summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Seymour <rseymour@google.com>2023-05-26 05:07:07 +0000
committerRob Seymour <rseymour@google.com>2023-05-26 05:08:18 +0000
commit420ac6d1d7b25c99c849fa3b56e241a1922edacc (patch)
treed0be033324f352e30efea12b87468a14e6a179b8
parent7748b4109575aa454e2f9ee5e326b988088e11c9 (diff)
parent265b065bf2ff009df62f6a86f24670f36ebaa143 (diff)
Merge UP1A.230524.001
Change-Id: Ib03c70d6968a92fa94d4c06fd783b91814a328ac
-rw-r--r--android/allowlists/allowlists.go5
-rw-r--r--android/filegroup.go3
-rw-r--r--android/package.go27
-rw-r--r--android/variable.go4
-rw-r--r--apex/apex.go14
-rw-r--r--bp2build/package_conversion_test.go60
-rw-r--r--cc/config/global.go7
-rwxr-xr-xjava/app.go27
-rw-r--r--java/app_test.go8
-rw-r--r--rust/bindgen.go2
-rw-r--r--ui/build/finder.go9
-rw-r--r--ui/build/soong.go2
12 files changed, 133 insertions, 35 deletions
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index e3e4dba90..63d4e11e0 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -59,7 +59,9 @@ var (
"build/bazel": Bp2BuildDefaultTrueRecursively,
"build/make/target/product/security": Bp2BuildDefaultTrue,
+ "build/make/tools/protos": Bp2BuildDefaultTrue,
"build/make/tools/releasetools": Bp2BuildDefaultTrue,
+ "build/make/tools/sbom": Bp2BuildDefaultTrue,
"build/make/tools/signapk": Bp2BuildDefaultTrue,
"build/make/tools/zipalign": Bp2BuildDefaultTrueRecursively,
"build/soong": Bp2BuildDefaultTrue,
@@ -1427,6 +1429,9 @@ var (
"styleprotoslite",
"CtsPkgInstallerConstants",
"guava-android-testlib",
+
+ // python_test_host with test data
+ "sbom_writers_test",
}
MixedBuildsDisabledList = []string{
diff --git a/android/filegroup.go b/android/filegroup.go
index 0ca5dc50e..f30ee5143 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -75,7 +75,8 @@ func isFilegroupWithPattern(pattern *regexp.Regexp) bazel.LabelMapper {
// https://docs.bazel.build/versions/master/be/general.html#filegroup
type bazelFilegroupAttributes struct {
- Srcs bazel.LabelListAttribute
+ Srcs bazel.LabelListAttribute
+ Applicable_licenses bazel.LabelListAttribute
}
type bazelAidlLibraryAttributes struct {
diff --git a/android/package.go b/android/package.go
index 2bf652126..7fbc70041 100644
--- a/android/package.go
+++ b/android/package.go
@@ -15,6 +15,8 @@
package android
import (
+ "path/filepath"
+
"android/soong/bazel"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -39,8 +41,8 @@ type packageProperties struct {
}
type bazelPackageAttributes struct {
- Default_visibility []string
- Default_applicable_licenses bazel.LabelListAttribute
+ Default_visibility []string
+ Default_package_metadata bazel.LabelListAttribute
}
type packageModule struct {
@@ -53,13 +55,32 @@ type packageModule struct {
var _ Bazelable = &packageModule{}
func (p *packageModule) ConvertWithBp2build(ctx TopDownMutatorContext) {
+ defaultPackageMetadata := bazel.MakeLabelListAttribute(BazelLabelForModuleDeps(ctx, p.properties.Default_applicable_licenses))
+ // If METADATA file exists in the package, add it to package(default_package_metadata=) using a
+ // filegroup(name="default_metadata_file") which can be accessed later on each module in Bazel
+ // using attribute "applicable_licenses".
+ // Attribute applicable_licenses of filegroup "default_metadata_file" has to be set to [],
+ // otherwise Bazel reports cyclic reference error.
+ if existed, _, _ := ctx.Config().fs.Exists(filepath.Join(ctx.ModuleDir(), "METADATA")); existed {
+ ctx.CreateBazelTargetModule(
+ bazel.BazelTargetModuleProperties{
+ Rule_class: "filegroup",
+ },
+ CommonAttributes{Name: "default_metadata_file"},
+ &bazelFilegroupAttributes{
+ Srcs: bazel.MakeLabelListAttribute(BazelLabelForModuleSrc(ctx, []string{"METADATA"})),
+ Applicable_licenses: bazel.LabelListAttribute{Value: bazel.LabelList{Includes: []bazel.Label{}}, EmitEmptyList: true},
+ })
+ defaultPackageMetadata.Value.Add(&bazel.Label{Label: ":default_metadata_file"})
+ }
+
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: "package",
},
CommonAttributes{},
&bazelPackageAttributes{
- Default_applicable_licenses: bazel.MakeLabelListAttribute(BazelLabelForModuleDeps(ctx, p.properties.Default_applicable_licenses)),
+ Default_package_metadata: defaultPackageMetadata,
// FIXME(asmundak): once b/221436821 is resolved
Default_visibility: []string{"//visibility:public"},
})
diff --git a/android/variable.go b/android/variable.go
index aead1b02a..a21994659 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -514,6 +514,10 @@ type productVariables struct {
SourceRootDirs []string `json:",omitempty"`
AfdoProfiles []string `json:",omitempty"`
+
+ ProductManufacturer string `json:",omitempty"`
+ ProductBrand string `json:",omitempty"`
+ BuildVersionTags []string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/apex/apex.go b/apex/apex.go
index 52b37420b..0a48f2a4e 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -137,6 +137,10 @@ type apexBundleProperties struct {
// List of filesystem images that are embedded inside this APEX bundle.
Filesystems []string
+ // The minimum SDK version that this APEX must support at minimum. This is usually set to
+ // the SDK version that the APEX was first introduced.
+ Min_sdk_version *string
+
// Whether this APEX is considered updatable or not. When set to true, this will enforce
// additional rules for making sure that the APEX is truly updatable. To be updatable,
// min_sdk_version should be set as well. This will also disable the size optimizations like
@@ -380,10 +384,6 @@ type overridableProperties struct {
// Trim against a specific Dynamic Common Lib APEX
Trim_against *string
-
- // The minimum SDK version that this APEX must support at minimum. This is usually set to
- // the SDK version that the APEX was first introduced.
- Min_sdk_version *string
}
type apexBundle struct {
@@ -2924,7 +2924,7 @@ func (a *apexBundle) minSdkVersionValue(ctx android.EarlyModuleContext) string {
// Only override the minSdkVersion value on Apexes which already specify
// a min_sdk_version (it's optional for non-updatable apexes), and that its
// min_sdk_version value is lower than the one to override with.
- minApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.overridableProperties.Min_sdk_version))
+ minApiLevel := minSdkVersionFromValue(ctx, proptools.String(a.properties.Min_sdk_version))
if minApiLevel.IsNone() {
return ""
}
@@ -3582,8 +3582,8 @@ func convertWithBp2build(a *apexBundle, ctx android.TopDownMutatorContext) (baze
// TODO(b/219503907) this would need to be set to a.MinSdkVersionValue(ctx) but
// given it's coming via config, we probably don't want to put it in here.
var minSdkVersion bazel.StringAttribute
- if a.overridableProperties.Min_sdk_version != nil {
- minSdkVersion.SetValue(*a.overridableProperties.Min_sdk_version)
+ if a.properties.Min_sdk_version != nil {
+ minSdkVersion.SetValue(*a.properties.Min_sdk_version)
}
if props, ok := productVariableProps[minSdkVersionPropName]; ok {
for c, p := range props {
diff --git a/bp2build/package_conversion_test.go b/bp2build/package_conversion_test.go
index 3704b2d7b..ce848e42d 100644
--- a/bp2build/package_conversion_test.go
+++ b/bp2build/package_conversion_test.go
@@ -15,9 +15,10 @@
package bp2build
import (
+ "testing"
+
"android/soong/android"
"android/soong/genrule"
- "testing"
)
func registerDependentModules(ctx android.RegistrationContext) {
@@ -29,6 +30,7 @@ func TestPackage(t *testing.T) {
tests := []struct {
description string
modules string
+ fs map[string]string
expected []ExpectedRuleTarget
}{
{
@@ -50,8 +52,50 @@ package {
"package",
"",
AttrNameToString{
- "default_applicable_licenses": `[":my_license"]`,
- "default_visibility": `["//visibility:public"]`,
+ "default_package_metadata": `[":my_license"]`,
+ "default_visibility": `["//visibility:public"]`,
+ },
+ android.HostAndDeviceDefault,
+ },
+ {
+ "android_license",
+ "my_license",
+ AttrNameToString{
+ "license_kinds": `["SPDX-license-identifier-Apache-2.0"]`,
+ "license_text": `"NOTICE"`,
+ "visibility": `[":__subpackages__"]`,
+ },
+ android.HostAndDeviceDefault,
+ },
+ },
+ },
+ {
+ description: "package has METADATA file",
+ fs: map[string]string{
+ "METADATA": ``,
+ },
+ modules: `
+license {
+ name: "my_license",
+ visibility: [":__subpackages__"],
+ license_kinds: ["SPDX-license-identifier-Apache-2.0"],
+ license_text: ["NOTICE"],
+}
+
+package {
+ default_applicable_licenses: ["my_license"],
+}
+`,
+ expected: []ExpectedRuleTarget{
+ {
+ "package",
+ "",
+ AttrNameToString{
+ "default_package_metadata": `[
+ ":my_license",
+ ":default_metadata_file",
+ ]`,
+ "default_visibility": `["//visibility:public"]`,
},
android.HostAndDeviceDefault,
},
@@ -65,6 +109,15 @@ package {
},
android.HostAndDeviceDefault,
},
+ {
+ "filegroup",
+ "default_metadata_file",
+ AttrNameToString{
+ "applicable_licenses": `[]`,
+ "srcs": `["METADATA"]`,
+ },
+ android.HostAndDeviceDefault,
+ },
},
},
}
@@ -80,6 +133,7 @@ package {
ModuleTypeUnderTestFactory: android.PackageFactory,
Blueprint: test.modules,
ExpectedBazelTargets: expected,
+ Filesystem: test.fs,
})
}
}
diff --git a/cc/config/global.go b/cc/config/global.go
index 0dd99229d..eb2d5dbe6 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -130,9 +130,6 @@ var (
// Turn off FMA which got enabled by default in clang-r445002 (http://b/218805949)
"-ffp-contract=off",
-
- // Turn off stack protector check for noreturn calls. (http://b/264965700)
- // "-mllvm -disable-check-noreturn-call",
}
commonGlobalConlyflags = []string{}
@@ -169,10 +166,6 @@ var (
commonGlobalLldflags = []string{
"-fuse-ld=lld",
"-Wl,--icf=safe",
-
- // KEYSTONE(I12d0bcd61de11c762805c535b8d0548eac2e2b66,b/278133889)
- // Turn off stack protector check for noreturn calls. (http://b/264965700)
- // "-Wl,-mllvm,-disable-check-noreturn-call",
}
deviceGlobalCppflags = []string{
diff --git a/java/app.go b/java/app.go
index 5d2d75868..5b3a48fe1 100755
--- a/java/app.go
+++ b/java/app.go
@@ -565,19 +565,6 @@ func processMainCert(m android.ModuleBase, certPropValue string, certificates []
certificates = append([]Certificate{mainCert}, certificates...)
}
- if !m.Platform() {
- certPath := certificates[0].Pem.String()
- systemCertPath := ctx.Config().DefaultAppCertificateDir(ctx).String()
- if strings.HasPrefix(certPath, systemCertPath) {
- enforceSystemCert := ctx.Config().EnforceSystemCertificate()
- allowed := ctx.Config().EnforceSystemCertificateAllowList()
-
- if enforceSystemCert && !inList(m.Name(), allowed) {
- ctx.PropertyErrorf("certificate", "The module in product partition cannot be signed with certificate in system.")
- }
- }
- }
-
if len(certificates) > 0 {
mainCertificate = certificates[0]
} else {
@@ -593,6 +580,20 @@ func processMainCert(m android.ModuleBase, certPropValue string, certificates []
}
}
+ if !m.Platform() {
+ certPath := mainCertificate.Pem.String()
+ systemCertPath := ctx.Config().DefaultAppCertificateDir(ctx).String()
+ if strings.HasPrefix(certPath, systemCertPath) {
+ enforceSystemCert := ctx.Config().EnforceSystemCertificate()
+ allowed := ctx.Config().EnforceSystemCertificateAllowList()
+
+ if enforceSystemCert && !inList(m.Name(), allowed) {
+ ctx.PropertyErrorf("certificate", "The module in product partition cannot be signed with certificate in system.")
+ }
+ }
+ }
+
+
return mainCertificate, certificates
}
diff --git a/java/app_test.go b/java/app_test.go
index 7e97b0fb1..b154bc990 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -3382,6 +3382,14 @@ func TestAppMissingCertificateAllowMissingDependencies(t *testing.T) {
srcs: ["a.java"],
certificate: ":missing_certificate",
sdk_version: "current",
+ }
+
+ android_app {
+ name: "bar",
+ srcs: ["a.java"],
+ certificate: ":missing_certificate",
+ product_specific: true,
+ sdk_version: "current",
}`)
foo := result.ModuleForTests("foo", "android_common")
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 13fa81e66..96645b075 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -29,7 +29,7 @@ var (
defaultBindgenFlags = []string{""}
// bindgen should specify its own Clang revision so updating Clang isn't potentially blocked on bindgen failures.
- bindgenClangVersion = "clang-r487747"
+ bindgenClangVersion = "clang-r487747c"
_ = pctx.VariableFunc("bindgenClangVersion", func(ctx android.PackageVarContext) string {
if override := ctx.Config().Getenv("LLVM_BINDGEN_PREBUILTS_VERSION"); override != "" {
diff --git a/ui/build/finder.go b/ui/build/finder.go
index 3f628cf7b..62079fee9 100644
--- a/ui/build/finder.go
+++ b/ui/build/finder.go
@@ -87,6 +87,8 @@ func NewSourceFinder(ctx Context, config Config) (f *finder.Finder) {
"TEST_MAPPING",
// Bazel top-level file to mark a directory as a Bazel workspace.
"WORKSPACE",
+ // METADATA file of packages
+ "METADATA",
},
// Bazel Starlark configuration files and all .mk files for product/board configuration.
IncludeSuffixes: []string{".bzl", ".mk"},
@@ -189,6 +191,13 @@ func FindSources(ctx Context, config Config, f *finder.Finder) {
ctx.Fatalf("Could not find OWNERS: %v", err)
}
+ // Recursively look for all METADATA files.
+ metadataFiles := f.FindNamedAt(".", "METADATA")
+ err = dumpListToFile(ctx, config, metadataFiles, filepath.Join(dumpDir, "METADATA.list"))
+ if err != nil {
+ ctx.Fatalf("Could not find METADATA: %v", err)
+ }
+
// Recursively look for all TEST_MAPPING files.
testMappings := f.FindNamedAt(".", "TEST_MAPPING")
err = dumpListToFile(ctx, config, testMappings, filepath.Join(dumpDir, "TEST_MAPPING.list"))
diff --git a/ui/build/soong.go b/ui/build/soong.go
index f37a934f4..8f2154632 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -397,6 +397,8 @@ func bootstrapBlueprint(ctx Context, config Config) {
pbi.Inputs = append(pbi.Inputs,
config.Bp2BuildFilesMarkerFile(),
filepath.Join(config.FileListDir(), "bazel.list"))
+ case bp2buildFilesTag:
+ pbi.Inputs = append(pbi.Inputs, filepath.Join(config.FileListDir(), "METADATA.list"))
}
invocations = append(invocations, pbi)
}