diff options
author | Andrew Richards <richards.aj@gmail.com> | 2018-07-18 08:50:09 +0100 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-07-18 15:50:09 +0800 |
commit | 1829391c0de0efcb96b1187fe35a0e9127e00d29 (patch) | |
tree | 4216bde1516e75fccbc8a8c6a0d1eebb5b929364 /build.sc | |
parent | 2d779b8ccd0a2f29a7d14dc193b4ad093142b521 (diff) | |
download | mill-1829391c0de0efcb96b1187fe35a0e9127e00d29.tar.gz mill-1829391c0de0efcb96b1187fe35a0e9127e00d29.tar.bz2 mill-1829391c0de0efcb96b1187fe35a0e9127e00d29.zip |
WIP: Scala native (#206)
* add scala-native PR#1143 as submodule
* first pass at integrating scala-native build into mill
including worker/bridge
* add the native libraries to the compile and run classpath
* sssshhh don't be so noisy
* update scala-native to latest build WIP
* update mill to latest scala-native build-api code
* add test interface from scala-native
this code is not published ornot published at the correct scala version so copy it in for now
* implement tests for scala-native
very messy at the moment
also correct bridge version as much as possible with out a scala-native release
* update to scala-native/master
scala-native #1143 now merged
* Remove scala-native submodule
* updates for scala-native 0.3.7 release
* fixes after rebase
* make test framework agnostic and tidy dependencies
* add robust method of getting JVM classpath for running tests
support for multiple test frameworks
tidy up
* rebase fixes for 0.2.0
* add SbtNativeModule and tidy
* rebase fixes
* fix building of compile / run Classpath (via transitiveIvyDeps)
better method of loading JVM test frameworks
* add tests for build, run, utest, scalatest
* move native tests into it own trait which can be extended/overidden
* change release mode to a sealed trait instead of boolean
* add logLevel to ScalaNativeModule and plumb in
propagate release and log levels to test projects
* use test-runner from scala-native instead of including project source
add ability easily compile against scala-native snapshots
* add some docs
* update to 0.3.8
Diffstat (limited to 'build.sc')
-rwxr-xr-x | build.sc | 47 |
1 files changed, 42 insertions, 5 deletions
@@ -156,7 +156,8 @@ object scalalib extends MillModule { genTask(core)() ++ genTask(main)() ++ genTask(scalalib)() ++ - genTask(scalajslib)() + genTask(scalajslib)() ++ + genTask(scalanativelib)() worker.testArgs() ++ main.graphviz.testArgs() ++ @@ -218,6 +219,39 @@ object twirllib extends MillModule { } +object scalanativelib extends MillModule { + def moduleDeps = Seq(scalalib) + + def scalacOptions = Seq[String]() // disable -P:acyclic:force + + def testArgs = T{ + val mapping = Map( + "MILL_SCALANATIVE_BRIDGE_0_3" -> + scalanativebridges("0.3").runClasspath() + .map(_.path) + .filter(_.toIO.exists) + .mkString(",") + ) + scalalib.worker.testArgs() ++ (for((k, v) <- mapping.toSeq) yield s"-D$k=$v") + } + + object scalanativebridges extends Cross[ScalaNativeBridgeModule]("0.3") + class ScalaNativeBridgeModule(scalaNativeBinary: String) extends MillModule { + def scalaNativeVersion = T{ "0.3.8" } + def moduleDeps = Seq(scalanativelib) + def ivyDeps = scalaNativeBinary match { + case "0.3" => + Agg( + ivy"org.scala-native::tools:${scalaNativeVersion()}", + ivy"org.scala-native::util:${scalaNativeVersion()}", + ivy"org.scala-native::nir:${scalaNativeVersion()}", + ivy"org.scala-native::nir:${scalaNativeVersion()}", + ivy"org.scala-native::test-runner:${scalaNativeVersion()}", + ) + } + } +} + def testRepos = T{ Seq( "MILL_ACYCLIC_REPO" -> @@ -238,10 +272,11 @@ def testRepos = T{ } object integration extends MillModule{ - def moduleDeps = Seq(moduledefs, scalalib, scalajslib) + def moduleDeps = Seq(moduledefs, scalalib, scalajslib, scalanativelib) def testArgs = T{ scalajslib.testArgs() ++ scalalib.worker.testArgs() ++ + scalanativelib.testArgs() ++ Seq( "-DMILL_TESTNG=" + testng.runClasspath().map(_.path).mkString(","), "-DMILL_VERSION=" + build.publishVersion()._2, @@ -290,12 +325,13 @@ def launcherScript(shellJvmArgs: Seq[String], } object dev extends MillModule{ - def moduleDeps = Seq(scalalib, scalajslib) + def moduleDeps = Seq(scalalib, scalajslib, scalanativelib) def forkArgs = ( scalalib.testArgs() ++ scalajslib.testArgs() ++ scalalib.worker.testArgs() ++ + scalanativelib.testArgs() ++ // Workaround for Zinc/JNA bug // https://github.com/sbt/sbt/blame/6718803ee6023ab041b045a6988fafcfae9d15b5/main/src/main/scala/sbt/Main.scala#L130 Seq( @@ -305,6 +341,7 @@ object dev extends MillModule{ ) ).distinct + // Pass dev.assembly VM options via file in Window due to small max args limit def windowsVmOptions(taskName: String, batch: Path, args: Seq[String])(implicit ctx: mill.util.Ctx) = { if (System.getProperty("java.specification.version").startsWith("1.")) { @@ -412,7 +449,7 @@ def gitHead = T.input{ def publishVersion = T.input{ val tag = try Option( - %%('git, 'describe, "--exact-match", "--tags", gitHead())(pwd).out.string.trim() + %%('git, 'describe, "--exact-match", "--tags", "--always", gitHead())(pwd).out.string.trim() ) catch{case e => None} @@ -424,7 +461,7 @@ def publishVersion = T.input{ tag match{ case Some(t) => (t, t) case None => - val latestTaggedVersion = %%('git, 'describe, "--abbrev=0", "--tags")(pwd).out.trim + val latestTaggedVersion = %%('git, 'describe, "--abbrev=0", "--always", "--tags")(pwd).out.trim val commitsSinceLastTag = %%('git, "rev-list", gitHead(), "--not", latestTaggedVersion, "--count")(pwd).out.trim.toInt |