Skip to content

Commit

Permalink
release script
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedAredah committed Jul 24, 2023
1 parent 0f2c5d5 commit 05d5f4c
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 16 deletions.
23 changes: 15 additions & 8 deletions src/NeTrainSimInstaller/NeTrainSimInstaller.pro
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
TEMPLATE = aux

QT_INSTALL_FRAMEWORK_PATH = C:\Qt\Tools\QtInstallerFramework\4.6

include(../mainconfig.pri)
include(create_xml.pri)


!CONFIG(debug, debug|release) {
DESTDIR_NeTrainSim = packages/com.VTTICSM.NeTrainSim/data
DESTDIR_NeTrainSim = packages/com.VTTICSM.NeTrainSim/data
DESTDIR_NeTrainSimGUI = packages/com.VTTICSM.NeTrainSimGUI/data

win32 {
create_package.commands = $$quote("C:\Qt\6.4.2\msvc2019_64\bin\windeployqt.exe" --qmldir ../NeTrainSim/ $${DESTDIR_NeTrainSim})
create_package.commands += $$quote("C:\Qt\6.4.2\msvc2019_64\bin\windeployqt.exe" --qmldir ../NeTrainSimGUI/ $${DESTDIR_NeTrainSimGUI})
create_package.commands = $$quote("C:\Qt\6.4.2\msvc2019_64\bin\windeployqt.exe" --qmldir ../NeTrainSim/ $${DESTDIR_NeTrainSim})
create_package.commands += $$quote("C:\Qt\6.4.2\msvc2019_64\bin\windeployqt.exe" --qmldir ../NeTrainSimGUI/ $${DESTDIR_NeTrainSimGUI})
}

macx {
Expand All @@ -18,12 +23,12 @@ QT_INSTALL_FRAMEWORK_PATH = C:\Qt\Tools\QtInstallerFramework\4.6
PRE_TARGETDEPS += create_package

DISTFILES += \
config/config.xml \
packages/com.VTTICSM.NeTrainSim/meta/package.xml \
config/config.xml.in \
packages/com.VTTICSM.NeTrainSim/meta/installscript.qs \
packages/com.VTTICSM.NeTrainSimGUI/meta/package.xml \
packages/com.VTTICSM.NeTrainSim/meta/package.xml.in \
packages/com.VTTICSM.NeTrainSimGUI/meta/installscript.qs \
../data/*
../data/* \
packages/com.VTTICSM.NeTrainSimGUI/meta/package.xml.in

# copy the manual and sample project to the installer
win32 {
Expand All @@ -45,7 +50,6 @@ QT_INSTALL_FRAMEWORK_PATH = C:\Qt\Tools\QtInstallerFramework\4.6
NeTrainSimInstaller.input = INPUT
NeTrainSimInstaller.output = $$INSTALLER
NeTrainSimInstaller.commands = $$QT_INSTALL_FRAMEWORK_PATH/bin/binarycreator.exe --offline-only -c config/config.xml -p packages ${QMAKE_FILE_OUT}
#NeTrainSimInstaller.CONFIG += target_predeps no_link combine
win32 {
NeTrainSimInstaller.clean_commands += $$quote(del ..\NeTrainSim\NeTrainSimInstaller\packages\com.VTTICSM.NeTrainSim\data /Q)
NeTrainSimInstaller.clean_commands += & for /d %%x in (..\NeTrainSim\NeTrainSimInstaller\packages\com.VTTICSM.NeTrainSim\data\*) do rd /s /q "%%x"
Expand All @@ -58,3 +62,6 @@ QT_INSTALL_FRAMEWORK_PATH = C:\Qt\Tools\QtInstallerFramework\4.6
QMAKE_EXTRA_COMPILERS += NeTrainSimInstaller

}

OTHER_FILES += \
config/installscript.qs
2 changes: 2 additions & 0 deletions src/NeTrainSimInstaller/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
<Logo>icon.png</Logo>
<StartMenuDir>NeTrainSim</StartMenuDir>
<TargetDir>@ApplicationsDirX64@/NeTrainSim</TargetDir>
<RunProgram>@TargetDir@/NeTrainSimGUI.exe</RunProgram>
<ControlScript>installscript.qs</ControlScript>
</Installer>
14 changes: 14 additions & 0 deletions src/NeTrainSimInstaller/config/config.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>NeTrainSim</Name>
<Version>$$VERSION</Version>
<Title>NeTrainSim Installer</Title>
<Publisher>Virginia Tech Transportation Institute - Center for Sustainable Mobility</Publisher>
<InstallerWindowIcon>../../NeTrainSimGUI/resources/icon.png</InstallerWindowIcon>
<InstallerApplicationIcon>../../NeTrainSimGUI/resources/icon</InstallerApplicationIcon>
<Logo>icon.png</Logo>
<StartMenuDir>NeTrainSim</StartMenuDir>
<TargetDir>@ApplicationsDirX64@/NeTrainSim</TargetDir>
<RunProgram>@TargetDir@/NeTrainSimGUI.exe</RunProgram>
<ControlScript>installscript.qs</ControlScript>
</Installer>
58 changes: 58 additions & 0 deletions src/NeTrainSimInstaller/config/installscript.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
function Controller() {
//installer.autoRejectMessageBoxes();
installer.installationFinished.connect(function() {
//gui.clickButton(buttons.NextButton);
});
}

Controller.prototype.WelcomePageCallback = function() {
//gui.clickButton(buttons.NextButton, 3000);
}

Controller.prototype.CredentialsPageCallback = function() {
//gui.clickButton(buttons.NextButton);
}

Controller.prototype.IntroductionPageCallback = function() {
//gui.clickButton(buttons.NextButton);
}

Controller.prototype.ReadyForInstallationPageCallback = function() {
//gui.clickButton(buttons.CommitButton);
}

Controller.prototype.PerformInstallationPageCallback = function() {
//gui.clickButton(buttons.CommitButton);
}

Controller.prototype.FinishedPageCallback = function() {
var checkBoxForm = gui.currentPageWidget().LaunchCheckBoxForm;
if (checkBoxForm && checkBoxForm.launchCheckBox) {
checkBoxForm.launchCheckBox.checked = false;
}
//gui.clickButton(buttons.FinishButton);
}

Controller.prototype.TargetDirectoryPageCallback = function() {
var targetDir = installer.value("TargetDir");
if (installer.fileExists(targetDir + "/maintenancetool.exe")) {
var buttonPressed = QMessageBox["warning"]("os.QMessageBox", "Warning",
"A previous installation has been detected at " + targetDir +
". Do you want to uninstall it?",
QMessageBox.Yes | QMessageBox.No);

if (buttonPressed == QMessageBox.Yes) {
installer.executeDetached(targetDir + "/maintenancetool.exe",
["--uninstall"]);
} else {
//gui.clickButton(buttons.CancelButton);
}
}
else {
var targetWidget = gui.pageWidgetByObjectName("TargetDirectoryPage");
targetWidget.TargetDirectoryLineEdit.setText(targetDir);
//gui.clickButton(buttons.NextButton);
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Package>
<DisplayName>NeTrainSim</DisplayName>
<Description>NeTrainSim Setup</Description>
<Version>0.1.0</Version>
<ReleaseDate>2023-06-13</ReleaseDate>
<Version>0.1.1</Version>
<ReleaseDate>2023-07-23</ReleaseDate>
<Licenses>
<License name="GPL-3.0 License" file="LICENSE" />
</Licenses>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>NeTrainSim</DisplayName>
<Description>NeTrainSim Setup</Description>
<Version>$$VERSION</Version>
<ReleaseDate>$$RELEASEDATE</ReleaseDate>
<Licenses>
<License name="GPL-3.0 License" file="LICENSE" />
</Licenses>
<Script>installscript.qs</Script>
<Default>true</Default>
</Package>
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ Component.prototype.createOperations = function()

if (systemInfo.productType === "windows") {
// Create a shortcut in the Start Menu
component.addOperation("CreateShortcut", "@TargetDir@/NeTrainSimGUI.exe", "@StartMenuDir@/NeTrainSimGUI.lnk",
"workingDirectory=@TargetDir@", "description=NeTrainSimGUI");
component.addOperation("CreateShortcut",
"@TargetDir@/NeTrainSimGUI.exe",
"@StartMenuDir@/NeTrainSimGUI.lnk",
"workingDirectory=@TargetDir@",
"description=NeTrainSimGUI");

// Create a shortcut on the Desktop
component.addOperation("CreateShortcut", "@TargetDir@/NeTrainSimGUI.exe", "@DesktopDir@/NeTrainSimGUI.lnk",
"workingDirectory=@TargetDir@", "description=NeTrainSimGUI");
component.addOperation("CreateShortcut",
"@TargetDir@/NeTrainSimGUI.exe",
"@DesktopDir@/NeTrainSimGUI.lnk",
"workingDirectory=@TargetDir@",
"description=NeTrainSimGUI");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Package>
<DisplayName>NeTrainSimGUI</DisplayName>
<Description>NeTrainSimGUI Setup</Description>
<Version>0.1.0</Version>
<ReleaseDate>2023-06-13</ReleaseDate>
<Version>0.1.1</Version>
<ReleaseDate>2023-07-23</ReleaseDate>
<Licenses>
<License name="GPL-3.0 License" file="LICENSE" />
</Licenses>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package>
<DisplayName>NeTrainSimGUI</DisplayName>
<Description>NeTrainSimGUI Setup</Description>
<Version>$$VERSION</Version>
<ReleaseDate>$$RELEASEDATE</ReleaseDate>
<Licenses>
<License name="GPL-3.0 License" file="LICENSE" />
</Licenses>
<Script>installscript.qs</Script>
<Default>true</Default>
</Package>

0 comments on commit 05d5f4c

Please sign in to comment.