summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.sbt7
-rwxr-xr-xbuild.sc12
-rw-r--r--readme.md22
3 files changed, 28 insertions, 13 deletions
diff --git a/build.sbt b/build.sbt
index 1dc993bf..eb789b79 100644
--- a/build.sbt
+++ b/build.sbt
@@ -101,7 +101,12 @@ lazy val scalaplugin = project
name := "mill-scalaplugin",
fork in Test := true,
baseDirectory in (Test, test) := (baseDirectory in (Test, test)).value / "..",
- javaOptions in (Test, test) := bridgeProps.value.toSeq,
+ javaOptions in (Test, test) := bridgeProps.value.toSeq
+ )
+lazy val bin = project
+ .dependsOn(scalaplugin)
+ .settings(
+ sharedSettings,
assemblyOption in assembly := {
(assemblyOption in assembly).value.copy(
prependShellScript = Some(
diff --git a/build.sc b/build.sc
index 29f1955f..a7508941 100755
--- a/build.sc
+++ b/build.sc
@@ -82,10 +82,12 @@ val bridges = for{
Dep.Java("org.scala-sbt", "compiler-interface", "1.0.5")
)
}
+
object ScalaPlugin extends MillModule {
override def projectDeps = Seq(Core)
def basePath = pwd / 'scalaplugin
+
override def testArgs = T{
val mapping = Map(
"MILL_COMPILER_BRIDGE_2_10_6" -> bridges("2.10.6").compile().classes.path,
@@ -97,6 +99,13 @@ object ScalaPlugin extends MillModule {
for((k, v) <- mapping.toSeq) yield s"-D$k=$v"
}
+}
+
+object Bin extends MillModule {
+
+ override def projectDeps = Seq(ScalaPlugin)
+ def basePath = pwd / 'bin
+
def releaseAssembly = T{
createAssembly(
(runDepClasspath().filter(_.path.ext != "pom") ++
@@ -109,5 +118,6 @@ object ScalaPlugin extends MillModule {
override def prependShellScript =
"#!/usr/bin/env sh\n" +
- s"""exec java ${testArgs().mkString(" ")} $$JAVA_OPTS -cp "$$0" mill.Main "$$@" """
+ s"""exec java ${ScalaPlugin.testArgs().mkString(" ")} $$JAVA_OPTS -cp "$$0" mill.Main "$$@" """
+
}
diff --git a/readme.md b/readme.md
index feef9e03..9efbdbdf 100644
--- a/readme.md
+++ b/readme.md
@@ -14,7 +14,7 @@ sbt core/test
Build a standalone executable jar:
```bash
-sbt scalaplugin/test:assembly
+sbt bin/test:assembly
```
Now you can re-build this very same project using the build.sc file, e.g. re-run
@@ -22,16 +22,16 @@ core unit tests
e.g.:
```bash
-./scalaplugin/target/mill run Core.compile
-./scalaplugin/target/mill run Core.test.compile
-./scalaplugin/target/mill run Core.test
-./scalaplugin/target/mill run ScalaPlugin.assembly
+./bin/target/mill run Core.compile
+./bin/target/mill run Core.test.compile
+./bin/target/mill run Core.test
+./bin/target/mill run ScalaPlugin.assembly
```
there is already a `watch` option that looks for changes on files, e.g.:
```bash
-./scalaplugin/target/mill --watch run Core.compile
+./bin/target/mill --watch run Core.compile
```
output will be generated into a the `./out` folder.
@@ -39,7 +39,7 @@ output will be generated into a the `./out` folder.
Lastly, you can generate IntelliJ Scala project files using Mill via
```bash
-./scalaplugin/target/mill idea
+./bin/target/mill idea
```
Allowing you to import a Mill project into Intellij without using SBT
@@ -50,7 +50,7 @@ Mill provides a build REPL, which lets you explore the build interactively and
run `Target`s from Scala code:
```scala
-lihaoyi mill$ scalaplugin/target/mill --repl
+lihaoyi mill$ bin/target/mill --repl
Loading...
Compiling (synthetic)/ammonite/predef/interpBridge.sc
Compiling (synthetic)/ammonite/predef/replBridge.sc
@@ -120,13 +120,13 @@ Mill executables that can you can use to run Mill commands:
git clean -xdf
# Build Mill executable using SBT
-sbt scalaplugin/test:assembly
+sbt bin/test:assembly
# Build Mill executable using the Mill executable generated by SBT
-scalaplugin/target/mill run ScalaPlugin.assembly
+bin/target/mill run Bin.assembly
# Build Mill executable using the Mill executable generated by Mill itself
-out/ScalaPlugin/assembly run ScalaPlugin.assembly
+out/Bin/assembly run Bin.assembly
```
Eventually, as Mill stabilizes, we will get rid of the SBT build entirely and