forked from FedorSmirnov89/opendse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
245 lines (205 loc) · 6.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
apply plugin: 'base'
apply plugin: 'maven'
apply plugin: 'application'
apply plugin: 'eclipse'
version = 'SNAPSHOT-' + new Date().format("yyyyMMdd")
def stagingURL = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotURL = 'https://oss.sonatype.org/content/repositories/snapshots/'
def descriptions = [
'opendse-generator' : 'The test case generator module of OpenDSE',
'opendse-io' : 'The IO module of OpenDSE',
'opendse-model' : 'The algorithms module of OpenDSE',
'opendse-visualization' : 'The visualization module of OpenDSE',
'opendse-optimization' : 'The optimization module of OpenDSE',
'opendse-tutorial' : 'The tutorial module of OpenDSE',
'opendse-realtime' : 'The real-time module of OpenDSE',
'opendse-encoding' : 'The implementation encoding module of OpenDSE'
]
allprojects {
group = 'net.sf.opendse'
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.2"
}
eclipse {
classpath {
containers 'org.springsource.ide.eclipse.gradle.classpathcontainer'
}
}
version = parent.version
sourceCompatibility = 11
targetCompatibility = 11
task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn:javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
required = { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: stagingURL) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'OpenDSE'
packaging 'jar'
description descriptions[project.name]
url 'http://opendse.sf.net'
scm {
url 'http://hg.code.sf.net/p/opendse/hgroot'
connection 'http://hg.code.sf.net/p/opendse/hgroot'
}
licenses {
license {
name "The MIT License"
url "http://www.opensource.org/licenses/MIT"
distribution 'repo'
}
}
developers {
developer {
id 'lukasiewycz'
name 'Martin Lukasiewycz'
}
}
}
}
}
}
// jacocoTestReport {
// additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
// sourceDirectories = files(sourceSets.main.allSource.srcDirs)
// classDirectories = files(sourceSets.main.output)
// reports {
// html.enabled = true
// xml.enabled = true
// csv.enabled = false
// }
// }
}
/* for now ignore all javadoc errors in case of Java 8 */
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
ext {
dateISO = new Date().format("yyyy-MM-dd")
}
uploadArchives.doFirst {
println "Sonatype Username: "+sonatypeUsername
println "Private Key: "+project.ext.get("signing.secretKeyRingFile")
println "Private Key ID: "+project.ext.get("signing.keyId")
}
mainClassName = 'org.opt4j.core.start.Opt4J'
task fatjar(dependsOn: subprojects.jar, type: Jar) {
destinationDir = new File(project.buildDir, 'fatjar')
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
attributes 'Main-Class': mainClassName
}
}
dependencies {
runtime project(':opendse-model')
runtime project(':opendse-io')
runtime project(':opendse-visualization')
runtime project(':opendse-optimization')
runtime project(':opendse-realtime')
runtime project(':opendse-encoding')
}
jar {
manifest {
attributes 'Main-Class': mainClassName
}
}
task alldocs(type: Javadoc) {
title = "OpenDSE $version Project API Documentation"
destinationDir = new File(project.buildDir, 'docs/javadoc')
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
options.links 'http://docs.oracle.com/javase/6/docs/api/','http://google-guice.googlecode.com/svn/tags/3.0/javadoc/','http://opt4j.sourceforge.net/javadoc/3.1.1/'
options.linkSource = true
subprojects.each {subproject ->
source subproject.sourceSets.main.java
}
subprojects.each { subproject ->
if( classpath ) {
classpath += subproject.sourceSets.main.output + subproject.sourceSets.main.compileClasspath
} else {
classpath = subproject.sourceSets.main.output + subproject.sourceSets.main.compileClasspath
}
}
}
import org.apache.tools.ant.filters.ReplaceTokens
task copyWebsite(type: Copy, dependsOn: getTasksByName('copyWebsite', true)){
from('src/main/website/') {
include '**/*.html'
filter(ReplaceTokens, tokens: [version : project.version, date : project.dateISO])
}
from('src/main/website/') {
exclude '**/*.html'
}
subprojects.each { subproject ->
from new File(subproject.buildDir, 'website')
}
into 'build/website/'
}
task copyJavadoc(type: Copy, dependsOn: alldocs){
from new File(project.buildDir, 'docs/javadoc')
into 'build/website/javadoc/'+version
}
task website(dependsOn: [copyWebsite, copyJavadoc]) {}
task release(dependsOn: [fatjar,website] ){}
//task wrapper(type: Wrapper) {
// gradleVersion = '4.4.1'
//}
//task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
// dependsOn = subprojects.test
// additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
// sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
// classDirectories = files(subprojects.sourceSets.main.output)
// executionData = files(subprojects.jacocoTestReport.executionData)
// reports {
// html.enabled = true
// xml.enabled = true
// csv.enabled = false
// }
// onlyIf = {
// true
// }
// doFirst {
// executionData = files(executionData.findAll {
// it.exists()
// })
// }
// afterEvaluate {
// classDirectories = files(classDirectories.files.collect {
// fileTree(dir: it, exclude: ['ptolemy/**', 'org/opt4j/tutorial/**', 'org/opt4j/viewer/**', 'org/opt4j/core/config/visualization/**'])
// })
// }
//}