diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index cf75013..ca84ff0 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -6,6 +6,7 @@ + @@ -14,4 +15,4 @@ - \ No newline at end of file + diff --git a/README.md b/README.md index 8abcf73..70843fa 100755 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ public void updateMajor() throws Exception { .execute(); } ``` + Invoking the `updateMajor` command, will create the `version.propertees`file: ```sh diff --git a/examples/.idea/misc.xml b/examples/.idea/misc.xml index 7010ea3..0e7a921 100644 --- a/examples/.idea/misc.xml +++ b/examples/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/examples/.vscode/launch.json b/examples/.vscode/launch.json index c868458..6a94475 100644 --- a/examples/.vscode/launch.json +++ b/examples/.vscode/launch.json @@ -1,6 +1,13 @@ { "version": "0.2.0", "configurations": [ + { + "type": "java", + "name": "PropertyFileExampleBuild", + "request": "launch", + "mainClass": "com.example.PropertyFileExampleBuild", + "projectName": "examples_dbdc9d4b" + }, { "type": "java", "name": "Run Main", @@ -18,7 +25,8 @@ "--disable-banner", "--disable-ansi-colors", "--exclude-engine=junit-platform-suite", - "--exclude-engine=junit-vintage"] + "--exclude-engine=junit-vintage" + ] } ] } diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..ede07c3 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,5 @@ +# Compile and Run Example + +```console +./bld compile run +``` diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index c57b897..f16131d 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,5 +1,5 @@ #Sun Apr 02 10:32:44 PDT 2023 -bld.extension=com.uwyn.rife2:bld-property-file:0.9.3 +bld.extension=com.uwyn.rife2:bld-property-file:0.9.4-SNAPSHOT bld.repositories=MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.downloadExtensionSources=true bld.downloadLocation= diff --git a/examples/src/bld/java/com/example/PropertyFileExampleBuild.java b/examples/src/bld/java/com/example/PropertyFileExampleBuild.java index b15c244..a1a14a7 100644 --- a/examples/src/bld/java/com/example/PropertyFileExampleBuild.java +++ b/examples/src/bld/java/com/example/PropertyFileExampleBuild.java @@ -40,8 +40,8 @@ public class PropertyFileExampleBuild extends Project { repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); scope(test) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0))); + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1))); } public static void main(String[] args) { diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 46c4a1d..5617ae3 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -1,6 +1,6 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true -bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.3 +bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.4 bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.downloadLocation= diff --git a/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java b/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java index 6ba1c5b..5b75edb 100644 --- a/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java +++ b/src/bld/java/rife/bld/extension/propertyfile/PropertyFileBuild.java @@ -37,7 +37,7 @@ public class PropertyFileBuild extends Project { public PropertyFileBuild() { pkg = "rife.bld.extension"; name = "bld-property-file"; - version = version(0, 9, 3); + version = version(0, 9, 4, "SNAPSHOT"); javaRelease = 17; downloadSources = true; @@ -48,12 +48,13 @@ public class PropertyFileBuild extends Project { .include(dependency("com.uwyn.rife2", "bld", version(1, 7, 5))); scope(test) .include(dependency("org.jsoup", "jsoup", version(1, 16, 2))) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0))) + .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1))) + .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1))) .include(dependency("org.assertj:assertj-joda-time:2.2.0")); javadocOperation() .javadocOptions() + .author() .docLint(NO_MISSING) .link("https://rife2.github.io/bld/") .link("https://rife2.github.io/rife2/"); @@ -65,15 +66,28 @@ public class PropertyFileBuild extends Project { .artifactId("bld-property-file") .description("bld Extension to Create or Modify Properties Files") .url("https://github.com/rife2/bld-property-file") - .developer(new PublishDeveloper().id("ethauvin").name("Erik C. Thauvin").email("erik@thauvin.net") - .url("https://erik.thauvin.net/")) - .developer(new PublishDeveloper().id("gbevin").name("Geert Bevin").email("gbevin@uwyn.com") - .url("https://github.com/gbevin")) - .license(new PublishLicense().name("The Apache License, Version 2.0") - .url("http://www.apache.org/licenses/LICENSE-2.0.txt")) - .scm(new PublishScm().connection("scm:git:https://github.com/rife2/bld-property-file.git") - .developerConnection("scm:git:git@github.com:rife2/bld-property-file.git") - .url("https://github.com/rife2/bld-property-file")) + .developer( + new PublishDeveloper().id("ethauvin") + .name("Erik C. Thauvin") + .email("erik@thauvin.net") + .url("https://erik.thauvin.net/") + ) + .developer( + new PublishDeveloper() + .id("gbevin") + .name("Geert Bevin") + .email("gbevin@uwyn.com") + .url("https://github.com/gbevin") + ) + .license( + new PublishLicense() + .name("The Apache License, Version 2.0") + .url("http://www.apache.org/licenses/LICENSE-2.0.txt") + ) + .scm( + new PublishScm().connection("scm:git:https://github.com/rife2/bld-property-file.git") + .developerConnection("scm:git:git@github.com:rife2/bld-property-file.git") + .url("https://github.com/rife2/bld-property-file")) .signKey(property("sign.key")) .signPassphrase(property("sign.passphrase")); } diff --git a/src/main/java/rife/bld/extension/propertyfile/Calc.java b/src/main/java/rife/bld/extension/propertyfile/Calc.java index 5707408..66bff61 100644 --- a/src/main/java/rife/bld/extension/propertyfile/Calc.java +++ b/src/main/java/rife/bld/extension/propertyfile/Calc.java @@ -26,7 +26,13 @@ import java.util.function.IntFunction; * @since 1.0 */ public final class Calc { + /** + * The add function. + */ public static final IntFunction ADD = Calc::add; + /** + * The sub function. + */ public static final IntFunction SUB = Calc::sub; @@ -38,6 +44,7 @@ public final class Calc { * Adds {@code 1} to the value. * * @param v the value + * @return the new value */ public static Integer add(int v) { return v + 1; @@ -47,6 +54,7 @@ public final class Calc { * Subtracts {@code 1} to the value. * * @param v the value + * @return the new value */ public static Integer sub(int v) { return v - 1; diff --git a/src/main/java/rife/bld/extension/propertyfile/Entry.java b/src/main/java/rife/bld/extension/propertyfile/Entry.java index dc1c1db..e737c82 100644 --- a/src/main/java/rife/bld/extension/propertyfile/Entry.java +++ b/src/main/java/rife/bld/extension/propertyfile/Entry.java @@ -26,6 +26,11 @@ import java.util.function.BiFunction; * @since 1.0 */ public class Entry extends EntryBase { + /** + * Instantiates a new Entry. + * + * @param key the key + */ public Entry(String key) { super(key); } @@ -34,6 +39,7 @@ public class Entry extends EntryBase { *

Sets the initial value to set the {@link java.util.Properties property} to, if not already defined.

* * @param defaultValue the default value + * @return the entry */ @SuppressWarnings("unused") public Entry defaultValue(Object defaultValue) { @@ -43,6 +49,8 @@ public class Entry extends EntryBase { /** * Sets the {@link Entry entry} up for deletion. + * + * @return the entry */ public Entry delete() { setDelete(true); @@ -53,6 +61,7 @@ public class Entry extends EntryBase { * Creates a new {@link Entry entry}. * * @param modify the modification function + * @return the entry */ public Entry modify(BiFunction modify) { setModify(modify); @@ -64,6 +73,7 @@ public class Entry extends EntryBase { * * @param value the value to perform a modification with * @param modify the modification function + * @return the entry */ public Entry modify(String value, BiFunction modify) { setModifyValue(value); @@ -75,6 +85,7 @@ public class Entry extends EntryBase { * Sets the new {@link java.util.Properties property} value. * * @param s The new value + * @return the entry */ public Entry set(Object s) { setNewValue(s); diff --git a/src/main/java/rife/bld/extension/propertyfile/EntryBase.java b/src/main/java/rife/bld/extension/propertyfile/EntryBase.java index ad2c5d9..89b1ea0 100644 --- a/src/main/java/rife/bld/extension/propertyfile/EntryBase.java +++ b/src/main/java/rife/bld/extension/propertyfile/EntryBase.java @@ -49,6 +49,8 @@ public class EntryBase { /** * Returns the calculation function. + * + * @return the calc function */ protected IntFunction getCalc() { return calc; @@ -56,6 +58,8 @@ public class EntryBase { /** * Returns the default value. + * + * @return the default value */ protected Object getDefaultValue() { return defaultValue; @@ -63,6 +67,8 @@ public class EntryBase { /** * Returns the key of the {@link java.util.Properties property}. + * + * @return the key */ protected String getKey() { return key; @@ -70,6 +76,8 @@ public class EntryBase { /** * Returns the modify function. + * + * @return the modify function */ protected BiFunction getModify() { return modify; @@ -77,6 +85,8 @@ public class EntryBase { /** * Returns the value to be used in the {@link #modify} function. + * + * @return the modify value */ protected String getModifyValue() { return modifyValue; @@ -84,6 +94,8 @@ public class EntryBase { /** * Returns the new value to set the {@link java.util.Properties property)} to. + * + * @return the new value */ public Object getNewValue() { return newValue; @@ -91,6 +103,8 @@ public class EntryBase { /** * Returns the pattern. + * + * @return the pattern */ protected String getPattern() { return pattern; @@ -98,6 +112,8 @@ public class EntryBase { /** * Returns the {@link EntryDate.Units unit}. + * + * @return the unit */ protected EntryDate.Units getUnit() { return unit; @@ -105,6 +121,8 @@ public class EntryBase { /** * Returns {@code true} if the {@link java.util.Properties property} is to be deleted. + * + * @return {@code true} or {@code false} */ protected boolean isDelete() { return isDelete; @@ -114,6 +132,7 @@ public class EntryBase { * Sets the key of the {@link java.util.Properties property}. * * @param key the {@link java.util.Properties property} key + * @return this instance */ @SuppressWarnings("unused") public EntryBase key(String key) { @@ -123,6 +142,8 @@ public class EntryBase { /** * Sets the calculation function. + * + * @param calc the calc function */ protected void setCalc(IntFunction calc) { this.calc = calc; @@ -139,6 +160,8 @@ public class EntryBase { /** * Sets whether the {@link java.util.Properties property} should be deleted. + * + * @param delete {@code true} or {@code false} */ protected void setDelete(boolean delete) { isDelete = delete; @@ -155,6 +178,8 @@ public class EntryBase { /** * Sets the modify function. + * + * @param modify the modify function */ protected void setModify(BiFunction modify) { this.modify = modify; @@ -163,7 +188,8 @@ public class EntryBase { /** * Sets the modify function. * - * @param value the value to perform a modification with + * @param value the value to perform a modification with + * @param modify the modify function */ protected void setModify(String value, BiFunction modify) { this.modifyValue = value; diff --git a/src/main/java/rife/bld/extension/propertyfile/EntryDate.java b/src/main/java/rife/bld/extension/propertyfile/EntryDate.java index 7a0beeb..d1d3dc4 100644 --- a/src/main/java/rife/bld/extension/propertyfile/EntryDate.java +++ b/src/main/java/rife/bld/extension/propertyfile/EntryDate.java @@ -41,6 +41,7 @@ public class EntryDate extends EntryBase { * Creates a new {@link EntryDate entry}. * * @param calc the calculation function + * @return this instance */ public EntryDate calc(IntFunction calc) { setCalc(calc); @@ -49,6 +50,8 @@ public class EntryDate extends EntryBase { /** * Sets the {@link EntryDate entry} up for deletion. + * + * @return this instance */ public EntryDate delete() { setDelete(true); @@ -57,6 +60,8 @@ public class EntryDate extends EntryBase { /** * Sets the new {@link java.util.Properties property} value to now. + * + * @return this instance */ public EntryDate now() { setNewValue("now"); @@ -68,6 +73,7 @@ public class EntryDate extends EntryBase { * {@link java.time.format.DateTimeFormatter DateTimeFormatter} respectively. * * @param pattern the pattern + * @return this instance */ public EntryDate pattern(String pattern) { setPattern(pattern); @@ -78,6 +84,7 @@ public class EntryDate extends EntryBase { * Sets the new {@link java.util.Properties property} value to an {@link Instant} * * @param instant the {@link Instant} to set the value to + * @return this instance */ public EntryDate set(Instant instant) { setNewValue(instant); @@ -88,6 +95,7 @@ public class EntryDate extends EntryBase { * Sets the new {@link java.util.Properties property} value to a {@link LocalDate} * * @param date the {@link LocalDate} to set the value to + * @return this instance */ public EntryDate set(LocalDate date) { setNewValue(date); @@ -98,6 +106,7 @@ public class EntryDate extends EntryBase { * Sets the new {@link java.util.Properties property} value to a {@link LocalDateTime} * * @param date the {@link LocalDateTime} to set the value to + * @return this instance */ public EntryDate set(LocalDateTime date) { setNewValue(date); @@ -108,6 +117,7 @@ public class EntryDate extends EntryBase { * Sets the new {@link java.util.Properties property} value to a {@link ZonedDateTime} * * @param date the {@link ZonedDateTime} to set the value to + * @return this instance */ public EntryDate set(ZonedDateTime date) { setNewValue(date); @@ -118,6 +128,7 @@ public class EntryDate extends EntryBase { * Sets the new {@link java.util.Properties property} value to a {@link LocalTime} * * @param time the {@link LocalTime} to set the value to + * @return this instance */ public EntryDate set(LocalTime time) { setNewValue(time); @@ -128,6 +139,7 @@ public class EntryDate extends EntryBase { * Sets the new {@link java.util.Properties property} value to a {@link Calendar} * * @param cal the {@link Calendar} to set the value to + * @return this instance */ public EntryDate set(Calendar cal) { setNewValue(cal); @@ -138,6 +150,7 @@ public class EntryDate extends EntryBase { * Sets the new {@link java.util.Properties property} value to a {@link Date} * * @param date the {@link Date} to set the value to + * @return this instance */ public EntryDate set(Date date) { setNewValue(date); @@ -148,6 +161,7 @@ public class EntryDate extends EntryBase { * Sets the {@link Units unit} value to apply to calculations for {@link EntryDate}. * * @param unit the {@link Units unit} + * @return this instance */ public EntryDate unit(Units unit) { setUnit(unit); @@ -168,6 +182,33 @@ public class EntryDate extends EntryBase { * */ public enum Units { - SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, YEAR + /** + * Second units. + */ + SECOND, + /** + * Minute units. + */ + MINUTE, + /** + * Hour units. + */ + HOUR, + /** + * Day units. + */ + DAY, + /** + * Week units. + */ + WEEK, + /** + * Month units. + */ + MONTH, + /** + * Year units. + */ + YEAR } } diff --git a/src/main/java/rife/bld/extension/propertyfile/EntryInt.java b/src/main/java/rife/bld/extension/propertyfile/EntryInt.java index 88d7dfa..db0b81d 100644 --- a/src/main/java/rife/bld/extension/propertyfile/EntryInt.java +++ b/src/main/java/rife/bld/extension/propertyfile/EntryInt.java @@ -38,6 +38,7 @@ public class EntryInt extends EntryBase { * Creates a new {@link EntryInt entry}. * * @param calc the calculation function. + * @return this instance */ public EntryInt calc(IntFunction calc) { setCalc(calc); @@ -48,6 +49,7 @@ public class EntryInt extends EntryBase { * Sets the initial value to set the {@link java.util.Properties property} to, if not already defined. * * @param defaultValue the default value + * @return this instance */ @SuppressWarnings("unused") public EntryInt defaultValue(Object defaultValue) { @@ -57,6 +59,8 @@ public class EntryInt extends EntryBase { /** * Sets the {@link EntryInt entry} up for deletion. + * + * @return this instance */ public EntryInt delete() { setDelete(true); @@ -67,6 +71,7 @@ public class EntryInt extends EntryBase { * Sets the new {@link java.util.Properties property} value to an integer. * * @param i The integer to set the value to + * @return this instance */ public EntryInt set(int i) { setNewValue(i); diff --git a/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java b/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java index 725e22f..5f330a0 100644 --- a/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java +++ b/src/main/java/rife/bld/extension/propertyfile/PropertyFileOperation.java @@ -41,6 +41,7 @@ public class PropertyFileOperation extends AbstractOperation