Skip to content

Commit e0f21fe

Browse files
authored
Merge pull request #229 from cyjseagull/release-2.7.1
sync code from release-2.7.1 to master
2 parents 3813763 + 7ccdb7e commit e0f21fe

File tree

53 files changed

+1865
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1865
-377
lines changed

build.gradle

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ext {
3636
// integrationTest.mustRunAfter test
3737
allprojects {
3838
group = 'org.fisco-bcos.java-sdk'
39-
version = '2.7.0'
39+
version = '2.7.1-SNAPSHOT'
4040
apply plugin: 'maven'
4141
apply plugin: 'maven-publish'
4242
apply plugin: 'idea'
@@ -48,7 +48,9 @@ allprojects {
4848
configurations.all {
4949
resolutionStrategy.cacheChangingModulesFor 30, 'seconds'
5050
}
51-
51+
jacoco {
52+
toolVersion = "0.8.6"
53+
}
5254
jacocoTestReport {
5355
reports {
5456
xml.enabled true
@@ -92,10 +94,32 @@ subprojects {
9294
}
9395
jar {
9496
destinationDir file("dist/apps")
95-
archiveName project.name + "-" + version + ".jar"
97+
archiveName "fisco-bcos-" + project.name + "-" + version + ".jar"
9698

9799
exclude "**/*.xml"
98100
exclude "**/*.properties"
101+
manifest {
102+
try {
103+
def repo = grgit.open(currentDir: project.rootDir)
104+
if (repo != null) {
105+
def date = new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
106+
def branch = repo.branch.getCurrent().getName()
107+
def commit = repo.head().getAbbreviatedId(40)
108+
109+
attributes(["Implementation-Timestamp": date,
110+
"Git-Branch" : branch,
111+
"Git-Commit" : commit
112+
])
113+
114+
logger.info(" Commit : ")
115+
logger.info(" => date: {}", date)
116+
logger.info(" => branch: {}", branch)
117+
logger.info(" => commit: {}", commit)
118+
}
119+
} catch (Exception e) {
120+
logger.warn(' .git not exist, cannot found commit info, e: {}', e)
121+
}
122+
} from sourceSets.main.output
99123

100124
doLast {
101125
copy {
@@ -112,22 +136,6 @@ subprojects {
112136
}
113137
}
114138
}
115-
116-
// for upload to maven
117-
task sourcesJar(type: Jar) {
118-
classifier = "sources"
119-
from sourceSets.main.allSource
120-
}
121-
122-
task javadocJar(type: Jar, dependsOn: javadoc) {
123-
classifier = "javadoc"
124-
from javadoc.destinationDir
125-
}
126-
artifacts {
127-
archives jar
128-
archives sourcesJar
129-
archives javadocJar
130-
}
131139
}
132140

133141
sourceSets {
@@ -212,7 +220,7 @@ publishing {
212220
publications {
213221
mavenJava(MavenPublication) {
214222

215-
artifactId project.name
223+
artifactId "fisco-bcos-" + project.name
216224
groupId project.group
217225
version project.version
218226

@@ -264,7 +272,7 @@ publishing {
264272

265273
jar {
266274
// destinationDir file('dist/apps')
267-
// archiveName project.name + '-' + project.version + '.jar'
275+
archiveName "fisco-bcos-" + project.name + '-' + project.version + '.jar'
268276
exclude '**/*.xml'
269277
exclude '**/*.properties'
270278

sdk-abi/build.gradle

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,66 @@ dependencies {
77
compile ("org.apache.commons:commons-lang3:${commonsLang3Version}")
88
}
99

10-
uploadArchives {
11-
repositories {
12-
mavenDeployer {
13-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
10+
task sourcesJar(type: Jar) {
11+
from sourceSets.main.allJava
12+
archiveClassifier = 'sources'
13+
}
1414

15-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
16-
authentication(userName: ossrhUsername, password: ossrhPassword)
17-
}
15+
task javadocJar(type: Jar) {
16+
from javadoc
17+
archiveClassifier = 'javadoc'
18+
}
19+
/*
20+
publishing {
21+
publications {
22+
mavenJava(MavenPublication) {
1823
19-
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
20-
authentication(userName: ossrhUsername, password: ossrhPassword)
21-
}
24+
artifactId "fisco-bcos-" + project.name
25+
groupId project.group
26+
version project.version
2227
23-
pom.project {
24-
name project.name
25-
packaging 'jar'
28+
from components.java
29+
artifact sourcesJar
30+
artifact javadocJar
31+
pom {
32+
name = 'fisco-bcos'
2633
description = 'fisco-bcos java-sdk'
2734
url = 'http://www.fisco-bcos.org'
2835
29-
scm {
30-
connection = 'https://github.com/FISCO-BCOS/java-sdk.git'
31-
url = 'https://github.com/FISCO-BCOS/java-sdk.git'
32-
}
33-
3436
licenses {
3537
license {
3638
name = 'The Apache License, Version 2.0'
3739
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
3840
}
3941
}
40-
4142
developers {
4243
developer {
4344
id = 'zhangsan'
4445
name = 'zhangsan'
4546
email = 'zhangsan@example.com'
4647
}
4748
}
49+
scm {
50+
connection = 'https://github.com/FISCO-BCOS/java-sdk.git'
51+
url = 'https://github.com/FISCO-BCOS/java-sdk.git'
52+
}
4853
}
4954
}
5055
}
51-
}
56+
repositories {
57+
maven {
58+
def releasesRepoURL = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
59+
def snapshotsRepoURL = "https://oss.sonatype.org/content/repositories/snapshots"
60+
url = !version.endsWith("SNAPSHOT") ? releasesRepoURL : snapshotsRepoURL
61+
62+
credentials {
63+
username ossrhUsername
64+
password ossrhPassword
65+
}
66+
}
67+
}
68+
69+
signing {
70+
sign publishing.publications.mavenJava
71+
}
72+
}*/

sdk-abi/src/main/java/org/fisco/bcos/sdk/abi/ABICodec.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.io.IOException;
1919
import java.util.ArrayList;
2020
import java.util.List;
21+
import org.apache.commons.lang3.tuple.Pair;
2122
import org.fisco.bcos.sdk.abi.wrapper.ABICodecJsonWrapper;
2223
import org.fisco.bcos.sdk.abi.wrapper.ABICodecObject;
2324
import org.fisco.bcos.sdk.abi.wrapper.ABIDefinition;
@@ -254,12 +255,12 @@ public String encodeMethodByInterfaceFromString(String methodInterface, List<Str
254255
throw new ABICodecException(errorMsg);
255256
}
256257

257-
public List<Object> decodeMethod(ABIDefinition abiDefinition, String output)
258-
throws ABICodecException {
258+
public Pair<List<Object>, List<ABIObject>> decodeMethodAndGetOutputObject(
259+
ABIDefinition abiDefinition, String output) throws ABICodecException {
259260
ABIObject outputABIObject = abiObjectFactory.createOutputObject(abiDefinition);
260261
ABICodecObject abiCodecObject = new ABICodecObject();
261262
try {
262-
return abiCodecObject.decodeJavaObject(outputABIObject, output);
263+
return abiCodecObject.decodeJavaObjectAndOutputObject(outputABIObject, output);
263264
} catch (Exception e) {
264265
logger.error(" exception in decodeMethodToObject : {}", e.getMessage());
265266
}
@@ -268,15 +269,15 @@ public List<Object> decodeMethod(ABIDefinition abiDefinition, String output)
268269
throw new ABICodecException(errorMsg);
269270
}
270271

271-
public List<Object> decodeMethod(String ABI, String methodName, String output)
272-
throws ABICodecException {
272+
public Pair<List<Object>, List<ABIObject>> decodeMethodAndGetOutputObject(
273+
String ABI, String methodName, String output) throws ABICodecException {
273274
ContractABIDefinition contractABIDefinition = abiDefinitionFactory.loadABI(ABI);
274275
List<ABIDefinition> methods = contractABIDefinition.getFunctions().get(methodName);
275276
for (ABIDefinition abiDefinition : methods) {
276277
ABIObject outputABIObject = abiObjectFactory.createOutputObject(abiDefinition);
277278
ABICodecObject abiCodecObject = new ABICodecObject();
278279
try {
279-
return abiCodecObject.decodeJavaObject(outputABIObject, output);
280+
return abiCodecObject.decodeJavaObjectAndOutputObject(outputABIObject, output);
280281
} catch (Exception e) {
281282
logger.error(" exception in decodeMethodToObject : {}", e.getMessage());
282283
}
@@ -287,6 +288,16 @@ public List<Object> decodeMethod(String ABI, String methodName, String output)
287288
throw new ABICodecException(errorMsg);
288289
}
289290

291+
public List<Object> decodeMethod(ABIDefinition abiDefinition, String output)
292+
throws ABICodecException {
293+
return decodeMethodAndGetOutputObject(abiDefinition, output).getLeft();
294+
}
295+
296+
public List<Object> decodeMethod(String ABI, String methodName, String output)
297+
throws ABICodecException {
298+
return decodeMethodAndGetOutputObject(ABI, methodName, output).getLeft();
299+
}
300+
290301
public List<Object> decodeMethodById(String ABI, String methodId, String output)
291302
throws ABICodecException {
292303
ContractABIDefinition contractABIDefinition = abiDefinitionFactory.loadABI(ABI);

0 commit comments

Comments
 (0)