Skip to content

Commit 67e2d0f

Browse files
authored
Merge pull request #152 from scala-steward/update/scalafmt-core-3.11.4
Update scalafmt-core to 3.11.4
2 parents f4c382d + c570cd0 commit 67e2d0f

3 files changed

Lines changed: 46 additions & 41 deletions

File tree

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33

44
# Scala Steward: Reformat with scalafmt 3.10.4
55
8b4cde6f77c4192809208de1b8c11e57e36c6f71
6+
7+
# Scala Steward: Reformat with scalafmt 3.11.4
8+
dd8d065f7e076b83d238dfa4ee3a7077b3616899

.scalafmt.conf

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

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

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -227,48 +227,48 @@ object MojoImplementation {
227227
// plugin/config presence (e.g. shared config, no bound execution) does not produce a JAR.
228228
.filter(_.getExecutions.asScala.exists(_.getGoals.asScala.contains("shade")))
229229
.flatMap { plugin =>
230-
// Merge execution-level config (where the `shade` goal is usually bound) over plugin-level.
231-
val pluginCfg = Option(plugin.getConfiguration).map(_.asInstanceOf[Xpp3Dom])
232-
val execCfgs = plugin.getExecutions.asScala
233-
.flatMap(e => Option(e.getConfiguration).map(_.asInstanceOf[Xpp3Dom]))
234-
val cfg = (execCfgs ++ pluginCfg)
235-
.reduceOption((dominant, recessive) => Xpp3Dom.mergeXpp3Dom(dominant, recessive))
236-
def child(name: String): Option[String] =
237-
cfg
238-
.flatMap(d => Option(d.getChild(name)))
239-
.flatMap(c => Option(c.getValue))
240-
.map(_.trim)
241-
.filter(_.nonEmpty)
242-
243-
val build = p.getBuild
244-
def warnMissing(jar: File): Option[File] = {
245-
log.warn(
246-
s"Reactor module '${p.getArtifactId}' is built by maven-shade-plugin but its shaded " +
247-
s"JAR was not found at $jar. Its relocated/bundled classes are NOT in target/classes, " +
248-
s"so dependents will fail to compile. Run `mvn package` on '${p.getArtifactId}' " +
249-
s"(shade binds to the package phase) before exporting to bloop."
250-
)
251-
None
252-
}
230+
// Merge execution-level config (where the `shade` goal is usually bound) over plugin-level.
231+
val pluginCfg = Option(plugin.getConfiguration).map(_.asInstanceOf[Xpp3Dom])
232+
val execCfgs = plugin.getExecutions.asScala
233+
.flatMap(e => Option(e.getConfiguration).map(_.asInstanceOf[Xpp3Dom]))
234+
val cfg = (execCfgs ++ pluginCfg)
235+
.reduceOption((dominant, recessive) => Xpp3Dom.mergeXpp3Dom(dominant, recessive))
236+
def child(name: String): Option[String] =
237+
cfg
238+
.flatMap(d => Option(d.getChild(name)))
239+
.flatMap(c => Option(c.getValue))
240+
.map(_.trim)
241+
.filter(_.nonEmpty)
242+
243+
val build = p.getBuild
244+
def warnMissing(jar: File): Option[File] = {
245+
log.warn(
246+
s"Reactor module '${p.getArtifactId}' is built by maven-shade-plugin but its shaded " +
247+
s"JAR was not found at $jar. Its relocated/bundled classes are NOT in target/classes, " +
248+
s"so dependents will fail to compile. Run `mvn package` on '${p.getArtifactId}' " +
249+
s"(shade binds to the package phase) before exporting to bloop."
250+
)
251+
None
252+
}
253253

254-
child("outputFile") match {
255-
case Some(out) =>
256-
// Explicit output path; resolve relative entries against the module base directory.
257-
val f = new File(out)
258-
val jar = if (f.isAbsolute) f else new File(p.getBasedir, out)
259-
if (jar.exists()) Some(jar) else warnMissing(jar)
260-
case None =>
261-
// With shadedArtifactAttached the shaded JAR is a secondary (classified) artifact and
262-
// the module's main artifact stays unshaded, so target/classes remains correct.
263-
val attached = child("shadedArtifactAttached").exists(_.equalsIgnoreCase("true"))
264-
if (attached) None
265-
else {
266-
val base = child("finalName").getOrElse(build.getFinalName)
267-
val jar = new File(build.getDirectory, s"$base.jar")
254+
child("outputFile") match {
255+
case Some(out) =>
256+
// Explicit output path; resolve relative entries against the module base directory.
257+
val f = new File(out)
258+
val jar = if (f.isAbsolute) f else new File(p.getBasedir, out)
268259
if (jar.exists()) Some(jar) else warnMissing(jar)
269-
}
260+
case None =>
261+
// With shadedArtifactAttached the shaded JAR is a secondary (classified) artifact and
262+
// the module's main artifact stays unshaded, so target/classes remains correct.
263+
val attached = child("shadedArtifactAttached").exists(_.equalsIgnoreCase("true"))
264+
if (attached) None
265+
else {
266+
val base = child("finalName").getOrElse(build.getFinalName)
267+
val jar = new File(build.getDirectory, s"$base.jar")
268+
if (jar.exists()) Some(jar) else warnMissing(jar)
269+
}
270+
}
270271
}
271-
}
272272
}
273273

274274
val reactorArtifactIds = session.getProjects().asScala.map(_.getArtifactId).toSet
@@ -330,7 +330,9 @@ object MojoImplementation {
330330
// classpath. Keyed by canonical path to match the explicit list and Maven-resolved entries.
331331
def canon(p: String): String = new File(p).getCanonicalPath
332332
val shadedByOutputDir: Map[String, String] =
333-
shadedDeps.map { case (d, jar) => canon(d.getBuild.getOutputDirectory) -> jar.getAbsolutePath }
333+
shadedDeps.map {
334+
case (d, jar) => canon(d.getBuild.getOutputDirectory) -> jar.getAbsolutePath
335+
}
334336
def substituteShaded(path: String): String = shadedByOutputDir.getOrElse(canon(path), path)
335337

336338
val configDir = mojo.getBloopConfigDir.toPath()

0 commit comments

Comments
 (0)