From 1bff0349d4954284e0e6fbcab2ace95e4be15766 Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Tue, 17 Jan 2023 20:40:22 +0000 Subject: 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 --- java/androidmk.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'java/androidmk.go') diff --git a/java/androidmk.go b/java/androidmk.go index a4dac80d4..148d7c276 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -733,3 +733,22 @@ func (apkSet *AndroidAppSet) AndroidMkEntries() []android.AndroidMkEntries { }, } } + +func (al *ApiLibrary) AndroidMkEntries() []android.AndroidMkEntries { + var entriesList []android.AndroidMkEntries + + entriesList = append(entriesList, android.AndroidMkEntries{ + Class: "JAVA_LIBRARIES", + OutputFile: android.OptionalPathForPath(al.stubsJar), + Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", + ExtraEntries: []android.AndroidMkExtraEntriesFunc{ + func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { + entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true) + entries.SetPath("LOCAL_SOONG_CLASSES_JAR", al.stubsJar) + entries.SetPath("LOCAL_SOONG_HEADER_JAR", al.stubsJar) + }, + }, + }) + + return entriesList +} -- cgit v1.2.3-59-g8ed1b