summaryrefslogtreecommitdiff
path: root/src/main/scala/forge/scalaplugin/Subproject.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-10-31 20:54:00 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2017-10-31 20:54:00 -0700
commitf63535b955941e1a9a0f84abeaf53bb2f2cc2fc4 (patch)
treec9ed2e76692df275a7456b4bd7230a6132ae366a /src/main/scala/forge/scalaplugin/Subproject.scala
parentc8fa7e83c1934e30e178cb727d98dcf367a13d93 (diff)
downloadmill-f63535b955941e1a9a0f84abeaf53bb2f2cc2fc4.tar.gz
mill-f63535b955941e1a9a0f84abeaf53bb2f2cc2fc4.tar.bz2
mill-f63535b955941e1a9a0f84abeaf53bb2f2cc2fc4.zip
Sketched out `MetacircularTests` using `scalaplugin.Subproject`; still doesn't compile
Diffstat (limited to 'src/main/scala/forge/scalaplugin/Subproject.scala')
-rw-r--r--src/main/scala/forge/scalaplugin/Subproject.scala56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/main/scala/forge/scalaplugin/Subproject.scala b/src/main/scala/forge/scalaplugin/Subproject.scala
index c4c9c562..b548c559 100644
--- a/src/main/scala/forge/scalaplugin/Subproject.scala
+++ b/src/main/scala/forge/scalaplugin/Subproject.scala
@@ -5,7 +5,6 @@ import java.io.File
import ammonite.ops.{Path, ls, mkdir, pwd}
import coursier.{Cache, Dependency, Fetch, MavenRepository, Module, Repository, Resolution}
-import forge.scalaplugin.Compile.getClass
import forge.{Target => T}
import forge.util.PathRef
import sbt.internal.inc.{FreshCompilerCache, ScalaInstance, ZincUtil}
@@ -98,37 +97,42 @@ import Subproject._
abstract class Subproject {
val scalaVersion: T[String]
- val compileDeps: T[Seq[coursier.Dependency]]
- val runDeps: T[Seq[coursier.Dependency]]
+ val scalaBinaryVersion = T{ scalaVersion.map(_.split('.').dropRight(1).mkString(".")) }
+ val deps = T{ Seq[coursier.Dependency]() }
+ val compileDeps = T{ Seq[coursier.Dependency]() }
+ val runDeps = T{ Seq[coursier.Dependency]() }
val basePath: T[Path]
- val repositories: T[Seq[Repository]] = T(
- Seq(Cache.ivy2Local, MavenRepository("https://repo1.maven.org/maven2"))
+ val repositories: Seq[Repository] = Seq(
+ Cache.ivy2Local,
+ MavenRepository("https://repo1.maven.org/maven2")
)
- val compileDepClasspath: T[Seq[PathRef]] = resolveDependencies(
- repositories,
- for((scalaVersion, compileDeps) <- zip(scalaVersion, compileDeps))
- yield compileDeps :+ Dependency(Module("org.scala-lang", "scala-compiler"), scalaVersion)
+ val compileDepClasspath: T[Seq[PathRef]] = T(
+ resolveDependencies(
+ repositories,
+ for((scalaVersion, compileDeps) <- zip(scalaVersion, compileDeps))
+ yield compileDeps :+ Dependency(Module("org.scala-lang", "scala-compiler"), scalaVersion)
+ )
)
- val runDepClasspath: T[Seq[PathRef]] = resolveDependencies(
- repositories,
- for((scalaVersion, runDeps) <- zip(scalaVersion, runDeps))
- yield runDeps ++ Seq(
- Dependency(Module("org.scala-lang", "scala-library"), scalaVersion)
+ val runDepClasspath: T[Seq[PathRef]] = T(
+ resolveDependencies(
+ repositories,
+ for((scalaVersion, runDeps) <- zip(scalaVersion, runDeps))
+ yield runDeps ++ Seq(
+ Dependency(Module("org.scala-lang", "scala-library"), scalaVersion)
+ )
)
)
- val sources: T[PathRef] = basePath.map(p => PathRef(p / 'src))
- val outputPath: T[Path] = basePath.map(p => p / 'out)
- val resources: T[PathRef] = basePath.map(p => PathRef(p / 'resources))
- val compiledPath: T[Path] = outputPath.map(p => p / 'classpath)
- val compiled: T[PathRef] = compileScala(
- scalaVersion,
- sources,
- compileDepClasspath,
- outputPath
- )
- val classpath: T[Seq[PathRef]] = for((r, c) <- resources.zip(compiled)) yield Seq(r, c)
- val jar: T[PathRef] = createJar(classpath)
+ val sources = T{ basePath.map(p => PathRef(p / 'src)) }
+ val outputPath = T{ basePath.map(p => p / 'out) }
+ val resources = T{ basePath.map(p => PathRef(p / 'resources)) }
+ val compiledPath = T{ outputPath.map(p => p / 'classpath) }
+ val compiled = T{
+ compileScala(scalaVersion, sources, compileDepClasspath, outputPath)
+ }
+
+ val classpath = T{ for((r, c) <- resources.zip(compiled)) yield Seq(r, c) }
+ val jar = T{ createJar(classpath) }
}