Merge "Include all_aconfig_declarations in droid dist" into main
diff --git a/android/config.go b/android/config.go
index 75471b9..e757d50 100644
--- a/android/config.go
+++ b/android/config.go
@@ -213,7 +213,7 @@
// Enables flagged apis annotated with READ_WRITE aconfig flags to be included in the stubs
// and hiddenapi flags so that they are accessible at runtime
func (c Config) ReleaseExportRuntimeApis() bool {
- return c.config.productVariables.GetBuildFlagBool("RELEASE_EXPORT_RUNTIME_APIS")
+ return Bool(c.config.productVariables.ExportRuntimeApis)
}
// Enables ABI monitoring of NDK libraries
@@ -222,7 +222,8 @@
}
func (c Config) ReleaseHiddenApiExportableStubs() bool {
- return c.config.productVariables.GetBuildFlagBool("RELEASE_HIDDEN_API_EXPORTABLE_STUBS")
+ return c.config.productVariables.GetBuildFlagBool("RELEASE_HIDDEN_API_EXPORTABLE_STUBS") ||
+ Bool(c.config.productVariables.HiddenapiExportableStubs)
}
// A DeviceConfig object represents the configuration for a particular device
diff --git a/android/soongconfig/modules.go b/android/soongconfig/modules.go
index d525bdc..c78b726 100644
--- a/android/soongconfig/modules.go
+++ b/android/soongconfig/modules.go
@@ -681,6 +681,14 @@
if !propStruct.IsValid() {
return nil, nil
}
+ if err := s.printfIntoPropertyRecursive(nil, propStruct, configValue); err != nil {
+ return nil, err
+ }
+
+ return values.Interface(), nil
+}
+
+func (s *valueVariable) printfIntoPropertyRecursive(fieldName []string, propStruct reflect.Value, configValue string) error {
for i := 0; i < propStruct.NumField(); i++ {
field := propStruct.Field(i)
kind := field.Kind()
@@ -695,23 +703,31 @@
case reflect.String:
err := printfIntoProperty(field, configValue)
if err != nil {
- return nil, fmt.Errorf("soong_config_variables.%s.%s: %s", s.variable, propStruct.Type().Field(i).Name, err)
+ fieldName = append(fieldName, propStruct.Type().Field(i).Name)
+ return fmt.Errorf("soong_config_variables.%s.%s: %s", s.variable, strings.Join(fieldName, "."), err)
}
case reflect.Slice:
for j := 0; j < field.Len(); j++ {
err := printfIntoProperty(field.Index(j), configValue)
if err != nil {
- return nil, fmt.Errorf("soong_config_variables.%s.%s: %s", s.variable, propStruct.Type().Field(i).Name, err)
+ fieldName = append(fieldName, propStruct.Type().Field(i).Name)
+ return fmt.Errorf("soong_config_variables.%s.%s: %s", s.variable, strings.Join(fieldName, "."), err)
}
}
case reflect.Bool:
// Nothing to do
+ case reflect.Struct:
+ fieldName = append(fieldName, propStruct.Type().Field(i).Name)
+ if err := s.printfIntoPropertyRecursive(fieldName, field, configValue); err != nil {
+ return err
+ }
+ fieldName = fieldName[:len(fieldName)-1]
default:
- return nil, fmt.Errorf("soong_config_variables.%s.%s: unsupported property type %q", s.variable, propStruct.Type().Field(i).Name, kind)
+ fieldName = append(fieldName, propStruct.Type().Field(i).Name)
+ return fmt.Errorf("soong_config_variables.%s.%s: unsupported property type %q", s.variable, strings.Join(fieldName, "."), kind)
}
}
-
- return values.Interface(), nil
+ return nil
}
func printfIntoProperty(propertyValue reflect.Value, configValue string) error {
diff --git a/android/soongconfig/modules_test.go b/android/soongconfig/modules_test.go
index db2c83c..1da0b49 100644
--- a/android/soongconfig/modules_test.go
+++ b/android/soongconfig/modules_test.go
@@ -429,6 +429,76 @@
}
}
+func Test_PropertiesToApply_Value_Nested(t *testing.T) {
+ mt, _ := newModuleType(&ModuleTypeProperties{
+ Module_type: "foo",
+ Config_namespace: "bar",
+ Value_variables: []string{"my_value_var"},
+ Properties: []string{"a.b"},
+ })
+ type properties struct {
+ A struct {
+ B string
+ }
+ }
+ conditionsDefault := &properties{
+ A: struct{ B string }{
+ B: "default",
+ },
+ }
+ type valueVarProps struct {
+ A struct {
+ B string
+ }
+ Conditions_default *properties
+ }
+ actualProps := &struct {
+ Soong_config_variables valueSoongConfigVars
+ }{
+ Soong_config_variables: valueSoongConfigVars{
+ My_value_var: &valueVarProps{
+ A: struct{ B string }{
+ B: "A.B=%s",
+ },
+ Conditions_default: conditionsDefault,
+ },
+ },
+ }
+ props := reflect.ValueOf(actualProps)
+
+ testCases := []struct {
+ name string
+ config SoongConfig
+ wantProps []interface{}
+ }{
+ {
+ name: "no_vendor_config",
+ config: Config(map[string]string{}),
+ wantProps: []interface{}{conditionsDefault},
+ },
+ {
+ name: "value_var_set",
+ config: Config(map[string]string{"my_value_var": "Hello"}),
+ wantProps: []interface{}{&properties{
+ A: struct{ B string }{
+ B: "A.B=Hello",
+ },
+ }},
+ },
+ }
+
+ for _, tc := range testCases {
+ gotProps, err := PropertiesToApply(mt, props, tc.config)
+ if err != nil {
+ t.Errorf("%s: Unexpected error in PropertiesToApply: %s", tc.name, err)
+ }
+
+ if !reflect.DeepEqual(gotProps, tc.wantProps) {
+ t.Errorf("%s: Expected %s, got %s", tc.name, tc.wantProps, gotProps)
+ }
+ }
+}
+
func Test_PropertiesToApply_String_Error(t *testing.T) {
mt, _ := newModuleType(&ModuleTypeProperties{
Module_type: "foo",
diff --git a/android/variable.go b/android/variable.go
index 2520020..be3c80d 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -496,6 +496,10 @@
BuildFromSourceStub *bool `json:",omitempty"`
BuildIgnoreApexContributionContents []string `json:",omitempty"`
+
+ HiddenapiExportableStubs *bool `json:",omitempty"`
+
+ ExportRuntimeApis *bool `json:",omitempty"`
}
type PartitionQualifiedVariablesType struct {
diff --git a/bpf/bpf.go b/bpf/bpf.go
index e1b512f..38fbd88 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -203,6 +203,15 @@
}
}
+
+ installDir := android.PathForModuleInstall(ctx, "etc", "bpf")
+ if len(bpf.properties.Sub_dir) > 0 {
+ installDir = installDir.Join(ctx, bpf.properties.Sub_dir)
+ }
+ for _, obj := range bpf.objs {
+ ctx.PackageFile(installDir, obj.Base(), obj)
+ }
+
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
}
diff --git a/filesystem/Android.bp b/filesystem/Android.bp
index 07d57c9..cdf6682 100644
--- a/filesystem/Android.bp
+++ b/filesystem/Android.bp
@@ -9,6 +9,7 @@
"blueprint",
"soong",
"soong-android",
+ "soong-bpf", // for testing
"soong-linkerconfig",
],
srcs: [
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index aef4756..c448105 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -19,6 +19,7 @@
"testing"
"android/soong/android"
+ "android/soong/bpf"
"android/soong/cc"
"android/soong/etc"
@@ -31,6 +32,7 @@
var fixture = android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
+ bpf.PrepareForTestWithBpf,
etc.PrepareForTestWithPrebuiltEtc,
cc.PrepareForIntegrationTestWithCc,
PrepareForTestWithFilesystemBuildComponents,
@@ -40,11 +42,55 @@
result := fixture.RunTestWithBp(t, `
android_filesystem {
name: "myfilesystem",
+ multilib: {
+ common: {
+ deps: [
+ "bpf.o",
+ ],
+ },
+ lib32: {
+ deps: [
+ "foo",
+ "libbar",
+ ],
+ },
+ lib64: {
+ deps: [
+ "libbar",
+ ],
+ },
+ },
+ compile_multilib: "both",
+ }
+
+ bpf {
+ name: "bpf.o",
+ srcs: ["bpf.c"],
+ }
+
+ cc_binary {
+ name: "foo",
+ compile_multilib: "prefer32",
+ }
+
+ cc_library {
+ name: "libbar",
}
`)
// produces "myfilesystem.img"
result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img")
+
+ fs := result.ModuleForTests("myfilesystem", "android_common").Module().(*filesystem)
+ expected := []string{
+ "bin/foo",
+ "lib/libbar.so",
+ "lib64/libbar.so",
+ "etc/bpf/bpf.o",
+ }
+ for _, e := range expected {
+ android.AssertStringListContains(t, "missing entry", fs.entries, e)
+ }
}
func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) {
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index caa8345..e5ffd28 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -22,6 +22,8 @@
"testing"
"android/soong/android"
+
+ "github.com/google/blueprint/proptools"
)
func TestDroidstubs(t *testing.T) {
@@ -419,8 +421,8 @@
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.BuildFlags = map[string]string{
"RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
- "RELEASE_EXPORT_RUNTIME_APIS": "true",
}
+ variables.ExportRuntimeApis = proptools.BoolPtr(true)
}),
android.FixtureMergeMockFs(map[string][]byte{
"a/A.java": nil,
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 85cc220..454dd87 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -263,10 +263,9 @@
// clang: error: '-x c' after last input file has no effect [-Werror,-Wunused-command-line-argument]
cflags = append(cflags, "-Wno-unused-command-line-argument")
- // LLVM_NEXT may contain flags that bindgen doesn't recognise. Turn off unknown flags warning.
- if ctx.Config().IsEnvTrue("LLVM_NEXT") {
- cflags = append(cflags, "-Wno-unknown-warning-option")
- }
+ // The Clang version used by CXX can be newer than the one used by Bindgen, and uses warning related flags that
+ // it cannot recognize. Turn off unknown warning flags warning.
+ cflags = append(cflags, "-Wno-unknown-warning-option")
outputFile := android.PathForModuleOut(ctx, b.BaseSourceProvider.getStem(ctx)+".rs")