From 0b2387551bf3ed15cb41eeacaa8cd0286db43349 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Tue, 29 Oct 2019 11:23:10 +0900 Subject: stem property of java modules are propagated to Make 62c7829595c0df53e96addcd347c11ac01012eee introduced the new stem property to java modules, but it wasn't propagated to Make. Fixing the problem. This change also fixes a problem that (module name) == (file name) is assumed in dexpreopt_config.go, which no longer is the case. A mutator runs to build a map from module name to its stem. The map is then used when filling up the file paths in the bootImageConfig struct. Bug: 139391334 Bug: 143494499 Test: m Test: BootImageProfileTest Change-Id: Idbc894f877692401471130de6cbfe5e0dd129da9 --- java/java.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index 947aa8caa..d7077d1bb 100644 --- a/java/java.go +++ b/java/java.go @@ -1602,6 +1602,10 @@ func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Modu 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 shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bo } 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 @@ func (j *Import) Name() string { 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) DepsMutator(ctx android.BottomUpMutatorContext) { 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 @@ func (j *DexImport) Name() string { 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) -- cgit v1.2.3-59-g8ed1b