Merge changes I42cb181f,I6413c9b1
* changes: Add sdk_version:"core_platform" to replace no_framework_libs:true Remove the no_standard_libs property
This commit is contained in:
@@ -52,7 +52,6 @@ func createNeverAllows() []*rule {
|
|||||||
rules = append(rules, createTrebleRules()...)
|
rules = append(rules, createTrebleRules()...)
|
||||||
rules = append(rules, createLibcoreRules()...)
|
rules = append(rules, createLibcoreRules()...)
|
||||||
rules = append(rules, createJavaDeviceForHostRules()...)
|
rules = append(rules, createJavaDeviceForHostRules()...)
|
||||||
rules = append(rules, createJavaLibraryHostRules()...)
|
|
||||||
return rules
|
return rules
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,13 +100,9 @@ func createLibcoreRules() []*rule {
|
|||||||
"development",
|
"development",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Core library constraints. The no_standard_libs can only be used in core
|
// Core library constraints. The sdk_version: "none" can only be used in core library projects.
|
||||||
// library projects. Access to core library targets is restricted using
|
// Access to core library targets is restricted using visibility rules.
|
||||||
// visibility rules.
|
|
||||||
rules := []*rule{
|
rules := []*rule{
|
||||||
neverallow().
|
|
||||||
notIn(coreLibraryProjects...).
|
|
||||||
with("no_standard_libs", "true"),
|
|
||||||
neverallow().
|
neverallow().
|
||||||
notIn(coreLibraryProjects...).
|
notIn(coreLibraryProjects...).
|
||||||
with("sdk_version", "none"),
|
with("sdk_version", "none"),
|
||||||
@@ -131,15 +126,6 @@ func createJavaDeviceForHostRules() []*rule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func createJavaLibraryHostRules() []*rule {
|
|
||||||
return []*rule{
|
|
||||||
neverallow().
|
|
||||||
moduleType("java_library_host").
|
|
||||||
with("no_standard_libs", "true").
|
|
||||||
because("no_standard_libs makes no sense with java_library_host"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func neverallowMutator(ctx BottomUpMutatorContext) {
|
func neverallowMutator(ctx BottomUpMutatorContext) {
|
||||||
m, ok := ctx.Module().(Module)
|
m, ok := ctx.Module().(Module)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@@ -147,37 +147,6 @@ var neverallowTests = []struct {
|
|||||||
expectedError: "java_device_for_host can only be used in whitelisted projects",
|
expectedError: "java_device_for_host can only be used in whitelisted projects",
|
||||||
},
|
},
|
||||||
// Libcore rule tests
|
// Libcore rule tests
|
||||||
{
|
|
||||||
name: "no_standard_libs: true inside core libraries",
|
|
||||||
fs: map[string][]byte{
|
|
||||||
"libcore/Blueprints": []byte(`
|
|
||||||
java_library {
|
|
||||||
name: "inside_core_libraries",
|
|
||||||
no_standard_libs: true,
|
|
||||||
}`),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no_standard_libs: true outside core libraries",
|
|
||||||
fs: map[string][]byte{
|
|
||||||
"Blueprints": []byte(`
|
|
||||||
java_library {
|
|
||||||
name: "outside_core_libraries",
|
|
||||||
no_standard_libs: true,
|
|
||||||
}`),
|
|
||||||
},
|
|
||||||
expectedError: "module \"outside_core_libraries\": violates neverallow",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "no_standard_libs: false",
|
|
||||||
fs: map[string][]byte{
|
|
||||||
"Blueprints": []byte(`
|
|
||||||
java_library {
|
|
||||||
name: "outside_core_libraries",
|
|
||||||
no_standard_libs: false,
|
|
||||||
}`),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "sdk_version: \"none\" inside core libraries",
|
name: "sdk_version: \"none\" inside core libraries",
|
||||||
fs: map[string][]byte{
|
fs: map[string][]byte{
|
||||||
@@ -209,18 +178,6 @@ var neverallowTests = []struct {
|
|||||||
}`),
|
}`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// java_library_host rule tests
|
|
||||||
{
|
|
||||||
name: "java_library_host with no_standard_libs: true",
|
|
||||||
fs: map[string][]byte{
|
|
||||||
"libcore/Blueprints": []byte(`
|
|
||||||
java_library_host {
|
|
||||||
name: "inside_core_libraries",
|
|
||||||
no_standard_libs: true,
|
|
||||||
}`),
|
|
||||||
},
|
|
||||||
expectedError: "module \"inside_core_libraries\": violates neverallow",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNeverallow(t *testing.T) {
|
func TestNeverallow(t *testing.T) {
|
||||||
@@ -296,7 +253,6 @@ func (p *mockCcLibraryModule) GenerateAndroidBuildActions(ModuleContext) {
|
|||||||
|
|
||||||
type mockJavaLibraryProperties struct {
|
type mockJavaLibraryProperties struct {
|
||||||
Libs []string
|
Libs []string
|
||||||
No_standard_libs *bool
|
|
||||||
Sdk_version *string
|
Sdk_version *string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -185,7 +185,6 @@ func init() {
|
|||||||
"LOCAL_NO_CRT": "nocrt",
|
"LOCAL_NO_CRT": "nocrt",
|
||||||
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
|
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
|
||||||
"LOCAL_RTTI_FLAG": "rtti",
|
"LOCAL_RTTI_FLAG": "rtti",
|
||||||
"LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libs",
|
|
||||||
"LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
|
"LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
|
||||||
"LOCAL_TIDY": "tidy",
|
"LOCAL_TIDY": "tidy",
|
||||||
"LOCAL_USE_CLANG_LLD": "use_clang_lld",
|
"LOCAL_USE_CLANG_LLD": "use_clang_lld",
|
||||||
|
@@ -517,10 +517,6 @@ func (a *AARImport) noFrameworkLibs() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AARImport) noStandardLibs() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ AndroidLibraryDependency = (*AARImport)(nil)
|
var _ AndroidLibraryDependency = (*AARImport)(nil)
|
||||||
|
|
||||||
func (a *AARImport) ExportPackage() android.Path {
|
func (a *AARImport) ExportPackage() android.Path {
|
||||||
|
159
java/app_test.go
159
java/app_test.go
@@ -546,7 +546,7 @@ func TestAppSdkVersion(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJNIABI(t *testing.T) {
|
func TestJNIABI_no_framework_libs_true(t *testing.T) {
|
||||||
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
|
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libjni",
|
name: "libjni",
|
||||||
@@ -619,7 +619,80 @@ func TestJNIABI(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJNIPackaging(t *testing.T) {
|
func TestJNIABI(t *testing.T) {
|
||||||
|
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
|
||||||
|
cc_library {
|
||||||
|
name: "libjni",
|
||||||
|
system_shared_libs: [],
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "test",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "test_first",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
compile_multilib: "first",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "test_both",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
compile_multilib: "both",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "test_32",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
compile_multilib: "32",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "test_64",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
compile_multilib: "64",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
name string
|
||||||
|
abis []string
|
||||||
|
}{
|
||||||
|
{"test", []string{"arm64-v8a"}},
|
||||||
|
{"test_first", []string{"arm64-v8a"}},
|
||||||
|
{"test_both", []string{"arm64-v8a", "armeabi-v7a"}},
|
||||||
|
{"test_32", []string{"armeabi-v7a"}},
|
||||||
|
{"test_64", []string{"arm64-v8a"}},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range testCases {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
app := ctx.ModuleForTests(test.name, "android_common")
|
||||||
|
jniLibZip := app.Output("jnilibs.zip")
|
||||||
|
var abis []string
|
||||||
|
args := strings.Fields(jniLibZip.Args["jarArgs"])
|
||||||
|
for i := 0; i < len(args); i++ {
|
||||||
|
if args[i] == "-P" {
|
||||||
|
abis = append(abis, filepath.Base(args[i+1]))
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(abis, test.abis) {
|
||||||
|
t.Errorf("want abis %v, got %v", test.abis, abis)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestJNIPackaging_no_framework_libs_true(t *testing.T) {
|
||||||
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
|
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libjni",
|
name: "libjni",
|
||||||
@@ -700,7 +773,89 @@ func TestJNIPackaging(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestJNIPackaging(t *testing.T) {
|
||||||
|
ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
|
||||||
|
cc_library {
|
||||||
|
name: "libjni",
|
||||||
|
system_shared_libs: [],
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
|
|
||||||
|
android_app {
|
||||||
|
name: "app",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
|
||||||
|
android_app {
|
||||||
|
name: "app_noembed",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
use_embedded_native_libs: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
android_app {
|
||||||
|
name: "app_embed",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
use_embedded_native_libs: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "test",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test {
|
||||||
|
name: "test_noembed",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
use_embedded_native_libs: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test_helper_app {
|
||||||
|
name: "test_helper",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
}
|
||||||
|
|
||||||
|
android_test_helper_app {
|
||||||
|
name: "test_helper_noembed",
|
||||||
|
sdk_version: "core_platform",
|
||||||
|
jni_libs: ["libjni"],
|
||||||
|
use_embedded_native_libs: false,
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
testCases := []struct {
|
||||||
|
name string
|
||||||
|
packaged bool
|
||||||
|
compressed bool
|
||||||
|
}{
|
||||||
|
{"app", false, false},
|
||||||
|
{"app_noembed", false, false},
|
||||||
|
{"app_embed", true, false},
|
||||||
|
{"test", true, false},
|
||||||
|
{"test_noembed", true, true},
|
||||||
|
{"test_helper", true, false},
|
||||||
|
{"test_helper_noembed", true, true},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range testCases {
|
||||||
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
app := ctx.ModuleForTests(test.name, "android_common")
|
||||||
|
jniLibZip := app.MaybeOutput("jnilibs.zip")
|
||||||
|
if g, w := (jniLibZip.Rule != nil), test.packaged; g != w {
|
||||||
|
t.Errorf("expected jni packaged %v, got %v", w, g)
|
||||||
|
}
|
||||||
|
|
||||||
|
if jniLibZip.Rule != nil {
|
||||||
|
if g, w := !strings.Contains(jniLibZip.Args["jarArgs"], "-L 0"), test.compressed; g != w {
|
||||||
|
t.Errorf("expected jni compressed %v, got %v", w, g)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCertificates(t *testing.T) {
|
func TestCertificates(t *testing.T) {
|
||||||
|
@@ -171,10 +171,6 @@ type JavadocProperties struct {
|
|||||||
// list of java libraries that will be in the classpath.
|
// list of java libraries that will be in the classpath.
|
||||||
Libs []string `android:"arch_variant"`
|
Libs []string `android:"arch_variant"`
|
||||||
|
|
||||||
// don't build against the default libraries (bootclasspath, ext, and framework for device
|
|
||||||
// targets)
|
|
||||||
No_standard_libs *bool
|
|
||||||
|
|
||||||
// don't build against the framework libraries (ext, and framework for device targets)
|
// don't build against the framework libraries (ext, and framework for device targets)
|
||||||
No_framework_libs *bool
|
No_framework_libs *bool
|
||||||
|
|
||||||
@@ -542,10 +538,6 @@ func (j *Javadoc) noFrameworkLibs() bool {
|
|||||||
return Bool(j.properties.No_framework_libs)
|
return Bool(j.properties.No_framework_libs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Javadoc) noStandardLibs() bool {
|
|
||||||
return Bool(j.properties.No_standard_libs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
|
func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
sdkDep := decodeSdkDep(ctx, sdkContext(j))
|
sdkDep := decodeSdkDep(ctx, sdkContext(j))
|
||||||
|
23
java/java.go
23
java/java.go
@@ -82,10 +82,6 @@ type CompilerProperties struct {
|
|||||||
// list of files that should be excluded from java_resources and java_resource_dirs
|
// list of files that should be excluded from java_resources and java_resource_dirs
|
||||||
Exclude_java_resources []string `android:"path,arch_variant"`
|
Exclude_java_resources []string `android:"path,arch_variant"`
|
||||||
|
|
||||||
// don't build against the default libraries (bootclasspath, ext, and framework for device
|
|
||||||
// targets)
|
|
||||||
No_standard_libs *bool
|
|
||||||
|
|
||||||
// don't build against the framework libraries (ext, and framework for device targets)
|
// don't build against the framework libraries (ext, and framework for device targets)
|
||||||
No_framework_libs *bool
|
No_framework_libs *bool
|
||||||
|
|
||||||
@@ -490,10 +486,6 @@ func (j *Module) noFrameworkLibs() bool {
|
|||||||
return Bool(j.properties.No_framework_libs)
|
return Bool(j.properties.No_framework_libs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Module) noStandardLibs() bool {
|
|
||||||
return Bool(j.properties.No_standard_libs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
sdkDep := decodeSdkDep(ctx, sdkContext(j))
|
sdkDep := decodeSdkDep(ctx, sdkContext(j))
|
||||||
@@ -513,8 +505,8 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if j.deviceProperties.System_modules == nil {
|
} else if j.deviceProperties.System_modules == nil {
|
||||||
ctx.PropertyErrorf("no_standard_libs",
|
ctx.PropertyErrorf("sdk_version",
|
||||||
"system_modules is required to be set when no_standard_libs is true, did you mean no_framework_libs?")
|
`system_modules is required to be set when sdk_version is "none", did you mean no_framework_libs?`)
|
||||||
} else if *j.deviceProperties.System_modules != "none" {
|
} else if *j.deviceProperties.System_modules != "none" {
|
||||||
ctx.AddVariationDependencies(nil, systemModulesTag, *j.deviceProperties.System_modules)
|
ctx.AddVariationDependencies(nil, systemModulesTag, *j.deviceProperties.System_modules)
|
||||||
}
|
}
|
||||||
@@ -682,7 +674,7 @@ func getLinkType(m *Module, name string) (ret linkType, stubs bool) {
|
|||||||
return javaSdk, true
|
return javaSdk, true
|
||||||
case ver == "current":
|
case ver == "current":
|
||||||
return javaSdk, false
|
return javaSdk, false
|
||||||
case ver == "" || ver == "none":
|
case ver == "" || ver == "none" || ver == "core_platform":
|
||||||
return javaPlatform, false
|
return javaPlatform, false
|
||||||
default:
|
default:
|
||||||
if _, err := strconv.Atoi(ver); err != nil {
|
if _, err := strconv.Atoi(ver); err != nil {
|
||||||
@@ -860,7 +852,8 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sd
|
|||||||
var ret string
|
var ret string
|
||||||
v := sdkContext.sdkVersion()
|
v := sdkContext.sdkVersion()
|
||||||
// For PDK builds, use the latest SDK version instead of "current"
|
// For PDK builds, use the latest SDK version instead of "current"
|
||||||
if ctx.Config().IsPdkBuild() && (v == "" || v == "none" || v == "current") {
|
if ctx.Config().IsPdkBuild() &&
|
||||||
|
(v == "" || v == "none" || v == "core_platform" || v == "current") {
|
||||||
sdkVersions := ctx.Config().Get(sdkVersionsKey).([]int)
|
sdkVersions := ctx.Config().Get(sdkVersionsKey).([]int)
|
||||||
latestSdkVersion := 0
|
latestSdkVersion := 0
|
||||||
if len(sdkVersions) > 0 {
|
if len(sdkVersions) > 0 {
|
||||||
@@ -879,7 +872,11 @@ func getJavaVersion(ctx android.ModuleContext, javaVersion string, sdkContext sd
|
|||||||
ret = "1.7"
|
ret = "1.7"
|
||||||
} else if ctx.Device() && sdk <= 29 || !ctx.Config().TargetOpenJDK9() {
|
} else if ctx.Device() && sdk <= 29 || !ctx.Config().TargetOpenJDK9() {
|
||||||
ret = "1.8"
|
ret = "1.8"
|
||||||
} else if ctx.Device() && sdkContext.sdkVersion() != "" && sdkContext.sdkVersion() != "none" && sdk == android.FutureApiLevel {
|
} else if ctx.Device() &&
|
||||||
|
sdkContext.sdkVersion() != "" &&
|
||||||
|
sdkContext.sdkVersion() != "none" &&
|
||||||
|
sdkContext.sdkVersion() != "core_platform" &&
|
||||||
|
sdk == android.FutureApiLevel {
|
||||||
// TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current"
|
// TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current"
|
||||||
ret = "1.8"
|
ret = "1.8"
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1013,7 +1013,7 @@ func TestPatchModule(t *testing.T) {
|
|||||||
java_library {
|
java_library {
|
||||||
name: "bar",
|
name: "bar",
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
no_standard_libs: true,
|
sdk_version: "none",
|
||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
patch_module: "java.base",
|
patch_module: "java.base",
|
||||||
}
|
}
|
||||||
|
25
java/sdk.go
25
java/sdk.go
@@ -45,16 +45,13 @@ type sdkContext interface {
|
|||||||
// targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set.
|
// targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set.
|
||||||
targetSdkVersion() string
|
targetSdkVersion() string
|
||||||
|
|
||||||
// Temporarily provide access to the no_standard_libs property (where present).
|
|
||||||
noStandardLibs() bool
|
|
||||||
|
|
||||||
// Temporarily provide access to the no_frameworks_libs property (where present).
|
// Temporarily provide access to the no_frameworks_libs property (where present).
|
||||||
noFrameworkLibs() bool
|
noFrameworkLibs() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string {
|
func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string {
|
||||||
switch v {
|
switch v {
|
||||||
case "", "none", "current", "system_current", "test_current", "core_current":
|
case "", "none", "current", "test_current", "system_current", "core_current", "core_platform":
|
||||||
return ctx.Config().DefaultAppTargetSdk()
|
return ctx.Config().DefaultAppTargetSdk()
|
||||||
default:
|
default:
|
||||||
return v
|
return v
|
||||||
@@ -65,7 +62,7 @@ func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string {
|
|||||||
// it returns android.FutureApiLevel (10000).
|
// it returns android.FutureApiLevel (10000).
|
||||||
func sdkVersionToNumber(ctx android.BaseModuleContext, v string) (int, error) {
|
func sdkVersionToNumber(ctx android.BaseModuleContext, v string) (int, error) {
|
||||||
switch v {
|
switch v {
|
||||||
case "", "none", "current", "test_current", "system_current", "core_current":
|
case "", "none", "current", "test_current", "system_current", "core_current", "core_platform":
|
||||||
return ctx.Config().DefaultAppTargetSdkInt(), nil
|
return ctx.Config().DefaultAppTargetSdkInt(), nil
|
||||||
default:
|
default:
|
||||||
n := android.GetNumericSdkVersion(v)
|
n := android.GetNumericSdkVersion(v)
|
||||||
@@ -145,8 +142,7 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
|||||||
jars: android.Paths{jarPath.Path(), lambdaStubsPath},
|
jars: android.Paths{jarPath.Path(), lambdaStubsPath},
|
||||||
aidl: android.OptionalPathForPath(aidlPath.Path()),
|
aidl: android.OptionalPathForPath(aidlPath.Path()),
|
||||||
|
|
||||||
// Pass values straight through for now to match previous behavior.
|
// Pass value straight through for now to match previous behavior.
|
||||||
noStandardLibs: sdkContext.noStandardLibs(),
|
|
||||||
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,8 +155,7 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
|||||||
frameworkResModule: r,
|
frameworkResModule: r,
|
||||||
aidl: android.OptionalPathForPath(aidl),
|
aidl: android.OptionalPathForPath(aidl),
|
||||||
|
|
||||||
// Pass values straight through for now to match previous behavior.
|
// Pass value straight through for now to match previous behavior.
|
||||||
noStandardLibs: sdkContext.noStandardLibs(),
|
|
||||||
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +182,8 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Config().UnbundledBuildUsePrebuiltSdks() && v != "" && v != "none" {
|
if ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
|
||||||
|
v != "" && v != "none" && v != "core_platform" {
|
||||||
return toPrebuilt(v)
|
return toPrebuilt(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,14 +193,19 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
|||||||
useDefaultLibs: true,
|
useDefaultLibs: true,
|
||||||
frameworkResModule: "framework-res",
|
frameworkResModule: "framework-res",
|
||||||
|
|
||||||
// Pass values straight through for now to match previous behavior.
|
// Pass value straight through for now to match previous behavior.
|
||||||
noStandardLibs: sdkContext.noStandardLibs(),
|
|
||||||
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
||||||
}
|
}
|
||||||
case "none":
|
case "none":
|
||||||
return sdkDep{
|
return sdkDep{
|
||||||
noStandardLibs: true,
|
noStandardLibs: true,
|
||||||
}
|
}
|
||||||
|
case "core_platform":
|
||||||
|
return sdkDep{
|
||||||
|
useDefaultLibs: true,
|
||||||
|
frameworkResModule: "framework-res",
|
||||||
|
noFrameworksLibs: true,
|
||||||
|
}
|
||||||
case "current":
|
case "current":
|
||||||
return toModule("android_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx))
|
return toModule("android_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx))
|
||||||
case "system_current":
|
case "system_current":
|
||||||
|
@@ -385,7 +385,6 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.LoadHookContext, apiSc
|
|||||||
Device_specific *bool
|
Device_specific *bool
|
||||||
Product_specific *bool
|
Product_specific *bool
|
||||||
Compile_dex *bool
|
Compile_dex *bool
|
||||||
No_standard_libs *bool
|
|
||||||
System_modules *string
|
System_modules *string
|
||||||
Java_version *string
|
Java_version *string
|
||||||
Product_variables struct {
|
Product_variables struct {
|
||||||
|
@@ -54,6 +54,14 @@ func TestClasspath(t *testing.T) {
|
|||||||
classpath: []string{},
|
classpath: []string{},
|
||||||
aidl: "",
|
aidl: "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: `sdk_version:"core_platform"`,
|
||||||
|
properties: `sdk_version:"core_platform"`,
|
||||||
|
bootclasspath: config.DefaultBootclasspathLibraries,
|
||||||
|
system: config.DefaultSystemModules,
|
||||||
|
classpath: []string{},
|
||||||
|
aidl: "",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "blank sdk version",
|
name: "blank sdk version",
|
||||||
properties: `sdk_version: "",`,
|
properties: `sdk_version: "",`,
|
||||||
@@ -111,14 +119,6 @@ func TestClasspath(t *testing.T) {
|
|||||||
bootclasspath: []string{"core.current.stubs", "core-lambda-stubs"},
|
bootclasspath: []string{"core.current.stubs", "core-lambda-stubs"},
|
||||||
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
system: "bootclasspath", // special value to tell 1.9 test to expect bootclasspath
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
|
||||||
name: "nostdlib - no_standard_libs: true",
|
|
||||||
properties: `no_standard_libs: true, system_modules: "none"`,
|
|
||||||
system: "none",
|
|
||||||
bootclasspath: []string{`""`},
|
|
||||||
classpath: []string{},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
|
|
||||||
name: "nostdlib",
|
name: "nostdlib",
|
||||||
@@ -127,14 +127,6 @@ func TestClasspath(t *testing.T) {
|
|||||||
bootclasspath: []string{`""`},
|
bootclasspath: []string{`""`},
|
||||||
classpath: []string{},
|
classpath: []string{},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
|
|
||||||
name: "nostdlib system_modules - no_standard_libs: true",
|
|
||||||
properties: `no_standard_libs: true, system_modules: "core-platform-api-stubs-system-modules"`,
|
|
||||||
system: "core-platform-api-stubs-system-modules",
|
|
||||||
bootclasspath: []string{`""`},
|
|
||||||
classpath: []string{},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
|
|
||||||
name: "nostdlib system_modules",
|
name: "nostdlib system_modules",
|
||||||
@@ -160,12 +152,6 @@ func TestClasspath(t *testing.T) {
|
|||||||
classpath: []string{},
|
classpath: []string{},
|
||||||
bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
|
bootclasspath: []string{"jdk8/jre/lib/jce.jar", "jdk8/jre/lib/rt.jar"},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "host supported nostdlib - no_standard_libs: true",
|
|
||||||
host: android.Host,
|
|
||||||
properties: `host_supported: true, no_standard_libs: true, system_modules: "none"`,
|
|
||||||
classpath: []string{},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "host supported nostdlib",
|
name: "host supported nostdlib",
|
||||||
host: android.Host,
|
host: android.Host,
|
||||||
|
@@ -64,7 +64,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
java_library {
|
java_library {
|
||||||
name: "framework",
|
name: "framework",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
no_standard_libs: true,
|
sdk_version: "none",
|
||||||
system_modules: "core-platform-api-stubs-system-modules",
|
system_modules: "core-platform-api-stubs-system-modules",
|
||||||
aidl: {
|
aidl: {
|
||||||
export_include_dirs: ["framework/aidl"],
|
export_include_dirs: ["framework/aidl"],
|
||||||
@@ -73,13 +73,13 @@ func GatherRequiredDepsForTest() string {
|
|||||||
|
|
||||||
android_app {
|
android_app {
|
||||||
name: "framework-res",
|
name: "framework-res",
|
||||||
no_framework_libs: true,
|
sdk_version: "core_platform",
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "android.hidl.base-V1.0-java",
|
name: "android.hidl.base-V1.0-java",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
no_standard_libs: true,
|
sdk_version: "none",
|
||||||
system_modules: "core-platform-api-stubs-system-modules",
|
system_modules: "core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
java_library {
|
java_library {
|
||||||
name: "android.hidl.manager-V1.0-java",
|
name: "android.hidl.manager-V1.0-java",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
no_standard_libs: true,
|
sdk_version: "none",
|
||||||
system_modules: "core-platform-api-stubs-system-modules",
|
system_modules: "core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ func GatherRequiredDepsForTest() string {
|
|||||||
java_library {
|
java_library {
|
||||||
name: "org.apache.http.legacy",
|
name: "org.apache.http.legacy",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
no_standard_libs: true,
|
sdk_version: "none",
|
||||||
system_modules: "core-platform-api-stubs-system-modules",
|
system_modules: "core-platform-api-stubs-system-modules",
|
||||||
installable: true,
|
installable: true,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user