chore: convert to a Cargo workspace (fj, fj-client, fj-core) (FJ-5) #5

Merged
David merged 1 commit from chore/cargo-workspace-fj-5 into main 2026-05-25 04:35:46 +02:00
Owner

FJ-5: FJ-3 Phase 1 - convert to a Cargo workspace (fj, fj-client, fj-core)

Phase 1 of 5 of FJ-3. Stands up the workspace and relocates the existing crate. No command logic moves in this phase; behavior is identical.

What changed

  • Root Cargo.toml is now a virtual workspace ([workspace], resolver = "2") with members = ["crates/fj", "crates/fj-client", "crates/fj-core"] and no [package].
  • The entire current crate moved to crates/fj/ via git mv (100% renames, history preserved): src/, build.rs, localization/, and Cargo.toml. Package name forgejo-cli, [[bin]] name = "fj", version 0.5.0, and [package.metadata.binstall] are all preserved unchanged.
  • crates/fj-client and crates/fj-core are compiling placeholder library crates, wired as path deps now so later phases move only code, not manifests: fj -> fj-core and fj-client; fj-core -> fj-client.
  • build.rs + localization/ live under crates/fj/; build.rs reads localization/ relative to its crate root, so the Fluent compile still runs at build time (verified).
  • Infra updated: oci-build/Dockerfile and Dockerfile.windows copy the root Cargo.toml/Cargo.lock plus every crates/*/Cargo.toml, prime the dep cache with dummy main/lib stubs, then copy crates/fj/build.rs, crates/fj/localization, and all crates/*/src for the real build (build.rs/localization deferred to the final layer so a localization edit no longer busts the dependency cache). .dockerignore note updated for crates/**. Both build-binary workflow path filters now use crates/**. The justfile create-release recipe reads/writes the version from crates/fj/Cargo.toml (the root manifest is now virtual). Binary output stays target/release/fj.

Verification

  • cargo build --locked succeeds at the workspace root.
  • target/release/fj version prints fj v0.5.0.
  • Docker builder stage (oci-build/Dockerfile) compiles all three crates and the exported binary prints fj v0.5.0.

Heads-up: pre-existing clippy failure (NOT introduced by this PR)

cargo clippy --all-targets -- -D warnings (the check.yml clippy step) fails on ~108 pre-existing lints (manual_repeat_n, needless_return, type_complexity, from_over_into, enum_variant_names, ...) in the crates/fj source. That source is byte-identical to origin/main (every .rs file is a 100% rename in this PR), so the lints predate this change. They are surfaced by a newer clippy build that landed under the mutable ghcr.io/niceguyit/rust-builder-glibc:v1.0.0-rust1.94-trixie tag (clippy build 2026-03-25), not by the workspace conversion. CI's check.yml clippy step will therefore be red for any PR to main until this is addressed. Recommend tracking the clippy/toolchain-drift cleanup as a separate issue rather than folding a ~108-site lint cleanup into this structural change. Left as-is here per FJ-5 scope ("No command logic moves in this phase").

🤖 Generated with Claude Code

## FJ-5: FJ-3 Phase 1 - convert to a Cargo workspace (fj, fj-client, fj-core) Phase 1 of 5 of FJ-3. Stands up the workspace and relocates the existing crate. No command logic moves in this phase; behavior is identical. ### What changed - Root `Cargo.toml` is now a virtual workspace (`[workspace]`, `resolver = "2"`) with `members = ["crates/fj", "crates/fj-client", "crates/fj-core"]` and no `[package]`. - The entire current crate moved to `crates/fj/` via `git mv` (100% renames, history preserved): `src/`, `build.rs`, `localization/`, and `Cargo.toml`. Package name `forgejo-cli`, `[[bin]] name = "fj"`, version `0.5.0`, and `[package.metadata.binstall]` are all preserved unchanged. - `crates/fj-client` and `crates/fj-core` are compiling placeholder library crates, wired as path deps now so later phases move only code, not manifests: `fj` -> `fj-core` and `fj-client`; `fj-core` -> `fj-client`. - `build.rs` + `localization/` live under `crates/fj/`; `build.rs` reads `localization/` relative to its crate root, so the Fluent compile still runs at build time (verified). - Infra updated: `oci-build/Dockerfile` and `Dockerfile.windows` copy the root `Cargo.toml`/`Cargo.lock` plus every `crates/*/Cargo.toml`, prime the dep cache with dummy `main`/`lib` stubs, then copy `crates/fj/build.rs`, `crates/fj/localization`, and all `crates/*/src` for the real build (`build.rs`/`localization` deferred to the final layer so a localization edit no longer busts the dependency cache). `.dockerignore` note updated for `crates/**`. Both build-binary workflow path filters now use `crates/**`. The `justfile` `create-release` recipe reads/writes the version from `crates/fj/Cargo.toml` (the root manifest is now virtual). Binary output stays `target/release/fj`. ### Verification - `cargo build --locked` succeeds at the workspace root. - `target/release/fj version` prints `fj v0.5.0`. - Docker builder stage (`oci-build/Dockerfile`) compiles all three crates and the exported binary prints `fj v0.5.0`. ### Heads-up: pre-existing clippy failure (NOT introduced by this PR) `cargo clippy --all-targets -- -D warnings` (the `check.yml` clippy step) fails on ~108 pre-existing lints (`manual_repeat_n`, `needless_return`, `type_complexity`, `from_over_into`, `enum_variant_names`, ...) in the `crates/fj` source. That source is byte-identical to `origin/main` (every `.rs` file is a 100% rename in this PR), so the lints predate this change. They are surfaced by a newer clippy build that landed under the mutable `ghcr.io/niceguyit/rust-builder-glibc:v1.0.0-rust1.94-trixie` tag (clippy build 2026-03-25), not by the workspace conversion. CI's `check.yml` clippy step will therefore be red for any PR to `main` until this is addressed. Recommend tracking the clippy/toolchain-drift cleanup as a separate issue rather than folding a ~108-site lint cleanup into this structural change. Left as-is here per FJ-5 scope ("No command logic moves in this phase"). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chore: convert to a Cargo workspace (fj, fj-client, fj-core) (FJ-5)
Some checks failed
Check / fmt + clippy + build + tests (pull_request) Failing after 20s
Create release / Create release from merged PR (pull_request) Has been skipped
fc4c3425d5
FJ-3 Phase 1 of 5: stand up the workspace and relocate the existing crate. No command logic moves in this phase; behavior is identical and the build stays green.

The single forgejo-cli crate now lives under crates/fj/ (src/, build.rs, localization/, and its Cargo.toml moved verbatim via git rename so history is preserved). The package name forgejo-cli, the [[bin]] name fj, the version 0.5.0, and the [package.metadata.binstall] block are all preserved unchanged. build.rs still reads localization/ relative to its crate root (now crates/fj/), so the Fluent compile runs as before.

The root Cargo.toml is now a virtual workspace ([workspace], resolver "2") listing crates/fj, crates/fj-client, crates/fj-core; it has no [package]. crates/fj-client and crates/fj-core are compiling placeholder library crates wired as path deps now so later phases move only code, not manifests: fj depends on fj-core and fj-client, and fj-core depends on fj-client.

Infra updated for the new layout: oci-build/Dockerfile and Dockerfile.windows copy the root Cargo.toml/Cargo.lock plus every crates/*/Cargo.toml, prime the dependency cache with dummy main/lib stubs, then copy crates/fj/build.rs, crates/fj/localization, and all crates/*/src for the real build (build.rs and localization are deferred to the final layer so a localization edit no longer busts the dependency cache); .dockerignore note updated to cover crates/**; both build-binary workflow path filters replaced src/build.rs/localization filters with crates/**; the justfile create-release recipe reads and writes the version from crates/fj/Cargo.toml since the root manifest is now virtual. Binary output stays target/release/fj.

Verified: cargo build --locked succeeds at the workspace root, target/release/fj version prints fj v0.5.0, and the Docker builder stage (oci-build/Dockerfile) compiles all three crates and exports an fj that prints fj v0.5.0.

Note: cargo clippy -- -D warnings fails on ~108 pre-existing lints (manual_repeat_n, needless_return, type_complexity, from_over_into, ...) in the unchanged crates/fj source. These are byte-identical to origin/main (every .rs file is a 100% rename) and are surfaced by a newer clippy that landed under the mutable rust-builder-glibc:v1.0.0-rust1.94-trixie tag, not by this conversion. They predate this change and should be addressed in a separate issue.

#FJ-5 State Done

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
David merged commit c3f464df99 into main 2026-05-25 04:35:46 +02:00
David deleted branch chore/cargo-workspace-fj-5 2026-05-25 04:35:46 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pandoras-box/forgejo-cli!5
No description provided.