Skip to content

Commit

Permalink
revert to the old "install" task which sets the development workspace…
Browse files Browse the repository at this point in the history
… root up as a valid GRAILS_HOME
  • Loading branch information
Jeff Brown committed Jun 20, 2011
1 parent fd9e0d9 commit e0820f8
Show file tree
Hide file tree
Showing 213 changed files with 127 additions and 79 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
/install/
/src
/out
/bin
/conf
/dsl-support
*.ipr
idea
/lib
/doc
/cobertura.ser
/cruise/coverage/report
/downloads
/test/groovy/grails/config
/test/grails-app
stacktrace.log
/dist
/idea-target
target
/build
/grails.iws
.gradle
Expand Down
File renamed without changes.
File renamed without changes.
49 changes: 44 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
repositories {
mavenRepo(urls: "http://repo.grails.org/grails/core")
Expand All @@ -10,8 +12,8 @@ buildscript {

apply plugin: 'idea'


grailsVersion = '1.4.0.BUILD-SNAPSHOT'
installDir = "${rootProject.projectDir}/install"
antVersion = "1.8.2"
antTraxVersion = "1.7.1"
aspectjVersion = "1.6.10"
Expand Down Expand Up @@ -116,7 +118,7 @@ subprojects { project ->
from(project.libsDir) {
include "*-${grailsVersion}.jar"
}
into "${installDir}/dist"
into "${rootProject.projectDir}/dist"
}
}

Expand Down Expand Up @@ -210,13 +212,50 @@ task clean << {
// delete(docs.destinationDir, libs.destinationDir)
delete(libs.destinationDir)
delete(buildDir)
delete(installDir)
}

task installResources << {
copy {
from 'build.properties'
into "${installDir}"
from('grails-resources/src/grails/home/tests')
into('lib')
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
}

copy {
from("grails-resources/src/grails/home/bash")
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['spring.loaded.version': springLoadedVersion])
fileMode = 0755
into "bin"

}
// the fileMode property above should take care of the chmod work, but
// it doesn't per http://jira.codehaus.org/browse/GRADLE-971
ant.chmod(dir: 'bin', perm: '755', includes: '*')

copy {
from("grails-resources/src/grails/home/conf")
into "conf"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['jline.version': jlineVersion])
filter(ReplaceTokens, tokens: ['jansi.version': jansiVersion])
filter(ReplaceTokens, tokens: ['jna.version': jnaVersion])
filter(ReplaceTokens, tokens: ['commons.cli.version': commonsCliVersion])
filter(ReplaceTokens, tokens: ['ant.version': antVersion])
filter(ReplaceTokens, tokens: ['gant.version': gantVersion])
filter(ReplaceTokens, tokens: ['ivy.version': ivyVersion])
}

copy {
from 'grails-resources/src/grails/home/dsl-support'
into 'dsl-support'
}

copy {
from "grails-resources/src/war/WEB-INF"
into 'src/war/WEB-INF'
}
}

Expand Down
File renamed without changes.
71 changes: 52 additions & 19 deletions gradle/assemble.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ dependencyCache = {
includes = dependencyIncludes as List
exclude "org.grails/**"
}
into "$installDir/lib"
into "$projectDir/lib"
}
copy {
from (cacheLocation) {
includes = ['org.grails/grails-datastore-gorm/jars/grails-datastore-gorm-*.jar',
'org.grails/grails-gdoc-engine/jars/grails-gdoc-engine-*.jar']
}
into "$installDir/lib"
into "$projectDir/lib"
}
}

Expand All @@ -50,10 +50,10 @@ task libs(dependsOn: getTasksByName("assemble", true)) {
into 'dist'
}
copy {
from("$projectDir/grails-resources/src/grails/grails-home") {
from("$projectDir/grails-resources") {
include 'src/grails', 'src/war'
}
into installDir
into projectDir
}
}
}
Expand Down Expand Up @@ -81,38 +81,71 @@ task pluginsFromSvn {
binExecutables = ["cygrails", "grails", "grails-debug", "grails-debug.bat", "grails.bat"]

distSpec = copySpec {
from(installDir) {
from(projectDir) {
into "grails-$grailsVersion"
exclude "bin/*"
include 'lib/', 'gradle/', 'media/', 'samples/', 'scripts/', 'build.gradle', 'build.properties', 'dependencies.txt',
'LICENSE', 'INSTALL', "src/", "gradlew.bat","gradle.properties"
exclude 'ant/bin'
}

from (installDir) {
from("grails-resources") {
into "grails-$grailsVersion"
include "bin/*"
fileMode = 0755
include 'src/grails/**', 'src/war/**'
// this file is accounted for later with special handling to do some token replacement
exclude 'src/grails/grails-macros.xml'
}

from(projectDir) {
into "grails-$grailsVersion"
include 'gradle/', 'build.gradle', "gradlew.bat","gradle.properties"
}

from(projectDir) {
into "grails-$grailsVersion"
include "gradlew"
fileMode = 0755
}

from(docs.destinationDir) {
into "grails-$grailsVersion/doc"
}

exclude "**/CVS/**"
from(project.files(pluginsFromSvn.dir) { builtBy 'pluginsFromSvn' }) {
into "grails-$grailsVersion/plugins"
}
from('grails-resources/src/grails/home/docs/README') {
into "grails-$grailsVersion"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
}
from('grails-resources/src/grails/home/tests') {
into "grails-$grailsVersion/src/resources/tests"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
}
from("grails-resources/src/grails/home/bash") {
into "grails-$grailsVersion/bin"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['spring.loaded.version': springLoadedVersion])
fileMode = 0755
}
from("grails-resources/src/grails/home/conf") {
into "grails-$grailsVersion/conf"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['ant.version': antVersion])
filter(ReplaceTokens, tokens: ['gant.version': gantVersion])
filter(ReplaceTokens, tokens: ['ivy.version': ivyVersion])
filter(ReplaceTokens, tokens: ['jline.version': jlineVersion])
filter(ReplaceTokens, tokens: ['jansi.version': jansiVersion])
filter(ReplaceTokens, tokens: ['jna.version': jnaVersion])
filter(ReplaceTokens, tokens: ['commons.cli.version': commonsCliVersion])
}
from(libs.destinationDir) {
into "grails-$grailsVersion/dist"
exclude "*.zip"
}
from("grails-resources/src/grails/grails-macros.xml") {
into "grails-$grailsVersion/src/grails"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
}
from('grails-resources/src/grails/home/dsl-support') {
into "grails-$grailsVersion/dsl-support"
}
}

task zipDist(type: Zip,dependsOn: [getTasksByName('install', true), 'populateDependencies', 'installResources']) {
task zipDist(type: Zip,dependsOn:libs) {
from distSpec
destinationDir = "${buildDir}/distributions" as File
baseName = 'grails'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ class PluginBuildSettings {
def userHome = System.getProperty("user.home")
def grailsHome = buildSettings.grailsHome.absolutePath
def basedir = buildSettings.baseDir.absolutePath
resourceResolver("file:${grailsHome}/grails-scripts/src/scripts/**.groovy").each { if (!it.file.name.startsWith('_')) scripts << it }
resourceResolver("file:${grailsHome}/scripts/**.groovy").each { if (!it.file.name.startsWith('_')) scripts << it }
resourceResolver("file:${basedir}/scripts/*.groovy").each { if (!it.file.name.startsWith('_')) scripts << it }
pluginScripts.each { if (!it.file.name.startsWith('_')) scripts << it }
Expand Down
48 changes: 13 additions & 35 deletions grails-resources/build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
import org.apache.tools.ant.filters.ReplaceTokens

task installGrailsHomeResources << {
copy {
from("src/grails/grails-home")
into "${installDir}/"
filter(ReplaceTokens, tokens: ['grails.version': grailsVersion])
filter(ReplaceTokens, tokens: ['groovy.version': groovyVersion])
filter(ReplaceTokens, tokens: ['jline.version': jlineVersion])
filter(ReplaceTokens, tokens: ['jansi.version': jansiVersion])
filter(ReplaceTokens, tokens: ['jna.version': jnaVersion])
filter(ReplaceTokens, tokens: ['commons.cli.version': commonsCliVersion])
filter(ReplaceTokens, tokens: ['ant.version': antVersion])
filter(ReplaceTokens, tokens: ['gant.version': gantVersion])
filter(ReplaceTokens, tokens: ['ivy.version': ivyVersion])
filter(ReplaceTokens, tokens: ['spring.loaded.version': springLoadedVersion])
}

ant.chmod(dir: "${installDir}/bin", perm: '755', includes: '*')
}

task createSharedFilesJar(type: Jar, description: 'Package up the files that are shared by both applications and plugins.') {
version = null
appendix = "shared-files"
appFileJar = true
from("src/grails/grails-home/src/war/WEB-INF") {
from("src/war/WEB-INF") {
into "web-app/WEB-INF"
include "applicationContext.xml", "sitemesh.xml", "tld/*.tld"
}
from("src/grails/grails-home/src/grails/grails-app/conf") {
from("src/grails/grails-app/conf") {
into "grails-app/conf"
include "DataSource.groovy", "UrlMappings.groovy"
}
Expand All @@ -37,11 +16,11 @@ task createSharedApplicationFilesJar(type: Jar, description: 'Package up the fil
version = null
appendix = "app-files"
appFileJar = true
from("src/grails/grails-home/src/war") {
from("src/war") {
into "web-app"
exclude "WEB-INF/**"
}
from("src/grails/grails-home/src/grails/grails-app") {
from("src/grails/grails-app") {
into "grails-app"
exclude "taglib/**", "utils/**", "conf/DataSource.groovy", "conf/UrlMappings.groovy"
}
Expand All @@ -51,38 +30,37 @@ task createSharedPluginFilesJar(type: Jar, description: 'Package up the files th
version = null
appendix = "plugin-files"
appFileJar = true
from("src/grails/grails-home/src/grails/templates/plugins")
from("src/grails/grails-home/src/grails") {
from("src/grails/templates/plugins")
from("src/grails") {
include "grails-app/views/error.gsp"
}
from("src/grails/grails-home/src/grails/plugin")
from("src/grails/plugin")
}

task createIntegrationFilesJar(type: Jar, description: 'Files to integrate Grails with IDEs and build systems.') {
version = null
appendix = "integration-files"
appFileJar = true
from("src/grails/grails-home/src/grails/templates/ide-support", "src/grails/ant")
from("src/grails/templates/ide-support", "src/grails/ant")
}

allJarFileTasks = [createSharedFilesJar,createSharedApplicationFilesJar,createSharedPluginFilesJar,createIntegrationFilesJar]
task resourceJarFiles(dependsOn: allJarFileTasks)
task resourceJarFiles(dependsOn:allJarFileTasks)


jar.dependsOn resourceJarFiles

for (jarTask in allJarFileTasks) {
jar.from(jarTask.archivePath)
}

jar.from("src/grails/grails-home/src/war") {
jar.from("src/war") {
into "src/war"
include "WEB-INF/**"
exclude 'WEB-INF/tld/grails.tld', 'WEB-INF/tld/spring.tld'
}
jar.from("src/grails/grails-home/src/grails/templates") {
jar.from("src/grails/templates") {
into "src/grails/templates"
}

jar.appendix = 'resources'

install.dependsOn installGrailsHomeResources
jar.appendix = 'resources'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 1 addition & 10 deletions grails-scripts/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,8 @@ dependencies {

sourceSets {
main {
groovy.srcDirs = ['src/scripts']
groovy.srcDirs = ['../scripts']
}
}

jar.appendix = 'scripts'

task installScripts {
copy {
from("src/scripts")
into "${installDir}/scripts"
}
}

install.dependsOn installScripts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ScaffoldingTest {
'''

void testGenerateDateSelect() {
def templateGenerator = new DefaultGrailsTemplateGenerator(basedir:"../grails-resources/src/grails/grails-home")
def templateGenerator = new DefaultGrailsTemplateGenerator(basedir:"../grails-resources")
gcl.parseClass(testDomain)
def testClass = gcl.loadClass("ScaffoldingTest")

Expand All @@ -72,7 +72,7 @@ class ScaffoldingTest {
}

void testGenerateNumberSelect() {
def templateGenerator = new DefaultGrailsTemplateGenerator(basedir:"../grails-resources/src/grails/grails-home")
def templateGenerator = new DefaultGrailsTemplateGenerator(basedir:"../grails-resources")
gcl.parseClass(testDomain)
def testClass = gcl.loadClass("ScaffoldingTest")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testGenerateController() throws Exception {
GroovyClassLoader gcl = new GroovyClassLoader(Thread.currentThread().getContextClassLoader());

generator = new DefaultGrailsTemplateGenerator();
generator.setBasedir("../grails-resources/src/grails/grails-home");
generator.setBasedir("../grails-resources");

Class dc = gcl.parseClass("class Test { \n Long id;\n Long version; }");
GrailsDomainClass domainClass = new DefaultGrailsDomainClass(dc);
Expand Down Expand Up @@ -103,7 +103,7 @@ public void testGenerateViews() throws Exception {
GroovyClassLoader gcl = new GroovyClassLoader(Thread.currentThread().getContextClassLoader());

DefaultGrailsTemplateGenerator generator = new DefaultGrailsTemplateGenerator();
generator.setBasedir("../grails-resources/src/grails/grails-home");
generator.setBasedir("../grails-resources");

Class dc = gcl.parseClass(
"class Test { " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class GroovyPageWithJSPTagsTests extends AbstractGrailsTagTests {
GroovySystem.metaClassRegistry.removeMetaClass MockHttpServletRequest
TagLibraryResolver.metaClass.resolveRootLoader = {->
def rootLoader = new RootLoader([] as URL[], Thread.currentThread().getContextClassLoader())
def res = new FileSystemResource("../install/lib/taglibs/standard/jars/standard-1.1.2.jar")
def res = new FileSystemResource("../lib/taglibs/standard/jars/standard-1.1.2.jar")
rootLoader.addURL res.getURL()
resolver.getResources("file:../install/lib/org.springframework/spring-web*/jars/*.jar").each {
resolver.getResources("file:../lib/org.springframework/spring-web*/jars/*.jar").each {
rootLoader.addURL it.getURL()
}
return rootLoader
Expand Down
Loading

0 comments on commit e0820f8

Please sign in to comment.