Merge "libclang_rt_prebuilt_library_shared mixed builds"
diff --git a/android/config.go b/android/config.go
index 4472036..afc138b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -658,6 +658,10 @@
return value == "0" || value == "n" || value == "no" || value == "off" || value == "false"
}
+func (c *config) TargetsJava11() bool {
+ return c.IsEnvTrue("EXPERIMENTAL_TARGET_JAVA_VERSION_11")
+}
+
// EnvDeps returns the environment variables this build depends on. The first
// call to this function blocks future reads from the environment.
func (c *config) EnvDeps() map[string]string {
diff --git a/apex/apex.go b/apex/apex.go
index 2064663..3051553 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -3211,8 +3211,15 @@
WithMatcher("permitted_packages", android.NotInList(module_packages)).
WithMatcher("min_sdk_version", android.LessThanSdkVersion("Tiramisu")).
Because("jars that are part of the " + module_name +
- " module may only allow these packages: " + strings.Join(module_packages, ",") +
- " with min_sdk < T. Please jarjar or move code around.")
+ " module may only use these package prefixes: " + strings.Join(module_packages, ",") +
+ " with min_sdk < T. Please consider the following alternatives:\n" +
+ " 1. If the offending code is from a statically linked library, consider " +
+ "removing that dependency and using an alternative already in the " +
+ "bootclasspath, or perhaps a shared library." +
+ " 2. Move the offending code into an allowed package.\n" +
+ " 3. Jarjar the offending code. Please be mindful of the potential system " +
+ "health implications of bundling that code, particularly if the offending jar " +
+ "is part of the bootclasspath.")
rules = append(rules, permittedPackagesRule)
}
return rules
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 7be8867..c546fa1 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -7464,7 +7464,7 @@
},
{
name: "Bootclasspath apex jar not satisfying allowed module packages on Q.",
- expectedError: `(?s)module "bcp_lib2" .* which is restricted because jars that are part of the myapex module may only allow these packages: foo.bar with min_sdk < T. Please jarjar or move code around.`,
+ expectedError: `(?s)module "bcp_lib2" .* which is restricted because jars that are part of the myapex module may only use these package prefixes: foo.bar with min_sdk < T. Please consider the following alternatives:\n 1. If the offending code is from a statically linked library, consider removing that dependency and using an alternative already in the bootclasspath, or perhaps a shared library. 2. Move the offending code into an allowed package.\n 3. Jarjar the offending code. Please be mindful of the potential system health implications of bundling that code, particularly if the offending jar is part of the bootclasspath.`,
bp: `
java_library {
name: "bcp_lib1",
@@ -7501,7 +7501,7 @@
},
{
name: "Bootclasspath apex jar not satisfying allowed module packages on R.",
- expectedError: `(?s)module "bcp_lib2" .* which is restricted because jars that are part of the myapex module may only allow these packages: foo.bar with min_sdk < T. Please jarjar or move code around.`,
+ expectedError: `(?s)module "bcp_lib2" .* which is restricted because jars that are part of the myapex module may only use these package prefixes: foo.bar with min_sdk < T. Please consider the following alternatives:\n 1. If the offending code is from a statically linked library, consider removing that dependency and using an alternative already in the bootclasspath, or perhaps a shared library. 2. Move the offending code into an allowed package.\n 3. Jarjar the offending code. Please be mindful of the potential system health implications of bundling that code, particularly if the offending jar is part of the bootclasspath.`,
bp: `
java_library {
name: "bcp_lib1",
diff --git a/java/base.go b/java/base.go
index a3eb8de..63328c8 100644
--- a/java/base.go
+++ b/java/base.go
@@ -122,6 +122,14 @@
Javacflags []string
}
+ Openjdk11 struct {
+ // List of source files that should only be used when passing -source 1.9 or higher
+ Srcs []string `android:"path"`
+
+ // List of javac flags that should only be used when passing -source 1.9 or higher
+ Javacflags []string
+ }
+
// When compiling language level 9+ .java code in packages that are part of
// a system module, patch_module names the module that your sources and
// dependencies should be patched into. The Android runtime currently
@@ -968,6 +976,9 @@
if flags.javaVersion.usesJavaModules() {
j.properties.Srcs = append(j.properties.Srcs, j.properties.Openjdk9.Srcs...)
}
+ if ctx.Config().TargetsJava11() {
+ j.properties.Srcs = append(j.properties.Srcs, j.properties.Openjdk11.Srcs...)
+ }
srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
if hasSrcExt(srcFiles.Strings(), ".proto") {
diff --git a/java/java.go b/java/java.go
index e3e9721..bb7c32b 100644
--- a/java/java.go
+++ b/java/java.go
@@ -450,8 +450,14 @@
return normalizeJavaVersion(ctx, javaVersion)
} else if ctx.Device() {
return defaultJavaLanguageVersion(ctx, sdkContext.SdkVersion(ctx))
- } else {
+ } else if ctx.Config().TargetsJava11() {
+ // Temporary experimental flag to be able to try and build with
+ // java version 11 options. The flag, if used, just sets Java
+ // 11 as the default version, leaving any components that
+ // target an older version intact.
return JAVA_VERSION_11
+ } else {
+ return JAVA_VERSION_9
}
}
diff --git a/java/sdk.go b/java/sdk.go
index 0dddd40..756a24d 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -55,10 +55,14 @@
return JAVA_VERSION_7
} else if sdk.FinalOrFutureInt() <= 29 {
return JAVA_VERSION_8
- } else if sdk.FinalOrFutureInt() <= 31 {
- return JAVA_VERSION_9
- } else {
+ } else if ctx.Config().TargetsJava11() {
+ // Temporary experimental flag to be able to try and build with
+ // java version 11 options. The flag, if used, just sets Java
+ // 11 as the default version, leaving any components that
+ // target an older version intact.
return JAVA_VERSION_11
+ } else {
+ return JAVA_VERSION_9
}
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 57ab268..7849f96 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1392,6 +1392,10 @@
Srcs []string
Javacflags []string
}
+ Openjdk11 struct {
+ Srcs []string
+ Javacflags []string
+ }
Dist struct {
Targets []string
Dest *string
@@ -1418,6 +1422,8 @@
}
props.Openjdk9.Srcs = module.properties.Openjdk9.Srcs
props.Openjdk9.Javacflags = module.properties.Openjdk9.Javacflags
+ props.Openjdk11.Srcs = module.properties.Openjdk11.Srcs
+ props.Openjdk11.Javacflags = module.properties.Openjdk11.Javacflags
// We compile the stubs for 1.8 in line with the main android.jar stubs, and potential
// interop with older developer tools that don't support 1.9.
props.Java_version = proptools.StringPtr("1.8")
diff --git a/licenses/LICENSE b/licenses/LICENSE
index dae0406..d645695 100644
--- a/licenses/LICENSE
+++ b/licenses/LICENSE
@@ -1,16 +1,4 @@
- Copyright (c) The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
-
- 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.
-
-
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/