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

Commit a08f8154 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Revert "Revert "Remove full api surface from-text stubs java_api...""...

Merge "Revert "Revert "Remove full api surface from-text stubs java_api..."" into main am: 28501b72

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3205867



Change-Id: I9aefb2d07bbb300af5fc4840bc2e58533d60e084
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3512ccef 28501b72
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -284,7 +284,7 @@ packages_to_document = [
// These are libs from framework-internal-utils that are required (i.e. being referenced)
// These are libs from framework-internal-utils that are required (i.e. being referenced)
// from framework-non-updatable-sources. Add more here when there's a need.
// from framework-non-updatable-sources. Add more here when there's a need.
// DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
// DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
// dependencies gets bigger.
// dependencies when the list gets bigger.
android_non_updatable_stubs_libs = [
android_non_updatable_stubs_libs = [
    "android.hardware.cas-V1.2-java",
    "android.hardware.cas-V1.2-java",
    "android.hardware.health-V1.0-java-constants",
    "android.hardware.health-V1.0-java-constants",
@@ -384,6 +384,11 @@ non_updatable_api_deps_on_modules = [
    "sdk_system_current_android",
    "sdk_system_current_android",
]
]


java_defaults {
    name: "module-classpath-java-defaults",
    libs: non_updatable_api_deps_on_modules,
}

// Defaults with module APIs in the classpath (mostly from prebuilts).
// Defaults with module APIs in the classpath (mostly from prebuilts).
// Suitable for compiling android-non-updatable.
// Suitable for compiling android-non-updatable.
stubs_defaults {
stubs_defaults {
+29 −230
Original line number Original line Diff line number Diff line
@@ -563,8 +563,12 @@ java_library {


java_defaults {
java_defaults {
    name: "android-non-updatable_from_text_defaults",
    name: "android-non-updatable_from_text_defaults",
    defaults: ["android-non-updatable-stubs-libs-defaults"],
    static_libs: ["framework-res-package-jar"],
    static_libs: ["framework-res-package-jar"],
    libs: ["stub-annotations"],
    libs: ["stub-annotations"],
    sdk_version: "none",
    system_modules: "none",
    previous_api: ":android.api.public.latest",
}
}


java_defaults {
java_defaults {
@@ -582,10 +586,10 @@ java_api_library {
        "api-stubs-docs-non-updatable.api.contribution",
        "api-stubs-docs-non-updatable.api.contribution",
    ],
    ],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    full_api_surface_stub: "android_stubs_current.from-text",
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // and can result in incorrect behavior.
    // and can result in incorrect behavior.
    previous_api: ":android.api.combined.public.latest",
    previous_api: ":android.api.combined.public.latest",
    libs: ["all-modules-public-stubs"],
}
}


java_api_library {
java_api_library {
@@ -596,10 +600,10 @@ java_api_library {
        "system-api-stubs-docs-non-updatable.api.contribution",
        "system-api-stubs-docs-non-updatable.api.contribution",
    ],
    ],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    full_api_surface_stub: "android_system_stubs_current.from-text",
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // and can result in incorrect behavior.
    // and can result in incorrect behavior.
    previous_api: ":android.api.combined.system.latest",
    previous_api: ":android.api.combined.system.latest",
    libs: ["all-modules-system-stubs"],
}
}


java_api_library {
java_api_library {
@@ -611,10 +615,10 @@ java_api_library {
        "test-api-stubs-docs-non-updatable.api.contribution",
        "test-api-stubs-docs-non-updatable.api.contribution",
    ],
    ],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    full_api_surface_stub: "android_test_stubs_current.from-text",
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // and can result in incorrect behavior.
    // and can result in incorrect behavior.
    previous_api: ":android.api.combined.test.latest",
    previous_api: ":android.api.combined.test.latest",
    libs: ["all-modules-system-stubs"],
}
}


java_api_library {
java_api_library {
@@ -625,8 +629,10 @@ java_api_library {
        "system-api-stubs-docs-non-updatable.api.contribution",
        "system-api-stubs-docs-non-updatable.api.contribution",
        "module-lib-api-stubs-docs-non-updatable.api.contribution",
        "module-lib-api-stubs-docs-non-updatable.api.contribution",
    ],
    ],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    defaults: [
    full_api_surface_stub: "android_module_lib_stubs_current_full.from-text",
        "module-classpath-java-defaults",
        "android-non-updatable_everything_from_text_defaults",
    ],
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // Use full Android API not just the non-updatable API as the latter is incomplete
    // and can result in incorrect behavior.
    // and can result in incorrect behavior.
    previous_api: ":android.api.combined.module-lib.latest",
    previous_api: ":android.api.combined.module-lib.latest",
@@ -644,14 +650,16 @@ java_api_library {
        "test-api-stubs-docs-non-updatable.api.contribution",
        "test-api-stubs-docs-non-updatable.api.contribution",
        "module-lib-api-stubs-docs-non-updatable.api.contribution",
        "module-lib-api-stubs-docs-non-updatable.api.contribution",
    ],
    ],
    defaults: ["android-non-updatable_everything_from_text_defaults"],
    defaults: [
    full_api_surface_stub: "android_test_module_lib_stubs_current.from-text",
        "module-classpath-java-defaults",
        "android-non-updatable_everything_from_text_defaults",
    ],


    // No need to specify previous_api as this is not used for compiling against.
    // No need to specify previous_api as this is not used for compiling against.

    // This module is only used for hiddenapi, and other modules should not
    // This module is only used for hiddenapi, and other modules should not
    // depend on this module.
    // depend on this module.
    visibility: ["//visibility:private"],
    visibility: ["//visibility:private"],
    libs: ["all-modules-system-stubs"],
}
}


java_defaults {
java_defaults {
@@ -665,7 +673,7 @@ java_defaults {
}
}


java_library {
java_library {
    name: "android_stubs_current.from-source",
    name: "android_stubs_current",
    static_libs: [
    static_libs: [
        "all-modules-public-stubs",
        "all-modules-public-stubs",
        "android-non-updatable.stubs",
        "android-non-updatable.stubs",
@@ -675,7 +683,7 @@ java_library {
}
}


java_library {
java_library {
    name: "android_stubs_current_exportable.from-source",
    name: "android_stubs_current_exportable",
    static_libs: [
    static_libs: [
        "all-modules-public-stubs-exportable",
        "all-modules-public-stubs-exportable",
        "android-non-updatable.stubs.exportable",
        "android-non-updatable.stubs.exportable",
@@ -685,7 +693,7 @@ java_library {
}
}


java_library {
java_library {
    name: "android_system_stubs_current.from-source",
    name: "android_system_stubs_current",
    static_libs: [
    static_libs: [
        "all-modules-system-stubs",
        "all-modules-system-stubs",
        "android-non-updatable.stubs.system",
        "android-non-updatable.stubs.system",
@@ -698,7 +706,7 @@ java_library {
}
}


java_library {
java_library {
    name: "android_system_stubs_current_exportable.from-source",
    name: "android_system_stubs_current_exportable",
    static_libs: [
    static_libs: [
        "all-modules-system-stubs-exportable",
        "all-modules-system-stubs-exportable",
        "android-non-updatable.stubs.exportable.system",
        "android-non-updatable.stubs.exportable.system",
@@ -722,7 +730,7 @@ java_library {
}
}


java_library {
java_library {
    name: "android_test_stubs_current.from-source",
    name: "android_test_stubs_current",
    static_libs: [
    static_libs: [
        // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
        // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
        // include the SystemApi of framework-non-updatable-sources.
        // include the SystemApi of framework-non-updatable-sources.
@@ -739,7 +747,7 @@ java_library {
}
}


java_library {
java_library {
    name: "android_test_stubs_current_exportable.from-source",
    name: "android_test_stubs_current_exportable",
    static_libs: [
    static_libs: [
        // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
        // Updatable modules do not have test APIs, but we want to include their SystemApis, like we
        // include the SystemApi of framework-non-updatable-sources.
        // include the SystemApi of framework-non-updatable-sources.
@@ -760,7 +768,7 @@ java_library {


// This module does not need to be copied to dist
// This module does not need to be copied to dist
java_library {
java_library {
    name: "android_test_frameworks_core_stubs_current.from-source",
    name: "android_test_frameworks_core_stubs_current",
    static_libs: [
    static_libs: [
        "all-updatable-modules-system-stubs",
        "all-updatable-modules-system-stubs",
        "android-non-updatable.stubs.test",
        "android-non-updatable.stubs.test",
@@ -772,7 +780,7 @@ java_library {
}
}


java_library {
java_library {
    name: "android_module_lib_stubs_current.from-source",
    name: "android_module_lib_stubs_current",
    defaults: [
    defaults: [
        "android.jar_defaults",
        "android.jar_defaults",
    ],
    ],
@@ -785,7 +793,7 @@ java_library {
}
}


java_library {
java_library {
    name: "android_module_lib_stubs_current_exportable.from-source",
    name: "android_module_lib_stubs_current_exportable",
    defaults: [
    defaults: [
        "android.jar_defaults",
        "android.jar_defaults",
        "android_stubs_dists_default",
        "android_stubs_dists_default",
@@ -801,20 +809,20 @@ java_library {
}
}


java_library {
java_library {
    name: "android_system_server_stubs_current.from-source",
    name: "android_system_server_stubs_current",
    defaults: [
    defaults: [
        "android.jar_defaults",
        "android.jar_defaults",
    ],
    ],
    srcs: [":services-non-updatable-stubs"],
    srcs: [":services-non-updatable-stubs"],
    installable: false,
    installable: false,
    static_libs: [
    static_libs: [
        "android_module_lib_stubs_current.from-source",
        "android_module_lib_stubs_current",
    ],
    ],
    visibility: ["//frameworks/base/services"],
    visibility: ["//frameworks/base/services"],
}
}


java_library {
java_library {
    name: "android_system_server_stubs_current_exportable.from-source",
    name: "android_system_server_stubs_current_exportable",
    defaults: [
    defaults: [
        "android.jar_defaults",
        "android.jar_defaults",
        "android_stubs_dists_default",
        "android_stubs_dists_default",
@@ -822,7 +830,7 @@ java_library {
    srcs: [":services-non-updatable-stubs{.exportable}"],
    srcs: [":services-non-updatable-stubs{.exportable}"],
    installable: false,
    installable: false,
    static_libs: [
    static_libs: [
        "android_module_lib_stubs_current_exportable.from-source",
        "android_module_lib_stubs_current_exportable",
    ],
    ],
    dist: {
    dist: {
        dir: "apistubs/android/system-server",
        dir: "apistubs/android/system-server",
@@ -897,215 +905,6 @@ java_genrule {
    },
    },
}
}


//
// Java API defaults and libraries for single tree build
//

java_defaults {
    name: "stub-annotation-defaults",
    libs: [
        "stub-annotations",
    ],
    static_libs: [
        // stub annotations do not contribute to the API surfaces but are statically
        // linked in the stubs for API surfaces (see frameworks/base/StubLibraries.bp).
        // This is because annotation processors insist on loading the classes for any
        // annotations found, thus should exist inside android.jar.
        "private-stub-annotations-jar",
    ],
    is_stubs_module: true,
}

// Listing of API domains contribution and dependencies per API surfaces
java_defaults {
    name: "android_test_stubs_current_contributions",
    api_surface: "test",
    api_contributions: [
        "framework-virtualization.stubs.source.test.api.contribution",
        "framework-location.stubs.source.test.api.contribution",
    ],
}

java_defaults {
    name: "android_test_frameworks_core_stubs_current_contributions",
    api_surface: "test",
    api_contributions: [
        "test-api-stubs-docs-non-updatable.api.contribution",
    ],
}

java_defaults {
    name: "android_module_lib_stubs_current_contributions",
    api_surface: "module-lib",
    api_contributions: [
        "api-stubs-docs-non-updatable.api.contribution",
        "system-api-stubs-docs-non-updatable.api.contribution",
        "module-lib-api-stubs-docs-non-updatable.api.contribution",
        "art.module.public.api.stubs.source.api.contribution",
        "art.module.public.api.stubs.source.system.api.contribution",
        "art.module.public.api.stubs.source.module_lib.api.contribution",
        "i18n.module.public.api.stubs.source.api.contribution",
        "i18n.module.public.api.stubs.source.system.api.contribution",
        "i18n.module.public.api.stubs.source.module_lib.api.contribution",
    ],
    previous_api: ":android.api.combined.module-lib.latest",
}

// Java API library definitions per API surface
java_api_library {
    name: "android_stubs_current.from-text",
    api_surface: "public",
    defaults: [
        // This module is dynamically created at frameworks/base/api/api.go
        // instead of being written out, in order to minimize edits in the codebase
        // when there is a change in the list of modules.
        // that contributes to an api surface.
        "android_stubs_current_contributions",
        "stub-annotation-defaults",
    ],
    api_contributions: [
        "api-stubs-docs-non-updatable.api.contribution",
    ],
    visibility: ["//visibility:public"],
    enable_validation: false,
    stubs_type: "everything",
}

java_api_library {
    name: "android_system_stubs_current.from-text",
    api_surface: "system",
    defaults: [
        "android_stubs_current_contributions",
        "android_system_stubs_current_contributions",
        "stub-annotation-defaults",
    ],
    api_contributions: [
        "api-stubs-docs-non-updatable.api.contribution",
        "system-api-stubs-docs-non-updatable.api.contribution",
    ],
    visibility: ["//visibility:public"],
    enable_validation: false,
    stubs_type: "everything",
}

java_api_library {
    name: "android_test_stubs_current.from-text",
    api_surface: "test",
    defaults: [
        "android_stubs_current_contributions",
        "android_system_stubs_current_contributions",
        "android_test_stubs_current_contributions",
        "stub-annotation-defaults",
    ],
    api_contributions: [
        "api-stubs-docs-non-updatable.api.contribution",
        "system-api-stubs-docs-non-updatable.api.contribution",
        "test-api-stubs-docs-non-updatable.api.contribution",
    ],
    visibility: ["//visibility:public"],
    enable_validation: false,
    stubs_type: "everything",
}

java_api_library {
    name: "android_test_frameworks_core_stubs_current.from-text",
    api_surface: "test",
    defaults: [
        "android_stubs_current_contributions",
        "android_system_stubs_current_contributions",
        "android_test_frameworks_core_stubs_current_contributions",
    ],
    libs: [
        "stub-annotations",
    ],
    api_contributions: [
        "api-stubs-docs-non-updatable.api.contribution",
        "system-api-stubs-docs-non-updatable.api.contribution",
    ],
    enable_validation: false,
    stubs_type: "everything",
}

java_api_library {
    name: "android_module_lib_stubs_current_full.from-text",
    api_surface: "module-lib",
    defaults: [
        "android_stubs_current_contributions",
        "android_system_stubs_current_contributions",
        "android_module_lib_stubs_current_contributions_full",
    ],
    libs: [
        "stub-annotations",
    ],
    api_contributions: [
        "api-stubs-docs-non-updatable.api.contribution",
        "system-api-stubs-docs-non-updatable.api.contribution",
        "module-lib-api-stubs-docs-non-updatable.api.contribution",
    ],
    visibility: ["//visibility:public"],
    enable_validation: false,
    stubs_type: "everything",
}

java_api_library {
    name: "android_module_lib_stubs_current.from-text",
    api_surface: "module-lib",
    defaults: [
        "android_module_lib_stubs_current_contributions",
    ],
    libs: [
        "android_module_lib_stubs_current_full.from-text",
        "stub-annotations",
    ],
    visibility: ["//visibility:public"],
    enable_validation: false,
    stubs_type: "everything",
}

java_api_library {
    name: "android_test_module_lib_stubs_current.from-text",
    api_surface: "module-lib",
    defaults: [
        "android_stubs_current_contributions",
        "android_system_stubs_current_contributions",
        "android_test_stubs_current_contributions",
        "android_module_lib_stubs_current_contributions",
    ],
    libs: [
        "android_module_lib_stubs_current_full.from-text",
        "stub-annotations",
    ],
    api_contributions: [
        "test-api-stubs-docs-non-updatable.api.contribution",
    ],

    // This module is only used to build android-non-updatable.stubs.test_module_lib
    // and other modules should not depend on this module.
    visibility: [
        "//visibility:private",
    ],
    enable_validation: false,
    stubs_type: "everything",
}

java_api_library {
    name: "android_system_server_stubs_current.from-text",
    api_surface: "system-server",
    api_contributions: [
        "services-non-updatable-stubs.api.contribution",
    ],
    libs: [
        "android_module_lib_stubs_current.from-text",
        "stub-annotations",
    ],
    static_libs: [
        "android_module_lib_stubs_current.from-text",
    ],
    visibility: ["//visibility:public"],
    enable_validation: false,
    stubs_type: "everything",
}

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// api-versions.xml generation, for public and system. This API database
// api-versions.xml generation, for public and system. This API database
// also contains the android.test.* APIs.
// also contains the android.test.* APIs.
+0 −81
Original line number Original line Diff line number Diff line
@@ -15,9 +15,7 @@
package api
package api


import (
import (
	"fmt"
	"sort"
	"sort"
	"strings"


	"github.com/google/blueprint/proptools"
	"github.com/google/blueprint/proptools"


@@ -464,79 +462,6 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_
	}
	}
}
}


func createApiContributionDefaults(ctx android.LoadHookContext, modules []string) {
	defaultsSdkKinds := []android.SdkKind{
		android.SdkPublic, android.SdkSystem, android.SdkModule,
	}
	for _, sdkKind := range defaultsSdkKinds {
		props := defaultsProps{}
		props.Name = proptools.StringPtr(
			sdkKind.DefaultJavaLibraryName() + "_contributions")
		if sdkKind == android.SdkModule {
			props.Name = proptools.StringPtr(
				sdkKind.DefaultJavaLibraryName() + "_contributions_full")
		}
		props.Api_surface = proptools.StringPtr(sdkKind.String())
		apiSuffix := ""
		if sdkKind != android.SdkPublic {
			apiSuffix = "." + strings.ReplaceAll(sdkKind.String(), "-", "_")
		}
		props.Api_contributions = transformArray(
			modules, "", fmt.Sprintf(".stubs.source%s.api.contribution", apiSuffix))
		props.Defaults_visibility = []string{"//visibility:public"}
		props.Previous_api = proptools.StringPtr(":android.api.combined." + sdkKind.String() + ".latest")
		ctx.CreateModule(java.DefaultsFactory, &props)
	}
}

func createFullApiLibraries(ctx android.LoadHookContext) {
	javaLibraryNames := []string{
		"android_stubs_current",
		"android_system_stubs_current",
		"android_test_stubs_current",
		"android_test_frameworks_core_stubs_current",
		"android_module_lib_stubs_current",
		"android_system_server_stubs_current",
	}

	for _, libraryName := range javaLibraryNames {
		props := libraryProps{}
		props.Name = proptools.StringPtr(libraryName)
		staticLib := libraryName + ".from-source"
		if ctx.Config().BuildFromTextStub() {
			staticLib = libraryName + ".from-text"
		}
		props.Static_libs = []string{staticLib}
		props.Defaults = []string{"android.jar_defaults"}
		props.Visibility = []string{"//visibility:public"}
		props.Is_stubs_module = proptools.BoolPtr(true)

		ctx.CreateModule(java.LibraryFactory, &props)
	}
}

func createFullExportableApiLibraries(ctx android.LoadHookContext) {
	javaLibraryNames := []string{
		"android_stubs_current_exportable",
		"android_system_stubs_current_exportable",
		"android_test_stubs_current_exportable",
		"android_module_lib_stubs_current_exportable",
		"android_system_server_stubs_current_exportable",
	}

	for _, libraryName := range javaLibraryNames {
		props := libraryProps{}
		props.Name = proptools.StringPtr(libraryName)
		staticLib := libraryName + ".from-source"
		props.Static_libs = []string{staticLib}
		props.Defaults = []string{"android.jar_defaults"}
		props.Visibility = []string{"//visibility:public"}
		props.Is_stubs_module = proptools.BoolPtr(true)

		ctx.CreateModule(java.LibraryFactory, &props)
	}
}

func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
	bootclasspath := a.bootclasspath(ctx)
	bootclasspath := a.bootclasspath(ctx)
	system_server_classpath := a.systemServerClasspath(ctx)
	system_server_classpath := a.systemServerClasspath(ctx)
@@ -562,12 +487,6 @@ func (a *CombinedApis) createInternalModules(ctx android.LoadHookContext) {
	createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath)
	createMergedAnnotationsFilegroups(ctx, bootclasspath, system_server_classpath)


	createPublicStubsSourceFilegroup(ctx, bootclasspath)
	createPublicStubsSourceFilegroup(ctx, bootclasspath)

	createApiContributionDefaults(ctx, bootclasspath)

	createFullApiLibraries(ctx)

	createFullExportableApiLibraries(ctx)
}
}


func combinedApisModuleFactory() android.Module {
func combinedApisModuleFactory() android.Module {
+58 −53
Original line number Original line Diff line number Diff line
@@ -52,6 +52,12 @@ func gatherRequiredDepsForTest() string {
		"core.current.stubs",
		"core.current.stubs",
		"ext",
		"ext",
		"framework",
		"framework",
		"android_stubs_current",
		"android_system_stubs_current",
		"android_test_stubs_current",
		"android_test_frameworks_core_stubs_current",
		"android_module_lib_stubs_current",
		"android_system_server_stubs_current",
		"android_stubs_current.from-text",
		"android_stubs_current.from-text",
		"android_system_stubs_current.from-text",
		"android_system_stubs_current.from-text",
		"android_test_stubs_current.from-text",
		"android_test_stubs_current.from-text",
@@ -211,7 +217,6 @@ func TestCombinedApisDefaults(t *testing.T) {
		sdk_version: "core_current",
		sdk_version: "core_current",
		annotations_enabled: true,
		annotations_enabled: true,
	}
	}

	java_sdk_library {
	java_sdk_library {
		name: "framework-bar",
		name: "framework-bar",
		srcs: ["a.java"],
		srcs: ["a.java"],
+4 −0
Original line number Original line Diff line number Diff line
@@ -47,6 +47,10 @@ java_sdk_library {
    compile_dex: true,
    compile_dex: true,
    default_to_stubs: true,
    default_to_stubs: true,
    dist_group: "android",
    dist_group: "android",

    // This module cannot generate stubs from the api signature files as stubs depends on the
    // private APIs, which are not visible in the api signature files.
    build_from_text_stub: false,
}
}


java_library {
java_library {