@@ -12,7 +12,9 @@ import mill.api.daemon.internal.bsp.{BspBuildTarget, BspModuleApi}
1212import mill .javalib .api .internal .{JavaCompilerOptions , JvmWorkerApi , ZincCompileJava }
1313
1414/**
15- * Core configuration required to compile a single Groovy module
15+ * Core configuration required to compile a single Groovy module.
16+ *
17+ * Resolves
1618 */
1719trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
1820
@@ -33,36 +35,31 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
3335 * All individual source files fed into the compiler.
3436 */
3537 override def allSourceFiles : T [Seq [PathRef ]] = Task {
36- Lib .findSourceFiles(allSources(), Seq ( " groovy " , " java " )).map( PathRef (_) )
38+ allGroovySourceFiles() ++ allJavaSourceFiles( )
3739 }
3840
3941 /**
4042 * All individual Java source files fed into the compiler.
4143 * Subset of [[allSourceFiles ]].
4244 */
4345 private def allJavaSourceFiles : T [Seq [PathRef ]] = Task {
44- allSourceFiles().filter(_.path.ext.toLowerCase() == " java" )
46+ Lib .findSourceFiles(allSources(), Seq ( " java" )).map( PathRef (_) )
4547 }
4648
4749 /**
4850 * All individual Groovy source files fed into the compiler.
4951 * Subset of [[allSourceFiles ]].
5052 */
5153 private def allGroovySourceFiles : T [Seq [PathRef ]] = Task {
52- allSourceFiles().filter(path => Seq (" groovy" ).contains(path.path.ext.toLowerCase() ))
54+ Lib .findSourceFiles(allSources(), Seq (" groovy" )).map( PathRef (_ ))
5355 }
5456
5557 /**
5658 * The dependencies of this module.
57- * Defaults to add the groovy dependency matching the [[groovyVersion ]].
59+ * Defaults to add the Groovy dependency matching the [[groovyVersion ]].
5860 */
5961 override def mandatoryMvnDeps : T [Seq [Dep ]] = Task {
60- super .mandatoryMvnDeps()
61- ++
62- groovyCompilerMvnDeps()
63- // Seq(
64- // mvn"org.apache.groovy:groovy:${groovyVersion()}"
65- // )
62+ super .mandatoryMvnDeps() ++ groovyCompilerMvnDeps()
6663 }
6764
6865 def jvmWorkerRef : ModuleRef [JvmWorkerModule ] = jvmWorker
@@ -86,28 +83,11 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
8683 /**
8784 * The Ivy/Coursier dependencies resembling the Groovy compiler.
8885 *
89- * Default is derived from [[groovyCompilerVersion ]].
86+ * Default is derived from [[groovyVersion ]].
9087 */
9188 def groovyCompilerMvnDeps : T [Seq [Dep ]] = Task {
9289 val gv = groovyVersion()
93- val compilerDep = mvn " org.apache.groovy:groovy-all: $gv"
94- Seq (compilerDep)
95- }
96-
97- /**
98- * Compiler Plugin dependencies.
99- */
100- def groovyCompilerPluginMvnDeps : T [Seq [Dep ]] = Task { Seq .empty[Dep ] }
101-
102- /**
103- * The resolved plugin jars
104- */
105- def groovyCompilerPluginJars : T [Seq [PathRef ]] = Task {
106- val jars = defaultResolver().classpath(
107- allMvnDeps(),
108- resolutionParamsMapOpt = None
109- )
110- jars.toSeq
90+ Seq (mvn " org.apache.groovy:groovy: $gv" )
11191 }
11292
11393 /**
@@ -118,9 +98,8 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
11898 }
11999
120100 /**
121- * The actual Groovy compile task (used by [[compile ]] and [[ groovycHelp ]] ).
101+ * The actual Groovy compile task (used by [[compile ]]).
122102 */
123- // TODO joint compilation: generate groovy-stubs -> compile java -> compile groovy -> delete stubs (or keep for debugging)
124103 protected def groovyCompileTask (): Task [CompilationResult ] =
125104 Task .Anon {
126105 val ctx = Task .ctx()
@@ -140,9 +119,9 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
140119
141120 def compileJava : Result [CompilationResult ] = {
142121 ctx.log.info(
143- s " Compiling ${javaSourceFiles.size} Java sources to ${ classes} ... "
122+ s " Compiling ${javaSourceFiles.size} Java sources to $classes ... "
144123 )
145- // The compile step is lazy, but its dependencies are not!
124+ // The compiler step is lazy, but its dependencies are not!
146125 internalCompileJavaFiles(
147126 worker = jvmWorkerRef().internalWorker(),
148127 upstreamCompileOutput = updateCompileOutput,
@@ -170,14 +149,15 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
170149
171150 if (isMixed || isGroovy){
172151 ctx.log.info(
173- s " Compiling ${groovySourceFiles.size} Groovy sources to ${ classes} ... "
152+ s " Compiling ${groovySourceFiles.size} Groovy sources to $classes ... "
174153 )
175154
176155 val workerGroovyResult =
177156 GroovyWorkerManager .groovyWorker().withValue(groovyCompilerClasspath()) {
178157 _.compile(groovySourceFiles, compileCp, classes)
179158 }
180159
160+ // TODO figure out if there is a better way to do this
181161 val analysisFile = dest / " groovy.analysis.dummy" // needed for mills CompilationResult
182162 os.write(target = analysisFile, data = " " , createFolders = true )
183163
@@ -236,7 +216,7 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
236216 }
237217
238218 /**
239- * A test sub-module linked to its parent module best suited for unit-tests.
219+ * A test submodule linked to its parent module best suited for unit-tests.
240220 */
241221 trait GroovyTests extends JavaTests with GroovyModule {
242222
0 commit comments