New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use in doLast method #8
Comments
I haven't kept up with Gradle's recent developments, but it seems that executing a task in a Can you define |
Okay, thanks. Sure, I could define Maybe my Gradle skills are just too bad to get this done :-( |
My Gradle skills certainly aren't anything to brag about, but one option is to do something like this: import com.github.eerohele.SaxonXsltTask
// The list of things (folders) you're iterating
def things = ['foo', 'bar', 'baz']
things.forEach { thing ->
task "transform-${thing}"(type: SaxonXsltTask) {
stylesheet 'my-stylesheet.xsl'
input file("$thing-input.xml")
output "build/$thing-output.xml"
}
task "test-${thing}"(dependsOn: "transform-${thing}") {
// insert whatever the "test" task should actually do here
doLast {
println "Hello, $thing!"
}
}
}
task "test-all"(dependsOn: things.collect { "test-${it}" } ) Then: $ gradle test-all Of course, I don't know enough about what you're trying to do to know whether that'll actually work. |
thanks, that's probably a good way to go. I'll try it... |
works, thanks! |
Glad to hear it! |
Hi, I would like to call the
xslt
task from within another tasksdoLast
method to be able to change the input directory while iterating over testfiles and performing other tasks.This does not seem to work at the moment, the xslt task just isn't being executed.
Do you have an idea why?
The
exec
task fails because the output of the xslt task is missing.If the runTests task depends on a single
xslt
task, it works well, but I loose the option to provide a specific directory to thexslt
task because the task cannot be called with parameters.Thanks!
The text was updated successfully, but these errors were encountered: