diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9af6b78..b658109 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,11 @@ name: build -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + types: [ opened, labeled, unlabeled, synchronize ] env: GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" @@ -13,38 +18,39 @@ jobs: fail-fast: false matrix: java-version: - - 1.8 + - 8 steps: + - name: Checkout Project + uses: actions/checkout@v3 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1.0.4 + - name: Cache Gradle dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.gradle/caches ~/.gradle/wrapper/ ~/.android/build-cache - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - - name: Checkout Project - uses: actions/checkout@v2 - - - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-gradle- - name: Configure JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v3.1.0 with: + distribution: temurin java-version: ${{ matrix.java-version }} - name: Run Build - run: ./gradlew clean build jar docsJar sourcesJar testsJar reportsZip generatePomFileForMavenPublication -s --scan + run: ./gradlew clean build -s - name: Upload Artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3.0.0 if: always() with: - name: gradle-checker-framework-plugin-${{ github.workflow }}-${{ github.run_id }} + name: gradle-license-plugin-${{ github.workflow }}-${{ github.run_id }} path: | build/libs build/outputs @@ -62,20 +68,19 @@ jobs: steps: - name: Checkout Project - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v1.0.4 - name: Configure JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v3.1.0 with: - java-version: 1.8 + distribution: temurin + java-version: 8 - name: Publish - run: ./gradlew clean artifactoryPublish -s --scan + run: ./gradlew clean publish -s env: - BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }} - BINTRAY_USERNAME: ${{ secrets.BINTRAY_USERNAME }} - GRADLE_KEY: ${{ secrets.GRADLE_KEY }} - GRADLE_SECRET: ${{ secrets.GRADLE_SECRET }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} diff --git a/README.md b/README.md index 0b1f75e..6e0873c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Gradle Checker Framework Plugin [![License](https://img.shields.io/badge/license-apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) -[![Build](https://github.com/jaredsburrows/gradle-checker-framework-plugin/workflows/build/badge.svg)](https://github.com/jaredsburrows/gradle-checker-framework-plugin/actions) +[![Build](https://github.com/jaredsburrows/gradle-checker-framework-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/jaredsburrows/gradle-checker-framework-plugin/actions/workflows/build.yml) [![Twitter Follow](https://img.shields.io/twitter/follow/jaredsburrows.svg?style=social)](https://twitter.com/jaredsburrows) This plugin configures `JavaCompile` tasks to use the [Checker Framework](https://checkerframework.org). @@ -17,7 +17,7 @@ This plugin configures `JavaCompile` tasks to use the [Checker Framework](https: ```groovy buildscript { repositories { - jcenter() + mavenCentral() } dependencies { @@ -27,13 +27,13 @@ buildscript { apply plugin: 'com.jaredsburrows.checkerframework' ``` -Release versions are available in the [JFrog Bintray repository](https://jcenter.bintray.com/com/jaredsburrows/gradle-checker-framework-plugin/). +Release versions are available in the [Sonatype's release repository](https://repo1.maven.org/maven2/com/jaredsburrows/gradle-checker-framework-plugin/). **Snapshot:** ```groovy buildscript { repositories { - maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' } + maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } } dependencies { @@ -43,7 +43,7 @@ buildscript { apply plugin: 'com.jaredsburrows.checkerframework' ``` -Snapshot versions are available in the [JFrog Artifactory repository](https://oss.jfrog.org/artifactory/libs-snapshot/com/jaredsburrows/gradle-checker-framework-plugin/). +Snapshot versions are available in the [Sonatype's snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/com/jaredsburrows/gradle-checker-framework-plugin/). ## Configuration @@ -65,17 +65,18 @@ By default, only the `NullnessChecker` is enabled. You can find out what checkers are available in the [Checker Framework Manual](https://checkerframework.org/manual/#introduction). ## License +``` +Copyright (C) 2017 Jared Burrows - Copyright (C) 2017 Jared Burrows - - 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 +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 + 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. +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. +``` diff --git a/build.gradle b/build.gradle index 259c7ce..7817264 100644 --- a/build.gradle +++ b/build.gradle @@ -1,45 +1,79 @@ +import java.time.ZonedDateTime +import java.time.format.DateTimeFormatter + plugins { - id 'com.jfrog.artifactory' version '4.18.3' - id 'com.jfrog.bintray' version '1.8.5' - id 'com.github.ben-manes.versions' version '0.36.0' - id 'com.gradle.plugin-publish' version '0.12.0' + alias(libs.plugins.maven.publish) apply false + alias(libs.plugins.plugin.publish) apply false + alias(libs.plugins.versions) id 'java-gradle-plugin' + id 'java-library' id 'groovy' - id 'maven-publish' } -repositories { - jcenter() - google() -} +subprojects { + repositories { + mavenCentral() + google() + } -apply from: 'gradle/dependencies.gradle' + tasks.withType(Jar).configureEach { + def dateFile = new File(buildDir, 'jar-manifest-date.txt') + if (!dateFile.exists()) { + def date = DateTimeFormatter.ofPattern('EEE MMM dd HH:mm:ss zzz yyyy'). + format(ZonedDateTime.now()) + dateFile.parentFile.mkdirs() + dateFile.text = date.trim() + } -group = GROUP -version = VERSION_NAME -description = POM_DESCRIPTION + manifest { + attributes( + 'Created-By': POM_DEVELOPER_NAME, + 'Implementation-Title': POM_NAME, + 'Implementation-Version': VERSION_NAME, + 'Implementation-Vendor': POM_DEVELOPER_NAME, + 'Built-By': System.getProperty('user.name'), + 'Built-Date': dateFile.text.trim(), + 'Built-JDK': System.getProperty('java.version'), + 'Built-Gradle': gradle.gradleVersion) + } + } -sourceCompatibility = versions.java -targetCompatibility = versions.java + tasks.withType(JavaCompile).configureEach { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 -jar { - manifest { - attributes( - 'Implementation-Title': POM_NAME, - 'Implementation-Version': archiveVersion, - 'Built-By': System.getProperty('user.name'), - 'Built-Date': new Date(), - 'Built-JDK': System.getProperty('java.version'), - 'Built-Gradle': gradle.gradleVersion) + configure(options) { + compilerArgs << '-Xlint:all' + compilerArgs << '-Xlint:-options' + encoding = 'utf-8' + fork = true + } } -} -dependencies { - implementation localGroovy() + tasks.withType(GroovyCompile).configureEach { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 - testImplementation deps.android.tools.build.gradle - testImplementation deps.spock, { exclude module: 'groovy-all' } // Use localGroovy() -} + configure(options) { + compilerArgs << '-Xlint:all' + compilerArgs << '-Xlint:-options' + encoding = 'utf-8' + fork = true + } + } + + tasks.withType(Test).configureEach { + useJUnitPlatform() + + testLogging { + exceptionFormat 'full' + showCauses true + showExceptions true + showStackTraces true + events 'failed', 'skipped' + } -apply from: 'gradle/compile.gradle' -apply from: 'gradle/publish.gradle' + def maxWorkerCount = gradle.startParameter.maxWorkerCount + maxParallelForks = (maxWorkerCount < 2) ? 1 : maxWorkerCount / 2 + } +} diff --git a/gradle-checker-framework-plugin/build.gradle b/gradle-checker-framework-plugin/build.gradle new file mode 100644 index 0000000..e95b9aa --- /dev/null +++ b/gradle-checker-framework-plugin/build.gradle @@ -0,0 +1,28 @@ +plugins { + alias(libs.plugins.maven.publish) + alias(libs.plugins.plugin.publish) + alias(libs.plugins.versions) + id 'java-gradle-plugin' + id 'java-library' + id 'groovy' +} + +dependencies { + compileOnly gradleApi() + + implementation localGroovy() + + testImplementation localGroovy() + testImplementation gradleTestKit() + testImplementation libs.android.plugin + testImplementation libs.spock, { exclude module: 'groovy-all' } // Use localGroovy() +} + +gradlePlugin { + plugins { + licensePlugin { + id = PLUGIN_NAME + implementationClass = PLUGIN_NAME_CLASS + } + } +} diff --git a/gradle-checker-framework-plugin/gradle.properties b/gradle-checker-framework-plugin/gradle.properties new file mode 100644 index 0000000..ec80ef2 --- /dev/null +++ b/gradle-checker-framework-plugin/gradle.properties @@ -0,0 +1,3 @@ +POM_ARTIFACT_ID=gradle-checker-framework-plugin +POM_NAME=Gradle Checker Framework Plugin +POM_DESCRIPTION=Gradle plugin to use the Checker Framework for Java. diff --git a/src/main/groovy/com/jaredsburrows/checkerframework/CheckerExtension.groovy b/gradle-checker-framework-plugin/src/main/groovy/com/jaredsburrows/checkerframework/CheckerExtension.groovy similarity index 100% rename from src/main/groovy/com/jaredsburrows/checkerframework/CheckerExtension.groovy rename to gradle-checker-framework-plugin/src/main/groovy/com/jaredsburrows/checkerframework/CheckerExtension.groovy diff --git a/src/main/groovy/com/jaredsburrows/checkerframework/CheckerPlugin.groovy b/gradle-checker-framework-plugin/src/main/groovy/com/jaredsburrows/checkerframework/CheckerPlugin.groovy similarity index 100% rename from src/main/groovy/com/jaredsburrows/checkerframework/CheckerPlugin.groovy rename to gradle-checker-framework-plugin/src/main/groovy/com/jaredsburrows/checkerframework/CheckerPlugin.groovy diff --git a/src/test/groovy/com/jaredsburrows/checkerframework/CheckerExtensionSpec.groovy b/gradle-checker-framework-plugin/src/test/groovy/com/jaredsburrows/checkerframework/CheckerExtensionSpec.groovy similarity index 99% rename from src/test/groovy/com/jaredsburrows/checkerframework/CheckerExtensionSpec.groovy rename to gradle-checker-framework-plugin/src/test/groovy/com/jaredsburrows/checkerframework/CheckerExtensionSpec.groovy index 80a1358..c829254 100644 --- a/src/test/groovy/com/jaredsburrows/checkerframework/CheckerExtensionSpec.groovy +++ b/gradle-checker-framework-plugin/src/test/groovy/com/jaredsburrows/checkerframework/CheckerExtensionSpec.groovy @@ -174,7 +174,7 @@ final class CheckerExtensionSpec extends Specification { } repositories { - jcenter() + mavenCentral() google() } diff --git a/src/test/groovy/com/jaredsburrows/checkerframework/CheckerPluginSpec.groovy b/gradle-checker-framework-plugin/src/test/groovy/com/jaredsburrows/checkerframework/CheckerPluginSpec.groovy similarity index 96% rename from src/test/groovy/com/jaredsburrows/checkerframework/CheckerPluginSpec.groovy rename to gradle-checker-framework-plugin/src/test/groovy/com/jaredsburrows/checkerframework/CheckerPluginSpec.groovy index 70c117c..7a050f9 100644 --- a/src/test/groovy/com/jaredsburrows/checkerframework/CheckerPluginSpec.groovy +++ b/gradle-checker-framework-plugin/src/test/groovy/com/jaredsburrows/checkerframework/CheckerPluginSpec.groovy @@ -16,7 +16,8 @@ final class CheckerPluginSpec extends Specification { '4.9', '4.10', '5.0', - '6.0' + '6.0', + '7.4.2', ] def "setup"() { @@ -33,7 +34,7 @@ final class CheckerPluginSpec extends Specification { } repositories { - jcenter() + mavenCentral() google() } """.stripIndent().trim() @@ -61,7 +62,7 @@ final class CheckerPluginSpec extends Specification { } repositories { - jcenter() + mavenCentral() google() } """.stripIndent().trim() @@ -90,7 +91,7 @@ final class CheckerPluginSpec extends Specification { } repositories { - jcenter() + mavenCentral() google() } """.stripIndent().trim() diff --git a/src/test/resources/maven/org/checkerframework/checker-qual/2.4.0/checker-qual-2.4.0.pom b/gradle-checker-framework-plugin/src/test/resources/maven/org/checkerframework/checker-qual/2.4.0/checker-qual-2.4.0.pom similarity index 100% rename from src/test/resources/maven/org/checkerframework/checker-qual/2.4.0/checker-qual-2.4.0.pom rename to gradle-checker-framework-plugin/src/test/resources/maven/org/checkerframework/checker-qual/2.4.0/checker-qual-2.4.0.pom diff --git a/src/test/resources/maven/org/checkerframework/checker/2.4.0/checker-2.4.0.pom b/gradle-checker-framework-plugin/src/test/resources/maven/org/checkerframework/checker/2.4.0/checker-2.4.0.pom similarity index 100% rename from src/test/resources/maven/org/checkerframework/checker/2.4.0/checker-2.4.0.pom rename to gradle-checker-framework-plugin/src/test/resources/maven/org/checkerframework/checker/2.4.0/checker-2.4.0.pom diff --git a/src/test/resources/maven/org/checkerframework/jdk8/2.4.0/jdk8-2.4.0.pom b/gradle-checker-framework-plugin/src/test/resources/maven/org/checkerframework/jdk8/2.4.0/jdk8-2.4.0.pom similarity index 100% rename from src/test/resources/maven/org/checkerframework/jdk8/2.4.0/jdk8-2.4.0.pom rename to gradle-checker-framework-plugin/src/test/resources/maven/org/checkerframework/jdk8/2.4.0/jdk8-2.4.0.pom diff --git a/gradle.properties b/gradle.properties index f23a919..8238fd4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,6 @@ GROUP=com.jaredsburrows VERSION_NAME=0.2.3-SNAPSHOT -POM_NAME=Gradle Checker Framework Plugin -POM_ARTIFACT_ID=gradle-checker-framework-plugin -POM_DESCRIPTION=Gradle plugin to use the Checker Framework for Java. POM_PACKAGING=jar POM_URL=https://github.com/jaredsburrows/gradle-checker-framework-plugin @@ -22,6 +19,5 @@ POM_DEVELOPER_ID=jaredsburrows POM_DEVELOPER_NAME=Jared Burrows POM_DEVELOPER_EMAIL=jaredsburrows@gmail.com -BINTRAY_GITHUB_REPO=jaredsburrows/gradle-checker-framework-plugin PLUGIN_NAME=com.jaredsburrows.checkerframework PLUGIN_NAME_CLASS=com.jaredsburrows.checkerframework.CheckerPlugin diff --git a/gradle/compile.gradle b/gradle/compile.gradle deleted file mode 100644 index 6446069..0000000 --- a/gradle/compile.gradle +++ /dev/null @@ -1,43 +0,0 @@ -tasks.withType(JavaCompile) { - sourceCompatibility = rootProject.versions.java - targetCompatibility = rootProject.versions.java - - // Show all warnings except boot classpath - configure(options) { - compilerArgs << '-Xlint:all' // Turn on all warnings - compilerArgs << '-Werror' // Turn warnings into errors - encoding = 'utf-8' - } -} - -tasks.withType(GroovyCompile) { - sourceCompatibility = rootProject.versions.java - targetCompatibility = rootProject.versions.java - - // Show all warnings except boot classpath - configure(options) { - compilerArgs << '-Xlint:all' // Turn on all warnings - compilerArgs << '-Werror' // Turn warnings into errors - encoding = 'utf-8' - } -} - -tasks.withType(Test) { - // Turn on logging for all tests, filter to show failures/skips only - testLogging { - exceptionFormat 'full' - showCauses true - showExceptions true - showStackTraces true - events 'failed', 'skipped' - } -} - -tasks.withType(Groovydoc) { - docTitle = "${project.name} ${project.version}" - header = project.name - link('http://docs.oracle.com/javase/8/docs/api/', - 'http://docs.oracle.com/javaee/7/api/', - 'http://groovy.codehaus.org/gapi/') - exclude '**/*Spec.java' -} diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle deleted file mode 100644 index cdfa85e..0000000 --- a/gradle/dependencies.gradle +++ /dev/null @@ -1,14 +0,0 @@ -ext.versions = [ - 'java': '1.8' -] - -ext.deps = [ - 'android': [ - 'tools': [ - 'build': [ - 'gradle': 'com.android.tools.build:gradle:4.0.2', - ] - ] - ], - 'spock' : 'org.spockframework:spock-core:1.3-groovy-2.5', -] diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..3f0ce9c --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,8 @@ +[plugins] +maven-publish = { id = "com.vanniktech.maven.publish", version = "0.19.0" } +plugin-publish = { id = "com.gradle.plugin-publish", version = "0.21.0" } +versions = { id = "com.github.ben-manes.versions", version = "0.42.0" } + +[libraries] +android-plugin = { module = "com.android.tools.build:gradle", version = "4.0.2" } +spock = { module = "org.spockframework:spock-junit4", version = "2.1-M2-groovy-3.0" } diff --git a/gradle/publish.gradle b/gradle/publish.gradle deleted file mode 100644 index 0ed79cc..0000000 --- a/gradle/publish.gradle +++ /dev/null @@ -1,180 +0,0 @@ -def pomConfig = { - resolveStrategy = Closure.DELEGATE_FIRST - name POM_ARTIFACT_ID - description POM_DESCRIPTION - url POM_URL - - issueManagement { - system POM_ISSUE_SYSTEM - url POM_ISSUE_URL - } - - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - email POM_DEVELOPER_EMAIL - } - } -} - -task docsJar(type: Jar, dependsOn: groovydoc) { - group = 'Publications' - description = 'Create jar of documentation.' - archiveClassifier = 'docs' - from groovydoc.destinationDir -} - -task sourcesJar(type: Jar, dependsOn: classes) { - group = 'Publications' - description = 'Create jar of sources.' - archiveClassifier = 'sources' - from sourceSets.main.allSource -} - -task testsJar(type: Jar) { - group = 'Publications' - description = 'Create jar of tests.' - archiveClassifier = 'tests' - from sourceSets.test.output -} - -task reportsZip(type: Zip, dependsOn: check) { - group = 'Publications' - description = 'Create a zip of all reports.' - archiveClassifier = 'reports' - from reporting.baseDir -} - -// Local published to ~/.m2 - mavenLocal() -publishing { - repositories { - mavenLocal() - } - - publications { - maven(MavenPublication) { - from components.java // includes main 'artifact jar' - artifact docsJar - artifact sourcesJar - artifact testsJar - artifact reportsZip - - groupId GROUP - artifactId POM_ARTIFACT_ID - version VERSION_NAME - - pom.withXml { - // Add parent POM information - asNode().children().first() + pomConfig - } - } - } -} -publish.dependsOn jar, docsJar, sourcesJar, testsJar, reportsZip -publish.dependsOn 'generatePomFileForMavenPublication' - -// Snapshots published to JFrog Artifactory repository -artifactory { - contextUrl = 'https://oss.jfrog.org' - - publish { - repository { - repoKey = 'oss-snapshot-local' - username = project.properties['BINTRAY_USERNAME'] ?: System.getenv('BINTRAY_USERNAME') - password = project.properties['BINTRAY_API_KEY'] ?: System.getenv('BINTRAY_API_KEY') - } - - defaults { - publications 'maven' - } - } - - resolve { - repository { - repoKey = 'libs-release' - } - } -} -artifactoryPublish.dependsOn jar, docsJar, sourcesJar, testsJar, reportsZip -artifactoryPublish.dependsOn 'generatePomFileForMavenPublication' - -// Publishes to JFrog Bintray's JCenter repository -bintray { - user = project.properties['BINTRAY_USERNAME'] ?: System.getenv('BINTRAY_USERNAME') - key = project.properties['BINTRAY_API_KEY'] ?: System.getenv('BINTRAY_API_KEY') - publications = ['maven'] - publish = true - - pkg { - repo = 'maven' - name = POM_ARTIFACT_ID - desc = POM_DESCRIPTION - websiteUrl = POM_URL - issueTrackerUrl = POM_ISSUE_URL - vcsUrl = POM_URL - labels = ['gradle', 'plugin', 'checker', 'framework'] - githubRepo = BINTRAY_GITHUB_REPO - githubReleaseNotesFile = 'README.md' - - version { - name = VERSION_NAME - desc = POM_DESCRIPTION - released = new Date() - vcsTag = VERSION_NAME - - mavenCentralSync { - sync = false - user = project.properties['SONATYPE_USERNAME'] ?: System.getenv('SONATYPE_USERNAME') - password = project.properties['SONATYPE_PASSWORD'] ?: System.getenv('SONATYPE_PASSWORD') - close = '1' - } - } - } -} -bintrayUpload.dependsOn jar, docsJar, sourcesJar, testsJar, reportsZip -bintrayUpload.dependsOn 'generatePomFileForMavenPublication' - -// Publishes to Gradle plugins repository -gradlePlugin { - plugins { - checkerFrameworkPlugin { - id = PLUGIN_NAME - implementationClass = PLUGIN_NAME_CLASS - } - } -} -pluginBundle { - website = POM_URL - vcsUrl = POM_URL - description = POM_DESCRIPTION - tags = bintray.pkg.labels - - plugins { - checkerFrameworkPlugin { - displayName = POM_NAME - } - } -} -publishPlugins.dependsOn jar, docsJar, sourcesJar, testsJar, reportsZip -publishPlugins.dependsOn 'generatePomFileForMavenPublication' - -// Publish to both Bintray and Gradle repositories -task release(dependsOn: [bintrayUpload, publishPlugins]) { - group = 'Publishing' - description = 'Publish to JFrog Jcenter\'s Brintray and Gradle Plugins Repositories.' -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c..41d9927 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d9ca16..aa991fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0..1b6c787 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/settings.gradle b/settings.gradle index fb321ad..61b22c0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,12 +1,32 @@ +pluginManagement { + repositories { + google() + gradlePluginPortal() + mavenCentral() + } +} + plugins { - id "com.gradle.enterprise" version "3.4.1" + id 'com.gradle.enterprise' version '3.10' } -rootProject.name = 'gradle-checker-framework-plugin' +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + + repositories { + google() + gradlePluginPortal() + mavenCentral() + } +} gradleEnterprise { buildScan { - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" + termsOfServiceUrl = 'https://gradle.com/terms-of-service' + termsOfServiceAgree = 'yes' + publishAlways() } } +rootProject.name = 'gradle-checker-framework-plugin' + +include ':gradle-checker-framework-plugin'