Skip to content

Commit b153014

Browse files
authored
Add a global --offline config key (VirtusLab#3216)
* Add a global offline config key * [debug] increase verbosity in failing tests * Kill Bloop's process after config tests * Remove verbosity options from tests
1 parent d9bc3e7 commit b153014

22 files changed

Lines changed: 93 additions & 25 deletions

File tree

build.mill

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ trait Core extends ScalaCliCrossSbtModule
420420
.exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-macros"))
421421
// Let's favor our config module rather than the one coursier pulls
422422
.exclude((organization, "config_2.13"))
423+
.exclude((organization, "config_3"))
423424
.exclude(("org.scala-lang.modules", "scala-collection-compat_2.13")),
424425
Deps.dependency,
425426
Deps.guava, // for coursierJvm / scalaJsEnvNodeJs, see above
@@ -927,15 +928,15 @@ trait Cli extends CrossSbtModule with ProtoBuildModule with CliLaunchers
927928
Deps.caseApp,
928929
Deps.coursierLauncher,
929930
Deps.coursierProxySetup,
930-
Deps.coursierPublish.exclude((organization, "config_2.13")),
931+
Deps.coursierPublish.exclude((organization, "config_2.13")).exclude((organization, "config_3")),
931932
Deps.jimfs, // scalaJsEnvNodeJs pulls jimfs:1.1, whose class path seems borked (bin compat issue with the guava version it depends on)
932933
Deps.jniUtils,
933934
Deps.jsoniterCore,
934935
Deps.libsodiumjni,
935936
Deps.metaconfigTypesafe,
936937
Deps.pythonNativeLibs,
937938
Deps.scalaPackager.exclude("com.lihaoyi" -> "os-lib_2.13"),
938-
Deps.signingCli.exclude((organization, "config_2.13")),
939+
Deps.signingCli.exclude((organization, "config_2.13")).exclude((organization, "config_3")),
939940
Deps.slf4jNop, // to silence jgit
940941
Deps.sttp,
941942
Deps.scalafixInterfaces,

modules/cli/src/main/scala/scala/cli/commands/bloop/BloopExit.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object BloopExit extends ScalaCommand[BloopExitOptions] {
1717
import opts.*
1818
compilationServer.bloopRifleConfig(
1919
global.logging.logger,
20-
coursier.coursierCache(global.logging.logger.coursierLogger("Downloading Bloop")),
20+
coursier.coursierCache(global.logging.logger, cacheLoggerPrefix = "Downloading Bloop"),
2121
global.logging.verbosity,
2222
"java", // shouldn't be used…
2323
Directories.directories

modules/cli/src/main/scala/scala/cli/commands/bloop/BloopOutput.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object BloopOutput extends ScalaCommand[BloopOutputOptions] {
1919
override def runCommand(options: BloopOutputOptions, args: RemainingArgs, logger: Logger): Unit = {
2020
val bloopRifleConfig = options.compilationServer.bloopRifleConfig(
2121
logger,
22-
CoursierOptions().coursierCache(logger.coursierLogger("Downloading Bloop")), // unused here
22+
CoursierOptions().coursierCache(logger, cacheLoggerPrefix = "Downloading Bloop"), // unused here
2323
options.global.logging.verbosity,
2424
"unused-java", // unused here
2525
Directories.directories

modules/cli/src/main/scala/scala/cli/commands/bloop/BloopStart.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ object BloopStart extends ScalaCommand[BloopStartOptions] {
2222
import opts.*
2323
val buildOptions = BuildOptions(
2424
javaOptions = JvmUtils.javaOptions(jvm).orExit(global.logging.logger),
25-
internal = InternalOptions(
26-
cache = Some(coursier.coursierCache(global.logging.logger.coursierLogger("")))
27-
)
25+
internal = InternalOptions(cache = Some(coursier.coursierCache(global.logging.logger)))
2826
)
2927

3028
compilationServer.bloopRifleConfig(
3129
global.logging.logger,
32-
coursier.coursierCache(global.logging.logger.coursierLogger("Downloading Bloop")),
30+
coursier.coursierCache(global.logging.logger, cacheLoggerPrefix = "Downloading Bloop"),
3331
global.logging.verbosity,
3432
buildOptions.javaHome().value.javaCommand,
3533
Directories.directories

modules/cli/src/main/scala/scala/cli/commands/config/Config.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object Config extends ScalaCommand[ConfigOptions] {
4545
)
4646
sys.exit(1)
4747
}
48-
val coursierCache = options.coursier.coursierCache(logger.coursierLogger(""))
48+
val coursierCache = options.coursier.coursierCache(logger)
4949
val secKeyEntry = Keys.pgpSecretKey
5050
val pubKeyEntry = Keys.pgpPublicKey
5151

@@ -132,7 +132,7 @@ object Config extends ScalaCommand[ConfigOptions] {
132132
System.err.println(err)
133133
sys.exit(1)
134134
case Right(passwordOption) =>
135-
val password = passwordOption.getBytes()
135+
val password = passwordOption.getBytes
136136
System.out.write(password.value)
137137
}
138138
else

modules/cli/src/main/scala/scala/cli/commands/default/Default.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Default(actualHelp: => RuntimeCommandsHelp)
4343
Version.runCommand(
4444
options = VersionOptions(
4545
global = options.shared.global,
46-
offline = options.shared.coursier.getOffline().getOrElse(false)
46+
offline = options.shared.coursier.getOffline(logger).getOrElse(false)
4747
),
4848
args = args,
4949
logger = logger

modules/cli/src/main/scala/scala/cli/commands/github/SecretCreate.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ object SecretCreate extends ScalaCommand[SecretCreateOptions] {
157157
).orExit(logger)
158158
}
159159

160-
val cache = options.coursier.coursierCache(logger.coursierLogger(""))
160+
val cache = options.coursier.coursierCache(logger)
161161
val archiveCache = ArchiveCache().withCache(cache)
162162

163163
LibSodiumJni.init(cache, archiveCache, logger)

modules/cli/src/main/scala/scala/cli/commands/new/New.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object New extends ScalaCommand[NewOptions] {
2727
Seq.empty,
2828
Some(scalaParameters),
2929
logger,
30-
CoursierOptions().coursierCache(logger.coursierLogger("")),
30+
CoursierOptions().coursierCache(logger),
3131
None
3232
) match {
3333
case Right(value) => value

modules/cli/src/main/scala/scala/cli/commands/pgp/PgpExternalCommand.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ abstract class PgpExternalCommand extends ExternalCommand {
100100

101101
val logger = options.global.logging.logger
102102

103-
val cache = options.coursier.coursierCache(logger.coursierLogger(""))
103+
val cache = options.coursier.coursierCache(logger)
104104
val retCode = tryRun(
105105
cache,
106106
remainingArgs,

modules/cli/src/main/scala/scala/cli/commands/pgp/PgpPush.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object PgpPush extends ScalaCommand[PgpPushOptions] {
2828
sys.exit(1)
2929
}
3030

31-
lazy val coursierCache = options.coursier.coursierCache(logger.coursierLogger(""))
31+
lazy val coursierCache = options.coursier.coursierCache(logger)
3232

3333
for (key <- all) {
3434
val path = os.Path(key, os.pwd)

0 commit comments

Comments
 (0)