Newer
Older
/*
* 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']

Vincent Massol
committed
// 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:

Vincent Massol
committed
// - 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

Vincent Massol
committed
// do the same as for the XWiki sha256.
// - To compute the mysql 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.

Vincent Massol
committed
// - 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#L101 (link for master)
// - mariadb: https://github.com/xwiki/xwiki-platform/blob/master/pom.xml#L104 (link for master)
def tokens = [
xwikiVersion: '15.10.3',
xwikiSha256: '0c3b73fb2ed8c301edcb12b031307bd1242b3bcd2ebfb26cd583b09a0dd5088c',
mysqlJDBCVersion: '8.2.0',
mysqlJDBCSha256: '06f14fbd664d0e382347489e66495ca27ab7e6c2e1d9969a496931736197465f',
mariadbJDBCVersion: '3.3.2',
mariadbJDBCSha256: '2a67ef3cc1ca481965a0e7f2d4174d126f3464d02b4055a441261fad8c196769'
xwikiVersion: '15.5.4',
xwikiSha256: '271159495bfe8461f209dc2674faef918b74e4c5a97edfc51e9608a419aa78e6',
mysqlJDBCVersion: '8.2.0',
mysqlJDBCSha256: '06f14fbd664d0e382347489e66495ca27ab7e6c2e1d9969a496931736197465f',
mariadbJDBCVersion: '3.3.2',
mariadbJDBCSha256: '2a67ef3cc1ca481965a0e7f2d4174d126f3464d02b4055a441261fad8c196769'
xwikiVersion: '14.10.20',
xwikiSha256: 'c418601676d61893ccb9e066b1f2bcce56717b49e5c2456656b6960db6bd6e4c',
mysqlJDBCVersion: '8.2.0',
mysqlJDBCSha256: '06f14fbd664d0e382347489e66495ca27ab7e6c2e1d9969a496931736197465f',
mariadbJDBCVersion: '3.3.2',
mariadbJDBCSha256: '2a67ef3cc1ca481965a0e7f2d4174d126f3464d02b4055a441261fad8c196769'
]
]
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}/*"
filteringCharset = 'UTF-8'
}
}
}
}
}