-
Notifications
You must be signed in to change notification settings - Fork 101
/
build.gradle
266 lines (242 loc) · 7.38 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
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.ZoneOffset
import java.time.ZonedDateTime
plugins {
id 'java'
id 'distribution'
id 'maven-publish'
id 'idea'
}
defaultTasks 'build'
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDir 'src'
exclude '**/*Test*.java'
}
}
runner {
java {
srcDir 'src'
include '**/tools/launcher/**'
}
}
test {
java {
srcDir 'src'
include '**/*Test*.java'
}
}
}
dependencies {
implementation 'org.mozilla:rhino:1.7.14'
implementation 'org.eclipse.jetty:jetty-server:11.0.17'
implementation 'org.eclipse.jetty:jetty-servlet:11.0.17'
implementation 'org.eclipse.jetty.websocket:websocket-jetty-server:11.0.17'
implementation 'org.eclipse.jetty.websocket:websocket-jetty-client:11.0.17'
implementation 'org.eclipse.jetty:jetty-servlets:11.0.17'
implementation 'org.eclipse.jetty:jetty-xml:11.0.17'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.20.0'
implementation 'org.jline:jline:3.21.0'
implementation('org.slf4j:slf4j-api') {
version {
strictly '1.7.36'
}
}
testImplementation 'junit:junit:4.13.2'
}
tasks.withType(JavaCompile) {
options.deprecation true
if (JavaVersion.current().isJava9Compatible()) {
options.compilerArgs.addAll(['--release', '8'])
}
}
task copyDependencies(type: Copy) {
from configurations.runtimeClasspath
into './lib/'
}
task modules(type: Jar) {
from('modules')
into('modules')
destinationDirectory = file('lib')
archiveFileName = 'ringo-modules.jar'
}
task runner(type: Jar) {
from sourceSets.runner.output
destinationDirectory = project.projectDir
archiveFileName = 'run.jar'
manifest {
attributes (
'Main-Class': 'org.ringojs.tools.launcher.Main'
)
}
}
task testModules(type: JavaExec) {
dependsOn copyDependencies, jar
classpath = sourceSets.main.runtimeClasspath
mainClass = 'org.ringojs.tools.launcher.Main'
args 'test/all.js'
shouldRunAfter test
}
task testDatesModule(type: DatesTestTask) {
dependsOn copyDependencies, jar
classpath = sourceSets.main.runtimeClasspath
mainClass = 'org.ringojs.tools.launcher.Main'
args 'test/ringo/utils/dates_test.js'
}
jar {
destinationDirectory = file('./lib')
archiveFileName = 'ringo-core.jar'
from('src') {
includes = ['**/*.html']
excludes = ['**/package.html']
}
}
javadoc {
destinationDir = file('./docs/java')
options.addStringOption('doctitle', "RingoJS Java API v${project.version}");
if (JavaVersion.current().isJava9Compatible() && !JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_13)) {
options.addBooleanOption('html5', true)
options.addBooleanOption('-no-module-directories', true)
options.addStringOption('sourcepath', 'src')
}
options.addBooleanOption('version', true);
}
test {
finalizedBy testModules
}
clean {
delete fileTree('lib').matching {
include '*.jar'
}
delete 'lib/ivy'
delete 'run.jar'
delete 'docs/java'
}
distributions {
main {
distributionBaseName = 'ringojs'
def binaries = ["bin/ringo", "bin/ringo-admin", "bin/ringo-web"]
def excludeFiles = [
'bin/rp', 'bin/rp.*',
'packages/*/**', 'build',
'*.zip', '*.o', '*.tar', '*.tar.gz', '.*/**', '*.iml', '*.xml', '*.patch'
]
contents {
includeEmptyDirs = true
duplicatesStrategy = 'exclude'
from(binaries) {
fileMode 0755
into "bin"
}
from(projectDir) {
exclude excludeFiles
}
from jar
from runner
from modules
from(javadoc) {
into 'docs/java'
}
}
}
}
assemble.dependsOn(modules, runner)
distZip {
dependsOn clean, copyDependencies
}
distTar {
dependsOn clean, copyDependencies
compression Compression.GZIP
archiveExtension = 'tar.gz'
}
task dist(type: Task, dependsOn: [distZip, distTar]) {
description = "Builds the release zip and tar files."
}
publishing {
publications {
maven(MavenPublication) {
groupId = "${project.groupId}"
artifactId = "${project.artifactId}"
from components.java
pom {
name = "${project.name}"
description = "${project.description}"
url = "${project.url}"
packaging = 'jar'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'hns'
name = 'Hannes Wallnöfer'
url = 'https://github.com/ringo/ringojs/commits/master?author=hns'
}
developer {
id = 'oberhamsi'
name = 'Simon Oberhammer'
url = 'https://github.com/ringo/ringojs/commits/master?author=oberhamsi'
}
developer {
id = 'botic'
name = 'Philipp Naderer-Puiu'
url = 'https://github.com/ringo/ringojs/commits/master?author=botic'
}
developer {
id = 'grob'
name = 'Robert Gaggl'
url = 'https://github.com/ringo/ringojs/commits/master?author=grob'
}
}
scm {
connection = 'scm:git:[email protected]:ringo/ringojs.git'
developerConnection = 'scm:git:[email protected]:ringo/ringojs.git'
url = 'https://github.com/ringo/ringojs'
}
issueManagement {
system = 'GitHub Issues'
url = 'https://github.com/ringo/ringojs/issues'
}
}
}
}
repositories {
maven {
name = 'myTestRepo'
url = "file://${buildDir}/testrepo"
}
}
}
class DatesTestTask extends JavaExec {
@TaskAction
void exec() {
LocalDateTime localDateTime = LocalDateTime.now()
ZoneId.getAvailableZoneIds()
.toArray()
.stream()
.map({id ->
ZoneId zoneId = ZoneId.of(id);
ZonedDateTime zonedDateTime = localDateTime.atZone(zoneId);
ZoneOffset zoneOffset = zonedDateTime.getOffset();
return zoneOffset.getId().replaceAll("Z", "+00:00")
})
.distinct()
.sorted()
.forEach({offset ->
String timeZone = "GMT${offset}"
logger.quiet("Testing ringo/utils/dates in timezone {} …", timeZone)
systemProperty("user.timezone", timeZone);
super.exec()
})
}
}