-
-
Notifications
You must be signed in to change notification settings - Fork 414
Export MILL_TEST_RESOURCE_DIR
to BSP project definitions
#5265
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
Export MILL_TEST_RESOURCE_DIR
to BSP project definitions
#5265
Conversation
"uri": "file:///workspace/app/test" | ||
}, | ||
"classpath": [ | ||
"/coursier-cache/https/repo1.maven.org/maven2/ch/qos/logback/logback-core/1.5.15/logback-core-1.5.15.jar", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is questionable, why do classpath entries here don't have file://
prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tricky case. The BSP spec often uses URI[]
, but here a string[]
is required. I still think using an URI-string would be more consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. in JavaOptionsItem
is also a classpath: string[]
specified, but we return URI-strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why does it differ between the app and test projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know. Looks like a bug.
"jvmOptions": [], | ||
"workingDirectory": "/workspace", | ||
"environmentVariables": { | ||
"MILL_TEST_RESOURCE_DIR": "/workspace/app/test/resources" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be exported here, or only in jvm-test-environments.json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test runner is a dedicated runner, hence trait TestModule extends RunModule
. forkEnv
and forkArgs
come from RunModule
, so it's correct that these are also exposed here. It's a Mill-specific redundancy, since we always use dedicated test modules in contrast to sbt, Maven and Gradle, where tests are some feature/scope of normal modules.
{ | ||
"className": "mill.testrunner.entrypoint.TestRunnerMain", | ||
"arguments": [ | ||
"file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/<scala3-version>/scala3-library_3-<scala3-version>.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/mill-moduledefs_3/0.11.4/mill-moduledefs_3-0.11.4.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_3/2.3.0/scala-xml_3-2.3.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.13.15/scala-reflect-2.13.15.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lumidion/sonatype-central-client-requests_3/0.3.0/sonatype-central-client-requests_3-0.3.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier_2.13/2.1.25-M13/coursier_2.13-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier-core_2.13/2.1.25-M13/coursier-core_2.13-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier-cache_2.13/2.1.25-M13/coursier-cache_2.13-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier-util_2.13/2.1.25-M13/coursier-util_2.13-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/versions_2.13/0.5.1/versions_2.13-0.5.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier-jvm_2.13/2.1.25-M13/coursier-jvm_2.13-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/jline/jline/3.28.0/jline-3.28.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/mainargs_3/0.7.6/mainargs_3-0.7.6.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/requests_3/0.9.0/requests_3-0.9.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-lang/scala-library/<scala-version>/scala-library-<scala-version>.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/sourcecode_3/0.4.3-M5/sourcecode_3-0.4.3-M5.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lumidion/sonatype-central-client-core_3/0.3.0/sonatype-central-client-core_3-0.3.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lumidion/sonatype-central-client-upickle_3/0.3.0/sonatype-central-client-upickle_3-0.3.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/os-lib_3/0.11.5-M9/os-lib_3-0.11.5-M9.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle_3/4.2.1/upickle_3-4.2.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits-named-tuples_3/4.2.1/upickle-implicits-named-tuples_3-4.2.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/pprint_3/0.9.0/pprint_3-0.9.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/fansi_3/0.5.0/fansi_3-0.5.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/fastparse_3/3.1.1/fastparse_3-3.1.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_3/2.12.0/scala-collection-compat_3-2.12.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/geny_3/1.1.1/geny_3-1.1.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/github/plokhotnyuk/jsoniter-scala/jsoniter-scala-core_2.13/2.13.39/jsoniter-scala-core_2.13-2.13.39.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier-env_2.13/2.1.25-M13/coursier-env_2.13-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier-exec/2.1.25-M13/coursier-exec-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/os-zip/0.11.5-M9/os-zip-0.11.5-M9.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/ujson_3/4.2.1/ujson_3-4.2.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upack_3/4.2.1/upack_3-4.2.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.2.1/upickle-implicits_3-4.2.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/dependency_2.13/0.3.2/dependency_2.13-0.3.2.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/coursier-proxy-setup/2.1.25-M13/coursier-proxy-setup-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_2.13/2.13.0/scala-collection-compat_2.13-2.13.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/jniutils/windows-jni-utils/0.3.3/windows-jni-utils-0.3.3.jar,file:/coursier-cache/https/repo1.maven.org/maven2/net/java/dev/jna/jna/5.16.0/jna-5.16.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.2.1/upickle-core_3-4.2.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/github/alexarchambault/concurrent-reference-hash-map/1.1.0/concurrent-reference-hash-map-1.1.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_2.13/2.3.0/scala-xml_2.13-2.3.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/github/alexarchambault/is-terminal/0.1.2/is-terminal-0.1.2.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-archiver/4.10.0/plexus-archiver-4.10.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-container-default/2.1.1/plexus-container-default-2.1.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/virtuslab/scala-cli/config_2.13/1.1.3/config_2.13-1.1.3.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/apache/tika/tika-core/3.1.0/tika-core-3.1.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/github/alexarchambault/windows-ansi/windows-ansi/0.0.6/windows-ansi-0.0.6.jar,file:/coursier-cache/https/repo1.maven.org/maven2/com/github/luben/zstd-jni/1.5.7-3/zstd-jni-1.5.7-3.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/get-coursier/cache-util/2.1.25-M13/cache-util-2.1.25-M13.jar,file:/coursier-cache/https/repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/4.0.1/plexus-utils-4.0.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-io/3.5.0/plexus-io-3.5.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/commons-io/commons-io/2.18.0/commons-io-2.18.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/apache/commons/commons-compress/1.27.1/commons-compress-1.27.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.16/slf4j-api-2.0.16.jar,file:/coursier-cache/https/repo1.maven.org/maven2/io/airlift/aircompressor/0.27/aircompressor-0.27.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/tukaani/xz/1.9/xz-1.9.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/codehaus/plexus/plexus-classworlds/2.6.0/plexus-classworlds-2.6.0.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/apache/xbean/xbean-reflect/3.7/xbean-reflect-3.7.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/virtuslab/scala-cli/specification-level_2.13/1.1.3/specification-level_2.13-1.1.3.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/fusesource/jansi/jansi/2.4.1/jansi-2.4.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/commons-codec/commons-codec/1.17.1/commons-codec-1.17.1.jar,file:/coursier-cache/https/repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.16.0/commons-lang3-3.16.0.jar,file:/mill-workspace/out/core/coursierutil/compile.dest/classes/,file:/mill-workspace/out/core/define/compile.dest/classes/,file:/mill-workspace/out/core/constants/buildInfoResources.dest/,file:/mill-workspace/out/core/constants/compile.dest/classes/,file:/mill-workspace/out/core/api/buildInfoResources.dest/,file:/mill-workspace/out/core/api/compile.dest/classes/,file:/mill-workspace/out/core/util/buildInfoResources.dest/,file:/mill-workspace/out/core/util/compile.dest/classes/,file:/mill-workspace/out/libs/scalalib/api/buildInfoResources.dest/,file:/mill-workspace/out/libs/scalalib/api/compile.dest/classes/,file:/mill-workspace/out/libs/testrunner/entrypoint/compile.dest/classes/,file:/mill-workspace/out/libs/testrunner/compile.dest/classes/,file:/mill-workspace/out/libs/scalalib/compile.dest/classes/,file:/mill-workspace/libs/scalalib/resources/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the single slash after file:
: Could be a missing sanitizeUri
call, that should ensure the same formatting as everywhere else.
MILL_TEST_RESOURCE_DIR
to BSP project definitionsMILL_TEST_RESOURCE_DIR
to BSP project definitions
CC @alexarchambault if you could take a look, since you're familiar with the BSP parts of the codebase |
Just pushed a few commits that fix some confusion there was around BSP run and test environments, I think (that was there in |
@arturaz looks like some tests need to be updated but otherwise the PR is probably in good shape |
@alexarchambault Is this correct? Right now Mill |
What is the rationale for adding It is a bit misleading. We have various |
Don't know where the first quote comes from, but I agree with @lihaoyi here in that test modules should always provide a run environment. This is a consequence of |
The basic goal is the same as the other |
It feels there was some duplication. Do we support the scenario you're describing (main methods in test modules) already in BSP? It seems some more tweaks are needed for that. I could add a test case, and have a look. |
My changes don't split modules between RunModules on the one hand, and test ones on the other. For the But the code around here currently prevents |
I pushed my commits, alongside a fix for (what I think is) an issue and that I discussed above, in #5287 |
The additional snapshot data build-targets-jvm-test-environments.json embeds parts of the Mill class path, whose versions should change quite often. #5287 addresses that. Maybe it should be merged before the PR here (I can take care of pushing a merge commit to disentangle things here if needed). |
@alexarchambault go it, I'll merge this first and we can do the other PR as a follow up |
integration/ide/bsp-server/resources/snapshots/build-targets-jvm-test-environments.json
Outdated
Show resolved
Hide resolved
This is a follow-up of some changes added in #5265. This further changes how we handle `buildTarget/jvmRunEnvironment` and `buildTarget/jvmTestEnvironment` requests, by making sure main classes in test modules are taken into account in `buildTarget/jvmRunEnvironment`, and by cleaning-up some test snapshot data of `buildTarget/jvmTestEnvironment`, so that they don't change too often and are more maintainable.
…#5292) The current way of changing the code and then changing it back is error prone, as witnessed in #5265 (comment) . This changes it to use an environment variable, which has no chance of being committed to the codebase. Pull request: #5292 Co-authored-by: Tobias Roeser <[email protected]>
Fixes #5039.
We've introduced
allForkEnv
toJavaModule
, which now contains the environment variables that Mill adds, in addition to user-defined environment variables.Updated the integration tests to include the newly-exported environment variables so that
./mill integration.ide[bsp-server].local.__.testForked mill.integration.BspServerTests.requestSnapshots
would work.Tested with Metals (requires a fix in Metals: scalameta/metals#7544) and Idea (only works with Junit for now: https://youtrack.jetbrains.com/issue/SCL-23964/Running-utest-test-in-Intellij-does-not-pass-environment-variables-configured-in-Mill)