summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go43
1 files changed, 30 insertions, 13 deletions
diff --git a/java/java.go b/java/java.go
index 7258dcefd..2bbb5b102 100644
--- a/java/java.go
+++ b/java/java.go
@@ -57,6 +57,10 @@ func registerJavaBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("java_host_for_device", HostForDeviceFactory)
ctx.RegisterModuleType("dex_import", DexImportFactory)
+ // This mutator registers dependencies on dex2oat for modules that should be
+ // dexpreopted. This is done late when the final variants have been
+ // established, to not get the dependencies split into the wrong variants and
+ // to support the checks in dexpreoptDisabled().
ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("dexpreopt_tool_deps", dexpreoptToolDepsMutator).Parallel()
})
@@ -481,11 +485,6 @@ func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bo
}
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- // Initialize the hiddenapi structure. Pass in the configuration name rather than the module name
- // so the hidden api will encode the <x>.impl java_ library created by java_sdk_library just as it
- // would the <x> library if <x> was configured as a boot jar.
- j.initHiddenAPI(ctx, j.ConfigurationName())
-
j.sdkVersion = j.SdkVersion(ctx)
j.minSdkVersion = j.MinSdkVersion(ctx)
@@ -669,6 +668,7 @@ func LibraryHostFactory() android.Module {
module.Module.properties.Installable = proptools.BoolPtr(true)
android.InitApexModule(module)
+ android.InitSdkAwareModule(module)
InitJavaModule(module, android.HostSupported)
return module
}
@@ -923,6 +923,7 @@ func TestFactory() android.Module {
module.Module.dexpreopter.isTest = true
module.Module.linter.test = true
+ android.InitSdkAwareModule(module)
InitJavaModule(module, android.HostAndDeviceSupported)
return module
}
@@ -1220,6 +1221,13 @@ func (j *Import) LintDepSets() LintDepSets {
return LintDepSets{}
}
+func (j *Import) getStrictUpdatabilityLinting() bool {
+ return false
+}
+
+func (j *Import) setStrictUpdatabilityLinting(bool) {
+}
+
func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
@@ -1232,9 +1240,6 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.sdkVersion = j.SdkVersion(ctx)
j.minSdkVersion = j.MinSdkVersion(ctx)
- // Initialize the hiddenapi structure.
- j.initHiddenAPI(ctx, j.BaseModuleName())
-
if !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform() {
j.hideApexVariantFromMake = true
}
@@ -1296,16 +1301,19 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if ai.ForPrebuiltApex {
if deapexerModule == nil {
// This should never happen as a variant for a prebuilt_apex is only created if the
- // deapxer module has been configured to export the dex implementation jar for this module.
+ // deapexer module has been configured to export the dex implementation jar for this module.
ctx.ModuleErrorf("internal error: module %q does not depend on a `deapexer` module for prebuilt_apex %q",
j.Name(), ai.ApexVariationName)
+ return
}
// Get the path of the dex implementation jar from the `deapexer` module.
di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo)
if dexOutputPath := di.PrebuiltExportPath(j.BaseModuleName(), ".dexjar"); dexOutputPath != nil {
j.dexJarFile = dexOutputPath
- j.hiddenAPIExtractInformation(ctx, dexOutputPath, outputFile)
+
+ // Initialize the hiddenapi structure.
+ j.initHiddenAPI(ctx, dexOutputPath, outputFile, nil)
} else {
// This should never happen as a variant for a prebuilt_apex is only created if the
// prebuilt_apex has been configured to export the java library dex file.
@@ -1336,9 +1344,11 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
return
}
- // Hidden API CSV generation and dex encoding
- dexOutputFile = j.hiddenAPIExtractAndEncode(ctx, dexOutputFile, outputFile,
- proptools.Bool(j.dexProperties.Uncompress_dex))
+ // Initialize the hiddenapi structure.
+ j.initHiddenAPI(ctx, dexOutputFile, outputFile, j.dexProperties.Uncompress_dex)
+
+ // Encode hidden API flags in dex file.
+ dexOutputFile = j.hiddenAPIEncodeDex(ctx, dexOutputFile)
j.dexJarFile = dexOutputFile
}
@@ -1542,6 +1552,13 @@ func (j *DexImport) IsInstallable() bool {
return true
}
+func (j *DexImport) getStrictUpdatabilityLinting() bool {
+ return false
+}
+
+func (j *DexImport) setStrictUpdatabilityLinting(bool) {
+}
+
func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(j.properties.Jars) != 1 {
ctx.PropertyErrorf("jars", "exactly one jar must be provided")