Commit browse files
Message
Changed Files (17)
-
modified .gitignore
diff --git a/.gitignore b/.gitignore index 147adbf..2a893ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target/ public/ +abbaye-build.tape -
modified CHANGELOG.md
diff --git a/CHANGELOG.md b/CHANGELOG.md index 533de24..ea58fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### ⚙️ Miscellaneous Tasks -- Add cargo-edit to mise tools, create release script, update AGENTS.md +- Add cargo-edit to mise tools, create release script, mise plugin ## [0.8.0] - 2026-06-17 ### 🚀 Features -
modified abbaye.schema.json
diff --git a/abbaye.schema.json b/abbaye.schema.json index c4a0804..02e1808 100644 --- a/abbaye.schema.json +++ b/abbaye.schema.json @@ -382,6 +382,11 @@ "default": 200, "minimum": 0 }, + "prefix": { + "description": "Directory prefix for git UI pages relative to the site output root.\nDefaults to `\"\"` (pages generated directly at the site root).\nSet to `\"repository\"` for the legacy layout.", + "type": "string", + "default": "" + }, "repo_path": { "description": "Path to the git repository to read. Defaults to `.` (the current directory).", "type": [ -
modified abbaye.toml
diff --git a/abbaye.toml b/abbaye.toml index 52cd943..7c6eb47 100644 --- a/abbaye.toml +++ b/abbaye.toml @@ -140,11 +140,11 @@ tag_prefix = "v" # Builds the Rust project with `cargo build --release`. category = "Binaries" name = "Pre-built binaries" -comment = "Built for x86_64 Linux (glibc and musl). Choose the -musl build for maximum portability." +comment = "Built for x86_64 and aarch64 Linux (musl)." type = "cargo" # Target triples for cross-compilation (optional, default: [] = host target). -targets = ["x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl"] +targets = ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"] # Path to Cargo.toml (optional, default: "./Cargo.toml"). # manifest_path = "Cargo.toml" -
modified mise.toml
diff --git a/mise.toml b/mise.toml index 2048cb9..e55e432 100644 --- a/mise.toml +++ b/mise.toml @@ -3,6 +3,7 @@ "cargo:cargo-edit" = "latest" "cargo:cargo-readme" = "latest" "cargo:cargo-semver-checks" = "latest" +"cargo:cross" = "latest" git-cliff = "latest" prek = "latest" release-plz = "latest" -
modified src/builders/cargo.rs
diff --git a/src/builders/cargo.rs b/src/builders/cargo.rs index 51d1dd0..d262df7 100644 --- a/src/builders/cargo.rs +++ b/src/builders/cargo.rs @@ -47,6 +47,19 @@ pub struct CargoBuilderConfig { #[serde(default)] pub bins: Vec<String>, + /// Use `cross` instead of `cargo` for the build invocation. + /// + /// When `true`, the builder runs `cross build --release` instead of + /// `cargo build --release`. This is useful when the host does not have + /// native cross-compilation toolchains installed — `cross` handles + /// toolchain provisioning via Docker or Podman automatically. + /// + /// Only affects the `cargo build` command name; all other flags + /// (`--target`, `--manifest-path`, `--target-dir`, + /// `--message-format=json`) and artifact discovery work identically. + #[serde(default)] + pub use_cross: bool, + /// Run cross-compilation targets in parallel using isolated temporary /// target directories. /// @@ -85,11 +98,13 @@ impl Default for CargoBuilderConfig { manifest_path: None, bins: Vec::new(), parallel: default_parallel(), + use_cross: false, } } } -/// Runs `cargo build --release` and returns the produced artifacts. +/// Runs `cargo build --release` (or `cross build --release`) and returns the +/// produced artifacts. pub struct CargoBuilder; impl Builder for CargoBuilder { @@ -256,7 +271,8 @@ async fn run_cargo_build( line_tx: UnboundedSender<String>, target_dir: Option<&Path>, ) -> Result<Vec<ArtifactPath>> { - let mut cmd = Command::new("cargo"); + let tool = if config.use_cross { "cross" } else { "cargo" }; + let mut cmd = Command::new(tool); cmd.args(["build", "--release", "--message-format=json"]); cmd.env("ABBAYE_BUILDING_VERSION", abbaye_version); @@ -371,7 +387,7 @@ async fn run_cargo_build( if !status.success() { return Err(miette!( - "cargo build --release failed with exit status: {status}" + "{tool} build --release failed with exit status: {status}" )); } -
modified src/builders/mod.rs
diff --git a/src/builders/mod.rs b/src/builders/mod.rs index 6cf57e3..3682996 100644 --- a/src/builders/mod.rs +++ b/src/builders/mod.rs @@ -59,7 +59,7 @@ //! | TOML `type` | Rust variant | What it does | //! |--------------|---------------|-----------------------------------------------------------| //! | `archive` | `Archive` | Creates a `.tar.gz` of the source tree. | -//! | `cargo` | `Cargo` | `cargo build --release`, optionally for multiple targets. | +//! | `cargo` | `Cargo` | `cargo build --release` (or `cross build --release`), optionally for multiple targets. | //! | `cargo_doc` | `CargoDoc` | `cargo doc`. | //! | `markdown` | `Markdown` | Renders a directory of `.md` files to HTML. | //! | `script` | `Script` | Runs an arbitrary sequence of `sh -c` commands. | -
modified src/config.rs
diff --git a/src/config.rs b/src/config.rs index dba37e3..f50a870 100644 --- a/src/config.rs +++ b/src/config.rs @@ -115,6 +115,11 @@ pub struct GitUiConfig { /// empty (the default), every ref is a candidate. #[serde(default)] pub include: Vec<String>, + /// Directory prefix for git UI pages relative to the site output root. + /// Defaults to `""` (pages generated directly at the site root). + /// Set to `"repository"` for the legacy layout. + #[serde(default)] + pub prefix: String, } fn default_branch() -> String { -
modified src/git_browse.rs
diff --git a/src/git_browse.rs b/src/git_browse.rs index 191d3da..8cbaece 100644 --- a/src/git_browse.rs +++ b/src/git_browse.rs @@ -46,6 +46,8 @@ pub(crate) fn build_browse_pages( lang: &Option<String>, clone_url: &Option<String>, formats: &[OutputFormat], + git_ui_path: &str, + prefix_empty: bool, ) -> Result<()> { use syntect::highlighting::ThemeSet; use syntect::parsing::SyntaxSet; @@ -96,6 +98,8 @@ pub(crate) fn build_browse_pages( &ss, theme, formats, + git_ui_path, + prefix_empty, )?; } @@ -119,6 +123,8 @@ fn walk_tree_dir( ss: &syntect::parsing::SyntaxSet, theme: &syntect::highlighting::Theme, formats: &[OutputFormat], + git_ui_path: &str, + prefix_empty: bool, ) -> Result<()> { let tree_obj = repo.find_object(tree_id).into_diagnostic()?.into_tree(); let decoded = tree_obj.decode().into_diagnostic()?; @@ -168,8 +174,12 @@ fn walk_tree_dir( b_tree.cmp(&a_tree).then(a.name.cmp(&b.name)) }); - let root_path = "../".repeat(3 + depth); - let commit_url = format!("{}commit/{commit_hash}.html", "../".repeat(depth + 2)); + let prefix_depth = if prefix_empty { 0 } else { 1 }; + let root_path = "../".repeat(prefix_depth + depth + 2); + let commit_url = format!( + "{}commit/{commit_hash}.html", + "../".repeat(prefix_depth + depth + 1) + ); let breadcrumbs = make_crumbs(dir_path, false, None); for format in formats { @@ -188,6 +198,7 @@ fn walk_tree_dir( ctx.insert("entries", &entries); ctx.insert("breadcrumbs", &breadcrumbs); ctx.insert("root_path", &root_path); + ctx.insert("git_ui_path", git_ui_path); let content = tera .render(&tmpl_name, &ctx) @@ -215,6 +226,8 @@ fn walk_tree_dir( ss, theme, formats, + git_ui_path, + prefix_empty, )?; } @@ -239,6 +252,8 @@ fn walk_tree_dir( ss, theme, formats, + git_ui_path, + prefix_empty, )?; } @@ -263,6 +278,8 @@ fn render_blob_page( ss: &syntect::parsing::SyntaxSet, theme: &syntect::highlighting::Theme, formats: &[OutputFormat], + git_ui_path: &str, + prefix_empty: bool, ) -> Result<()> { const MAX_BLOB_BYTES: usize = 1024 * 1024; @@ -303,8 +320,12 @@ fn render_blob_page( ) }; - let root_path = "../".repeat(3 + depth); - let commit_url = format!("{}commit/{commit_hash}.html", "../".repeat(depth + 2)); + let prefix_depth = if prefix_empty { 0 } else { 1 }; + let root_path = "../".repeat(prefix_depth + depth + 2); + let commit_url = format!( + "{}commit/{commit_hash}.html", + "../".repeat(prefix_depth + depth + 1) + ); let breadcrumbs = make_crumbs( std::path::Path::new(file_path) .parent() @@ -335,6 +356,7 @@ fn render_blob_page( ctx.insert("too_large", &too_large); ctx.insert("size", &data.len()); ctx.insert("root_path", &root_path); + ctx.insert("git_ui_path", git_ui_path); let content = tera .render(&tmpl_name, &ctx) -
modified src/git_ui.rs
diff --git a/src/git_ui.rs b/src/git_ui.rs index 0f902d7..c8078cb 100644 --- a/src/git_ui.rs +++ b/src/git_ui.rs @@ -206,9 +206,37 @@ impl Progress { pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfig) -> Result<()> { let output_dir = &config.site.output_dir; - let ui_dir = output_dir.join("repository"); + let prefix = &git_cfg.prefix; + + if prefix == "repository" { + warn!( + "The default git UI prefix has changed from 'repository' to '' (site root). \ + Set prefix = \"repository\" in your [git_ui] config to keep the legacy layout." + ); + } + + let prefix_empty = prefix.is_empty(); + let ui_dir = if prefix_empty { + output_dir.clone() + } else { + output_dir.join(prefix) + }; let bare_dir = output_dir.join("repository.git"); + let root_path_for = |extra_depth: usize| -> String { + if prefix_empty { + "../".repeat(extra_depth) + } else { + "../".repeat(extra_depth + 1) + } + }; + + let git_ui_path = if prefix_empty { + String::new() + } else { + format!("{prefix}/") + }; + tokio::fs::create_dir_all(&ui_dir).await.into_diagnostic()?; tokio::fs::create_dir_all(ui_dir.join("commit")) .await @@ -396,7 +424,8 @@ pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfi ctx.insert("branch_nav", &branch_nav); ctx.insert("commits", commits); ctx.insert("truncated", &truncated); - ctx.insert("root_path", "../"); + ctx.insert("root_path", &root_path_for(0)); + ctx.insert("git_ui_path", &git_ui_path); let content = tera.render(&tmpl_name, &ctx).into_diagnostic()?; tokio::fs::write(ui_dir.join(&out_filename), content) @@ -418,7 +447,8 @@ pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfi ctx.insert("clone_url", &clone_url); ctx.insert("tags", &tags); ctx.insert("branches", &ref_branches); - ctx.insert("root_path", "../"); + ctx.insert("root_path", &root_path_for(0)); + ctx.insert("git_ui_path", &git_ui_path); let content = tera.render(&tmpl_name, &ctx).into_diagnostic()?; tokio::fs::write(ui_dir.join(&out_filename), content) @@ -446,7 +476,8 @@ pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfi ctx.insert("commit", commit_info); ctx.insert("changed_files", &changed_files); ctx.insert("has_browse", &has_browse); - ctx.insert("root_path", "../../"); + ctx.insert("root_path", &root_path_for(1)); + ctx.insert("git_ui_path", &git_ui_path); let content = tera.render(&tmpl_name, &ctx).into_diagnostic()?; tokio::fs::write(commit_dir.join(&out_filename), content) @@ -472,6 +503,8 @@ pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfi let theme_path = PathBuf::from(".abbaye").join("theme"); let repo_path_browse = repo_path.clone(); let formats = config.site.formats.clone(); + let git_ui_path_browse = git_ui_path.clone(); + let prefix_empty_browse = prefix_empty; tokio::task::spawn_blocking(move || { crate::git_browse::build_browse_pages( @@ -483,6 +516,8 @@ pub async fn build_git_repository_ui(config: &AbbayeConfig, git_cfg: &GitUiConfi &lang, &clone_url_browse, &formats, + &git_ui_path_browse, + prefix_empty_browse, ) }) .await -
modified src/site.rs
diff --git a/src/site.rs b/src/site.rs index 2052d1b..be7e78c 100644 --- a/src/site.rs +++ b/src/site.rs @@ -331,6 +331,17 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { }) }); let version_tag = config.version_extractor.tag_name(&version); + let git_ui_path = config + .git_ui + .as_ref() + .map(|cfg| { + if cfg.prefix.is_empty() { + String::new() + } else { + format!("{}/", cfg.prefix) + } + }) + .unwrap_or_default(); for format in &config.site.formats { let suffix = format.extension(); @@ -373,6 +384,7 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { ctx.insert("dist_categories", &dist_categories); ctx.insert("git_ui_enabled", &config.git_ui.is_some()); ctx.insert("git_ui_clone_url", &git_ui_clone_url); + ctx.insert("git_ui_path", &git_ui_path); ctx.insert("version_tag", &version_tag); ctx.insert("root_path", "../"); @@ -416,6 +428,7 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { ctx.insert("atom_feed", ATOM_FEED_FILENAME); ctx.insert("git_ui_enabled", &config.git_ui.is_some()); ctx.insert("git_ui_clone_url", &git_ui_clone_url); + ctx.insert("git_ui_path", &git_ui_path); ctx.insert("root_path", ""); let content = tera.render(&tmpl_name, &ctx).into_diagnostic()?; -
modified src/templates/git_blob.html.j2
diff --git a/src/templates/git_blob.html.j2 b/src/templates/git_blob.html.j2 index 517645c..d4a748f 100644 --- a/src/templates/git_blob.html.j2 +++ b/src/templates/git_blob.html.j2 @@ -5,8 +5,8 @@ {% block header %} <a href="{{ root_path }}" class="site-title">{{ project_name }}</a> <nav> - <a href="{{ root_path }}repository/index.html">Log</a> - <a href="{{ root_path }}repository/refs.html">Refs</a> + <a href="{{ root_path }}{{ git_ui_path }}index.html">Log</a> + <a href="{{ root_path }}{{ git_ui_path }}refs.html">Refs</a> </nav> {% endblock %} {% block body %} -
modified src/templates/git_tree.html.j2
diff --git a/src/templates/git_tree.html.j2 b/src/templates/git_tree.html.j2 index 61d2e7e..f194760 100644 --- a/src/templates/git_tree.html.j2 +++ b/src/templates/git_tree.html.j2 @@ -5,8 +5,8 @@ {% block header %} <a href="{{ root_path }}" class="site-title">{{ project_name }}</a> <nav> - <a href="{{ root_path }}repository/index.html">Log</a> - <a href="{{ root_path }}repository/refs.html">Refs</a> + <a href="{{ root_path }}{{ git_ui_path }}index.html">Log</a> + <a href="{{ root_path }}{{ git_ui_path }}refs.html">Refs</a> </nav> {% endblock %} {% block body %} -
modified src/templates/root_index.gmi.j2
diff --git a/src/templates/root_index.gmi.j2 b/src/templates/root_index.gmi.j2 index f03def2..e5622fe 100644 --- a/src/templates/root_index.gmi.j2 +++ b/src/templates/root_index.gmi.j2 @@ -7,6 +7,6 @@ {% if git_ui_enabled %} ## Repository -=> repository/ Browse source +=> {{ git_ui_path }} Browse source {% endif %} => {{ atom_feed }} Atom feed -
modified src/templates/root_index.html.j2
diff --git a/src/templates/root_index.html.j2 b/src/templates/root_index.html.j2 index c09d49d..f67c6e9 100644 --- a/src/templates/root_index.html.j2 +++ b/src/templates/root_index.html.j2 @@ -55,7 +55,7 @@ <span class="clone-url">git clone {{ git_ui_clone_url }} {{ project_name }}</span> </div> {% endif %} - <p class="repo-browse-link"><a href="repository/">Browse source →</a></p> + <p class="repo-browse-link"><a href="{{ git_ui_path }}">Browse source →</a></p> {% endif %} </main> {% endblock %} -
modified src/templates/version_index.gmi.j2
diff --git a/src/templates/version_index.gmi.j2 b/src/templates/version_index.gmi.j2 index d74ddf6..2f48dde 100644 --- a/src/templates/version_index.gmi.j2 +++ b/src/templates/version_index.gmi.j2 @@ -5,7 +5,7 @@ ## Repository => {{ repo_url }} {{ repo_url }} {% endif %}{% if git_ui_enabled and version_tag %} -=> ../repository/refs.gmi#tag-{{ version_tag }} Browse {{ version_tag }} +=> ../{{ git_ui_path }}refs.gmi#tag-{{ version_tag }} Browse {{ version_tag }} {% endif %}{% if has_docs %} ## Documentation => docs/ API docs -
modified src/templates/version_index.html.j2
diff --git a/src/templates/version_index.html.j2 b/src/templates/version_index.html.j2 index 4c6354e..640ffeb 100644 --- a/src/templates/version_index.html.j2 +++ b/src/templates/version_index.html.j2 @@ -30,7 +30,7 @@ {% if git_ui_enabled %} <h3>Source</h3> <ul> - <li><a href="{{ root_path | default(value='') }}repository/refs.html#tag-{{ version_tag }}">Browse {{ version_tag }}</a></li> + <li><a href="{{ root_path | default(value='') }}{{ git_ui_path }}refs.html#tag-{{ version_tag }}">Browse {{ version_tag }}</a></li> </ul> {% endif %} {% if has_docs %} <h3>Documentation</h3>