Commit 3f8b7c62 authored by Eric Bruneton's avatar Eric Bruneton

Merge branch 'upgrade-to-gradle-4-6' into 'master'

Update to Gradle 4.6, which now has native support for JUnit5.

See merge request !136
parents 84c9bb83 be9dea9f
Pipeline #950 passed with stage
in 6 minutes and 31 seconds
image: gradle:4.4.1-jdk8-alpine
image: gradle:4.6-jdk8-alpine
variables:
# Set the location of the dependency cache to a local directory, so that it
......
......@@ -28,7 +28,6 @@
buildscript {
repositories { mavenCentral() }
dependencies { classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1' }
}
plugins { id 'biz.aQute.bnd.builder' version '3.3.0' apply false }
......@@ -41,12 +40,11 @@ description = 'ASM, a very small and fast Java bytecode manipulation framework'
subprojects {
repositories { mavenCentral() }
apply plugin: 'java'
apply plugin: 'org.junit.platform.gradle.plugin'
junitPlatform { filters { engines { 'junit-jupiter' } } }
group = 'org.ow2.asm'
version = '6.1-beta2'
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
test { useJUnitPlatform() }
ext.provides = [] // The provided java packages, e.g. ['org.objectweb.asm']
ext.requires = [] // The required Gradle projects, e.g. [':asm-test']
ext.depends = [] // The external dependencies, e.g. ['junit:junit:4.12']
......@@ -79,8 +77,8 @@ project(':asm-commons') {
project(':asm-test') {
description = "Utilities for testing ${parent.description}"
provides = ['org.objectweb.asm.test']
depends = ['org.junit.jupiter:junit-jupiter-api:5.0.1',
'org.junit.jupiter:junit-jupiter-params:5.0.1']
depends = ['org.junit.jupiter:junit-jupiter-api:5.1.0',
'org.junit.jupiter:junit-jupiter-params:5.1.0']
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
......@@ -172,47 +170,37 @@ subprojects {
dependencies {
requires.each { projectName -> compile project(projectName) }
depends.each { artifactName -> compile artifactName }
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.1',
'org.junit.jupiter:junit-jupiter-params:5.0.1', project(':asm-test')
// Workaround for https://github.com/junit-team/junit5-samples/issues/45
testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0'
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0',
'org.junit.jupiter:junit-jupiter-params:5.1.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
testCompile project(':asm-test')
}
}
// Exclude anything deprecated or outside asm packages from code coverage.
def jacocoClasses(project) {
return files(project.sourceSets.main.output.collect { fileTree(
dir: it, include: 'org/objectweb/asm/**', exclude: '**/Remapping*'
)})
}
// Configures the projects with a non-empty 'provides' property. These are the
// ones which are published in Maven. They must be checked for code coverage and
// backward compatibility, retrofited to Java 1.5, packaged with biz.aQute.bnd
// and uploaded to Maven with a POM, sources and Javadoc.
configure(subprojects.findAll { it.provides }) {
// Code coverage configuration (JUnit5 is not yet supported by default, we
// need to override the default tasks to make this work).
// Code coverage configuration.
apply plugin: 'jacoco'
jacoco { applyTo junitPlatformTest }
afterEvaluate {
def classes = files(project.sourceSets.main.output.collect { fileTree(
dir: it, include: 'org/objectweb/asm/**', exclude: '**/Remapping*'
)})
task jacocoTestReport(type: JacocoReport, overwrite: true) {
executionData junitPlatformTest
sourceSets sourceSets.main
sourceDirectories = files(project.sourceSets.main.allSource.srcDirs)
classDirectories = classes
}
task jacocoTestCoverageVerification(
type: JacocoCoverageVerification, overwrite: true) {
executionData junitPlatformTest
sourceSets sourceSets.main
sourceDirectories = files(project.sourceSets.main.allSource.srcDirs)
classDirectories = classes
violationRules.rule {
limit {
counter = 'INSTRUCTION'
minimum = minCodeCoverage
}
}
jacocoTestReport {
afterEvaluate { classDirectories = jacocoClasses(project) }
}
jacocoTestCoverageVerification {
violationRules.rule {
limit { counter = 'INSTRUCTION'; minimum = minCodeCoverage }
}
afterEvaluate { classDirectories = jacocoClasses(project) }
}
check.dependsOn jacocoTestCoverageVerification
// Retrofit the code to Java 1.5, in-place, in compileJava.doLast.
if (name != 'asm-test') {
......@@ -282,12 +270,6 @@ configure(subprojects.findAll { it.provides }) {
// Apply the SonarQube plugin to monitor the code quality of the project.
// Use with 'gradlew sonarqube -Dsonar.host.url=https://sonarqube.ow2.org'.
apply plugin: 'org.sonarqube'
sonarqube {
properties {
property 'sonar.jacoco.reportPaths',
"${project.buildDir}/jacoco/junitPlatformTest.exec"
}
}
// Add a task to generate a private javadoc and add it as a dependency of the
// 'check' task.
......
......@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment