summaryrefslogtreecommitdiff
path: root/android/paths.go
diff options
context:
space:
mode:
author Chris Wailes <chriswailes@google.com> 2021-07-30 13:25:42 -0700
committer Chris Wailes <chriswailes@google.com> 2021-08-02 11:50:34 -0700
commitb2703adce4c5d69ff0b3334dd4cca0583c2d82c6 (patch)
treeb2d078464a75fb68d0ccffb95defcef1114d18c7 /android/paths.go
parent067b88976206266082762a3ba757088b7db83ab6 (diff)
Conditionally apply rustdoc flags to third party crates
This CL changes the logic in rust/builder.go so that some rustdoc flags are only applied to external crates. This will allow us to since warnings and deal with soft-failures in external crates while allowing us to be more strict with our internal Rust code. Bug: 195136952 Test: m rustdoc Change-Id: Icdde304bbbb323cae9657e8f842f58ae79e811ce
Diffstat (limited to 'android/paths.go')
-rw-r--r--android/paths.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/android/paths.go b/android/paths.go
index 99db22f6e..9c9914e33 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -20,6 +20,7 @@ import (
"os"
"path/filepath"
"reflect"
+ "regexp"
"sort"
"strings"
@@ -2094,3 +2095,25 @@ func PathsIfNonNil(paths ...Path) Paths {
}
return ret
}
+
+var thirdPartyDirPrefixExceptions = []*regexp.Regexp{
+ regexp.MustCompile("^vendor/[^/]*google[^/]*/"),
+ regexp.MustCompile("^hardware/google/"),
+ regexp.MustCompile("^hardware/interfaces/"),
+ regexp.MustCompile("^hardware/libhardware[^/]*/"),
+ regexp.MustCompile("^hardware/ril/"),
+}
+
+func IsThirdPartyPath(path string) bool {
+ thirdPartyDirPrefixes := []string{"external/", "vendor/", "hardware/"}
+
+ if HasAnyPrefix(path, thirdPartyDirPrefixes) {
+ for _, prefix := range thirdPartyDirPrefixExceptions {
+ if prefix.MatchString(path) {
+ return false
+ }
+ }
+ return true
+ }
+ return false
+}