'win32' and 'win64' release targets now build 'old' zip alongside with 'new' installer .exe

pull/1541/head
ErNis 2 years ago
parent f53d2b166b
commit c4f4bb0f67

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@ -0,0 +1,169 @@
; ------------------------------------------
; Installer for INAV
; ------------------------------------------
; It receives from the command line with /D the parameters:
; version
; archName
; archAllowed
; archInstallIn64bit
; sourceFolder
; targetFolder
#define ApplicationName "INAV Configurator"
#define CompanyName "The INAV open source project"
#define CompanyUrl "https://github.com/iNavFlight/inav"
#define ExecutableFileName "inav-configurator.exe"
#define GroupName "INAV"
#define InstallerFileName "INAV-Configurator_" + archName + "-installer" + "_" + version
#define SourcePath "..\..\" + sourceFolder + "\inav-configurator\" + archName
#define TargetFolderName "INAV-Configurator"
#define UpdatesUrl "https://github.com/iNavFlight/inav-configurator/releases"
[CustomMessages]
AppName=inav-configurator
LaunchProgram=Start {#ApplicationName}
[Files]
Source: "{#SourcePath}\*"; DestDir: "{app}"; Flags: recursesubdirs
[Icons]
; Programs group
Name: "{group}\{#ApplicationName}"; Filename: "{app}\{#ExecutableFileName}";
; Desktop icon
Name: "{autodesktop}\{#ApplicationName}"; Filename: "{app}\{#ExecutableFileName}";
; Non admin users, uninstall icon
Name: "{group}\Uninstall {#ApplicationName}"; Filename: "{uninstallexe}"; Check: not IsAdminInstallMode
[Languages]
; English default, it must be first
Name: "en"; MessagesFile: "compiler:Default.isl"
; Official languages
;Name: "ca"; MessagesFile: "compiler:Languages\Catalan.isl"
;Name: "da"; MessagesFile: "compiler:Languages\Danish.isl"
;Name: "de"; MessagesFile: "compiler:Languages\German.isl"
;Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl"
;Name: "fr"; MessagesFile: "compiler:Languages\French.isl"
;Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
;Name: "ja"; MessagesFile: "compiler:Languages\Japanese.isl"
;Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl"
;Name: "pt"; MessagesFile: "compiler:Languages\Portuguese.isl"
;Name: "pl"; MessagesFile: "compiler:Languages\Polish.isl"
;Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl"
; Not official. Sometimes not updated to latest version (strings missing)
;Name: "ga"; MessagesFile: "unofficial_inno_languages\Galician.isl"
;Name: "eu"; MessagesFile: "unofficial_inno_languages\Basque.isl"
;Name: "hr"; MessagesFile: "unofficial_inno_languages\Croatian.isl"
;Name: "hu"; MessagesFile: "unofficial_inno_languages\Hungarian.isl"
;Name: "id"; MessagesFile: "unofficial_inno_languages\Indonesian.isl"
;Name: "ko"; MessagesFile: "unofficial_inno_languages\Korean.isl"
;Name: "lv"; MessagesFile: "unofficial_inno_languages\Latvian.isl"
;Name: "sv"; MessagesFile: "unofficial_inno_languages\Swedish.isl"
;Name: "zh_CN"; MessagesFile: "unofficial_inno_languages\ChineseSimplified.isl"
;Name: "zh_TW"; MessagesFile: "unofficial_inno_languages\ChineseTraditional.isl"
; Not available
; pt_BR (Portuguese Brasileiro)
[Run]
; Add a checkbox to start the app after installed
Filename: {app}\{cm:AppName}.exe; Description: {cm:LaunchProgram,{cm:AppName}}; Flags: nowait postinstall skipifsilent
[Setup]
AppId=2e5662ca-1fb3-8f1e-a7e1-e390add7a19d
AppName={#ApplicationName}
AppPublisher={#CompanyName}
AppPublisherURL={#CompanyUrl}
AppUpdatesURL={#UpdatesUrl}
AppVersion={#version}
ArchitecturesAllowed={#archAllowed}
ArchitecturesInstallIn64BitMode={#archInstallIn64bit}
Compression=lzma2
DefaultDirName={autopf}\{#GroupName}\{#TargetFolderName}
DefaultGroupName={#GroupName}\{#ApplicationName}
LicenseFile=..\..\LICENSE
MinVersion=6.2
OutputBaseFilename={#InstallerFileName}
OutputDir=..\..\{#targetFolder}\
PrivilegesRequiredOverridesAllowed=commandline dialog
SetupIconFile=inav_installer_icon.ico
ShowLanguageDialog=yes
SolidCompression=yes
UninstallDisplayIcon={app}\{#ExecutableFileName}
UninstallDisplayName={#ApplicationName}
WizardImageFile=inav_installer.bmp
WizardSmallImageFile=inav_installer_small.bmp
WizardStyle=modern
[Code]
function GetOldNsisUninstallerPath(): String;
var
RegKey: String;
begin
Result := '';
// Look into the different registry entries: win32, win64 and without user rights
if not RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\INAV Configurator', 'UninstallString', Result) then
begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\INAV Configurator', 'UninstallString', Result) then
begin
RegQueryStringValue(HKCU, 'SOFTWARE\INAV\INAV Configurator', 'UninstallString', Result)
end;
end;
end;
function GetQuietUninstallerPath(): String;
var
RegKey: String;
begin
Result := '';
RegKey := Format('%s\%s_is1', ['Software\Microsoft\Windows\CurrentVersion\Uninstall', '{#emit SetupSetting("AppId")}']);
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, RegKey, 'QuietUninstallString', Result) then
begin
RegQueryStringValue(HKEY_CURRENT_USER, RegKey, 'QuietUninstallString', Result);
end;
end;
function InitializeSetup(): Boolean;
var
ResultCode: Integer;
ParameterStr : String;
UninstPath : String;
begin
Result := True;
// Check if the application is already installed by the old NSIS installer, and uninstall it
UninstPath := GetOldNsisUninstallerPath();
// Found, start uninstall
if UninstPath <> '' then
begin
UninstPath := RemoveQuotes(UninstPath);
// Add this parameter to not return until uninstall finished. The drawback is that the uninstaller file is not deleted
ParameterStr := '_?=' + ExtractFilePath(UninstPath);
if Exec(UninstPath, ParameterStr, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// Delete the unistaller file and empty folders. Not deleting the files.
DeleteFile(UninstPath);
DelTree(ExtractFilePath(UninstPath), True, False, True);
end
else begin
Result := False;
MsgBox('Error uninstalling old Configurator ' + SysErrorMessage(ResultCode) + '.', mbError, MB_OK);
end;
end
else begin
// Search for new Inno Setup installations
UninstPath := GetQuietUninstallerPath();
if UninstPath <> '' then
begin
if not Exec('>', UninstPath, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
Result := False;
MsgBox('Error uninstalling Configurator ' + SysErrorMessage(ResultCode) + '.', mbError, MB_OK);
end;
end;
end;
end;

@ -284,15 +284,18 @@ function get_nw_version() {
return semver.valid(semver.coerce(require('./package.json').dependencies.nw));
}
function get_release_filename(platform, ext) {
function get_release_filename(platform, ext, addition = '') {
var pkg = require('./package.json');
return 'INAV-Configurator_' + platform + '_' + pkg.version + '.' + ext;
return 'INAV-Configurator_' + platform + addition + '_' + pkg.version + '.' + ext;
}
gulp.task('release-win32', function() {
gulp.task('release-win32', function(done) {
var pkg = require('./package.json');
// Create ZIP
console.log('Creating x86 ZIP file...');
var src = path.join(appsDir, pkg.name, 'win32');
var output = fs.createWriteStream(path.join(appsDir, get_release_filename('win32', 'zip')));
var output = fs.createWriteStream(path.join(appsDir, get_release_filename('win32', 'zip', '-portable')));
var archive = archiver('zip', {
zlib: { level: 9 }
});
@ -300,21 +303,92 @@ gulp.task('release-win32', function() {
archive.on('error', function(err) { throw err; });
archive.pipe(output);
archive.directory(src, 'INAV Configurator');
return archive.finalize();
archive.finalize();
// Create Installer
console.log('Creating x86 Installer...');
const innoSetup = require('@quanle94/innosetup');
const APPS_DIR = './apps/';
var arch = 'win32';
// Parameters passed to the installer script
const parameters = [];
// Extra parameters to replace inside the iss file
parameters.push(`/Dversion=${pkg.version}`);
parameters.push(`/DarchName=${arch}`);
parameters.push(`/DarchAllowed=${(arch === 'win32') ? 'x86 x64' : 'x64'}`);
parameters.push(`/DarchInstallIn64bit=${(arch === 'win32') ? '' : 'x64'}`);
parameters.push(`/DsourceFolder=${APPS_DIR}`);
parameters.push(`/DtargetFolder=${APPS_DIR}`);
// Show only errors in console
parameters.push(`/Q`);
// Script file to execute
parameters.push("assets/windows/installer.iss");
innoSetup(parameters, {},
function(error) {
if (error != null) {
console.error(`Installer for platform ${arch} finished with error ${error}`);
} else {
console.log(`Installer for platform ${arch} finished`);
}
done();
});
});
gulp.task('release-win64', function() {
gulp.task('release-win64', function(done) {
var pkg = require('./package.json');
// Create ZIP
console.log('Creating x64 ZIP file...');
var src = path.join(appsDir, pkg.name, 'win64');
var output = fs.createWriteStream(path.join(appsDir, get_release_filename('win64', 'zip')));
var output = fs.createWriteStream(path.join(appsDir, get_release_filename('win64', 'zip', '-portable')));
var archive = archiver('zip', {
zlib: { level: 9 }
zlib: { level: 9 }
});
archive.on('warning', function(err) { throw err; });
archive.on('error', function(err) { throw err; });
archive.pipe(output);
archive.directory(src, 'INAV Configurator');
return archive.finalize();
archive.finalize();
// Create Installer
console.log('Creating x64 Installer...');
const innoSetup = require('@quanle94/innosetup');
const APPS_DIR = './apps/';
var arch = 'win64';
// Parameters passed to the installer script
const parameters = [];
// Extra parameters to replace inside the iss file
parameters.push(`/Dversion=${pkg.version}`);
parameters.push(`/DarchName=${arch}`);
parameters.push(`/DarchAllowed=${(arch === 'win32') ? 'x86 x64' : 'x64'}`);
parameters.push(`/DarchInstallIn64bit=${(arch === 'win32') ? '' : 'x64'}`);
parameters.push(`/DsourceFolder=${APPS_DIR}`);
parameters.push(`/DtargetFolder=${APPS_DIR}`);
// Show only errors in console
parameters.push(`/Q`);
// Script file to execute
parameters.push("assets/windows/installer.iss");
innoSetup(parameters, {},
function(error) {
if (error != null) {
console.error(`Installer for platform ${arch} finished with error ${error}`);
} else {
console.log(`Installer for platform ${arch} finished`);
}
done();
});
});
gulp.task('release-osx64', function(done) {
@ -340,7 +414,7 @@ gulp.task('release-osx64', function(done) {
const zipFilename = path.join(appsDir, get_release_filename('macOS', 'zip'));
var output = fs.createWriteStream(zipFilename);
var archive = archiver('zip', {
zlib: { level: 9 }
zlib: { level: 9 }
});
archive.on('warning', function(err) { throw err; });
archive.on('error', function(err) { throw err; });

8677
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -45,6 +45,7 @@
},
"devDependencies": {
"nw-builder": "^3.5.7",
"semver": "6.3.0"
"semver": "6.3.0",
"@quanle94/innosetup": "^6.0.2"
}
}

Loading…
Cancel
Save