Files
Oxicloud/build.rs
T
DioCrafts 54639d466a chore(frontend): remove the legacy vanilla-JS frontend and its tooling
The SvelteKit app under /frontend has fully superseded the legacy
vanilla-JS/CSS frontend in /static, which was only ever served by a
debug `cargo run` / `PROFILE=dev` and never shipped to production.
Remove it together with the whole subsystem that existed only to
support it (~54k lines).

Frontend & assets:
- Delete /static (js/, css/, *.html, sw.js, basemaps/, locales symlink).
- Relocate the brand/PWA assets (logo/, favicon.ico, manifest.webmanifest)
  to frontend/static/ so they ship with the SPA. This also fixes the
  favicon, which app.html referenced but was missing from the prod bundle.
- Migrate the Nextcloud login-flow redirects from /nextcloud-error.html
  to the SvelteKit /nextcloud/error route.

Web layer:
- Simplify resolve_static_path: drop the PROFILE=dev branch; always prefer
  the Vite static-dist/ build, fall back to the configured path.
- Resolve i18n locales from the served SPA dir with a frontend/static
  fallback so `just dev` works without a prior build.

Build:
- Prune build.rs from 1262 to ~70 lines (git metadata only); the Rust asset
  pipeline and the OXICLOUD_RUST_ASSETS rollback flag are gone.
- Drop the now-unused build-dependencies (oxc_*, lightningcss).
- Remove the COPY static lines from the Dockerfile (cacher + builder).

Tooling & docs:
- Delete biome.json, jsconfig.json, tools/check-*.py, identifier.sh.
- Remove the legacy front-* justfile recipes; repoint the design-system
  scripts (locales, dead-tokens, brand-drift, token-docs) at the frontend,
  and drop check-contrast/check-headings (coupled to the old token
  taxonomy / multi-page HTML).
- Repoint docs/DESIGN-SYSTEM.md links; remove 5 superseded docs/plan/*.

Backend dead code:
- Remove the dead `folder_repo` field from FileBlobWriteRepository.
- Remove the deprecated GET /api/folders/{id}/listing endpoint
  (superseded by /resources).

Verified: cargo clippy (all-features/all-targets) clean, cargo test
--workspace 448 passed, cargo fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 03:20:10 +02:00

72 lines
2.8 KiB
Rust

//! build.rs — injects git build metadata into the binary.
//!
//! Exposes `GIT_HASH` and `GIT_BRANCH` (consumed via `env!()` in `main.rs`).
//! There is no Rust-side asset pipeline: the frontend is built by Vite into
//! `static-dist/` and served directly by the web layer (`interfaces::web`).
use std::env;
use std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
git_status();
}
// ═══════════════════════════════════════════════════════════════════════════════
// Grab git values
// Supports GitHub; CI vars are honoured (extend if moving to GitLab/CircleCI/…).
// ═══════════════════════════════════════════════════════════════════════════════
fn git_status() {
// Rerun the build script when the commit or branch changes
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs/heads");
let git_hash = first_env(&["GITHUB_SHA", "CI_COMMIT_SHA", "CIRCLE_SHA1", "GIT_COMMIT"])
.or_else(|| git(&["rev-parse", "HEAD"]))
.unwrap_or_else(|| "unknown".into());
println!("cargo:rustc-env=GIT_HASH={git_hash}");
let git_branch = first_env(&[
"GITHUB_HEAD_REF", // GitHub: PR source branch (empty on push)
"GITHUB_REF_NAME", // GitHub: branch/tag on push
"CI_COMMIT_REF_NAME", // GitLab
"CIRCLE_BRANCH", // CircleCI
"GIT_BRANCH", // Jenkins
])
.or_else(|| git(&["rev-parse", "--abbrev-ref", "HEAD"]))
.filter(|b| b != "HEAD") // detached HEAD is not a real branch name
.unwrap_or_else(|| "unknown".into());
println!("cargo:rustc-env=GIT_BRANCH={git_branch}");
// CI builds: rerun if the injected env changes
for k in [
"GITHUB_SHA",
"GITHUB_HEAD_REF",
"GITHUB_REF_NAME",
"CI_COMMIT_SHA",
"CI_COMMIT_REF_NAME",
"CIRCLE_SHA1",
"CIRCLE_BRANCH",
"GIT_COMMIT",
"GIT_BRANCH",
] {
println!("cargo:rerun-if-env-changed={k}");
}
println!("cargo:warning=OxiCloud building with git hash: {git_hash} and branch: {git_branch}");
}
fn git(args: &[&str]) -> Option<String> {
let out = Command::new("git").args(args).output().ok()?;
out.status.success().then_some(())?;
let s = String::from_utf8(out.stdout).ok()?.trim().to_string();
(!s.is_empty()).then_some(s)
}
fn first_env(keys: &[&str]) -> Option<String> {
keys.iter()
.find_map(|k| env::var(k).ok())
.filter(|s| !s.is_empty())
}