Author: Chirayu Desai
Last-Update: 2016-08-22
Description: Make sure maxParallelForks is always >= 1
Bug: https://android-review.googlesource.com/260250
Forwarded: yes
--- a/build-system/builder/build.gradle
+++ b/build-system/builder/build.gradle
@@ -36,7 +36,9 @@
 }
 
 test {
-    maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    if (Runtime.runtime.availableProcessors() >= 2) {
+        maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    }
 }
 
 group = 'com.android.tools.build'
--- a/build-system/gradle-core/build.gradle
+++ b/build-system/gradle-core/build.gradle
@@ -85,7 +85,9 @@
         events "failed"
     }
 
-    maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    if (Runtime.runtime.availableProcessors() >= 2) {
+        maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    }
 }
 
 groovydoc {
--- a/build-system/gradle-experimental/build.gradle
+++ b/build-system/gradle-experimental/build.gradle
@@ -70,7 +70,9 @@
         events "failed"
     }
 
-    maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    if (Runtime.runtime.availableProcessors() >= 2) {
+        maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    }
 }
 
 groovydoc {
--- a/build-system/gradle/build.gradle
+++ b/build-system/gradle/build.gradle
@@ -57,7 +57,9 @@
         events "failed"
     }
 
-    maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    if (Runtime.runtime.availableProcessors() >= 2) {
+        maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    }
 }
 
 groovydoc {
--- a/build-system/manifest-merger/build.gradle
+++ b/build-system/manifest-merger/build.gradle
@@ -26,7 +26,9 @@
 }
 
 test {
-    maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    if (Runtime.runtime.availableProcessors() >= 2) {
+        maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    }
 }
 
 project.ext.pomName = 'Android Tools Manifest Merger library'
--- a/lint/cli/build.gradle
+++ b/lint/cli/build.gradle
@@ -17,7 +17,9 @@
 }
 
 test {
-    maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    if (Runtime.runtime.availableProcessors() >= 2) {
+        maxParallelForks = Runtime.runtime.availableProcessors() / 2
+    }
 }
 
 
