/
build.gradle
29 lines (27 loc) · 1.19 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import org.gradle.internal.logging.text.StyledTextOutputFactory
import static org.gradle.internal.logging.text.StyledTextOutput.Style.UserInput
import static org.gradle.internal.logging.text.StyledTextOutput.Style.Normal
task log {
doLast {
def executor = Executors.newCachedThreadPool()
(1..10).each { thread ->
executor.execute {
def textOut = services.get(StyledTextOutputFactory.class).create('build')
(1..100).each { iteration ->
logger.lifecycle("log message from thread $thread iteration $iteration")
print "stdout message "
println "from thread $thread iteration $iteration"
textOut.text("styled text message from thread ")
textOut.style(UserInput).text(thread).style(Normal)
textOut.text(' iteration ')
textOut.style(UserInput).text(iteration).style(Normal)
textOut.println()
}
}
}
executor.shutdown()
executor.awaitTermination(30, TimeUnit.SECONDS)
}
}