aboutsummaryrefslogtreecommitdiffstats
path: root/java/java.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2020-06-24 16:22:38 +0100
committerPaul Duffin <paulduffin@google.com>2020-06-26 18:14:18 +0100
commitc4422106a7cf4731e27d664646bc0d57ad3f37fa (patch)
tree3ab8dd6f8c982103b80b2789f262e7f844ea1dbb /java/java.go
parent82f62fdac4ccb234585751b3631567226e8f5c58 (diff)
downloadbuild_soong-c4422106a7cf4731e27d664646bc0d57ad3f37fa.tar.gz
build_soong-c4422106a7cf4731e27d664646bc0d57ad3f37fa.tar.bz2
build_soong-c4422106a7cf4731e27d664646bc0d57ad3f37fa.zip
Apply hiddenapi encoding to java_sdk_library .impl
Adds a ConfigurationName property, and ConfigurationName() method that allows a library to separate its name (e.g. framework-tethering.impl) from the name used in the build configuration, e.g. ctx.Config().BootJars(). Updates hiddenapi processing to use ConfigurationName() instead of ctx.ModuleName(). Changes java_sdk_library to set the ConfigurationName property of the implementation library to the name of the module instead of <module>.impl so that it will match the name in the boot jars list. Bug: 159683330 Test: m framework-tethering dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l Verify that there are >0 hiddenapi entries. Add java_sdk_library_import prefer=true for framework-tethering and repeat the above to verify that there are 0 hiddenapi entries. Apply this change, repeat above and verify that there are the same # of entries as before. Remove the prebuilt for framework-tethering Repeat the above and verify that there is no change to the # of entries Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go
index 90e9b1f6..5632ff58 100644
--- a/java/java.go
+++ b/java/java.go
@@ -342,6 +342,12 @@ type CompilerDeviceProperties struct {
// otherwise provides defaults libraries to add to the bootclasspath.
System_modules *string
+ // The name of the module as used in build configuration.
+ //
+ // Allows a library to separate its actual name from the name used in
+ // build configuration, e.g.ctx.Config().BootJars().
+ ConfigurationName *string `blueprint:"mutated"`
+
// set the name of the output
Stem *string
@@ -1617,8 +1623,11 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
return
}
+ configurationName := j.ConfigurationName()
+ primary := configurationName == ctx.ModuleName()
+
// Hidden API CSV generation and dex encoding
- dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile,
+ dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, configurationName, primary, dexOutputFile, j.implementationJarFile,
proptools.Bool(j.deviceProperties.Uncompress_dex))
// merge dex jar with resources if necessary
@@ -1872,6 +1881,10 @@ func (j *Module) Stem() string {
return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
}
+func (j *Module) ConfigurationName() string {
+ return proptools.StringDefault(j.deviceProperties.ConfigurationName, j.BaseModuleName())
+}
+
func (j *Module) JacocoReportClassesFile() android.Path {
return j.jacocoReportClassesFile
}