Merge "Add CcUnstrippedInfo provider and use it in mixed builds"
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 9b284fc..a9c766b 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -47,11 +47,13 @@
"bionic": Bp2BuildDefaultTrueRecursively,
"bootable/recovery/minadbd": Bp2BuildDefaultTrue,
"bootable/recovery/minui": Bp2BuildDefaultTrue,
+ "bootable/recovery/applypatch": Bp2BuildDefaultTrue,
"bootable/recovery/recovery_utils": Bp2BuildDefaultTrue,
"bootable/recovery/tools/recovery_l10n": Bp2BuildDefaultTrue,
"build/bazel": Bp2BuildDefaultTrueRecursively,
"build/make/target/product/security": Bp2BuildDefaultTrue,
+ "build/make/tools/releasetools": Bp2BuildDefaultTrue,
"build/make/tools/signapk": Bp2BuildDefaultTrue,
"build/make/tools/zipalign": Bp2BuildDefaultTrueRecursively,
"build/soong": Bp2BuildDefaultTrue,
@@ -109,6 +111,8 @@
"external/boringssl": Bp2BuildDefaultTrueRecursively,
"external/bouncycastle": Bp2BuildDefaultTrue,
"external/brotli": Bp2BuildDefaultTrue,
+ "external/bsdiff": Bp2BuildDefaultTrueRecursively,
+ "external/bzip2": Bp2BuildDefaultTrueRecursively,
"external/conscrypt": Bp2BuildDefaultTrue,
"external/e2fsprogs": Bp2BuildDefaultTrueRecursively,
"external/eigen": Bp2BuildDefaultTrueRecursively,
@@ -138,6 +142,7 @@
"external/libcap": Bp2BuildDefaultTrueRecursively,
"external/libcxx": Bp2BuildDefaultTrueRecursively,
"external/libcxxabi": Bp2BuildDefaultTrueRecursively,
+ "external/libdivsufsort": Bp2BuildDefaultTrueRecursively,
"external/libdrm": Bp2BuildDefaultTrue,
"external/libevent": Bp2BuildDefaultTrueRecursively,
"external/libgav1": Bp2BuildDefaultTrueRecursively,
@@ -148,6 +153,7 @@
"external/libvpx": Bp2BuildDefaultTrueRecursively,
"external/libyuv": Bp2BuildDefaultTrueRecursively,
"external/lz4/lib": Bp2BuildDefaultTrue,
+ "external/lz4/programs": Bp2BuildDefaultTrue,
"external/lzma/C": Bp2BuildDefaultTrueRecursively,
"external/mdnsresponder": Bp2BuildDefaultTrueRecursively,
"external/minijail": Bp2BuildDefaultTrueRecursively,
@@ -282,6 +288,7 @@
"system/core/libsysutils": Bp2BuildDefaultTrueRecursively,
"system/core/libutils": Bp2BuildDefaultTrueRecursively,
"system/core/libvndksupport": Bp2BuildDefaultTrueRecursively,
+ "system/core/mkbootfs": Bp2BuildDefaultTrueRecursively,
"system/core/property_service/libpropertyinfoparser": Bp2BuildDefaultTrueRecursively,
"system/core/property_service/libpropertyinfoserializer": Bp2BuildDefaultTrueRecursively,
"system/extras/toolchain-extras": Bp2BuildDefaultTrue,
@@ -315,6 +322,7 @@
"system/timezone/apex": Bp2BuildDefaultTrueRecursively,
"system/timezone/output_data": Bp2BuildDefaultTrueRecursively,
"system/tools/aidl/build/tests_bp2build": Bp2BuildDefaultTrue,
+ "system/tools/mkbootimg": Bp2BuildDefaultTrueRecursively,
"system/tools/sysprop": Bp2BuildDefaultTrue,
"system/unwinding/libunwindstack": Bp2BuildDefaultTrueRecursively,
@@ -474,7 +482,6 @@
"prebuilt_stats-log-api-gen",
// fastboot
- "bootimg_headers",
"fastboot",
"libfastboot",
"liblp",
@@ -507,6 +514,7 @@
//system/extras/verity/fec
"fec",
+ "boot_signer",
//packages/apps/Car/libs/car-ui-lib/car-ui-androidx
// genrule dependencies for java_imports
@@ -1245,6 +1253,29 @@
"launcherprotosnano",
"datastallprotosnano",
"devicepolicyprotosnano",
+ "ota_metadata_proto_java",
+ "merge_ota",
+
+ // releasetools
+ "releasetools_fsverity_metadata_generator",
+ "verity_utils",
+ "check_ota_package_signature",
+ "check_target_files_vintf",
+ "releasetools_check_target_files_vintf",
+ "releasetools_verity_utils",
+ "build_image",
+ "ota_from_target_files",
+ "releasetools_ota_from_target_files",
+ "releasetools_build_image",
+ "add_img_to_target_files",
+ "releasetools_add_img_to_target_files",
+ "fsverity_metadata_generator",
+ "sign_target_files_apks",
+
+ // depends on the support of yacc file
+ "libapplypatch",
+ "libapplypatch_modes",
+ "applypatch",
}
Bp2buildCcLibraryStaticOnlyList = []string{}
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 47ed7dd..29695d6 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -175,12 +175,13 @@
}
type bazelPaths struct {
- homeDir string
- bazelPath string
- outputBase string
- workspaceDir string
- soongOutDir string
- metricsDir string
+ homeDir string
+ bazelPath string
+ outputBase string
+ workspaceDir string
+ soongOutDir string
+ metricsDir string
+ bazelDepsFile string
}
// A context object which tracks queued requests that need to be made to Bazel,
@@ -446,6 +447,11 @@
} else {
missingEnvVars = append(missingEnvVars, "BAZEL_METRICS_DIR")
}
+ if len(c.Getenv("BAZEL_DEPS_FILE")) > 1 {
+ p.bazelDepsFile = c.Getenv("BAZEL_DEPS_FILE")
+ } else {
+ missingEnvVars = append(missingEnvVars, "BAZEL_DEPS_FILE")
+ }
if len(missingEnvVars) > 0 {
return nil, errors.New(fmt.Sprintf("missing required env vars to use bazel: %s", missingEnvVars))
} else {
diff --git a/android/module.go b/android/module.go
index c099e6d..5aecb05 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1246,12 +1246,14 @@
// when generated as the 'data' label list attribute in Bazel. Remove it if
// it exists. See b/247985196.
_, requiredWithoutCycles := RemoveFromList(ctx.ModuleName(), mod.commonProperties.Required)
+ requiredWithoutCycles = FirstUniqueStrings(requiredWithoutCycles)
required := depsToLabelList(requiredWithoutCycles)
archVariantProps := mod.GetArchVariantProperties(ctx, &commonProperties{})
for axis, configToProps := range archVariantProps {
for config, _props := range configToProps {
if archProps, ok := _props.(*commonProperties); ok {
_, requiredWithoutCycles := RemoveFromList(ctx.ModuleName(), archProps.Required)
+ requiredWithoutCycles = FirstUniqueStrings(requiredWithoutCycles)
required.SetSelectValue(axis, config, depsToLabelList(requiredWithoutCycles).Value)
if !neitherHostNorDevice {
if archProps.Enabled != nil {
diff --git a/apex/apex.go b/apex/apex.go
index 4247db4..6afbd4a 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2740,11 +2740,6 @@
return ""
}
- archMinApiLevel := cc.MinApiForArch(ctx, a.MultiTargets()[0].Arch.ArchType)
- if !archMinApiLevel.IsNone() && archMinApiLevel.CompareTo(minApiLevel) > 0 {
- minApiLevel = archMinApiLevel
- }
-
overrideMinSdkValue := ctx.DeviceConfig().ApexGlobalMinSdkVersionOverride()
overrideApiLevel := minSdkVersionFromValue(ctx, overrideMinSdkValue)
if !overrideApiLevel.IsNone() && overrideApiLevel.CompareTo(minApiLevel) > 0 {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e130fcc..647a575 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -2191,6 +2191,38 @@
`)
}
+func TestApexMinSdkVersion_MinApiForArch(t *testing.T) {
+ // Tests that an apex dependency with min_sdk_version higher than the
+ // min_sdk_version of the apex is allowed as long as the dependency's
+ // min_sdk_version is less than or equal to the api level that the
+ // architecture was introduced in. In this case, arm64 didn't exist
+ // until api level 21, so the arm64 code will never need to run on
+ // an api level 20 device, even if other architectures of the apex
+ // will.
+ testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ native_shared_libs: ["libfoo"],
+ min_sdk_version: "20",
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ cc_library {
+ name: "libfoo",
+ srcs: ["mylib.cpp"],
+ apex_available: ["myapex"],
+ min_sdk_version: "21",
+ stl: "none",
+ }
+ `)
+}
+
func TestJavaStableSdkVersion(t *testing.T) {
testCases := []struct {
name string
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 0f57911..70308c8 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -500,6 +500,9 @@
Arm64 struct {
Src *string `android:"path"`
}
+ Riscv64 struct {
+ Src *string `android:"path"`
+ }
X86 struct {
Src *string `android:"path"`
}
@@ -527,6 +530,8 @@
src = String(p.Arch.Arm.Src)
case android.Arm64:
src = String(p.Arch.Arm64.Src)
+ case android.Riscv64:
+ src = String(p.Arch.Riscv64.Src)
case android.X86:
src = String(p.Arch.X86.Src)
case android.X86_64:
diff --git a/bp2build/python_binary_conversion_test.go b/bp2build/python_binary_conversion_test.go
index e8b9bc4..1b538d0 100644
--- a/bp2build/python_binary_conversion_test.go
+++ b/bp2build/python_binary_conversion_test.go
@@ -4,6 +4,7 @@
"testing"
"android/soong/android"
+ "android/soong/genrule"
"android/soong/python"
)
@@ -12,6 +13,8 @@
RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {
ctx.RegisterModuleType("python_library", python.PythonLibraryFactory)
ctx.RegisterModuleType("python_library_host", python.PythonLibraryHostFactory)
+ ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
+ ctx.RegisterModuleType("python_defaults", python.DefaultsFactory)
}, tc)
}
@@ -165,3 +168,152 @@
},
})
}
+
+func TestPythonBinaryMainIsNotSpecified(t *testing.T) {
+ runBp2BuildTestCaseWithPythonLibraries(t, Bp2buildTestCase{
+ Description: "python_binary_host main label in same package",
+ ModuleTypeUnderTest: "python_binary_host",
+ ModuleTypeUnderTestFactory: python.PythonBinaryHostFactory,
+ Blueprint: `python_binary_host {
+ name: "foo",
+ bazel_module: { bp2build_available: true },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("py_binary", "foo", AttrNameToString{
+ "imports": `["."]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
+
+func TestPythonBinaryMainIsLabel(t *testing.T) {
+ runBp2BuildTestCaseWithPythonLibraries(t, Bp2buildTestCase{
+ Description: "python_binary_host main label in same package",
+ ModuleTypeUnderTest: "python_binary_host",
+ ModuleTypeUnderTestFactory: python.PythonBinaryHostFactory,
+ Blueprint: `python_binary_host {
+ name: "foo",
+ main: ":a",
+ bazel_module: { bp2build_available: true },
+}
+
+genrule {
+ name: "a",
+ bazel_module: { bp2build_available: false },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("py_binary", "foo", AttrNameToString{
+ "main": `":a"`,
+ "imports": `["."]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
+
+func TestPythonBinaryMainIsSubpackageFile(t *testing.T) {
+ runBp2BuildTestCaseWithPythonLibraries(t, Bp2buildTestCase{
+ Description: "python_binary_host main is subpackage file",
+ ModuleTypeUnderTest: "python_binary_host",
+ ModuleTypeUnderTestFactory: python.PythonBinaryHostFactory,
+ Filesystem: map[string]string{
+ "a/Android.bp": "",
+ "a/b.py": "",
+ },
+ Blueprint: `python_binary_host {
+ name: "foo",
+ main: "a/b.py",
+ bazel_module: { bp2build_available: true },
+}
+
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("py_binary", "foo", AttrNameToString{
+ "main": `"//a:b.py"`,
+ "imports": `["."]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
+
+func TestPythonBinaryMainIsSubDirFile(t *testing.T) {
+ runBp2BuildTestCaseWithPythonLibraries(t, Bp2buildTestCase{
+ Description: "python_binary_host main is file in sub directory that is not Bazel package",
+ ModuleTypeUnderTest: "python_binary_host",
+ ModuleTypeUnderTestFactory: python.PythonBinaryHostFactory,
+ Filesystem: map[string]string{
+ "a/b.py": "",
+ },
+ Blueprint: `python_binary_host {
+ name: "foo",
+ main: "a/b.py",
+ bazel_module: { bp2build_available: true },
+}
+
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("py_binary", "foo", AttrNameToString{
+ "main": `"a/b.py"`,
+ "imports": `["."]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
+
+func TestPythonBinaryDuplicatesInRequired(t *testing.T) {
+ runBp2BuildTestCaseWithPythonLibraries(t, Bp2buildTestCase{
+ Description: "python_binary_host duplicates in required attribute of the module and its defaults",
+ ModuleTypeUnderTest: "python_binary_host",
+ ModuleTypeUnderTestFactory: python.PythonBinaryHostFactory,
+ Blueprint: `python_binary_host {
+ name: "foo",
+ main: "a.py",
+ defaults: ["d"],
+ required: [
+ "r1",
+ ],
+ bazel_module: { bp2build_available: true },
+}
+
+python_defaults {
+ name: "d",
+ required: [
+ "r1",
+ "r2",
+ ],
+}` + simpleModuleDoNotConvertBp2build("genrule", "r1") +
+ simpleModuleDoNotConvertBp2build("genrule", "r2"),
+
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("py_binary", "foo", AttrNameToString{
+ "main": `"a.py"`,
+ "imports": `["."]`,
+ "data": `[
+ ":r1",
+ ":r2",
+ ]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ }),
+ },
+ })
+}
diff --git a/cc/api_level.go b/cc/api_level.go
index 8f9e1f6..fdff5cb 100644
--- a/cc/api_level.go
+++ b/cc/api_level.go
@@ -20,7 +20,7 @@
"android/soong/android"
)
-func MinApiForArch(ctx android.EarlyModuleContext,
+func minApiForArch(ctx android.EarlyModuleContext,
arch android.ArchType) android.ApiLevel {
switch arch {
@@ -38,7 +38,7 @@
func nativeApiLevelFromUser(ctx android.BaseModuleContext,
raw string) (android.ApiLevel, error) {
- min := MinApiForArch(ctx, ctx.Arch().ArchType)
+ min := minApiForArch(ctx, ctx.Arch().ArchType)
if raw == "minimum" {
return min, nil
}
diff --git a/cc/cc.go b/cc/cc.go
index d0362fc..eb7c639 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3626,6 +3626,16 @@
return err
}
+ // A dependency only needs to support a min_sdk_version at least
+ // as high as the api level that the architecture was introduced in.
+ // This allows introducing new architectures in the platform that
+ // need to be included in apexes that normally require an older
+ // min_sdk_version.
+ minApiForArch := minApiForArch(ctx, c.Target().Arch.ArchType)
+ if sdkVersion.LessThan(minApiForArch) {
+ sdkVersion = minApiForArch
+ }
+
if ver.GreaterThan(sdkVersion) {
return fmt.Errorf("newer SDK(%v)", ver)
}
diff --git a/cc/config/global.go b/cc/config/global.go
index bf80907..4e4d174 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -312,8 +312,8 @@
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
- ClangDefaultVersion = "clang-r468909"
- ClangDefaultShortVersion = "15.0.2"
+ ClangDefaultVersion = "clang-r468909b"
+ ClangDefaultShortVersion = "15.0.3"
// Directories with warnings from Android.bp files.
WarningAllowedProjects = []string{
diff --git a/cc/coverage.go b/cc/coverage.go
index d0902ea..a7356f8 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -108,6 +108,12 @@
if EnableContinuousCoverage(ctx) {
flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-mllvm", "-runtime-counter-relocation")
}
+
+ // http://b/248022906, http://b/247941801 enabling coverage and hwasan-globals
+ // instrumentation together causes duplicate-symbol errors for __llvm_profile_filename.
+ if c, ok := ctx.Module().(*Module); ok && c.sanitize.isSanitizerEnabled(Hwasan) {
+ flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-mllvm", "-hwasan-globals=0")
+ }
}
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 66dfef5..0b47f0e 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -564,11 +564,6 @@
s.Scudo = nil
}
- if Bool(s.Undefined) || Bool(s.All_undefined) || len(s.Misc_undefined) > 0 {
- // TODO(b/251249010): re-enable Hwaddress with UBSan once fixed.
- s.Hwaddress = nil
- }
-
if Bool(s.Hwaddress) {
s.Address = nil
s.Thread = nil
diff --git a/cmd/pom2bp/pom2bp.go b/cmd/pom2bp/pom2bp.go
index 0e8ad05..ba0648d 100644
--- a/cmd/pom2bp/pom2bp.go
+++ b/cmd/pom2bp/pom2bp.go
@@ -207,6 +207,10 @@
return p.Packaging == "jar"
}
+func (p Pom) IsApk() bool {
+ return p.Packaging == "apk"
+}
+
func (p Pom) IsHostModule() bool {
return hostModuleNames.IsHostModule(p.GroupId, p.ArtifactId)
}
@@ -244,6 +248,8 @@
func (p Pom) ImportModuleType() string {
if p.IsAar() {
return "android_library_import"
+ } else if p.IsApk() {
+ return "android_app_import"
} else if p.IsHostOnly() {
return "java_import_host"
} else {
@@ -254,6 +260,8 @@
func (p Pom) BazelImportTargetType() string {
if p.IsAar() {
return "aar_import"
+ } else if p.IsApk() {
+ return "apk_import"
} else {
return "java_import"
}
@@ -262,6 +270,8 @@
func (p Pom) ImportProperty() string {
if p.IsAar() {
return "aars"
+ } else if p.IsApk() {
+ return "apk"
} else {
return "jars"
}
@@ -270,6 +280,8 @@
func (p Pom) BazelImportProperty() string {
if p.IsAar() {
return "aar"
+ } else if p.IsApk() {
+ return "apk"
} else {
return "jars"
}
@@ -493,8 +505,12 @@
var bpTemplate = template.Must(template.New("bp").Parse(`
{{.ImportModuleType}} {
name: "{{.BpName}}",
+ {{- if .IsApk}}
+ {{.ImportProperty}}: "{{.ArtifactFile}}",
+ {{- else}}
{{.ImportProperty}}: ["{{.ArtifactFile}}"],
sdk_version: "{{.SdkVersion}}",
+ {{- end}}
{{- if .Jetifier}}
jetifier: true,
{{- end}}
@@ -535,8 +551,14 @@
],
{{- end}}
{{- else if not .IsHostOnly}}
+ {{- if not .IsApk}}
min_sdk_version: "{{.DefaultMinSdkVersion}}",
{{- end}}
+ {{- end}}
+ {{- if .IsApk}}
+ presigned: true
+ {{- end}}
+
}
`))
@@ -995,7 +1017,7 @@
for _, pom := range poms {
var err error
- if staticDeps {
+ if staticDeps && !pom.IsApk() {
err = depsTemplate.Execute(buf, pom)
} else {
err = template.Execute(buf, pom)
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 9f00fc3..0ba25c8 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -167,10 +167,15 @@
return configuration.BazelContext.InvokeBazel(configuration)
}
ctx.SetBeforePrepareBuildActionsHook(bazelHook)
-
ninjaDeps := bootstrap.RunBlueprint(cmdlineArgs, bootstrap.DoEverything, ctx.Context, configuration)
ninjaDeps = append(ninjaDeps, extraNinjaDeps...)
+ bazelPaths, err := readBazelPaths(configuration)
+ if err != nil {
+ panic("Bazel deps file not found: " + err.Error())
+ }
+ ninjaDeps = append(ninjaDeps, bazelPaths...)
+
globListFiles := writeBuildGlobsNinjaFile(ctx, configuration.SoongOutDir(), configuration)
ninjaDeps = append(ninjaDeps, globListFiles...)
@@ -699,3 +704,14 @@
}
codegenMetrics.Write(metricsDir)
}
+
+func readBazelPaths(configuration android.Config) ([]string, error) {
+ depsPath := configuration.Getenv("BAZEL_DEPS_FILE")
+
+ data, err := os.ReadFile(depsPath)
+ if err != nil {
+ return nil, err
+ }
+ paths := strings.Split(strings.TrimSpace(string(data)), "\n")
+ return paths, nil
+}
diff --git a/java/droidstubs.go b/java/droidstubs.go
index d9efb40..5777b18 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -28,7 +28,7 @@
)
// The values allowed for Droidstubs' Api_levels_sdk_type
-var allowedApiLevelSdkTypes = []string{"public", "system", "module-lib"}
+var allowedApiLevelSdkTypes = []string{"public", "system", "module-lib", "system-server"}
func init() {
RegisterStubsBuildComponents(android.InitRegistrationContext)
@@ -134,7 +134,7 @@
// the dirs which Metalava extracts API levels annotations from.
Api_levels_annotations_dirs []string
- // the sdk kind which Metalava extracts API levels annotations from. Supports 'public', 'system' and 'module-lib' for now; defaults to public.
+ // the sdk kind which Metalava extracts API levels annotations from. Supports 'public', 'system', 'module-lib' and 'system-server'; defaults to public.
Api_levels_sdk_type *string
// the filename which Metalava extracts API levels annotations from. Defaults to android.jar.
@@ -445,6 +445,8 @@
// for older releases. Similarly, module-lib falls back to system API.
var sdkDirs []string
switch proptools.StringDefault(d.properties.Api_levels_sdk_type, "public") {
+ case "system-server":
+ sdkDirs = []string{"system-server", "module-lib", "system", "public"}
case "module-lib":
sdkDirs = []string{"module-lib", "system", "public"}
case "system":
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index 2443692..25f8c86 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -122,7 +122,7 @@
"some-other-exported-dir",
],
api_levels_annotations_enabled: true,
- api_levels_sdk_type: "%s",
+ api_levels_sdk_type: "%s",
}
`, sdkType),
map[string][]byte{
@@ -169,6 +169,21 @@
}, patterns)
}
+func TestSystemServerDroidstubs(t *testing.T) {
+ patterns := getAndroidJarPatternsForDroidstubs(t, "system-server")
+
+ android.AssertArrayString(t, "order of patterns", []string{
+ "--android-jar-pattern somedir/%/system-server/android.jar",
+ "--android-jar-pattern someotherdir/%/system-server/android.jar",
+ "--android-jar-pattern somedir/%/module-lib/android.jar",
+ "--android-jar-pattern someotherdir/%/module-lib/android.jar",
+ "--android-jar-pattern somedir/%/system/android.jar",
+ "--android-jar-pattern someotherdir/%/system/android.jar",
+ "--android-jar-pattern somedir/%/public/android.jar",
+ "--android-jar-pattern someotherdir/%/public/android.jar",
+ }, patterns)
+}
+
func TestDroidstubsSandbox(t *testing.T) {
ctx, _ := testJavaWithFS(t, `
genrule {
diff --git a/python/binary.go b/python/binary.go
index f4ad626..1f49a54 100644
--- a/python/binary.go
+++ b/python/binary.go
@@ -34,7 +34,7 @@
}
type bazelPythonBinaryAttributes struct {
- Main *string
+ Main *bazel.Label
Srcs bazel.LabelListAttribute
Deps bazel.LabelListAttribute
Python_version *string
@@ -42,17 +42,6 @@
}
func pythonBinaryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
- var main *string
- for _, propIntf := range m.GetProperties() {
- if props, ok := propIntf.(*BinaryProperties); ok {
- // main is optional.
- if props.Main != nil {
- main = props.Main
- break
- }
- }
- }
-
// TODO(b/182306917): this doesn't fully handle all nested props versioned
// by the python version, which would have been handled by the version split
// mutator. This is sufficient for very simple python_binary_host modules
@@ -72,13 +61,24 @@
baseAttrs := m.makeArchVariantBaseAttributes(ctx)
attrs := &bazelPythonBinaryAttributes{
- Main: main,
+ Main: nil,
Srcs: baseAttrs.Srcs,
Deps: baseAttrs.Deps,
Python_version: python_version,
Imports: baseAttrs.Imports,
}
+ for _, propIntf := range m.GetProperties() {
+ if props, ok := propIntf.(*BinaryProperties); ok {
+ // main is optional.
+ if props.Main != nil {
+ main := android.BazelLabelForModuleSrcSingle(ctx, *props.Main)
+ attrs.Main = &main
+ break
+ }
+ }
+ }
+
props := bazel.BazelTargetModuleProperties{
// Use the native py_binary rule.
Rule_class: "py_binary",
diff --git a/python/defaults.go b/python/defaults.go
index c54e7d0..3dc5bc4 100644
--- a/python/defaults.go
+++ b/python/defaults.go
@@ -19,7 +19,7 @@
)
func init() {
- android.RegisterModuleType("python_defaults", defaultsFactory)
+ android.RegisterModuleType("python_defaults", DefaultsFactory)
}
type Defaults struct {
@@ -30,7 +30,7 @@
func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
-func defaultsFactory() android.Module {
+func DefaultsFactory() android.Module {
module := &Defaults{}
module.AddProperties(
diff --git a/rust/sanitize.go b/rust/sanitize.go
index a3c5cb5..c68137e 100644
--- a/rust/sanitize.go
+++ b/rust/sanitize.go
@@ -189,16 +189,6 @@
}
}
- // TODO:(b/178369775)
- // For now sanitizing is only supported on devices
- if ctx.Os() == android.Android && Bool(s.Fuzzer) {
- sanitize.Properties.SanitizerEnabled = true
- }
-
- if ctx.Os() == android.Android && Bool(s.Address) {
- sanitize.Properties.SanitizerEnabled = true
- }
-
// HWASan requires AArch64 hardware feature (top-byte-ignore).
if ctx.Arch().ArchType != android.Arm64 || !ctx.Os().Bionic() {
s.Hwaddress = nil
@@ -219,7 +209,9 @@
s.Memtag_heap = nil
}
- if ctx.Os() == android.Android && (Bool(s.Hwaddress) || Bool(s.Address) || Bool(s.Memtag_heap)) {
+ // TODO:(b/178369775)
+ // For now sanitizing is only supported on devices
+ if ctx.Os() == android.Android && (Bool(s.Hwaddress) || Bool(s.Address) || Bool(s.Memtag_heap) || Bool(s.Fuzzer)) {
sanitize.Properties.SanitizerEnabled = true
}
}
diff --git a/ui/build/soong.go b/ui/build/soong.go
index e0d67cc..28c6ec9 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -404,6 +404,7 @@
soongBuildEnv.Set("BAZEL_WORKSPACE", absPath(ctx, "."))
soongBuildEnv.Set("BAZEL_METRICS_DIR", config.BazelMetricsDir())
soongBuildEnv.Set("LOG_DIR", config.LogsDir())
+ soongBuildEnv.Set("BAZEL_DEPS_FILE", filepath.Join(os.Getenv("TOP"), config.OutDir(), "tools", "bazel.list"))
// For Soong bootstrapping tests
if os.Getenv("ALLOW_MISSING_DEPENDENCIES") == "true" {