Skip to content

Commit

Permalink
Fix Gradle 8.1 Compatibility (#26)
Browse files Browse the repository at this point in the history
* Update Gradle, Kotlin, plugin-publish

* Add `.editorconfig` to ensure common formatting across the project

* Add `settings.gradle` with `rootProject.name` to fix abiltiy to relocate build cache

* Enable build cache for better build performance

* Configure toolchains, use LTS java version

* Fix kotlin deprecation warning

* Temporairly disable `pl.droidsonroids.jacoco.testkit` due to incompatibility

* Fix Gradle 8.1 compatibility by not subclassing `WriteProperties` task

* Bump min_supported gradle version

* Update Configuration Cache test

Make it run twice, to ensure second run will actually use cached values

* Remove file that doesn't exist anymore
  • Loading branch information
mateuszkwiecinski authored Apr 15, 2023
1 parent 6186899 commit f4e8d4b
Show file tree
Hide file tree
Showing 13 changed files with 265 additions and 193 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{kt,kts}]
max_line_length = 140
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for more details.
- Apply plugin in `build.gradle`:
```groovy
plugins {
id "pl.droidsonroids.jacoco.testkit" version "1.0.8"
id "pl.droidsonroids.jacoco.testkit" version "1.0.9"
}
```
This will add `testkit-gradle.properties` system resource.
Expand Down Expand Up @@ -56,13 +56,13 @@ class AwesomeTest {
### Adding coverage for another task (ex. integrationTest)
By default the plugin configures the `test` task for any project with Java plugin applied.

To configure the coverage for another task just add something like this:
To configure the coverage for another task just add something like this:
```groovy
jacocoTestKit {
applyTo("intTestRuntimeOnly", tasks.named("integrationTest"))
}
```

### Custom JaCoCo destination file
JaCoCo destination file path reads it from the `JacocoTaskExtension` so you can change it like this:
```groovy
Expand All @@ -73,5 +73,5 @@ tasks.named("test").configure {
}
```

### Update from 1.0.5 or older
Starting from plugin version 1.0.6 the minimum supported Gradle version is 4.9
### Requirements
Minimum supported Gradle version is 7.6
33 changes: 12 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.32'
id 'com.gradle.plugin-publish' version '0.14.0'
id 'org.jetbrains.kotlin.jvm' version '1.8.20'
id 'com.gradle.plugin-publish' version '1.2.0'
id 'jacoco'
id 'java-gradle-plugin'
id 'pl.droidsonroids.jacoco.testkit' version '1.0.8'
// id 'pl.droidsonroids.jacoco.testkit' version '1.0.8'
}

dependencies {
Expand All @@ -12,45 +12,36 @@ dependencies {
testImplementation 'org.assertj:assertj-core:3.16.1'
}

repositories {
mavenCentral()
}

group = GROUP
version = VERSION_NAME

pluginBundle {
gradlePlugin {
website = POM_URL
vcsUrl = POM_SCM_URL
description = POM_DESCRIPTION
tags = ['jacoco', 'coverage', 'testkit', 'test']

plugins {
jacocoTestKitPlugin {
id = 'pl.droidsonroids.jacoco.testkit'
implementationClass = 'pl.droidsonroids.gradle.jacoco.testkit.JaCoCoTestKitPlugin'
displayName = POM_NAME
description = POM_DESCRIPTION
tags.set(['jacoco', 'coverage', 'testkit', 'test'])
}
}
}

gradlePlugin {
plugins {
jacocoTestKitPlugin {
id = 'pl.droidsonroids.jacoco.testkit'
implementationClass = 'pl.droidsonroids.gradle.jacoco.testkit.JaCoCoTestKitPlugin'
}
}
kotlin {
jvmToolchain(17)
}

jacoco {
toolVersion '0.8.6'
toolVersion '0.8.9'
}

jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
xml.required = true
csv.required = false
html.required = true
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ POM_PACKAGING=jar
POM_EMAIL[email protected]
POM_INCEPTION_YEAR=2017
POM_DEVELOPER_NAME=Karol Wrótniak
org.gradle.caching=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit f4e8d4b

Please sign in to comment.