diff --git a/.config/mill-version b/.config/mill-version index 624e53bb2ea..e7fd7ecd910 100644 --- a/.config/mill-version +++ b/.config/mill-version @@ -1 +1 @@ -0.12.5-130-8f256f-DIRTY3537ab30-native \ No newline at end of file +0.12.5-130-8f256f-DIRTY3537ab30-native diff --git a/example/javalib/basic/1-simple/build.mill b/example/javalib/basic/1-simple/build.mill index 67abcd1e759..85b8b4b7a3b 100644 --- a/example/javalib/basic/1-simple/build.mill +++ b/example/javalib/basic/1-simple/build.mill @@ -99,4 +99,9 @@ Test run foo.FooTest finished: 0 failed, 0 ignored, 2 total, ... > ./out/foo/assembly.dest/out.jar --text hello # mac/linux

hello

+> cp ./out/foo/assembly.dest/out.jar out.bat # windows + +> ./out.bat --text hello # windows +

hello

+ */ diff --git a/example/javalib/publishing/1-assembly-config/foo/src/foo/Foo.java b/example/javalib/publishing/1-assembly-config/foo/src/foo/Foo.java index 87af722ed02..6f7d62e9e76 100644 --- a/example/javalib/publishing/1-assembly-config/foo/src/foo/Foo.java +++ b/example/javalib/publishing/1-assembly-config/foo/src/foo/Foo.java @@ -8,5 +8,6 @@ public static void main(String[] args) throws IOException { InputStream inputStream = Foo.class.getClassLoader().getResourceAsStream("application.conf"); String conf = new String(inputStream.readAllBytes()); System.out.println("Loaded application.conf from resources: " + conf); + System.out.println("Loaded test.property: " + System.getProperty("test.property")); } } diff --git a/example/kotlinlib/basic/1-simple/build.mill b/example/kotlinlib/basic/1-simple/build.mill index bb5f4f5ef62..5c90b858120 100644 --- a/example/kotlinlib/basic/1-simple/build.mill +++ b/example/kotlinlib/basic/1-simple/build.mill @@ -113,4 +113,8 @@ Test run finished: 0 failed, 0 ignored, 2 total, ... > ./out/foo/assembly.dest/out.jar --text hello # mac/linux

hello

+> cp ./out/foo/assembly.dest/out.jar out.bat # windows + +> ./out.bat --text hello # windows +

hello

*/ diff --git a/example/kotlinlib/publishing/1-assembly-config/foo/src/foo/Foo.kt b/example/kotlinlib/publishing/1-assembly-config/foo/src/foo/Foo.kt index 7dec7cec592..6530a391fb0 100644 --- a/example/kotlinlib/publishing/1-assembly-config/foo/src/foo/Foo.kt +++ b/example/kotlinlib/publishing/1-assembly-config/foo/src/foo/Foo.kt @@ -8,4 +8,5 @@ fun main(args: Array) { val conf = it.readAllBytes().toString(Charsets.UTF_8) println("Loaded application.conf from resources: $conf") } + println("Loaded test.property: " + System.getProperty("test.property")) } diff --git a/example/scalalib/basic/1-simple/build.mill b/example/scalalib/basic/1-simple/build.mill index d06aad7401d..04e287019f0 100644 --- a/example/scalalib/basic/1-simple/build.mill +++ b/example/scalalib/basic/1-simple/build.mill @@ -119,6 +119,12 @@ error: Missing argument: --text > ./out/foo/assembly.dest/out.jar --text hello # mac/linux

hello

+> # Note that on windows you need to rename `out.jar` to `out.bat` to run it +> cp ./out/foo/assembly.dest/out.jar out.bat # windows + +> ./out.bat --text hello # windows +

hello

+ */ //// SNIPPET:END diff --git a/example/scalalib/publishing/1-assembly-config/build.mill b/example/scalalib/publishing/1-assembly-config/build.mill index df8aeda18e5..0c52b109e19 100644 --- a/example/scalalib/publishing/1-assembly-config/build.mill +++ b/example/scalalib/publishing/1-assembly-config/build.mill @@ -47,3 +47,14 @@ Loaded application.conf from resources:... ...Bar Application Conf */ + +// Note that when running the assembly directly via `./out.jar`, you can configure +// JVM flags via the `JAVA_OPTS` environment variable, and select the JVM +// to use via `JAVA_HOME`. + +/** Usage + +> JAVA_OPTS=-Dtest.property=1337 ./out/foo/assembly.dest/out.jar +Loaded test.property: 1337 + +*/ diff --git a/example/scalalib/publishing/1-assembly-config/foo/src/Foo.scala b/example/scalalib/publishing/1-assembly-config/foo/src/Foo.scala index 7cc5814801e..c20bdd94e67 100644 --- a/example/scalalib/publishing/1-assembly-config/foo/src/Foo.scala +++ b/example/scalalib/publishing/1-assembly-config/foo/src/Foo.scala @@ -3,5 +3,6 @@ object Foo { def main(args: Array[String]): Unit = { val conf = os.read(os.resource / "application.conf") println("Loaded application.conf from resources: " + conf) + println("Loaded test.property: " + System.getProperty("test.property")) } } diff --git a/testkit/src/mill/testkit/ExampleTester.scala b/testkit/src/mill/testkit/ExampleTester.scala index 86a59505a25..8e6b40951fc 100644 --- a/testkit/src/mill/testkit/ExampleTester.scala +++ b/testkit/src/mill/testkit/ExampleTester.scala @@ -114,13 +114,19 @@ class ExampleTester( |------------------------------""".stripMargin ) + val windowsPathEnv = + if (!Util.windowsPlatform) Map() + else Map( + "BASH_ENV" -> os.temp("export PATH=\"/c/Program Files/Git/usr/bin:$PATH\"").toString() + ) + val res = os.call( (bashExecutable, "-c", commandStr), stdout = os.Pipe, - stderr = os.Pipe, + stderr = os.Inherit, cwd = workspacePath, mergeErrIntoOut = true, - env = IntegrationTester.millTestSuiteEnv, + env = IntegrationTester.millTestSuiteEnv ++ windowsPathEnv, check = false )