first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -35,11 +35,11 @@ First, ensure you've set up your environment.
|
||||
By default, it is located at `C:\Program Files (x86)\Inno Setup 6\ISCC.exe`.
|
||||
2. Compile the installer:
|
||||
```shell
|
||||
iscc .\script\windows\windows-installer.iss`.
|
||||
iscc .\script\windows\windows-installer.iss
|
||||
```
|
||||
3. Run the generated executable:
|
||||
```shell
|
||||
.\script\windows\Output\Warp-Windows-Setup.exe`.
|
||||
.\script\windows\Output\Warp-Windows-Setup.exe
|
||||
```
|
||||
|
||||
The script begins with a series of preprocessor definitions.
|
||||
|
||||
@@ -1,6 +1,80 @@
|
||||
#!/usr/bin/env powershell
|
||||
param(
|
||||
[switch]$Help,
|
||||
[switch]$InstallCommonSkills,
|
||||
[string]$CommonSkillsTarget = $env:WARP_COMMON_SKILLS_INSTALL_TARGET
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
||||
|
||||
function Show-Usage {
|
||||
Write-Output 'Usage: .\script\windows\bootstrap.ps1 [-Help] [-InstallCommonSkills] [-CommonSkillsTarget <project|global>]'
|
||||
Write-Output ''
|
||||
Write-Output 'Prepare this checkout for Warp development on Windows.'
|
||||
Write-Output ''
|
||||
Write-Output 'Options:'
|
||||
Write-Output ' -Help Show this help message.'
|
||||
Write-Output ' -InstallCommonSkills Install or update common agent skills from skills-lock.json.'
|
||||
Write-Output ' -CommonSkillsTarget Install into project .agents/skills or global ~/.agents/skills.'
|
||||
Write-Output ''
|
||||
Write-Output 'Environment:'
|
||||
Write-Output ' WARP_SKIP_COMMON_SKILLS_INSTALL=1'
|
||||
Write-Output ' Skip installing common agent skills.'
|
||||
Write-Output ' WARP_COMMON_SKILLS_INSTALL_TARGET=project|global'
|
||||
Write-Output ' Choose the install target when -CommonSkillsTarget is omitted.'
|
||||
Write-Output ' Target prompting and duplicate checks are delegated to warpdotdev/common-skills/scripts/install_common_skills.'
|
||||
Write-Output ' WARP_COMMON_SKILLS_SCRIPTS_DIR=/path/to/common-skills/scripts'
|
||||
Write-Output ' Override where common-skills management scripts are loaded from.'
|
||||
Write-Output ' WARP_COMMON_SKILLS_REF=<git-ref>'
|
||||
Write-Output ' Override the remote warpdotdev/common-skills ref used when fetching scripts.'
|
||||
}
|
||||
|
||||
function ConvertTo-CommonSkillsTarget {
|
||||
param([string]$Target)
|
||||
|
||||
switch ($Target.ToLowerInvariant()) {
|
||||
{ $_ -eq '' -or $_ -eq 'p' -or $_ -eq 'project' -or $_ -eq '1' } { return 'project' }
|
||||
{ $_ -eq 'g' -or $_ -eq 'global' -or $_ -eq '2' } { return 'global' }
|
||||
default { throw "Invalid common skills install target: $Target" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Show-BootstrapPreview {
|
||||
Write-Output 'Warp bootstrap is starting for Windows.'
|
||||
Write-Output 'It will:'
|
||||
Write-Output ' - Check for Git for Windows.'
|
||||
Write-Output ' - Install Rust if cargo is unavailable.'
|
||||
Write-Output ' - Install Visual Studio Build Tools, jq, CMake, InnoSetup, and gcloud as needed.'
|
||||
Write-Output ' - Install Cargo test dependencies.'
|
||||
|
||||
if (-not $InstallCommonSkills) {
|
||||
Write-Output ' - Skip common agent skills unless -InstallCommonSkills is provided.'
|
||||
} elseif ($env:WARP_SKIP_COMMON_SKILLS_INSTALL -eq '1') {
|
||||
Write-Output ' - Skip common agent skills because WARP_SKIP_COMMON_SKILLS_INSTALL=1.'
|
||||
} elseif ($script:ResolvedCommonSkillsTarget -eq 'global') {
|
||||
Write-Output ' - Install or update common agent skills in ~/.agents/skills if needed.'
|
||||
} elseif ($script:ResolvedCommonSkillsTarget -eq 'project') {
|
||||
Write-Output ' - Install or update common agent skills in this checkout''s .agents/skills if needed.'
|
||||
} else {
|
||||
Write-Output ' - Prompt for where common agent skills should be installed before installing or updating them.'
|
||||
}
|
||||
|
||||
Write-Output 'Run .\script\windows\bootstrap.ps1 -Help to see options and environment overrides.'
|
||||
Write-Output ''
|
||||
}
|
||||
|
||||
if ($Help) {
|
||||
Show-Usage
|
||||
exit 0
|
||||
}
|
||||
$script:ResolvedCommonSkillsTarget = ''
|
||||
if ($InstallCommonSkills -and $CommonSkillsTarget) {
|
||||
$script:ResolvedCommonSkillsTarget = ConvertTo-CommonSkillsTarget $CommonSkillsTarget
|
||||
}
|
||||
|
||||
Show-BootstrapPreview
|
||||
|
||||
# Git for Windows can be installed system-wide (Program Files) or per-user (LOCALAPPDATA\Programs\Git).
|
||||
$gitBinCandidates = @(
|
||||
@@ -13,6 +87,37 @@ if (-not $gitBinDir) {
|
||||
Write-Error 'https://gitforwindows.org/'
|
||||
exit 1
|
||||
}
|
||||
$env:PATH = "$gitBinDir;$env:PATH"
|
||||
function Resolve-CommonSkillsScript {
|
||||
param([string]$ScriptName)
|
||||
|
||||
if ($env:WARP_COMMON_SKILLS_SCRIPTS_DIR) {
|
||||
$scriptPath = Join-Path $env:WARP_COMMON_SKILLS_SCRIPTS_DIR $ScriptName
|
||||
if (Test-Path -PathType Leaf $scriptPath) { return $scriptPath }
|
||||
throw "Could not find $ScriptName in WARP_COMMON_SKILLS_SCRIPTS_DIR=$env:WARP_COMMON_SKILLS_SCRIPTS_DIR."
|
||||
}
|
||||
|
||||
$commonSkillsRef = if ($env:WARP_COMMON_SKILLS_REF) { $env:WARP_COMMON_SKILLS_REF } else { 'main' }
|
||||
$rawBaseUrl = if ($env:WARP_COMMON_SKILLS_RAW_BASE_URL) {
|
||||
$env:WARP_COMMON_SKILLS_RAW_BASE_URL.TrimEnd('/')
|
||||
} else {
|
||||
"https://raw.githubusercontent.com/warpdotdev/common-skills/$commonSkillsRef/scripts"
|
||||
}
|
||||
$rawUrl = "$rawBaseUrl/$ScriptName"
|
||||
$scriptPath = Join-Path $env:TEMP "warp-$ScriptName"
|
||||
|
||||
Invoke-WebRequest -Uri $rawUrl -OutFile $scriptPath
|
||||
return $scriptPath
|
||||
}
|
||||
|
||||
function Install-CommonSkill {
|
||||
$installScript = Resolve-CommonSkillsScript 'install_common_skills'
|
||||
if ($script:ResolvedCommonSkillsTarget) {
|
||||
& "$gitBinDir\bash.exe" "$installScript" --repo-root "$RepoRoot" "--$script:ResolvedCommonSkillsTarget" --if-needed
|
||||
} else {
|
||||
& "$gitBinDir\bash.exe" "$installScript" --repo-root "$RepoRoot" --if-needed --prompt-for-target
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Get-Command -Name cargo -Type Application -ErrorAction SilentlyContinue)) {
|
||||
Write-Output 'Installing rust...'
|
||||
@@ -22,6 +127,24 @@ if (-not (Get-Command -Name cargo -Type Application -ErrorAction SilentlyContinu
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Visual Studio Build Tools (MSVC compiler + linker + Windows SDK) are required to link Rust crates
|
||||
# targeting x86_64-pc-windows-msvc.
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
$haveMsvcBuildTools = $false
|
||||
if (Test-Path $vswhere) {
|
||||
$vsInstall = & $vswhere -latest -products * `
|
||||
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.Windows11SDK.22621 `
|
||||
-property installationPath
|
||||
if ($vsInstall) { $haveMsvcBuildTools = $true }
|
||||
}
|
||||
if (-not $haveMsvcBuildTools) {
|
||||
Write-Output 'Installing Visual Studio Build Tools (MSVC + Windows SDK)...'
|
||||
winget install -e --id Microsoft.VisualStudio.2022.BuildTools `
|
||||
--accept-package-agreements --accept-source-agreements `
|
||||
--override '--passive --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22621 --includeRecommended'
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
# A bash executable should come with Git for Windows
|
||||
& "$gitBinDir\bash.exe" "$PWD\script\install_cargo_test_deps"
|
||||
|
||||
@@ -51,3 +174,7 @@ if ($identityToken.Trim().Length -eq 0) {
|
||||
Read-Host
|
||||
gcloud auth login
|
||||
}
|
||||
|
||||
if ($InstallCommonSkills) {
|
||||
Install-CommonSkill
|
||||
}
|
||||
|
||||
@@ -92,32 +92,32 @@ if ("$CHANNEL" -eq 'local') {
|
||||
$WARP_BIN = 'warp'
|
||||
$BINARY_NAME = 'warp.exe'
|
||||
$APP_NAME = 'GalaxyLocal'
|
||||
$FEATURES = "$FEATURES,nld_improvements"
|
||||
} elseif ("$CHANNEL" -eq 'dev') {
|
||||
$WARP_BIN = 'dev'
|
||||
$BINARY_NAME = 'dev.exe'
|
||||
$APP_NAME = 'GalaxyDev'
|
||||
$FEATURES = "$FEATURES,agent_mode_debug,nld_improvements"
|
||||
$FEATURES = "$FEATURES,agent_mode_debug"
|
||||
} elseif ("$CHANNEL" -eq 'preview') {
|
||||
$WARP_BIN = 'preview'
|
||||
$BINARY_NAME = 'preview.exe'
|
||||
$APP_NAME = 'GalaxyPreview'
|
||||
$FEATURES = "$FEATURES,preview_channel,nld_improvements"
|
||||
$FEATURES = "$FEATURES,preview_channel"
|
||||
} elseif ("$CHANNEL" -eq 'stable') {
|
||||
$WARP_BIN = 'stable'
|
||||
$BINARY_NAME = 'warp.exe'
|
||||
$APP_NAME = 'Galaxy'
|
||||
# TODO(vorporeal): Remove this once we get tests passing with this default enabled.
|
||||
$FEATURES = "$FEATURES,nld_improvements"
|
||||
} elseif ("$CHANNEL" -eq 'oss') {
|
||||
$WARP_BIN = 'warp-oss'
|
||||
$BINARY_NAME = 'warp-oss.exe'
|
||||
$APP_NAME = 'GalaxyOss'
|
||||
# The OSS channel does not ship Sentry, so drop the crash_reporting feature
|
||||
# (which would otherwise pull in the Sentry SDK as a dependency).
|
||||
$FEATURES = 'release_bundle,gui,nld_improvements'
|
||||
$FEATURES = 'release_bundle,gui'
|
||||
}
|
||||
|
||||
# All channels ship the v3 classifier and v2 heuristic.
|
||||
$FEATURES = "$FEATURES,nld_classifier_v3,nld_heuristic_v2"
|
||||
|
||||
$BINARY_PATH = "$CARGO_TARGET_OUTPUT_DIR\$BINARY_NAME"
|
||||
$BUNDLE_ID = "dev.warp.$APP_NAME"
|
||||
$INSTALLER_OUTPUT_DIR = "$WINDOWS_INSTALLER_DIR\Output"
|
||||
|
||||
@@ -122,6 +122,7 @@ if ($Channel -and (Test-Path $GatedSource -PathType Container)) {
|
||||
# to the repo alongside the component and add an entry here.
|
||||
# Cross-platform components:
|
||||
$AdditionalLicenses = @(
|
||||
@{ Name = 'Alacritty (alacritty_terminal)'; License = 'Apache-2.0'; Path = 'crates\warp_terminal\src\model\LICENSE-ALACRITTY' },
|
||||
@{ Name = 'Hack Font'; License = 'MIT'; Path = 'app\assets\bundled\fonts\hack\LICENSE.md' },
|
||||
@{ Name = 'Roboto Font'; License = 'SIL Open Font License'; Path = 'app\assets\bundled\fonts\roboto\LICENSE.txt' },
|
||||
@{ Name = 'bash-preexec'; License = 'MIT'; Path = 'app\assets\bundled\bootstrap\bash-preexec-LICENSE.md' },
|
||||
|
||||
@@ -70,13 +70,13 @@ UninstallDisplayIcon="{app}\icon.ico"
|
||||
CloseApplications=force
|
||||
; For manual installs: if Warp is running, show a dialog prompting the user to close it
|
||||
; before Setup proceeds. Returned empty for background updates so the check is skipped.
|
||||
; TODO(andy) uncomment this after the 4/22 release
|
||||
;AppMutex={code:GetAppMutex}
|
||||
AppMutex={code:GetAppMutex}
|
||||
SetupMutex={#AppMutexName}Setup
|
||||
; Version 1809 / Build 18362 is required for ConPTY. See https://github.com/microsoft/vscode-docs/blob/9d736b662fdde3fed17d8bc2ed70bfea4ae20636/docs/supporting/troubleshoot-terminal-launch.md?plain=1#L66/
|
||||
MinVersion=10.0.18362
|
||||
; Tell Windows Explorer to reload the environment so that path changes take effect.
|
||||
ChangesEnvironment=true
|
||||
RedirectionGuard=no
|
||||
; Sign the setup engine and uninstaller so that the temporary bootstrapper
|
||||
; extracted to %TEMP% is Authenticode-signed. This prevents Microsoft Defender
|
||||
; ASR rule D4F940AB from blocking the installer in enterprise environments.
|
||||
@@ -109,6 +109,8 @@ Source: "{#TargetProfileDir}\resources\*"; DestDir: "{app}\resources"; Flags: ig
|
||||
|
||||
[Registry]
|
||||
Root: HKCU; Subkey: "SOFTWARE\Warp.dev\{#MyAppName}"; Flags: uninsdeletekey
|
||||
Root: HKCU; Subkey: "SOFTWARE\Warp.dev\{#MyAppName}"; ValueType: string; ValueName: "InstallationPath"; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletevalue
|
||||
Root: HKA; Subkey: "Software\Microsoft\Windows\CurrentVersion\App Paths\{#MyAppExeName}"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName}"; Flags: uninsdeletekey
|
||||
; cleanup "Open Warp Here" registry entries
|
||||
Root: HKA; Subkey: "Software\Classes\Directory\shell\{#MyAppName}"; Flags: deletekey
|
||||
Root: HKA; Subkey: "Software\Classes\Directory\Background\shell\{#MyAppName}"; Flags: deletekey
|
||||
@@ -212,7 +214,19 @@ begin
|
||||
Sleep(1000);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Log('Warp has exited; proceeding with file installation.');
|
||||
{ The minidump crash-reporter is a child process (same exe name) that
|
||||
may outlive the main Warp process. It holds the executable file open,
|
||||
which causes the file-copy step to fail with "Access is denied".
|
||||
We identify it by the "minidump-server" argument in its command line. }
|
||||
Exec('powershell.exe',
|
||||
'-NoProfile -NoLogo -Command "$stopError = 0; Get-CimInstance Win32_Process -Filter \"Name=''{#MyAppExeName}'' and CommandLine like ''%minidump-server%''\" | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorVariable e -ErrorAction SilentlyContinue; if ($e) { $stopError = $e[0].Exception.HResult } }; exit $stopError"',
|
||||
'', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||
if ResultCode <> 0 then
|
||||
Log('minidump-server cleanup failed (exit code: ' + IntToStr(ResultCode) + ')');
|
||||
Sleep(500);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user