-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
561 lines (511 loc) · 31.4 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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
import org.apache.commons.lang3.SystemUtils
import org.labkey.gradle.plugin.NpmRun
import org.labkey.gradle.task.PurgeNpmAlphaVersions
import org.labkey.gradle.task.ShowDiscrepancies
import org.labkey.gradle.util.BuildUtils
import org.labkey.gradle.util.GroupNames
plugins {
id "com.jfrog.artifactory" version "${artifactoryPluginVersion}" apply false
id "com.github.node-gradle.node" version "${gradleNodePluginVersion}" apply false
id "org.owasp.dependencycheck" version "${owaspDependencyCheckPluginVersion}" apply false
// id "com.github.ben-manes.versions" version "0.39.0"
id "org.labkey.build.multiGit"
id 'org.labkey.versioning' apply false // Need this for our 'base' plugin to get the version specified in settings.gradle
}
allprojects {
if (project.hasProperty('enableOwaspDependencyCheck'))
{
// Comment in to enable the tasks for owasp dependency checking
apply plugin: 'org.owasp.dependencycheck'
dependencyCheck {
outputDirectory = project.rootProject.layout.buildDirectory.file("reports/dependencyCheck/${project.path.replaceAll(':', '_').substring(1)}").get().asFile
suppressionFile = "${project.rootProject.rootDir}/dependencyCheckSuppression.xml"
analyzers {
assemblyEnabled = false // Sets whether the .NET Assembly Analyzer should be used.
nodeEnabled = false // Sets whether the Node.js Analyzer should be used.
nodeAudit {
enabled = false
}
retirejs {
enabled = false
}
}
formats = ['HTML', 'JUNIT']
skipConfigurations = ['dedupe', 'gwtCompileClasspath', 'gwtRuntimeClasspath', 'developmentOnly']
skipProjects = [':server:testAutomation']
if (project.hasProperty('nvdApiKey'))
{
nvd {
apiKey = "${project.property('nvdApiKey')}"
}
}
}
}
if (BuildUtils.shouldPublish(project) || BuildUtils.shouldPublishDistribution(project))
{
apply plugin: 'com.jfrog.artifactory'
}
project.tasks.withType(JavaCompile).configureEach {
JavaCompile compile ->
compile.options.incremental = true // Gradle 3.4
compile.options.encoding = 'UTF-8'
}
}
// We need the tomcat home directory to run UI tests from within IntelliJ.
String tomcatDirProp = System.getenv('CATALINA_HOME') != null ? System.getenv('CATALINA_HOME') : System.properties['tomcat.home']
if (tomcatDirProp != null && !new File(tomcatDirProp).exists())
throw new GradleException("Tomcat home directory ${tomcatDirProp} does not exist.")
allprojects {
// this configuration is needed only in server and testAutomation, but we leave it here (for now) to avoid duplication
configurations
{
driver
utilities
}
configurations.configureEach {
// exclude log4j, which may come in transitively, from all configurations to avoid its potential vulnerabilities
exclude group: "log4j", module:"log4j"
}
configurations.driver.setDescription("Dependencies used for SqlUtils")
configurations.utilities.setDescription("Utility binaries for use on Windows platform")
dependencies
{
//for SqlUtils
driver "org.postgresql:postgresql:${postgresqlDriverVersion}"
driver "com.microsoft.sqlserver:mssql-jdbc:${mssqlJdbcVersion}"
if (SystemUtils.IS_OS_WINDOWS)
{
utilities "org.labkey.tools.windows:utils:${windowsUtilsVersion}@zip"
}
}
// We apply the base module here so we get the configurations (in particular external and modules)
// that can be used for the allDepInsight task below. I would really prefer not to do this here, but
// we'll need to find another solution for allDepInsight (perhaps enumerate projects?)
apply plugin: 'org.labkey.build.base'
tasks.withType(JavaCompile)
.configureEach {
sourceCompatibility = project.ext.sourceCompatibility
targetCompatibility = project.ext.targetCompatibility
}
repositories
{
mavenCentral()
// this if statement is necessary because the TeamCity artifactory plugin overrides
// the repositories but does not use these artifactory_ urls. For others who are
// developing or building, you do need to specify the three artifactory_ properties
// used below.
if (project.hasProperty("artifactory_contextUrl"))
{
maven {
url "${artifactory_contextUrl}/ext-tools-local"
content {
includeGroup "org.labkey.tools.windows"
includeGroup "org.labkey.tools.linux"
includeGroup "org.labkey.tools.osx"
}
}
maven {
url "${artifactory_contextUrl}/libs-release-no-proxy"
if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password'))
{
credentials {
username = artifactory_user
password = artifactory_password
}
authentication {
basic(BasicAuthentication)
}
}
mavenContent {
releasesOnly()
}
}
maven {
url "${artifactory_contextUrl}/libs-snapshot-no-proxy"
if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password'))
{
credentials {
username = artifactory_user
password = artifactory_password
}
authentication {
basic(BasicAuthentication)
}
}
mavenContent {
snapshotsOnly()
}
content {
includeGroup "org.labkey"
includeGroup "org.labkey.api"
includeGroup "org.labkey.module"
includeGroup "org.labkey.build"
}
}
// Temporarily uncomment the block below and update the four-digit number to allow building with Tomcat versions that
// haven't been released yet. The "VOTE" emails sent to the Tomcat dev email list include a staging repo URL. In
// addition to updating the url to match, you'll also need to update apacheTomcatVersion in gradle.properties.
// maven {
// url "https://repository.apache.org/content/repositories/orgapachetomcat-1322/"
// }
maven {
// Mondrian dependencies are available via this repository. It's a direct dependency of the Query
// module but is declared here as many modules depend on Query and therefore need it as well.
url "https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn"
content {
includeGroup "pentaho"
includeGroup "org.pentaho"
includeGroup "org.olap4j"
includeGroup "javacup"
}
}
}
}
configurations.configureEach
{
// Check for updates every build for SNAPSHOT dependencies
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
configurations.configureEach
{Configuration config ->
resolutionStrategy {
// we force this version because we have compilation problems with version 1.9.2 of commons-beanutils, which is the version
// that is brought in by Gradle's conflict resolution as a result of our chosen versions for commons-validator (1.5.0) and commons-digester (1.8.1)
force "commons-beanutils:commons-beanutils:${commonsBeanutilsVersion}"
// we get different versions of slf4j-log4j12 and slf4j-api from different transitive dependencies.
force "org.slf4j:slf4j-log4j12:${slf4jLog4j12Version}"
force "org.slf4j:slf4j-api:${slf4jLog4jApiVersion}"
// force some newer versions than are brought in by mondrian (et al.)
force "xerces:xercesImpl:${xercesImplVersion}"
force "org.apache.logging.log4j:log4j-core:${log4j2Version}"
force "org.apache.logging.log4j:log4j-api:${log4j2Version}"
force "org.apache.logging.log4j:log4j-1.2-api:${log4j2Version}"
// force version for consistency with saml, query, LDK, and pipeline
force "commons-lang:commons-lang:${commonsLangVersion}"
// force version for consistency with workflow, api, SequenceAnalysis
force "org.apache.commons:commons-lang3:${commonsLang3Version}"
force "commons-dbcp:commons-dbcp:${commonsDbcpVersion}"
force "commons-io:commons-io:${commonsIoVersion}"
force "commons-logging:commons-logging:${commonsLoggingVersion}"
force "commons-pool:commons-pool:${commonsPoolVersion}"
// force version for consistency with premium, OpenLdapSync
force "org.apache.commons:commons-text:${commonsTextVersion}"
// force version for consistency with query, saml, LDK, api
force "commons-collections:commons-collections:${commonsCollectionsVersion}"
// force version for ms2, saml, fileTransfer, harvest, api, accounts, docker
force "commons-codec:commons-codec:${commonsCodecVersion}"
// force version consistency in TCRdb, SequenceAnalysis, API
force "org.apache.commons:commons-math3:${commonsMath3Version}"
force "org.reflections:reflections:${reflectionsVersion}"
// force version for cloud, docker, fileTransfer, googledrive, tcrb, wnprc_ehr
force "org.apache.httpcomponents:httpcore:${httpcoreVersion}"
force "org.apache.httpcomponents.core5:httpcore5:${httpcore5Version}"
// force version for cloud, docker, fileTransfer, googledrive, tcrb, wnprc_ehr
force "org.apache.httpcomponents:httpclient:${httpclientVersion}"
force "org.apache.httpcomponents.client5:httpclient5:${httpclient5Version}"
// force version for postgresql jdbc, cloud, docker, fileTransfer, saml, query, GoogleDrive, WNPRC_EHR
force "org.checkerframework:checker-qual:${checkerQualVersion}"
// force version for SequenceAnalysis, api, cloud
force "com.google.guava:guava:${guavaVersion}"
// force version for SequenceAnalysis, TargetedMS
force "com.google.protobuf:protobuf-java:${googleProtocolBufVersion}"
// force Jakarta Activation API version used by our Angus Activation implementation
force "jakarta.activation:jakarta.activation-api:${jakartaActivationApiVersion}"
// force version for accounts, api, query
force "javax.validation:validation-api:${validationApiVersion}"
// force version for accounts, docker, api, workflow
force "com.fasterxml.jackson.core:jackson-annotations:${jacksonAnnotationsVersion}"
// saml and query bring in different versions transitively; we force the later one
force "xalan:xalan:${xalanVersion}"
// genotyping brings in a much older version of this, so we force a newer version for compatibility
force "org.apache.commons:commons-compress:${commonsCompressVersion}"
// Force ant to be a newer version (transitive dependency of query > eigenbase-resgen > eigenbase-xom)
force "org.apache.ant:ant:${antVersion}"
// Transitive dependency of commons-compress -- Transitive dependency com.github.samtools:htsjdk which references an older version
force "org.tukaani:xz:${tukaaniXZVersion}"
// force version for api, LDK, pipeline, query, saml, but not for the xsdDoc configuration, which requires
// an older version for the docflex library we use
if (!config.name.equals('xsdDoc'))
force "xml-apis:xml-apis:${xmlApisVersion}"
// cloud and SequenceAnalysis bring this in as a transitive dependency. We resolve to the later version here to keep things consistent
force "com.google.code.gson:gson:${gsonVersion}"
// Google oauth2-http Library and api-common (via Picard, and perhaps others) bring in different versions; force the latest
force "com.google.auto.value:auto-value-annotations:${googleAutoValueAnnotationsVersion}"
force "com.google.http-client:google-http-client-apache-v2:${googleHttpClientVersion}"
force "com.google.http-client:google-http-client-gson:${googleHttpClientVersion}"
force "com.google.http-client:google-http-client-jackson2:${googleHttpClientVersion}"
// FileTransfer depends on this directly; WNPRC_EHR and GoogleDrive bring a different version in transitively.
force "com.google.oauth-client:google-oauth-client:${googleOauthClientVersion}"
// Google HTTP Client Library and Guava bring in different versions; force the latest
force "com.google.errorprone:error_prone_annotations:${googleErrorProneAnnotationsVersion}"
// Force patched version of GPRC, dependency of a number of Google service APIs in WNPRC and fileTransfer
force "io.grpc:grpc-context:${grpcVersion}"
// TODO Remove these when the Picard version brought in by the SequenceAnalysis module is upgraded to use a version of grpc > 1.60.0
force "io.grpc:grpc-alts:${grpcVersion}"
force "io.grpc:grpc-auth:${grpcVersion}"
force "io.grpc:grpc-core:${grpcVersion}"
force "io.grpc:grpc-googleapis:${grpcVersion}"
force "io.grpc:grpc-grpclb:${grpcVersion}"
force "io.grpc:grpc-netty-shaded:${grpcVersion}"
force "io.grpc:grpc-protobuf:${grpcVersion}"
force "io.grpc:grpc-protobuf-lite:${grpcVersion}"
force "io.grpc:grpc-rls:${grpcVersion}"
force "io.grpc:grpc-services:${grpcVersion}"
force "io.grpc:grpc-stub:${grpcVersion}"
force "io.grpc:grpc-xds:${grpcVersion}"
// workflow (Activiti) brings in older versions of these libraries, so we need to force these versions
force "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
force "com.fasterxml.jackson.core:jackson-databind:${jacksonDatabindVersion}"
// The version of picard we depend on brings in an older version of htsjdk, but SequenceAnalysis depends on a later version
force "com.github.samtools:htsjdk:${htsjdkVersion}"
// This is a dependency for HTSJDK. Force version for CVE-2023-43642
force "org.xerial.snappy:snappy-java:${snappyJavaVersion}"
// Cloud module brings in earlier versions of this library, so we force the later one
force "org.apache.tika:tika-core:${tikaVersion}"
// OpenLDAPSync and premium have transitive dependency on a broken version of MINA
force "org.apache.mina:mina-core:${apacheMinaVersion}"
// saml has transitive dependencies on old versions of batik and xmlgraphics-commons, which conflict with more recent versions in api
force "org.apache.xmlgraphics:batik-css:${batikVersion}"
force "org.apache.xmlgraphics:xmlgraphics-commons:${fopVersion}"
// force consistency in TCRdb, WNPRC
force "org.javassist:javassist:${javassistVersion}"
force "org.jetbrains:annotations:${annotationsVersion}"
// force consistency between API and Java remote API
force "org.json:json:${orgJsonVersion}"
force "org.ow2.asm:asm:${asmVersion}"
// force junit and hamcrest versions to be consistent with what comes from labkey-client-api.
// The hamcrest dependencies come through transitively from jackson, junit, jmock
force "org.hamcrest:hamcrest:${hamcrestVersion}"
force "junit:junit:${junitVersion}"
// force consistency in nlp and saml that bring these in transitively
force "org.codehaus.woodstox:stax2-api:${stax2ApiVersion}"
force "com.fasterxml.woodstox:woodstox-core:${woodstoxCoreVersion}"
// force consistency in docker and connectors, saml, nlp
force "org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}"
// force consistency in docker and connectors and saml
force "org.bouncycastle:bcpkix-jdk18on:${bouncycastleVersion}"
// force consistency with netty jar files for docker and UserReg-WS
force "io.netty:netty-resolver:${nettyVersion}"
force "io.netty:netty-resolver-dns:${nettyVersion}"
force "io.netty:netty-handler:${nettyVersion}"
force "io.netty:netty-handler-proxy:${nettyVersion}"
force "io.netty:netty-buffer:${nettyVersion}"
force "io.netty:netty-transport:${nettyVersion}"
force "io.netty:netty-codec-socks:${nettyVersion}"
force "io.netty:netty-codec:${nettyVersion}"
force "io.netty:netty-common:${nettyVersion}"
force "io.netty:netty-codec-http:${nettyVersion}"
force "io.netty:netty-codec-http2:${nettyVersion}"
force "io.netty:netty-transport-native-epoll:${nettyVersion}"
force "io.netty:netty-transport-native-kqueue:${nettyVersion}"
// Force consistency for dependencies from pipeline and query
force "org.dom4j:dom4j:${dom4jVersion}"
// Force consistency between pipeline's ActiveMQ and cloud's jClouds dependencies
force "javax.annotation:javax.annotation-api:${javaxAnnotationVersion}"
// Force snappy-java version for CVE-2023-43642. Remove once HTSJDK bumps its preferred version.
force "org.xerial.snappy:snappy-java:${snappyJavaVersion}"
// Consistency between cloud, pipeline, and query
force "javax.xml.bind:jaxb-api:${jaxbApiOldVersion}"
// Force consistency for dependencies from cloud
force "joda-time:joda-time:${jodaTimeVersion}"
// Force latest hadoop-hdfs-client for CVE-2021-37404, CVE-2022-25168, CVE-2022-26612, CVE-2021-25642, CVE-2021-33036, CVE-2023-26031
force "org.apache.hadoop:hadoop-hdfs-client:${hadoopHdfsClientVersion}"
dependencySubstitution {
// Because the client api artifact name is not the same as the directory structure, we use
// Gradle's dependency substitution so the dependency will appear correctly in the pom files that
// are generated. Because dependency substitution does not understand the use of classifiers, we cannot
// use this mechanism in general (plus, it's very slow for our many-module build).
if (project.findProject(BuildUtils.getRemoteApiProjectPath(gradle)) && BuildUtils.shouldBuildFromSource(project.project(BuildUtils.getRemoteApiProjectPath(gradle))))
substitute module('org.labkey:labkey-client-api') using project(BuildUtils.getRemoteApiProjectPath(gradle))
// mule and tika bring in different versions of bouncycastle package via transitive dependencies, but these versions
// result in a StackOverflow when starting tomcat so we substitute new libraries for both versions that are brought in.
substitute module('bouncycastle:bcprov-jdk14:138') using module("org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}")
substitute module('bouncycastle:bcmail-jdk14:138') using module("org.bouncycastle:bcpkix-jdk18on:${bouncycastleVersion}")
substitute module('bouncycastle:bcprov-jdk15:1.45') using module("org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}")
substitute module('bouncycastle:bcmail-jdk15:138') using module("org.bouncycastle:bcpkix-jdk18on:${bouncycastleVersion}")
// Docker and SAML are bringing in older -jdk15on versions (more recent versions have been renamed with -jdk18on suffix)
substitute module('org.bouncycastle:bcprov-jdk15on:1.54') using module("org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}")
substitute module('org.bouncycastle:bcprov-jdk15on:1.64') using module("org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}")
substitute module('org.bouncycastle:bcpkix-jdk15on:1.64') using module("org.bouncycastle:bcpkix-jdk18on:${bouncycastleVersion}")
// This JAR packages classes with the same names as commons-logging but forces them to use SLF4J instead
// of the normal routing decisions, and can result in very verbose output to STDOUT
substitute module('org.slf4j:jcl-over-slf4j') using module("commons-logging:commons-logging:${commonsLoggingVersion}")
// jdk5 backport of guava has significant conflicts with guava 18+
substitute module('com.google.guava:guava-jdk5') using module("com.google.guava:guava:${guavaVersion}")
// This library was renamed
substitute module('org.codehaus.woodstox:woodstox-core-asl') using module("com.fasterxml.woodstox:woodstox-core:${woodstoxCoreVersion}")
// Avoid conflicts with declared dependencies on the newer versions from 'net.hydromatic'
substitute module('eigenbase:eigenbase-properties') using module("net.hydromatic:eigenbase-properties:${eigenbasePropertiesVersion}")
substitute module('eigenbase:eigenbase-resgen') using module("net.hydromatic:eigenbase-resgen:${eigenbaseResgenVersion}")
substitute module('eigenbase:eigenbase-xom') using module("net.hydromatic:eigenbase-xom:${eigenbaseXomVersion}")
substitute module('org.hamcrest:hamcrest-core') using module("org.hamcrest:hamcrest:${hamcrestVersion}")
substitute module('org.hamcrest:hamcrest-library') using module("org.hamcrest:hamcrest:${hamcrestVersion}")
}
}
}
}
if (BuildUtils.shouldPublish(project) || BuildUtils.shouldPublishDistribution(project))
{
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = BuildUtils.getRepositoryKey(project)
if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password'))
{
username = artifactory_user
password = artifactory_password
}
}
defaults
{
publishBuildInfo = false
publishPom = true
publishIvy = false
}
}
}
artifactoryPublish.skip = true
}
subprojects {
project.tasks.register("showRepos", DefaultTask) {
task ->
task.group = "Help"
task.description = "Show the list of repositories currently in use."
task.doLast({
repositories.each {
println "repository: ${it.name} (${it.hasProperty("url") ? it.url : it.getDirs()})"
}
})
}
project.tasks.register("showConfigs") {
task ->
task.group = GroupNames.HELP
task.description = "Show all the configurations available in the project and their published artifacts"
task.doLast({
project.configurations.forEach({
Configuration config ->
println(config.name + ": (${config.getDescription()})")
})
})
}
project.tasks.register("allDepInsight", DependencyInsightReportTask) {
DependencyInsightReportTask t ->
t.group = "Help"
t.description = "Displays the insight into a specific dependency across all projects"
t.showingAllVariants=false
}
project.tasks.register("allDependencies", DependencyReportTask) {
task ->
task.group = GroupNames.HELP
task.description = "Displays the dependencies for all projects"
}
}
project.tasks.register("showDiscrepancies", ShowDiscrepancies) {
task ->
task.group = "Help"
task.description = "Report external dependencies that have more than one version referenced in the modules in this build"
}
project.tasks.register('getModulesManifest', DefaultTask) {
task ->
task.group = GroupNames.DISTRIBUTION
task.description = "Creates a csv file with a list of the modules for each distribution. By default it will be " +
"placed in a directory called manifests in the root of this labkey installation. Specify another " +
"directory by using \"-PmanifestDir\". The default file name is distributionModules.csv; specify " +
"another name using \"-PmanifestFileName\"."
task.doLast({
String manifestDir = "${project.getRootProject().getProjectDir()}/manifests"
String manifestFileName = "distributionModules.csv"
if (project.hasProperty("manifestDir"))
{
manifestDir = project.manifestDir
}
if (project.hasProperty("manifestFileName"))
{
manifestFileName = project.manifestFileName
}
project.mkdir(manifestDir)
File manifestFile = project.file("${manifestDir}/${manifestFileName}")
StringBuilder manifestString = new StringBuilder("distribution,moduleName\n")
project.allprojects({ Project sp ->
if (sp.configurations.getNames().contains("distribution"))
{
String distName
if (sp.getName().startsWith("test_"))
{
// This is for the test_*prc case.
distName = sp.getName()
}
else
{
distName = sp.tasks.distribution.hasProperty("subDirName") ?
sp.tasks.distribution.subDirName :
sp.getName()
}
sp.configurations.distribution
.getAllDependencies()
.withType(ProjectDependency)
.each({ dep ->
manifestString.append("${distName},${dep.name}\n")
})
}
})
manifestFile.text = manifestString.toString()
})
}
project.tasks.register('listNpmProjects', DefaultTask) {
task ->
task.group = GroupNames.NPM_RUN
task.description ="List all projects that employ npm in their build"
task.doLast({
List<String> npmProjects = []
project.allprojects({Project p ->
if (p.getPlugins().hasPlugin(NpmRun.class))
npmProjects.add("${p.path} (${NpmRun.useYarn(p) ? 'yarn' : 'npm'})")
})
if (npmProjects.size() == 0)
println("No projects found containing ${NpmRun.NPM_PROJECT_FILE}")
else {
println("The following projects use NPM in their builds:\n\t${npmProjects.join("\n\t")}\n")
}
})
}
project.tasks.register('ijWorkspaceSetup', Copy) {
Copy copy ->
copy.group = "IntelliJ"
copy.description = "Copy the workspace template file. Used only once, for initial setup of the IntelliJ project."
copy.from(".idea/configTemplates/workspace.xml")
copy.into('.idea')
}
project.tasks.register("ijRunConfigurationsSetup", Copy) {
Copy copy ->
copy.group = "IntelliJ"
copy.description = "Copy run configurations from templates, substituting path separators for this OS"
copy.from(".idea/runConfigurations/templates")
copy.into(".idea/runConfigurations")
copy.filter({ String line ->
return line.replace("PATH_SEPARATOR", File.pathSeparator)
})
copy.mustRunAfter(project.tasks.ijCodeSetup)
}
project.tasks.register("ijCodeSetup", Copy) {
Copy copy ->
copy.group = "IntelliJ"
copy.description = "Copy template files from .idea/configTemplates to .idea directory (excluding the workspace.xml file)"
copy.from(".idea/configTemplates")
copy.into(".idea/")
copy.exclude("workspace.xml")
}
project.tasks.register('ijConfigure') {
DefaultTask task ->
task.group = "IntelliJ"
task.description = "Install IntelliJ template files as files for IntelliJ to use in .idea directory"
task.dependsOn(project.tasks.ijCodeSetup)
task.dependsOn(project.tasks.ijRunConfigurationsSetup)
}
project.tasks.register('purgeNpmAlphaVersions', PurgeNpmAlphaVersions) {
group = GroupNames.NPM_RUN
description = "Given an alpha version prefix for npm packages via the property -P${PurgeNpmAlphaVersions.ALPHA_PREFIX_PROPERTY}=yourPrefix, " +
"removes all packages with versions that match that prefix from Artifactory (e.g., @labkey/components-1.2.3-yourPrefix.0 and @labkey/workflow-0.3.4-yourPrefix.1). " +
" Use -PdryRun to see what versions would be deleted without actually doing the deletion."
}