diff options
author | Dan Willemsen <dwillemsen@google.com> | 2017-10-05 13:28:16 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2017-11-03 13:40:08 -0700 |
commit | 47e44a4c5c9c814891ab57267c249ef8e41a7c38 (patch) | |
tree | e128910722ab1c31323b4715204eef0b752cb1e5 | |
parent | f9e621603b769401732adfdfda1d509d27190cc7 (diff) | |
download | build_soong-47e44a4c5c9c814891ab57267c249ef8e41a7c38.tar.gz build_soong-47e44a4c5c9c814891ab57267c249ef8e41a7c38.tar.bz2 build_soong-47e44a4c5c9c814891ab57267c249ef8e41a7c38.zip |
pom2mk: Add a flag to specify a specific version of artifacts
For repositories that contain multiple versions of the same artifact,
we'd only like to create makefiles for one of the versions of the
artifact.
Bug: 64723465
Test: cd prebuilts/maven_repo/android; pom2mk -use-version 25.3.1 com/android/support
Change-Id: I5bdbba8d2143a47610d56d679381eb01b3cf176d
-rw-r--r-- | cmd/pom2mk/pom2mk.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/pom2mk/pom2mk.go b/cmd/pom2mk/pom2mk.go index e6144a56..a2297f48 100644 --- a/cmd/pom2mk/pom2mk.go +++ b/cmd/pom2mk/pom2mk.go @@ -84,6 +84,8 @@ func (d ExtraDeps) Set(v string) error { var extraDeps = make(ExtraDeps) +var useVersion string + type Dependency struct { XMLName xml.Name `xml:"dependency"` @@ -152,6 +154,10 @@ func convert(filename string, out io.Writer) error { return err } + if useVersion != "" && pom.Version != useVersion { + return nil + } + if pom.Packaging == "" { pom.Packaging = "jar" } @@ -178,6 +184,9 @@ Usage: %s [--rewrite <regex>=<replace>] [--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). This may be specified multiple times to declare these dependencies. + -use-version <version> + If the maven directory contains multiple versions of artifacts and their pom files, + -use-version can be used to only write makefiles for a specific version of those artifacts. <dir> The directory to search for *.pom files under. @@ -187,6 +196,7 @@ The makefile is written to stdout, to be put in the current directory (often as 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(&useVersion, "use-version", "", "Only read artifacts of a specific version") flag.Parse() if flag.NArg() != 1 { |