Home > Enterprise >  How to get the current max-workers value?
How to get the current max-workers value?

Time:07-13

In my build.gradle script, I have an Exec task to start a multithreaded process, and I would like to limit the number of threads in the process to the value of max-workers, which can be specified on the command line with --max-workers, or in gradle.properties with org.gradle.workers.max, and possibly other ways. How should I get this value to then pass on to my process?

I have already tried reading the org.gradle.workers.max property, but that property doesn't exist if it is not set by the user and instead max-workers is defined by some other means.

CodePudding user response:

You may be able to access this value using API project.getGradle() .getStartParameter() .getMaxWorkerCount().

  • Related