-
Notifications
You must be signed in to change notification settings - Fork 4
Add config option to suppress CE starvation warnings #39
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
Changes from all commits
4072565
571515e
59be07c
7180935
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| starvation-checks { | ||
| enabled = true | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,5 +17,5 @@ langoustine-tracer | |
| .vscode | ||
| .claude | ||
| ai | ||
| .cellar | ||
| .cellar/cache | ||
| result | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,7 +139,6 @@ cellar get-external org.typelevel:cats-core_3:latest cats.Monad | |
| |---|---|---| | ||
| | `--module <name>`, `-m` | project commands | Build module name (required for Mill/sbt) | | ||
| | `--no-cache` | project commands | Skip classpath cache, re-extract from build tool | | ||
| | `--config <path>`, `-c` | project commands | Path to config file | | ||
| | `--java-home <path>` | all | Use a specific JDK for JRE classpath | | ||
| | `-r`, `--repository <url>` | external commands | Extra Maven repository URL (repeatable) | | ||
| | `-l`, `--limit <N>` | `list`, `list-external`, `search`, `search-external` | Max results (default: 50) | | ||
|
|
@@ -152,8 +151,6 @@ Cellar loads configuration from HOCON files and environment variables. Files are | |
| 2. `~/.cellar/cellar.conf` (user-level, optional) | ||
| 3. `.cellar/cellar.conf` (project-level, optional) | ||
|
|
||
| Use `--config <path>` / `-c <path>` to load a specific file instead. | ||
|
|
||
| ### Default config | ||
|
|
||
| ```hocon | ||
|
|
@@ -168,6 +165,12 @@ sbt { | |
| # Extra arguments passed to sbt, space-separated (e.g. "--client") | ||
| extra-args = "" # env: CELLAR_SBT_EXTRA_ARGS | ||
| } | ||
|
|
||
| starvation-checks { | ||
| # Enable Cats Effect CPU starvation warnings (default: false). | ||
| # Set to true during development or CI to surface warnings. | ||
| enabled = false # env: CELLAR_STARVATION_CHECKS_ENABLED | ||
| } | ||
|
Comment on lines
+169
to
+173
|
||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| package cellar | ||
|
|
||
| import cats.effect.IO | ||
| import cats.syntax.all.* | ||
| import fs2.io.file.{Files, Path} | ||
| import fs2.io.file.Path | ||
| import pureconfig.* | ||
|
|
||
| case class MillConfig(binary: String) derives ConfigReader | ||
|
|
@@ -11,25 +9,20 @@ case class SbtConfig(binary: String, extraArgs: String) derives ConfigReader { | |
| def effectiveExtraArgs: List[String] = extraArgs.split("\\s+").filter(_.nonEmpty).toList | ||
| } | ||
|
|
||
| case class Config(mill: MillConfig, sbt: SbtConfig) derives ConfigReader | ||
| case class StarvationChecksConfig(enabled: Boolean) derives ConfigReader | ||
|
|
||
| object Config { | ||
| lazy val default: IO[Config] = load(None) | ||
| case class Config(mill: MillConfig, sbt: SbtConfig, starvationChecks: StarvationChecksConfig) derives ConfigReader | ||
|
Comment on lines
+12
to
+14
|
||
|
|
||
| val defaultUserPath: Option[Path] = | ||
| object Config { | ||
| private val defaultUserPath: Option[Path] = | ||
| sys.props.get("user.home").map(Path(_).resolve(".cellar").resolve("cellar.conf")) | ||
| val defaultProjectPath: Path = Path(".cellar").resolve("cellar.conf") | ||
|
|
||
| def load(path: Option[Path]): IO[Config] = { | ||
| def load0(path: List[Path]) = | ||
| IO.blocking { | ||
| path.foldLeft(ConfigSource.default)((cs, p) => ConfigSource.file(p.toNioPath).withFallback(cs)).loadOrThrow[Config] | ||
| } | ||
|
|
||
| path match | ||
| case sp: Some[_] => load0(sp.toList) | ||
| case None => | ||
| val relevantPaths = defaultUserPath.toList ++ List(defaultProjectPath) | ||
| relevantPaths.filterA(p => Files[IO].exists(p)).flatMap(load0) | ||
| private val defaultProjectPath: Path = Path(".cellar").resolve("cellar.conf") | ||
|
|
||
| lazy val global: Config = { | ||
| val paths = (defaultUserPath.toList ++ List(defaultProjectPath)) | ||
| .filter(p => java.nio.file.Files.exists(p.toNioPath)) | ||
| paths | ||
| .foldLeft(ConfigSource.default)((cs, p) => ConfigSource.file(p.toNioPath).withFallback(cs)) | ||
| .loadOrThrow[Config] | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.