Disabled SpotBugs for now.

Updated dependencies and copyright
This commit is contained in:
Erik C. Thauvin 2023-07-14 19:27:07 -07:00
parent 2ce19a215f
commit d7d641f207
38 changed files with 253 additions and 166 deletions

View file

@ -15,13 +15,14 @@ jobs:
java-version: [ 1.8, 11, 17 ] java-version: [ 1.8, 11, 17 ]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }} - name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1 uses: actions/setup-java@v3
with: with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }} java-version: ${{ matrix.java-version }}
- name: Grant execute permission for gradlew - name: Grant execute permission for gradlew
@ -29,33 +30,20 @@ jobs:
- name: Cache SonarCloud packages - name: Cache SonarCloud packages
if: matrix.java-version == env.SONAR_JDK if: matrix.java-version == env.SONAR_JDK
uses: actions/cache@v1 uses: actions/cache@v3
with: with:
path: ~/.sonar/cache path: ~/.sonar/cache
key: ${{ runner.os }}-sonar key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{ matrix.java-version }}-
- name: Test with Gradle - name: Test with Gradle
run: ./gradlew build check --stacktrace uses: gradle/gradle-build-action@v2
with:
arguments: build check --stacktrace
- name: SonarCloud - name: SonarCloud
if: success() && matrix.java-version == env.SONAR_JDK if: success() && matrix.java-version == env.SONAR_JDK
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube run: ./gradlew sonar --info
- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties

1
.gitignore vendored
View file

@ -65,7 +65,6 @@ dist/
ehthumbs.db ehthumbs.db
fabric.properties fabric.properties
gen/ gen/
gradle.properties
hs_err_pid* hs_err_pid*
kobaltBuild kobaltBuild
kobaltw*-test kobaltw*-test

2
.idea/compiler.xml generated
View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8"> <bytecodeTargetLevel target="17">
<module name="example_annotationProcessor" target="1.8" /> <module name="example_annotationProcessor" target="1.8" />
<module name="example_main" target="1.8" /> <module name="example_main" target="1.8" />
<module name="example_test" target="1.8" /> <module name="example_test" target="1.8" />

View file

@ -31,5 +31,15 @@
<option name="name" value="MavenLocal" /> <option name="name" value="MavenLocal" />
<option name="url" value="file:$MAVEN_REPOSITORY$/" /> <option name="url" value="file:$MAVEN_REPOSITORY$/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:$PROJECT_DIR$/../../maven/repository/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
</remote-repository>
</component> </component>
</project> </project>

40
.idea/misc.xml generated
View file

@ -55,6 +55,42 @@
<pattern value="net.thauvin.erik.semver.VersionInfo" /> <pattern value="net.thauvin.erik.semver.VersionInfo" />
<pattern value="net.thauvin.erik.semver.VersionInfo" method="VersionInfo" /> <pattern value="net.thauvin.erik.semver.VersionInfo" method="VersionInfo" />
<pattern value="net.thauvin.erik.semver.Constants" method="Constants" /> <pattern value="net.thauvin.erik.semver.Constants" method="Constants" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="buildMeta" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="buildMetaKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="buildMetaPrefix" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="buildMetaPrefixKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="className" />
<pattern value="net.thauvin.erik.semver.ConstantsTest" />
<pattern value="net.thauvin.erik.semver.VersionInfoTest" />
<pattern value="net.thauvin.erik.semver.VersionProcessor" />
<pattern value="net.thauvin.erik.semver.VersionProcessorTest" />
<pattern value="net.thauvin.erik.semver.VersionTest" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="keysPrefix" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="major" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="majorKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="minor" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="minorKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="packageName" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="patch" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="patchKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="preRelease" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="preReleaseKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="preReleasePrefix" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="preReleasePrefixKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="project" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="projectKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="properties" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="separator" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="separatorKey" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="template" />
<pattern value="net.thauvin.erik.semver.ConstantsTest" method="testDefaults" />
<pattern value="net.thauvin.erik.semver.VersionProcessorTest" method="testFindValues" />
<pattern value="net.thauvin.erik.semver.VersionInfoTest" method="testGetVersion" />
<pattern value="net.thauvin.erik.semver.VersionProcessorTest" method="testParseIntProperty" />
<pattern value="net.thauvin.erik.semver.VersionInfoTest" method="testSetGet" />
<pattern value="net.thauvin.erik.semver.ConstantsTest" method="testTemplates" />
<pattern value="net.thauvin.erik.semver.VersionInfoTest" method="testVersionInfo" />
<pattern value="net.thauvin.erik.semver.VersionTest" method="type" />
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration"> <component name="FrameworkDetectionExcludesConfiguration">
@ -71,12 +107,12 @@
</option> </option>
<option name="options"> <option name="options">
<map> <map>
<entry key="Encoding" value="" /> <entry key="Statistics URL" value="" />
<entry key="Target JDK" value="1.8" /> <entry key="Target JDK" value="1.8" />
</map> </map>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="15" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View file

@ -1,4 +1,4 @@
Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,8 @@
# Semantic Version Annotation Processor # Semantic Version Annotation Processor
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause) [![release](https://img.shields.io/github/release/ethauvin/semver.svg)](https://github.com/ethauvin/semver/releases/latest) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver) [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause) [![release](https://img.shields.io/github/release/ethauvin/semver.svg)](https://github.com/ethauvin/semver/releases/latest) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver)
[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/semver/badge.svg?targetFile=build.gradle)](https://snyk.io/test/github/ethauvin/semver?targetFile=build.gradle) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_semver) [![GitHub CI](https://github.com/ethauvin/semver/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/semver/actions/workflows/gradle.yml) [![Build status](https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true)](https://ci.appveyor.com/project/ethauvin/semver) [![CircleCI](https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/semver/tree/master)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_semver&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_semver) [![GitHub CI](https://github.com/ethauvin/semver/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/semver/actions/workflows/gradle.yml) [![Build status](https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true)](https://ci.appveyor.com/project/ethauvin/semver) [![CircleCI](https://circleci.com/gh/ethauvin/semver/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/semver/tree/master)
An [annotation processor](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html) that automatically generates a `GeneratedVersion` class based on a [Mustache](https://mustache.github.io/) template and containing the [semantic version](https://semver.org/) (major, minor, patch, etc.) that is read from a [Properties](https://docs.oracle.com/javase/tutorial/essential/environment/properties.html) file or defined in the [annotation](https://docs.oracle.com/javase/tutorial/java/annotations/basics.html). An [annotation processor](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html) that automatically generates a `GeneratedVersion` class based on a [Mustache](https://mustache.github.io/) template and containing the [semantic version](https://semver.org/) (major, minor, patch, etc.) that is read from a [Properties](https://docs.oracle.com/javase/tutorial/essential/environment/properties.html) file or defined in the [annotation](https://docs.oracle.com/javase/tutorial/java/annotations/basics.html).
@ -200,6 +201,10 @@ mvn verify
To install and run from [Gradle](https://gradle.org/), add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle): To install and run from [Gradle](https://gradle.org/), add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle):
```gradle ```gradle
repositories {
mavenCentral()
}
dependencies { dependencies {
annotationProcessor 'net.thauvin.erik:semver:1.2.0' annotationProcessor 'net.thauvin.erik:semver:1.2.0'
compileOnly 'net.thauvin.erik:semver:1.2.0' compileOnly 'net.thauvin.erik:semver:1.2.0'

View file

@ -1,18 +1,18 @@
// import com.github.spotbugs.snom.SpotBugsTask
import org.apache.tools.ant.taskdefs.condition.Os
plugins { plugins {
id 'java' id 'java'
id 'jacoco' id 'jacoco'
id 'maven-publish' id 'maven-publish'
id 'pmd' id 'pmd'
id 'signing' id 'signing'
id 'com.github.ben-manes.versions' version '0.42.0' id 'com.github.ben-manes.versions' version '0.47.0'
id 'net.thauvin.erik.gradle.semver' version '1.0.4' id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'com.github.spotbugs' version '5.0.3' // id 'com.github.spotbugs' version '5.0.14'
id 'org.sonarqube' version '3.3' id 'org.sonarqube' version '4.2.1.3168'
} }
import com.github.spotbugs.snom.SpotBugsTask
import org.apache.tools.ant.taskdefs.condition.Os
defaultTasks 'check' defaultTasks 'check'
group = 'net.thauvin.erik' group = 'net.thauvin.erik'
@ -32,8 +32,8 @@ def isNonStable = { String version ->
} }
ext.versions = [ ext.versions = [
pmd: '6.44.0', pmd: '6.54.0',
spotbugs: '4.5.3' // spotbugs: '4.7.3'
] ]
repositories { repositories {
@ -45,13 +45,13 @@ repositories {
dependencies { dependencies {
implementation 'com.github.spullara.mustache.java:compiler:0.9.10' implementation 'com.github.spullara.mustache.java:compiler:0.9.10'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0' // spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0'
spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.4.7' // spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.6.0'
compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs" // compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs" // testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
testImplementation 'org.testng:testng:7.5' testImplementation 'org.testng:testng:7.8.0'
} }
@ -60,8 +60,8 @@ tasks.withType(JavaCompile) {
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_17
withSourcesJar() withSourcesJar()
withJavadocJar() withJavadocJar()
} }
@ -136,11 +136,11 @@ javadoc {
title = "$mavenDescription $project.version API" title = "$mavenDescription $project.version API"
} }
options.with { options.with {
source = '8' source = '17'
tags = ['created'] tags = ['created']
author = true author = true
//addBooleanOption('html4', true) //addBooleanOption('html4', true)
links('https://docs.oracle.com/javase/8/docs/api/') links('https://docs.oracle.com/en/java/javase/17/docs/api/')
//addStringOption('Xdoclint:none', '-quiet') //addStringOption('Xdoclint:none', '-quiet')
} }
} }
@ -154,19 +154,19 @@ test {
useTestNG() useTestNG()
} }
spotbugs { // spotbugs {
toolVersion.set("${versions.spotbugs}") // toolVersion.set("${versions.spotbugs}")
excludeFilter.set(file("$projectDir/config/spotbugs/excludeFilter.xml")) // excludeFilter.set(file("$projectDir/config/spotbugs/excludeFilter.xml"))
} // }
tasks.withType(SpotBugsTask) { // tasks.withType(SpotBugsTask).configureEach {
reports { // reports {
xml.required = false // xml.required = false
html.required = true // html.required = true
} // }
} // }
task release { tasks.register('release') {
group = 'Publishing' group = 'Publishing'
description = 'Releases new version to local maven repository.' description = 'Releases new version to local maven repository.'
dependsOn(wrapper, clean, publishToMavenLocal) dependsOn(wrapper, clean, publishToMavenLocal)
@ -175,7 +175,7 @@ task release {
} }
} }
task pandoc(type: Exec) { tasks.register('pandoc', Exec) {
group = 'Documentation' group = 'Documentation'
def pandoc_args = ['--from', 'gfm', def pandoc_args = ['--from', 'gfm',
'--to', 'html5', '--to', 'html5',
@ -197,7 +197,7 @@ task pandoc(type: Exec) {
} }
jacoco { jacoco {
toolVersion = '0.8.9-SNAPSHOT' //toolVersion = '0.8.9'
} }
jacocoTestReport { jacocoTestReport {
@ -217,6 +217,6 @@ sonarqube {
} }
} }
tasks.sonarqube { tasks.sonar {
dependsOn 'jacocoTestReport' dependsOn 'jacocoTestReport'
} }

View file

@ -72,7 +72,6 @@
<exclude name="AvoidFieldNameMatchingMethodName"/> <exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/> <exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidLiteralsInIfCondition"/> <exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="EmptyCatchBlock"/> <exclude name="EmptyCatchBlock"/>
<exclude name="NullAssignment"/> <exclude name="NullAssignment"/>
</rule> </rule>

View file

@ -1,7 +1,7 @@
plugins { plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'com.github.ben-manes.versions' version '0.42.0' id 'com.github.ben-manes.versions' version '0.46.0'
} }
// ./gradlew run // ./gradlew run

Binary file not shown.

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

30
examples/java/gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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 # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -80,13 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -133,22 +130,29 @@ location of your Java installation."
fi fi
else 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. if ! command -v java >/dev/null 2>&1
then
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# 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"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@ -205,6 +213,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

View file

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View file

@ -1,8 +1,8 @@
plugins { plugins {
id("application") id("application")
id("com.github.ben-manes.versions") version "0.42.0" id("com.github.ben-manes.versions") version "0.46.0"
kotlin("jvm") version "1.6.21" kotlin("jvm") version "1.7.22"
kotlin("kapt") version "1.6.21" kotlin("kapt") version "1.7.22"
} }
// ./gradlew // ./gradlew
@ -48,13 +48,13 @@ tasks {
register("runJavaExample", JavaExec::class) { register("runJavaExample", JavaExec::class) {
group = "application" group = "application"
main = "com.example.JavaExample" mainClass.set("com.example.JavaExample")
classpath = sourceSets.main.get().runtimeClasspath classpath = sourceSets.main.get().runtimeClasspath
} }
register("runExample", JavaExec::class) { register("runExample", JavaExec::class) {
group = "application" group = "application"
main = "com.example.Example" mainClass.set("com.example.Example")
classpath = sourceSets.main.get().runtimeClasspath classpath = sourceSets.main.get().runtimeClasspath
} }
} }

Binary file not shown.

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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 # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -80,13 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -133,22 +130,29 @@ location of your Java installation."
fi fi
else 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. if ! command -v java >/dev/null 2>&1
then
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# 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"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@ -205,6 +213,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

View file

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View file

@ -1,7 +1,7 @@
plugins { plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'com.github.ben-manes.versions' version '0.38.0' id 'com.github.ben-manes.versions' version '0.46.0'
} }
// ./gradlew run // ./gradlew run

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

30
examples/test/gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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 # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -80,13 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -133,22 +130,29 @@ location of your Java installation."
fi fi
else 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. if ! command -v java >/dev/null 2>&1
then
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# 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"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@ -205,6 +213,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

View file

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

0
gradle.properties Normal file
View file

Binary file not shown.

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

30
gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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 # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -80,13 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -133,22 +130,29 @@ location of your Java installation."
fi fi
else 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. if ! command -v java >/dev/null 2>&1
then
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# 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"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@ -205,6 +213,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

15
gradlew.bat vendored
View file

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View file

@ -13,7 +13,7 @@ declare -a examples=(
# e.g: empty or javadoc, etc. # e.g: empty or javadoc, etc.
gradle_doc="javadoc pandoc" gradle_doc="javadoc pandoc"
# e.g. empty or sonarqube # e.g. empty or sonarqube
gradle_sonar="sonarqube" gradle_sonar="sonar"
# gradle options for examples # gradle options for examples
gradle_opts="--console=plain --no-build-cache --no-daemon" gradle_opts="--console=plain --no-build-cache --no-daemon"
# maven arguments for examples # maven arguments for examples

View file

@ -1,7 +1,7 @@
/* /*
* Constants.java * Constants.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/* /*
* Version.java * Version.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/* /*
* VersionInfo.java * VersionInfo.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/* /*
* VersionProcessor.java * VersionProcessor.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -36,7 +36,6 @@ import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache; import com.github.mustachejava.Mustache;
import com.github.mustachejava.MustacheFactory; import com.github.mustachejava.MustacheFactory;
import com.github.mustachejava.MustacheNotFoundException; import com.github.mustachejava.MustacheNotFoundException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import javax.annotation.processing.*; import javax.annotation.processing.*;
import javax.lang.model.SourceVersion; import javax.lang.model.SourceVersion;
@ -75,7 +74,6 @@ public class VersionProcessor extends AbstractProcessor {
log(Diagnostic.Kind.ERROR, t != null ? t.toString() : s); log(Diagnostic.Kind.ERROR, t != null ? t.toString() : s);
} }
@SuppressFBWarnings({"PATH_TRAVERSAL_IN"})
private VersionInfo findValues(final Version version) throws IOException { private VersionInfo findValues(final Version version) throws IOException {
final VersionInfo versionInfo = new VersionInfo(version); final VersionInfo versionInfo = new VersionInfo(version);
@ -125,7 +123,6 @@ public class VersionProcessor extends AbstractProcessor {
return versionInfo; return versionInfo;
} }
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
private File getLocalFile(final String fileName) { private File getLocalFile(final String fileName) {
if (processingEnv != null) { // null when testing. if (processingEnv != null) { // null when testing.
final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG); final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG);
@ -227,25 +224,17 @@ public class VersionProcessor extends AbstractProcessor {
log(Diagnostic.Kind.WARNING, s); log(Diagnostic.Kind.WARNING, s);
} }
@SuppressFBWarnings({"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
private void writeTemplate(final String type, final VersionInfo versionInfo, final String template) private void writeTemplate(final String type, final VersionInfo versionInfo, final String template)
throws IOException { throws IOException {
final File dir = getLocalFile(""); final File dir = getLocalFile("");
final MustacheFactory mf = new DefaultMustacheFactory(dir); final MustacheFactory mf = new DefaultMustacheFactory(dir);
final Mustache mustache = mf.compile(template); final Mustache mustache = mf.compile(template);
final String templateName; final String templateName = switch (mustache.getName()) {
switch (mustache.getName()) { case Constants.DEFAULT_JAVA_TEMPLATE -> "default (Java)";
case Constants.DEFAULT_JAVA_TEMPLATE: case Constants.DEFAULT_KOTLIN_TEMPLATE -> "default (Kotlin)";
templateName = "default (Java)"; default -> mustache.getName() + " (" + dir.getAbsolutePath() + ')';
break; };
case Constants.DEFAULT_KOTLIN_TEMPLATE:
templateName = "default (Kotlin)";
break;
default:
templateName = mustache.getName() + " (" + dir.getAbsolutePath() + ')';
break;
}
note("Loaded template: " + templateName); note("Loaded template: " + templateName);
final String fileName = versionInfo.getClassName() + '.' + type; final String fileName = versionInfo.getClassName() + '.' + type;

View file

@ -1,7 +1,7 @@
/* /*
* ConstantsTest.java * ConstantsTest.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/* /*
* VersionInfoTest.java * VersionInfoTest.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -32,7 +32,6 @@
package net.thauvin.erik.semver; package net.thauvin.erik.semver;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -47,7 +46,6 @@ import static org.testng.Assert.assertEquals;
* @created 2016-02-03 * @created 2016-02-03
* @since 1.0 * @since 1.0
*/ */
@SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS")
public class VersionInfoTest { public class VersionInfoTest {
private VersionInfo versionInfo = new VersionInfo(); private VersionInfo versionInfo = new VersionInfo();

View file

@ -1,7 +1,7 @@
/* /*
* VersionProcessorTest.java * VersionProcessorTest.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -32,7 +32,6 @@
package net.thauvin.erik.semver; package net.thauvin.erik.semver;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -52,7 +51,6 @@ public class VersionProcessorTest {
private final VersionProcessor processor = new VersionProcessor(); private final VersionProcessor processor = new VersionProcessor();
private final Version version = new VersionTest(); private final Version version = new VersionTest();
@SuppressFBWarnings("RFI_SET_ACCESSIBLE")
@SuppressWarnings("PMD.AvoidAccessibilityAlteration") @SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@Test @Test
public void testFindValues() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { public void testFindValues() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
@ -64,7 +62,6 @@ public class VersionProcessorTest {
assertEquals(versionInfo.getProject(), "James Bond", "getProject(James Bond)"); assertEquals(versionInfo.getProject(), "James Bond", "getProject(James Bond)");
} }
@SuppressFBWarnings("RFI_SET_ACCESSIBLE")
@SuppressWarnings("PMD.AvoidAccessibilityAlteration") @SuppressWarnings("PMD.AvoidAccessibilityAlteration")
@Test @Test
public void testParseIntProperty() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { public void testParseIntProperty() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

View file

@ -1,7 +1,7 @@
/* /*
* VersionTest.java * VersionTest.java
* *
* Copyright (c) 2016-2022, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -41,7 +41,7 @@ import java.lang.annotation.Annotation;
* @created 2019-04-02 * @created 2019-04-02
* @since 1.2.0 * @since 1.2.0
*/ */
@SuppressWarnings({"ClassExplicitlyAnnotation", "SameReturnValue", "java:S2187"}) @SuppressWarnings({"ClassExplicitlyAnnotation", "SameReturnValue", "java:S2187", "PMD.TestClassWithoutTestCases"})
class VersionTest implements Version { class VersionTest implements Version {
@Override @Override
public Class<? extends Annotation> annotationType() { public Class<? extends Annotation> annotationType() {