Version 0.9.8-SNAPSHOT
This commit is contained in:
parent
4ee818deab
commit
61d723b589
4 changed files with 31 additions and 26 deletions
|
@ -45,8 +45,8 @@ public class SampleBuild extends Project {
|
||||||
public void genver() throws Exception {
|
public void genver() throws Exception {
|
||||||
new GeneratedVersionOperation()
|
new GeneratedVersionOperation()
|
||||||
.fromProject(this)
|
.fromProject(this)
|
||||||
.projectName("My App")
|
// .projectName("My App")
|
||||||
.classTemplate("my_app_version.txt")
|
// .classTemplate("my_app_version.txt")
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,30 @@
|
||||||
/*
|
|
||||||
* This file is automatically generated.
|
|
||||||
* Do not modify! -- ALL CHANGES WILL BE ERASED!
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.example;
|
package com.example;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
public final class GeneratedVersion implements Comparable<GeneratedVersion> {
|
||||||
* Provides project version information.
|
public static final Date BUILD_DATE = new Date(1720371304587L);
|
||||||
*/
|
|
||||||
public final class GeneratedVersion {
|
|
||||||
public static final String PROJECT = "Sample";
|
|
||||||
public static final Date BUILD_DATE = new Date(1720056110519L);
|
|
||||||
public static final int MAJOR = 1;
|
public static final int MAJOR = 1;
|
||||||
public static final int MINOR = 0;
|
public static final int MINOR = 0;
|
||||||
public static final int REVISION = 1;
|
public static final String PROJECT = "My App";
|
||||||
public static final String QUALIFIER = "rc1";
|
public static final String QUALIFIER = "rc1";
|
||||||
|
public static final int REVISION = 1;
|
||||||
public static final String VERSION = "1.0.1-rc1";
|
public static final String VERSION = "1.0.1-rc1";
|
||||||
|
|
||||||
/**
|
|
||||||
* Disables the default constructor.
|
|
||||||
*/
|
|
||||||
private GeneratedVersion() {
|
private GeneratedVersion() {
|
||||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
// no-op
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(GeneratedVersion 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,7 +35,7 @@ public class GeneratedVersionOperationBuild extends Project {
|
||||||
public GeneratedVersionOperationBuild() {
|
public GeneratedVersionOperationBuild() {
|
||||||
pkg = "rife.bld.extension";
|
pkg = "rife.bld.extension";
|
||||||
name = "GeneratedVersionOperation";
|
name = "GeneratedVersionOperation";
|
||||||
version = version(0, 9, 7);
|
version = version(0, 9, 8, "SNAPSHOT");
|
||||||
|
|
||||||
javaRelease = 17;
|
javaRelease = 17;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class GeneratedVersionOperationBuild extends Project {
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3)))
|
||||||
.include(dependency("org.assertj", "assertj-core", version(3, 26, 0)));
|
.include(dependency("org.assertj", "assertj-core", version(3, 26, 3)));
|
||||||
|
|
||||||
precompileOperation()
|
precompileOperation()
|
||||||
.templateTypes(TXT);
|
.templateTypes(TXT);
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
|
|
||||||
package rife.bld.extension;
|
package rife.bld.extension;
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.*;
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import rife.bld.BaseProject;
|
import rife.bld.BaseProject;
|
||||||
import rife.bld.Project;
|
import rife.bld.Project;
|
||||||
import rife.bld.dependencies.VersionNumber;
|
import rife.bld.dependencies.VersionNumber;
|
||||||
|
@ -39,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
class GeneratedVersionTest {
|
class GeneratedVersionTest {
|
||||||
private final BaseProject PROJECT = new Project() {
|
private final BaseProject PROJECT = new Project() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -108,6 +108,7 @@ class GeneratedVersionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Order(1)
|
||||||
void testBuildTemplate() {
|
void testBuildTemplate() {
|
||||||
var gv = new GeneratedVersion();
|
var gv = new GeneratedVersion();
|
||||||
gv.setProject(PROJECT);
|
gv.setProject(PROJECT);
|
||||||
|
@ -127,7 +128,7 @@ class GeneratedVersionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testExecute() throws Exception {
|
void testExecute() throws Exception {
|
||||||
var tmpDir = Files.createTempDirectory("bld-generated-version-").toFile();
|
var tmpDir = Files.createTempDirectory("bld-generated-version-execute-").toFile();
|
||||||
tmpDir.deleteOnExit();
|
tmpDir.deleteOnExit();
|
||||||
|
|
||||||
new GeneratedVersionOperation()
|
new GeneratedVersionOperation()
|
||||||
|
@ -147,7 +148,8 @@ class GeneratedVersionTest {
|
||||||
var content = Files.readString(template.toPath());
|
var content = Files.readString(template.toPath());
|
||||||
assertThat(content).contains("class MyVersion")
|
assertThat(content).contains("class MyVersion")
|
||||||
.contains("PROJECT = \"MyExample\";").contains("MAJOR = 2").contains("MINOR = 1")
|
.contains("PROJECT = \"MyExample\";").contains("MAJOR = 2").contains("MINOR = 1")
|
||||||
.contains("REVISION = 3").contains("QUALIFIER = \"\"").contains("private MyVersion");
|
.contains("REVISION = 3").contains("QUALIFIER = \"\"").contains("private MyVersion")
|
||||||
|
.doesNotContain("package");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -171,8 +173,9 @@ class GeneratedVersionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Order(2)
|
||||||
void testWriteTemplate() throws IOException {
|
void testWriteTemplate() throws IOException {
|
||||||
var tmpDir = Files.createTempDirectory("bld-generated-version-").toFile();
|
var tmpDir = Files.createTempDirectory("bld-generated-version-write-").toFile();
|
||||||
tmpDir.deleteOnExit();
|
tmpDir.deleteOnExit();
|
||||||
|
|
||||||
var gv = new GeneratedVersion();
|
var gv = new GeneratedVersion();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue