-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
244 lines (213 loc) · 5.7 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
/*
Project JaCaMo web
Gradle build file for JaCaMo Applications
October 15, 2019
*/
plugins {
id "java-library"
id "eclipse"
id "maven-publish"
id "com.github.johnrengelman.shadow" version "5.2.0"
id "com.github.node-gradle.node" version "2.2.0"
}
defaultTasks 'run'
group 'org.jacamo'
version '0.5'
repositories {
mavenCentral()
maven { url "https://raw.githubusercontent.com/jacamo-lang/mvn-repo/master" }
flatDir {
dirs 'lib'
}
}
dependencies {
implementation 'org.jacamo:jacamo:0.10-SNAPSHOT'
implementation 'org.jacamo:jacamo-rest:0.5'
//websockets for simulations
implementation 'javax.websocket:javax.websocket-api:1.1'
implementation 'org.glassfish.tyrus:tyrus-server:1.1'
implementation 'org.glassfish.tyrus:tyrus-container-grizzly:1.1'
// https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.6.0.201912101111-r'
// https://mvnrepository.com/artifact/net.openhft/compiler
implementation 'net.openhft:compiler:2.3.1'
testImplementation group: 'junit', name: 'junit', version: '4.12'
}
sourceSets {
env {
java {
srcDir 'src/env'
}
}
main {
resources {
srcDir 'src/agt'
srcDir 'src/org'
srcDir 'src/resources'
}
}
}
/*
*
* JaCaMo projects for lauch configuration and tests
*
*/
task run (type: JavaExec, dependsOn: 'classes') {
group ' JaCaMo'
description 'runs the JaCaMo platform'
doFirst {
mkdir 'log'
}
main 'jacamo.infra.JaCaMoLauncher'
args 'src/jcm/main.jcm'
classpath sourceSets.main.runtimeClasspath
}
task fixTab {
ant.fixcrlf(eol: 'lf', includes: '**/*.txt,**/*.bat, **/*.adoc', srcdir: '.')
ant.fixcrlf(tab: 'remove', tablength: '4', javafiles: 'true', includes: '**/*.java,**/*.xml', srcdir: 'src')
ant.fixcrlf(tab: 'remove', tablength: '4', javafiles: 'true', includes: '**/*.java,**/*.xml,**/*.asl,**/*.jcm', srcdir: '.')
//ant.fixcrlf(tab: 'remove', tablength: '4', javafiles: 'true', includes: '**/*.java,**/*.xml,**/*.asl,**/*.jcm,**/*.txt', srcdir: 'doc')
}
jar {
baseName 'jacamo-web'
manifest {
attributes(
'Class-Path': configurations.compileClasspath.collect { it.getName() }.join(' '),
'Main-Class': 'jacamo.infra.JaCaMoLauncher',
'args': 'src/jcm/main.jcm'
)
}
}
/*
*
* Java Docs
*
*/
// the following lines is used to avoid errors while generating javadoc
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
task javadocJar (type: Jar, dependsOn: javadoc) {
baseName 'jacamo-web'
classifier = 'javadoc'
from '${docsDir}/../../doc/api'
}
/*
*
* Maven publication
*
*/
task sourceJar (type : Jar) {
baseName 'jacamo-web'
classifier = 'sources'
from sourceSets.main.allSource
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact sourceJar
artifact javadocJar
artifactId 'jacamo-web'
}
}
}
// transfer local maven artifact to our maven2 repository at github
task publishMavenGitHub(dependsOn: [ 'build', 'publishToMavenLocal']) {
doLast {
def wdir = System.getProperty("user.home")+'/.m2/repository/org/jacamo/jacamo-web'
def rdir = System.getProperty("user.home")+'/pro/jacamo-mvn-repo'
exec {
commandLine 'git', 'pull'
workingDir rdir
}
copy {
from wdir
into rdir + '/org/jacamo/jacamo-web'
}
exec {
commandLine 'git', 'add', '*'
workingDir rdir
}
exec {
commandLine 'git', 'commit', '-a', '-m', 'new version of jacamo web '+project.version
workingDir rdir
}
exec {
commandLine 'git', 'push'
workingDir rdir
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
/*
*
* NPM test javascripts
*
*/
node {
/* gradle-node-plugin configuration
https://github.com/srs/gradle-node-plugin/blob/master/docs/node.md
Task name pattern:
./gradlew npm_<command> Executes an NPM command.
*/
// Version of node to use.
version = '14.17.5'
// Version of yarn to use.
yarnVersion = '1.22.5'
// If true, it will download node using above parameters.
// If false, it will try to use globally installed node.
download = true
}
String testsExecutedMarkerName = "${projectDir}/.tests.executed"
task testYarn(type: YarnTask, dependsOn: 'yarn') {
dependsOn assemble
// force Jest test runner to execute tests once and finish the process instead of starting watch mode
environment CI: 'true'
args = ['run', 'test']
inputs.files fileTree('src/js')
inputs.file 'yarn.lock'
// allows easy triggering re-tests
doLast {
new File(testsExecutedMarkerName).text = 'delete this file to force re-execution JavaScript tests'
}
outputs.file testsExecutedMarkerName
}
check.dependsOn testYarn
task buildYarn(type: YarnTask, dependsOn: 'yarn') {
dependsOn assemble
// force Jest test runner to execute tests once and finish the process instead of starting watch mode
environment CI: 'true'
args = ['run', 'build']
inputs.files fileTree('src/js')
inputs.file 'yarn.lock'
}
build.dependsOn buildYarn
/*
*
* Compile javascript if bundle does not exists
*
*/
if ( !file("src/resources/js/jacamoweb.js").exists() ) {
allprojects {
tasks.shadowJar.dependsOn tasks.build
tasks.run.dependsOn tasks.build
}
}
/*
*
* Clean compiled files
*
*/
clean {
delete 'bin'
delete 'build'
delete 'log'
delete testsExecutedMarkerName /*Used on testYarn*/
}