Added calc and modify functions
This commit is contained in:
parent
3fe54858fa
commit
753f3bcf45
19 changed files with 382 additions and 343 deletions
4
examples/.idea/libraries/bld.xml
generated
4
examples/.idea/libraries/bld.xml
generated
|
@ -2,12 +2,12 @@
|
|||
<library name="bld">
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.14.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.16.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.14-sources.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.5.16-sources.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
||||
|
|
4
examples/.idea/misc.xml
generated
4
examples/.idea/misc.xml
generated
|
@ -1,10 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="rife.bld.BuildCommand" />
|
||||
</list>
|
||||
<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" />
|
||||
<pattern value="com.example.PropertyFileExampleBuild" method="deleteVersion" />
|
||||
</component>
|
||||
<component name="PDMPlugin">
|
||||
<option name="skipTestSources" value="false" />
|
||||
|
|
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.14.jar",
|
||||
"${HOME}/.rife2/dist/rife2-1.5.16.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
"lib/test/*.jar"
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
#Sun Apr 02 10:32:44 PDT 2023
|
||||
bld.extension=com.uwyn.rife2:bld-property-file:0.9.0
|
||||
bld.repositories=MAVEN_LOCAL,https\://repo1.maven.org/maven2/
|
||||
bld.repositories=MAVEN_LOCAL,RIFE2,https\://repo1.maven.org/maven2/
|
||||
bld.downloadExtensionSources=true
|
||||
rife2.downloadLocation=
|
||||
rife2.version=1.5.14
|
||||
rife2.version=1.5.16
|
|
@ -3,7 +3,6 @@ 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;
|
||||
|
||||
|
@ -12,9 +11,10 @@ import java.util.List;
|
|||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||
import static rife.bld.dependencies.Repository.SONATYPE_SNAPSHOTS;
|
||||
import static rife.bld.dependencies.Scope.test;
|
||||
import static rife.bld.extension.propertyfile.Calc.ADD;
|
||||
|
||||
public class PropertyFileExampleBuild extends Project {
|
||||
final Entry buildDateEntry = new Entry("build.date").value("now").pattern("yyyy-MM-dd").type(Types.DATE);
|
||||
final Entry buildDateEntry = new Entry("build.date").set("now").pattern("yyyy-MM-dd").type(Types.DATE);
|
||||
|
||||
public PropertyFileExampleBuild() {
|
||||
pkg = "com.example";
|
||||
|
@ -27,7 +27,6 @@ public class PropertyFileExampleBuild extends Project {
|
|||
scope(test)
|
||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 2)))
|
||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 2)));
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -39,11 +38,11 @@ public class PropertyFileExampleBuild extends Project {
|
|||
new PropertyFileOperation(this)
|
||||
.file("version.properties")
|
||||
// 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))
|
||||
.entry(new Entry("version.major").defaultValue(0).type(Types.INT).calc(ADD))
|
||||
// set the minor version to 0
|
||||
.entry(new Entry("version.minor").value(0))
|
||||
.entry(new Entry("version.minor").set(0))
|
||||
// set the patch version to 0
|
||||
.entry(new Entry("version.patch").value(0))
|
||||
.entry(new Entry("version.patch").set(0))
|
||||
// set the build date to the current date
|
||||
.entry(buildDateEntry)
|
||||
.execute();
|
||||
|
@ -56,9 +55,9 @@ public class PropertyFileExampleBuild extends Project {
|
|||
// 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))
|
||||
.entry(new Entry("version.minor").defaultValue(-1).type(Types.INT).calc(ADD))
|
||||
// set the patch version to 0
|
||||
.entry(new Entry("version.patch").value(0))
|
||||
.entry(new Entry("version.patch").set(0))
|
||||
// set the build date to the current date
|
||||
.entry(buildDateEntry)
|
||||
.execute();
|
||||
|
@ -73,9 +72,20 @@ public class PropertyFileExampleBuild extends Project {
|
|||
// 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").value(10).defaultValue(0).type(Types.INT).operation(Operations.ADD))
|
||||
.entry(new Entry("version.patch").defaultValue(0).type(Types.INT).calc(v -> v + 10))
|
||||
// set the build date to the current date
|
||||
.entry(buildDateEntry)
|
||||
.execute();
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Delete version properties")
|
||||
public void deleteVersion() throws Exception {
|
||||
new PropertyFileOperation(this)
|
||||
.file("version.properties")
|
||||
.entry(new Entry("version.major").delete())
|
||||
.entry(new Entry("version.minor").delete())
|
||||
.entry(new Entry("version.patch").delete())
|
||||
.entry(buildDateEntry.delete())
|
||||
.execute();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue