Skip to content

Commit

Permalink
Update .mill-version (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi authored Oct 24, 2024
1 parent 84ca9e3 commit 4baa7ed
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.12
0.12.0
4 changes: 3 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ trait OsLibModule
// we check the textual output of system commands and expect it in english
def forkEnv = super.forkEnv() ++ Map(
"LC_ALL" -> "C",
"TEST_SUBPROCESS_ENV" -> "value"
"TEST_SUBPROCESS_ENV" -> "value",
"OS_TEST_RESOURCE_FOLDER" -> os.jvm(crossValue).test.resources().head.path.toString
)
}
}
Expand Down Expand Up @@ -206,6 +207,7 @@ object os extends Module {
def ivyDeps = Agg(Deps.jna)
object test extends ScalaTests with OsLibTestModule {
def moduleDeps = super.moduleDeps ++ Seq(os.jvm().test)

}
}
}
Expand Down
6 changes: 4 additions & 2 deletions mill
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
set -e

if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
DEFAULT_MILL_VERSION=0.11.0
DEFAULT_MILL_VERSION=0.11.12
fi

if [ -z "$MILL_VERSION" ] ; then
Expand Down Expand Up @@ -53,7 +53,9 @@ if [ -z "$MILL_MAIN_CLI" ] ; then
fi

MILL_FIRST_ARG=""
if [ "$1" = "--bsp" ] || [ "$1" = "-i" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then

# first arg is a long flag for "--interactive" or starts with "-i"
if [ "$1" = "--bsp" ] || [ "${1#"-i"}" != "$1" ] || [ "$1" = "--interactive" ] || [ "$1" = "--no-server" ] || [ "$1" = "--repl" ] || [ "$1" = "--help" ] ; then
# Need to preserve the first position of those listed options
MILL_FIRST_ARG=$1
shift
Expand Down
2 changes: 1 addition & 1 deletion os/test/src-jvm/ExampleTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ object ExampleTests extends TestSuite {
}
test("findWc") {

val wd = os.pwd / "os/test/resources/test"
val wd = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"

// find . -name '*.txt' | xargs wc -l
val lines = os.walk(wd)
Expand Down
4 changes: 2 additions & 2 deletions os/test/src-jvm/OpTestsJvmOnly.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.nio.charset.Charset
object OpTestsJvmOnly extends TestSuite {

val tests = Tests {
val res = os.pwd / "os/test/resources/test"
val res = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
val testFolder = os.pwd / "out/scratch/test"
test("lsRecPermissions") {
if (Unix()) {
Expand Down Expand Up @@ -74,7 +74,7 @@ object OpTestsJvmOnly extends TestSuite {
// Not sure why this doesn't work on native
test("redirectSubprocessInheritedOutput") {
if (Unix()) { // relies on bash scripts that don't run on windows
val scriptFolder = os.pwd / "os/test/resources/test"
val scriptFolder = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
val lines = collection.mutable.Buffer.empty[String]
os.Inherit.out.withValue(os.ProcessOutput.Readlines(lines.append(_))) {
// Redirected
Expand Down
2 changes: 1 addition & 1 deletion os/test/src-jvm/ProcessPipelineTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TestUtil.prep
import scala.util.Try

object ProcessPipelineTests extends TestSuite {
val scriptFolder = pwd / "os/test/resources/scripts"
val scriptFolder = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "scripts"

lazy val scalaHome = sys.env("SCALA_HOME")

Expand Down
2 changes: 1 addition & 1 deletion os/test/src/OpTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.nio.charset.Charset
object OpTests extends TestSuite {

val tests = Tests {
val res = os.pwd / "os/test/resources/test"
val res = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"
test("ls") - assert(
os.list(res).toSet == Set(
res / "folder1",
Expand Down
8 changes: 6 additions & 2 deletions os/test/src/SubprocessTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import utest._
import scala.collection.mutable

object SubprocessTests extends TestSuite {
val scriptFolder = pwd / "os/test/resources/test"
val scriptFolder = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "test"

val lsCmd = if (scala.util.Properties.isWin) "dir" else "ls"

Expand Down Expand Up @@ -38,6 +38,8 @@ object SubprocessTests extends TestSuite {
}
}
test("chained") {
proc("git", "init").call()
os.write.over(os.pwd / "Readme.adoc", "hello")
assert(
proc("git", "init").call().out.text().contains("Reinitialized existing Git repository"),
proc("git", "init").call().out.text().contains("Reinitialized existing Git repository"),
Expand All @@ -46,6 +48,8 @@ object SubprocessTests extends TestSuite {
}
test("basicList") {
val files = List("Readme.adoc", "build.sc")
os.write.over(os.pwd / "Readme.adoc", "hello")
os.write.over(os.pwd / "build.sc", "world")
val output = TestUtil.proc(lsCmd, files).call().out.text()
assert(files.forall(output.contains))
}
Expand Down Expand Up @@ -193,7 +197,7 @@ object SubprocessTests extends TestSuite {
}
test("jarTf") {
// This was the original repro for the multi-chunk concurrency bugs
val jarFile = os.pwd / "os/test/resources/misc/out.jar"
val jarFile = os.Path(sys.env("OS_TEST_RESOURCE_FOLDER")) / "misc/out.jar"
assert(TestUtil.eqIgnoreNewlineStyle(
os.proc("jar", "-tf", jarFile).call().out.text(),
"""META-INF/MANIFEST.MF
Expand Down
2 changes: 1 addition & 1 deletion os/test/src/TestUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object TestUtil {
}
)

val original = Paths.get("os", "test", "resources", "test")
val original = Paths.get(sys.env("OS_TEST_RESOURCE_FOLDER"), "test")
Files.walkFileTree(
original,
new SimpleFileVisitor[Path]() {
Expand Down

0 comments on commit 4baa7ed

Please sign in to comment.