Remove product-specific flags from android_library modules
Static android libraries should not get the product-specific flags. Bug: 73724997 Test: m checkbuild Change-Id: I89e8c0a3fb788b18ee6603e9d21c9b9a5275f42f
This commit is contained in:
parent
d09b0b653b
commit
e78dcd313c
18
java/aar.go
18
java/aar.go
|
@ -76,14 +76,11 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkVersion string) (flags [
|
|||
|
||||
hasVersionCode := false
|
||||
hasVersionName := false
|
||||
hasProduct := false
|
||||
for _, f := range a.aaptProperties.Aaptflags {
|
||||
if strings.HasPrefix(f, "--version-code") {
|
||||
hasVersionCode = true
|
||||
} else if strings.HasPrefix(f, "--version-name") {
|
||||
hasVersionName = true
|
||||
} else if strings.HasPrefix(f, "--product") {
|
||||
hasProduct = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,21 +137,6 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkVersion string) (flags [
|
|||
linkFlags = append(linkFlags, "--min-sdk-version "+sdkVersion)
|
||||
linkFlags = append(linkFlags, "--target-sdk-version "+sdkVersion)
|
||||
|
||||
// Product characteristics
|
||||
if !hasProduct && len(ctx.Config().ProductAAPTCharacteristics()) > 0 {
|
||||
linkFlags = append(linkFlags, "--product", ctx.Config().ProductAAPTCharacteristics())
|
||||
}
|
||||
|
||||
// Product AAPT config
|
||||
for _, aaptConfig := range ctx.Config().ProductAAPTConfig() {
|
||||
linkFlags = append(linkFlags, "-c", aaptConfig)
|
||||
}
|
||||
|
||||
// Product AAPT preferred config
|
||||
if len(ctx.Config().ProductAAPTPreferredConfig()) > 0 {
|
||||
linkFlags = append(linkFlags, "--preferred-density", ctx.Config().ProductAAPTPreferredConfig())
|
||||
}
|
||||
|
||||
// Version code
|
||||
if !hasVersionCode {
|
||||
linkFlags = append(linkFlags, "--version-code", ctx.Config().PlatformSdkVersion())
|
||||
|
|
22
java/app.go
22
java/app.go
|
@ -86,6 +86,28 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
a.properties.Instrument = true
|
||||
}
|
||||
|
||||
hasProduct := false
|
||||
for _, f := range a.aaptProperties.Aaptflags {
|
||||
if strings.HasPrefix(f, "--product") {
|
||||
hasProduct = true
|
||||
}
|
||||
}
|
||||
|
||||
// Product characteristics
|
||||
if !hasProduct && len(ctx.Config().ProductAAPTCharacteristics()) > 0 {
|
||||
linkFlags = append(linkFlags, "--product", ctx.Config().ProductAAPTCharacteristics())
|
||||
}
|
||||
|
||||
// Product AAPT config
|
||||
for _, aaptConfig := range ctx.Config().ProductAAPTConfig() {
|
||||
linkFlags = append(linkFlags, "-c", aaptConfig)
|
||||
}
|
||||
|
||||
// Product AAPT preferred config
|
||||
if len(ctx.Config().ProductAAPTPreferredConfig()) > 0 {
|
||||
linkFlags = append(linkFlags, "--preferred-density", ctx.Config().ProductAAPTPreferredConfig())
|
||||
}
|
||||
|
||||
// TODO: LOCAL_PACKAGE_OVERRIDES
|
||||
// $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
|
||||
|
||||
|
|
Loading…
Reference in New Issue