Cleaned up alternate example class template
This commit is contained in:
parent
c4f143ae02
commit
e8a12857b8
3 changed files with 32 additions and 19 deletions
30
examples/my_app_version.txt
Normal file
30
examples/my_app_version.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
package {{v packageName/}};
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public final class {{v className/}} implements Comparable<{{v className/}}> {
|
||||
public static final String PROJECT = "{{v project/}}";
|
||||
public static final Date BUILD_DATE = new Date({{v epoch/}}L);
|
||||
public static final int MAJOR = {{v major/}};
|
||||
public static final int MINOR = {{v minor/}};
|
||||
public static final int REVISION = {{v revision/}};
|
||||
public static final String QUALIFIER = "{{v qualifier/}}";
|
||||
public static final String VERSION = "{{v version/}}";
|
||||
|
||||
private {{v className/}}() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo({{v className/}} other) {
|
||||
if (MAJOR != other.MAJOR) {
|
||||
return Integer.compare(MAJOR, other.MAJOR);
|
||||
} else if (MINOR != other.MINOR) {
|
||||
return Integer.compare(MINOR, other.MINOR);
|
||||
} else if (REVISION != other.REVISION) {
|
||||
return Integer.compare(REVISION, other.REVISION);
|
||||
} else {
|
||||
return QUALIFIER.compareTo(other.QUALIFIER);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package {{v packageName/}};
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public final class {{v className/}} {
|
||||
public static final String PROJECT = "{{v project/}}";
|
||||
public static final Date BUILD_DATE = new Date({{v epoch/}}L);
|
||||
public static final int MAJOR = {{v major/}};
|
||||
public static final int MINOR = {{v minor/}};
|
||||
public static final int REVISION = {{v revision/}};
|
||||
public static final String QUALIFIER = "{{v qualifier/}}";
|
||||
public static final String VERSION = "{{v version/}}";
|
||||
|
||||
private {{v className/}}() {
|
||||
// no-op
|
||||
}
|
||||
}
|
|
@ -45,8 +45,8 @@ public class SampleBuild extends Project {
|
|||
public void genver() throws Exception {
|
||||
new GeneratedVersionOperation()
|
||||
.fromProject(this)
|
||||
// .projectName("My App")
|
||||
// .classTemplate("myversion.txt")
|
||||
.projectName("My App")
|
||||
.classTemplate("my_app_version.txt")
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue