Merge "Surface Java APIs Used By APK-only Modules." into tm-dev
This commit is contained in:
@@ -409,7 +409,15 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
|
||||
},
|
||||
},
|
||||
}}
|
||||
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
||||
func(w io.Writer, name, prefix, moduleDir string) {
|
||||
if app.javaApiUsedByOutputFile.String() != "" {
|
||||
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s/$(notdir %s))\n",
|
||||
app.installApkName, app.javaApiUsedByOutputFile.String(), "java_apis_used_by_apex", app.javaApiUsedByOutputFile.String())
|
||||
}
|
||||
},
|
||||
}},
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AndroidApp) getOverriddenPackages() []string {
|
||||
|
@@ -169,6 +169,8 @@ type AndroidApp struct {
|
||||
overriddenManifestPackageName string
|
||||
|
||||
android.ApexBundleDepsInfo
|
||||
|
||||
javaApiUsedByOutputFile android.ModuleOutPath
|
||||
}
|
||||
|
||||
func (a *AndroidApp) IsInstallable() bool {
|
||||
@@ -277,6 +279,7 @@ func (a *AndroidTestHelperApp) GenerateAndroidBuildActions(ctx android.ModuleCon
|
||||
func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
a.checkAppSdkVersions(ctx)
|
||||
a.generateAndroidBuildActions(ctx)
|
||||
a.generateJavaUsedByApex(ctx)
|
||||
}
|
||||
|
||||
func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) {
|
||||
|
@@ -258,6 +258,18 @@ func TransformJniLibsToJar(ctx android.ModuleContext, outputFile android.Writabl
|
||||
})
|
||||
}
|
||||
|
||||
func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) {
|
||||
javaApiUsedByOutputFile := android.PathForModuleOut(ctx, a.installApkName+"_using.xml")
|
||||
javaUsedByRule := android.NewRuleBuilder(pctx, ctx)
|
||||
javaUsedByRule.Command().
|
||||
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")).
|
||||
BuiltTool("dexdeps").
|
||||
Output(javaApiUsedByOutputFile).
|
||||
Input(a.Library.Module.outputFile)
|
||||
javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
|
||||
a.javaApiUsedByOutputFile = javaApiUsedByOutputFile
|
||||
}
|
||||
|
||||
func targetToJniDir(target android.Target) string {
|
||||
return filepath.Join("lib", target.Arch.Abi[0])
|
||||
}
|
||||
|
@@ -54,6 +54,8 @@ var PrepareForTestWithJavaBuildComponents = android.GroupFixturePreparers(
|
||||
"build/soong/java/lint_defaults.txt": nil,
|
||||
// Needed for apps that do not provide their own.
|
||||
"build/make/target/product/security": nil,
|
||||
// Required to generate Java used-by API coverage
|
||||
"build/soong/scripts/gen_java_usedby_apex.sh": nil,
|
||||
}.AddToFixture(),
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user