Generate Build.java file with data from the build.
Currently includes build version and time, but additional build-time static data can be easily added in the future.
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
/*/target/
|
/*/target/
|
||||||
|
core/src/main/java/com/threerings/getdown/data/Build.java
|
||||||
|
|||||||
@@ -56,6 +56,51 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>gen-build</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<tstamp>
|
||||||
|
<format property="build_time" pattern="yyyy-MM-dd HH:mm"/>
|
||||||
|
</tstamp>
|
||||||
|
<copy file="${project.build.sourceDirectory}/com/threerings/getdown/data/Build.java.tmpl"
|
||||||
|
tofile="${project.build.sourceDirectory}/com/threerings/getdown/data/Build.java"
|
||||||
|
overwrite="true">
|
||||||
|
<filterset>
|
||||||
|
<filter token="build_time" value="${build_time}"/>
|
||||||
|
<filter token="build_version" value="${project.version}"/>
|
||||||
|
</filterset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<configuration>
|
||||||
|
<filesets>
|
||||||
|
<fileset>
|
||||||
|
<directory>${project.build.sourceDirectory}/</directory>
|
||||||
|
<includes>
|
||||||
|
<include>com/threerings/getdown/data/Build.java</include>
|
||||||
|
</includes>
|
||||||
|
<followSymlinks>false</followSymlinks>
|
||||||
|
</fileset>
|
||||||
|
</filesets>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// Getdown - application installer, patcher and launcher
|
||||||
|
// Copyright (C) 2004-2016 Getdown authors
|
||||||
|
// https://github.com/threerings/getdown/blob/master/LICENSE
|
||||||
|
|
||||||
|
package com.threerings.getdown.data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains static data provided during the build process.
|
||||||
|
*/
|
||||||
|
public class Build {
|
||||||
|
|
||||||
|
/** The date and time at which the code was built: in {@code yyyy-MM-dd HH:mm} format. */
|
||||||
|
public static String time () {
|
||||||
|
return "@build_time@";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The Maven version of the Getdown project. */
|
||||||
|
public static String version () {
|
||||||
|
return "@build_version@";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,6 +47,7 @@ import com.samskivert.util.StringUtil;
|
|||||||
|
|
||||||
import com.threerings.getdown.data.Application.UpdateInterface.Step;
|
import com.threerings.getdown.data.Application.UpdateInterface.Step;
|
||||||
import com.threerings.getdown.data.Application;
|
import com.threerings.getdown.data.Application;
|
||||||
|
import com.threerings.getdown.data.Build;
|
||||||
import com.threerings.getdown.data.Resource;
|
import com.threerings.getdown.data.Resource;
|
||||||
import com.threerings.getdown.data.SysProps;
|
import com.threerings.getdown.data.SysProps;
|
||||||
import com.threerings.getdown.net.Downloader;
|
import com.threerings.getdown.net.Downloader;
|
||||||
@@ -150,6 +151,8 @@ public abstract class Getdown extends Thread
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("Getdown starting", "version", Build.version(), "built", Build.time());
|
||||||
|
|
||||||
// determine whether or not we can write to our install directory
|
// determine whether or not we can write to our install directory
|
||||||
File instdir = _app.getLocalPath("");
|
File instdir = _app.getLocalPath("");
|
||||||
if (!instdir.canWrite()) {
|
if (!instdir.canWrite()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user