-
Notifications
You must be signed in to change notification settings - Fork 4
Project symbol lookup #9
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 7 commits
e70d14a
2323a30
7c69850
f68f159
f44175e
4c88ed6
62e8cd5
b969e49
56d9160
e0f86e3
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 |
|---|---|---|
|
|
@@ -17,3 +17,4 @@ langoustine-tracer | |
| .vscode | ||
| .claude | ||
| ai | ||
| .cellar | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||||||||
| package cellar.build | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| import cats.effect.IO | ||||||||||||||||||||||||||||||||||||||||
| import java.nio.file.{Files, Path} | ||||||||||||||||||||||||||||||||||||||||
| import java.security.MessageDigest | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| object BuildFingerprint: | ||||||||||||||||||||||||||||||||||||||||
| def compute(files: List[Path], module: String): IO[String] = | ||||||||||||||||||||||||||||||||||||||||
| IO.blocking { | ||||||||||||||||||||||||||||||||||||||||
| val digest = MessageDigest.getInstance("SHA-256") | ||||||||||||||||||||||||||||||||||||||||
| digest.update(module.getBytes) | ||||||||||||||||||||||||||||||||||||||||
| files.sorted.foreach { path => | ||||||||||||||||||||||||||||||||||||||||
| if Files.exists(path) then | ||||||||||||||||||||||||||||||||||||||||
| digest.update(path.toString.getBytes) | ||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
| object BuildFingerprint: | |
| def compute(files: List[Path], module: String): IO[String] = | |
| IO.blocking { | |
| val digest = MessageDigest.getInstance("SHA-256") | |
| digest.update(module.getBytes) | |
| files.sorted.foreach { path => | |
| if Files.exists(path) then | |
| digest.update(path.toString.getBytes) | |
| import java.nio.charset.StandardCharsets | |
| object BuildFingerprint: | |
| def compute(files: List[Path], module: String): IO[String] = | |
| IO.blocking { | |
| val digest = MessageDigest.getInstance("SHA-256") | |
| digest.update(module.getBytes(StandardCharsets.UTF_8)) | |
| files.sorted.foreach { path => | |
| if Files.exists(path) then | |
| digest.update(path.toString.getBytes(StandardCharsets.UTF_8)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package cellar.build | ||
|
|
||
| import cats.effect.IO | ||
| import cellar.CellarError | ||
| import java.nio.file.Path | ||
|
|
||
| trait BuildTool: | ||
| def kind: BuildToolKind | ||
| def compile(module: Option[String]): IO[Unit] | ||
| def extractClasspath(module: Option[String]): IO[List[Path]] | ||
| def fingerprintFiles(): IO[List[Path]] | ||
|
|
||
| protected def requireModule(module: Option[String]): IO[String] = | ||
| module match | ||
| case Some(m) => IO.pure(m) | ||
| case None => IO.raiseError(CellarError.ModuleRequired(kind)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package cellar.build | ||
|
|
||
| import cats.effect.IO | ||
| import java.nio.file.{Files, Path} | ||
|
|
||
| enum BuildToolKind: | ||
| case Mill, Sbt, ScalaCli | ||
|
|
||
| object BuildToolDetector: | ||
| private val millMarkers = List("build.mill", "build.sc", "build.mill.yaml", "build.yaml") | ||
|
|
||
| /** Detect the build tool kind from marker files only (no binary check). */ | ||
| def detectKind(dir: Path): IO[BuildToolKind] = | ||
| IO.blocking { | ||
| val millMarker = millMarkers.find(m => Files.exists(dir.resolve(m))) | ||
| val hasSbt = Files.exists(dir.resolve("build.sbt")) | ||
| val hasScalaBuild = Files.isDirectory(dir.resolve(".scala-build")) | ||
|
|
||
| if millMarker.isDefined then BuildToolKind.Mill | ||
| else if hasSbt then BuildToolKind.Sbt | ||
| else if hasScalaBuild then BuildToolKind.ScalaCli | ||
| else BuildToolKind.ScalaCli // fallback | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CLI semantics have changed so
get/list/searchnow operate on the current project and the old coordinate-based behavior moved to*-external.README.mdstill documentscellar get <coordinate> <fqn>etc., which will now be incorrect for users. Please update the README (and any other user docs) to match the new command names/meaning.