-
Notifications
You must be signed in to change notification settings - Fork 8
/
deploy.gradle
198 lines (169 loc) · 6.53 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
// GeoGebra Deployment
// Copyright (c) 2015-2017 The GeoGebra Group
// All rights reserved
// @author Zoltan Kovacs <[email protected]>
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/")
// 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 javagiacWin64JarClang (type: Jar) {
description 'Create the Windows 64 bit .jar package for the Java Giac library (via clang).'
baseName = 'javagiac-win64'
destinationDir = javagiacDir
from "cbuild64" // Make sure the DLL is compiled and put into this folder first.
include '*.dll'
rename 'libjavagiac.dll', 'javagiac64.dll'
classifier 'natives-windows-amd64'
}
task testJavagiacWin64 (dependsOn: 'javagiacWin64JarClang') {
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 javagiacMacJar (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_x86-64") { // FIXME: unify
include '*.jnilib'
}
from("${buildDir}/binaries/javagiacSharedLibrary/osx_arm-v8") {
include '*.jnilib'
rename 'libjavagiac.jnilib', 'libjavagiac-arm64.jnilib'
}
classifier 'natives-macosx-universal'
}
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',
'testJavagiacWin64', 'testJavagiacMac', 'testJavagiacAndroidArm', 'testJavagiacAndroidX86']) {
description 'Tests the Linux, Windows, Mac and Android versions of the Java Giac library. [incubating]'
}
task javagiacJars (dependsOn: ['javagiacMacJar', 'javagiacLinux64Jar',
'javagiacWin64JarClang']) {
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 javagiacWin64JarClang
artifact javagiacMacJar
artifact javagiacPomJar
pom {
name = 'Java Giac'
description = 'Java Giac for GeoGebra'
}
}
mavenZip(MavenPublication) {
artifactId = 'igiac'
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 'https://repo.geogebra.net/releases'
credentials {
username = ggMavenRepoUser
password = ggMavenRepoPass
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}
}