diff --git a/examples/.idea/libraries/bld.xml b/examples/.idea/libraries/bld.xml index 657c6e2..a0a25eb 100644 --- a/examples/.idea/libraries/bld.xml +++ b/examples/.idea/libraries/bld.xml @@ -2,15 +2,15 @@ - + + - + + - - - + diff --git a/examples/.idea/misc.xml b/examples/.idea/misc.xml index 542659b..4af0048 100644 --- a/examples/.idea/misc.xml +++ b/examples/.idea/misc.xml @@ -1,5 +1,11 @@ + + + + + + diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json index 44ad385..bce4c6c 100644 --- a/examples/.vscode/settings.json +++ b/examples/.vscode/settings.json @@ -7,7 +7,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.rife2/dist/rife2-1.5.11.jar", + "${HOME}/.rife2/dist/rife2-1.5.14.jar", "lib/compile/*.jar", "lib/runtime/*.jar", "lib/test/*.jar" diff --git a/examples/README.md b/examples/README.md index cf9d2eb..96a664a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -16,11 +16,10 @@ To run the examples, issue one of the following command or combination there off ./bld updateMinor run ./bld updatePatch run ``` -Upon execution, the content of the `verison.properties` file will be displayed, reflecting the modification to the -`version.major`, `version.minor` or `version.patch` properties. +Upon execution, the `version.properties` file will be created and displayed: ```shell -./bld updatePatch run +./bld updateMajor run ``` ```shell @@ -28,8 +27,28 @@ Upon execution, the content of the `verison.properties` file will be displayed, | version.properties | +---------------------------+ # -#Sun Apr 02 17:19:10 PDT 2023 +#Sun Apr 02 23:51:39 PDT 2023 +build.date=2023-04-02 version.major=1 version.minor=0 -version.patch=1 +version.patch=0 +``` + +Subsequent commands will reflect the modifications to the +`version.major`, `version.minor` or `version.patch` properties: + +```shell +./bld upatePatch run +``` + +```shell ++---------------------------+ +| version.properties | ++---------------------------+ +# +#Sun Apr 02 23:55:09 PDT 2023 +build.date=2023-04-02 +version.major=1 +version.minor=0 +version.patch=10 ``` diff --git a/examples/lib/bld/bld-wrapper.jar b/examples/lib/bld/bld-wrapper.jar index 050a6bd..b372bbc 100644 Binary files a/examples/lib/bld/bld-wrapper.jar and b/examples/lib/bld/bld-wrapper.jar differ diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index ccddd15..b61179e 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,7 +1,6 @@ #Sun Apr 02 10:32:44 PDT 2023 bld.extension=com.uwyn.rife2:bld-property-file:0.9.0 -bld.repositories=https\://repo1.maven.org/maven2/,/home/erik/.m2/repository +bld.repositories=MAVEN_LOCAL,https\://repo1.maven.org/maven2/ +bld.downloadExtensionSources=true rife2.downloadLocation= -rife2.version=1.5.11 - - +rife2.version=1.5.14 \ No newline at end of file diff --git a/examples/src/bld/java/com/example/PropertyFileExampleBuild.java b/examples/src/bld/java/com/example/PropertyFileExampleBuild.java index 5ff2531..e3e88a6 100644 --- a/examples/src/bld/java/com/example/PropertyFileExampleBuild.java +++ b/examples/src/bld/java/com/example/PropertyFileExampleBuild.java @@ -2,10 +2,10 @@ package com.example; import rife.bld.BuildCommand; import rife.bld.Project; -import rife.bld.extension.propertyFile.Entry; -import rife.bld.extension.propertyFile.Entry.Operations; -import rife.bld.extension.propertyFile.Entry.Types; -import rife.bld.extension.propertyFile.PropertyFileOperation; +import rife.bld.extension.propertyfile.Entry; +import rife.bld.extension.propertyfile.Entry.Operations; +import rife.bld.extension.propertyfile.Entry.Types; +import rife.bld.extension.propertyfile.PropertyFileOperation; import java.util.List; @@ -14,6 +14,7 @@ import static rife.bld.dependencies.Repository.SONATYPE_SNAPSHOTS; import static rife.bld.dependencies.Scope.test; public class PropertyFileExampleBuild extends Project { + final Entry buildDateEntry = new Entry("build.date").value("now").pattern("yyyy-MM-dd").type(Types.DATE); public PropertyFileExampleBuild() { pkg = "com.example"; @@ -33,30 +34,48 @@ public class PropertyFileExampleBuild extends Project { new PropertyFileExampleBuild().start(args); } - @BuildCommand + @BuildCommand(summary = "Updates major version") public void updateMajor() throws Exception { new PropertyFileOperation(this) .file("version.properties") - .entry(new Entry("version.major").defaultValue(1).type(Types.INT).operation(Operations.ADD)) + // set the major version to 1 if it doesn't exist, increase by 1 + .entry(new Entry("version.major").defaultValue(0).type(Types.INT).operation(Operations.ADD)) + // set the minor version to 0 .entry(new Entry("version.minor").value(0)) + // set the patch version to 0 .entry(new Entry("version.patch").value(0)) + // set the build date to the current date + .entry(buildDateEntry) .execute(); } - @BuildCommand + @BuildCommand(summary = "Updates minor version") public void updateMinor() throws Exception { new PropertyFileOperation(this) .file("version.properties") - .entry(new Entry("version.minor").defaultValue(0).type(Types.INT).operation(Operations.ADD)) + // set the major version to 1 if it doesn't exist + .entry(new Entry("version.major").defaultValue(1)) + // set the minor version to 0 if it doesn't exist, increase by 1 + .entry(new Entry("version.minor").defaultValue(-1).type(Types.INT).operation(Operations.ADD)) + // set the patch version to 0 .entry(new Entry("version.patch").value(0)) + // set the build date to the current date + .entry(buildDateEntry) .execute(); } - @BuildCommand + @BuildCommand(summary = "Updates patch version") public void updatePatch() throws Exception { new PropertyFileOperation(this) .file("version.properties") - .entry(new Entry("version.patch").defaultValue(0).type(Types.INT).operation(Operations.ADD)) + // set the major version to 1 if it doesn't exist + .entry(new Entry("version.major").defaultValue(1)) + // set the minor version to 0 if it doesn't exist + .entry(new Entry("version.minor").defaultValue(0)) + // set the patch version to 10 if it doesn't exist, increase by 10 + .entry(new Entry("version.patch").defaultValue(0).type(Types.INT).operation(Operations.ADD).value(10)) + // set the build date to the current date + .entry(buildDateEntry) .execute(); } } \ No newline at end of file diff --git a/examples/src/main/java/com/example/PropertyFileExampleMain.java b/examples/src/main/java/com/example/PropertyFileExampleMain.java index b23e1e8..df451ba 100644 --- a/examples/src/main/java/com/example/PropertyFileExampleMain.java +++ b/examples/src/main/java/com/example/PropertyFileExampleMain.java @@ -21,7 +21,7 @@ public class PropertyFileExampleMain { } } - public String getMessage() { + String getMessage() { return "Hello World!"; } } \ No newline at end of file diff --git a/examples/src/test/java/com/example/PropertyFileExampleTest.java b/examples/src/test/java/com/example/PropertyFileExampleTest.java index 7eedb4a..7ea91a3 100644 --- a/examples/src/test/java/com/example/PropertyFileExampleTest.java +++ b/examples/src/test/java/com/example/PropertyFileExampleTest.java @@ -2,9 +2,9 @@ package com.example; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; -public class PropertyFileExampleTest { +class PropertyFileExampleTest { @Test void verifyHello() { assertEquals("Hello World!", new PropertyFileExampleMain().getMessage()); diff --git a/examples/version.properties b/examples/version.properties deleted file mode 100644 index 435570e..0000000 --- a/examples/version.properties +++ /dev/null @@ -1,5 +0,0 @@ -# -#Sun Apr 02 17:19:10 PDT 2023 -version.major=1 -version.minor=0 -version.patch=1