Skip to content

Commit

Permalink
Fix #76: use Gradle 4.10.3 to build (#77)
Browse files Browse the repository at this point in the history
* Gradle 4.10.3
* Fix breaking change: checkstyle/checkstyle#6478
  • Loading branch information
TWiStErRob committed May 26, 2019
1 parent 3c312a3 commit b12234a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -67,10 +67,12 @@ cache:
# Prevent "Downloading https://services.gradle.org/distributions/gradle-4.2.1-all.zip"
# Prevent "Unzipping /home/travis/.gradle/wrapper/dists/gradle-4.2.1-all/domrskppdhf3wtn5mziw0c2zr/gradle-4.2.1-all.zip"
- $HOME/.gradle/wrapper/dists/gradle-4.9-all/
- $HOME/.gradle/wrapper/dists/gradle-4.10.3-all/
# Prevent "Download https://jcenter.bintray.com/" during compilation
- $HOME/.gradle/caches/modules-2/
# Prevent "Generating JAR file 'gradle-api-4.2.1.jar'" during compilation
- $HOME/.gradle/caches/4.9/generated-gradle-jars/
- $HOME/.gradle/caches/4.10.3/generated-gradle-jars/
# Prevent "Welcome to Gradle 4.9! Here are the highlights of this release:" in build log
- $HOME/.gradle/notifications/4.9/release-features.rendered
- $HOME/.gradle/notifications/4.10.3/release-features.rendered
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Expand Up @@ -41,7 +41,7 @@ subprojects {
}

tasks {
"sourcesJar" (Jar::class) {
register<Jar>("sourcesJar") {
classifier = "sources"
from(java.sourceSets["main"].kotlin.sourceDirectories)
}
Expand Down Expand Up @@ -235,7 +235,7 @@ project.tasks.create("tests", TestReport::class.java) {
publishing {
publications.invoke {
subprojects.filterNot { it.name == "internal" }.forEach { project ->
project.name(MavenPublication::class) {
register<MavenPublication>(project.name) {
// compiled files: artifact(tasks["jar"])) { classifier = null } + dependencies
from(project.components["java"])
// source files
Expand Down
5 changes: 5 additions & 0 deletions buildSrc/build.gradle.kts
Expand Up @@ -12,6 +12,11 @@ plugins {
`kotlin-dsl`
}

kotlinDslPluginOptions {
// https://docs.gradle.org/4.10.3/userguide/kotlin_dsl.html#sec:kotlin_compiler_arguments
experimentalWarning.set(false)
}

repositories {
jcenter()
}
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/import_control_1_3.dtd">
"https://checkstyle.org/dtds/import_control_1_3.dtd">
<import-control pkg="" strategyOnMismatch="allowed">
</import-control>
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 10 additions & 10 deletions test/build.gradle.kts
Expand Up @@ -26,22 +26,22 @@ dependencies {
}

// Need to depend on the real artifact so TestPluginTest can work
val jar by tasks
tasks {
"test" {
dependsOn(jar)
named<Test>("test") {
dependsOn("jar")
doFirst {
val jar by tasks.named<Jar>("jar")
val artifactPath = jar.outputs.files.singleFile.parentFile
(this as Test).jvmArgs("-Dnet.twisterrob.gradle.test.artifactPath=${artifactPath}")
}
}
}

afterEvaluate {
//noinspection UnnecessaryQualifiedReference keep it explicitly together with code
val metaTask = tasks["pluginUnderTestMetadata"] as org.gradle.plugin.devel.tasks.PluginUnderTestMetadata
metaTask.pluginClasspath = files(
configurations.runtimeClasspath - configurations.compileOnly,
jar.outputs.files.singleFile
)
//noinspection UnnecessaryQualifiedReference keep it explicitly together with code
tasks.named<org.gradle.plugin.devel.tasks.PluginUnderTestMetadata>("pluginUnderTestMetadata") {
pluginClasspath.apply{
setFrom()
from(configurations.runtimeClasspath - configurations.compileOnly)
from(tasks.getByName<Jar>("jar").outputs.files.singleFile)
}
}

0 comments on commit b12234a

Please sign in to comment.