Rename repo_root to workspace_root

This seems like a slightly better term
because I think it also applies to tarball.
Ref: https://github.com/fish-shell/fish-shell/pull/11785#discussion_r2335280389
This commit is contained in:
Johannes Altmanninger
2025-09-13 10:18:32 +02:00
parent 33735f507a
commit 27db0e5fed
8 changed files with 21 additions and 21 deletions

View File

@@ -27,7 +27,7 @@ fn main() {
// compare it directly as a string at runtime.
rsconf::set_env_value(
"CARGO_MANIFEST_DIR",
fish_build_helper::get_repo_root().to_str().unwrap(),
fish_build_helper::workspace_root().to_str().unwrap(),
);
// Some build info
@@ -335,9 +335,9 @@ fn get_version(src_dir: &Path) -> String {
// or because it refused (safe.directory applies to `git describe`!)
// So we read the SHA ourselves.
fn get_git_hash() -> Result<String, Box<dyn std::error::Error>> {
let repo_root_dir = fish_build_helper::get_repo_root();
let gitdir = repo_root_dir.join(".git");
let jjdir = repo_root_dir.join(".jj");
let workspace_root = fish_build_helper::workspace_root();
let gitdir = workspace_root.join(".git");
let jjdir = workspace_root.join(".jj");
let commit_id = if gitdir.exists() {
// .git/HEAD contains ref: refs/heads/branch
let headpath = gitdir.join("HEAD");

View File

@@ -34,13 +34,13 @@ if $lint; then
export RUSTDOCFLAGS="--deny=warnings ${RUSTDOCFLAGS}"
fi
repo_root="$(dirname "$0")/.."
build_dir="${CARGO_TARGET_DIR:-$repo_root/target}/${target_triple}/debug"
workspace_root="$(dirname "$0")/.."
build_dir="${CARGO_TARGET_DIR:-$workspace_root/target}/${target_triple}/debug"
template_file=$(mktemp)
FISH_GETTEXT_EXTRACTION_FILE=$template_file cargo build --workspace --all-targets --features=gettext-extract
if $lint; then
PATH="$build_dir:$PATH" "$repo_root/build_tools/style.fish" --all --check
PATH="$build_dir:$PATH" "$workspace_root/build_tools/style.fish" --all --check
for features in "" --no-default-features; do
cargo clippy --workspace --all-targets $features
done
@@ -50,7 +50,7 @@ cargo test --doc --workspace
if $lint; then
cargo doc --workspace
fi
FISH_GETTEXT_EXTRACTION_FILE=$template_file "$repo_root/tests/test_driver.py" "$build_dir"
FISH_GETTEXT_EXTRACTION_FILE=$template_file "$workspace_root/tests/test_driver.py" "$build_dir"
exit
}

View File

@@ -19,7 +19,7 @@ begin
echo ""
end
set -g repo_root (status dirname)/..
set -g workspace_root (status dirname)/..
set -l rust_extraction_file
if set -l --query _flag_use_existing_template
@@ -66,7 +66,7 @@ begin
sed -E -e 's_\\\\_\\\\\\\\_g' -e 's_"_\\\\"_g' -e 's_^(.*)$_msgid "\1"\nmsgstr ""\n_'
end
set -g share_dir $repo_root/share
set -g share_dir $workspace_root/share
# This regex handles explicit requests to translate a message. These are more important to translate
# than messages which should be implicitly translated.

View File

@@ -24,7 +24,7 @@ if set -l -q _flag_all
end
end
set -l repo_root (status dirname)/..
set -l workspace_root (status dirname)/..
if test $all = yes
if not set -l -q _flag_force; and not set -l -q _flag_check
@@ -43,7 +43,7 @@ if test $all = yes
end
end
end
set fish_files $repo_root/{benchmarks,build_tools,etc,share}/**.fish
set fish_files $workspace_root/{benchmarks,build_tools,etc,share}/**.fish
set python_files {doc_src,share,tests}/**.py
else
# Format the files specified as arguments.

View File

@@ -6,7 +6,7 @@
# updates the PO files for each language from that
# (changed line numbers, added messages, removed messages),
# and finally generates a machine-readable MO file for each language,
# which is stored in share/locale/$LANG/LC_MESSAGES/fish.mo (relative to the repo root).
# which is stored in share/locale/$LANG/LC_MESSAGES/fish.mo (relative to the workspace root).
#
# Use cases:
# For developers:

View File

@@ -7,7 +7,7 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> PathBuf {
std::fs::canonicalize(path).unwrap()
}
pub fn get_repo_root() -> PathBuf {
pub fn workspace_root() -> PathBuf {
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
canonicalize(manifest_dir.ancestors().nth(2).unwrap())
}
@@ -15,7 +15,7 @@ pub fn get_repo_root() -> PathBuf {
pub fn get_target_dir() -> PathBuf {
option_env!("CARGO_TARGET_DIR")
.map(canonicalize)
.unwrap_or(get_repo_root().join("target"))
.unwrap_or(workspace_root().join("target"))
}
// TODO Move this to rsconf

View File

@@ -17,19 +17,19 @@ fn main() {
fn build_man(man_dir: &Path) {
use std::{env, process::Command};
let repo_root_dir = fish_build_helper::get_repo_root();
let workspace_root = fish_build_helper::workspace_root();
let man_str = man_dir.to_str().unwrap();
let sec1_dir = man_dir.join("man1");
let sec1_str = sec1_dir.to_str().unwrap();
let docsrc_dir = repo_root_dir.join("doc_src");
let docsrc_dir = workspace_root.join("doc_src");
let docsrc_str = docsrc_dir.to_str().unwrap();
let sphinx_doc_sources = [
repo_root_dir.join("CHANGELOG.rst"),
repo_root_dir.join("CONTRIBUTING.rst"),
workspace_root.join("CHANGELOG.rst"),
workspace_root.join("CONTRIBUTING.rst"),
docsrc_dir.clone(),
];
fish_build_helper::rebuild_if_paths_changed(sphinx_doc_sources);

View File

@@ -10,9 +10,9 @@ cleanup () {
trap cleanup EXIT INT TERM HUP
repo_root=$(dirname "$0")/../..
workspace_root=$(dirname "$0")/../..
builder=$1
docsrc=$repo_root/doc_src
docsrc=$workspace_root/doc_src
tmp_dir=$(mktemp -d)
doctree=$tmp_dir/doctree
output_dir=$tmp_dir/$builder