Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ksp = "2.3.3"
# Version of KGP tapmoc is compatible with at runtime
kgp-compile-only = "1.9.0"
compile-sdk = "36"
agp9 = "9.0.0-beta02"
agp9 = "9.0.1"
nmcp = "1.3.1-SNAPSHOT-bd3a2d8eeaa63dce9dfc2c9d8b63f4a2a98a50e7"

[libraries]
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pluginManagement {
content {
includeModule("com.gradleup.gratatouille", "gratatouille-processor")
includeModule("com.gradleup.nmcp", "nmcp-tasks")
includeModule("com.gradleup.tapmoc", "tapmoc-tasks")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ private class KgpImpl(private val dependencyHandler: DependencyHandler, extensio
}
}
}
/**
* We also need to fight AGP there: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/internal/utils/kgpUtils.kt;l=386;drc=24548ccac3813558373462f04d14e6738141624d
*
* This is assuming there will always be an "api" configuration...
*/
dependencyHandler.add("api", "org.jetbrains.kotlin:kotlin-stdlib:${version}")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.gradle.api.NamedDomainObjectSet
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
import org.gradle.api.attributes.Attribute
import org.gradle.api.attributes.Category
import org.gradle.api.attributes.Usage
import org.gradle.api.provider.Property
Expand Down Expand Up @@ -94,6 +95,41 @@ internal abstract class TapmocExtensionImpl(private val project: Project) : Tapm
it.isVisible = false

it.attributes.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, usage))
/**
* For Android, select "release" by default. This is probably not 100% correct, but fixes errors like those:
*
* ```
* Could not determine the dependencies of task ':openfeedback-m3:tapmocCheckClassFileVersions'.
* > Could not resolve all dependencies for configuration ':openfeedback-m3:tapmocRuntimeDependencies'.
* > Could not resolve project :openfeedback-resources.
* Required by:
* project :openfeedback-m3
* > The consumer was configured to find a component for use during runtime. However we cannot choose between the following variants of project :openfeedback-resources:
* - debugRuntimeElements
* - releaseRuntimeElements
* All of them match the consumer attributes:
* - Variant 'debugRuntimeElements' capability 'io.openfeedback:openfeedback-resources:1.0.0-alpha.5-SNAPSHOT' declares a component for use during runtime:
* - Unmatched attributes:
* - Provides a library but the consumer didn't ask for it
* - Provides attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.9.0' but the consumer didn't ask for it
* - Provides attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' but the consumer didn't ask for it
* - Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'debug' but the consumer didn't ask for it
* - Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
* - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
* - Variant 'releaseRuntimeElements' capability 'io.openfeedback:openfeedback-resources:1.0.0-alpha.5-SNAPSHOT' declares a component for use during runtime:
* - Unmatched attributes:
* - Provides a library but the consumer didn't ask for it
* - Provides attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.9.0' but the consumer didn't ask for it
* - Provides attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' but the consumer didn't ask for it
* - Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'release' but the consumer didn't ask for it
* - Provides attribute 'org.gradle.jvm.environment' with value 'android' but the consumer didn't ask for it
* - Provides attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but the consumer didn't ask for it
* ```
*
* I'm expecting the attributes to be ignored in the other cases because "missing attributes are a match" 🤞
*/
it.attributes.attribute(Attribute.of("com.android.build.gradle.internal.attributes.VariantAttr", String::class.java), "release")
it.attributes.attribute(Attribute.of("artifactType", String::class.java), "jar")
}

var firstTime = true
Expand Down
4 changes: 0 additions & 4 deletions tests/agp9-kotlin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ pluginManagement {

includeBuild("../../")
includeBuild("../build-logic")

fun toto(settings: Settings) {
settings.layout.rootDirectory.files()
}
3 changes: 2 additions & 1 deletion tests/gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import tapmoc.Severity

plugins {
id("com.gradleup.tapmoc")
`embedded-kotlin`
// Use a version of KGP that can target 1.8
id("org.jetbrains.kotlin.jvm").version("2.2.10")
id("java-gradle-plugin") // needs to be before check.publication
id("check.publication")
}
Expand Down
3 changes: 1 addition & 2 deletions tests/gradle-plugin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
# See https://github.com/gradle/gradle/pull/34540
distributionUrl=https://services.gradle.org/distributions-snapshots/gradle-9.4.0-20251215022449+0000-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading