-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
405 lines (358 loc) · 14.2 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
buildscript {
// For testing corda version variations
if(project.hasProperty("cordaVariationVersion"))
ext['corda_variation_version'] = project.getProperty("cordaVariationVersion")
else ext['corda_variation_version'] = '4.6'
Map<String, String> cordaReleaseVersions = [
'4.4':'4.4',
'4.5':'4.5',
'4.6': '4.6.1',
'4.7':'4.7.1',
'4.8':'4.8']
Map<String, String> cordaPluginVersions = [
'4.4':'5.0.6',
'4.5':'5.0.8',
'4.6': '5.0.12',
'4.7': '5.0.12',
'4.8': '5.0.12']
Map<String, String> cordaPlatformVersions = [
'4.4': 6,
'4.5': 7,
'4.6': 8,
'4.7': 9,
'4.8': 10]
ext['corda_release_version'] = cordaReleaseVersions["$corda_variation_version"]
ext['corda_gradle_plugins_version'] = cordaPluginVersions["$corda_variation_version"]
ext['corda_platform_version'] = cordaPlatformVersions["$corda_variation_version"]
println("Gradle running, Corda dependencies version: $corda_release_version, " +
"plugins version: $corda_gradle_plugins_version, "+
"platform version: $corda_platform_version")
ext {
autodsl_version = '0.0.11'
autoservice_version = '1.0-rc7'
corda_release_group = 'net.corda'
//springboot
spring_version = '5.2.10.RELEASE'
spring_boot_version = '2.3.5.RELEASE'
spring_boot_gradle_plugin_version = '2.3.5.RELEASE'
dokka_version = '0.9.13'
junit_jupiter_version = '5.6.2'
testcontainers_version = '1.15.3'
kotlin_version = '1.2.71'
kotlintest_version = '3.1.10'
kotlinpoet_version = '1.5.0'
kotlinutils_version = '0.30'
corbeans_version = '0.56'
poolboy_version = '0.4'
partiture_version = '0.19'
quasar_exclusions = [
"co.paralleluniverse**",
"groovy**",
"com.esotericsoftware**",
"io.swagger**",
"io.netty**",
"jdk**",
"junit**",
"kotlin**",
"net.rubygrapefruit.**",
"org.gradle.**",
"org.apache.**",
"org.jacoco.**",
"org.junit**",
"org.slf4j**",
"worker.org.gradle.**",
"com.nhaarman.mockito_kotlin**",
"okhttp3.internal**",
"org.apache**",
"org.assertj**",
"org.hamcrest**",
"org.mockito**",
"org.opentest4j**",
'org.springframework**',
'reactor.core.publisher**',
'com.github.manosbatsis.corbeans**',
"org.testcontainers**"]
}
ext['kotlin.version'] = "$kotlin_version"
ext['spring.version'] = "$spring_version"
ext['spring-boot.version'] = "$spring_boot_version"
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' }
// Auto DSL
maven { url "https://dl.bintray.com/juanchosaravia/autodsl" }
}
//apply from: "${rootProject.projectDir}/repositories.gradle"
dependencies {
classpath "net.corda.plugins:publish-utils:$corda_gradle_plugins_version"
classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version"
classpath "net.corda.plugins:api-scanner:$corda_gradle_plugins_version"
// kotlin plugins
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
// release to Maven Central through Sonatype OSSRH
// without the need to use Nexus GUI
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.12.0"
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.9.0'
}
}
plugins {
id "com.github.hierynomus.license" version "0.15.0"
id "org.jetbrains.dokka" version "0.9.16"
}
apply plugin: 'io.codearte.nexus-staging'
nexusStaging {
packageGroup = 'com.github.manosbatsis.corda.testacles'
stagingProfileId = 'com.github.manosbatsis'
}
apply plugin: 'license'
license {
header rootProject.file("etc/license/header.txt")
includes(["**/*.java", "**/*.kt"])
excludes(["**/build/**", "**/config/dev/**"])
mapping {
kt='SLASHSTAR_STYLE'
}
strictCheck true
}
task licenseFormatForKotlin(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
source = fileTree(dir: "./").include("**/*.kt")
}
licenseFormat.dependsOn licenseFormatForKotlin
/**
* Finds sub-projects that need dokka generation
* Place `apply plugin: 'org.jetbrains.dokka'` there
* @return A set of projects that have dokka task
*/
Set<Project> findDokkaProjects() {
subprojects.findAll {
!it.tasks.findAll { "dokka" == it.getName() }.isEmpty()
}
}
task dokkaForGhPages (type: org.jetbrains.dokka.gradle.DokkaTask, overwrite: true) {
outputDirectory = "$rootProject.buildDir/docs/0.x"
outputFormat = "gfm"
dependsOn {
findDokkaProjects().collect {
it.tasks.getByName("dokka")
}
}
doFirst {
def dokkaProjects = findDokkaProjects()
classpath = dokkaProjects.collect { project -> project.jar.outputs.files.getFiles() }.flatten()
classpath += files(dokkaProjects.collect { project -> project.sourceSets.main.compileClasspath })
sourceDirs = files(dokkaProjects.collect { project -> "${project.projectDir}/src/main/kotlin" })
}
}
allprojects {
apply plugin: 'idea'
apply from: "${rootProject.projectDir}/repositories.gradle"
configurations {
cloneCorda { transitive = false }
cloneTestcontainers { transitive = false }
// Adding a configuration that extends existing configuration:
//(testCompile was added by the java plugin)
integrationTestCompile.extendsFrom(testCompile)
all {
// Stop deprecation warnings since we use stdlib-jdkX
exclude(group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jre8')
exclude(group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jre7')
exclude(group: 'org.slf4j', module:'slf4j-simple')
exclude(group: "org.apache.logging.log4j", module: "log4j-slf4j-impl")
//exclude(group: "org.apache.logging.log4j", module: "log4j-slf4j-impl")
resolutionStrategy {
preferProjectModules()
eachDependency { DependencyResolveDetails details ->
// Force corda_release_version
def exclusions = ['corda-finance-contracts']
if (details.requested.group == "net.corda" && !exclusions.contains(details.requested.name)) {
details.useTarget group: corda_release_group, name: details.requested.name, version: corda_release_version
}
// Force dependencies to use the same version of as Kotlin as we.
if (details.requested.group == "org.jetbrains.kotlin") {
details.useTarget group: details.requested.group, name: details.requested.name, version: kotlin_version
}
}
}
}
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
jvmTarget = "1.8"
freeCompilerArgs = ["-Xjsr305=strict","-Xnormalize-constructor-calls=enable"]
javaParameters = true // Useful for reflection.
}
}
tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) {
skipDeprecated = true
// Disable linking to online JDK documentation
noJdkLink = true
noStdlibLink=true
}
test {
environment "CORDA_VARIATION_VERSION", "$corda_variation_version"
maxParallelForks = 1
jvmArgs "-Xmx2048m", "-XX:MaxPermSize=2048m"
testLogging.showStandardStreams = true
testLogging.exceptionFormat = 'full'
useJUnitPlatform {
include '**/*Test.class'
}
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlin_version")
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_jupiter_version"
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit_jupiter_version")
}
// convenient report on all dependencies
task allDeps(type: DependencyReportTask) {}
}
configure(subprojects.findAll { !it.name.contains('example') }) {
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask){
outputFormat = 'javadoc'
outputDirectory = javadoc.destinationDir
inputs.dir 'src/main/kotlin'
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts { archives sourcesJar, javadocJar }
// Conditional signature of artifacts
if (project.findProperty('signing.password') != '<YOUR-PASSWORD>') {
signing {
sign configurations.archives
}
}
// Upload the archives
uploadArchives {
artifacts {}
repositories {
mavenDeployer {
// Sign POMs
beforeDeployment { deployment ->
signing.signPom(deployment)
}
// Release and Snapshot repos
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
// Add required metadata to POM
pom {
project {
name project.name
packaging project.name == rootProject.name ? 'pom' : 'jar'
description 'Corda Testacles: Test containers and tools to help cordaps grow a suite.'
url 'https://manosbatsis.github.io/corda-testacles/'
scm {
connection 'scm:git:git://github.com/manosbatsis/corda-testacles.git'
developerConnection 'scm:git:ssh://github.com/manosbatsis/corda-testacles.git'
url 'http://github.com/manosbatsis/corda-testacles/tree/master'
}
licenses {
license {
name 'GNU Lesser General Public License, Version 3'
url 'https://www.gnu.org/licenses/lgpl-3.0.txt'
}
}
developers {
developer {
id 'manosbatsis'
name 'Manos Batsis'
email '[email protected]'
}
}
}
}
}
}
}
}
// ----------------
// Cordform Section
// ----------------
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'net.corda.plugins.quasar-utils'
dependencies {
cordaCompile "$corda_release_group:corda-core:$corda_release_version"
cordaCompile "$corda_release_group:corda-jackson:$corda_release_version"
cordaCompile "$corda_release_group:corda-rpc:$corda_release_version"
cordaRuntime "$corda_release_group:corda:$corda_release_version"
// Cordapps for Cordform/deployNodes
cordapp project(":corda-testacles-example-cordapp")
cordapp "com.github.manosbatsis.partiture:partiture:$partiture_version"
testImplementation ("$corda_release_group:corda-node-driver:$corda_release_version")
}
cordapp {
targetPlatformVersion corda_platform_version
minimumPlatformVersion 5
contract {
name "Testacles Parent"
vendor "Manos Batsis"
versionId 1
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion corda_platform_version.toInteger()
}
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':corda-testacles-example-cordapp:assemble']) {
nodeDefaults {
projectCordapp {
deploy = false
}
// 4.6 only: runSchemaMigration = true
cordapp project(":corda-testacles-example-cordapp")
cordapp "com.github.manosbatsis.partiture:partiture:$partiture_version"
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
name "O=Notary,L=London,C=GB"
notary = [validating : false]
p2pPort 10002
rpcSettings {
address("localhost:10003")
adminAddress("localhost:10043")
}
cordapps = []
}
node {
name "O=PartyA,L=London,C=GB"
p2pPort 10005
rpcSettings {
address("localhost:10006")
adminAddress("localhost:10046")
}
}
node {
name "O=PartyB,L=New York,C=US"
p2pPort 10008
rpcSettings {
address("localhost:10009")
adminAddress("localhost:10049")
}
}
}