Convert the enabled property to a configurable property
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: Ib520aceadf095b1910634b4798da2eafd4889424
diff --git a/build/aidl_api.go b/build/aidl_api.go
index 06355d3..210c033 100644
--- a/build/aidl_api.go
+++ b/build/aidl_api.go
@@ -748,7 +748,7 @@
func (f *freezeApiSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var files android.Paths
ctx.VisitAllModules(func(module android.Module) {
- if !module.Enabled() {
+ if !module.Enabled(ctx) {
return
}
if m, ok := module.(*aidlApi); ok {
diff --git a/build/aidl_interface_backends.go b/build/aidl_interface_backends.go
index 941d696..25a5cf2 100644
--- a/build/aidl_interface_backends.go
+++ b/build/aidl_interface_backends.go
@@ -106,9 +106,7 @@
var cpp_std *string
var hostSupported *bool
addCflags := commonProperties.Cflags
- targetProp := ccTargetProperties{
- Darwin: darwinProperties{Enabled: proptools.BoolPtr(false)},
- }
+ targetProp := ccTargetProperties{}
if lang == langCpp {
importExportDependencies = append(importExportDependencies, "libbinder", "libutils")
@@ -173,7 +171,11 @@
Imports: i.getImportsForVersion(version),
ModuleProperties: []interface{}{
&ccProperties{
- Name: proptools.StringPtr(cppModuleGen),
+ Name: proptools.StringPtr(cppModuleGen),
+ Enabled: android.CreateSelectOsToBool(map[string]*bool{
+ "": nil,
+ "darwin": proptools.BoolPtr(false),
+ }),
Vendor_available: vendorAvailable,
Odm_available: odmAvailable,
Product_available: productAvailable,
@@ -244,9 +246,7 @@
importExportDependencies := []string{}
var hostSupported *bool
var addCflags []string // not using cpp backend cflags for now
- targetProp := ccTargetProperties{
- Darwin: darwinProperties{Enabled: proptools.BoolPtr(false)},
- }
+ targetProp := ccTargetProperties{}
importExportDependencies = append(importExportDependencies, "libbinder", "libutils")
hostSupported = i.properties.Host_supported
@@ -262,7 +262,11 @@
g := aidlImplementationGeneratorProperties{
ModuleProperties: []interface{}{
&ccProperties{
- Name: proptools.StringPtr(cppAnalyzerModuleGen),
+ Name: proptools.StringPtr(cppAnalyzerModuleGen),
+ Enabled: android.CreateSelectOsToBool(map[string]*bool{
+ "": nil,
+ "darwin": proptools.BoolPtr(false),
+ }),
Vendor_available: vendorAvailable,
Odm_available: odmAvailable,
Product_available: productAvailable,
@@ -401,7 +405,11 @@
rustCrateName := fixRustName(i.ModuleBase.Name())
mctx.CreateModule(wrapLibraryFactory(aidlRustLibraryFactory), &rustProperties{
- Name: proptools.StringPtr(rustModuleGen),
+ Name: proptools.StringPtr(rustModuleGen),
+ Enabled: android.CreateSelectOsToBool(map[string]*bool{
+ "darwin": proptools.BoolPtr(false),
+ "": nil,
+ }),
Crate_name: rustCrateName,
Stem: proptools.StringPtr("lib" + versionedRustName),
Defaults: []string{"aidl-rust-module-defaults"},
@@ -410,7 +418,6 @@
Product_available: i.properties.Product_available,
Apex_available: i.properties.Backend.Rust.Apex_available,
Min_sdk_version: i.minSdkVersion(langRust),
- Target: rustTargetProperties{Darwin: darwinProperties{Enabled: proptools.BoolPtr(false)}},
Rustlibs: i.properties.Backend.Rust.Additional_rustlibs,
}, &rust.SourceProviderProperties{
Source_stem: proptools.StringPtr(versionedRustName),
diff --git a/build/properties.go b/build/properties.go
index e858948..deafe00 100644
--- a/build/properties.go
+++ b/build/properties.go
@@ -14,6 +14,10 @@
package aidl
+import (
+ "github.com/google/blueprint/proptools"
+)
+
type nameProperties struct {
Name *string
}
@@ -22,10 +26,6 @@
Cflags []string
}
-type darwinProperties struct {
- Enabled *bool
-}
-
type imageProperties struct {
Shared_libs []string
Header_libs []string
@@ -35,18 +35,14 @@
type ccTargetProperties struct {
Host hostProperties
- Darwin darwinProperties
Platform imageProperties
Vendor imageProperties
Product imageProperties
}
-type rustTargetProperties struct {
- Darwin darwinProperties
-}
-
type ccProperties struct {
Name *string
+ Enabled proptools.Configurable[bool]
Owner *string
Defaults []string
Double_loadable *bool
@@ -92,6 +88,7 @@
type rustProperties struct {
Name *string
+ Enabled proptools.Configurable[bool]
Crate_name string
Owner *string
Defaults []string
@@ -101,7 +98,6 @@
Srcs []string
Rustlibs []string
Stem *string
- Target rustTargetProperties
Apex_available []string
Min_sdk_version *string
}