current GIT hash is now available to firmware source code
This commit is contained in:
parent
d46ebf97de
commit
6709070817
|
@ -1,5 +1,9 @@
|
|||
// This file was generated by Version2Header
|
||||
// Fri Feb 01 18:26:44 EST 2019
|
||||
#ifndef VCS_VERSION
|
||||
#define VCS_VERSION "16581"
|
||||
// Sat Feb 02 19:45:56 EST 2019
|
||||
#ifndef GIT_HASH
|
||||
#ifndef GIT_HASH
|
||||
#define GIT_HASH "d46ebf97de076858e7654ba198dc2b19b1c4470d"
|
||||
#endif
|
||||
#ifndef VCS_VERSION
|
||||
#define VCS_VERSION "16628"
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
rem Let's regemerate 'svnversion.h'
|
||||
rem TODO: handle std err - for example, in case svn needs upgrade
|
||||
java -jar ../java_tools/version2header.jar 10000 https://github.com/rusefi/rusefi
|
||||
|
||||
for /f %%i in ('git rev-parse HEAD') do set git_hash=%%i
|
||||
echo Git hash=%git_hash%
|
||||
java -jar ../java_tools/version2header.jar 10000 https://github.com/rusefi/rusefi %git_hash%
|
Binary file not shown.
|
@ -9,24 +9,26 @@ import java.util.Date;
|
|||
public class Version2Header {
|
||||
private static final String NL = "\n";//System.getProperty("line.separator");
|
||||
|
||||
private static final String COMMAND = "svn info ";
|
||||
private static final String SVN_COMMAND = "svn info ";
|
||||
private static final String VERSION_MARKER = "Last Changed Rev: ";
|
||||
private static final String HEADER_TAG = "VCS_VERSION";
|
||||
private static final String GIT_HASH_TAG = "GIT_HASH";
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
System.out.println("Version offset value is now a mandatory parameter!");
|
||||
if (args.length != 3) {
|
||||
System.out.println("offset, URL and githash should be specified");
|
||||
System.exit(-1);
|
||||
}
|
||||
int versionOffsetValue = Integer.parseInt(args[0]);
|
||||
String url = args.length == 2 ? args[1] : "";
|
||||
String url = args[1];
|
||||
String gitHash = args[2];
|
||||
System.out.println("Hi, it's " + new Date());
|
||||
if (url.isEmpty()) {
|
||||
System.out.println("Looking for local version");
|
||||
} else {
|
||||
System.out.println("Looking for remove version: " + url);
|
||||
}
|
||||
String command = COMMAND + url;
|
||||
String command = SVN_COMMAND + url;
|
||||
|
||||
System.out.println("Working with " + NL.length() + " line ends, offset " + versionOffsetValue);
|
||||
Process simulatorProcess = null;
|
||||
|
@ -47,7 +49,7 @@ public class Version2Header {
|
|||
String ver = line.substring(VERSION_MARKER.length());
|
||||
System.out.println("Version [" + ver + "]");
|
||||
int version = Integer.parseInt(ver);
|
||||
writeFile(versionOffsetValue + version);
|
||||
writeFile(versionOffsetValue + version, gitHash);
|
||||
}
|
||||
}
|
||||
System.out.println("Got " + counter + " lines of stdout");
|
||||
|
@ -64,10 +66,14 @@ public class Version2Header {
|
|||
}
|
||||
}
|
||||
|
||||
private static void writeFile(int version) throws IOException {
|
||||
private static void writeFile(int version, String gitHash) throws IOException {
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter("svnversion.h"));
|
||||
bw.write("// This file was generated by Version2Header" + NL);
|
||||
bw.write("// " + new Date() + NL);
|
||||
bw.write("#ifndef " + GIT_HASH_TAG + NL);
|
||||
bw.write("#ifndef " + GIT_HASH_TAG + NL);
|
||||
bw.write("#define " + GIT_HASH_TAG + " \"" + gitHash + "\"" + NL);
|
||||
bw.write("#endif" + NL);
|
||||
bw.write("#ifndef " + HEADER_TAG + NL);
|
||||
bw.write("#define " + HEADER_TAG + " \"" + version + "\"" + NL);
|
||||
bw.write("#endif" + NL);
|
||||
|
|
Loading…
Reference in New Issue