diff options
author | Colin Cross <ccross@android.com> | 2018-04-19 22:44:16 -0700 |
---|---|---|
committer | Jeff Gaston <jeffrygaston@google.com> | 2018-04-26 13:24:51 -0400 |
commit | 8a32a05989ab6c6a675ae8e0d05104c398e774a4 (patch) | |
tree | 7a0583bf210354e9adedf0728446f24e4ad0af4b | |
parent | f84c8636d38582896e577c530a491c15e7fe1626 (diff) | |
download | build_soong-8a32a05989ab6c6a675ae8e0d05104c398e774a4.tar.gz build_soong-8a32a05989ab6c6a675ae8e0d05104c398e774a4.tar.bz2 build_soong-8a32a05989ab6c6a675ae8e0d05104c398e774a4.zip |
Add pom2mk -exclude
Add an option to pom2mk to exclude modules by name.
Bug: 78300023
Test: cd prebuilts/sdk/current/support && pom2mk -regen Android.mk -exclude androidx.car_car
Change-Id: I083907ef364384aace524ced81820567f5075d76
Merged-In: I083907ef364384aace524ced81820567f5075d76
(manually cherry-picked from c7453caf2c0a94192d0f722f26e9552da953ef8f)
-rw-r--r-- | cmd/pom2mk/pom2mk.go | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cmd/pom2mk/pom2mk.go b/cmd/pom2mk/pom2mk.go index d6a50210..57416243 100644 --- a/cmd/pom2mk/pom2mk.go +++ b/cmd/pom2mk/pom2mk.go @@ -88,6 +88,19 @@ func (d ExtraDeps) Set(v string) error { var extraDeps = make(ExtraDeps) +type Exclude map[string]bool + +func (e Exclude) String() string { + return "" +} + +func (e Exclude) Set(v string) error { + e[v] = true + return nil +} + +var excludes = make(Exclude) + var sdkVersion string var useVersion string var staticDeps bool @@ -333,7 +346,7 @@ func main() { The tool will extract the necessary information from *.pom files to create an Android.mk whose aar libraries can be linked against when using AAPT2. -Usage: %s [--rewrite <regex>=<replace>] [--extra-deps <module>=<module>[,<module>]] [<dir>] [-regen <file>] +Usage: %s [--rewrite <regex>=<replace>] [-exclude <module>] [--extra-deps <module>=<module>[,<module>]] [<dir>] [-regen <file>] -rewrite <regex>=<replace> rewrite can be used to specify mappings between Maven projects and Make modules. The -rewrite @@ -341,6 +354,8 @@ Usage: %s [--rewrite <regex>=<replace>] [--extra-deps <module>=<module>[,<module project, mappings are searched in the order they were specified. The first <regex> matching either the Maven project's <groupId>:<artifactId> or <artifactId> will be used to generate the Make module name using <replace>. If no matches are found, <artifactId> is used. + -exclude <module> + Don't put the specified module in the makefile. -extra-deps <module>=<module>[,<module>] Some Android.mk modules have transitive dependencies that must be specified when they are depended upon (like android-support-v7-mediarouter requires android-support-v7-appcompat). @@ -362,6 +377,7 @@ Usage: %s [--rewrite <regex>=<replace>] [--extra-deps <module>=<module>[,<module var regen string + flag.Var(&excludes, "exclude", "Exclude module") flag.Var(&extraDeps, "extra-deps", "Extra dependencies needed when depending on a module") flag.Var(&rewriteNames, "rewrite", "Regex(es) to rewrite artifact names") flag.StringVar(&sdkVersion, "sdk-version", "", "What to write to LOCAL_SDK_VERSION") @@ -444,14 +460,17 @@ Usage: %s [--rewrite <regex>=<replace>] [--extra-deps <module>=<module>[,<module } if pom != nil { - poms = append(poms, pom) key := pom.MkName() + if excludes[key] { + continue + } if old, ok := modules[key]; ok { fmt.Fprintln(os.Stderr, "Module", key, "defined twice:", old.PomFile, pom.PomFile) duplicate = true } + poms = append(poms, pom) modules[key] = pom } } |