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

Add support for Dotty projects #397

Merged
merged 6 commits into from
Aug 5, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Support using a locally published compiler
Publishing locally with sbt means publishing ivy-style, which uses
a different naming convention than maven, we now handle both cases.
smarter committed Aug 5, 2018
commit 41b68a1d289a3d2cf8207e86f5896409bb9243ba
10 changes: 6 additions & 4 deletions scalalib/src/mill/scalalib/Lib.scala
Original file line number Diff line number Diff line change
@@ -65,11 +65,13 @@ object Lib{
}
}

def grepJar(classPath: Agg[Path], s: String) = {
def grepJar(classPath: Agg[Path], name: String, version: String) = {
val mavenStylePath = s"$name-$version.jar"
val ivyStylePath = s"$version/$name.jar"

classPath
.find(_.toString.endsWith(s))
.getOrElse(throw new Exception("Cannot find " + s))
.toIO
.find(p => p.toString.endsWith(mavenStylePath) || p.toString.endsWith(ivyStylePath))
.getOrElse(throw new Exception(s"Cannot find $mavenStylePath or $ivyStylePath"))
}


7 changes: 6 additions & 1 deletion scalalib/src/mill/scalalib/ScalaModule.scala
Original file line number Diff line number Diff line change
@@ -84,7 +84,12 @@ trait ScalaModule extends JavaModule { outer =>
Lib.depToDependency(_, scalaVersion0, platformSuffix()),
Seq(ivy"org.scala-sbt::compiler-bridge:${Versions.zinc}"),
sources = true
).map(_.find(_.path.last == s"compiler-bridge_${scalaBinaryVersion0}-${Versions.zinc}-sources.jar").map(_.path).get)
).map(deps =>
grepJar(
deps.map(_.path),
s"compiler-bridge_${scalaBinaryVersion0}", s"${Versions.zinc}-sources"
)
)
}

def scalacPluginClasspath: T[Agg[PathRef]] = T {
4 changes: 2 additions & 2 deletions scalalib/worker/src/mill/scalalib/worker/ScalaWorker.scala
Original file line number Diff line number Diff line change
@@ -100,8 +100,8 @@ class ScalaWorker(ctx0: mill.util.Ctx,
val scalaInstance = new ScalaInstance(
version = scalaVersion,
loader = mill.util.ClassLoader.create(compilerJars.map(_.toURI.toURL), null),
libraryJar = grepJar(compilerClasspath, s"scala-library-$scalaVersion.jar"),
compilerJar = grepJar(compilerClasspath, s"scala-compiler-$scalaVersion.jar"),
libraryJar = grepJar(compilerClasspath, "scala-library", scalaVersion).toIO,
compilerJar = grepJar(compilerClasspath, "scala-compiler", scalaVersion).toIO,
allJars = compilerJars,
explicitActual = None
)