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: variables:
# Set the location of the dependency cache to a local directory, so that it # Set the location of the dependency cache to a local directory, so that it
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
buildscript { buildscript {
repositories { mavenCentral() } 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 } 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' ...@@ -41,12 +40,11 @@ description = 'ASM, a very small and fast Java bytecode manipulation framework'
subprojects { subprojects {
repositories { mavenCentral() } repositories { mavenCentral() }
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'org.junit.platform.gradle.plugin'
junitPlatform { filters { engines { 'junit-jupiter' } } }
group = 'org.ow2.asm' group = 'org.ow2.asm'
version = '6.1-beta2' version = '6.1-beta2'
sourceCompatibility = '1.6' sourceCompatibility = '1.6'
targetCompatibility = '1.6' targetCompatibility = '1.6'
test { useJUnitPlatform() }
ext.provides = [] // The provided java packages, e.g. ['org.objectweb.asm'] ext.provides = [] // The provided java packages, e.g. ['org.objectweb.asm']
ext.requires = [] // The required Gradle projects, e.g. [':asm-test'] ext.requires = [] // The required Gradle projects, e.g. [':asm-test']
ext.depends = [] // The external dependencies, e.g. ['junit:junit:4.12'] ext.depends = [] // The external dependencies, e.g. ['junit:junit:4.12']
...@@ -79,8 +77,8 @@ project(':asm-commons') { ...@@ -79,8 +77,8 @@ project(':asm-commons') {
project(':asm-test') { project(':asm-test') {
description = "Utilities for testing ${parent.description}" description = "Utilities for testing ${parent.description}"
provides = ['org.objectweb.asm.test'] provides = ['org.objectweb.asm.test']
depends = ['org.junit.jupiter:junit-jupiter-api:5.0.1', depends = ['org.junit.jupiter:junit-jupiter-api:5.1.0',
'org.junit.jupiter:junit-jupiter-params:5.0.1'] 'org.junit.jupiter:junit-jupiter-params:5.1.0']
sourceCompatibility = '1.8' sourceCompatibility = '1.8'
targetCompatibility = '1.8' targetCompatibility = '1.8'
} }
...@@ -172,47 +170,37 @@ subprojects { ...@@ -172,47 +170,37 @@ subprojects {
dependencies { dependencies {
requires.each { projectName -> compile project(projectName) } requires.each { projectName -> compile project(projectName) }
depends.each { artifactName -> compile artifactName } depends.each { artifactName -> compile artifactName }
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.1', testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0',
'org.junit.jupiter:junit-jupiter-params:5.0.1', project(':asm-test') 'org.junit.jupiter:junit-jupiter-params:5.1.0'
// Workaround for https://github.com/junit-team/junit5-samples/issues/45 testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0' testCompile project(':asm-test')
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.1'
} }
} }
// 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 // 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 // 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 // backward compatibility, retrofited to Java 1.5, packaged with biz.aQute.bnd
// and uploaded to Maven with a POM, sources and Javadoc. // and uploaded to Maven with a POM, sources and Javadoc.
configure(subprojects.findAll { it.provides }) { configure(subprojects.findAll { it.provides }) {
// Code coverage configuration (JUnit5 is not yet supported by default, we // Code coverage configuration.
// need to override the default tasks to make this work).
apply plugin: 'jacoco' apply plugin: 'jacoco'
jacoco { applyTo junitPlatformTest } jacocoTestReport {
afterEvaluate { afterEvaluate { classDirectories = jacocoClasses(project) }
def classes = files(project.sourceSets.main.output.collect { fileTree( }
dir: it, include: 'org/objectweb/asm/**', exclude: '**/Remapping*' jacocoTestCoverageVerification {
)}) violationRules.rule {
task jacocoTestReport(type: JacocoReport, overwrite: true) { limit { counter = 'INSTRUCTION'; minimum = minCodeCoverage }
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
}
}
} }
afterEvaluate { classDirectories = jacocoClasses(project) }
} }
check.dependsOn jacocoTestCoverageVerification
// Retrofit the code to Java 1.5, in-place, in compileJava.doLast. // Retrofit the code to Java 1.5, in-place, in compileJava.doLast.
if (name != 'asm-test') { if (name != 'asm-test') {
...@@ -282,12 +270,6 @@ configure(subprojects.findAll { it.provides }) { ...@@ -282,12 +270,6 @@ configure(subprojects.findAll { it.provides }) {
// Apply the SonarQube plugin to monitor the code quality of the project. // Apply the SonarQube plugin to monitor the code quality of the project.
// Use with 'gradlew sonarqube -Dsonar.host.url=https://sonarqube.ow2.org'. // Use with 'gradlew sonarqube -Dsonar.host.url=https://sonarqube.ow2.org'.
apply plugin: 'org.sonarqube' 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 // Add a task to generate a private javadoc and add it as a dependency of the
// 'check' task. // 'check' task.
......
...@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME ...@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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