Add bld example
This commit is contained in:
parent
0ec7a6ee13
commit
11a47e7e0b
64 changed files with 425 additions and 54 deletions
2
examples/java/gradle/.editorconfig
Normal file
2
examples/java/gradle/.editorconfig
Normal file
|
@ -0,0 +1,2 @@
|
|||
[*]
|
||||
insert_final_newline = true
|
5
examples/java/gradle/.gitattributes
vendored
Normal file
5
examples/java/gradle/.gitattributes
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# batch files are specific to windows and always crlf
|
||||
*.bat eol=crlf
|
82
examples/java/gradle/.gitignore
vendored
Normal file
82
examples/java/gradle/.gitignore
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
!.vscode/extensions.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!gradle-wrapper.jar
|
||||
.classpath
|
||||
.DS_Store
|
||||
.gradle
|
||||
.history
|
||||
.idea_modules/
|
||||
.idea/**/contentModel.xml
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dbnavigator.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
.idea/**/mongoSettings.xml
|
||||
.idea/**/shelf
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/workspace.xml
|
||||
.idea/caches/build_file_checksums.ser
|
||||
.idea/httpRequests
|
||||
.idea/replstate.xml
|
||||
.kobalt
|
||||
.mtj.tmp/
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
.nb-gradle
|
||||
.project
|
||||
.scannerwork
|
||||
.settings
|
||||
.vscode/*
|
||||
*.class
|
||||
*.code-workspace
|
||||
*.ctxt
|
||||
*.ear
|
||||
*.iws
|
||||
*.jar
|
||||
*.log
|
||||
*.nar
|
||||
*.rar
|
||||
*.sublime-*
|
||||
*.tar.gz
|
||||
*.war
|
||||
*.zip
|
||||
atlassian-ide-plugin.xml
|
||||
bin/
|
||||
build/
|
||||
cmake-build-*/
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics-build.properties
|
||||
crashlytics.properties
|
||||
dependency-reduced-pom.xml
|
||||
deploy/
|
||||
dist/
|
||||
ehthumbs.db
|
||||
fabric.properties
|
||||
gen/
|
||||
gradle.properties
|
||||
hs_err_pid*
|
||||
kobaltBuild
|
||||
kobaltw*-test
|
||||
lib/kotlin*
|
||||
libs/
|
||||
local.properties
|
||||
out/
|
||||
pom.xml.next
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.tag
|
||||
pom.xml.versionsBackup
|
||||
proguard-project.txt
|
||||
project.properties
|
||||
release.properties
|
||||
target/
|
||||
test-output
|
||||
Thumbs.db
|
1
examples/java/gradle/.idea/.name
generated
Normal file
1
examples/java/gradle/.idea/.name
generated
Normal file
|
@ -0,0 +1 @@
|
|||
examples-java
|
9
examples/java/gradle/.idea/compiler.xml
generated
Normal file
9
examples/java/gradle/.idea/compiler.xml
generated
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel>
|
||||
<module name="examples-java_main" target="1.8" />
|
||||
<module name="examples-java_test" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
6
examples/java/gradle/.idea/encodings.xml
generated
Normal file
6
examples/java/gradle/.idea/encodings.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
53
examples/java/gradle/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
53
examples/java/gradle/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
|
@ -0,0 +1,53 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<option name="myLocal" value="true" />
|
||||
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="created" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="LocalCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="REPORT_VARIABLES" value="true" />
|
||||
<option name="REPORT_PARAMETERS" value="false" />
|
||||
<option name="REPORT_CATCH_PARAMETERS" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
|
||||
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" />
|
||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
|
||||
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
6
examples/java/gradle/.idea/misc.xml
generated
Normal file
6
examples/java/gradle/.idea/misc.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/classes" />
|
||||
</component>
|
||||
</project>
|
10
examples/java/gradle/.idea/modules.xml
generated
Normal file
10
examples/java/gradle/.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-java.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-java.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-java_main.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-java_main.iml" group="examples-java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/examples-java_test.iml" filepath="$PROJECT_DIR$/.idea/modules/examples-java_test.iml" group="examples-java" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
13
examples/java/gradle/.idea/modules/examples-java.iml
generated
Normal file
13
examples/java/gradle/.idea/modules/examples-java.iml
generated
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="examples-java" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../..">
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../build" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../out" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
18
examples/java/gradle/.idea/modules/examples-java_main.iml
generated
Normal file
18
examples/java/gradle/.idea/modules/examples-java_main.iml
generated
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="examples-java:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/../../out/production/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../src/generated">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/generated" isTestSource="false" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$/../../src/main">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: net.thauvin.erik:semver:1.0.1" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Gradle: com.github.spullara.mustache.java:compiler:0.9.4" level="project" />
|
||||
</component>
|
||||
</module>
|
15
examples/java/gradle/.idea/modules/examples-java_test.iml
generated
Normal file
15
examples/java/gradle/.idea/modules/examples-java_test.iml
generated
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="examples-java:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output-test url="file://$MODULE_DIR$/../../out/test/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../src/test">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="examples-java_main" />
|
||||
</component>
|
||||
<component name="TestModuleProperties" production-module="examples-java_main" />
|
||||
</module>
|
6
examples/java/gradle/.idea/vcs.xml
generated
Normal file
6
examples/java/gradle/.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
39
examples/java/gradle/build.gradle
Normal file
39
examples/java/gradle/build.gradle
Normal file
|
@ -0,0 +1,39 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
id 'com.github.ben-manes.versions' version '0.47.0'
|
||||
}
|
||||
|
||||
// ./gradlew run
|
||||
// ./gradlew runExample
|
||||
|
||||
defaultTasks 'run'
|
||||
|
||||
final def semverProcessor = 'net.thauvin.erik:semver:1.2.1-SNAPSHOT'
|
||||
|
||||
sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
|
||||
mainClassName = 'com.example.App'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor semverProcessor
|
||||
implementation semverProcessor
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.generatedSourceOutputDirectory.set(file("${projectDir}/src/generated/java"))
|
||||
options.compilerArgs += ["-Asemver.project.dir=$projectDir"]
|
||||
}
|
||||
|
||||
task runExample(type: JavaExec) {
|
||||
group = 'application'
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
mainClass.set('com.example.Example')
|
||||
}
|
21
examples/java/gradle/example.mustache
Normal file
21
examples/java/gradle/example.mustache
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* This file is automatically generated.
|
||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||
*/
|
||||
|
||||
package {{packageName}};
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public final class {{className}} {
|
||||
public static final String PROJECT = "{{project}}";
|
||||
public static final Date BUILDDATE = new Date({{epoch}}L);
|
||||
public static final String VERSION = "{{version}}";
|
||||
|
||||
/**
|
||||
* Disables the default constructor.
|
||||
*/
|
||||
private {{className}}() {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
}
|
9
examples/java/gradle/example.properties
Normal file
9
examples/java/gradle/example.properties
Normal file
|
@ -0,0 +1,9 @@
|
|||
#Generated by the Semver Plugin for Gradle
|
||||
#Sat Apr 27 17:04:13 PDT 2019
|
||||
example.buildmeta=T800
|
||||
example.major=8
|
||||
example.minor=4
|
||||
example.patch=97
|
||||
example.prerelease=alpha
|
||||
example.project=Java Example
|
||||
example.semver=8.4.97-alpha+T800
|
BIN
examples/java/gradle/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
examples/java/gradle/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
249
examples/java/gradle/gradlew
vendored
Executable file
249
examples/java/gradle/gradlew
vendored
Executable file
|
@ -0,0 +1,249 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# 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
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
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
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$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, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# 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" "$@"
|
92
examples/java/gradle/gradlew.bat
vendored
Normal file
92
examples/java/gradle/gradlew.bat
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
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.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
64
examples/java/gradle/pom.xml
Normal file
64
examples/java/gradle/pom.xml
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>Example</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>Example</name>
|
||||
|
||||
<properties>
|
||||
<semver.version>1.2.0</semver.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.thauvin.erik</groupId>
|
||||
<artifactId>semver</artifactId>
|
||||
<version>${semver.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<generatedSourcesDirectory>src/generated/java</generatedSourcesDirectory>
|
||||
<annotationProcessorPaths>
|
||||
<annotationProcessorPath>
|
||||
<groupId>net.thauvin.erik</groupId>
|
||||
<artifactId>semver</artifactId>
|
||||
<version>${semver.version}</version>
|
||||
</annotationProcessorPath>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>run</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>com.example.App</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
19
examples/java/gradle/settings.gradle
Normal file
19
examples/java/gradle/settings.gradle
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* This settings file was auto generated by the Gradle buildInit task
|
||||
* by 'erik' at '1/14/16 4:59 PM' with Gradle 2.10
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
* In a single project build this file can be empty or even removed.
|
||||
*
|
||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
||||
* in the user guide at https://docs.gradle.org/2.10/userguide/multi_project_builds.html
|
||||
*/
|
||||
|
||||
/*
|
||||
// To declare projects as part of a multi-project build use the 'include' method
|
||||
include 'shared'
|
||||
include 'api'
|
||||
include 'services:webservice'
|
||||
*/
|
||||
|
||||
rootProject.name = 'examples-java'
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* This file is automatically generated.
|
||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||
*/
|
||||
|
||||
package com.example;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public final class ExampleVersion {
|
||||
public static final String PROJECT = "Java Example";
|
||||
public static final Date BUILDDATE = new Date(1692423608415L);
|
||||
public static final String VERSION = "8.4.97-alpha+T800";
|
||||
|
||||
/**
|
||||
* Disables the default constructor.
|
||||
*/
|
||||
private ExampleVersion() {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This file is automatically generated.
|
||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
||||
*/
|
||||
|
||||
package com.example;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Provides semantic version information.
|
||||
*
|
||||
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
|
||||
*/
|
||||
public final class GeneratedVersion {
|
||||
public static final String PROJECT = "Java App";
|
||||
public static final Date BUILDDATE = new Date(1692423608452L);
|
||||
public static final int MAJOR = 11;
|
||||
public static final int MINOR = 11;
|
||||
public static final int PATCH = 20;
|
||||
public static final String PRERELEASE = "beta";
|
||||
public static final String PRERELEASE_PREFIX = "-";
|
||||
public static final String BUILDMETA = "007";
|
||||
public static final String BUILDMETA_PREFIX = "+";
|
||||
public static final String SEPARATOR = ".";
|
||||
public static final String VERSION = "11.11.20-beta+007";
|
||||
|
||||
/**
|
||||
* Disables the default constructor.
|
||||
*/
|
||||
private GeneratedVersion() {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
}
|
31
examples/java/gradle/src/main/java/com/example/App.java
Normal file
31
examples/java/gradle/src/main/java/com/example/App.java
Normal file
|
@ -0,0 +1,31 @@
|
|||
package com.example;
|
||||
|
||||
import net.thauvin.erik.semver.Version;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
@Version(properties = "version.properties")
|
||||
public final class App {
|
||||
/**
|
||||
* Command line interface.
|
||||
*
|
||||
* @param args The command line parameters.
|
||||
*/
|
||||
public static void main(final String... args) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z", Locale.US);
|
||||
|
||||
System.out.println("-----------------------------------------------------");
|
||||
|
||||
System.out.println(" Version: " + GeneratedVersion.PROJECT + ' ' + GeneratedVersion.VERSION);
|
||||
|
||||
System.out.println(" Built on: " + sdf.format(GeneratedVersion.BUILDDATE));
|
||||
System.out.println(" Major: " + GeneratedVersion.MAJOR);
|
||||
System.out.println(" Minor: " + GeneratedVersion.MINOR);
|
||||
System.out.println(" Patch: " + GeneratedVersion.PATCH);
|
||||
System.out.println(" PreRelease: " + GeneratedVersion.PRERELEASE);
|
||||
System.out.println(" BuildMetaData: " + GeneratedVersion.BUILDMETA);
|
||||
|
||||
System.out.println("-----------------------------------------------------");
|
||||
}
|
||||
}
|
27
examples/java/gradle/src/main/java/com/example/Example.java
Normal file
27
examples/java/gradle/src/main/java/com/example/Example.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package com.example;
|
||||
|
||||
import net.thauvin.erik.semver.Version;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
@Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion",
|
||||
keysPrefix = "example.")
|
||||
public final class Example {
|
||||
/**
|
||||
* Command line interface.
|
||||
*
|
||||
* @param args The command line parameters.
|
||||
*/
|
||||
public static void main(final String... args) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
|
||||
System.out.println("-- From Example -------------------------------------");
|
||||
|
||||
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
|
||||
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
|
||||
|
||||
System.out.println("-----------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
9
examples/java/gradle/version.properties
Normal file
9
examples/java/gradle/version.properties
Normal file
|
@ -0,0 +1,9 @@
|
|||
#Generated by the Semver Plugin for Gradle
|
||||
#Sat Apr 27 17:05:34 PDT 2019
|
||||
version.buildmeta=007
|
||||
version.major=11
|
||||
version.minor=11
|
||||
version.patch=20
|
||||
version.prerelease=beta
|
||||
version.project=Java App
|
||||
version.semver=11.11.20-beta+007
|
BIN
examples/java/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
examples/java/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue