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
"""
}
}
createTask
Unresolved directive in ../_feedback.adoc - include::/opt/build/repo/build/contributors/015_tasks/150_task_createTask.adoc[]
At a Glance
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
customTasks.gradle
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.