Slackbot
09/18/2022, 9:18 AMThomas Broyer
09/18/2022, 10:03 AMgradle.taskGraph.whenReady
and throw if it hasTask("idea")
? (not sure it's compatible with configuration cache though)Thor Rognan
09/18/2022, 10:22 AMhasTask(String)
takes an "_absolute path of the task"._ I tried with "idea" and the FQN, but no luck. I'm not sure how to actually invoke the hasTask(Task)
API as it takes an instance of a task 🤔Thor Rognan
09/18/2022, 10:32 AMif (idea.module != null) {
tasks.named("ideaModule") {
enabled = false
}
}
if (idea.project != null) {
setOf("ideaProject", "ideaWorkspace").forEach { taskName ->
tasks.named(taskName) {
enabled = false
}
}
}
if (idea.project != null) {
tasks.named("idea") {
doFirst {
throw RuntimeException("To import in IntelliJ IDEA, follow the instructions in $ideaInstructionsUri")
}
}
}
Thomas Broyer
09/18/2022, 10:32 AMhasTask(":idea")
?Thomas Broyer
09/18/2022, 10:36 AMgradle.taskGraph.whenReady {
if (hasTask(":idea")) throw RuntimeException("To import in IntelliJ IDEA, follow the instructions in ...")
}
both in settings.gradle.kts
or build.gradle.kts
Thor Rognan
09/18/2022, 10:36 AMhasTask(":idea")
worked for me:
gradle.taskGraph.whenReady {
if (hasTask(":idea")) {
throw RuntimeException("To import in IntelliJ IDEA, follow the instructions in $ideaInstructionsUri")
}
}
console output:
FAILURE: Build failed with an exception.
* What went wrong:
Failed to notify task execution graph listener.
> To import in IntelliJ IDEA, follow the instructions in ...
Thor Rognan
09/18/2022, 10:37 AMThomas Broyer
09/18/2022, 11:28 AM:idea
, not idea
(bad copy/paste from various tests in snippet above, edited/fixed now)Thomas Broyer
09/18/2022, 11:28 AMThor Rognan
09/18/2022, 11:33 AM