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

Commit 874a97ea authored by Cole Faust's avatar Cole Faust Committed by Automerger Merge Worker
Browse files

Merge "Add lint api database files for module and system server sdks" am: 1291b83a

parents bf0a7474 1291b83a
Loading
Loading
Loading
Loading
+36 −9
Original line number Original line Diff line number Diff line
@@ -122,17 +122,30 @@ droidstubs {
}
}


droidstubs {
droidstubs {
    name: "framework-doc-system-stubs",
    name: "android-non-updatable-doc-stubs-module-lib",
    defaults: ["framework-doc-stubs-sources-default"],
    defaults: [
        "android-non-updatable-doc-stubs-defaults",
        "module-classpath-stubs-defaults",
    ],
    args: metalava_framework_docs_args +
    args: metalava_framework_docs_args +
        " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
        " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) " +
    api_levels_annotations_enabled: true,
        " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\) ",
    api_levels_annotations_dirs: [
    generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs.
        "sdk-dir",
    write_sdk_values: false,
        "api-versions-jars-dir",
}

droidstubs {
    name: "android-non-updatable-doc-stubs-system-server",
    defaults: [
        "android-non-updatable-doc-stubs-defaults",
        "module-classpath-stubs-defaults",
    ],
    ],
    api_levels_sdk_type: "system",
    args: metalava_framework_docs_args +
    extensions_info_file: ":sdk-extensions-info",
        " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) " +
        " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\) " +
        " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.SYSTEM_SERVER\\) ",
    generate_stubs: false, // We're only using this module for the annotations.zip output, disable doc-stubs.
    write_sdk_values: false,
}
}


droidstubs {
droidstubs {
@@ -150,6 +163,20 @@ droidstubs {
    extensions_info_file: ":sdk-extensions-info",
    extensions_info_file: ":sdk-extensions-info",
}
}


droidstubs {
    name: "framework-doc-system-stubs",
    defaults: ["framework-doc-stubs-sources-default"],
    args: metalava_framework_docs_args +
        " --show-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.PRIVILEGED_APPS\\) ",
    api_levels_annotations_enabled: true,
    api_levels_annotations_dirs: [
        "sdk-dir",
        "api-versions-jars-dir",
    ],
    api_levels_sdk_type: "system",
    extensions_info_file: ":sdk-extensions-info",
}

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// API docs are created from the generated stub source files
// API docs are created from the generated stub source files
// using droiddoc
// using droiddoc
+57 −0
Original line number Original line Diff line number Diff line
@@ -411,6 +411,36 @@ java_library {
    ],
    ],
}
}


java_library {
    name: "android_module_stubs_current_with_test_libs",
    static_libs: [
        "android_module_lib_stubs_current",
        "android.test.base.stubs",
        "android.test.mock.stubs",
        "android.test.runner.stubs",
    ],
    defaults: ["android.jar_defaults"],
    visibility: [
        "//visibility:override",
        "//visibility:private",
    ],
}

java_library {
    name: "android_system_server_stubs_current_with_test_libs",
    static_libs: [
        "android_system_server_stubs_current",
        "android.test.base.stubs.system",
        "android.test.mock.stubs.system",
        "android.test.runner.stubs.system",
    ],
    defaults: ["android.jar_defaults"],
    visibility: [
        "//visibility:override",
        "//visibility:private",
    ],
}

droidstubs {
droidstubs {
    name: "api_versions_public",
    name: "api_versions_public",
    srcs: [":android_stubs_current_with_test_libs{.jar}"],
    srcs: [":android_stubs_current_with_test_libs{.jar}"],
@@ -420,6 +450,7 @@ droidstubs {
        "sdk-dir",
        "sdk-dir",
        "api-versions-jars-dir",
        "api-versions-jars-dir",
    ],
    ],
    api_levels_sdk_type: "public",
    extensions_info_file: ":sdk-extensions-info",
    extensions_info_file: ":sdk-extensions-info",
}
}


@@ -436,6 +467,32 @@ droidstubs {
    extensions_info_file: ":sdk-extensions-info",
    extensions_info_file: ":sdk-extensions-info",
}
}


droidstubs {
    name: "api_versions_module_lib",
    srcs: [":android_module_stubs_current_with_test_libs{.jar}"],
    generate_stubs: false,
    api_levels_annotations_enabled: true,
    api_levels_annotations_dirs: [
        "sdk-dir",
        "api-versions-jars-dir",
    ],
    api_levels_sdk_type: "module-lib",
    extensions_info_file: ":sdk-extensions-info",
}

droidstubs {
    name: "api_versions_system_server",
    srcs: [":android_system_server_stubs_current_with_test_libs{.jar}"],
    generate_stubs: false,
    api_levels_annotations_enabled: true,
    api_levels_annotations_dirs: [
        "sdk-dir",
        "api-versions-jars-dir",
    ],
    api_levels_sdk_type: "system-server",
    extensions_info_file: ":sdk-extensions-info",
}

/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// hwbinder.stubs provides APIs required for building HIDL Java
// hwbinder.stubs provides APIs required for building HIDL Java
// libraries.
// libraries.
+18 −0
Original line number Original line Diff line number Diff line
@@ -207,6 +207,24 @@ genrule {
    ],
    ],
}
}


genrule {
    name: "sdk-annotations-module-lib.zip",
    defaults: ["sdk-annotations-defaults"],
    srcs: [
        ":android-non-updatable-doc-stubs-module-lib{.annotations.zip}",
        ":all-modules-module-lib-annotations",
    ],
}

genrule {
    name: "sdk-annotations-system-server.zip",
    defaults: ["sdk-annotations-defaults"],
    srcs: [
        ":android-non-updatable-doc-stubs-system-server{.annotations.zip}",
        ":all-modules-system-server-annotations",
    ],
}

genrule {
genrule {
    name: "combined-removed-dex",
    name: "combined-removed-dex",
    visibility: [
    visibility: [
+69 −26
Original line number Original line Diff line number Diff line
@@ -148,18 +148,35 @@ func createMergedStubsSrcjar(ctx android.LoadHookContext, modules []string) {
	ctx.CreateModule(genrule.GenRuleFactory, &props)
	ctx.CreateModule(genrule.GenRuleFactory, &props)
}
}


func createMergedPublicAnnotationsFilegroup(ctx android.LoadHookContext, modules []string) {
func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules []string) {
	for _, i := range []struct{
		name    string
		tag     string
		modules []string
	}{
		{
			name: "all-modules-public-annotations",
			tag:  "{.public.annotations.zip}",
			modules: modules,
		}, {
			name: "all-modules-system-annotations",
			tag:  "{.system.annotations.zip}",
			modules: modules,
		}, {
			name: "all-modules-module-lib-annotations",
			tag:  "{.module-lib.annotations.zip}",
			modules: modules,
		}, {
			name: "all-modules-system-server-annotations",
			tag:  "{.system-server.annotations.zip}",
			modules: system_server_modules,
		},
	} {
		props := fgProps{}
		props := fgProps{}
	props.Name = proptools.StringPtr("all-modules-public-annotations")
		props.Name = proptools.StringPtr(i.name)
	props.Srcs = createSrcs(modules, "{.public.annotations.zip}")
		props.Srcs = createSrcs(i.modules, i.tag)
		ctx.CreateModule(android.FileGroupFactory, &props)
		ctx.CreateModule(android.FileGroupFactory, &props)
	}
	}

func createMergedSystemAnnotationsFilegroup(ctx android.LoadHookContext, modules []string) {
	props := fgProps{}
	props.Name = proptools.StringPtr("all-modules-system-annotations")
	props.Srcs = createSrcs(modules, "{.system.annotations.zip}")
	ctx.CreateModule(android.FileGroupFactory, &props)
}
}


func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
@@ -172,18 +189,44 @@ func createFilteredApiVersions(ctx android.LoadHookContext, modules []string) {
	//    difficult to achieve.
	//    difficult to achieve.
	modules = remove(modules, art)
	modules = remove(modules, art)


	for _, i := range []struct{
		name string
		out  string
		in   string
	}{
		{
			// We shouldn't need public-filtered or system-filtered.
			// public-filtered is currently used to lint things that
			// use the module sdk or the system server sdk, but those
			// should be switched over to module-filtered and
			// system-server-filtered, and then public-filtered can
			// be removed.
			name: "api-versions-xml-public-filtered",
			out:  "api-versions-public-filtered.xml",
			in:   ":api_versions_public{.api_versions.xml}",
		}, {
			name: "api-versions-xml-module-lib-filtered",
			out:  "api-versions-module-lib-filtered.xml",
			in:   ":api_versions_module_lib{.api_versions.xml}",
		}, {
			name: "api-versions-xml-system-server-filtered",
			out:  "api-versions-system-server-filtered.xml",
			in:   ":api_versions_system_server{.api_versions.xml}",
		},
	} {
		props := genruleProps{}
		props := genruleProps{}
	props.Name = proptools.StringPtr("api-versions-xml-public-filtered")
		props.Name = proptools.StringPtr(i.name)
	props.Tools = []string{"api_versions_trimmer"}
		props.Out = []string{i.out}
	props.Out = []string{"api-versions-public-filtered.xml"}
	props.Cmd = proptools.StringPtr("$(location api_versions_trimmer) $(out) $(in)")
		// Note: order matters: first parameter is the full api-versions.xml
		// Note: order matters: first parameter is the full api-versions.xml
		// after that the stubs files in any order
		// after that the stubs files in any order
		// stubs files are all modules that export API surfaces EXCEPT ART
		// stubs files are all modules that export API surfaces EXCEPT ART
	props.Srcs = append([]string{":api_versions_public{.api_versions.xml}"}, createSrcs(modules, ".stubs{.jar}")...)
		props.Srcs = append([]string{i.in}, createSrcs(modules, ".stubs{.jar}")...)
		props.Tools = []string{"api_versions_trimmer"}
		props.Cmd = proptools.StringPtr("$(location api_versions_trimmer) $(out) $(in)")
		props.Dists = []android.Dist{{Targets: []string{"sdk"}}}
		props.Dists = []android.Dist{{Targets: []string{"sdk"}}}
		ctx.CreateModule(genrule.GenRuleFactory, &props)
		ctx.CreateModule(genrule.GenRuleFactory, &props)
	}
	}
}


func createMergedPublicStubs(ctx android.LoadHookContext, modules []string) {
func createMergedPublicStubs(ctx android.LoadHookContext, modules []string) {
	props := libraryProps{}
	props := libraryProps{}
@@ -279,11 +322,12 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_


func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
	bootclasspath := a.properties.Bootclasspath
	bootclasspath := a.properties.Bootclasspath
	system_server_classpath := a.properties.System_server_classpath
	if ctx.Config().VendorConfig("ANDROID").Bool("include_nonpublic_framework_api") {
	if ctx.Config().VendorConfig("ANDROID").Bool("include_nonpublic_framework_api") {
		bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...)
		bootclasspath = append(bootclasspath, a.properties.Conditional_bootclasspath...)
		sort.Strings(bootclasspath)
		sort.Strings(bootclasspath)
	}
	}
	createMergedTxts(ctx, bootclasspath, a.properties.System_server_classpath)
	createMergedTxts(ctx, bootclasspath, system_server_classpath)


	createMergedStubsSrcjar(ctx, bootclasspath)
	createMergedStubsSrcjar(ctx, bootclasspath)


@@ -292,8 +336,7 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
	createMergedFrameworkModuleLibStubs(ctx, bootclasspath)
	createMergedFrameworkModuleLibStubs(ctx, bootclasspath)
	createMergedFrameworkImpl(ctx, bootclasspath)
	createMergedFrameworkImpl(ctx, bootclasspath)


	createMergedPublicAnnotationsFilegroup(ctx, bootclasspath)
	createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath)
	createMergedSystemAnnotationsFilegroup(ctx, bootclasspath)


	createFilteredApiVersions(ctx, bootclasspath)
	createFilteredApiVersions(ctx, bootclasspath)