forked from fsist/safepickle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
186 lines (146 loc) · 5.46 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
task wrapper(type: Wrapper) {
gradleVersion = '2.2.1'
}
allprojects {
group = 'com.fsist'
version = '1.0.9'
apply plugin: 'scala'
apply plugin: 'maven'
apply plugin: 'signing'
defaultTasks 'compileScala', 'compileTestScala'
// Can't set targetCompatibility (i.e. JDK level) to 1.7 or above because of https://issues.scala-lang.org/browse/SI-8645
// Which was due to JDK bug https://bugs.openjdk.java.net/browse/JDK-8046233 which was fixed in JDK 7u76 / 8u25 (but we don't have those new versions yet)
compileScala.sourceCompatibility = '1.6'
compileScala.targetCompatibility = '1.6'
compileScala.scalaCompileOptions.deprecation = true
compileScala.scalaCompileOptions.failOnError = true
compileScala.scalaCompileOptions.unchecked = true
compileScala.scalaCompileOptions.additionalParameters = ['-feature']
repositories {
mavenCentral()
}
dependencies {
compile 'org.scala-lang:scala-library:2.11.7'
compile 'org.scala-lang:scala-reflect:2.11.7'
compile 'org.scala-lang:scala-compiler:2.11.7'
compile 'com.typesafe.scala-logging:scala-logging_2.11:3.1.0'
compile 'commons-codec:commons-codec:1.10' // For base64
testCompile 'ch.qos.logback:logback-classic:1.1.2'
testCompile 'org.scalatest:scalatest_2.11:2.2.1'
testCompile 'org.pegdown:pegdown:1.4.2'
}
project.archivesBaseName = project.name + "_2.11"
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task scaladocJar(type: Jar, dependsOn: scaladoc) {
classifier = 'javadoc'
from scaladoc.destinationDir
}
task testJar(type: Jar, dependsOn: compileTestScala) {
from compileTestScala.destinationDir
appendix 'test' // Names the jar
}
signing {
sign jar
sign sourcesJar
sign scaladocJar
}
artifacts {
archives jar
archives sourcesJar
archives scaladocJar
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
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)
}
pom.project {
name 'safepickle'
artifactId = project.name + '_2.11'
packaging 'jar'
description 'A small Scala pickling library.'
url 'https://github.com/fsist/safepickle'
scm {
connection 'scm:git:[email protected]:fsist/safepickle.git'
developerConnection '[email protected]:fsist/safepickle.git'
url 'https://github.com/fsist/safepickle'
}
organization {
name = 'Sentrix'
url = 'http://www.sentrix.com/'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'danarmak'
name 'Daniel Armak'
email '[email protected]'
}
}
}
}
}
}
task scalatest(type: JavaExec, dependsOn: [ compileTestScala, testJar] ) {
main 'org.scalatest.tools.Runner'
classpath compileTestScala.classpath
classpath testJar.archivePath
args = [ '-o', '-w', 'com.fsist.safepickle', '-h', 'test-output-html', '-R', testJar.archivePath ]
}
}
/* Tests for all projects, at once */
// Merge all test classes in a single JAR, allowing the ScalaTest runner to discover them all in one run
task scalatestallJar(type: Jar) {
baseName 'scalatestall'
destinationDir project.buildDir
for (prj in allprojects) {
from prj.compileTestScala.destinationDir
from "${prj.projectDir}/src/test/resources"
}
exclude 'logback.xml'
exclude 'application.conf'
}
for (prj in allprojects) {
scalatestallJar.dependsOn(prj.compileTestScala)
}
clean << {
delete 'test-output-xml'
delete 'test-output-html'
}
task scalatestall(type: JavaExec, dependsOn: scalatestallJar) {
// maxHeapSize '4096M'
main 'org.scalatest.tools.Runner'
for (prj in allprojects) {
classpath prj.compileScala.classpath
classpath prj.compileTestScala.classpath // Which also includes the compileScala jar
classpath prj.compileTestScala.destinationDir // For access to resource files without going through class loaders
}
classpath scalatestallJar.archivePath
args = [ '-o', '-w', 'com.fsist.safepickle', '-u', 'test-output-xml', '-h', 'test-output-html', '-R', scalatestallJar.archivePath ]
}
// Declares an inter-project dependency that includes the compileTestScala configuration,
// so test code in one project can depend on test code in another.
def dependOnProject(srcproj, targetPath) {
srcproj.dependencies {
compile project(targetPath)
testCompile project(path: targetPath, configuration: 'testCompile')
testCompile files(project(targetPath).tasks.compileTestScala.destinationDir)
// IntelliJ doesn't seem to understand exported test deps, so we add the test deps of the target project explicitly:
testCompile project(targetPath).configurations.getByName('testCompile').allDependencies
}
srcproj.compileTestScala.dependsOn("$targetPath:compileTestScala")
// srcproj.distConfig.from targetproj.file('src/main/resources')
}