diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 96c055ee..63028ace 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -12,9 +12,7 @@ jobs: os: [ubuntu, macos, windows] steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - run: echo CARGO_HOME=$GITHUB_WORKSPACE/.cargo >> $GITHUB_ENV - shell: bash + # - uses: Swatinem/rust-cache@v2 - run: cargo build --locked - run: cargo test - run: |- diff --git a/example/setup.sh b/example/setup.sh index a83bd0ca..3a5a08b0 100755 --- a/example/setup.sh +++ b/example/setup.sh @@ -19,4 +19,4 @@ set -e # typically commit these fixups and the generated third-party/BUCK in the same # commit as above. -../target/debug/reindeer --third-party-dir third-party buckify +RUST_LOG="debug" ../target/debug/reindeer --third-party-dir third-party buckify diff --git a/src/buckify.rs b/src/buckify.rs index a7ffe1bb..e6c76b2a 100644 --- a/src/buckify.rs +++ b/src/buckify.rs @@ -114,7 +114,30 @@ pub fn relative_path(mut base: &Path, to: &Path) -> PathBuf { res.display() ); res.push(".."); - base = base.parent().expect("root dir not prefix of other?"); + base.parent().expect("root not prefix of other?") + /* + match base.parent() { + Some(parent) => base = parent, + None => { + // Here, `to` and `base` do not share a common + // ancestor. + + // Example: + // - `to` = 'C:\Users\runneradmin\.cargo\...001f\anyhow-1.0.79\build.rs' + // - `base` = 'D:\a\reindeer\reindeer\shim\third-party\rust' + + // In this case return `to` "as-is" (i.e. without any + // modification)`. `reindeer buckify` seems to work + // with this choice. + log::debug!( + "relative_path: no common ancestor. returning to={}", + to.display(), + ); + + return to.to_path_buf(); + } + } + */ } res.join(