summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby <robby@santoslab.org>2018-04-07 08:23:42 -0500
committerGitHub <noreply@github.com>2018-04-07 08:23:42 -0500
commitccb67db3759a16e95a75920d87281185310ccd81 (patch)
treeb901d0173eaf48489583c9a905914baaaf3486ab
parente628c84be7cf0b7bb00ba2141635d29503203fc4 (diff)
downloadmill-ccb67db3759a16e95a75920d87281185310ccd81.tar.gz
mill-ccb67db3759a16e95a75920d87281185310ccd81.tar.bz2
mill-ccb67db3759a16e95a75920d87281185310ccd81.zip
Merge April 1 - 4, 2018 changes on master (#283)
* fix build * Detect sh/batch launcher, dev.assembly, and release filename. * Updated appveyor cache. * Added some entries for master in readme.md changelog. * Updated readme.md changelog. * fixes #173; use default(compile) configuration for deps as default (#270) * revert #254 to fix bootstrapping https://github.com/lihaoyi/mill/issues/268 * Updated ci tests. * Reverted Ammonite caching workaround (a796f0a) now that it's fixed * Changed ci/test-mill-0.sh to use interactive mode due to intermittent client failures to connect to server in travis * Added ci/test-mill-bootstrap.sh (ci/test-mill-0.sh with bootstrapping) and use it on oraclejdk9 instead of ci/test-mill-0.sh * Upgraded mill used for ci to 0.1.7-29-f5097f * revive #254 and fix #268 (#274) * Test mill batch (.bat) in AppVeyor * fix minor typos in docs * Sync Ammonite in ScalaModule (with build.sc).
-rw-r--r--.appveyor.yml18
-rw-r--r--.travis.yml4
-rwxr-xr-xbuild.sc33
-rwxr-xr-xci/test-mill-0.sh4
-rwxr-xr-xci/test-mill-1.sh2
-rwxr-xr-xci/test-mill-2.sh2
-rwxr-xr-xci/test-mill-bootstrap.sh26
-rwxr-xr-xci/test-mill-dev.sh4
-rwxr-xr-xci/test-mill-release.sh7
-rw-r--r--docs/pages/1 - Intro to Mill.md8
-rw-r--r--main/src/mill/modules/Jvm.scala6
-rw-r--r--readme.md35
-rw-r--r--scalalib/src/mill/scalalib/Dep.scala10
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala2
-rw-r--r--scalalib/src/mill/scalalib/publish/Ivy.scala6
-rw-r--r--scalalib/src/mill/scalalib/publish/Pom.scala2
-rw-r--r--scalalib/test/src/mill/scalalib/ResolveDepsTests.scala8
17 files changed, 115 insertions, 62 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 693bd85e..9a281405 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -9,6 +9,8 @@ clone_folder: c:\mill
environment:
matrix:
+ - COMPILER: default
+ JAVA_HOME: C:\Program Files\Java\jdk9
- COMPILER: cygwin
CYGWIN_DIR: cygwin64
JAVA_HOME: C:\Program Files\Java\jdk9
@@ -17,26 +19,26 @@ environment:
MSYS2_DIR: msys64
MSYSTEM: MINGW64
JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- - COMPILER: msys2
- MSYS2_ARCH: x86_64
- MSYS2_DIR: msys64
- MSYSTEM: MINGW64
- JAVA_HOME: C:\Program Files\Java\jdk9
cache:
- - '%LOCALAPPDATA%\Coursier\cache'
+ - '%LOCALAPPDATA%\Coursier\cache -> build.sc'
install:
- - SET MILL_URL=https://github.com/lihaoyi/mill/releases/download/0.1.7/0.1.7-8-b913c6
+ - SET MILL_URL=https://github.com/lihaoyi/mill/releases/download/0.1.7/0.1.7-29-f5097f
build_script:
+ - if [%COMPILER%]==[default] (
+ SET "PATH=%JAVA_HOME%\bin;%PATH%" &&
+ MD C:\bin &&
+ curl -Lo C:\bin\mill.bat %MILL_URL% &&
+ cmd /C C:\bin\mill.bat -i all __.publishLocal release &&
+ cmd /C C:\mill\out\release\dest\mill.bat -i all main.test scalajslib.test)
- if [%COMPILER%]==[msys2] (
SET "PATH=%JAVA_HOME%\bin;C:\%MSYS2_DIR%\%MSYSTEM%\bin;C:\%MSYS2_DIR%\usr\bin;%PATH%" &&
C:\%MSYS2_DIR%\usr\bin\bash -lc 'mkdir -p /usr/local/bin' &&
C:\%MSYS2_DIR%\usr\bin\bash -lc "curl -Lo /usr/local/bin/mill %MILL_URL%" &&
C:\%MSYS2_DIR%\usr\bin\bash -lc 'chmod +x /usr/local/bin/mill' &&
C:\%MSYS2_DIR%\usr\bin\bash -lc "cd /c/mill && mill -i all __.publishLocal release" &&
- rd /s /q %USERPROFILE%\.mill &&
C:\%MSYS2_DIR%\usr\bin\bash -lc "cd /c/mill && out/release/dest/mill -i all main.test scalajslib.test")
- if [%COMPILER%]==[cygwin] (
SET "PATH=%JAVA_HOME%\bin;C:\%CYGWIN_DIR%\bin;C:\%CYGWIN_DIR%\usr\bin;%PATH%" &&
diff --git a/.travis.yml b/.travis.yml
index e0e20fc7..bdbff76d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,7 @@ matrix:
env: CI_SCRIPT=ci/test-mill-dev.sh
jdk: oraclejdk9
- stage: build
- env: CI_SCRIPT=ci/test-mill-0.sh
+ env: CI_SCRIPT=ci/test-mill-bootstrap.sh
jdk: oraclejdk9
- stage: release
@@ -38,7 +38,7 @@ matrix:
jdk: oraclejdk8
script:
- - curl -L -o ~/bin/mill https://github.com/lihaoyi/mill/releases/download/0.1.7/0.1.7-8-b913c6 && chmod +x ~/bin/mill
+ - curl -L -o ~/bin/mill https://github.com/lihaoyi/mill/releases/download/0.1.7/0.1.7-29-f5097f && chmod +x ~/bin/mill
- export PATH=~/bin/mill:$PATH
- "$CI_SCRIPT"
diff --git a/build.sc b/build.sc
index 7ceafc2e..1890edf2 100755
--- a/build.sc
+++ b/build.sc
@@ -258,6 +258,13 @@ def launcherScript(jvmArgs: Seq[String],
)
}
+val isBatch =
+ scala.util.Properties.isWin &&
+ !(org.jline.utils.OSUtils.IS_CYGWIN
+ || org.jline.utils.OSUtils.IS_MINGW
+ || "MSYS" == System.getProperty("MSYSTEM"))
+
+
object dev extends MillModule{
def moduleDeps = Seq(scalalib, scalajslib)
def forkArgs = T{
@@ -265,7 +272,7 @@ object dev extends MillModule{
}
def launcher = T{
val isWin = scala.util.Properties.isWin
- val outputPath = T.ctx().dest / "run"
+ val outputPath = T.ctx().dest / (if (isBatch) "run.bat" else "run")
write(outputPath, prependShellScript())
@@ -280,7 +287,7 @@ object dev extends MillModule{
}
def assembly = T{
- val filename = "mill"
+ val filename = if (isBatch) "mill.bat" else "mill"
mv(super.assembly().path, T.ctx().dest / filename)
PathRef(T.ctx().dest / filename)
}
@@ -307,29 +314,21 @@ object dev extends MillModule{
}
}
-private def releaseHelper(dest: Path,
- cp: Agg[Path],
- ver: String)
- (implicit ctx: mill.util.Ctx.Dest): PathRef = {
+def release = T{
+ val dest = T.ctx().dest
+ val filename = if (isBatch) "mill.bat" else "mill"
mv(
createAssembly(
- cp,
+ dev.runClasspath().map(_.path),
prependShellScript = launcherScript(
- Seq("-DMILL_VERSION=" + ver),
+ Seq("-DMILL_VERSION=" + publishVersion()._2),
Agg("$0"),
Agg("%~dpnx0")
)
).path,
- dest / "mill"
+ dest / filename
)
- PathRef(dest / "mill")
-}
-
-def release = T{
- releaseHelper(
- T.ctx().dest,
- dev.runClasspath().map(_.path),
- publishVersion()._2)
+ PathRef(dest / filename)
}
val isMasterCommit = {
diff --git a/ci/test-mill-0.sh b/ci/test-mill-0.sh
index 3d1470f1..2cc78d81 100755
--- a/ci/test-mill-0.sh
+++ b/ci/test-mill-0.sh
@@ -5,5 +5,5 @@ set -eux
# Starting from scratch...
git clean -xdf
-# Run tests using Mill built using SBT
-mill all {clientserver,main,scalalib,scalajslib}.test
+# Run tests
+mill -i all {clientserver,main,scalalib,scalajslib}.test
diff --git a/ci/test-mill-1.sh b/ci/test-mill-1.sh
index 079cb519..b0ed7bc2 100755
--- a/ci/test-mill-1.sh
+++ b/ci/test-mill-1.sh
@@ -5,5 +5,5 @@ set -eux
# Starting from scratch...
git clean -xdf
-# Run tests using Mill built using SBT
+# Run tests
mill integration.test "mill.integration.local.{JawnTests,BetterFilesTests,UpickleTests}"
diff --git a/ci/test-mill-2.sh b/ci/test-mill-2.sh
index 3b0da706..ce61bb7c 100755
--- a/ci/test-mill-2.sh
+++ b/ci/test-mill-2.sh
@@ -5,5 +5,5 @@ set -eux
# Starting from scratch...
git clean -xdf
-# Run tests using Mill built using SBT
+# Run tests
mill integration.test "mill.integration.local.{AcyclicTests,AmmoniteTests}"
diff --git a/ci/test-mill-bootstrap.sh b/ci/test-mill-bootstrap.sh
new file mode 100755
index 00000000..be2b5c3a
--- /dev/null
+++ b/ci/test-mill-bootstrap.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -eux
+
+# Starting from scratch...
+git clean -xdf
+
+# First build
+mill -i all __.publishLocal release
+mv out/release/dest/mill ~/mill-1
+
+# Clean up
+git clean -xdf
+
+# Differentiate first and second builds
+echo "Build 2" > info.txt && git add info.txt && git commit -m "Add info.txt"
+
+# Second build
+~/mill-1 -i all __.publishLocal release
+mv out/release/dest/mill ~/mill-2
+
+# Clean up
+git clean -xdf
+
+# Use second build to run tests using Mill
+~/mill-2 -i all {clientserver,main,scalalib,scalajslib}.test \ No newline at end of file
diff --git a/ci/test-mill-dev.sh b/ci/test-mill-dev.sh
index ae8556fb..52deb139 100755
--- a/ci/test-mill-dev.sh
+++ b/ci/test-mill-dev.sh
@@ -8,8 +8,6 @@ git clean -xdf
# Build Mill
mill -i dev.assembly
-rm -fR ~/.mill
-
-# Second build & run tests using Mill
+# Second build & run tests
out/dev/assembly/dest/mill -i all {clientserver,main,scalalib,scalajslib}.test
diff --git a/ci/test-mill-release.sh b/ci/test-mill-release.sh
index 19173827..f1fb10ae 100755
--- a/ci/test-mill-release.sh
+++ b/ci/test-mill-release.sh
@@ -5,12 +5,11 @@ set -eux
# Starting from scratch...
git clean -xdf
+# Build Mill
ci/publish-local.sh
+# Clean up
git clean -xdf
-rm -fR ~/.mill
-
-# Second build & run tests using Mill
-
+# Run tests
~/mill-release -i integration.test "mill.integration.forked.{AcyclicTests,UpickleTests,PlayJsonTests}"
diff --git a/docs/pages/1 - Intro to Mill.md b/docs/pages/1 - Intro to Mill.md
index d0ce29c7..305721d4 100644
--- a/docs/pages/1 - Intro to Mill.md
+++ b/docs/pages/1 - Intro to Mill.md
@@ -453,13 +453,12 @@ res2: mill.scalalib.CompilationResult = CompilationResult(
)
```
-You can run `mill` alone to open a build REPL; this is a Scala console with your
+You can run `mill -i` to open a build REPL; this is a Scala console with your
`build.sc` loaded, which lets you run tasks interactively. The task-running
syntax is slightly different from the command-line, but more in-line with how
you would depend on tasks from within your build file.
-You can use this REPL to run build commands quicker, due to keeping the JVM warm
-between runs, or to interactively explore your build to see what is available.
+You can use this REPL to interactively explore your build to see what is available.
## Deploying your code
@@ -543,6 +542,5 @@ You also need to specify `release` as `true` or `false`, depending on whether
you just want to stage your module on `oss.sonatype.org` or you want Mill to
complete the release process to Maven Central.
-If you are publishing multiple artifacts, you can also use `target/bin/mill
-mill.scalalib.PublishModule/publishAll1 as described
+If you are publishing multiple artifacts, you can also use `mill mill.scalalib.PublishModule/publishAll` as described
[here](http://www.lihaoyi.com/mill/page/common-project-layouts.html#publishing)
diff --git a/main/src/mill/modules/Jvm.scala b/main/src/mill/modules/Jvm.scala
index 8e9d443e..287dc624 100644
--- a/main/src/mill/modules/Jvm.scala
+++ b/main/src/mill/modules/Jvm.scala
@@ -355,7 +355,11 @@ object Jvm {
jvmArgs: Seq[String])
(implicit ctx: Ctx.Dest)= {
val isWin = scala.util.Properties.isWin
- val outputPath = ctx.dest / "run"
+ val isBatch = isWin &&
+ !(org.jline.utils.OSUtils.IS_CYGWIN
+ || org.jline.utils.OSUtils.IS_MINGW
+ || "MSYS" == System.getProperty("MSYSTEM"))
+ val outputPath = ctx.dest / (if (isBatch) "run.bat" else "run")
val classPathStrs = classPath.map(_.toString)
write(outputPath, launcherUniversalScript(mainClass, classPathStrs, classPathStrs, jvmArgs))
diff --git a/readme.md b/readme.md
index da41853b..1eec0e66 100644
--- a/readme.md
+++ b/readme.md
@@ -328,24 +328,41 @@ rm -rf out/
## Changelog
+### Master
+
+- Universal (combined batch/sh) script generation for launcher, assembly, and release
+
+ For some shell (e.g., `ksh` or `fish`), a shebang line should be added, e.g., using GNU sed:
+
+ ```bash
+ sed -i '1s;^;#!/usr/bin/env sh\n;' <mill-path>
+ ```
+
+ Or download directly with shebang added as follows:
+
+ ```bash
+ sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L <mill-url>) > /usr/local/bin/mill && chmod +x /usr/local/bin/mill'
+ ```
+
+ On Windows, save `<mill-url>` as `mill.bat`
+
+- Windows client/server improvements
+
+- Windows repl support (note: MSYS2 subsystem/shell will be supported when jline3 v3.6.3 is released)
+
+- Fixed Java 9 support
+
### 0.1.7
+- Windows batch (.bat) generation for launcher, assembly, and release
+
- Support for non-interactive (client/server) mode on Windows.
- Mill requires an `sh` environment to run on Windows;
- it is recommended to use [MSYS2](https://www.msys2.org) on Windows.
-
- [Cygwin](https://www.cygwin.com) can also be used,
- but your mileage may vary when running mill on non-interactive (client/server) mode
- (it failed intermittently in mill's AppVeyor tests).
On Cygwin, run the following after downloading mill:
```bash
sed -i '0,/-cp "\$0"/{s/-cp "\$0"/-cp `cygpath -w "\$0"`/}; 0,/-cp "\$0"/{s/-cp "\$0"/-cp `cygpath -w "\$0"`/}' <mill-path>
```
-
- Mill also runs on [Git-Bash](https://gitforwindows.org) and [WSL](https://docs.microsoft.com/windows/wsl)
- but only on interactive mode.
- More fixes for Java 9
diff --git a/scalalib/src/mill/scalalib/Dep.scala b/scalalib/src/mill/scalalib/Dep.scala
index 84aa6576..9719bd2d 100644
--- a/scalalib/src/mill/scalalib/Dep.scala
+++ b/scalalib/src/mill/scalalib/Dep.scala
@@ -24,6 +24,8 @@ sealed trait Dep {
}
object Dep{
+ val DefaultConfiguration = "default(compile)"
+
implicit def parse(signature: String) = {
val parts = signature.split(';')
val module = parts.head
@@ -45,7 +47,7 @@ object Dep{
}).configure(attributes = attributes)
}
def apply(org: String, name: String, version: String, cross: Boolean): Dep = {
- this(coursier.Dependency(coursier.Module(org, name), version), cross)
+ this(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross)
}
case class Java(dep: coursier.Dependency, cross: Boolean, force: Boolean) extends Dep {
def configure(attributes: coursier.Attributes): Dep = copy(dep = dep.copy(attributes = attributes))
@@ -53,7 +55,7 @@ object Dep{
object Java{
implicit def rw: RW[Java] = macroRW
def apply(org: String, name: String, version: String, cross: Boolean, force: Boolean): Dep = {
- Java(coursier.Dependency(coursier.Module(org, name), version), cross, force)
+ Java(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross, force)
}
}
implicit def default(dep: coursier.Dependency): Dep = new Java(dep, false, false)
@@ -64,7 +66,7 @@ object Dep{
object Scala{
implicit def rw: RW[Scala] = macroRW
def apply(org: String, name: String, version: String, cross: Boolean, force: Boolean): Dep = {
- Scala(coursier.Dependency(coursier.Module(org, name), version), cross, force)
+ Scala(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross, force)
}
}
case class Point(dep: coursier.Dependency, cross: Boolean, force: Boolean) extends Dep {
@@ -73,7 +75,7 @@ object Dep{
object Point{
implicit def rw: RW[Point] = macroRW
def apply(org: String, name: String, version: String, cross: Boolean, force: Boolean): Dep = {
- Point(coursier.Dependency(coursier.Module(org, name), version), cross, force)
+ Point(coursier.Dependency(coursier.Module(org, name), version, DefaultConfiguration), cross, force)
}
}
implicit def rw = RW.merge[Dep](
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index 562b60d6..c0ef6cce 100644
--- a/scalalib/src/mill/scalalib/ScalaModule.scala
+++ b/scalalib/src/mill/scalalib/ScalaModule.scala
@@ -335,7 +335,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
unmanagedClasspath() ++
resolveDeps(T.task{
runIvyDeps() ++ scalaLibraryIvyDeps() ++ transitiveIvyDeps() ++
- Agg(ivy"com.lihaoyi:::ammonite:1.1.0-7-33b728c")
+ Agg(ivy"com.lihaoyi:::ammonite:1.1.0-12-f07633d")
})()
}
diff --git a/scalalib/src/mill/scalalib/publish/Ivy.scala b/scalalib/src/mill/scalalib/publish/Ivy.scala
index 3b271fa8..22e26ff6 100644
--- a/scalalib/src/mill/scalalib/publish/Ivy.scala
+++ b/scalalib/src/mill/scalalib/publish/Ivy.scala
@@ -42,10 +42,10 @@ object Ivy {
private def renderDependency(dep: Dependency) = {
if (dep.exclusions.isEmpty)
- <dependency org={dep.artifact.group} name={dep.artifact.id} rev={dep.artifact.version} conf={s"${dep.scope}->default(${dep.configuration.getOrElse("compile")})"} />
+ <dependency org={dep.artifact.group} name={dep.artifact.id} rev={dep.artifact.version} conf={s"${scopeToConf(dep.scope)}->${dep.configuration.getOrElse("default(compile)")}"} />
else
- <dependency org={dep.artifact.group} name={dep.artifact.id} rev={dep.artifact.version} conf={s"${dep.scope}->default(${dep.configuration.getOrElse("compile")})"}>
- {dep.exclusions.map(ex => <exclude org={ex._1} name={ex._2} matcher="exact"/>).toSeq}
+ <dependency org={dep.artifact.group} name={dep.artifact.id} rev={dep.artifact.version} conf={s"${scopeToConf(dep.scope)}->${dep.configuration.getOrElse("default(compile)")}"}>
+ {dep.exclusions.map(ex => <exclude org={ex._1} name={ex._2} matcher="exact"/>)}
</dependency>
}
diff --git a/scalalib/src/mill/scalalib/publish/Pom.scala b/scalalib/src/mill/scalalib/publish/Pom.scala
index 3c8ba4dc..84cf0632 100644
--- a/scalalib/src/mill/scalalib/publish/Pom.scala
+++ b/scalalib/src/mill/scalalib/publish/Pom.scala
@@ -108,7 +108,7 @@ object Pom {
<groupId>{ex._1}</groupId>
<artifactId>{ex._2}</artifactId>
</exclude>
- )}.toSeq
+ )}
</exclusions>
{scope}
</dependency>
diff --git a/scalalib/test/src/mill/scalalib/ResolveDepsTests.scala b/scalalib/test/src/mill/scalalib/ResolveDepsTests.scala
index b1fcec3e..861fa312 100644
--- a/scalalib/test/src/mill/scalalib/ResolveDepsTests.scala
+++ b/scalalib/test/src/mill/scalalib/ResolveDepsTests.scala
@@ -26,6 +26,14 @@ object ResolveDepsTests extends TestSuite {
assert(paths.items.next.path.toString.contains("natives-macos"))
}
+ 'resolveTransitiveRuntimeDeps - {
+ val deps = Agg(ivy"org.mockito:mockito-core:2.7.22")
+ val Success(paths) = evalDeps(deps)
+ assert(paths.nonEmpty)
+ assert(paths.exists(_.path.toString.contains("objenesis")))
+ assert(paths.exists(_.path.toString.contains("byte-buddy")))
+ }
+
'excludeTransitiveDeps - {
val deps = Agg(ivy"com.lihaoyi::pprint:0.5.3".exclude("com.lihaoyi" -> "fansi_2.12"))
val Success(paths) = evalDeps(deps)