diff --git a/build.gradle b/build.gradle index a3f71e9..34bcf13 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,14 @@ plugins { id 'java' id 'java-library' - id 'application' + //id 'application' + id 'com.github.johnrengelman.shadow' version '4.0.2' + id 'maven-publish' + id 'signing' } -mainClassName = 'org.bdware.sc.ContractProcess' + +//mainClassName = 'org.bdware.sc.ContractProcess' repositories { mavenLocal() mavenCentral() @@ -41,21 +45,29 @@ dependencies { implementation 'com.sun.mail:javax.mail:1.6.2' implementation 'com.squareup.okhttp3:okhttp:4.9.1' implementation 'org.bdware.bdcontract:sdk-java:1.0.0' - implementation 'org.bdware.doip:doip-audit-tool:0.9.3' - api fileTree(dir: 'lib', include: '*.jar') - + implementation 'org.bdware.doip:doip-audit-tool:0.9.4' + compile fileTree(dir: 'lib', include: '*.jar') testImplementation 'junit:junit:4.13.2' } +task classJar(type: Jar, dependsOn: classes) { + classifier = "jar" +} +//jar { +// classifier = "" +//} + jar { String libs = '' configurations.runtimeClasspath.each { libs = libs + " libs/" + it.name } - + from { + configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } + } manifest { attributes 'Manifest-Version': project.version - attributes 'Main-Class': mainClassName + // attributes 'Main-Class': mainClassName attributes 'Class-Path': libs } } @@ -78,4 +90,89 @@ task buildBundle(dependsOn: [":cp:copyLibs", ":cp:copyJar"]) { doLast { println "buildBundle in ./build/output/ successfully" } +} + + +task sourceJar(type: Jar, dependsOn: classes) { + archiveClassifier = "sources" + classifier = "sources" + from sourceSets.main.allSource +} +tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + archiveClassifier = 'javadoc' + classifier = "javadoc" + exclude { + details -> details.file.getAbsolutePath().contains("/gm/") + } + from javadoc.destinationDir +} +//shadowJar { +// classifier = "jar" +// dependencies { +// include(dependency(fileTree(dir: 'lib', include: '*.jar'))) +//// exclude(dependency('com.google.code.gson:gson:2.8.6')) +//// relocate 'com.google.code.gson', 'irs.com.google.code.gson' +// } +//} + +publishing { + publications { + mavenJava(MavenPublication) { + groupId project.group + artifactId "cp" + version "${version}" + from components.java + artifact sourceJar + artifact javadocJar + artifact classJar + pom { + name = "bdware-cp" + description = "cp" + url = "https://gitee.com/BDWare/cp" + licenses { + license { + name = "GPL v2" + url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt" + } + } + developers { + developer { + id = "dataware" + email = "caihq@pku.edu.cn" + } + } + scm { + connection = "scm:git:https://gitee.com/BDWare/cp.git" + developerConnection = "scm:git:https://gitee.com/BDWare/cp.git" + url = "https://gitee.com/BDWare/cp" + } + } + + } + } + repositories { + maven { + name 'bdwareSnapshotRepository' + url 'https://oss.sonatype.org/content/repositories/snapshots' + credentials { + username = "${NEXUS_USERNAME}" + password = "${NEXUS_PASSWORD}" + } + } + maven { + name 'bdwareRepository' + url 'https://oss.sonatype.org/service/local/staging/deploy/maven2' + credentials { + username = "${NEXUS_USERNAME}" + password = "${NEXUS_PASSWORD}" + } + } + } +} +signing { + sign publishing.publications.mavenJava } \ No newline at end of file diff --git a/src/main/debugger/org/bdware/sc/debugger/DebugMain.java b/src/main/debugger/org/bdware/sc/debugger/DebugMain.java index 0fc7062..c7792f3 100644 --- a/src/main/debugger/org/bdware/sc/debugger/DebugMain.java +++ b/src/main/debugger/org/bdware/sc/debugger/DebugMain.java @@ -2,8 +2,8 @@ package org.bdware.sc.debugger; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bdware.client.SmartContractClient; import org.bdware.sc.ContractProcess; import org.bdware.sc.bean.Contract; diff --git a/src/main/java/org/bdware/sc/engine/JSONTool.java b/src/main/java/org/bdware/sc/engine/JSONTool.java index 8ba4f1f..cccf9f9 100644 --- a/src/main/java/org/bdware/sc/engine/JSONTool.java +++ b/src/main/java/org/bdware/sc/engine/JSONTool.java @@ -133,7 +133,7 @@ public class JSONTool { recorded.add(arr); JsonObject jsonObject = new JsonObject(); for (Object k : arr.keySet()) { - jsonObject.add(k.toString(), convertMirrorToJsonInternal(k, recorded)); + jsonObject.add(k.toString(), convertMirrorToJsonInternal(arr.get(k), recorded)); } return jsonObject; } else if (obj.getClass() == jdk.internal.dynalink.beans.StaticClass.class) {