Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.3.0 #27

Merged
merged 9 commits into from
Feb 7, 2024
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ext {
junitVersion = '4.13.2'
commonsLang3Version = '3.12.0'

javaSDKVersion3 = "3.3.0"
javaSDKVersion3 = "3.6.0-SNAPSHOT"
javaSDKVersion2 = "2.9.1"
slf4jVersion = "1.7.32"
}
Expand All @@ -50,7 +50,7 @@ sourceSets {
// integrationTest.mustRunAfter test
allprojects {
group = 'org.fisco-bcos.code-generator'
version = '1.2.0'
version = '1.3.0-SNAPSHOT'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'eclipse'
Expand Down
25 changes: 23 additions & 2 deletions src/main/java/org/fisco/bcos/codegen/CodeGenMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ public class CodeGenMain {
public static final String COMMAND_GENERATE = "generate";
public static final String COMMAND_PREFIX = COMMAND_SOLIDITY + " " + COMMAND_GENERATE;

public enum TransactionVersion {
V0(0),
V1(1);

private final int v;

TransactionVersion(int v) {
this.v = v;
}

public int getV() {
return v;
}
}

public enum Version {
V3(3),
V2(2);
Expand Down Expand Up @@ -104,9 +119,14 @@ static class PicocliRunner implements Runnable {

@Option(
names = {"-e", "--enableAsyncCall"},
description = "enable async call.")
description = "enable async call, only V3 enable.")
private boolean enableAsyncCall = false;

@Option(
names = {"-t", "--txVersion"},
description = "specify transaction version, default is 0, only V3 enable.")
private TransactionVersion transactionVersion = TransactionVersion.V0;

@Override
public void run() {
if (version.equals(Version.V2)) {
Expand All @@ -125,7 +145,8 @@ public void run() {
abiFile,
destinationFileDir,
packageName,
enableAsyncCall)
enableAsyncCall,
transactionVersion.getV())
.generateJavaFiles();
} catch (Exception e) {
org.fisco.bcos.codegen.v3.utils.CodeGenUtils.exitError(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class ContractGenerator {
private String basePackageName;

private boolean enableAsyncCall = false;
private int transactionVersion = 0;

public ContractGenerator(
File binFile,
Expand All @@ -78,6 +79,18 @@ public ContractGenerator(
this.enableAsyncCall = enableAsyncCall;
}

public ContractGenerator(
File binFile,
File smBinFile,
File abiFile,
File destinationDir,
String basePackageName,
boolean enableAsyncCall,
int transactionVersion) {
this(binFile, smBinFile, abiFile, destinationDir, basePackageName, enableAsyncCall);
this.transactionVersion = transactionVersion;
}

public void generateJavaFiles() throws CodeGenException, IOException, ClassNotFoundException {
// get binary
byte[] binary = CodeGenUtils.readBytes(this.binFile);
Expand All @@ -103,7 +116,8 @@ public void generateJavaFiles() throws CodeGenException, IOException, ClassNotFo
new String(abiBytes),
destinationDir.toString(),
basePackageName,
enableAsyncCall);
enableAsyncCall,
transactionVersion);
}

private byte[] calculateWasmBytes(byte[] binary) throws IOException {
Expand Down
Loading
Loading