Modify Soong to utilize from-text android.jar in build
Context
- from-text android.jar files are built using Metalava, and these can be
utilized in `decodeSdkDep` so that any modules that depends on APIs
can be compiled using from-text android.jars
- This change removes dependency on source java files when compiling
stub android.jar files
Implementation
- Modify java_api_library module to create system modules using the
generated android.jar
- Replace modules in decodeSdkDep to link against java_api_library
modules
- Add --build-from-text-stub flag to hide the feature behind a flag
Test: m --build-from-text-stub
Bug: 271154441
Change-Id: I104df595edc65c0006820d5ae5b15f1fb167e190
diff --git a/android/config.go b/android/config.go
index e0b661b..e634647 100644
--- a/android/config.go
+++ b/android/config.go
@@ -100,6 +100,8 @@
BazelForceEnabledModules string
UseBazelProxy bool
+
+ BuildFromTextStub bool
}
// Build modes that soong_build can run as.
@@ -272,6 +274,10 @@
// If true, for any requests to Bazel, communicate with a Bazel proxy using
// unix sockets, instead of spawning Bazel as a subprocess.
UseBazelProxy bool
+
+ // If buildFromTextStub is true then the Java API stubs are
+ // built from the signature text files, not the source Java files.
+ buildFromTextStub bool
}
type deviceConfig struct {
@@ -466,6 +472,8 @@
MultitreeBuild: cmdArgs.MultitreeBuild,
UseBazelProxy: cmdArgs.UseBazelProxy,
+
+ buildFromTextStub: cmdArgs.BuildFromTextStub,
}
config.deviceConfig = &deviceConfig{
@@ -1873,3 +1881,7 @@
s.String(),
version)
}
+
+func (c *config) BuildFromTextStub() bool {
+ return c.buildFromTextStub
+}