Implement bp2build for the `package` module
* We are interested mostly in the conversion the `default_applicable_licenses`
attribute, as `default_visibility` cannot be handled until every module's
`visibility` is handled.
* Several referenced license modules had to be manually enabled for
conversion, and likewise a few trivial Android.bp containing only
package and license modules.
* As Bazel allows only a single `package` rule, the package rules in a
manually converted BUILD.bazel files were removed (in
external/protobuf and prebuilts/clang/host/linux-x86 trees).
* The converted package rule is emitted before the `load` statements per
Bazel documentation.
Bug: 190817312
Test: treehugger
Change-Id: If8bf6fee1580177de3bb402923615bcd48923ed2
diff --git a/android/license.go b/android/license.go
index c36f488..cde5e6e 100644
--- a/android/license.go
+++ b/android/license.go
@@ -78,9 +78,11 @@
Visibility: m.properties.Visibility,
}
- // TODO(asmundak): Soong supports multiple license texts while Bazel does not.
- if len(m.properties.License_text) > 1 {
- fmt.Fprintf(os.Stderr, "%s:%s: warning: using only the first license_text item\n",
+ // TODO(asmundak): Soong supports multiple license texts while Bazel's license
+ // rule does not. Have android_license create a genrule to concatenate multiple
+ // license texts.
+ if len(m.properties.License_text) > 1 && ctx.Config().IsEnvTrue("BP2BUILD_VERBOSE") {
+ fmt.Fprintf(os.Stderr, "warning: using only the first license_text item from //%s:%s\n",
ctx.ModuleDir(), m.Name())
}
if len(m.properties.License_text) >= 1 {