Merge "Allow soong config value variables to set nested properties" into main
diff --git a/aconfig/all_aconfig_declarations.go b/aconfig/all_aconfig_declarations.go
index b6c9023..3d9663c 100644
--- a/aconfig/all_aconfig_declarations.go
+++ b/aconfig/all_aconfig_declarations.go
@@ -31,7 +31,8 @@
}
type allAconfigDeclarationsSingleton struct {
- intermediatePath android.OutputPath
+ intermediateBinaryProtoPath android.OutputPath
+ intermediateTextProtoPath android.OutputPath
}
func (this *allAconfigDeclarationsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
@@ -59,20 +60,35 @@
panic(fmt.Errorf("Only one aconfig_declarations allowed for each package."))
}
- // Generate build action for aconfig
- this.intermediatePath = android.PathForIntermediates(ctx, "all_aconfig_declarations.pb")
+ // Generate build action for aconfig (binary proto output)
+ this.intermediateBinaryProtoPath = android.PathForIntermediates(ctx, "all_aconfig_declarations.pb")
ctx.Build(pctx, android.BuildParams{
Rule: AllDeclarationsRule,
Inputs: cacheFiles,
- Output: this.intermediatePath,
+ Output: this.intermediateBinaryProtoPath,
Description: "all_aconfig_declarations",
Args: map[string]string{
"cache_files": android.JoinPathsWithPrefix(cacheFiles, "--cache "),
},
})
- ctx.Phony("all_aconfig_declarations", this.intermediatePath)
+ ctx.Phony("all_aconfig_declarations", this.intermediateBinaryProtoPath)
+
+ // Generate build action for aconfig (text proto output)
+ this.intermediateTextProtoPath = android.PathForIntermediates(ctx, "all_aconfig_declarations.textproto")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: AllDeclarationsRuleTextProto,
+ Inputs: cacheFiles,
+ Output: this.intermediateTextProtoPath,
+ Description: "all_aconfig_declarations_textproto",
+ Args: map[string]string{
+ "cache_files": android.JoinPathsWithPrefix(cacheFiles, "--cache "),
+ },
+ })
+ ctx.Phony("all_aconfig_declarations_textproto", this.intermediateTextProtoPath)
}
func (this *allAconfigDeclarationsSingleton) MakeVars(ctx android.MakeVarsContext) {
- ctx.DistForGoal("droid", this.intermediatePath)
+ ctx.DistForGoal("droid", this.intermediateBinaryProtoPath)
+ ctx.DistForGoalWithFilename("sdk", this.intermediateBinaryProtoPath, "flags.pb")
+ ctx.DistForGoalWithFilename("sdk", this.intermediateTextProtoPath, "flags.textproto")
}
diff --git a/aconfig/init.go b/aconfig/init.go
index 16fb0cd..e64429f 100644
--- a/aconfig/init.go
+++ b/aconfig/init.go
@@ -75,6 +75,21 @@
"${aconfig}",
},
}, "cache_files")
+ AllDeclarationsRuleTextProto = pctx.AndroidStaticRule("All_aconfig_declarations_dump_textproto",
+ blueprint.RuleParams{
+ Command: `${aconfig} dump-cache --dedup --format textproto --out ${out} ${cache_files}`,
+ CommandDeps: []string{
+ "${aconfig}",
+ },
+ }, "cache_files")
+
+ CreateStorageRule = pctx.AndroidStaticRule("aconfig_create_storage",
+ blueprint.RuleParams{
+ Command: `${aconfig} create-storage --container ${container} --file ${file_type} --out ${out} ${cache_files}`,
+ CommandDeps: []string{
+ "${aconfig}",
+ },
+ }, "container", "file_type", "cache_files")
// For exported_java_aconfig_library: Generate a JAR from all
// java_aconfig_libraries to be consumed by apps built outside the
diff --git a/android/config.go b/android/config.go
index a87ca3b..75471b9 100644
--- a/android/config.go
+++ b/android/config.go
@@ -654,6 +654,7 @@
"framework-nfc": {},
"framework-ondevicepersonalization": {},
"framework-pdf": {},
+ "framework-pdf-v": {},
"framework-permission": {},
"framework-permission-s": {},
"framework-scheduling": {},
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 5cc50dd..02dc6e6 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -11115,25 +11115,23 @@
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
- if len(copyCmds) != 5 {
+ if len(copyCmds) != 8 {
t.Fatalf("Expected 5 commands, got %d in:\n%s", len(copyCmds), s)
}
ensureMatches(t, copyCmds[4], "^cp -f .*/aconfig_flags.pb .*/image.apex$")
+ ensureMatches(t, copyCmds[5], "^cp -f .*/package.map .*/image.apex$")
+ ensureMatches(t, copyCmds[6], "^cp -f .*/flag.map .*/image.apex$")
+ ensureMatches(t, copyCmds[7], "^cp -f .*/flag.val .*/image.apex$")
- combineAconfigRule := mod.Rule("All_aconfig_declarations_dump")
- s = " " + combineAconfigRule.Args["cache_files"]
- aconfigArgs := regexp.MustCompile(" --cache ").Split(s, -1)[1:]
- if len(aconfigArgs) != 2 {
- t.Fatalf("Expected 2 commands, got %d in:\n%s", len(aconfigArgs), s)
+ inputs := []string{
+ "my_aconfig_declarations_foo/intermediate.pb",
+ "my_aconfig_declarations_bar/intermediate.pb",
}
- android.EnsureListContainsSuffix(t, aconfigArgs, "my_aconfig_declarations_foo/intermediate.pb")
- android.EnsureListContainsSuffix(t, aconfigArgs, "my_aconfig_declarations_bar/intermediate.pb")
-
- buildParams := combineAconfigRule.BuildParams
- android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_aconfig_declarations_foo/intermediate.pb")
- android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_aconfig_declarations_bar/intermediate.pb")
- ensureContains(t, buildParams.Output.String(), "android_common_myapex/aconfig_flags.pb")
+ VerifyAconfigRule(t, &mod, "combine_aconfig_declarations", inputs, "android_common_myapex/aconfig_flags.pb", "", "")
+ VerifyAconfigRule(t, &mod, "create_aconfig_package_map_file", inputs, "android_common_myapex/package.map", "myapex", "package_map")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_map_file", inputs, "android_common_myapex/flag.map", "myapex", "flag_map")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_val_file", inputs, "android_common_myapex/flag.val", "myapex", "flag_val")
}
func TestAconfigFilesJavaAndCcDeps(t *testing.T) {
@@ -11241,30 +11239,24 @@
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
- if len(copyCmds) != 9 {
- t.Fatalf("Expected 9 commands, got %d in:\n%s", len(copyCmds), s)
+ if len(copyCmds) != 12 {
+ t.Fatalf("Expected 12 commands, got %d in:\n%s", len(copyCmds), s)
}
ensureMatches(t, copyCmds[8], "^cp -f .*/aconfig_flags.pb .*/image.apex$")
+ ensureMatches(t, copyCmds[9], "^cp -f .*/package.map .*/image.apex$")
+ ensureMatches(t, copyCmds[10], "^cp -f .*/flag.map .*/image.apex$")
+ ensureMatches(t, copyCmds[11], "^cp -f .*/flag.val .*/image.apex$")
- combineAconfigRule := mod.Rule("All_aconfig_declarations_dump")
- s = " " + combineAconfigRule.Args["cache_files"]
- aconfigArgs := regexp.MustCompile(" --cache ").Split(s, -1)[1:]
- if len(aconfigArgs) != 3 {
- t.Fatalf("Expected 3 commands, got %d in:\n%s", len(aconfigArgs), s)
+ inputs := []string{
+ "my_aconfig_declarations_foo/intermediate.pb",
+ "my_cc_library_bar/android_arm64_armv8-a_shared_apex10000/myapex/aconfig_merged.pb",
+ "my_aconfig_declarations_baz/intermediate.pb",
}
- android.EnsureListContainsSuffix(t, aconfigArgs, "my_aconfig_declarations_foo/intermediate.pb")
- android.EnsureListContainsSuffix(t, aconfigArgs, "my_cc_library_bar/android_arm64_armv8-a_shared_apex10000/myapex/aconfig_merged.pb")
- android.EnsureListContainsSuffix(t, aconfigArgs, "my_aconfig_declarations_baz/intermediate.pb")
-
- buildParams := combineAconfigRule.BuildParams
- if len(buildParams.Inputs) != 3 {
- t.Fatalf("Expected 3 input, got %d", len(buildParams.Inputs))
- }
- android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_aconfig_declarations_foo/intermediate.pb")
- android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_cc_library_bar/android_arm64_armv8-a_shared_apex10000/myapex/aconfig_merged.pb")
- android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_aconfig_declarations_baz/intermediate.pb")
- ensureContains(t, buildParams.Output.String(), "android_common_myapex/aconfig_flags.pb")
+ VerifyAconfigRule(t, &mod, "combine_aconfig_declarations", inputs, "android_common_myapex/aconfig_flags.pb", "", "")
+ VerifyAconfigRule(t, &mod, "create_aconfig_package_map_file", inputs, "android_common_myapex/package.map", "myapex", "package_map")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_map_file", inputs, "android_common_myapex/flag.map", "myapex", "flag_map")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_val_file", inputs, "android_common_myapex/flag.val", "myapex", "flag_val")
}
func TestAconfigFilesRustDeps(t *testing.T) {
@@ -11388,28 +11380,43 @@
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
s := mod.Rule("apexRule").Args["copy_commands"]
copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
- if len(copyCmds) != 23 {
- t.Fatalf("Expected 23 commands, got %d in:\n%s", len(copyCmds), s)
+ if len(copyCmds) != 26 {
+ t.Fatalf("Expected 26 commands, got %d in:\n%s", len(copyCmds), s)
}
ensureMatches(t, copyCmds[22], "^cp -f .*/aconfig_flags.pb .*/image.apex$")
+ ensureMatches(t, copyCmds[23], "^cp -f .*/package.map .*/image.apex$")
+ ensureMatches(t, copyCmds[24], "^cp -f .*/flag.map .*/image.apex$")
+ ensureMatches(t, copyCmds[25], "^cp -f .*/flag.val .*/image.apex$")
- combineAconfigRule := mod.Rule("All_aconfig_declarations_dump")
- s = " " + combineAconfigRule.Args["cache_files"]
+ inputs := []string{
+ "my_aconfig_declarations_foo/intermediate.pb",
+ "my_rust_binary/android_arm64_armv8-a_apex10000/myapex/aconfig_merged.pb",
+ }
+ VerifyAconfigRule(t, &mod, "combine_aconfig_declarations", inputs, "android_common_myapex/aconfig_flags.pb", "", "")
+ VerifyAconfigRule(t, &mod, "create_aconfig_package_map_file", inputs, "android_common_myapex/package.map", "myapex", "package_map")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_map_file", inputs, "android_common_myapex/flag.map", "myapex", "flag_map")
+ VerifyAconfigRule(t, &mod, "create_aconfig_flag_val_file", inputs, "android_common_myapex/flag.val", "myapex", "flag_val")
+}
+
+func VerifyAconfigRule(t *testing.T, mod *android.TestingModule, desc string, inputs []string, output string, container string, file_type string) {
+ aconfigRule := mod.Description(desc)
+ s := " " + aconfigRule.Args["cache_files"]
aconfigArgs := regexp.MustCompile(" --cache ").Split(s, -1)[1:]
- if len(aconfigArgs) != 2 {
- t.Fatalf("Expected 2 commands, got %d in:\n%s", len(aconfigArgs), s)
+ if len(aconfigArgs) != len(inputs) {
+ t.Fatalf("Expected %d commands, got %d in:\n%s", len(inputs), len(aconfigArgs), s)
}
- android.EnsureListContainsSuffix(t, aconfigArgs, "my_aconfig_declarations_foo/intermediate.pb")
- android.EnsureListContainsSuffix(t, aconfigArgs, "my_rust_binary/android_arm64_armv8-a_apex10000/myapex/aconfig_merged.pb")
- buildParams := combineAconfigRule.BuildParams
- if len(buildParams.Inputs) != 2 {
- t.Fatalf("Expected 3 input, got %d", len(buildParams.Inputs))
+ ensureEquals(t, container, aconfigRule.Args["container"])
+ ensureEquals(t, file_type, aconfigRule.Args["file_type"])
+
+ buildParams := aconfigRule.BuildParams
+ for _, input := range inputs {
+ android.EnsureListContainsSuffix(t, aconfigArgs, input)
+ android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), input)
}
- android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_aconfig_declarations_foo/intermediate.pb")
- android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_rust_binary/android_arm64_armv8-a_apex10000/myapex/aconfig_merged.pb")
- ensureContains(t, buildParams.Output.String(), "android_common_myapex/aconfig_flags.pb")
+
+ ensureContains(t, buildParams.Output.String(), output)
}
func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) {
diff --git a/apex/builder.go b/apex/builder.go
index 3d61219..e49cf28 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -85,6 +85,18 @@
pctx.HostBinToolVariable("aconfig", "aconfig")
}
+type createStorageStruct struct {
+ Output_file string
+ Desc string
+ File_type string
+}
+
+var createStorageInfo = []createStorageStruct{
+ {"package.map", "create_aconfig_package_map_file", "package_map"},
+ {"flag.map", "create_aconfig_flag_map_file", "flag_map"},
+ {"flag.val", "create_aconfig_flag_val_file", "flag_val"},
+}
+
var (
apexManifestRule = pctx.StaticRule("apexManifestRule", blueprint.RuleParams{
Command: `rm -f $out && ${jsonmodify} $in ` +
@@ -648,6 +660,25 @@
copyCommands = append(copyCommands, "cp -f "+apexAconfigFile.String()+" "+imageDir.String())
implicitInputs = append(implicitInputs, apexAconfigFile)
defaultReadOnlyFiles = append(defaultReadOnlyFiles, apexAconfigFile.Base())
+
+ for _, info := range createStorageInfo {
+ outputFile := android.PathForModuleOut(ctx, info.Output_file)
+ ctx.Build(pctx, android.BuildParams{
+ Rule: aconfig.CreateStorageRule,
+ Inputs: a.aconfigFiles,
+ Output: outputFile,
+ Description: info.Desc,
+ Args: map[string]string{
+ "container": ctx.ModuleName(),
+ "file_type": info.File_type,
+ "cache_files": android.JoinPathsWithPrefix(a.aconfigFiles, "--cache "),
+ },
+ })
+
+ copyCommands = append(copyCommands, "cp -f "+outputFile.String()+" "+imageDir.String())
+ implicitInputs = append(implicitInputs, outputFile)
+ defaultReadOnlyFiles = append(defaultReadOnlyFiles, outputFile.Base())
+ }
}
////////////////////////////////////////////////////////////////////////////////////
diff --git a/bloaty/bloaty.go b/bloaty/bloaty.go
index 43fb71d..b72b6d3 100644
--- a/bloaty/bloaty.go
+++ b/bloaty/bloaty.go
@@ -85,6 +85,9 @@
func (singleton *sizesSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var deps android.Paths
ctx.VisitAllModules(func(m android.Module) {
+ if !m.ExportedToMake() {
+ return
+ }
filePaths, ok := android.SingletonModuleProvider(ctx, m, fileSizeMeasurerKey)
if !ok {
return
diff --git a/cc/check.go b/cc/check.go
index 58ff5b2..32d1f06 100644
--- a/cc/check.go
+++ b/cc/check.go
@@ -45,6 +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") {
+ ctx.PropertyErrorf(prop, "Bad flag: `%s`, use the correct target soong rule.", flag)
} else if strings.Contains(flag, " ") {
args := strings.Split(flag, " ")
if args[0] == "-include" {
diff --git a/cc/config/global.go b/cc/config/global.go
index d3c2658..b21d56c 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -367,8 +367,6 @@
"-Wno-gnu-offsetof-extensions",
// TODO: Enable this warning http://b/315245071
"-Wno-fortify-source",
- "-Wno-tautological-negation-compare",
- "-Wno-tautological-undefined-compare",
}
llvmNextExtraCommonGlobalCflags = []string{
diff --git a/java/java.go b/java/java.go
index 7cf5c1f..af4c3be 100644
--- a/java/java.go
+++ b/java/java.go
@@ -699,8 +699,178 @@
}
}
-func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+// list of java_library modules that set platform_apis: true
+// this property is a no-op for java_library
+// TODO (b/215379393): Remove this allowlist
+var (
+ aospPlatformApiAllowlist = map[string]bool{
+ "adservices-test-scenarios": true,
+ "aidl-cpp-java-test-interface-java": true,
+ "aidl-test-extras-java": true,
+ "aidl-test-interface-java": true,
+ "aidl-test-interface-permission-java": true,
+ "aidl_test_java_client_permission": true,
+ "aidl_test_java_client_sdk1": true,
+ "aidl_test_java_client_sdk29": true,
+ "aidl_test_java_client": true,
+ "aidl_test_java_service_permission": true,
+ "aidl_test_java_service_sdk1": true,
+ "aidl_test_java_service_sdk29": true,
+ "aidl_test_java_service": true,
+ "aidl_test_loggable_interface-java": true,
+ "aidl_test_nonvintf_parcelable-V1-java": true,
+ "aidl_test_nonvintf_parcelable-V2-java": true,
+ "aidl_test_unstable_parcelable-java": true,
+ "aidl_test_vintf_parcelable-V1-java": true,
+ "aidl_test_vintf_parcelable-V2-java": true,
+ "android.aidl.test.trunk-V1-java": true,
+ "android.aidl.test.trunk-V2-java": true,
+ "android.frameworks.location.altitude-V1-java": true,
+ "android.frameworks.location.altitude-V2-java": true,
+ "android.frameworks.stats-V1-java": true,
+ "android.frameworks.stats-V2-java": true,
+ "android.frameworks.stats-V3-java": true,
+ "android.hardware.authsecret-V1-java": true,
+ "android.hardware.authsecret-V2-java": true,
+ "android.hardware.biometrics.common-V1-java": true,
+ "android.hardware.biometrics.common-V2-java": true,
+ "android.hardware.biometrics.common-V3-java": true,
+ "android.hardware.biometrics.common-V4-java": true,
+ "android.hardware.biometrics.face-V1-java": true,
+ "android.hardware.biometrics.face-V2-java": true,
+ "android.hardware.biometrics.face-V3-java": true,
+ "android.hardware.biometrics.face-V4-java": true,
+ "android.hardware.biometrics.fingerprint-V1-java": true,
+ "android.hardware.biometrics.fingerprint-V2-java": true,
+ "android.hardware.biometrics.fingerprint-V3-java": true,
+ "android.hardware.biometrics.fingerprint-V4-java": true,
+ "android.hardware.bluetooth.lmp_event-V1-java": true,
+ "android.hardware.confirmationui-V1-java": true,
+ "android.hardware.confirmationui-V2-java": true,
+ "android.hardware.gatekeeper-V1-java": true,
+ "android.hardware.gatekeeper-V2-java": true,
+ "android.hardware.gnss-V1-java": true,
+ "android.hardware.gnss-V2-java": true,
+ "android.hardware.gnss-V3-java": true,
+ "android.hardware.gnss-V4-java": true,
+ "android.hardware.graphics.common-V1-java": true,
+ "android.hardware.graphics.common-V2-java": true,
+ "android.hardware.graphics.common-V3-java": true,
+ "android.hardware.graphics.common-V4-java": true,
+ "android.hardware.graphics.common-V5-java": true,
+ "android.hardware.identity-V1-java": true,
+ "android.hardware.identity-V2-java": true,
+ "android.hardware.identity-V3-java": true,
+ "android.hardware.identity-V4-java": true,
+ "android.hardware.identity-V5-java": true,
+ "android.hardware.identity-V6-java": true,
+ "android.hardware.keymaster-V1-java": true,
+ "android.hardware.keymaster-V2-java": true,
+ "android.hardware.keymaster-V3-java": true,
+ "android.hardware.keymaster-V4-java": true,
+ "android.hardware.keymaster-V5-java": true,
+ "android.hardware.oemlock-V1-java": true,
+ "android.hardware.oemlock-V2-java": true,
+ "android.hardware.power.stats-V1-java": true,
+ "android.hardware.power.stats-V2-java": true,
+ "android.hardware.power.stats-V3-java": true,
+ "android.hardware.power-V1-java": true,
+ "android.hardware.power-V2-java": true,
+ "android.hardware.power-V3-java": true,
+ "android.hardware.power-V4-java": true,
+ "android.hardware.power-V5-java": true,
+ "android.hardware.rebootescrow-V1-java": true,
+ "android.hardware.rebootescrow-V2-java": true,
+ "android.hardware.security.authgraph-V1-java": true,
+ "android.hardware.security.keymint-V1-java": true,
+ "android.hardware.security.keymint-V2-java": true,
+ "android.hardware.security.keymint-V3-java": true,
+ "android.hardware.security.keymint-V4-java": true,
+ "android.hardware.security.secureclock-V1-java": true,
+ "android.hardware.security.secureclock-V2-java": true,
+ "android.hardware.thermal-V1-java": true,
+ "android.hardware.thermal-V2-java": true,
+ "android.hardware.threadnetwork-V1-java": true,
+ "android.hardware.weaver-V1-java": true,
+ "android.hardware.weaver-V2-java": true,
+ "android.hardware.weaver-V3-java": true,
+ "android.security.attestationmanager-java": true,
+ "android.security.authorization-java": true,
+ "android.security.compat-java": true,
+ "android.security.legacykeystore-java": true,
+ "android.security.maintenance-java": true,
+ "android.security.metrics-java": true,
+ "android.system.keystore2-V1-java": true,
+ "android.system.keystore2-V2-java": true,
+ "android.system.keystore2-V3-java": true,
+ "android.system.keystore2-V4-java": true,
+ "binderReadParcelIface-java": true,
+ "binderRecordReplayTestIface-java": true,
+ "car-experimental-api-static-lib": true,
+ "collector-device-lib-platform": true,
+ "com.android.car.oem": true,
+ "com.google.hardware.pixel.display-V10-java": true,
+ "com.google.hardware.pixel.display-V1-java": true,
+ "com.google.hardware.pixel.display-V2-java": true,
+ "com.google.hardware.pixel.display-V3-java": true,
+ "com.google.hardware.pixel.display-V4-java": true,
+ "com.google.hardware.pixel.display-V5-java": true,
+ "com.google.hardware.pixel.display-V6-java": true,
+ "com.google.hardware.pixel.display-V7-java": true,
+ "com.google.hardware.pixel.display-V8-java": true,
+ "com.google.hardware.pixel.display-V9-java": true,
+ "conscrypt-support": true,
+ "cts-keystore-test-util": true,
+ "cts-keystore-user-auth-helper-library": true,
+ "ctsmediautil": true,
+ "CtsNetTestsNonUpdatableLib": true,
+ "DpmWrapper": true,
+ "flickerlib-apphelpers": true,
+ "flickerlib-helpers": true,
+ "flickerlib-parsers": true,
+ "flickerlib": true,
+ "hardware.google.bluetooth.ccc-V1-java": true,
+ "hardware.google.bluetooth.sar-V1-java": true,
+ "monet": true,
+ "pixel-power-ext-V1-java": true,
+ "pixel-power-ext-V2-java": true,
+ "pixel_stateresidency_provider_aidl_interface-java": true,
+ "pixel-thermal-ext-V1-java": true,
+ "protolog-lib": true,
+ "RkpRegistrationCheck": true,
+ "rotary-service-javastream-protos": true,
+ "service_based_camera_extensions": true,
+ "statsd-helper-test": true,
+ "statsd-helper": true,
+ "test-piece-2-V1-java": true,
+ "test-piece-2-V2-java": true,
+ "test-piece-3-V1-java": true,
+ "test-piece-3-V2-java": true,
+ "test-piece-3-V3-java": true,
+ "test-piece-4-V1-java": true,
+ "test-piece-4-V2-java": true,
+ "test-root-package-V1-java": true,
+ "test-root-package-V2-java": true,
+ "test-root-package-V3-java": true,
+ "test-root-package-V4-java": true,
+ "testServiceIface-java": true,
+ "wm-flicker-common-app-helpers": true,
+ "wm-flicker-common-assertions": true,
+ "wm-shell-flicker-utils": true,
+ "wycheproof-keystore": true,
+ }
+ // Union of aosp and internal allowlists
+ PlatformApiAllowlist = map[string]bool{}
+)
+
+func init() {
+ for k, v := range aospPlatformApiAllowlist {
+ PlatformApiAllowlist[k] = v
+ }
+}
+
+func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.provideHiddenAPIPropertyInfo(ctx)
j.sdkVersion = j.SdkVersion(ctx)
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 2e4f2e3..d532aaa 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1997,8 +1997,10 @@
tag string
pattern string
}{
- {tag: ".api.txt", pattern: "%s.txt"},
- {tag: ".removed-api.txt", pattern: "%s-removed.txt"},
+ // "exportable" api files are copied to the dist directory instead of the
+ // "everything" api files.
+ {tag: ".exportable.api.txt", pattern: "%s.txt"},
+ {tag: ".exportable.removed-api.txt", pattern: "%s-removed.txt"},
} {
props.Dists = append(props.Dists, android.Dist{
Targets: []string{"sdk", "win_sdk"},
diff --git a/rust/config/global.go b/rust/config/global.go
index aebbb1b..418eca4 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -25,7 +25,7 @@
pctx = android.NewPackageContext("android/soong/rust/config")
ExportedVars = android.NewExportedVariables(pctx)
- RustDefaultVersion = "1.74.1"
+ RustDefaultVersion = "1.75.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2021"
Stdlibs = []string{
diff --git a/rust/testing.go b/rust/testing.go
index 0b34c97..d9cacdc 100644
--- a/rust/testing.go
+++ b/rust/testing.go
@@ -75,6 +75,7 @@
apex_available: ["//apex_available:platform", "//apex_available:anyapex"],
min_sdk_version: "29",
vendor_available: true,
+ host_supported: true,
recovery_available: true,
llndk: {
symbol_file: "liblog.map.txt",
diff --git a/sysprop/Android.bp b/sysprop/Android.bp
index 1d5eb31..a00a5e4 100644
--- a/sysprop/Android.bp
+++ b/sysprop/Android.bp
@@ -11,6 +11,7 @@
"soong-android",
"soong-cc",
"soong-java",
+ "soong-rust",
],
srcs: [
"sysprop_library.go",
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 766f3e7..2258232 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -21,6 +21,7 @@
"io"
"os"
"path"
+ "strings"
"sync"
"github.com/google/blueprint"
@@ -29,6 +30,7 @@
"android/soong/android"
"android/soong/cc"
"android/soong/java"
+ "android/soong/rust"
)
type dependencyTag struct {
@@ -51,7 +53,16 @@
genSrcjars android.Paths
}
+type syspropRustGenRule struct {
+ android.ModuleBase
+
+ properties syspropGenProperties
+
+ genSrcs android.Paths
+}
+
var _ android.OutputFileProducer = (*syspropJavaGenRule)(nil)
+var _ android.OutputFileProducer = (*syspropRustGenRule)(nil)
var (
syspropJava = pctx.AndroidStaticRule("syspropJava",
@@ -64,11 +75,20 @@
"$soongZipCmd",
},
}, "scope")
+ syspropRust = pctx.AndroidStaticRule("syspropRust",
+ blueprint.RuleParams{
+ Command: `rm -rf $out_dir && mkdir -p $out_dir && ` +
+ `$syspropRustCmd --scope $scope --rust-output-dir $out_dir $in`,
+ CommandDeps: []string{
+ "$syspropRustCmd",
+ },
+ }, "scope", "out_dir")
)
func init() {
pctx.HostBinToolVariable("soongZipCmd", "soong_zip")
pctx.HostBinToolVariable("syspropJavaCmd", "sysprop_java")
+ pctx.HostBinToolVariable("syspropRustCmd", "sysprop_rust")
}
// syspropJavaGenRule module generates srcjar containing generated java APIs.
@@ -122,6 +142,56 @@
return g
}
+// syspropRustGenRule module generates rust source files containing generated rust APIs.
+// It also depends on check api rule, so api check has to pass to use sysprop_library.
+func (g *syspropRustGenRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ var checkApiFileTimeStamp android.WritablePath
+
+ ctx.VisitDirectDeps(func(dep android.Module) {
+ if m, ok := dep.(*syspropLibrary); ok {
+ checkApiFileTimeStamp = m.checkApiFileTimeStamp
+ }
+ })
+
+ for _, syspropFile := range android.PathsForModuleSrc(ctx, g.properties.Srcs) {
+ syspropDir := strings.TrimSuffix(syspropFile.String(), syspropFile.Ext())
+ outputDir := android.PathForModuleGen(ctx, syspropDir, "src")
+ libPath := android.PathForModuleGen(ctx, syspropDir, "src", "lib.rs")
+ parsersPath := android.PathForModuleGen(ctx, syspropDir, "src", "gen_parsers_and_formatters.rs")
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: syspropRust,
+ Description: "sysprop_rust " + syspropFile.Rel(),
+ Outputs: android.WritablePaths{libPath, parsersPath},
+ Input: syspropFile,
+ Implicit: checkApiFileTimeStamp,
+ Args: map[string]string{
+ "scope": g.properties.Scope,
+ "out_dir": outputDir.String(),
+ },
+ })
+
+ g.genSrcs = append(g.genSrcs, libPath, parsersPath)
+ }
+}
+
+func (g *syspropRustGenRule) DepsMutator(ctx android.BottomUpMutatorContext) {
+ // Add a dependency from the stubs to sysprop library so that the generator rule can depend on
+ // the check API rule of the sysprop library.
+ ctx.AddFarVariationDependencies(nil, nil, proptools.String(g.properties.Check_api))
+}
+
+func (g *syspropRustGenRule) OutputFiles(_ string) (android.Paths, error) {
+ return g.genSrcs, nil
+}
+
+func syspropRustGenFactory() android.Module {
+ g := &syspropRustGenRule{}
+ g.AddProperties(&g.properties)
+ android.InitAndroidModule(g)
+ return g
+}
+
type syspropLibrary struct {
android.ModuleBase
android.ApexModuleBase
@@ -180,6 +250,12 @@
// Forwarded to java_library.min_sdk_version
Min_sdk_version *string
}
+
+ Rust struct {
+ // Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
+ // Forwarded to rust_library.min_sdk_version
+ Min_sdk_version *string
+ }
}
var (
@@ -233,6 +309,21 @@
return m.BaseModuleName() + "_java_gen_public"
}
+func (m *syspropLibrary) rustGenModuleName() string {
+ return m.rustCrateName() + "_rust_gen"
+}
+
+func (m *syspropLibrary) rustGenStubName() string {
+ return "lib" + m.rustCrateName() + "_rust"
+}
+
+func (m *syspropLibrary) rustCrateName() string {
+ moduleName := strings.ToLower(m.BaseModuleName())
+ moduleName = strings.ReplaceAll(moduleName, "-", "_")
+ moduleName = strings.ReplaceAll(moduleName, ".", "_")
+ return moduleName
+}
+
func (m *syspropLibrary) BaseModuleName() string {
return m.ModuleBase.Name()
}
@@ -436,6 +527,18 @@
Min_sdk_version *string
}
+type rustLibraryProperties struct {
+ Name *string
+ Srcs []string
+ Installable *bool
+ Crate_name string
+ Rustlibs []string
+ Vendor_available *bool
+ Product_available *bool
+ Apex_available []string
+ Min_sdk_version *string
+}
+
func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
if len(m.properties.Srcs) == 0 {
ctx.PropertyErrorf("srcs", "sysprop_library must specify srcs")
@@ -564,6 +667,28 @@
})
}
+ // Generate a Rust implementation library.
+ ctx.CreateModule(syspropRustGenFactory, &syspropGenProperties{
+ Srcs: m.properties.Srcs,
+ Scope: scope,
+ Name: proptools.StringPtr(m.rustGenModuleName()),
+ Check_api: proptools.StringPtr(ctx.ModuleName()),
+ })
+ rustProps := rustLibraryProperties{
+ Name: proptools.StringPtr(m.rustGenStubName()),
+ Srcs: []string{":" + m.rustGenModuleName()},
+ Installable: proptools.BoolPtr(false),
+ Crate_name: m.rustCrateName(),
+ Rustlibs: []string{
+ "librustutils",
+ },
+ Vendor_available: m.properties.Vendor_available,
+ Product_available: m.properties.Product_available,
+ Apex_available: m.ApexProperties.Apex_available,
+ Min_sdk_version: proptools.StringPtr("29"),
+ }
+ ctx.CreateModule(rust.RustLibraryFactory, &rustProps)
+
// syspropLibraries will be used by property_contexts to check types.
// Record absolute paths of sysprop_library to prevent soong_namespace problem.
if m.ExportedToMake() {
diff --git a/sysprop/sysprop_test.go b/sysprop/sysprop_test.go
index e5b3dea..9dd696f 100644
--- a/sysprop/sysprop_test.go
+++ b/sysprop/sysprop_test.go
@@ -22,6 +22,7 @@
"android/soong/android"
"android/soong/cc"
"android/soong/java"
+ "android/soong/rust"
"github.com/google/blueprint/proptools"
)
@@ -46,18 +47,6 @@
recovery_available: true,
}
- cc_library {
- name: "liblog",
- no_libcrt: true,
- nocrt: true,
- system_shared_libs: [],
- recovery_available: true,
- host_supported: true,
- llndk: {
- symbol_file: "liblog.map.txt",
- }
- }
-
java_library {
name: "sysprop-library-stub-platform",
sdk_version: "core_current",
@@ -74,6 +63,15 @@
product_specific: true,
sdk_version: "core_current",
}
+
+ rust_library {
+ name: "librustutils",
+ crate_name: "rustutils",
+ srcs: ["librustutils/lib.rs"],
+ product_available: true,
+ vendor_available: true,
+ min_sdk_version: "29",
+ }
`
mockFS := android.MockFS{
@@ -115,11 +113,14 @@
"android/sysprop/PlatformProperties.sysprop": nil,
"com/android/VendorProperties.sysprop": nil,
"com/android2/OdmProperties.sysprop": nil,
+
+ "librustutils/lib.rs": nil,
}
result := android.GroupFixturePreparers(
cc.PrepareForTestWithCcDefaultModules,
java.PrepareForTestWithJavaDefaultModules,
+ rust.PrepareForTestWithRustDefaultModules,
PrepareForTestWithSyspropBuildComponents,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.DeviceSystemSdkVersions = []string{"28"}
@@ -356,6 +357,10 @@
javaModule := result.ModuleForTests("sysprop-platform", "android_common").Module().(*java.Library)
propFromJava := javaModule.ApexProperties.Apex_available
android.AssertDeepEquals(t, "apex_available forwarding to java module", expected, propFromJava)
+
+ rustModule := result.ModuleForTests("libsysprop_platform_rust", "android_arm64_armv8-a_rlib_rlib-std").Module().(*rust.Module)
+ propFromRust := rustModule.ApexProperties.Apex_available
+ android.AssertDeepEquals(t, "apex_available forwarding to rust module", expected, propFromRust)
}
func TestMinSdkVersionIsForwarded(t *testing.T) {
@@ -371,6 +376,9 @@
java: {
min_sdk_version: "30",
},
+ rust: {
+ min_sdk_version: "29",
+ }
}
`)
@@ -381,4 +389,8 @@
javaModule := result.ModuleForTests("sysprop-platform", "android_common").Module().(*java.Library)
propFromJava := javaModule.MinSdkVersionString()
android.AssertStringEquals(t, "min_sdk_version forwarding to java module", "30", propFromJava)
+
+ rustModule := result.ModuleForTests("libsysprop_platform_rust", "android_arm64_armv8-a_rlib_rlib-std").Module().(*rust.Module)
+ propFromRust := proptools.String(rustModule.Properties.Min_sdk_version)
+ android.AssertStringEquals(t, "min_sdk_version forwarding to rust module", "29", propFromRust)
}