diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10f5088e..0c6fd695 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [8, 11, 17, 18] # todo: update to latest Gradle version for Java 21 support + java: [ 8, 11, 17, 18, 21 ] fail-fast: false max-parallel: 4 name: JDK ${{ matrix.java }} diff --git a/build.gradle b/build.gradle index 56c09ffa..423bab36 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,6 @@ buildscript { } } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0' classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:6.1.0' } } @@ -114,10 +113,11 @@ subprojects { mavenJava(MavenPublication) { from components.java - artifactId = jar.baseName + artifactId = project.name + //artifactId = jar.archiveBaseName pom { - name = jar.baseName + name = project.name description = 'A library to query and verify JSON' url = 'https://github.com/jayway/JsonPath' @@ -149,9 +149,6 @@ subprojects { } wrapper { - gradleVersion = '7.4.2' + gradleVersion = '8.5' } -//Task used by Heroku for staging -task stage(dependsOn: [':json-path-web-test:clean', 'json-path-web-test:jar', 'json-path-web-test:shadowJar']) {} - diff --git a/gradle/binaryCompatibility.gradle b/gradle/binaryCompatibility.gradle deleted file mode 100644 index 57111001..00000000 --- a/gradle/binaryCompatibility.gradle +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2003-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import groovy.text.markup.MarkupTemplateEngine -import groovy.text.markup.TemplateConfiguration - - -buildscript { - // this block should not be necessary, but for some reason it fails without! - repositories { - mavenCentral() - maven { - url "https://plugins.gradle.org/m2/" - } - } - - dependencies { - classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.4.0' - } -} - - -task checkBinaryCompatibility { - description = 'Generates binary compatibility reports' -} - - -if (JavaVersion.current().isJava7Compatible()) { - apply plugin: 'me.champeau.gradle.japicmp' - - - def reportGenerator = { model -> - outputProcessor { - - def skipClass = { c -> c.fullyQualifiedName.startsWith('com.jayway.jsonpath.internal') || c.fullyQualifiedName.contains('$')} - def skipMethod = { c, m -> skipClass(c) || m.name =~ /access\$[0-9]+/ } - def violations = [:].withDefault { - // key = class name - // value = map of violations - [:].withDefault { [] } - } - removedMethod { c, m -> - if (!skipMethod(c, m)) { - def level = m.name.startsWith('super$') ? 'warning' : 'error' - violations[c.fullyQualifiedName][level] << "Method ${m.name} has been removed" - } - } - removedClass { c -> - if (!skipClass(c)) { - violations[c.fullyQualifiedName].error << "Class has been removed" - } - } - modifiedMethod { c, m -> - if (!skipMethod(c, m)) { - violations[c.fullyQualifiedName].warning << """
Method ${m.name} has been modified
-From
${m.oldMethod.get()?.longName}to
${m.newMethod.get()?.longName}""" - } - } - newClass { c -> - if (!skipClass(c)) { - violations[c.fullyQualifiedName].info << "Class has been added" - } - } - newMethod { c, m -> - if (!skipMethod(c, m)) { - violations[c.fullyQualifiedName].info << """
Method ${m.name} has been added
-Signature:
${m.newMethod.get()?.longName}""" - } - } - after { - model.violations = violations - } - } - } - -// using a global engine for all tasks in order to increase performance - def configDir = file("$rootDir/gradle") - def templateFile = 'binarycompat-report.groovy' - def templateConfiguration = new TemplateConfiguration() - templateConfiguration.with { - autoIndent = true - autoNewLine = true - } - def engine = new MarkupTemplateEngine(this.class.classLoader, configDir, templateConfiguration) - - - subprojects { - - tasks.register("japicmp", me.champeau.gradle.japicmp.JapicmpTask) { - //task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask) { - dependsOn jar - //baseline = "com.jayway.jsonpath:${project.name}:+@jar" //latest release - baseline = 'com.jayway.jsonpath:json-path:2.0.0@jar' - to = jar.archivePath - accessModifier = 'protected' - onlyModified = true - failOnModification = false - txtOutputFile = file("$buildDir/reports/japi.txt") - - def htmlReportFile = file("${buildDir}/reports/binary-compat-${project.name}.html") - inputs.file file("$configDir/$templateFile") - outputs.file htmlReportFile - - def model = [title : "Binary compatibility report for ${project.name}", - project : project, - baseline: baseline, - archive : to.name] - outputProcessor(reportGenerator.curry(model)) - - doLast { - htmlReportFile.withWriter('utf-8') { wrt -> - engine.createTemplateByPath(templateFile).make(model).writeTo(wrt) - } - } - } - } - - subprojects { - check.dependsOn(checkBinaryCompatibility) - - tasks.register("checkCompatibility", me.champeau.gradle.japicmp.JapicmpTask) { task -> - checkBinaryCompatibility.dependsOn(task) - } - } -} diff --git a/gradle/binarycompat-report.groovy b/gradle/binarycompat-report.groovy deleted file mode 100644 index 9e3e6633..00000000 --- a/gradle/binarycompat-report.groovy +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2003-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A template which generates an HTML report from the bincompat XML report - */ -modelTypes = { - String title - String baseline - String archive - Map