Add bld example
This commit is contained in:
parent
0ec7a6ee13
commit
11a47e7e0b
64 changed files with 425 additions and 54 deletions
36
examples/java/bld/src/bld/java/com/example/ExampleBuild.java
Normal file
36
examples/java/bld/src/bld/java/com/example/ExampleBuild.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package com.example;
|
||||
|
||||
import rife.bld.BuildCommand;
|
||||
import rife.bld.Project;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.dependencies.Repository.*;
|
||||
import static rife.bld.dependencies.Scope.compile;
|
||||
|
||||
public class ExampleBuild extends Project {
|
||||
public ExampleBuild() {
|
||||
pkg = "com.example";
|
||||
name = "Example";
|
||||
version = version(0, 1, 0);
|
||||
|
||||
mainClass = "com.example.App";
|
||||
|
||||
testOperation().mainClass("com.example.ExampleTest");
|
||||
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
|
||||
|
||||
scope(compile)
|
||||
.include(dependency("net.thauvin.erik", "semver",
|
||||
version(1, 2, 1, "SNAPSHOT")));
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Run the example")
|
||||
public void runExample() throws Exception {
|
||||
runOperation().executeOnce(() -> runOperation().fromProject(this).mainClass("com.example.Example"));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ExampleBuild().start(args);
|
||||
}
|
||||
}
|
31
examples/java/bld/src/main/java/com/example/App.java
Normal file
31
examples/java/bld/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("-----------------------------------------------------");
|
||||
}
|
||||
}
|
21
examples/java/bld/src/main/java/com/example/Example.java
Normal file
21
examples/java/bld/src/main/java/com/example/Example.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package com.example;
|
||||
|
||||
import net.thauvin.erik.semver.Version;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
@Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion",
|
||||
keysPrefix = "example.")
|
||||
public class Example {
|
||||
public static void main(final String... args) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
|
||||
System.out.println("-- From Example -------------------------------------");
|
||||
|
||||
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
|
||||
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
|
||||
|
||||
System.out.println("-----------------------------------------------------");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.example;
|
||||
|
||||
public class ExampleTest {
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue