-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
211 lines (186 loc) · 7.11 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
apply plugin: 'idea'
apply plugin: "de.undercouch.download"
apply plugin: 'org.sonarqube'
apply plugin: "com.github.ben-manes.versions"
allprojects {
group 'com.platon'
}
buildscript {
repositories {
mavenLocal()
maven {url "http://maven.aliyun.com/nexus/content/groups/public/"}
maven {url "https://sdk.platon.network/nexus/content/repositories/releases/"}
maven {url "https://sdk.platon.network/nexus/content/repositories/snapshots/"}
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.ajoberstar:grgit:1.7.2'
classpath "de.undercouch:gradle-download-task:4.0.2"
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'
classpath "com.github.ben-manes:gradle-versions-plugin:0.27.0"
classpath 'org.owasp:dependency-check-gradle:5.2.4'
}
}
ext {
// Open the Git repository in the current directory.
git = org.ajoberstar.grgit.Grgit.open(file('.'))
// Get commit id of HEAD.
gitRevision = git.head().id
// Get abbreviated commit Id of HEAD
gitAbbRevision = git.head().abbreviatedId
// sdk version
sdkVersion = '0.15.1.15-SNAPSHOT'
// sdk发包时间, 无用字段, 测试部门要求添加
sdkTime = '2021-04-02'
// timestamp
buildTimestamp = new Date().format('yyyy-MM-dd HH:mm:ss')
}
sonarqube {
properties {
property "sonar.sourceEncoding", "UTF-8"
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://sdk.platon.network/nexus/content/repositories/releases/'
}
maven {
url 'https://sdk.platon.network/nexus/content/repositories/snapshots/'
}
}
buildscript {
}
configurations {
all {
exclude module: "junit"
// 默认24小时 这样配置jar包会直接去配置的仓库拿
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
dependencies {
testImplementation('org.junit.jupiter:junit-jupiter-params:5.5.2') { force = true }
testImplementation('org.junit.jupiter:junit-jupiter-api:5.5.2') { force = true }
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.5.2') { force = true }
testImplementation('org.junit.jupiter:junit-jupiter:5.5.2') { force = true }
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-migrationsupport:5.5.2'
testImplementation('org.junit.platform:junit-platform-launcher:1.5.2') { force = true }
testImplementation('org.junit.platform:junit-platform-engine:1.5.2') { force = true }
testImplementation('org.junit.platform:junit-platform-commons:1.5.2') { force = true }
testImplementation('org.mockito:mockito-core:3.2.4') { force = true }
testImplementation('org.mockito:mockito-junit-jupiter:3.2.4')
testImplementation 'io.github.overstart:dtotest:1.1'
testImplementation 'org.awaitility:awaitility:4.0.1'
compile 'ch.qos.logback:logback-classic:1.2.3'
compile 'org.slf4j:slf4j-api:1.7.25'
compile 'org.codehaus.janino:janino:3.1.0'
compile 'commons-io:commons-io:2.6'
compile 'org.apache.commons:commons-lang3:3.9'
compile 'commons-codec:commons-codec:1.13'
compile 'commons-beanutils:commons-beanutils:1.9.4'
compile 'com.warrenstrange:googleauth:1.4.0'
compile 'com.alibaba:fastjson:1.2.66'
compile "com.platon.sdk:core:${sdkVersion}"
compile 'org.bitcoinj:bitcoinj-core:0.14.7'
}
test {
jvmArgs = [
'-Dfile.encoding=utf-8', '-DjunitTest'
]
useJUnitPlatform()
}
[compileJava, compileTestJava].each { task ->
task.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror"
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
jacoco {
toolVersion = '0.8.4'
}
jacocoTestReport {
reports {
xml.enabled true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.enabled true
}
// afterEvaluate {
// classDirectories.from = files(classDirectories.files.collect {
// fileTree(dir: it,
// exclude: ['**/model/*',
// '**/entity/*',
// '**/enums/*'])
// })
// }
}
}
dependencyUpdates {
outputFormatter = { result ->
file("$buildDir/dependencyUpdates").mkdirs()
def writer = new FileWriter(new File("$buildDir/", 'dependencyUpdates/report.html'))
def html = new groovy.xml.MarkupBuilder(writer)
html.html {
head {
meta(charset: 'UTF-8')
}
body {
table(border: '1', cellpadding: '2', cellspacing: '0') {
thead {
tr {
td("Group")
td("Module")
td("Version")
td("Remark")
}
}
tbody {
tr { td(colspan: "4", "已更新最新") }
result.current.dependencies.each { dependency ->
tr {
td(dependency.group)
td(dependency.name)
td(dependency.version)
td()
}
}
tr { td(colspan: "4", "版本超前") }
result.exceeded.dependencies.each { dependency ->
tr {
td(dependency.group)
td(dependency.name)
td(dependency.version)
td()
}
}
tr { td(colspan: "4", "版本过时") }
result.outdated.dependencies.each { dependency ->
tr {
td(dependency.group)
td(dependency.name)
td(dependency.version)
td(dependency.available.release ?: dependency.available.milestone)
}
}
tr { td(colspan: "4", "无法判断") }
result.unresolved.dependencies.each { dependency ->
tr {
td(dependency.group)
td(dependency.name)
td(dependency.version)
td()
}
}
}
}
}
}
writer.flush()
}
}