0

Given an Exec gradle task my-custom-cli-task in a gradle kotlin build script defined by

task<Exec>("my-custom-cli-task") {
  workingdir(projectDir)
  commandLine("my-cli-command","somefile.someextension")
}

I need to run this for a set of project files, defined by

val sourcefileSet = fileTree("$projectDir/") { include("**/*.someextension") }

All theses commands could be run in parallel.

How should this be done using gradle kotlin best practices ?

(Note : I'm aware of https://stackoverflow.com/a/43070603/5565079 but It applies to gradle groovy and I'm not sure how it would translate to kotlin.)

Alice Oualouest
  • 836
  • 12
  • 20
  • 1
    Since you are running one command on multiple files you could create a custom task and use the [Worker API](https://docs.gradle.org/current/userguide/worker_api.html). – aSemy Dec 02 '22 at 09:59

0 Answers0