Compare commits
23 commits
Author | SHA1 | Date | |
---|---|---|---|
990d4e4c27 | |||
bebb56e71a | |||
bd315b4f0a | |||
86cc8b1519 | |||
aef7d1fa6a | |||
dafbaaff0f | |||
352bdaeb0d | |||
e8e7f65b2c | |||
bc2813cd31 | |||
808ca2a6f2 | |||
f7ef436a72 | |||
5e6a29fbe0 | |||
d19857bdd7 | |||
80c5374583 | |||
dac85d16f0 | |||
47ecdb372d | |||
13f0cd5b78 | |||
993d6f6f83 | |||
f4b1caa986 | |||
bcf95bc6f0 | |||
3553573bc7 | |||
09c3fef1ed | |||
b308a52d71 |
68 changed files with 2374 additions and 2040 deletions
|
@ -1,45 +1,54 @@
|
||||||
version: 2
|
version: 2
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
working_directory: ~/repo
|
working_directory: ~/repo
|
||||||
docker:
|
|
||||||
- image: circleci/openjdk:8-jdk
|
|
||||||
environment:
|
environment:
|
||||||
JVM_OPTS: -Xmx3200m
|
JVM_OPTS: -Xmx3200m
|
||||||
TERM: dumb
|
TERM: dumb
|
||||||
CI: true
|
CI: true
|
||||||
|
|
||||||
jobs:
|
defaults_gradle: &defaults_gradle
|
||||||
build_gradle:
|
steps:
|
||||||
<<: *defaults
|
- checkout
|
||||||
|
- restore_cache:
|
||||||
steps:
|
keys:
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- gradle-dependencies-{{ checksum "build.gradle.kts" }}
|
- gradle-dependencies-{{ checksum "build.gradle.kts" }}
|
||||||
# fallback to using the latest cache if no exact match is found
|
# fallback to using the latest cache if no exact match is found
|
||||||
- gradle-dependencies-
|
- gradle-dependencies-
|
||||||
|
- run:
|
||||||
|
name: Gradle Dependencies
|
||||||
|
command: ./gradlew dependencies
|
||||||
|
- save_cache:
|
||||||
|
paths: ~/.m2
|
||||||
|
key: gradle-dependencies-{{ checksum "build.gradle.kts" }}
|
||||||
|
- run:
|
||||||
|
name: Run All Checks
|
||||||
|
command: ./gradlew check
|
||||||
|
- store_artifacts:
|
||||||
|
path: build/reports/
|
||||||
|
destination: reports
|
||||||
|
- store_test_results:
|
||||||
|
path: build/reports/
|
||||||
|
|
||||||
- run:
|
jobs:
|
||||||
name: Gradle Dependencies
|
build_gradle_jdk17:
|
||||||
command: ./gradlew dependencies
|
<<: *defaults
|
||||||
|
|
||||||
- save_cache:
|
docker:
|
||||||
paths: ~/.gradle
|
- image: cimg/openjdk:17.0
|
||||||
key: gradle-dependencies-{{ checksum "build.gradle.kts" }}
|
|
||||||
|
|
||||||
- run:
|
<<: *defaults_gradle
|
||||||
name: Run All Checks
|
|
||||||
command: ./gradlew check --scan
|
|
||||||
|
|
||||||
- store_artifacts:
|
build_gradle_jdk8:
|
||||||
path: build/reports/
|
<<: *defaults
|
||||||
destination: reports
|
|
||||||
- store_test_results:
|
docker:
|
||||||
path: build/reports/
|
- image: cimg/openjdk:8.0
|
||||||
|
|
||||||
|
<<: *defaults_gradle
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_gradle:
|
gradle:
|
||||||
jobs:
|
jobs:
|
||||||
- build_gradle
|
- build_gradle_jdk8
|
||||||
|
- build_gradle_jdk17
|
||||||
|
|
48
.github/workflows/gradle.yml
vendored
48
.github/workflows/gradle.yml
vendored
|
@ -1,19 +1,45 @@
|
||||||
name: Java CI with Gradle
|
name: gradle-ci
|
||||||
|
|
||||||
on: [push, pull_request, workflow_dispatch]
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java-version: [ 1.8, 11, 17 ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 1.8
|
with:
|
||||||
uses: actions/setup-java@v1
|
fetch-depth: 0
|
||||||
with:
|
|
||||||
java-version: 1.8
|
- name: Set up JDK ${{ matrix.java-version }}
|
||||||
- name: Grant execute permission for gradlew
|
uses: actions/setup-java@v1
|
||||||
run: chmod +x gradlew
|
with:
|
||||||
- name: Test with Gradle
|
java-version: ${{ matrix.java-version }}
|
||||||
run: ./gradlew check
|
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
|
||||||
|
- 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
|
||||||
|
run: ./gradlew build check --stacktrace
|
||||||
|
|
||||||
|
- name: Cleanup Gradle Cache
|
||||||
|
run: |
|
||||||
|
rm -f ~/.gradle/caches/modules-2/modules-2.lock
|
||||||
|
rm -f ~/.gradle/caches/modules-2/gc.properties
|
||||||
|
|
40
.gitignore
vendored
40
.gitignore
vendored
|
@ -1,22 +1,7 @@
|
||||||
.vscode/*
|
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
|
|
||||||
__pycache__
|
|
||||||
.classpath
|
|
||||||
.DS_Store
|
|
||||||
.gradle
|
|
||||||
.history
|
|
||||||
.kobalt
|
|
||||||
.mtj.tmp/
|
|
||||||
.mvn/timing.properties
|
|
||||||
.mvn/wrapper/maven-wrapper.jar
|
|
||||||
.nb-gradle
|
|
||||||
.project
|
|
||||||
.scannerwork
|
|
||||||
.settings
|
|
||||||
*.class
|
*.class
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
*.ctxt
|
*.ctxt
|
||||||
|
@ -27,7 +12,21 @@ __pycache__
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.zip
|
*.zip
|
||||||
/**/.idea_modules/
|
.DS_Store
|
||||||
|
.classpath
|
||||||
|
.gradle
|
||||||
|
.history
|
||||||
|
.kobalt
|
||||||
|
.mtj.tmp/
|
||||||
|
.mvn/timing.properties
|
||||||
|
.mvn/wrapper/maven-wrapper.jar
|
||||||
|
.nb-gradle
|
||||||
|
.project
|
||||||
|
.scannerwork
|
||||||
|
.settings
|
||||||
|
.vscode/*
|
||||||
|
/**/.idea/$CACHE_FILE$
|
||||||
|
/**/.idea/$PRODUCT_WORKSPACE_FILE$
|
||||||
/**/.idea/**/caches/build_file_checksums.ser
|
/**/.idea/**/caches/build_file_checksums.ser
|
||||||
/**/.idea/**/contentModel.xml
|
/**/.idea/**/contentModel.xml
|
||||||
/**/.idea/**/dataSources.ids
|
/**/.idea/**/dataSources.ids
|
||||||
|
@ -48,8 +47,10 @@ __pycache__
|
||||||
/**/.idea/**/uiDesigner.xml
|
/**/.idea/**/uiDesigner.xml
|
||||||
/**/.idea/**/usage.statistics.xml
|
/**/.idea/**/usage.statistics.xml
|
||||||
/**/.idea/**/workspace.xml
|
/**/.idea/**/workspace.xml
|
||||||
/**/.idea/$CACHE_FILE$
|
/**/.idea/sonarlint*
|
||||||
/**/.idea/$PRODUCT_WORKSPACE_FILE$
|
/**/.idea_modules/
|
||||||
|
Thumbs.db
|
||||||
|
__pycache__
|
||||||
atlassian-ide-plugin.xml
|
atlassian-ide-plugin.xml
|
||||||
bin/
|
bin/
|
||||||
build/
|
build/
|
||||||
|
@ -63,7 +64,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
|
||||||
|
@ -71,6 +71,7 @@ lib/kotlin*
|
||||||
libs/
|
libs/
|
||||||
local.properties
|
local.properties
|
||||||
out/
|
out/
|
||||||
|
pom.xml.asc
|
||||||
pom.xml.next
|
pom.xml.next
|
||||||
pom.xml.releaseBackup
|
pom.xml.releaseBackup
|
||||||
pom.xml.tag
|
pom.xml.tag
|
||||||
|
@ -80,5 +81,4 @@ project.properties
|
||||||
release.properties
|
release.properties
|
||||||
target/
|
target/
|
||||||
test-output
|
test-output
|
||||||
Thumbs.db
|
|
||||||
venv
|
venv
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
image: gradle:alpine
|
image: gradle:8-jdk11
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
|
||||||
|
@ -12,7 +12,7 @@ stages:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
script: ./gradlew --build-cache assemble
|
script: gradle --build-cache assemble
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_COMMIT_REF_NAME"
|
key: "$CI_COMMIT_REF_NAME"
|
||||||
policy: push
|
policy: push
|
||||||
|
@ -22,7 +22,7 @@ build:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
script: ./gradlew check
|
script: gradle check
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_COMMIT_REF_NAME"
|
key: "$CI_COMMIT_REF_NAME"
|
||||||
policy: pull
|
policy: pull
|
||||||
|
|
15
.idea/codeStyles/Project.xml
generated
Normal file
15
.idea/codeStyles/Project.xml
generated
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value />
|
||||||
|
</option>
|
||||||
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
||||||
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
2
.idea/codeStyles/codeStyleConfig.xml
generated
2
.idea/codeStyles/codeStyleConfig.xml
generated
|
@ -1,5 +1,5 @@
|
||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<state>
|
<state>
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
</state>
|
</state>
|
||||||
</component>
|
</component>
|
15
.idea/jarRepositories.xml
generated
15
.idea/jarRepositories.xml
generated
|
@ -26,5 +26,20 @@
|
||||||
<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="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</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>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://packages.jetbrains.team/maven/p/ij/intellij-dependencies" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
6
.idea/kotlinc.xml
generated
Normal file
6
.idea/kotlinc.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinJpsPluginSettings">
|
||||||
|
<option name="version" value="1.9.10" />
|
||||||
|
</component>
|
||||||
|
</project>
|
65
.idea/libraries-with-intellij-classes.xml
generated
Normal file
65
.idea/libraries-with-intellij-classes.xml
generated
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="libraries-with-intellij-classes">
|
||||||
|
<option name="intellijApiContainingLibraries">
|
||||||
|
<list>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="ideaIU" />
|
||||||
|
<option name="groupId" value="com.jetbrains.intellij.idea" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="ideaIU" />
|
||||||
|
<option name="groupId" value="com.jetbrains" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="ideaIC" />
|
||||||
|
<option name="groupId" value="com.jetbrains.intellij.idea" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="ideaIC" />
|
||||||
|
<option name="groupId" value="com.jetbrains" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="pycharmPY" />
|
||||||
|
<option name="groupId" value="com.jetbrains.intellij.pycharm" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="pycharmPY" />
|
||||||
|
<option name="groupId" value="com.jetbrains" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="pycharmPC" />
|
||||||
|
<option name="groupId" value="com.jetbrains.intellij.pycharm" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="pycharmPC" />
|
||||||
|
<option name="groupId" value="com.jetbrains" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="clion" />
|
||||||
|
<option name="groupId" value="com.jetbrains.intellij.clion" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="clion" />
|
||||||
|
<option name="groupId" value="com.jetbrains" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="riderRD" />
|
||||||
|
<option name="groupId" value="com.jetbrains.intellij.rider" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="riderRD" />
|
||||||
|
<option name="groupId" value="com.jetbrains" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="goland" />
|
||||||
|
<option name="groupId" value="com.jetbrains.intellij.goland" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
<LibraryCoordinatesState>
|
||||||
|
<option name="artifactId" value="goland" />
|
||||||
|
<option name="groupId" value="com.jetbrains" />
|
||||||
|
</LibraryCoordinatesState>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
5
.idea/misc.xml
generated
5
.idea/misc.xml
generated
|
@ -13,7 +13,10 @@
|
||||||
<component name="NodePackageJsonFileManager">
|
<component name="NodePackageJsonFileManager">
|
||||||
<packageJsonPaths />
|
<packageJsonPaths />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="PDMPlugin">
|
||||||
|
<option name="skipTestSources" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="15" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
30
.travis.yml
30
.travis.yml
|
@ -1,30 +0,0 @@
|
||||||
language: java
|
|
||||||
dist: trusty
|
|
||||||
|
|
||||||
jdk:
|
|
||||||
- oraclejdk8
|
|
||||||
|
|
||||||
addons:
|
|
||||||
sonarcloud:
|
|
||||||
organization: "ethauvin-github"
|
|
||||||
|
|
||||||
before_cache:
|
|
||||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- chmod +x gradlew
|
|
||||||
|
|
||||||
script:
|
|
||||||
- ./gradlew check --scan
|
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.gradle/caches/
|
|
||||||
- $HOME/.gradle/wrapper/
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- |
|
|
||||||
if [ "${TRAVIS_TEST_RESULT}" == 0 ]; then
|
|
||||||
./gradlew sonarqube
|
|
||||||
fi
|
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
Copyright (c) 2018-2022, 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
|
24
README.md
24
README.md
|
@ -1,4 +1,4 @@
|
||||||
[](http://opensource.org/licenses/BSD-3-Clause) [](https://sonarcloud.io/dashboard?id=ethauvin_semver-gradle) [](https://travis-ci.com/ethauvin/semver-gradle) [](https://circleci.com/gh/ethauvin/semver-gradle/tree/master) [](https://plugins.gradle.org/plugin/net.thauvin.erik.gradle.semver)
|
[](https://opensource.org/licenses/BSD-3-Clause) [](https://github.com/ethauvin/semver-gradle/actions/workflows/gradle.yml) [](https://circleci.com/gh/ethauvin/semver-gradle/tree/master) [](https://plugins.gradle.org/plugin/net.thauvin.erik.gradle.semver)
|
||||||
|
|
||||||
# Semantic Version Plugin for Gradle
|
# Semantic Version Plugin for Gradle
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ or in your `gradle.build` file:
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
someTask {
|
someTask {
|
||||||
dependsOn(incrementPatch)
|
dependsOn incrementPatch
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -178,7 +178,7 @@ But, for example, if you wanted to save the version properties in a different fi
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
semver {
|
semver {
|
||||||
properties = "my.version" // read and save properties in "my.version"
|
properties = 'my.version' // read and save properties in "my.version"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -186,13 +186,13 @@ or using different property keys for the version data:
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
semver {
|
semver {
|
||||||
keysPrefix = "" // no prefix
|
keysPrefix = '' // no prefix
|
||||||
semverKey = "version"
|
semverKey = 'version'
|
||||||
majorKey = "maj"
|
majorKey = 'maj'
|
||||||
minorKey = "min"
|
minorKey = 'min'
|
||||||
patchKey = "build"
|
patchKey = 'build'
|
||||||
preReleaseKey = "rel"
|
preReleaseKey = 'rel'
|
||||||
buildMetaKey = "meta"
|
buildMetaKey = 'meta'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
which would match the data in `my.version`:
|
which would match the data in `my.version`:
|
||||||
|
@ -227,8 +227,8 @@ In order to quickly support multiple projects. The `keysPrefix` property is avai
|
||||||
|
|
||||||
```gradle
|
```gradle
|
||||||
semver {
|
semver {
|
||||||
properties = "test.properties"
|
properties = 'test.properties'
|
||||||
keysPrefix = "test."
|
keysPrefix = 'test.'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
image: openjdk:8
|
image: maven:3-openjdk-18
|
||||||
|
|
||||||
pipelines:
|
pipelines:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,102 +1,79 @@
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||||
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`java-gradle-plugin`
|
id("com.github.ben-manes.versions") version "0.51.0"
|
||||||
`maven-publish`
|
id("com.gradle.plugin-publish") version "1.2.1"
|
||||||
jacoco
|
id("io.gitlab.arturbosch.detekt") version "1.23.5"
|
||||||
kotlin("jvm") version "1.3.72"
|
id("java-gradle-plugin")
|
||||||
id("com.github.ben-manes.versions") version "0.36.0"
|
id("java")
|
||||||
id("com.gradle.plugin-publish") version "0.12.0"
|
id("maven-publish")
|
||||||
id("io.gitlab.arturbosch.detekt") version "1.14.2"
|
id("org.gradle.kotlin.kotlin-dsl") version "4.2.1"
|
||||||
id("org.gradle.kotlin.kotlin-dsl") version "1.3.6"
|
kotlin("jvm") version "1.9.20"
|
||||||
id("org.sonarqube") version "3.0"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "1.0.5-beta"
|
version = "1.0.5"
|
||||||
group = "net.thauvin.erik.gradle"
|
group = "net.thauvin.erik.gradle"
|
||||||
|
|
||||||
object VersionInfo {
|
|
||||||
const val spek = "2.0.13"
|
|
||||||
}
|
|
||||||
val versions: VersionInfo by extra { VersionInfo }
|
|
||||||
|
|
||||||
val github = "https://github.com/ethauvin/semver-gradle"
|
val github = "https://github.com/ethauvin/semver-gradle"
|
||||||
val packageName = "net.thauvin.erik.gradle.semver"
|
val packageName = "net.thauvin.erik.gradle.semver"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
|
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
|
|
||||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
implementation(platform(kotlin("bom")))
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
testImplementation(kotlin("reflect"))
|
|
||||||
|
// testImplementation(gradleTestKit())
|
||||||
|
|
||||||
testImplementation(kotlin("test"))
|
testImplementation(kotlin("test"))
|
||||||
|
testImplementation(kotlin("test-junit"))
|
||||||
testImplementation(gradleTestKit())
|
|
||||||
|
|
||||||
testImplementation("org.spekframework.spek2:spek-dsl-jvm:${versions.spek}")
|
|
||||||
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:${versions.spek}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType<KotlinCompile> {
|
withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = "1.8"
|
kotlinOptions {
|
||||||
// Gradle 4.6
|
jvmTarget = java.targetCompatibility.toString()
|
||||||
kotlinOptions.apiVersion = "1.2"
|
apiVersion = "1.6"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<Test> {
|
withType<Test> {
|
||||||
useJUnitPlatform {
|
testLogging {
|
||||||
includeEngines("spek2")
|
exceptionFormat = TestExceptionFormat.FULL
|
||||||
|
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<JacocoReport> {
|
|
||||||
reports {
|
|
||||||
html.isEnabled = true
|
|
||||||
xml.isEnabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"sonarqube" {
|
|
||||||
dependsOn("jacocoTestReport")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
detekt {
|
detekt {
|
||||||
// input = files("src/main/kotlin", "src/test/kotlin")
|
// toolVersion = "main-SNAPSHOT"
|
||||||
// filters = ".*/resources/.*,.*/build/.*"
|
|
||||||
baseline = project.rootDir.resolve("detekt-baseline.xml")
|
baseline = project.rootDir.resolve("detekt-baseline.xml")
|
||||||
}
|
}
|
||||||
|
|
||||||
sonarqube {
|
|
||||||
properties {
|
|
||||||
property("sonar.projectName", "semver-gradle")
|
|
||||||
property("sonar.projectKey", "ethauvin_semver-gradle")
|
|
||||||
property("sonar.sourceEncoding", "UTF-8")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gradlePlugin {
|
gradlePlugin {
|
||||||
|
website.set(github)
|
||||||
|
vcsUrl.set(github)
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
create(project.name) {
|
create(project.name) {
|
||||||
id = packageName
|
id = packageName
|
||||||
displayName = "SemVer Plugin"
|
displayName = "SemVer Plugin"
|
||||||
description = "Semantic Version Plugin for Gradle"
|
description = "Semantic Version Plugin for Gradle"
|
||||||
|
tags.set(listOf("semver", "semantic", "version", "versioning", "auto-increment", "kotlin", "java"))
|
||||||
implementationClass = "$packageName.SemverPlugin"
|
implementationClass = "$packageName.SemverPlugin"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginBundle {
|
|
||||||
website = github
|
|
||||||
vcsUrl = github
|
|
||||||
tags = listOf("semver", "semantic", "version", "versioning", "auto-increment", "kotlin", "java")
|
|
||||||
mavenCoordinates {
|
|
||||||
groupId = project.group.toString()
|
|
||||||
artifactId = project.name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<SmellBaseline>
|
<SmellBaseline>
|
||||||
<ManuallySuppressedIssues></ManuallySuppressedIssues>
|
<ManuallySuppressedIssues></ManuallySuppressedIssues>
|
||||||
<CurrentIssues>
|
<CurrentIssues>
|
||||||
<ID>MagicNumber:Utils.kt$Utils$3</ID>
|
<ID>MagicNumber:utils.kt$3</ID>
|
||||||
<ID>MagicNumber:Utils.kt$Utils$4</ID>
|
<ID>MagicNumber:utils.kt$4</ID>
|
||||||
<ID>MagicNumber:Utils.kt$Utils$5</ID>
|
<ID>MagicNumber:utils.kt$5</ID>
|
||||||
<ID>NestedBlockDepth:Utils.kt$Utils$fun loadProperties(file: File): Properties</ID>
|
<ID>NestedBlockDepth:utils.kt$fun File.loadProperties(): Properties</ID>
|
||||||
<ID>NestedBlockDepth:Utils.kt$Utils$fun parseSemVer(input: String?, version: Version): Boolean</ID>
|
<ID>NestedBlockDepth:utils.kt$fun parseSemVer(input: String?, version: Version): Boolean</ID>
|
||||||
<ID>NestedBlockDepth:Utils.kt$Utils$fun saveProperties(projectDir: File, config: SemverConfig, version: Version)</ID>
|
<ID>NestedBlockDepth:utils.kt$fun saveProperties(projectDir: File, config: SemverConfig, version: Version)</ID>
|
||||||
</CurrentIssues>
|
</CurrentIssues>
|
||||||
</SmellBaseline>
|
</SmellBaseline>
|
||||||
|
|
|
@ -2,7 +2,7 @@ plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
||||||
id 'com.github.ben-manes.versions' version '0.28.0'
|
id 'com.github.ben-manes.versions' version '0.51.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -14,7 +14,7 @@ mainClassName = 'com.example.Example'
|
||||||
|
|
||||||
defaultTasks 'run'
|
defaultTasks 'run'
|
||||||
|
|
||||||
def semverProcessor = "net.thauvin.erik:semver:1.2.0"
|
def semverProcessor = 'net.thauvin.erik:semver:1.2.1'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
annotationProcessor semverProcessor
|
annotationProcessor semverProcessor
|
||||||
|
@ -28,7 +28,7 @@ tasks.withType(JavaCompile) {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
run {
|
run {
|
||||||
|
@ -41,8 +41,8 @@ run {
|
||||||
}
|
}
|
||||||
|
|
||||||
semver {
|
semver {
|
||||||
// properties = "example.properties"
|
// properties = 'example.properties'
|
||||||
// keysPrefix = "example."
|
// keysPrefix = 'example.'
|
||||||
// preReleaseKey = "release"
|
// preReleaseKey = 'release'
|
||||||
// buildMetaKey = "meta"
|
// buildMetaKey = 'meta'
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -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-6.2.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
294
examples/annotation-processor/java/gradlew
vendored
294
examples/annotation-processor/java/gradlew
vendored
|
@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,78 +17,111 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## 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/HEAD/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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -97,87 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# 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\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
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
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
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:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
55
examples/annotation-processor/java/gradlew.bat
vendored
55
examples/annotation-processor/java/gradlew.bat
vendored
|
@ -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,13 +41,13 @@ 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 init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
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. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -54,48 +55,36 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
: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
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
/*
|
/*
|
||||||
* This file is automatically generated.
|
* This file is automatically generated.
|
||||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.example;
|
package com.example;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides semantic version information.
|
* Provides semantic version information.
|
||||||
*
|
*
|
||||||
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
||||||
*/
|
*/
|
||||||
public final class GeneratedVersion {
|
public final class GeneratedVersion {
|
||||||
public static final String PROJECT = "Java Example";
|
public static final String PROJECT = "Java Example";
|
||||||
public static final Date BUILDDATE = new Date(1564027571537L);
|
public static final Date BUILDDATE = new Date(1707709694421L);
|
||||||
public static final int MAJOR = 2;
|
public static final int MAJOR = 2;
|
||||||
public static final int MINOR = 10;
|
public static final int MINOR = 12;
|
||||||
public static final int PATCH = 0;
|
public static final int PATCH = 0;
|
||||||
public static final String PRERELEASE = "";
|
public static final String PRERELEASE = "";
|
||||||
public static final String PRERELEASE_PREFIX = "-";
|
public static final String PRERELEASE_PREFIX = "-";
|
||||||
public static final String BUILDMETA = "";
|
public static final String BUILDMETA = "";
|
||||||
public static final String BUILDMETA_PREFIX = "+";
|
public static final String BUILDMETA_PREFIX = "+";
|
||||||
public static final String SEPARATOR = ".";
|
public static final String SEPARATOR = ".";
|
||||||
public static final String VERSION = "2.10.0";
|
public static final String VERSION = "2.12.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the default constructor.
|
* Disables the default constructor.
|
||||||
*/
|
*/
|
||||||
private GeneratedVersion() {
|
private GeneratedVersion() {
|
||||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Wed Jul 24 21:06:09 PDT 2019
|
#Sun Feb 11 19:56:02 PST 2024
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.major=2
|
version.major=2
|
||||||
version.minor=10
|
version.minor=13
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=
|
version.prerelease=
|
||||||
version.project=Java Example
|
version.project=Java Example
|
||||||
version.semver=2.10.0
|
version.semver=2.13.0
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm").version("1.3.61")
|
id("application")
|
||||||
application
|
id("com.github.ben-manes.versions") version "0.51.0"
|
||||||
id("org.jetbrains.kotlin.kapt").version("1.3.61")
|
id("net.thauvin.erik.gradle.semver") version "1.0.4"
|
||||||
id("net.thauvin.erik.gradle.semver").version("1.0.4")
|
kotlin("jvm") version "1.7.22"
|
||||||
id("com.github.ben-manes.versions").version("0.28.0")
|
kotlin("kapt") version "1.7.22"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -13,7 +13,7 @@ plugins {
|
||||||
|
|
||||||
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
|
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
|
||||||
|
|
||||||
var semverProcessor = "net.thauvin.erik:semver:1.2.0"
|
var semverProcessor = "net.thauvin.erik:semver:1.2.1"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
kapt(semverProcessor)
|
kapt(semverProcessor)
|
||||||
|
@ -24,11 +24,11 @@ dependencies {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClassName = "com.example.Main"
|
mainClass.set("com.example.Main")
|
||||||
}
|
}
|
||||||
|
|
||||||
kapt {
|
kapt {
|
||||||
|
|
Binary file not shown.
|
@ -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-6.2.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
294
examples/annotation-processor/kotlin/gradlew
vendored
294
examples/annotation-processor/kotlin/gradlew
vendored
|
@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,78 +17,111 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## 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/HEAD/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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -97,87 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# 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\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
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
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
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:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
55
examples/annotation-processor/kotlin/gradlew.bat
vendored
55
examples/annotation-processor/kotlin/gradlew.bat
vendored
|
@ -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,13 +41,13 @@ 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 init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
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. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -54,48 +55,36 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
: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
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Wed Jul 24 21:06:46 PDT 2019
|
#Sun Feb 11 19:56:22 PST 2024
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.major=14
|
version.major=14
|
||||||
version.minor=3
|
version.minor=6
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=
|
version.prerelease=
|
||||||
version.project=Kotlin Example
|
version.project=Kotlin Example
|
||||||
version.semver=14.3.0
|
version.semver=14.6.0
|
||||||
|
|
|
@ -2,7 +2,7 @@ plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
||||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
id 'com.github.ben-manes.versions' version '0.51.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -12,34 +12,28 @@ plugins {
|
||||||
// ./gradlew incrementBuildMeta run
|
// ./gradlew incrementBuildMeta run
|
||||||
// ./gradlew echoVersion
|
// ./gradlew echoVersion
|
||||||
|
|
||||||
|
|
||||||
defaultTasks 'run'
|
defaultTasks 'run'
|
||||||
|
|
||||||
|
mainClassName = 'App'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
|
testImplementation platform('org.junit:junit-bom:5.10.2')
|
||||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
|
||||||
mainClassName = 'App'
|
|
||||||
// project.afterEvaluate {
|
|
||||||
// println "Version: $version"
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
semver {
|
semver {
|
||||||
// properties = "example.properties"
|
// properties = 'example.properties'
|
||||||
// keysPrefix = "example."
|
// keysPrefix = 'example.'
|
||||||
// preReleaseKey = "release"
|
// preReleaseKey = 'release'
|
||||||
// buildMetaKey = "meta"
|
// buildMetaKey = 'meta'
|
||||||
}
|
}
|
||||||
|
|
||||||
incrementBuildMeta {
|
incrementBuildMeta {
|
||||||
|
@ -50,8 +44,10 @@ incrementBuildMeta {
|
||||||
}
|
}
|
||||||
|
|
||||||
run {
|
run {
|
||||||
|
// project.afterEvaluate {
|
||||||
|
// println "Version: $version"
|
||||||
|
// }
|
||||||
doFirst {
|
doFirst {
|
||||||
// println "Version: ${-> version}"
|
|
||||||
println "Version: $version"
|
println "Version: $version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,5 +56,5 @@ run {
|
||||||
}
|
}
|
||||||
|
|
||||||
task echoVersion(type:Exec) {
|
task echoVersion(type:Exec) {
|
||||||
commandLine 'echo', "${-> project.version}"
|
commandLine('echo', "${-> project.version}")
|
||||||
}
|
}
|
||||||
|
|
BIN
examples/java/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/java/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -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-6.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
294
examples/java/gradlew
vendored
294
examples/java/gradlew
vendored
|
@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,67 +17,99 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## 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/HEAD/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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# 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\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
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
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
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:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
35
examples/java/gradlew.bat
vendored
35
examples/java/gradlew.bat
vendored
|
@ -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,13 +41,13 @@ 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. 1>&2
|
||||||
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. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Fri Sep 25 17:38:33 PDT 2020
|
#Sun Feb 11 19:55:34 PST 2024
|
||||||
version.buildmeta=20200925173833
|
version.buildmeta=20240211195534
|
||||||
version.major=1
|
version.major=1
|
||||||
version.minor=0
|
version.minor=0
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=
|
version.prerelease=
|
||||||
version.semver=1.0.0+20200925173833
|
version.semver=1.0.0+20240211195534
|
||||||
|
|
|
@ -4,10 +4,10 @@ import java.time.LocalDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm").version("1.4.10")
|
id("application")
|
||||||
application
|
id("com.github.ben-manes.versions") version "0.51.0"
|
||||||
id("net.thauvin.erik.gradle.semver").version("1.0.4")
|
id("net.thauvin.erik.gradle.semver") version "1.0.4"
|
||||||
id("com.github.ben-manes.versions").version("0.36.0")
|
kotlin("jvm") version "1.7.22"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
@ -20,15 +20,15 @@ defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
testImplementation("org.testng:testng:7.3.0")
|
testImplementation("org.testng:testng:7.9.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClassName = "com.example.MainKt"
|
mainClass.set("com.example.MainKt")
|
||||||
// project.afterEvaluate {
|
// project.afterEvaluate {
|
||||||
// println("Version: $version")
|
// println("Version: $version")
|
||||||
// }
|
// }
|
||||||
|
|
BIN
examples/kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/kotlin/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -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-6.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
294
examples/kotlin/gradlew
vendored
294
examples/kotlin/gradlew
vendored
|
@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,67 +17,99 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## 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/HEAD/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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# 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\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
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
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
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:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
35
examples/kotlin/gradlew.bat
vendored
35
examples/kotlin/gradlew.bat
vendored
|
@ -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,13 +41,13 @@ 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. 1>&2
|
||||||
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. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Mon Nov 09 21:24:16 PST 2020
|
#Sun Feb 11 19:55:46 PST 2024
|
||||||
version.buildmeta=20201109212416
|
version.buildmeta=20240211195546
|
||||||
version.major=1
|
version.major=1
|
||||||
version.minor=2
|
version.minor=2
|
||||||
version.patch=4
|
version.patch=4
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
version.semver=1.2.4-beta+20201109212416
|
version.semver=1.2.4-beta+20240211195546
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
buildscript {
|
plugins {
|
||||||
repositories {
|
id 'java'
|
||||||
mavenLocal()
|
id 'application'
|
||||||
mavenCentral()
|
id("net.thauvin.erik.gradle.semver") version "1.0.4"
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath "net.thauvin.erik.gradle:semver:1.0.5-beta"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'java'
|
defaultTasks 'run'
|
||||||
apply plugin: 'application'
|
|
||||||
apply plugin: 'net.thauvin.erik.gradle.semver'
|
|
||||||
|
|
||||||
mainClassName = 'App'
|
mainClassName = 'App'
|
||||||
|
|
||||||
//version = 1.0
|
// version = 1.0
|
||||||
|
|
||||||
def f = new File("version.properties")
|
def f = new File("version.properties")
|
||||||
|
|
||||||
|
@ -27,13 +21,12 @@ dependencies {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
println(project.version)
|
println project.version
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
println(project.version)
|
println "afterEvaluate: $project.version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +40,13 @@ incrementBuildMeta {
|
||||||
|
|
||||||
run {
|
run {
|
||||||
doFirst {
|
doFirst {
|
||||||
println("Version: $semver.major$semver.separator$semver.minor$semver.separator$semver.patch$semver.preReleasePrefix$semver.preRelease$semver.buildMetaPrefix$semver.buildMeta")
|
println "$semver"
|
||||||
args = [f.name]
|
args = [f.name]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task echoVersion(type:Exec) {
|
task echoVersion(type:Exec) {
|
||||||
commandLine "echo", "${-> version}"
|
commandLine('echo', "${-> version}")
|
||||||
}
|
}
|
||||||
|
|
||||||
semver {
|
semver {
|
||||||
|
|
BIN
examples/test/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/test/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
|
@ -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-5.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
295
examples/test/gradlew
vendored
295
examples/test/gradlew
vendored
|
@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,78 +17,111 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## 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/HEAD/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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -97,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; 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
|
|
||||||
# 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\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
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
|
||||||
|
# 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
|
||||||
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:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
58
examples/test/gradlew.bat
vendored
58
examples/test/gradlew.bat
vendored
|
@ -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,10 +25,14 @@
|
||||||
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%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@ -37,13 +41,13 @@ 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 init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
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. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -51,48 +55,36 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
: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
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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-6.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
294
gradlew
vendored
294
gradlew
vendored
|
@ -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");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -17,67 +17,99 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## 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/HEAD/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
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
@ -87,9 +119,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
@ -98,88 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# 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\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
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
|
||||||
|
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
|
||||||
|
# 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
|
||||||
|
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:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
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.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
35
gradlew.bat
vendored
35
gradlew.bat
vendored
|
@ -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,13 +41,13 @@ 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. 1>&2
|
||||||
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. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
21
preflightcheck.sh
Normal file → Executable file
21
preflightcheck.sh
Normal file → Executable file
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# set source and test locations
|
# set source and test locations
|
||||||
src="src/main/kotlin/net/thauvin/erik/gradle/semver/"
|
src="src/main/kotlin/net/thauvin/erik/gradle/semver/"
|
||||||
test="src/main/kotlin/net/thauvin/erik/gradle/semver/"
|
test="src/test/kotlin/net/thauvin/erik/gradle/semver/"
|
||||||
# e.g: .java, .kt, etc.
|
# e.g: .java, .kt, etc.
|
||||||
ext=".kt"
|
ext=".kt"
|
||||||
java8=true
|
java8=true
|
||||||
|
@ -15,14 +15,14 @@ declare -a examples=(
|
||||||
# e.g: empty or javadoc, etc.
|
# e.g: empty or javadoc, etc.
|
||||||
gradle_doc=""
|
gradle_doc=""
|
||||||
# e.g. empty or sonarqube
|
# e.g. empty or sonarqube
|
||||||
gradle_sonar="sonarqube"
|
gradle_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
|
||||||
maven_args="compile exec:java"
|
maven_args="compile exec:java"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Version: 1.1.3
|
# Version: 1.1.5
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ "$java8" = true ]
|
if [ "$java8" = true ]
|
||||||
|
@ -42,7 +42,7 @@ pause() {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkCopyright() {
|
checkCopyright() {
|
||||||
if [ "$(grep -c "$date" "$1")" -eq 0 ]
|
if [ "$(grep -c "$date" "$1")" == "0" ]
|
||||||
then
|
then
|
||||||
echo -e " Invalid: ${red}$f${std}"
|
echo -e " Invalid: ${red}$f${std}"
|
||||||
else
|
else
|
||||||
|
@ -106,7 +106,7 @@ checkDeps() {
|
||||||
* ) for ex in "${!examples[@]}"
|
* ) for ex in "${!examples[@]}"
|
||||||
do
|
do
|
||||||
runGradle $(echo "${examples[ex]}" | cut -d " " -f 1) dU
|
runGradle $(echo "${examples[ex]}" | cut -d " " -f 1) dU
|
||||||
runKobalt $(echo "${examples[ex]}" | cut -d " " -f 1) checkVersions
|
# runKobalt $(echo "${examples[ex]}" | cut -d " " -f 1) checkVersions
|
||||||
runMaven $(echo "${examples[ex]}" | cut -d " " -f 1) versions:display-dependency-updates
|
runMaven $(echo "${examples[ex]}" | cut -d " " -f 1) versions:display-dependency-updates
|
||||||
if [ "$ex" -eq "${#examples}" ]
|
if [ "$ex" -eq "${#examples}" ]
|
||||||
then
|
then
|
||||||
|
@ -132,7 +132,7 @@ runExamples() {
|
||||||
for ex in "${!examples[@]}"
|
for ex in "${!examples[@]}"
|
||||||
do
|
do
|
||||||
runGradle ${examples[ex]} clean $gradle_opts
|
runGradle ${examples[ex]} clean $gradle_opts
|
||||||
runKobalt ${examples[ex]} clean
|
# runKobalt ${examples[ex]} clean
|
||||||
runMaven $(echo "${examples[ex]}" | cut -d " " -f 1) clean $maven_args
|
runMaven $(echo "${examples[ex]}" | cut -d " " -f 1) clean $maven_args
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ examplesMenu() {
|
||||||
examplesMenu
|
examplesMenu
|
||||||
else
|
else
|
||||||
runGradle ${examples[$(($choice - 1))]}
|
runGradle ${examples[$(($choice - 1))]}
|
||||||
runKobalt ${examples[$(($choice - 1))]}
|
# runKobalt ${examples[$(($choice - 1))]}
|
||||||
runMaven $(echo "${examples[$(($choice - 1))]}" | cut -d " " -f 1) $maven_args
|
runMaven $(echo "${examples[$(($choice - 1))]}" | cut -d " " -f 1) $maven_args
|
||||||
examplesMenu
|
examplesMenu
|
||||||
fi ;;
|
fi ;;
|
||||||
|
@ -165,9 +165,12 @@ examplesMenu() {
|
||||||
validateCopyrights() {
|
validateCopyrights() {
|
||||||
clear
|
clear
|
||||||
echo -e "${cyan}Validating copyrights...${std}"
|
echo -e "${cyan}Validating copyrights...${std}"
|
||||||
for f in LICENSE.TXT ${src}/*${ext} ${test}/*${ext}
|
for f in "LICENSE.txt" ${src}/*${ext} ${test}/*${ext}
|
||||||
do
|
do
|
||||||
checkCopyright "$f"
|
if [ -f "$f" ]
|
||||||
|
then
|
||||||
|
checkCopyright "$f"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
pause
|
pause
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.gradle.enterprise").version("3.3.4")
|
id("com.gradle.enterprise").version("3.6.3")
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleEnterprise {
|
gradleEnterprise {
|
||||||
buildScan {
|
buildScan {
|
||||||
link("GitHub", "https://github.com/ethauvin/semver-gradle/tree/master")
|
link("GitHub", "https://github.com/ethauvin/semver/tree/master")
|
||||||
if ("true" == System.getenv("CI")) {
|
if (!System.getenv("CI").isNullOrEmpty()) {
|
||||||
|
isUploadInBackground = false
|
||||||
publishOnFailure()
|
publishOnFailure()
|
||||||
tag("CI")
|
tag("CI")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverConfig.kt
|
* SemverConfig.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2022, 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
|
||||||
|
@ -97,27 +97,14 @@ open class SemverConfig @Inject constructor(
|
||||||
get() = semVersion.separator
|
get() = semVersion.separator
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "SemverConfig(" +
|
return "SemverConfig(semVersion=$semVersion, properties='$properties', semverKey='$semverKey'," +
|
||||||
"properties='$properties', " +
|
" majorKey='$majorKey', minorKey='$minorKey', patchKey='$patchKey', preReleaseKey='$preReleaseKey'," +
|
||||||
"semverKey='$semverKey', " +
|
" preReleasePrefixKey='$preReleasePrefixKey', buildMetaKey='$buildMetaKey'," +
|
||||||
"majorKey='$majorKey', " +
|
" buildMetaPrefixKey='$buildMetaPrefixKey', separatorKey='$separatorKey', keysPrefix='$keysPrefix'," +
|
||||||
"minorKey='$minorKey', " +
|
" semver='$semver', version='$version', major=$major, minor=$minor, patch=$patch," +
|
||||||
"patchKey='$patchKey', " +
|
" preRelease='$preRelease', buildMeta='$buildMeta', preReleasePrefix='$preReleasePrefix'," +
|
||||||
"preReleaseKey='$preReleaseKey', " +
|
" buildMetaPrefix='$buildMetaPrefix', separator='$separator')"
|
||||||
"preReleasePrefixKey='$preReleasePrefixKey', " +
|
|
||||||
"buildMetaKey='$buildMetaKey', " +
|
|
||||||
"buildMetaPrefixKey='$buildMetaPrefixKey', " +
|
|
||||||
"separator='$separatorKey', " +
|
|
||||||
"keysPrefix='$keysPrefix', " +
|
|
||||||
"semver='$semver', " +
|
|
||||||
"major='$major', " +
|
|
||||||
"minor='$minor', " +
|
|
||||||
"patch='$patch', " +
|
|
||||||
"preRelease='$preRelease', " +
|
|
||||||
"buildMeta='$buildMeta', " +
|
|
||||||
"preReleasePrefix='$preReleasePrefix', " +
|
|
||||||
"buildMetaPrefix='$buildMetaPrefix', " +
|
|
||||||
"separator='$separator'" +
|
|
||||||
')'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverIncrementBuildMetaTask.kt
|
* SemverIncrementBuildMetaTask.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2022, 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
|
||||||
|
@ -58,8 +58,8 @@ open class SemverIncrementBuildMetaTask @Inject constructor(
|
||||||
if (version.buildMeta != buildMeta) {
|
if (version.buildMeta != buildMeta) {
|
||||||
version.buildMeta = buildMeta
|
version.buildMeta = buildMeta
|
||||||
project.version = version.semver
|
project.version = version.semver
|
||||||
logger.lifecycle("Version: ${project.version}")
|
if (logger.isLifecycleEnabled) logger.lifecycle("Version: ${project.version}")
|
||||||
Utils.saveProperties(project.projectDir, config, version)
|
saveProperties(project.projectDir, config, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverIncrementTask.kt
|
* SemverIncrementTask.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2022, 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
|
||||||
|
@ -35,6 +35,7 @@ package net.thauvin.erik.gradle.semver
|
||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
import org.gradle.api.tasks.CacheableTask
|
import org.gradle.api.tasks.CacheableTask
|
||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
|
import java.util.Locale
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@CacheableTask
|
@CacheableTask
|
||||||
|
@ -45,7 +46,13 @@ open class SemverIncrementTask @Inject constructor(
|
||||||
) : DefaultTask() {
|
) : DefaultTask() {
|
||||||
init {
|
init {
|
||||||
group = "version"
|
group = "version"
|
||||||
description = "Increments ${type.capitalize()} version number."
|
description =
|
||||||
|
"Increments ${
|
||||||
|
type.replaceFirstChar {
|
||||||
|
if (it.isLowerCase()) it.titlecase(Locale.getDefault())
|
||||||
|
else it.toString()
|
||||||
|
}
|
||||||
|
} version number."
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
@ -57,7 +64,7 @@ open class SemverIncrementTask @Inject constructor(
|
||||||
isPatch = type == SemverConfig.DEFAULT_PATCH_KEY
|
isPatch = type == SemverConfig.DEFAULT_PATCH_KEY
|
||||||
)
|
)
|
||||||
project.version = version.semver
|
project.version = version.semver
|
||||||
logger.lifecycle("Version: ${project.version}")
|
if (logger.isLifecycleEnabled) logger.lifecycle("Version: ${project.version}")
|
||||||
Utils.saveProperties(project.projectDir, config, version)
|
saveProperties(project.projectDir, config, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SemverPlugin.kt
|
* SemverPlugin.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2022, 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
|
||||||
|
@ -37,6 +37,7 @@ import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.util.GradleVersion
|
import org.gradle.util.GradleVersion
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
class SemverPlugin : Plugin<Project> {
|
class SemverPlugin : Plugin<Project> {
|
||||||
private val simpleName = SemverPlugin::class.simpleName
|
private val simpleName = SemverPlugin::class.simpleName
|
||||||
private var version = Version()
|
private var version = Version()
|
||||||
|
@ -58,9 +59,9 @@ class SemverPlugin : Plugin<Project> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun afterEvaluate(project: Project) {
|
private fun afterEvaluate(project: Project) {
|
||||||
val propsFile = Utils.getPropertiesFile(project.projectDir, config.properties)
|
val propsFile = getPropertiesFile(project.projectDir, config.properties)
|
||||||
|
|
||||||
if (project.version != "unspecified") {
|
if (project.version != "unspecified" && project.logger.isWarnEnabled) {
|
||||||
project.logger.warn(
|
project.logger.warn(
|
||||||
"Please specify the version in ${propsFile.name} and remove it from ${project.buildFile.name}"
|
"Please specify the version in ${propsFile.name} and remove it from ${project.buildFile.name}"
|
||||||
)
|
)
|
||||||
|
@ -69,31 +70,37 @@ class SemverPlugin : Plugin<Project> {
|
||||||
propsFile.apply {
|
propsFile.apply {
|
||||||
val isNew = !exists()
|
val isNew = !exists()
|
||||||
|
|
||||||
project.logger.info(
|
if (project.logger.isInfoEnabled) {
|
||||||
"[$simpleName] Attempting to read properties from: `$absoluteFile`. " +
|
project.logger.info(
|
||||||
"[exists: $isNew, isFile: $isFile, canRead: ${canRead()}]"
|
"[$simpleName] Attempting to read properties from: `$absoluteFile`. " +
|
||||||
)
|
"[exists: $isNew, isFile: $isFile, canRead: ${canRead()}]"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val props = Utils.loadProperties(this)
|
val props = this.loadProperties()
|
||||||
val requiredProps = setOf(
|
val requiredProps = setOf(
|
||||||
config.semverKey, config.majorKey, config.minorKey, config.patchKey,
|
config.semverKey, config.majorKey, config.minorKey, config.patchKey,
|
||||||
config.preReleaseKey, config.buildMetaKey
|
config.preReleaseKey, config.buildMetaKey
|
||||||
)
|
)
|
||||||
val hasReqProps = !isNew && props.stringPropertyNames().containsAll(requiredProps) &&
|
val hasReqProps = !isNew && props.stringPropertyNames().containsAll(requiredProps) &&
|
||||||
Utils.isNotSystemProperty(requiredProps)
|
requiredProps.isNotSystemProperty()
|
||||||
|
|
||||||
Utils.loadVersion(config, version, props)
|
loadVersion(config, version, props)
|
||||||
|
|
||||||
project.tasks.withType(SemverIncrementBuildMetaTask::class.java) {
|
project.tasks.withType(SemverIncrementBuildMetaTask::class.java) {
|
||||||
buildMeta = version.buildMeta
|
buildMeta = version.buildMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
project.version = version.semver
|
project.version = version.semver
|
||||||
project.logger.info("[$simpleName] Project version set to: ${project.version}")
|
if (project.logger.isInfoEnabled) {
|
||||||
|
project.logger.info("[$simpleName] Project version set to: ${project.version}")
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasReqProps || !isFile) {
|
if (!hasReqProps || !isFile) {
|
||||||
project.logger.info("[$simpleName] Saving version properties to `$absoluteFile`.")
|
if (project.logger.isInfoEnabled) {
|
||||||
Utils.saveProperties(project.projectDir, config, version)
|
project.logger.info("[$simpleName] Saving version properties to `$absoluteFile`.")
|
||||||
|
}
|
||||||
|
saveProperties(project.projectDir, config, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* SortedProperties.kt
|
* SortedProperties.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2022, 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
|
||||||
|
@ -38,11 +38,11 @@ import java.util.Properties
|
||||||
|
|
||||||
internal class SortedProperties : Properties() {
|
internal class SortedProperties : Properties() {
|
||||||
override val entries: MutableSet<MutableMap.MutableEntry<Any, Any>>
|
override val entries: MutableSet<MutableMap.MutableEntry<Any, Any>>
|
||||||
get() = super.entries.sortedWith(Comparator { a, b -> a.toString().compareTo(b.toString()) }).toMutableSet()
|
get() = super.entries.sortedWith { a, b -> a.toString().compareTo(b.toString()) }.toMutableSet()
|
||||||
|
|
||||||
override fun keys(): Enumeration<Any> {
|
override fun keys(): Enumeration<Any> {
|
||||||
val keys = Collections.list(super.keys())
|
val keys = Collections.list(super.keys())
|
||||||
keys.sortWith(Comparator { a, b -> a.toString().compareTo(b.toString()) })
|
keys.sortWith { a, b -> a.toString().compareTo(b.toString()) }
|
||||||
return Collections.enumeration(keys)
|
return Collections.enumeration(keys)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,223 +0,0 @@
|
||||||
/*
|
|
||||||
* Utils.kt
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* Neither the name of this project nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.thauvin.erik.gradle.semver
|
|
||||||
|
|
||||||
import org.gradle.api.GradleException
|
|
||||||
import java.io.File
|
|
||||||
import java.io.FileInputStream
|
|
||||||
import java.io.FileOutputStream
|
|
||||||
import java.io.IOException
|
|
||||||
import java.util.Properties
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The <code>Utils</code> class.
|
|
||||||
*
|
|
||||||
* @author <a href="https://erik.thauvin.net/" target="_blank">Erik C. Thauvin</a>
|
|
||||||
* @created 2019-04-10
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
object Utils {
|
|
||||||
fun File.canReadFile(): Boolean {
|
|
||||||
return canRead() && isFile
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Properties.put(key: String, value: String, isValidCondition: Boolean) {
|
|
||||||
if (isValidCondition) put(key, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isNotSystemProperty(keys: Set<String>): Boolean {
|
|
||||||
keys.forEach {
|
|
||||||
if (System.getProperties().containsKey(it)) return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getPropertiesFile(projectDir: File, propsFile: String): File {
|
|
||||||
return if (File(propsFile).isAbsolute) {
|
|
||||||
File(propsFile)
|
|
||||||
} else {
|
|
||||||
File(projectDir, propsFile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadProperties(file: File): Properties {
|
|
||||||
var isNew = false
|
|
||||||
val props = Properties()
|
|
||||||
file.apply {
|
|
||||||
try {
|
|
||||||
if (!exists() && createNewFile()) {
|
|
||||||
isNew = true
|
|
||||||
}
|
|
||||||
} catch (e: IOException) {
|
|
||||||
throw GradleException("Unable to create: `$absoluteFile`", e)
|
|
||||||
}
|
|
||||||
if (canReadFile()) {
|
|
||||||
FileInputStream(this).reader().use { reader ->
|
|
||||||
props.apply {
|
|
||||||
if (!isNew) {
|
|
||||||
load(reader)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw GradleException("Unable to read version from: `$absoluteFile`")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return props
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadIntProperty(props: Properties, key: String, default: Int): Int {
|
|
||||||
try {
|
|
||||||
return loadProperty(props, key, default.toString()).toInt()
|
|
||||||
} catch (e: java.lang.NumberFormatException) {
|
|
||||||
throw GradleException("Unable to parse $key property. (${e.message})", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadProperty(props: Properties, key: String, default: String): String {
|
|
||||||
return System.getProperty(key, if (props.isNotEmpty()) props.getProperty(key, default) else default)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadVersion(config: SemverConfig, version: Version, props: Properties) {
|
|
||||||
props.apply {
|
|
||||||
if (!parseSemVer(System.getProperty(config.semverKey), version)) {
|
|
||||||
version.major = loadIntProperty(this, config.majorKey, Version.DEFAULT_MAJOR)
|
|
||||||
version.minor = loadIntProperty(this, config.minorKey, Version.DEFAULT_MINOR)
|
|
||||||
version.patch = loadIntProperty(this, config.patchKey, Version.DEFAULT_PATCH)
|
|
||||||
version.preRelease = loadProperty(this, config.preReleaseKey, Version.DEFAULT_EMPTY)
|
|
||||||
version.buildMeta = loadProperty(this, config.buildMetaKey, Version.DEFAULT_EMPTY)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isEmpty) {
|
|
||||||
version.preReleasePrefix =
|
|
||||||
getProperty(config.preReleasePrefixKey, Version.DEFAULT_PRERELEASE_PREFIX)
|
|
||||||
version.buildMetaPrefix =
|
|
||||||
getProperty(config.buildMetaPrefixKey, Version.DEFAULT_BUILDMETA_PREFIX)
|
|
||||||
version.separator = getProperty(config.separatorKey, Version.DEFAULT_SEPARATOR)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun parseSemVer(input: String?, version: Version): Boolean {
|
|
||||||
if (input.isNullOrBlank()) return false
|
|
||||||
|
|
||||||
try {
|
|
||||||
val max = 5
|
|
||||||
val min = 3
|
|
||||||
|
|
||||||
val parts = input.split(
|
|
||||||
Regex("[\\Q${version.separator}${version.preReleasePrefix}${version.buildMetaPrefix}\\E]"),
|
|
||||||
max
|
|
||||||
)
|
|
||||||
|
|
||||||
if (parts.size >= min) {
|
|
||||||
version.major = parts[0].toInt()
|
|
||||||
version.minor = parts[1].toInt()
|
|
||||||
version.patch = parts[2].toInt()
|
|
||||||
version.preRelease = ""
|
|
||||||
version.buildMeta = ""
|
|
||||||
|
|
||||||
if (parts.size > min) {
|
|
||||||
when {
|
|
||||||
parts.size == max -> {
|
|
||||||
version.preRelease = parts[3]
|
|
||||||
version.buildMeta = parts[4]
|
|
||||||
}
|
|
||||||
parts.size == 4 -> {
|
|
||||||
if (input.endsWith(version.buildMetaPrefix + parts[3])) {
|
|
||||||
version.buildMeta = parts[3]
|
|
||||||
} else {
|
|
||||||
version.preRelease = parts[3]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw NumberFormatException("Not enough parts.")
|
|
||||||
}
|
|
||||||
} catch (e: NumberFormatException) {
|
|
||||||
throw GradleException("Unable to parse version: \"$input\" (${e.message})", e)
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun saveProperties(projectDir: File, config: SemverConfig, version: Version) {
|
|
||||||
val propsFile = getPropertiesFile(projectDir, config.properties)
|
|
||||||
SortedProperties().apply {
|
|
||||||
try {
|
|
||||||
propsFile.apply {
|
|
||||||
if (canReadFile()) {
|
|
||||||
FileInputStream(this).reader().use { load(it) }
|
|
||||||
} else {
|
|
||||||
createNewFile()
|
|
||||||
}
|
|
||||||
|
|
||||||
put(config.semverKey, version.semver)
|
|
||||||
put(config.majorKey, version.major.toString())
|
|
||||||
put(config.minorKey, version.minor.toString())
|
|
||||||
put(config.patchKey, version.patch.toString())
|
|
||||||
put(config.preReleaseKey, version.preRelease)
|
|
||||||
put(config.buildMetaKey, version.buildMeta)
|
|
||||||
put(config.semverKey, version.semver)
|
|
||||||
|
|
||||||
put(
|
|
||||||
config.buildMetaPrefixKey, version.buildMetaPrefix,
|
|
||||||
version.buildMetaPrefix != Version.DEFAULT_BUILDMETA_PREFIX ||
|
|
||||||
containsKey(config.buildMetaPrefixKey)
|
|
||||||
)
|
|
||||||
put(
|
|
||||||
config.preReleasePrefixKey, version.preReleasePrefix,
|
|
||||||
version.preReleasePrefix != Version.DEFAULT_PRERELEASE_PREFIX ||
|
|
||||||
containsKey(config.preReleasePrefixKey)
|
|
||||||
)
|
|
||||||
put(
|
|
||||||
config.separatorKey, version.separator,
|
|
||||||
version.separator != Version.DEFAULT_SEPARATOR ||
|
|
||||||
containsKey(config.separatorKey)
|
|
||||||
)
|
|
||||||
|
|
||||||
if (canWrite()) {
|
|
||||||
FileOutputStream(this).writer().use {
|
|
||||||
store(it, "Generated by the Semver Plugin for Gradle")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw IOException("Can't write.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: IOException) {
|
|
||||||
throw GradleException("Unable to write version to: `${propsFile.absoluteFile}`", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Version.kt
|
* Version.kt
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright (c) 2018-2022, 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
|
||||||
|
@ -54,8 +54,8 @@ class Version {
|
||||||
|
|
||||||
val semver: String
|
val semver: String
|
||||||
get() = "$major$separator$minor$separator$patch" +
|
get() = "$major$separator$minor$separator$patch" +
|
||||||
(if (preRelease.isNotEmpty()) "$preReleasePrefix$preRelease" else "") +
|
(if (preRelease.isNotEmpty()) "$preReleasePrefix$preRelease" else "") +
|
||||||
(if (buildMeta.isNotEmpty()) "$buildMetaPrefix$buildMeta" else "")
|
(if (buildMeta.isNotEmpty()) "$buildMetaPrefix$buildMeta" else "")
|
||||||
|
|
||||||
fun increment(isMajor: Boolean = false, isMinor: Boolean = false, isPatch: Boolean = false) {
|
fun increment(isMajor: Boolean = false, isMinor: Boolean = false, isPatch: Boolean = false) {
|
||||||
if (isMajor) {
|
if (isMajor) {
|
||||||
|
@ -70,16 +70,5 @@ class Version {
|
||||||
if (isPatch) patch++
|
if (isPatch) patch++
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString() = semver
|
||||||
return "Version(" +
|
|
||||||
"major='$major', " +
|
|
||||||
"minor='$minor', " +
|
|
||||||
"patch='$patch', " +
|
|
||||||
"preRelease='$preRelease', " +
|
|
||||||
"preReleasePrefix='$preReleasePrefix', " +
|
|
||||||
"buildMeta='$buildMeta', " +
|
|
||||||
"buildMetaPrefix='$buildMetaPrefix', " +
|
|
||||||
"separator='$separator', " +
|
|
||||||
')'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
214
src/main/kotlin/net/thauvin/erik/gradle/semver/utils.kt
Normal file
214
src/main/kotlin/net/thauvin/erik/gradle/semver/utils.kt
Normal file
|
@ -0,0 +1,214 @@
|
||||||
|
/*
|
||||||
|
* utils.kt
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2022, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
|
import org.gradle.api.GradleException
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
import java.io.IOException
|
||||||
|
import java.util.Properties
|
||||||
|
|
||||||
|
private fun Properties.put(key: String, value: String, isValidCondition: Boolean) {
|
||||||
|
if (isValidCondition) put(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun File.canReadFile(): Boolean {
|
||||||
|
return canRead() && isFile
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getPropertiesFile(projectDir: File, propsFile: String): File {
|
||||||
|
return if (File(propsFile).isAbsolute) {
|
||||||
|
File(propsFile)
|
||||||
|
} else {
|
||||||
|
File(projectDir, propsFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Set<String>.isNotSystemProperty(): Boolean {
|
||||||
|
this.forEach {
|
||||||
|
if (System.getProperties().containsKey(it)) return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun File.loadProperties(): Properties {
|
||||||
|
var isNew = false
|
||||||
|
val props = Properties()
|
||||||
|
this.apply {
|
||||||
|
try {
|
||||||
|
if (!exists() && createNewFile()) {
|
||||||
|
isNew = true
|
||||||
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
throw GradleException("Unable to create: `$absoluteFile`", e)
|
||||||
|
}
|
||||||
|
if (canReadFile()) {
|
||||||
|
FileInputStream(this).reader().use { reader ->
|
||||||
|
props.apply {
|
||||||
|
if (!isNew) {
|
||||||
|
load(reader)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw GradleException("Unable to read version from: `$absoluteFile`")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadIntProperty(props: Properties, key: String, default: Int): Int {
|
||||||
|
try {
|
||||||
|
return loadProperty(props, key, default.toString()).toInt()
|
||||||
|
} catch (e: java.lang.NumberFormatException) {
|
||||||
|
throw GradleException("Unable to parse $key property. (${e.message})", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadProperty(props: Properties, key: String, default: String): String {
|
||||||
|
return System.getProperty(key, if (props.isNotEmpty()) props.getProperty(key, default) else default)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadVersion(config: SemverConfig, version: Version, props: Properties) {
|
||||||
|
props.apply {
|
||||||
|
if (!parseSemVer(System.getProperty(config.semverKey), version)) {
|
||||||
|
version.major = loadIntProperty(this, config.majorKey, Version.DEFAULT_MAJOR)
|
||||||
|
version.minor = loadIntProperty(this, config.minorKey, Version.DEFAULT_MINOR)
|
||||||
|
version.patch = loadIntProperty(this, config.patchKey, Version.DEFAULT_PATCH)
|
||||||
|
version.preRelease = loadProperty(this, config.preReleaseKey, Version.DEFAULT_EMPTY)
|
||||||
|
version.buildMeta = loadProperty(this, config.buildMetaKey, Version.DEFAULT_EMPTY)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isEmpty) {
|
||||||
|
version.preReleasePrefix =
|
||||||
|
getProperty(config.preReleasePrefixKey, Version.DEFAULT_PRERELEASE_PREFIX)
|
||||||
|
version.buildMetaPrefix =
|
||||||
|
getProperty(config.buildMetaPrefixKey, Version.DEFAULT_BUILDMETA_PREFIX)
|
||||||
|
version.separator = getProperty(config.separatorKey, Version.DEFAULT_SEPARATOR)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun parseSemVer(input: String?, version: Version): Boolean {
|
||||||
|
if (input.isNullOrBlank()) return false
|
||||||
|
|
||||||
|
try {
|
||||||
|
val max = 5
|
||||||
|
val min = 3
|
||||||
|
|
||||||
|
val parts = input.split(
|
||||||
|
Regex("[\\Q${version.separator}${version.preReleasePrefix}${version.buildMetaPrefix}\\E]"),
|
||||||
|
max
|
||||||
|
)
|
||||||
|
|
||||||
|
if (parts.size >= min) {
|
||||||
|
version.major = parts[0].toInt()
|
||||||
|
version.minor = parts[1].toInt()
|
||||||
|
version.patch = parts[2].toInt()
|
||||||
|
version.preRelease = ""
|
||||||
|
version.buildMeta = ""
|
||||||
|
|
||||||
|
if (parts.size > min) {
|
||||||
|
when (parts.size) {
|
||||||
|
max -> {
|
||||||
|
version.preRelease = parts[3]
|
||||||
|
version.buildMeta = parts[4]
|
||||||
|
}
|
||||||
|
4 -> {
|
||||||
|
if (input.endsWith(version.buildMetaPrefix + parts[3])) {
|
||||||
|
version.buildMeta = parts[3]
|
||||||
|
} else {
|
||||||
|
version.preRelease = parts[3]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw NumberFormatException("Not enough parts.")
|
||||||
|
}
|
||||||
|
} catch (e: NumberFormatException) {
|
||||||
|
throw GradleException("Unable to parse version: \"$input\" (${e.message})", e)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun saveProperties(projectDir: File, config: SemverConfig, version: Version) {
|
||||||
|
val propsFile = getPropertiesFile(projectDir, config.properties)
|
||||||
|
SortedProperties().apply {
|
||||||
|
try {
|
||||||
|
propsFile.apply {
|
||||||
|
if (canReadFile()) {
|
||||||
|
FileInputStream(this).reader().use { load(it) }
|
||||||
|
} else {
|
||||||
|
createNewFile()
|
||||||
|
}
|
||||||
|
|
||||||
|
put(config.semverKey, version.semver)
|
||||||
|
put(config.majorKey, version.major.toString())
|
||||||
|
put(config.minorKey, version.minor.toString())
|
||||||
|
put(config.patchKey, version.patch.toString())
|
||||||
|
put(config.preReleaseKey, version.preRelease)
|
||||||
|
put(config.buildMetaKey, version.buildMeta)
|
||||||
|
put(config.semverKey, version.semver)
|
||||||
|
|
||||||
|
put(
|
||||||
|
config.buildMetaPrefixKey, version.buildMetaPrefix,
|
||||||
|
version.buildMetaPrefix != Version.DEFAULT_BUILDMETA_PREFIX ||
|
||||||
|
containsKey(config.buildMetaPrefixKey)
|
||||||
|
)
|
||||||
|
put(
|
||||||
|
config.preReleasePrefixKey, version.preReleasePrefix,
|
||||||
|
version.preReleasePrefix != Version.DEFAULT_PRERELEASE_PREFIX ||
|
||||||
|
containsKey(config.preReleasePrefixKey)
|
||||||
|
)
|
||||||
|
put(
|
||||||
|
config.separatorKey, version.separator,
|
||||||
|
version.separator != Version.DEFAULT_SEPARATOR ||
|
||||||
|
containsKey(config.separatorKey)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (canWrite()) {
|
||||||
|
FileOutputStream(this).writer().use {
|
||||||
|
store(it, "Generated by the Semver Plugin for Gradle")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw IOException("Can't write.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
throw GradleException("Unable to write version to: `${propsFile.absoluteFile}`", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,124 +0,0 @@
|
||||||
/*
|
|
||||||
* SemverConfigSpec.kt
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* Neither the name of this project nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.thauvin.erik.gradle.semver
|
|
||||||
|
|
||||||
import org.spekframework.spek2.Spek
|
|
||||||
import org.spekframework.spek2.style.gherkin.Feature
|
|
||||||
import kotlin.test.assertEquals
|
|
||||||
import kotlin.test.assertTrue
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
object SemverConfigSpec : Spek({
|
|
||||||
Feature("SemverConfig") {
|
|
||||||
val config = SemverConfig(Version())
|
|
||||||
Scenario("Testing configs") {
|
|
||||||
val vars = listOf(
|
|
||||||
config.semverKey,
|
|
||||||
config.majorKey,
|
|
||||||
config.minorKey,
|
|
||||||
config.patchKey,
|
|
||||||
config.preReleaseKey,
|
|
||||||
config.preReleasePrefixKey,
|
|
||||||
config.buildMetaKey,
|
|
||||||
config.buildMetaPrefixKey,
|
|
||||||
config.separatorKey
|
|
||||||
)
|
|
||||||
val defaults = listOf(
|
|
||||||
SemverConfig.DEFAULT_SEMVER_KEY,
|
|
||||||
SemverConfig.DEFAULT_MAJOR_KEY,
|
|
||||||
SemverConfig.DEFAULT_MINOR_KEY,
|
|
||||||
SemverConfig.DEFAULT_PATCH_KEY,
|
|
||||||
SemverConfig.DEFAULT_PRERELEASE_KEY,
|
|
||||||
SemverConfig.DEFAULT_PRERELEASE_PREFIX_KEY,
|
|
||||||
SemverConfig.DEFAULT_BUILDMETA_KEY,
|
|
||||||
SemverConfig.DEFAULT_BUILDMETA_PREFIX_KEY,
|
|
||||||
SemverConfig.DEFAULT_SEPARATOR
|
|
||||||
)
|
|
||||||
|
|
||||||
When("checking defaults") {}
|
|
||||||
|
|
||||||
defaults.forEachIndexed { i, d ->
|
|
||||||
Then(" ${vars[i]} should be the same: ${config.keysPrefix}$d") {
|
|
||||||
assertEquals(vars[i], "${config.keysPrefix}$d")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("config.properties should be version.properties") {
|
|
||||||
assertEquals(config.properties, "version.properties")
|
|
||||||
}
|
|
||||||
|
|
||||||
lateinit var newKeys: List<String>
|
|
||||||
|
|
||||||
When("setting keyPrefix to test.") {
|
|
||||||
config.keysPrefix = "test."
|
|
||||||
newKeys = listOf(
|
|
||||||
config.semverKey,
|
|
||||||
config.majorKey,
|
|
||||||
config.minorKey,
|
|
||||||
config.patchKey,
|
|
||||||
config.preReleaseKey,
|
|
||||||
config.preReleasePrefixKey,
|
|
||||||
config.buildMetaKey,
|
|
||||||
config.buildMetaPrefixKey,
|
|
||||||
config.separatorKey
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("all config keys should start with test.xxxx") {
|
|
||||||
newKeys.forEach { k ->
|
|
||||||
assertTrue(k.startsWith("test."), k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
When("checking extension properties") {}
|
|
||||||
|
|
||||||
Then("semver should be defaults") {
|
|
||||||
val defaultSemver =
|
|
||||||
"${Version.DEFAULT_MAJOR}${Version.DEFAULT_SEPARATOR}${Version.DEFAULT_MINOR}${Version.DEFAULT_SEPARATOR}${Version.DEFAULT_PATCH}"
|
|
||||||
assertEquals(config.semver, defaultSemver)
|
|
||||||
assertEquals(
|
|
||||||
"${config.major}${config.separator}${config.minor}${config.separator}${config.patch}",
|
|
||||||
defaultSemver
|
|
||||||
)
|
|
||||||
assertEquals(config.preRelease, Version.DEFAULT_EMPTY)
|
|
||||||
assertEquals(config.buildMeta, Version.DEFAULT_EMPTY)
|
|
||||||
assertEquals(config.preReleasePrefix, Version.DEFAULT_PRERELEASE_PREFIX)
|
|
||||||
assertEquals(config.buildMetaPrefix, Version.DEFAULT_BUILDMETA_PREFIX)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("semver = version") {
|
|
||||||
assertEquals(config.semver, config.version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* SemverConfigTest.kt
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2022, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
class SemverConfigTest {
|
||||||
|
private val config = SemverConfig(Version())
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testConfigs() {
|
||||||
|
val vars = listOf(
|
||||||
|
config.semverKey,
|
||||||
|
config.majorKey,
|
||||||
|
config.minorKey,
|
||||||
|
config.patchKey,
|
||||||
|
config.preReleaseKey,
|
||||||
|
config.preReleasePrefixKey,
|
||||||
|
config.buildMetaKey,
|
||||||
|
config.buildMetaPrefixKey,
|
||||||
|
config.separatorKey
|
||||||
|
)
|
||||||
|
val defaults = listOf(
|
||||||
|
SemverConfig.DEFAULT_SEMVER_KEY,
|
||||||
|
SemverConfig.DEFAULT_MAJOR_KEY,
|
||||||
|
SemverConfig.DEFAULT_MINOR_KEY,
|
||||||
|
SemverConfig.DEFAULT_PATCH_KEY,
|
||||||
|
SemverConfig.DEFAULT_PRERELEASE_KEY,
|
||||||
|
SemverConfig.DEFAULT_PRERELEASE_PREFIX_KEY,
|
||||||
|
SemverConfig.DEFAULT_BUILDMETA_KEY,
|
||||||
|
SemverConfig.DEFAULT_BUILDMETA_PREFIX_KEY,
|
||||||
|
SemverConfig.DEFAULT_SEPARATOR
|
||||||
|
)
|
||||||
|
|
||||||
|
defaults.forEachIndexed { i, d ->
|
||||||
|
assertEquals(vars[i], "${config.keysPrefix}$d", " ${vars[i]} should be the same: ${config.keysPrefix}$d")
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(config.properties, "version.properties", "config.properties should be version.properties")
|
||||||
|
|
||||||
|
assertTrue(
|
||||||
|
config.toString().contains("properties='${SemverConfig.DEFAULT_PROPERTIES}'"),
|
||||||
|
"toString contains default properties"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testExtensionProperties() {
|
||||||
|
config.keysPrefix = "test."
|
||||||
|
|
||||||
|
val newKeys = listOf(
|
||||||
|
config.semverKey,
|
||||||
|
config.majorKey,
|
||||||
|
config.minorKey,
|
||||||
|
config.patchKey,
|
||||||
|
config.preReleaseKey,
|
||||||
|
config.preReleasePrefixKey,
|
||||||
|
config.buildMetaKey,
|
||||||
|
config.buildMetaPrefixKey,
|
||||||
|
config.separatorKey
|
||||||
|
)
|
||||||
|
|
||||||
|
newKeys.forEach { k ->
|
||||||
|
assertTrue(k.startsWith("test."), "$k: all config keys should start with test.xxxx")
|
||||||
|
}
|
||||||
|
|
||||||
|
val defaultSemver =
|
||||||
|
"${Version.DEFAULT_MAJOR}${Version.DEFAULT_SEPARATOR}${Version.DEFAULT_MINOR}" +
|
||||||
|
"${Version.DEFAULT_SEPARATOR}${Version.DEFAULT_PATCH}"
|
||||||
|
assertEquals(config.semver, defaultSemver, "semver should be defaults")
|
||||||
|
assertEquals(
|
||||||
|
"${config.major}${config.separator}${config.minor}${config.separator}${config.patch}",
|
||||||
|
defaultSemver,
|
||||||
|
"major-minor-patch should be defaults."
|
||||||
|
)
|
||||||
|
assertEquals(config.preRelease, Version.DEFAULT_EMPTY, "preRelease empty default")
|
||||||
|
assertEquals(config.buildMeta, Version.DEFAULT_EMPTY, "buildMeta empty default")
|
||||||
|
assertEquals(config.preReleasePrefix, Version.DEFAULT_PRERELEASE_PREFIX, "preReleasePrefix default")
|
||||||
|
assertEquals(config.buildMetaPrefix, Version.DEFAULT_BUILDMETA_PREFIX, "buildMetaPrefix default")
|
||||||
|
|
||||||
|
assertEquals(config.semver, config.version, "semver = version")
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,203 +0,0 @@
|
||||||
/*
|
|
||||||
* SemverVersionSpec.kt
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* Neither the name of this project nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.thauvin.erik.gradle.semver
|
|
||||||
|
|
||||||
import org.spekframework.spek2.Spek
|
|
||||||
import org.spekframework.spek2.style.gherkin.Feature
|
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
object SemverVersionSpec : Spek({
|
|
||||||
Feature("SemverVersion") {
|
|
||||||
val version = Version()
|
|
||||||
Scenario("Testing Versions") {
|
|
||||||
When("validating default version") {}
|
|
||||||
|
|
||||||
Then("major should be 1") {
|
|
||||||
assertEquals(1, version.major)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("minor should be 1") {
|
|
||||||
assertEquals(0, version.minor)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("patch should be 0") {
|
|
||||||
assertEquals(0, version.patch)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("prerelease should be empty") {
|
|
||||||
assertEquals("", version.preRelease)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("meta should be empty") {
|
|
||||||
assertEquals("", version.buildMeta)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("preRelease prefix should be -") {
|
|
||||||
assertEquals("-", version.preReleasePrefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("meta prefix should be +") {
|
|
||||||
assertEquals("+", version.buildMetaPrefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("separator should be .") {
|
|
||||||
assertEquals(".", version.separator)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("version should be 1.0.0") {
|
|
||||||
assertEquals("1.0.0", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing major") {
|
|
||||||
version.increment(isMajor = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 2.0.0") {
|
|
||||||
assertEquals("2.0.0", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing minor") {
|
|
||||||
version.increment(isMinor = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 2.1.0") {
|
|
||||||
assertEquals("2.1.0", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing patch") {
|
|
||||||
version.increment(isPatch = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 2.1.1") {
|
|
||||||
assertEquals("2.1.1", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing minor again") {
|
|
||||||
version.increment(isMinor = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 2.2.0") {
|
|
||||||
assertEquals("2.2.0", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing major again") {
|
|
||||||
version.increment(isMajor = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 3.0.0") {
|
|
||||||
assertEquals("3.0.0", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing all") {
|
|
||||||
version.increment(isMajor = true, isMinor = true, isPatch = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 4.1.1") {
|
|
||||||
assertEquals("4.1.1", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing major and minor") {
|
|
||||||
version.increment(isMajor = true, isMinor = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 5.1.0") {
|
|
||||||
assertEquals("5.1.0", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing minor and patch") {
|
|
||||||
version.increment(isMinor = true, isPatch = true)
|
|
||||||
}
|
|
||||||
Then("should return 5.2.1") {
|
|
||||||
assertEquals("5.2.1", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("incrementing nothing") {
|
|
||||||
version.increment()
|
|
||||||
}
|
|
||||||
Then("should still return 5.2.1") {
|
|
||||||
assertEquals("5.2.1", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("resetting version") {
|
|
||||||
version.major = 1
|
|
||||||
version.minor = 0
|
|
||||||
version.patch = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 1.0.0") {
|
|
||||||
assertEquals("1.0.0", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("adding prerelease") {
|
|
||||||
version.preRelease = "beta"
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 1.0.0-beta") {
|
|
||||||
assertEquals("1.0.0-beta", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("adding metadata") {
|
|
||||||
version.buildMeta = "007"
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 1.0.0-beta+007") {
|
|
||||||
assertEquals("1.0.0-beta+007", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("changing prerelease prefix") {
|
|
||||||
version.preReleasePrefix = "--"
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 1.0.0--beta+007") {
|
|
||||||
assertEquals("1.0.0--beta+007", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("changing meta prefix") {
|
|
||||||
version.buildMetaPrefix = "++"
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 1.0.0--beta++007") {
|
|
||||||
assertEquals("1.0.0--beta++007", version.semver)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("changing separator") {
|
|
||||||
version.separator = "-"
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should return 1-0-0--beta++007") {
|
|
||||||
assertEquals("1-0-0--beta++007", version.semver)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* SortedPropertiesTest.kt
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2022, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
class SortedPropertiesTest {
|
||||||
|
@Test
|
||||||
|
fun testSortedProperties() {
|
||||||
|
val props = SortedProperties()
|
||||||
|
val fruits = setOf("Avocado", "Tomato", "apple", "banana", "cucumber", "zucchini")
|
||||||
|
|
||||||
|
fruits.reversed().forEach {
|
||||||
|
props[it] = "test"
|
||||||
|
}
|
||||||
|
|
||||||
|
val keys = props.keys().iterator()
|
||||||
|
fruits.forEach {
|
||||||
|
assertEquals(it, keys.next(), "$it key")
|
||||||
|
}
|
||||||
|
|
||||||
|
val entries = props.entries.iterator()
|
||||||
|
fruits.forEach {
|
||||||
|
assertEquals(it, entries.next().key, "$it entry")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,269 +0,0 @@
|
||||||
/*
|
|
||||||
* UtilsSpec.kt
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018-2020, Erik C. Thauvin (erik@thauvin.net)
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* Neither the name of this project nor the names of its contributors may be
|
|
||||||
* used to endorse or promote products derived from this software without
|
|
||||||
* specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package net.thauvin.erik.gradle.semver
|
|
||||||
|
|
||||||
import net.thauvin.erik.gradle.semver.Utils.canReadFile
|
|
||||||
import org.gradle.api.GradleException
|
|
||||||
import org.spekframework.spek2.Spek
|
|
||||||
import org.spekframework.spek2.style.gherkin.Feature
|
|
||||||
import java.io.File
|
|
||||||
import java.util.*
|
|
||||||
import kotlin.test.assertEquals
|
|
||||||
import kotlin.test.assertFailsWith
|
|
||||||
import kotlin.test.assertNull
|
|
||||||
import kotlin.test.assertTrue
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
object UtilsSpec : Spek(
|
|
||||||
{
|
|
||||||
Feature("Utils") {
|
|
||||||
val version = Version()
|
|
||||||
val config = SemverConfig(version)
|
|
||||||
val propsFile = File("test.properties")
|
|
||||||
val projectDir = File("./")
|
|
||||||
lateinit var props: Properties
|
|
||||||
|
|
||||||
Scenario("Save/Load Properties") {
|
|
||||||
When("saving the property") {
|
|
||||||
config.properties = propsFile.name
|
|
||||||
Utils.saveProperties(projectDir, config, version)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("properties file should exists and be readable") {
|
|
||||||
assertEquals(propsFile.canReadFile(), propsFile.canRead() && propsFile.isFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("loading the properties file") {
|
|
||||||
props = Utils.loadProperties(propsFile)
|
|
||||||
propsFile.delete()
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("version and properties should be the same.") {
|
|
||||||
assertEquals(props.getProperty(config.majorKey), version.major.toString(), "Major")
|
|
||||||
assertEquals(props.getProperty(config.minorKey), version.minor.toString(), "Minor")
|
|
||||||
assertEquals(props.getProperty(config.patchKey), version.patch.toString(), "Patch")
|
|
||||||
assertEquals(props.getProperty(config.preReleaseKey), version.preRelease, "PreRelease")
|
|
||||||
assertNull(props.getProperty(config.preReleasePrefixKey), "PreRelease Prefix")
|
|
||||||
assertEquals(props.getProperty(config.buildMetaKey), version.buildMeta, "Build Meta")
|
|
||||||
assertNull(props.getProperty(config.buildMetaPrefixKey), "Build Meta Prefix")
|
|
||||||
assertNull(props.getProperty(config.separatorKey), "Separator")
|
|
||||||
assertEquals(props.getProperty(config.semverKey), version.semver, "semver")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scenario("System Properties") {
|
|
||||||
lateinit var sysProps: Array<Pair<String, String>>
|
|
||||||
|
|
||||||
Given("new system properties") {
|
|
||||||
sysProps = arrayOf(
|
|
||||||
Pair(config.majorKey, "2"),
|
|
||||||
Pair(config.minorKey, "1"),
|
|
||||||
Pair(config.patchKey, "1"),
|
|
||||||
Pair(config.preReleaseKey, "beta"),
|
|
||||||
Pair(config.buildMetaKey, "007")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("none should already exists") {
|
|
||||||
assertTrue(
|
|
||||||
Utils.isNotSystemProperty(
|
|
||||||
setOf(
|
|
||||||
config.majorKey,
|
|
||||||
config.minorKey,
|
|
||||||
config.patchKey,
|
|
||||||
config.preReleaseKey,
|
|
||||||
config.buildMetaKey
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("version should match system properties") {
|
|
||||||
sysProps.forEach {
|
|
||||||
System.getProperties().setProperty(it.first, it.second)
|
|
||||||
if (it.first == config.majorKey || it.first == config.minorKey || it.first == config.patchKey) {
|
|
||||||
assertEquals(Utils.loadIntProperty(props, it.first, -1), it.second.toInt())
|
|
||||||
} else {
|
|
||||||
assertEquals(Utils.loadProperty(props, it.first, ""), it.second)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
When("loading version") {
|
|
||||||
Utils.loadVersion(config, version, props)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("version should be identical") {
|
|
||||||
assertEquals(version.semver, "2.1.1-beta+007")
|
|
||||||
}
|
|
||||||
|
|
||||||
When("saving properties") {
|
|
||||||
Utils.saveProperties(projectDir, config, version)
|
|
||||||
}
|
|
||||||
|
|
||||||
lateinit var newProps: Properties
|
|
||||||
|
|
||||||
And("loading properties file") {
|
|
||||||
newProps = Utils.loadProperties(propsFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("new properties should validate") {
|
|
||||||
sysProps.forEach {
|
|
||||||
assertEquals(newProps.getProperty(it.first), it.second, it.second)
|
|
||||||
}
|
|
||||||
propsFile.delete()
|
|
||||||
}
|
|
||||||
|
|
||||||
When("setting the version as system property") {
|
|
||||||
System.getProperties().setProperty(config.semverKey, "3.2.2")
|
|
||||||
}
|
|
||||||
|
|
||||||
And("loading the properties") {
|
|
||||||
Utils.loadVersion(config, version, props)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("versions should match") {
|
|
||||||
assertEquals(version.semver, System.getProperty(config.semverKey))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scenario("Version Parsing") {
|
|
||||||
When("validating version parsing") {}
|
|
||||||
|
|
||||||
Then("versions should parse") {
|
|
||||||
listOf(
|
|
||||||
"1.0.0",
|
|
||||||
"2.1.0-beta",
|
|
||||||
"3.2.1-beta+007",
|
|
||||||
"4.3.2+007",
|
|
||||||
"11.11.1",
|
|
||||||
"111.11.11-beta",
|
|
||||||
"1111.111.11-beta+001.12"
|
|
||||||
).forEach {
|
|
||||||
assertTrue(Utils.parseSemVer(it, version), "parsing semver: $it")
|
|
||||||
assertEquals(it, version.semver, it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("should throw exceptions") {
|
|
||||||
assertFailsWith<GradleException>("2.1.1a") {
|
|
||||||
Utils.parseSemVer("2.1.1a", version)
|
|
||||||
}
|
|
||||||
assertFailsWith<GradleException>("2a.1.1") {
|
|
||||||
Utils.parseSemVer("2a.1.1", version)
|
|
||||||
}
|
|
||||||
assertFailsWith<GradleException>("2.1a.1") {
|
|
||||||
Utils.parseSemVer("2.1a.1", version)
|
|
||||||
}
|
|
||||||
assertFailsWith<GradleException>("2.1") {
|
|
||||||
Utils.parseSemVer("2.1", version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Given("new prefixes") {
|
|
||||||
version.preReleasePrefix = "."
|
|
||||||
version.buildMetaPrefix = "."
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("prefixes should parse") {
|
|
||||||
listOf("2.1.0.beta.1", "2.1.1.1", "3.2.1.beta.1.007").forEach {
|
|
||||||
assertTrue(Utils.parseSemVer(it, version), "parsing semver: $it")
|
|
||||||
assertEquals(it, version.semver, it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("last pre-release and meta should match") {
|
|
||||||
assertEquals(version.preRelease, "beta")
|
|
||||||
assertEquals(version.buildMeta, "1.007")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scenario("Load locked properties") {
|
|
||||||
lateinit var locked: File
|
|
||||||
|
|
||||||
Given("the locked location") {
|
|
||||||
locked = File("locked")
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("loading locked properties") {
|
|
||||||
assertFailsWith<GradleException> {
|
|
||||||
Utils.loadProperties(File(locked, propsFile.name))
|
|
||||||
}
|
|
||||||
locked.delete()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scenario("Save to locked properties") {
|
|
||||||
lateinit var propsLocked: File
|
|
||||||
Given("the locked properties") {
|
|
||||||
propsLocked = File(System.getProperty("user.home") + File.separator + "locked.properties")
|
|
||||||
propsLocked.createNewFile()
|
|
||||||
propsLocked.setReadOnly()
|
|
||||||
config.properties = propsLocked.name
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("saving the locked properties file") {
|
|
||||||
assertFailsWith<GradleException> {
|
|
||||||
Utils.saveProperties(propsLocked.parentFile, config, version)
|
|
||||||
}
|
|
||||||
propsLocked.delete()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Scenario("Save/Load Properties in foo") {
|
|
||||||
lateinit var fooDir: File
|
|
||||||
lateinit var fooProps: File
|
|
||||||
When("saving the foo property") {
|
|
||||||
fooDir = File("foo")
|
|
||||||
fooDir.mkdir()
|
|
||||||
fooProps = File(fooDir, propsFile.name)
|
|
||||||
config.properties = fooProps.absolutePath
|
|
||||||
Utils.saveProperties(projectDir, config, version)
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("foo properties file should exists and be readable") {
|
|
||||||
assertEquals(fooProps.canReadFile(), fooProps.canRead() && fooProps.isFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
When("loading the foo properties file") {
|
|
||||||
props = Utils.loadProperties(fooProps)
|
|
||||||
fooProps.delete()
|
|
||||||
fooDir.delete()
|
|
||||||
}
|
|
||||||
|
|
||||||
Then("version in foo properties should be the same") {
|
|
||||||
assertEquals(props.getProperty(config.semverKey), version.semver)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
231
src/test/kotlin/net/thauvin/erik/gradle/semver/UtilsTest.kt
Normal file
231
src/test/kotlin/net/thauvin/erik/gradle/semver/UtilsTest.kt
Normal file
|
@ -0,0 +1,231 @@
|
||||||
|
/*
|
||||||
|
* est.kt
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2022, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
|
import org.gradle.api.GradleException
|
||||||
|
import java.io.File
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.test.assertFailsWith
|
||||||
|
import kotlin.test.assertNull
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests
|
||||||
|
*/
|
||||||
|
class UtilsTest {
|
||||||
|
private val version = Version()
|
||||||
|
private val config = SemverConfig(version)
|
||||||
|
private val propsFile = File("test.properties")
|
||||||
|
private val projectDir = File("./")
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testExceptions() {
|
||||||
|
assertFailsWith<GradleException>("2.1.1a") {
|
||||||
|
parseSemVer("2.1.1a", version)
|
||||||
|
}
|
||||||
|
assertFailsWith<GradleException>("2a.1.1") {
|
||||||
|
parseSemVer("2a.1.1", version)
|
||||||
|
}
|
||||||
|
assertFailsWith<GradleException>("2.1a.1") {
|
||||||
|
parseSemVer("2.1a.1", version)
|
||||||
|
}
|
||||||
|
assertFailsWith<GradleException>("2.1") {
|
||||||
|
parseSemVer("2.1", version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testFooProperties() {
|
||||||
|
val fooDir = File("foo")
|
||||||
|
fooDir.mkdir()
|
||||||
|
val fooFile = File(fooDir, propsFile.name)
|
||||||
|
config.properties = fooFile.absolutePath
|
||||||
|
saveProperties(projectDir, config, version)
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
fooFile.canReadFile(),
|
||||||
|
fooFile.canRead() && fooFile.isFile,
|
||||||
|
"foo properties file should exists and be readable"
|
||||||
|
)
|
||||||
|
|
||||||
|
val fooProps = fooFile.loadProperties()
|
||||||
|
fooFile.delete()
|
||||||
|
fooDir.delete()
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
fooProps.getProperty(config.semverKey),
|
||||||
|
version.semver,
|
||||||
|
"version in foo properties should be the same"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testLoadSaveProperties() {
|
||||||
|
config.properties = propsFile.name
|
||||||
|
saveProperties(projectDir, config, version)
|
||||||
|
assertEquals(
|
||||||
|
propsFile.canReadFile(),
|
||||||
|
propsFile.canRead() && propsFile.isFile,
|
||||||
|
"properties file should exists and be readable"
|
||||||
|
)
|
||||||
|
|
||||||
|
val props = propsFile.loadProperties()
|
||||||
|
|
||||||
|
assertEquals(props.getProperty(config.majorKey), version.major.toString(), "Major")
|
||||||
|
assertEquals(props.getProperty(config.minorKey), version.minor.toString(), "Minor")
|
||||||
|
assertEquals(props.getProperty(config.patchKey), version.patch.toString(), "Patch")
|
||||||
|
assertEquals(props.getProperty(config.preReleaseKey), version.preRelease, "PreRelease")
|
||||||
|
assertNull(props.getProperty(config.preReleasePrefixKey), "PreRelease Prefix")
|
||||||
|
assertEquals(props.getProperty(config.buildMetaKey), version.buildMeta, "Build Meta")
|
||||||
|
assertNull(props.getProperty(config.buildMetaPrefixKey), "Build Meta Prefix")
|
||||||
|
assertNull(props.getProperty(config.separatorKey), "Separator")
|
||||||
|
assertEquals(props.getProperty(config.semverKey), version.semver, "semver")
|
||||||
|
|
||||||
|
propsFile.delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testLockedProperties() {
|
||||||
|
var locked = File("locked")
|
||||||
|
|
||||||
|
assertFailsWith<GradleException> {
|
||||||
|
File(locked, propsFile.name).loadProperties()
|
||||||
|
}
|
||||||
|
locked.delete()
|
||||||
|
|
||||||
|
locked = File(System.getProperty("user.home") + File.separator + "locked.properties")
|
||||||
|
locked.createNewFile()
|
||||||
|
locked.setReadOnly()
|
||||||
|
config.properties = locked.name
|
||||||
|
|
||||||
|
if (!locked.canWrite()) {
|
||||||
|
assertFailsWith<GradleException> {
|
||||||
|
saveProperties(locked.parentFile, config, version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
locked.delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testLoadIntProperty() {
|
||||||
|
val props = SortedProperties()
|
||||||
|
props["foo"] = "bar"
|
||||||
|
|
||||||
|
assertFailsWith<GradleException> { loadIntProperty(props, "foo", 1) }
|
||||||
|
|
||||||
|
assertEquals(loadIntProperty(props, "none", 1), 1, "default int value")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testPrefix() {
|
||||||
|
version.preReleasePrefix = "."
|
||||||
|
version.buildMetaPrefix = "."
|
||||||
|
|
||||||
|
listOf("2.1.0.beta.1", "2.1.1.1", "3.2.1.beta.1.007").forEach {
|
||||||
|
assertTrue(parseSemVer(it, version), "parsing semver: $it")
|
||||||
|
assertEquals(it, version.semver, it)
|
||||||
|
}
|
||||||
|
|
||||||
|
assertEquals(version.preRelease, "beta", "last pre-release should match")
|
||||||
|
assertEquals(version.buildMeta, "1.007", "last meta should match")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testSystemProperties() {
|
||||||
|
val sysProps = arrayOf(
|
||||||
|
Pair(config.majorKey, "2"),
|
||||||
|
Pair(config.minorKey, "1"),
|
||||||
|
Pair(config.patchKey, "1"),
|
||||||
|
Pair(config.preReleaseKey, "beta"),
|
||||||
|
Pair(config.buildMetaKey, "007")
|
||||||
|
)
|
||||||
|
|
||||||
|
assertTrue(
|
||||||
|
setOf(
|
||||||
|
config.majorKey,
|
||||||
|
config.minorKey,
|
||||||
|
config.patchKey,
|
||||||
|
config.preReleaseKey,
|
||||||
|
config.buildMetaKey
|
||||||
|
).isNotSystemProperty(), "none should already exists"
|
||||||
|
)
|
||||||
|
|
||||||
|
val props = propsFile.loadProperties()
|
||||||
|
|
||||||
|
sysProps.forEach {
|
||||||
|
val msg = "${it.first} should match system properties"
|
||||||
|
System.getProperties().setProperty(it.first, it.second)
|
||||||
|
if (it.first == config.majorKey || it.first == config.minorKey || it.first == config.patchKey) {
|
||||||
|
assertEquals(loadIntProperty(props, it.first, -1), it.second.toInt(), msg)
|
||||||
|
} else {
|
||||||
|
assertEquals(loadProperty(props, it.first, ""), it.second, msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadVersion(config, version, props)
|
||||||
|
assertEquals(version.semver, "2.1.1-beta+007", "version should be identical")
|
||||||
|
|
||||||
|
saveProperties(projectDir, config, version)
|
||||||
|
|
||||||
|
val newPropsFile = File(config.properties)
|
||||||
|
val newProps = newPropsFile.loadProperties()
|
||||||
|
|
||||||
|
sysProps.forEach {
|
||||||
|
assertEquals(newProps.getProperty(it.first), it.second, "new properties should validate")
|
||||||
|
}
|
||||||
|
|
||||||
|
newPropsFile.delete()
|
||||||
|
|
||||||
|
System.getProperties().setProperty(config.semverKey, "3.2.2")
|
||||||
|
props["foo"] = "bar"
|
||||||
|
loadVersion(config, version, props)
|
||||||
|
assertEquals(version.semver, System.getProperty(config.semverKey), "versions should match")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testVersionParsing() {
|
||||||
|
listOf(
|
||||||
|
"1.0.0",
|
||||||
|
"2.1.0-beta",
|
||||||
|
"3.2.1-beta+007",
|
||||||
|
"4.3.2+007",
|
||||||
|
"11.11.1",
|
||||||
|
"111.11.11-beta",
|
||||||
|
"1111.111.11-beta+001.12"
|
||||||
|
).forEach {
|
||||||
|
assertTrue(parseSemVer(it, version), "parsing semver: $it")
|
||||||
|
assertEquals(it, version.semver, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
109
src/test/kotlin/net/thauvin/erik/gradle/semver/VersionTest.kt
Normal file
109
src/test/kotlin/net/thauvin/erik/gradle/semver/VersionTest.kt
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
/*
|
||||||
|
* VersionTest.kt
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2022, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
class VersionTest {
|
||||||
|
private val version = Version()
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testDefaultVersion() {
|
||||||
|
assertEquals(1, version.major, "major should be 1")
|
||||||
|
assertEquals(0, version.minor, "minor should be 1")
|
||||||
|
assertEquals(0, version.patch, "patch should be 0")
|
||||||
|
assertEquals("", version.preRelease, "prerelease should be empty")
|
||||||
|
assertEquals("", version.buildMeta, "meta should be empty")
|
||||||
|
assertEquals("-", version.preReleasePrefix, "preRelease prefix should be -")
|
||||||
|
assertEquals("+", version.buildMetaPrefix, "meta prefix should be +")
|
||||||
|
assertEquals(".", version.separator, "separator should be .")
|
||||||
|
assertEquals("1.0.0", version.semver, "version should be 1.0.0")
|
||||||
|
assertEquals(version.toString(), version.semver, "toString should be semver")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testIncrement() {
|
||||||
|
version.increment(isMajor = true)
|
||||||
|
assertEquals("2.0.0", version.semver, "should return 2.0.0")
|
||||||
|
|
||||||
|
version.increment(isMinor = true)
|
||||||
|
assertEquals("2.1.0", version.semver, "should return 2.1.0")
|
||||||
|
|
||||||
|
version.increment(isPatch = true)
|
||||||
|
assertEquals("2.1.1", version.semver, "should return 2.1.1")
|
||||||
|
|
||||||
|
version.increment(isMinor = true)
|
||||||
|
assertEquals("2.2.0", version.semver, "should return 2.2.0")
|
||||||
|
|
||||||
|
version.increment(isMajor = true)
|
||||||
|
assertEquals("3.0.0", version.semver, "should return 3.0.0")
|
||||||
|
|
||||||
|
version.increment(isMajor = true, isMinor = true, isPatch = true)
|
||||||
|
assertEquals("4.1.1", version.semver, "should return 4.1.1")
|
||||||
|
|
||||||
|
version.increment(isMajor = true, isMinor = true)
|
||||||
|
assertEquals("5.1.0", version.semver, "should return 5.1.0")
|
||||||
|
|
||||||
|
version.increment(isMinor = true, isPatch = true)
|
||||||
|
assertEquals("5.2.1", version.semver, "should return 5.2.1")
|
||||||
|
|
||||||
|
version.increment()
|
||||||
|
assertEquals("5.2.1", version.semver, "should still return 5.2.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testVersion() {
|
||||||
|
version.major = 1
|
||||||
|
version.minor = 0
|
||||||
|
version.patch = 0
|
||||||
|
assertEquals("1.0.0", version.semver, "should return 1.0.0")
|
||||||
|
|
||||||
|
version.preRelease = "beta"
|
||||||
|
assertEquals("1.0.0-beta", version.semver, "should return 1.0.0-beta")
|
||||||
|
|
||||||
|
version.buildMeta = "007"
|
||||||
|
assertEquals("1.0.0-beta+007", version.semver, "should return 1.0.0-beta+007")
|
||||||
|
|
||||||
|
version.preReleasePrefix = "--"
|
||||||
|
assertEquals("1.0.0--beta+007", version.semver, "should return 1.0.0--beta+007")
|
||||||
|
|
||||||
|
version.buildMetaPrefix = "++"
|
||||||
|
assertEquals("1.0.0--beta++007", version.semver, "should return 1.0.0--beta++007")
|
||||||
|
|
||||||
|
version.separator = "-"
|
||||||
|
assertEquals("1-0-0--beta++007", version.semver, "should return 1-0-0--beta++007")
|
||||||
|
|
||||||
|
assertEquals(version.toString(), version.semver, "toString() should return semver")
|
||||||
|
}
|
||||||
|
}
|
61
updatewrappers.sh
Normal file → Executable file
61
updatewrappers.sh
Normal file → Executable file
|
@ -1,18 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Version: 1.0.2
|
# Version: 1.0.3
|
||||||
#
|
#
|
||||||
|
|
||||||
# set the examples directories
|
# set the examples directories
|
||||||
declare -a dirs=(
|
declare -a dirs=(
|
||||||
"${PWD##*/}"
|
"${PWD##*/}"
|
||||||
"examples/java"
|
"examples/java"
|
||||||
"examples/kotlin"
|
"examples/kotlin"
|
||||||
"examples/annotation-processor/java"
|
"examples/annotation-processor/java"
|
||||||
"examples/annotation-processor/kotlin")
|
"examples/annotation-processor/kotlin")
|
||||||
java8=true
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
@ -22,42 +20,25 @@ green=$(tput setaf 2)
|
||||||
red=$(tput setaf 1)
|
red=$(tput setaf 1)
|
||||||
std=$(tput sgr0)
|
std=$(tput sgr0)
|
||||||
|
|
||||||
if [ "$java8" = true ]
|
|
||||||
then
|
|
||||||
export JAVA_HOME="$JAVA8_HOME"
|
|
||||||
export PATH="$(cygpath "$JAVA_HOME")/bin:$PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
kVer=$(kobaltw --version | awk '{print substr($2, 1, length($2)-1)}')
|
|
||||||
updateWrappers() {
|
updateWrappers() {
|
||||||
curVer="$(gradle --version | awk '/Gradle/ {print $2}')"
|
curVer="$(gradle --version | awk '/Gradle/ {print $2}')"
|
||||||
if [ -d gradle ]; then
|
if [ -d gradle ]; then
|
||||||
if [ "$curVer" != "$(./gradlew --version | awk '/Gradle/ {print $2}')" ]; then
|
if [ "$curVer" != "$(./gradlew --version | awk '/Gradle/ {print $2}')" ]; then
|
||||||
gradle -q --console=plain wrapper
|
gradle -q --console=plain wrapper
|
||||||
echo -e " $(./gradlew --version | awk '/Gradle/') ${green}UPDATED${std}"
|
echo -e " $(./gradlew --version | awk '/Gradle/') ${green}UPDATED${std}"
|
||||||
else
|
else
|
||||||
echo -e " Gradle $curVer UP-TO-DATE"
|
echo -e " Gradle $curVer UP-TO-DATE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -d kobalt ]; then
|
|
||||||
kw=$(cut -d "=" -f 2 kobalt/wrapper/kobalt-wrapper.properties)
|
|
||||||
if [ "$kw" = "$kVer" ]
|
|
||||||
then
|
|
||||||
echo -e " Kobalt $kw UP-TO-DATE"
|
|
||||||
else
|
|
||||||
echo -e "kobalt.version=$kVer" > kobalt/wrapper/kobalt-wrapper.properties
|
|
||||||
echo -e " Kobalt $kVer ${green}UPDATED${std}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -e "Updating wrappers..."
|
echo -e "Updating wrappers..."
|
||||||
|
|
||||||
for d in "${!dirs[@]}"; do
|
for d in "${!dirs[@]}"; do
|
||||||
if [ "$d" -ne 0 ]; then
|
if [ "$d" -ne 0 ]; then
|
||||||
cd "${dirs[d]}" || exit 1
|
cd "${dirs[d]}" || exit 1
|
||||||
fi
|
fi
|
||||||
echo -e " ${cyan}${dirs[d]}${std}"
|
echo -e " ${cyan}${dirs[d]}${std}"
|
||||||
updateWrappers
|
updateWrappers
|
||||||
cd "$pwd"
|
cd "$pwd"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue