-
Notifications
You must be signed in to change notification settings - Fork 62
/
build.gradle
131 lines (109 loc) · 3.98 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
plugins {
id 'com.github.hierynomus.license' version '0.15.0' apply false
id 'com.github.johnrengelman.shadow' version '4.0.3' apply false
id 'com.github.alisiikh.scalastyle_2.12' version '2.1.0' apply false
id 'me.champeau.gradle.jmh' version '0.4.8' apply false
id "ch.kk7.spawn" version "1.0.20180924200750" apply false
}
apply from: 'build.params.gradle'
apply plugin: 'base'
allprojects {
group = 'org.opencypher'
version = ver.self
}
apply from: 'build.licenses.gradle'
subprojects {
apply plugin: 'scala'
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile group: 'org.scala-lang', name: 'scala-library', version: ver.scala.full
// Seems we need to lock these down, otherwise we get runtime errors on reflection
compile group: 'org.scala-lang', name: 'scala-reflect', version: ver.scala.full
compile group: 'org.scala-lang', name: 'scala-compiler', version: ver.scala.full
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: ver.log4j.main
compile group: 'org.apache.logging.log4j', name: "log4j-api-scala".scala(), version: ver.log4j.scala
testCompile group: 'org.apache.logging.log4j', name: 'log4j-core', version: ver.log4j.main
testCompile group: 'org.scalatest', name: "scalatest".scala(), version: ver.scalatest
testCompile group: 'org.scalacheck', name: "scalacheck".scala(), version: ver.scalacheck
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: ver.junit.runner
}
test {
useJUnit()
}
ext.scalacParameters = [
"-target:jvm-$ver.jvm".toString(),
'-unchecked',
'-deprecation',
'-feature',
'-Xfatal-warnings',
'-Xfuture',
'-Ypartial-unification',
'-Ywarn-adapted-args'
]
tasks.withType(ScalaCompile) {
options.encoding = 'UTF-8'
scalaCompileOptions.additionalParameters = scalacParameters
}
tasks.withType(ScalaDoc) {
scalaDocOptions.additionalParameters = scalacParameters
}
task sourceJar(type: Jar) {
classifier = 'sources'
from(sourceSets.main.allSource)
}
task docJar(type: Jar) {
dependsOn tasks.scaladoc
classifier = 'javadoc'
from(tasks.scaladoc.destinationDir)
}
task testJar(type: Jar) {
classifier = 'tests'
from(sourceSets.test.output)
}
tasks.withType(Jar) {
from(tasks.generateLicensesFiles) {
into("META-INF/")
}
}
task licenseFile {
outputs.file(project.parent.file('LICENSE.txt'))
}
task dependencySearch(type: DependencyInsightReportTask) {
description 'Searches all projects for a dependency'
group 'help'
}
task runApp {
dependsOn tasks.classes
group 'run'
description 'Run a custom Scala app (use -PmainClass=com.my.package.App)'
doLast {
javaexec {
classpath = sourceSets.main.runtimeClasspath
main = project.getProperty("mainClass")
}
}
}
// copied from https://stackoverflow.com/a/38058671/568723
task depSize {
description 'Lists all dependencies sorted by their size'
doLast {
final formatStr = "%,10.2f"
final conf = configurations.default
final size = conf.collect { it.length() / (1024 * 1024) }.sum()
final out = new StringBuffer()
out << 'Total dependencies size:'.padRight(45)
out << "${String.format(formatStr, size)} Mb\n\n"
conf.sort { -it.length() }
.each {
out << "${it.name}".padRight(45)
out << "${String.format(formatStr, (it.length() / 1024))} kb\n"
}
println(out)
}
}
}
apply from: 'build.publishing.gradle'
apply from: 'build.style.gradle'