add commit info to web3sdk.
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'org.ajoberstar:gradle-git:1.7.2'
+ }
+}
+
plugins {
id 'com.github.sherter.google-java-format' version '0.8'
}
@@ -8,6 +17,7 @@ apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'signing'
apply plugin: 'application'
+apply plugin: 'org.ajoberstar.grgit'
sourceCompatibility = 1.8
@@ -88,7 +98,7 @@ dependencies {
//archivesBaseName = 'web3sdk'
//group = 'org.fisco-bcos'
-//version = '2.0.2'
+//version = '2.0.5'
configurations {
integrationTestCompile.extendsFrom testCompile
@@ -129,6 +139,15 @@ check.dependsOn.remove(test)
check.dependsOn.remove(integrationTest)
check.dependsOn.remove(verifyGoogleJavaFormat)
+import org.ajoberstar.grgit.*
+
+def repo = null;
+try {
+ repo = Grgit.open('.')
+} catch(Exception e) {
+ println(" .git directory not exist.");
+}
+
// 1 dist jar
jar {
destinationDir file('dist/apps')
@@ -138,6 +157,16 @@ jar {
exclude '**/*.crt'
exclude '**/*.key'
+ manifest {
+ if(repo != null) {
+ attributes(["Built-By": System.getProperty("user.name"),
+ "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
+ "Git-Branch": repo.branch.getCurrent().getName(),
+ "Git-Commit": repo.head().getAbbreviatedId(40),
+ ])
+ }
+ } from sourceSets.main.output
+
doLast {
copy {
