diff options
author | 2024-02-07 19:52:19 +0000 | |
---|---|---|
committer | 2024-02-07 22:18:01 +0000 | |
commit | 31cf274769ade4f5d0e823f267c84df6c48e00df (patch) | |
tree | ae4def1343e59d22e68460b6cb244252a74a2d53 /api/api.go | |
parent | a73a8b3a9e4d9112db4790e3c760fa56e489f229 (diff) |
Add merged txt filegroups that depend on the exportable non-updatable txt files
Currently, ther merged txt filegroups are dist'ed as api/*-current.txt
and api/*-removed.txt files during droid dist build.
This change adds additional merged txt filegroup modules
that depend on the non-updatable exportable txt files instead of
the checked in non-updatable txt files (under frameworks/base/core).
These added modules will be dist'ed in droid build, instead of the
currently existing merged txt filegroups.
Test: m nothing && inspect ninja output
Bug: 324254328
Change-Id: Ib0b47ba032a2917d0f2df6ad585d2102d6940c50
Diffstat (limited to 'api/api.go')
-rw-r--r-- | api/api.go | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/api/api.go b/api/api.go index fa2be21db09f..c733f5b5bffd 100644 --- a/api/api.go +++ b/api/api.go @@ -130,7 +130,7 @@ type MergedTxtDefinition struct { Scope string } -func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { +func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition, stubsTypeSuffix string, doDist bool) { metalavaCmd := "$(location metalava)" // Silence reflection warnings. See b/168689341 metalavaCmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " @@ -140,7 +140,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { if txt.Scope != "public" { filename = txt.Scope + "-" + filename } - moduleName := ctx.ModuleName() + "-" + filename + moduleName := ctx.ModuleName() + stubsTypeSuffix + filename props := genruleProps{} props.Name = proptools.StringPtr(moduleName) @@ -148,17 +148,19 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { props.Out = []string{filename} props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --out $(out)") props.Srcs = append([]string{txt.BaseTxt}, createSrcs(txt.Modules, txt.ModuleTag)...) - props.Dists = []android.Dist{ - { - Targets: []string{"droidcore"}, - Dir: proptools.StringPtr("api"), - Dest: proptools.StringPtr(filename), - }, - { - Targets: []string{"api_txt", "sdk"}, - Dir: proptools.StringPtr("apistubs/android/" + txt.Scope + "/api"), - Dest: proptools.StringPtr(txt.DistFilename), - }, + if doDist { + props.Dists = []android.Dist{ + { + Targets: []string{"droidcore"}, + Dir: proptools.StringPtr("api"), + Dest: proptools.StringPtr(filename), + }, + { + Targets: []string{"api_txt", "sdk"}, + Dir: proptools.StringPtr("apistubs/android/" + txt.Scope + "/api"), + Dest: proptools.StringPtr(txt.DistFilename), + }, + } } props.Visibility = []string{"//visibility:public"} ctx.CreateModule(genrule.GenRuleFactory, &props) @@ -343,7 +345,7 @@ func createPublicStubsSourceFilegroup(ctx android.LoadHookContext, modules []str ctx.CreateModule(android.FileGroupFactory, &props) } -func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string) { +func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_classpath []string, baseTxtModulePrefix, stubsTypeSuffix string, doDist bool) { var textFiles []MergedTxtDefinition tagSuffix := []string{".api.txt}", ".removed-api.txt}"} @@ -352,7 +354,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-" + f, + BaseTxt: ":" + baseTxtModulePrefix + f, Modules: bootclasspath, ModuleTag: "{.public" + tagSuffix[i], Scope: "public", @@ -360,7 +362,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-system-" + f, + BaseTxt: ":" + baseTxtModulePrefix + "system-" + f, Modules: bootclasspath, ModuleTag: "{.system" + tagSuffix[i], Scope: "system", @@ -368,7 +370,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-module-lib-" + f, + BaseTxt: ":" + baseTxtModulePrefix + "module-lib-" + f, Modules: bootclasspath, ModuleTag: "{.module-lib" + tagSuffix[i], Scope: "module-lib", @@ -376,14 +378,14 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, DistFilename: distFilename[i], - BaseTxt: ":non-updatable-system-server-" + f, + BaseTxt: ":" + baseTxtModulePrefix + "system-server-" + f, Modules: system_server_classpath, ModuleTag: "{.system-server" + tagSuffix[i], Scope: "system-server", }) } for _, txt := range textFiles { - createMergedTxt(ctx, txt) + createMergedTxt(ctx, txt, stubsTypeSuffix, doDist) } } @@ -465,7 +467,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...) sort.Strings(bootclasspath) } - createMergedTxts(ctx, bootclasspath, system_server_classpath) + createMergedTxts(ctx, bootclasspath, system_server_classpath, "non-updatable-", "-", false) + createMergedTxts(ctx, bootclasspath, system_server_classpath, "non-updatable-exportable-", "-exportable-", true) createMergedPublicStubs(ctx, bootclasspath) createMergedSystemStubs(ctx, bootclasspath) |