forked from geogebra/giac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.gradle
272 lines (232 loc) · 9.49 KB
/
deploy.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
267
268
269
270
271
// GeoGebra Deployment
// Copyright (c) 2015-2017 The GeoGebra Group
// All rights reserved
// @author Zoltan Kovacs <zoltan@geogebra.org>
ext.workspaceUrl = 'https://deploy.geogebra.org/job/GeoGebra-build/ws/'
ext.macServerSvnCommand = '/usr/local/bin/svn'
// To sign the .jar files
// Remote file copying and remote execution (via ssh)
ext.compileLinux32JavagiacKey = file(System.env.LINUX32_SSH ?: '/dev/null')
ssh.settings {
knownHosts = allowAnyHosts
}
def ggMavenRepoUrl = 'scp://dev.geogebra.org:22077/var/www/maven2'
def ggMavenRepoUser = System.env.MAVEN_USR
def ggMavenRepoPass = System.env.MAVEN_PSW
def distDir = "$buildDir/distributions"
def javagiacDir = file("$distDir/javagiac/")
def ggbGiacJsDir = file("$distDir/giac.js/")
remotes {
compileLinux32Server {
host = 'ggb1.idm.jku.at'
port = 2299
user = 'kovzol' // TODO: use a more general account
identity = compileLinux32JavagiacKey
}
macServer {
host = '140.78.116.142'
port = 22
user = System.env.MAC_USR
password = System.env.MAC_PSW
}
}
task javagiacWin32Jar (dependsOn: ':javagiacWin32SharedLibrary', type: Jar) {
description 'Create the Windows 32 bit .jar package for the Java Giac library.'
baseName = 'javagiac-win32'
destinationDir = javagiacDir
from "${buildDir}/libs/javagiac/shared/win32"
include '*.dll'
classifier 'natives-windows-i586'
}
// Unsure if this is needed or not. Otherwise there is no .pom file for Java Giac (which is probably a problem).
task javagiacPomJar (type: Jar) {
description 'Creates empty .jar package for the Java Giac library.'
baseName = 'javagiac'
destinationDir = javagiacDir
}
task testJavagiacWin32 (dependsOn: 'javagiacWin32Jar') {
description 'Tests the Windows 32 bit version of Java Giac. [incubating]'
}
task javagiacWin64Jar (dependsOn: ':javagiacWin64SharedLibrary', type: Jar) {
description 'Creates the Windows 64 bit .jar package for the Java Giac library.'
baseName = 'javagiac-win64'
destinationDir = javagiacDir
from "${buildDir}/libs/javagiac/shared/win64"
include '*.dll'
rename 'javagiac.dll', 'javagiac64.dll'
classifier 'natives-windows-amd64'
}
task testJavagiacWin64 (dependsOn: 'javagiacWin64Jar') {
description 'Tests the Windows 64 bit version of Java Giac. [incubating]'
}
task javagiacLinux64Jar (dependsOn: 'javagiacLinux64SharedLibrary', type: Jar) {
description 'Creates the Linux 64 bit .jar package for the Java Giac library.'
baseName = 'javagiac-linux64'
destinationDir = javagiacDir
from "${buildDir}/libs/javagiac/shared/linux64"
include '*.so'
rename 'libjavagiac.so', 'libjavagiac64.so'
classifier 'natives-linux-amd64'
}
task testJavagiacLinux64 (dependsOn: 'javagiacLinux64Jar') {
description 'Tests the Linux 64 bit version of Java Giac. [incubating]'
}
task javagiacLinux32Jar (dependsOn: 'compileLinux32MacJavagiacRemotely', type: Jar) {
description 'Creates the Linux 32 bit .jar package for the Java Giac library.'
baseName = 'javagiac-linux32'
destinationDir = javagiacDir
from "${buildDir}/libs/javagiac/shared/linux32" // FIXME: unify
include '*.so'
classifier 'natives-linux-i586'
}
task javagiacMacJar (dependsOn: 'compileLinux32MacJavagiacRemotely', type: Jar) {
description 'Creates the Linux 32 bit .jar package for the Java Giac library.'
baseName = 'javagiac-mac'
destinationDir = javagiacDir
from "${buildDir}/binaries/javagiacSharedLibrary/osx_amd64" // FIXME: unify
include '*.jnilib'
classifier 'natives-macosx-universal'
}
task testJavagiacLinux32 (dependsOn: 'javagiacLinux32Jar') {
description 'Tests the Linux 32 bit version of Java Giac. [incubating]'
}
task testJavagiacMac (dependsOn: 'javagiacMacJar') {
description 'Tests the Mac version of Java Giac. [incubating]'
}
task testJavagiacAndroidArm (dependsOn: 'javagiacAndroideabiSharedLibrary') {
description 'Tests the Android ARM version of Java Giac. [incubating]'
}
task testJavagiacAndroidX86 (dependsOn: 'javagiacAndroidx86SharedLibrary') {
description 'Tests the Android x86 version of Java Giac. [incubating]'
}
task testJavagiac (dependsOn: ['testJavagiacLinux64', 'testJavagiacLinux32',
'testJavagiacWin32', 'testJavagiacWin64', 'testJavagiacMac', 'testJavagiacAndroidArm', 'testJavagiacAndroidX86']) {
description 'Tests the Linux, Windows, Mac and Android versions of the Java Giac library. [incubating]'
}
task compileLinux32MacJavagiacRemotely () {
description 'Compiles the Linux 32 bit and Mac versions of the Java Giac library remotely (parallel).'
def outputLinux32Dir = "${buildDir}/libs/javagiac/shared/linux32" // FIXME: unify
def outputMacDir = "${buildDir}/binaries/javagiacSharedLibrary/osx_amd64" // FIXME: unify
def outputLinux32 = "$outputLinux32Dir/libjavagiac.so"
def outputMac = "$outputMacDir/libjavagiac.jnilib"
// outputs.file output // be never UP-TO-DATE
doLast {
ssh.run {
// session(remotes.compileLinux32Server) {
// execute "cd giac; svn update -r$ggrev --non-interactive --trust-server-cert"
// execute "cd giac; ./gradlew javagiacLinux32SharedLibrary -Prevision=$ggrev"
// file(outputLinux32Dir).mkdirs()
// get from: "giac/build/libs/javagiac/shared/linux32/libjavagiac.so", into: outputLinux32 // FIXME: unify
// }
session(remotes.macServer) {
execute "cd giac; $macServerSvnCommand update -r$ggrev --non-interactive --trust-server-cert"
execute "cd giac; export ANDROID_SDK_ROOT=~/.android-sdk/; ./gradlew javagiacOsx_amd64SharedLibrary -Prevision=$ggrev"
file(outputMacDir).mkdirs()
get from: "giac/build/binaries/javagiacSharedLibrary/osx_amd64/libjavagiac.jnilib", into: outputMac // FIXME: unify
}
}
}
}
task javagiacJars (dependsOn: ['javagiacMacJar', 'javagiacLinux32Jar', 'javagiacLinux64Jar',
'javagiacWin32Jar', 'javagiacWin64Jar']) {
description 'Creates the native .jar files for Windows, Linux and Mac for Java Giac.'
}
task testGiacJs (dependsOn: ['createGiacJs']) {
description 'Tests Javascript version of Giac. [incubating]'
}
task testGiac (dependsOn: ['testJavagiac', 'testGiacJs']) {
description 'Tests Giac. [incubating]'
}
/* Publications */
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'javagiac'
groupId = 'fr.ujf-grenoble'
version = ggrev
artifact javagiacLinux64Jar
artifact javagiacLinux32Jar
artifact javagiacWin64Jar
artifact javagiacWin32Jar
artifact javagiacMacJar
artifact javagiacPomJar
pom {
name = 'Java Giac'
description = 'Java Giac for GeoGebra'
}
}
mavenZip(MavenPublication) {
artifactId = 'javagiac'
groupId = 'fr.ujf-grenoble'
version = ggrev
artifact cocoapodsZip
pom {
name = 'iOS Cocoapods Zip'
packaging = 'zip'
}
}
}
}
def processFileInplace(file, Closure processText) {
def text = file.text
file.write(processText(text))
}
task uploadDeployerAar (dependsOn: ['androidAar', 'giac-android:uploadDeployerAar']) {
description 'Deploys the .aar package to GeoGebra\'s Maven repository.'
}
// giac.js -- taken care of by artifacts
// node version
// Recompilation is slow, and seems to be not really required, so we don't run "npm install".
task updateNodegiacVersion () {
description 'Updates Node Giac version in the package.json file.'
doLast {
def packageJson = file("$projectDir/package.json")
processFileInplace(packageJson) { line ->
def pattern = ~/"version": "(.*)"/
def matcher = (line =~ pattern)
matcher.replaceAll("\"version\": \"1.23.$ggrev\"")
}
}
}
task updateNodegiacWebCommit (dependsOn: 'updateNodegiacVersion') {
description 'Commits changes of package.json to the SVN repository.'
doLast {
exec {
// Note that this step may need user interaction on a first run. In such a case, e.g. in Jenkins
// you may need to manually connect to the SVN server first by running this task manually.
// Jenkins' home folder is by default in /var/lib/jenkins and its workspace is
// in jobs/*/workspace which is actually a standard SVN checkout folder.
commandLine 'svn', 'commit', '--username', System.env.MAVEN_USR,
'--password', System.env.MAVEN_PSW,
'-m', "Automatically update package.json to r$ggrev",
projectDir
}
}
}
task publishNodegiac (dependsOn: 'updateNodegiacWebCommit') {
description 'Publishes Node Giac to npmjs.com'
doLast {
exec {
commandLine 'npm', 'publish'
}
}
}
// Top level task
task updateGiac (dependsOn: [':publishMavenJavaPublicationToMavenRepository', ':giac-android:publish']) {
description 'Commits all update related changes for Giac.'
}
allprojects {
afterEvaluate {
publishing {
repositories {
maven {
url 'sftp://dev.geogebra.org:22077/var/www/maven2'
credentials {
username = ggMavenRepoUser
password = ggMavenRepoPass
}
}
}
}
}
}