This message was deleted.
# community-support
s
This message was deleted.
v
I don't think so, just register a new task and configure it like you need it.
l
Copy code
tasks.register<DependencyUpdatesTask>("myTask")
Is this the correct API?
v
Yes, or if you prefer
Copy code
val myTask by tasks.registering(DependencyUpdatesTask::class)
❤️ 1
Especially if you need the task reference later on
l
Works like a charm. I have noticed a lot of .pom files has been downloaded while running the new task. So I conclude that the new task is not aware of the output of the original task. Is it possible that both task share same outputs? Should I even bother with this or is it for more experienced gradle user?
v
I don't think there can anything be shared, but that would be a question to Ben I guess
l
Could you link him, maybe he will have a look. But isn't it common in gradle that 1 Task produces an output and another task relies on it?
v
I don't know whether he is in this Slack, at least I cannot find him by his name. But yes, it is common that one task uses the output of another task as input. But that's not your situation, is it? You have two sibling tasks that do the same task with different configuration.
l
Ah ok. Tbh I'm not sure if this is even a configuration because no properties are set:
Copy code
/*
  Versions configuration.
  Register new task to retrieve only stable versions.
 */
fun isNonStable(version: String): Boolean {
    val stableKeyword = listOf("RELEASE", "FINAL", "GA")
        .any { version.uppercase(Locale.getDefault()).contains(it) }
    val regex = "^[0-9,.v-]+(-r)?$".toRegex()
    val isStable = stableKeyword || regex.matches(version)
    return isStable.not()
}

tasks.register<DependencyUpdatesTask>("dependencyUpdatesStable") {
    rejectVersionIf {
        isNonStable(candidate.version)
    }
}
That's all I have done.
v
Yes, this is still configuration 🙂
l
ok in this case it makes sense that the output will be different and thus not sharable. Thanks Vampire, you are the best
👌 1