Merge "Fix mistake in disting of api txt"

This commit is contained in:
Anton Hansson
2022-04-12 17:56:26 +00:00
committed by Gerrit Code Review

View File

@@ -27,6 +27,7 @@ import (
const art = "art.module.public.api" const art = "art.module.public.api"
const conscrypt = "conscrypt.module.public.api" const conscrypt = "conscrypt.module.public.api"
const i18n = "i18n.module.public.api" const i18n = "i18n.module.public.api"
var core_libraries_modules = []string{art, conscrypt, i18n} var core_libraries_modules = []string{art, conscrypt, i18n}
// The intention behind this soong plugin is to generate a number of "merged" // The intention behind this soong plugin is to generate a number of "merged"
@@ -92,6 +93,8 @@ type fgProps struct {
type MergedTxtDefinition struct { type MergedTxtDefinition struct {
// "current.txt" or "removed.txt" // "current.txt" or "removed.txt"
TxtFilename string TxtFilename string
// Filename in the new dist dir. "android.txt" or "android-removed.txt"
DistFilename string
// The module for the non-updatable / non-module part of the api. // The module for the non-updatable / non-module part of the api.
BaseTxt string BaseTxt string
// The list of modules that are relevant for this merged txt. // The list of modules that are relevant for this merged txt.
@@ -112,7 +115,6 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) {
if txt.Scope != "public" { if txt.Scope != "public" {
filename = txt.Scope + "-" + filename filename = txt.Scope + "-" + filename
} }
props := genruleProps{} props := genruleProps{}
props.Name = proptools.StringPtr(ctx.ModuleName() + "-" + filename) props.Name = proptools.StringPtr(ctx.ModuleName() + "-" + filename)
props.Tools = []string{"metalava"} props.Tools = []string{"metalava"}
@@ -126,9 +128,9 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) {
Dest: proptools.StringPtr(filename), Dest: proptools.StringPtr(filename),
}, },
{ {
Targets: []string{"sdk"}, Targets: []string{"api_txt", "sdk"},
Dir: proptools.StringPtr("apistubs/android/" + txt.Scope + "/api"), Dir: proptools.StringPtr("apistubs/android/" + txt.Scope + "/api"),
Dest: proptools.StringPtr(txt.TxtFilename), Dest: proptools.StringPtr(txt.DistFilename),
}, },
} }
props.Visibility = []string{"//visibility:public"} props.Visibility = []string{"//visibility:public"}
@@ -242,9 +244,11 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_
var textFiles []MergedTxtDefinition var textFiles []MergedTxtDefinition
tagSuffix := []string{".api.txt}", ".removed-api.txt}"} tagSuffix := []string{".api.txt}", ".removed-api.txt}"}
distFilename := []string{"android.txt", "android-removed.txt"}
for i, f := range []string{"current.txt", "removed.txt"} { for i, f := range []string{"current.txt", "removed.txt"} {
textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{
TxtFilename: f, TxtFilename: f,
DistFilename: distFilename[i],
BaseTxt: ":non-updatable-" + f, BaseTxt: ":non-updatable-" + f,
Modules: bootclasspath, Modules: bootclasspath,
ModuleTag: "{.public" + tagSuffix[i], ModuleTag: "{.public" + tagSuffix[i],
@@ -252,6 +256,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_
}) })
textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{
TxtFilename: f, TxtFilename: f,
DistFilename: distFilename[i],
BaseTxt: ":non-updatable-system-" + f, BaseTxt: ":non-updatable-system-" + f,
Modules: bootclasspath, Modules: bootclasspath,
ModuleTag: "{.system" + tagSuffix[i], ModuleTag: "{.system" + tagSuffix[i],
@@ -259,6 +264,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_
}) })
textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{
TxtFilename: f, TxtFilename: f,
DistFilename: distFilename[i],
BaseTxt: ":non-updatable-module-lib-" + f, BaseTxt: ":non-updatable-module-lib-" + f,
Modules: bootclasspath, Modules: bootclasspath,
ModuleTag: "{.module-lib" + tagSuffix[i], ModuleTag: "{.module-lib" + tagSuffix[i],
@@ -266,6 +272,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_
}) })
textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{
TxtFilename: f, TxtFilename: f,
DistFilename: distFilename[i],
BaseTxt: ":non-updatable-system-server-" + f, BaseTxt: ":non-updatable-system-server-" + f,
Modules: system_server_classpath, Modules: system_server_classpath,
ModuleTag: "{.system-server" + tagSuffix[i], ModuleTag: "{.system-server" + tagSuffix[i],