Added new example with custom properties and template.
This commit is contained in:
parent
0fb4324d8d
commit
f801ce03fe
28 changed files with 533 additions and 65 deletions
13
.idea/misc.xml
generated
13
.idea/misc.xml
generated
|
@ -4,6 +4,19 @@
|
||||||
<component name="JavaScriptSettings">
|
<component name="JavaScriptSettings">
|
||||||
<option name="languageLevel" value="ES6" />
|
<option name="languageLevel" value="ES6" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="PDMPlugin">
|
||||||
|
<option name="customRuleSets">
|
||||||
|
<list>
|
||||||
|
<option value="K:\java\semver\config\pmd.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="options">
|
||||||
|
<map>
|
||||||
|
<entry key="Encoding" value="" />
|
||||||
|
<entry key="Target JDK" value="1.8" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
|
|
48
CHANGELOG.md
Normal file
48
CHANGELOG.md
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
## [Unreleased](https://github.com/ethauvin/semver/tree/HEAD)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/1.1.1...HEAD)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- kapt and Kotlin 1.3.30 require kapt.use.worker.api=true [\#2](https://github.com/ethauvin/semver/issues/2)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- kapt and Kotlin 1.3.30 require kapt.use.worker.api=true [\#2](https://github.com/ethauvin/semver/issues/2)
|
||||||
|
|
||||||
|
## [1.1.1](https://github.com/ethauvin/semver/tree/1.1.1) (2019-03-31)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/1.1.0-beta...1.1.1)
|
||||||
|
|
||||||
|
## [1.1.0-beta](https://github.com/ethauvin/semver/tree/1.1.0-beta) (2018-11-04)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/1.0.1...1.1.0-beta)
|
||||||
|
|
||||||
|
## [1.0.1](https://github.com/ethauvin/semver/tree/1.0.1) (2017-05-30)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/1.0.0...1.0.1)
|
||||||
|
|
||||||
|
## [1.0.0](https://github.com/ethauvin/semver/tree/1.0.0) (2017-05-10)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.6-beta...1.0.0)
|
||||||
|
|
||||||
|
## [0.9.6-beta](https://github.com/ethauvin/semver/tree/0.9.6-beta) (2016-07-15)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.5-beta...0.9.6-beta)
|
||||||
|
|
||||||
|
## [0.9.5-beta](https://github.com/ethauvin/semver/tree/0.9.5-beta) (2016-02-03)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.4-beta...0.9.5-beta)
|
||||||
|
|
||||||
|
## [0.9.4-beta](https://github.com/ethauvin/semver/tree/0.9.4-beta) (2016-01-29)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.3-beta...0.9.4-beta)
|
||||||
|
|
||||||
|
## [0.9.3-beta](https://github.com/ethauvin/semver/tree/0.9.3-beta) (2016-01-28)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.2-beta...0.9.3-beta)
|
||||||
|
|
||||||
|
## [0.9.2-beta](https://github.com/ethauvin/semver/tree/0.9.2-beta) (2016-01-25)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.1-beta...0.9.2-beta)
|
||||||
|
|
||||||
|
## [0.9.1-beta](https://github.com/ethauvin/semver/tree/0.9.1-beta) (2016-01-25)
|
||||||
|
[Full Changelog](https://github.com/ethauvin/semver/compare/0.9.0-beta...0.9.1-beta)
|
||||||
|
|
||||||
|
## [0.9.0-beta](https://github.com/ethauvin/semver/tree/0.9.0-beta) (2016-01-24)
|
||||||
|
|
||||||
|
|
||||||
|
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
10
build.gradle
10
build.gradle
|
@ -3,9 +3,10 @@ plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'jacoco'
|
id 'jacoco'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
|
id 'pmd'
|
||||||
id 'com.jfrog.bintray' version '1.8.4'
|
id 'com.jfrog.bintray' version '1.8.4'
|
||||||
id 'com.github.ben-manes.versions' version '0.21.0'
|
id 'com.github.ben-manes.versions' version '0.21.0'
|
||||||
id 'net.thauvin.erik.gradle.semver' version '0.9.9-beta'
|
id 'net.thauvin.erik.gradle.semver' version '1.0.0'
|
||||||
id 'com.github.spotbugs' version '1.7.1'
|
id 'com.github.spotbugs' version '1.7.1'
|
||||||
id 'org.sonarqube' version '2.7'
|
id 'org.sonarqube' version '2.7'
|
||||||
}
|
}
|
||||||
|
@ -27,7 +28,7 @@ def mavenScmDevCon = 'git@github.com:ethauvin/semver.git'
|
||||||
|
|
||||||
def pkgLicenses = ['BSD 3-Clause']
|
def pkgLicenses = ['BSD 3-Clause']
|
||||||
def pkgIssueTrackerUrl = mavenUrl + '/issues'
|
def pkgIssueTrackerUrl = mavenUrl + '/issues'
|
||||||
def pkgLabels = ['java', 'annotation', 'processor', 'semantic', 'version']
|
def pkgLabels = ['java', 'kotlin', 'annotation', 'processor', 'semantic', 'version']
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
@ -51,6 +52,11 @@ dependencies {
|
||||||
testImplementation 'org.testng:testng:6.14.3'
|
testImplementation 'org.testng:testng:6.14.3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pmd {
|
||||||
|
ruleSetFiles = files("config/pmd.xml")
|
||||||
|
ruleSets = []
|
||||||
|
}
|
||||||
|
|
||||||
bintray {
|
bintray {
|
||||||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
||||||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||||
|
|
254
config/pmd.xml
Normal file
254
config/pmd.xml
Normal file
|
@ -0,0 +1,254 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="erik"
|
||||||
|
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||||
|
<description>Erik's Ruleset</description>
|
||||||
|
<!-- BEST PRACTICES -->
|
||||||
|
<rule ref="category/java/bestpractices.xml/AvoidStringBufferField"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/CheckResultSet"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/ConstantsInInterface"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/DefaultLabelNotLastInSwitchStmt"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/GuardLogStatement"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/LooseCoupling"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/MethodReturnsInternalArray"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/MissingOverride"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/PositionLiteralsFirstInCaseInsensitiveComparisons"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/PositionLiteralsFirstInComparisons"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/PreserveStackTrace"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/ReplaceEnumerationWithIterator"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/ReplaceHashtableWithMap"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/ReplaceVectorWithList"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/SwitchStmtsShouldHaveDefault"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/SystemPrintln"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedImports"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UseAssertEqualsInsteadOfAssertTrue"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UseAssertNullInsteadOfAssertTrue"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UseAssertSameInsteadOfAssertTrue"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UseAssertTrueInsteadOfAssertEquals"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty"/>
|
||||||
|
<rule ref="category/java/bestpractices.xml/UseVarargs"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- NAMING CONVENTIONS -->
|
||||||
|
<rule ref="category/java/codestyle.xml/FormalParameterNamingConventions"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/GenericsNaming"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/LocalVariableNamingConventions"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/MethodNamingConventions"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/PackageCase"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- OTHER -->
|
||||||
|
<rule ref="category/java/codestyle.xml/AvoidDollarSigns"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/AvoidUsingNativeCode"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/BooleanGetMethodName"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/CallSuperInConstructor"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/ControlStatementBraces"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/DontImportJavaLang"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/DuplicateImports"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/EmptyMethodInAbstractClassShouldBeAbstract"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/ExtendsObject"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/FieldDeclarationsShouldBeAtStartOfClass"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/LocalVariableCouldBeFinal"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/MethodArgumentCouldBeFinal"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/NoPackage"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/TooManyStaticImports"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryAnnotationValueElement"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryConstructor"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryLocalBeforeReturn"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryReturn"/>
|
||||||
|
<rule ref="category/java/codestyle.xml/UselessQualifiedThis"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- DESIGN -->
|
||||||
|
<rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod"/>
|
||||||
|
<rule ref="category/java/design.xml/AvoidRethrowingException"/>
|
||||||
|
<rule ref="category/java/design.xml/AvoidThrowingNewInstanceOfSameException"/>
|
||||||
|
<rule ref="category/java/design.xml/AvoidThrowingNullPointerException"/>
|
||||||
|
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes"/>
|
||||||
|
<rule ref="category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal"/>
|
||||||
|
<rule ref="category/java/design.xml/CollapsibleIfStatements"/>
|
||||||
|
<rule ref="category/java/design.xml/CouplingBetweenObjects"/>
|
||||||
|
<rule ref="category/java/design.xml/DataClass"/>
|
||||||
|
<rule ref="category/java/design.xml/DoNotExtendJavaLangError"/>
|
||||||
|
<rule ref="category/java/design.xml/ExceptionAsFlowControl"/>
|
||||||
|
<rule ref="category/java/design.xml/ExcessivePublicCount"/>
|
||||||
|
<rule ref="category/java/design.xml/FinalFieldCouldBeStatic"/>
|
||||||
|
<rule ref="category/java/design.xml/ImmutableField"/>
|
||||||
|
<rule ref="category/java/design.xml/LogicInversion"/>
|
||||||
|
<rule ref="category/java/design.xml/SignatureDeclareThrowsException"/>
|
||||||
|
<rule ref="category/java/design.xml/SimplifiedTernary"/>
|
||||||
|
<rule ref="category/java/design.xml/SimplifyBooleanAssertion"/>
|
||||||
|
<rule ref="category/java/design.xml/SimplifyBooleanExpressions"/>
|
||||||
|
<rule ref="category/java/design.xml/SimplifyBooleanReturns"/>
|
||||||
|
<rule ref="category/java/design.xml/SimplifyConditional"/>
|
||||||
|
<rule ref="category/java/design.xml/SingularField"/>
|
||||||
|
<rule ref="category/java/design.xml/SwitchDensity"/>
|
||||||
|
<rule ref="category/java/design.xml/UselessOverridingMethod"/>
|
||||||
|
<rule ref="category/java/design.xml/UseUtilityClass"/>
|
||||||
|
|
||||||
|
<!-- DOCUMENTATION -->
|
||||||
|
<rule ref="category/java/documentation.xml/UncommentedEmptyConstructor"/>
|
||||||
|
<rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ERROR PRONE -->
|
||||||
|
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
|
||||||
|
<properties>
|
||||||
|
<property name="allowWhile" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidAssertAsIdentifier"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidCallingFinalize"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidCatchingThrowable"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidEnumAsIdentifier"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidInstanceofChecksInCatchClause"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidLosingExceptionInformation"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/BadComparison"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CallSuperFirst"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CallSuperLast"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CheckSkipResult"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CloneMethodMustBePublic"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CloneMethodMustImplementCloneable"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CloneMethodReturnTypeMustMatchClassName"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CloneThrowsCloneNotSupportedException"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CloseResource"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod"/>>
|
||||||
|
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/DoNotExtendJavaLangThrowable"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/DoNotHardCodeSDCard"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/DoNotThrowExceptionInFinally"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/DontImportSun"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EqualsNull"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/FinalizeDoesNotCallSuperFinalize"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/FinalizeOnlyCallsSuperFinalize"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/FinalizeOverloaded"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/FinalizeShouldBeProtected"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/IdempotentOperations"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/ImportFromSamePackage"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/InstantiationToGetClass"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/InvalidSlf4jMessageFormat"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/JUnitSpelling"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/JUnitStaticSuite"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/LoggerIsNotStaticFinal"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/MethodWithSameNameAsEnclosingClass"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/MissingBreakInSwitch"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/MissingSerialVersionUID"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/MoreThanOneLogger"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/NonStaticInitializer"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/NullAssignment"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/ProperCloneImplementation"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/ProperLogger"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/ReturnEmptyArrayRatherThanNull"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/SimpleDateFormatNeedsLocale"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/SingleMethodSingleton"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/StaticEJBFieldShouldBeFinal"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/StringBufferInstantiationWithChar"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/SuspiciousEqualsMethodName"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/SuspiciousHashcodeMethodName"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/SuspiciousOctalEscape"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/TestClassWithoutTestCases"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UnnecessaryBooleanAssertion"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UseCorrectExceptionLogging"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/UseLocaleWithCaseConversions"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
|
||||||
|
<properties>
|
||||||
|
<property name="allowExceptionNameRegex">
|
||||||
|
<value>^ignore$</value>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyFinalizer"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyIfStmt"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyInitializer"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyStatementBlock"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptySwitchStatements"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyTryBlock"/>
|
||||||
|
<rule ref="category/java/errorprone.xml/EmptyWhileStmt"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- MULTITHREADING -->
|
||||||
|
<rule ref="category/java/multithreading.xml/AvoidSynchronizedAtMethodLevel"/>
|
||||||
|
<rule ref="category/java/multithreading.xml/AvoidThreadGroup"/>
|
||||||
|
<rule ref="category/java/multithreading.xml/AvoidUsingVolatile"/>
|
||||||
|
<rule ref="category/java/multithreading.xml/DontCallThreadRun"/>
|
||||||
|
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking"/>
|
||||||
|
<rule ref="category/java/multithreading.xml/NonThreadSafeSingleton"/>
|
||||||
|
<rule ref="category/java/multithreading.xml/UseConcurrentHashMap"/>
|
||||||
|
<rule ref="category/java/multithreading.xml/UseNotifyAllInsteadOfNotify"/>
|
||||||
|
|
||||||
|
<!-- PERFORMANCE -->
|
||||||
|
<rule ref="category/java/performance.xml/AddEmptyString"/>
|
||||||
|
<rule ref="category/java/performance.xml/AppendCharacterWithChar"/>
|
||||||
|
<rule ref="category/java/performance.xml/AvoidArrayLoops"/>
|
||||||
|
<rule ref="category/java/performance.xml/AvoidFileStream"/>
|
||||||
|
<rule ref="category/java/performance.xml/AvoidInstantiatingObjectsInLoops"/>
|
||||||
|
<rule ref="category/java/performance.xml/AvoidUsingShortType"/>
|
||||||
|
<rule ref="category/java/performance.xml/BigIntegerInstantiation"/>
|
||||||
|
<rule ref="category/java/performance.xml/BooleanInstantiation"/>
|
||||||
|
<rule ref="category/java/performance.xml/ByteInstantiation"/>
|
||||||
|
<rule ref="category/java/performance.xml/ConsecutiveAppendsShouldReuse"/>
|
||||||
|
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends"/>
|
||||||
|
<rule ref="category/java/performance.xml/InefficientEmptyStringCheck"/>
|
||||||
|
<rule ref="category/java/performance.xml/InefficientStringBuffering"/>
|
||||||
|
<rule ref="category/java/performance.xml/InsufficientStringBufferDeclaration"/>
|
||||||
|
<rule ref="category/java/performance.xml/IntegerInstantiation"/>
|
||||||
|
<rule ref="category/java/performance.xml/LongInstantiation"/>
|
||||||
|
<rule ref="category/java/performance.xml/OptimizableToArrayCall"/>
|
||||||
|
<rule ref="category/java/performance.xml/RedundantFieldInitializer"/>
|
||||||
|
<rule ref="category/java/performance.xml/SimplifyStartsWith"/>
|
||||||
|
<rule ref="category/java/performance.xml/ShortInstantiation"/>
|
||||||
|
<rule ref="category/java/performance.xml/StringInstantiation"/>
|
||||||
|
<rule ref="category/java/performance.xml/StringToString"/>
|
||||||
|
<rule ref="category/java/performance.xml/TooFewBranchesForASwitchStatement"/>
|
||||||
|
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation"/>
|
||||||
|
<rule ref="category/java/performance.xml/UseArrayListInsteadOfVector"/>
|
||||||
|
<rule ref="category/java/performance.xml/UseArraysAsList"/>
|
||||||
|
<rule ref="category/java/performance.xml/UseIndexOfChar"/>
|
||||||
|
<rule ref="category/java/performance.xml/UselessStringValueOf"/>
|
||||||
|
<rule ref="category/java/performance.xml/UseStringBufferForStringAppends"/>
|
||||||
|
<rule ref="category/java/performance.xml/UseStringBufferLength"/>
|
||||||
|
|
||||||
|
<!-- SECURITY -->
|
||||||
|
<rule ref="category/java/security.xml/HardCodedCryptoKey"/>
|
||||||
|
<rule ref="category/java/security.xml/InsecureCryptoIv"/>
|
||||||
|
</ruleset>
|
|
@ -4,7 +4,8 @@ plugins {
|
||||||
id 'com.github.ben-manes.versions' version '0.21.0'
|
id 'com.github.ben-manes.versions' version '0.21.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew run
|
||||||
|
// ./gradlew runExample
|
||||||
|
|
||||||
defaultTasks 'run'
|
defaultTasks 'run'
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ targetCompatibility = 1.8
|
||||||
|
|
||||||
compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
||||||
|
|
||||||
mainClassName = 'com.example.Example'
|
mainClassName = 'com.example.App'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
@ -26,3 +27,10 @@ dependencies {
|
||||||
annotationProcessor semverProcessor
|
annotationProcessor semverProcessor
|
||||||
compileOnly semverProcessor
|
compileOnly semverProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task runExample(type: JavaExec) {
|
||||||
|
group = 'application'
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
|
||||||
|
main = 'com.example.Example'
|
||||||
|
}
|
||||||
|
|
|
@ -10,11 +10,6 @@ import java.util.Date;
|
||||||
public final class {{className}} {
|
public final class {{className}} {
|
||||||
public static final String PROJECT = "{{project}}";
|
public static final String PROJECT = "{{project}}";
|
||||||
public static final Date BUILDDATE = new Date({{epoch}}L);
|
public static final Date BUILDDATE = new Date({{epoch}}L);
|
||||||
public static final int MAJOR = {{major}};
|
|
||||||
public static final int MINOR = {{minor}};
|
|
||||||
public static final int PATCH = {{patch}};
|
|
||||||
public static final String PRERELEASE = "{{preRelease}}";
|
|
||||||
public static final String BUILDMETA = "{{buildMeta}}";
|
|
||||||
public static final String VERSION = "{{version}}";
|
public static final String VERSION = "{{version}}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
9
examples/java/example.properties
Normal file
9
examples/java/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
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -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(1556420335650L);
|
||||||
|
public static final String VERSION = "8.4.97-alpha+T800";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables the default constructor.
|
||||||
|
*/
|
||||||
|
private ExampleVersion() {
|
||||||
|
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,15 +6,23 @@ package com.example;
|
||||||
|
|
||||||
import java.util.Date;
|
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 final class GeneratedVersion {
|
||||||
public final static String PROJECT = "Java Example";
|
public final static String PROJECT = "Java App";
|
||||||
public final static Date BUILDDATE = new Date(1555703771370L);
|
public final static Date BUILDDATE = new Date(1556420335600L);
|
||||||
public final static int MAJOR = 2;
|
public final static int MAJOR = 11;
|
||||||
public final static int MINOR = 0;
|
public final static int MINOR = 11;
|
||||||
public final static int PATCH = 52;
|
public final static int PATCH = 20;
|
||||||
public final static String PRERELEASE = "beta";
|
public final static String PRERELEASE = "beta";
|
||||||
|
public final static String PRERELEASE_PREFIX = "-";
|
||||||
public final static String BUILDMETA = "007";
|
public final static String BUILDMETA = "007";
|
||||||
public final static String VERSION = "2.0.52-beta+007";
|
public final static String BUILDMETA_PREFIX = "+";
|
||||||
|
public final static String SEPARATOR = ".";
|
||||||
|
public final static String VERSION = "11.11.20-beta+007";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the default constructor.
|
* Disables the default constructor.
|
||||||
|
|
31
examples/java/src/main/java/com/example/App.java
Normal file
31
examples/java/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("-----------------------------------------------------");
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,24 +3,25 @@ package com.example;
|
||||||
import net.thauvin.erik.semver.Version;
|
import net.thauvin.erik.semver.Version;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
//@Version(properties = "version.properties", template = "example.mustache")
|
@Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion",
|
||||||
@Version(properties = "version.properties")
|
keysPrefix = "example.")
|
||||||
public class Example {
|
public final class Example {
|
||||||
|
/**
|
||||||
|
* Command line interface.
|
||||||
|
*
|
||||||
|
* @param args The command line parameters.
|
||||||
|
*/
|
||||||
public static void main(final String... args) {
|
public static void main(final String... args) {
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z");
|
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||||
|
|
||||||
System.out.println("-----------------------------------------------------");
|
System.out.println("-- From Example -------------------------------------");
|
||||||
|
|
||||||
System.out.println(" Version: " + GeneratedVersion.PROJECT + ' ' + GeneratedVersion.VERSION);
|
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
|
||||||
|
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
|
||||||
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("-----------------------------------------------------");
|
System.out.println("-----------------------------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Sat Mar 30 15:48:08 PDT 2019
|
#Sat Apr 27 17:05:34 PDT 2019
|
||||||
version.buildmeta=007
|
version.buildmeta=007
|
||||||
version.major=2
|
version.major=11
|
||||||
version.minor=0
|
version.minor=11
|
||||||
version.patch=52
|
version.patch=20
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
version.project=Java Example
|
version.project=Java App
|
||||||
|
version.semver=11.11.20-beta+007
|
||||||
|
|
|
@ -6,8 +6,10 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ./gradlew
|
// ./gradlew
|
||||||
|
// ./gradlew run
|
||||||
// ./gradlew runJava
|
// ./gradlew runJava
|
||||||
// ./gradlew run runJava
|
// ./gradlew runExample
|
||||||
|
// ./gradlew runJavaExample
|
||||||
|
|
||||||
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
|
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
|
||||||
|
|
||||||
|
@ -32,11 +34,25 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClassName = "com.example.Main"
|
mainClassName = "com.example.App"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
register("runJava", JavaExec::class) {
|
register("runJava", JavaExec::class) {
|
||||||
|
group = "application"
|
||||||
|
main = "com.example.JavaApp"
|
||||||
|
classpath = sourceSets["main"].runtimeClasspath
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
register("runJavaExample", JavaExec::class) {
|
||||||
|
group = "application"
|
||||||
|
main = "com.example.JavaExample"
|
||||||
|
classpath = sourceSets["main"].runtimeClasspath
|
||||||
|
}
|
||||||
|
|
||||||
|
register("runExample", JavaExec::class) {
|
||||||
|
group = "application"
|
||||||
main = "com.example.Example"
|
main = "com.example.Example"
|
||||||
classpath = sourceSets["main"].runtimeClasspath
|
classpath = sourceSets["main"].runtimeClasspath
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,5 @@ object {{className}} {
|
||||||
@JvmField
|
@JvmField
|
||||||
val BUILDDATE = Date({{epoch}}L)
|
val BUILDDATE = Date({{epoch}}L)
|
||||||
@JvmField
|
@JvmField
|
||||||
val MAJOR = {{major}}
|
|
||||||
@JvmField
|
|
||||||
val MINOR = {{minor}}
|
|
||||||
@JvmField
|
|
||||||
val PATCH = {{patch}}
|
|
||||||
@JvmField
|
|
||||||
val PRERELEASE = "{{preRelease}}"
|
|
||||||
@JvmField
|
|
||||||
val BUILDMETA = "{{buildMeta}}"
|
|
||||||
@JvmField
|
|
||||||
val VERSION = "{{version}}"
|
val VERSION = "{{version}}"
|
||||||
}
|
}
|
||||||
|
|
9
examples/kotlin/example.properties
Normal file
9
examples/kotlin/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=Kotlin Example
|
||||||
|
example.semver=8.4.97-alpha+T800
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
package com.example;
|
package com.example;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Example {
|
public final class JavaApp {
|
||||||
|
/**
|
||||||
|
* Command line interface.
|
||||||
|
*
|
||||||
|
* @param args The command line parameters.
|
||||||
|
*/
|
||||||
public static void main(final String... args) {
|
public static void main(final String... args) {
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z");
|
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z", Locale.US);
|
||||||
|
|
||||||
System.out.println("-- From Java ----------------------------------------");
|
System.out.println("-- From Java ----------------------------------------");
|
||||||
|
|
22
examples/kotlin/src/main/java/com/example/JavaExample.java
Normal file
22
examples/kotlin/src/main/java/com/example/JavaExample.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package com.example;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public final class JavaExample {
|
||||||
|
/**
|
||||||
|
* 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 JavaExample -----------------------------------");
|
||||||
|
|
||||||
|
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
|
||||||
|
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
|
||||||
|
|
||||||
|
System.out.println("-------------------------------------------------------");
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,14 +2,14 @@ package com.example
|
||||||
|
|
||||||
import net.thauvin.erik.semver.Version
|
import net.thauvin.erik.semver.Version
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
//@Version(properties = "version.properties", type = "kt", template = "example.mustache")
|
|
||||||
@Version(properties = "version.properties", type = "kt")
|
@Version(properties = "version.properties", type = "kt")
|
||||||
class Main {
|
class App {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
val sdf = SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z")
|
val sdf = SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z", Locale.US)
|
||||||
|
|
||||||
println("-----------------------------------------------------")
|
println("-----------------------------------------------------")
|
||||||
|
|
23
examples/kotlin/src/main/kotlin/com/example/Example.kt
Normal file
23
examples/kotlin/src/main/kotlin/com/example/Example.kt
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package com.example
|
||||||
|
|
||||||
|
import net.thauvin.erik.semver.Version
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
@Version(properties = "example.properties", type = "kt", template = "example.mustache", className = "ExampleVersion",
|
||||||
|
keysPrefix = "example.")
|
||||||
|
class Example {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US)
|
||||||
|
|
||||||
|
println("-------------------------------------------------------")
|
||||||
|
|
||||||
|
println(" ${ExampleVersion.PROJECT} ${ExampleVersion.VERSION} ("
|
||||||
|
+ sdf.format(ExampleVersion.BUILDDATE) + ')')
|
||||||
|
|
||||||
|
println("-------------------------------------------------------")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Fri Nov 02 18:26:53 PDT 2018
|
#Sat Apr 27 17:04:13 PDT 2019
|
||||||
version.buildmeta=007
|
version.buildmeta=007
|
||||||
version.major=3
|
version.major=11
|
||||||
version.minor=17
|
version.minor=11
|
||||||
version.patch=52
|
version.patch=20
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
version.project=Kotlin Example
|
version.project=Kotlin App
|
||||||
|
version.semver=11.11.20-beta+007
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -8,8 +8,8 @@ ext=".java"
|
||||||
java8=true
|
java8=true
|
||||||
# e.g: <example directory> <gradle args...>
|
# e.g: <example directory> <gradle args...>
|
||||||
declare -a examples=(
|
declare -a examples=(
|
||||||
"examples/java run"
|
"examples/java run runExample"
|
||||||
"examples/kotlin run runJava")
|
"examples/kotlin run runJava runExample runJavaExample")
|
||||||
# e.g: empty or javadoc, etc.
|
# e.g: empty or javadoc, etc.
|
||||||
gradle_doc="javadoc pandoc"
|
gradle_doc="javadoc pandoc"
|
||||||
# e.g. empty or sonarqube
|
# e.g. empty or sonarqube
|
||||||
|
|
|
@ -39,6 +39,7 @@ package net.thauvin.erik.semver;
|
||||||
* @created 2016-01-16
|
* @created 2016-01-16
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("PMD.DataClass")
|
||||||
public class VersionInfo {
|
public class VersionInfo {
|
||||||
private final long epoch = System.currentTimeMillis();
|
private final long epoch = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ import java.util.Set;
|
||||||
* @created 2016-01-13
|
* @created 2016-01-13
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("PMD.GuardLogStatement")
|
||||||
@SupportedOptions({Constants.KAPT_KOTLIN_GENERATED_OPTION_NAME, Constants.SEMVER_PROJECT_DIR_ARG})
|
@SupportedOptions({Constants.KAPT_KOTLIN_GENERATED_OPTION_NAME, Constants.SEMVER_PROJECT_DIR_ARG})
|
||||||
public class VersionProcessor extends AbstractProcessor {
|
public class VersionProcessor extends AbstractProcessor {
|
||||||
private Filer filer;
|
private Filer filer;
|
||||||
|
@ -84,7 +85,7 @@ public class VersionProcessor extends AbstractProcessor {
|
||||||
log(Diagnostic.Kind.ERROR, (t != null ? t.toString() : s));
|
log(Diagnostic.Kind.ERROR, (t != null ? t.toString() : s));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressFBWarnings(value = {"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
|
@SuppressFBWarnings({"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
|
||||||
private VersionInfo findValues(final Version version)
|
private VersionInfo findValues(final Version version)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final VersionInfo versionInfo = new VersionInfo(version);
|
final VersionInfo versionInfo = new VersionInfo(version);
|
||||||
|
@ -137,7 +138,7 @@ public class VersionProcessor extends AbstractProcessor {
|
||||||
return versionInfo;
|
return versionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getProjectDir(String fileName) {
|
private String getProjectDir(final String fileName) {
|
||||||
if (processingEnv != null) { // null when testing.
|
if (processingEnv != null) { // null when testing.
|
||||||
final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG);
|
final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG);
|
||||||
if (prop != null) {
|
if (prop != null) {
|
||||||
|
@ -169,6 +170,7 @@ public class VersionProcessor extends AbstractProcessor {
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
|
||||||
@Override
|
@Override
|
||||||
public synchronized void init(final ProcessingEnvironment processingEnv) {
|
public synchronized void init(final ProcessingEnvironment processingEnv) {
|
||||||
super.init(processingEnv);
|
super.init(processingEnv);
|
||||||
|
@ -201,6 +203,7 @@ public class VersionProcessor extends AbstractProcessor {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
|
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
|
||||||
|
final boolean isLocalTemplate = new File(Constants.DEFAULT_TEMPLATE_NAME).exists();
|
||||||
for (final Element element : roundEnv.getElementsAnnotatedWith(Version.class)) {
|
for (final Element element : roundEnv.getElementsAnnotatedWith(Version.class)) {
|
||||||
final Version version = element.getAnnotation(Version.class);
|
final Version version = element.getAnnotation(Version.class);
|
||||||
if (element.getKind() == ElementKind.CLASS) {
|
if (element.getKind() == ElementKind.CLASS) {
|
||||||
|
@ -215,7 +218,7 @@ public class VersionProcessor extends AbstractProcessor {
|
||||||
note("Found version: " + versionInfo.getVersion());
|
note("Found version: " + versionInfo.getVersion());
|
||||||
final String template;
|
final String template;
|
||||||
if (Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template())
|
if (Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template())
|
||||||
&& new File(Constants.DEFAULT_TEMPLATE_NAME).exists()) {
|
&& isLocalTemplate) {
|
||||||
template = Constants.DEFAULT_TEMPLATE_NAME;
|
template = Constants.DEFAULT_TEMPLATE_NAME;
|
||||||
} else if (Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template())
|
} else if (Constants.DEFAULT_JAVA_TEMPLATE.equals(version.template())
|
||||||
&& Constants.KOTLIN_TYPE.equals(version.type())) {
|
&& Constants.KOTLIN_TYPE.equals(version.type())) {
|
||||||
|
@ -238,7 +241,7 @@ public class VersionProcessor extends AbstractProcessor {
|
||||||
log(Diagnostic.Kind.WARNING, s);
|
log(Diagnostic.Kind.WARNING, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressFBWarnings(value = {"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
|
@SuppressFBWarnings({"PATH_TRAVERSAL_IN", "UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"})
|
||||||
private void writeTemplate(final String type,
|
private void writeTemplate(final String type,
|
||||||
final VersionInfo versionInfo,
|
final VersionInfo versionInfo,
|
||||||
final String template)
|
final String template)
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class VersionInfoTest {
|
||||||
private final Calendar now = Calendar.getInstance();
|
private final Calendar now = Calendar.getInstance();
|
||||||
private VersionInfo versionInfo = new VersionInfo();
|
private VersionInfo versionInfo = new VersionInfo();
|
||||||
|
|
||||||
|
@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
|
||||||
@Test
|
@Test
|
||||||
public void testGetVersion() {
|
public void testGetVersion() {
|
||||||
Assert.assertEquals(versionInfo.getVersion(), "1.0.0", "getVersion(1.0.0)");
|
Assert.assertEquals(versionInfo.getVersion(), "1.0.0", "getVersion(1.0.0)");
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#Generated by the Semver Plugin for Gradle
|
#Generated by the Semver Plugin for Gradle
|
||||||
#Sat Mar 30 18:10:32 PDT 2019
|
#Fri Apr 26 18:43:34 PDT 2019
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
version.major=1
|
version.major=1
|
||||||
version.minor=2
|
version.minor=2
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=
|
version.prerelease=
|
||||||
|
version.semver=1.2.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue