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

Runner specification #1445

Merged
merged 11 commits into from
Nov 18, 2022
13 changes: 11 additions & 2 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ trait Directives extends ScalaCliSbtModule with ScalaCliPublishModule with HasTe
def moduleDeps = Seq(
options,
core,
`build-macros`
`build-macros`,
`cli-options`
)
def scalacOptions = T {
super.scalacOptions() ++ asyncScalacOptions(scalaVersion())
Expand All @@ -435,6 +436,9 @@ trait Directives extends ScalaCliSbtModule with ScalaCliPublishModule with HasTe
Deps.usingDirectives
)

def repositoriesTask =
T.task(super.repositoriesTask() ++ deps.customRepositories)

object test extends Tests with ScalaCliTests {
def ivyDeps = super.ivyDeps() ++ Agg(
Deps.pprint
Expand Down Expand Up @@ -515,6 +519,9 @@ trait Options extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
Deps.jsoniterMacros
)

def repositoriesTask =
T.task(super.repositoriesTask() ++ deps.customRepositories)

object test extends Tests with ScalaCliTests {
// uncomment below to debug tests in attach mode on 5005 port
// def forkArgs = T {
Expand Down Expand Up @@ -595,6 +602,9 @@ trait Build extends ScalaCliSbtModule with ScalaCliPublishModule with HasTests
Deps.zipInputStream
) ++ (if (scalaVersion().startsWith("3")) Agg() else Agg(Deps.shapeless))

def repositoriesTask =
T.task(super.repositoriesTask() ++ deps.customRepositories)

object test extends Tests with ScalaCliTests {
def ivyDeps = super.ivyDeps() ++ Agg(
Deps.pprint,
Expand Down Expand Up @@ -741,7 +751,6 @@ trait Cli extends SbtModule with ProtoBuildModule with CliLaunchers
}
def moduleDeps = Seq(
`build-module`,
`cli-options`,
config(Scala.scala3),
`scala3-graal`(Scala.scala3)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ final case class AboutOptions(
logging: LoggingOptions = LoggingOptions(),
@Hidden
@HelpMessage(HelpMessages.passwordOption)
@Tag(tags.implementation)
ghToken: Option[PasswordOption] = None
) extends HasLoggingOptions
// format: on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import caseapp.*
// format: off
final case class BenchmarkingOptions(
@Group("Benchmarking")
@HelpMessage("[experimental] Run JMH benchmarks")
@Tag(tags.experimental)
@HelpMessage("Run JMH benchmarks")
jmh: Option[Boolean] = None,
@Group("Benchmarking")
@HelpMessage("[experimental] Set JMH version")
@Tag(tags.experimental)
@HelpMessage("Set JMH version")
@ValueDescription("version")
jmhVersion: Option[String] = None
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ final case class CompileOptions(

@Name("p")
@Name("printClasspath")
@Tag(tags.restricted)
@HelpMessage("Print the resulting class path")
printClassPath: Boolean = false,

@HelpMessage("Compile test scope")
@Tag(tags.should)
test: Boolean = false
) extends HasSharedOptions
// format: on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ final case class CoursierOptions(
@Group("Dependency")
@HelpMessage("Specify a TTL for changing dependencies, such as snapshots")
@ValueDescription("duration|Inf")
@Tag(tags.implementation)
@Hidden
ttl: Option[String] = None,
@Group("Dependency")
@HelpMessage("Set the coursier cache location")
@ValueDescription("path")
@Tag(tags.implementation)
@Hidden
cache: Option[String] = None,
@Group("Dependency")
@HelpMessage("Enable checksum validation of artifacts downloaded by coursier")
@Tag(tags.implementation)
@Hidden
coursierValidateChecksums: Option[Boolean] = None
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import caseapp.*

// format: off
final case class CrossOptions(
@HelpMessage("[experimental] Run given command against all provided Scala versions and/or platforms")
@Tag(tags.experimental)
@HelpMessage("Run given command against all provided Scala versions and/or platforms")
cross: Option[Boolean] = None
)
// format: on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ final case class DocOptions(
@Recurse
shared: SharedOptions = SharedOptions(),
@Group("Doc")
@Tag(tags.must)
@HelpMessage("Set the destination path")
@Name("o")
output: Option[String] = None,
@Group("Doc")
@HelpMessage("Overwrite the destination directory, if it exists")
@HelpMessage("Overwrite the destination directory, if it exists")
@Tag(tags.must)
@Name("f")
force: Boolean = false,
@Group("Doc")
@HelpMessage("Control if Scala CLI should use default options for scaladoc, true by default. Use `--default-scaladoc-opts:false` to not include default options.")
@Tag(tags.should)
@ExtraName("defaultScaladocOpts")
defaultScaladocOptions: Option[Boolean] = None,
) extends HasSharedOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ final case class DoctorOptions(
logging: LoggingOptions = LoggingOptions(),
@Hidden
@HelpMessage(HelpMessages.passwordOption)
@Tag(tags.implementation)
ghToken: Option[PasswordOption] = None
) extends HasLoggingOptions
// format: on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,34 @@ final case class FmtOptions(
shared: SharedOptions = SharedOptions(),

@Group("Format")
@Tag(tags.should)
@HelpMessage("Check if sources are well formatted")
check: Boolean = false,

@Group("Format")
@Tag(tags.implementation)
@HelpMessage("Use project filters defined in the configuration. Turned on by default, use `--respect-project-filters:false` to disable it.")
respectProjectFilters: Boolean = true,

@Group("Format")
@Tag(tags.implementation)
@HelpMessage("Saves .scalafmt.conf file if it was created or overwritten")
saveScalafmtConf: Boolean = false,

@Group("Format")
@Tag(tags.implementation)
@Hidden
osArchSuffix: Option[String] = None,
@Group("Format")
@Tag(tags.implementation)
@Hidden
scalafmtTag: Option[String] = None,
@Group("Format")
@Tag(tags.implementation)
@Hidden
scalafmtGithubOrgName: Option[String] = None,
@Group("Format")
@Tag(tags.implementation)
@Hidden
scalafmtExtension: Option[String] = None,
@Group("Format")
Expand All @@ -41,22 +48,27 @@ final case class FmtOptions(

@Group("Format")
@Name("F")
@Tag(tags.implementation)
@HelpMessage("Pass argument to scalafmt.")
scalafmtArg: List[String] = Nil,

@Group("Format")
@HelpMessage("Custom path to the scalafmt configuration file.")
@Tag(tags.implementation)
@Name("scalafmtConfig")
scalafmtConf: Option[String] = None,
@Group("Format")
@HelpMessage("Pass configuration as a string.")
@Name("scalafmtConfigStr")
@Name("scalafmtConfSnippet")
scalafmtConfStr: Option[String] = None,
@Tag(tags.implementation)
@Group("Format")
@HelpMessage("Pass a global dialect for scalafmt. This overrides whatever value is configured in the .scalafmt.conf file or inferred based on Scala version used.")
@Tag(tags.implementation)
@Name("dialect")
scalafmtDialect: Option[String] = None,
@Tag(tags.implementation)
@Group("Format")
@HelpMessage(s"Pass scalafmt version before running it (${Constants.defaultScalafmtVersion} by default). If passed, this overrides whatever value is configured in the .scalafmt.conf file.")
@Name("fmtVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@ import com.github.plokhotnyuk.jsoniter_scala.macros.*
@HelpMessage("Print help message")
case class HelpGroupOptions(
@HelpMessage("Show options for ScalaJS")
@Tag(tags.implementation)
helpJs: Boolean = false,
@HelpMessage("Show options for ScalaNative")
@Tag(tags.implementation)
helpNative: Boolean = false,
@HelpMessage("Show options for Scaladoc")
@Name("scaladocHelp")
@Name("docHelp")
@Name("helpDoc")
@Tag(tags.implementation)
helpScaladoc: Boolean = false,
@HelpMessage("Show options for Scala REPL")
@Name("replHelp")
@Tag(tags.implementation)
helpRepl: Boolean = false,
@HelpMessage("Show options for Scalafmt")
@Name("scalafmtHelp")
@Name("fmtHelp")
@Name("helpFmt")
@Tag(tags.implementation)
helpScalafmt: Boolean = false
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,30 @@ final case class InstallCompletionsOptions(
directories: SharedDirectoriesOptions = SharedDirectoriesOptions(),

@Name("shell")
@Tag(tags.implementation)
@HelpMessage("Name of the shell, either zsh or bash")
format: Option[String] = None,

@Tag(tags.implementation)
@HelpMessage("Path to `*rc` file, defaults to `.bashrc` or `.zshrc` depending on shell")
rcFile: Option[String] = None,

@Tag(tags.implementation)
@HelpMessage("Completions output directory")
@Name("o")
output: Option[String] = None,

@Hidden
@Tag(tags.implementation)
@HelpMessage("Custom banner in comment placed in rc file")
banner: String = "{NAME} completions",

@Hidden
@Tag(tags.implementation)
@HelpMessage("Custom completions name")
name: Option[String] = None,

@Tag(tags.implementation)
@HelpMessage("Print completions to stdout")
env: Boolean = false,
) extends HasLoggingOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,22 @@ final case class InstallHomeOptions(
@Recurse
logging: LoggingOptions = LoggingOptions(),
@Group("InstallHome")
@Tag(tags.implementation)
scalaCliBinaryPath: String,
@Group("InstallHome")
@Name("f")
@Tag(tags.implementation)
@HelpMessage("Overwrite if it exists")
force: Boolean = false,
@Hidden
@Tag(tags.implementation)
@HelpMessage("Binary name")
binaryName: String = "scala-cli",
@Tag(tags.implementation)
@HelpMessage("Print the update to `env` variable")
env: Boolean = false,
@Hidden
@Tag(tags.implementation)
@HelpMessage("Binary directory")
binDir: Option[String] = None
) extends HasLoggingOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ final case class LoggingOptions(
verbosityOptions: VerbosityOptions = VerbosityOptions(),
@Group("Logging")
@HelpMessage("Decrease verbosity")
@Tag(tags.implementation)
@Name("q")
quiet: Boolean = false,
@Group("Logging")
@Tag(tags.implementation)
@HelpMessage("Use progress bars")
progress: Option[Boolean] = None
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ final case class MainClassOptions(
@Group("Entrypoint")
@HelpMessage("Specify which main class to run")
@ValueDescription("main-class")
@Tag(tags.must)
@Name("M")
mainClass: Option[String] = None,

Expand All @@ -15,6 +16,7 @@ final case class MainClassOptions(
@Name("mainClassList")
@Name("listMainClass")
@Name("listMainClasses")
@Tag(tags.should)
mainClassLs: Option[Boolean] = None
)
// format: on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import caseapp.*
// format: off
final case class MarkdownOptions(
@Group("Markdown")
@HelpMessage("[experimental] Enable markdown support.")
@Tag(tags.experimental)
@HelpMessage("Enable markdown support.")
@Name("md")
@Name("markdown")
enableMarkdown: Boolean = false // TODO: add a separate scope for Markdown and remove this option once it's stable
Expand Down
Loading