Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GenIdea): Multiple scala library in Scala SDK #3170

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions idea/src/mill/idea/GenIdeaImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ case class GenIdeaImpl(
// TODO: make this a separate eval to handle resolve errors
externalSources()
val resolvedSp: Agg[PathRef] = scalacPluginDependencies()
val resolvedCompilerCp: Agg[PathRef] =
scalaCompilerClasspath()
val (scalajsLibs, resolvedCompilerCp): (Agg[PathRef], Agg[PathRef]) =
scalaCompilerClasspath().partition { cp =>
val path = cp.path.toString()
path.contains("scalajs") || path.contains("sjs")
}
val resolvedLibraryCp: Agg[PathRef] =
externalLibraryDependencies()
val scalacOpts: Seq[String] = allScalacOptions()
Expand All @@ -210,12 +213,20 @@ case class GenIdeaImpl(
configFileContributions()
val resolvedCompilerOutput = compilerOutput()
val resolvedScalaVersion = scalaVersion()
// Ignore scala3-library_3 if sjs versions are presented
val filteredResolvedCp = if (scalajsLibs.isEmpty) {
resolvedCp
} else {
resolvedCp.filterNot(
_.value.toString().contains("scala3-library_3")
)
}

ResolvedModule(
path = path,
// FIXME: why do we need to sources in the classpath?
// FIXED, was: classpath = resolvedCp.map(_.path).filter(_.ext == "jar") ++ resolvedSrcs.map(_.path),
classpath = resolvedCp.filter(_.value.ext == "jar"),
classpath = filteredResolvedCp.filter(_.value.ext == "jar"),
module = mod,
pluginClasspath = resolvedSp.map(_.path).filter(_.ext == "jar"),
scalaOptions = scalacOpts,
Expand Down
Loading