diff options
| author | ruki <[email protected]> | 2023-11-20 11:37:57 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-20 11:37:57 +0800 |
| commit | 1da08ea73e20ac47aefc95ea74d032ced598ef91 (patch) | |
| tree | 781813671459a5fa9939d06d6de5c6b66d80bcfa | |
| parent | 9619fa5f353216abc628f8117fba6c0931d77355 (diff) | |
| parent | 521b6b1e73dd72aaff2f53fec359eb1cda6d3d9e (diff) | |
Merge pull request #4397 from xmake-io/ci
improve ci
| -rw-r--r-- | .github/workflows/windows.yml | 73 | ||||
| -rw-r--r-- | .github/workflows/windows_luajit.yml | 68 | ||||
| -rw-r--r-- | scripts/installer.nsi | 369 |
3 files changed, 34 insertions, 476 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d801f8a60..4a16620a8 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -46,16 +46,13 @@ jobs: path: xmake-cache key: ${{ matrix.os }}-${{ matrix.arch }} - - name: Prepare + - name: Set release arch name run: | - xmake show - curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v309/nsis-3.09.zip" -o ./nsis.zip - curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v309/nsis-3.09-strlen_8192.zip" -o ./nsis-longstr.zip - curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v309/UAC.zip" -o ./nsis-uac.zip - Expand-Archive ./nsis.zip -DestinationPath ./nsis - Expand-Archive ./nsis-longstr.zip -DestinationPath ./nsis -Force - Expand-Archive ./nsis-uac.zip -DestinationPath ./nsis -Force - Move-Item ./nsis/UAC.nsh ./nsis/Include/ + if ("${{ matrix.arch }}" -eq "x64") { + Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append + } else { + Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append + } - name: Build run: | @@ -64,6 +61,15 @@ jobs: xmake -vD cd .. + - name: Artifact + run: | + cd core + xrepo update-repo + xmake pack -vD -y --formats=nsis,zip --autobuild=n -o ../artifacts/${{env.RELEASE_NAME}} --basename=xmake + (Get-FileHash ../artifacts/${{env.RELEASE_NAME}}/xmake.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append + Copy-Item shafile ../artifacts/${{env.RELEASE_NAME}} + cd .. + - name: Tests run: | Copy-Item ./core/build/xmake.exe ./xmake @@ -74,51 +80,8 @@ jobs: Set-Item -Path Env:Path -Value ($Env:XMAKE_PROGRAM_DIR + ";" + $Env:Path) xrepo --version xmake show - #xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake xmake lua -v -D tests/run.lua - - name: Set release arch name - run: | - if ("${{ matrix.arch }}" -eq "x64") { - Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append - } else { - Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append - } - - name: Artifact - run: | - # build installer - (New-Item ./winenv/bin -ItemType Directory).FullName - curl -fsSL "https://github.com/xmake-mirror/7zip/releases/download/19.00/7z19.00-${{ matrix.arch }}.zip" -o .\7zip.zip - Expand-Archive ./7zip.zip -DestinationPath ./7zip - Copy-Item ./7zip/7z.exe ./winenv/bin - Copy-Item ./7zip/7z.dll ./winenv/bin - curl -fsSL "https://curl.se/windows/dl-8.2.1_11/curl-8.2.1_11-win32-mingw.zip" -o .\curl.zip - Expand-Archive ./curl.zip -DestinationPath ./curl - Copy-Item ./curl/curl-8.2.1_11-win32-mingw/bin/curl.exe ./winenv/bin - Copy-Item ./curl/curl-8.2.1_11-win32-mingw/bin/curl-ca-bundle.crt ./winenv/bin - $version = (Get-Command xmake/xmake.exe).FileVersionInfo - ./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /D${{ matrix.arch }} .\scripts\installer.nsi - (New-Item ./artifacts/${{env.RELEASE_NAME}} -ItemType Directory).FullName - Copy-Item scripts/xmake.exe ./artifacts/${{env.RELEASE_NAME}}/xmake.exe - # archive - Copy-Item ./*.md ./xmake - Copy-Item ./winenv ./xmake -Recurse - Add-Type -AssemblyName System.Text.Encoding - Add-Type -AssemblyName System.IO.Compression.FileSystem - class FixedEncoder : System.Text.UTF8Encoding { - FixedEncoder() : base($true) { } - [byte[]] GetBytes([string] $s) - { - $s = $s.Replace("\", "/") - return ([System.Text.UTF8Encoding]$this).GetBytes($s) - } - } - Copy-Item ./xmake ./archive/xmake -Recurse - [System.IO.Compression.ZipFile]::CreateFromDirectory("$PWD\archive", "$PWD\archive.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) - (Get-FileHash .\archive.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append - Copy-Item archive.zip ./artifacts/${{env.RELEASE_NAME}} - Copy-Item shafile ./artifacts/${{env.RELEASE_NAME}} - # upload artifacts - uses: actions/upload-artifact@v2 with: @@ -127,7 +90,7 @@ jobs: - uses: actions/upload-artifact@v2 with: name: xmake-latest.${{ env.RELEASE_NAME }}.zip - path: artifacts/${{env.RELEASE_NAME}}/archive.zip + path: artifacts/${{env.RELEASE_NAME}}/xmake.zip - uses: actions/upload-artifact@v2 with: name: xmake-latest.${{ env.RELEASE_NAME }}.sha256 @@ -156,7 +119,7 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: artifacts/${{env.RELEASE_NAME}}/archive.zip + file: artifacts/${{env.RELEASE_NAME}}/xmake.zip asset_name: xmake-${{ env.GITHUB_REF_SLUG }}.${{ env.RELEASE_NAME }}.zip tag: ${{ steps.previoustag.outputs.tag }} overwrite: true @@ -180,7 +143,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: artifacts/${{env.RELEASE_NAME}}/archive.zip + asset_path: artifacts/${{env.RELEASE_NAME}}/xmake.zip asset_name: xmake-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.zip asset_content_type: application/zip diff --git a/.github/workflows/windows_luajit.yml b/.github/workflows/windows_luajit.yml index 3c81db731..9386acbff 100644 --- a/.github/workflows/windows_luajit.yml +++ b/.github/workflows/windows_luajit.yml @@ -35,16 +35,13 @@ jobs: - uses: little-core-labs/[email protected] id: tagName - - name: Prepare + - name: Set release arch name run: | - xmake show - curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v309/nsis-3.09.zip" -o ./nsis.zip - curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v309/nsis-3.09-strlen_8192.zip" -o ./nsis-longstr.zip - curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v309/UAC.zip" -o ./nsis-uac.zip - Expand-Archive ./nsis.zip -DestinationPath ./nsis - Expand-Archive ./nsis-longstr.zip -DestinationPath ./nsis -Force - Expand-Archive ./nsis-uac.zip -DestinationPath ./nsis -Force - Move-Item ./nsis/UAC.nsh ./nsis/Include/ + if ("${{ matrix.arch }}" -eq "x64") { + Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append + } else { + Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append + } - name: Build run: | @@ -53,6 +50,15 @@ jobs: xmake -vD cd .. + - name: Artifact + run: | + cd core + xrepo update-repo + xmake pack -vD -y --formats=nsis,zip --autobuild=n -o ../artifacts/${{env.RELEASE_NAME}} --basename=xmake + (Get-FileHash ../artifacts/${{env.RELEASE_NAME}}/xmake.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append + Copy-Item shafile ../artifacts/${{env.RELEASE_NAME}} + cd .. + - name: Tests run: | Copy-Item ./core/build/xmake.exe ./xmake @@ -64,48 +70,6 @@ jobs: xmake show xmake lua -v -D tests/run.lua - - name: Set release arch name - run: | - if ("${{ matrix.arch }}" -eq "x64") { - Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append - } else { - Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append - } - - name: Artifact - run: | - # build installer - (New-Item ./winenv/bin -ItemType Directory).FullName - curl -fsSL "https://github.com/xmake-mirror/7zip/releases/download/19.00/7z19.00-${{ matrix.arch }}.zip" -o .\7zip.zip - Expand-Archive ./7zip.zip -DestinationPath ./7zip - Copy-Item ./7zip/7z.exe ./winenv/bin - Copy-Item ./7zip/7z.dll ./winenv/bin - curl -fsSL "https://curl.se/windows/dl-8.2.1_11/curl-8.2.1_11-win32-mingw.zip" -o .\curl.zip - Expand-Archive ./curl.zip -DestinationPath ./curl - Copy-Item ./curl/curl-8.2.1_11-win32-mingw/bin/curl.exe ./winenv/bin - Copy-Item ./curl/curl-8.2.1_11-win32-mingw/bin/curl-ca-bundle.crt ./winenv/bin - $version = (Get-Command xmake/xmake.exe).FileVersionInfo - ./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /D${{ matrix.arch }} .\scripts\installer.nsi - (New-Item ./artifacts/${{env.RELEASE_NAME}} -ItemType Directory).FullName - Copy-Item scripts/xmake.exe ./artifacts/${{env.RELEASE_NAME}}/xmake.exe - # archive - Copy-Item ./*.md ./xmake - Copy-Item ./winenv ./xmake -Recurse - Add-Type -AssemblyName System.Text.Encoding - Add-Type -AssemblyName System.IO.Compression.FileSystem - class FixedEncoder : System.Text.UTF8Encoding { - FixedEncoder() : base($true) { } - [byte[]] GetBytes([string] $s) - { - $s = $s.Replace("\", "/") - return ([System.Text.UTF8Encoding]$this).GetBytes($s) - } - } - Copy-Item ./xmake ./archive/xmake -Recurse - [System.IO.Compression.ZipFile]::CreateFromDirectory("$PWD\archive", "$PWD\archive.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new()) - (Get-FileHash .\archive.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append - Copy-Item archive.zip ./artifacts/${{env.RELEASE_NAME}} - Copy-Item shafile ./artifacts/${{env.RELEASE_NAME}} - # upload artifacts - uses: actions/upload-artifact@v2 with: @@ -114,7 +78,7 @@ jobs: - uses: actions/upload-artifact@v2 with: name: xmake-latest.${{ env.RELEASE_NAME }}.zip - path: artifacts/${{env.RELEASE_NAME}}/archive.zip + path: artifacts/${{env.RELEASE_NAME}}/xmake.zip - uses: actions/upload-artifact@v2 with: name: xmake-latest.${{ env.RELEASE_NAME }}.sha256 diff --git a/scripts/installer.nsi b/scripts/installer.nsi deleted file mode 100644 index 8f3050557..000000000 --- a/scripts/installer.nsi +++ /dev/null @@ -1,369 +0,0 @@ -; xmake.nsi -; -; This script is perhaps one of the simplest NSIs you can make. All of the -; optional settings are left to their default settings. The installer simply -; prompts the user asking them where to install, and drops a copy of xmake.nsi -; there. - -;-------------------------------- -; includes -!include "MUI2.nsh" -!include "WordFunc.nsh" -!include "WinMessages.nsh" -!include FileFunc.nsh -!include UAC.nsh - -; xmake version Information -!ifndef MAJOR - !error 'xmake major version is not defined!' -!endif -!ifndef MINOR - !error 'xmake minor version is not defined!' -!endif -!ifndef ALTER - !error 'xmake alter version is not defined!' -!endif -!ifndef BUILD - !error 'xmake build version is not defined!' -!endif - -!define VERSION ${MAJOR}.${MINOR}.${ALTER} -!define VERSION_FULL ${VERSION}+${BUILD} - -!ifdef x64 - !define ARCH x64 -!else - !define ARCH x86 -!endif - -;-------------------------------- - -; The name of the installer -Name "Xmake - v${VERSION}" - -; The file to write -OutFile "xmake.exe" - -; Use unicode -Unicode true - -; Use best compressor -SetCompressor /FINAL /SOLID lzma -SetCompressorDictSize 64 -SetDatablockOptimize ON - -; The default installation directory -!ifdef x64 - !define PROGRAMFILES $PROGRAMFILES64 - !define HKLM HKLM64 - !define HKCU HKCU64 -!else - !define PROGRAMFILES $PROGRAMFILES - !define HKLM HKLM - !define HKCU HKCU -!endif - -; Request application privileges for Windows Vista -RequestExecutionLevel user - -; Set DPI Aware -ManifestDPIAware true - -;-------------------------------- -; Interface Settings - -!define MUI_ABORTWARNING - -;-------------------------------- -; Icon -!define MUI_ICON "..\core\src\demo\xmake.ico" - -;-------------------------------- -; UAC helper - -!macro Init thing - uac_tryagain: - !insertmacro UAC_RunElevated - ${Switch} $0 - ${Case} 0 - ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done - ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on - ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user - MessageBox mb_YesNo|mb_IconExclamation|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, try again" /SD IDNO IDYES uac_tryagain IDNO 0 - ${EndIf} - ;fall-through and die - ${Case} 1223 - MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "This ${thing} requires admin privileges, aborting!" - Quit - ${Case} 1062 - MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon service not running, aborting!" - Quit - ${Default} - MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Unable to elevate, error $0" - Quit - ${EndSwitch} - - ; The UAC plugin changes the error level even in the inner process, reset it. - ; note fix install exit code 1223 to 0 with slient /S - SetErrorLevel 0 - SetShellVarContext all -!macroend - -;-------------------------------- -; Install Pages - -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE "..\LICENSE.md" -!insertmacro MUI_PAGE_COMPONENTS -!insertmacro MUI_PAGE_DIRECTORY -!insertmacro MUI_PAGE_INSTFILES -!define MUI_FINISHPAGE_LINK "Donate $$5" -!define MUI_FINISHPAGE_LINK_LOCATION "https://xmake.io/#/sponsor" -!insertmacro MUI_PAGE_FINISH - -;-------------------------------- -; Uninstall Pages - -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_UNPAGE_FINISH - -;-------------------------------- -; Languages - -!insertmacro MUI_LANGUAGE "English" - -;-------------------------------- -; Version Information - - -VIProductVersion ${VERSION}.0 -VIFileVersion ${VERSION}.0 -VIAddVersionKey /LANG=0 ProductName Xmake -VIAddVersionKey /LANG=0 Comments "A cross-platform build utility based on Lua$\nwebsite: https://xmake.io" -VIAddVersionKey /LANG=0 CompanyName "The TBOOX Open Source Group" -VIAddVersionKey /LANG=0 LegalCopyright "Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io" -VIAddVersionKey /LANG=0 FileDescription "Xmake Installer - v${VERSION}" -VIAddVersionKey /LANG=0 OriginalFilename "xmake-${ARCH}.exe" -VIAddVersionKey /LANG=0 FileVersion ${VERSION_FULL} -VIAddVersionKey /LANG=0 ProductVersion ${VERSION_FULL} - - -;-------------------------------- -; Reg paths - -!define RegUninstall "Software\Microsoft\Windows\CurrentVersion\Uninstall\XMake" - -;-------------------------------- - -Var NOADMIN - -Function TrimQuote - Exch $R1 ; Original string - Push $R2 - -Loop: - StrCpy $R2 "$R1" 1 - StrCmp "$R2" "'" TrimLeft - StrCmp "$R2" "$\"" TrimLeft - StrCmp "$R2" "$\r" TrimLeft - StrCmp "$R2" "$\n" TrimLeft - StrCmp "$R2" "$\t" TrimLeft - StrCmp "$R2" " " TrimLeft - GoTo Loop2 -TrimLeft: - StrCpy $R1 "$R1" "" 1 - Goto Loop - -Loop2: - StrCpy $R2 "$R1" 1 -1 - StrCmp "$R2" "'" TrimRight - StrCmp "$R2" "$\"" TrimRight - StrCmp "$R2" "$\r" TrimRight - StrCmp "$R2" "$\n" TrimRight - StrCmp "$R2" "$\t" TrimRight - StrCmp "$R2" " " TrimRight - GoTo Done -TrimRight: - StrCpy $R1 "$R1" -1 - Goto Loop2 - -Done: - Pop $R2 - Exch $R1 -FunctionEnd - -; Installer -Function .onInit - ${GetOptions} $CMDLINE "/NOADMIN" $NOADMIN - ${If} ${Errors} - !insertmacro Init "installer" - StrCpy $NOADMIN "false" - ${Else} - StrCpy $NOADMIN "true" - ${EndIf} - - ; load from reg - ${If} $InstDir == "" - ${If} $NOADMIN == "false" - ReadRegStr $R0 ${HKLM} ${RegUninstall} "InstallLocation" - ${Else} - ReadRegStr $R0 ${HKCU} ${RegUninstall} "InstallLocation" - ${EndIf} - ${If} $R0 != "" - Push $R0 - Call TrimQuote - Pop $R0 - StrCpy $InstDir $R0 - ${EndIf} - ${EndIf} - ; use default - ${If} $InstDir == "" - StrCpy $InstDir ${PROGRAMFILES}\xmake - ${EndIf} - -FunctionEnd - -Section "Xmake (required)" InstallExeutable - - SectionIn RO - - ; Set output path to the installation directory. - SetOutPath $InstDir - - ; Remove previous directories used - ; https://github.com/xmake-io/xmake/issues/1888 - IfFileExists "$InstDir\xmake.exe" file_found file_not_found_or_end - file_found: - RMDir /r "$InstDir" - goto file_not_found_or_end - file_not_found_or_end: - - ; Put file there - File /r /x ".DS_Store" /x "*.swp" "..\xmake\*.*" - File "..\*.md" - File "..\core\build\xmake.exe" - File "..\scripts\xrepo.bat" - File "..\scripts\xrepo.ps1" - File /r /x ".DS_Store" "..\winenv" - - WriteUninstaller "uninstall.exe" - - !macro AddReg RootKey - - ; Write uac info - WriteRegStr ${RootKey} ${RegUninstall} "NoAdmin" "$NOADMIN" - - ; Write the uninstall keys for Windows - WriteRegStr ${RootKey} ${RegUninstall} "DisplayName" "Xmake build utility (${ARCH})" - WriteRegStr ${RootKey} ${RegUninstall} "DisplayIcon" '"$InstDir\xmake.exe"' - WriteRegStr ${RootKey} ${RegUninstall} "Comments" "A cross-platform build utility based on Lua" - WriteRegStr ${RootKey} ${RegUninstall} "Publisher" "The TBOOX Open Source Group" - WriteRegStr ${RootKey} ${RegUninstall} "UninstallString" '"$InstDir\uninstall.exe"' - WriteRegStr ${RootKey} ${RegUninstall} "QuiteUninstallString" '"$InstDir\uninstall.exe" /S' - WriteRegStr ${RootKey} ${RegUninstall} "InstallLocation" $InstDir - WriteRegStr ${RootKey} ${RegUninstall} "HelpLink" 'https://xmake.io/' - WriteRegStr ${RootKey} ${RegUninstall} "URLInfoAbout" 'https://github.com/xmake-io/xmake' - WriteRegStr ${RootKey} ${RegUninstall} "URLUpdateInfo" 'https://github.com/xmake-io/xmake/releases' - WriteRegDWORD ${RootKey} ${RegUninstall} "VersionMajor" ${MAJOR} - WriteRegDWORD ${RootKey} ${RegUninstall} "VersionMinor" ${MINOR} - WriteRegStr ${RootKey} ${RegUninstall} "DisplayVersion" ${VERSION_FULL} - WriteRegDWORD ${RootKey} ${RegUninstall} "NoModify" 1 - WriteRegDWORD ${RootKey} ${RegUninstall} "NoRepair" 1 - - ;write size to reg - ${GetSize} "$InstDir" "/S=0K" $0 $1 $2 - IntFmt $0 "0x%08X" $0 - WriteRegDWORD ${RootKey} ${RegUninstall} "EstimatedSize" "$0" - !macroend - - ${If} $NOADMIN == "false" - !insertmacro AddReg ${HKLM} - ${Else} - !insertmacro AddReg ${HKCU} - ${EndIf} - -SectionEnd - -Section "Enable Long Path" LongPath - ${If} $NOADMIN == "false" - ; Enable long path - WriteRegDWORD ${HKLM} "SYSTEM\CurrentControlSet\Control\FileSystem" "LongPathsEnabled" 1 - ${EndIf} -SectionEnd - -Section "Add to PATH" InstallPath - - ${If} $NOADMIN == "false" - ; Remove the installation path from the $PATH environment variable first - ReadRegStr $R0 ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" - ${WordReplace} $R0 ";$InstDir" "" "+" $R1 - - ; Write the installation path into the $PATH environment variable - WriteRegExpandStr ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1;$InstDir" - ${Else} - ; Remove the installation path from the $PATH environment variable first - ReadRegStr $R0 ${HKCU} "Environment" "Path" - ${WordReplace} $R0 ";$InstDir" "" "+" $R1 - - ; Write the installation path into the $PATH environment variable - WriteRegExpandStr ${HKCU} "Environment" "Path" "$R1;$InstDir" - ${EndIf} - - ; make sure windows knows about the change - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 - -SectionEnd - -;-------------------------------- -; Descriptions - -; Language strings -LangString DESC_InstallExeutable ${LANG_ENGLISH} "A cross-platform build utility based on Lua" -LangString DESC_InstallPath ${LANG_ENGLISH} "Add xmake to PATH" -LangString DESC_LongPath ${LANG_ENGLISH} "Increases the maximum path length limit, up to 32,767 characters (before 256). This can be useful if a project has many recursive subfolders to make sure that the project is compiled without errors. A reboot might be required because some processes may have started before the new value was set" - -; Assign language strings to sections -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN -!insertmacro MUI_DESCRIPTION_TEXT ${InstallExeutable} $(DESC_InstallExeutable) -!insertmacro MUI_DESCRIPTION_TEXT ${InstallPath} $(DESC_InstallPath) -!insertmacro MUI_DESCRIPTION_TEXT ${LongPath} $(DESC_LongPath) -!insertmacro MUI_FUNCTION_DESCRIPTION_END - -;-------------------------------- - -; Uninstaller - -Function un.onInit - ; check if we need uac - ReadRegStr $NOADMIN ${HKLM} ${RegUninstall} "NoAdmin" - IfErrors 0 +2 - ReadRegStr $NOADMIN ${HKCU} ${RegUninstall} "NoAdmin" - - ${IfNot} $NOADMIN == "true" - !insertmacro Init "uninstaller" - ${EndIf} - -FunctionEnd - -Section "Uninstall" - - ; Remove directories used - RMDir /r "$InstDir" - - ; Clean reg - ${If} $NOADMIN == "false" - DeleteRegKey ${HKLM} ${RegUninstall} - ; Remove the installation path from the $PATH environment variable - ReadRegStr $R0 ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" - ${WordReplace} $R0 ";$InstDir" "" "+" $R1 - WriteRegExpandStr ${HKLM} "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$R1" - ${Else} - DeleteRegKey ${HKCU} ${RegUninstall} - ; Remove the installation path from the $PATH environment variable - ReadRegStr $R0 ${HKCU} "Environment" "Path" - ${WordReplace} $R0 ";$InstDir" "" "+" $R1 - WriteRegExpandStr ${HKCU} "Environment" "Path" "$R1" - ${EndIf} - -SectionEnd |
