Add sdk_version:"none" to replace no_standard_libs:true
Where possible this duplicates any tests that use no_standard_libs:true
with ones that use sdk_version:"none". If not possible (e.g. in the
default targets included in java/testing.go) it switches some to use
sdk_version:"none" to ensure that there is no regression in the
behavior of no_standard_libs:true.
Follow up changes will switch all usages of no_standard_libs:true over
to use sdk_version:"none" at which point no_standard_libs will be
removed.
Bug: 134566750
Test: m droid
Change-Id: I5f0fd3daa980f6b223abe454cba7f25a97a39d7a
diff --git a/android/neverallow_test.go b/android/neverallow_test.go
index 9c43d53..62c5142 100644
--- a/android/neverallow_test.go
+++ b/android/neverallow_test.go
@@ -178,6 +178,37 @@
}`),
},
},
+ {
+ name: "sdk_version: \"none\" inside core libraries",
+ fs: map[string][]byte{
+ "libcore/Blueprints": []byte(`
+ java_library {
+ name: "inside_core_libraries",
+ sdk_version: "none",
+ }`),
+ },
+ },
+ {
+ name: "sdk_version: \"none\" outside core libraries",
+ fs: map[string][]byte{
+ "Blueprints": []byte(`
+ java_library {
+ name: "outside_core_libraries",
+ sdk_version: "none",
+ }`),
+ },
+ expectedError: "module \"outside_core_libraries\": violates neverallow",
+ },
+ {
+ name: "sdk_version: \"current\"",
+ fs: map[string][]byte{
+ "Blueprints": []byte(`
+ java_library {
+ name: "outside_core_libraries",
+ sdk_version: "current",
+ }`),
+ },
+ },
// java_library_host rule tests
{
name: "java_library_host with no_standard_libs: true",
@@ -266,6 +297,7 @@
type mockJavaLibraryProperties struct {
Libs []string
No_standard_libs *bool
+ Sdk_version *string
}
type mockJavaLibraryModule struct {