Skip to content

Commit

Permalink
Fixed Gradle 9.0 migration issue
Browse files Browse the repository at this point in the history
`attributes` block shouldn't be used in dependency configurations

Fixes #716
PR #723
  • Loading branch information
shanshin authored Jan 6, 2025
1 parent d9b5f4d commit 2342c07
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2017-2025 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.kover.gradle.plugin.test.functional.cases

import kotlinx.kover.gradle.plugin.test.functional.framework.configurator.BuildConfigurator
import kotlinx.kover.gradle.plugin.test.functional.framework.starter.GeneratedTest
import kotlin.test.assertFalse

internal class CompatibilityTests {

@GeneratedTest
fun BuildConfigurator.testGradle9Compatibility() {
addProjectWithKover {
sourcesFrom("simple")
}

run("test") {
assertFalse(output.contains("Deprecated Gradle features were used in this build"), "There should be no deprecated Gradle features")
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public class KoverSettingsGradlePlugin: Plugin<Settings> {

val agentDependency = configurations.create(SettingsNames.DEPENDENCY_AGENT) {
asDependency()
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(KoverUsageAttr.VALUE))
}
}
dependencies.add(agentDependency.name, rootProject)

Expand All @@ -78,9 +75,6 @@ public class KoverSettingsGradlePlugin: Plugin<Settings> {

val dependencyConfig = configurations.create(KOVER_DEPENDENCY_NAME) {
asDependency()
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(KoverUsageAttr.VALUE))
}
}

val eachProjectRules = mutableMapOf<String, List<ProjectVerificationRuleSettingsImpl>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import org.gradle.kotlin.dsl.register
internal fun prepare(project: Project): KoverContext {
val koverBucketConfiguration = project.configurations.create(KOVER_DEPENDENCY_NAME) {
asBucket()
attributes {
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(KoverUsageAttr.VALUE))
}
}

// Project always consumes its own artifacts
Expand Down

0 comments on commit 2342c07

Please sign in to comment.