aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2022-12-09 09:29:23 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-12-09 11:45:47 +0530
commitcdbec08f5a967220ba0375dbc6e683134d73f95f (patch)
tree7c39e51ce0dedab30f0c77960331b6b4fccb438a /scripts
parentUpdate 'recipes' submodule (diff)
downloadferdium-server-cdbec08f5a967220ba0375dbc6e683134d73f95f.tar.gz
ferdium-server-cdbec08f5a967220ba0375dbc6e683134d73f95f.tar.zst
ferdium-server-cdbec08f5a967220ba0375dbc6e683134d73f95f.zip
Add 'python' dependency for compiling native libs
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-unix.sh2
-rw-r--r--scripts/build-windows.ps135
2 files changed, 29 insertions, 8 deletions
diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh
index ff1ce0f..24ab0f7 100755
--- a/scripts/build-unix.sh
+++ b/scripts/build-unix.sh
@@ -75,7 +75,7 @@ fi
75# ----------------------------------------------------------------------------- 75# -----------------------------------------------------------------------------
76# Ensure that the system dependencies are at the correct version - fail if not 76# Ensure that the system dependencies are at the correct version - fail if not
77# Check python version 77# Check python version
78EXPECTED_PYTHON_VERSION="3.10.4" 78EXPECTED_PYTHON_VERSION=$(node -p 'require("./package.json").engines.python')
79ACTUAL_PYTHON_VERSION=$(python --version | sed -e "s/Python //") 79ACTUAL_PYTHON_VERSION=$(python --version | sed -e "s/Python //")
80if [[ "$ACTUAL_PYTHON_VERSION" != "$EXPECTED_PYTHON_VERSION" ]]; then 80if [[ "$ACTUAL_PYTHON_VERSION" != "$EXPECTED_PYTHON_VERSION" ]]; then
81 fail_with_docs "You are not running the expected version of Python! 81 fail_with_docs "You are not running the expected version of Python!
diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1
index 81187c6..4026aa5 100644
--- a/scripts/build-windows.ps1
+++ b/scripts/build-windows.ps1
@@ -93,7 +93,7 @@ if ($env:CLEAN -eq "true")
93# ----------------------------------------------------------------------------- 93# -----------------------------------------------------------------------------
94# Ensure that the system dependencies are at the correct version - fail if not 94# Ensure that the system dependencies are at the correct version - fail if not
95# Check python version 95# Check python version
96$EXPECTED_PYTHON_VERSION = "3.10.4" 96$EXPECTED_PYTHON_VERSION = (Get-Content package.json | ConvertFrom-Json).engines.python
97$ACTUAL_PYTHON_VERSION = (python --version).trim("Python ") 97$ACTUAL_PYTHON_VERSION = (python --version).trim("Python ")
98if ([System.Version]$ACTUAL_PYTHON_VERSION -ne [System.Version]$EXPECTED_PYTHON_VERSION) { 98if ([System.Version]$ACTUAL_PYTHON_VERSION -ne [System.Version]$EXPECTED_PYTHON_VERSION) {
99 fail_with_docs "You are not running the expected version of Python! 99 fail_with_docs "You are not running the expected version of Python!
@@ -101,14 +101,35 @@ if ([System.Version]$ACTUAL_PYTHON_VERSION -ne [System.Version]$EXPECTED_PYTHON_
101 actual : [$ACTUAL_PYTHON_VERSION]" 101 actual : [$ACTUAL_PYTHON_VERSION]"
102} 102}
103 103
104# TODO: Needs proper way to check MSVS Tools
105# Check MSVS Tools through MSVS_VERSION 104# Check MSVS Tools through MSVS_VERSION
106$EXPECTED_MSVST_VERSION = "2015" 105$EXPECTED_MSVST_VERSION = @("2019","2022")
107$ACTUAL_MSVST_VERSION = (npm config get msvs_version) 106$NPM_CONFIG_MSVS_VERSION = npm config get msvs_version
108if ([double]$ACTUAL_MSVST_VERSION -ne [double]$EXPECTED_MSVST_VERSION) { 107if((-not $NPM_CONFIG_MSVS_VERSION) -or -not ($EXPECTED_MSVST_VERSION -contains $NPM_CONFIG_MSVS_VERSION)){
109 fail_with_docs "You are not running the expected version of MSVS Tools! 108 Write-Host "Your Microsoft Visual Studio Tools isn't set properly or it's not the right version!
109 Checking your version..."
110
111 # TODO: Implement path for ARM machines
112 $MSVS_REG_PATH = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\X64"
113
114 if(-not (Test-Path -Path $MSVS_REG_PATH)){
115 fail_with_docs "You don't have the Microsoft Visual Studio Tools installed!"
116 }
117
118 $MSVS_VERSION = [int]((Get-ItemProperty -Path $MSVS_REG_PATH).Version.substring(4, 2))
119 switch($MSVS_VERSION) {
120 { $MSVS_VERSION -ge 30 } {$ACTUAL_MSVST_VERSION = "2022"}
121 { ($MSVS_VERSION -ge 20) -and ($MSVS_VERSION -le 29) } {$ACTUAL_MSVST_VERSION = "2019"}
122 { $MSVS_VERSION -lt 20 } {$ACTUAL_MSVST_VERSION = "2017 or lower"}
123 }
124
125 if (-not ($EXPECTED_MSVST_VERSION -contains $ACTUAL_MSVST_VERSION)) {
126 fail_with_docs "You are not running the expected version of MSVS Tools!
110 expected: [$EXPECTED_MSVST_VERSION] 127 expected: [$EXPECTED_MSVST_VERSION]
111 actual : [$ACTUAL_MSVST_VERSION]" 128 actual : [$ACTUAL_MSVST_VERSION]"
129 }
130
131 Write-Host "Changing your msvs_version on npm to [$ACTUAL_MSVST_VERSION]"
132 npm config set msvs_version $ACTUAL_MSVST_VERSION
112} 133}
113 134
114# ----------------------------------------------------------------------------- 135# -----------------------------------------------------------------------------
@@ -125,7 +146,7 @@ if ($EXPECTED_NPM_VERSION -ne $ACTUAL_NPM_VERSION) {
125} 146}
126 147
127# Check pnpm version 148# Check pnpm version
128$EXPECTED_PNPM_VERSION = (Get-Content recipes\package.json | ConvertFrom-Json).engines.pnpm 149$EXPECTED_PNPM_VERSION = (Get-Content .\recipes\package.json | ConvertFrom-Json).engines.pnpm
129$ACTUAL_PNPM_VERSION = Get-Command pnpm --version -ErrorAction SilentlyContinue # in case the pnpm executable itself is not present 150$ACTUAL_PNPM_VERSION = Get-Command pnpm --version -ErrorAction SilentlyContinue # in case the pnpm executable itself is not present
130if ($ACTUAL_PNPM_VERSION -ne $EXPECTED_PNPM_VERSION) { 151if ($ACTUAL_PNPM_VERSION -ne $EXPECTED_PNPM_VERSION) {
131 npm i -gf pnpm@$EXPECTED_PNPM_VERSION 152 npm i -gf pnpm@$EXPECTED_PNPM_VERSION