Xetius
Xetius

Reputation: 46794

Running Gradle tasks which don't exit in parallel

I am currently running a number of tasks which don't exit to execute all my mocks. I'm using this script:

../gradlew :pm:pm-mock-1:run \
           :pm:pm-mock-2:run \
           :pm:pm-mock-3:run \
           :pm:pm-mock-4:run \
           :pm:pm-mock-5:run \
           :pm:pm-mock-6:run \
           :pm:pm-mock-7:run \
           :pm:pm-mock-8:run \
           :pm:pm-mock-9:run \
           --parallel \
           --max-workers=10

Ideally I would like a single task to run all of the mocks, but if I have

task runMocks(dependsOn: [
    'pm-mock-1:run',
    'pm-mock-2:run',
    'pm-mock-3:run',
    'pm-mock-4:run',
    'pm-mock-5:run',
    'pm-mock-6:run',
    'pm-mock-7:run',
    'pm-mock-8:run',
    'pm-mock-9:run'])

then it waits for the first task to end, rather than running them in parallel.

How would I replicate my script so that I can run

../gradle :runMocks

Upvotes: 2

Views: 203

Answers (1)

Ethan
Ethan

Reputation: 6913

In you gradle.properties file add

org.gradle.parallel=true 
org.gradle.workers.max=10

You can read more about gradle.properties file at https://docs.gradle.org/current/userguide/build_environment.html

Upvotes: 1

Related Questions