@@ -95,28 +95,8 @@ trait KotlinJsModule extends KotlinModule { outer =>
9595 * Compiles all the sources to the IR representation.
9696 */
9797 override def compile : T [CompilationResult ] = Task {
98- KotlinWorkerManager .kotlinWorker().withValue(kotlinCompilerClasspath()) {
99- kotlinWorker =>
100- kotlinJsCompile(
101- outputMode = OutputMode .KlibDir ,
102- irClasspath = None ,
103- allKotlinSourceFiles = allKotlinSourceFiles(),
104- librariesClasspath = compileClasspath(),
105- callMain = kotlinJsCallMain(),
106- moduleKind = kotlinJsModuleKind(),
107- produceSourceMaps = kotlinJsSourceMap(),
108- sourceMapEmbedSourcesKind = kotlinJsSourceMapEmbedSources(),
109- sourceMapNamesPolicy = kotlinJsSourceMapNamesPolicy(),
110- splitPerModule = kotlinJsSplitPerModule(),
111- esTarget = kotlinJsESTarget(),
112- kotlinVersion = kotlinVersion(),
113- destinationRoot = Task .dest,
114- artifactId = artifactId(),
115- explicitApi = kotlinExplicitApi(),
116- extraKotlinArgs = allKotlincOptions(),
117- worker = kotlinWorker
118- )
119- }
98+ // same as super, but kept for bin-compat
99+ kotlinCompileTask()()
120100 }
121101
122102 override def runLocal (args : Task [Args ] = Task .Anon (Args ())): Command [Unit ] =
@@ -217,7 +197,8 @@ trait KotlinJsModule extends KotlinModule { outer =>
217197 artifactId = artifactId(),
218198 explicitApi = kotlinExplicitApi(),
219199 extraKotlinArgs = allKotlincOptions() ++ extraKotlinArgs,
220- worker = kotlinWorker
200+ worker = kotlinWorker,
201+ useBtApi = kotlincUseBtApi()
221202 )
222203 }
223204 }
@@ -247,7 +228,8 @@ trait KotlinJsModule extends KotlinModule { outer =>
247228 artifactId = artifactId(),
248229 explicitApi = kotlinExplicitApi(),
249230 extraKotlinArgs = allKotlincOptions(),
250- worker = kotlinWorker
231+ worker = kotlinWorker,
232+ useBtApi = kotlincUseBtApi()
251233 )
252234 }
253235 }
@@ -291,7 +273,8 @@ trait KotlinJsModule extends KotlinModule { outer =>
291273 artifactId : String ,
292274 explicitApi : Boolean ,
293275 extraKotlinArgs : Seq [String ],
294- worker : KotlinWorker
276+ worker : KotlinWorker ,
277+ useBtApi : Boolean
295278 )(implicit ctx : mill.api.TaskCtx ): Result [CompilationResult ] = {
296279 val versionAllowed = kotlinVersion.split(" \\ ." ).map(_.toInt) match {
297280 case Array (1 , 8 , z) => z >= 20
@@ -308,10 +291,15 @@ trait KotlinJsModule extends KotlinModule { outer =>
308291 // * https://kotlinlang.org/docs/compiler-reference.html#kotlin-js-compiler-options
309292 // * https://github.com/JetBrains/kotlin/blob/v1.9.25/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt
310293
311- val inputFiles = irClasspath match {
312- case Some (x) => Seq (s " -Xinclude= ${x.path.toIO.getAbsolutePath}" )
313- case None => allKotlinSourceFiles.map(_.path.toIO.getAbsolutePath)
314- }
294+ // val (inputFiles, includeArgs) = irClasspath match {
295+ // case Some(x) =>
296+ // (Seq(), Seq(s"-Xinclude=${x.path.toIO.getAbsolutePath}"))
297+ // case None =>
298+ // (allKotlinSourceFiles.map(_.path.toIO.getAbsolutePath), Seq())
299+ // }
300+
301+ val includeArgs = irClasspath.map(p => s " -Xinclude= ${p.path}" ).toSeq
302+ val inputFiles = irClasspath.fold(allKotlinSourceFiles.map(_.path))(_ => Seq ())
315303
316304 val librariesCp = librariesClasspath.map(_.path)
317305 .filter(os.exists)
@@ -399,8 +387,7 @@ trait KotlinJsModule extends KotlinModule { outer =>
399387 val compilerArgs : Seq [String ] = Seq (
400388 innerCompilerArgs.result(),
401389 extraKotlinArgs,
402- // parameters
403- inputFiles
390+ includeArgs
404391 ).flatten
405392
406393 val compileDestination = os.Path (outputArgs.last)
@@ -411,7 +398,12 @@ trait KotlinJsModule extends KotlinModule { outer =>
411398 } else {
412399 Task .log.info(s " Linking IR to $compileDestination" )
413400 }
414- val workerResult = worker.compile(KotlinWorkerTarget .Js , compilerArgs)
401+ val workerResult = worker.compile(
402+ target = KotlinWorkerTarget .Js ,
403+ useBtApi = useBtApi,
404+ args = compilerArgs,
405+ sources = inputFiles
406+ )
415407
416408 val analysisFile = Task .dest / " kotlin.analysis.dummy"
417409 if (! os.exists(analysisFile)) {
@@ -430,6 +422,11 @@ trait KotlinJsModule extends KotlinModule { outer =>
430422 }
431423 }
432424
425+ override def kotlincUseBtApi : Task .Simple [Boolean ] = Task {
426+ // currently not implemented
427+ false
428+ }
429+
433430 private def binaryKindToOutputMode (binaryKind : Option [BinaryKind ]): OutputMode =
434431 binaryKind match {
435432 // still produce IR classes, but they won't be yet linked
0 commit comments