-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
288 lines (253 loc) · 10.6 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
buildscript {
ext {
corda_release_group = 'net.corda'
corda_release_version = '4.6'
corda_gradle_plugins_version = '5.0.11'
corda_platform_version = '8'
tokens_release_version = '1.1'
tokens_release_group = 'com.r3.corda.lib.tokens'
accounts_release_group = 'com.r3.corda.lib.accounts'
accounts_release_version = '1.0'
confidential_id_release_group = 'com.r3.corda.lib.ci'
confidential_id_release_version = '1.0'
dokka_version = '0.9.18'
jackson_version = '2.9.7'
junitVersion = '5.3.2'
junit_jupiter_version = '5.3.2'
kotlin_version = '1.2.71'
kotlintest_version = '3.1.10'
kotlinpoet_version = '1.5.0'
kotlinutils_version = '0.30'
vaultaire_version = '0.46'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases' }
}
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"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_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"
}
apply plugin: 'io.codearte.nexus-staging'
nexusStaging {
packageGroup = 'com.github.manosbatsis.corda.leanstate'
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
allprojects {
apply from: "${rootProject.projectDir}/repositories.gradle"
apply plugin: 'idea'
configurations {
// Adding a configuration that extends existing configuration:
//(testCompile was added by the java plugin)
integrationTestCompile.extendsFrom(testCompile)
all {
// Exclude old Junit since we use jupiter
exclude group: 'junit', module: 'junit'
// 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'
resolutionStrategy {
// Force dependencies to use the same version of Guava as Corda.
force "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
force "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
force "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
}
}
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
tasks.withType(JavaCompile) {
options.compilerArgs << "-parameters" // Required by Corda's serialisation framework.
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
jvmTarget = "1.8"
javaParameters = true // Useful for reflection.
freeCompilerArgs = ["-Xjsr305=strict", "-java-parameters"]
}
}
tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) {
skipDeprecated = true
apiVersion = "1.2"
// Disable linking to online JDK documentation
noJdkLink = true
noStdlibLink=true
}
test {
useJUnitPlatform {
includeEngines 'junit-jupiter'
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
exclude '**/*IntegrationTest.class'
}
}
// Run integration tests using junit5
task integrationTest(type: Test) {
useJUnitPlatform {
includeEngines 'junit-jupiter'
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
include '**/*IT.class', '**/*DriverTests.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-params:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
}
// convenient report on all dependencies
task allDeps(type: DependencyReportTask) {}
configurations {
all {
// Exclude old Junit since we use jupiter
exclude group: 'junit', module: 'junit'
// 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'
resolutionStrategy {
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
}
}
}
}
}
}
configure([project(':leanstate-contracts'),
project(':leanstate-processor')]) {
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
task dokkaForGhPages(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputDirectory = "$rootDir/docs/0.x"
outputFormat = "gfm"
inputs.dir 'src/main/kotlin'
}
dokka {
outputFormat = 'javadoc'
outputDirectory = javadoc.destinationDir
linkMapping {
dir = "src/main/kotlin"
url = "https://github.com/manosbatsis/corda-lean-state/tree/master/${project.name}/src/main/kotlin/"
suffix = "#L"
}
}
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 {
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 LeanState: Generate Corda contract and persistent states from a simplified interface'
url 'https://manosbatsis.github.io/corda-lean-state/'
scm {
connection 'scm:git:git://github.com/manosbatsis/corda-lean-state.git'
developerConnection 'scm:git:ssh://github.com/manosbatsis/corda-lean-state.git'
url 'http://github.com/manosbatsis/corda-lean-state/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]'
}
}
}
}
}
}
}
}