<@U7A7U4XH7> something like this? ```(task("test")...
# gradle
m
@leigh something like this?
Copy code
(task("test") as Test?)?.testLogging?.showStandardStreams = true
l
thanks @mbonnin! i gave this a try and i got the following error:
Copy code
A problem occurred configuring root project '...'.
> Cannot add task ':test' as a task with that name already exists.
m
oups
(task["test"] as Test?)?.testLogging?.showStandardStreams = true
?
sorry I don't have a valid setup anymore so I cannot try but the idea would be to retrieve the "test" task somehow
l
yeah seems it doesn't like the square brackets. it errored suggesting
()
Copy code
e: build.gradle.kts:14:2: Function invocation 'task(...)' expected
e: build.gradle.kts:14:2: None of the following functions can be called with the arguments supplied: 
public open fun task(p0: String): Task defined in Build_gradle
public open fun task(p0: String, p1: Closure<(raw) Any!>): Task defined in Build_gradle
public open fun task(p0: (Mutable)Map<String!, *>, p1: String): Task defined in Build_gradle
public open fun task(p0: (Mutable)Map<String!, *>, p1: String, p2: Closure<(raw) Any!>): Task defined in Build_gradle
m
let me check
m
https://stackoverflow.com/a/46126491/627727 adapted for
Test::class
and
test
as the task name would work
m
tasks.getByName("test")
m
that works too, but you have to cast it
as Test
👍 2
l
ah perfect that worked thank you!
d
tasks["test"]
should work as well also, no need to cast to
Test?
go for
Test
👍 3