-
Notifications
You must be signed in to change notification settings - Fork 221
/
Copy pathbuild.gradle
177 lines (166 loc) · 6.93 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
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
import org.apache.tools.ant.filters.ReplaceTokens
// Run this Gradle build with 'gradle' to generate the various versions and variants from the template directory.
// Whenever a new version of XWiki is out, update this file to update the token values, run gradle and commit the
// result.
//
// Note: As a consequence only update the template files and never the generated files!
defaultTasks 'generate'
def variants = ['mysql-tomcat', 'mariadb-tomcat', 'postgres-tomcat']
// Notes:
// - To compute the XWiki sha256, download the XWiki WAR from
// http://nexus.xwiki.org/nexus/content/groups/public/org/xwiki/platform/xwiki-platform-distribution-war, and issue:
// - Unix: sha256sum <binary name>
// - Mac: shasum --algorithm 256 <binary name>
// - To compute the mysql JDBC sha256, get the JAR at https://search.maven.org/artifact/com.mysql/mysql-connector-j and
// do the same as for the XWiki sha256.
// - To compute the MariaDB JDBC sha256, get the JAR at
// https://search.maven.org/artifact/org.mariadb.jdbc/mariadb-java-client and do the same as for the XWiki sha256.
// - To compute the Postgres JDBC sha256, get the JAR at
// https://search.maven.org/artifact/org.postgresql/postgresql and do the same as for the XWiki sha256.
// - Use the JDBC driver versions found in the XWiki POM for the specified versions:
// - mysql: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L110 (link for master)
// - mariadb: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L113 (link for master)
// - postgresql: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L119 (link for master)
// Versions of mysql, mariadb and postgres currently in use in the docker images.
def mysql = [
'9': [
JDBCVersion: '9.1.0',
JDBCSha256: '8776e2ebc46072c9a47ea59d98298c4273bd9f16a7b26b5dfa4744535aa26c62'
],
'8': [
JDBCVersion: '8.4.0',
JDBCSha256: 'd77962877d010777cff997015da90ee689f0f4bb76848340e1488f2b83332af5'
]
]
def mariadb = [
'3.5': [
JDBCVersion: '3.5.1',
JDBCSha256: '50a50c4a3c13c30dfbd40587f7ad9a496197d285ede0948641d9eee68fdf2106'
],
'3.4': [
JDBCVersion: '3.4.1',
JDBCSha256: 'f60e4b282f1f4bdb74f0a26436ba7078a5e480b6f6702f6a7b45d9ba5e604a24'
]
]
def postgres = [
'42': [
JDBCVersion: '42.7.4',
JDBCSha256: '188976721ead8e8627eb6d8389d500dccc0c9bebd885268a3047180274a6031e'
]
]
def tokens = [
'17': [
xwikiVersion: '17.0.0',
xwikiSha256: 'fd4d25b42c5645d87f7ed242967161ccb2648688948de93649a5ca11a1845c34',
mysqlJDBCVersion: mysql['9'].JDBCVersion,
mysqlJDBCSha256: mysql['9'].JDBCSha256,
mariadbJDBCVersion: mariadb['3.5'].JDBCVersion,
mariadbJDBCSha256: mariadb['3.5'].JDBCSha256,
postgresJDBCVersion: postgres['42'].JDBCVersion,
postgresJDBCSha256: postgres['42'].JDBCSha256,
tomcatImageTag: [
tomcatVersion: '10',
javaVersion: '21'
]
],
'16': [
xwikiVersion: '16.10.3',
xwikiSha256: 'bf1f77ad964b2285c5a7695ae279bbb26f23df01ea83982bcc644af45a658405',
mysqlJDBCVersion: mysql['9'].JDBCVersion,
mysqlJDBCSha256: mysql['9'].JDBCSha256,
mariadbJDBCVersion: mariadb['3.5'].JDBCVersion,
mariadbJDBCSha256: mariadb['3.5'].JDBCSha256,
postgresJDBCVersion: postgres['42'].JDBCVersion,
postgresJDBCSha256: postgres['42'].JDBCSha256,
tomcatImageTag: [
tomcatVersion: '9',
javaVersion: '21'
]
],
'16.4': [
xwikiVersion: '16.4.6',
xwikiSha256: 'b41e9d29eafd31acdcf44c7ca5c81eacb2067ca129cf35391d10f493f6e623d3',
mysqlJDBCVersion: mysql['8'].JDBCVersion,
mysqlJDBCSha256: mysql['8'].JDBCSha256,
mariadbJDBCVersion: mariadb['3.5'].JDBCVersion,
mariadbJDBCSha256: mariadb['3.5'].JDBCSha256,
postgresJDBCVersion: postgres['42'].JDBCVersion,
postgresJDBCSha256: postgres['42'].JDBCSha256,
tomcatImageTag: [
tomcatVersion: '9',
javaVersion: '17'
]
],
'14': [
xwikiVersion: '14.10.21',
xwikiSha256: '72a634e2aeb085878dce2629a3e5e6136887d0c22712dcee5a284be8143135ea',
mysqlJDBCVersion: mysql['8'].JDBCVersion,
mysqlJDBCSha256: mysql['8'].JDBCSha256,
mariadbJDBCVersion: mariadb['3.4'].JDBCVersion,
mariadbJDBCSha256: mariadb['3.4'].JDBCSha256,
postgresJDBCVersion: postgres['42'].JDBCVersion,
postgresJDBCSha256: postgres['42'].JDBCSha256,
tomcatImageTag: [
tomcatVersion: '9',
javaVersion: '17'
]
]
]
task generate() {
doLast {
// Copy the template for all versions and variants
tokens.keySet().each() { version ->
variants.each() { variant ->
// Extract the db type and add it as a token
def (db, servlet) = variant.tokenize('-')
tokens[version].'db' = db
// Copy common template files, evaluating groovy in them
copy {
from 'template'
into "${version}/${variant}"
include '.env'
include 'Dockerfile'
include 'docker-compose.yml'
include 'xwiki/*'
expand(tokens[version])
filteringCharset = 'UTF-8'
}
// Copy DB-specific template files, evaluating groovy in them
copy {
from 'template'
into "${version}/${variant}"
include "${db}/*"
expand(tokens[version])
filteringCharset = 'UTF-8'
}
// Copy Servlet-specific template files, evaluating groovy in them
copy {
from 'template'
into "${version}/${variant}"
include "${servlet}/*"
expand(tokens[version])
filteringCharset = 'UTF-8'
}
}
}
}
}