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
diff --git a/android/neverallow.go b/android/neverallow.go
index f751389..f35d1fe 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -52,7 +52,6 @@
rules = append(rules, createTrebleRules()...)
rules = append(rules, createLibcoreRules()...)
rules = append(rules, createJavaDeviceForHostRules()...)
- rules = append(rules, createJavaLibraryHostRules()...)
return rules
}
@@ -101,15 +100,11 @@
"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 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 {
diff --git a/android/neverallow_test.go b/android/neverallow_test.go
index 62c5142..ee3c94f 100644
--- a/android/neverallow_test.go
+++ b/android/neverallow_test.go
@@ -148,37 +148,6 @@
},
// 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{
"libcore/Blueprints": []byte(`
@@ -209,18 +178,6 @@
}`),
},
},
- // 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 @@
}
type mockJavaLibraryProperties struct {
- Libs []string
- No_standard_libs *bool
- Sdk_version *string
+ Libs []string
+ Sdk_version *string
}
type mockJavaLibraryModule struct {