mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
Merge pull request #14754 from nik9000/build
Make Build work without git
This commit is contained in:
commit
e0646eeb89
@ -240,6 +240,10 @@ class BuildPlugin implements Plugin<Project> {
|
|||||||
'X-Compile-Elasticsearch-Version': VersionProperties.elasticsearch,
|
'X-Compile-Elasticsearch-Version': VersionProperties.elasticsearch,
|
||||||
'X-Compile-Lucene-Version': VersionProperties.lucene,
|
'X-Compile-Lucene-Version': VersionProperties.lucene,
|
||||||
'Build-Date': ZonedDateTime.now(ZoneOffset.UTC))
|
'Build-Date': ZonedDateTime.now(ZoneOffset.UTC))
|
||||||
|
if (jarTask.manifest.attributes.containsKey('Change') == false) {
|
||||||
|
logger.warn('Building without git revision id.')
|
||||||
|
jarTask.manifest.attributes('Change': 'N/A')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,13 @@ import java.util.jar.JarInputStream;
|
|||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Information about a build of Elasticsearch.
|
||||||
*/
|
*/
|
||||||
public class Build {
|
public class Build {
|
||||||
|
/**
|
||||||
|
* The current build of Elasticsearch. Filled with information scanned at
|
||||||
|
* startup from the jar.
|
||||||
|
*/
|
||||||
public static final Build CURRENT;
|
public static final Build CURRENT;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -56,6 +60,14 @@ public class Build {
|
|||||||
shortHash = "Unknown";
|
shortHash = "Unknown";
|
||||||
date = "Unknown";
|
date = "Unknown";
|
||||||
}
|
}
|
||||||
|
if (shortHash == null) {
|
||||||
|
throw new IllegalStateException("Error finding the build shortHash. " +
|
||||||
|
"Stopping Elasticsearch now so it doesn't run in subtly broken ways. This is likely a build bug.");
|
||||||
|
}
|
||||||
|
if (date == null) {
|
||||||
|
throw new IllegalStateException("Error finding the build date. " +
|
||||||
|
"Stopping Elasticsearch now so it doesn't run in subtly broken ways. This is likely a build bug.");
|
||||||
|
}
|
||||||
|
|
||||||
CURRENT = new Build(shortHash, date);
|
CURRENT = new Build(shortHash, date);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user