Merge "pom2mk: Allow setting LOCAL_SDK_VERSION" am: dbe8b78a5d am: 1bf562160b

am: 2409facf73

Change-Id: Ib77a2e8bf77afe9b19c26316dd90ae45b877f080
This commit is contained in:
Dan Willemsen 2017-11-11 00:03:01 +00:00 committed by android-build-merger
commit 44df8d97a5
1 changed files with 9 additions and 0 deletions

View File

@ -83,6 +83,7 @@ func (d ExtraDeps) Set(v string) error {
var extraDeps = make(ExtraDeps) var extraDeps = make(ExtraDeps)
var sdkVersion string
var useVersion string var useVersion string
type Dependency struct { type Dependency struct {
@ -127,6 +128,10 @@ func (p Pom) MkDeps() []string {
return ret return ret
} }
func (p Pom) SdkVersion() string {
return sdkVersion
}
func (p *Pom) FixDepTypes(modules map[string]*Pom) { func (p *Pom) FixDepTypes(modules map[string]*Pom) {
for _, d := range p.Dependencies { for _, d := range p.Dependencies {
if d.Type != "" { if d.Type != "" {
@ -147,6 +152,7 @@ LOCAL_SRC_FILES := {{.ArtifactFile}}
LOCAL_BUILT_MODULE_STEM := javalib.jar LOCAL_BUILT_MODULE_STEM := javalib.jar
LOCAL_MODULE_SUFFIX := .{{.Packaging}} LOCAL_MODULE_SUFFIX := .{{.Packaging}}
LOCAL_USE_AAPT2 := true LOCAL_USE_AAPT2 := true
LOCAL_SDK_VERSION := {{.SdkVersion}}
LOCAL_STATIC_ANDROID_LIBRARIES := \ LOCAL_STATIC_ANDROID_LIBRARIES := \
{{range .MkDeps}} {{.}} \ {{range .MkDeps}} {{.}} \
{{end}} {{end}}
@ -196,6 +202,8 @@ Usage: %s [--rewrite <regex>=<replace>] [--extra-deps <module>=<module>[,<module
Some Android.mk modules have transitive dependencies that must be specified when they are 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). depended upon (like android-support-v7-mediarouter requires android-support-v7-appcompat).
This may be specified multiple times to declare these dependencies. This may be specified multiple times to declare these dependencies.
-sdk-version <version>
Sets LOCAL_SDK_VERSION := <version> for all modules.
-use-version <version> -use-version <version>
If the maven directory contains multiple versions of artifacts and their pom files, 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. -use-version can be used to only write makefiles for a specific version of those artifacts.
@ -208,6 +216,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(&extraDeps, "extra-deps", "Extra dependencies needed when depending on a module")
flag.Var(&rewriteNames, "rewrite", "Regex(es) to rewrite artifact names") flag.Var(&rewriteNames, "rewrite", "Regex(es) to rewrite artifact names")
flag.StringVar(&sdkVersion, "sdk-version", "", "What to write to LOCAL_SDK_VERSION")
flag.StringVar(&useVersion, "use-version", "", "Only read artifacts of a specific version") flag.StringVar(&useVersion, "use-version", "", "Only read artifacts of a specific version")
flag.Parse() flag.Parse()