From 86c4ef48d1988391947f2efabe548cf9618b4cc6 Mon Sep 17 00:00:00 2001 From: halx99 Date: Sat, 8 Jul 2023 12:37:02 +0800 Subject: [PATCH] Improve setup script [skip ci] --- 1k/manifest.ps1 | 17 +++++++++++++++++ setup.ps1 | 14 +++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 1k/manifest.ps1 diff --git a/1k/manifest.ps1 b/1k/manifest.ps1 new file mode 100644 index 0000000000..81f8c9ed78 --- /dev/null +++ b/1k/manifest.ps1 @@ -0,0 +1,17 @@ +# Uncomment to overwrite $manifest in main script build1k.ps1 + +# $manifest = @{ +# msvc = '143+'; +# ndk = 'r23c+'; +# xcode = '13.0.0~14.2.0'; # range +# clang = '15.0.0+'; +# gcc = '9.0.0+'; +# cmake = '3.26.4+'; +# nuget = '*'; # any +# glslcc = '1.7.6+'; +# ninja = '1.11.1+'; +# jdk = '11.0.19+'; +# cmdlinetools = '7.0+'; # android cmdlinetools +# } + +# [void]$manifest diff --git a/setup.ps1 b/setup.ps1 index 100df00dcc..7c6ff89dbb 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -31,18 +31,21 @@ if ($IsWin) { else { $PATH = [System.Collections.ArrayList]$env:PATH.Split(':') if (Test-Path $PROFILE -PathType Leaf) { - $profileContent = Get-Content $PROFILE + $profileContent = Get-Content $PROFILE -raw } else { $profileContent = '' } + $needSave = $false if ($profileContent.IndexOf('$env:AX_ROOT = ') -eq -1) { $profileContent += '$env:AX_ROOT = "{0}"{1}' -f $AX_ROOT, "`n" + $needSave = $true } if ($profileContent.IndexOf('$env:PATH = ') -eq -1) { $profileContent += '$env:PATH = "{0}:$env:PATH"' -f $AX_CONSOLE_BIN + $needSave = $true } $profileDir = Split-Path $PROFILE -Parent @@ -50,12 +53,13 @@ else { mkdir $profileDir | Out-Null } - Set-Content $PROFILE -Value $profileContent + if ($needSave) { + Set-Content $PROFILE -Value $profileContent + } } if ($IsLinux) { - b1k_print "This Shell Script will install dependencies for axmol" - Write-Host "Are you continue? (y/n) " -NoNewline + Write-Host "Are you continue install linux dependencies for axmol? (y/n) " -NoNewline $answer = Read-Host if ($answer -like 'y*') { b1k_print "It will take few minutes" @@ -111,7 +115,7 @@ if ($IsWin) { } $parentProcessName = $parentProcess.ProcessName if ($parentProcessName -like "explorer") { - Write-Host "setup successfully, press any key to exit . . ." -NoNewline + b1k_print "setup successfully, press any key to exit . . ." -NoNewline cmd /c pause 1>$null exit 0 }