feat: grep jars within cp

This commit is contained in:
CaiHQ 2022-04-21 00:50:40 +08:00
parent a536e8e11f
commit 519d4866ab
4 changed files with 21 additions and 19 deletions

View File

@ -3,13 +3,12 @@
#### 介绍 #### 介绍
idea开发合约的示例。 idea开发合约的示例。
#### 软件架构
软件架构说明
#### 配置cp 的lib #### 配置cp 的lib
做一个软链接将cp-bundle的build/output 软链接到 做一个软链接将cp-bundle的build/output 软链接到
backend/cplibs。 backend/cplibs。
#### 配置grepcp.list
用于手动指定不打包的jar。 格式为每行一个jar名。
#### 前端sdk说明 #### 前端sdk说明

View File

@ -1,9 +1,8 @@
buildscript { buildscript {
dependencies { dependencies {
classpath files("buildlibs/simpleypkpacker.jar") classpath files("buildlibs/simple-ypk-packer-0.3.0.jar")
} }
} }
plugins { plugins {
id 'java' id 'java'
id 'java-library' id 'java-library'
@ -34,8 +33,8 @@ sourceSets {
} }
dependencies { dependencies {
api 'org.apache.logging.log4j:log4j-core:2.14.1' api 'org.apache.logging.log4j:log4j-core:2.17.2'
api 'org.apache.logging.log4j:log4j-api:2.14.1' api 'org.apache.logging.log4j:log4j-api:2.17.2'
implementation fileTree(dir: 'cplibs', include: '*.jar') implementation fileTree(dir: 'cplibs', include: '*.jar')
implementation fileTree(dir: 'cplibs/lib/', include: '*.jar') implementation fileTree(dir: 'cplibs/lib/', include: '*.jar')
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
@ -59,24 +58,25 @@ task copyAssets(type: Copy) {
from "../front" from "../front"
into "./build/output/assets/" into "./build/output/assets/"
} }
task mergeJar(dependsOn: ["sourcesJar", "jar"]) {
doLast {
org.bdware.datanet.YPKPacker.mergeJar("./backend/build/libs/$project.name-${project.version}.jar",
"./backend/build/libs/$project.name-${project.version}-sources.jar",
"./backend/build/libs/$project.name-${project.version}-all.jar")
}
}
task copyJar(type: Copy, dependsOn: ["mergeJar", ":backend:copyLibs"]) { task copyJar(type: Copy, dependsOn: [":backend:jar", ":backend:copyLibs"]) {
from "./build/libs/$project.name-${project.version}-all.jar" from "./build/libs/$project.name-${project.version}.jar"
into "./build/output" into "./build/output"
rename { String fileName -> "sc-example.jar" } rename { String fileName -> "sc-example.jar" }
doFirst { doFirst {
println "copyJar start" println "copyJar start"
} }
} }
def reltivePath = "./backend"
//reltivePath="."
def currVersion = "0.1.0"
task grepCP (dependsOn:["copyJar"]){
doLast {
org.bdware.datanet.YPKPacker.grepCPLibWithFilter("${reltivePath}/cplibs/libs","${reltivePath}/build/output/libs","${reltivePath}/grepcp.list")
}
}
task buildZip(type: Zip, dependsOn: ["copyAssets", "copyJar", "copyYJS"]) { task buildZip(type: Zip, dependsOn: ["copyAssets", "copyJar", "copyYJS","grepCP"]) {
from './build/output/' from './build/output/'
duplicatesStrategy = DuplicatesStrategy.INCLUDE duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'contractexample.zip' archiveFileName = 'contractexample.zip'
@ -85,6 +85,6 @@ task buildZip(type: Zip, dependsOn: ["copyAssets", "copyJar", "copyYJS"]) {
task buildYPK(dependsOn: ["buildZip"]) { task buildYPK(dependsOn: ["buildZip"]) {
doLast { doLast {
org.bdware.datanet.YPKPacker.staticPack("./backend/build/contractexample.zip", "./backend/build/contractexample.ypk") org.bdware.datanet.YPKPacker.staticPack("${reltivePath}/build/contractexample.zip", "${reltivePath}/build/contractexample-${currVersion}.ypk")
} }
} }

Binary file not shown.

3
backend/grepcp.list Normal file
View File

@ -0,0 +1,3 @@
log4j-core-2.14.1.jar
log4j-api-2.14.1.jar
yjs.jar