Skip to content

Commit

Permalink
Simplify windows conda activation
Browse files Browse the repository at this point in the history
  • Loading branch information
oskirby committed Oct 5, 2024
1 parent c17fd58 commit 4dd8bf9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 36 deletions.
7 changes: 5 additions & 2 deletions taskcluster/kinds/build/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ task-defaults:
worker-type: b-win2022
fetches:
fetch:
- win-dev-env
- win-sentry-cli
- win-conda
- wireguard-nt
toolchain:
- cargo-vendor
- conda-windows-x86_64
conda-pack:
- artifact: conda-windows.tar.gz
extract: false
dependencies:
conda-pack: toolchain-windows-conda-pack
worker:
taskcluster-proxy: true
chain-of-trust: true
Expand Down
46 changes: 12 additions & 34 deletions taskcluster/scripts/build/windows_clang_cl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ Set-Location -Path $TASK_WORKDIR
# doesn't handle recursive submodules, so we'll need to do it ourselves.
git -C "$REPO_ROOT_PATH" submodule update --init --recursive


# We have not yet removed our VC_Redist strategy. Therefore we rely on the old vsstudio bundle to get us that :)
# TODO: We need to handle this at some point.
$env:VCToolsRedistDir=(resolve-path "$FETCHES_PATH/VisualStudio/VC/Redist/MSVC/14.30.30704/").ToString()
# TODO: Remove this and change all to Microsoft_VC143 once we know there is no cavecat building with msvcv143
Copy-Item -Path $env:VCToolsRedistDir\\MergeModules\\Microsoft_VC143_CRT_x64.msm -Destination $REPO_ROOT_PATH\\Microsoft_VC142_CRT_x64.msm
Copy-Item -Path $env:VCToolsRedistDir\\MergeModules\\Microsoft_VC143_CRT_x86.msm -Destination $REPO_ROOT_PATH\\Microsoft_VC142_CRT_x86.msm
Copy-Item -Path $env:VCToolsRedistDir\\MergeModules\\Microsoft_VC143_CRT_x64.msm -Destination $env:VCToolsRedistDir\\MergeModules\\Microsoft_VC142_CRT_x64.msm
Copy-Item -Path $env:VCToolsRedistDir\\MergeModules\\Microsoft_VC143_CRT_x86.msm -Destination $env:VCToolsRedistDir\\MergeModules\\Microsoft_VC142_CRT_x86.msm


# Setup Openssl Import
$SSL_PATH = "$FETCHES_PATH/QT_OUT/SSL"
if (Test-Path -Path $SSL_PATH) {
Expand All @@ -49,28 +38,19 @@ replace-with = "vendored-sources"
"@ | Out-File -Encoding utf8 $REPO_ROOT_PATH\.cargo\config.toml
}

## Install MiniConda
New-Item -ItemType Directory -Force -Path "$TASK_WORKDIR/miniconda"
$MINICONDA_DIR =resolve-path "$TASK_WORKDIR/miniconda"
Start-Process -NoNewWindow "$FETCHES_PATH\miniconda_installer.exe" -Wait -ArgumentList @('/S',"/D=$MINICONDA_DIR")
. $MINICONDA_DIR\shell\condabin\conda-hook.ps1

## Setup the conda environment
. $REPO_ROOT_PATH/scripts/utils/call_bat.ps1 $FETCHES_PATH/Scripts/activate.bat
conda-unpack

# Conda Pack excpets to be run under cmd. therefore it will
# (unlike conda) ignore activate.d powershell scripts.
# So let's manually run the activation scripts.
#
$CONDA_PREFIX = $env:CONDA_PREFIX

$ACTIVATION_SCRIPTS = Get-ChildItem -Path "$CONDA_PREFIX\etc\conda\activate.d" -Filter "*.ps1"
foreach ($script in $ACTIVATION_SCRIPTS) {
Write-Output "Activating: $CONDA_PREFIX\etc\conda\activate.d\$script"
. "$CONDA_PREFIX\etc\conda\activate.d\$script"
}
# This is a wierd bug `PREFIX/bin` does not seem to be on the PATH
# when we run the activate.bat :shrugs:
# This will cause go to be missing.
$env:PATH="$CONDA_PREFIX\bin;$env:Path"
gci env:* | sort-object name

## Unpack and activate the conda environment.
New-Item -ItemType Directory -Force -Path "$TASK_WORKDIR/conda-windows"
$CONDA_DIR = resolve-path "$TASK_WORKDIR/conda-windows"
Start-Process -NoNewWindow -WorkingDirectory "$FETCHES_PATH" tar -Wait -ArgumentList @("-C", "$CONDA_DIR", "-xvf","$FETCHES_PATH\conda-windows.tar.gz")
Start-Process -NoNewWindow "$CONDA_DIR\Scripts\conda-unpack.exe" -Wait
conda activate $CONDA_DIR
conda info

# Okay We are ready to build!
mkdir $TASK_WORKDIR/cmake_build
Expand All @@ -79,8 +59,6 @@ $BUILD_DIR =resolve-path "$TASK_WORKDIR/cmake_build"
# Do the generic build
cmake -S $REPO_ROOT_PATH -B $BUILD_DIR -GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DPYTHON_EXECUTABLE="$CONDA_PREFIX\python.exe" `
-DGOLANG_BUILD_TOOL="$CONDA_PREFIX\bin\go.exe" `
-DWIREGUARD_FOLDER="$FETCHES_PATH\wireguard-nt" `
-DCMAKE_PREFIX_PATH="$QTPATH/lib/cmake" `
-DBUILD_TESTS=OFF
Expand Down

0 comments on commit 4dd8bf9

Please sign in to comment.