summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go94
1 files changed, 30 insertions, 64 deletions
diff --git a/java/java.go b/java/java.go
index 95f4fd892..661422b54 100644
--- a/java/java.go
+++ b/java/java.go
@@ -356,12 +356,17 @@ type UsesLibraryDependency interface {
// TODO(jungjw): Move this to kythe.go once it's created.
type xref interface {
XrefJavaFiles() android.Paths
+ XrefKotlinFiles() android.Paths
}
func (j *Module) XrefJavaFiles() android.Paths {
return j.kytheFiles
}
+func (j *Module) XrefKotlinFiles() android.Paths {
+ return j.kytheKotlinFiles
+}
+
func (d dependencyTag) PropagateAconfigValidation() bool {
return d.static
}
@@ -1296,7 +1301,7 @@ type testProperties struct {
Test_options TestOptions
// Names of modules containing JNI libraries that should be installed alongside the test.
- Jni_libs []string
+ Jni_libs proptools.Configurable[[]string]
// Install the test into a folder named for the module in all test suites.
Per_testcase_directory *bool
@@ -1480,10 +1485,11 @@ func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) {
}
}
- if len(j.testProperties.Jni_libs) > 0 {
+ jniLibs := j.testProperties.Jni_libs.GetOrDefault(ctx, nil)
+ if len(jniLibs) > 0 {
for _, target := range ctx.MultiTargets() {
sharedLibVariations := append(target.Variations(), blueprint.Variation{Mutator: "link", Variation: "shared"})
- ctx.AddFarVariationDependencies(sharedLibVariations, jniLibTag, j.testProperties.Jni_libs...)
+ ctx.AddFarVariationDependencies(sharedLibVariations, jniLibTag, jniLibs...)
}
}
@@ -2607,17 +2613,6 @@ func (a *Import) JacocoReportClassesFile() android.Path {
return nil
}
-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...)
ctx.AddVariationDependencies(nil, staticLibTag, j.properties.Static_libs.GetOrDefault(ctx, nil)...)
@@ -2695,13 +2690,13 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars)
}
}
- } else if dep, ok := module.(SdkLibraryDependency); ok {
+ } else if _, ok := android.OtherModuleProvider(ctx, module, SdkLibraryInfoProvider); ok {
switch tag {
case libTag, sdkLibTag:
- depHeaderJars := dep.SdkHeaderJars(ctx, j.SdkVersion(ctx))
- flags.classpath = append(flags.classpath, depHeaderJars...)
- transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars,
- android.NewDepSet(android.PREORDER, depHeaderJars, nil))
+ sdkInfo, _ := android.OtherModuleProvider(ctx, module, SdkLibraryInfoProvider)
+ generatingLibsString := android.PrettyConcat(
+ getGeneratingLibs(ctx, j.SdkVersion(ctx), module.Name(), sdkInfo), true, "or")
+ ctx.ModuleErrorf("cannot depend directly on java_sdk_library %q; try depending on %s instead", module.Name(), generatingLibsString)
}
}
@@ -2813,41 +2808,14 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
if ctx.Device() {
- // If this is a variant created for a prebuilt_apex then use the dex implementation jar
- // obtained from the associated deapexer module.
+ // Shared libraries deapexed from prebuilt apexes are no longer supported.
+ // Set the dexJarBuildPath to a fake path.
+ // This allows soong analysis pass, but will be an error during ninja execution if there are
+ // any rdeps.
ai, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
if ai.ForPrebuiltApex {
- // Get the path of the dex implementation jar from the `deapexer` module.
- di, err := android.FindDeapexerProviderForModule(ctx)
- if err != nil {
- // An error was found, possibly due to multiple apexes in the tree that export this library
- // Defer the error till a client tries to call DexJarBuildPath
- j.dexJarFileErr = err
- j.initHiddenAPIError(err)
- return
- }
- dexJarFileApexRootRelative := ApexRootRelativePathToJavaLib(j.BaseModuleName())
- if dexOutputPath := di.PrebuiltExportPath(dexJarFileApexRootRelative); dexOutputPath != nil {
- dexJarFile := makeDexJarPathFromPath(dexOutputPath)
- j.dexJarFile = dexJarFile
- installPath := android.PathForModuleInPartitionInstall(ctx, "apex", ai.ApexVariationName, ApexRootRelativePathToJavaLib(j.BaseModuleName()))
- j.dexJarInstallFile = installPath
-
- j.dexpreopter.installPath = j.dexpreopter.getInstallPath(ctx, android.RemoveOptionalPrebuiltPrefix(ctx.ModuleName()), installPath)
- setUncompressDex(ctx, &j.dexpreopter, &j.dexer)
- j.dexpreopter.uncompressedDex = *j.dexProperties.Uncompress_dex
-
- if profilePath := di.PrebuiltExportPath(dexJarFileApexRootRelative + ".prof"); profilePath != nil {
- j.dexpreopter.inputProfilePathOnHost = profilePath
- }
-
- // Initialize the hiddenapi structure.
- j.initHiddenAPI(ctx, dexJarFile, outputFile, j.dexProperties.Uncompress_dex)
- } 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.
- ctx.ModuleErrorf("internal error: no dex implementation jar available from prebuilt APEX %s", di.ApexModuleName())
- }
+ j.dexJarFile = makeDexJarPathFromPath(android.PathForModuleInstall(ctx, "intentionally_no_longer_supported"))
+ j.initHiddenAPI(ctx, j.dexJarFile, outputFile, j.dexProperties.Uncompress_dex)
} else if Bool(j.dexProperties.Compile_dex) {
sdkDep := decodeSdkDep(ctx, android.SdkContext(j))
if sdkDep.invalidVersion {
@@ -3120,21 +3088,10 @@ func (a *DexImport) JacocoReportClassesFile() android.Path {
return nil
}
-func (a *DexImport) LintDepSets() LintDepSets {
- return LintDepSets{}
-}
-
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")
@@ -3304,15 +3261,20 @@ type kytheExtractJavaSingleton struct {
func (ks *kytheExtractJavaSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var xrefTargets android.Paths
+ var xrefKotlinTargets android.Paths
ctx.VisitAllModules(func(module android.Module) {
if javaModule, ok := module.(xref); ok {
xrefTargets = append(xrefTargets, javaModule.XrefJavaFiles()...)
+ xrefKotlinTargets = append(xrefKotlinTargets, javaModule.XrefKotlinFiles()...)
}
})
// TODO(asmundak): perhaps emit a rule to output a warning if there were no xrefTargets
if len(xrefTargets) > 0 {
ctx.Phony("xref_java", xrefTargets...)
}
+ if len(xrefKotlinTargets) > 0 {
+ ctx.Phony("xref_kotlin", xrefKotlinTargets...)
+ }
}
var Bool = proptools.Bool
@@ -3332,9 +3294,13 @@ func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
depName := android.RemoveOptionalPrebuiltPrefix(ctx.OtherModuleName(depModule))
var sdkLib *string
- if lib, ok := depModule.(SdkLibraryDependency); ok && lib.sharedLibrary() {
+ if lib, ok := android.OtherModuleProvider(ctx, depModule, SdkLibraryInfoProvider); ok && lib.SharedLibrary {
// A shared SDK library. This should be added as a top-level CLC element.
sdkLib = &depName
+ } else if lib, ok := depModule.(SdkLibraryComponentDependency); ok && lib.OptionalSdkLibraryImplementation() != nil {
+ if depModule.Name() == proptools.String(lib.OptionalSdkLibraryImplementation())+".impl" {
+ sdkLib = lib.OptionalSdkLibraryImplementation()
+ }
} else if ulib, ok := depModule.(ProvidesUsesLib); ok {
// A non-SDK library disguised as an SDK library by the means of `provides_uses_lib`
// property. This should be handled in the same way as a shared SDK library.