hidl_interface: workaround to inherit common props
Spec. for notice:
NOTICE files for system contain this when the test module is
included in the build:
<file-content contentId="1fce5e8416b70df4e39d51db8b3112e9"><![CDATA[I am notifying you of something! Wheeee!
]]></file-content>
Bug: 119771576
Change-Id: I13de15b0ed018012197b1a9f2ed75e070ba62129
Fixes: 120561634
Test: manual (see above)
diff --git a/build/hidl_interface.go b/build/hidl_interface.go
index 37d753b..bd99cfa 100644
--- a/build/hidl_interface.go
+++ b/build/hidl_interface.go
@@ -146,12 +146,6 @@
// Vndk properties for interface library only.
cc.VndkProperties
- // The owner of the module
- Owner *string
-
- // Install core variant on the /product instead of /system
- Product_specific *bool
-
// List of .hal files which compose this interface.
Srcs []string
@@ -176,10 +170,45 @@
Full_root_option string `blueprint:"mutated"`
}
+// TODO(b/119771576): These properties are shared by all Android modules, and we are specifically
+// calling these out to be copied to every create module. However, if a new property is added, it
+// could break things because this code has no way to know about that.
+type manuallyInheritCommonProperties struct {
+ Enabled *bool
+ Compile_multilib *string
+ Target struct {
+ Host struct {
+ Compile_multilib *string
+ }
+ Android struct {
+ Compile_multilib *string
+ }
+ }
+ Proprietary *bool
+ Owner *string
+ Vendor *bool
+ Soc_specific *bool
+ Device_specific *bool
+ Product_specific *bool
+ Product_services_specific *bool
+ Recovery *bool
+ Init_rc []string
+ Vintf_fragments []string
+ Required []string
+ Notice *string
+ Dist struct {
+ Targets []string
+ Dest *string
+ Dir *string
+ Suffix *string
+ }
+}
+
type hidlInterface struct {
android.ModuleBase
- properties hidlInterfaceProperties
+ properties hidlInterfaceProperties
+ inheritCommonProperties manuallyInheritCommonProperties
}
func processSources(mctx android.LoadHookContext, srcs []string) ([]string, []string, bool) {
@@ -289,10 +318,9 @@
// TODO(b/69002743): remove filegroups
mctx.CreateModule(android.ModuleFactoryAdaptor(android.FileGroupFactory), &fileGroupProperties{
- Name: proptools.StringPtr(name.fileGroupName()),
- Owner: i.properties.Owner,
- Srcs: i.properties.Srcs,
- })
+ Name: proptools.StringPtr(name.fileGroupName()),
+ Srcs: i.properties.Srcs,
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(hidlGenFactory), &nameProperties{
Name: proptools.StringPtr(name.sourcesName()),
@@ -303,7 +331,7 @@
Interfaces: i.properties.Interfaces,
Inputs: i.properties.Srcs,
Outputs: concat(wrap(name.dir(), interfaces, "All.cpp"), wrap(name.dir(), types, ".cpp")),
- })
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(hidlGenFactory), &nameProperties{
Name: proptools.StringPtr(name.headersName()),
}, &hidlGenProperties{
@@ -319,13 +347,11 @@
wrap(name.dir()+"IHw", interfaces, ".h"),
wrap(name.dir(), types, ".h"),
wrap(name.dir()+"hw", types, ".h")),
- })
+ }, &i.inheritCommonProperties)
if shouldGenerateLibrary {
mctx.CreateModule(android.ModuleFactoryAdaptor(cc.LibraryFactory), &ccProperties{
Name: proptools.StringPtr(name.string()),
- Owner: i.properties.Owner,
- Product_specific: i.properties.Product_specific,
Recovery_available: proptools.BoolPtr(true),
Vendor_available: proptools.BoolPtr(true),
Double_loadable: proptools.BoolPtr(isDoubleLoadable(name.string())),
@@ -347,7 +373,7 @@
"libutils",
}),
Export_generated_headers: []string{name.headersName()},
- }, &i.properties.VndkProperties)
+ }, &i.properties.VndkProperties, &i.inheritCommonProperties)
}
if shouldGenerateJava {
@@ -361,10 +387,9 @@
Inputs: i.properties.Srcs,
Outputs: concat(wrap(name.sanitizedDir()+"I", interfaces, ".java"),
wrap(name.sanitizedDir(), i.properties.Types, ".java")),
- })
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(java.LibraryFactory), &javaProperties{
Name: proptools.StringPtr(name.javaName()),
- Owner: i.properties.Owner,
Defaults: []string{"hidl-java-module-defaults"},
No_framework_libs: proptools.BoolPtr(true),
Installable: proptools.BoolPtr(true),
@@ -377,7 +402,7 @@
// not depend on framework.
Sdk_version: proptools.StringPtr("core_current"),
Libs: []string{"hwbinder.stubs"},
- })
+ }, &i.inheritCommonProperties)
}
if shouldGenerateJavaConstants {
@@ -390,14 +415,13 @@
Interfaces: i.properties.Interfaces,
Inputs: i.properties.Srcs,
Outputs: []string{name.sanitizedDir() + "Constants.java"},
- })
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(java.LibraryFactory), &javaProperties{
Name: proptools.StringPtr(name.javaConstantsName()),
- Owner: i.properties.Owner,
Defaults: []string{"hidl-java-module-defaults"},
No_framework_libs: proptools.BoolPtr(true),
Srcs: []string{":" + name.javaConstantsSourcesName()},
- })
+ }, &i.inheritCommonProperties)
}
mctx.CreateModule(android.ModuleFactoryAdaptor(hidlGenFactory), &nameProperties{
@@ -409,7 +433,7 @@
Interfaces: i.properties.Interfaces,
Inputs: i.properties.Srcs,
Outputs: wrap(name.dir()+"A", concat(interfaces, types), ".cpp"),
- })
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(hidlGenFactory), &nameProperties{
Name: proptools.StringPtr(name.adapterHelperHeadersName()),
}, &hidlGenProperties{
@@ -419,12 +443,10 @@
Interfaces: i.properties.Interfaces,
Inputs: i.properties.Srcs,
Outputs: wrap(name.dir()+"A", concat(interfaces, types), ".h"),
- })
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(cc.LibraryFactory), &ccProperties{
Name: proptools.StringPtr(name.adapterHelperName()),
- Owner: i.properties.Owner,
- Product_specific: i.properties.Product_specific,
Vendor_available: proptools.BoolPtr(true),
Defaults: []string{"hidl-module-defaults"},
Generated_sources: []string{name.adapterHelperSourcesName()},
@@ -450,7 +472,7 @@
}, wrap("", dependencies, "-adapter-helper"), cppDependencies, libraryIfExists),
Export_generated_headers: []string{name.adapterHelperHeadersName()},
Group_static_libs: proptools.BoolPtr(true),
- })
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(hidlGenFactory), &nameProperties{
Name: proptools.StringPtr(name.adapterSourcesName()),
}, &hidlGenProperties{
@@ -460,10 +482,9 @@
Interfaces: i.properties.Interfaces,
Inputs: i.properties.Srcs,
Outputs: []string{"main.cpp"},
- })
+ }, &i.inheritCommonProperties)
mctx.CreateModule(android.ModuleFactoryAdaptor(cc.TestFactory), &ccProperties{
Name: proptools.StringPtr(name.adapterName()),
- Owner: i.properties.Owner,
Generated_sources: []string{name.adapterSourcesName()},
Shared_libs: []string{
"libbase",
@@ -479,7 +500,7 @@
name.adapterHelperName(),
}, wrap("", dependencies, "-adapter-helper"), cppDependencies, libraryIfExists),
Group_static_libs: proptools.BoolPtr(true),
- })
+ }, &i.inheritCommonProperties)
}
func (h *hidlInterface) Name() string {
@@ -506,6 +527,7 @@
func hidlInterfaceFactory() android.Module {
i := &hidlInterface{}
i.AddProperties(&i.properties)
+ i.AddProperties(&i.inheritCommonProperties)
android.InitAndroidModule(i)
android.AddLoadHook(i, func(ctx android.LoadHookContext) { hidlInterfaceMutator(ctx, i) })
diff --git a/build/properties.go b/build/properties.go
index 1fae95d..a08e0bd 100644
--- a/build/properties.go
+++ b/build/properties.go
@@ -28,7 +28,6 @@
Name *string
Owner *string
Defaults []string
- Product_specific *bool
Vendor_available *bool
Recovery_available *bool
Generated_sources []string
diff --git a/test/vendor/1.0/Android.bp b/test/vendor/1.0/Android.bp
index 8519fa5..4f8485b 100644
--- a/test/vendor/1.0/Android.bp
+++ b/test/vendor/1.0/Android.bp
@@ -1,5 +1,3 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
hidl_interface {
name: "hidl.tests.vendor@1.0",
owner: "some-owner-name",
@@ -19,5 +17,8 @@
],
gen_java: true,
gen_java_constants: true,
+
+ // tests that license is copied
+ notice: "FAKE_NOTICE_FILE",
}
diff --git a/test/vendor/1.0/FAKE_NOTICE_FILE b/test/vendor/1.0/FAKE_NOTICE_FILE
new file mode 100644
index 0000000..68b43bf
--- /dev/null
+++ b/test/vendor/1.0/FAKE_NOTICE_FILE
@@ -0,0 +1 @@
+I am notifying you of something! Wheeee!