Added build.date to examples
This commit is contained in:
parent
c53230dd61
commit
29ccd1cbdf
10 changed files with 71 additions and 33 deletions
10
examples/.idea/libraries/bld.xml
generated
10
examples/.idea/libraries/bld.xml
generated
|
@ -2,15 +2,15 @@
|
|||
<library name="bld">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.11.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.14.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.11-sources.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.14-sources.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
</SOURCES>
|
||||
<excluded>
|
||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||
</excluded>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
||||
</library>
|
||||
|
|
6
examples/.idea/misc.xml
generated
6
examples/.idea/misc.xml
generated
|
@ -1,5 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<pattern value="com.example.PropertyFileExampleBuild" />
|
||||
<pattern value="com.example.PropertyFileExampleBuild" method="updateMajor" />
|
||||
<pattern value="com.example.PropertyFileExampleBuild" method="updateMinor" />
|
||||
<pattern value="com.example.PropertyFileExampleBuild" method="updatePatch" />
|
||||
</component>
|
||||
<component name="PDMPlugin">
|
||||
<option name="skipTestSources" value="false" />
|
||||
</component>
|
||||
|
|
2
examples/.vscode/settings.json
vendored
2
examples/.vscode/settings.json
vendored
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
Binary file not shown.
|
@ -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
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ public class PropertyFileExampleMain {
|
|||
}
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
String getMessage() {
|
||||
return "Hello World!";
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#
|
||||
#Sun Apr 02 17:19:10 PDT 2023
|
||||
version.major=1
|
||||
version.minor=0
|
||||
version.patch=1
|
Loading…
Add table
Add a link
Reference in a new issue