From fe62ee6423f843b3b8e8ecef9bf40cd31a531e43 Mon Sep 17 00:00:00 2001 From: Jesse Eichar Date: Wed, 4 Jul 2012 08:00:33 +0200 Subject: [PATCH] cleaned up build, faster, smaller and gradle 1.0 --- build.gradle | 7 +- buildSrc/README | 3 - buildSrc/build.gradle | 21 ---- buildSrc/experimental/build.gradle | 21 ---- .../groovy/com/camptocamp/gradle/SSL.groovy | 48 -------- .../gradle/plugin/ByteCodeQuality.groovy | 67 ----------- .../gradle/plugin/Camptocamp.groovy | 110 ------------------ .../gradle/plugin/CamptocampConvention.groovy | 37 ------ .../camptocamp/gradle/plugin/Cobertura.groovy | 79 ------------- .../gradle/task/AddSecurityProxy.groovy | 74 ------------ .../camptocamp/gradle/task/Filtering.groovy | 105 ----------------- .../gradle/task/JettyRunAllWar.groovy | 76 ------------ .../gradle/task/ProjectLayout.groovy | 78 ------------- .../gradle/task/WarProjectLayout.groovy | 30 ----- gradle/wrapper/gradle-wrapper.properties | 2 +- 15 files changed, 5 insertions(+), 753 deletions(-) delete mode 100644 buildSrc/README delete mode 100644 buildSrc/build.gradle delete mode 100644 buildSrc/experimental/build.gradle delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/SSL.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/ByteCodeQuality.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Camptocamp.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/CamptocampConvention.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Cobertura.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/task/AddSecurityProxy.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/task/Filtering.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/task/JettyRunAllWar.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/task/ProjectLayout.groovy delete mode 100644 buildSrc/src/main/groovy/com/camptocamp/gradle/task/WarProjectLayout.groovy diff --git a/build.gradle b/build.gradle index 36835e10e4..6c7edf7034 100644 --- a/build.gradle +++ b/build.gradle @@ -13,10 +13,11 @@ apply plugin: 'project-report' defaultTasks 'jar', 'war', 'standalone' -MAPFISH_REPO='http://dev.mapfish.org/maven/repository' +def MAPFISH_REPO='http://dev.mapfish.org/maven/repository' repositories { - mavenRepo urls: MAPFISH_REPO - mavenRepo urls: ["http://www.ibiblio.org/maven2", "http://download.osgeo.org/webdav/geotools"] + mavenRepo url: MAPFISH_REPO + mavenRepo url: "http://download.osgeo.org/webdav/geotools" + mavenRepo url: "http://www.ibiblio.org/maven2" mavenCentral() } diff --git a/buildSrc/README b/buildSrc/README deleted file mode 100644 index 7fa31541cf..0000000000 --- a/buildSrc/README +++ /dev/null @@ -1,3 +0,0 @@ -Several gradle plugins and tasks for Gradle projects. They consist of several plugins for code quality, project layout etc... - -All files Licenses under Creative Commons. Do what you will with these files. \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 69e7bfb603..0000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Creative commons license - * Copyright (C) 2009 Camptocamp - */ - -import org.apache.ivy.plugins.resolver.* - -apply plugin: 'groovy' - -repositories { - mavenRepo(urls: 'http://gradle.artifactoryonline.com/gradle/libs') -} - -jetty_depends = ["org.mortbay.jetty:jetty:6.1.22@jar", "org.mortbay.jetty:jetty-util:6.1.22@jar", - "javax.servlet:servlet-api:2.5@jar"] -dependencies { - compile jetty_depends, 'org.mortbay.jetty:jetty:6.1.22@jar' - compile gradleApi() - // todo Actually it should be only groovy, but without junit we get a strange error. We need to understand this. - groovy localGroovy() -} \ No newline at end of file diff --git a/buildSrc/experimental/build.gradle b/buildSrc/experimental/build.gradle deleted file mode 100644 index 5d2332566f..0000000000 --- a/buildSrc/experimental/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -apply id: 'scala' - -tasks.addRule("Pattern: ~") { String taskName -> - if (taskName.startsWith ("~")){ - task(taskName) << { - doFirst { - def targetName = taskName.substring(1) - def found = getTasksByName(targetName,false) - println("found: $found") - if(found.size() == 0) { - throw new AssertionError("$targetName is not a known task") - } else if (found.size() > 1){ - throw new AssertionError("$targetName matches multiple tasks: $found") - } - - println("continuous $targetName") - def taskToExec = found.iterator().next() - } - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/SSL.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/SSL.groovy deleted file mode 100644 index 2503cafab9..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/SSL.groovy +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle; - -class SSL { - private def mPrivateKey = System.env['privateKey'] ?: System.properties['privateKey'] - private def mPassphrase = System.env['sshPassphrase'] ?: System.properties['sshPassphrase'] ?: System.env['sslPassphrase'] ?: System.properties['sslPassphrase'] - private def passphraseWarned, privateKeyWarned = false; - - def privateKey() { - - if(mPrivateKey==null) { - def defaultDir = new File(System.properties['user.home'], '.ssh') - def key = defaultDir.listFiles().find {it.name == 'id_rsa' || it.name == 'id_dsa'} - if(key!=null) { - mPrivateKey = key.path - } else if(!privateKeyWarned) { - privateKeyWarned = true - System.err.println("[WARNING] Private key was not found. The 'privateKey' property is referenced as well as the ~/.ssh directory for the key file") - } - } - return mPrivateKey - } - - def passphrase() { - if(!passphraseWarned && mPassphrase==null) { - passphraseWarned = true - System.err.println("[WARNING] SSL passphrase was not found. Set '-DsshPassphrase=' property on gradle launch") - } - return mPassphrase - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/ByteCodeQuality.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/ByteCodeQuality.groovy deleted file mode 100644 index 33869c9df5..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/ByteCodeQuality.groovy +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.plugin; - -import org.gradle.api.*; -import org.gradle.api.plugins.*; - -class ByteCodeQuality implements Plugin { - String version = "1.3.9" - - def void apply(Project project) { - project.configurations { - findbugsConf - } - - project.dependencies { - findbugsConf "com.google.code.findbugs:findbugs:$version", "com.google.code.findbugs:findbugs-ant:$version" - } - - project.task("findbugs", dependsOn: project.jar) << { - gradleUserHomeDir = project.gradle.gradleUserHomeDir - ant = project.ant - home = new File(gradleUserHomeDir,"findbugs") - - libs = new File(home, "lib") - findBugsJar = new File(libs,"findbugs.jar") - if(!findBugsJar.exists()) { - archive = "findbugs-${version}.zip" - ant.get(src: "http://downloads.sourceforge.net/project/findbugs/findbugs/1.3.9/$archive?use_mirror=switch", - dest: "$gradleUserHomeDir/$archive", verbose: "on", usetimestamp: "on") - ant.unzip(src: "$gradleUserHomeDir/$archive", - dest: "$gradleUserHomeDir") - ant.move(file: "$gradleUserHomeDir/findbugs-$version", - tofile: "$gradleUserHomeDir/findbugs") - ant.delete(file: "$gradleUserHomeDir/$archive") - } - - result = ant { - taskdef(name:'findbugs', classname:'edu.umd.cs.findbugs.anttask.FindBugsTask', - classpath: project.configurations.findbugsConf.asPath) - - findbugs(home: home.path, output:'html', outputFile: "$project.buildDir/reports/findbugs.html") { - sourcePath(path: sourceSets.main.java) - "class"(location: sourceSets.main.classes.asPath) - } - } - } - - project.build.dependsOn 'findbugs' - } -} diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Camptocamp.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Camptocamp.groovy deleted file mode 100644 index 5dc100581a..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Camptocamp.groovy +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.plugin; - -import org.gradle.api.*; -import org.gradle.api.plugins.*; -import com.camptocamp.gradle.task.* - -class Camptocamp implements Plugin { - final String FILTER_RESOURCES_TASKNAME = "filterResources" - final String FILTER_WEBAPP_TASKNAME = "filterWebapp" - - def void apply(Project project) { - def convention = new CamptocampConvention(project) - project.convention.plugins.camptocamp = convention - - - configureFiltering(project, FILTER_RESOURCES_TASKNAME, convention.filterResourcesIn, convention.filterResourcesOut) - configureFiltering(project, FILTER_WEBAPP_TASKNAME, convention.filterWebappIn, convention.filterWebappOut) - - configureProjectLayout(project) - configureWarProjectLayout(project) - configureAddSecurityProxy(project) - - project.afterEvaluate { - configureWarPlugins(project, convention) - configureJettyRunAll(project) - } - } - - def configureJettyRunAll(Project project) { - - if(project.getTasksByName("war",false).isEmpty()) return ; - - project.tasks.addRule("Pattern: $JettyRunAllWar.TASK_NAME") { taskName -> - if (taskName == JettyRunAllWar.TASK_NAME) { - def allTasks = project.tasks - allTasks.add(taskName, JettyRunAllWar.class) - } - } - } - - def configureWarPlugins(Project project, CamptocampConvention convention) { - project.tasks.withType(org.gradle.api.tasks.bundling.War.class).allTasks { task -> - task.dependsOn project.tasks.getByName(FILTER_WEBAPP_TASKNAME) - task.from convention.filterWebappOut - } - } - - def configureProjectLayout(Project project) { - ProjectLayout layout = project.tasks.add(ProjectLayout.TASK_NAME, ProjectLayout.class) - layout.description = "Adds files for a default Camptocamp application configuration" - } - - def configureFiltering(Project project, String name, String input, String output) { - Filtering filtering = project.tasks.add(name, Filtering.class) - filtering.description = "copies all the files that need to have strings updated from the "+ - "filter files to the build dir for inclusion into the webapp" - - filtering.from input - filtering.into output - - project.ant.delete(dir: output) - - if(System.getProperty("server") == null) { - project.logger.info("system property 'server' is not defined so defaulting to 'local'") - } - def server = System.getProperty("server") ?: "local" - - project.fileTree { - from 'filters' - include "$server/*.filter" - }.each { - filtering.filterFile(it) - } - - def global = project.file("filters/global-resource.filter") - if (global.exists()) { - filtering.filterFile(global) - } else { - project.logger.info("$global does not exist. Verify this is not an error") - } - - } - - def configureWarProjectLayout(Project project) { - - } - - def configureAddSecurityProxy(Project project) { - ProjectLayout proxy = project.tasks.add(AddSecurityProxy.TASK_NAME, AddSecurityProxy.class) - proxy.description = "adds the proxy submodules to a proxy directory" - } -} diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/CamptocampConvention.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/CamptocampConvention.groovy deleted file mode 100644 index d6dc1766a9..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/CamptocampConvention.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.plugin; - -import org.gradle.api.Project; - -class CamptocampConvention { - String filterResourcesIn - String filterResourcesOut - - String filterWebappIn - String filterWebappOut - - def CamptocampConvention(Project project) { - filterResourcesIn = project.file("src/main/filter-resources") - filterResourcesOut = project.file("$project.buildDir/classes/main/") - - filterWebappIn = project.file("src/main/filter-webapp") - filterWebappOut = project.file("$project.buildDir/filtered/webapp") - } -} diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Cobertura.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Cobertura.groovy deleted file mode 100644 index ffa16cb0cb..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/plugin/Cobertura.groovy +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.plugin; - -import org.gradle.api.*; - -class Cobertura implements Plugin { - - def void apply(Project project) { - def cobSerFile="${project.buildDir}/cobertura.ser" - def srcOriginal="${project.sourceSets.main.classesDir}" - def srcCopy="${srcOriginal}-copy" - def version = '1.9.3' - - def ant = project.ant - - project.configurations { - coberturaConf - } - - project.dependencies { - coberturaConf "net.sourceforge.cobertura:cobertura:$version" - testRuntime "net.sourceforge.cobertura:cobertura:$version" - } - - project.test.doFirst { - // delete data file for cobertura, otherwise coverage would be added - ant.delete(file:cobSerFile, failonerror:false) - // delete copy of original classes - ant.delete(dir: srcCopy, failonerror:false) - // import cobertura task, so it is available in the script - ant.taskdef(resource:'tasks.properties', classpath: project.configurations.coberturaConf.asPath) - // create copy (backup) of original class files - ant.copy(todir: srcCopy) { - fileset(dir: srcOriginal) - } - - // instrument the relevant classes in-place - ant.'cobertura-instrument'(datafile:cobSerFile) { - fileset(dir: srcOriginal, - includes:"**/*.class", - excludes:"**/*Test.class") - } - - } - - project.test { - options.systemProperties['net.sourceforge.cobertura.datafile']="${cobSerFile}" - } - - project.test.doLast { - if (new File(srcCopy).exists()) { - // replace instrumented classes with backup copy again - ant.delete(file: srcOriginal) - ant.move(file: srcCopy, - tofile: srcOriginal) - // create cobertura reports - ant.'cobertura-report'(destdir:"$project.buildDir/reports/test-coverage", - format:'html', srcdir:"src/main/java", datafile:cobSerFile) - } - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/AddSecurityProxy.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/task/AddSecurityProxy.groovy deleted file mode 100644 index 31cca8be2b..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/AddSecurityProxy.groovy +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.task; - -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; - -class AddSecurityProxy extends ProjectLayout { - public static final def TASK_NAME = "addSecurityProxy" - - def proxyDir = System.getProperty('proxyDir') ?: 'security-proxy' - - def AddSecurityProxy() { - // this is to layout the config with the standard options - // see ProjectLayout properties - baseDir = proxyDir+'/config' - directories = [ ] - } - - def basicLayout() { - - def settingsFile = new File("$project.projectDir/settings.gradle") - settingsFile.append("\ninclude ':$proxyDir', ':$proxyDir:cas', ':$proxyDir:config', ':$proxyDir:core'") - - gitSubmoduleAddProxy() - gitCloneConfig() - - super.basicLayout() - } - - def gitSubmoduleAddProxy() { - def url = 'git@github.com:jesseeichar/security-proxy.git' -// url = "/Users/jeichar/Local_Projects/security-proxy" - project.logger.quiet("cloning project: $url") - - project.ant.exec(executable: 'git', failonerror: true, logError: true) { - arg(value: 'clone') - arg(value: '--recursive') - arg(value: url) - arg(value: "$proxyDir") - } - } - - def gitCloneConfig() { - def url = 'git@github.com:jesseeichar/proxy-config.git' - // url = "/Users/jeichar/Local_Projects/security-proxy/config" - project.logger.quiet("cloning project: $url") - project.ant.exec(executable: 'git', failonerror: true, logError: true) { - arg(value: 'clone') - arg(value: url) - arg(value: "$proxyDir/config") - } - - - project.ant.delete(dir: "$proxyDir/config/.git", failonerror: true) - - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/Filtering.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/task/Filtering.groovy deleted file mode 100644 index 5c6cb5480a..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/Filtering.groovy +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.task; - -import org.apache.tools.ant.filters.ReplaceTokens - -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; -import org.gradle.api.tasks.InputFiles; -import org.gradle.api.tasks.Copy; - -import java.io.File - -class Filtering extends Copy { - - def String beginToken = "@" - def String endToken = "@" - private def Iterable filterFiles = [] - - @InputFiles - def Iterable getFilterFiles() { - return filterFiles - } - - def filterFile(File f) { - if(!f.exists()) { - project.logger.info("$f was added as a filterFile but does not exist") - } else { - filterFiles += f - - def properties = new Properties() - f.withReader { properties.load(it) } - - def MATCH = /@.*@/ - - def toResolve = properties.findAll { it.value =~ MATCH } - def toRemove = [] - - def count = 0 - def MAX_RESOLVES = 100 - - while(!toResolve.isEmpty() && count < MAX_RESOLVES) { - count ++ - toResolve.each { entry -> - def m = entry.value =~ /@(.*?)@/ - - def updated = entry.value - m.each { - updated = updated.replace(it[0], properties[it[1]]) - } - properties[entry.key] = updated - - if(!(updated =~ MATCH)) { - toRemove << entry.key - } - } - toRemove.each{toResolve.remove(it)} - } - - if(count >= MAX_RESOLVES){ - String unresolved = "" - toResolve.each(unresolved += "it.key -> $it.value\n") - throw new AssertionError("after $MAX_RESOLVES resolves it was not possible to resolve all elements in file $f:\n"+unresolved) - } - - filter(ReplaceTokens, tokens: properties) - } - } - - def filterFile(String fileName) { - filterFile(project.file(fileName)) - } - - def filterFiles(Iterable files) { - files.each {file -> - if(file instanceof String) { - filterFile ((String)(file)) - } else { - filterFile ((File)(file)) - } - } - } - - - def setFilterFiles(Iterable files) { - filterFiles = [] - filterFiles(files) - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/JettyRunAllWar.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/task/JettyRunAllWar.groovy deleted file mode 100644 index 4f42c722fd..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/JettyRunAllWar.groovy +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.task; - -import org.apache.tools.ant.filters.ReplaceTokens - -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; -import org.gradle.api.tasks.InputFiles; -import org.gradle.api.tasks.Copy; -import org.gradle.api.plugins.jetty.JettyRunWar; -import org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext; -import org.gradle.api.plugins.jetty.internal.JettyPluginServer; - - -import java.io.File - -class JettyRunAllWar extends JettyRunWar { - - public static final def TASK_NAME = "jettyRunAllWar" - - /** - * Projects that will also be ran but will - * not be the project whose sources will be scanned - */ - def backgroundProjects = project.rootProject.allprojects.findAll { - project.path != it.path && war(it) != null - }.asList() - - public JettyRunAllWar() { - println("running JettyRunAllWar on "+project.path) - webApp = war(project).archivePath - backgroundProjects.tail().each { proj -> - if(war(proj) == null) { - throw AssertionError( proj.path + "does not have a war task") - } - - } - - } - - static def war(project) { - def tasks = project.getTasksByName("war",false) - return tasks.find{true} - } - - public void configureWebApplication() throws Exception { - super.configureWebApplication() - backgroundProjects.each{ proj -> - def warTask = war(proj) - def context = new JettyPluginWebAppContext() - context.setContextPath(proj.name) - context.setWar(warTask.archivePath.absolutePath) - context.configure() - getServer().addWebApplication(context) - } - - } - -} diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/ProjectLayout.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/task/ProjectLayout.groovy deleted file mode 100644 index 43b452ea64..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/ProjectLayout.groovy +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.task; - -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; - -class ProjectLayout extends DefaultTask { - - public static final def TASK_NAME = "layout" - - def projectName = "$project.name" - def baseDir = "." - def devHost = "$projectName-dev.int.lsn.camptocamp.com" - def demoHost = "$projectName-demo.dmz.lsn.camptocamp.com" - def prodHost = "${projectName}.camptocamp.com" - def filterFile = "resource.filter" - - def filterFiles = [ - dev: {"$baseDir/filters/dev/$filterFile"}, - demo: {"$baseDir/filters/demo/$filterFile"}, - prod: {"$baseDir/filters/prod/$filterFile"}, - local: {"$baseDir/filters/local/$filterFile"}/*, - global: {"$baseDir/filters/global-$filterFile"}*/ - ] - def directories = [ - srcJava: {"$baseDir/$baseDir/src/main/java"}, - srcResources: {"$baseDir/src/main/resources"}, - testJava: {"$baseDir/src/test/java"}, - filteredResource: {"$baseDir/src/main/filter-resources"}, - filteredWebapp: {"$baseDir/src/main/filter-webapp"}, - testResources: {"$baseDir/src/test/resources"} - ] - - def filterFile(String publicHost) { -"""# This file contains key-value pairs that will be used to resolve @key@ strings in the filtered resources - -public_host=$publicHost -""" - } - - @TaskAction - def basicLayout() { - filterFiles.each { path -> - def file = new File(path.value.call()) - file.getParentFile().mkdirs() - logger.info('creating '+file) - if (! file.exists() ){ - if(properties.containsKey(path.key+"Host")) { - file.write(filterFile(this[path.key+"Host"])) - } else { - file.write("") - } - } - } - - directories.each { - logger.info('creating '+it.value.call()) - new File(it.value.call()).mkdirs() - } - } -} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/WarProjectLayout.groovy b/buildSrc/src/main/groovy/com/camptocamp/gradle/task/WarProjectLayout.groovy deleted file mode 100644 index ef122dd2f6..0000000000 --- a/buildSrc/src/main/groovy/com/camptocamp/gradle/task/WarProjectLayout.groovy +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2009 Camptocamp - * - * This file is part of MapFish Print - * - * MapFish Print is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * MapFish Print 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MapFish Print. If not, see . - */ -package com.camptocamp.gradle.task; - -import org.gradle.api.DefaultTask; -import org.gradle.api.tasks.TaskAction; - -class WarProjectLayout extends ProjectLayout { - - @TaskAction - def filter() { - - } -} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2be299847..35a2fbbb78 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://dev.mapfish.org/gradle/gradle-1.0-milestone-7-bin.zip +distributionUrl=http\://dev.mapfish.org/gradle/gradle-1.0-bin.zip