Copilot commented on code in PR #16158:
URL: https://github.com/apache/grails-core/pull/16158#discussion_r3805249757


##########
grails-gradle/build.gradle:
##########
@@ -47,7 +47,33 @@ ext {
     // needing --rerun-tasks. Useful for repeatedly running the same test 
command while
     // chasing flaky tests across runs.
     doNotCacheTests = System.getenv('DO_NOT_CACHE_TESTS')?.toBoolean()
-    configuredTestParallel = findProperty('maxTestParallel') as Integer ?: 
(isCiBuild ? 3 : Runtime.runtime.availableProcessors() * 3/4 as int ?: 1)
+    // Half the LOGICAL processors, not 3/4. This separate Gradle build 
mirrors the root
+    // build.gradle - see it for the full rationale. CI keeps its existing 
budget.
+    configuredTestParallel = findProperty('maxTestParallel') as Integer ?:
+            (isCiBuild ? 3 : Math.max(1, 
(Runtime.runtime.availableProcessors() / 2) as int))
+}
+
+/** Caps each test fork's view of the machine. See the root build.gradle for 
the rationale. */
+final class ActiveProcessorCountArgumentProvider implements 
CommandLineArgumentProvider {

Review Comment:
   Same robustness concern here: prefer explicitly importing 
`org.gradle.process.CommandLineArgumentProvider` (or fully-qualifying it) 
rather than relying on implicit imports, to avoid script compilation issues 
across Gradle/Groovy contexts.



##########
grails-forge/build.gradle:
##########
@@ -44,8 +44,24 @@ ext {
     doNotCacheTests = System.getenv('DO_NOT_CACHE_TESTS')?.toBoolean()
 }
 
+/** Caps each test fork's view of the machine. See the root build.gradle for 
the rationale. */
+final class ActiveProcessorCountArgumentProvider implements 
CommandLineArgumentProvider {

Review Comment:
   Same robustness concern here: add an explicit import for 
`org.gradle.process.CommandLineArgumentProvider` (or fully-qualify it) so this 
script doesn’t depend on implicit imports.



##########
grails-gradle/build.gradle:
##########
@@ -47,7 +47,33 @@ ext {
     // needing --rerun-tasks. Useful for repeatedly running the same test 
command while
     // chasing flaky tests across runs.
     doNotCacheTests = System.getenv('DO_NOT_CACHE_TESTS')?.toBoolean()
-    configuredTestParallel = findProperty('maxTestParallel') as Integer ?: 
(isCiBuild ? 3 : Runtime.runtime.availableProcessors() * 3/4 as int ?: 1)
+    // Half the LOGICAL processors, not 3/4. This separate Gradle build 
mirrors the root
+    // build.gradle - see it for the full rationale. CI keeps its existing 
budget.
+    configuredTestParallel = findProperty('maxTestParallel') as Integer ?:
+            (isCiBuild ? 3 : Math.max(1, 
(Runtime.runtime.availableProcessors() / 2) as int))

Review Comment:
   In Groovy, `/` produces a `BigDecimal`, then `as int` truncates it. Using 
`intdiv(2)` communicates intent (integer division) more clearly and avoids the 
intermediate `BigDecimal`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to