Revert "Revert "Automated NDK API coverage used by Mainline modules build integration.""
This reverts commit 556b2ad77e31956cbc2a329553c8ad7692639708.
Original change-id: Ib1b2f0dd2f9ae85b1545c6cc5bb4c5bbdfac1c15
Reason for revert: Add excutable permission to the gen_ndk_backedby_apex.sh.
Test: TARGET_BUILD_APPS=com.android.adbd m dist apps_only
Change-Id: Ib587ba200cd7f2f61d478452b43c329d72b2de06
diff --git a/apex/androidmk.go b/apex/androidmk.go
index 61b9dad..de04d52 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -422,12 +422,21 @@
fmt.Fprintf(w, dist)
}
- if a.coverageOutputPath.String() != "" {
+ if a.apisUsedByModuleFile.String() != "" {
goal := "apps_only"
- distFile := a.coverageOutputPath.String()
+ distFile := a.apisUsedByModuleFile.String()
fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
" $(call dist-for-goals,%s,%s:ndk_apis_usedby_apex/$(notdir %s))\n"+
- "endif",
+ "endif\n",
+ goal, distFile, distFile)
+ }
+
+ if a.apisBackedByModuleFile.String() != "" {
+ goal := "apps_only"
+ distFile := a.apisBackedByModuleFile.String()
+ fmt.Fprintf(w, "ifneq (,$(filter $(my_register_name),$(TARGET_BUILD_APPS)))\n"+
+ " $(call dist-for-goals,%s,%s:ndk_apis_backedby_apex/$(notdir %s))\n"+
+ "endif\n",
goal, distFile, distFile)
}
}
diff --git a/apex/apex.go b/apex/apex.go
index 1d4f7b2..a405721 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -355,7 +355,8 @@
prebuiltFileToDelete string
// Path of API coverage generate file
- coverageOutputPath android.ModuleOutPath
+ apisUsedByModuleFile android.ModuleOutPath
+ apisBackedByModuleFile android.ModuleOutPath
}
// apexFileClass represents a type of file that can be included in APEX.
diff --git a/apex/builder.go b/apex/builder.go
index 66eaff1..1ec59a8 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -686,7 +686,7 @@
implicitInputs = append(implicitInputs, unsignedOutputFile)
// Run coverage analysis
- apisUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+".txt")
+ apisUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_using.txt")
ctx.Build(pctx, android.BuildParams{
Rule: generateAPIsUsedbyApexRule,
Implicits: implicitInputs,
@@ -697,7 +697,19 @@
"readelf": "${config.ClangBin}/llvm-readelf",
},
})
- a.coverageOutputPath = apisUsedbyOutputFile
+ a.apisUsedByModuleFile = apisUsedbyOutputFile
+
+ apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
+ ndkLibraryList := android.PathForSource(ctx, "system/core/rootdir/etc/public.libraries.android.txt")
+ rule := android.NewRuleBuilder(pctx, ctx)
+ rule.Command().
+ Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
+ Text(imageDir.String()).
+ Implicits(implicitInputs).
+ Output(apisBackedbyOutputFile).
+ Input(ndkLibraryList)
+ rule.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
+ a.apisBackedByModuleFile = apisBackedbyOutputFile
bundleConfig := a.buildBundleConfig(ctx)