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/sdk_version.go b/android/sdk_version.go
index 7ace638..1e1fe10 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -94,8 +94,9 @@
// not check if either module exists.
// TODO: Return .txt (single-tree or multi-tree equivalents) based on config
func JavaLibraryNameFromText(c Config, name string) string {
- // This returns the default for now.
- // TODO: Implement this
+ if c.BuildFromTextStub() {
+ return name + ".from-text"
+ }
return name
}