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..e2e7ce74672 100644 --- a/scripts/symlinks-to-hardlinks.ps1 +++ b/scripts/symlinks-to-hardlinks.ps1 @@ -22,8 +22,7 @@ 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...' + Write-Error "error: git-rm-symlink: Not a valid source: $symlink =/=> $src" return }