Renamed example to examples
This commit is contained in:
parent
45581b8001
commit
31584513b0
27 changed files with 3 additions and 3 deletions
45
examples/src/bld/java/com/example/SampleBuild.java
Normal file
45
examples/src/bld/java/com/example/SampleBuild.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package com.example;
|
||||
|
||||
import rife.bld.BuildCommand;
|
||||
import rife.bld.Project;
|
||||
import rife.bld.extension.GeneratedVersionOperation;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||
import static rife.bld.dependencies.Repository.RIFE2_RELEASES;
|
||||
import static rife.bld.dependencies.Scope.test;
|
||||
|
||||
public class SampleBuild extends Project {
|
||||
public SampleBuild() {
|
||||
pkg = "com.example";
|
||||
name = "Sample";
|
||||
mainClass = "com.example.SampleMain";
|
||||
version = version(1, 0, 1, "rc1");
|
||||
|
||||
downloadSources = true;
|
||||
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
|
||||
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) {
|
||||
new SampleBuild().start(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compile() throws Exception {
|
||||
genver();
|
||||
super.compile();
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Generates version class")
|
||||
public void genver() throws Exception {
|
||||
new GeneratedVersionOperation()
|
||||
.fromProject(this)
|
||||
// .classTemplate(new File(".", "myversion.txt"))
|
||||
.execute();
|
||||
}
|
||||
}
|
17
examples/src/main/java/com/example/GeneratedVersion.java
Normal file
17
examples/src/main/java/com/example/GeneratedVersion.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package com.example;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public final class GeneratedVersion {
|
||||
public static final String PROJECT = "Sample";
|
||||
public static final Date BUILD_DATE = new Date(1682700481013L);
|
||||
public static final int MAJOR = 1;
|
||||
public static final int MINOR = 0;
|
||||
public static final int REVISION = 1;
|
||||
public static final String QUALIFIER = "rc1";
|
||||
public static final String VERSION = "1.0.1-rc1";
|
||||
|
||||
private GeneratedVersion() {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
}
|
22
examples/src/main/java/com/example/SampleMain.java
Normal file
22
examples/src/main/java/com/example/SampleMain.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package com.example;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public class SampleMain {
|
||||
public static void main(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.BUILD_DATE));
|
||||
System.out.println(" Major: " + GeneratedVersion.MAJOR);
|
||||
System.out.println(" Minor: " + GeneratedVersion.MINOR);
|
||||
System.out.println(" Revision: " + GeneratedVersion.REVISION);
|
||||
System.out.println(" Qualifier:: " + GeneratedVersion.QUALIFIER);
|
||||
|
||||
System.out.println("-----------------------------------------------------");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue