Remove the no_standard_libs property
Corrects an error message that refers to no_standard_libs. Removes any tests that use no_standard_libs:true where possible as there are duplicate tests for sdk_version:"none". Otherwise, switches them over to use sdk_version:"none". The androidmk mapping from LOCAL_NO_STANDARD_LIBRARIES to no_standard_libs has also been removed. There was little point in updating the tool to map it through to sdk_version:"none" as there are only a couple of places where it is used, in art's test running mk targets and in some unbundled packages to work around some limitation in .mk based build. Bug: 134566750 Test: m droid Change-Id: I6413c9b1fe3e63b93753a6a017d2981e32b7e013
This commit is contained in:
@@ -52,7 +52,6 @@ func createNeverAllows() []*rule {
|
||||
rules = append(rules, createTrebleRules()...)
|
||||
rules = append(rules, createLibcoreRules()...)
|
||||
rules = append(rules, createJavaDeviceForHostRules()...)
|
||||
rules = append(rules, createJavaLibraryHostRules()...)
|
||||
return rules
|
||||
}
|
||||
|
||||
@@ -101,13 +100,9 @@ func createLibcoreRules() []*rule {
|
||||
"development",
|
||||
}
|
||||
|
||||
// Core library constraints. The no_standard_libs can only be used in core
|
||||
// library projects. Access to core library targets is restricted using
|
||||
// visibility rules.
|
||||
// Core library constraints. The sdk_version: "none" can only be used in core library projects.
|
||||
// Access to core library targets is restricted using visibility rules.
|
||||
rules := []*rule{
|
||||
neverallow().
|
||||
notIn(coreLibraryProjects...).
|
||||
with("no_standard_libs", "true"),
|
||||
neverallow().
|
||||
notIn(coreLibraryProjects...).
|
||||
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) {
|
||||
m, ok := ctx.Module().(Module)
|
||||
if !ok {
|
||||
|
@@ -147,37 +147,6 @@ var neverallowTests = []struct {
|
||||
expectedError: "java_device_for_host can only be used in whitelisted projects",
|
||||
},
|
||||
// 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",
|
||||
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) {
|
||||
@@ -295,9 +252,8 @@ func (p *mockCcLibraryModule) GenerateAndroidBuildActions(ModuleContext) {
|
||||
}
|
||||
|
||||
type mockJavaLibraryProperties struct {
|
||||
Libs []string
|
||||
No_standard_libs *bool
|
||||
Sdk_version *string
|
||||
Libs []string
|
||||
Sdk_version *string
|
||||
}
|
||||
|
||||
type mockJavaLibraryModule struct {
|
||||
|
@@ -185,7 +185,6 @@ func init() {
|
||||
"LOCAL_NO_CRT": "nocrt",
|
||||
"LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
|
||||
"LOCAL_RTTI_FLAG": "rtti",
|
||||
"LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libs",
|
||||
"LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
|
||||
"LOCAL_TIDY": "tidy",
|
||||
"LOCAL_USE_CLANG_LLD": "use_clang_lld",
|
||||
|
@@ -517,10 +517,6 @@ func (a *AARImport) noFrameworkLibs() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *AARImport) noStandardLibs() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var _ AndroidLibraryDependency = (*AARImport)(nil)
|
||||
|
||||
func (a *AARImport) ExportPackage() android.Path {
|
||||
|
@@ -171,10 +171,6 @@ type JavadocProperties struct {
|
||||
// list of java libraries that will be in the classpath.
|
||||
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)
|
||||
No_framework_libs *bool
|
||||
|
||||
@@ -542,10 +538,6 @@ func (j *Javadoc) noFrameworkLibs() bool {
|
||||
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) {
|
||||
if ctx.Device() {
|
||||
sdkDep := decodeSdkDep(ctx, sdkContext(j))
|
||||
|
12
java/java.go
12
java/java.go
@@ -82,10 +82,6 @@ type CompilerProperties struct {
|
||||
// list of files that should be excluded from java_resources and java_resource_dirs
|
||||
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)
|
||||
No_framework_libs *bool
|
||||
|
||||
@@ -490,10 +486,6 @@ func (j *Module) noFrameworkLibs() bool {
|
||||
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) {
|
||||
if ctx.Device() {
|
||||
sdkDep := decodeSdkDep(ctx, sdkContext(j))
|
||||
@@ -513,8 +505,8 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
} else if j.deviceProperties.System_modules == nil {
|
||||
ctx.PropertyErrorf("no_standard_libs",
|
||||
"system_modules is required to be set when no_standard_libs is true, did you mean no_framework_libs?")
|
||||
ctx.PropertyErrorf("sdk_version",
|
||||
`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" {
|
||||
ctx.AddVariationDependencies(nil, systemModulesTag, *j.deviceProperties.System_modules)
|
||||
}
|
||||
|
@@ -1013,7 +1013,7 @@ func TestPatchModule(t *testing.T) {
|
||||
java_library {
|
||||
name: "bar",
|
||||
srcs: ["b.java"],
|
||||
no_standard_libs: true,
|
||||
sdk_version: "none",
|
||||
system_modules: "none",
|
||||
patch_module: "java.base",
|
||||
}
|
||||
|
12
java/sdk.go
12
java/sdk.go
@@ -45,9 +45,6 @@ type sdkContext interface {
|
||||
// targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set.
|
||||
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).
|
||||
noFrameworkLibs() bool
|
||||
}
|
||||
@@ -145,8 +142,7 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
||||
jars: android.Paths{jarPath.Path(), lambdaStubsPath},
|
||||
aidl: android.OptionalPathForPath(aidlPath.Path()),
|
||||
|
||||
// Pass values straight through for now to match previous behavior.
|
||||
noStandardLibs: sdkContext.noStandardLibs(),
|
||||
// Pass value straight through for now to match previous behavior.
|
||||
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
||||
}
|
||||
}
|
||||
@@ -159,8 +155,7 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
||||
frameworkResModule: r,
|
||||
aidl: android.OptionalPathForPath(aidl),
|
||||
|
||||
// Pass values straight through for now to match previous behavior.
|
||||
noStandardLibs: sdkContext.noStandardLibs(),
|
||||
// Pass value straight through for now to match previous behavior.
|
||||
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
||||
}
|
||||
|
||||
@@ -197,8 +192,7 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
|
||||
useDefaultLibs: true,
|
||||
frameworkResModule: "framework-res",
|
||||
|
||||
// Pass values straight through for now to match previous behavior.
|
||||
noStandardLibs: sdkContext.noStandardLibs(),
|
||||
// Pass value straight through for now to match previous behavior.
|
||||
noFrameworksLibs: sdkContext.noFrameworkLibs(),
|
||||
}
|
||||
case "none":
|
||||
|
@@ -385,7 +385,6 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.LoadHookContext, apiSc
|
||||
Device_specific *bool
|
||||
Product_specific *bool
|
||||
Compile_dex *bool
|
||||
No_standard_libs *bool
|
||||
System_modules *string
|
||||
Java_version *string
|
||||
Product_variables struct {
|
||||
|
@@ -111,14 +111,6 @@ func TestClasspath(t *testing.T) {
|
||||
bootclasspath: []string{"core.current.stubs", "core-lambda-stubs"},
|
||||
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",
|
||||
@@ -127,14 +119,6 @@ func TestClasspath(t *testing.T) {
|
||||
bootclasspath: []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",
|
||||
@@ -160,12 +144,6 @@ func TestClasspath(t *testing.T) {
|
||||
classpath: []string{},
|
||||
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",
|
||||
host: android.Host,
|
||||
|
@@ -64,7 +64,7 @@ func GatherRequiredDepsForTest() string {
|
||||
java_library {
|
||||
name: "framework",
|
||||
srcs: ["a.java"],
|
||||
no_standard_libs: true,
|
||||
sdk_version: "none",
|
||||
system_modules: "core-platform-api-stubs-system-modules",
|
||||
aidl: {
|
||||
export_include_dirs: ["framework/aidl"],
|
||||
@@ -79,7 +79,7 @@ func GatherRequiredDepsForTest() string {
|
||||
java_library {
|
||||
name: "android.hidl.base-V1.0-java",
|
||||
srcs: ["a.java"],
|
||||
no_standard_libs: true,
|
||||
sdk_version: "none",
|
||||
system_modules: "core-platform-api-stubs-system-modules",
|
||||
installable: true,
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func GatherRequiredDepsForTest() string {
|
||||
java_library {
|
||||
name: "android.hidl.manager-V1.0-java",
|
||||
srcs: ["a.java"],
|
||||
no_standard_libs: true,
|
||||
sdk_version: "none",
|
||||
system_modules: "core-platform-api-stubs-system-modules",
|
||||
installable: true,
|
||||
}
|
||||
@@ -95,7 +95,7 @@ func GatherRequiredDepsForTest() string {
|
||||
java_library {
|
||||
name: "org.apache.http.legacy",
|
||||
srcs: ["a.java"],
|
||||
no_standard_libs: true,
|
||||
sdk_version: "none",
|
||||
system_modules: "core-platform-api-stubs-system-modules",
|
||||
installable: true,
|
||||
}
|
||||
|
Reference in New Issue
Block a user