Merge "Revert^2 "Convert cc modules to use AndroidMkInfoProvider."" into main
diff --git a/android/module_info_json.go b/android/module_info_json.go
index ee552dc..d102dd2 100644
--- a/android/module_info_json.go
+++ b/android/module_info_json.go
@@ -6,6 +6,7 @@
"slices"
"github.com/google/blueprint"
+ "github.com/google/blueprint/gobtools"
)
type CoreModuleInfoJSON struct {
@@ -20,8 +21,7 @@
Required []string `json:"required,omitempty"` // $(sort $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))
}
-type ModuleInfoJSON struct {
- core CoreModuleInfoJSON
+type ExtraModuleInfoJSON struct {
SubName string `json:"-"`
Uninstallable bool `json:"-"`
Class []string `json:"class,omitempty"` // $(sort $(ALL_MODULES.$(m).CLASS))
@@ -45,6 +45,11 @@
TestConfig []string `json:"test_config,omitempty"` // $(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS)
}
+type ModuleInfoJSON struct {
+ core CoreModuleInfoJSON
+ ExtraModuleInfoJSON
+}
+
//ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
//$(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) \
//$(LOCAL_STATIC_LIBRARIES) \
@@ -60,7 +65,7 @@
type combinedModuleInfoJSON struct {
*CoreModuleInfoJSON
- *ModuleInfoJSON
+ *ExtraModuleInfoJSON
}
func encodeModuleInfoJSON(w io.Writer, moduleInfoJSON *ModuleInfoJSON) error {
@@ -99,7 +104,27 @@
sortAndUnique(&moduleInfoJSONCopy.TestConfig)
encoder := json.NewEncoder(w)
- return encoder.Encode(combinedModuleInfoJSON{&moduleInfoJSONCopy.core, &moduleInfoJSONCopy})
+ return encoder.Encode(combinedModuleInfoJSON{&moduleInfoJSONCopy.core, &moduleInfoJSONCopy.ExtraModuleInfoJSON})
+}
+
+func (p *ModuleInfoJSON) ToGob() *combinedModuleInfoJSON {
+ return &combinedModuleInfoJSON{
+ CoreModuleInfoJSON: &p.core,
+ ExtraModuleInfoJSON: &p.ExtraModuleInfoJSON,
+ }
+}
+
+func (p *ModuleInfoJSON) FromGob(data *combinedModuleInfoJSON) {
+ p.core = *data.CoreModuleInfoJSON
+ p.ExtraModuleInfoJSON = *data.ExtraModuleInfoJSON
+}
+
+func (m *ModuleInfoJSON) GobEncode() ([]byte, error) {
+ return gobtools.CustomGobEncode[combinedModuleInfoJSON](m)
+}
+
+func (m *ModuleInfoJSON) GobDecode(data []byte) error {
+ return gobtools.CustomGobDecode[combinedModuleInfoJSON](data, m)
}
var ModuleInfoJSONProvider = blueprint.NewProvider[*ModuleInfoJSON]()
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index 61fa46d..790a865 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -533,6 +533,8 @@
return "test"
case *benchmarkDecorator:
return "test"
+ case *objectLinker:
+ return "object"
}
panic(fmt.Sprintf("Unexpected module type: %T", m.linker))
}
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index ce72fed..743bfd4 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -725,7 +725,7 @@
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "fonts")
// This module is device-only
- android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
return module
}
diff --git a/etc/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go
index 676a096..4a0312f 100644
--- a/etc/prebuilt_etc_test.go
+++ b/etc/prebuilt_etc_test.go
@@ -469,7 +469,7 @@
}
`)
- p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
+ p := result.Module("foo.conf", "android_common").(*PrebuiltEtc)
expected := "out/soong/target/product/test_device/system/fonts"
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPaths[0])
}
diff --git a/java/base.go b/java/base.go
index 07899d1..8dad2d9 100644
--- a/java/base.go
+++ b/java/base.go
@@ -67,19 +67,19 @@
Exclude_java_resource_dirs []string `android:"arch_variant"`
// list of files to use as Java resources
- Java_resources []string `android:"path,arch_variant"`
+ Java_resources proptools.Configurable[[]string] `android:"path,arch_variant"`
// list of files that should be excluded from java_resources and java_resource_dirs
Exclude_java_resources []string `android:"path,arch_variant"`
// Same as java_resources, but modules added here will use the device variant. Can be useful
// for making a host test that tests the contents of a device built app.
- Device_common_java_resources []string `android:"path_device_common"`
+ Device_common_java_resources proptools.Configurable[[]string] `android:"path_device_common"`
// Same as java_resources, but modules added here will use the device's os variant and the
// device's first architecture variant. Can be useful for making a host test that tests the
// contents of a native device built app.
- Device_first_java_resources []string `android:"path_device_first"`
+ Device_first_java_resources proptools.Configurable[[]string] `android:"path_device_first"`
// list of module-specific flags that will be used for javac compiles
Javacflags []string `android:"arch_variant"`
@@ -1495,9 +1495,9 @@
dirArgs, dirDeps := ResourceDirsToJarArgs(ctx, j.properties.Java_resource_dirs,
j.properties.Exclude_java_resource_dirs, j.properties.Exclude_java_resources)
- fileArgs, fileDeps := ResourceFilesToJarArgs(ctx, j.properties.Java_resources, j.properties.Exclude_java_resources)
- fileArgs2, fileDeps2 := ResourceFilesToJarArgs(ctx, j.properties.Device_common_java_resources, nil)
- fileArgs3, fileDeps3 := ResourceFilesToJarArgs(ctx, j.properties.Device_first_java_resources, nil)
+ fileArgs, fileDeps := ResourceFilesToJarArgs(ctx, j.properties.Java_resources.GetOrDefault(ctx, nil), j.properties.Exclude_java_resources)
+ fileArgs2, fileDeps2 := ResourceFilesToJarArgs(ctx, j.properties.Device_common_java_resources.GetOrDefault(ctx, nil), nil)
+ fileArgs3, fileDeps3 := ResourceFilesToJarArgs(ctx, j.properties.Device_first_java_resources.GetOrDefault(ctx, nil), nil)
fileArgs = slices.Concat(fileArgs, fileArgs2, fileArgs3)
fileDeps = slices.Concat(fileDeps, fileDeps2, fileDeps3)
extraArgs, extraDeps := resourcePathsToJarArgs(j.extraResources), j.extraResources
diff --git a/rust/sanitize.go b/rust/sanitize.go
index c086880..b8f922f 100644
--- a/rust/sanitize.go
+++ b/rust/sanitize.go
@@ -94,14 +94,6 @@
"-C llvm-args=--hwasan-with-ifunc",
}
-func boolPtr(v bool) *bool {
- if v {
- return &v
- } else {
- return nil
- }
-}
-
func init() {
}
func (sanitize *sanitize) props() []interface{} {
@@ -111,6 +103,11 @@
func (sanitize *sanitize) begin(ctx BaseModuleContext) {
s := &sanitize.Properties.Sanitize
+ // Disable sanitizers for musl x86 modules, rustc does not support any sanitizers.
+ if ctx.Os() == android.LinuxMusl && ctx.Arch().ArchType == android.X86 {
+ s.Never = proptools.BoolPtr(true)
+ }
+
// Never always wins.
if Bool(s.Never) {
return
@@ -212,11 +209,6 @@
s.Memtag_heap = nil
}
- // Disable sanitizers for musl x86 modules, rustc does not support any sanitizers.
- if ctx.Os() == android.LinuxMusl && ctx.Arch().ArchType == android.X86 {
- s.Never = boolPtr(true)
- }
-
// TODO:(b/178369775)
// For now sanitizing is only supported on non-windows targets
if ctx.Os() != android.Windows && (Bool(s.Hwaddress) || Bool(s.Address) || Bool(s.Memtag_heap) || Bool(s.Fuzzer)) {
@@ -318,16 +310,16 @@
sanitizerSet := false
switch t {
case cc.Fuzzer:
- sanitize.Properties.Sanitize.Fuzzer = boolPtr(b)
+ sanitize.Properties.Sanitize.Fuzzer = proptools.BoolPtr(b)
sanitizerSet = true
case cc.Asan:
- sanitize.Properties.Sanitize.Address = boolPtr(b)
+ sanitize.Properties.Sanitize.Address = proptools.BoolPtr(b)
sanitizerSet = true
case cc.Hwasan:
- sanitize.Properties.Sanitize.Hwaddress = boolPtr(b)
+ sanitize.Properties.Sanitize.Hwaddress = proptools.BoolPtr(b)
sanitizerSet = true
case cc.Memtag_heap:
- sanitize.Properties.Sanitize.Memtag_heap = boolPtr(b)
+ sanitize.Properties.Sanitize.Memtag_heap = proptools.BoolPtr(b)
sanitizerSet = true
default:
panic(fmt.Errorf("setting unsupported sanitizerType %d", t))