Loading api/Android.bp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -374,7 +374,10 @@ stubs_defaults { previous_api: ":android.api.public.latest", previous_api: ":android.api.public.latest", merge_annotations_dirs: ["metalava-manual"], merge_annotations_dirs: ["metalava-manual"], defaults_visibility: ["//frameworks/base/api"], 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 // We resolve dependencies on APIs in modules by depending on a prebuilt of the whole Loading api/api.go +23 −20 Original line number Original line Diff line number Diff line Loading @@ -130,7 +130,7 @@ type MergedTxtDefinition struct { Scope string Scope string } } func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition, stubsTypeSuffix string, doDist bool) { metalavaCmd := "$(location metalava)" metalavaCmd := "$(location metalava)" // Silence reflection warnings. See b/168689341 // Silence reflection warnings. See b/168689341 metalavaCmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " metalavaCmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " Loading @@ -140,7 +140,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { if txt.Scope != "public" { if txt.Scope != "public" { filename = txt.Scope + "-" + filename filename = txt.Scope + "-" + filename } } moduleName := ctx.ModuleName() + "-" + filename moduleName := ctx.ModuleName() + stubsTypeSuffix + filename props := genruleProps{} props := genruleProps{} props.Name = proptools.StringPtr(moduleName) props.Name = proptools.StringPtr(moduleName) Loading @@ -148,6 +148,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { props.Out = []string{filename} props.Out = []string{filename} props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --out $(out)") props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --out $(out)") props.Srcs = append([]string{txt.BaseTxt}, createSrcs(txt.Modules, txt.ModuleTag)...) props.Srcs = append([]string{txt.BaseTxt}, createSrcs(txt.Modules, txt.ModuleTag)...) if doDist { props.Dists = []android.Dist{ props.Dists = []android.Dist{ { { Targets: []string{"droidcore"}, Targets: []string{"droidcore"}, Loading @@ -160,6 +161,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { Dest: proptools.StringPtr(txt.DistFilename), Dest: proptools.StringPtr(txt.DistFilename), }, }, } } } props.Visibility = []string{"//visibility:public"} props.Visibility = []string{"//visibility:public"} ctx.CreateModule(genrule.GenRuleFactory, &props) ctx.CreateModule(genrule.GenRuleFactory, &props) } } Loading Loading @@ -343,7 +345,7 @@ func createPublicStubsSourceFilegroup(ctx android.LoadHookContext, modules []str ctx.CreateModule(android.FileGroupFactory, &props) 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 var textFiles []MergedTxtDefinition tagSuffix := []string{".api.txt}", ".removed-api.txt}"} tagSuffix := []string{".api.txt}", ".removed-api.txt}"} Loading @@ -352,7 +354,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-" + f, BaseTxt: ":" + baseTxtModulePrefix + f, Modules: bootclasspath, Modules: bootclasspath, ModuleTag: "{.public" + tagSuffix[i], ModuleTag: "{.public" + tagSuffix[i], Scope: "public", Scope: "public", Loading @@ -360,7 +362,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-system-" + f, BaseTxt: ":" + baseTxtModulePrefix + "system-" + f, Modules: bootclasspath, Modules: bootclasspath, ModuleTag: "{.system" + tagSuffix[i], ModuleTag: "{.system" + tagSuffix[i], Scope: "system", Scope: "system", Loading @@ -368,7 +370,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-module-lib-" + f, BaseTxt: ":" + baseTxtModulePrefix + "module-lib-" + f, Modules: bootclasspath, Modules: bootclasspath, ModuleTag: "{.module-lib" + tagSuffix[i], ModuleTag: "{.module-lib" + tagSuffix[i], Scope: "module-lib", Scope: "module-lib", Loading @@ -376,14 +378,14 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-system-server-" + f, BaseTxt: ":" + baseTxtModulePrefix + "system-server-" + f, Modules: system_server_classpath, Modules: system_server_classpath, ModuleTag: "{.system-server" + tagSuffix[i], ModuleTag: "{.system-server" + tagSuffix[i], Scope: "system-server", Scope: "system-server", }) }) } } for _, txt := range textFiles { for _, txt := range textFiles { createMergedTxt(ctx, txt) createMergedTxt(ctx, txt, stubsTypeSuffix, doDist) } } } } Loading Loading @@ -465,7 +467,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...) bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...) sort.Strings(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) createMergedPublicStubs(ctx, bootclasspath) createMergedSystemStubs(ctx, bootclasspath) createMergedSystemStubs(ctx, bootclasspath) Loading core/api/Android.bp +51 −0 Original line number Original line Diff line number Diff line Loading @@ -96,3 +96,54 @@ filegroup { name: "non-updatable-test-lint-baseline.txt", name: "non-updatable-test-lint-baseline.txt", srcs: ["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}"], } Loading
api/Android.bp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -374,7 +374,10 @@ stubs_defaults { previous_api: ":android.api.public.latest", previous_api: ":android.api.public.latest", merge_annotations_dirs: ["metalava-manual"], merge_annotations_dirs: ["metalava-manual"], defaults_visibility: ["//frameworks/base/api"], 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 // We resolve dependencies on APIs in modules by depending on a prebuilt of the whole Loading
api/api.go +23 −20 Original line number Original line Diff line number Diff line Loading @@ -130,7 +130,7 @@ type MergedTxtDefinition struct { Scope string Scope string } } func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition, stubsTypeSuffix string, doDist bool) { metalavaCmd := "$(location metalava)" metalavaCmd := "$(location metalava)" // Silence reflection warnings. See b/168689341 // Silence reflection warnings. See b/168689341 metalavaCmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " metalavaCmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " Loading @@ -140,7 +140,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { if txt.Scope != "public" { if txt.Scope != "public" { filename = txt.Scope + "-" + filename filename = txt.Scope + "-" + filename } } moduleName := ctx.ModuleName() + "-" + filename moduleName := ctx.ModuleName() + stubsTypeSuffix + filename props := genruleProps{} props := genruleProps{} props.Name = proptools.StringPtr(moduleName) props.Name = proptools.StringPtr(moduleName) Loading @@ -148,6 +148,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { props.Out = []string{filename} props.Out = []string{filename} props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --out $(out)") props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --out $(out)") props.Srcs = append([]string{txt.BaseTxt}, createSrcs(txt.Modules, txt.ModuleTag)...) props.Srcs = append([]string{txt.BaseTxt}, createSrcs(txt.Modules, txt.ModuleTag)...) if doDist { props.Dists = []android.Dist{ props.Dists = []android.Dist{ { { Targets: []string{"droidcore"}, Targets: []string{"droidcore"}, Loading @@ -160,6 +161,7 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { Dest: proptools.StringPtr(txt.DistFilename), Dest: proptools.StringPtr(txt.DistFilename), }, }, } } } props.Visibility = []string{"//visibility:public"} props.Visibility = []string{"//visibility:public"} ctx.CreateModule(genrule.GenRuleFactory, &props) ctx.CreateModule(genrule.GenRuleFactory, &props) } } Loading Loading @@ -343,7 +345,7 @@ func createPublicStubsSourceFilegroup(ctx android.LoadHookContext, modules []str ctx.CreateModule(android.FileGroupFactory, &props) 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 var textFiles []MergedTxtDefinition tagSuffix := []string{".api.txt}", ".removed-api.txt}"} tagSuffix := []string{".api.txt}", ".removed-api.txt}"} Loading @@ -352,7 +354,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-" + f, BaseTxt: ":" + baseTxtModulePrefix + f, Modules: bootclasspath, Modules: bootclasspath, ModuleTag: "{.public" + tagSuffix[i], ModuleTag: "{.public" + tagSuffix[i], Scope: "public", Scope: "public", Loading @@ -360,7 +362,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-system-" + f, BaseTxt: ":" + baseTxtModulePrefix + "system-" + f, Modules: bootclasspath, Modules: bootclasspath, ModuleTag: "{.system" + tagSuffix[i], ModuleTag: "{.system" + tagSuffix[i], Scope: "system", Scope: "system", Loading @@ -368,7 +370,7 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-module-lib-" + f, BaseTxt: ":" + baseTxtModulePrefix + "module-lib-" + f, Modules: bootclasspath, Modules: bootclasspath, ModuleTag: "{.module-lib" + tagSuffix[i], ModuleTag: "{.module-lib" + tagSuffix[i], Scope: "module-lib", Scope: "module-lib", Loading @@ -376,14 +378,14 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ textFiles = append(textFiles, MergedTxtDefinition{ textFiles = append(textFiles, MergedTxtDefinition{ TxtFilename: f, TxtFilename: f, DistFilename: distFilename[i], DistFilename: distFilename[i], BaseTxt: ":non-updatable-system-server-" + f, BaseTxt: ":" + baseTxtModulePrefix + "system-server-" + f, Modules: system_server_classpath, Modules: system_server_classpath, ModuleTag: "{.system-server" + tagSuffix[i], ModuleTag: "{.system-server" + tagSuffix[i], Scope: "system-server", Scope: "system-server", }) }) } } for _, txt := range textFiles { for _, txt := range textFiles { createMergedTxt(ctx, txt) createMergedTxt(ctx, txt, stubsTypeSuffix, doDist) } } } } Loading Loading @@ -465,7 +467,8 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) { bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...) bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...) sort.Strings(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) createMergedPublicStubs(ctx, bootclasspath) createMergedSystemStubs(ctx, bootclasspath) createMergedSystemStubs(ctx, bootclasspath) Loading
core/api/Android.bp +51 −0 Original line number Original line Diff line number Diff line Loading @@ -96,3 +96,54 @@ filegroup { name: "non-updatable-test-lint-baseline.txt", name: "non-updatable-test-lint-baseline.txt", srcs: ["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}"], }