Skip to content

Commit 267cf19

Browse files
committed
.
1 parent 8ce7a91 commit 267cf19

File tree

3 files changed

+43
-10
lines changed

3 files changed

+43
-10
lines changed

libs/javalib/src/mill/javalib/JavaModule.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ trait JavaModule
10681068
BoundDep(coursierDependencyTask(), force = false)
10691069
),
10701070
sources = sources,
1071-
artifactTypes = Some(artifactTypes()),
1071+
artifactTypes = if (sources) None else Some(artifactTypes()),
10721072
resolutionParamsMapOpt =
10731073
Some { params =>
10741074
params

libs/javalib/test/src/mill/javalib/ResolveDepsTests.scala

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,49 @@ object ResolveDepsTests extends TestSuite {
315315

316316
test("resolvedMvnDepsSources") {
317317
UnitTester(TestCase, null).scoped { eval =>
318+
// First check that regular resolvedMvnDeps works
319+
val Right(depsResult) = eval(TestCase.sources.resolvedMvnDeps): @unchecked
320+
val deps = depsResult.value
321+
assert(deps.nonEmpty)
322+
assert(deps.exists(_.path.last.contains("geny")))
323+
324+
// Now check resolvedMvnDepsSources
318325
val Right(result) = eval(TestCase.sources.resolvedMvnDepsSources): @unchecked
319326
val sourcesDir = result.value.path
320327

321328
// Check that the sources directory exists and contains unpacked source files
322329
assert(os.exists(sourcesDir))
323330
assert(os.isDir(sourcesDir))
324331

325-
// Check that geny source files are unpacked (geny has a Geny.scala file)
326-
val scalaFiles = os.walk(sourcesDir).filter(_.ext == "scala")
327-
assert(scalaFiles.nonEmpty)
328-
assert(scalaFiles.exists(_.last == "Geny.scala"))
332+
// Check that source files are unpacked
333+
val allFiles = os
334+
.walk(sourcesDir)
335+
.filter(os.isFile)
336+
.map(_.relativeTo(sourcesDir).toString)
337+
.sorted
338+
339+
val expected = Set(
340+
"geny/ByteData.scala",
341+
"geny/Bytes.scala",
342+
"geny/Generator.scala",
343+
"geny/Internal.scala",
344+
"geny/Writable.scala",
345+
"rootdoc.txt",
346+
"scala/AnyVal.scala",
347+
"scala/AnyValCompanion.scala",
348+
"scala/App.scala",
349+
"scala/Array.scala",
350+
"scala/Boolean.scala",
351+
"scala/Byte.scala",
352+
"scala/Char.scala",
353+
"scala/Console.scala",
354+
"scala/DelayedInit.scala",
355+
"scala/Double.scala",
356+
"scala/DummyImplicit.scala",
357+
"scala/Dynamic.scala"
358+
)
359+
360+
assert(expected.subsetOf(allFiles.toSet))
329361
}
330362
}
331363
}

libs/util/src/mill/util/JdkCommandsModule.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ trait JdkCommandsModule extends mill.api.Module {
2020

2121
private def callJdk(toolName: String, javaHome: Option[PathRef], args: Seq[String]): Int = {
2222
os.call(
23-
cmd = Seq(jdkTool(toolName, javaHome.map(_.path))) ++ args,
24-
stdin = os.Inherit,
25-
stdout = os.Inherit,
26-
check = false
27-
)
23+
cmd = Seq(jdkTool(toolName, javaHome.map(_.path))) ++ args,
24+
stdin = os.Inherit,
25+
stdout = os.Inherit,
26+
check = false
27+
)
2828
.exitCode
2929
}
30+
3031
/**
3132
* Runs the `java` command from this module's [[jdkCommandsJavaHome]].
3233
* Renamed to `java` on the command line.

0 commit comments

Comments
 (0)