Merge changes Ica0cb5a5,If432cdc6,Idb4b0b0a into main
* changes:
Revert^2 "Remove java_sdk_library "magic""
Revert^2 "Restrict java_sdk_library in libs of java_import and droidstubs modules"
Revert^2 "Restrict java_sdk_library in libs"
diff --git a/android/module.go b/android/module.go
index 1a3f328..e2b7e11 100644
--- a/android/module.go
+++ b/android/module.go
@@ -381,7 +381,7 @@
Native_bridge_supported *bool `android:"arch_variant"`
// init.rc files to be installed if this module is installed
- Init_rc []string `android:"arch_variant,path"`
+ Init_rc proptools.Configurable[[]string] `android:"arch_variant,path"`
// VINTF manifest fragments to be installed if this module is installed
Vintf_fragments proptools.Configurable[[]string] `android:"path"`
@@ -1855,7 +1855,7 @@
// so only a single rule is created for each init.rc or vintf fragment file.
if !m.InVendorRamdisk() {
- ctx.initRcPaths = PathsForModuleSrc(ctx, m.commonProperties.Init_rc)
+ ctx.initRcPaths = PathsForModuleSrc(ctx, m.commonProperties.Init_rc.GetOrDefault(ctx, nil))
rcDir := PathForModuleInstall(ctx, "etc", "init")
for _, src := range ctx.initRcPaths {
installedInitRc := rcDir.Join(ctx, src.Base())
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 94e0452..01551ab 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -429,41 +429,45 @@
// Also ensure that the ABI of the next API level (if there is one) matches
// this API level. *New* ABI is allowed, but any changes to APIs that exist
// in this API level are disallowed.
- if !this.apiLevel.IsCurrent() && prebuiltAbiDump.Valid() {
+ if prebuiltAbiDump.Valid() {
nextApiLevel := findNextApiLevel(ctx, this.apiLevel)
if nextApiLevel == nil {
panic(fmt.Errorf("could not determine which API level follows "+
"non-current API level %s", this.apiLevel))
}
- nextAbiDiffPath := android.PathForModuleOut(ctx,
- "abidiff_next.timestamp")
- nextAbiDump := this.findPrebuiltAbiDump(ctx, *nextApiLevel)
- missingNextPrebuiltError := fmt.Sprintf(
- missingPrebuiltErrorTemplate, this.libraryName(ctx),
- nextAbiDump.InvalidReason())
- if !nextAbiDump.Valid() {
- ctx.Build(pctx, android.BuildParams{
- Rule: android.ErrorRule,
- Output: nextAbiDiffPath,
- Args: map[string]string{
- "error": missingNextPrebuiltError,
- },
- })
- } else {
- ctx.Build(pctx, android.BuildParams{
- Rule: stgdiff,
- Description: fmt.Sprintf(
- "Comparing ABI to the next API level %s %s",
- prebuiltAbiDump, nextAbiDump),
- Output: nextAbiDiffPath,
- Inputs: android.Paths{
- prebuiltAbiDump.Path(), nextAbiDump.Path()},
- Args: map[string]string{
- "args": "--format=small --ignore=interface_addition",
- },
- })
+
+ // "current" ABI is not tracked.
+ if !nextApiLevel.IsCurrent() {
+ nextAbiDiffPath := android.PathForModuleOut(ctx,
+ "abidiff_next.timestamp")
+ nextAbiDump := this.findPrebuiltAbiDump(ctx, *nextApiLevel)
+ missingNextPrebuiltError := fmt.Sprintf(
+ missingPrebuiltErrorTemplate, this.libraryName(ctx),
+ nextAbiDump.InvalidReason())
+ if !nextAbiDump.Valid() {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.ErrorRule,
+ Output: nextAbiDiffPath,
+ Args: map[string]string{
+ "error": missingNextPrebuiltError,
+ },
+ })
+ } else {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: stgdiff,
+ Description: fmt.Sprintf(
+ "Comparing ABI to the next API level %s %s",
+ prebuiltAbiDump, nextAbiDump),
+ Output: nextAbiDiffPath,
+ Inputs: android.Paths{
+ prebuiltAbiDump.Path(), nextAbiDump.Path()},
+ Args: map[string]string{
+ "args": "--format=small --ignore=interface_addition",
+ },
+ })
+ }
+ this.abiDiffPaths = append(this.abiDiffPaths, nextAbiDiffPath)
}
- this.abiDiffPaths = append(this.abiDiffPaths, nextAbiDiffPath)
}
}
diff --git a/compliance/Android.bp b/compliance/Android.bp
new file mode 100644
index 0000000..08736b4
--- /dev/null
+++ b/compliance/Android.bp
@@ -0,0 +1,39 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+bootstrap_go_package {
+ name: "soong-compliance",
+ pkgPath: "android/soong/compliance",
+ deps: [
+ "soong-android",
+ ],
+ srcs: [
+ "notice.go",
+ ],
+ testSrcs: [
+ ],
+ pluginFor: ["soong_build"],
+}
+
+notice_xml {
+ name: "notice_xml_system",
+ partition_name: "system",
+ visibility: [
+ "//device/google/cuttlefish/system_image",
+ ],
+}
diff --git a/compliance/notice.go b/compliance/notice.go
new file mode 100644
index 0000000..4fc83ab
--- /dev/null
+++ b/compliance/notice.go
@@ -0,0 +1,100 @@
+// Copyright 2024 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compliance
+
+import (
+ "path/filepath"
+
+ "android/soong/android"
+ "github.com/google/blueprint"
+)
+
+func init() {
+ RegisterNoticeXmlBuildComponents(android.InitRegistrationContext)
+}
+
+var PrepareForTestWithNoticeXmlBuildComponents = android.GroupFixturePreparers(
+ android.FixtureRegisterWithContext(RegisterNoticeXmlBuildComponents),
+)
+
+var PrepareForTestWithNoticeXml = android.GroupFixturePreparers(
+ PrepareForTestWithNoticeXmlBuildComponents,
+)
+
+func RegisterNoticeXmlBuildComponents(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("notice_xml", NoticeXmlFactory)
+}
+
+var (
+ pctx = android.NewPackageContext("android/soong/compliance")
+
+ genNoticeXml = pctx.HostBinToolVariable("genNoticeXml", "gen_notice_xml")
+
+ // Command to generate NOTICE.xml.gz for a partition
+ genNoticeXmlRule = pctx.AndroidStaticRule("genNoticeXmlRule", blueprint.RuleParams{
+ Command: "rm -rf $out && " +
+ "${genNoticeXml} --output_file ${out} --metadata ${in} --partition ${partition} --product_out ${productOut} --soong_out ${soongOut}",
+ CommandDeps: []string{"${genNoticeXml}"},
+ }, "partition", "productOut", "soongOut")
+)
+
+func NoticeXmlFactory() android.Module {
+ m := &NoticeXmlModule{}
+ m.AddProperties(&m.props)
+ android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibFirst)
+ return m
+}
+
+type NoticeXmlModule struct {
+ android.ModuleBase
+
+ props noticeXmlProperties
+
+ outputFile android.OutputPath
+ installPath android.InstallPath
+}
+
+type noticeXmlProperties struct {
+ Partition_name string
+}
+
+func (nx *NoticeXmlModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ output := android.PathForModuleOut(ctx, "NOTICE.xml.gz")
+ metadataDb := android.PathForOutput(ctx, "compliance-metadata", ctx.Config().DeviceProduct(), "compliance-metadata.db")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: genNoticeXmlRule,
+ Input: metadataDb,
+ Output: output,
+ Args: map[string]string{
+ "productOut": filepath.Join(ctx.Config().OutDir(), "target", "product", ctx.Config().DeviceName()),
+ "soongOut": ctx.Config().SoongOutDir(),
+ "partition": nx.props.Partition_name,
+ },
+ })
+
+ nx.outputFile = output.OutputPath
+
+ if android.Bool(ctx.Config().ProductVariables().UseSoongSystemImage) {
+ nx.installPath = android.PathForModuleInPartitionInstall(ctx, nx.props.Partition_name, "etc")
+ ctx.InstallFile(nx.installPath, "NOTICE.xml.gz", nx.outputFile)
+ }
+}
+
+func (nx *NoticeXmlModule) AndroidMkEntries() []android.AndroidMkEntries {
+ return []android.AndroidMkEntries{{
+ Class: "ETC",
+ OutputFile: android.OptionalPathForPath(nx.outputFile),
+ }}
+}
diff --git a/compliance/notice_test.go b/compliance/notice_test.go
new file mode 100644
index 0000000..6187e53
--- /dev/null
+++ b/compliance/notice_test.go
@@ -0,0 +1,38 @@
+// Copyright 2024 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compliance
+
+import (
+ "testing"
+
+ "android/soong/android"
+)
+
+var prepareForNoticeXmlTest = android.GroupFixturePreparers(
+ android.PrepareForTestWithArchMutator,
+ PrepareForTestWithNoticeXml,
+)
+
+func TestPrebuiltEtcOutputFile(t *testing.T) {
+ result := prepareForNoticeXmlTest.RunTestWithBp(t, `
+ notice_xml {
+ name: "notice_xml_system",
+ partition_name: "system",
+ }
+ `)
+
+ m := result.Module("notice_xml_system", "android_arm64_armv8-a").(*NoticeXmlModule)
+ android.AssertStringEquals(t, "output file", "NOTICE.xml.gz", m.outputFile.Base())
+}
\ No newline at end of file
diff --git a/rust/config/arm64_device.go b/rust/config/arm64_device.go
index 9850570..94a4457 100644
--- a/rust/config/arm64_device.go
+++ b/rust/config/arm64_device.go
@@ -35,8 +35,13 @@
},
"armv8-2a": []string{},
"armv8-2a-dotprod": []string{},
+
+ // branch-protection=bti,pac-ret is equivalent to Clang's mbranch-protection=standard
"armv9-a": []string{
- // branch-protection=bti,pac-ret is equivalent to Clang's mbranch-protection=standard
+ "-Z branch-protection=bti,pac-ret",
+ "-Z stack-protector=none",
+ },
+ "armv9-2a": []string{
"-Z branch-protection=bti,pac-ret",
"-Z stack-protector=none",
},
diff --git a/tests/build_action_caching_test.sh b/tests/build_action_caching_test.sh
index 981827d..7524d82 100755
--- a/tests/build_action_caching_test.sh
+++ b/tests/build_action_caching_test.sh
@@ -71,9 +71,11 @@
cp -pr out/soong/build_aosp_arm_ninja_incremental out/soong/*.mk out/soong/build.aosp_arm.*.ninja ${OUTPUT_DIR}/after
compare_files
+ echo "Tests passed"
}
function compare_files() {
+ count=0
for file_before in ${OUTPUT_DIR}/before/*.ninja; do
file_after="${OUTPUT_DIR}/after/$(basename "$file_before")"
assert_files_equal $file_before $file_after
@@ -82,8 +84,11 @@
echo "Files have identical mtime: $file_before $file_after"
exit 1
fi
+ ((count++))
done
+ echo "Compared $count ninja files"
+ count=0
for file_before in ${OUTPUT_DIR}/before/*.mk; do
file_after="${OUTPUT_DIR}/after/$(basename "$file_before")"
assert_files_equal $file_before $file_after
@@ -93,8 +98,11 @@
echo "Files have different mtimes: $file_before $file_after"
exit 1
fi
+ ((count++))
done
+ echo "Compared $count mk files"
+ count=0
for file_before in ${OUTPUT_DIR}/before/build_aosp_arm_ninja_incremental/*.ninja; do
file_after="${OUTPUT_DIR}/after/build_aosp_arm_ninja_incremental/$(basename "$file_before")"
assert_files_equal $file_before $file_after
@@ -104,7 +112,9 @@
echo "Files have different mtimes: $file_before $file_after"
exit 1
fi
+ ((count++))
done
+ echo "Compared $count incremental ninja files"
}
test_build_action_restoring
diff --git a/tradefed_modules/test_module_config.go b/tradefed_modules/test_module_config.go
index ef18131..7a04c19 100644
--- a/tradefed_modules/test_module_config.go
+++ b/tradefed_modules/test_module_config.go
@@ -242,6 +242,7 @@
entries.SetBoolIfTrue("LOCAL_IS_UNIT_TEST", m.provider.IsUnitTest)
entries.AddCompatibilityTestSuites(m.tradefedProperties.Test_suites...)
+ entries.AddStrings("LOCAL_HOST_REQUIRED_MODULES", m.provider.HostRequiredModuleNames...)
// The app_prebuilt_internal.mk files try create a copy of the OutputFile as an .apk.
// Normally, this copies the "package.apk" from the intermediate directory here.
diff --git a/tradefed_modules/test_module_config_test.go b/tradefed_modules/test_module_config_test.go
index 1510a03..f76a152 100644
--- a/tradefed_modules/test_module_config_test.go
+++ b/tradefed_modules/test_module_config_test.go
@@ -40,6 +40,7 @@
name: "base",
sdk_version: "current",
data: [":HelperApp", "data/testfile"],
+ host_required: ["other-module"],
test_suites: ["general-tests"],
}
@@ -80,6 +81,7 @@
android.AssertArrayString(t, "", entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"], []string{})
android.AssertArrayString(t, "", entries.EntryMap["LOCAL_REQUIRED_MODULES"], []string{"base"})
+ android.AssertArrayString(t, "", entries.EntryMap["LOCAL_HOST_REQUIRED_MODULES"], []string{"other-module"})
android.AssertArrayString(t, "", entries.EntryMap["LOCAL_CERTIFICATE"], []string{"build/make/target/product/security/testkey.x509.pem"})
android.AssertStringEquals(t, "", entries.Class, "APPS")