Skip to content

Commit

Permalink
Work of many WIPs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgodbolt committed Jun 23, 2024
1 parent 3b41b5c commit 1079870
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/package-ms-compiler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Package MS compiler
# TODO this
#run-name: Package MS compiler from $URL

# TODO not on push, on demand, this is just for testing.
on:
push:

jobs:
package-ms-compiler:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- shell: pwsh
run: .\msvc-install\gh-msvc-install.ps1 -url https://aka.ms/vs/17/pre/vs_BuildTools.exe
63 changes: 63 additions & 0 deletions msvc-install/gh-msvc-install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
param (
[Parameter(Mandatory = $true)][string]$url
)
$ErrorActionPreference = "Stop"

#### WILL COM
$url = "https://aka.ms/vs/17/pre/vs_BuildTools.exe"

$download_path = "%TMP%\download"
$full_install_root = "%TMP%\full"
$archives = "%TMP%\archives"

function Download
{
Param (
[string] $version,
[string] $url
)

$versionPath = "$download_path/$version"
$filepath = "$versionPath/installer.exe"

if (!(Test-Path -Path $filepath))
{
New-Item -ItemType Directory $versionPath
Invoke-WebRequest -Uri $url -OutFile $filepath
}
}

function Install
{
$installer = "$download_path/installer.exe"

New-Item -ItemType Directory -Force "$full_install_root/$version"
Start-Process -Wait -FilePath "$installer" -ArgumentList @("--quiet", "--installPath", "$full_install_root", "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "--add", "Microsoft.VisualStudio.Component.VC.Tools.ARM64", "--add", "Microsoft.VisualStudio.Component.VC.Tools.ARM")
}

function ZipVC
{
Param (
[string] $compilerVersion,
[string] $productVersion
)

New-Item -ItemType Directory -Force "$archives"
& "7z.exe" a "$archives/$compilerVersion-$productVersion.zip" "$full_install_root/VC/Tools/MSVC/$compilerVersion"
}

New-Item -ItemType Directory -Force "$full_install_root"

Download -url $url
Install

$dir = "$full_install_root/VC/Tools/MSVC"
Get-ChildItem $dir | Foreach-Object {
$compilerVersion = $_.Name
Write-Host "Compiler directory version: $compilerVersion"

$compilerExeProductVersion = (Get-Item "$dir/$compilerVersion/bin/Hostx64/x64/cl.exe").VersionInfo.ProductVersionRaw
Write-Host "Compiler exe version: $compilerExeProductVersion"

ZipVC -compilerVersion $compilerVersion -productVersion $compilerExeProductVersion
}

0 comments on commit 1079870

Please sign in to comment.