From e169ad70a51a554756bdd520e1b0db3433d92dc8 Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Wed, 18 Sep 2019 08:42:54 -0700 Subject: [PATCH] Add OWNERS for Rust whitelist. Splits out the Rust paths whitelist into a separate file under config/ so that OWNERS can be defined for it. Bug: 141207129 Test: m -j crosvm.experimental Change-Id: I5effa6783e5c47560b4b1eae12ad0eb9e9ba96fe --- Android.bp | 1 + OWNERS | 1 + rust/config/whitelist.go | 21 +++++++++++++++++++++ rust/rust.go | 21 ++------------------- 4 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 rust/config/whitelist.go diff --git a/Android.bp b/Android.bp index 25038c653..89a171178 100644 --- a/Android.bp +++ b/Android.bp @@ -334,6 +334,7 @@ bootstrap_go_package { srcs: [ "rust/config/global.go", "rust/config/toolchain.go", + "rust/config/whitelist.go", "rust/config/x86_linux_host.go", "rust/config/x86_64_device.go", ], diff --git a/OWNERS b/OWNERS index 4ae045d04..9f0fcf26e 100644 --- a/OWNERS +++ b/OWNERS @@ -4,3 +4,4 @@ per-file ndk_*.go, *gen_stub_libs.py = danalbert@google.com per-file clang.go,global.go = srhines@google.com, chh@google.com, pirama@google.com, yikong@google.com per-file tidy.go = srhines@google.com, chh@google.com per-file lto.go,pgo.go = srhines@google.com, pirama@google.com, yikong@google.com +per-file rust/config/whitelist.go = ivanlozano@google.com, jeffv@google.com, jgalenson@google.com, srhines@google.com diff --git a/rust/config/whitelist.go b/rust/config/whitelist.go new file mode 100644 index 000000000..464626424 --- /dev/null +++ b/rust/config/whitelist.go @@ -0,0 +1,21 @@ +package config + +var ( + RustAllowedPaths = []string{ + "external/rust/crates", + "external/crosvm", + "external/adhd", + } + + RustModuleTypes = []string{ + "rust_binary", + "rust_binary_host", + "rust_library", + "rust_library_dylib", + "rust_library_rlib", + "rust_library_host", + "rust_library_host_dylib", + "rust_library_host_rlib", + "rust_proc_macro", + } +) diff --git a/rust/rust.go b/rust/rust.go index 7cc0b2c3b..212091662 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -29,28 +29,11 @@ var pctx = android.NewPackageContext("android/soong/rust") func init() { // Only allow rust modules to be defined for certain projects - rustModuleTypes := []string{ - "rust_binary", - "rust_binary_host", - "rust_library", - "rust_library_dylib", - "rust_library_rlib", - "rust_library_host", - "rust_library_host_dylib", - "rust_library_host_rlib", - "rust_proc_macro", - } - - rustAllowedPaths := []string{ - "external/rust/crates", - "external/crosvm", - "external/adhd", - } android.AddNeverAllowRules( android.NeverAllow(). - NotIn(rustAllowedPaths...). - ModuleType(rustModuleTypes...)) + NotIn(config.RustAllowedPaths...). + ModuleType(config.RustModuleTypes...)) android.RegisterModuleType("rust_defaults", defaultsFactory) android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {