Make android_app.stem overridable
override_android_app can set "stem" property to set the APK name.
Bug: 193504286
Test: m (soong test)
Change-Id: I9ad66ea28bd1b030cb2c588d1f070d72e62ab1c7
diff --git a/java/base.go b/java/base.go
index 7cd71a2..bc8da9a 100644
--- a/java/base.go
+++ b/java/base.go
@@ -253,9 +253,6 @@
// otherwise provides defaults libraries to add to the bootclasspath.
System_modules *string
- // set the name of the output
- Stem *string
-
IsSDKLibrary bool `blueprint:"mutated"`
// If true, generate the signature file of APK Signing Scheme V4, along side the signed APK file.
@@ -267,6 +264,15 @@
SyspropPublicStub string `blueprint:"mutated"`
}
+// Device properties that can be overridden by overriding module (e.g. override_android_app)
+type OverridableDeviceProperties struct {
+ // set the name of the output. If not set, `name` is used.
+ // To override a module with this property set, overriding module might need to set this as well.
+ // Otherwise, both the overridden and the overriding modules will have the same output name, which
+ // can cause the duplicate output error.
+ Stem *string
+}
+
// Functionality common to Module and Import
//
// It is embedded in Module so its functionality can be used by methods in Module
@@ -389,6 +395,8 @@
protoProperties android.ProtoProperties
deviceProperties DeviceProperties
+ overridableDeviceProperties OverridableDeviceProperties
+
// jar file containing header classes including static library dependencies, suitable for
// inserting into the bootclasspath/classpath of another compile
headerJarFile android.Path
@@ -544,6 +552,7 @@
j.addHostProperties()
j.AddProperties(
&j.deviceProperties,
+ &j.overridableDeviceProperties,
&j.dexer.dexProperties,
&j.dexpreoptProperties,
&j.linter.properties,
@@ -1671,7 +1680,7 @@
}
func (j *Module) Stem() string {
- return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
+ return proptools.StringDefault(j.overridableDeviceProperties.Stem, j.Name())
}
func (j *Module) JacocoReportClassesFile() android.Path {