1 minute to read
createTask
About This Task
You miss a special task in the above list? Or maybe you want to change a task to better fit your needs? Why not create your own project specific task?
Execute ./dtcw createTask
and docToolchain will create and configure a custom gradle task for you in a folder scripts
.
To get started, take a look at all the other tasks to see how they solve problems. Copy and modify the code to your own task and start hacking.
Source
Show source code of scripts/customTasks.gradle
or go directly to GitHub · docToolchain/scripts/customTasks.gradle.
scripts/customTasks.gradle
config.customTasks?.each { task ->
println "include custom task $task"
apply from: docDir+'/'+task
}
task createTask(
description: 'create a new Task as quick start',
group: 'docToolchain'
) {
doLast {
def file = new File(docDir+'/scripts/customTask.gradle')
new File(docDir+"/scripts").mkdirs()
file.write("""\
task customTask (
description: 'a custom task',
group: 'docToolchain'
) {
doLast {
println "your own custom task"
}
}
""")
def config = new File(docDir+'/'+mainConfigFile)
config.write(config.text.replaceAll(
"/[*][*] customTasks [*][*]/",
"'scripts/customTask.gradle',\n\t\t/** customTasks **/"
))
println """
custom task
${file.canonicalPath}
created and configured
"""
}
}
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.