Skip to content

Commit 34fdd10

Browse files
authored
Improve IDE support for scripts by scoping them per-file (#6068)
Scoping them per-folder results in conflicts when there are multiple scripts in a single folder, whereas scoping them so the module root is the file itself seems to work better and allow the different scripts to each have their own classpath etc. <img width="976" height="652" alt="Screenshot 2025-10-31 at 10 34 17 AM" src="https://github.com/user-attachments/assets/01db49e6-7379-485e-b217-20ade6222afb" />
1 parent 3b83c84 commit 34fdd10

File tree

12 files changed

+48
-65
lines changed

12 files changed

+48
-65
lines changed

integration/ide/bsp-server-reload/resources/snapshots/broken/start/workspace-build-targets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"uri": "file:///workspace/app/src/milltests/TheApp.scala"
66
},
77
"displayName": "app.src.milltests.TheApp.scala",
8-
"baseDirectory": "file:///workspace/app/src/milltests",
8+
"baseDirectory": "file:///workspace/app/src/milltests/TheApp.scala",
99
"tags": [
1010
"library",
1111
"application"
@@ -52,7 +52,7 @@
5252
"uri": "file:///workspace/lib/src/milltests/Lib.scala"
5353
},
5454
"displayName": "lib.src.milltests.Lib.scala",
55-
"baseDirectory": "file:///workspace/lib/src/milltests",
55+
"baseDirectory": "file:///workspace/lib/src/milltests/Lib.scala",
5656
"tags": [
5757
"library",
5858
"application"

integration/ide/bsp-server-reload/resources/snapshots/reload/changed/workspace-build-targets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"uri": "file:///workspace/app/src/milltests/TheApp.scala"
66
},
77
"displayName": "app.src.milltests.TheApp.scala",
8-
"baseDirectory": "file:///workspace/app/src/milltests",
8+
"baseDirectory": "file:///workspace/app/src/milltests/TheApp.scala",
99
"tags": [
1010
"library",
1111
"application"

integration/ide/bsp-server/resources/snapshots/build-targets-compile-classpaths.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@
159159
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upack_3/4.4.0/upack_3-4.4.0.jar",
160160
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
161161
"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",
162-
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
163-
"file:///workspace/scripts/folder1/compile-resources"
162+
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar"
164163
]
165164
},
166165
{
@@ -174,8 +173,7 @@
174173
"file:///coursier-cache/https/repo1.maven.org/maven2/org/attoparser/attoparser/2.0.6.RELEASE/attoparser-2.0.6.RELEASE.jar",
175174
"file:///coursier-cache/https/repo1.maven.org/maven2/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar",
176175
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
177-
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
178-
"file:///workspace/scripts/folder2/compile-resources"
176+
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar"
179177
]
180178
},
181179
{
@@ -201,9 +199,7 @@
201199
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
202200
"file:///coursier-cache/https/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar",
203201
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
204-
"file:///workspace/scripts/folder2/compile-resources",
205-
"file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compile.dest/classes",
206-
"file:///workspace/scripts/folder2/compile-resources"
202+
"file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compile.dest/classes"
207203
]
208204
},
209205
{
@@ -217,8 +213,7 @@
217213
"file:///coursier-cache/https/repo1.maven.org/maven2/org/attoparser/attoparser/2.0.6.RELEASE/attoparser-2.0.6.RELEASE.jar",
218214
"file:///coursier-cache/https/repo1.maven.org/maven2/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar",
219215
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
220-
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
221-
"file:///workspace/scripts/foldershared/compile-resources"
216+
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar"
222217
]
223218
},
224219
{
@@ -242,8 +237,7 @@
242237
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upack_3/4.4.0/upack_3-4.4.0.jar",
243238
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
244239
"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",
245-
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
246-
"file:///workspace/scripts/foldershared/compile-resources"
240+
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar"
247241
]
248242
},
249243
{

integration/ide/bsp-server/resources/snapshots/build-targets-javac-options.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@
186186
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upack_3/4.4.0/upack_3-4.4.0.jar",
187187
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
188188
"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",
189-
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
190-
"file:///workspace/scripts/folder1/compile-resources"
189+
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar"
191190
],
192191
"classDirectory": "file:///workspace/out/mill-bsp-out/scripts/folder1/script.scala/compiledClassesAndSemanticDbFiles.dest"
193192
},
@@ -203,8 +202,7 @@
203202
"file:///coursier-cache/https/repo1.maven.org/maven2/org/attoparser/attoparser/2.0.6.RELEASE/attoparser-2.0.6.RELEASE.jar",
204203
"file:///coursier-cache/https/repo1.maven.org/maven2/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar",
205204
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
206-
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
207-
"file:///workspace/scripts/folder2/compile-resources"
205+
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar"
208206
],
209207
"classDirectory": "file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compiledClassesAndSemanticDbFiles.dest"
210208
},
@@ -232,9 +230,7 @@
232230
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
233231
"file:///coursier-cache/https/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar",
234232
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
235-
"file:///workspace/scripts/folder2/compile-resources",
236-
"file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compile.dest/classes",
237-
"file:///workspace/scripts/folder2/compile-resources"
233+
"file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compile.dest/classes"
238234
],
239235
"classDirectory": "file:///workspace/out/mill-bsp-out/scripts/folder2/FooTest.java/compiledClassesAndSemanticDbFiles.dest"
240236
},
@@ -250,8 +246,7 @@
250246
"file:///coursier-cache/https/repo1.maven.org/maven2/org/attoparser/attoparser/2.0.6.RELEASE/attoparser-2.0.6.RELEASE.jar",
251247
"file:///coursier-cache/https/repo1.maven.org/maven2/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar",
252248
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
253-
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
254-
"file:///workspace/scripts/foldershared/compile-resources"
249+
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar"
255250
],
256251
"classDirectory": "file:///workspace/out/mill-bsp-out/scripts/foldershared/Foo.java/compiledClassesAndSemanticDbFiles.dest"
257252
},
@@ -277,8 +272,7 @@
277272
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upack_3/4.4.0/upack_3-4.4.0.jar",
278273
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
279274
"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",
280-
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
281-
"file:///workspace/scripts/foldershared/compile-resources"
275+
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar"
282276
],
283277
"classDirectory": "file:///workspace/out/mill-bsp-out/scripts/foldershared/script.scala/compiledClassesAndSemanticDbFiles.dest"
284278
},

integration/ide/bsp-server/resources/snapshots/build-targets-jvm-run-environments.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@
244244
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
245245
"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",
246246
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
247-
"file:///workspace/scripts/folder1/compile-resources",
248-
"file:///workspace/scripts/folder1/resources",
249247
"file:///workspace/out/mill-bsp-out/scripts/folder1/script.scala/compile.dest/classes"
250248
],
251249
"jvmOptions": [],
@@ -272,8 +270,6 @@
272270
"file:///coursier-cache/https/repo1.maven.org/maven2/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar",
273271
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
274272
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
275-
"file:///workspace/scripts/folder2/compile-resources",
276-
"file:///workspace/scripts/folder2/resources",
277273
"file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compile.dest/classes"
278274
],
279275
"jvmOptions": [],
@@ -311,18 +307,15 @@
311307
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
312308
"file:///coursier-cache/https/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar",
313309
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
314-
"file:///workspace/scripts/folder2/compile-resources",
315-
"file:///workspace/scripts/folder2/resources",
316310
"file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compile.dest/classes",
317-
"file:///workspace/scripts/folder2/compile-resources",
318-
"file:///workspace/scripts/folder2/resources",
311+
"file:///workspace/scripts/folder2/FooTest.java/resources",
319312
"file:///workspace/out/mill-bsp-out/scripts/folder2/FooTest.java/compile.dest/classes"
320313
],
321314
"jvmOptions": [],
322315
"workingDirectory": "/workspace",
323316
"environmentVariables": {
324317
"MILL_WORKSPACE_ROOT": "/workspace",
325-
"MILL_TEST_RESOURCE_DIR": "/workspace/scripts/folder2/resources"
318+
"MILL_TEST_RESOURCE_DIR": "/workspace/scripts/folder2/FooTest.java/resources"
326319
},
327320
"mainClasses": []
328321
},
@@ -338,8 +331,6 @@
338331
"file:///coursier-cache/https/repo1.maven.org/maven2/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar",
339332
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
340333
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
341-
"file:///workspace/scripts/foldershared/compile-resources",
342-
"file:///workspace/scripts/foldershared/resources",
343334
"file:///workspace/out/mill-bsp-out/scripts/foldershared/Foo.java/compile.dest/classes"
344335
],
345336
"jvmOptions": [],
@@ -376,8 +367,6 @@
376367
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
377368
"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",
378369
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
379-
"file:///workspace/scripts/foldershared/compile-resources",
380-
"file:///workspace/scripts/foldershared/resources",
381370
"file:///workspace/out/mill-bsp-out/scripts/foldershared/script.scala/compile.dest/classes"
382371
],
383372
"jvmOptions": [],

integration/ide/bsp-server/resources/snapshots/build-targets-jvm-test-environments.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,8 @@
129129
"file:///coursier-cache/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.5/slf4j-api-2.0.5.jar",
130130
"file:///coursier-cache/https/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar",
131131
"file:///coursier-cache/https/repo1.maven.org/maven2/org/javassist/javassist/3.29.0-GA/javassist-3.29.0-GA.jar",
132-
"file:///workspace/scripts/folder2/compile-resources",
133-
"file:///workspace/scripts/folder2/resources",
134132
"file:///workspace/out/mill-bsp-out/scripts/folder2/Foo.java/compile.dest/classes",
135-
"file:///workspace/scripts/folder2/compile-resources",
136-
"file:///workspace/scripts/folder2/resources",
133+
"file:///workspace/scripts/folder2/FooTest.java/resources",
137134
"file:///workspace/out/mill-bsp-out/scripts/folder2/FooTest.java/compile.dest/classes",
138135
"file:///user-home/.ivy2/local/com.lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/jars/mill-libs-javalib-testrunner-entrypoint.jar",
139136
"file:///coursier-cache/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"
@@ -142,7 +139,7 @@
142139
"workingDirectory": "/workspace",
143140
"environmentVariables": {
144141
"MILL_WORKSPACE_ROOT": "/workspace",
145-
"MILL_TEST_RESOURCE_DIR": "/workspace/scripts/folder2/resources"
142+
"MILL_TEST_RESOURCE_DIR": "/workspace/scripts/folder2/FooTest.java/resources"
146143
},
147144
"mainClasses": [
148145
{

integration/ide/bsp-server/resources/snapshots/build-targets-scalac-options.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@
109109
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upack_3/4.4.0/upack_3-4.4.0.jar",
110110
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
111111
"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",
112-
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
113-
"file:///workspace/scripts/folder1/compile-resources"
112+
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar"
114113
],
115114
"classDirectory": "file:///workspace/out/mill-bsp-out/scripts/folder1/script.scala/compiledClassesAndSemanticDbFiles.dest"
116115
},
@@ -136,8 +135,7 @@
136135
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upack_3/4.4.0/upack_3-4.4.0.jar",
137136
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-implicits_3/4.4.0/upickle-implicits_3-4.4.0.jar",
138137
"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",
139-
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar",
140-
"file:///workspace/scripts/foldershared/compile-resources"
138+
"file:///coursier-cache/https/repo1.maven.org/maven2/com/lihaoyi/upickle-core_3/4.4.0/upickle-core_3-4.4.0.jar"
141139
],
142140
"classDirectory": "file:///workspace/out/mill-bsp-out/scripts/foldershared/script.scala/compiledClassesAndSemanticDbFiles.dest"
143141
},

integration/ide/bsp-server/resources/snapshots/build-targets-sources.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@
293293
},
294294
"sources": [
295295
{
296-
"uri": "file:///workspace/scripts/folder1",
297-
"kind": 2,
296+
"uri": "file:///workspace/scripts/folder1/script.scala",
297+
"kind": 1,
298298
"generated": false
299299
}
300300
]
@@ -305,8 +305,8 @@
305305
},
306306
"sources": [
307307
{
308-
"uri": "file:///workspace/scripts/folder2",
309-
"kind": 2,
308+
"uri": "file:///workspace/scripts/folder2/Foo.java",
309+
"kind": 1,
310310
"generated": false
311311
}
312312
]
@@ -317,8 +317,8 @@
317317
},
318318
"sources": [
319319
{
320-
"uri": "file:///workspace/scripts/folder2",
321-
"kind": 2,
320+
"uri": "file:///workspace/scripts/folder2/FooTest.java",
321+
"kind": 1,
322322
"generated": false
323323
}
324324
]
@@ -329,8 +329,8 @@
329329
},
330330
"sources": [
331331
{
332-
"uri": "file:///workspace/scripts/foldershared",
333-
"kind": 2,
332+
"uri": "file:///workspace/scripts/foldershared/Foo.java",
333+
"kind": 1,
334334
"generated": false
335335
}
336336
]
@@ -341,8 +341,8 @@
341341
},
342342
"sources": [
343343
{
344-
"uri": "file:///workspace/scripts/foldershared",
345-
"kind": 2,
344+
"uri": "file:///workspace/scripts/foldershared/script.scala",
345+
"kind": 1,
346346
"generated": false
347347
}
348348
]

integration/ide/bsp-server/resources/snapshots/workspace-build-targets.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@
570570
"uri": "file:///workspace/scripts/folder1/script.scala"
571571
},
572572
"displayName": "scripts.folder1.script.scala",
573-
"baseDirectory": "file:///workspace/scripts/folder1",
573+
"baseDirectory": "file:///workspace/scripts/folder1/script.scala",
574574
"tags": [
575575
"library",
576576
"application"
@@ -617,7 +617,7 @@
617617
"uri": "file:///workspace/scripts/folder2/Foo.java"
618618
},
619619
"displayName": "scripts.folder2.Foo.java",
620-
"baseDirectory": "file:///workspace/scripts/folder2",
620+
"baseDirectory": "file:///workspace/scripts/folder2/Foo.java",
621621
"tags": [
622622
"library",
623623
"application"
@@ -643,7 +643,7 @@
643643
"uri": "file:///workspace/scripts/folder2/FooTest.java"
644644
},
645645
"displayName": "scripts.folder2.FooTest.java",
646-
"baseDirectory": "file:///workspace/scripts/folder2",
646+
"baseDirectory": "file:///workspace/scripts/folder2/FooTest.java",
647647
"tags": [
648648
"test"
649649
],
@@ -672,7 +672,7 @@
672672
"uri": "file:///workspace/scripts/foldershared/Foo.java"
673673
},
674674
"displayName": "scripts.foldershared.Foo.java",
675-
"baseDirectory": "file:///workspace/scripts/foldershared",
675+
"baseDirectory": "file:///workspace/scripts/foldershared/Foo.java",
676676
"tags": [
677677
"library",
678678
"application"
@@ -698,7 +698,7 @@
698698
"uri": "file:///workspace/scripts/foldershared/script.scala"
699699
},
700700
"displayName": "scripts.foldershared.script.scala",
701-
"baseDirectory": "file:///workspace/scripts/foldershared",
701+
"baseDirectory": "file:///workspace/scripts/foldershared/script.scala",
702702
"tags": [
703703
"library",
704704
"application"

libs/script/src/JavaModule.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,17 @@ object JavaModule {
2626

2727
override def moduleDeps = scriptConfig.moduleDeps.map(_.asInstanceOf[mill.javalib.JavaModule])
2828

29+
/** Scripts default to having no source folders */
2930
override def sources = Task.Sources()
3031

32+
/** Scripts default to having no resource folders */
33+
override def resources = Task.Sources()
34+
35+
override def sourcesFolders = Nil
36+
37+
/** Scripts default to having no compile-time resource folders */
38+
override def compileResources = Task.Sources()
39+
3140
/** The script file itself */
3241
def scriptSource = Task.Source(scriptConfig.simpleModulePath)
3342

0 commit comments

Comments
 (0)