Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbe9e9a
commit 0aed6ac
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apply plugin: 'groovy' | ||
apply plugin: 'maven' | ||
|
||
group = 'org.grails' | ||
|
||
repositories { | ||
maven { url "http://repo.spring.io/libs-release" } | ||
mavenLocal() | ||
mavenCentral() | ||
|
||
} | ||
|
||
dependencies { | ||
compile gradleApi() | ||
compile project(":grails-bootstrap"), { | ||
exclude group:"org.fusesource.jansi", module:"jansi" | ||
exclude group:"jline", module:"jline" | ||
exclude group:"net.java.dev.jna", module:"jna" | ||
|
||
// Ant | ||
exclude group:"org.codehaus.groovy", module:"groovy-ant" | ||
exclude group:"org.apache.ant", module:"ant" | ||
exclude group:"org.apache.ant", module:"ant-launcher" | ||
exclude group:"org.apache.ivy", module:"ivy" | ||
exclude group:"org.apache.ant", module:"ant-trax" | ||
exclude group:"org.apache.ant", module:"ant-junit" | ||
|
||
exclude group:"org.codehaus.gant", module:"gant_groovy1.8" | ||
} | ||
compile "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion" | ||
} |
56 changes: 56 additions & 0 deletions
56
grails-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/core/GrailsPlugin.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.grails.gradle.plugin.core | ||
|
||
import grails.util.Environment | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.plugins.GroovyPlugin | ||
import org.springframework.boot.gradle.SpringBootPlugin | ||
|
||
class GrailsPlugin extends GroovyPlugin { | ||
|
||
void apply(Project project) { | ||
super.apply(project) | ||
|
||
project.getPlugins().apply(SpringBootPlugin) | ||
|
||
|
||
def projectDir = project.projectDir | ||
|
||
def grailsSourceDirs = [] | ||
def excludedDirs = ['views', 'migrations', 'assets', 'i18n'] | ||
new File("$projectDir/grails-app").eachDir { File subdir -> | ||
def dirName = subdir.name | ||
if(!subdir.hidden && !dirName.startsWith(".") && !excludedDirs.contains(dirName)) { | ||
grailsSourceDirs << subdir.absolutePath | ||
} | ||
} | ||
|
||
grailsSourceDirs << "$projectDir/src/main/groovy" | ||
|
||
def environment = Environment.current | ||
|
||
println "ENVIRONMENT IS $environment" | ||
|
||
|
||
project.sourceSets { | ||
main { | ||
groovy { | ||
srcDirs = grailsSourceDirs | ||
filter { | ||
exclude "$projectDir/grails-app/conf/hibernate" | ||
exclude "$projectDir/grails-app/conf/spring" | ||
} | ||
resources { | ||
srcDirs = [ | ||
"$projectDir/grails-app/conf/hibernate", | ||
"$projectDir/grails-app/conf/spring", | ||
"$projectDir/grails-app/views", | ||
"$projectDir/src/main/webapp" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
grails-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.grails.core.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
implementation-class=org.grails.gradle.plugin.core.GrailsPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0aed6ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think
grails-app/conf
could/should be used as a srcDir completely. maybe with excludes. using the 2.4.x branch, i found it very convenient to be able to place spring@Configuration
classes intograils-app/conf/my/package/name
, giving them a clear separation from regularsrc/(java|groovy)
code0aed6ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is partially, in that non-Groovy files there get copied from there to the classes directory by GrailsProjectPackager.packageConfigFiles(). But you can add extra directories under
/src
and they're treated as source directories; non-source files get copied to the classes directory and source files are compiled. You can even add multiple ones with self-documenting names like/src/configuration
0aed6ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah i see. missed the
new File("$projectDir/grails-app").eachDir { ... }
part. thanks for the quick feedback.