Skip to content

Commit 993c052

Browse files
authored
Merge pull request #135 from scalacenter/update/scalafmt-core-3.10.4
Update scalafmt-core to 3.10.4
2 parents e778612 + fd8acfb commit 993c052

4 files changed

Lines changed: 62 additions & 34 deletions

File tree

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# Scala Steward: Reformat with scalafmt 3.7.0
22
9918d3ef687de71b9006c3989cd4306212f7ff63
3+
4+
# Scala Steward: Reformat with scalafmt 3.10.4
5+
8b4cde6f77c4192809208de1b8c11e57e36c6f71

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "3.10.3"
1+
version = "3.10.4"
22
runner.dialect = scala213
33
maxColumn = 100
44
docstrings.style = Asterisk

src/main/scala/bloop/integrations/maven/MojoImplementation.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ object MojoImplementation {
255255
}
256256

257257
val (modules, extraClasspath) = {
258-
val hasJunit = allArtifacts.exists(a => a.getGroupId == "junit" && a.getArtifactId == "junit")
258+
val hasJunit =
259+
allArtifacts.exists(a => a.getGroupId == "junit" && a.getArtifactId == "junit")
259260
val hasJunitInterface = allArtifacts.exists(a => a.getArtifactId == "junit-interface")
260261
if (hasJunit && !hasJunitInterface && configuration == "test") {
261262
val junitInterfaceVersion = "0.13.3"
@@ -347,7 +348,9 @@ object MojoImplementation {
347348
log.debug(s"Configuration to be serialized:\n$config")
348349
bloop.config.write(config, configTarget.toPath)
349350

350-
log.info(s"Starting to write configuration for project: ${project.getArtifactId()} with configuration: $configuration")
351+
log.info(
352+
s"Starting to write configuration for project: ${project.getArtifactId()} with configuration: $configuration"
353+
)
351354
log.debug(s"Source directories: ${sourceDirs0.map(_.getAbsolutePath).mkString(", ")}")
352355
log.debug(s"Classpath: ${classpath0().asScala.mkString(", ")}")
353356
log.debug(s"Resources: ${resources0.asScala.mkString(", ")}")

src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -214,22 +214,26 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
214214
case (configFile, projectName, List(module1, module2)) =>
215215
// module1 is "module1"
216216
// module2 is "module1-test"
217-
217+
218218
// module1's test configuration should be renamed to avoid conflict with module2
219219
// Default would be "module1-test", but "module1-test" exists as a reactor artifact (module2)
220220
// So it should be "module1-test-scope"
221221
assertEquals("module1", module1.project.name)
222-
222+
223223
// We need to check the test configuration name for module1.
224224
// check() function loads the "compile" configuration (default expectation in this test suite assumption?)
225225
// Actually check() loads the config based on the project file name.
226226
// module1 comes from "conflicting_modules/module1/pom.xml" -> parent dir is "module1".
227227
// The bloop file loaded is "module1.json".
228-
228+
229229
// Let's check the test config of module1
230-
val module1TestConfigPath = configFile.project.directory.resolve(".bloop").resolve("module1-test-scope.json")
231-
assertTrue(s"Test config for module1 should be renamed to module1-test-scope.json", Files.exists(module1TestConfigPath))
232-
230+
val module1TestConfigPath =
231+
configFile.project.directory.resolve(".bloop").resolve("module1-test-scope.json")
232+
assertTrue(
233+
s"Test config for module1 should be renamed to module1-test-scope.json",
234+
Files.exists(module1TestConfigPath)
235+
)
236+
233237
val module1TestConfig = readValidBloopConfig(module1TestConfigPath.toFile())
234238
assertEquals("module1-test-scope", module1TestConfig.project.name)
235239

@@ -310,48 +314,62 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
310314
case List(m1, m2) => (m1, m2)
311315
case _ => fail(s"Expected 2 submodules, but got ${submodulesList.size}")
312316
}
313-
317+
314318
// Standard naming should be preserved when no collision exists
315319
assert(!configFile.project.name.contains("-compile"))
316320
assert(!module1.project.name.contains("-compile"))
317321
assert(!module2.project.name.contains("-compile"))
318-
319-
// Note: To test actual collision, we would need to construct a project structure
320-
// where a submodule name conflicts with the test suffix of another module.
321-
// For now, we verify that the default behavior is correct (no suffixes).
322+
323+
// Note: To test actual collision, we would need to construct a project structure
324+
// where a submodule name conflicts with the test suffix of another module.
325+
// For now, we verify that the default behavior is correct (no suffixes).
322326
}
323327
}
324328

325329
@Test
326330
def junitSupport() = {
327331
check("junit_project/pom.xml") { (configFile, projectName, subprojects) =>
328332
assert(subprojects.isEmpty)
329-
333+
330334
// Read the test configuration file
331-
val testConfigFile = readValidBloopConfig(configFile.project.directory.resolve(".bloop").resolve(s"$projectName-test.json").toFile())
332-
335+
val testConfigFile = readValidBloopConfig(
336+
configFile.project.directory.resolve(".bloop").resolve(s"$projectName-test.json").toFile()
337+
)
338+
333339
// Check if junit-interface is present in the resolution modules of the test config
334340
val resolutionModules = testConfigFile.project.resolution.get.modules
335341
val hasJunitInterface = resolutionModules.exists(_.name.contains("junit-interface"))
336-
337-
assertTrue("junit-interface should be present in test config when junit is used", hasJunitInterface)
338-
342+
343+
assertTrue(
344+
"junit-interface should be present in test config when junit is used",
345+
hasJunitInterface
346+
)
347+
339348
// Also check classpath
340-
val hasJunitInterfaceInClasspath = testConfigFile.project.classpath.exists(_.toString.contains("junit-interface"))
341-
assertTrue("junit-interface should be present in test classpath when junit is used", hasJunitInterfaceInClasspath)
349+
val hasJunitInterfaceInClasspath =
350+
testConfigFile.project.classpath.exists(_.toString.contains("junit-interface"))
351+
assertTrue(
352+
"junit-interface should be present in test classpath when junit is used",
353+
hasJunitInterfaceInClasspath
354+
)
342355
}
343356
}
344357

345-
private def check(testProject: String, submodules: List[String] = Nil, extraContent: Map[String, String] = Map.empty)(
358+
private def check(
359+
testProject: String,
360+
submodules: List[String] = Nil,
361+
extraContent: Map[String, String] = Map.empty
362+
)(
346363
checking: (Config.File, String, List[Config.File]) => Unit
347364
): Unit = {
348365
println(s"Checking $testProject")
349366
val tempDir = Files.createTempDirectory("mavenBloop")
350367
val outFile = copyFromResource(tempDir, testProject)
351-
extraContent.foreach { case (relativePath, content) =>
352-
val p = tempDir.resolve(relativePath)
353-
Files.createDirectories(p.getParent)
354-
Files.write(p, content.getBytes("UTF-8"))
368+
extraContent.foreach {
369+
case (relativePath, content) =>
370+
val p = tempDir.resolve(relativePath)
371+
Files.createDirectories(p.getParent)
372+
Files.write(p, content.getBytes("UTF-8"))
355373
}
356374
submodules.foreach(copyFromResource(tempDir, _))
357375
val wrapperJar = copyFromResource(tempDir, s"maven-wrapper.jar")
@@ -443,8 +461,6 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
443461
}
444462
}
445463

446-
447-
448464
@Test
449465
def withIncludes() = {
450466
check(
@@ -456,17 +472,20 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
456472
) { (configFile, projectName, subprojects) =>
457473
assert(subprojects.isEmpty)
458474
val resources = configFile.project.resources.getOrElse(Nil)
459-
475+
460476
val included = resources.find(_.toString.endsWith("included.txt"))
461477
val excluded = resources.find(_.toString.endsWith("excluded.txt"))
462-
478+
463479
assert(included.isDefined, "included.txt should be in resources")
464480
assert(excluded.isEmpty, "excluded.txt should NOT be in resources")
465481

466482
// Ensure the directory itself is not added when we have explicit includes
467483
val resourceDir = configFile.project.directory.resolve("src/main/resources").toAbsolutePath
468484
val hasResourceDir = resources.exists(_.toAbsolutePath == resourceDir)
469-
assert(!hasResourceDir, s"Resource directory $resourceDir should NOT be in resources when includes are specified")
485+
assert(
486+
!hasResourceDir,
487+
s"Resource directory $resourceDir should NOT be in resources when includes are specified"
488+
)
470489
}
471490
}
472491

@@ -488,7 +507,10 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
488507

489508
val baseDirectory = configFile.project.directory.toAbsolutePath
490509
val hasBaseDir = resources.exists(_.toAbsolutePath == baseDirectory)
491-
assert(!hasBaseDir, s"Base directory $baseDirectory should NOT be in resources when includes are specified")
510+
assert(
511+
!hasBaseDir,
512+
s"Base directory $baseDirectory should NOT be in resources when includes are specified"
513+
)
492514
}
493515
}
494516

@@ -506,7 +528,7 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
506528
val resourceDir = configFile.project.directory.resolve("src/main/resources").toAbsolutePath
507529
val hasResourceDir = resources.exists(_.toAbsolutePath == resourceDir)
508530
assert(hasResourceDir, s"Resource directory $resourceDir SHOULD be in resources")
509-
531+
510532
// Individual files should NOT be listed
511533
val hasFile = resources.exists(_.toString.endsWith("hello.txt"))
512534
assert(!hasFile, "Individual files inside resource dir should NOT be in resources list")

0 commit comments

Comments
 (0)