This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new e745fc1310 minor refactor: remove gradle warnings about creating 
features using the "main" source set
e745fc1310 is described below

commit e745fc13108412fe6ae6373a3e0d0699e8fada4c
Author: Paul King <[email protected]>
AuthorDate: Wed Dec 4 11:47:56 2024 +1000

    minor refactor: remove gradle warnings about creating features using the 
"main" source set
---
 .../groovy/org/apache/groovy/gradle/GroovyLibraryExtension.groovy | 5 ++++-
 build.gradle                                                      | 8 +++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/build-logic/src/main/groovy/org/apache/groovy/gradle/GroovyLibraryExtension.groovy
 
b/build-logic/src/main/groovy/org/apache/groovy/gradle/GroovyLibraryExtension.groovy
index 4ecfee34de..c306b1a61b 100644
--- 
a/build-logic/src/main/groovy/org/apache/groovy/gradle/GroovyLibraryExtension.groovy
+++ 
b/build-logic/src/main/groovy/org/apache/groovy/gradle/GroovyLibraryExtension.groovy
@@ -152,8 +152,11 @@ class GroovyLibraryExtension {
     }
 
     void registerOptionalFeature(String name) {
+        def sourceSet = javaPluginExtension.sourceSets.create(name)
+        def main = javaPluginExtension.sourceSets.getByName('main')
+        main.compileClasspath += sourceSet.compileClasspath
         javaPluginExtension.registerFeature(name) {
-            it.usingSourceSet(javaPluginExtension.sourceSets.getByName("main"))
+            it.usingSourceSet(sourceSet)
         }
         AdhocComponentWithVariants component = findComponent()
         def apiElements = configurations.getByName("${name}ApiElements")
diff --git a/build.gradle b/build.gradle
index f3158d0e80..da73ee2ac2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -154,6 +154,12 @@ dependencies {
             requireCapability 'org.apache.groovy:groovy-grapes'
         }
     }
+    testRuntimeOnly(project(':')) {
+        because 'Tests are using GPars'
+        capabilities {
+            requireCapability 'org.apache.groovy:groovy-gpars'
+        }
+    }
 }
 
 configurations {
@@ -164,7 +170,7 @@ configurations {
             grapesImplementation
     )
     groovyCompilerClasspath {
-        extendsFrom(implementation, compileOnly, grapesImplementation, 
loggingImplementation, xstreamAstImplementation, runtimeOnly)
+        extendsFrom(implementation, compileOnly, gparsImplementation, 
grapesImplementation, loggingImplementation, xstreamAstImplementation, 
runtimeOnly)
     }
 }
 

Reply via email to