Skip to content

Commit

Permalink
fix for GRAILS-2285 "ability to override a plugin's artefacts"
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Mar 24, 2010
1 parent df60a58 commit 595d80a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
7 changes: 3 additions & 4 deletions scripts/_GrailsClasspath.groovy
Expand Up @@ -197,9 +197,11 @@ void setClasspath() {
cpath << dir.file.absolutePath << File.pathSeparator
// Adding the grails-app folders to the root loader causes re-load issues as
// root loader returns old class before the grails GCL attempts to recompile it
//rootLoader?.addURL(dir.URL)
// rootLoader?.addURL(dir.URL)
}
cpath << classesDirPath << File.pathSeparator
cpath << pluginClassesDirPath << File.pathSeparator

cpath << "${basedir}/web-app/WEB-INF" << File.pathSeparator
for (jar in jarFiles) {
cpath << jar.file.absolutePath << File.pathSeparator
Expand All @@ -212,9 +214,6 @@ void setClasspath() {
compConfig.setClasspath(cpath.toString());
compConfig.sourceEncoding = "UTF-8"

// rootLoader?.addURL(new File("${basedir}/grails-app/conf/hibernate").toURI().toURL())
// rootLoader?.addURL(new File("${basedir}/src/java").toURI().toURL())

// The resources directory must be created before it is added to
// the root loader, otherwise it is quietly ignored. In other words,
// if the directory is created after its path has been added to the
Expand Down
1 change: 1 addition & 0 deletions scripts/_GrailsClean.groovy
Expand Up @@ -45,6 +45,7 @@ target ( cleanCompiledSources: "Cleans compiled Java and Groovy sources" ) {
ant.delete(dir:"${webInf}/lib")
ant.delete(dir:"${basedir}/web-app/plugins")
ant.delete(dir:classesDirPath)
ant.delete(dir:pluginClassesDirPath, failonerror:false)
ant.delete(dir:resourcesDirPath)
ant.delete(dir:testDirPath)
}
Expand Down
8 changes: 6 additions & 2 deletions scripts/_GrailsCompile.groovy
Expand Up @@ -67,7 +67,7 @@ target(setCompilerSettings: "Updates the compile build settings based on args")
target(compile : "Implementation of compilation phase") {
depends(compilePlugins)

def classesDirPath = grailsSettings.classesDir.path
def classesDirPath = new File(grailsSettings.classesDir.path)
ant.mkdir(dir:classesDirPath)

profile("Compiling sources to location [$classesDirPath]") {
Expand All @@ -84,7 +84,9 @@ target(compile : "Implementation of compilation phase") {
event("StatusFinal", ["Compilation error: ${e.message}"])
exit(1)
}

classLoader.addURL(grailsSettings.classesDir.toURI().toURL())
classLoader.addURL(grailsSettings.pluginClassesDir.toURI().toURL())

// If this is a plugin project, the descriptor is not included
// in the compiler's source path. So, we manually compile it
Expand All @@ -97,7 +99,7 @@ target(compile : "Implementation of compilation phase") {
target(compilePlugins: "Compiles source files of all referenced plugins.") {
depends(setCompilerSettings, resolveDependencies)

def classesDirPath = grailsSettings.classesDir.path
def classesDirPath = pluginClassesDirPath
ant.mkdir(dir:classesDirPath)

profile("Compiling sources to location [$classesDirPath]") {
Expand Down Expand Up @@ -129,6 +131,8 @@ target(compilePlugins: "Compiles source files of all referenced plugins.") {
exclude(name: "**/resources.groovy")
javac(classpathref:classpathId, encoding:"UTF-8", debug:"yes")
}


}
}
}
Expand Down
18 changes: 11 additions & 7 deletions scripts/_GrailsWar.groovy
Expand Up @@ -120,15 +120,22 @@ target (war: "The implementation target") {
fileset(dir:"${basedir}/grails-app", includes:"views/**")
fileset(dir:"${resourcesDirPath}/grails-app", includes:"i18n/**")
}
ant.copy(todir:"${stagingDir}/WEB-INF/classes") {
fileset(dir:classesDirPath) {

def classesDirExcludes = {
exclude(name:"hibernate")
exclude(name:"spring")
exclude(name:"hibernate/*")
exclude(name:"spring/*")
}
}


ant.copy(todir:"${stagingDir}/WEB-INF/classes") {
fileset(dir:pluginClassesDirPath, classesDirExcludes)
}

ant.copy(todir:"${stagingDir}/WEB-INF/classes", overwrite:true) {
fileset(dir:classesDirPath, classesDirExcludes)
}

ant.mkdir(dir:"${stagingDir}/WEB-INF/spring")

ant.copy(todir:"${stagingDir}/WEB-INF/spring") {
Expand Down Expand Up @@ -357,9 +364,6 @@ protected def createDescriptorInternal(pluginInfos, resourceList) {
xml.resource(name)
addedResources.add name
}
else {
println "\tWARNING: Duplicate resource '${name}', using the last one in compile order."
}
}
}
xml.plugins {
Expand Down

0 comments on commit 595d80a

Please sign in to comment.