Added README
This commit is contained in:
parent
b50da16e74
commit
98d6c5c659
1 changed files with 68 additions and 1 deletions
69
README.md
69
README.md
|
@ -1 +1,68 @@
|
|||
# TBD
|
||||
# [Bld](https://rife2.com/bld) Extension to Generate Project Version Data
|
||||
|
||||
|
||||
[](http://opensource.org/licenses/BSD-3-Clause)
|
||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
||||
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-generated-version)
|
||||
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-generated-version)
|
||||
[](https://github.com/rife2/bld-generated-version/actions/workflows/bld.yml)
|
||||
|
||||
To automatically create a generated version class using the default template in your project on compile:
|
||||
```java
|
||||
@Override
|
||||
public void compile() throws Exception {
|
||||
genver();
|
||||
super.compile();
|
||||
}
|
||||
|
||||
@BuildCommand(summary = "Generates version class")
|
||||
public void genver() throws Exception {
|
||||
new GeneratedVersionOperation()
|
||||
.fromProject(this)
|
||||
.execute();
|
||||
}
|
||||
```
|
||||
|
||||
```text
|
||||
./bld compile
|
||||
```
|
||||
|
||||
- [View Examples](https://github.com/rife2/bld-generated-version/tree/master/examples)
|
||||
|
||||
## Version Class Template
|
||||
|
||||
This is the default template:
|
||||
|
||||
```java
|
||||
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/}}() {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
}
|
||||
```
|
||||
## Custom Template
|
||||
You can specified your own template using some or all of the template value tags, as follows:
|
||||
|
||||
```java
|
||||
@BuildCommand(summary = "Generates version class")
|
||||
public void genver() throws Exception {
|
||||
new GeneratedVersionOperation()
|
||||
.fromProject(this)
|
||||
.classTemplate(new File(".", "myversion.txt"))
|
||||
.execute();
|
||||
}
|
||||
```
|
||||
|
||||
Please check the [GeneratedVersionOperation documentation](https://rife2.github.io/bld-generated-version/rife/bld/extension/GeneratedVersionOperation.html#method-summary) for all available configuration options.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue