summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-27 16:34:44 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-27 16:34:44 +0000
commita0994763b52d9772faf00dfb854724a4657af825 (patch)
tree1e5fb5a0f2f2da5ff8e22bb143e1802c63f4cff5
parente72b534555fe76d2cc6182f861737c83163fe603 (diff)
parentdb58475e5b73fb30baf1d6f8eb3f21bc933df916 (diff)
downloadbase-a0994763b52d9772faf00dfb854724a4657af825.tar.gz
Snap for 8772314 from db58475e5b73fb30baf1d6f8eb3f21bc933df916 to studio-dolphin-release
Change-Id: Ie65aa68efa3ba28fc5425671ea3694b37716d4c8
-rw-r--r--bazel/sdk/dev-sdk-packages1
-rw-r--r--bazel/sdk/prebuilts.studio.sdk.BUILD5
-rw-r--r--build-system/builder-model/src/main/java/com/android/builder/model/v2/ide/LibraryType.kt8
-rw-r--r--build-system/builder/src/main/java/com/android/builder/core/ToolsRevisionUtils.java2
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/api/component/impl/ComponentImpl.kt2
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/api/component/impl/TestFixturesImpl.kt5
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/component/ComponentCreationConfig.kt5
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilder.kt38
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/LibraryService.kt6
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/ResolvedArtifact.kt4
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/v2/LibraryImpl.kt11
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/scope/ProjectInfo.kt5
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/AarMetadataTask.kt2
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryClasses.kt2
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryJavaRes.kt3
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/CheckMultiApkLibrariesTask.kt9
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/featuresplit/PackagedDependenciesWriterTask.kt72
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/CompileLibraryResourcesTask.kt3
-rw-r--r--build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ZipMergingTask.kt3
-rw-r--r--build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilderTest.kt25
-rw-r--r--build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/GraphUtils.kt11
-rw-r--r--build-system/integration-test/BUILD.bazel2
-rw-r--r--build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/application/CheckMultiApkLibrariesTaskTest.kt4
-rw-r--r--build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/AppModelTest.kt78
-rw-r--r--build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/testing/testFixtures/TestFixturesTest.kt138
-rw-r--r--build-system/integration-test/application/src/test/resources/com/android/build/gradle/integration/model/DependencyWithoutFileWithDependenciesTest_VariantDependencies.txt142
-rw-r--r--build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/TestVersions.kt2
-rw-r--r--build-system/integration-test/lint/src/test/java/com/android/build/gradle/integration/lint/LintWithAnalyticsEnabledTest.kt2
-rw-r--r--build-system/integration-test/native/BUILD.bazel1
-rw-r--r--build-system/integration-test/test-projects/composeHelloWorld/app/src/main/AndroidManifest.xml1
-rw-r--r--build-system/integration-test/test-projects/jetifier/app/src/main/AndroidManifest.xml1
-rw-r--r--build-system/integration-test/test-projects/navigation/app/src/main/AndroidManifest.xml1
-rw-r--r--build-system/integration-test/test-projects/navigation/library/src/main/AndroidManifest.xml1
-rw-r--r--build-system/integration-test/test-projects/testFixturesApp/appTests/build.gradle30
-rw-r--r--build-system/integration-test/test-projects/testFixturesApp/appTests/src/main/AndroidManifest.xml4
-rw-r--r--build-system/integration-test/test-projects/testFixturesApp/settings.gradle1
-rw-r--r--common/version.bzl4
-rw-r--r--common/version/com/android/version.properties6
38 files changed, 595 insertions, 45 deletions
diff --git a/bazel/sdk/dev-sdk-packages b/bazel/sdk/dev-sdk-packages
index 7722f80fba..6945e8db63 100644
--- a/bazel/sdk/dev-sdk-packages
+++ b/bazel/sdk/dev-sdk-packages
@@ -19,6 +19,7 @@ build-tools;25.0.0
build-tools;24.0.3
# Platforms. There's no Google APIs for 25.
+platforms;android-33
platforms;android-32
platforms;android-31
platforms;android-30
diff --git a/bazel/sdk/prebuilts.studio.sdk.BUILD b/bazel/sdk/prebuilts.studio.sdk.BUILD
index f74f724504..f8c6a47c96 100644
--- a/bazel/sdk/prebuilts.studio.sdk.BUILD
+++ b/bazel/sdk/prebuilts.studio.sdk.BUILD
@@ -231,6 +231,11 @@ java_import(
],
)
+platform_filegroup(
+ name = "platforms/android-33",
+ visibility = ["//visibility:public"],
+)
+
# Version-specific rule public while tests transition to platform 32
platform_filegroup(
name = "platforms/android-32",
diff --git a/build-system/builder-model/src/main/java/com/android/builder/model/v2/ide/LibraryType.kt b/build-system/builder-model/src/main/java/com/android/builder/model/v2/ide/LibraryType.kt
index cacdf4d357..88ab2ecc82 100644
--- a/build-system/builder-model/src/main/java/com/android/builder/model/v2/ide/LibraryType.kt
+++ b/build-system/builder-model/src/main/java/com/android/builder/model/v2/ide/LibraryType.kt
@@ -40,5 +40,11 @@ enum class LibraryType {
* The dependency is an external dependency with no artifact, pointing to a different artifact
* (via Gradle's available-at feature, and possibly via POM's relocation feature.)
*/
- RELOCATED;
+ RELOCATED,
+
+ /**
+ * The dependency is an external dependency with no artifact, but it may depend on other
+ * libraries.
+ */
+ NO_ARTIFACT_FILE;
}
diff --git a/build-system/builder/src/main/java/com/android/builder/core/ToolsRevisionUtils.java b/build-system/builder/src/main/java/com/android/builder/core/ToolsRevisionUtils.java
index 89e66420a1..a4d96bb95c 100644
--- a/build-system/builder/src/main/java/com/android/builder/core/ToolsRevisionUtils.java
+++ b/build-system/builder/src/main/java/com/android/builder/core/ToolsRevisionUtils.java
@@ -49,5 +49,5 @@ public class ToolsRevisionUtils {
* <p>The build system will warn if the compile SDK version is greater than this value to
* encourage build authors to upgrade the Android Gradle Plugin.
*/
- public static final AndroidVersion MAX_RECOMMENDED_COMPILE_SDK_VERSION = new AndroidVersion(32);
+ public static final AndroidVersion MAX_RECOMMENDED_COMPILE_SDK_VERSION = new AndroidVersion(33);
}
diff --git a/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/ComponentImpl.kt b/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/ComponentImpl.kt
index 4d6be43ce3..8aaa2e2789 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/ComponentImpl.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/ComponentImpl.kt
@@ -872,4 +872,6 @@ abstract class ComponentImpl(
"Turn on with by putting '${BooleanOption.ENABLE_LEGACY_API.propertyName}=true in gradle.properties'\n" +
"Using this deprecated API may still fail, depending on usage of the new Variant API, like computing applicationId via a task output."
}
+
+ override fun getArtifactName(name: String) = name
}
diff --git a/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/TestFixturesImpl.kt b/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/TestFixturesImpl.kt
index 7550baa9ff..d4231ec122 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/TestFixturesImpl.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/api/component/impl/TestFixturesImpl.kt
@@ -44,6 +44,7 @@ import com.android.build.gradle.internal.services.TaskCreationServices
import com.android.build.gradle.internal.services.VariantServices
import com.android.build.gradle.internal.tasks.AarMetadataTask.Companion.DEFAULT_MIN_AGP_VERSION
import com.android.build.gradle.internal.tasks.factory.GlobalTaskCreationConfig
+import com.android.build.gradle.internal.testFixtures.testFixturesFeatureName
import com.android.build.gradle.internal.variant.TestFixturesVariantData
import com.android.build.gradle.internal.variant.VariantPathHelper
import com.google.wireless.android.sdk.stats.GradleBuildVariant
@@ -154,6 +155,10 @@ open class TestFixturesImpl @Inject constructor(
variantDslInfo.isPseudoLocalesEnabled
)
+ override fun getArtifactName(name: String): String {
+ return "$testFixturesFeatureName-$name"
+ }
+
// ---------------------------------------------------------------------------------------------
// Private stuff
// ---------------------------------------------------------------------------------------------
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/component/ComponentCreationConfig.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/component/ComponentCreationConfig.kt
index a6674509d1..d8d6bd4d79 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/component/ComponentCreationConfig.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/component/ComponentCreationConfig.kt
@@ -186,6 +186,11 @@ interface ComponentCreationConfig : ComponentIdentity {
val javaCompilation: JavaCompilation
+ /**
+ * Returns the artifact name modified depending on the component type.
+ */
+ fun getArtifactName(name: String): String
+
// ---------------------------------------------------------------------------------------------
// VARIANT DSL INFO REPLACEMENTS
// ---------------------------------------------------------------------------------------------
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilder.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilder.kt
index ef9a306098..4204e48655 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilder.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilder.kt
@@ -129,20 +129,23 @@ class FullDependencyGraphBuilder(
val variantKey = variant.toKey()
val artifact = artifactMap[variantKey]
+ val variantDependencies by lazy {
+ dependency.selected.getDependenciesForVariant(variant)
+ }
val library = if (artifact == null) {
- // There are 2 (currently known) reasons this can happen:
- // - when resolving a test graph, as one of the roots will be the same module and this
+ val owner = variant.owner
+
+ // There are 3 (currently known) reasons this can happen:
+ // 1. when an artifact is relocated via Gradle's module "available-at" feature.
+ // 2. when resolving a test graph, as one of the roots will be the same module and this
// is not included in the other artifact-based API.
- // - when an artifact is relocated via Gradle's module "available-at" feature.
+ // 3. when dependency is without artifact file, but with transitive dependencies
//
- // In both case, there are still dependencies, so we need to create a library object,
+ // In all cases, there are still dependencies, so we need to create a library object,
// and traverse the dependencies.
- val owner = variant.owner
-
if (variant.externalVariant.isPresent) {
- // The presence of an external variant indicates that this is a relocation. We
- // don't need to point to the relocation, we just need to process this node as is
+ // Scenario 1
libraryService.getLibrary(
ResolvedArtifact(
owner,
@@ -158,6 +161,7 @@ class FullDependencyGraphBuilder(
)
)
} else if (owner is ProjectComponentIdentifier && inputs.projectPath == owner.projectPath) {
+ // Scenario 2
// create on the fly a ResolvedArtifact around this project
// and get the matching library item
libraryService.getLibrary(
@@ -179,6 +183,22 @@ class FullDependencyGraphBuilder(
buildMapping = inputs.buildMapping
)
)
+ } else if (variantDependencies.isNotEmpty()) {
+ // Scenario 3
+ libraryService.getLibrary(
+ ResolvedArtifact(
+ owner,
+ variant,
+ variantName = "unknown",
+ artifactFile = null,
+ isTestFixturesArtifact = false,
+ extractedFolder = null,
+ publishedLintJar = null,
+ dependencyType = ResolvedArtifact.DependencyType.NO_ARTIFACT_FILE,
+ isWrappedModule = false,
+ buildMapping = inputs.buildMapping
+ )
+ )
} else {
null
}
@@ -198,7 +218,7 @@ class FullDependencyGraphBuilder(
}
// Now visit children, and add them as dependencies
- dependency.selected.getDependenciesForVariant(variant).forEach {
+ variantDependencies.forEach {
handleDependency(it, visited, artifactMap)?.let { childGraphItem ->
libraryGraphItem.addDependency(childGraphItem)
}
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/LibraryService.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/LibraryService.kt
index f7b0cfa4c1..71e56a4c3d 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/LibraryService.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/LibraryService.kt
@@ -270,6 +270,12 @@ class LibraryServiceImpl(
libraryInfo,
)
}
+ ResolvedArtifact.DependencyType.NO_ARTIFACT_FILE -> {
+ LibraryImpl.createNoArtifactFileLibrary(
+ stringCache.cacheString(libraryInfo.computeKey()),
+ libraryInfo,
+ )
+ }
}
} else {
val projectInfo = getProjectInfo(artifact.variant)
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/ResolvedArtifact.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/ResolvedArtifact.kt
index f31a4ca7de..6c4b4ae7ed 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/ResolvedArtifact.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/dependencies/ResolvedArtifact.kt
@@ -80,7 +80,9 @@ data class ResolvedArtifact internal constructor(
enum class DependencyType constructor(val extension: String) {
JAVA(EXT_JAR),
ANDROID(EXT_AAR),
- RELOCATED_ARTIFACT("")
+ RELOCATED_ARTIFACT(""),
+ // An artifact without file, but it may contain dependencies.
+ NO_ARTIFACT_FILE(""),
}
/**
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/v2/LibraryImpl.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/v2/LibraryImpl.kt
index ead34fc765..035caf8d15 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/v2/LibraryImpl.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/ide/v2/LibraryImpl.kt
@@ -117,6 +117,17 @@ data class LibraryImpl private constructor(
artifact = null,
lintJar = null
)
+
+ fun createNoArtifactFileLibrary(
+ key: String,
+ libraryInfo: LibraryInfo,
+ ) = LibraryImpl(
+ key = key,
+ type = LibraryType.NO_ARTIFACT_FILE,
+ libraryInfo = libraryInfo,
+ artifact = null,
+ lintJar = null
+ )
}
}
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/scope/ProjectInfo.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/scope/ProjectInfo.kt
index 448a2db873..ccae371e0f 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/scope/ProjectInfo.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/scope/ProjectInfo.kt
@@ -21,12 +21,14 @@ import com.android.build.gradle.BaseExtension
import com.android.builder.core.BuilderConstants
import com.google.common.base.Preconditions
import org.gradle.api.Project
+import org.gradle.api.capabilities.Capability
import org.gradle.api.file.Directory
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFile
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.api.provider.Provider
import org.gradle.api.resources.TextResource
+import org.gradle.internal.component.external.model.ImmutableCapability
import java.io.File
/**
@@ -59,6 +61,9 @@ class ProjectInfo(private val project: Project) {
val version: String
get() = project.version.toString()
+ val defaultProjectCapability: Capability
+ get() = ImmutableCapability(project.group.toString(), project.name, "unspecified")
+
val projectDirectory: Directory
get() = project.layout.projectDirectory
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/AarMetadataTask.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/AarMetadataTask.kt
index af13e19712..42cdf6769f 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/AarMetadataTask.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/AarMetadataTask.kt
@@ -106,7 +106,7 @@ abstract class AarMetadataTask : NonIncrementalTask() {
creationConfig.artifacts
.setInitialProvider(taskProvider, AarMetadataTask::output)
- .withName(AAR_METADATA_FILE_NAME)
+ .withName(creationConfig.getArtifactName(AAR_METADATA_FILE_NAME))
.on(InternalArtifactType.AAR_METADATA)
}
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryClasses.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryClasses.kt
index dc6f779053..425ec19146 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryClasses.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryClasses.kt
@@ -258,7 +258,7 @@ abstract class BundleLibraryClassesJar : NonIncrementalTask(), BundleLibraryClas
.setInitialProvider(
taskProvider,
BundleLibraryClassesJar::output
- ).withName(FN_CLASSES_JAR).let {
+ ).withName(creationConfig.getArtifactName(FN_CLASSES_JAR)).let {
if (publishedType == PublishedConfigType.API_ELEMENTS) {
it.on(InternalArtifactType.COMPILE_LIBRARY_CLASSES_JAR)
} else {
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryJavaRes.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryJavaRes.kt
index 4e3d887d3f..79b082f384 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryJavaRes.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/BundleLibraryJavaRes.kt
@@ -100,7 +100,8 @@ abstract class BundleLibraryJavaRes : NonIncrementalTask() {
creationConfig.artifacts.setInitialProvider(
taskProvider,
BundleLibraryJavaRes::output
- ).withName(FN_INTERMEDIATE_RES_JAR).on(InternalArtifactType.LIBRARY_JAVA_RES)
+ ).withName(creationConfig.getArtifactName(FN_INTERMEDIATE_RES_JAR))
+ .on(InternalArtifactType.LIBRARY_JAVA_RES)
}
override fun configure(
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/CheckMultiApkLibrariesTask.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/CheckMultiApkLibrariesTask.kt
index 03ac4273e7..e3b26a9608 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/CheckMultiApkLibrariesTask.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/CheckMultiApkLibrariesTask.kt
@@ -19,6 +19,7 @@ package com.android.build.gradle.internal.tasks
import com.android.build.gradle.internal.component.ComponentCreationConfig
import com.android.build.gradle.internal.publishing.AndroidArtifacts
import com.android.build.gradle.internal.tasks.factory.VariantTaskCreationAction
+import com.android.build.gradle.internal.tasks.featuresplit.removeVariantNameFromId
import com.android.utils.FileUtils
import com.google.common.io.Files
import org.apache.commons.io.Charsets
@@ -132,12 +133,12 @@ abstract class CheckMultiApkLibrariesTask : NonIncrementalTask() {
): Boolean {
var found = false
for (library in Files.readLines(file, Charsets.UTF_8)) {
- val libraryWithoutVariant = library.substringBeforeLast("::")
- if (map.containsKey(libraryWithoutVariant)) {
+ val key = removeVariantNameFromId(library)
+ if (map.containsKey(key)) {
found = true
- map[libraryWithoutVariant]?.add(projectPath)
+ map[key]?.add(projectPath)
} else {
- map[libraryWithoutVariant] = mutableListOf(projectPath)
+ map[key] = mutableListOf(projectPath)
}
}
return found
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/featuresplit/PackagedDependenciesWriterTask.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/featuresplit/PackagedDependenciesWriterTask.kt
index 5dfa05452b..77a5b8c60d 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/featuresplit/PackagedDependenciesWriterTask.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/internal/tasks/featuresplit/PackagedDependenciesWriterTask.kt
@@ -21,6 +21,7 @@ import com.android.build.gradle.internal.component.ComponentCreationConfig
import com.android.build.gradle.internal.ide.dependencies.getIdString
import com.android.build.gradle.internal.publishing.AndroidArtifacts
import com.android.build.gradle.internal.publishing.AndroidArtifacts.ARTIFACT_TYPE
+import com.android.build.gradle.internal.publishing.PublishedConfigSpec
import com.android.build.gradle.internal.scope.InternalArtifactType
import com.android.build.gradle.internal.tasks.NonIncrementalTask
import com.android.build.gradle.internal.tasks.factory.VariantTaskCreationAction
@@ -36,7 +37,7 @@ import org.gradle.api.artifacts.result.ResolvedArtifactResult
import org.gradle.api.attributes.AttributeContainer
import org.gradle.api.file.FileCollection
import org.gradle.api.file.RegularFileProperty
-import org.gradle.api.provider.Property
+import org.gradle.api.provider.ListProperty
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
@@ -71,7 +72,7 @@ abstract class PackagedDependenciesWriterTask : NonIncrementalTask() {
get() = transitivePackagedDeps.artifactFiles
@get:Input
- abstract val projectPathAndVariant: Property<String>
+ abstract val currentProjectIds: ListProperty<String>
override fun doTaskAction() {
val apkFilters = mutableSetOf<String>()
@@ -88,7 +89,7 @@ abstract class PackagedDependenciesWriterTask : NonIncrementalTask() {
contentFilters.addAll(lines)
}
- val contentWithProject = content + projectPathAndVariant.get()
+ val contentWithProject = content + currentProjectIds.get()
// compute the overall content
val filteredContent =
@@ -132,7 +133,35 @@ abstract class PackagedDependenciesWriterTask : NonIncrementalTask() {
task: PackagedDependenciesWriterTask
) {
super.configure(task)
- task.projectPathAndVariant.setDisallowChanges("${creationConfig.services.projectInfo.path}::${task.variantName}")
+ val apiAndRuntimeConfigurations = listOfNotNull(
+ creationConfig.variantDependencies.getElements(
+ PublishedConfigSpec(
+ AndroidArtifacts.PublishedConfigType.API_ELEMENTS
+ )
+ ),
+ creationConfig.variantDependencies.getElements(
+ PublishedConfigSpec(
+ AndroidArtifacts.PublishedConfigType.RUNTIME_ELEMENTS
+ )
+ )
+ )
+ task.currentProjectIds.setDisallowChanges(
+ apiAndRuntimeConfigurations.let { configurations ->
+
+ val capabilitiesList = configurations.map { it.outgoing.capabilities }.filter {
+ it.isNotEmpty()
+ }.ifEmpty {
+ listOf(listOf(creationConfig.services.projectInfo.defaultProjectCapability))
+ }
+
+ val projectId = "${creationConfig.services.projectInfo.path}::${task.variantName}"
+ capabilitiesList.map { capabilities ->
+ encodeCapabilitiesInId(projectId) {
+ capabilities.joinToString(";") { it.toString() }
+ }
+ }.distinct()
+ }
+ )
task.runtimeAarOrJarDeps =
creationConfig.variantDependencies
.runtimeClasspath
@@ -151,13 +180,17 @@ abstract class PackagedDependenciesWriterTask : NonIncrementalTask() {
}
fun ResolvedArtifactResult.toIdString(): String {
- return id.componentIdentifier.toIdString {
- variant.attributes.getAttribute(VariantAttr.ATTRIBUTE)?.name
- }
+ return id.componentIdentifier.toIdString(
+ variantProvider = { variant.attributes.getAttribute(VariantAttr.ATTRIBUTE)?.name },
+ capabilitiesProvider = { variant.capabilities.joinToString(";") { it.toString() } },
+ )
}
-private inline fun ComponentIdentifier.toIdString(variantProvider: () -> String?) : String {
- return when (this) {
+private fun ComponentIdentifier.toIdString(
+ variantProvider: () -> String?,
+ capabilitiesProvider: () -> String
+) : String {
+ val id = when (this) {
is ProjectComponentIdentifier -> {
val variant = variantProvider()
if (variant == null) {
@@ -169,4 +202,25 @@ private inline fun ComponentIdentifier.toIdString(variantProvider: () -> String?
is ModuleComponentIdentifier -> "$group:$module"
else -> toString()
}
+
+ return encodeCapabilitiesInId(id, capabilitiesProvider)
+}
+
+private fun encodeCapabilitiesInId(
+ id: String,
+ capabilitiesProvider: () -> String
+): String {
+ return "$id;${capabilitiesProvider.invoke()}"
+}
+
+fun removeVariantNameFromId(
+ id: String
+): String {
+ return if (id.contains("::")) {
+ val libraryWithoutVariant = id.substringBeforeLast("::")
+ val capabilities = id.substringAfter(";")
+ "$libraryWithoutVariant;$capabilities"
+ } else {
+ id
+ }
}
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/CompileLibraryResourcesTask.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/CompileLibraryResourcesTask.kt
index 7972d5a489..66b60159dd 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/CompileLibraryResourcesTask.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/CompileLibraryResourcesTask.kt
@@ -263,7 +263,8 @@ abstract class CompileLibraryResourcesTask : NewIncrementalTask() {
creationConfig.artifacts.setInitialProvider(
taskProvider,
CompileLibraryResourcesTask::outputDir
- ).withName("out").on(InternalArtifactType.COMPILED_LOCAL_RESOURCES)
+ ).withName(creationConfig.getArtifactName("out"))
+ .on(InternalArtifactType.COMPILED_LOCAL_RESOURCES)
}
override fun configure(
diff --git a/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ZipMergingTask.kt b/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ZipMergingTask.kt
index 3174d53596..cb038e12a4 100644
--- a/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ZipMergingTask.kt
+++ b/build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ZipMergingTask.kt
@@ -105,7 +105,8 @@ abstract class ZipMergingTask : NonIncrementalTask() {
creationConfig.artifacts.setInitialProvider(
taskProvider,
ZipMergingTask::outputFile
- ).withName(FN_INTERMEDIATE_FULL_JAR).on(InternalArtifactType.FULL_JAR)
+ ).withName(creationConfig.getArtifactName(FN_INTERMEDIATE_FULL_JAR))
+ .on(InternalArtifactType.FULL_JAR)
}
override fun configure(
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilderTest.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilderTest.kt
index 5c74aa3de5..8cebbdbcef 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilderTest.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/FullDependencyGraphBuilderTest.kt
@@ -21,6 +21,7 @@ import com.android.build.gradle.internal.dependency.ResolutionResultProvider
import com.android.build.gradle.internal.fixtures.FakeObjectFactory
import com.android.build.gradle.internal.ide.DependencyFailureHandler
import com.android.build.gradle.internal.ide.dependencies.ResolvedArtifact.DependencyType.ANDROID
+import com.android.build.gradle.internal.ide.dependencies.ResolvedArtifact.DependencyType.NO_ARTIFACT_FILE
import com.android.build.gradle.internal.publishing.AndroidArtifacts
import com.android.builder.model.v2.ide.ArtifactDependencies
import com.android.builder.model.v2.ide.Library
@@ -186,6 +187,30 @@ internal class FullDependencyGraphBuilderTest {
.assertThat(graphs.compileDependencies.map { it.key })
.containsExactly("foo|bar-parent|1.0||", "foo|bar|1.0||")
}
+
+ /** Regression test for http://b/230648123. */
+ @Test
+ fun testDependencyWithoutFileWithDependencies() {
+ val (graphs, _) = buildModelGraph {
+ module("foo", "bar", "1.0") {
+ file = null
+ dependencyType = NO_ARTIFACT_FILE
+ // intentionally no file present, just a dependency on parent
+ dependency(
+ module("foo", "bar-parent", "1.0") {
+ file = File("path/to/bar-parent-1.0.jar")
+ }
+ )
+ }
+ }
+
+ Truth
+ .assertThat(graphs.compileDependencies.map { it.key })
+ .containsExactly("foo|bar|1.0||")
+ Truth
+ .assertThat(graphs.compileDependencies.single().dependencies.map { it.key })
+ .containsExactly("foo|bar-parent|1.0||")
+ }
}
// -------------
diff --git a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/GraphUtils.kt b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/GraphUtils.kt
index 3225dbacb5..eaed8a63ec 100644
--- a/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/GraphUtils.kt
+++ b/build-system/gradle-core/src/test/java/com/android/build/gradle/internal/ide/dependencies/GraphUtils.kt
@@ -65,7 +65,7 @@ interface DependencyBuilder {
interface DependencyNodeBuilder: DependencyBuilder {
var dependencyType: DependencyType
- var file: File
+ var file: File?
fun capability(group: String, name: String, version: String? = null)
fun <T: Any> attribute(attribute: Attribute<T>, value: T)
@@ -158,9 +158,10 @@ open class DependencyBuilderImpl: DependencyBuilder {
externalVariant = Optional.ofNullable(externalVariant)
)
- // if there's an external variant due to relocation then that particular module
- // will not have a matching artifact.
- if (externalVariant == null) {
+ // Module will not have a matching artifact:
+ // - if there's an external variant due to relocation
+ // - file is missing e.g. there are only dependencies on other modules
+ if (externalVariant == null && node.file != null) {
artifacts.add(
ResolvedArtifact(
componentIdentifier = componentIdentifier,
@@ -217,7 +218,7 @@ abstract class DependencyNodeBuilderImpl: DependencyBuilderImpl(), DependencyNod
abstract fun getComponentIdentifier(): ComponentIdentifier
- override var file: File = File("")
+ override var file: File? = File("")
override fun capability(group: String, name: String, version: String?) {
capabilities.add(FakeCapability(group, name, version))
}
diff --git a/build-system/integration-test/BUILD.bazel b/build-system/integration-test/BUILD.bazel
index 8fd8b18184..eb1d44c45f 100644
--- a/build-system/integration-test/BUILD.bazel
+++ b/build-system/integration-test/BUILD.bazel
@@ -28,7 +28,7 @@ LATEST_ANDROID_X_CONSTRAINTLAYOUT = "1.1.3"
# framework/src/main/java/com/android/build/gradle/integration/common/fixture/TestVersions.kt
filegroup(
name = "android_platform_for_tests",
- srcs = ["//prebuilts/studio/sdk:platforms/android-32_build_only"],
+ srcs = ["//prebuilts/studio/sdk:platforms/android-33_build_only"],
visibility = [":__subpackages__"],
)
diff --git a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/application/CheckMultiApkLibrariesTaskTest.kt b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/application/CheckMultiApkLibrariesTaskTest.kt
index cfc8d52d71..c37d1296ec 100644
--- a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/application/CheckMultiApkLibrariesTaskTest.kt
+++ b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/application/CheckMultiApkLibrariesTaskTest.kt
@@ -67,9 +67,9 @@ class CheckMultiApkLibrariesTaskTest {
val result = project.executor().expectFailure().run("assembleDebug")
assertThat(result.failureMessage).contains(
- "[:otherFeature1, :otherFeature2] all package the same library [:lib].")
+ "[:otherFeature1, :otherFeature2] all package the same library [:lib;capability group='project', name='lib', version='unspecified'].")
assertThat(result.failureMessage).contains(
- "[:otherFeature1, :otherFeature2] all package the same library [com.android.support:support-core-utils].")
+ "[:otherFeature1, :otherFeature2] all package the same library [com.android.support:support-core-utils;capability group='com.android.support', name='support-core-utils', version='28.0.0'].")
assertThat(result.failureMessage).contains(
"Multiple APKs packaging the same library can cause runtime errors."
)
diff --git a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/AppModelTest.kt b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/AppModelTest.kt
index f2764ff32c..d938080e65 100644
--- a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/AppModelTest.kt
+++ b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/model/AppModelTest.kt
@@ -16,15 +16,20 @@
package com.android.build.gradle.integration.model
+
+import com.android.build.gradle.integration.common.fixture.ANDROIDX_VERSION
+import com.android.build.gradle.integration.common.fixture.GradleTestProject
import com.android.build.gradle.integration.common.fixture.model.ModelComparator
import com.android.build.gradle.integration.common.fixture.model.ReferenceModelComparator
import com.android.build.gradle.integration.common.fixture.testprojects.PluginType
import com.android.build.gradle.integration.common.fixture.testprojects.createGradleProject
import com.android.build.gradle.integration.common.fixture.testprojects.prebuilts.setUpHelloWorld
+import com.android.build.gradle.options.BooleanOption
import com.android.builder.model.v2.ide.SyncIssue
import com.android.testutils.MavenRepoGenerator
import com.android.testutils.TestInputsGenerator
import com.android.testutils.generateAarWithContent
+import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
@@ -592,3 +597,76 @@ class RelocatedArtifactTest: ModelComparator() {
with(result).compareVariantDependencies(goldenFile = "VariantDependencies")
}
}
+
+/** Regression test for http://b/229298359. */
+class DependencyWithoutFileWithDependenciesTest: ModelComparator() {
+
+ @get:Rule
+ val project = createGradleProject {
+ subProject(":app") {
+ plugins.add(PluginType.ANDROID_APP)
+ android {
+ setUpHelloWorld()
+ }
+ appendToBuildFile {
+ """
+ repositories {
+ maven {
+ url { '../repo' }
+ }
+ }
+ dependencies {
+ testImplementation("com.foo:bar:1.0") {
+ capabilities {
+ requireCapability("com.foo:bar-custom:1.0")
+ }
+ }
+ }
+ """.trimIndent()
+ }
+ }
+ subProject(":bar") {
+ plugins.add(PluginType.JAVA_LIBRARY)
+ plugins.add(PluginType.MAVEN_PUBLISH)
+ appendToBuildFile {
+ """
+ group = "com.foo"
+ version = "1.0"
+
+ Configuration customCapability = configurations.create("customCapability")
+ customCapability.setCanBeConsumed(true)
+ customCapability.setCanBeResolved(false)
+ customCapability.attributes.attribute(
+ TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
+ objects.named(TargetJvmEnvironment.class, TargetJvmEnvironment.STANDARD_JVM)
+ )
+ customCapability.outgoing.capability("com.foo:bar-custom:1.0")
+ dependencies.add("customCapability", 'androidx.annotation:annotation:$ANDROIDX_VERSION')
+ components.java.addVariantsFromConfiguration(customCapability) { mapToOptional() }
+
+ publishing {
+ repositories {
+ maven { url = '../repo' }
+ }
+ publications {
+ mavenJava(MavenPublication) {
+ from components.java
+ }
+ }
+ }
+ """.trimIndent()
+ }
+ }
+ }
+
+ @Test
+ fun `test models`() {
+ project.executor().run(":bar:publish")
+ val result = project.modelV2()
+ .with(BooleanOption.USE_ANDROID_X, true)
+ .ignoreSyncIssues(SyncIssue.SEVERITY_WARNING)
+ .fetchModels(variantName = "debug")
+
+ with(result).compareVariantDependencies(goldenFile = "VariantDependencies")
+ }
+}
diff --git a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/testing/testFixtures/TestFixturesTest.kt b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/testing/testFixtures/TestFixturesTest.kt
index 67d9541e8a..875c685852 100644
--- a/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/testing/testFixtures/TestFixturesTest.kt
+++ b/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/testing/testFixtures/TestFixturesTest.kt
@@ -20,6 +20,7 @@ import com.android.build.gradle.integration.common.fixture.GradleTestProject
import com.android.build.gradle.integration.common.utils.TestFileUtils
import com.android.testutils.truth.PathSubject.assertThat
import com.android.utils.FileUtils
+import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
import java.io.File
@@ -37,6 +38,12 @@ class TestFixturesTest {
"project(\":javaLib\")",
"'com.example.javaLib:javaLib:1.0'"
)
+
+ TestFileUtils.searchAndReplace(
+ project.getSubproject(":appTests").buildFile,
+ "project(\":javaLib\")",
+ "'com.example.javaLib:javaLib:1.0'"
+ )
}
if (publishAndroidLib) {
@@ -51,6 +58,12 @@ class TestFixturesTest {
"project(\":lib\")",
"'com.example.lib:lib:1.0'"
)
+
+ TestFileUtils.searchAndReplace(
+ project.getSubproject(":appTests").buildFile,
+ "project(\":lib\")",
+ "'com.example.lib:lib:1.0'"
+ )
}
if (publishJavaLib) {
@@ -259,6 +272,125 @@ class TestFixturesTest {
)
}
+ @Test
+ fun `test plugin consumes test fixtures`() {
+ setUpProject(
+ publishAndroidLib = false,
+ publishJavaLib = false
+ )
+ useAndroidX()
+
+ project.executor().run(":appTests:packageDebug")
+
+ val testApk = project.getSubproject(":appTests").getApk(GradleTestProject.ApkType.DEBUG)
+
+ testApk.mainDexFile.get().classes.keys.let { classes ->
+ // test fixtures classes
+ Truth.assertThat(classes).containsAtLeastElementsIn(
+ listOf(
+ "Lcom/example/app/testFixtures/AppInterfaceTester;",
+ "Lcom/example/javalib/testFixtures/JavaLibInterfaceTester;",
+ "Lcom/example/lib/testFixtures/LibInterfaceTester;",
+ "Lcom/example/lib/testFixtures/LibResourcesTester;"
+ )
+ )
+
+ // lib and java lib classes
+ Truth.assertThat(classes).containsAtLeastElementsIn(
+ listOf(
+ "Lcom/example/javalib/JavaLibInterface;",
+ "Lcom/example/lib/LibInterface;",
+ "Lcom/example/lib/BuildConfig;",
+ )
+ )
+
+ // app classes shouldn't be packaged in the test apk
+ Truth.assertThat(classes).doesNotContain(
+ "Lcom/example/app/AppInterface;"
+ )
+ }
+ }
+
+ @Test
+ fun `test plugin consumes published test fixtures`() {
+ setUpProject(
+ publishAndroidLib = true,
+ publishJavaLib = true
+ )
+ useAndroidX()
+
+ project.executor().run(":appTests:packageDebug")
+
+ val testApk = project.getSubproject(":appTests").getApk(GradleTestProject.ApkType.DEBUG)
+
+ testApk.mainDexFile.get().classes.keys.let { classes ->
+ // test fixtures classes
+ Truth.assertThat(classes).containsAtLeastElementsIn(
+ listOf(
+ "Lcom/example/app/testFixtures/AppInterfaceTester;",
+ "Lcom/example/javalib/testFixtures/JavaLibInterfaceTester;",
+ "Lcom/example/lib/testFixtures/LibInterfaceTester;",
+ "Lcom/example/lib/testFixtures/LibResourcesTester;"
+ )
+ )
+
+ // lib and java lib classes
+ Truth.assertThat(classes).containsAtLeastElementsIn(
+ listOf(
+ "Lcom/example/javalib/JavaLibInterface;",
+ "Lcom/example/lib/LibInterface;",
+ "Lcom/example/lib/BuildConfig;",
+ )
+ )
+
+ // app classes shouldn't be packaged in the test apk
+ Truth.assertThat(classes).doesNotContain(
+ "Lcom/example/app/AppInterface;"
+ )
+ }
+ }
+
+ @Test
+ fun `test plugin excludes main lib classes but includes test fixtures`() {
+ setUpProject(
+ publishAndroidLib = false,
+ publishJavaLib = false
+ )
+ useAndroidX()
+
+ TestFileUtils.searchAndReplace(
+ project.getSubproject(":app").buildFile,
+ "compileOnly",
+ "implementation"
+ )
+
+ project.executor().run(":appTests:packageDebug")
+
+ val testApk = project.getSubproject(":appTests").getApk(GradleTestProject.ApkType.DEBUG)
+
+ testApk.mainDexFile.get().classes.keys.let { classes ->
+ // test fixtures classes
+ Truth.assertThat(classes).containsAtLeastElementsIn(
+ listOf(
+ "Lcom/example/app/testFixtures/AppInterfaceTester;",
+ "Lcom/example/javalib/testFixtures/JavaLibInterfaceTester;",
+ "Lcom/example/lib/testFixtures/LibInterfaceTester;",
+ "Lcom/example/lib/testFixtures/LibResourcesTester;"
+ )
+ )
+
+ // lib and java lib classes shouldn't be packaged in the test apk
+ Truth.assertThat(classes).doesNotContain("Lcom/example/javalib/JavaLibInterface;")
+ Truth.assertThat(classes).doesNotContain("Lcom/example/lib/LibInterface;")
+ Truth.assertThat(classes).doesNotContain("Lcom/example/lib/BuildConfig;")
+
+ // app classes shouldn't be packaged in the test apk
+ Truth.assertThat(classes).doesNotContain(
+ "Lcom/example/app/AppInterface;"
+ )
+ }
+ }
+
private fun setUpProjectForLint(ignoreTestFixturesSourcesInApp: Boolean) {
project.getSubproject(":app").buildFile.appendText(
"""
@@ -304,7 +436,7 @@ class TestFixturesTest {
methodWithUnavailablePermission();
""".trimIndent()
)
- FileUtils.createFile(project.file("gradle.properties"), "android.useAndroidX=true")
+ useAndroidX()
}
private fun addNewPublishingDslForAndroidLibrary() {
@@ -319,4 +451,8 @@ class TestFixturesTest {
""".trimIndent()
)
}
+
+ private fun useAndroidX() {
+ FileUtils.createFile(project.file("gradle.properties"), "android.useAndroidX=true")
+ }
}
diff --git a/build-system/integration-test/application/src/test/resources/com/android/build/gradle/integration/model/DependencyWithoutFileWithDependenciesTest_VariantDependencies.txt b/build-system/integration-test/application/src/test/resources/com/android/build/gradle/integration/model/DependencyWithoutFileWithDependenciesTest_VariantDependencies.txt
new file mode 100644
index 0000000000..63c1a77e47
--- /dev/null
+++ b/build-system/integration-test/application/src/test/resources/com/android/build/gradle/integration/model/DependencyWithoutFileWithDependenciesTest_VariantDependencies.txt
@@ -0,0 +1,142 @@
+> VariantDependencies:
+ - name = "debug"
+ - mainArtifact:
+ - compileDependencies = []
+ - runtimeDependencies = []
+ - unresolvedDependencies = []
+ - androidTestArtifact:
+ - compileDependencies:
+ - :|:app|debug|com.android.build.api.attributes.AgpVersionAttr>{AGP_Version}, com.android.build.gradle.internal.attributes.VariantAttr>debug, org.gradle.libraryelements>jar, org.gradle.usage>java-api|project:app:unspecified:
+ - requestedCoordinates = (null)
+ - dependencies = []
+ - runtimeDependencies = []
+ - unresolvedDependencies = []
+ > unitTestArtifact:
+ > compileDependencies:
+ - :|:app|debug|com.android.build.api.attributes.AgpVersionAttr>{AGP_Version}, com.android.build.gradle.internal.attributes.VariantAttr>debug, org.gradle.libraryelements>jar, org.gradle.usage>java-api|project:app:unspecified:
+ - requestedCoordinates = (null)
+ - dependencies = []
+ - com.foo|bar|1.0|org.gradle.jvm.environment>standard-jvm, org.gradle.status>release|com.foo:bar-custom:1.0:
+ - requestedCoordinates = (null)
+ - dependencies:
+ - androidx.annotation|annotation|1.0.0|org.gradle.category>library, org.gradle.libraryelements>jar, org.gradle.status>release, org.gradle.usage>java-api|androidx.annotation:annotation:1.0.0:
+ - requestedCoordinates = (null)
+ - dependencies = []
+ < compileDependencies
+ - runtimeDependencies:
+ - :|:app|debug|com.android.build.api.attributes.AgpVersionAttr>{AGP_Version}, com.android.build.gradle.internal.attributes.VariantAttr>debug, org.gradle.usage>java-runtime|project:app:unspecified:
+ - requestedCoordinates = (null)
+ - dependencies = []
+ - com.foo|bar|1.0|org.gradle.jvm.environment>standard-jvm, org.gradle.status>release|com.foo:bar-custom:1.0:
+ - dependencies = "*visited*"
+ - unresolvedDependencies = []
+ < unitTestArtifact
+ - testFixturesArtifact = (null)
+ > libraries:
+ > :|:app|debug|com.android.build.api.attributes.AgpVersionAttr>{AGP_Version}, com.android.build.gradle.internal.attributes.VariantAttr>debug, org.gradle.libraryelements>jar, org.gradle.usage>java-api|project:app:unspecified:
+ - type = PROJECT
+ - artifact = {PROJECT}/app/build/intermediates/compile_app_classes_jar/debug/classes.jar{!}
+ > projectInfo:
+ - buildId = ":"
+ - projectPath = ":app"
+ - isTestFixtures = false
+ - buildType = "debug"
+ - productFlavors = []
+ - attributes:
+ * "com.android.build.api.attributes.AgpVersionAttr -> {AGP_Version}"
+ * "com.android.build.gradle.internal.attributes.VariantAttr -> debug"
+ * "org.gradle.libraryelements -> jar"
+ * "org.gradle.usage -> java-api"
+ - capabilities:
+ * "project:app:unspecified"
+ < projectInfo
+ - libraryInfo = (null)
+ - lintJar = (null)
+ - androidLibraryData = (null)
+ < :|:app|debug|com.android.build.api.attributes.AgpVersionAttr>{AGP_Version}, com.android.build.gradle.internal.attributes.VariantAttr>debug, org.gradle.libraryelements>jar, org.gradle.usage>java-api|project:app:unspecified
+ > :|:app|debug|com.android.build.api.attributes.AgpVersionAttr>{AGP_Version}, com.android.build.gradle.internal.attributes.VariantAttr>debug, org.gradle.usage>java-runtime|project:app:unspecified:
+ - type = PROJECT
+ - artifact = (null)
+ > projectInfo:
+ - buildId = ":"
+ - projectPath = ":app"
+ - isTestFixtures = false
+ - buildType = "debug"
+ - productFlavors = []
+ - attributes:
+ * "com.android.build.api.attributes.AgpVersionAttr -> {AGP_Version}"
+ * "com.android.build.gradle.internal.attributes.VariantAttr -> debug"
+ * "org.gradle.usage -> java-runtime"
+ - capabilities:
+ * "project:app:unspecified"
+ < projectInfo
+ - libraryInfo = (null)
+ - lintJar = (null)
+ - androidLibraryData = (null)
+ < :|:app|debug|com.android.build.api.attributes.AgpVersionAttr>{AGP_Version}, com.android.build.gradle.internal.attributes.VariantAttr>debug, org.gradle.usage>java-runtime|project:app:unspecified
+ > androidx.annotation|annotation|1.0.0|org.gradle.category>library, org.gradle.libraryelements>jar, org.gradle.status>release, org.gradle.usage>java-api|androidx.annotation:annotation:1.0.0:
+ - type = JAVA_LIBRARY
+ - artifact = {LOCAL_REPO}/androidx/annotation/annotation/1.0.0/annotation-1.0.0.jar{F}
+ - projectInfo = (null)
+ > libraryInfo:
+ - group = "androidx.annotation"
+ - name = "annotation"
+ - version = "1.0.0"
+ - isTestFixtures = false
+ - buildType = (null)
+ - productFlavors = []
+ - attributes:
+ * "org.gradle.category -> library"
+ * "org.gradle.libraryelements -> jar"
+ * "org.gradle.status -> release"
+ * "org.gradle.usage -> java-api"
+ - capabilities:
+ * "androidx.annotation:annotation:1.0.0"
+ < libraryInfo
+ - lintJar = (null)
+ - androidLibraryData = (null)
+ < androidx.annotation|annotation|1.0.0|org.gradle.category>library, org.gradle.libraryelements>jar, org.gradle.status>release, org.gradle.usage>java-api|androidx.annotation:annotation:1.0.0
+ > androidx.annotation|annotation|1.0.0|org.gradle.category>library, org.gradle.libraryelements>jar, org.gradle.status>release, org.gradle.usage>java-runtime|androidx.annotation:annotation:1.0.0:
+ - type = JAVA_LIBRARY
+ - artifact = {LOCAL_REPO}/androidx/annotation/annotation/1.0.0/annotation-1.0.0.jar{F}
+ - projectInfo = (null)
+ > libraryInfo:
+ - group = "androidx.annotation"
+ - name = "annotation"
+ - version = "1.0.0"
+ - isTestFixtures = false
+ - buildType = (null)
+ - productFlavors = []
+ - attributes:
+ * "org.gradle.category -> library"
+ * "org.gradle.libraryelements -> jar"
+ * "org.gradle.status -> release"
+ * "org.gradle.usage -> java-runtime"
+ - capabilities:
+ * "androidx.annotation:annotation:1.0.0"
+ < libraryInfo
+ - lintJar = (null)
+ - androidLibraryData = (null)
+ < androidx.annotation|annotation|1.0.0|org.gradle.category>library, org.gradle.libraryelements>jar, org.gradle.status>release, org.gradle.usage>java-runtime|androidx.annotation:annotation:1.0.0
+ > com.foo|bar|1.0|org.gradle.jvm.environment>standard-jvm, org.gradle.status>release|com.foo:bar-custom:1.0:
+ - type = NO_ARTIFACT_FILE
+ - artifact = (null)
+ - projectInfo = (null)
+ > libraryInfo:
+ - group = "com.foo"
+ - name = "bar"
+ - version = "1.0"
+ - isTestFixtures = false
+ - buildType = (null)
+ - productFlavors = []
+ - attributes:
+ * "org.gradle.jvm.environment -> standard-jvm"
+ * "org.gradle.status -> release"
+ - capabilities:
+ * "com.foo:bar-custom:1.0"
+ < libraryInfo
+ - lintJar = (null)
+ - androidLibraryData = (null)
+ < com.foo|bar|1.0|org.gradle.jvm.environment>standard-jvm, org.gradle.status>release|com.foo:bar-custom:1.0
+ < libraries
+< VariantDependencies
diff --git a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/TestVersions.kt b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/TestVersions.kt
index 37af871f0f..aa2448ff22 100644
--- a/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/TestVersions.kt
+++ b/build-system/integration-test/framework/src/main/java/com/android/build/gradle/integration/common/fixture/TestVersions.kt
@@ -22,7 +22,7 @@ package com.android.build.gradle.integration.common.fixture
* //tools/base/build-system/integration-test:android_platform_for_tests will also need to be
* updated to match
*/
-const val DEFAULT_COMPILE_SDK_VERSION = 32
+const val DEFAULT_COMPILE_SDK_VERSION = 33
const val DEFAULT_MIN_SDK_VERSION = 14
const val SUPPORT_LIB_MIN_SDK = 14
const val NDK_19_SUPPORT_LIB_MIN_SDK = 21
diff --git a/build-system/integration-test/lint/src/test/java/com/android/build/gradle/integration/lint/LintWithAnalyticsEnabledTest.kt b/build-system/integration-test/lint/src/test/java/com/android/build/gradle/integration/lint/LintWithAnalyticsEnabledTest.kt
index 37c2c60cbd..55bc7126ed 100644
--- a/build-system/integration-test/lint/src/test/java/com/android/build/gradle/integration/lint/LintWithAnalyticsEnabledTest.kt
+++ b/build-system/integration-test/lint/src/test/java/com/android/build/gradle/integration/lint/LintWithAnalyticsEnabledTest.kt
@@ -36,6 +36,8 @@ class LintWithAnalyticsEnabledTest {
fun disableAbortOnError() {
project.getSubproject(":app").buildFile
.appendText("\nandroid.lintOptions.abortOnError=false\n")
+ project.getSubproject(":library").buildFile
+ .appendText("\nandroid.lintOptions.abortOnError=false\n")
}
@Test
diff --git a/build-system/integration-test/native/BUILD.bazel b/build-system/integration-test/native/BUILD.bazel
index 22597fef74..ac48dde29b 100644
--- a/build-system/integration-test/native/BUILD.bazel
+++ b/build-system/integration-test/native/BUILD.bazel
@@ -8,6 +8,7 @@ DATA = [
"//prebuilts/studio/sdk:platform-tools",
"//prebuilts/studio/sdk:platforms/android-19_build_only",
"//prebuilts/studio/sdk:platforms/android-24_build_only",
+ "//prebuilts/studio/sdk:platforms/android-32_build_only", # b/236754841
"//tools/base/build-system:gradle-distrib",
"//tools/base/build-system/aapt2:aapt2_for_tests",
"//tools/base/build-system/integration-test:android_platform_for_tests",
diff --git a/build-system/integration-test/test-projects/composeHelloWorld/app/src/main/AndroidManifest.xml b/build-system/integration-test/test-projects/composeHelloWorld/app/src/main/AndroidManifest.xml
index 1bd66f7606..43e02fcbb7 100644
--- a/build-system/integration-test/test-projects/composeHelloWorld/app/src/main/AndroidManifest.xml
+++ b/build-system/integration-test/test-projects/composeHelloWorld/app/src/main/AndroidManifest.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:allowBackup="true"
android:label="@string/app_name"
diff --git a/build-system/integration-test/test-projects/jetifier/app/src/main/AndroidManifest.xml b/build-system/integration-test/test-projects/jetifier/app/src/main/AndroidManifest.xml
index 7269967562..a8a15ff537 100644
--- a/build-system/integration-test/test-projects/jetifier/app/src/main/AndroidManifest.xml
+++ b/build-system/integration-test/test-projects/jetifier/app/src/main/AndroidManifest.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
diff --git a/build-system/integration-test/test-projects/navigation/app/src/main/AndroidManifest.xml b/build-system/integration-test/test-projects/navigation/app/src/main/AndroidManifest.xml
index a6e95b7666..b4e4940b18 100644
--- a/build-system/integration-test/test-projects/navigation/app/src/main/AndroidManifest.xml
+++ b/build-system/integration-test/test-projects/navigation/app/src/main/AndroidManifest.xml
@@ -17,6 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:icon="@drawable/icon"
android:label="@string/app_label" >
diff --git a/build-system/integration-test/test-projects/navigation/library/src/main/AndroidManifest.xml b/build-system/integration-test/test-projects/navigation/library/src/main/AndroidManifest.xml
index 92a0d7be9a..e2dd33be73 100644
--- a/build-system/integration-test/test-projects/navigation/library/src/main/AndroidManifest.xml
+++ b/build-system/integration-test/test-projects/navigation/library/src/main/AndroidManifest.xml
@@ -16,6 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application>
<activity
android:name=".LibraryActivity"
diff --git a/build-system/integration-test/test-projects/testFixturesApp/appTests/build.gradle b/build-system/integration-test/test-projects/testFixturesApp/appTests/build.gradle
new file mode 100644
index 0000000000..8b3e0dfb66
--- /dev/null
+++ b/build-system/integration-test/test-projects/testFixturesApp/appTests/build.gradle
@@ -0,0 +1,30 @@
+plugins {
+ id 'com.android.test'
+}
+
+android {
+ namespace = "com.example.apptests"
+ compileSdkVersion rootProject.latestCompileSdk
+ buildToolsVersion = rootProject.buildToolsVersion
+
+ targetProjectPath ':app'
+
+ defaultConfig {
+ minSdkVersion rootProject.supportLibMinSdk
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+}
+
+repositories {
+ maven {
+ url = '../testrepo'
+ }
+}
+
+dependencies {
+ implementation testFixtures(project(":app"))
+ implementation testFixtures(project(":javaLib"))
+ implementation testFixtures(project(":lib"))
+
+ implementation 'junit:junit:4.12'
+}
diff --git a/build-system/integration-test/test-projects/testFixturesApp/appTests/src/main/AndroidManifest.xml b/build-system/integration-test/test-projects/testFixturesApp/appTests/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..ef712f5649
--- /dev/null
+++ b/build-system/integration-test/test-projects/testFixturesApp/appTests/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="com.example.apptests">
+
+</manifest>
diff --git a/build-system/integration-test/test-projects/testFixturesApp/settings.gradle b/build-system/integration-test/test-projects/testFixturesApp/settings.gradle
index 89e5d738e4..e6144638f2 100644
--- a/build-system/integration-test/test-projects/testFixturesApp/settings.gradle
+++ b/build-system/integration-test/test-projects/testFixturesApp/settings.gradle
@@ -1,4 +1,5 @@
include ':app'
+include ':appTests'
include ':lib'
include ':lib2'
include ':javaLib'
diff --git a/common/version.bzl b/common/version.bzl
index 057e6b58d2..dc48261076 100644
--- a/common/version.bzl
+++ b/common/version.bzl
@@ -1,2 +1,2 @@
-BASE_VERSION = "30.3.0-beta04"
-BUILD_VERSION = "7.3.0-beta04"
+BASE_VERSION = "30.3.0-dev"
+BUILD_VERSION = "7.3.0-dev"
diff --git a/common/version/com/android/version.properties b/common/version/com/android/version.properties
index cc418e82ad..a0019bf1a6 100644
--- a/common/version/com/android/version.properties
+++ b/common/version/com/android/version.properties
@@ -1,8 +1,8 @@
# The source of truth for these values are in tools/buildSrc/base
# Consistency is maintained via tests
-baseVersion = 30.3.0-beta04
-buildVersion = 7.3.0-beta04
-cmdlineToolsVersion = 7.0-beta04
+baseVersion = 30.3.0-dev
+buildVersion = 7.3.0-dev
+cmdlineToolsVersion = 3.0-dev
apiVersion = 3
nativeApiVersion = 0