Add support for generating Windows install program instead of zip file. Part of #6304

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2018-11-05 10:40:11 +01:00
parent bf123f308a
commit a31d10f6dc
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
20 changed files with 1443 additions and 35 deletions

3
.gitignore vendored
View File

@ -130,7 +130,7 @@ CMakeCache.txt
**/CMakeFiles/
/StatusImPackage/*
*.AppImage
Status-Windows-x86_64.zip
Status-Windows-x86_64.exe
/desktop/bin/*
/desktop/lib/*
/desktop/modules/*
@ -148,4 +148,3 @@ logger_settings.ini
conan*.txt
conanbuildinfo.*
conan.cmake
/.conan_*/

View File

@ -77,22 +77,22 @@ pipeline {
if (btype != 'release') {
dmgUrl = cmn.uploadArtifact(cmn.pkgFind('dmg'))
appUrl = cmn.uploadArtifact(cmn.pkgFind('AppImage'))
zipUrl = cmn.uploadArtifact(cmn.pkgFind('zip'))
exeUrl = cmn.uploadArtifact(cmn.pkgFind('exe'))
} else {
dmgUrl = null
appUrl = null
zipUrl = null
exeUrl = null
}
/* special case for iOS Diawi links */
ipaUrl = ios.getBuildVariables().get('DIAWI_URL')
/* add URLs to the build description */
cmn.setBuildDesc(
Apk: apkUrl, e2e: e2eUrl, iOS: ipaUrl, App: appUrl, Mac: dmgUrl, Win: zipUrl,
Apk: apkUrl, e2e: e2eUrl, iOS: ipaUrl, App: appUrl, Mac: dmgUrl, Win: exeUrl,
)
/* Create latest.json with newest nightly URLs */
if (btype == 'nightly') {
cmn.updateLatestNightlies(
APK: apkUrl, IOS: ipaUrl, APP: appUrl, MAC: dmgUrl, WIN: zipUrl
APK: apkUrl, IOS: ipaUrl, APP: appUrl, MAC: dmgUrl, WIN: exeUrl
)
}
} }
@ -101,7 +101,7 @@ pipeline {
steps { script {
if (env.CHANGE_ID != null) {
cmn.githubNotify(
apk: apkUrl, e2e: e2eUrl, ipa: ipaUrl, app: appUrl, dmg: dmgUrl, win: zipUrl,
apk: apkUrl, e2e: e2eUrl, ipa: ipaUrl, app: appUrl, dmg: dmgUrl, win: exeUrl,
)
}
} }

View File

@ -3,7 +3,7 @@ pipeline {
/* privileged mode is necessary for fuse */
docker {
label 'linux-new'
image 'statusteam/windows-desktop-ubuntu:1.0.0'
image 'statusteam/windows-desktop-ubuntu:nsis-1.0.0'
args (
"--privileged "+
"-v /dev/fuse:/dev/fuse "+

View File

@ -65,8 +65,8 @@ def bundleWindows(type = 'nightly') {
sh './scripts/build-desktop.sh bundle'
dir(packageFolder) {
pkg = common.pkgFilename(type, 'zip')
sh "mv ../Status-Windows-x86_64.zip ${pkg}"
pkg = common.pkgFilename(type, 'exe')
sh "mv ../Status-x86_64-setup.exe ${pkg}"
}
return "${packageFolder}/${pkg}".drop(2)
}

View File

@ -0,0 +1,23 @@
!include LogicLib.nsh
!include WordFunc.nsh
Function SnoreWinVer
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
${VersionCompare} "6.2" $R0 $R0
${If} $R0 == 1
Push "NotWin8"
${Else}
Push "AtLeastWin8"
${EndIf}
FunctionEnd
!macro SnoreShortcut path exe appID
Call SnoreWinVer
Pop $0
${If} $0 == "AtLeastWin8"
nsExec::ExecToLog '"${SnoreToastExe}" -install "${path}" "${exe}" "${appID}"'
${Else}
DetailPrint "Creating shortcut to ${exe}"
CreateShortCut "${path}" "${exe}"
${EndIf}
!macroend

View File

@ -0,0 +1,299 @@
/*** UAC Plug-in ***
Interactive User (MediumIL) Admin user (HighIL)
***[Setup.exe]************* ***[Setup.exe]**************
* * * *
* +++[.OnInit]+++++++++++ * * +++[.OnInit]++++++++++++ *
* + UAC_RunElevated >---+-+----> * + + *
* + NSIS.Quit + * * + + *
* +++++++++++++++++++++++ * * ++++++++++++++++++++++++ *
* * * *
* * * *
* +++[Section]+++++++++++ * * +++[Section]++++++++++++ *
* + + * /--+-+-<UAC_AsUser_ExecShell+ *
* +++++++++++++++++++++++ * | * ++++++++++++++++++++++++ *
* * | * *
* Win32.ShellExecute <---+--/ * *
* * * *
*************************** ****************************
*/
!ifndef UAC_HDR__INC
!verbose push
!verbose 3
!ifndef UAC_VERBOSE
!define UAC_VERBOSE 3
!endif
!verbose ${UAC_VERBOSE}
!define UAC_HDR__INC 0x00020400 ;MMmmbbrr
!include LogicLib.nsh
/* UAC_RunElevated
**
** Starts the elevation operation.
**
** Return values:
**
** $0: Win32 error code (0 on success, 1223 if user aborted elevation dialog, anything else should be treated as a fatal error)
** $1: If $0==0:
** 0 UAC is not supported by the OS
** 1 Started a elevated child process, the current process should act like a wrapper (Call Quit without any further processing)
** 2 The process is already running @ HighIL (Member of admin group)
** 3 You should call RunElevated again (This can happen if a user without admin priv. is used in the runas dialog)
** $2: If $0==0 && $1==1: ExitCode of the elevated fork process (The NSIS errlvl is also set)
** $3: If $0==0: 1 if the user is a member of the admin group or 0 otherwise
**/
!macro UAC_RunElevated
UAC::_ 0
!macroend
!macro UAC_PageElevation_RunElevated
UAC::_ 0
!macroend
/*!macro UAC_OnInitElevation_RunElevated
UAC::_ 0
!macroend
!macro UAC_OnInitElevation_OnGuiInit
!macroend*/
/* UAC_GetIntegrityLevel <NSISVar:Output | "s">
**
** Get integrity level of current process
**
**/
!macro UAC_GetIntegrityLevel outvar
UAC::_ 6
!if "${outvar}" != "s"
Pop ${outvar}
!endif
!macroend
/* UAC_IsAdmin
**
** Is the current process running with administrator privileges? Result in $0
**
** ${If} ${UAC_IsAdmin} ...
**
**/
!macro UAC_IsAdmin
UAC::_ 2
!macroend
!define UAC_IsAdmin `"" UAC_IsAdmin ""`
!macro _UAC_IsAdmin _a _b _t _f
!insertmacro _UAC_MakeLL_Cmp _!= 0 2s
!macroend
/* UAC_IsInnerInstance
**
** Does the current process have a NSIS/UAC parent process that is part of the elevation operation?
**
** ${If} ${UAC_IsInnerInstance} ...
**
**/
!macro UAC_IsInnerInstance
UAC::_ 3
!macroend
!define UAC_IsInnerInstance `"" UAC_IsInnerInstance ""`
!macro _UAC_IsInnerInstance _a _b _t _f
!insertmacro _UAC_MakeLL_Cmp _!= 0 3s
!macroend
/* UAC_PageElevation_OnInit, UAC_PageElevation_OnGuiInit,
**
** Helper macros for elevation on a custom elevation page, see the DualMode example for more information.
**
**/
!macro UAC_Notify_OnGuiInit
UAC::_ 4
!macroend
!macro UAC_PageElevation_OnGuiInit
!insertmacro UAC_Notify_OnGuiInit
!macroend
!macro UAC_PageElevation_OnInit
UAC::_ 5
${IfThen} ${Errors} ${|} Quit ${|}
!macroend
/* UAC_AsUser_Call <Function|Label> <NSISAddressName> <UAC_* flags>
**
** Calls a function or label in the user process instance.
** All the UAC_AsUser_* macros use this helper macro.
**
**/
!define UAC_SYNCREGISTERS 0x1
;define UAC_SYNCSTACK 0x2
!define UAC_SYNCOUTDIR 0x4
!define UAC_SYNCINSTDIR 0x8
;define UAC_CLEARERRFLAG 0x10
!macro UAC_AsUser_Call type name flags
push $0
Get${type}Address $0 ${name}
!verbose push
!verbose ${UAC_VERBOSE}
!insertmacro _UAC_ParseDefineFlagsToInt _UAC_AsUser_Call__flags ${flags}
!verbose pop
StrCpy $0 "1$0:${_UAC_AsUser_Call__flags}"
!undef _UAC_AsUser_Call__flags
Exch $0
UAC::_
!macroend
/*
** UAC_AsUser_GetSection <Flags|InstTypes|Size|Text> <SectionIndex> <NSISVar:Output>
*/
!macro UAC_AsUser_GetSection secprop secidx outvar
!insertmacro _UAC_AsUser_GenOp ${outvar} SectionGet${secprop} ${secidx} ""
!macroend
/*
** UAC_AsUser_GetGlobalVar <NSISVar:SourceAndOutput>
** UAC_AsUser_GetGlobal <NSISVar:Output> <NSISVar:Source>
*/
!macro UAC_AsUser_GetGlobalVar var
!insertmacro _UAC_AsUser_GenOp ${var} StrCpy "" ${var}
!macroend
!macro UAC_AsUser_GetGlobal outvar srcvar
!insertmacro _UAC_AsUser_GenOp ${outvar} StrCpy "" ${srcvar}
!macroend
/*
** UAC_AsUser_ExecShell <Verb> <ApplicationOrFile> <Parameters> <Working Directory> <SW_*>
**
** Call ExecShell in the user process instance.
**
*/
!macro UAC_AsUser_ExecShell verb command params workdir show
!insertmacro _UAC_IncL
goto _UAC_L_E_${__UAC_L}
_UAC_L_F_${__UAC_L}:
ExecShell "${verb}" "${command}" '${params}' ${show}
return
_UAC_L_E_${__UAC_L}:
!if "${workdir}" != ""
push $outdir
SetOutPath "${workdir}"
!endif
!insertmacro UAC_AsUser_Call Label _UAC_L_F_${__UAC_L} ${UAC_SYNCREGISTERS}|${UAC_SYNCOUTDIR}|${UAC_SYNCINSTDIR} #|${UAC_CLEARERRFLAG}
!if "${workdir}" != ""
pop $outdir
SetOutPath $outdir
!endif
!macroend
!macro _UAC_MakeLL_Cmp cmpop cmp pluginparams
!insertmacro _LOGICLIB_TEMP
UAC::_ ${pluginparams}
pop $_LOGICLIB_TEMP
!insertmacro ${cmpop} $_LOGICLIB_TEMP ${cmp} `${_t}` `${_f}`
!macroend
!macro _UAC_definemath def val1 op val2
!define /math _UAC_definemath "${val1}" ${op} ${val2}
!ifdef ${def}
!undef ${def}
!endif
!define ${def} "${_UAC_definemath}"
!undef _UAC_definemath
!macroend
!macro _UAC_ParseDefineFlags_orin parse outflags
!searchparse /noerrors ${${parse}} "" _UAC_ParseDefineFlags_orin_f1 "|" _UAC_ParseDefineFlags_orin_f2
!define _UAC_ParseDefineFlags_orin_this ${_UAC_ParseDefineFlags_orin_f1}
!undef ${parse}
!define ${parse} ${_UAC_ParseDefineFlags_orin_f2}
!define _UAC_ParseDefineFlags_orin_saveout ${${outflags}}
!undef ${outflags}
!define /math ${outflags} "${_UAC_ParseDefineFlags_orin_saveout}" | "${_UAC_ParseDefineFlags_orin_this}"
!undef _UAC_ParseDefineFlags_orin_saveout
!undef _UAC_ParseDefineFlags_orin_this
!ifdef _UAC_ParseDefineFlags_orin_f1
!undef _UAC_ParseDefineFlags_orin_f1
!endif
!ifdef _UAC_ParseDefineFlags_orin_f2
!undef _UAC_ParseDefineFlags_orin_f2
!endif
!macroend
!macro _UAC_ParseDefineFlags_Begin _outdef _in
!define _UAC_PDF${_outdef}_parse "${_in}"
!define _UAC_PDF${_outdef}_flags ""
!define _UAC_PDF${_outdef}_r 0
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x1
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x2
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x4
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x8
!insertmacro _UAC_ParseDefineFlags_orin _UAC_PDF${_outdef}_parse _UAC_PDF${_outdef}_flags ;0x10
!macroend
!macro _UAC_ParseDefineFlags_End _outdef
!define ${_outdef} ${_UAC_PDF${_outdef}_r}
!undef _UAC_PDF${_outdef}_r
!undef _UAC_PDF${_outdef}_flags
!undef _UAC_PDF${_outdef}_parse
!macroend
!macro _UAC_ParseDefineFlags_IncludeFlag _outdef flag
!if ${_UAC_PDF${_outdef}_flags} & ${flag}
!insertmacro _UAC_definemath _UAC_PDF${_outdef}_r ${_UAC_PDF${_outdef}_r} | ${flag}
!endif
!macroend
!macro _UAC_ParseDefineFlagsToInt _outdef _in
!insertmacro _UAC_ParseDefineFlags_Begin _UAC_ParseDefineFlagsToInt_tmp "${_in}"
!define ${_outdef} ${_UAC_PDF_UAC_ParseDefineFlagsToInt_tmp_flags}
!insertmacro _UAC_ParseDefineFlags_End _UAC_ParseDefineFlagsToInt_tmp
!undef _UAC_ParseDefineFlagsToInt_tmp
!macroend
!macro _UAC_IncL
!insertmacro _UAC_definemath __UAC_L "${__UAC_L}" + 1
!macroend
!macro _UAC_AsUser_GenOp outvar op opparam1 opparam2
!define _UAC_AUGOGR_ID _UAC_AUGOGR_OP${outvar}${op}${opparam1}${opparam2}
!ifndef ${_UAC_AUGOGR_ID} ;Has this exact action been done before?
!if ${outvar} == $0
!define ${_UAC_AUGOGR_ID} $1
!else
!define ${_UAC_AUGOGR_ID} $0
!endif
!if "${opparam1}" == ""
!define _UAC_AUGOGR_OPP1 ${${_UAC_AUGOGR_ID}}
!define _UAC_AUGOGR_OPP2 ${opparam2}
!else
!define _UAC_AUGOGR_OPP1 ${opparam1}
!define _UAC_AUGOGR_OPP2 ${${_UAC_AUGOGR_ID}}
!endif
goto ${_UAC_AUGOGR_ID}_C
${_UAC_AUGOGR_ID}_F:
${op} ${_UAC_AUGOGR_OPP1} ${_UAC_AUGOGR_OPP2}
return
${_UAC_AUGOGR_ID}_C:
!undef _UAC_AUGOGR_OPP1
!undef _UAC_AUGOGR_OPP2
!endif
push ${${_UAC_AUGOGR_ID}}
!insertmacro UAC_AsUser_Call Label ${_UAC_AUGOGR_ID}_F ${UAC_SYNCREGISTERS}
StrCpy ${outvar} ${${_UAC_AUGOGR_ID}}
pop ${${_UAC_AUGOGR_ID}}
!undef _UAC_AUGOGR_ID
!macroend
!verbose pop
!endif /* UAC_HDR__INC */

View File

@ -0,0 +1,28 @@
!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess`
!macro nsProcess::FindProcess _FILE _ERR
nsProcess::_FindProcess /NOUNLOAD `${_FILE}`
Pop ${_ERR}
!macroend
!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess`
!macro nsProcess::KillProcess _FILE _ERR
nsProcess::_KillProcess /NOUNLOAD `${_FILE}`
Pop ${_ERR}
!macroend
!define nsProcess::CloseProcess `!insertmacro nsProcess::CloseProcess`
!macro nsProcess::CloseProcess _FILE _ERR
nsProcess::_CloseProcess /NOUNLOAD `${_FILE}`
Pop ${_ERR}
!macroend
!define nsProcess::Unload `!insertmacro nsProcess::Unload`
!macro nsProcess::Unload
nsProcess::_Unload
!macroend

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,12 @@
# windeployqt should be used here, but since we get the `Not implemented` error from it, we're trying to manually copy artifacts to output directory
set(TARGET_DIR "${@APP_NAME@_BINARY_DIR}")
##########################################################################################################
#
# NOTE: Remember to reflect any changes on the setup generation procedure in /deployment/windows/nsis/setup.nsi
#
##########################################################################################################
set(qtmodules Core Quick QuickTemplates2 QuickControls2 WebSockets Widgets Gui Network Svg Qml Concurrent)
if(USE_QTWEBKIT)
set(qtmodules ${qtmodules} Multimedia WebKit WebKitWidgets WebChannel)

View File

@ -18,7 +18,7 @@ RUN apt-get update && apt-get -q -y --no-install-recommends install curl softwar
apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get -q -y --no-install-recommends install \
wget git zip unzip golang-go nodejs yarn file jq \
wget git nsis unzip golang-go nodejs yarn file jq \
python python3-pip python3-setuptools python3-wheel \
apt-transport-https locales openjdk-8-jdk-headless \
extra-cmake-modules build-essential fuse \

View File

@ -1,7 +1,7 @@
GIT_COMMIT = $(shell git rev-parse --short HEAD)
IMAGE_TAG = 1.0.0
IMAGE_NAME = statusteam/windows-desktop-ubuntu:$(IMAGE_TAG)
IMAGE_NAME = statusteam/windows-desktop-ubuntu:nsis-$(IMAGE_TAG)
build:
docker build \

View File

@ -47,7 +47,11 @@ const int MAIN_WINDOW_WIDTH = 1024;
const int MAIN_WINDOW_HEIGHT = 768;
const QString CRASH_REPORT_EXECUTABLE = QStringLiteral("reportApp");
const QString CRASH_REPORT_EXECUTABLE_RELATIVE_PATH =
#ifdef Q_OS_WIN
QStringLiteral("");
#else
QStringLiteral("/../reportApp");
#endif
const char *ENABLE_LOG_FILE_ENV_VAR_NAME = "STATUS_LOG_FILE_ENABLED";
const char *LOG_FILE_PATH_ENV_VAR_NAME = "STATUS_LOG_PATH";

View File

@ -213,7 +213,14 @@ function compile() {
function bundleWindows() {
local buildType="$1"
# TODO: Produce a setup program instead of a ZIP
local version_file="${STATUSREACTPATH}/desktop_files/VERSION"
VERSION=$(cat $version_file)
if [ -z "$VERSION" ]; then
echo "${RED}Could not read version from ${version_file}!${NC}"
exit 1
fi
pushd $WORKFOLDER
rm -rf Windows
mkdir Windows
@ -224,30 +231,33 @@ function bundleWindows() {
fi
unzip "$STATUSIM_WINDOWS_BASEIMAGE_ZIP" -d Windows/
rm -f Status-Windows-x86_64.zip
pushd Windows
cp $STATUSREACTPATH/.env .
mkdir -p assets/resources notifier
cp $STATUSREACTPATH/node_modules/node-notifier/vendor/snoreToast/SnoreToast.exe .
cp $STATUSREACTPATH/node_modules/node-notifier/vendor/notifu/*.exe notifier/
cp -r $STATUSREACTPATH/resources/fonts \
$STATUSREACTPATH/resources/icons \
$STATUSREACTPATH/resources/images \
assets/resources/
local _bin=$STATUSREACTPATH/desktop/bin
rm -rf $_bin/cmake_install.cmake $_bin/Makefile $_bin/CMakeFiles $_bin/Status_autogen && \
cp -r $_bin/* .
local zipOptions="-mr9"
if [ -z $buildType ]; then
zipOptions="-mr1"
elif [ "$buildType" = "pr" ]; then
zipOptions="-mr2"
fi
zip $zipOptions ../../Status-Windows-x86_64.zip .
pushd $STATUSREACTPATH/desktop/bin
rm -rf cmake_install.cmake Makefile CMakeFiles Status_autogen
popd
rm -rf Windows
popd
local compressionAlgo="lzma"
local compressionType="/SOLID"
if [ -z $buildType ]; then
compressionAlgo="bzip2"
compressionType=""
elif [ "$buildType" = "pr" ]; then
compressionAlgo="zlib"
fi
local top_srcdir=$(joinExistingPath "$STATUSREACTPATH" '.')
VERSION_MAJOR="$(cut -d'.' -f1 <<<"$VERSION")"
VERSION_MINOR="$(cut -d'.' -f2 <<<"$VERSION")"
VERSION_BUILD="$(cut -d'.' -f3 <<<"$VERSION")"
makensis -Dtop_srcdir=${top_srcdir} \
-DCOMPRESSION_ALGO=${compressionAlgo} \
-DCOMPRESSION_TYPE=${compressionType} \
-DVERSION_MAJOR=$VERSION_MAJOR \
-DVERSION_MINOR=$VERSION_MINOR \
-DVERSION_BUILD=$VERSION_BUILD \
-DPUBLISHER=Status.im \
-DWEBSITE_URL="https://status.im/" \
./deployment/windows/nsis/setup.nsi
}
function bundleLinux() {

View File

@ -10,6 +10,11 @@ function downloadUrl() {
fi
}
function install_nsis() {
# NSIS (Nullsoft Scriptable Install System) is a professional open source system to create Windows installers. It is designed to be as small and flexible as possible and is therefore very suitable for internet distribution.
linux_install nsis
}
function install_node() {
if nvm_installed; then
install_node_via_nvm

View File

@ -28,6 +28,7 @@ install_wget
install_java8
install_clojure_cli
install_leiningen
install_nsis
install_node
install_watchman
install_react_native_cli