From 15a8e793f3dc54dbefd3f1fae8eea0a8919e606b Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 10 Nov 2017 14:02:44 -0800 Subject: [PATCH] pom2mk: Allow setting LOCAL_SDK_VERSION For unbundled builds, LOCAL_SDK_VERSION needs to be set, otherwise we'll try to use frameworks-res, which isn't available. Bug: 64723465 Test: Use with prebuilts/sdk/update_current.py Change-Id: If5e1233b4bcb09b3d0e2251e8dd1a8ecfc87eb19 --- cmd/pom2mk/pom2mk.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/pom2mk/pom2mk.go b/cmd/pom2mk/pom2mk.go index ac29a2a98..4596db966 100644 --- a/cmd/pom2mk/pom2mk.go +++ b/cmd/pom2mk/pom2mk.go @@ -83,6 +83,7 @@ func (d ExtraDeps) Set(v string) error { var extraDeps = make(ExtraDeps) +var sdkVersion string var useVersion string type Dependency struct { @@ -127,6 +128,10 @@ func (p Pom) MkDeps() []string { return ret } +func (p Pom) SdkVersion() string { + return sdkVersion +} + func (p *Pom) FixDepTypes(modules map[string]*Pom) { for _, d := range p.Dependencies { if d.Type != "" { @@ -147,6 +152,7 @@ LOCAL_SRC_FILES := {{.ArtifactFile}} LOCAL_BUILT_MODULE_STEM := javalib.jar LOCAL_MODULE_SUFFIX := .{{.Packaging}} LOCAL_USE_AAPT2 := true +LOCAL_SDK_VERSION := {{.SdkVersion}} LOCAL_STATIC_ANDROID_LIBRARIES := \ {{range .MkDeps}} {{.}} \ {{end}} @@ -196,6 +202,8 @@ Usage: %s [--rewrite =] [--extra-deps =[, + Sets LOCAL_SDK_VERSION := for all modules. -use-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. @@ -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(&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.Parse()