Feat: Add Scala SDK - #164
Conversation
markovejnovic
left a comment
There was a problem hiding this comment.
Thank you for your PR! Left some comments, but not blocking. Feel free to merge. I'll make a follow-up pass afterwards.
| .coverage | ||
| htmlcov/ | ||
| .vscode/ | ||
| git No newline at end of file |
There was a problem hiding this comment.
I'd avoid gitignoring this. I can imagine we create a git/ directory and I think this would filter it out
| dependencies = [ | ||
| "pytest>=9.0.3", | ||
| ] | ||
|
|
There was a problem hiding this comment.
I would avoid adding this since pytest is already under project.optional-dependencies.dev.
| version = 1 | ||
| revision = 3 |
There was a problem hiding this comment.
In theory, after you revert your pyproject.toml you'll be able to drop changes on this file.
| @hm.target() | ||
| def project() -> ScalaProject: | ||
| return hm.scala.project(path=".") | ||
|
|
||
|
|
||
| @hm.pipeline( | ||
| "ci", | ||
| env={"CI": "true"}, | ||
| triggers=[hm.push(branch="main")] | ||
| ) | ||
| def ci(project: hm.Target[ScalaProject]) -> tuple[hm.Step, ...]: | ||
| return project.ci() |
There was a problem hiding this comment.
| @hm.target() | |
| def project() -> ScalaProject: | |
| return hm.scala.project(path=".") | |
| @hm.pipeline( | |
| "ci", | |
| env={"CI": "true"}, | |
| triggers=[hm.push(branch="main")] | |
| ) | |
| def ci(project: hm.Target[ScalaProject]) -> tuple[hm.Step, ...]: | |
| return project.ci() | |
| @hm.pipeline( | |
| "ci", | |
| env={"CI": "true"}, | |
| triggers=[hm.push(branch="main")] | |
| ) | |
| def ci(project: hm.Target[ScalaProject]) -> tuple[hm.Step, ...]: | |
| project = hm.scala.project(path=".") | |
| return project.ci() |
Just so the example is slightly shorter! =)
| # and can be added to the global gitignore or merged into this file. For a more nuclear | ||
| # option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
| # .idea/ | ||
| .idea/ |
There was a problem hiding this comment.
| .idea/ | |
| .idea/ |
| build_file_path = f"{path}/build.sbt" if path != "." else "build.sbt" | ||
| properties_file = f"{path}/project/build.properties" if path != "." else "project/build.properties" | ||
| scala_main_glob = f"{path}/**/src/main/*.scala" if path != "." else "**/src/main/*.scala" | ||
| scala_test_glob = f"{path}/**/src/test/*.scala" if path != "." else "**/src/test/*.scala" |
There was a problem hiding this comment.
Hmm, this hard-coded stuff kind of fears me.
I don't completely understand scala's canonical project structure but I suspect there will always be an edge-case wherein people do not have conventional/common/simple project structures so this hard-coded glob wouldn't fit.
For example, someone could create *.test.scala files to indicate tests? These globs would cause that build to not be buildable within hm.
But I think this is OK for now. I don't want perfect to be the enemy of good, and I want to spend time getting claude to write hm files for real-world projects to research what would be the best interface.
There was a problem hiding this comment.
this is scala's canonical project structure and yes you're right there might be edge cases but largely this is the convention and it stems from the jvm world. Scala files whether test or source files are still .scala which is in the src/tests folder
…nit scaffold
- Example pipeline: drop the unresolved `project: hm.Target[...]` parameter that
crashed rendering ("target 'project' not found"); call
`hm.scala.project(".").ci()` directly.
- pyproject: remove pytest from runtime `dependencies` (already a dev dep);
restore uv.lock to the tracked revision, dropping unrelated churn.
- fmt defaults to check=True (`sbt scalafmtCheckAll`) so `ci()` verifies
formatting instead of silently reformatting; ScalaProject.fmt delegates to the
toolchain step (chains off install, parallel to warmup), mirroring Rust.
- Fix `_test_cmd` construction (spacing, `--` options, str-coerce + shlex-quote)
and add parametrized coverage.
- Drop the dead `components` param and the invalid `ScalaProject.setup` (no
`installed` field); remove TODOs; reformat to 4-space; fix isort order; export
`ScalaProject`.
- Rewrite docstrings to the real API (`hm.scala.toolchain`/`project`, not
`hm.scala()`/`clippy`/`version=`).
- Fix tests that asserted nothing or targeted `hm.rust`; align label/scalafmt
expectations.
- Add the missing `hm init` Scala template + wiring and a roundtrip test.
- Revert unrelated root `.gitignore` `.idea/` flip and the stray `git ` entry.
Note: pipeline-SDK reference docs are generated from these docstrings in the
parent repo via `make docs-generate` — regenerate there alongside the gitlink bump.
No description provided.