Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b5fa427 authored by Sophie Zheng's avatar Sophie Zheng Committed by Gerrit Code Review
Browse files

Merge "Java APIs used by Mainline modules."

parents cb16a92e 0234737f
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -449,23 +449,18 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
					fmt.Fprintf(w, dist)
				}

				if a.apisUsedByModuleFile.String() != "" {
					goal := "apps_only"
					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\n",
						goal, distFile, distFile)
				distCoverageFiles(w, "ndk_apis_usedby_apex", a.nativeApisUsedByModuleFile.String())
				distCoverageFiles(w, "ndk_apis_usedby_apex", a.nativeApisBackedByModuleFile.String())
				distCoverageFiles(w, "java_apis_used_by_apex", a.javaApisUsedByModuleFile.String())
			}
		}}
}

				if a.apisBackedByModuleFile.String() != "" {
func distCoverageFiles(w io.Writer, dir string, distfile string) {
	if distfile != "" {
		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)
				}
			" $(call dist-for-goals,%s,%s:%s/$(notdir %s))\n"+
			"endif\n", goal, distfile, dir, distfile)
	}
		}}
}
+3 −2
Original line number Diff line number Diff line
@@ -424,8 +424,9 @@ type apexBundle struct {
	isCompressed bool

	// Path of API coverage generate file
	apisUsedByModuleFile   android.ModuleOutPath
	apisBackedByModuleFile android.ModuleOutPath
	nativeApisUsedByModuleFile   android.ModuleOutPath
	nativeApisBackedByModuleFile android.ModuleOutPath
	javaApisUsedByModuleFile     android.ModuleOutPath

	// Collect the module directory for IDE info in java/jdeps.go.
	modulePaths []string
+22 −5
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ func init() {
	pctx.HostBinToolVariable("sload_f2fs", "sload_f2fs")
	pctx.HostBinToolVariable("make_erofs", "make_erofs")
	pctx.HostBinToolVariable("apex_compression_tool", "apex_compression_tool")
	pctx.HostBinToolVariable("dexdeps", "dexdeps")
	pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh")
}

@@ -707,12 +708,12 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
				"readelf":   "${config.ClangBin}/llvm-readelf",
			},
		})
		a.apisUsedByModuleFile = apisUsedbyOutputFile
		a.nativeApisUsedByModuleFile = apisUsedbyOutputFile

		var libNames []string
		var nativeLibNames []string
		for _, f := range a.filesInfo {
			if f.class == nativeSharedLib {
				libNames = append(libNames, f.stem())
				nativeLibNames = append(nativeLibNames, f.stem())
			}
		}
		apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
@@ -720,9 +721,25 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
		rule.Command().
			Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
			Output(apisBackedbyOutputFile).
			Flags(libNames)
			Flags(nativeLibNames)
		rule.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
		a.apisBackedByModuleFile = apisBackedbyOutputFile
		a.nativeApisBackedByModuleFile = apisBackedbyOutputFile

		var javaLibOrApkPath []android.Path
		for _, f := range a.filesInfo {
			if f.class == javaSharedLib || f.class == app {
				javaLibOrApkPath = append(javaLibOrApkPath, f.builtFile)
			}
		}
		javaApiUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_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).
			Inputs(javaLibOrApkPath)
		javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
		a.javaApisUsedByModuleFile = javaApiUsedbyOutputFile

		bundleConfig := a.buildBundleConfig(ctx)

+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ var PrepareForTestWithApexBuildComponents = android.GroupFixturePreparers(
	android.MockFS{
		// Needed by apex.
		"system/core/rootdir/etc/public.libraries.android.txt": nil,
		"build/soong/scripts/gen_java_usedby_apex.sh":          nil,
		"build/soong/scripts/gen_ndk_backedby_apex.sh":         nil,
		// Needed by prebuilt_apex.
		"build/soong/scripts/unpack-prebuilt-apex.sh": nil,
+1 −1
Original line number Diff line number Diff line
@@ -3,4 +3,4 @@ per-file build-mainline-modules.sh = ngeoffray@google.com,paulduffin@google.com,
per-file build-aml-prebuilts.sh = ngeoffray@google.com,paulduffin@google.com,mast@google.com
per-file construct_context.py = ngeoffray@google.com,calin@google.com,skvadrik@google.com
per-file conv_linker_config.py = kiyoungkim@google.com, jiyong@google.com, jooyung@google.com
per-file gen_ndk*.sh = sophiez@google.com, allenhair@google.com
per-file gen_ndk*.sh,gen_java*.sh = sophiez@google.com, allenhair@google.com
 No newline at end of file
Loading