« Return to Thread: a quick and dirty wrapper for the grails-app build

a quick and dirty wrapper for the grails-app build

by Helmut Denk () :: Rate this Message:

Reply to Author | View in Thread

hi gradle,

as i noted in an earlier post, i think that gradle-support
for building grails-apps would be a useful thing.

unfortunately i dont feel like the man to do a proper gradle-plugin
for grails (this is mainly a matter of skills but also a matter
of time). i also think, that regarding the future of the grails-build
there are some basic decisions/moves to be made, that are solely
in the responsibility of the grails-team.

what could be done IMO from the gradle-perspective is a
quick&dirty solution, that can be useful as long as grails
doesnt come out with something better.

my idea for this is a plugin, that wraps the existing
grails commands and adds the ability to resolve and
publish artefacts.

here a script-snippet, that tries to show what
i mean by 'wrapping grails-commands':


*** snip ***

task clean() << {
    ant.exec(executable: getExecutable(), dir: "$projectDir",
    failonerror: 'true', failifexecutionfails: 'true') {
        arg(line: getArgLine('clean'))
    }
}

task war() << {
    ant.exec(executable: getExecutable(), dir: "$projectDir",
    failonerror: 'true', failifexecutionfails: 'true') {
        arg(line: getArgLine('war'))
    }
}

task test() << {
    ant.exec(executable: getExecutable(), dir: "$projectDir",
    failonerror: 'false', failifexecutionfails: 'true') {
        arg(line: getArgLine('test-app'))
    }
}

String getExecutable() {
    String executable

    if (windowsOrNot()) {
        executable = 'cmd'
    } else {
        // dann isses Unix
        executable = 'sh'
    }
    return executable
}

String getArgLine(String arg) {
    String argLine

    if (windowsOrNot()) {
        argLine = "/c grails.bat $arg"
    } else {
        // dann isses Unix
        argLine = "-l grails.sh $arg"
    }
    return argLine
}

boolean windowsOrNot() {
    return '\\'.equals(File.separator)
}

*** snap ***

any comments/suggestions are welcome ...

have a successful day

 « Return to Thread: a quick and dirty wrapper for the grails-app build