mirror of
https://gitee.com/BDWare/contract-java-example.git
synced 2025-01-09 17:34:10 +00:00
update ypk-packer
This commit is contained in:
parent
2d5b0f7586
commit
1b60a1b64a
32
README.md
32
README.md
@ -7,14 +7,12 @@ idea开发合约的示例。
|
||||
#### 测试环境配置
|
||||
|
||||
1. 在本地准备docker测试环境。
|
||||
|
||||
```bash
|
||||
cd bdserver-docker-compose
|
||||
docker-compose up -d
|
||||
cat bdcontract/manager.keypair
|
||||
#并复制这组{"publickey".."privateKey"}
|
||||
```
|
||||
|
||||
2. 打开浏览器`http://127.0.0.1:21030/NodePortal.html`。点击右上角`欢迎04xx`按钮,将步骤1中的keyPair复制,并点`导入密钥`。
|
||||
|
||||
### 开发环境配置
|
||||
@ -24,7 +22,7 @@ cat bdcontract/manager.keypair
|
||||
|
||||
#### 调试运行
|
||||
|
||||
1修改debugconf.json,将cpHost改为从docker可访问的域名或ip。
|
||||
1.修改debugconf.json,将cpHost改为从docker可访问的域名或ip。
|
||||
|
||||
```
|
||||
在MAC/Linux环境下,可使用ifconfig | grep inet ,查看本地局域网ip,并配置到cpHost字段。
|
||||
@ -55,7 +53,33 @@ test/java/HelloTest.run
|
||||
```
|
||||
|
||||
注意run方法中的`for (;;);`用于防止测试用例退出。
|
||||
在windows中可能影响其他测试用例运行。可独立写个`public static void main(String[] args)`去运行合约。
|
||||
在windows中可能影响其他测试用例运行。可编写`public static void main(String[] args)`去运行合约。
|
||||
|
||||
3.带UI的ypk调试
|
||||
由于bdcontract会根据启动参数中的ypkPath去解析ypk文件中的资源文件,因此,当需要通过`http://xxx:xx/DOIP/ContractID`这种形式去访问静态资源时,
|
||||
需要配置ypk路径映射。
|
||||
一种做法是:
|
||||
|
||||
1) 在./bdserver-docker-compose目录下,在启动之后,会生成一个文件`./bdcontract/BDWareProjectDir`。将该目录映射至./backend目录下或是backend的上级目录下。
|
||||
|
||||
```
|
||||
cd 至backend
|
||||
ln -s /absolute/path/to/BDWareProjectDir ./
|
||||
```
|
||||
|
||||
2) 修改DebugMain的启动路径为BDWareProjectDir所在目录。
|
||||
|
||||
3) 修改debugconf.json中的ypkPath,使用相对路径的形式`./BDWareProjectDir/xxx`。
|
||||
|
||||
4) 注意需要将编译好的ypk放至BDWareProjectDir中。可编写一个新的gradle task完成脚本化复制。如:
|
||||
|
||||
```
|
||||
task copyToBDWareProjectDir(type: Copy) {
|
||||
from "./build/contractexample-${currVersion}.ypk"
|
||||
into "../bdserver-docker-compose/bdcontract/BDWareProjectDir/"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### 部署运行
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.bdware.bdcontract:simple-ypk-packer:0.5.4"
|
||||
classpath "org.bdware.bdcontract:ypk-deploy-tool:0.7.0"
|
||||
classpath "org.bdware.bdcontract:simple-ypk-packer:0.5.5"
|
||||
classpath "org.bdware.bdcontract:ypk-deploy-tool:0.7.1"
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
@ -40,7 +39,7 @@ sourceSets {
|
||||
dependencies {
|
||||
api 'org.apache.logging.log4j:log4j-core:2.17.2'
|
||||
api 'org.apache.logging.log4j:log4j-api:2.17.2'
|
||||
implementation 'org.bdware.sc:cp:1.6.7'
|
||||
implementation 'org.bdware.sc:cp:1.6.8'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
}
|
||||
|
||||
@ -73,10 +72,10 @@ task copyJar(type: Copy, dependsOn: [":backend:jar", ":backend:copyLibs"]) {
|
||||
}
|
||||
def reltivePath = "./backend"
|
||||
//reltivePath="."
|
||||
def currVersion = "1.3.1"
|
||||
def currVersion = "1.3.2"
|
||||
task grepCP(dependsOn: ["copyJar"]) {
|
||||
doLast {
|
||||
org.bdware.datanet.YPKPacker.grepJarByCPVersion("${reltivePath}/build/output/libs", org.bdware.datanet.CPVersion.cp_1_6_7)
|
||||
org.bdware.datanet.YPKPacker.grepJarByCPVersion("${reltivePath}/build/output/libs", org.bdware.datanet.CPVersion.cp_1_6_8)
|
||||
org.bdware.datanet.YPKPacker.grepJarByListFile("${reltivePath}/build/output/libs", "${reltivePath}/grepcp.list")
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ services:
|
||||
- "2416:2416" # P2P
|
||||
- "2401:2401" # API
|
||||
bdcontract:
|
||||
image: bdware/bdcontract:1.7.9
|
||||
image: bdware/bdcontract:1.8.2
|
||||
command: "-Dfile.encoding=UTF-8 -Djava.library.path='./dynamicLibrary' -Dlog4j.configurationFile=./log4j2.properties -cp ./libs/*:bdagent.jar org.bdware.server.CMHttpServer"
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
|
Loading…
Reference in New Issue
Block a user