diff --git a/README.md b/README.md index a4a3f787647..d714df79612 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,12 @@ Please note for this to work you should create/update `~/.gradle/gradle.properti ### Running checkstyle on the java code ### ./gradlew checkstyleMain checkstyleTest +### Limit the number of processes for each task ### + ./gradlew -Dorg.gradle.project.maxParallelForks=1 test + +This will most commonly be useful for automated builds where the full resources of the host running the build and tests +may not be dedicated to Kafka's build. + ### Running in Vagrant ### See [vagrant/README.md](vagrant/README.md). diff --git a/build.gradle b/build.gradle index 51d4a780889..2b0f66be59e 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,8 @@ ext { gradleVersion = "2.4" buildVersionFileName = "kafka-version.properties" + userMaxForks = project.hasProperty('maxParallelForks') ? maxParallelForks.toInteger() : null + skipSigning = project.hasProperty('skipSigning') && skipSigning.toBoolean() shouldSign = !skipSigning && !version.endsWith("SNAPSHOT") @@ -124,7 +126,7 @@ subprojects { } tasks.withType(Test) { - maxParallelForks = Runtime.runtime.availableProcessors() + maxParallelForks = userMaxForks ?: Runtime.runtime.availableProcessors() } jar {