|
@@ -14,6 +14,8 @@
|
|
|
|
|
|
package android
|
|
package android
|
|
|
|
|
|
|
|
+import "android/soong/bazel"
|
|
|
|
+
|
|
func init() {
|
|
func init() {
|
|
RegisterLicenseKindBuildComponents(InitRegistrationContext)
|
|
RegisterLicenseKindBuildComponents(InitRegistrationContext)
|
|
}
|
|
}
|
|
@@ -32,13 +34,39 @@ type licenseKindProperties struct {
|
|
Visibility []string
|
|
Visibility []string
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+var _ Bazelable = &licenseKindModule{}
|
|
|
|
+
|
|
type licenseKindModule struct {
|
|
type licenseKindModule struct {
|
|
ModuleBase
|
|
ModuleBase
|
|
DefaultableModuleBase
|
|
DefaultableModuleBase
|
|
|
|
+ BazelModuleBase
|
|
|
|
|
|
properties licenseKindProperties
|
|
properties licenseKindProperties
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+type bazelLicenseKindAttributes struct {
|
|
|
|
+ Conditions []string
|
|
|
|
+ Url string
|
|
|
|
+ Visibility []string
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (m *licenseKindModule) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
|
|
|
+ attrs := &bazelLicenseKindAttributes{
|
|
|
|
+ Conditions: m.properties.Conditions,
|
|
|
|
+ Url: m.properties.Url,
|
|
|
|
+ Visibility: m.properties.Visibility,
|
|
|
|
+ }
|
|
|
|
+ ctx.CreateBazelTargetModule(
|
|
|
|
+ bazel.BazelTargetModuleProperties{
|
|
|
|
+ Rule_class: "license_kind",
|
|
|
|
+ Bzl_load_location: "@rules_license//rules:license_kind.bzl",
|
|
|
|
+ },
|
|
|
|
+ CommonAttributes{
|
|
|
|
+ Name: m.Name(),
|
|
|
|
+ },
|
|
|
|
+ attrs)
|
|
|
|
+}
|
|
|
|
+
|
|
func (m *licenseKindModule) DepsMutator(ctx BottomUpMutatorContext) {
|
|
func (m *licenseKindModule) DepsMutator(ctx BottomUpMutatorContext) {
|
|
// Nothing to do.
|
|
// Nothing to do.
|
|
}
|
|
}
|
|
@@ -51,13 +79,14 @@ func LicenseKindFactory() Module {
|
|
module := &licenseKindModule{}
|
|
module := &licenseKindModule{}
|
|
|
|
|
|
base := module.base()
|
|
base := module.base()
|
|
- module.AddProperties(&base.nameProperties, &module.properties)
|
|
|
|
|
|
+ module.AddProperties(&base.nameProperties, &module.properties, &base.commonProperties.BazelConversionStatus)
|
|
|
|
|
|
// The visibility property needs to be checked and parsed by the visibility module.
|
|
// The visibility property needs to be checked and parsed by the visibility module.
|
|
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
|
|
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
|
|
|
|
|
|
initAndroidModuleBase(module)
|
|
initAndroidModuleBase(module)
|
|
InitDefaultableModule(module)
|
|
InitDefaultableModule(module)
|
|
|
|
+ InitBazelModule(module)
|
|
|
|
|
|
return module
|
|
return module
|
|
}
|
|
}
|