summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2024-05-07 00:03:05 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-05-07 00:03:05 +0000
commit5284ad3b33e11de21baea1a122b5c869e0a73f46 (patch)
tree97ff138a45f9e5c3a82cb3e9dcdcc89931dfaae0 /java/java.go
parentf91daab1ab4ca42e22acbeae349582d3e666c57f (diff)
parent8f25d296b57bbd7abebe274ce628663587861220 (diff)
Merge "Revert "Remove compilation actions from java sdk library"" into main
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go49
1 files changed, 9 insertions, 40 deletions
diff --git a/java/java.go b/java/java.go
index aa39148fa..30581f265 100644
--- a/java/java.go
+++ b/java/java.go
@@ -674,10 +674,6 @@ type Library struct {
var _ android.ApexModule = (*Library)(nil)
-func (j *Library) CheckDepsMinSdkVersion(ctx android.ModuleContext) {
- CheckMinSdkVersion(ctx, j)
-}
-
// Provides access to the list of permitted packages from apex boot jars.
type PermittedPackagesForUpdatableBootJars interface {
PermittedPackagesForUpdatableBootJars() []string
@@ -906,12 +902,6 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.minSdkVersion = j.MinSdkVersion(ctx)
j.maxSdkVersion = j.MaxSdkVersion(ctx)
- // Check min_sdk_version of the transitive dependencies if this module is created from
- // java_sdk_library.
- if j.deviceProperties.Min_sdk_version != nil && j.SdkLibraryName() != nil {
- j.CheckDepsMinSdkVersion(ctx)
- }
-
// SdkLibrary.GenerateAndroidBuildActions(ctx) sets the stubsLinkType to Unknown.
// If the stubsLinkType has already been set to Unknown, the stubsLinkType should
// not be overridden.
@@ -942,12 +932,8 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.checkSdkVersions(ctx)
j.checkHeadersOnly(ctx)
if ctx.Device() {
- libName := j.Name()
- if j.SdkLibraryName() != nil && strings.HasSuffix(libName, ".impl") {
- libName = proptools.String(j.SdkLibraryName())
- }
j.dexpreopter.installPath = j.dexpreopter.getInstallPath(
- ctx, libName, android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar"))
+ ctx, j.Name(), android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar"))
j.dexpreopter.isSDKLibrary = j.deviceProperties.IsSDKLibrary
setUncompressDex(ctx, &j.dexpreopter, &j.dexer)
j.dexpreopter.uncompressedDex = *j.dexProperties.Uncompress_dex
@@ -958,24 +944,8 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
j.compile(ctx, nil, nil, nil)
- // If this module is an impl library created from java_sdk_library,
- // install the files under the java_sdk_library module outdir instead of this module outdir.
- if j.SdkLibraryName() != nil && strings.HasSuffix(j.Name(), ".impl") {
- j.setInstallRules(ctx, proptools.String(j.SdkLibraryName()))
- } else {
- j.setInstallRules(ctx, ctx.ModuleName())
- }
-
- android.SetProvider(ctx, android.TestOnlyProviderKey, android.TestModuleInformation{
- TestOnly: Bool(j.sourceProperties.Test_only),
- TopLevelTarget: j.sourceProperties.Top_level_test_target,
- })
-}
-
-func (j *Library) setInstallRules(ctx android.ModuleContext, installModuleName string) {
- apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
-
- if (Bool(j.properties.Installable) || ctx.Host()) && apexInfo.IsForPlatform() {
+ exclusivelyForApex := !apexInfo.IsForPlatform()
+ if (Bool(j.properties.Installable) || ctx.Host()) && !exclusivelyForApex {
var extraInstallDeps android.InstallPaths
if j.InstallMixin != nil {
extraInstallDeps = j.InstallMixin(ctx, j.outputFile)
@@ -992,23 +962,22 @@ func (j *Library) setInstallRules(ctx android.ModuleContext, installModuleName s
if !ctx.Host() {
archDir = ctx.DeviceConfig().DeviceArch()
}
- installDir = android.PathForModuleInstall(ctx, installModuleName, archDir)
+ installDir = android.PathForModuleInstall(ctx, ctx.ModuleName(), archDir)
} else {
installDir = android.PathForModuleInstall(ctx, "framework")
}
j.installFile = ctx.InstallFile(installDir, j.Stem()+".jar", j.outputFile, extraInstallDeps...)
}
+
+ android.SetProvider(ctx, android.TestOnlyProviderKey, android.TestModuleInformation{
+ TestOnly: Bool(j.sourceProperties.Test_only),
+ TopLevelTarget: j.sourceProperties.Top_level_test_target,
+ })
}
func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
j.usesLibrary.deps(ctx, false)
j.deps(ctx)
-
- if j.SdkLibraryName() != nil && strings.HasSuffix(j.Name(), ".impl") {
- if dexpreopt.IsDex2oatNeeded(ctx) {
- dexpreopt.RegisterToolDeps(ctx)
- }
- }
}
const (