Merge "add jacocoagent by default to Java modules" into tm-mainline-prod
diff --git a/android/gen_notice.go b/android/gen_notice.go
index e2b839f..2eb6bec 100644
--- a/android/gen_notice.go
+++ b/android/gen_notice.go
@@ -179,7 +179,7 @@
// The visibility property needs to be checked and parsed by the visibility module.
setPrimaryVisibilityProperty(module, "visibility", &module.properties.Visibility)
- initAndroidModuleBase(module)
+ InitAndroidArchModule(module, DeviceSupported, MultilibCommon)
InitDefaultableModule(module)
return module
diff --git a/android/gen_notice_test.go b/android/gen_notice_test.go
index 4ad2ecf..b45ce4f 100644
--- a/android/gen_notice_test.go
+++ b/android/gen_notice_test.go
@@ -12,19 +12,6 @@
expectedErrors []string
}{
{
- name: "gen_notice must not accept licenses property",
- fs: map[string][]byte{
- "top/Android.bp": []byte(`
- gen_notice {
- name: "top_license",
- licenses: ["other_license"],
- }`),
- },
- expectedErrors: []string{
- `unrecognized property "licenses"`,
- },
- },
- {
name: "bad gen_notice",
fs: map[string][]byte{
"top/Android.bp": []byte(`
diff --git a/java/app.go b/java/app.go
index c7fdc0c..433bf08 100755
--- a/java/app.go
+++ b/java/app.go
@@ -589,6 +589,16 @@
a.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx)
+ var noticeAssetPath android.WritablePath
+ if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
+ // The rule to create the notice file can't be generated yet, as the final output path
+ // for the apk isn't known yet. Add the path where the notice file will be generated to the
+ // aapt rules now before calling aaptBuildActions, the rule to create the notice file will
+ // be generated later.
+ noticeAssetPath = android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
+ a.aapt.noticeFile = android.OptionalPathForPath(noticeAssetPath)
+ }
+
// Process all building blocks, from AAPT to certificates.
a.aaptBuildActions(ctx)
@@ -663,7 +673,8 @@
a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
}
- if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
+ if a.aapt.noticeFile.Valid() {
+ // Generating the notice file rule has to be here after a.outputFile is known.
noticeFile := android.PathForModuleOut(ctx, "NOTICE.html.gz")
android.BuildNoticeHtmlOutputFromLicenseMetadata(
ctx, noticeFile, "", "",
@@ -672,13 +683,11 @@
android.PathForModuleInstall(ctx).String() + "/",
a.outputFile.String(),
})
- noticeAssetPath := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
builder := android.NewRuleBuilder(pctx, ctx)
builder.Command().Text("cp").
Input(noticeFile).
Output(noticeAssetPath)
builder.Build("notice_dir", "Building notice dir")
- a.aapt.noticeFile = android.OptionalPathForPath(noticeAssetPath)
}
for _, split := range a.aapt.splits {
diff --git a/java/base.go b/java/base.go
index 89776d8..b629f0f 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1934,6 +1934,9 @@
case bootClasspathTag:
deps.bootClasspath = append(deps.bootClasspath, dep.HeaderJars...)
case libTag, instrumentationForTag:
+ if _, ok := module.(*Plugin); ok {
+ ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a libs dependency", otherName)
+ }
deps.classpath = append(deps.classpath, dep.HeaderJars...)
deps.dexClasspath = append(deps.dexClasspath, dep.HeaderJars...)
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs...)
@@ -1942,6 +1945,9 @@
case java9LibTag:
deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...)
case staticLibTag:
+ if _, ok := module.(*Plugin); ok {
+ ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a static_libs dependency", otherName)
+ }
deps.classpath = append(deps.classpath, dep.HeaderJars...)
deps.staticJars = append(deps.staticJars, dep.ImplementationJars...)
deps.staticHeaderJars = append(deps.staticHeaderJars, dep.HeaderJars...)