mirror of
https://gitee.com/BDWare/cp.git
synced 2026-02-14 17:39:28 +00:00
Compare commits
7 Commits
feat/start
...
feat/start
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f55f60eb8 | ||
|
|
8a3c59ed59 | ||
|
|
9ecbf54c2d | ||
|
|
a9ec23400e | ||
|
|
247adc11de | ||
|
|
957cdb469f | ||
|
|
afd6363fd5 |
@@ -16,4 +16,9 @@ copy debugconf.json.template debugconf.json
|
|||||||
3.设置DebugMain的路径为:xxx/xxx/cp
|
3.设置DebugMain的路径为:xxx/xxx/cp
|
||||||
```
|
```
|
||||||
执行DebugMain.main即可
|
执行DebugMain.main即可
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 构建可执行版本
|
||||||
|
执行`cp/build.gradle`中的`buildBundle`任务。
|
||||||
|
在`cp/build/output`即为相关的jar包。
|
||||||
|
由`yjs.jar`(即cp.jar)和一系列依赖(在libs目录下)组成。
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ plugins {
|
|||||||
apply from: '../spotless.gradle'
|
apply from: '../spotless.gradle'
|
||||||
|
|
||||||
group = "org.bdware.sc"
|
group = "org.bdware.sc"
|
||||||
version = "1.10.5"
|
version = "1.10.6"
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
// options.compilerArgs << '-Xlint:none'
|
// options.compilerArgs << '-Xlint:none'
|
||||||
// options.compilerArgs << '-Xlint:deprecation' << "-Werror"
|
// options.compilerArgs << '-Xlint:deprecation' << "-Werror"
|
||||||
@@ -51,7 +51,7 @@ dependencies {
|
|||||||
implementation 'com.sun.mail:javax.mail:1.6.2'
|
implementation 'com.sun.mail:javax.mail:1.6.2'
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
||||||
implementation 'org.bdware.bdcontract:sdk-java:1.0.2'
|
implementation 'org.bdware.bdcontract:sdk-java:1.0.2'
|
||||||
implementation 'org.bdware.doip:doip-audit-tool:1.5.9'
|
implementation 'org.bdware.doip:doip-audit-tool:1.6.0'
|
||||||
implementation 'org.bdware.doip:doip-sdk:1.5.9'
|
implementation 'org.bdware.doip:doip-sdk:1.5.9'
|
||||||
implementation 'org.apache.logging.log4j:log4j-layout-template-json:2.17.2'
|
implementation 'org.apache.logging.log4j:log4j-layout-template-json:2.17.2'
|
||||||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3'
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3'
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.zz.gmhelper.SM2KeyPair;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DoipLocalSingleton {
|
public class DoipLocalSingleton {
|
||||||
@@ -66,38 +67,57 @@ public class DoipLocalSingleton {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
SM2KeyPair keyPair = JavaScriptEntry.getKeyPair();
|
SM2KeyPair keyPair = JavaScriptEntry.getKeyPair();
|
||||||
String repoID = "bdtest/BDRepo/" + UUID.randomUUID().toString();
|
String repoID = "";
|
||||||
String owner = ContractProcess.instance.getContract().getOwner();
|
String owner = ContractProcess.instance.getContract().getOwner();
|
||||||
String repoType = "BDO";
|
String repoType = "BDO";
|
||||||
EndpointConfig config = null;
|
EndpointConfig config = null;
|
||||||
try {
|
try {
|
||||||
if (otherConfigs != null && otherConfigs.isJsonObject()) {
|
if (otherConfigs != null && otherConfigs.isJsonObject()) {
|
||||||
config = new TempConfigStorage(otherConfigs.toString()).loadAsEndpointConfig();
|
config = new TempConfigStorage(otherConfigs.toString()).loadAsEndpointConfig();
|
||||||
|
// 获取合约启动配置
|
||||||
if (otherConfigs.getAsJsonObject().has("repoID")) {
|
if (otherConfigs.getAsJsonObject().has("repoID")) {
|
||||||
repoID = otherConfigs.getAsJsonObject().get("repoID").getAsString();
|
repoID = otherConfigs.getAsJsonObject().get("repoID").getAsString();
|
||||||
}
|
}
|
||||||
|
if (otherConfigs.getAsJsonObject().has("publicKey")) {
|
||||||
|
owner = otherConfigs.getAsJsonObject().get("publicKey").getAsString();
|
||||||
|
}
|
||||||
if (config.privateKey == null || config.publicKey == null) {
|
if (config.privateKey == null || config.publicKey == null) {
|
||||||
config.privateKey = keyPair.getPrivateKeyStr();
|
config.privateKey = keyPair.getPrivateKeyStr();
|
||||||
config.publicKey = keyPair.getPublicKeyStr();
|
config.publicKey = keyPair.getPublicKeyStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.routerURI != null && config.repoName != null) {
|
if (config.routerURI != null && config.repoName != null) {
|
||||||
AuditIrpClient irpClient = new AuditIrpClient(config);
|
try {
|
||||||
EndpointInfo endpointInfo = irpClient.getEndpointInfo();
|
AuditIrpClient irpClient = new AuditIrpClient(config);
|
||||||
repoID = endpointInfo.getDoId();
|
EndpointInfo endpointInfo = null;
|
||||||
owner = endpointInfo.getPubKey();
|
for (int i = 0; i < 10; i++) {
|
||||||
infos.clear();
|
endpointInfo = irpClient.getEndpointInfo();
|
||||||
infos.add(new DoipListenerConfig(endpointInfo.getURI(), "2.1"));
|
if (endpointInfo == null)
|
||||||
port = new URI(endpointInfo.getURI()).getPort();
|
Thread.sleep(200);
|
||||||
SharableVarManager.initSharableVarManager(repoID, config);
|
}
|
||||||
|
// 已合约自己的配置为主
|
||||||
|
if (endpointInfo != null) {
|
||||||
|
repoID = Objects.equals(repoID, "") ? endpointInfo.getDoId() : repoID;
|
||||||
|
owner = owner.equals(config.publicKey) ? owner : endpointInfo.getPubKey();
|
||||||
|
infos.clear();
|
||||||
|
}
|
||||||
|
infos.add(new DoipListenerConfig(endpointInfo.getURI(), "2.1"));
|
||||||
|
port = new URI(endpointInfo.getURI()).getPort();
|
||||||
|
SharableVarManager.initSharableVarManager(repoID, config);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果启动参数中添加了 doipStartPort 参数,使用该参数作为启动端口
|
// 如果启动参数中添加了 doipStartPort 参数,使用该参数作为启动端口
|
||||||
if (otherConfigs != null && otherConfigs.isJsonObject() && otherConfigs.getAsJsonObject().has("doipStartPort") && infos.size() == 1) {
|
if (otherConfigs != null && otherConfigs.isJsonObject()
|
||||||
|
&& otherConfigs.getAsJsonObject().has("doipStartPort") && infos.size() == 1) {
|
||||||
int doipStartPort = otherConfigs.getAsJsonObject().get("doipStartPort").getAsInt();
|
int doipStartPort = otherConfigs.getAsJsonObject().get("doipStartPort").getAsInt();
|
||||||
// 如果当前启动的端口和指定的端口不一致,修改启动端口
|
// 如果当前启动的端口和指定的端口不一致,修改启动端口
|
||||||
if (doipStartPort != port) {
|
if (doipStartPort != port) {
|
||||||
infos.get(0).url = infos.get(0).url.replace(String.valueOf(port), String.valueOf(doipStartPort));
|
infos.get(0).url = infos.get(0).url.replace(String.valueOf(port),
|
||||||
port = doipStartPort;
|
String.valueOf(doipStartPort));
|
||||||
|
port = doipStartPort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user