mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Store the build's commit hash in Jarfile manifest.
This commit is contained in:
parent
cc8fe09d87
commit
797bfe5cd5
@ -237,6 +237,15 @@ configure(project(':common')) {
|
||||
modules = ['javafx.graphics']
|
||||
}
|
||||
|
||||
ext.getHash = {
|
||||
def p1 = 'git rev-parse HEAD'.execute()
|
||||
p1.waitFor()
|
||||
return p1.text.substring(0,7)
|
||||
}
|
||||
|
||||
jar.manifest.attributes(
|
||||
"Implementation-Version": getHash())
|
||||
|
||||
dependencies {
|
||||
implementation project(':proto')
|
||||
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
|
||||
|
@ -17,8 +17,12 @@
|
||||
|
||||
package bisq.common.app;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -135,6 +139,16 @@ public class Version {
|
||||
'}');
|
||||
}
|
||||
|
||||
public String readCommitHash() {
|
||||
try {
|
||||
String pth = getClass().getResource(getClass().getSimpleName() + ".class").toString();
|
||||
String mnf = pth.substring(0, pth.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
|
||||
Attributes attr = new Manifest(new URL(mnf).openStream()).getMainAttributes();
|
||||
return attr.getValue("Implementation-Version");
|
||||
} catch (Exception ignored) { }
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
public static final byte COMPENSATION_REQUEST = (byte) 0x01;
|
||||
public static final byte REIMBURSEMENT_REQUEST = (byte) 0x01;
|
||||
public static final byte PROPOSAL = (byte) 0x01;
|
||||
|
@ -29,7 +29,6 @@ import bisq.core.filter.FilterManager;
|
||||
import bisq.core.network.p2p.inventory.messages.GetInventoryRequest;
|
||||
import bisq.core.network.p2p.inventory.messages.GetInventoryResponse;
|
||||
import bisq.core.network.p2p.inventory.model.InventoryItem;
|
||||
import bisq.core.network.p2p.inventory.model.RequestInfo;
|
||||
|
||||
import bisq.network.p2p.network.Connection;
|
||||
import bisq.network.p2p.network.MessageListener;
|
||||
@ -151,7 +150,7 @@ public class GetInventoryRequestHandler implements MessageListener {
|
||||
|
||||
// node
|
||||
inventory.put(InventoryItem.version, Version.VERSION);
|
||||
inventory.put(InventoryItem.commitHash, RequestInfo.COMMIT_HASH);
|
||||
inventory.put(InventoryItem.commitHash, new Version().readCommitHash());
|
||||
inventory.put(InventoryItem.usedMemory, String.valueOf(Profiler.getUsedMemoryInBytes()));
|
||||
inventory.put(InventoryItem.jvmStartTime, String.valueOf(ManagementFactory.getRuntimeMXBean().getStartTime()));
|
||||
|
||||
|
@ -28,9 +28,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@Getter
|
||||
public class RequestInfo {
|
||||
// Carries latest commit hash of feature changes (not latest commit as that is then the commit for editing that field)
|
||||
public static final String COMMIT_HASH = "c07d47a8";
|
||||
|
||||
private final long requestStartTime;
|
||||
@Setter
|
||||
private long responseTime;
|
||||
|
Loading…
Reference in New Issue
Block a user