forked from WeBankBlockchain/WeCross
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
256 lines (224 loc) · 8.3 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
plugins {
id 'com.github.sherter.google-java-format' version '0.8'
id 'org.ajoberstar.grgit' version '4.0.1'
}
// Apply the java-library plugin to add support for Java Library
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'java'
//apply plugin: 'war'
apply plugin: 'jacoco'
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'https://maven.aliyun.com/repository/public/' }
mavenCentral()
}
sourceCompatibility = '1.8'
version = '1.2.1'
task stubSourceJar(type: Jar) {
into 'com/webank/wecross/stub', { from 'src/main/java/com/webank/wecross/stub' }
into 'com/webank/wecross/exception', { from 'src/main/java/com/webank/wecross/exception' }
classifier = 'sources'
}
task stubJar(type: Jar) {
into 'com/webank/wecross/stub', { from 'build/classes/java/main/com/webank/wecross/stub' }
into 'com/webank/wecross/exception', { from 'build/classes/java/main/com/webank/wecross/exception' }
}
task javadocJar(type: Jar) {
// from javadoc
classifier = 'javadoc'
}
ext {
if (!project.hasProperty("NEXUS_USERNAME")) {
NEXUS_USERNAME="xxx"
}
if (!project.hasProperty("NEXUS_PASSWORD")) {
NEXUS_PASSWORD="xxx"
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'com.webank'
artifactId = 'wecross-java-stub'
from components.java
artifacts = [stubJar, stubSourceJar, javadocJar]
// https://docs.gradle.org/current/dsl/org.gradle.api.publish.maven.MavenPublication.html
pom {
name = "WeCross-Stub"
description = "Stub interface for WeCross"
url = "https://github.com/WebankBlockchain/WeCross"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "Shareong"
name = "Shareong"
email = "[email protected]"
}
}
scm {
connection = "scm:git:git://github.com/WebankBlockchain/WeCross.git"
developerConnection = "scm:git:ssh://github.com/WebankBlockchain/WeCross.git"
url = "https://github.com/WebankBlockchain/WeCross"
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = NEXUS_USERNAME
password = NEXUS_PASSWORD
}
}
}
signing {
sign publishing.publications.mavenJava
}
}
googleJavaFormat {
options style: 'AOSP'
source = sourceSets*.allJava
include '**/*.java'
exclude '**/temp/*.java'
}
verifyGoogleJavaFormat {
source = sourceSets*.allJava
include '**/*.java'
exclude '**/temp/*.java'
}
configurations.all {
exclude module: "spring-boot-starter-logging"
exclude module: "spring-boot-starter-web"
exclude group: 'io.netty', module: 'netty-all'
}
def log4j_version="2.15.0"
List logger = [
"org.apache.logging.log4j:log4j-api:$log4j_version",
"org.apache.logging.log4j:log4j-core:$log4j_version",
"org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version",
//"org.apache.logging.log4j:log4j-to-slf4j:$log4j_version",
"org.apache.logging.log4j:log4j-web:$log4j_version",
"org.apache.logging.log4j:log4j-jul:$log4j_version"
]
dependencies {
compile logger
compile 'org.quartz-scheduler:quartz:2.3.2'
compile 'com.moandjiezana.toml:toml4j:0.7.2'
compile 'org.apache.commons:commons-lang3:3.11'
compile 'com.fasterxml.jackson.core:jackson-databind:2.11.2' // must not lower than 2.11.0 to support abi translate
compile 'org.springframework.boot:spring-boot-starter-actuator:2.6.1'
compile 'org.springframework.boot:spring-boot-configuration-processor:2.6.1'
compile 'org.springframework.boot:spring-boot-starter-log4j2:2.6.1'
compile 'org.asynchttpclient:async-http-client:2.12.2'
compile 'org.bouncycastle:bcprov-jdk15on:1.60'
compile 'commons-codec:commons-codec:1.14'
compile 'javax.activation:activation:1.1.1'
compile 'org.fisco-bcos:tcnative:2.0.34.0'
compile 'org.apache.httpcomponents:httpclient:4.5.13'
compile group: 'io.netty', name: 'netty-buffer', version: '4.1.58.Final'
compile group: 'io.netty', name: 'netty-codec', version: '4.1.58.Final'
compile group: 'io.netty', name: 'netty-codec-http', version: '4.1.58.Final'
compile group: 'io.netty', name: 'netty-codec-http2', version: '4.1.58.Final'
compile group: 'io.netty', name: 'netty-common', version: '4.1.58.Final'
compile group: 'io.netty', name: 'netty-handler', version: '4.1.58.Final'
compile group: 'io.netty', name: 'netty-resolver', version: '4.1.58.Final'
compile group: 'io.netty', name: 'netty-transport', version: '4.1.58.Final'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.6.1'
}
sourceSets {
main {
resources {
exclude '/*'
}
}
}
jar {
destinationDir file('dist/apps')
archiveName project.name + "-" + project.version + '.jar'
exclude '**/*.toml'
exclude '**/*.xml'
exclude '**/*.properties'
exclude '**/*.yml'
exclude '**/*.crt'
exclude '**/*.key'
manifest {
attributes(
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': 'com.webank.wecross.Application'
)
try {
def repo = grgit.open(dir: file('.').canonicalPath)
if (repo != null) {
def date = new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
def branch = repo.branch.getCurrent().getName()
def commit = repo.head().getAbbreviatedId(40)
attributes(["Implementation-Timestamp": date,
"Git-Branch" : branch,
"Git-Commit" : commit
])
logger.info(" Commit : ")
logger.info(" => date: {}", date)
logger.info(" => branch: {}", branch)
logger.info(" => commit: {}", commit)
}
} catch (Exception e) {
// logger.warn(' .git not exist, cannot found commit info')
}
}
doLast {
copy {
from file('src/main/resources/')
into 'dist/conf'
}
copy {
from configurations.runtime
into 'dist/lib'
}
copy {
from file('.').listFiles().findAll { File f -> (f.name.endsWith('.sh') || f.name.endsWith('.env')) }
into 'dist'
}
copy {
from file('scripts/')
into 'dist'
}
mkdir 'dist/plugin'
}
}
task makeStubJAR(type: org.gradle.api.tasks.bundling.Jar) {
baseName 'stub'
from 'build/classes/java/main/com/webank/wecross/stub'
from 'src/main/java/com/webank/wecross/stub'
into 'com/webank/wecross/stub/'
destinationDir file('dist/stub/')
}
test {
testLogging {
showStandardStreams = false
events "passed","skipped","failed"
}
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled false
}
}