Procházet zdrojové kódy

Use local Cargo config for Windows htslib patches

STEIMLE Thomas před 2 týdny
rodič
revize
ff6cea3cb3
3 změnil soubory, kde provedl 14 přidání a 4 odebrání
  1. 1 0
      .gitignore
  2. 0 4
      Cargo.toml
  3. 13 0
      setup-patches.ps1

+ 1 - 0
.gitignore

@@ -3,3 +3,4 @@
 *.out
 *.dat
 /patches/
+/.cargo/config.toml

+ 0 - 4
Cargo.toml

@@ -65,7 +65,3 @@ filetime = "0.2.27"
 opt-level = 0
 debug = false
 
-[target.'cfg(windows)'.patch.crates-io]
-hts-sys = { path = "patches/hts-sys" }
-rust-htslib = { path = "patches/rust-htslib" }
-

+ 13 - 0
setup-patches.ps1

@@ -1,6 +1,19 @@
 param()
 $ErrorActionPreference = "Stop"
 
+$cargoDir = Join-Path $PSScriptRoot ".cargo"
+if (-not (Test-Path $cargoDir)) {
+    New-Item -ItemType Directory -Path $cargoDir | Out-Null
+}
+$cargoConfig = Join-Path $cargoDir "config.toml"
+$cargoConfigText = @"
+[patch.crates-io]
+hts-sys = { path = "patches/hts-sys" }
+rust-htslib = { path = "patches/rust-htslib" }
+"@
+[System.IO.File]::WriteAllText($cargoConfig, $cargoConfigText, (New-Object System.Text.UTF8Encoding $false))
+Write-Host "Wrote local Windows Cargo patch config -> .cargo\config.toml"
+
 $found = Resolve-Path "$env:USERPROFILE\.cargo\registry\src\index.crates.io-*\hts-sys-2.2.0" `
          -ErrorAction SilentlyContinue
 if (-not $found) {