Merge "Export system headers for SdkVariants as well"
diff --git a/apex/androidmk.go b/apex/androidmk.go
index b76f6bd..aadccb7 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -317,14 +317,14 @@
func (a *apexBundle) androidMkForType() android.AndroidMkData {
return android.AndroidMkData{
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
- moduleNames := []string{}
apexType := a.properties.ApexType
- if a.installable() {
- apexName := proptools.StringDefault(a.properties.Apex_name, name)
- moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir, data)
- }
if apexType == flattenedApex {
+ var moduleNames []string = nil
+ if a.installable() {
+ apexName := proptools.StringDefault(a.properties.Apex_name, name)
+ moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir, data)
+ }
// Only image APEXes can be flattened.
fmt.Fprintln(w, "\ninclude $(CLEAR_VARS) # apex.apexBundle.flat")
fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
@@ -366,7 +366,7 @@
}
android.AndroidMkEmitAssignList(w, "LOCAL_OVERRIDES_MODULES", a.overridableProperties.Overrides)
- a.writeRequiredModules(w, moduleNames)
+ a.writeRequiredModules(w, nil)
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 33fce7c..28097aa 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -526,7 +526,6 @@
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n")
ensureNotContains(t, androidMk, "LOCAL_MODULE := mylib.com.android.myapex\n")
optFlags := apexRule.Args["opt_flags"]
@@ -2996,7 +2995,7 @@
var builder strings.Builder
data.Custom(&builder, name, prefix, "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := libc++.vendor.myapex:64 mylib.vendor.myapex:64 apex_manifest.pb.myapex apex_pubkey.myapex libc.vendor libm.vendor libdl.vendor\n")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := libc.vendor libm.vendor libdl.vendor\n")
}
func TestAndroidMkWritesCommonProperties(t *testing.T) {
@@ -4153,7 +4152,6 @@
var builder strings.Builder
data.Custom(&builder, name, prefix, "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n")
ensureNotContains(t, androidMk, "LOCAL_MODULE := mylib.com.android.myapex\n")
}
@@ -5687,12 +5685,6 @@
var builder strings.Builder
data.Custom(&builder, name, prefix, "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_MODULE := mytest.myapex\n")
- ensureContains(t, androidMk, "LOCAL_MODULE := mytest1.myapex\n")
- ensureContains(t, androidMk, "LOCAL_MODULE := mytest2.myapex\n")
- ensureContains(t, androidMk, "LOCAL_MODULE := mytest3.myapex\n")
- ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.myapex\n")
- ensureContains(t, androidMk, "LOCAL_MODULE := apex_pubkey.myapex\n")
ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n")
flatBundle := ctx.ModuleForTests("myapex", "android_common_myapex_flattened").Module().(*apexBundle)
@@ -5726,7 +5718,7 @@
var builder strings.Builder
mk.Custom(&builder, ab.Name(), "TARGET_", "", mk)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := apex_manifest.pb.myapex apex_pubkey.myapex myapex.flattened\n")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := myapex.flattened\n")
}
func TestErrorsIfDepsAreNotEnabled(t *testing.T) {
@@ -6519,12 +6511,6 @@
var builder strings.Builder
data.Custom(&builder, name, "TARGET_", "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_MODULE := override_app.override_myapex")
- ensureContains(t, androidMk, "LOCAL_MODULE := overrideBpf.o.override_myapex")
- ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.override_myapex")
- ensureContains(t, androidMk, "LOCAL_MODULE := override_bcplib.override_myapex")
- ensureContains(t, androidMk, "LOCAL_MODULE := override_systemserverlib.override_myapex")
- ensureContains(t, androidMk, "LOCAL_MODULE := override_java_library.override_myapex")
ensureContains(t, androidMk, "LOCAL_MODULE_STEM := override_myapex.apex")
ensureContains(t, androidMk, "LOCAL_OVERRIDES_MODULES := unknownapex myapex")
ensureNotContains(t, androidMk, "LOCAL_MODULE := app.myapex")
@@ -7116,7 +7102,7 @@
var builder strings.Builder
data.Custom(&builder, name, prefix, "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := mylib.myapex:64 apex_manifest.pb.myapex apex_pubkey.myapex a b\n")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := a b\n")
ensureContains(t, androidMk, "LOCAL_HOST_REQUIRED_MODULES := c d\n")
ensureContains(t, androidMk, "LOCAL_TARGET_REQUIRED_MODULES := e f\n")
}
@@ -7287,6 +7273,9 @@
"myapex",
"//apex_available:platform",
],
+ stubs: {
+ versions: ["current"],
+ },
}
`)
@@ -7296,11 +7285,10 @@
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String()
// `myotherlib` is added to `myapex` as symlink
- ensureContains(t, androidMk, "LOCAL_MODULE := mylib.myapex\n")
ensureNotContains(t, androidMk, "LOCAL_MODULE := prebuilt_myotherlib.myapex\n")
ensureNotContains(t, androidMk, "LOCAL_MODULE := myotherlib.myapex\n")
// `myapex` should have `myotherlib` in its required line, not `prebuilt_myotherlib`
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := mylib.myapex:64 myotherlib:64 apex_manifest.pb.myapex apex_pubkey.myapex\n")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := myotherlib\n")
}
func TestApexWithJniLibs(t *testing.T) {
@@ -8813,7 +8801,7 @@
// The make level dependency needs to be on otherlib - prebuilt_otherlib isn't
// a thing there.
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := libc++:64 mylib.myapex:64 apex_manifest.pb.myapex apex_pubkey.myapex otherlib\n")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := otherlib\n")
}
func TestExcludeDependency(t *testing.T) {
@@ -9207,7 +9195,7 @@
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := foo.myapex apex_manifest.pb.myapex apex_pubkey.myapex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.odex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.vdex\n")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.odex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.vdex\n")
}
func TestAndroidMk_DexpreoptBuiltInstalledForApex_Prebuilt(t *testing.T) {
@@ -9283,7 +9271,7 @@
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := foo.myapex apex_manifest.pb.myapex apex_pubkey.myapex otherapex")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := otherapex")
}
func TestAndroidMk_RequiredDeps(t *testing.T) {
@@ -9307,7 +9295,7 @@
var builder strings.Builder
data.Custom(&builder, bundle.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String()
- ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := apex_manifest.pb.myapex apex_pubkey.myapex foo\n")
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES := foo\n")
flattenedBundle := ctx.ModuleForTests("myapex", "android_common_myapex_flattened").Module().(*apexBundle)
flattenedBundle.requiredDeps = append(flattenedBundle.requiredDeps, "foo")
diff --git a/bazel/properties.go b/bazel/properties.go
index 8a6d1b0..0fca60b 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -814,6 +814,16 @@
return false
}
+// HasAxisSpecificValues returns true if the attribute contains axis specific label list values from a given axis
+func (lla LabelListAttribute) HasAxisSpecificValues(axis ConfigurationAxis) bool {
+ for _, values := range lla.ConfigurableValues[axis] {
+ if !values.IsNil() {
+ return true
+ }
+ }
+ return false
+}
+
// IsEmpty returns true if the attribute has no values under any configuration.
func (lla LabelListAttribute) IsEmpty() bool {
if len(lla.Value.Includes) > 0 {
diff --git a/bp2build/aar_conversion_test.go b/bp2build/aar_conversion_test.go
index df7cced..5f93eb7 100644
--- a/bp2build/aar_conversion_test.go
+++ b/bp2build/aar_conversion_test.go
@@ -133,6 +133,7 @@
"exports": `[":static_import_dep"]`,
},
),
+ MakeNeverlinkDuplicateTarget("android_library", "TestImport"),
},
},
)
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index f924d00..052bc32 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -1806,6 +1806,11 @@
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Blueprint: soongCcLibraryPreamble + `
cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library {
name: "target_linux_bionic_empty",
target: {
linux_bionic: {
@@ -1816,7 +1821,10 @@
}
`,
ExpectedBazelTargets: makeCcLibraryTargets("target_linux_bionic_empty", AttrNameToString{
- "system_dynamic_deps": `[]`,
+ "system_dynamic_deps": `select({
+ "//build/bazel/platforms/os:linux_musl": [":libc_musl"],
+ "//conditions:default": [],
+ })`,
}),
},
)
@@ -1829,6 +1837,11 @@
ModuleTypeUnderTestFactory: cc.LibraryFactory,
Blueprint: soongCcLibraryPreamble + `
cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library {
name: "target_bionic_empty",
target: {
bionic: {
@@ -1839,12 +1852,68 @@
}
`,
ExpectedBazelTargets: makeCcLibraryTargets("target_bionic_empty", AttrNameToString{
- "system_dynamic_deps": `[]`,
+ "system_dynamic_deps": `select({
+ "//build/bazel/platforms/os:linux_musl": [":libc_musl"],
+ "//conditions:default": [],
+ })`,
}),
},
)
}
+func TestCcLibrary_SystemSharedLibsMuslEmpty(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library system_shared_lib empty for musl variant",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: soongCcLibraryPreamble + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library {
+ name: "target_musl_empty",
+ target: {
+ musl: {
+ system_shared_libs: [],
+ },
+ },
+ include_build_directory: false,
+}
+`,
+ ExpectedBazelTargets: makeCcLibraryTargets("target_musl_empty", AttrNameToString{
+ "system_dynamic_deps": `[]`,
+ }),
+ })
+}
+
+func TestCcLibrary_SystemSharedLibsLinuxMuslEmpty(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library system_shared_lib empty for linux_musl variant",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: soongCcLibraryPreamble + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library {
+ name: "target_linux_musl_empty",
+ target: {
+ linux_musl: {
+ system_shared_libs: [],
+ },
+ },
+ include_build_directory: false,
+}
+`,
+ ExpectedBazelTargets: makeCcLibraryTargets("target_linux_musl_empty", AttrNameToString{
+ "system_dynamic_deps": `[]`,
+ }),
+ })
+}
func TestCcLibrary_SystemSharedLibsSharedAndRoot(t *testing.T) {
runCcLibraryTestCase(t, Bp2buildTestCase{
Description: "cc_library system_shared_libs set for shared and root",
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index 767f4ad..d5256f6 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -1310,6 +1310,11 @@
runCcLibraryStaticTestCase(t, Bp2buildTestCase{
Description: "cc_library_static system_shared_lib empty for bionic variant",
Blueprint: soongCcLibraryStaticPreamble + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
cc_library_static {
name: "target_bionic_empty",
target: {
@@ -1322,7 +1327,10 @@
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_library_static", "target_bionic_empty", AttrNameToString{
- "system_dynamic_deps": `[]`,
+ "system_dynamic_deps": `select({
+ "//build/bazel/platforms/os:linux_musl": [":libc_musl"],
+ "//conditions:default": [],
+ })`,
}),
},
})
@@ -1336,6 +1344,11 @@
runCcLibraryStaticTestCase(t, Bp2buildTestCase{
Description: "cc_library_static system_shared_lib empty for linux_bionic variant",
Blueprint: soongCcLibraryStaticPreamble + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
cc_library_static {
name: "target_linux_bionic_empty",
target: {
@@ -1348,6 +1361,63 @@
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_library_static", "target_linux_bionic_empty", AttrNameToString{
+ "system_dynamic_deps": `select({
+ "//build/bazel/platforms/os:linux_musl": [":libc_musl"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
+
+func TestStaticLibrary_SystemSharedLibsMuslEmpty(t *testing.T) {
+ runCcLibraryStaticTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_static system_shared_lib empty for musl variant",
+ Blueprint: soongCcLibraryStaticPreamble + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library_static {
+ name: "target_musl_empty",
+ target: {
+ musl: {
+ system_shared_libs: [],
+ },
+ },
+ include_build_directory: false,
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "target_musl_empty", AttrNameToString{
+ "system_dynamic_deps": `[]`,
+ }),
+ },
+ })
+}
+
+func TestStaticLibrary_SystemSharedLibsLinuxMuslEmpty(t *testing.T) {
+ runCcLibraryStaticTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_static system_shared_lib empty for linux_musl variant",
+ Blueprint: soongCcLibraryStaticPreamble + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library_static {
+ name: "target_linux_musl_empty",
+ target: {
+ linux_musl: {
+ system_shared_libs: [],
+ },
+ },
+ include_build_directory: false,
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "target_linux_musl_empty", AttrNameToString{
"system_dynamic_deps": `[]`,
}),
},
@@ -1359,6 +1429,11 @@
Description: "cc_library_static system_shared_libs set for bionic variant",
Blueprint: soongCcLibraryStaticPreamble +
simpleModuleDoNotConvertBp2build("cc_library", "libc") + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
cc_library_static {
name: "target_bionic",
target: {
@@ -1374,6 +1449,7 @@
"system_dynamic_deps": `select({
"//build/bazel/platforms/os:android": [":libc"],
"//build/bazel/platforms/os:linux_bionic": [":libc"],
+ "//build/bazel/platforms/os:linux_musl": [":libc_musl"],
"//conditions:default": [],
})`,
}),
@@ -1387,6 +1463,11 @@
Blueprint: soongCcLibraryStaticPreamble +
simpleModuleDoNotConvertBp2build("cc_library", "libc") +
simpleModuleDoNotConvertBp2build("cc_library", "libm") + `
+cc_library {
+ name: "libc_musl",
+ bazel_module: { bp2build_available: false },
+}
+
cc_library_static {
name: "target_linux_bionic",
system_shared_libs: ["libc"],
@@ -1402,6 +1483,7 @@
MakeBazelTarget("cc_library_static", "target_linux_bionic", AttrNameToString{
"system_dynamic_deps": `[":libc"] + select({
"//build/bazel/platforms/os:linux_bionic": [":libm"],
+ "//build/bazel/platforms/os:linux_musl": [":libc_musl"],
"//conditions:default": [],
})`,
}),
diff --git a/bp2build/symlink_forest.go b/bp2build/symlink_forest.go
index 667b952..37188f1 100644
--- a/bp2build/symlink_forest.go
+++ b/bp2build/symlink_forest.go
@@ -22,6 +22,7 @@
"os"
"path/filepath"
"regexp"
+ "sort"
"sync"
"sync/atomic"
@@ -275,14 +276,17 @@
}
}
- allEntries := make(map[string]struct{})
+ allEntries := make([]string, 0, len(srcDirMap)+len(buildFilesMap))
for n := range srcDirMap {
- allEntries[n] = struct{}{}
+ allEntries = append(allEntries, n)
}
-
for n := range buildFilesMap {
- allEntries[n] = struct{}{}
+ if _, ok := srcDirMap[n]; !ok {
+ allEntries = append(allEntries, n)
+ }
}
+ // Tests read the error messages generated, so ensure their order is deterministic
+ sort.Strings(allEntries)
err := os.MkdirAll(shared.JoinPath(context.topdir, forestDir), 0777)
if err != nil {
@@ -291,7 +295,7 @@
}
context.mkdirCount.Add(1)
- for f := range allEntries {
+ for _, f := range allEntries {
if f[0] == '.' {
continue // Ignore dotfiles
}
diff --git a/cc/Android.bp b/cc/Android.bp
index 8860f78..5fd9afe 100644
--- a/cc/Android.bp
+++ b/cc/Android.bp
@@ -52,7 +52,6 @@
"vndk.go",
"vndk_prebuilt.go",
- "cflag_artifacts.go",
"cmakelists.go",
"compdb.go",
"compiler.go",
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 6f97260..aea1fa1 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -813,6 +813,8 @@
features := compilerAttrs.features.Clone().Append(linkerAttrs.features).Append(bp2buildSanitizerFeatures(ctx, module))
features.DeduplicateAxesFromBase()
+ addMuslSystemDynamicDeps(ctx, linkerAttrs)
+
return baseAttributes{
compilerAttrs,
linkerAttrs,
@@ -823,6 +825,16 @@
}
}
+// As a workaround for b/261657184, we are manually adding the default value
+// of system_dynamic_deps for the linux_musl os.
+// TODO: Solve this properly
+func addMuslSystemDynamicDeps(ctx android.Bp2buildMutatorContext, attrs linkerAttributes) {
+ systemDynamicDeps := attrs.systemDynamicDeps.SelectValue(bazel.OsConfigurationAxis, "linux_musl")
+ if attrs.systemDynamicDeps.HasAxisSpecificValues(bazel.OsConfigurationAxis) && systemDynamicDeps.IsNil() {
+ attrs.systemDynamicDeps.SetSelectValue(bazel.OsConfigurationAxis, "linux_musl", android.BazelLabelForModuleDeps(ctx, config.MuslDefaultSharedLibraries))
+ }
+}
+
type fdoProfileAttributes struct {
Absolute_path_profile string
}
diff --git a/cc/cflag_artifacts.go b/cc/cflag_artifacts.go
deleted file mode 100644
index 25a7a43..0000000
--- a/cc/cflag_artifacts.go
+++ /dev/null
@@ -1,101 +0,0 @@
-package cc
-
-import (
- "fmt"
- "sort"
- "strings"
-
- "android/soong/android"
-)
-
-func init() {
- android.RegisterSingletonType("cflag_artifacts_text", cflagArtifactsTextFactory)
-}
-
-func cflagArtifactsTextFactory() android.Singleton {
- return &cflagArtifactsText{}
-}
-
-var (
- TrackedCFlags = []string{
- "-Wall",
- "-Werror",
- "-Wextra",
- "-Wthread-safety",
- "-O3",
- }
-
- TrackedCFlagsDir = []string{
- "device/google/",
- "vendor/google/",
- }
-)
-
-// Stores output files.
-type cflagArtifactsText struct {
- outputs android.WritablePaths
-}
-
-// allowedDir verifies if the directory/project is part of the TrackedCFlagsDir
-// filter.
-func allowedDir(subdir string) bool {
- subdir += "/"
- return android.HasAnyPrefix(subdir, TrackedCFlagsDir)
-}
-
-// GenCFlagArtifact is used to generate the build rules which produce a file
-// that contains a list of all modules using/not using a particular cflag
-func (s *cflagArtifactsText) GenCFlagArtifact(ctx android.SingletonContext,
- flag string, modulesUsing, modulesNotUsing []string) {
-
- filename := "module_cflags" + flag + ".txt"
- filepath := android.PathForOutput(ctx, "cflags", filename)
-
- lines := make([]string, 0, 2+len(modulesUsing)+len(modulesNotUsing))
- lines = append(lines, "# Modules using "+flag)
- lines = append(lines, modulesUsing...)
- lines = append(lines, "# Modules not using "+flag)
- lines = append(lines, modulesNotUsing...)
-
- android.WriteFileRule(ctx, filepath, strings.Join(lines, "\n"))
- s.outputs = append(s.outputs, filepath)
-}
-
-func (s *cflagArtifactsText) GenerateBuildActions(ctx android.SingletonContext) {
- modulesWithCFlag := make(map[string][]string)
-
- // Scan through all modules, selecting the ones that are part of the filter,
- // and then storing into a map which tracks whether or not tracked C flag is
- // used or not.
- ctx.VisitAllModules(func(module android.Module) {
- if ccModule, ok := module.(*Module); ok {
- if allowedDir(ctx.ModuleDir(ccModule)) {
- cflags := ccModule.flags.Local.CFlags
- cppflags := ccModule.flags.Local.CppFlags
- module := fmt.Sprintf("%s:%s (%s)",
- ctx.BlueprintFile(ccModule),
- ctx.ModuleName(ccModule),
- ctx.ModuleSubDir(ccModule))
- for _, flag := range TrackedCFlags {
- if inList(flag, cflags) || inList(flag, cppflags) {
- modulesWithCFlag[flag] = append(modulesWithCFlag[flag], module)
- } else {
- modulesWithCFlag["!"+flag] = append(modulesWithCFlag["!"+flag], module)
- }
- }
- }
- }
- })
-
- // Traversing map and setting up rules to produce intermediary files which
- // contain parts of each expected C Flag artifact.
- for _, flag := range TrackedCFlags {
- sort.Strings(modulesWithCFlag[flag])
- sort.Strings(modulesWithCFlag["!"+flag])
- s.GenCFlagArtifact(ctx, flag, modulesWithCFlag[flag], modulesWithCFlag["!"+flag])
- }
-}
-
-func (s *cflagArtifactsText) MakeVars(ctx android.MakeVarsContext) {
- ctx.Strict("SOONG_MODULES_CFLAG_ARTIFACTS", strings.Join(s.outputs.Strings(), " "))
-}
diff --git a/cc/config/x86_linux_host.go b/cc/config/x86_linux_host.go
index 740405e..93aa82e 100644
--- a/cc/config/x86_linux_host.go
+++ b/cc/config/x86_linux_host.go
@@ -112,7 +112,7 @@
muslCrtBeginSharedBinary, muslCrtEndSharedBinary = []string{"libc_musl_crtbegin_dynamic"}, []string{"libc_musl_crtend"}
muslCrtBeginSharedLibrary, muslCrtEndSharedLibrary = []string{"libc_musl_crtbegin_so"}, []string{"libc_musl_crtend_so"}
- muslDefaultSharedLibraries = []string{"libc_musl"}
+ MuslDefaultSharedLibraries = []string{"libc_musl"}
)
const (
@@ -331,7 +331,7 @@
func (toolchainMusl) CrtEndSharedBinary() []string { return muslCrtEndSharedBinary }
func (toolchainMusl) CrtEndSharedLibrary() []string { return muslCrtEndSharedLibrary }
-func (toolchainMusl) DefaultSharedLibraries() []string { return muslDefaultSharedLibraries }
+func (toolchainMusl) DefaultSharedLibraries() []string { return MuslDefaultSharedLibraries }
func (toolchainMusl) Cflags() string {
return "${config.LinuxMuslCflags}"
diff --git a/cc/library.go b/cc/library.go
index 8fd0019..1291f5c 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1239,6 +1239,10 @@
// b/239274367 --apex and --systemapi filters symbols tagged with # apex and #
// systemapi, respectively. The former is for symbols defined in platform libraries
// and the latter is for symbols defined in APEXes.
+ // A single library can contain either # apex or # systemapi, but not both.
+ // The stub generator (ndkstubgen) is additive, so passing _both_ of these to it should be a no-op.
+ // However, having this distinction helps guard accidental
+ // promotion or demotion of API and also helps the API review process b/191371676
var flag string
if ctx.Module().(android.ApexModule).NotInPlatform() {
flag = "--apex"
diff --git a/java/aar.go b/java/aar.go
index 60b0436..58b72ab 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -1041,6 +1041,21 @@
},
)
+ neverlink := true
+ ctx.CreateBazelTargetModule(
+ bazel.BazelTargetModuleProperties{
+ Rule_class: "android_library",
+ Bzl_load_location: "//build/bazel/rules/android:rules.bzl",
+ },
+ android.CommonAttributes{Name: name + "-neverlink"},
+ &bazelAndroidLibrary{
+ javaLibraryAttributes: &javaLibraryAttributes{
+ Neverlink: bazel.BoolAttribute{Value: &neverlink},
+ Exports: bazel.MakeSingleLabelListAttribute(bazel.Label{Label: ":" + name}),
+ },
+ },
+ )
+
}
func (a *AndroidLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
diff --git a/java/java.go b/java/java.go
index 37fc390..0479f10 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2675,17 +2675,10 @@
}
if m.properties.Libs != nil {
- // TODO 244210934 ALIX Check if this else statement breaks presubmits get rid of it if it doesn't
- modType := ctx.ModuleType()
- if strings.HasPrefix(modType, "java_binary") || strings.HasPrefix(modType, "java_library") || modType == "android_app" || modType == "android_library" || modType == "java_plugin" {
- for _, d := range m.properties.Libs {
- neverlinkLabel := android.BazelLabelForModuleDepSingle(ctx, d)
- neverlinkLabel.Label = neverlinkLabel.Label + "-neverlink"
- deps.Add(&neverlinkLabel)
- }
-
- } else {
- deps.Append(android.BazelLabelForModuleDeps(ctx, android.LastUniqueStrings(android.CopyOf(m.properties.Libs))))
+ for _, d := range m.properties.Libs {
+ neverlinkLabel := android.BazelLabelForModuleDepSingle(ctx, d)
+ neverlinkLabel.Label = neverlinkLabel.Label + "-neverlink"
+ deps.Add(&neverlinkLabel)
}
}
diff --git a/scripts/hiddenapi/signature_trie.py b/scripts/hiddenapi/signature_trie.py
index 3650fa1..2ff0c5f 100644
--- a/scripts/hiddenapi/signature_trie.py
+++ b/scripts/hiddenapi/signature_trie.py
@@ -150,10 +150,6 @@
f"wildcard '{last_element}' and "
f"member signature '{member[0]}'")
wildcard = [last_element]
- elif last_element.islower():
- raise Exception(f"Invalid signature '{signature}': last element "
- f"'{last_element}' is lower case but should be an "
- f"upper case class name or wildcard")
else:
packages = elements[0:-1]
# Split the class name into outer / inner classes
diff --git a/scripts/hiddenapi/signature_trie_test.py b/scripts/hiddenapi/signature_trie_test.py
index 6d4e660..bd4a9a8 100755
--- a/scripts/hiddenapi/signature_trie_test.py
+++ b/scripts/hiddenapi/signature_trie_test.py
@@ -117,14 +117,6 @@
self.assertEqual(elements, self.signature_to_elements(signature))
self.assertEqual(signature, self.elements_to_signature(elements))
- def test_invalid_no_class_or_wildcard(self):
- signature = "java/lang"
- with self.assertRaises(Exception) as context:
- self.signature_to_elements(signature)
- self.assertIn(
- "last element 'lang' is lower case but should be an "
- "upper case class name or wildcard", str(context.exception))
-
def test_non_standard_class_name(self):
elements = [
("package", "javax"),