aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-06-22 17:20:19 -0700
committerColin Cross <ccross@android.com>2017-06-23 11:24:54 -0700
commit3e3e72da90ab94f0a763b6b53567ff335c9e1b3e (patch)
tree78b631c43d76222544b95ff1cd4a3cb040aef69d
parent540eff8e5fcabe9db02b00bdc82fd28632ba5835 (diff)
downloadbuild_soong-3e3e72da90ab94f0a763b6b53567ff335c9e1b3e.tar.gz
build_soong-3e3e72da90ab94f0a763b6b53567ff335c9e1b3e.tar.bz2
build_soong-3e3e72da90ab94f0a763b6b53567ff335c9e1b3e.zip
Add java config and share it with make
Add a java/config package to hold config information, and share it with make through makevars. Test: builds Change-Id: I46c088bda0fe97a1823bfdd80fa692d0bf61da1b
-rw-r--r--Android.bp14
-rw-r--r--java/config/config.go23
-rw-r--r--java/config/makevars.go29
-rw-r--r--java/java.go7
4 files changed, 69 insertions, 4 deletions
diff --git a/Android.bp b/Android.bp
index c571e744..1eac394a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -188,6 +188,7 @@ bootstrap_go_package {
"soong",
"soong-android",
"soong-genrule",
+ "soong-java-config",
],
srcs: [
"java/androidmk.go",
@@ -202,6 +203,19 @@ bootstrap_go_package {
}
bootstrap_go_package {
+ name: "soong-java-config",
+ pkgPath: "android/soong/java/config",
+ deps: [
+ "blueprint-proptools",
+ "soong-android",
+ ],
+ srcs: [
+ "java/config/config.go",
+ "java/config/makevars.go",
+ ],
+}
+
+bootstrap_go_package {
name: "soong-python",
pkgPath: "android/soong/python",
deps: [
diff --git a/java/config/config.go b/java/config/config.go
new file mode 100644
index 00000000..848d09d1
--- /dev/null
+++ b/java/config/config.go
@@ -0,0 +1,23 @@
+// Copyright 2017 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package config
+
+import "android/soong/android"
+
+var (
+ DefaultLibraries = []string{"core-oj", "core-libart", "ext", "framework", "okhttp"}
+)
+
+var pctx = android.NewPackageContext("android/soong/java/config")
diff --git a/java/config/makevars.go b/java/config/makevars.go
new file mode 100644
index 00000000..67024543
--- /dev/null
+++ b/java/config/makevars.go
@@ -0,0 +1,29 @@
+// Copyright 2017 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package config
+
+import (
+ "strings"
+
+ "android/soong/android"
+)
+
+func init() {
+ android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
+}
+
+func makeVarsProvider(ctx android.MakeVarsContext) {
+ ctx.Strict("TARGET_DEFAULT_JAVA_LIBRARIES", strings.Join(DefaultLibraries, " "))
+}
diff --git a/java/java.go b/java/java.go
index 01a05f07..20661c47 100644
--- a/java/java.go
+++ b/java/java.go
@@ -26,6 +26,7 @@ import (
"android/soong/android"
"android/soong/genrule"
+ "android/soong/java/config"
)
func init() {
@@ -169,8 +170,6 @@ func (j *Module) BootClasspath(ctx android.BaseContext) string {
}
}
-var defaultJavaLibraries = []string{"core-libart", "legacy-test", "ext", "framework"}
-
func (j *Module) deps(ctx android.BottomUpMutatorContext) {
var deps []string
@@ -180,7 +179,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
deps = append(deps, bootClasspath)
}
if ctx.Device() && j.deviceProperties.Sdk_version == "" {
- deps = append(deps, defaultJavaLibraries...)
+ deps = append(deps, config.DefaultLibraries...)
}
}
deps = append(deps, j.properties.Java_libs...)
@@ -218,7 +217,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) (classpath android.Paths
if javaDep, ok := module.(JavaDependency); ok {
if otherName == j.BootClasspath(ctx) {
bootClasspath = android.OptionalPathForPath(javaDep.ClasspathFile())
- } else if inList(otherName, defaultJavaLibraries) {
+ } else if inList(otherName, config.DefaultLibraries) {
classpath = append(classpath, javaDep.ClasspathFile())
} else if inList(otherName, j.properties.Java_libs) {
classpath = append(classpath, javaDep.ClasspathFile())