From f3edebd5b739031d3b35abcc329ecd9d71356aae Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Mon, 15 Apr 2019 12:47:09 +0100 Subject: [PATCH] Update to Java 8 This also removes all unnecessary configuration for Java 6 as well as references to the release/2.x branch. --- .dependabot/config.yml | 3 +-- .github/CONTRIBUTING.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- .travis.yml | 2 +- README.md | 10 +++++----- build.gradle | 6 ++---- gradle/java-library.gradle | 4 ++-- gradle/mockito-core/javadoc.gradle | 16 +++++++--------- gradle/root/java-compatibility-check.gradle | 13 ------------- gradle/shipkit.gradle | 1 - .../deprecatedPluginsTest.gradle | 2 -- subprojects/errorprone/errorprone.gradle | 3 --- subprojects/extTest/extTest.gradle | 2 -- subprojects/junit-jupiter/junit-jupiter.gradle | 3 --- .../junitJupiterExtensionTest.gradle | 2 -- version.properties | 5 +---- 16 files changed, 22 insertions(+), 56 deletions(-) delete mode 100644 gradle/root/java-compatibility-check.gradle diff --git a/.dependabot/config.yml b/.dependabot/config.yml index cd85cf642e..16be16a270 100644 --- a/.dependabot/config.yml +++ b/.dependabot/config.yml @@ -5,5 +5,4 @@ update_configs: directory: "/" update_schedule: "daily" # Redundant - default repository branch by default - target_branch: "release/2.x" - + target_branch: "release/3.x" diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e17a75294a..b399d0fc7f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -13,7 +13,7 @@ # Contributing to Mockito Which branch : -* On mockito 2.x, make your pull request target `release/2.x` +* On mockito 3.x (or 2.x), make your pull request target `release/3.x` (or `release/2.x`) * On next mockito version make your pull request target `master` ## Pull request criteria diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f4440d87f1..b15f4f8413 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,7 @@ > There may be a thorough review, with feedback -> code change loop. > > Which branch : -> - On mockito 2.x, make your pull request target `release/2.x` +> - On mockito 3.x (or 2.x), make your pull request target `release/3.x` (or `release/2.x`) > - On next mockito version make your pull request target `master` > > _This block can be removed_ @@ -15,7 +15,7 @@ check list - - [ ] Read the [contributing guide](https://github.com/mockito/mockito/blob/release/2.x/.github/CONTRIBUTING.md) + - [ ] Read the [contributing guide](https://github.com/mockito/mockito/blob/release/3.x/.github/CONTRIBUTING.md) - [ ] PR should be motivated, i.e. what does it fix, why, and if relevant how - [ ] If possible / relevant include an example in the description, that could help all readers including project members to get a better picture of the change diff --git a/.travis.yml b/.travis.yml index 56d834e9d6..4faa7c1828 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ script: # We are using && below on purpose # ciPerformRelease must run only when the entire build has completed # This guarantees that no release steps are executed when the build or tests fail - - ./gradlew build idea -s -PcheckJavaCompatibility && ./gradlew ciPerformRelease + - ./gradlew build idea -s && ./gradlew ciPerformRelease after_success: #Generates coverage report: diff --git a/README.md b/README.md index 2abe9b0101..21ffee5cc0 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,18 @@ Most popular mocking framework for Java -[![Build Status](https://travis-ci.org/mockito/mockito.svg?branch=release/2.x)](https://travis-ci.org/mockito/mockito) [![Coverage Status](https://img.shields.io/codecov/c/github/mockito/mockito.svg)](https://codecov.io/github/mockito/mockito) [![MIT License](http://img.shields.io/badge/license-MIT-green.svg) ](https://github.com/mockito/mockito/blob/master/LICENSE) +[![Build Status](https://travis-ci.org/mockito/mockito.svg?branch=release/3.x)](https://travis-ci.org/mockito/mockito) [![Coverage Status](https://img.shields.io/codecov/c/github/mockito/mockito.svg)](https://codecov.io/github/mockito/mockito) [![MIT License](http://img.shields.io/badge/license-MIT-green.svg) ](https://github.com/mockito/mockito/blob/master/LICENSE) -[![latest release](https://img.shields.io/badge/release%20notes-2.x-yellow.svg)](https://github.com/mockito/mockito/blob/release/2.x/doc/release-notes/official.md) +[![latest release](https://img.shields.io/badge/release%20notes-3.x-yellow.svg)](https://github.com/mockito/mockito/blob/release/3.x/doc/release-notes/official.md) [![Bintray](https://api.bintray.com/packages/mockito/maven/mockito-development/images/download.svg)](https://bintray.com/mockito/maven) [![Maven Central](https://img.shields.io/maven-central/v/org.mockito/mockito-core.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.mockito%22%20AND%20a%3A%22mockito-core%22) [![Javadocs](http://www.javadoc.io/badge/org.mockito/mockito-core.svg?color=red)](http://www.javadoc.io/doc/org.mockito/mockito-core) -## Current version is 2.x +## Current version is 3.x Still on Mockito 1.x? See [what's new](https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2) in Mockito 2! -Mockito [continuously delivers](https://github.com/mockito/mockito/wiki/Continuous-Delivery-Overview) improvements using Shipkit library (http://shipkit.org). See the [latest release notes](https://github.com/mockito/mockito/blob/release/2.x/doc/release-notes/official.md) and [latest documentation](http://javadoc.io/page/org.mockito/mockito-core/2/org/mockito/Mockito.html). Docs in javadoc.io are available 24h after release. Read also about [semantic versioning in Mockito](https://github.com/mockito/mockito/wiki/Semantic-Versioning). +Mockito [continuously delivers](https://github.com/mockito/mockito/wiki/Continuous-Delivery-Overview) improvements using Shipkit library (http://shipkit.org). See the [latest release notes](https://github.com/mockito/mockito/blob/release/3.x/doc/release-notes/official.md) and [latest documentation](http://javadoc.io/page/org.mockito/mockito-core/2/org/mockito/Mockito.html). Docs in javadoc.io are available 24h after release. Read also about [semantic versioning in Mockito](https://github.com/mockito/mockito/wiki/Semantic-Versioning). Older 1.x releases are available in [Central Repository](http://search.maven.org/#artifactdetails|org.mockito|mockito-core|1.10.19|jar) @@ -28,7 +28,7 @@ and [javadoc.io](http://javadoc.io/page/org.mockito/mockito-core/1.10.19/org/moc All you want to know about Mockito is hosted at [The Mockito Site](http://site.mockito.org) which is [Open Source](https://github.com/mockito/mockito.github.io) and likes [pull requests](https://github.com/mockito/mockito.github.io/pulls), too. -Want to contribute? Take a look at the [Contributing Guide](https://github.com/mockito/mockito/blob/release/2.x/.github/CONTRIBUTING.md). +Want to contribute? Take a look at the [Contributing Guide](https://github.com/mockito/mockito/blob/release/3.x/.github/CONTRIBUTING.md). Enjoy Mockito! diff --git a/build.gradle b/build.gradle index 45336ac673..febcadafca 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,6 @@ buildscript { dependencies { classpath 'gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.14.0' - classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.5.0' //for 'java-compatibility-check.gradle' classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.6' //Using buildscript.classpath so that we can resolve shipkit from maven local, during local testing @@ -35,7 +34,6 @@ allprojects { apply from: 'gradle/root/ide.gradle' apply from: 'gradle/root/gradle-fix.gradle' -apply from: 'gradle/root/java-compatibility-check.gradle' apply from: 'gradle/java-library.gradle' apply from: 'gradle/license.gradle' apply from: 'gradle/root/coverage.gradle' @@ -93,8 +91,8 @@ dependencies { } wrapper { - gradleVersion = '4.9' - distributionSha256Sum = 'e66e69dce8173dd2004b39ba93586a184628bc6c28461bc771d6835f7f9b0d28' + gradleVersion = '5.3.1' + distributionSha256Sum = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' } //Posting Build scans to https://scans.gradle.com diff --git a/gradle/java-library.gradle b/gradle/java-library.gradle index 7e857d0758..be214c6c24 100644 --- a/gradle/java-library.gradle +++ b/gradle/java-library.gradle @@ -15,8 +15,8 @@ generatePomFileForJavaLibraryPublication.doLast { bintrayUpload.enabled = true -sourceCompatibility = 1.6 -targetCompatibility = 1.6 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 test { include "**/*Test.class" diff --git a/gradle/mockito-core/javadoc.gradle b/gradle/mockito-core/javadoc.gradle index d770bdcfc3..0ed36bb960 100644 --- a/gradle/mockito-core/javadoc.gradle +++ b/gradle/mockito-core/javadoc.gradle @@ -54,17 +54,15 @@ javadoc { """.replaceAll(/\r|\n|[ ]{8}/, "")) options.stylesheetFile rootProject.file("src/javadoc/stylesheet.css") - if (JavaVersion.current().isJava8Compatible()) { - options.addStringOption('Xdoclint:none', '-quiet') + options.addStringOption('Xdoclint:none', '-quiet') - def minorVersion = System.getProperty("java.version") =~ /1.8.0_(\d*)/ + def minorVersion = System.getProperty("java.version") =~ /1.8.0_(\d*)/ - // Since JDK 8 version 121 scripts are not allowed in comments. However, - // earlier version throw an error if an unknown option is passed. - // Therefore only add this option if the JDK is actually correct. - if (minorVersion.size() > 0 && Integer.valueOf(minorVersion[0][1]) >= 121 || JavaVersion.current().isJava9Compatible()) { - options.addBooleanOption('-allow-script-in-comments', true) - } + // Since JDK 8 version 121 scripts are not allowed in comments. However, + // earlier version throw an error if an unknown option is passed. + // Therefore only add this option if the JDK is actually correct. + if (minorVersion.size() > 0 && Integer.valueOf(minorVersion[0][1]) >= 121 || JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('-allow-script-in-comments', true) } doLast { diff --git a/gradle/root/java-compatibility-check.gradle b/gradle/root/java-compatibility-check.gradle deleted file mode 100644 index fb2a1ca002..0000000000 --- a/gradle/root/java-compatibility-check.gradle +++ /dev/null @@ -1,13 +0,0 @@ -//Use animal sniffer to detect Java incompatibilities, as we build on newer JDKs -//if we're skipping release, let's also skip checking compatibility (faster builds) -if (project.hasProperty('checkJavaCompatibility') && !System.getenv("SKIP_RELEASE")) { - allprojects { p -> - def isJava8 = p.name != 'junit-jupiter' && p.name != 'errorprone' - plugins.withId('java') { - p.apply plugin: 'ru.vyarus.animalsniffer' - p.dependencies { - signature "org.codehaus.mojo.signature:java1${isJava8 ? '6' : '8'}:1.0@signature" - } - } - } -} diff --git a/gradle/shipkit.gradle b/gradle/shipkit.gradle index db99c6165f..aa4546cd0e 100644 --- a/gradle/shipkit.gradle +++ b/gradle/shipkit.gradle @@ -15,7 +15,6 @@ shipkit { 'docs': 'Documentation' ] - //git.releasableBranchRegex = "master|release/.+" // matches 'master', 'release/2.x', 'release/3.x', etc. git.releasableBranchRegex = "release/.+" // 'release/2.x', 'release/3.x', etc. def buildNo = System.getenv("TRAVIS_BUILD_NUMBER") diff --git a/subprojects/deprecatedPluginsTest/deprecatedPluginsTest.gradle b/subprojects/deprecatedPluginsTest/deprecatedPluginsTest.gradle index 4f22c60313..d685a4dc0e 100644 --- a/subprojects/deprecatedPluginsTest/deprecatedPluginsTest.gradle +++ b/subprojects/deprecatedPluginsTest/deprecatedPluginsTest.gradle @@ -3,8 +3,6 @@ apply from: "$rootDir/gradle/dependencies.gradle" apply plugin: 'java' description = "End-to-end tests for deprecated Mockito plugins." -sourceCompatibility = 1.8 - dependencies { testCompile project(":") testCompile libraries.junit4 diff --git a/subprojects/errorprone/errorprone.gradle b/subprojects/errorprone/errorprone.gradle index 5f97da1c22..786480264b 100644 --- a/subprojects/errorprone/errorprone.gradle +++ b/subprojects/errorprone/errorprone.gradle @@ -11,9 +11,6 @@ dependencies { testCompile libraries.errorproneTestApi } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - test { inputs.files(configurations.errorproneJavac).withNormalizer(ClasspathNormalizer) jvmArgs += "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" diff --git a/subprojects/extTest/extTest.gradle b/subprojects/extTest/extTest.gradle index aa07054a61..35b9811af8 100644 --- a/subprojects/extTest/extTest.gradle +++ b/subprojects/extTest/extTest.gradle @@ -3,8 +3,6 @@ apply from: "$rootDir/gradle/dependencies.gradle" apply plugin: 'java' description = "End-to-end tests for Mockito and its extensions." -sourceCompatibility = 1.8 - repositories { mavenLocal() //we depend on locally published mockito } diff --git a/subprojects/junit-jupiter/junit-jupiter.gradle b/subprojects/junit-jupiter/junit-jupiter.gradle index d5b2982226..7cfc0b7de1 100644 --- a/subprojects/junit-jupiter/junit-jupiter.gradle +++ b/subprojects/junit-jupiter/junit-jupiter.gradle @@ -2,9 +2,6 @@ description = "Mockito JUnit 5 support" apply from: "$rootDir/gradle/java-library.gradle" -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - dependencies { compile project.rootProject implementation libraries.junitJupiterApi diff --git a/subprojects/junitJupiterExtensionTest/junitJupiterExtensionTest.gradle b/subprojects/junitJupiterExtensionTest/junitJupiterExtensionTest.gradle index 1761dcd46d..184278b838 100644 --- a/subprojects/junitJupiterExtensionTest/junitJupiterExtensionTest.gradle +++ b/subprojects/junitJupiterExtensionTest/junitJupiterExtensionTest.gradle @@ -3,8 +3,6 @@ apply from: "$rootDir/gradle/dependencies.gradle" apply plugin: 'java' description = "End-to-end tests for automatic registration of MockitoExtension." -sourceCompatibility = 1.8 - dependencies { testCompile project(":junit-jupiter") testCompile libraries.assertj diff --git a/version.properties b/version.properties index fe2f3f97fa..6975939054 100644 --- a/version.properties +++ b/version.properties @@ -1,8 +1,5 @@ #Currently building Mockito version -version=2.27.1 +version=3.0.0 #Previous version used to generate release notes delta previousVersion=2.27.0 - -#Not published currently, see https://github.com/mockito/mockito/issues/962 -mockito.testng.version=1.0