Merge "Avoid C++ naming error" into main
diff --git a/android/sdk.go b/android/sdk.go
index 121470d..4bcbe2e 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -513,6 +513,9 @@
// SupportedLinkages returns the names of the linkage variants supported by this module.
SupportedLinkages() []string
+ // DisablesStrip returns true if the stripping needs to be disabled for this module.
+ DisablesStrip() bool
+
// ArePrebuiltsRequired returns true if prebuilts are required in the sdk snapshot, false
// otherwise.
ArePrebuiltsRequired() bool
@@ -618,6 +621,9 @@
// The names of linkage variants supported by this module.
SupportedLinkageNames []string
+ // StripDisabled returns true if the stripping needs to be disabled for this module.
+ StripDisabled bool
+
// When set to true BpPropertyNotRequired indicates that the member type does not require the
// property to be specifiable in an Android.bp file.
BpPropertyNotRequired bool
@@ -689,6 +695,10 @@
return b.SupportedLinkageNames
}
+func (b *SdkMemberTypeBase) DisablesStrip() bool {
+ return b.StripDisabled
+}
+
// registeredModuleExportsMemberTypes is the set of registered SdkMemberTypes for module_exports
// modules.
var registeredModuleExportsMemberTypes = &sdkRegistry{}
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go
index e6ebff2..a8d89b1 100644
--- a/apex/apex_singleton.go
+++ b/apex/apex_singleton.go
@@ -46,6 +46,9 @@
Command: "cat $out.rsp | xargs cat" +
// Only track non-external dependencies, i.e. those that end up in the binary
" | grep -v '(external)'" +
+ // Allowlist androidx deps
+ " | grep -v '^androidx\\.'" +
+ " | grep -v '^prebuilt_androidx\\.'" +
// Ignore comments in any of the files
" | grep -v '^#'" +
" | sort -u -f >$out",
diff --git a/cc/check.go b/cc/check.go
index 32d1f06..e3af3b2 100644
--- a/cc/check.go
+++ b/cc/check.go
@@ -45,7 +45,8 @@
ctx.PropertyErrorf(prop, "-Weverything is not allowed in Android.bp files. "+
"Build with `m ANDROID_TEMPORARILY_ALLOW_WEVERYTHING=true` to experiment locally with -Weverything.")
}
- } else if strings.HasPrefix(flag, "-target") || strings.HasPrefix(flag, "--target") {
+ } else if strings.HasPrefix(flag, "-target ") || strings.HasPrefix(flag, "--target ") ||
+ strings.HasPrefix(flag, "-target=") || strings.HasPrefix(flag, "--target=") {
ctx.PropertyErrorf(prop, "Bad flag: `%s`, use the correct target soong rule.", flag)
} else if strings.Contains(flag, " ") {
args := strings.Split(flag, " ")
@@ -63,6 +64,10 @@
if len(args) > 2 {
ctx.PropertyErrorf(prop, "`-mllvm` only takes one argument: `%s`", flag)
}
+ } else if args[0] == "-Xclang" {
+ if len(args) > 2 {
+ ctx.PropertyErrorf(prop, "`-Xclang` only takes one argument: `%s`", flag)
+ }
} else if strings.HasPrefix(flag, "-D") && strings.Contains(flag, "=") {
// Do nothing in this case.
// For now, we allow space characters in -DNAME=def form to allow use cases
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index b797764..fb2924a 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -69,6 +69,7 @@
"libc",
"libc++",
"libc++_static",
+ "libc++demangle",
"libc_musl",
"libc_musl_crtbegin_so",
"libc_musl_crtbegin_static",
@@ -96,9 +97,6 @@
}
type CmakeSnapshotProperties struct {
- // TODO: remove
- Modules []string
-
// Host modules to add to the snapshot package. Their dependencies are pulled in automatically.
Modules_host []string
@@ -289,7 +287,6 @@
deviceVendorVariations := append(deviceVariations, blueprint.Variation{"image", "vendor"})
hostVariations := ctx.Config().BuildOSTarget.Variations()
- ctx.AddVariationDependencies(hostVariations, cmakeSnapshotModuleTag, m.Properties.Modules...)
ctx.AddVariationDependencies(hostVariations, cmakeSnapshotModuleTag, m.Properties.Modules_host...)
ctx.AddVariationDependencies(deviceSystemVariations, cmakeSnapshotModuleTag, m.Properties.Modules_system...)
ctx.AddVariationDependencies(deviceVendorVariations, cmakeSnapshotModuleTag, m.Properties.Modules_vendor...)
diff --git a/cc/cmake_snapshot_test.go b/cc/cmake_snapshot_test.go
index 8fca6c1..b6f4369 100644
--- a/cc/cmake_snapshot_test.go
+++ b/cc/cmake_snapshot_test.go
@@ -38,7 +38,9 @@
result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, `
cc_cmake_snapshot {
name: "foo",
- modules: [],
+ modules_host: [],
+ modules_system: [],
+ modules_vendor: [],
prebuilts: ["libc++"],
include_sources: true,
}`)
@@ -65,7 +67,7 @@
result := android.GroupFixturePreparers(PrepareForIntegrationTestWithCc, xtra).RunTestWithBp(t, `
cc_cmake_snapshot {
name: "foo",
- modules: [
+ modules_system: [
"foo_binary",
],
include_sources: true,
@@ -99,7 +101,7 @@
cc_cmake_snapshot {
name: "foo",
- modules: [],
+ modules_system: [],
prebuilts: ["libc++"],
include_sources: true,
}`)
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index a65b1ba..1f71c19 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -31,6 +31,7 @@
SupportsSdk: true,
HostOsDependent: true,
SupportedLinkageNames: []string{"shared"},
+ StripDisabled: true,
},
prebuiltModuleType: "cc_prebuilt_library_shared",
}
diff --git a/java/app.go b/java/app.go
index f35e4c3..e8c9bfe 100644
--- a/java/app.go
+++ b/java/app.go
@@ -583,7 +583,11 @@
a.aapt.splitNames = a.appProperties.Package_splits
a.aapt.LoggingParent = String(a.overridableAppProperties.Logging_parent)
if a.Updatable() {
- a.aapt.defaultManifestVersion = android.DefaultUpdatableModuleVersion
+ if override := ctx.Config().Getenv("OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION"); override != "" {
+ a.aapt.defaultManifestVersion = override
+ } else {
+ a.aapt.defaultManifestVersion = android.DefaultUpdatableModuleVersion
+ }
}
// Use non final ids if we are doing optimized shrinking and are using R8.
diff --git a/java/app_test.go b/java/app_test.go
index 9e2d19e..5770ab4 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -519,6 +519,49 @@
testJavaError(t, `"libjni" .*: links "libbar" built against newer API version "current"`, bp)
}
+func TestUpdatableApps_ApplyDefaultUpdatableModuleVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ updatable: true,
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesContain(t,
+ "com.android.foo: expected manifest fixer to set override-placeholder-version to android.DefaultUpdatableModuleVersion",
+ foo.BuildParams.Args["args"],
+ fmt.Sprintf("--override-placeholder-version %s", android.DefaultUpdatableModuleVersion),
+ )
+}
+
+func TestUpdatableApps_ApplyOverrideApexManifestDefaultVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ android.FixtureMergeEnv(map[string]string{
+ "OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION": "1234",
+ }),
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ updatable: true,
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesContain(t,
+ "com.android.foo: expected manifest fixer to set override-placeholder-version to 1234",
+ foo.BuildParams.Args["args"],
+ "--override-placeholder-version 1234",
+ )
+}
+
func TestResourceDirs(t *testing.T) {
testCases := []struct {
name string
@@ -4556,3 +4599,44 @@
)
}
+
+func TestNotApplyDefaultUpdatableModuleVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesNotContain(t,
+ "com.android.foo: expected manifest fixer to not set override-placeholder-version",
+ foo.BuildParams.Args["args"],
+ "--override-placeholder-version",
+ )
+}
+
+func TestNotApplyOverrideApexManifestDefaultVersion(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ android.FixtureMergeEnv(map[string]string{
+ "OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION": "1234",
+ }),
+ ).RunTestWithBp(t, `
+ android_app {
+ name: "com.android.foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ min_sdk_version: "31",
+ }
+ `)
+ foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer")
+ android.AssertStringDoesNotContain(t,
+ "com.android.foo: expected manifest fixer to not set override-placeholder-version",
+ foo.BuildParams.Args["args"],
+ "--override-placeholder-version",
+ )
+}
diff --git a/java/lint_defaults.txt b/java/lint_defaults.txt
index 262e184..b8ce95c 100644
--- a/java/lint_defaults.txt
+++ b/java/lint_defaults.txt
@@ -123,6 +123,9 @@
--warning_check SupportAnnotationUsage
--warning_check UniqueConstants
--warning_check UseSdkSuppress
+# TODO(b/303434307) The intent is for this to be set to error severity
+# once existing violations are cleaned up
+--warning_check FlaggedApi
--warning_check ExactAlarm
--warning_check ExpiredTargetSdkVersion
diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go
index 3a8d3cf..87c0814 100644
--- a/linkerconfig/linkerconfig.go
+++ b/linkerconfig/linkerconfig.go
@@ -104,7 +104,7 @@
// Secondly, if there's provideLibs gathered from provideModules, append them
var provideLibs []string
for _, m := range provideModules {
- if c, ok := m.(*cc.Module); ok && cc.IsStubTarget(c) {
+ if c, ok := m.(*cc.Module); ok && (cc.IsStubTarget(c) || c.HasLlndkStubs()) {
for _, ps := range c.PackagingSpecs() {
provideLibs = append(provideLibs, ps.FileName())
}
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index 9490d12..c9e20b3 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -148,6 +148,9 @@
srcs: ["linux_glibc/x86_64/lib/sdkmember.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -368,6 +371,9 @@
srcs: ["arm/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -455,6 +461,9 @@
},
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -697,6 +706,9 @@
srcs: ["x86_64/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -824,6 +836,9 @@
export_include_dirs: ["arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -932,6 +947,9 @@
srcs: ["arm/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -950,6 +968,9 @@
srcs: ["arm/lib/myothernativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -967,6 +988,9 @@
srcs: ["arm/lib/mysystemnativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -1041,6 +1065,9 @@
export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -1127,6 +1154,9 @@
srcs: ["windows/x86_64/lib/mynativelib.dll"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -2021,6 +2051,9 @@
srcs: ["arm/lib/sslnil.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -2038,6 +2071,9 @@
srcs: ["arm/lib/sslempty.so"],
},
},
+ strip: {
+ none: true,
+ },
}
cc_prebuilt_library_shared {
@@ -2055,6 +2091,9 @@
srcs: ["arm/lib/sslnonempty.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`))
@@ -2114,6 +2153,9 @@
srcs: ["linux_glibc/x86/lib/sslvariants.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
)
@@ -2171,6 +2213,9 @@
srcs: ["arm/lib/stubslib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`))
}
@@ -2242,6 +2287,9 @@
srcs: ["linux_glibc/x86/lib/stubslib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
)
@@ -2298,6 +2346,9 @@
srcs: ["linux_glibc/x86/lib/mylib-host.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
@@ -2355,6 +2406,9 @@
srcs: ["arm/lib/mynativelib.so"],
},
},
+ strip: {
+ none: true,
+ },
}
`),
checkAllCopyRules(`
diff --git a/sdk/update.go b/sdk/update.go
index 0a97fd9..198c8d4 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -434,6 +434,14 @@
prebuiltModule := memberType.AddPrebuiltModule(memberCtx, member)
s.createMemberSnapshot(memberCtx, member, prebuiltModule.(*bpModule))
+ // Set stripper to none to skip stripping for generated snapshots.
+ // Mainline prebuilts (cc_prebuilt_library_shared) are not strippable in older platforms.
+ // Thus, stripping should be skipped when being used as prebuilts.
+ if memberType.DisablesStrip() {
+ stripPropertySet := prebuiltModule.(*bpModule).AddPropertySet("strip")
+ stripPropertySet.AddProperty("none", true)
+ }
+
if member.memberType != android.LicenseModuleSdkMemberType && !builder.isInternalMember(member.name) {
// More exceptions
// 1. Skip BCP and SCCP fragments
diff --git a/ui/build/config.go b/ui/build/config.go
index 1d5269c..52c5e23 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -313,6 +313,7 @@
"DISPLAY",
"GREP_OPTIONS",
"JAVAC",
+ "LEX",
"NDK_ROOT",
"POSIXLY_CORRECT",