Handle simple prebuilt static libraries from bazel
Test: generate & sync BUILD files via bp2build && mixed build droid
Bug: 184192619
Change-Id: I27f0d76c88cbff25f3c7a805f3dfbb1eeaf8e771
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 5ac6924..28c0e53 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -69,6 +69,10 @@
// Returns the results of GetOutputFiles and GetCcObjectFiles in a single query (in that order).
GetOutputFilesAndCcObjectFiles(label string, archType ArchType) ([]string, []string, bool)
+ // GetPrebuiltCcStaticLibraryFiles returns paths to prebuilt cc static libraries, and whether the
+ // results were available
+ GetPrebuiltCcStaticLibraryFiles(label string, archType ArchType) ([]string, bool)
+
// ** End cquery methods
// Issues commands to Bazel to receive results for all cquery requests
@@ -126,6 +130,11 @@
return result, result, ok
}
+func (m MockBazelContext) GetPrebuiltCcStaticLibraryFiles(label string, archType ArchType) ([]string, bool) {
+ result, ok := m.AllFiles[label]
+ return result, ok
+}
+
func (m MockBazelContext) InvokeBazel() error {
panic("unimplemented")
}
@@ -169,6 +178,19 @@
return outputFiles, ccObjects, ok
}
+// GetPrebuiltCcStaticLibraryFiles returns a slice of prebuilt static libraries for the given
+// label/archType if there are query results; otherwise, it enqueues the query and returns false.
+func (bazelCtx *bazelContext) GetPrebuiltCcStaticLibraryFiles(label string, archType ArchType) ([]string, bool) {
+ result, ok := bazelCtx.cquery(label, cquery.GetPrebuiltCcStaticLibraryFiles, archType)
+ if !ok {
+ return nil, false
+ }
+
+ bazelOutput := strings.TrimSpace(result)
+ ret := cquery.GetPrebuiltCcStaticLibraryFiles.ParseResult(bazelOutput)
+ return ret, ok
+}
+
func (n noopBazelContext) GetOutputFiles(label string, archType ArchType) ([]string, bool) {
panic("unimplemented")
}
@@ -177,6 +199,10 @@
panic("unimplemented")
}
+func (n noopBazelContext) GetPrebuiltCcStaticLibraryFiles(label string, archType ArchType) ([]string, bool) {
+ panic("unimplemented")
+}
+
func (n noopBazelContext) InvokeBazel() error {
panic("unimplemented")
}