Loading android/neverallow.go +0 −33 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ var neverallows = []Rule{} func init() { AddNeverAllowRules(createIncludeDirsRules()...) AddNeverAllowRules(createTrebleRules()...) AddNeverAllowRules(createLibcoreRules()...) AddNeverAllowRules(createMediaRules()...) AddNeverAllowRules(createJavaDeviceForHostRules()...) AddNeverAllowRules(createCcSdkVariantRules()...) Loading Loading @@ -133,38 +132,6 @@ func createTrebleRules() []Rule { } } func createLibcoreRules() []Rule { var coreLibraryProjects = []string{ "libcore", "external/apache-harmony", "external/apache-xml", "external/bouncycastle", "external/conscrypt", "external/icu", "external/okhttp", "external/wycheproof", "prebuilts", } // Additional whitelisted path only used for ART testing, which needs access to core library // targets. This does not affect the contents of a device image (system, vendor, etc.). var artTests = []string{ "art/test", } // Core library constraints. The sdk_version: "none" can only be used in core library projects and ART tests. // Access to core library targets is restricted using visibility rules. rules := []Rule{ NeverAllow(). NotIn(coreLibraryProjects...). NotIn(artTests...). With("sdk_version", "none"). WithoutMatcher("name", Regexp("^android_.*stubs_current$")), } return rules } func createMediaRules() []Rule { return []Rule{ NeverAllow(). Loading android/neverallow_test.go +0 −44 Original line number Diff line number Diff line Loading @@ -215,50 +215,6 @@ var neverallowTests = []struct { "java_device_for_host can only be used in allowed projects", }, }, // Libcore rule tests { name: "sdk_version: \"none\" inside core libraries", fs: map[string][]byte{ "libcore/Android.bp": []byte(` java_library { name: "inside_core_libraries", sdk_version: "none", }`), }, }, { name: "sdk_version: \"none\" on android_*stubs_current stub", fs: map[string][]byte{ "frameworks/base/Android.bp": []byte(` java_library { name: "android_stubs_current", sdk_version: "none", }`), }, }, { name: "sdk_version: \"none\" outside core libraries", fs: map[string][]byte{ "Android.bp": []byte(` java_library { name: "outside_core_libraries", sdk_version: "none", }`), }, expectedErrors: []string{ "module \"outside_core_libraries\": violates neverallow", }, }, { name: "sdk_version: \"current\"", fs: map[string][]byte{ "Android.bp": []byte(` java_library { name: "outside_core_libraries", sdk_version: "current", }`), }, }, // CC sdk rule tests { name: `"sdk_variant_only" outside allowed list`, Loading Loading
android/neverallow.go +0 −33 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ var neverallows = []Rule{} func init() { AddNeverAllowRules(createIncludeDirsRules()...) AddNeverAllowRules(createTrebleRules()...) AddNeverAllowRules(createLibcoreRules()...) AddNeverAllowRules(createMediaRules()...) AddNeverAllowRules(createJavaDeviceForHostRules()...) AddNeverAllowRules(createCcSdkVariantRules()...) Loading Loading @@ -133,38 +132,6 @@ func createTrebleRules() []Rule { } } func createLibcoreRules() []Rule { var coreLibraryProjects = []string{ "libcore", "external/apache-harmony", "external/apache-xml", "external/bouncycastle", "external/conscrypt", "external/icu", "external/okhttp", "external/wycheproof", "prebuilts", } // Additional whitelisted path only used for ART testing, which needs access to core library // targets. This does not affect the contents of a device image (system, vendor, etc.). var artTests = []string{ "art/test", } // Core library constraints. The sdk_version: "none" can only be used in core library projects and ART tests. // Access to core library targets is restricted using visibility rules. rules := []Rule{ NeverAllow(). NotIn(coreLibraryProjects...). NotIn(artTests...). With("sdk_version", "none"). WithoutMatcher("name", Regexp("^android_.*stubs_current$")), } return rules } func createMediaRules() []Rule { return []Rule{ NeverAllow(). Loading
android/neverallow_test.go +0 −44 Original line number Diff line number Diff line Loading @@ -215,50 +215,6 @@ var neverallowTests = []struct { "java_device_for_host can only be used in allowed projects", }, }, // Libcore rule tests { name: "sdk_version: \"none\" inside core libraries", fs: map[string][]byte{ "libcore/Android.bp": []byte(` java_library { name: "inside_core_libraries", sdk_version: "none", }`), }, }, { name: "sdk_version: \"none\" on android_*stubs_current stub", fs: map[string][]byte{ "frameworks/base/Android.bp": []byte(` java_library { name: "android_stubs_current", sdk_version: "none", }`), }, }, { name: "sdk_version: \"none\" outside core libraries", fs: map[string][]byte{ "Android.bp": []byte(` java_library { name: "outside_core_libraries", sdk_version: "none", }`), }, expectedErrors: []string{ "module \"outside_core_libraries\": violates neverallow", }, }, { name: "sdk_version: \"current\"", fs: map[string][]byte{ "Android.bp": []byte(` java_library { name: "outside_core_libraries", sdk_version: "current", }`), }, }, // CC sdk rule tests { name: `"sdk_variant_only" outside allowed list`, Loading