Skip to content
Snippets Groups Projects
Commit 31cf2747 authored by Jihoon Kang's avatar Jihoon Kang
Browse files

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
parent a73a8b3a
No related branches found
No related tags found
No related merge requests found
......@@ -374,7 +374,10 @@ stubs_defaults {
previous_api: ":android.api.public.latest",
merge_annotations_dirs: ["metalava-manual"],
defaults_visibility: ["//frameworks/base/api"],
visibility: ["//frameworks/base/api"],
visibility: [
"//frameworks/base/api",
"//frameworks/base/core/api",
],
}
// We resolve dependencies on APIs in modules by depending on a prebuilt of the whole
......
......@@ -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)
......
......@@ -96,3 +96,54 @@ filegroup {
name: "non-updatable-test-lint-baseline.txt",
srcs: ["test-lint-baseline.txt"],
}
// Exportable stub artifacts
filegroup {
name: "non-updatable-exportable-current.txt",
srcs: [":api-stubs-docs-non-updatable{.exportable.api.txt}"],
}
filegroup {
name: "non-updatable-exportable-removed.txt",
srcs: [":api-stubs-docs-non-updatable{.exportable.removed-api.txt}"],
}
filegroup {
name: "non-updatable-exportable-system-current.txt",
srcs: [":system-api-stubs-docs-non-updatable{.exportable.api.txt}"],
}
filegroup {
name: "non-updatable-exportable-system-removed.txt",
srcs: [":system-api-stubs-docs-non-updatable{.exportable.removed-api.txt}"],
}
filegroup {
name: "non-updatable-exportable-module-lib-current.txt",
srcs: [":module-lib-api-stubs-docs-non-updatable{.exportable.api.txt}"],
}
filegroup {
name: "non-updatable-exportable-module-lib-removed.txt",
srcs: [":module-lib-api-stubs-docs-non-updatable{.exportable.removed-api.txt}"],
}
filegroup {
name: "non-updatable-exportable-test-current.txt",
srcs: [":test-api-stubs-docs-non-updatable{.exportable.api.txt}"],
}
filegroup {
name: "non-updatable-exportable-test-removed.txt",
srcs: [":test-api-stubs-docs-non-updatable{.exportable.removed-api.txt}"],
}
filegroup {
name: "non-updatable-exportable-system-server-current.txt",
srcs: [":services-non-updatable-stubs{.exportable.api.txt}"],
}
filegroup {
name: "non-updatable-exportable-system-server-removed.txt",
srcs: [":services-non-updatable-stubs{.exportable.removed-api.txt}"],
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment