From 039d5d9efed6665d83449c6420ce36c93f4cc740 Mon Sep 17 00:00:00 2001 From: Pebaz Date: Sun, 25 Apr 2021 13:21:02 -0400 Subject: [PATCH 1/2] Run symlink converter script on Windows --- Cargo.toml | 3 +++ build.rs | 12 ++++++++++++ scripts/symlinks-to-hardlinks.ps1 | 5 ++--- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index 36ab0ded955..8f761f96fb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,6 +48,9 @@ cpython = "0.5.0" python3-sys = "0.5.0" criterion = "0.3" +[target.'cfg(target_os = "windows")'.build-dependencies] +powershell_script = "0.1.5" + [[bench]] name = "execution" harness = false diff --git a/build.rs b/build.rs new file mode 100644 index 00000000000..20d4bb07135 --- /dev/null +++ b/build.rs @@ -0,0 +1,12 @@ +use powershell_script; + +fn main() { + // Run scripts/symlinks-to-hardlinks.ps1 automatically on Windows + if cfg!(windows) { + let command = "scripts/symlinks-to-hardlinks.ps1"; + + powershell_script::run(command, false).expect( + "Failed to convert symlinks into hardlinks" + ); + } +} diff --git a/scripts/symlinks-to-hardlinks.ps1 b/scripts/symlinks-to-hardlinks.ps1 index 9ec79de4e3c..e59aeeb3c2d 100644 --- a/scripts/symlinks-to-hardlinks.ps1 +++ b/scripts/symlinks-to-hardlinks.ps1 @@ -22,9 +22,8 @@ git ls-files -s | Select-String '^120000' | ConvertFrom-String -PropertyNames Ge Remove-Item $symlink New-Item -ItemType Junction -Name $symlink -Value $src } else { - Write-Error 'error: git-rm-symlink: Not a valid source\n' - Write-Error '$symlink =/=> $src...' - return + Write-Error "error: git-rm-symlink: Not a valid source: $symlink =/=> $src" + # return } git update-index --assume-unchanged $symlink From d1638f1a91087cb5128fd55da7e453a1a21f3a5e Mon Sep 17 00:00:00 2001 From: Pebaz Date: Sun, 25 Apr 2021 13:56:59 -0400 Subject: [PATCH 2/2] Fix symlink script --- scripts/symlinks-to-hardlinks.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/symlinks-to-hardlinks.ps1 b/scripts/symlinks-to-hardlinks.ps1 index e59aeeb3c2d..e2e7ce74672 100644 --- a/scripts/symlinks-to-hardlinks.ps1 +++ b/scripts/symlinks-to-hardlinks.ps1 @@ -23,7 +23,7 @@ git ls-files -s | Select-String '^120000' | ConvertFrom-String -PropertyNames Ge New-Item -ItemType Junction -Name $symlink -Value $src } else { Write-Error "error: git-rm-symlink: Not a valid source: $symlink =/=> $src" - # return + return } git update-index --assume-unchanged $symlink