Merge "stem property of java modules are propagated to Make"
diff --git a/java/androidmk.go b/java/androidmk.go
index 9e9b277..cd91b46 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -52,6 +52,7 @@
if r := library.deviceProperties.Target.Hostdex.Required; len(r) > 0 {
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(r, " "))
}
+ fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", library.Stem()+"-hostdex")
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
}
}
@@ -102,6 +103,7 @@
if library.proguardDictionary != nil {
entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", library.proguardDictionary)
}
+ entries.SetString("LOCAL_MODULE_STEM", library.Stem())
},
},
ExtraFooters: []android.AndroidMkExtraFootersFunc{
@@ -160,6 +162,7 @@
entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.combinedClasspathFile)
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.combinedClasspathFile)
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion())
+ entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
},
},
}
@@ -187,6 +190,7 @@
if len(prebuilt.dexpreopter.builtInstalled) > 0 {
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", prebuilt.dexpreopter.builtInstalled)
}
+ entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
},
},
}
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 2a142ba..3d7f36c 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -73,7 +73,7 @@
for i, m := range image.modules {
name := image.name
if i != 0 {
- name += "-" + m
+ name += "-" + stemOf(m)
}
for _, ext := range exts {
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index 429bbdb..b3b1317 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -96,6 +96,16 @@
return targets
}
+func stemOf(moduleName string) string {
+ // b/139391334: the stem of framework-minus-apex is framework
+ // This is hard coded here until we find a good way to query the stem
+ // of a module before any other mutators are run
+ if moduleName == "framework-minus-apex" {
+ return "framework"
+ }
+ return moduleName
+}
+
func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string,
needZip bool) bootImageConfig {
return ctx.Config().Once(key, func() interface{} {
@@ -110,18 +120,18 @@
for _, m := range artModules {
bootLocations = append(bootLocations,
- filepath.Join("/apex/com.android.art/javalib", m+".jar"))
+ filepath.Join("/apex/com.android.art/javalib", stemOf(m)+".jar"))
}
for _, m := range frameworkModules {
bootLocations = append(bootLocations,
- filepath.Join("/system/framework", m+".jar"))
+ filepath.Join("/system/framework", stemOf(m)+".jar"))
}
// The path to bootclasspath dex files needs to be known at module GenerateAndroidBuildAction time, before
// the bootclasspath modules have been compiled. Set up known paths for them, the singleton rules will copy
// them there.
- // TODO: use module dependencies instead
+ // TODO(b/143682396): use module dependencies instead
var bootDexPaths android.WritablePaths
for _, m := range imageModules {
bootDexPaths = append(bootDexPaths,
diff --git a/java/java.go b/java/java.go
index 947aa8c..d7077d1 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1602,6 +1602,10 @@
return depTag == staticLibTag
}
+func (j *Module) Stem() string {
+ return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
+}
+
//
// Java libraries (.jar file)
//
@@ -1631,8 +1635,7 @@
}
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework",
- proptools.StringDefault(j.deviceProperties.Stem, ctx.ModuleName())+".jar")
+ j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar")
j.dexpreopter.isSDKLibrary = j.deviceProperties.IsSDKLibrary
j.dexpreopter.isInstallable = Bool(j.properties.Installable)
j.dexpreopter.uncompressedDex = shouldUncompressDex(ctx, &j.dexpreopter)
@@ -1994,6 +1997,10 @@
return j.prebuilt.Name(j.ModuleBase.Name())
}
+func (j *Import) Stem() string {
+ return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
+}
+
func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
}
@@ -2001,7 +2008,7 @@
func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
jars := android.PathsForModuleSrc(ctx, j.properties.Jars)
- jarName := proptools.StringDefault(j.properties.Stem, ctx.ModuleName()) + ".jar"
+ jarName := j.Stem() + ".jar"
outputFile := android.PathForModuleOut(ctx, "combined", jarName)
TransformJarsToJar(ctx, outputFile, "for prebuilts", jars, android.OptionalPath{},
false, j.properties.Exclude_files, j.properties.Exclude_dirs)
@@ -2178,13 +2185,16 @@
return j.prebuilt.Name(j.ModuleBase.Name())
}
+func (j *DexImport) Stem() string {
+ return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
+}
+
func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(j.properties.Jars) != 1 {
ctx.PropertyErrorf("jars", "exactly one jar must be provided")
}
- j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework",
- proptools.StringDefault(j.properties.Stem, ctx.ModuleName())+".jar")
+ j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar")
j.dexpreopter.isInstallable = true
j.dexpreopter.uncompressedDex = shouldUncompressDex(ctx, &j.dexpreopter)