Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use -native Mill binary in Mill's own build #4294

Merged
merged 58 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
af3f67e
.
lihaoyi Jan 12, 2025
c0c6fc5
.
lihaoyi Jan 12, 2025
03b22dd
.
lihaoyi Jan 12, 2025
aca064d
.
lihaoyi Jan 12, 2025
aad0b8e
.
lihaoyi Jan 12, 2025
a20453f
.
lihaoyi Jan 12, 2025
2466c4e
.
lihaoyi Jan 12, 2025
d72821e
.
lihaoyi Jan 12, 2025
f57a34e
.
lihaoyi Jan 12, 2025
6798c51
.
lihaoyi Jan 12, 2025
88f473c
.
lihaoyi Jan 12, 2025
9256259
.
lihaoyi Jan 12, 2025
f0a80b1
.
lihaoyi Jan 12, 2025
97d27bf
.
lihaoyi Jan 12, 2025
2daa594
.
lihaoyi Jan 12, 2025
0f2a784
.
lihaoyi Jan 12, 2025
b69e6e6
.
lihaoyi Jan 12, 2025
9abc762
.
lihaoyi Jan 12, 2025
5968aea
.
lihaoyi Jan 12, 2025
fbd8c6c
.
lihaoyi Jan 12, 2025
e46349f
.
lihaoyi Jan 12, 2025
a3d16ad
.
lihaoyi Jan 12, 2025
8f65a00
.
lihaoyi Jan 12, 2025
b5da7c7
.
lihaoyi Jan 12, 2025
d577683
.
lihaoyi Jan 12, 2025
28bc05b
.
lihaoyi Jan 12, 2025
6748893
.
lihaoyi Jan 12, 2025
1cacb98
.
lihaoyi Jan 12, 2025
cf7fb05
.
lihaoyi Jan 12, 2025
e58b2f3
.
lihaoyi Jan 12, 2025
4c2cee8
.
lihaoyi Jan 12, 2025
f941b90
.
lihaoyi Jan 12, 2025
33d8d3b
.
lihaoyi Jan 12, 2025
6172a04
.
lihaoyi Jan 12, 2025
3ffb4eb
.
lihaoyi Jan 12, 2025
a06d1b5
.
lihaoyi Jan 12, 2025
4479608
.
lihaoyi Jan 12, 2025
25eec9d
.
lihaoyi Jan 12, 2025
2b972fb
.
lihaoyi Jan 12, 2025
4b5216b
.
lihaoyi Jan 12, 2025
c334af0
.
lihaoyi Jan 12, 2025
0c02493
.
lihaoyi Jan 12, 2025
c847f3b
.
lihaoyi Jan 12, 2025
39cb6b7
.
lihaoyi Jan 12, 2025
12caa19
.
lihaoyi Jan 12, 2025
d78619c
.
lihaoyi Jan 12, 2025
795f80b
.
lihaoyi Jan 12, 2025
a69aaa9
.
lihaoyi Jan 12, 2025
85724ed
.
lihaoyi Jan 12, 2025
7e7e119
.
lihaoyi Jan 12, 2025
81d728b
disable problematic test on windows
lihaoyi Jan 12, 2025
fedcec4
consolidate mill-init-error tests
lihaoyi Jan 12, 2025
256ad10
.
lihaoyi Jan 12, 2025
5a6e4b3
Merge branch 'cleanup-tests' into native-bootstrap
lihaoyi Jan 12, 2025
9bba18e
.
lihaoyi Jan 13, 2025
2cb62b0
.
lihaoyi Jan 13, 2025
597dc14
.
lihaoyi Jan 13, 2025
a956d54
.
lihaoyi Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.5-68-e4bf78
0.12.5-68-e4bf78-native
6 changes: 2 additions & 4 deletions .github/actions/post-build-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/setup-java@v4
with:
java-version: ${{ inputs.java-version }}
distribution: temurin
- run: echo temurin:${{ inputs.java-version }} > .mill-jvm-version
shell: bash

# Need to fix cached artifact file permissions because github actions screws it up
# https://github.com/actions/upload-artifact/issues/38
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ jobs:
with:
ref: ${{ github.base_ref }}

- run: echo temurin:${{ inputs.java-version }} > .mill-jvm-version

- run: chmod -R 777 . # normalize permissions before and after upload/download-artifact

- run: mkdir out && touch out/mill-selective-execution.json
shell: bash

- run: cat .mill-jvm-version

- run: ./mill -i -k selective.prepare ${{ inputs.prepareargs }}
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'run-all-tests') }}

Expand Down
20 changes: 4 additions & 16 deletions .github/workflows/publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ jobs:

- uses: coursier/cache-action@v6

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: "echo temurin:11 > .mill-jvm-version"

- run: ./mill -i __.publishArtifacts

Expand Down Expand Up @@ -81,10 +78,7 @@ jobs:

- uses: coursier/cache-action@v6

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: "echo temurin:11 > .mill-jvm-version"

- run: ./mill -i mill.scalalib.PublishModule/

Expand Down Expand Up @@ -119,10 +113,7 @@ jobs:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: "echo temurin:11 > .mill-jvm-version"

- run: ./mill -i mill.scalalib.PublishModule/ --publishArtifacts dist.native.publishArtifacts

Expand Down Expand Up @@ -151,9 +142,6 @@ jobs:

- uses: coursier/cache-action@v6

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: "echo temurin:11 > .mill-jvm-version"

- run: ./mill -i dist.uploadToGithub --authKey $REPO_ACCESS_TOKEN
5 changes: 1 addition & 4 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:

- uses: coursier/cache-action@v6

- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: temurin
- run: "echo temurin:11 > .mill-jvm-version"

- run: ci/publish-docs.sh
20 changes: 8 additions & 12 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Uncommment this to replace the rest of the file when you want to debug stuff in CI

#
#name: Run Debug
#
#on:
Expand All @@ -7,21 +9,18 @@
# workflow_dispatch:
#
#jobs:
# debug:
# debug-windows:
## runs-on: ubuntu-latest
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v4
# with: { fetch-depth: 1 }
# - uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: '17'
#
# - run: ./mill 'example.scalalib.publishing[7-native-image].packaged.server.test'
# - run: ./mill 'example.scalalib.basic[1-simple].packaged.fork.test'
# env:
# COURSIER_ARCHIVE_CACHE: "C:/coursier-arc"


name: Run Tests

# We run full CI on push builds to main and on all pull requests
Expand Down Expand Up @@ -71,10 +70,7 @@ jobs:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- run: "echo temurin:17 > .mill-jvm-version"

- run: ./mill -i example.javalib.basic.__.local.server.test

Expand Down Expand Up @@ -139,7 +135,7 @@ jobs:
# Most of these integration tests should not depend on which mode they
# are run in, so just run them in `local`
- java-version: '17'
millargs: "'integration.{failure,feature,ide}.__.native.server.test'"
millargs: "'integration.{failure,feature,ide}.__.packaged.server.test'"
install-android-sdk: false
# These invalidation tests need to be exercised in both execution modes
# to make sure they work with and without -i/--no-server being passed
Expand Down Expand Up @@ -174,7 +170,7 @@ jobs:
- java-version: 17
millargs: "'integration.{feature,failure}.__.packaged.fork.test'"

- java-version: 11
- java-version: 11 # Run this with Mill native launcher as a smoketest
millargs: "'integration.invalidation.__.packaged.server.test'"

- java-version: 11
Expand Down
1 change: 1 addition & 0 deletions .mill-jvm-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
temurin:17.0.6
Original file line number Diff line number Diff line change
Expand Up @@ -83,57 +83,61 @@ object TutorialTests extends TestSuite {

test("compileScalaPB") {
test("calledDirectly") - UnitTester(Tutorial, resourcePath).scoped { eval =>
val Right(result) = eval.apply(Tutorial.core.compileScalaPB)
if (!mill.main.client.Util.isWindows) {
val Right(result) = eval.apply(Tutorial.core.compileScalaPB)

val outPath = protobufOutPath(eval)
val outPath = protobufOutPath(eval)

val outputFiles = os.walk(result.value.path).filter(os.isFile)
val outputFiles = os.walk(result.value.path).filter(os.isFile)

val expectedSourcefiles = compiledSourcefiles.map(outPath / _)
val expectedSourcefiles = compiledSourcefiles.map(outPath / _)

assert(
result.value.path == eval.outPath / "core/compileScalaPB.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedSourcefiles.contains),
outputFiles.size == 5,
result.evalCount > 0
)
assert(
result.value.path == eval.outPath / "core/compileScalaPB.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedSourcefiles.contains),
outputFiles.size == 5,
result.evalCount > 0
)

// don't recompile if nothing changed
val Right(result2) = eval.apply(Tutorial.core.compileScalaPB)
// don't recompile if nothing changed
val Right(result2) = eval.apply(Tutorial.core.compileScalaPB)

assert(result2.evalCount == 0)
assert(result2.evalCount == 0)
}
}

test("calledWithSpecificFile") - UnitTester(
TutorialWithSpecificSources,
resourcePath
).scoped { eval =>
val Right(result) = eval.apply(TutorialWithSpecificSources.core.compileScalaPB)
if (!mill.main.client.Util.isWindows) {
val Right(result) = eval.apply(TutorialWithSpecificSources.core.compileScalaPB)

val outPath = protobufOutPath(eval)
val outPath = protobufOutPath(eval)

val outputFiles = os.walk(result.value.path).filter(os.isFile)
val outputFiles = os.walk(result.value.path).filter(os.isFile)

val expectedSourcefiles = Seq[os.RelPath](
os.rel / "AddressBook.scala",
os.rel / "Person.scala",
os.rel / "TutorialProto.scala",
os.rel / "IncludeProto.scala"
).map(outPath / _)
val expectedSourcefiles = Seq[os.RelPath](
os.rel / "AddressBook.scala",
os.rel / "Person.scala",
os.rel / "TutorialProto.scala",
os.rel / "IncludeProto.scala"
).map(outPath / _)

assert(
result.value.path == eval.outPath / "core/compileScalaPB.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedSourcefiles.contains),
outputFiles.size == 3,
result.evalCount > 0
)
assert(
result.value.path == eval.outPath / "core/compileScalaPB.dest",
outputFiles.nonEmpty,
outputFiles.forall(expectedSourcefiles.contains),
outputFiles.size == 3,
result.evalCount > 0
)

// don't recompile if nothing changed
val Right(result2) = eval.apply(Tutorial.core.compileScalaPB)
// don't recompile if nothing changed
val Right(result2) = eval.apply(Tutorial.core.compileScalaPB)

assert(result2.evalCount == 0)
assert(result2.evalCount == 0)
}
}

// // This throws a NullPointerException in coursier somewhere
Expand Down
12 changes: 0 additions & 12 deletions dist/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,6 @@ object `package` extends RootModule with InstallModule {
| JAVACMD="$$JAVA_HOME/bin/java"
|fi
|
|# Client-server mode doesn't seem to work on WSL, just disable it for now
|# https://stackoverflow.com/a/43618657/871202
|if grep -qEi "(Microsoft|WSL)" /proc/version > /dev/null 2> /dev/null ; then
| if [ -z $$COURSIER_CACHE ] ; then
| COURSIER_CACHE=.coursier
| fi
|fi
|exec "$$JAVACMD" $jvmArgsStr $$JAVA_OPTS -cp "$classpathStr" $millMainClass "$$@"
|""".stripMargin
},
Expand All @@ -247,11 +240,6 @@ object `package` extends RootModule with InstallModule {
s"""setlocal EnableDelayedExpansion
|set "JAVACMD=java.exe"
|if not "%JAVA_HOME%"=="" set "JAVACMD=%JAVA_HOME%\\bin\\java.exe"
|if "%1" == "-i" set _I_=true
|if "%1" == "--interactive" set _I_=true
|if "%1" == "--repl" set _I_=true
|if "%1" == "--no-server" set _I_=true
|if "%1" == "--bsp" set _I_=true
|
|"%JAVACMD%" $jvmArgsStr %JAVA_OPTS% -cp "$classpathStr" $millMainClass %*
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,63 +41,50 @@ object ModuleInitErrorTests extends UtestIntegrationTestSuite {
assert(res4.out.contains("foo.fooTask"))
}

test("rootTask") - integrationTest { tester =>
test("tasks") - integrationTest { tester =>
import tester._
// If we specify a task in the root module, we are not
// affected by the sub-modules failing to initialize
val res = eval("rootTask")
assert(res.isSuccess == true)
assert(res.out.contains("""Running rootTask"""))
}
test("rootCommand") - integrationTest { tester =>

import tester._
// If we specify a task in the root module, we are not
// affected by the sub-modules failing to initialize
val res = eval(("rootCommand", "-s", "hello"))
assert(res.isSuccess == true)
assert(res.out.contains("""Running rootCommand hello"""))
}
test("fooTask") - integrationTest { tester =>
import tester._
val res = eval("foo.fooTask")
assert(res.isSuccess == false)
assert(fansi.Str(res.err).plainText.contains("""java.lang.Exception: Foo Boom"""))
val res1 = eval(("rootCommand", "-s", "hello"))
assert(res1.isSuccess == true)
assert(res1.out.contains("""Running rootCommand hello"""))

val res2 = eval("foo.fooTask")
assert(res2.isSuccess == false)
assert(fansi.Str(res2.err).plainText.contains("""java.lang.Exception: Foo Boom"""))
// Make sure the stack trace is "short" and does not contain all the stack
// frames from the Mill launcher
assert(fansi.Str(res.err).plainText.linesIterator.size < 20)
}
test("fooCommand") - integrationTest { tester =>
import tester._
val res = eval(("foo.fooCommand", "-s", "hello"))
assert(res.isSuccess == false)
assert(fansi.Str(res.err).plainText.contains("""java.lang.Exception: Foo Boom"""))
assert(fansi.Str(res.err).plainText.linesIterator.size < 20)
}
test("barTask") - integrationTest { tester =>
import tester._
val res = eval("bar.barTask")
assert(res.isSuccess == true)
assert(res.out.contains("""Running barTask"""))
}
test("barCommand") - integrationTest { tester =>
import tester._
val res = eval(("bar.barCommand", "-s", "hello"))
assert(res.isSuccess == true)
assert(res.out.contains("""Running barCommand hello"""))
}
test("quxTask") - integrationTest { tester =>
import tester._
val res = eval("bar.qux.quxTask")
assert(res.isSuccess == false)
assert(fansi.Str(res.err).plainText.contains("""java.lang.Exception: Qux Boom"""))
assert(fansi.Str(res.err).plainText.linesIterator.size < 20)
}
test("quxCommand") - integrationTest { tester =>
import tester._
val res = eval(("bar.qux.quxCommand", "-s", "hello"))
assert(res.isSuccess == false)
assert(fansi.Str(res.err).plainText.contains("""java.lang.Exception: Qux Boom"""))
assert(fansi.Str(res.err).plainText.linesIterator.size < 20)
assert(fansi.Str(res2.err).plainText.linesIterator.size < 20)

val res3 = eval(("foo.fooCommand", "-s", "hello"))
assert(res3.isSuccess == false)
assert(fansi.Str(res3.err).plainText.contains("""java.lang.Exception: Foo Boom"""))
assert(fansi.Str(res3.err).plainText.linesIterator.size < 20)

val res4 = eval("bar.barTask")
assert(res4.isSuccess == true)
assert(res4.out.contains("""Running barTask"""))

val res5 = eval(("bar.barCommand", "-s", "hello"))
assert(res5.isSuccess == true)
assert(res5.out.contains("""Running barCommand hello"""))

val res6 = eval("bar.qux.quxTask")
assert(res6.isSuccess == false)
assert(fansi.Str(res6.err).plainText.contains("""java.lang.Exception: Qux Boom"""))
assert(fansi.Str(res6.err).plainText.linesIterator.size < 20)

val res7 = eval(("bar.qux.quxCommand", "-s", "hello"))
assert(res7.isSuccess == false)
assert(fansi.Str(res7.err).plainText.contains("""java.lang.Exception: Qux Boom"""))
assert(fansi.Str(res7.err).plainText.linesIterator.size < 20)
}
}
}
Loading
Loading