summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/config/kotlin.go7
-rw-r--r--java/dex.go10
-rw-r--r--java/kotlin.go5
-rw-r--r--java/ravenwood.go20
-rw-r--r--java/ravenwood_test.go59
-rw-r--r--java/sdk_library.go16
6 files changed, 77 insertions, 40 deletions
diff --git a/java/config/kotlin.go b/java/config/kotlin.go
index e5e187cad..302d021db 100644
--- a/java/config/kotlin.go
+++ b/java/config/kotlin.go
@@ -50,4 +50,11 @@ func init() {
}, " "))
pctx.StaticVariable("KotlincGlobalFlags", strings.Join([]string{}, " "))
+ // Use KotlincKytheGlobalFlags to prevent kotlinc version skew issues between android and
+ // g3 kythe indexers.
+ // This is necessary because there might be instances of kotlin code in android
+ // platform that are not fully compatible with the kotlinc used in g3 kythe indexers.
+ // e.g. uninitialized variables are a warning in 1.*, but an error in 2.*
+ // https://github.com/JetBrains/kotlin/blob/master/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt#L748
+ pctx.StaticVariable("KotlincKytheGlobalFlags", strings.Join([]string{"-language-version 1.9"}, " "))
}
diff --git a/java/dex.go b/java/dex.go
index 7d42efc9c..9d12b9ac4 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -245,6 +245,16 @@ func (d *dexer) dexCommonFlags(ctx android.ModuleContext,
if err != nil {
ctx.PropertyErrorf("min_sdk_version", "%s", err)
}
+ if !Bool(d.dexProperties.No_dex_container) && effectiveVersion.FinalOrFutureInt() >= 36 {
+ // W is 36, but we have not bumped the SDK version yet, so check for both.
+ if ctx.Config().PlatformSdkVersion().FinalInt() >= 36 ||
+ ctx.Config().PlatformSdkCodename() == "Wear" {
+ // TODO(b/329465418): Skip this module since it causes issue with app DRM
+ if ctx.ModuleName() != "framework-minus-apex" {
+ flags = append([]string{"-JDcom.android.tools.r8.dexContainerExperiment"}, flags...)
+ }
+ }
+ }
// If the specified SDK level is 10000, then configure the compiler to use the
// current platform SDK level and to compile the build as a platform build.
diff --git a/java/kotlin.go b/java/kotlin.go
index 3573f1eae..f42d16304 100644
--- a/java/kotlin.go
+++ b/java/kotlin.go
@@ -65,8 +65,6 @@ var kotlinc = pctx.AndroidRemoteStaticRule("kotlinc", android.RemoteRuleSupports
"headerClassesDir", "headerJar", "kotlinJvmTarget", "kotlinBuildFile", "emptyDir", "name")
var kotlinKytheExtract = pctx.AndroidStaticRule("kotlinKythe",
- // TODO (b/265428637): To prevent kotlinc version skew between android builds and internal kotlin indexers (g3), consider embedding the kotlinc used by android into the kzip file.
- // This has an impact on .kzip sizes, so defer that for now.
blueprint.RuleParams{
Command: `rm -rf "$srcJarDir" && mkdir -p "$srcJarDir" && ` +
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" -f "*.kt" $srcJars && ` +
@@ -76,7 +74,8 @@ var kotlinKytheExtract = pctx.AndroidStaticRule("kotlinKythe",
// Skip header jars, those should not have an effect on kythe results.
` --args '${config.KotlincGlobalFlags} ` +
` ${config.KotlincSuppressJDK9Warnings} ${config.JavacHeapFlags} ` +
- ` $kotlincFlags -jvm-target $kotlinJvmTarget'`,
+ ` $kotlincFlags -jvm-target $kotlinJvmTarget ` +
+ `${config.KotlincKytheGlobalFlags}'`,
CommandDeps: []string{
"${config.KotlinKytheExtractor}",
"${config.ZipSyncCmd}",
diff --git a/java/ravenwood.go b/java/ravenwood.go
index bb136cf6e..3fa73e64d 100644
--- a/java/ravenwood.go
+++ b/java/ravenwood.go
@@ -33,7 +33,6 @@ func RegisterRavenwoodBuildComponents(ctx android.RegistrationContext) {
var ravenwoodLibContentTag = dependencyTag{name: "ravenwoodlibcontent"}
var ravenwoodUtilsTag = dependencyTag{name: "ravenwoodutils"}
var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"}
-var ravenwoodDataTag = dependencyTag{name: "ravenwooddata"}
var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"}
const ravenwoodUtilsName = "ravenwood-utils"
@@ -228,7 +227,10 @@ type ravenwoodLibgroupProperties struct {
Jni_libs []string
// We use this to copy framework-res.apk to the ravenwood runtime directory.
- Data []string
+ Data []string `android:"path,arch_variant"`
+
+ // We use this to copy font files to the ravenwood runtime directory.
+ Fonts []string `android:"path,arch_variant"`
}
type ravenwoodLibgroup struct {
@@ -267,9 +269,6 @@ func (r *ravenwoodLibgroup) DepsMutator(ctx android.BottomUpMutatorContext) {
for _, lib := range r.ravenwoodLibgroupProperties.Jni_libs {
ctx.AddVariationDependencies(ctx.Config().BuildOSTarget.Variations(), jniLibTag, lib)
}
- for _, data := range r.ravenwoodLibgroupProperties.Data {
- ctx.AddVariationDependencies(nil, ravenwoodDataTag, data)
- }
}
func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -309,12 +308,17 @@ func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContex
}
dataInstallPath := installPath.Join(ctx, "ravenwood-data")
- for _, data := range r.ravenwoodLibgroupProperties.Data {
- libModule := ctx.GetDirectDepWithTag(data, ravenwoodDataTag)
- file := android.OutputFileForModule(ctx, libModule, "")
+ data := android.PathsForModuleSrc(ctx, r.ravenwoodLibgroupProperties.Data)
+ for _, file := range data {
ctx.InstallFile(dataInstallPath, file.Base(), file)
}
+ fontsInstallPath := installPath.Join(ctx, "fonts")
+ fonts := android.PathsForModuleSrc(ctx, r.ravenwoodLibgroupProperties.Fonts)
+ for _, file := range fonts {
+ ctx.InstallFile(fontsInstallPath, file.Base(), file)
+ }
+
// Normal build should perform install steps
ctx.Phony(r.BaseModuleName(), android.PathForPhony(ctx, r.BaseModuleName()+"-install"))
}
diff --git a/java/ravenwood_test.go b/java/ravenwood_test.go
index d26db930d..0a1b08926 100644
--- a/java/ravenwood_test.go
+++ b/java/ravenwood_test.go
@@ -19,6 +19,7 @@ import (
"testing"
"android/soong/android"
+ "android/soong/etc"
)
var prepareRavenwoodRuntime = android.GroupFixturePreparers(
@@ -59,11 +60,15 @@ var prepareRavenwoodRuntime = android.GroupFixturePreparers(
}
android_app {
name: "app1",
- sdk_version: "current",
+ sdk_version: "current",
}
android_app {
name: "app2",
- sdk_version: "current",
+ sdk_version: "current",
+ }
+ prebuilt_font {
+ name: "Font.ttf",
+ src: "Font.ttf",
}
android_ravenwood_libgroup {
name: "ravenwood-runtime",
@@ -76,7 +81,10 @@ var prepareRavenwoodRuntime = android.GroupFixturePreparers(
"ravenwood-runtime-jni2",
],
data: [
- "app1",
+ ":app1",
+ ],
+ fonts: [
+ ":Font.ttf"
],
}
android_ravenwood_libgroup {
@@ -97,6 +105,7 @@ func TestRavenwoodRuntime(t *testing.T) {
ctx := android.GroupFixturePreparers(
PrepareForIntegrationTestWithJava,
+ etc.PrepareForTestWithPrebuiltEtc,
prepareRavenwoodRuntime,
).RunTest(t)
@@ -114,6 +123,7 @@ func TestRavenwoodRuntime(t *testing.T) {
runtime.Output(installPathPrefix + "/ravenwood-runtime/lib64/libred.so")
runtime.Output(installPathPrefix + "/ravenwood-runtime/lib64/ravenwood-runtime-jni3.so")
runtime.Output(installPathPrefix + "/ravenwood-runtime/ravenwood-data/app1.apk")
+ runtime.Output(installPathPrefix + "/ravenwood-runtime/fonts/Font.ttf")
utils := ctx.ModuleForTests("ravenwood-utils", "android_common")
utils.Output(installPathPrefix + "/ravenwood-utils/framework-rules.ravenwood.jar")
}
@@ -125,29 +135,30 @@ func TestRavenwoodTest(t *testing.T) {
ctx := android.GroupFixturePreparers(
PrepareForIntegrationTestWithJava,
+ etc.PrepareForTestWithPrebuiltEtc,
prepareRavenwoodRuntime,
).RunTestWithBp(t, `
- cc_library_shared {
- name: "jni-lib1",
- host_supported: true,
- srcs: ["jni.cpp"],
- }
- cc_library_shared {
- name: "jni-lib2",
- host_supported: true,
- srcs: ["jni.cpp"],
- stem: "libblue",
- shared_libs: [
- "jni-lib3",
- ],
- }
- cc_library_shared {
- name: "jni-lib3",
- host_supported: true,
- srcs: ["jni.cpp"],
- stem: "libpink",
- }
- android_ravenwood_test {
+ cc_library_shared {
+ name: "jni-lib1",
+ host_supported: true,
+ srcs: ["jni.cpp"],
+ }
+ cc_library_shared {
+ name: "jni-lib2",
+ host_supported: true,
+ srcs: ["jni.cpp"],
+ stem: "libblue",
+ shared_libs: [
+ "jni-lib3",
+ ],
+ }
+ cc_library_shared {
+ name: "jni-lib3",
+ host_supported: true,
+ srcs: ["jni.cpp"],
+ stem: "libpink",
+ }
+ android_ravenwood_test {
name: "ravenwood-test",
srcs: ["Test.java"],
jni_libs: [
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 725aaed9b..9f0564a9c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1727,6 +1727,7 @@ func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext)
staticLibs.AppendSimpleValue(module.sdkLibraryProperties.Impl_only_static_libs)
props := struct {
Name *string
+ Enabled proptools.Configurable[bool]
Visibility []string
Libs []string
Static_libs proptools.Configurable[[]string]
@@ -1734,6 +1735,7 @@ func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext)
Stem *string
}{
Name: proptools.StringPtr(module.implLibraryModuleName()),
+ Enabled: module.EnabledProperty(),
Visibility: visibility,
Libs: append(module.properties.Libs, module.sdkLibraryProperties.Impl_only_libs...),
@@ -1762,6 +1764,7 @@ func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext)
type libraryProperties struct {
Name *string
+ Enabled proptools.Configurable[bool]
Visibility []string
Srcs []string
Installable *bool
@@ -1788,6 +1791,7 @@ type libraryProperties struct {
func (module *SdkLibrary) stubsLibraryProps(mctx android.DefaultableHookContext, apiScope *apiScope) libraryProperties {
props := libraryProperties{}
+ props.Enabled = module.EnabledProperty()
props.Visibility = []string{"//visibility:override", "//visibility:private"}
// sources are generated from the droiddoc
sdkVersion := module.sdkVersionForStubsLibrary(mctx, apiScope)
@@ -1838,6 +1842,7 @@ func (module *SdkLibrary) createExportableStubsLibrary(mctx android.DefaultableH
func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookContext, apiScope *apiScope, name string, scopeSpecificDroidstubsArgs []string) {
props := struct {
Name *string
+ Enabled proptools.Configurable[bool]
Visibility []string
Srcs []string
Installable *bool
@@ -1879,6 +1884,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
// * libs (static_libs/libs)
props.Name = proptools.StringPtr(name)
+ props.Enabled = module.EnabledProperty()
props.Visibility = childModuleVisibility(module.sdkLibraryProperties.Stubs_source_visibility)
props.Srcs = append(props.Srcs, module.properties.Srcs...)
props.Srcs = append(props.Srcs, module.sdkLibraryProperties.Api_srcs...)
@@ -2004,6 +2010,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext, apiScope *apiScope) {
props := struct {
Name *string
+ Enabled proptools.Configurable[bool]
Visibility []string
Api_contributions []string
Libs proptools.Configurable[[]string]
@@ -2016,6 +2023,7 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
}{}
props.Name = proptools.StringPtr(module.apiLibraryModuleName(apiScope))
+ props.Enabled = module.EnabledProperty()
props.Visibility = []string{"//visibility:override", "//visibility:private"}
apiContributions := []string{}
@@ -2066,6 +2074,7 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext,
func (module *SdkLibrary) topLevelStubsLibraryProps(mctx android.DefaultableHookContext, apiScope *apiScope, doDist bool) libraryProperties {
props := libraryProperties{}
+ props.Enabled = module.EnabledProperty()
props.Visibility = childModuleVisibility(module.sdkLibraryProperties.Stubs_library_visibility)
sdkVersion := module.sdkVersionForStubsLibrary(mctx, apiScope)
props.Sdk_version = proptools.StringPtr(sdkVersion)
@@ -2158,6 +2167,7 @@ func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
}
props := struct {
Name *string
+ Enabled proptools.Configurable[bool]
Lib_name *string
Apex_available []string
On_bootclasspath_since *string
@@ -2168,6 +2178,7 @@ func (module *SdkLibrary) createXmlFile(mctx android.DefaultableHookContext) {
Uses_libs_dependencies []string
}{
Name: proptools.StringPtr(module.xmlPermissionsModuleName()),
+ Enabled: module.EnabledProperty(),
Lib_name: proptools.StringPtr(module.BaseModuleName()),
Apex_available: module.ApexProperties.Apex_available,
On_bootclasspath_since: module.commonSdkLibraryProperties.On_bootclasspath_since,
@@ -2263,11 +2274,6 @@ func (module *SdkLibrary) getApiDir() string {
// runtime libs and xml file. If requested, the stubs and docs are created twice
// once for public API level and once for system API level
func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookContext) {
- // If the module has been disabled then don't create any child modules.
- if !module.Enabled(mctx) {
- return
- }
-
if len(module.properties.Srcs) == 0 {
mctx.PropertyErrorf("srcs", "java_sdk_library must specify srcs")
return