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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We use [semantic versioning](http://semver.org/):
- [fix] _agent_, _teamscale-gradle-plugin_, _teamscale-maven-plugin_: A corrupt class file whose class name cannot be read is skipped with a warning instead of failing the coverage report.
- [fix] _impacted-test-engine_: A test that a failing assumption aborts is reported as skipped instead of as an error.
- [fix] _teamscale-gradle-plugin_: The plugin now works when the build sets `jacoco.excludes` or the JUnit Platform `excludeEngines` of a test task to a read-only collection (for example, `listOf(...)` or `setOf(...)` in the Kotlin DSL). Previously, applying the plugin or running the test task failed with an `UnsupportedOperationException`.
- [fix] _teamscale-gradle-plugin_: Applying `com.teamscale.aggregation` no longer emits deprecation warnings on Gradle 9.6 and newer.
- [fix] _teamscale-gradle-plugin_: The default excludes now match Mockito mocks (e.g. `com.company.IFoo$MockitoMock$123`) and Guice fast classes (e.g. `com.company.Foo$$FastClassByGuice$$abc`). Previously the profiler instrumented them, and the testwise coverage report warned that it found coverage for classes that were not provided.

# 39.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=FAIL
org.gradle.configuration-cache.parallel=true
org.gradle.daemon=false
org.gradle.isolated-projects=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.teamscale.tia

import com.teamscale.test.commons.SystemTestUtils.runGradle
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

/**
* Checks that the plugins are compatible with [Isolated Projects](https://docs.gradle.org/current/userguide/isolated_projects.html).
* It is enabled via gradle.properties, so every build of the test project fails on a violation.
*/
class IsolatedProjectsTest {
@Test
fun testIsolatedProjects() {
val result = runGradle(
"gradle-project", "clean",
"unitTestAggregateCompactCoverageReport", "unitTestAggregateJUnitReport",
"systemTestAggregateTestwiseCoverageReport"
)
// Guards against the tests of this module silently running without Isolated Projects.
assertThat(result.stdout).contains("Isolated Projects is an incubating feature")
}
}
2 changes: 2 additions & 0 deletions teamscale-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ gradlePlugin {
compatibility {
features {
configurationCache = true
isolatedProjects = true
}
}
}
Expand All @@ -54,6 +55,7 @@ gradlePlugin {
compatibility {
features {
configurationCache = true
isolatedProjects = true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,22 @@ abstract class ReportAggregationPlugin : Plugin<Project> {
@get:Inject
protected abstract val jvmPluginServices: JvmPluginServices

@Suppress("DEPRECATION")
override fun apply(project: Project) {
val configurations = project.configurations
val reportAggregation =
configurations.dependencyScope(REPORT_AGGREGATION_CONFIGURATION_NAME) {
description = "A configuration to collect reports across projects."
isVisible = false
}.get()

val aggregateReportResults = configurations.resolvable(AGGREGATE_REPORT_RESULTS_CONFIGURATION_NAME) {
extendsFrom(reportAggregation)
description =
"Resolvable configuration used to gather files for report aggregation via ArtifactViews, not intended to be used directly"
isVisible = false
}.get()

project.plugins.withType<JavaBasePlugin> {
reportAggregation.dependencies.add(project.dependencyFactory.create(project))
// The map notation is the only way to create a project dependency that works on Gradle 8 and is not deprecated on Gradle 9.
reportAggregation.dependencies.add(project.dependencies.project(mapOf("path" to project.path)))
// If the current project is jvm-based, aggregate dependent projects as jvm-based as well.
jvmPluginServices.configureAsRuntimeElements(aggregateReportResults)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.teamscale

import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

/**
* Tests that applying the plugins emits no deprecation warnings. Runs on the Gradle version that builds the plugin,
* since new deprecations only show up on newer Gradle versions than the minimum supported one.
*/
class DeprecationWarningTest : TeamscalePluginTestBase() {

override val gradleVersion: String? = null

@BeforeEach
fun init() {
rootProject.settingsFile.writeText("rootProject.name = 'deprecations'")
}

@Test
fun `aggregation plugin emits no deprecation warning`() {
rootProject.buildFile.writeText(
"""
plugins {
id 'com.teamscale.aggregation'
}
""".trimIndent()
)

run("help", "--warning-mode=fail")
}

@Test
fun `aggregation plugin in a Java project emits no deprecation warning`() {
rootProject.buildFile.writeText(
"""
plugins {
id 'java'
id 'com.teamscale'
id 'com.teamscale.aggregation'
}
""".trimIndent()
)

run("help", "--warning-mode=fail")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ abstract class TeamscalePluginTestBase {
System.getProperty("systemTestCoverageAgent")?.takeIf { it.none(Char::isWhitespace) }
}

/** The Gradle version to run the builds with, or null for the Gradle distribution that runs the tests. */
protected open val gradleVersion: String? = TeamscalePlugin.MINIMUM_SUPPORTED_VERSION.version

/** Teamscale mock server to be used during the tests. */
protected lateinit var teamscaleMockServer: TeamscaleMockServer

Expand Down Expand Up @@ -87,7 +90,7 @@ abstract class TeamscalePluginTestBase {
.withProjectDir(rootProject.projectDir)
.withPluginClasspath()
.withArguments(runnerArgs)
.withGradleVersion(TeamscalePlugin.MINIMUM_SUPPORTED_VERSION.version)
gradleVersion?.let { runner.withGradleVersion(it) }

return runner
}
Expand Down
Loading