Skip to content
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

Update scalafmt-cli_2.13, scalafmt-core to 3.8.2 #2966

Merged
merged 4 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Scala Steward: Reformat with scalafmt 3.7.3
34ae72e8cf5878dccb44ac3f864cbf4892f18354

# Scala Steward: Reformat with scalafmt 3.8.2
6d2639650f6e0b941840b995cc30b7de7afff5a0
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.7.17"
version = "3.8.2"

align.preset = more
maxColumn = 100
Expand Down
9 changes: 6 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ trait Core extends ScalaCliCrossSbtModule
| def semanticDbPluginModuleName = "semanticdb-scalac"
| def semanticDbPluginVersion = "${Deps.scalametaTrees.dep.version}"
|
| def semanticDbJavacPluginOrganization = "${Deps.semanticDbJavac.dep.module.organization.value}"
| def semanticDbJavacPluginOrganization = "${Deps.semanticDbJavac.dep.module.organization
.value}"
| def semanticDbJavacPluginModuleName = "${Deps.semanticDbJavac.dep.module.name.value}"
| def semanticDbJavacPluginVersion = "${Deps.semanticDbJavac.dep.version}"
|
Expand Down Expand Up @@ -714,7 +715,8 @@ trait Build extends ScalaCliCrossSbtModule
| def toolkitName = "${Deps.toolkit.dep.module.name.value}"
| def toolkitTestName = "${Deps.toolkitTest.dep.module.name.value}"
| def toolkitVersion = "${Deps.toolkitTest.dep.version}"
| def typelevelToolkitOrganization = "${Deps.typelevelToolkit.dep.module.organization.value}"
| def typelevelToolkitOrganization = "${Deps.typelevelToolkit.dep.module.organization
.value}"
| def typelevelToolkitVersion = "${Deps.typelevelToolkit.dep.version}"
|
| def defaultScalaVersion = "${Scala.defaultUser}"
Expand Down Expand Up @@ -1018,7 +1020,8 @@ trait CliIntegration extends SbtModule with ScalaCliPublishModule with HasTests
| def toolkitVersionForNative05 = "${Deps.toolkitVersionForNative05}"
| def toolkiMaxScalaNative = "${Deps.Versions.maxScalaNativeForToolkit}"
| def typelevelToolkitVersion = "${Deps.typelevelToolkitVersion}"
| def typelevelToolkitMaxScalaNative = "${Deps.Versions.maxScalaNativeForTypelevelToolkit}"
| def typelevelToolkitMaxScalaNative = "${Deps.Versions
.maxScalaNativeForTypelevelToolkit}"
|
| def ghOrg = "$ghOrg"
| def ghName = "$ghName"
Expand Down
3 changes: 2 additions & 1 deletion modules/build/src/main/scala/scala/build/Bloop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ object Bloop {

val buildTarget = buildTargetOpt.getOrElse {
throw new Exception(
s"Expected to find project '$projectName' in build targets (only got ${results.getTargets.asScala.map("'" + _.getDisplayName + "'").mkString(", ")})"
s"Expected to find project '$projectName' in build targets (only got ${results.getTargets
.asScala.map("'" + _.getDisplayName + "'").mkString(", ")})"
)
}

Expand Down
3 changes: 2 additions & 1 deletion modules/build/src/main/scala/scala/build/bsp/BspImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ final class BspImpl(
bloopSession.get().remoteServer.jvmVersion.exists(_.value < projectJavaHome.version)
) {
reloadableOptions.logger.log(
s"Bloop JVM version too low, current ${bloopSession.get().remoteServer.jvmVersion.get.value} expected ${projectJavaHome.version}, restarting server"
s"Bloop JVM version too low, current ${bloopSession.get().remoteServer.jvmVersion.get
.value} expected ${projectJavaHome.version}, restarting server"
)
// RelodableOptions don't take into account buildOptions from sources
val updatedReloadableOptions = reloadableOptions.copy(
Expand Down
3 changes: 2 additions & 1 deletion modules/build/src/main/scala/scala/build/bsp/BspServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ class BspServer(
capabilities.setCanDebug(true)
val baseDirectory = new File(new URI(target.getBaseDirectory))
if (
isIntelliJ && baseDirectory.getName == Constants.workspaceDirName && baseDirectory.getParentFile != null
isIntelliJ && baseDirectory.getName == Constants.workspaceDirName && baseDirectory
.getParentFile != null
) {
val newBaseDirectory = baseDirectory.getParentFile.toPath.toUri.toASCIIString
target.setBaseDirectory(newBaseDirectory)
Expand Down
3 changes: 2 additions & 1 deletion modules/build/src/main/scala/scala/build/input/Inputs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ object Inputs {
|Workspace path cannot contain a ${Console.BOLD}${File.pathSeparator}${Console.RESET}.
|Consider moving your project to a different path.
|Alternatively, you can force your workspace with the '--workspace' option:
| ${Console.BOLD}$prog --workspace <alternative-workspace-path> $argsString${Console.RESET}"""
| ${Console.BOLD}$prog --workspace <alternative-workspace-path> $argsString${Console
.RESET}"""
.stripMargin
))
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ object MarkdownCodeWrapper {
else System.lineSeparator()
val nextScopeIndex = if index == 0 || fence.resetScope then scopeIndex + 1 else scopeIndex
val newAcc = acc + (System.lineSeparator() * (fence.startLine - line - 1)) // padding
.:++(classOpener) // new class opening (if applicable)
.:++(fence.body) // snippet body
.:++(classOpener) // new class opening (if applicable)
.:++(fence.body) // snippet body
.:++(System.lineSeparator()) // padding in place of closing backticks
generateMainScalaLines(
snippets = snippets,
Expand Down Expand Up @@ -157,7 +157,7 @@ object MarkdownCodeWrapper {
else {
val fence: MarkdownCodeBlock = snippets(index)
val newAcc = acc + (System.lineSeparator() * (fence.startLine - line)) // padding
.:++(fence.body) // snippet body
.:++(fence.body) // snippet body
.:++(System.lineSeparator()) // padding in place of closing backticks
generateRawScalaLines(snippets, index + 1, fence.endLine + 1, newAcc)
}
Expand Down
3 changes: 2 additions & 1 deletion modules/cli/src/main/scala/scala/cli/commands/bsp/Bsp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ object Bsp extends ScalaCommand[BspOptions] {
val withLauncherOptions = withEnvs.copy(
classPathOptions = withEnvs.classPathOptions.copy(
extraRepositories =
(withEnvs.classPathOptions.extraRepositories ++ launcherOptions.scalaRunner.cliPredefinedRepository).distinct
(withEnvs.classPathOptions.extraRepositories ++ launcherOptions.scalaRunner
.cliPredefinedRepository).distinct
),
scalaOptions = withEnvs.scalaOptions.copy(
defaultScalaVersion = launcherOptions.scalaRunner.cliUserScalaVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ case class LegacyScalaOptions(
s"""Deprecated option '$s' is ignored.
|The compiled project files will be saved in the '.scala-build' directory in the project root folder.
|If you need to produce an actual jar file, run the '$PowerString${Package.name}' sub-command as follows:
| ${Console.BOLD}$progName $PowerString${Package.name} --library $filteredArgsString${Console.RESET}""".stripMargin
| ${Console.BOLD}$progName $PowerString${Package
.name} --library $filteredArgsString${Console.RESET}""".stripMargin
)
}
noSaveOptionString.foreach { ns =>
logger.message(
s"""Deprecated option '$ns' is ignored.
|A jar file is not saved unless the '$PowerString${Package.name}' sub-command is called.""".stripMargin
|A jar file is not saved unless the '$PowerString${Package
.name}' sub-command is called.""".stripMargin
)
}
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ object DependencyUpdate extends ScalaCommand[DependencyUpdateOptions] {
os.write.over(file, appliedDiagnostics)
diagnostics.foreach(diagnostic =>
logger.message(
s"Updated dependency ${diagnostic._2.dependencyModuleName}: ${diagnostic._2.currentVersion} -> ${diagnostic._2.newVersion}"
s"Updated dependency ${diagnostic._2.dependencyModuleName}: ${diagnostic._2
.currentVersion} -> ${diagnostic._2.newVersion}"
)
)
case (Left(file), diagnostics) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1051,14 +1051,16 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
try repoParams0.hooks.beforeUpload(finalFileSet, isSnapshot0).unsafeRun()(ec)
catch {
case NonFatal(e)
if "Failed to get .*oss\\.sonatype\\.org.*/staging/profiles \\(http status: 403,".r.unanchored.matches(
e.getMessage
) =>
if "Failed to get .*oss\\.sonatype\\.org.*/staging/profiles \\(http status: 403,".r
.unanchored.matches(
e.getMessage
) =>
logger.exit(new WrongSonatypeServerError(isLegacySonatype))
case NonFatal(e)
if "Failed to get .*oss\\.sonatype\\.org.*/staging/profiles \\(http status: 401,".r.unanchored.matches(
e.getMessage
) =>
if "Failed to get .*oss\\.sonatype\\.org.*/staging/profiles \\(http status: 401,".r
.unanchored.matches(
e.getMessage
) =>
logger.exit(new InvalidSonatypePublishCredentials(usernameOnlyAscii, passwordOnlyAscii))
case NonFatal(e) =>
throw new Exception(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ object RunOptions {
|${HelpMessages.acceptedInputs}
|
|To pass arguments to the actual application, just add them after `--`, like:
| ${Console.BOLD}${ScalaCli.progName} run Main.scala AnotherSource.scala -- first-arg second-arg${Console.RESET}
| ${Console.BOLD}${ScalaCli
.progName} run Main.scala AnotherSource.scala -- first-arg second-arg${Console.RESET}
|
|${HelpMessages.commandDocWebsiteReference(cmdName)}""".stripMargin
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ object HelpMessages {
def commandFullHelpReference(commandName: String, needsPower: Boolean = false): String = {
val maybePowerString = if needsPower then "--power " else ""
s"""You are currently viewing the basic help for the $commandName sub-command. You can view the full help by running:
| ${Console.BOLD}${ScalaCli.progName} $maybePowerString$commandName --help-full${Console.RESET}""".stripMargin
| ${Console.BOLD}${ScalaCli.progName} $maybePowerString$commandName --help-full${Console
.RESET}""".stripMargin
}

def commandDocWebsiteReference(websiteSuffix: String): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ final case class SharedOptions(
if assumedSourceJars.nonEmpty then
val assumedSourceJarsString = assumedSourceJars.mkString(", ")
logger.message(
s"""[${Console.YELLOW}warn${Console.RESET}] Jars with the ${ScalaCliConsole.GRAY}*-sources.jar${Console.RESET} name suffix are assumed to be source jars.
s"""[${Console.YELLOW}warn${Console.RESET}] Jars with the ${ScalaCliConsole
.GRAY}*-sources.jar${Console.RESET} name suffix are assumed to be source jars.
|The following jars were assumed to be source jars and will be treated as such: $assumedSourceJarsString""".stripMargin
)
val (resolvedToolkitDependency, toolkitMaxDefaultScalaNativeVersions) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ object ShebangOptions {
|
|When relying on the `run` sub-command, inputs and $baseRunnerName options can be mixed,
|while program args have to be specified after `--`
| ${Console.BOLD}$progName [command] [${baseRunnerName}_options | input]... -- [program_arguments]...${Console.RESET}
| ${Console
.BOLD}$progName [command] [${baseRunnerName}_options | input]... -- [program_arguments]...${Console
.RESET}
|
|However, for the `shebang` sub-command, only a single input file can be set, while all $baseRunnerName options
|have to be set before the input file.
|All inputs after the first are treated as program arguments, without the need for `--`
| ${Console.BOLD}$progName shebang [${baseRunnerName}_options]... input [program_arguments]...${Console.RESET}
| ${Console
.BOLD}$progName shebang [${baseRunnerName}_options]... input [program_arguments]...${Console
.RESET}
|
|Using this, it is possible to conveniently set up Unix shebang scripts. For example:
| ${ScalaCliConsole.GRAY}#!/usr/bin/env -S $progName shebang --scala-version 2.13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ object GenerateReferenceDoc extends CaseApp[InternalDocOptions] {
else ""
}
|
|This is a summary of options that are available for each subcommand of the `${ScalaCli.baseRunnerName}` command.
|This is a summary of options that are available for each subcommand of the `${ScalaCli
.baseRunnerName}` command.
|
|""".stripMargin
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,10 +1097,12 @@ abstract class RunTestDefinitions
)
}
|You can run one of them by passing it with the --main-class option, e.g.
| ${Console.BOLD}${TestUtil.detectCliPath} run . $extraOptionsString --main-class ${expectedMainClassNames.head}${Console.RESET}
| ${Console.BOLD}${TestUtil.detectCliPath} run . $extraOptionsString --main-class ${expectedMainClassNames
.head}${Console.RESET}
|
|You can pick the main class interactively by passing the --interactive option.
| ${Console.BOLD}${TestUtil.detectCliPath} run . $extraOptionsString --interactive${Console.RESET}""".stripMargin
| ${Console.BOLD}${TestUtil
.detectCliPath} run . $extraOptionsString --interactive${Console.RESET}""".stripMargin
expect(errorMessage == expectedErrorMessage)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ trait SemanticDbTestDefinitions { _: CompileTestDefinitions =>
val semDbFile = semDbFiles.head
val expectedSemanticDbPath =
if (semanticDbTargetDir.isDefined)
os.rel / semanticDbTargetDir.get / "META-INF" / "semanticdb" / "foo" / s"$sourceFileName.semanticdb"
os.rel / semanticDbTargetDir
.get / "META-INF" / "semanticdb" / "foo" / s"$sourceFileName.semanticdb"
else
os.rel / "META-INF" / "semanticdb" / "foo" / s"$sourceFileName.semanticdb"
expect(semDbFile.endsWith(expectedSemanticDbPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
"--predefined-repository",
(localRepoPath / "https" / "repo1.maven.org" / "maven2").toNIO.toUri.toASCIIString,
"--predefined-repository",
(localRepoPath / "https" / "scala-ci.typesafe.com" / "artifactory" / "scala-integration").toNIO.toUri.toASCIIString,
(localRepoPath / "https" / "scala-ci.typesafe.com" / "artifactory" / "scala-integration")
.toNIO.toUri.toASCIIString,
"run",
"simple.sc",
"--with-compiler",
Expand Down
3 changes: 2 additions & 1 deletion modules/options/src/main/scala/scala/build/Artifacts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,8 @@ object Artifacts {
resolutionError: coursier.error.ResolutionError.Simple
) = resolutionError match {
case ex: ResolutionError.CantDownloadModule
if ex.module.name.value == s"${Constants.toolkitName}_2.12" || ex.module.name.value == s"${Constants.toolkitTestName}_2.12" =>
if ex.module.name.value == s"${Constants.toolkitName}_2.12" || ex.module.name
.value == s"${Constants.toolkitTestName}_2.12" =>
val errorPositions = dependencies.collect {
case Positioned(pos, dep)
if ex.module == dep.module => pos
Expand Down
2 changes: 1 addition & 1 deletion project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ object Deps {
def scala3Compiler(sv: String) = ivy"org.scala-lang:scala3-compiler_3:$sv"
def scalaAsync = ivy"org.scala-lang.modules::scala-async:1.0.1".exclude("*" -> "*")
def scalac(sv: String) = ivy"org.scala-lang:scala-compiler:$sv"
def scalafmtCli = ivy"org.scalameta:scalafmt-cli_2.13:3.7.17"
def scalafmtCli = ivy"org.scalameta:scalafmt-cli_2.13:3.8.2"
// Force using of 2.13 - is there a better way?
def scalaJsEnvJsdomNodejs =
ivy"org.scala-js:scalajs-env-jsdom-nodejs_2.13:1.1.0"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ Pass a global dialect for scalafmt. This overrides whatever value is configured

Aliases: `--fmt-version`

Pass scalafmt version before running it (3.7.17 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.
Pass scalafmt version before running it (3.8.2 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.

## Global suppress warning options

Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/scala-command/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Aliases: `--fmt-version`

`IMPLEMENTATION specific` per Scala Runner specification

Pass scalafmt version before running it (3.7.17 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.
Pass scalafmt version before running it (3.8.2 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.

## Global suppress warning options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3765,7 +3765,7 @@ Aliases: `--dialect`

**--scalafmt-version**

Pass scalafmt version before running it (3.7.17 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.
Pass scalafmt version before running it (3.8.2 by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.

Aliases: `--fmt-version`

Expand Down
Loading