Merge "Implement detecting container violations." into main
This commit is contained in:
@@ -16,6 +16,7 @@ package android
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"reflect"
|
||||||
"slices"
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -145,6 +146,17 @@ func (i ApexInfo) InApexModule(apexModuleName string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To satisfy the comparable interface
|
||||||
|
func (i ApexInfo) Equal(other any) bool {
|
||||||
|
otherApexInfo, ok := other.(ApexInfo)
|
||||||
|
return ok && i.ApexVariationName == otherApexInfo.ApexVariationName &&
|
||||||
|
i.MinSdkVersion == otherApexInfo.MinSdkVersion &&
|
||||||
|
i.Updatable == otherApexInfo.Updatable &&
|
||||||
|
i.UsePlatformApis == otherApexInfo.UsePlatformApis &&
|
||||||
|
reflect.DeepEqual(i.InApexVariants, otherApexInfo.InApexVariants) &&
|
||||||
|
reflect.DeepEqual(i.InApexModules, otherApexInfo.InApexModules)
|
||||||
|
}
|
||||||
|
|
||||||
// ApexTestForInfo stores the contents of APEXes for which this module is a test - although this
|
// ApexTestForInfo stores the contents of APEXes for which this module is a test - although this
|
||||||
// module is not part of the APEX - and thus has access to APEX internals.
|
// module is not part of the APEX - and thus has access to APEX internals.
|
||||||
type ApexTestForInfo struct {
|
type ApexTestForInfo struct {
|
||||||
|
@@ -15,8 +15,10 @@
|
|||||||
package android
|
package android
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"slices"
|
"slices"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
)
|
)
|
||||||
@@ -395,6 +397,40 @@ func (c *ContainersInfo) UpdatableApex() bool {
|
|||||||
|
|
||||||
var ContainersInfoProvider = blueprint.NewProvider[ContainersInfo]()
|
var ContainersInfoProvider = blueprint.NewProvider[ContainersInfo]()
|
||||||
|
|
||||||
|
func satisfyAllowedExceptions(ctx ModuleContext, allowedExceptionLabels []exceptionHandleFuncLabel, m, dep Module) bool {
|
||||||
|
for _, label := range allowedExceptionLabels {
|
||||||
|
if exceptionHandleFunctionsTable[label](ctx, m, dep) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ContainersInfo) GetViolations(mctx ModuleContext, m, dep Module, depInfo ContainersInfo) []string {
|
||||||
|
var violations []string
|
||||||
|
|
||||||
|
// Any containers that the module belongs to but the dependency does not belong to must be examined.
|
||||||
|
_, containersUniqueToModule, _ := ListSetDifference(c.belongingContainers, depInfo.belongingContainers)
|
||||||
|
|
||||||
|
// Apex container should be examined even if both the module and the dependency belong to
|
||||||
|
// the apex container to check that the two modules belong to the same apex.
|
||||||
|
if InList(ApexContainer, c.belongingContainers) && !InList(ApexContainer, containersUniqueToModule) {
|
||||||
|
containersUniqueToModule = append(containersUniqueToModule, ApexContainer)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, containerUniqueToModule := range containersUniqueToModule {
|
||||||
|
for _, restriction := range containerUniqueToModule.restricted {
|
||||||
|
if InList(restriction.dependency, depInfo.belongingContainers) {
|
||||||
|
if !satisfyAllowedExceptions(mctx, restriction.allowedExceptions, m, dep) {
|
||||||
|
violations = append(violations, restriction.errorMessage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return violations
|
||||||
|
}
|
||||||
|
|
||||||
func generateContainerInfo(ctx ModuleContext) ContainersInfo {
|
func generateContainerInfo(ctx ModuleContext) ContainersInfo {
|
||||||
var containers []*container
|
var containers []*container
|
||||||
|
|
||||||
@@ -436,3 +472,32 @@ func setContainerInfo(ctx ModuleContext) {
|
|||||||
SetProvider(ctx, ContainersInfoProvider, containersInfo)
|
SetProvider(ctx, ContainersInfoProvider, containersInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkContainerViolations(ctx ModuleContext) {
|
||||||
|
if _, ok := ctx.Module().(InstallableModule); ok {
|
||||||
|
containersInfo, _ := getContainerModuleInfo(ctx, ctx.Module())
|
||||||
|
ctx.VisitDirectDepsIgnoreBlueprint(func(dep Module) {
|
||||||
|
if !dep.Enabled(ctx) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pre-existing violating dependencies are tracked in containerDependencyViolationAllowlist.
|
||||||
|
// If this dependency is allowlisted, do not check for violation.
|
||||||
|
// If not, check if this dependency matches any restricted dependency and
|
||||||
|
// satisfies any exception functions, which allows bypassing the
|
||||||
|
// restriction. If all of the exceptions are not satisfied, throw an error.
|
||||||
|
if depContainersInfo, ok := getContainerModuleInfo(ctx, dep); ok {
|
||||||
|
if allowedViolations, ok := ContainerDependencyViolationAllowlist[ctx.ModuleName()]; ok && InList(dep.Name(), allowedViolations) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
violations := containersInfo.GetViolations(ctx, ctx.Module(), dep, depContainersInfo)
|
||||||
|
if len(violations) > 0 {
|
||||||
|
errorMessage := fmt.Sprintf("%s cannot depend on %s. ", ctx.ModuleName(), dep.Name())
|
||||||
|
errorMessage += strings.Join(violations, " ")
|
||||||
|
ctx.ModuleErrorf(errorMessage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1778,6 +1778,9 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
setContainerInfo(ctx)
|
setContainerInfo(ctx)
|
||||||
|
if ctx.Config().Getenv("DISABLE_CONTAINER_CHECK") != "true" {
|
||||||
|
checkContainerViolations(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
ctx.licenseMetadataFile = PathForModuleOut(ctx, "meta_lic")
|
ctx.licenseMetadataFile = PathForModuleOut(ctx, "meta_lic")
|
||||||
|
|
||||||
|
@@ -74,6 +74,8 @@ func TestValidationAcrossContainersExportedPass(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "none",
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -122,6 +124,8 @@ func TestValidationAcrossContainersExportedPass(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "none",
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -345,6 +349,8 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "none",
|
||||||
}`,
|
}`,
|
||||||
expectedError: `.*my_java_library_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
|
expectedError: `.*my_java_library_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
|
||||||
},
|
},
|
||||||
@@ -392,6 +398,8 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "none",
|
||||||
}`,
|
}`,
|
||||||
expectedError: `.*my_android_app_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
|
expectedError: `.*my_android_app_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
|
||||||
},
|
},
|
||||||
@@ -693,6 +701,8 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "none",
|
||||||
}`,
|
}`,
|
||||||
expectedError: `.*my_android_app_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
|
expectedError: `.*my_android_app_foo/myapex depends on my_java_aconfig_library_foo/otherapex/production across containers`,
|
||||||
},
|
},
|
||||||
@@ -769,6 +779,8 @@ func TestValidationNotPropagateAcrossShared(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "none",
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -4929,6 +4929,7 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
|||||||
java_import {
|
java_import {
|
||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
jars: ["libfoo.jar"],
|
jars: ["libfoo.jar"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -4969,6 +4970,22 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
|||||||
t.Run("prebuilt with source preferred", func(t *testing.T) {
|
t.Run("prebuilt with source preferred", func(t *testing.T) {
|
||||||
|
|
||||||
bp := `
|
bp := `
|
||||||
|
apex {
|
||||||
|
name: "myapex",
|
||||||
|
key: "myapex.key",
|
||||||
|
updatable: false,
|
||||||
|
java_libs: [
|
||||||
|
"libfoo",
|
||||||
|
"libbar",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}
|
||||||
|
|
||||||
prebuilt_apex {
|
prebuilt_apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
arch: {
|
arch: {
|
||||||
@@ -4985,10 +5002,21 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
|||||||
java_import {
|
java_import {
|
||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
jars: ["libfoo.jar"],
|
jars: ["libfoo.jar"],
|
||||||
|
apex_available: [
|
||||||
|
"myapex",
|
||||||
|
],
|
||||||
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
|
apex_available: [
|
||||||
|
"myapex",
|
||||||
|
],
|
||||||
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -4996,12 +5024,21 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
|||||||
public: {
|
public: {
|
||||||
jars: ["libbar.jar"],
|
jars: ["libbar.jar"],
|
||||||
},
|
},
|
||||||
|
apex_available: [
|
||||||
|
"myapex",
|
||||||
|
],
|
||||||
|
compile_dex: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
name: "libbar",
|
name: "libbar",
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
unsafe_ignore_missing_latest_api: true,
|
unsafe_ignore_missing_latest_api: true,
|
||||||
|
apex_available: [
|
||||||
|
"myapex",
|
||||||
|
],
|
||||||
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -5010,11 +5047,9 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
|||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "prebuilt_libfoo")
|
checkDexJarBuildPath(t, ctx, "prebuilt_libfoo")
|
||||||
checkDexJarInstallPath(t, ctx, "prebuilt_libfoo")
|
checkDexJarInstallPath(t, ctx, "prebuilt_libfoo")
|
||||||
ensureNoSourceVariant(t, ctx, "libfoo")
|
|
||||||
|
|
||||||
checkDexJarBuildPath(t, ctx, "prebuilt_libbar")
|
checkDexJarBuildPath(t, ctx, "prebuilt_libbar")
|
||||||
checkDexJarInstallPath(t, ctx, "prebuilt_libbar")
|
checkDexJarInstallPath(t, ctx, "prebuilt_libbar")
|
||||||
ensureNoSourceVariant(t, ctx, "libbar")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("prebuilt preferred with source", func(t *testing.T) {
|
t.Run("prebuilt preferred with source", func(t *testing.T) {
|
||||||
@@ -5040,6 +5075,7 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
|
|||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -5166,6 +5202,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
jars: ["libfoo.jar"],
|
jars: ["libfoo.jar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
permitted_packages: ["foo"],
|
permitted_packages: ["foo"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -5320,12 +5357,14 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
jars: ["libfoo.jar"],
|
jars: ["libfoo.jar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -5417,6 +5456,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
jars: ["libfoo.jar"],
|
jars: ["libfoo.jar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
permitted_packages: ["foo"],
|
permitted_packages: ["foo"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -5424,6 +5464,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
installable: true,
|
installable: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -5514,6 +5555,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "libfoo",
|
name: "libfoo",
|
||||||
jars: ["libfoo.jar"],
|
jars: ["libfoo.jar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -5522,6 +5564,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
permitted_packages: ["foo"],
|
permitted_packages: ["foo"],
|
||||||
installable: true,
|
installable: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
@@ -5540,6 +5583,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
permitted_packages: ["bar"],
|
permitted_packages: ["bar"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -6134,6 +6178,7 @@ func TestApexWithTestHelperApp(t *testing.T) {
|
|||||||
name: "TesterHelpAppFoo",
|
name: "TesterHelpAppFoo",
|
||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
apex_available: [ "myapex" ],
|
apex_available: [ "myapex" ],
|
||||||
|
sdk_version: "test_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
`)
|
`)
|
||||||
@@ -7736,7 +7781,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
|||||||
srcs: ["foo/bar/MyClass.java"],
|
srcs: ["foo/bar/MyClass.java"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
libs: ["myotherjar"],
|
static_libs: ["myotherjar"],
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
"myapex.updatable",
|
"myapex.updatable",
|
||||||
@@ -8397,6 +8442,7 @@ func TestUpdatable_should_not_set_generate_classpaths_proto(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
|
||||||
systemserverclasspath_fragment {
|
systemserverclasspath_fragment {
|
||||||
@@ -9439,6 +9485,7 @@ func TestApexJavaCoverage(t *testing.T) {
|
|||||||
srcs: ["mybootclasspathlib.java"],
|
srcs: ["mybootclasspathlib.java"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
|
||||||
systemserverclasspath_fragment {
|
systemserverclasspath_fragment {
|
||||||
@@ -9754,6 +9801,7 @@ func TestSdkLibraryCanHaveHigherMinSdkVersion(t *testing.T) {
|
|||||||
unsafe_ignore_missing_latest_api: true,
|
unsafe_ignore_missing_latest_api: true,
|
||||||
min_sdk_version: "31",
|
min_sdk_version: "31",
|
||||||
static_libs: ["util"],
|
static_libs: ["util"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -9762,6 +9810,7 @@ func TestSdkLibraryCanHaveHigherMinSdkVersion(t *testing.T) {
|
|||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
min_sdk_version: "31",
|
min_sdk_version: "31",
|
||||||
static_libs: ["another_util"],
|
static_libs: ["another_util"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -9769,6 +9818,7 @@ func TestSdkLibraryCanHaveHigherMinSdkVersion(t *testing.T) {
|
|||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
min_sdk_version: "31",
|
min_sdk_version: "31",
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
@@ -9824,7 +9874,7 @@ func TestSdkLibraryCanHaveHigherMinSdkVersion(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("bootclasspath_fragment jar must set min_sdk_version", func(t *testing.T) {
|
t.Run("bootclasspath_fragment jar must set min_sdk_version", func(t *testing.T) {
|
||||||
preparer.ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "mybootclasspathlib".*must set min_sdk_version`)).
|
preparer.
|
||||||
RunTestWithBp(t, `
|
RunTestWithBp(t, `
|
||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
@@ -9855,6 +9905,8 @@ func TestSdkLibraryCanHaveHigherMinSdkVersion(t *testing.T) {
|
|||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
unsafe_ignore_missing_latest_api: true,
|
unsafe_ignore_missing_latest_api: true,
|
||||||
|
sdk_version: "current",
|
||||||
|
min_sdk_version: "30",
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
@@ -10107,6 +10159,9 @@ func TestApexLintBcpFragmentSdkLibDeps(t *testing.T) {
|
|||||||
key: "myapex.key",
|
key: "myapex.key",
|
||||||
bootclasspath_fragments: ["mybootclasspathfragment"],
|
bootclasspath_fragments: ["mybootclasspathfragment"],
|
||||||
min_sdk_version: "29",
|
min_sdk_version: "29",
|
||||||
|
java_libs: [
|
||||||
|
"jacocoagent",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
apex_key {
|
apex_key {
|
||||||
name: "myapex.key",
|
name: "myapex.key",
|
||||||
|
@@ -104,6 +104,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) {
|
|||||||
test: {
|
test: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -749,6 +750,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) {
|
|||||||
],
|
],
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -922,6 +924,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) {
|
|||||||
],
|
],
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -1093,6 +1096,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) {
|
|||||||
],
|
],
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -1245,6 +1249,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *test
|
|||||||
],
|
],
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
|
@@ -92,6 +92,7 @@ func TestCreateClasspathElements(t *testing.T) {
|
|||||||
],
|
],
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
installable: true,
|
installable: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
|
@@ -30,7 +30,7 @@ func TestApexDepsContainers(t *testing.T) {
|
|||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForApexTest,
|
prepareForApexTest,
|
||||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
java.FixtureWithLastReleaseApis("mybootclasspathlib"),
|
java.FixtureWithLastReleaseApis("mybootclasspathlib", "bar"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
@@ -68,16 +68,17 @@ func TestApexDepsContainers(t *testing.T) {
|
|||||||
],
|
],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"foo",
|
"food",
|
||||||
"baz",
|
"baz",
|
||||||
],
|
],
|
||||||
libs: [
|
libs: [
|
||||||
"bar",
|
"bar.stubs",
|
||||||
],
|
],
|
||||||
min_sdk_version: "30",
|
min_sdk_version: "30",
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
java_library {
|
java_library {
|
||||||
name: "foo",
|
name: "food",
|
||||||
srcs:[
|
srcs:[
|
||||||
"A.java",
|
"A.java",
|
||||||
],
|
],
|
||||||
@@ -85,13 +86,15 @@ func TestApexDepsContainers(t *testing.T) {
|
|||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
min_sdk_version: "30",
|
min_sdk_version: "30",
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
java_library {
|
java_sdk_library {
|
||||||
name: "bar",
|
name: "bar",
|
||||||
srcs:[
|
srcs:[
|
||||||
"A.java",
|
"A.java",
|
||||||
],
|
],
|
||||||
min_sdk_version: "30",
|
min_sdk_version: "30",
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
java_library {
|
java_library {
|
||||||
name: "baz",
|
name: "baz",
|
||||||
@@ -103,6 +106,7 @@ func TestApexDepsContainers(t *testing.T) {
|
|||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
min_sdk_version: "30",
|
min_sdk_version: "30",
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
@@ -130,7 +134,7 @@ func TestApexDepsContainers(t *testing.T) {
|
|||||||
isApexContainer: false,
|
isApexContainer: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
moduleName: "foo",
|
moduleName: "food",
|
||||||
variant: "android_common_apex30",
|
variant: "android_common_apex30",
|
||||||
isSystemContainer: true,
|
isSystemContainer: true,
|
||||||
isApexContainer: true,
|
isApexContainer: true,
|
||||||
@@ -162,7 +166,7 @@ func TestNonUpdatableApexDepsContainers(t *testing.T) {
|
|||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForApexTest,
|
prepareForApexTest,
|
||||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
java.FixtureWithLastReleaseApis("mybootclasspathlib"),
|
java.FixtureWithLastReleaseApis("mybootclasspathlib", "bar"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
@@ -199,26 +203,30 @@ func TestNonUpdatableApexDepsContainers(t *testing.T) {
|
|||||||
],
|
],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"foo",
|
"food",
|
||||||
],
|
],
|
||||||
libs: [
|
libs: [
|
||||||
"bar",
|
"bar.stubs",
|
||||||
],
|
],
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
java_library {
|
java_library {
|
||||||
name: "foo",
|
name: "food",
|
||||||
srcs:[
|
srcs:[
|
||||||
"A.java",
|
"A.java",
|
||||||
],
|
],
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
java_library {
|
java_sdk_library {
|
||||||
name: "bar",
|
name: "bar",
|
||||||
srcs:[
|
srcs:[
|
||||||
"A.java",
|
"A.java",
|
||||||
],
|
],
|
||||||
|
sdk_version: "none",
|
||||||
|
system_modules: "none",
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
@@ -246,7 +254,7 @@ func TestNonUpdatableApexDepsContainers(t *testing.T) {
|
|||||||
isApexContainer: false,
|
isApexContainer: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
moduleName: "foo",
|
moduleName: "food",
|
||||||
variant: "android_common_apex10000",
|
variant: "android_common_apex10000",
|
||||||
isSystemContainer: true,
|
isSystemContainer: true,
|
||||||
isApexContainer: true,
|
isApexContainer: true,
|
||||||
|
@@ -293,6 +293,7 @@ func TestPlatformBootclasspathDependencies(t *testing.T) {
|
|||||||
],
|
],
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
installable: true,
|
installable: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a java_import that is not preferred and so won't have an appropriate apex variant created
|
// Add a java_import that is not preferred and so won't have an appropriate apex variant created
|
||||||
|
@@ -80,6 +80,7 @@ func TestSystemserverclasspathFragmentContents(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
systemserverclasspath_fragment {
|
systemserverclasspath_fragment {
|
||||||
@@ -350,6 +351,7 @@ func TestSystemserverclasspathFragmentStandaloneContents(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
],
|
],
|
||||||
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
systemserverclasspath_fragment {
|
systemserverclasspath_fragment {
|
||||||
|
@@ -593,6 +593,13 @@ func (j *Module) InstallInProduct() bool {
|
|||||||
return j.ProductSpecific()
|
return j.ProductSpecific()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ android.StubsAvailableModule = (*Module)(nil)
|
||||||
|
|
||||||
|
// To safisfy the StubsAvailableModule interface
|
||||||
|
func (j *Module) IsStubsModule() bool {
|
||||||
|
return proptools.Bool(j.properties.Is_stubs_module)
|
||||||
|
}
|
||||||
|
|
||||||
func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
|
func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
|
||||||
sdkVersion := j.SdkVersion(ctx)
|
sdkVersion := j.SdkVersion(ctx)
|
||||||
if sdkVersion.Stable() {
|
if sdkVersion.Stable() {
|
||||||
|
@@ -38,6 +38,7 @@ java_defaults {
|
|||||||
visibility: ["//visibility:public"],
|
visibility: ["//visibility:public"],
|
||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
|
is_stubs_module: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -289,6 +290,7 @@ java_defaults {
|
|||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
patch_module: "java.base",
|
patch_module: "java.base",
|
||||||
|
is_stubs_module: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same as legacy.core.platform.api.stubs, but android annotations are
|
// Same as legacy.core.platform.api.stubs, but android annotations are
|
||||||
@@ -307,6 +309,7 @@ java_library {
|
|||||||
"legacy.core.platform.api.stubs",
|
"legacy.core.platform.api.stubs",
|
||||||
],
|
],
|
||||||
patch_module: "java.base",
|
patch_module: "java.base",
|
||||||
|
is_stubs_module: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -339,6 +342,7 @@ java_library {
|
|||||||
"stable.core.platform.api.stubs",
|
"stable.core.platform.api.stubs",
|
||||||
],
|
],
|
||||||
patch_module: "java.base",
|
patch_module: "java.base",
|
||||||
|
is_stubs_module: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used when compiling higher-level code against *.core.platform.api.stubs.
|
// Used when compiling higher-level code against *.core.platform.api.stubs.
|
||||||
|
@@ -54,6 +54,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
name: "foo",
|
name: "foo",
|
||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
@@ -98,6 +99,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
java_library {
|
java_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
installable: true,
|
installable: true,
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
@@ -107,6 +109,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
java_library {
|
java_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
@@ -144,6 +147,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
@@ -164,6 +168,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
apex_available: ["com.android.apex1"],
|
apex_available: ["com.android.apex1"],
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
apexVariant: true,
|
apexVariant: true,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@@ -176,6 +181,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
apex_available: ["com.android.apex1"],
|
apex_available: ["com.android.apex1"],
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
moduleName: "service-foo",
|
moduleName: "service-foo",
|
||||||
apexVariant: true,
|
apexVariant: true,
|
||||||
@@ -189,6 +195,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
apex_available: ["com.android.apex1"],
|
apex_available: ["com.android.apex1"],
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
moduleName: "prebuilt_service-foo",
|
moduleName: "prebuilt_service-foo",
|
||||||
apexVariant: true,
|
apexVariant: true,
|
||||||
@@ -202,6 +209,7 @@ func TestDexpreoptEnabled(t *testing.T) {
|
|||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
apex_available: ["com.android.apex1"],
|
apex_available: ["com.android.apex1"],
|
||||||
|
sdk_version: "current",
|
||||||
}`,
|
}`,
|
||||||
moduleName: "service-foo",
|
moduleName: "service-foo",
|
||||||
apexVariant: false,
|
apexVariant: false,
|
||||||
@@ -311,6 +319,7 @@ func TestDexpreoptBuiltInstalledForApex(t *testing.T) {
|
|||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
apex_available: ["com.android.apex1"],
|
apex_available: ["com.android.apex1"],
|
||||||
|
sdk_version: "current",
|
||||||
}`)
|
}`)
|
||||||
ctx := result.TestContext
|
ctx := result.TestContext
|
||||||
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
|
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
|
||||||
@@ -342,6 +351,7 @@ func TestDexpreoptBuiltInstalledForApex(t *testing.T) {
|
|||||||
name: "foo",
|
name: "foo",
|
||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
|
sdk_version: "current",
|
||||||
}`)
|
}`)
|
||||||
ctx = result.TestContext
|
ctx = result.TestContext
|
||||||
module = ctx.ModuleForTests("foo", "android_common")
|
module = ctx.ModuleForTests("foo", "android_common")
|
||||||
@@ -398,6 +408,7 @@ func TestAndroidMkEntriesForApex(t *testing.T) {
|
|||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
apex_available: ["com.android.apex1"],
|
apex_available: ["com.android.apex1"],
|
||||||
|
sdk_version: "current",
|
||||||
}`)
|
}`)
|
||||||
ctx := result.TestContext
|
ctx := result.TestContext
|
||||||
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
|
module := ctx.ModuleForTests("service-foo", "android_common_apex1000")
|
||||||
@@ -429,6 +440,7 @@ func TestAndroidMkEntriesForApex(t *testing.T) {
|
|||||||
name: "foo",
|
name: "foo",
|
||||||
installable: true,
|
installable: true,
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
|
sdk_version: "current",
|
||||||
}`)
|
}`)
|
||||||
ctx = result.TestContext
|
ctx = result.TestContext
|
||||||
module = ctx.ModuleForTests("foo", "android_common")
|
module = ctx.ModuleForTests("foo", "android_common")
|
||||||
@@ -454,6 +466,7 @@ func TestGenerateProfileEvenIfDexpreoptIsDisabled(t *testing.T) {
|
|||||||
profile: "art-profile",
|
profile: "art-profile",
|
||||||
},
|
},
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
|
sdk_version: "current",
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
ctx := result.TestContext
|
ctx := result.TestContext
|
||||||
|
@@ -2099,6 +2099,7 @@ func (module *SdkLibrary) topLevelStubsLibraryProps(mctx android.DefaultableHook
|
|||||||
props.Dist.Dir = proptools.StringPtr(module.apiDistPath(apiScope))
|
props.Dist.Dir = proptools.StringPtr(module.apiDistPath(apiScope))
|
||||||
props.Dist.Tag = proptools.StringPtr(".jar")
|
props.Dist.Tag = proptools.StringPtr(".jar")
|
||||||
}
|
}
|
||||||
|
props.Is_stubs_module = proptools.BoolPtr(true)
|
||||||
|
|
||||||
return props
|
return props
|
||||||
}
|
}
|
||||||
|
@@ -184,6 +184,10 @@ var PrepareForTestWithJacocoInstrumentation = android.GroupFixturePreparers(
|
|||||||
host_supported: true,
|
host_supported: true,
|
||||||
srcs: ["Test.java"],
|
srcs: ["Test.java"],
|
||||||
sdk_version: "current",
|
sdk_version: "current",
|
||||||
|
apex_available: [
|
||||||
|
"//apex_available:anyapex",
|
||||||
|
"//apex_available:platform",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
`)),
|
`)),
|
||||||
)
|
)
|
||||||
@@ -408,7 +412,6 @@ func gatherRequiredDepsForTest() string {
|
|||||||
"core.current.stubs",
|
"core.current.stubs",
|
||||||
"legacy.core.platform.api.stubs",
|
"legacy.core.platform.api.stubs",
|
||||||
"stable.core.platform.api.stubs",
|
"stable.core.platform.api.stubs",
|
||||||
|
|
||||||
"android_stubs_current_exportable",
|
"android_stubs_current_exportable",
|
||||||
"android_system_stubs_current_exportable",
|
"android_system_stubs_current_exportable",
|
||||||
"android_test_stubs_current_exportable",
|
"android_test_stubs_current_exportable",
|
||||||
@@ -416,13 +419,11 @@ func gatherRequiredDepsForTest() string {
|
|||||||
"android_system_server_stubs_current_exportable",
|
"android_system_server_stubs_current_exportable",
|
||||||
"core.current.stubs.exportable",
|
"core.current.stubs.exportable",
|
||||||
"legacy.core.platform.api.stubs.exportable",
|
"legacy.core.platform.api.stubs.exportable",
|
||||||
|
|
||||||
"kotlin-stdlib",
|
"kotlin-stdlib",
|
||||||
"kotlin-stdlib-jdk7",
|
"kotlin-stdlib-jdk7",
|
||||||
"kotlin-stdlib-jdk8",
|
"kotlin-stdlib-jdk8",
|
||||||
"kotlin-annotations",
|
"kotlin-annotations",
|
||||||
"stub-annotations",
|
"stub-annotations",
|
||||||
|
|
||||||
"aconfig-annotations-lib",
|
"aconfig-annotations-lib",
|
||||||
"unsupportedappusage",
|
"unsupportedappusage",
|
||||||
}
|
}
|
||||||
@@ -435,6 +436,7 @@ func gatherRequiredDepsForTest() string {
|
|||||||
sdk_version: "none",
|
sdk_version: "none",
|
||||||
system_modules: "stable-core-platform-api-stubs-system-modules",
|
system_modules: "stable-core-platform-api-stubs-system-modules",
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
is_stubs_module: true,
|
||||||
}
|
}
|
||||||
`, extra)
|
`, extra)
|
||||||
}
|
}
|
||||||
|
@@ -338,6 +338,7 @@ func testSnapshotWithBootClasspathFragment_Contents(t *testing.T, sdk string, co
|
|||||||
shared_library: false,
|
shared_library: false,
|
||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "2",
|
min_sdk_version: "2",
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -348,6 +349,7 @@ func testSnapshotWithBootClasspathFragment_Contents(t *testing.T, sdk string, co
|
|||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "2",
|
min_sdk_version: "2",
|
||||||
permitted_packages: ["myothersdklibrary"],
|
permitted_packages: ["myothersdklibrary"],
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -357,6 +359,7 @@ func testSnapshotWithBootClasspathFragment_Contents(t *testing.T, sdk string, co
|
|||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "2",
|
min_sdk_version: "2",
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
@@ -624,6 +627,7 @@ func TestSnapshotWithBootClasspathFragment_Fragments(t *testing.T) {
|
|||||||
min_sdk_version: "2",
|
min_sdk_version: "2",
|
||||||
permitted_packages: ["myothersdklibrary"],
|
permitted_packages: ["myothersdklibrary"],
|
||||||
compile_dex: true,
|
compile_dex: true,
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
|
|
||||||
@@ -655,6 +659,7 @@ func TestSnapshotWithBootClasspathFragment_Fragments(t *testing.T) {
|
|||||||
shared_library: false,
|
shared_library: false,
|
||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "2",
|
min_sdk_version: "2",
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
@@ -877,6 +882,7 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
|
|||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
permitted_packages: ["mysdklibrary"],
|
permitted_packages: ["mysdklibrary"],
|
||||||
min_sdk_version: "current",
|
min_sdk_version: "current",
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -895,6 +901,7 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
|
|||||||
package_prefixes: ["newlibrary.all.mine"],
|
package_prefixes: ["newlibrary.all.mine"],
|
||||||
single_packages: ["newlibrary.mine"],
|
single_packages: ["newlibrary.mine"],
|
||||||
},
|
},
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
@@ -1080,6 +1087,7 @@ func testSnapshotWithBootClasspathFragment_MinSdkVersion(t *testing.T, targetBui
|
|||||||
shared_library: false,
|
shared_library: false,
|
||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "S",
|
min_sdk_version: "S",
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -1090,6 +1098,7 @@ func testSnapshotWithBootClasspathFragment_MinSdkVersion(t *testing.T, targetBui
|
|||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "Tiramisu",
|
min_sdk_version: "Tiramisu",
|
||||||
permitted_packages: ["mynewsdklibrary"],
|
permitted_packages: ["mynewsdklibrary"],
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
@@ -1287,6 +1296,7 @@ func TestSnapshotWithEmptyBootClasspathFragment(t *testing.T) {
|
|||||||
shared_library: false,
|
shared_library: false,
|
||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "Tiramisu",
|
min_sdk_version: "Tiramisu",
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
name: "mynewsdklibrary",
|
name: "mynewsdklibrary",
|
||||||
@@ -1296,6 +1306,7 @@ func TestSnapshotWithEmptyBootClasspathFragment(t *testing.T) {
|
|||||||
public: {enabled: true},
|
public: {enabled: true},
|
||||||
min_sdk_version: "Tiramisu",
|
min_sdk_version: "Tiramisu",
|
||||||
permitted_packages: ["mynewsdklibrary"],
|
permitted_packages: ["mynewsdklibrary"],
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
|
@@ -80,6 +80,7 @@ func testSnapshotWithSystemServerClasspathFragment(t *testing.T, sdk string, tar
|
|||||||
dex_preopt: {
|
dex_preopt: {
|
||||||
profile: "art-profile",
|
profile: "art-profile",
|
||||||
},
|
},
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
).RunTest(t)
|
).RunTest(t)
|
||||||
@@ -110,12 +111,14 @@ func TestSnapshotWithPartialSystemServerClasspathFragment(t *testing.T) {
|
|||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
srcs: ["Test.java"],
|
srcs: ["Test.java"],
|
||||||
min_sdk_version: "33", // Tiramisu
|
min_sdk_version: "33", // Tiramisu
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
name: "mysdklibrary-future",
|
name: "mysdklibrary-future",
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
srcs: ["Test.java"],
|
srcs: ["Test.java"],
|
||||||
min_sdk_version: "34", // UpsideDownCake
|
min_sdk_version: "34", // UpsideDownCake
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
@@ -199,6 +202,7 @@ func TestSnapshotWithEmptySystemServerClasspathFragment(t *testing.T) {
|
|||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
srcs: ["Test.java"],
|
srcs: ["Test.java"],
|
||||||
min_sdk_version: "34", // UpsideDownCake
|
min_sdk_version: "34", // UpsideDownCake
|
||||||
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
sdk {
|
sdk {
|
||||||
name: "mysdk",
|
name: "mysdk",
|
||||||
|
Reference in New Issue
Block a user