summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/pages/1 - Intro to Mill.md13
-rw-r--r--docs/pages/2 - Configuring Mill.md26
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala7
-rw-r--r--scalalib/src/mill/scalalib/publish/settings.scala7
4 files changed, 48 insertions, 5 deletions
diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md
index 3602e038..bbed0ed7 100644
--- a/docs/pages/1 - Intro to Mill.md
+++ b/docs/pages/1 - Intro to Mill.md
@@ -39,6 +39,12 @@ To get started, download Mill from:
https://github.com/lihaoyi/mill/releases/download/0.2.4/0.2.4, and save it as
`mill.bat`.
+If you're using [Scoop](https://scoop.sh) you can install Mill via
+
+```bash
+scoop install mill
+```
+
Mill also works on a sh environment on Windows (e.g.,
[MSYS2](https://www.msys2.org),
[Cygwin](https://www.cygwin.com),
@@ -54,6 +60,13 @@ to get started, follow the instructions in the [manual](#manual) section below.
sed -i '0,/-cp "\$0"/{s/-cp "\$0"/-cp `cygpath -w "\$0"`/}; 0,/-cp "\$0"/{s/-cp "\$0"/-cp `cygpath -w "\$0"`/}' /usr/local/bin/mill
```
+### Docker
+You can download and run a [Docker image containing OpenJDK, Scala and Mill](https://hub.docker.com/r/nightscape/scala-mill/) using
+```bash
+docker pull nightscape/scala-mill
+docker run -it nightscape/scala-mill
+```
+
### Manual
To get started, download Mill and install it into your system via the following
diff --git a/docs/pages/2 - Configuring Mill.md b/docs/pages/2 - Configuring Mill.md
index 036fbe6b..6f7b29c7 100644
--- a/docs/pages/2 - Configuring Mill.md
+++ b/docs/pages/2 - Configuring Mill.md
@@ -448,7 +448,7 @@ object foo extends ScalaModule {
def scalaVersion = "2.12.4"
def unmanagedClasspath = T {
if (!ammonite.ops.exists(millSourcePath / "lib")) Agg()
- else Agg.from(ammonite.ops.ls(millSourcePath / "lib"))
+ else Agg.from(ammonite.ops.ls(millSourcePath / "lib").map(PathRef(_)))
}
}
```
@@ -474,6 +474,30 @@ compilation output, but if there is more than one or the main class comes from
some library you can explicitly specify which one to use. This also adds the
main class to your `foo.jar` and `foo.assembly` jars.
+## Merge/exclude files from assembly
+
+When you make a runnable jar of your project with `assembly` command,
+you may want to exclude some files from a final jar (like signature files, and manifest files from library jars),
+and merge duplicated files (for instance `reference.conf` files from library dependencies).
+
+By default mill excludes all `*.sf`, `*.dsa`, `*.rsa`, and `META-INF/MANIFEST.MF` files from assembly, and concatenates all `reference.conf` files.
+You can also define your own merge/exclude rules.
+
+```scala
+// build.sc
+import mill._, scalalib._
+import mill.modules.Assembly._
+
+object foo extends ScalaModule {
+ def scalaVersion = "2.12.4"
+ def assemblyRules = Seq(
+ Rule.Append("application.conf"), // all application.conf files will be concatenated into single file
+ Rule.AppendPattern(".*\\.conf"), // all *.conf files will be concatenated into single file
+ Rule.ExcludePattern("*.temp") // all *.temp files will be excluded from a final jar
+ )
+}
+```
+
## Downloading Non-Maven Jars
```scala
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index 9262b6e0..3ce84088 100644
--- a/scalalib/src/mill/scalalib/ScalaModule.scala
+++ b/scalalib/src/mill/scalalib/ScalaModule.scala
@@ -38,7 +38,12 @@ trait ScalaModule extends JavaModule { outer =>
}
override def resolvePublishDependency: Task[Dep => publish.Dependency] = T.task{
- publish.Artifact.fromDep(_: Dep, scalaVersion(), Lib.scalaBinaryVersion(scalaVersion()))
+ publish.Artifact.fromDep(
+ _: Dep,
+ scalaVersion(),
+ Lib.scalaBinaryVersion(scalaVersion()),
+ platformSuffix()
+ )
}
override def finalMainClassOpt: T[Either[String, String]] = T{
diff --git a/scalalib/src/mill/scalalib/publish/settings.scala b/scalalib/src/mill/scalalib/publish/settings.scala
index 2cd92eb2..9a59f09d 100644
--- a/scalalib/src/mill/scalalib/publish/settings.scala
+++ b/scalalib/src/mill/scalalib/publish/settings.scala
@@ -20,14 +20,15 @@ object Artifact {
}
def fromDep(dep: Dep,
scalaFull: String,
- scalaBin: String): Dependency = {
+ scalaBin: String,
+ platformSuffix: String): Dependency = {
dep match {
case d: Dep.Java => fromDepJava(d)
case Dep.Scala(dep, cross, force) =>
Dependency(
Artifact(
dep.module.organization,
- s"${dep.module.name}_${scalaBin}",
+ s"${dep.module.name}${platformSuffix}_${scalaBin}",
dep.version
),
Scope.Compile,
@@ -38,7 +39,7 @@ object Artifact {
Dependency(
Artifact(
dep.module.organization,
- s"${dep.module.name}_${scalaFull}",
+ s"${dep.module.name}${platformSuffix}_${scalaFull}",
dep.version
),
Scope.Compile,