diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2017-10-31 21:47:49 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2017-10-31 21:47:49 -0700 |
commit | fc58e48c0e64bf5a51aed5499ee0e590fb92bfcd (patch) | |
tree | 9b0678cb6f7fdee4a3570429e317fd3de3aea62a /src/main/scala | |
parent | 9acfd75aa69be861a904b9b48b373584e67b4def (diff) | |
download | mill-fc58e48c0e64bf5a51aed5499ee0e590fb92bfcd.tar.gz mill-fc58e48c0e64bf5a51aed5499ee0e590fb92bfcd.tar.bz2 mill-fc58e48c0e64bf5a51aed5499ee0e590fb92bfcd.zip |
Metacircular building now works
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/forge/Target.scala | 4 | ||||
-rw-r--r-- | src/main/scala/forge/scalaplugin/Subproject.scala | 26 |
2 files changed, 19 insertions, 11 deletions
diff --git a/src/main/scala/forge/Target.scala b/src/main/scala/forge/Target.scala index 56157584..c0b85f2a 100644 --- a/src/main/scala/forge/Target.scala +++ b/src/main/scala/forge/Target.scala @@ -65,8 +65,8 @@ object Target{ } class Zipped[T, V](source1: Target[T], source2: Target[V]) extends Target[(T, V)]{ - def evaluate(args: Args) = (args(0), args(0)) - val inputs = List(source1, source1) + def evaluate(args: Args) = (args(0), args(1)) + val inputs = List(source1, source2) } def path(path: ammonite.ops.Path) = new Path(path) diff --git a/src/main/scala/forge/scalaplugin/Subproject.scala b/src/main/scala/forge/scalaplugin/Subproject.scala index cca60732..93532ec9 100644 --- a/src/main/scala/forge/scalaplugin/Subproject.scala +++ b/src/main/scala/forge/scalaplugin/Subproject.scala @@ -22,7 +22,13 @@ object Subproject{ for((scalaVersion, sources, compileClasspath, outputPath) <- zip(scalaVersion, sources, compileClasspath, outputPath)) yield { val binaryScalaVersion = scalaVersion.split('.').dropRight(1).mkString(".") - def grepJar(s: String) = compileClasspath.find(_.toString.endsWith(s)).get.path.toIO + def grepJar(s: String) = { + compileClasspath + .find(_.path.toString.endsWith(s)) + .getOrElse(throw new Exception("Cannot find " + s)) + .path + .toIO + } val scalac = ZincUtil.scalaCompiler( new ScalaInstance( version = scalaVersion, @@ -35,19 +41,18 @@ object Subproject{ grepJar(s"compiler-bridge_$binaryScalaVersion-1.0.3.jar") ) - val outputDir = pwd/'target/'zinc - mkdir(outputDir) + mkdir(outputPath) scalac.apply( - sources = ls.rec(sources.path).map(_.toIO).toArray, + sources = ls.rec(sources.path).filter(_.isFile).map(_.toIO).toArray, changes = new DependencyChanges { def isEmpty = true def modifiedBinaries() = Array[File]() def modifiedClasses() = Array[String]() }, classpath = compileClasspath.map(_.path.toIO).toArray, - singleOutput = outputDir.toIO, + singleOutput = outputPath.toIO, options = Array(), callback = new xsbti.AnalysisCallback { def startSource(source: File) = () @@ -111,15 +116,18 @@ abstract class Subproject { val compileDepClasspath: T[Seq[PathRef]] = T( resolveDependencies( repositories, - for((scalaVersion, compileDeps) <- zip(scalaVersion, compileDeps)) - yield compileDeps :+ Dependency(Module("org.scala-lang", "scala-compiler"), scalaVersion) + for((scalaVersion, scalaBinaryVersion, compileDeps, deps) <- zip(scalaVersion, scalaBinaryVersion, compileDeps, deps)) + yield deps ++ compileDeps ++ Seq( + Dependency(Module("org.scala-lang", "scala-compiler"), scalaVersion), + Dependency(Module("org.scala-sbt", s"compiler-bridge_$scalaBinaryVersion"), "1.0.3") + ) ) ) val runDepClasspath: T[Seq[PathRef]] = T( resolveDependencies( repositories, - for((scalaVersion, runDeps) <- zip(scalaVersion, runDeps)) - yield runDeps ++ Seq( + for((scalaVersion, runDeps, deps) <- zip(scalaVersion, runDeps, deps)) + yield deps ++ runDeps ++ Seq( Dependency(Module("org.scala-lang", "scala-library"), scalaVersion) ) ) |