aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLibravatar Slan <duducruzas@gmail.com>2022-07-08 05:06:16 +0530
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2022-07-08 05:06:16 +0530
commit2f38ed7876ff45a75dd40a017f156b2f02416cdb (patch)
tree3a33fe37a873955cac9931936057ee57af499229 /scripts
parentWorkaround for 71c5237 (#406) (diff)
downloadferdium-app-2f38ed7876ff45a75dd40a017f156b2f02416cdb.tar.gz
ferdium-app-2f38ed7876ff45a75dd40a017f156b2f02416cdb.tar.zst
ferdium-app-2f38ed7876ff45a75dd40a017f156b2f02416cdb.zip
refactor: refactored MSVS validation (#439)
- Added todo for ARM machines - Only run 'npm config set' if there is none Co-authored-by: Ricardo Cino <ricardo@cino.io>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build-windows.ps140
1 files changed, 27 insertions, 13 deletions
diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1
index f0aeaee32..a8c1787a1 100644
--- a/scripts/build-windows.ps1
+++ b/scripts/build-windows.ps1
@@ -94,27 +94,41 @@ if ($env:CLEAN -eq "true")
94# ----------------------------------------------------------------------------- 94# -----------------------------------------------------------------------------
95# Ensure that the system dependencies are at the correct version - fail if not 95# Ensure that the system dependencies are at the correct version - fail if not
96# Check MSVS Tools through MSVS_VERSION 96# Check MSVS Tools through MSVS_VERSION
97
98
97$EXPECTED_MSVST_VERSION = @("2019","2022") 99$EXPECTED_MSVST_VERSION = @("2019","2022")
98$MSVS_REG_PATH = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\Setup" 100$NPM_CONFIG_MSVS_VERSION = npm config get msvs_version
101if((-not $NPM_CONFIG_MSVS_VERSION) -or -not ($EXPECTED_MSVST_VERSION -contains $NPM_CONFIG_MSVS_VERSION)){
102 Write-Host "Your Microsoft Visual Studio Tools isn't set properly or it's not the right version!
103 Checking your version..."
99 104
100if(-not (Test-Path -Path $MSVS_REG_PATH)){ 105 # TODO: Implement path for ARM machines
101 fail_with_docs "You don't have MSVS Tools Installed!" 106 $MSVS_REG_PATH = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\X64"
102}
103 107
104$MSVS_PATH = (Get-ItemProperty -Path $MSVS_REG_PATH).SharedInstallationPath | Split-Path 108 if(-not (Test-Path -Path $MSVS_REG_PATH)){
109 fail_with_docs "You don't have the Microsoft Visual Studio Tools installed!"
110 }
105 111
106Get-ChildItem($MSVS_PATH) | ForEach-Object{ 112 $MSVS_VERSION = [int]((Get-ItemProperty -Path $MSVS_REG_PATH).Version.substring(4, 2))
107 if($EXPECTED_MSVST_VERSION -contains $_){ 113 switch($MSVS_VERSION) {
108 $ACTUAL_MSVST_VERSION = $_ 114 { $MSVS_VERSION -ge 30 } {$ACTUAL_MSVST_VERSION = "2022"}
109 break 115 { ($MSVS_VERSION -ge 20) -and ($MSVS_VERSION -le 29) } {$ACTUAL_MSVST_VERSION = "2019"}
116 { $MSVS_VERSION -lt 20 } {$ACTUAL_MSVST_VERSION = "2017 or lower"}
110 } 117 }
111}
112 118
113if(-not $ACTUAL_MSVST_VERSION){ 119 if (-not ($EXPECTED_MSVST_VERSION -contains $ACTUAL_MSVST_VERSION)) {
114 fail_with_docs "You are not running the expected version of MSVS Tools! 120 fail_with_docs "You are not running the expected version of MSVS Tools!
115 expected: [$EXPECTED_MSVST_VERSION]" 121 expected: [$EXPECTED_MSVST_VERSION]
122 actual : [$ACTUAL_MSVST_VERSION]"
123 }
124
125 Write-Host "Changing your msvs_version on npm to [$ACTUAL_MSVST_VERSION]"
126 npm config set msvs_version $ACTUAL_MSVST_VERSION
116} 127}
117 128
129
130
131
118# ----------------------------------------------------------------------------- 132# -----------------------------------------------------------------------------
119# Ensure that the system dependencies are at the correct version - recover if not 133# Ensure that the system dependencies are at the correct version - recover if not
120# Check npm version 134# Check npm version