forked from nextflow-io/nextflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
338 lines (287 loc) · 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
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
/*
* Copyright 2020, Seqera Labs
* Copyright 2013-2019, Centre for Genomic Regulation (CRG)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id "io.codearte.nexus-staging" version "0.21.2"
id 'java'
id 'idea'
}
// Add ability to test with upcoming versions of Groovy
def groovyVer = System.getenv('CI_GROOVY_VERSION')
if (groovyVer) {
def repo = groovyVer.startsWith('com.github.apache:') ? 'https://jitpack.io' : 'https://oss.jfrog.org/oss-snapshot-local/'
logger.lifecycle "Overriden Groovy dependency to use $groovyVer - repository: $repo"
allprojects {
repositories {
maven { url repo }
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.codehaus.groovy') {
if( groovyVer.contains(':') )
details.useTarget(groovyVer)
else
details.useVersion(groovyVer)
println ">> Overriding $details.requested with version: $groovyVer"
}
}
}
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'java-test-fixtures'
apply plugin: 'idea'
version = new File('VERSION').text.trim()
group = 'io.nextflow'
sourceCompatibility = 1.8
targetCompatibility = 1.8
idea {
module.inheritOutputDirs = true
}
repositories {
jcenter()
mavenCentral()
maven { url 'https://repo.eclipse.org/content/groups/releases' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
configurations {
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sub:exclude_transitive_dependencies
all*.exclude group: 'org.codehaus.groovy', module: 'groovy-all'
all*.exclude group: 'org.codehaus.groovy', module: 'groovy-cli-picocli'
// groovydoc libs
groovyDoc.extendsFrom runtime
}
dependencies {
// test configuration
testFixturesCompile ("org.codehaus.groovy:groovy-test:2.5.11") { exclude group: 'org.codehaus.groovy' }
testFixturesCompile ("cglib:cglib-nodep:2.2")
testFixturesCompile ("org.objenesis:objenesis:2.1")
testFixturesCompile ("org.spockframework:spock-core:1.3-groovy-2.5") { exclude group: 'org.codehaus.groovy' }
testFixturesCompile 'com.google.jimfs:jimfs:1.1'
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sec:module_replacement
modules {
module("commons-logging:commons-logging") { replacedBy("org.slf4j:jcl-over-slf4j") }
}
// Documentation required libraries
groovyDoc 'org.fusesource.jansi:jansi:1.11'
groovyDoc "org.codehaus.groovy:groovy-groovydoc:2.5.11"
groovyDoc "org.codehaus.groovy:groovy-ant:2.5.11"
}
// this is required due to this IDEA bug
// https://youtrack.jetbrains.com/issue/IDEA-129282
sourceSets {
main {
output.resourcesDir = 'build/classes/main'
}
}
// Disable strict javadoc checks
// See http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
// patched as described here
// http://forums.gradle.org/gradle/topics/gradle_task_groovydoc_failing_with_noclassdeffounderror
tasks.withType(Groovydoc) {
groovyClasspath = project.configurations.groovyDoc
includes = ["nextflow/**"]
}
// Required to run tests on Java 9 and higher in compatibility mode
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
tasks.withType(Test) {
jvmArgs ([
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.nio=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED',
'--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED',
'--add-modules=java.xml.bind,java.activation',
])
}
}
}
// disable jar for root project
jar.enabled = false
/*
* Update the build timestamp in the source source file
*/
task buildInfo { doLast {
def file0 = file('./modules/nextflow/src/main/groovy/nextflow/Const.groovy')
def buildNum = 0
def src = file0.text
src.find(/APP_BUILDNUM *= *([0-9]*)/) { buildNum = it[1]?.toInteger()+1 }
src = src.replaceAll('APP_VER *= *"[0-9a-zA-Z_\\-\\.]+"', "APP_VER = \"${version}\"" as String)
src = src.replaceAll('APP_TIMESTAMP *= *[0-9]*', "APP_TIMESTAMP = ${System.currentTimeMillis()}" as String)
if( buildNum ) {
src = src.replaceAll('APP_BUILDNUM *= *[0-9]*', "APP_BUILDNUM = ${buildNum}" as String)
}
else {
println "WARN: Unable to find current build number"
}
file0.text = src
// -- update 'nextflow' wrapper
file0 = file('nextflow')
src = file0.text
src = src.replaceAll(/NXF_VER\=\$\{NXF_VER:-'.*'\}/, 'NXF_VER=\\${NXF_VER:-\'' + version + '\'}')
file0.text = src
// -- update sphynx
def major = version.split(/\./)[0..1].join('.')
file0 = file('docs/conf.py')
src = file0.text
src = src.replaceAll(/version *= *'[0-9a-zA-Z_\-\.]+'/, "version = '$major'" as String)
src = src.replaceAll(/release *= *'[0-9a-zA-Z_\-\.]+'/, "release = '$version'" as String)
file0.text = src
// -- update dockerfile
file0 = file('docker/Dockerfile')
src = file0.text
src = src.replaceAll(/releases\/v[0-9a-zA-Z_\-\.]+\//, "releases/v$version/" as String)
file0.text = src
}}
/*
* Compile sources and copies all libs to target directory
*/
task compile {
dependsOn buildInfo
dependsOn allprojects.jar
}
def getRuntimeConfigs() {
def names = subprojects
.findAll { prj -> prj.name!='capsule-loader' }
.collect { it.name }
FileCollection result = null
for( def it : names ) {
def cfg = project(it).configurations.getByName('runtime')
if( result==null )
result = cfg
else
result += cfg
// this include the module actual jar file
result = result + cfg.getOutgoing().getArtifacts().getFiles()
}
return result
}
/*
* Save the runtime classpath
*/
task exportClasspath {
dependsOn allprojects.jar
doLast {
def home = System.getProperty('user.home')
def all = getRuntimeConfigs()
def libs = all.collect { File file -> /*println file.canonicalPath.replace(home, '$HOME');*/ file.canonicalPath; }
file('.launch.classpath').text = libs.join(':')
}
}
ext.nexusUsername = project.findProperty('nexusUsername')
ext.nexusPassword = project.findProperty('nexusPassword')
ext.nexusFullName = project.findProperty('nexusFullName')
ext.nexusEmail = project.findProperty('nexusEmail')
// `signing.keyId` property needs to be defined in the `gradle.properties` file
ext.enableSignArchives = project.findProperty('signing.keyId')
ext.deployable = []
ext.deployable << project(':nextflow')
ext.deployable << project(':nf-commons')
ext.deployable << project(':nf-console')
ext.deployable << project(':nf-httpfs')
ext.deployable << project(':nf-ga4gh')
ext.deployable << project(':nf-google')
ext.deployable << project(':nf-amazon')
ext.deployable << project(':nf-tower')
/*
* Maven central deployment
* http://central.sonatype.org/pages/gradle.html
*/
configure(deployable) {
apply plugin: 'maven'
apply plugin: 'signing'
task javadocJar(type: Jar) {
classifier = 'javadoc'
from configurations.groovyDoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: nexusUsername, password: nexusPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: nexusUsername, password: nexusPassword)
}
pom.project {
name 'Nextflow'
packaging 'jar'
// optionally artifactId can be defined here
description 'A DSL modelled around the UNIX pipe concept, that simplifies writing parallel and scalable pipelines in a portable manner'
url 'http://www.nextflow.io'
scm {
connection 'scm:git:https://github.com/nextflow-io/nextflow'
developerConnection 'scm:git:git@github.com:nextflow-io/nextflow.git'
url 'https://github.com/nextflow-io/nextflow'
}
licenses {
license {
name 'Apache 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id nexusUsername
name nexusFullName
email nexusEmail
}
}
}
}
}
}
signArchives.onlyIf { enableSignArchives }
}
task upload {
dependsOn compile
dependsOn deployable.uploadArchives
}
/*
* Configure Nextflow staging plugin -- https://github.com/Codearte/gradle-nexus-staging-plugin
* It adds the tasks
* - closeRepository
* - releaseRepository
* - closeAndReleaseRepository
*/
nexusStaging {
packageGroup = 'io.nextflow'
delayBetweenRetriesInMillis = 10_000
}
if( System.env.BUILD_PACK )
apply from: 'packing.gradle'