@@ -12,7 +12,9 @@ import mill.api.daemon.internal.bsp.{BspBuildTarget, BspModuleApi}
12
12
import mill .javalib .api .internal .{JavaCompilerOptions , JvmWorkerApi , ZincCompileJava }
13
13
14
14
/**
15
- * Core configuration required to compile a single Groovy module
15
+ * Core configuration required to compile a single Groovy module.
16
+ *
17
+ * Resolves
16
18
*/
17
19
trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
18
20
@@ -33,36 +35,31 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
33
35
* All individual source files fed into the compiler.
34
36
*/
35
37
override def allSourceFiles : T [Seq [PathRef ]] = Task {
36
- Lib .findSourceFiles(allSources(), Seq ( " groovy " , " java " )).map( PathRef (_) )
38
+ allGroovySourceFiles() ++ allJavaSourceFiles( )
37
39
}
38
40
39
41
/**
40
42
* All individual Java source files fed into the compiler.
41
43
* Subset of [[allSourceFiles ]].
42
44
*/
43
45
private def allJavaSourceFiles : T [Seq [PathRef ]] = Task {
44
- allSourceFiles().filter(_.path.ext.toLowerCase() == " java" )
46
+ Lib .findSourceFiles(allSources(), Seq ( " java" )).map( PathRef (_) )
45
47
}
46
48
47
49
/**
48
50
* All individual Groovy source files fed into the compiler.
49
51
* Subset of [[allSourceFiles ]].
50
52
*/
51
53
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 (_ ))
53
55
}
54
56
55
57
/**
56
58
* 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 ]].
58
60
*/
59
61
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()
66
63
}
67
64
68
65
def jvmWorkerRef : ModuleRef [JvmWorkerModule ] = jvmWorker
@@ -86,28 +83,11 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
86
83
/**
87
84
* The Ivy/Coursier dependencies resembling the Groovy compiler.
88
85
*
89
- * Default is derived from [[groovyCompilerVersion ]].
86
+ * Default is derived from [[groovyVersion ]].
90
87
*/
91
88
def groovyCompilerMvnDeps : T [Seq [Dep ]] = Task {
92
89
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" )
111
91
}
112
92
113
93
/**
@@ -118,9 +98,8 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
118
98
}
119
99
120
100
/**
121
- * The actual Groovy compile task (used by [[compile ]] and [[ groovycHelp ]] ).
101
+ * The actual Groovy compile task (used by [[compile ]]).
122
102
*/
123
- // TODO joint compilation: generate groovy-stubs -> compile java -> compile groovy -> delete stubs (or keep for debugging)
124
103
protected def groovyCompileTask (): Task [CompilationResult ] =
125
104
Task .Anon {
126
105
val ctx = Task .ctx()
@@ -140,9 +119,9 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
140
119
141
120
def compileJava : Result [CompilationResult ] = {
142
121
ctx.log.info(
143
- s " Compiling ${javaSourceFiles.size} Java sources to ${ classes} ... "
122
+ s " Compiling ${javaSourceFiles.size} Java sources to $classes ... "
144
123
)
145
- // The compile step is lazy, but its dependencies are not!
124
+ // The compiler step is lazy, but its dependencies are not!
146
125
internalCompileJavaFiles(
147
126
worker = jvmWorkerRef().internalWorker(),
148
127
upstreamCompileOutput = updateCompileOutput,
@@ -170,14 +149,15 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
170
149
171
150
if (isMixed || isGroovy){
172
151
ctx.log.info(
173
- s " Compiling ${groovySourceFiles.size} Groovy sources to ${ classes} ... "
152
+ s " Compiling ${groovySourceFiles.size} Groovy sources to $classes ... "
174
153
)
175
154
176
155
val workerGroovyResult =
177
156
GroovyWorkerManager .groovyWorker().withValue(groovyCompilerClasspath()) {
178
157
_.compile(groovySourceFiles, compileCp, classes)
179
158
}
180
159
160
+ // TODO figure out if there is a better way to do this
181
161
val analysisFile = dest / " groovy.analysis.dummy" // needed for mills CompilationResult
182
162
os.write(target = analysisFile, data = " " , createFolders = true )
183
163
@@ -236,7 +216,7 @@ trait GroovyModule extends JavaModule with GroovyModuleApi { outer =>
236
216
}
237
217
238
218
/**
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.
240
220
*/
241
221
trait GroovyTests extends JavaTests with GroovyModule {
242
222
0 commit comments