Skip to content
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
10 changes: 4 additions & 6 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,7 @@ trait BuildMacros extends ScalaCliCrossSbtModule
}

object test extends ScalaCliTests with ScalaCliScalafixModule {
override def scalacOptions: T[Seq[String]] = Task {
super.scalacOptions() ++ Seq("-deprecation")
}
override def scalacOptions: T[Seq[String]] = super.scalacOptions()

def testNegativeCompilation(): Command[Unit] = Task.Command(exclusive = true) {
val base = BuildCtx.workspaceRoot / "modules" / "build-macros" / "src"
Expand Down Expand Up @@ -682,7 +680,7 @@ trait Config extends ScalaCliCrossSbtModule
Seq(`specification-level`(crossScalaVersion))
override def mvnDeps: T[Seq[Dep]] = super.mvnDeps() ++ Seq(Deps.jsoniterCore)
override def compileMvnDeps: T[Seq[Dep]] = super.compileMvnDeps() ++ Seq(Deps.jsoniterMacros)
override def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ Seq("-deprecation")
override def scalacOptions: T[Seq[String]] = super.scalacOptions()
}

trait Options extends ScalaCliCrossSbtModule
Expand Down Expand Up @@ -713,7 +711,7 @@ trait Options extends ScalaCliCrossSbtModule
Task.Anon(super.repositoriesTask() ++ deps.customRepositories)

object test extends ScalaCliTests with ScalaCliScalafixModule {
override def scalacOptions = super.scalacOptions() ++ Seq("-deprecation")
override def scalacOptions = super.scalacOptions()
// uncomment below to debug tests in attach mode on 5005 port
// def forkArgs = Task {
// super.forkArgs() ++ Seq("-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y")
Expand Down Expand Up @@ -762,7 +760,7 @@ trait Build extends ScalaCliCrossSbtModule
Task.Anon(super.repositoriesTask() ++ deps.customRepositories)

object test extends ScalaCliTests with ScalaCliScalafixModule {
override def scalacOptions: T[Seq[String]] = super.scalacOptions() ++ Seq("-deprecation")
override def scalacOptions: T[Seq[String]] = super.scalacOptions()
override def mvnDeps: T[Seq[Dep]] = super.mvnDeps() ++ Seq(
Deps.pprint,
Deps.slf4jNop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ object SemanticdbProcessor {
for {
fun <- updateTree(t.function)
} yield t.withFunction(fun)
case _ => Some(tree)
}

if (os.isFile(orig)) {
Expand Down

This file was deleted.

12 changes: 11 additions & 1 deletion modules/cli/src/main/scala/scala/cli/commands/ScalaCommand.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package scala.cli.commands

import caseapp.core.Scala3Helpers.*
import caseapp.core.app.Command
import caseapp.core.complete.{Completer, CompletionItem}
import caseapp.core.help.{Help, HelpFormat}
Expand Down Expand Up @@ -296,7 +297,7 @@ abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T],

override def helpFormat: HelpFormat = ScalaCliHelp.helpFormat

override val messages: Help[T] =
private val helpWithWarnings: Help[T] =
if shouldExcludeInSip then
inHelp.copy(helpMessage =
Some(HelpMessage(WarningMessages.powerCommandUsedInSip(
Expand All @@ -323,6 +324,15 @@ abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T],
)
else inHelp

override def help: Help[T] = helpWithWarnings

override lazy val finalHelp: Help[?] =
def withName[A](h: Help[A]): Help[A] =
if name == h.progName then h else h.withProgName(name)
if hasFullHelp then withName(help.withFullHelp)
else if hasHelp then withName(help.withHelp)
else withName(help)

/** @param options
* command-specific [[T]] options
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ object Package extends ScalaCommand[PackageOptions] with BuildCommandHelpers {
val modulesSet = modules.toSet
val providedDeps: Seq[core.Dependency] = value {
res
.map(_.dependencyArtifacts0.safeArtifacts.map(_.map(_._1)))
.map(_.dependencyArtifacts0().safeArtifacts.map(_.map(_._1)))
.sequence
.left
.map(CompositeBuildException(_))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ object Run extends ScalaCommand[RunOptions] with BuildCommandHelpers {
case s: MarkdownFile => fwd(s.path.toString)
case _: SbtFile => ""
case s: OnDisk => fwd(s.path.toString)
case s => s.getClass.getName
case null => ""
}.filter(_.nonEmpty).distinct
val sources = sourceFiles.mkString(File.pathSeparator)
val sourceNames = sourceFiles.map(base).mkString(File.pathSeparator)
Expand Down

This file was deleted.

8 changes: 6 additions & 2 deletions modules/cli/src/test/scala/cli/tests/ScalafmtTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import scala.build.tests.{TestInputs, TestLogger}
import scala.cli.commands.fmt.{FmtOptions, FmtUtil}

class ScalafmtTests extends TestUtil.ScalaCliSuite {
import ScalafmtTests.*
private lazy val defaultScalafmtVersion = Constants.defaultScalafmtVersion

test("readVersionFromFile with non-default scalafmt version") {
Expand All @@ -35,8 +36,6 @@ class ScalafmtTests extends TestUtil.ScalaCliSuite {
}

test(s"check native launcher availability for scalafmt $defaultScalafmtVersion") {
final case class Asset(name: String)
final case class Release(tag_name: String, assets: List[Asset])
lazy val releaseCodec: JsonValueCodec[Release] = JsonCodecMaker.make
val url =
s"https://api.github.com/repos/scalameta/scalafmt/releases/tags/v$defaultScalafmtVersion"
Expand Down Expand Up @@ -75,3 +74,8 @@ class ScalafmtTests extends TestUtil.ScalaCliSuite {
}
}
}

object ScalafmtTests {
private final case class Asset(name: String)
private final case class Release(tag_name: String, assets: List[Asset])
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object OsLibc {
// FIXME These values should be the default ones in coursier-jvm

lazy val jvmIndexOs: String = {
val default = JvmChannel.defaultOs
val default = JvmChannel.defaultOs()
if (default == "linux" && isMusl.getOrElse(false)) "linux-musl"
else default
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def checkFile(file: os.Path, options: Options): Unit =
if success then Green(commandName)
else Red(commandName)
println(s"$cmdLog ${cmd.log}")
println(logs.result.mkString("\n"))
println(logs.result().mkString("\n"))

def pause(): Unit =
println(s"After [${cmd.context}] using $out. Press ENTER key to continue...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ object GenerateReferenceDoc extends CaseApp[InternalDocOptions] {

if (command.names.tail.nonEmpty)
b.section(command.names.map(_.mkString(" ")).tail.mkString("Aliases: `", "`, `", "`"))
for (desc <- command.messages.helpMessage.map(_.referenceDocDetailedMessage))
for (desc <- command.help.helpMessage.map(_.referenceDocDetailedMessage))
b.section(desc)
optionsForCommand(command)
b.section("---")
Expand Down Expand Up @@ -355,7 +355,7 @@ object GenerateReferenceDoc extends CaseApp[InternalDocOptions] {
b.append(s"$headerPrefix## ${names.head}\n\n")
if (names.tail.nonEmpty) b.append(names.tail.sorted.mkString("Aliases: `", "`, `", "`\n\n"))

for (desc <- c.messages.helpMessage.map(_.referenceDocDetailedMessage)) b.section(desc)
for (desc <- c.help.helpMessage.map(_.referenceDocDetailedMessage)) b.section(desc)

if (origins.nonEmpty) {
val links = origins.map { origin =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ object ConfigMonoid:
inline given derive[T](using m: Mirror.ProductOf[T]): ConfigMonoid[T] =
inline m match
case p: Mirror.ProductOf[T] =>
new ConfigMonoid[T]:
def zero: T =
p.fromProduct(zeroTuple[m.MirroredElemTypes])

def orElse(main: T, defaults: T): T =
p.fromProduct(valueTuple[m.MirroredElemTypes, T](0, main, defaults))
ConfigMonoidImpl[T](p.fromProduct(zeroTuple[m.MirroredElemTypes]))((main, defaults) =>
p.fromProduct(valueTuple[m.MirroredElemTypes, T](0, main, defaults))
)
Loading