Merge changes from topic "soong-tests-presubmit" into main
* changes:
Add script to run Soong tests with go tools
Disable TestVariantSingletonModule when go test -short is used
Fix data race in propagateRROEnforcementMutator
Fix data race in finder_test.go
Fix data race in dex_bootjars
Fix race CommonGlobalCflags when running tests in parallel.
Fix data race in snapshot singletons when running parallel tests
diff --git a/android/config.go b/android/config.go
index 1ea0d94..eb1e647 100644
--- a/android/config.go
+++ b/android/config.go
@@ -214,6 +214,10 @@
return c.config.productVariables.GetBuildFlagBool("RELEASE_NDK_ABI_MONITORED")
}
+func (c Config) ReleaseHiddenApiExportableStubs() bool {
+ return c.config.productVariables.GetBuildFlagBool("RELEASE_HIDDEN_API_EXPORTABLE_STUBS")
+}
+
// A DeviceConfig object represents the configuration for a particular device
// being built. For now there will only be one of these, but in the future there
// may be multiple devices being built.
@@ -1961,18 +1965,6 @@
return Bool(c.config.productVariables.CheckVendorSeappViolations)
}
-func (c *deviceConfig) NextReleaseHideFlaggedApi() bool {
- return Bool(c.config.productVariables.NextReleaseHideFlaggedApi)
-}
-
-func (c *deviceConfig) ReleaseExposeFlaggedApi() bool {
- return Bool(c.config.productVariables.Release_expose_flagged_api)
-}
-
-func (c *deviceConfig) HideFlaggedApis() bool {
- return c.NextReleaseHideFlaggedApi() && !c.ReleaseExposeFlaggedApi()
-}
-
func (c *config) GetBuildFlag(name string) (string, bool) {
val, ok := c.productVariables.BuildFlags[name]
return val, ok
diff --git a/android/prebuilt.go b/android/prebuilt.go
index d2b8fa1..a94f5b7 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -277,6 +277,9 @@
}
value := srcPropsValue.FieldByIndex(srcFieldIndex)
if value.Kind() == reflect.Ptr {
+ if value.IsNil() {
+ return nil
+ }
value = value.Elem()
}
if value.Kind() != reflect.String {
diff --git a/android/sdk_version.go b/android/sdk_version.go
index 73568af..9355667 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -109,6 +109,17 @@
}
}
+func (k SdkKind) DefaultExportableJavaLibraryName() string {
+ switch k {
+ case SdkPublic, SdkSystem, SdkTest, SdkModule, SdkSystemServer:
+ return k.DefaultJavaLibraryName() + "_exportable"
+ case SdkCore:
+ return k.DefaultJavaLibraryName() + ".exportable"
+ default:
+ panic(fmt.Errorf("API surface %v does not provide exportable stubs", k))
+ }
+}
+
// SdkSpec represents the kind and the version of an SDK for a module to build against
type SdkSpec struct {
Kind SdkKind
diff --git a/android/soong_config_modules.go b/android/soong_config_modules.go
index ec0edfd..90b49eb 100644
--- a/android/soong_config_modules.go
+++ b/android/soong_config_modules.go
@@ -41,6 +41,7 @@
ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory)
ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory)
ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory)
+ ctx.RegisterModuleType("soong_config_value_variable", SoongConfigValueVariableDummyFactory)
}
var PrepareForTestWithSoongConfigModuleBuildComponents = FixtureRegisterWithContext(RegisterSoongConfigModuleBuildComponents)
@@ -303,6 +304,11 @@
properties soongconfig.VariableProperties
}
+type soongConfigValueVariableDummyModule struct {
+ ModuleBase
+ properties soongconfig.VariableProperties
+}
+
// soong_config_string_variable defines a variable and a set of possible string values for use
// in a soong_config_module_type definition.
func SoongConfigStringVariableDummyFactory() Module {
@@ -321,6 +327,15 @@
return module
}
+// soong_config_value_variable defines a variable whose value can be expanded into
+// the value of a string property.
+func SoongConfigValueVariableDummyFactory() Module {
+ module := &soongConfigValueVariableDummyModule{}
+ module.AddProperties(&module.properties)
+ initAndroidModuleBase(module)
+ return module
+}
+
func (m *soongConfigStringVariableDummyModule) Name() string {
return m.properties.Name + fmt.Sprintf("%p", m)
}
@@ -333,6 +348,12 @@
func (*soongConfigBoolVariableDummyModule) Namespaceless() {}
func (*soongConfigBoolVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
+func (m *soongConfigValueVariableDummyModule) Name() string {
+ return m.properties.Name + fmt.Sprintf("%p", m)
+}
+func (*soongConfigValueVariableDummyModule) Namespaceless() {}
+func (*soongConfigValueVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
+
// importModuleTypes registers the module factories for a list of module types defined
// in an Android.bp file. These module factories are scoped for the current Android.bp
// file only.
diff --git a/android/soongconfig/modules.go b/android/soongconfig/modules.go
index f6b4938..d525bdc 100644
--- a/android/soongconfig/modules.go
+++ b/android/soongconfig/modules.go
@@ -16,12 +16,13 @@
import (
"fmt"
- "github.com/google/blueprint/parser"
- "github.com/google/blueprint/proptools"
"io"
"reflect"
"sort"
"strings"
+
+ "github.com/google/blueprint/parser"
+ "github.com/google/blueprint/proptools"
)
const conditionsDefault = "conditions_default"
@@ -688,6 +689,7 @@
continue
}
field = field.Elem()
+ kind = field.Kind()
}
switch kind {
case reflect.String:
diff --git a/android/soongconfig/modules_test.go b/android/soongconfig/modules_test.go
index 00e8b78..db2c83c 100644
--- a/android/soongconfig/modules_test.go
+++ b/android/soongconfig/modules_test.go
@@ -299,7 +299,7 @@
Conditions_default *properties
}
-type soongConfigVars struct {
+type boolSoongConfigVars struct {
Bool_var interface{}
}
@@ -307,7 +307,11 @@
String_var interface{}
}
-func Test_PropertiesToApply(t *testing.T) {
+type valueSoongConfigVars struct {
+ My_value_var interface{}
+}
+
+func Test_PropertiesToApply_Bool(t *testing.T) {
mt, _ := newModuleType(&ModuleTypeProperties{
Module_type: "foo",
Config_namespace: "bar",
@@ -323,9 +327,9 @@
B: false,
}
actualProps := &struct {
- Soong_config_variables soongConfigVars
+ Soong_config_variables boolSoongConfigVars
}{
- Soong_config_variables: soongConfigVars{
+ Soong_config_variables: boolSoongConfigVars{
Bool_var: &boolVarProps{
A: boolVarPositive.A,
B: boolVarPositive.B,
@@ -369,6 +373,62 @@
}
}
+func Test_PropertiesToApply_Value(t *testing.T) {
+ mt, _ := newModuleType(&ModuleTypeProperties{
+ Module_type: "foo",
+ Config_namespace: "bar",
+ Value_variables: []string{"my_value_var"},
+ Properties: []string{"a", "b"},
+ })
+ conditionsDefault := &properties{
+ A: proptools.StringPtr("default"),
+ B: false,
+ }
+ actualProps := &struct {
+ Soong_config_variables valueSoongConfigVars
+ }{
+ Soong_config_variables: valueSoongConfigVars{
+ My_value_var: &boolVarProps{
+ A: proptools.StringPtr("A=%s"),
+ B: true,
+ Conditions_default: conditionsDefault,
+ },
+ },
+ }
+ props := reflect.ValueOf(actualProps)
+
+ testCases := []struct {
+ name string
+ config SoongConfig
+ wantProps []interface{}
+ }{
+ {
+ name: "no_vendor_config",
+ config: Config(map[string]string{}),
+ wantProps: []interface{}{conditionsDefault},
+ },
+ {
+ name: "value_var_set",
+ config: Config(map[string]string{"my_value_var": "Hello"}),
+ wantProps: []interface{}{&properties{
+ A: proptools.StringPtr("A=Hello"),
+ B: true,
+ }},
+ },
+ }
+
+ for _, tc := range testCases {
+ gotProps, err := PropertiesToApply(mt, props, tc.config)
+ if err != nil {
+ t.Errorf("%s: Unexpected error in PropertiesToApply: %s", tc.name, err)
+ }
+
+ if !reflect.DeepEqual(gotProps, tc.wantProps) {
+ t.Errorf("%s: Expected %s, got %s", tc.name, tc.wantProps, gotProps)
+ }
+ }
+}
+
func Test_PropertiesToApply_String_Error(t *testing.T) {
mt, _ := newModuleType(&ModuleTypeProperties{
Module_type: "foo",
diff --git a/android/variable.go b/android/variable.go
index 9844080..a4917c5 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -73,6 +73,7 @@
Cflags []string `android:"arch_variant"`
Shared_libs []string `android:"arch_variant"`
Whole_static_libs []string `android:"arch_variant"`
+ Static_libs []string `android:"arch_variant"`
Exclude_static_libs []string `android:"arch_variant"`
Srcs []string `android:"arch_variant"`
Header_libs []string `android:"arch_variant"`
@@ -491,10 +492,6 @@
// partition images. They should not be read from soong modules.
PartitionVarsForBazelMigrationOnlyDoNotUse PartitionVariables `json:",omitempty"`
- NextReleaseHideFlaggedApi *bool `json:",omitempty"`
-
- Release_expose_flagged_api *bool `json:",omitempty"`
-
BuildFlags map[string]string `json:",omitempty"`
BuildFromSourceStub *bool `json:",omitempty"`
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 6564911..9d61e1c 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -64,6 +64,8 @@
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
"LOCAL_STRIP_MODULE": strip(),
"LOCAL_CFLAGS": cflags,
+ "LOCAL_PROTOC_FLAGS": protoLocalIncludeDirs,
+ "LOCAL_PROTO_JAVA_OUTPUT_PARAMS": protoOutputParams,
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
"LOCAL_PROGUARD_ENABLED": proguardEnabled,
"LOCAL_MODULE_PATH": prebuiltModulePath,
@@ -760,6 +762,27 @@
return includeVariableNow(bpVariable{"cflags", bpparser.ListType}, ctx)
}
+func protoOutputParams(ctx variableAssignmentContext) error {
+ // The Soong replacement for LOCAL_PROTO_JAVA_OUTPUT_PARAMS doesn't need ","
+ ctx.mkvalue = ctx.mkvalue.Clone()
+ ctx.mkvalue.ReplaceLiteral(`, `, ` `)
+ return includeVariableNow(bpVariable{"proto.output_params", bpparser.ListType}, ctx)
+}
+
+func protoLocalIncludeDirs(ctx variableAssignmentContext) error {
+ // The Soong replacement for LOCAL_PROTOC_FLAGS includes "--proto_path=$(LOCAL_PATH)/..."
+ ctx.mkvalue = ctx.mkvalue.Clone()
+ if len(ctx.mkvalue.Strings) >= 1 && strings.Contains(ctx.mkvalue.Strings[0], "--proto_path=") {
+ ctx.mkvalue.Strings[0] = strings.Replace(ctx.mkvalue.Strings[0], "--proto_path=", "", 1)
+ paths, err := localizePaths(ctx)
+ if err == nil {
+ err = setVariable(ctx.file, ctx.append, ctx.prefix, "proto.local_include_dirs", paths, true)
+ }
+ return err
+ }
+ return fmt.Errorf("Currently LOCAL_PROTOC_FLAGS only support with value '--proto_path=$(LOCAL_PATH)/...'")
+}
+
func proguardEnabled(ctx variableAssignmentContext) error {
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
diff --git a/androidmk/androidmk/androidmk_test.go b/androidmk/androidmk/androidmk_test.go
index 08bbb39..460f1ff 100644
--- a/androidmk/androidmk/androidmk_test.go
+++ b/androidmk/androidmk/androidmk_test.go
@@ -1727,9 +1727,34 @@
}
`,
},
+ {
+ desc: "LOCAL_PROTO_JAVA_OUTPUT_PARAMS",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java, parcelable_messages=true
+LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos
+include $(BUILD_PACKAGE)
+ `,
+ expected: `
+android_app {
+ name: "foo",
+ proto: {
+ output_params: [
+ "enum_style=java",
+ "parcelable_messages=true",
+ ],
+ local_include_dirs: ["protos"],
+ },
+}
+`,
+ },
}
func TestEndToEnd(t *testing.T) {
+ // Skip checking Android.mk path with cleaning "ANDROID_BUILD_TOP"
+ t.Setenv("ANDROID_BUILD_TOP", "")
+
for i, test := range testCases {
expected, err := bpfix.Reformat(test.expected)
if err != nil {
diff --git a/apex/apex.go b/apex/apex.go
index b37c495..5b0def0 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1152,15 +1152,42 @@
// Skip these mainline modules for now
var (
skipStrictUpdatabilityLintAllowlist = []string{
+ // go/keep-sorted start
+ "PackageManagerTestApex",
+ "com.android.adservices",
+ "com.android.appsearch",
"com.android.art",
"com.android.art.debug",
+ "com.android.btservices",
+ "com.android.cellbroadcast",
+ "com.android.configinfrastructure",
"com.android.conscrypt",
+ "com.android.extservices",
+ "com.android.extservices_tplus",
+ "com.android.healthfitness",
+ "com.android.ipsec",
"com.android.media",
- // test apexes
+ "com.android.mediaprovider",
+ "com.android.ondevicepersonalization",
+ "com.android.os.statsd",
+ "com.android.permission",
+ "com.android.rkpd",
+ "com.android.scheduling",
+ "com.android.tethering",
+ "com.android.uwb",
+ "com.android.wifi",
"test_com.android.art",
+ "test_com.android.cellbroadcast",
"test_com.android.conscrypt",
+ "test_com.android.extservices",
+ "test_com.android.ipsec",
"test_com.android.media",
+ "test_com.android.mediaprovider",
+ "test_com.android.os.statsd",
+ "test_com.android.permission",
+ "test_com.android.wifi",
"test_jitzygote_com.android.art",
+ // go/keep-sorted end
}
// TODO: b/215736885 Remove this list
@@ -2878,22 +2905,7 @@
// Module separator
//
m["com.android.runtime"] = []string{
- "libdebuggerd",
- "libdebuggerd_common_headers",
- "libdebuggerd_handler_core",
- "libdl_static",
- "libjemalloc5",
- "liblinker_main",
- "liblinker_malloc",
- "liblzma",
- "libprocinfo",
- "libpropertyinfoparser",
- "libscudo",
- "libsystemproperties",
- "libtombstoned_client_static",
- "libunwindstack",
"libz",
- "libziparchive",
}
return m
}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 7081f57..7e67c0f 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -6127,6 +6127,84 @@
out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/index.csv
`)
})
+
+ t.Run("Co-existing unflagged apexes should create a duplicate deapexer error in hiddenapi processing", func(t *testing.T) {
+ bp := `
+ // Source
+ apex {
+ name: "myapex",
+ enabled: false,
+ key: "myapex.key",
+ bootclasspath_fragments: ["my-bootclasspath-fragment"],
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ // Prebuilt
+ prebuilt_apex {
+ name: "myapex.v1",
+ source_apex_name: "myapex",
+ arch: {
+ arm64: {
+ src: "myapex-arm64.apex",
+ },
+ arm: {
+ src: "myapex-arm.apex",
+ },
+ },
+ exported_bootclasspath_fragments: ["my-bootclasspath-fragment"],
+ prefer: true,
+ }
+ prebuilt_apex {
+ name: "myapex.v2",
+ source_apex_name: "myapex",
+ arch: {
+ arm64: {
+ src: "myapex-arm64.apex",
+ },
+ arm: {
+ src: "myapex-arm.apex",
+ },
+ },
+ exported_bootclasspath_fragments: ["my-bootclasspath-fragment"],
+ prefer: true,
+ }
+
+ prebuilt_bootclasspath_fragment {
+ name: "my-bootclasspath-fragment",
+ contents: ["libfoo", "libbar"],
+ apex_available: ["myapex"],
+ hidden_api: {
+ annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
+ metadata: "my-bootclasspath-fragment/metadata.csv",
+ index: "my-bootclasspath-fragment/index.csv",
+ stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
+ all_flags: "my-bootclasspath-fragment/all-flags.csv",
+ },
+ prefer: true,
+ }
+
+ java_import {
+ name: "libfoo",
+ jars: ["libfoo.jar"],
+ apex_available: ["myapex"],
+ prefer: true,
+ }
+ java_import {
+ name: "libbar",
+ jars: ["libbar.jar"],
+ apex_available: ["myapex"],
+ prefer: true,
+ }
+ `
+
+ testDexpreoptWithApexes(t, bp, "Multiple installable prebuilt APEXes provide ambiguous deapexers: prebuilt_myapex.v1 and prebuilt_myapex.v2", preparer, fragment)
+ })
+
}
func TestApexWithTests(t *testing.T) {
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index b431661..f1e71b0 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -53,7 +53,11 @@
java.FixtureConfigureBootJars("com.android.art:baz", "com.android.art:quuz"),
java.FixtureConfigureApexBootJars("someapex:foo", "someapex:bar"),
prepareForTestWithArtApex,
-
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("foo", "baz"),
).RunTestWithBp(t, `
@@ -154,9 +158,9 @@
artFragment := result.Module("art-bootclasspath-fragment", "android_common")
artInfo, _ := android.SingletonModuleProvider(result, artFragment, java.HiddenAPIInfoProvider)
- bazPublicStubs := "out/soong/.intermediates/baz.stubs/android_common/dex/baz.stubs.jar"
- bazSystemStubs := "out/soong/.intermediates/baz.stubs.system/android_common/dex/baz.stubs.system.jar"
- bazTestStubs := "out/soong/.intermediates/baz.stubs.test/android_common/dex/baz.stubs.test.jar"
+ bazPublicStubs := "out/soong/.intermediates/baz.stubs.exportable/android_common/dex/baz.stubs.exportable.jar"
+ bazSystemStubs := "out/soong/.intermediates/baz.stubs.exportable.system/android_common/dex/baz.stubs.exportable.system.jar"
+ bazTestStubs := "out/soong/.intermediates/baz.stubs.exportable.test/android_common/dex/baz.stubs.exportable.test.jar"
checkAPIScopeStubs("art", artInfo, java.PublicHiddenAPIScope, bazPublicStubs)
checkAPIScopeStubs("art", artInfo, java.SystemHiddenAPIScope, bazSystemStubs)
@@ -167,8 +171,8 @@
otherFragment := result.Module("other-bootclasspath-fragment", "android_common")
otherInfo, _ := android.SingletonModuleProvider(result, otherFragment, java.HiddenAPIInfoProvider)
- fooPublicStubs := "out/soong/.intermediates/foo.stubs/android_common/dex/foo.stubs.jar"
- fooSystemStubs := "out/soong/.intermediates/foo.stubs.system/android_common/dex/foo.stubs.system.jar"
+ fooPublicStubs := "out/soong/.intermediates/foo.stubs.exportable/android_common/dex/foo.stubs.exportable.jar"
+ fooSystemStubs := "out/soong/.intermediates/foo.stubs.exportable.system/android_common/dex/foo.stubs.exportable.system.jar"
checkAPIScopeStubs("other", otherInfo, java.PublicHiddenAPIScope, bazPublicStubs, fooPublicStubs)
checkAPIScopeStubs("other", otherInfo, java.SystemHiddenAPIScope, bazSystemStubs, fooSystemStubs)
@@ -696,6 +700,11 @@
java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("foo", "quuz"),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
apex {
name: "com.android.art",
@@ -807,11 +816,11 @@
"foo",
})
- fooStubs := getDexJarPath(result, "foo.stubs")
- quuzPublicStubs := getDexJarPath(result, "quuz.stubs")
- quuzSystemStubs := getDexJarPath(result, "quuz.stubs.system")
- quuzTestStubs := getDexJarPath(result, "quuz.stubs.test")
- quuzModuleLibStubs := getDexJarPath(result, "quuz.stubs.module_lib")
+ fooStubs := getDexJarPath(result, "foo.stubs.exportable")
+ quuzPublicStubs := getDexJarPath(result, "quuz.stubs.exportable")
+ quuzSystemStubs := getDexJarPath(result, "quuz.stubs.exportable.system")
+ quuzTestStubs := getDexJarPath(result, "quuz.stubs.exportable.test")
+ quuzModuleLibStubs := getDexJarPath(result, "quuz.stubs.exportable.module_lib")
// Make sure that the fragment uses the quuz stub dex jars when generating the hidden API flags.
fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000")
diff --git a/apex/platform_bootclasspath_test.go b/apex/platform_bootclasspath_test.go
index 01b616b..161941d 100644
--- a/apex/platform_bootclasspath_test.go
+++ b/apex/platform_bootclasspath_test.go
@@ -252,6 +252,11 @@
java.FixtureWithLastReleaseApis("foo"),
java.PrepareForTestWithDexpreopt,
dexpreopt.FixtureDisableDexpreoptBootImages(false),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
apex {
name: "com.android.art",
@@ -386,10 +391,10 @@
`platform:all_apex_contributions`,
// The following are stubs.
- `platform:android_stubs_current`,
- `platform:android_system_stubs_current`,
- `platform:android_test_stubs_current`,
- `platform:legacy.core.platform.api.stubs`,
+ `platform:android_stubs_current_exportable`,
+ `platform:android_system_stubs_current_exportable`,
+ `platform:android_test_stubs_current_exportable`,
+ `platform:legacy.core.platform.api.stubs.exportable`,
// Needed for generating the boot image.
`platform:dex2oatd`,
@@ -422,6 +427,9 @@
java.PrepareForTestWithJavaSdkLibraryFiles,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
}),
java.FixtureWithPrebuiltApis(map[string][]string{
"current": {},
@@ -546,7 +554,7 @@
"platform:prebuilt_sdk_test_current_android",
// Not a prebuilt as no prebuilt existed when it was added.
- "platform:legacy.core.platform.api.stubs",
+ "platform:legacy.core.platform.api.stubs.exportable",
// The platform_bootclasspath intentionally adds dependencies on both source and prebuilt
// modules when available as it does not know which one will be preferred.
diff --git a/apex/vndk.go b/apex/vndk.go
index 26c60ed..377c1c0 100644
--- a/apex/vndk.go
+++ b/apex/vndk.go
@@ -65,24 +65,27 @@
}
vndkVersion := ab.vndkVersion(mctx.DeviceConfig())
- apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion)
- if err != nil {
- mctx.PropertyErrorf("vndk_version", "%s", err.Error())
- return
- }
+ if vndkVersion != "" {
+ apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion)
+ if err != nil {
+ mctx.PropertyErrorf("vndk_version", "%s", err.Error())
+ return
+ }
- targets := mctx.MultiTargets()
- if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) &&
- vndkVersion != mctx.DeviceConfig().PlatformVndkVersion() {
- // Disable VNDK APEXes for VNDK versions less than the minimum supported API
- // level for the primary architecture. This validation is skipped if the VNDK
- // version matches the platform VNDK version, which can occur when the device
- // config targets the 'current' VNDK (see `vndkVersion`).
- ab.Disable()
- }
- if proptools.String(ab.vndkProperties.Vndk_version) != "" &&
- apiLevel.GreaterThanOrEqualTo(android.ApiLevelOrPanic(mctx, mctx.DeviceConfig().PlatformVndkVersion())) {
- ab.Disable()
+ targets := mctx.MultiTargets()
+ if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) &&
+ vndkVersion != mctx.DeviceConfig().PlatformVndkVersion() {
+ // Disable VNDK APEXes for VNDK versions less than the minimum supported API
+ // level for the primary architecture. This validation is skipped if the VNDK
+ // version matches the platform VNDK version, which can occur when the device
+ // config targets the 'current' VNDK (see `vndkVersion`).
+ ab.Disable()
+ }
+ if proptools.String(ab.vndkProperties.Vndk_version) != "" &&
+ mctx.DeviceConfig().PlatformVndkVersion() != "" &&
+ apiLevel.GreaterThanOrEqualTo(android.ApiLevelOrPanic(mctx, mctx.DeviceConfig().PlatformVndkVersion())) {
+ ab.Disable()
+ }
}
}
}
@@ -94,6 +97,11 @@
if vndkVersion == "" {
vndkVersion = mctx.DeviceConfig().PlatformVndkVersion()
}
+
+ if vndkVersion == "" {
+ return
+ }
+
if vndkVersion == mctx.DeviceConfig().PlatformVndkVersion() {
vndkVersion = "current"
} else {
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 7723dc3..fe542b0 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -105,7 +105,7 @@
entries.AddStrings("LOCAL_RUNTIME_LIBRARIES", c.Properties.AndroidMkRuntimeLibs...)
}
entries.SetString("LOCAL_SOONG_LINK_TYPE", c.makeLinkType)
- if c.UseVndk() {
+ if c.InVendorOrProduct() {
entries.SetBool("LOCAL_USE_VNDK", true)
if c.IsVndk() && !c.static() {
entries.SetString("LOCAL_SOONG_VNDK_VERSION", c.VndkVersion())
diff --git a/cc/cc.go b/cc/cc.go
index fd7a38a..c07e358 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3785,7 +3785,7 @@
}
func GetMakeLinkType(actx android.ModuleContext, c LinkableInterface) string {
- if c.UseVndk() {
+ if c.InVendorOrProduct() {
if c.IsLlndk() {
if !c.IsLlndkPublic() {
return "native:vndk_private"
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index 0964015..ac5f74c 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -29,6 +29,8 @@
// Equivalent to "-munaligned-access", but our clang doesn't have that yet.
"-Xclang -target-feature -Xclang +unaligned-scalar-mem",
"-Xclang -target-feature -Xclang +unaligned-vector-mem",
+ // Until https://gitlab.com/qemu-project/qemu/-/issues/1976 is fixed...
+ "-fno-vectorize",
}
riscv64ArchVariantCflags = map[string][]string{}
diff --git a/cc/library.go b/cc/library.go
index 28eb80b..ff30d40 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -17,6 +17,7 @@
import (
"fmt"
"io"
+ "log"
"path/filepath"
"regexp"
"strconv"
@@ -871,12 +872,18 @@
func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
name := library.getLibNameHelper(ctx.baseModuleName(), ctx.inVendor(), ctx.inProduct())
+ // Replace name with VNDK ext as original lib only when VNDK is enabled
if ctx.IsVndkExt() {
- // vndk-ext lib should have the same name with original lib
- ctx.VisitDirectDepsWithTag(vndkExtDepTag, func(module android.Module) {
- originalName := module.(*Module).outputFile.Path()
- name = strings.TrimSuffix(originalName.Base(), originalName.Ext())
- })
+ if ctx.DeviceConfig().VndkVersion() != "" {
+ // vndk-ext lib should have the same name with original lib
+ ctx.VisitDirectDepsWithTag(vndkExtDepTag, func(module android.Module) {
+ originalName := module.(*Module).outputFile.Path()
+ name = strings.TrimSuffix(originalName.Base(), originalName.Ext())
+ })
+ } else {
+ // TODO(b/320208784) : Suggest a solution for former VNDK-ext libraries before VNDK deprecation.
+ log.Printf("VNDK Extension on module %s will not be available once VNDK is deprecated", ctx.baseModuleName())
+ }
}
if ctx.Host() && Bool(library.Properties.Unique_host_soname) {
diff --git a/genrule/allowlists.go b/genrule/allowlists.go
index cbefa45..3383650 100644
--- a/genrule/allowlists.go
+++ b/genrule/allowlists.go
@@ -24,6 +24,7 @@
SandboxingDenyModuleList = []string{
// go/keep-sorted start
"aidl_camera_build_version",
+ "com.google.pixel.camera.hal.manifest",
// go/keep-sorted end
}
diff --git a/java/app_import.go b/java/app_import.go
index 997274c..5f20fdd 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -151,7 +151,9 @@
}
// Updates properties with variant-specific values.
-func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) {
+// This happens as a DefaultableHook instead of a LoadHook because we want to run it after
+// soong config variables are applied.
+func (a *AndroidAppImport) processVariants(ctx android.DefaultableHookContext) {
config := ctx.Config()
dpiProps := reflect.ValueOf(a.dpiVariants).Elem().FieldByName("Dpi_variants")
@@ -543,7 +545,7 @@
module.AddProperties(&module.dexpreoptProperties)
module.AddProperties(&module.usesLibrary.usesLibraryProperties)
module.populateAllVariantStructs()
- android.AddLoadHook(module, func(ctx android.LoadHookContext) {
+ module.SetDefaultableHook(func(ctx android.DefaultableHookContext) {
module.processVariants(ctx)
})
@@ -594,7 +596,7 @@
module.AddProperties(&module.dexpreoptProperties)
module.AddProperties(&module.testProperties)
module.populateAllVariantStructs()
- android.AddLoadHook(module, func(ctx android.LoadHookContext) {
+ module.SetDefaultableHook(func(ctx android.DefaultableHookContext) {
module.processVariants(ctx)
})
diff --git a/java/app_import_test.go b/java/app_import_test.go
index ef4626e..44f8f16 100644
--- a/java/app_import_test.go
+++ b/java/app_import_test.go
@@ -411,6 +411,27 @@
installPath: "/system/app/foo/foo.apk",
},
{
+ name: "matching arch without default",
+ bp: `
+ android_app_import {
+ name: "foo",
+ apk: "prebuilts/apk/app.apk",
+ arch: {
+ arm64: {
+ apk: "prebuilts/apk/app_arm64.apk",
+ },
+ },
+ presigned: true,
+ dex_preopt: {
+ enabled: true,
+ },
+ }
+ `,
+ expected: "verify_uses_libraries/apk/app_arm64.apk",
+ artifactPath: "prebuilts/apk/app_arm64.apk",
+ installPath: "/system/app/foo/foo.apk",
+ },
+ {
name: "no matching arch",
bp: `
android_app_import {
@@ -454,26 +475,105 @@
}
for _, test := range testCases {
- ctx, _ := testJava(t, test.bp)
+ t.Run(test.name, func(t *testing.T) {
+ ctx, _ := testJava(t, test.bp)
- variant := ctx.ModuleForTests("foo", "android_common")
- if test.expected == "" {
- if variant.Module().Enabled() {
- t.Error("module should have been disabled, but wasn't")
+ variant := ctx.ModuleForTests("foo", "android_common")
+ if test.expected == "" {
+ if variant.Module().Enabled() {
+ t.Error("module should have been disabled, but wasn't")
+ }
+ rule := variant.MaybeRule("genProvenanceMetaData")
+ android.AssertDeepEquals(t, "Provenance metadata is not empty", android.TestingBuildParams{}, rule)
+ return
}
- rule := variant.MaybeRule("genProvenanceMetaData")
- android.AssertDeepEquals(t, "Provenance metadata is not empty", android.TestingBuildParams{}, rule)
- continue
- }
- input := variant.Output("jnis-uncompressed/foo.apk").Input.String()
- if strings.HasSuffix(input, test.expected) {
- t.Errorf("wrong src apk, expected: %q got: %q", test.expected, input)
- }
- rule := variant.Rule("genProvenanceMetaData")
- android.AssertStringEquals(t, "Invalid input", test.artifactPath, rule.Inputs[0].String())
- android.AssertStringEquals(t, "Invalid output", "out/soong/.intermediates/provenance_metadata/foo/provenance_metadata.textproto", rule.Output.String())
- android.AssertStringEquals(t, "Invalid args", "foo", rule.Args["module_name"])
- android.AssertStringEquals(t, "Invalid args", test.installPath, rule.Args["install_path"])
+ input := variant.Output("jnis-uncompressed/foo.apk").Input.String()
+ if strings.HasSuffix(input, test.expected) {
+ t.Errorf("wrong src apk, expected: %q got: %q", test.expected, input)
+ }
+ rule := variant.Rule("genProvenanceMetaData")
+ android.AssertStringEquals(t, "Invalid input", test.artifactPath, rule.Inputs[0].String())
+ android.AssertStringEquals(t, "Invalid output", "out/soong/.intermediates/provenance_metadata/foo/provenance_metadata.textproto", rule.Output.String())
+ android.AssertStringEquals(t, "Invalid args", "foo", rule.Args["module_name"])
+ android.AssertStringEquals(t, "Invalid args", test.installPath, rule.Args["install_path"])
+ })
+ }
+}
+
+func TestAndroidAppImport_SoongConfigVariables(t *testing.T) {
+ testCases := []struct {
+ name string
+ bp string
+ expected string
+ artifactPath string
+ metaDataPath string
+ installPath string
+ }{
+ {
+ name: "matching arch",
+ bp: `
+ soong_config_module_type {
+ name: "my_android_app_import",
+ module_type: "android_app_import",
+ config_namespace: "my_namespace",
+ value_variables: ["my_apk_var"],
+ properties: ["apk"],
+ }
+ soong_config_value_variable {
+ name: "my_apk_var",
+ }
+ my_android_app_import {
+ name: "foo",
+ soong_config_variables: {
+ my_apk_var: {
+ apk: "prebuilts/apk/%s.apk",
+ },
+ },
+ presigned: true,
+ dex_preopt: {
+ enabled: true,
+ },
+ }
+ `,
+ expected: "verify_uses_libraries/apk/name_from_soong_config.apk",
+ artifactPath: "prebuilts/apk/name_from_soong_config.apk",
+ installPath: "/system/app/foo/foo.apk",
+ },
+ }
+
+ for _, test := range testCases {
+ t.Run(test.name, func(t *testing.T) {
+ ctx := android.GroupFixturePreparers(
+ prepareForJavaTest,
+ android.PrepareForTestWithSoongConfigModuleBuildComponents,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.VendorVars = map[string]map[string]string{
+ "my_namespace": {
+ "my_apk_var": "name_from_soong_config",
+ },
+ }
+ }),
+ ).RunTestWithBp(t, test.bp).TestContext
+
+ variant := ctx.ModuleForTests("foo", "android_common")
+ if test.expected == "" {
+ if variant.Module().Enabled() {
+ t.Error("module should have been disabled, but wasn't")
+ }
+ rule := variant.MaybeRule("genProvenanceMetaData")
+ android.AssertDeepEquals(t, "Provenance metadata is not empty", android.TestingBuildParams{}, rule)
+ return
+ }
+ input := variant.Output("jnis-uncompressed/foo.apk").Input.String()
+ if strings.HasSuffix(input, test.expected) {
+ t.Errorf("wrong src apk, expected: %q got: %q", test.expected, input)
+ }
+ rule := variant.Rule("genProvenanceMetaData")
+ android.AssertStringEquals(t, "Invalid input", test.artifactPath, rule.Inputs[0].String())
+ android.AssertStringEquals(t, "Invalid output", "out/soong/.intermediates/provenance_metadata/foo/provenance_metadata.textproto", rule.Output.String())
+ android.AssertStringEquals(t, "Invalid args", "foo", rule.Args["module_name"])
+ android.AssertStringEquals(t, "Invalid args", test.installPath, rule.Args["install_path"])
+ })
}
}
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index ae24404..c89c643 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -229,6 +229,7 @@
type BootclasspathFragmentModule struct {
android.ModuleBase
+ android.DefaultableModuleBase
android.ApexModuleBase
ClasspathFragmentBase
@@ -267,6 +268,7 @@
android.InitApexModule(m)
initClasspathFragment(m, BOOTCLASSPATH)
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
+ android.InitDefaultableModule(m)
android.AddLoadHook(m, func(ctx android.LoadHookContext) {
// If code coverage has been enabled for the framework then append the properties with
@@ -399,6 +401,11 @@
func (b *BootclasspathFragmentModule) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
tag := ctx.OtherModuleDependencyTag(dep)
+
+ // If the module is a default module, do not check the tag
+ if _, ok := dep.(*Defaults); ok {
+ return true
+ }
if IsBootclasspathFragmentContentDepTag(tag) {
// Boot image contents are automatically added to apex.
return true
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go
index 216c3b3..95cd4a9 100644
--- a/java/bootclasspath_fragment_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -222,6 +222,11 @@
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary", "mycoreplatform"),
FixtureConfigureApexBootJars("someapex:mysdklibrary"),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
bootclasspath_fragment {
name: "myfragment",
@@ -277,11 +282,11 @@
stubsJar := "out/soong/.intermediates/mystublib/android_common/dex/mystublib.jar"
// Stubs jars for mysdklibrary
- publicStubsJar := "out/soong/.intermediates/mysdklibrary.stubs/android_common/dex/mysdklibrary.stubs.jar"
- systemStubsJar := "out/soong/.intermediates/mysdklibrary.stubs.system/android_common/dex/mysdklibrary.stubs.system.jar"
+ publicStubsJar := "out/soong/.intermediates/mysdklibrary.stubs.exportable/android_common/dex/mysdklibrary.stubs.exportable.jar"
+ systemStubsJar := "out/soong/.intermediates/mysdklibrary.stubs.exportable.system/android_common/dex/mysdklibrary.stubs.exportable.system.jar"
// Stubs jars for myothersdklibrary
- otherPublicStubsJar := "out/soong/.intermediates/myothersdklibrary.stubs/android_common/dex/myothersdklibrary.stubs.jar"
+ otherPublicStubsJar := "out/soong/.intermediates/myothersdklibrary.stubs.exportable/android_common/dex/myothersdklibrary.stubs.exportable.jar"
// Check that SdkPublic uses public stubs for all sdk libraries.
android.AssertPathsRelativeToTopEquals(t, "public dex stubs jar", []string{otherPublicStubsJar, publicStubsJar, stubsJar}, info.TransitiveStubDexJarsByScope.StubDexJarsForScope(PublicHiddenAPIScope))
diff --git a/java/config/droidstubs.go b/java/config/droidstubs.go
index 7029fee..f46c893 100644
--- a/java/config/droidstubs.go
+++ b/java/config/droidstubs.go
@@ -55,13 +55,6 @@
}
MetalavaAnnotationsWarningsFlags = strings.Join(metalavaAnnotationsWarningsFlags, " ")
-
- metalavaHideFlaggedApis = []string{
- "--revert-annotation",
- "android.annotation.FlaggedApi",
- }
-
- MetalavaHideFlaggedApis = strings.Join(metalavaHideFlaggedApis, " ")
)
const (
@@ -73,8 +66,6 @@
exportedVars.ExportString("MetalavaAddOpens", MetalavaAddOpens)
- exportedVars.ExportStringList("MetalavaHideFlaggedApis", metalavaHideFlaggedApis)
-
exportedVars.ExportStringListStaticVariable("MetalavaAnnotationsFlags", metalavaAnnotationsFlags)
exportedVars.ExportStringListStaticVariable("MetalavaAnnotationWarningsFlags", metalavaAnnotationsWarningsFlags)
diff --git a/java/core-libraries/Android.bp b/java/core-libraries/Android.bp
index c6ab561..8ffe511 100644
--- a/java/core-libraries/Android.bp
+++ b/java/core-libraries/Android.bp
@@ -38,9 +38,6 @@
visibility: ["//visibility:public"],
sdk_version: "none",
system_modules: "none",
- dist: {
- targets: dist_targets,
- },
}
java_library {
@@ -89,6 +86,32 @@
},
}
+java_library {
+ name: "core.current.stubs.exportable.from-source",
+ defaults: [
+ "core.current.stubs.defaults",
+ ],
+ static_libs: [
+ "art.module.public.api.stubs.exportable",
+ "conscrypt.module.public.api.stubs.exportable",
+ "i18n.module.public.api.stubs.exportable",
+ ],
+ dist: {
+ targets: dist_targets,
+ dest: "core.current.stubs.jar",
+ },
+}
+
+java_library {
+ name: "core.current.stubs.exportable",
+ defaults: [
+ "core.current.stubs.defaults",
+ ],
+ static_libs: [
+ "core.current.stubs.exportable.from-source",
+ ],
+}
+
// Distributed with the SDK for turning into system modules to compile apps
// against.
//
@@ -298,6 +321,19 @@
],
}
+java_library {
+ name: "legacy.core.platform.api.stubs.exportable.from-source",
+ visibility: core_platform_visibility,
+ defaults: [
+ "core.platform.api.stubs.defaults",
+ ],
+ static_libs: [
+ "art.module.public.api.stubs.exportable.module_lib",
+ "conscrypt.module.platform.api.stubs.exportable",
+ "legacy.i18n.module.platform.api.stubs.exportable",
+ ],
+}
+
java_defaults {
name: "android_core_platform_stubs_current_contributions",
api_surface: "core_platform",
@@ -345,6 +381,17 @@
},
}
+java_library {
+ name: "legacy.core.platform.api.stubs.exportable",
+ visibility: core_platform_visibility,
+ defaults: [
+ "core.platform.api.stubs.defaults",
+ ],
+ static_libs: [
+ "legacy.core.platform.api.stubs.exportable.from-source",
+ ],
+}
+
java_defaults {
name: "core.platform.api.stubs.defaults",
hostdex: true,
diff --git a/java/dex.go b/java/dex.go
index fbb8418..cdae0a2 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -223,13 +223,6 @@
if err != nil {
ctx.PropertyErrorf("min_sdk_version", "%s", err)
}
- if effectiveVersion.FinalOrFutureInt() >= 35 {
- // V is 35, but we have not bumped the SDK version yet, so check for both.
- if ctx.Config().PlatformSdkVersion().FinalInt() >= 35 ||
- ctx.Config().PlatformSdkCodename() == "VanillaIceCream" {
- flags = append([]string{"-JDcom.android.tools.r8.dexContainerExperiment"}, flags...)
- }
- }
// If the specified SDK level is 10000, then configure the compiler to use the
// current platform SDK level and to compile the build as a platform build.
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 04e6be8..0626313 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -199,6 +199,10 @@
StubsSrcJar() android.Path
}
+type ExportableApiStubsSrcProvider interface {
+ ExportableStubsSrcJar() android.Path
+}
+
// Provider of information about API stubs, used by java_sdk_library.
type ApiStubsProvider interface {
AnnotationsZip() android.Path
@@ -208,6 +212,14 @@
ApiStubsSrcProvider
}
+type ExportableApiStubsProvider interface {
+ ExportableAnnotationsZip() android.Path
+ ExportableApiFilePath() android.Path
+ ExportableRemovedApiFilePath() android.Path
+
+ ExportableApiStubsSrcProvider
+}
+
type currentApiTimestampProvider interface {
CurrentApiTimestamp() android.Path
}
@@ -713,9 +725,6 @@
}
cmd.Flag(config.MetalavaFlags)
- if ctx.DeviceConfig().HideFlaggedApis() {
- cmd.Flag(config.MetalavaHideFlaggedApis)
- }
return cmd
}
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index 379e240..52cd1c5 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -22,8 +22,6 @@
"testing"
"android/soong/android"
-
- "github.com/google/blueprint/proptools"
)
func TestDroidstubs(t *testing.T) {
@@ -364,38 +362,6 @@
ctx.ModuleForTests("bar", "android_common")
}
-func TestDroidstubsHideFlaggedApi(t *testing.T) {
- result := android.GroupFixturePreparers(
- prepareForJavaTest,
- android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
- variables.NextReleaseHideFlaggedApi = proptools.BoolPtr(true)
- variables.Release_expose_flagged_api = proptools.BoolPtr(false)
- }),
- android.FixtureMergeMockFs(map[string][]byte{
- "a/A.java": nil,
- "a/current.txt": nil,
- "a/removed.txt": nil,
- }),
- ).RunTestWithBp(t, `
- droidstubs {
- name: "foo",
- srcs: ["a/A.java"],
- api_surface: "public",
- check_api: {
- current: {
- api_file: "a/current.txt",
- removed_api_file: "a/removed.txt",
- }
- },
- }
- `)
-
- m := result.ModuleForTests("foo", "android_common")
- manifest := m.Output("metalava.sbox.textproto")
- cmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest).Commands[0].Command)
- android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "--revert-annotation android.annotation.FlaggedApi")
-}
-
func TestAconfigDeclarations(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForJavaTest,
diff --git a/java/hiddenapi.go b/java/hiddenapi.go
index e9ee3a2..5441a3b 100644
--- a/java/hiddenapi.go
+++ b/java/hiddenapi.go
@@ -44,7 +44,8 @@
//
// This must be the path to the unencoded dex jar as the encoded dex jar indirectly depends on
// this file so using the encoded dex jar here would result in a cycle in the ninja rules.
- bootDexJarPath OptionalDexJarPath
+ bootDexJarPath OptionalDexJarPath
+ bootDexJarPathErr error
// The paths to the classes jars that contain classes and class members annotated with
// the UnsupportedAppUsage annotation that need to be extracted as part of the hidden API
@@ -56,7 +57,10 @@
uncompressDexState *bool
}
-func (h *hiddenAPI) bootDexJar() OptionalDexJarPath {
+func (h *hiddenAPI) bootDexJar(ctx android.ModuleErrorfContext) OptionalDexJarPath {
+ if h.bootDexJarPathErr != nil {
+ ctx.ModuleErrorf(h.bootDexJarPathErr.Error())
+ }
return h.bootDexJarPath
}
@@ -77,7 +81,7 @@
}
type hiddenAPIIntf interface {
- bootDexJar() OptionalDexJarPath
+ bootDexJar(ctx android.ModuleErrorfContext) OptionalDexJarPath
classesJars() android.Paths
uncompressDex() *bool
}
@@ -126,6 +130,11 @@
h.active = isModuleInBootClassPath(ctx, module)
}
+// Store any error encountered during the initialization of hiddenapi structure (e.g. unflagged co-existing prebuilt apexes)
+func (h *hiddenAPI) initHiddenAPIError(err error) {
+ h.bootDexJarPathErr = err
+}
+
func isModuleInBootClassPath(ctx android.BaseModuleContext, module android.Module) bool {
// Get the configured platform and apex boot jars.
nonApexBootJars := ctx.Config().NonApexBootJars()
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index a512860..3c7cf3a 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -245,12 +245,22 @@
testStubModules = append(testStubModules, "sdk_test_current_android")
} else {
// Use stub modules built from source
- publicStubModules = append(publicStubModules, android.SdkPublic.DefaultJavaLibraryName())
- systemStubModules = append(systemStubModules, android.SdkSystem.DefaultJavaLibraryName())
- testStubModules = append(testStubModules, android.SdkTest.DefaultJavaLibraryName())
+ if config.ReleaseHiddenApiExportableStubs() {
+ publicStubModules = append(publicStubModules, android.SdkPublic.DefaultExportableJavaLibraryName())
+ systemStubModules = append(systemStubModules, android.SdkSystem.DefaultExportableJavaLibraryName())
+ testStubModules = append(testStubModules, android.SdkTest.DefaultExportableJavaLibraryName())
+ } else {
+ publicStubModules = append(publicStubModules, android.SdkPublic.DefaultJavaLibraryName())
+ systemStubModules = append(systemStubModules, android.SdkSystem.DefaultJavaLibraryName())
+ testStubModules = append(testStubModules, android.SdkTest.DefaultJavaLibraryName())
+ }
}
// We do not have prebuilts of the core platform api yet
- corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
+ if config.ReleaseHiddenApiExportableStubs() {
+ corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs.exportable")
+ } else {
+ corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
+ }
// Allow products to define their own stubs for custom product jars that apps can use.
publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...)
@@ -289,7 +299,12 @@
func hiddenAPIRetrieveDexJarBuildPath(ctx android.ModuleContext, module android.Module, kind android.SdkKind) android.Path {
var dexJar OptionalDexJarPath
if sdkLibrary, ok := module.(SdkLibraryDependency); ok {
- dexJar = sdkLibrary.SdkApiStubDexJar(ctx, kind)
+ if ctx.Config().ReleaseHiddenApiExportableStubs() {
+ dexJar = sdkLibrary.SdkApiExportableStubDexJar(ctx, kind)
+ } else {
+ dexJar = sdkLibrary.SdkApiStubDexJar(ctx, kind)
+ }
+
} else if j, ok := module.(UsesLibraryDependency); ok {
dexJar = j.DexJarBuildPath(ctx)
} else {
@@ -1342,7 +1357,7 @@
// invalid, then create a fake path and either report an error immediately or defer reporting of the
// error until the path is actually used.
func retrieveBootDexJarFromHiddenAPIModule(ctx android.ModuleContext, module hiddenAPIModule) android.Path {
- bootDexJar := module.bootDexJar()
+ bootDexJar := module.bootDexJar(ctx)
if !bootDexJar.Valid() {
fake := android.PathForModuleOut(ctx, fmt.Sprintf("fake/boot-dex/%s.jar", module.Name()))
handleMissingDexBootFile(ctx, module, fake, bootDexJar.InvalidReason())
diff --git a/java/hiddenapi_singleton_test.go b/java/hiddenapi_singleton_test.go
index 37afe29..c1fee21 100644
--- a/java/hiddenapi_singleton_test.go
+++ b/java/hiddenapi_singleton_test.go
@@ -177,10 +177,10 @@
{
name: "testBundled",
unbundledBuild: false,
- publicStub: "android_stubs_current",
- systemStub: "android_system_stubs_current",
- testStub: "android_test_stubs_current",
- corePlatformStub: "legacy.core.platform.api.stubs",
+ publicStub: "android_stubs_current_exportable",
+ systemStub: "android_system_stubs_current_exportable",
+ testStub: "android_test_stubs_current_exportable",
+ corePlatformStub: "legacy.core.platform.api.stubs.exportable",
preparer: android.GroupFixturePreparers(),
}, {
name: "testUnbundled",
@@ -188,7 +188,7 @@
publicStub: "sdk_public_current_android",
systemStub: "sdk_system_current_android",
testStub: "sdk_test_current_android",
- corePlatformStub: "legacy.core.platform.api.stubs",
+ corePlatformStub: "legacy.core.platform.api.stubs.exportable",
preparer: PrepareForTestWithPrebuiltsOfCurrentApi,
},
}
@@ -200,6 +200,9 @@
prepareForTestWithDefaultPlatformBootclasspath,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Always_use_prebuilt_sdks = proptools.BoolPtr(tc.unbundledBuild)
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
}),
).RunTest(t)
diff --git a/java/java.go b/java/java.go
index 4eeded3..d18d915 100644
--- a/java/java.go
+++ b/java/java.go
@@ -564,9 +564,11 @@
func (v javaVersion) String() string {
switch v {
case JAVA_VERSION_6:
- return "1.6"
+ // Java version 1.6 no longer supported, bumping to 1.8
+ return "1.8"
case JAVA_VERSION_7:
- return "1.7"
+ // Java version 1.7 no longer supported, bumping to 1.8
+ return "1.8"
case JAVA_VERSION_8:
return "1.8"
case JAVA_VERSION_9:
@@ -583,10 +585,12 @@
func (v javaVersion) StringForKotlinc() string {
// $ ./external/kotlinc/bin/kotlinc -jvm-target foo
// error: unknown JVM target version: foo
- // Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17
+ // Supported versions: 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17
switch v {
+ case JAVA_VERSION_6:
+ return "1.8"
case JAVA_VERSION_7:
- return "1.6"
+ return "1.8"
case JAVA_VERSION_9:
return "9"
default:
@@ -602,9 +606,11 @@
func normalizeJavaVersion(ctx android.BaseModuleContext, javaVersion string) javaVersion {
switch javaVersion {
case "1.6", "6":
- return JAVA_VERSION_6
+ // Java version 1.6 no longer supported, bumping to 1.8
+ return JAVA_VERSION_8
case "1.7", "7":
- return JAVA_VERSION_7
+ // Java version 1.7 no longer supported, bumping to 1.8
+ return JAVA_VERSION_8
case "1.8", "8":
return JAVA_VERSION_8
case "1.9", "9":
@@ -2258,6 +2264,7 @@
// An error was found, possibly due to multiple apexes in the tree that export this library
// Defer the error till a client tries to call DexJarBuildPath
j.dexJarFileErr = err
+ j.initHiddenAPIError(err)
return
}
dexJarFileApexRootRelative := ApexRootRelativePathToJavaLib(j.BaseModuleName())
@@ -2726,6 +2733,8 @@
&LintProperties{},
&appTestHelperAppProperties{},
&JavaApiLibraryProperties{},
+ &bootclasspathFragmentProperties{},
+ &SourceOnlyBootclasspathProperties{},
)
android.InitDefaultsModule(module)
diff --git a/java/sdk.go b/java/sdk.go
index 352b243..81be991 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -47,9 +47,7 @@
if err != nil {
ctx.PropertyErrorf("sdk_version", "%s", err)
}
- if sdk.FinalOrFutureInt() <= 23 {
- return JAVA_VERSION_7
- } else if sdk.FinalOrFutureInt() <= 29 {
+ if sdk.FinalOrFutureInt() <= 29 {
return JAVA_VERSION_8
} else if sdk.FinalOrFutureInt() <= 31 {
return JAVA_VERSION_9
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 058862b..7373124 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -104,9 +104,16 @@
// The name of the property in the java_sdk_library_import
propertyName string
- // The tag to use to depend on the stubs library module.
+ // The tag to use to depend on the stubs library module if the parent module
+ // does not differentiate everything and exportable stubs (e.g. sdk_library_import).
stubsTag scopeDependencyTag
+ // The tag to use to depend on the everything stubs library module.
+ everythingStubsTag scopeDependencyTag
+
+ // The tag to use to depend on the exportable stubs library module.
+ exportableStubsTag scopeDependencyTag
+
// The tag to use to depend on the stubs source module (if separate from the API module).
stubsSourceTag scopeDependencyTag
@@ -172,6 +179,16 @@
apiScope: scope,
depInfoExtractor: (*scopePaths).extractStubsLibraryInfoFromDependency,
}
+ scope.everythingStubsTag = scopeDependencyTag{
+ name: name + "-stubs-everything",
+ apiScope: scope,
+ depInfoExtractor: (*scopePaths).extractEverythingStubsLibraryInfoFromDependency,
+ }
+ scope.exportableStubsTag = scopeDependencyTag{
+ name: name + "-stubs-exportable",
+ apiScope: scope,
+ depInfoExtractor: (*scopePaths).extractExportableStubsLibraryInfoFromDependency,
+ }
scope.stubsSourceTag = scopeDependencyTag{
name: name + "-stubs-source",
apiScope: scope,
@@ -669,6 +686,11 @@
// This is not the implementation jar, it still only contains stubs.
stubsDexJarPath OptionalDexJarPath
+ // The exportable dex jar for the stubs.
+ // This is not the implementation jar, it still only contains stubs.
+ // Includes unflagged apis and flagged apis enabled by release configurations.
+ exportableStubsDexJarPath OptionalDexJarPath
+
// The API specification file, e.g. system_current.txt.
currentApiFilePath android.OptionalPath
@@ -695,6 +717,36 @@
libDep := dep.(UsesLibraryDependency)
paths.stubsDexJarPath = libDep.DexJarBuildPath(ctx)
+ paths.exportableStubsDexJarPath = libDep.DexJarBuildPath(ctx)
+ return nil
+ } else {
+ return fmt.Errorf("expected module that has JavaInfoProvider, e.g. java_library")
+ }
+}
+
+func (paths *scopePaths) extractEverythingStubsLibraryInfoFromDependency(ctx android.ModuleContext, dep android.Module) error {
+ if lib, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
+ paths.stubsHeaderPath = lib.HeaderJars
+ if !ctx.Config().ReleaseHiddenApiExportableStubs() {
+ paths.stubsImplPath = lib.ImplementationJars
+ }
+
+ libDep := dep.(UsesLibraryDependency)
+ paths.stubsDexJarPath = libDep.DexJarBuildPath(ctx)
+ return nil
+ } else {
+ return fmt.Errorf("expected module that has JavaInfoProvider, e.g. java_library")
+ }
+}
+
+func (paths *scopePaths) extractExportableStubsLibraryInfoFromDependency(ctx android.ModuleContext, dep android.Module) error {
+ if lib, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
+ if ctx.Config().ReleaseHiddenApiExportableStubs() {
+ paths.stubsImplPath = lib.ImplementationJars
+ }
+
+ libDep := dep.(UsesLibraryDependency)
+ paths.exportableStubsDexJarPath = libDep.DexJarBuildPath(ctx)
return nil
} else {
return fmt.Errorf("expected module that has JavaInfoProvider, e.g. java_library")
@@ -710,6 +762,15 @@
}
}
+func (paths *scopePaths) treatDepAsExportableApiStubsProvider(dep android.Module, action func(provider ExportableApiStubsProvider)) error {
+ if exportableApiStubsProvider, ok := dep.(ExportableApiStubsProvider); ok {
+ action(exportableApiStubsProvider)
+ return nil
+ } else {
+ return fmt.Errorf("expected module that implements ExportableApiStubsSrcProvider, e.g. droidstubs")
+ }
+}
+
func (paths *scopePaths) treatDepAsApiStubsSrcProvider(dep android.Module, action func(provider ApiStubsSrcProvider)) error {
if apiStubsProvider, ok := dep.(ApiStubsSrcProvider); ok {
action(apiStubsProvider)
@@ -725,6 +786,12 @@
paths.removedApiFilePath = android.OptionalPathForPath(provider.RemovedApiFilePath())
}
+func (paths *scopePaths) extractApiInfoFromExportableApiStubsProvider(provider ExportableApiStubsProvider) {
+ paths.annotationsZip = android.OptionalPathForPath(provider.ExportableAnnotationsZip())
+ paths.currentApiFilePath = android.OptionalPathForPath(provider.ExportableApiFilePath())
+ paths.removedApiFilePath = android.OptionalPathForPath(provider.ExportableRemovedApiFilePath())
+}
+
func (paths *scopePaths) extractApiInfoFromDep(ctx android.ModuleContext, dep android.Module) error {
return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) {
paths.extractApiInfoFromApiStubsProvider(provider)
@@ -735,6 +802,10 @@
paths.stubsSrcJar = android.OptionalPathForPath(provider.StubsSrcJar())
}
+func (paths *scopePaths) extractStubsSourceInfoFromExportableApiStubsProviders(provider ExportableApiStubsSrcProvider) {
+ paths.stubsSrcJar = android.OptionalPathForPath(provider.ExportableStubsSrcJar())
+}
+
func (paths *scopePaths) extractStubsSourceInfoFromDep(ctx android.ModuleContext, dep android.Module) error {
return paths.treatDepAsApiStubsSrcProvider(dep, func(provider ApiStubsSrcProvider) {
paths.extractStubsSourceInfoFromApiStubsProviders(provider)
@@ -742,6 +813,12 @@
}
func (paths *scopePaths) extractStubsSourceAndApiInfoFromApiStubsProvider(ctx android.ModuleContext, dep android.Module) error {
+ if ctx.Config().ReleaseHiddenApiExportableStubs() {
+ return paths.treatDepAsExportableApiStubsProvider(dep, func(provider ExportableApiStubsProvider) {
+ paths.extractApiInfoFromExportableApiStubsProvider(provider)
+ paths.extractStubsSourceInfoFromExportableApiStubsProviders(provider)
+ })
+ }
return paths.treatDepAsApiStubsProvider(dep, func(provider ApiStubsProvider) {
paths.extractApiInfoFromApiStubsProvider(provider)
paths.extractStubsSourceInfoFromApiStubsProviders(provider)
@@ -1132,6 +1209,16 @@
}
// to satisfy SdkLibraryDependency interface
+func (c *commonToSdkLibraryAndImport) SdkApiExportableStubDexJar(ctx android.BaseModuleContext, kind android.SdkKind) OptionalDexJarPath {
+ paths := c.selectScopePaths(ctx, kind)
+ if paths == nil {
+ return makeUnsetDexJarPath()
+ }
+
+ return paths.exportableStubsDexJarPath
+}
+
+// to satisfy SdkLibraryDependency interface
func (c *commonToSdkLibraryAndImport) SdkRemovedTxtFile(ctx android.BaseModuleContext, kind android.SdkKind) android.OptionalPath {
apiScope := sdkKindToApiScope(kind)
paths := c.findScopePaths(apiScope)
@@ -1249,10 +1336,16 @@
// they are identical to the corresponding header jars.
SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion android.SdkSpec) android.Paths
- // SdkApiStubDexJar returns the dex jar for the stubs. It is needed by the hiddenapi processing
- // tool which processes dex files.
+ // SdkApiStubDexJar returns the dex jar for the stubs for the prebuilt
+ // java_sdk_library_import module. It is needed by the hiddenapi processing tool which
+ // processes dex files.
SdkApiStubDexJar(ctx android.BaseModuleContext, kind android.SdkKind) OptionalDexJarPath
+ // SdkApiExportableStubDexJar returns the exportable dex jar for the stubs for
+ // java_sdk_library module. It is needed by the hiddenapi processing tool which processes
+ // dex files.
+ SdkApiExportableStubDexJar(ctx android.BaseModuleContext, kind android.SdkKind) OptionalDexJarPath
+
// SdkRemovedTxtFile returns the optional path to the removed.txt file for the specified sdk kind.
SdkRemovedTxtFile(ctx android.BaseModuleContext, kind android.SdkKind) android.OptionalPath
@@ -1365,8 +1458,10 @@
for _, apiScope := range module.getGeneratedApiScopes(ctx) {
// Add dependencies to the stubs library
stubModuleName := module.stubsLibraryModuleName(apiScope)
+ ctx.AddVariationDependencies(nil, apiScope.everythingStubsTag, stubModuleName)
- ctx.AddVariationDependencies(nil, apiScope.stubsTag, stubModuleName)
+ exportableStubModuleName := module.exportableStubsLibraryModuleName(apiScope)
+ ctx.AddVariationDependencies(nil, apiScope.exportableStubsTag, exportableStubModuleName)
// Add a dependency on the stubs source in order to access both stubs source and api information.
ctx.AddVariationDependencies(nil, apiScope.stubsSourceAndApiTag, module.stubsSourceModuleName(apiScope))
@@ -2769,6 +2864,7 @@
// An error was found, possibly due to multiple apexes in the tree that export this library
// Defer the error till a client tries to call DexJarBuildPath
module.dexJarFileErr = err
+ module.initHiddenAPIError(err)
return
}
dexJarFileApexRootRelative := ApexRootRelativePathToJavaLib(module.BaseModuleName())
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index c14f3e6..3326ec5 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -38,6 +38,11 @@
android.FixtureModifyConfig(func(config android.Config) {
config.SetApiLibraries([]string{"foo"})
}),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
droiddoc_exported_dir {
name: "droiddoc-templates-sdk",
@@ -139,6 +144,9 @@
"foo.api.public.latest",
"foo.api.system.latest",
"foo.stubs",
+ "foo.stubs.exportable",
+ "foo.stubs.exportable.system",
+ "foo.stubs.exportable.test",
"foo.stubs.source",
"foo.stubs.source.system",
"foo.stubs.source.test",
@@ -529,6 +537,11 @@
prepareForJavaTest,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("sdklib"),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
java_sdk_library {
name: "sdklib",
@@ -547,6 +560,7 @@
`sdklib.api.public.latest`,
`sdklib.impl`,
`sdklib.stubs`,
+ `sdklib.stubs.exportable`,
`sdklib.stubs.source`,
`sdklib.xml`,
})
@@ -919,6 +933,11 @@
prepareForJavaTest,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("sdklib"),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
java_sdk_library {
name: "sdklib",
@@ -945,6 +964,7 @@
`sdklib.api.public.latest`,
`sdklib.impl`,
`sdklib.stubs`,
+ `sdklib.stubs.exportable`,
`sdklib.stubs.source`,
`sdklib.xml`,
})
@@ -966,6 +986,11 @@
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("sdklib"),
preparer,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
java_sdk_library {
name: "sdklib",
@@ -1018,6 +1043,7 @@
`sdklib.api.public.latest`,
`sdklib.impl`,
`sdklib.stubs`,
+ `sdklib.stubs.exportable`,
`sdklib.stubs.source`,
`sdklib.xml`,
})
diff --git a/java/testing.go b/java/testing.go
index 5959c49..04e8c73 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -407,6 +407,14 @@
"legacy.core.platform.api.stubs",
"stable.core.platform.api.stubs",
+ "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",
+ "core.current.stubs.exportable",
+ "legacy.core.platform.api.stubs.exportable",
+
"kotlin-stdlib",
"kotlin-stdlib-jdk7",
"kotlin-stdlib-jdk8",
diff --git a/scripts/lint_project_xml.py b/scripts/lint_project_xml.py
index 3b0158d..c40b07d 100755
--- a/scripts/lint_project_xml.py
+++ b/scripts/lint_project_xml.py
@@ -18,6 +18,7 @@
"""This file generates project.xml and lint.xml files used to drive the Android Lint CLI tool."""
import argparse
+import sys
from xml.dom import minidom
from ninja_rsp import NinjaRspFileReader
@@ -159,8 +160,8 @@
if args.baseline_path:
baseline = minidom.parse(args.baseline_path)
disallowed_issues = check_baseline_for_disallowed_issues(baseline, args.disallowed_issues)
- if bool(disallowed_issues):
- raise RuntimeError('disallowed issues %s found in lint baseline file %s for module %s'
+ if disallowed_issues:
+ sys.exit('disallowed issues %s found in lint baseline file %s for module %s'
% (disallowed_issues, args.baseline_path, args.name))
if args.project_out:
diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go
index 273a5cf..5d41958 100644
--- a/sdk/bootclasspath_fragment_sdk_test.go
+++ b/sdk/bootclasspath_fragment_sdk_test.go
@@ -270,6 +270,12 @@
// Add a platform_bootclasspath that depends on the fragment.
fixtureAddPlatformBootclasspathForBootclasspathFragment("myapex", "mybootclasspathfragment"),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
+
android.FixtureWithRootAndroidBp(sdk+`
apex {
name: "myapex",
@@ -489,15 +495,15 @@
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/filtered-stub-flags.csv -> hiddenapi/filtered-stub-flags.csv
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/filtered-flags.csv -> hiddenapi/filtered-flags.csv
.intermediates/mysdk/common_os/empty -> java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar
-.intermediates/myothersdklibrary.stubs/android_common/combined/myothersdklibrary.stubs.jar -> sdk_library/public/myothersdklibrary-stubs.jar
-.intermediates/myothersdklibrary.stubs.source/android_common/everything/myothersdklibrary.stubs.source_api.txt -> sdk_library/public/myothersdklibrary.txt
-.intermediates/myothersdklibrary.stubs.source/android_common/everything/myothersdklibrary.stubs.source_removed.txt -> sdk_library/public/myothersdklibrary-removed.txt
-.intermediates/mysdklibrary.stubs/android_common/combined/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
-.intermediates/mycoreplatform.stubs/android_common/combined/mycoreplatform.stubs.jar -> sdk_library/public/mycoreplatform-stubs.jar
-.intermediates/mycoreplatform.stubs.source/android_common/everything/mycoreplatform.stubs.source_api.txt -> sdk_library/public/mycoreplatform.txt
-.intermediates/mycoreplatform.stubs.source/android_common/everything/mycoreplatform.stubs.source_removed.txt -> sdk_library/public/mycoreplatform-removed.txt
+.intermediates/myothersdklibrary.stubs.exportable/android_common/combined/myothersdklibrary.stubs.exportable.jar -> sdk_library/public/myothersdklibrary-stubs.jar
+.intermediates/myothersdklibrary.stubs.source/android_common/exportable/myothersdklibrary.stubs.source_api.txt -> sdk_library/public/myothersdklibrary.txt
+.intermediates/myothersdklibrary.stubs.source/android_common/exportable/myothersdklibrary.stubs.source_removed.txt -> sdk_library/public/myothersdklibrary-removed.txt
+.intermediates/mysdklibrary.stubs.exportable/android_common/combined/mysdklibrary.stubs.exportable.jar -> sdk_library/public/mysdklibrary-stubs.jar
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
+.intermediates/mycoreplatform.stubs.exportable/android_common/combined/mycoreplatform.stubs.exportable.jar -> sdk_library/public/mycoreplatform-stubs.jar
+.intermediates/mycoreplatform.stubs.source/android_common/exportable/mycoreplatform.stubs.source_api.txt -> sdk_library/public/mycoreplatform.txt
+.intermediates/mycoreplatform.stubs.source/android_common/exportable/mycoreplatform.stubs.source_removed.txt -> sdk_library/public/mycoreplatform-removed.txt
`)
})
@@ -509,15 +515,15 @@
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi/filtered-stub-flags.csv -> hiddenapi/filtered-stub-flags.csv
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi/filtered-flags.csv -> hiddenapi/filtered-flags.csv
.intermediates/mysdk/common_os/empty -> java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar
-.intermediates/myothersdklibrary.stubs/android_common/combined/myothersdklibrary.stubs.jar -> sdk_library/public/myothersdklibrary-stubs.jar
-.intermediates/myothersdklibrary.stubs.source/android_common/everything/myothersdklibrary.stubs.source_api.txt -> sdk_library/public/myothersdklibrary.txt
-.intermediates/myothersdklibrary.stubs.source/android_common/everything/myothersdklibrary.stubs.source_removed.txt -> sdk_library/public/myothersdklibrary-removed.txt
-.intermediates/mysdklibrary.stubs/android_common/combined/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
-.intermediates/mycoreplatform.stubs/android_common/combined/mycoreplatform.stubs.jar -> sdk_library/public/mycoreplatform-stubs.jar
-.intermediates/mycoreplatform.stubs.source/android_common/everything/mycoreplatform.stubs.source_api.txt -> sdk_library/public/mycoreplatform.txt
-.intermediates/mycoreplatform.stubs.source/android_common/everything/mycoreplatform.stubs.source_removed.txt -> sdk_library/public/mycoreplatform-removed.txt
+.intermediates/myothersdklibrary.stubs.exportable/android_common/combined/myothersdklibrary.stubs.exportable.jar -> sdk_library/public/myothersdklibrary-stubs.jar
+.intermediates/myothersdklibrary.stubs.source/android_common/exportable/myothersdklibrary.stubs.source_api.txt -> sdk_library/public/myothersdklibrary.txt
+.intermediates/myothersdklibrary.stubs.source/android_common/exportable/myothersdklibrary.stubs.source_removed.txt -> sdk_library/public/myothersdklibrary-removed.txt
+.intermediates/mysdklibrary.stubs.exportable/android_common/combined/mysdklibrary.stubs.exportable.jar -> sdk_library/public/mysdklibrary-stubs.jar
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
+.intermediates/mycoreplatform.stubs.exportable/android_common/combined/mycoreplatform.stubs.exportable.jar -> sdk_library/public/mycoreplatform-stubs.jar
+.intermediates/mycoreplatform.stubs.source/android_common/exportable/mycoreplatform.stubs.source_api.txt -> sdk_library/public/mycoreplatform.txt
+.intermediates/mycoreplatform.stubs.source/android_common/exportable/mycoreplatform.stubs.source_removed.txt -> sdk_library/public/mycoreplatform-removed.txt
`
t.Run("added-via-apex", func(t *testing.T) {
testSnapshotWithBootClasspathFragment_Contents(t, `
@@ -760,6 +766,12 @@
// Add a platform_bootclasspath that depends on the fragment.
fixtureAddPlatformBootclasspathForBootclasspathFragment("myapex", "mybootclasspathfragment"),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
+
android.MockFS{
"my-blocked.txt": nil,
"my-max-target-o-low-priority.txt": nil,
@@ -963,12 +975,12 @@
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/filtered-stub-flags.csv -> hiddenapi/filtered-stub-flags.csv
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/filtered-flags.csv -> hiddenapi/filtered-flags.csv
.intermediates/mysdk/common_os/empty -> java_boot_libs/snapshot/jars/are/invalid/mybootlib.jar
-.intermediates/mynewlibrary.stubs/android_common/combined/mynewlibrary.stubs.jar -> sdk_library/public/mynewlibrary-stubs.jar
-.intermediates/mynewlibrary.stubs.source/android_common/everything/mynewlibrary.stubs.source_api.txt -> sdk_library/public/mynewlibrary.txt
-.intermediates/mynewlibrary.stubs.source/android_common/everything/mynewlibrary.stubs.source_removed.txt -> sdk_library/public/mynewlibrary-removed.txt
-.intermediates/mysdklibrary.stubs/android_common/combined/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
+.intermediates/mynewlibrary.stubs.exportable/android_common/combined/mynewlibrary.stubs.exportable.jar -> sdk_library/public/mynewlibrary-stubs.jar
+.intermediates/mynewlibrary.stubs.source/android_common/exportable/mynewlibrary.stubs.source_api.txt -> sdk_library/public/mynewlibrary.txt
+.intermediates/mynewlibrary.stubs.source/android_common/exportable/mynewlibrary.stubs.source_removed.txt -> sdk_library/public/mynewlibrary-removed.txt
+.intermediates/mysdklibrary.stubs.exportable/android_common/combined/mysdklibrary.stubs.exportable.jar -> sdk_library/public/mysdklibrary-stubs.jar
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
`),
snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
@@ -997,6 +1009,12 @@
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": targetBuildRelease,
}),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
+
android.FixtureWithRootAndroidBp(`
sdk {
name: "mysdk",
@@ -1095,15 +1113,15 @@
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi-for-sdk-snapshot/index.csv -> hiddenapi/index.csv
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi-for-sdk-snapshot/stub-flags.csv -> hiddenapi/stub-flags.csv
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi-for-sdk-snapshot/all-flags.csv -> hiddenapi/all-flags.csv
-.intermediates/mysdklibrary.stubs/android_common/combined/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
+.intermediates/mysdklibrary.stubs.exportable/android_common/combined/mysdklibrary.stubs.exportable.jar -> sdk_library/public/mysdklibrary-stubs.jar
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
`
// On S the stub flags should only be generated from mysdklibrary as mynewsdklibrary is not part
// of the snapshot.
expectedStubFlagsInputs := []string{
- "out/soong/.intermediates/mysdklibrary.stubs/android_common/dex/mysdklibrary.stubs.jar",
+ "out/soong/.intermediates/mysdklibrary.stubs.exportable/android_common/dex/mysdklibrary.stubs.exportable.jar",
"out/soong/.intermediates/mysdklibrary/android_common/aligned/mysdklibrary.jar",
}
@@ -1173,20 +1191,20 @@
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv -> hiddenapi/signature-patterns.csv
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi/filtered-stub-flags.csv -> hiddenapi/filtered-stub-flags.csv
.intermediates/mybootclasspathfragment/android_common_myapex/modular-hiddenapi/filtered-flags.csv -> hiddenapi/filtered-flags.csv
-.intermediates/mysdklibrary.stubs/android_common/combined/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
-.intermediates/mynewsdklibrary.stubs/android_common/combined/mynewsdklibrary.stubs.jar -> sdk_library/public/mynewsdklibrary-stubs.jar
-.intermediates/mynewsdklibrary.stubs.source/android_common/everything/mynewsdklibrary.stubs.source_api.txt -> sdk_library/public/mynewsdklibrary.txt
-.intermediates/mynewsdklibrary.stubs.source/android_common/everything/mynewsdklibrary.stubs.source_removed.txt -> sdk_library/public/mynewsdklibrary-removed.txt
+.intermediates/mysdklibrary.stubs.exportable/android_common/combined/mysdklibrary.stubs.exportable.jar -> sdk_library/public/mysdklibrary-stubs.jar
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
+.intermediates/mynewsdklibrary.stubs.exportable/android_common/combined/mynewsdklibrary.stubs.exportable.jar -> sdk_library/public/mynewsdklibrary-stubs.jar
+.intermediates/mynewsdklibrary.stubs.source/android_common/exportable/mynewsdklibrary.stubs.source_api.txt -> sdk_library/public/mynewsdklibrary.txt
+.intermediates/mynewsdklibrary.stubs.source/android_common/exportable/mynewsdklibrary.stubs.source_removed.txt -> sdk_library/public/mynewsdklibrary-removed.txt
`
// On tiramisu the stub flags should be generated from both mynewsdklibrary and mysdklibrary as
// they are both part of the snapshot.
expectedStubFlagsInputs := []string{
- "out/soong/.intermediates/mynewsdklibrary.stubs/android_common/dex/mynewsdklibrary.stubs.jar",
+ "out/soong/.intermediates/mynewsdklibrary.stubs.exportable/android_common/dex/mynewsdklibrary.stubs.exportable.jar",
"out/soong/.intermediates/mynewsdklibrary/android_common/aligned/mynewsdklibrary.jar",
- "out/soong/.intermediates/mysdklibrary.stubs/android_common/dex/mysdklibrary.stubs.jar",
+ "out/soong/.intermediates/mysdklibrary.stubs.exportable/android_common/dex/mysdklibrary.stubs.exportable.jar",
"out/soong/.intermediates/mysdklibrary/android_common/aligned/mysdklibrary.jar",
}
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 592c005..1b2b0f1 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -45,6 +45,11 @@
java.PrepareForTestWithJavaDefaultModules,
java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("myjavalib"),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
)
// Contains tests for SDK members provided by the java package.
@@ -608,6 +613,11 @@
"1": {"myjavalib"},
"2": {"myjavalib"},
}),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTestWithBp(t, `
sdk {
name: "mysdk",
@@ -696,9 +706,9 @@
checkAllCopyRules(`
.intermediates/exported-system-module/android_common/turbine-combined/exported-system-module.jar -> java/exported-system-module.jar
.intermediates/system-module/android_common/turbine-combined/system-module.jar -> java/system-module.jar
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
checkInfoContents(result.Config, `
[
@@ -941,15 +951,15 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.system/android_common/combined/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source.system/android_common/everything/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
-.intermediates/myjavalib.stubs.source.system/android_common/everything/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.test/android_common/combined/myjavalib.stubs.test.jar -> sdk_library/test/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source.test/android_common/everything/myjavalib.stubs.source.test_api.txt -> sdk_library/test/myjavalib.txt
-.intermediates/myjavalib.stubs.source.test/android_common/everything/myjavalib.stubs.source.test_removed.txt -> sdk_library/test/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable.system/android_common/combined/myjavalib.stubs.exportable.system.jar -> sdk_library/system/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source.system/android_common/exportable/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
+.intermediates/myjavalib.stubs.source.system/android_common/exportable/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable.test/android_common/combined/myjavalib.stubs.exportable.test.jar -> sdk_library/test/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source.test/android_common/exportable/myjavalib.stubs.source.test_api.txt -> sdk_library/test/myjavalib.txt
+.intermediates/myjavalib.stubs.source.test/android_common/exportable/myjavalib.stubs.source.test_removed.txt -> sdk_library/test/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
@@ -999,9 +1009,9 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib-foo.stubs/android_common/combined/myjavalib-foo.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib-foo.stubs.source/android_common/everything/myjavalib-foo.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib-foo.stubs.source/android_common/everything/myjavalib-foo.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib-foo.stubs.exportable/android_common/combined/myjavalib-foo.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib-foo.stubs.source/android_common/exportable/myjavalib-foo.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib-foo.stubs.source/android_common/exportable/myjavalib-foo.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
@@ -1052,10 +1062,10 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source-stubs.srcjar -> sdk_library/public/myjavalib.srcjar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source-stubs.srcjar -> sdk_library/public/myjavalib.srcjar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
)
}
@@ -1100,10 +1110,10 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_annotations.zip -> sdk_library/public/myjavalib_annotations.zip
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_annotations.zip -> sdk_library/public/myjavalib_annotations.zip
`),
checkMergeZips(".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip"),
)
@@ -1153,16 +1163,23 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
checkMergeZips(".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip"),
)
}
func TestSnapshotWithJavaSdkLibrary_CompileDex(t *testing.T) {
- result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
+ result := android.GroupFixturePreparers(
+ prepareForSdkTestWithJavaSdkLibrary,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
+ ).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@@ -1214,21 +1231,22 @@
ctx := android.ModuleInstallPathContextForTesting(result.Config)
dexJarBuildPath := func(name string, kind android.SdkKind) string {
dep := result.Module(name, "android_common").(java.SdkLibraryDependency)
- path := dep.SdkApiStubDexJar(ctx, kind).Path()
+ path := dep.SdkApiExportableStubDexJar(ctx, kind).Path()
return path.RelativeToTop().String()
}
dexJarPath := dexJarBuildPath("myjavalib", android.SdkPublic)
- android.AssertStringEquals(t, "source dex public stubs jar build path", "out/soong/.intermediates/myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath)
+ android.AssertStringEquals(t, "source dex public stubs jar build path", "out/soong/.intermediates/myjavalib.stubs.exportable/android_common/dex/myjavalib.stubs.exportable.jar", dexJarPath)
dexJarPath = dexJarBuildPath("myjavalib", android.SdkSystem)
- systemDexJar := "out/soong/.intermediates/myjavalib.stubs.system/android_common/dex/myjavalib.stubs.system.jar"
+ systemDexJar := "out/soong/.intermediates/myjavalib.stubs.exportable.system/android_common/dex/myjavalib.stubs.exportable.system.jar"
android.AssertStringEquals(t, "source dex system stubs jar build path", systemDexJar, dexJarPath)
// This should fall back to system as module is not available.
dexJarPath = dexJarBuildPath("myjavalib", android.SdkModule)
android.AssertStringEquals(t, "source dex module stubs jar build path", systemDexJar, dexJarPath)
+ // Prebuilt dex jar does not come from the exportable stubs.
dexJarPath = dexJarBuildPath(android.PrebuiltNameFromSource("myjavalib"), android.SdkPublic)
android.AssertStringEquals(t, "prebuilt dex public stubs jar build path", "out/soong/.intermediates/snapshot/prebuilt_myjavalib.stubs/android_common/dex/myjavalib.stubs.jar", dexJarPath)
}),
@@ -1270,9 +1288,9 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
@@ -1318,9 +1336,9 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
@@ -1376,12 +1394,12 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.system/android_common/combined/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source.system/android_common/everything/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
-.intermediates/myjavalib.stubs.source.system/android_common/everything/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable.system/android_common/combined/myjavalib.stubs.exportable.system.jar -> sdk_library/system/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source.system/android_common/exportable/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
+.intermediates/myjavalib.stubs.source.system/android_common/exportable/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
@@ -1448,15 +1466,15 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.system/android_common/combined/myjavalib.stubs.system.jar -> sdk_library/system/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source.system/android_common/everything/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
-.intermediates/myjavalib.stubs.source.system/android_common/everything/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.module_lib/android_common/combined/myjavalib.stubs.module_lib.jar -> sdk_library/module-lib/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source.module_lib/android_common/everything/myjavalib.stubs.source.module_lib_api.txt -> sdk_library/module-lib/myjavalib.txt
-.intermediates/myjavalib.stubs.source.module_lib/android_common/everything/myjavalib.stubs.source.module_lib_removed.txt -> sdk_library/module-lib/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable.system/android_common/combined/myjavalib.stubs.exportable.system.jar -> sdk_library/system/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source.system/android_common/exportable/myjavalib.stubs.source.system_api.txt -> sdk_library/system/myjavalib.txt
+.intermediates/myjavalib.stubs.source.system/android_common/exportable/myjavalib.stubs.source.system_removed.txt -> sdk_library/system/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable.module_lib/android_common/combined/myjavalib.stubs.exportable.module_lib.jar -> sdk_library/module-lib/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source.module_lib/android_common/exportable/myjavalib.stubs.source.module_lib_api.txt -> sdk_library/module-lib/myjavalib.txt
+.intermediates/myjavalib.stubs.source.module_lib/android_common/exportable/myjavalib.stubs.source.module_lib_removed.txt -> sdk_library/module-lib/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/module-lib/myjavalib_stub_sources.zip",
@@ -1514,12 +1532,12 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
-.intermediates/myjavalib.stubs.system_server/android_common/combined/myjavalib.stubs.system_server.jar -> sdk_library/system-server/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source.system_server/android_common/everything/myjavalib.stubs.source.system_server_api.txt -> sdk_library/system-server/myjavalib.txt
-.intermediates/myjavalib.stubs.source.system_server/android_common/everything/myjavalib.stubs.source.system_server_removed.txt -> sdk_library/system-server/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable.system_server/android_common/combined/myjavalib.stubs.exportable.system_server.jar -> sdk_library/system-server/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source.system_server/android_common/exportable/myjavalib.stubs.source.system_server_api.txt -> sdk_library/system-server/myjavalib.txt
+.intermediates/myjavalib.stubs.source.system_server/android_common/exportable/myjavalib.stubs.source.system_server_removed.txt -> sdk_library/system-server/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
@@ -1568,9 +1586,9 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
`),
checkMergeZips(
".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
@@ -1625,9 +1643,9 @@
}
`),
checkAllCopyRules(`
-.intermediates/myjavalib.stubs/android_common/combined/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
-.intermediates/myjavalib.stubs.source/android_common/everything/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.exportable/android_common/combined/myjavalib.stubs.exportable.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/exportable/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
docs/known_doctags -> doctags/docs/known_doctags
`),
)
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index d14c2ba..c4df146 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -442,6 +442,11 @@
android.FixtureMergeEnv(map[string]string{
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S",
}),
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildFlags = map[string]string{
+ "RELEASE_HIDDEN_API_EXPORTABLE_STUBS": "true",
+ }
+ }),
).RunTest(t)
CheckSnapshot(t, result, "mysdk", "",
@@ -487,9 +492,9 @@
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv
-.intermediates/mysdklibrary.stubs/android_common/combined/mysdklibrary.stubs.jar -> sdk_library/public/mysdklibrary-stubs.jar
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
-.intermediates/mysdklibrary.stubs.source/android_common/everything/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
+.intermediates/mysdklibrary.stubs.exportable/android_common/combined/mysdklibrary.stubs.exportable.jar -> sdk_library/public/mysdklibrary-stubs.jar
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_api.txt -> sdk_library/public/mysdklibrary.txt
+.intermediates/mysdklibrary.stubs.source/android_common/exportable/mysdklibrary.stubs.source_removed.txt -> sdk_library/public/mysdklibrary-removed.txt
`),
)
})
diff --git a/ui/build/androidmk_denylist.go b/ui/build/androidmk_denylist.go
index b2266b2..e004cdc 100644
--- a/ui/build/androidmk_denylist.go
+++ b/ui/build/androidmk_denylist.go
@@ -25,7 +25,10 @@
"cts/",
"dalvik/",
"developers/",
- "kernel/",
+ // Do not block other directories in kernel/, see b/319658303.
+ "kernel/configs/",
+ "kernel/prebuilts/",
+ "kernel/tests/",
"libcore/",
"libnativehelper/",
"pdk/",