Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix archivegen for windows installer #2221

Merged
merged 8 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/atomicdex-desktop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name_zip }}
path: ./bundled/windows/bin.zip
path: ./bundled/windows/${{ env.DEX_PROJECT_NAME }}.zip
retention-days: 7

- name: Upload artifacts (Windows installer)
Expand Down
2 changes: 1 addition & 1 deletion ci_tools_atomic_dex/installer/windows/config/config.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ProductUrl>@DEX_WEBSITE@</ProductUrl>
<Publisher>@DEX_COMPANY@</Publisher>
<TargetDir>@DEX_INSTALL_TARGET_DIR_WIN64@/@DEX_DISPLAY_NAME@</TargetDir>
<RunProgram>@DEX_TARGET_DIR@/@DEX_PROJECT_NAME@.exe</RunProgram>
<RunProgram>@DEX_TARGET_DIR@/bin/@DEX_PROJECT_NAME@.exe</RunProgram>
<RunProgramDescription>Run @DEX_DISPLAY_NAME@ now.</RunProgramDescription>
<StartMenuDir>@DEX_DISPLAY_NAME@</StartMenuDir>
<MaintenanceToolName>@DEX_MAINTENANCE_TOOL_NAME@</MaintenanceToolName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ Component.prototype.createOperations = function()
if (installer.value("os") === "win") {
// Start Menu Shortcut
component.addOperation("CreateShortcut",
"@DEX_TARGET_DIR@/@DEX_PROJECT_NAME@.exe",
"@DEX_TARGET_DIR@/bin/@DEX_PROJECT_NAME@.exe",
"@DEX_START_MENU_DIR@/@DEX_DISPLAY_NAME@.lnk",
"workingDirectory=@DEX_TARGET_DIR@",
"workingDirectory=@DEX_TARGET_DIR@/bin",
"iconPath=@DEX_ICON_DIR@", "iconId=0",
"description=Start @DEX_DISPLAY_NAME@");

// Desktop Shortcut
component.addOperation("CreateShortcut",
"@DEX_TARGET_DIR@/@DEX_PROJECT_NAME@.exe",
"@DEX_TARGET_DIR@/bin/@DEX_PROJECT_NAME@.exe",
"@DEX_DESKTOP_DIR@/@DEX_DISPLAY_NAME@.lnk",
"workingDirectory=@DEX_TARGET_DIR@",
"workingDirectory=@DEX_TARGET_DIR@/bin",
"iconPath=@DEX_ICON_DIR@", "iconId=0",
"description=Start @DEX_DISPLAY_NAME@");

Expand Down
3 changes: 1 addition & 2 deletions cmake/install/macos/osx_post_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ get_filename_component(QT_ROOT_DIR $ENV{QT_ROOT} DIRECTORY)
set(IFW_BINDIR ${QT_ROOT_DIR}/Tools/QtInstallerFramework/4.5/bin)
message(STATUS "IFW_BIN PATH IS ${IFW_BINDIR}")
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${DEX_PROJECT_NAME}.7z)
execute_process(COMMAND ls WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
message(STATUS "Generating ${DEX_PROJECT_NAME}.7z with [${IFW_BINDIR}/archivegen ${DEX_PROJECT_NAME}.7z ${DEX_PROJECT_NAME}.app] from directory: ${CMAKE_CURRENT_SOURCE_DIR}/bin")
message(STATUS "command is: [${IFW_BINDIR}/archivegen ${DEX_PROJECT_NAME}.7z ${PROJECT_APP_PATH} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin]")
execute_process(COMMAND
${IFW_BINDIR}/archivegen ${DEX_PROJECT_NAME}.7z ${PROJECT_APP_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin
Expand Down
54 changes: 39 additions & 15 deletions cmake/install/windows/windows_post_install.cmake
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
include(${CMAKE_CURRENT_LIST_DIR}/../../project.metadata.cmake)
message(STATUS "===== Starting Windows Post Install =====")

message(STATUS "PROJECT_ROOT_DIR (before readjusting) -> ${PROJECT_ROOT_DIR}")

get_filename_component(PROJECT_ROOT_DIR ${CMAKE_SOURCE_DIR} DIRECTORY)
if (EXISTS ${PROJECT_ROOT_DIR}/build-Release OR EXISTS ${PROJECT_ROOT_DIR}/build-Debug)
message(STATUS "from ci tools, readjusting")
get_filename_component(PROJECT_ROOT_DIR ${PROJECT_ROOT_DIR} DIRECTORY)
endif ()
message(STATUS "PROJECT_ROOT_DIR (after readjusting) -> ${PROJECT_ROOT_DIR}")

set(PROJECT_APP_DIR bin)
set(PROJECT_APP_PATH ${CMAKE_SOURCE_DIR}/${PROJECT_APP_DIR})
set(PROJECT_APP_PATH ${CMAKE_SOURCE_DIR}/bin)
set(TARGET_APP_PATH ${PROJECT_ROOT_DIR}/bundled/windows)

message(STATUS "VCPKG package manager enabled")
message(STATUS "PROJECT_ROOT_DIR (after readjusting) -> ${PROJECT_ROOT_DIR}")
message(STATUS "PROJECT_QML_DIR -> ${PROJECT_QML_DIR}")
message(STATUS "CMAKE_SOURCE_DIR -> ${CMAKE_SOURCE_DIR}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR -> ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "DEX_PROJECT_NAME -> ${DEX_PROJECT_NAME}")

if (EXISTS ${PROJECT_APP_PATH})
message(STATUS "PROJECT_APP_PATH path is -> ${PROJECT_APP_PATH}")
message(STATUS "TARGET_APP_PATH path is -> ${TARGET_APP_PATH}")
message(STATUS "PROJECT_APP_PATH path -> ${PROJECT_APP_PATH}")
message(STATUS "TARGET_APP_PATH path -> ${TARGET_APP_PATH}")
else ()
message(FATAL_ERROR "Didn't find ${PROJECT_APP_PATH}")
endif ()

if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/bin.zip)
message(STATUS "Creating bin.zip...")
execute_process(COMMAND powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('bin', 'bin.zip'); }"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
ECHO_OUTPUT_VARIABLE
Expand All @@ -35,7 +38,7 @@ endif()

if (NOT EXISTS ${TARGET_APP_PATH}/bin.zip)
message(STATUS "Copying ${CMAKE_SOURCE_DIR}/bin.zip to ${TARGET_APP_PATH}/${DEX_PROJECT_NAME}.zip")
file(COPY ${CMAKE_SOURCE_DIR}/bin.zip DESTINATION ${TARGET_APP_PATH})
file(COPY ${CMAKE_SOURCE_DIR}/bin.zip DESTINATION ${TARGET_APP_PATH}/${DEX_PROJECT_NAME}.zip)
else()
message(STATUS "${TARGET_APP_PATH}/${DEX_PROJECT_NAME}.zip exists - skipping")
endif()
Expand All @@ -44,15 +47,21 @@ message(STATUS "Embedding the manifest")
if (NOT EXISTS ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/packages/com.komodoplatform.atomicdex/data/${DEX_PROJECT_NAME}.exe.manifest)
message(WARNING "${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/packages/com.komodoplatform.atomicdex/data/${DEX_PROJECT_NAME}.exe.manifest doesn't exist - aborting")
endif()
file(COPY ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/packages/com.komodoplatform.atomicdex/data/${DEX_PROJECT_NAME}.exe.manifest DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)
file(COPY ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/packages/com.komodoplatform.atomicdex/data/${DEX_PROJECT_NAME}.exe.manifest DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/bin)

#FILE(GLOB CURDIR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/ ${CMAKE_CURRENT_SOURCE_DIR}/bin/*)
#message(STATUS "curdir: ${CURDIR}")

message(STATUS "curdir: ${CURDIR}")

#message(STATUS "Executing: [mt.exe -manifest \"${DEX_PROJECT_NAME}.exe.manifest\" -outputresource:\"${DEX_PROJECT_NAME}.exe\";\#1] from directory: ${CMAKE_CURRENT_SOURCE_DIR}/bin")

set(DEX_OUT "${CMAKE_CURRENT_SOURCE_DIR}\\bin\\${DEX_PROJECT_NAME}.exe")
set(DEX_IN "${CMAKE_CURRENT_SOURCE_DIR}\\bin\\${DEX_PROJECT_NAME}.exe.manifest")
cmake_path(CONVERT ${DEX_OUT} TO_NATIVE_PATH_LIST DEX_OUT_NATIVE)
cmake_path(CONVERT ${DEX_IN} TO_NATIVE_PATH_LIST DEX_IN_NATIVE)

#message(STATUS "mt.exe -manifest ${DEX_IN_NATIVE} -outputresource:${DEX_OUT_NATIVE}")

execute_process(COMMAND powershell.exe -File ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/ci_scripts/mt_wrapper.ps1 ${DEX_IN} ${DEX_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin
ECHO_ERROR_VARIABLE
Expand All @@ -64,10 +73,17 @@ message(STATUS "manifest output: ${MANIFEST_RESULT} ${MANIFEST_OUTPUT} ${MANIFES
message(STATUS "Creating Installer")
set(IFW_BINDIR $ENV{QT_ROOT}/Tools/QtInstallerFramework/4.5/bin)
message(STATUS "IFW_BIN PATH IS ${IFW_BINDIR}")
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${DEX_PROJECT_NAME}.7z)
message(STATUS "command is: [${IFW_BINDIR}/archivegen.exe ${DEX_PROJECT_NAME}.7z .]")
execute_process(COMMAND ${IFW_BINDIR}/archivegen.exe ${DEX_PROJECT_NAME}.7z .
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${DEX_PROJECT_NAME}.7z)
message(STATUS "Contents of folder: ls ${CMAKE_CURRENT_SOURCE_DIR}")
execute_process(COMMAND ls "${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "Contents of folder: ls ${CMAKE_CURRENT_SOURCE_DIR}/bin")
execute_process(COMMAND ls "${CMAKE_CURRENT_SOURCE_DIR}/bin")
message(STATUS "Contents of folder: ls ${CMAKE_CURRENT_SOURCE_DIR}/bundled")
execute_process(COMMAND ls "${CMAKE_CURRENT_SOURCE_DIR}/bundled")
message(STATUS "command is: [${IFW_BINDIR}/archivegen.exe ${DEX_PROJECT_NAME}.7z ${PROJECT_APP_PATH} WORKING_DIRECTORY ${PROJECT_ROOT_DIR}/bundled]")
execute_process(COMMAND
${IFW_BINDIR}/archivegen.exe ${DEX_PROJECT_NAME}.7z ${PROJECT_APP_PATH}
WORKING_DIRECTORY ${PROJECT_ROOT_DIR}/bundled
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE
RESULT_VARIABLE ARCHIVE_RESULT
Expand All @@ -78,10 +94,18 @@ else()
message(STATUS "${DEX_PROJECT_NAME}.7z already exists skipping")
endif()

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${DEX_PROJECT_NAME}.7z DESTINATION ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/packages/com.komodoplatform.atomicdex/data)
message(STATUS "Contents of folder: ls ${PROJECT_APP_PATH}")
execute_process(COMMAND ls "${PROJECT_APP_PATH}")

file(COPY ${PROJECT_ROOT_DIR}/bundled/${DEX_PROJECT_NAME}.7z DESTINATION ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/packages/com.komodoplatform.atomicdex/data)

execute_process(COMMAND ${IFW_BINDIR}/binarycreator.exe -c ./config/config.xml -p ./packages/ ${DEX_PROJECT_NAME}_installer.exe
WORKING_DIRECTORY ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows
ECHO_OUTPUT_VARIABLE
ECHO_ERROR_VARIABLE)
file(COPY ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/${DEX_PROJECT_NAME}_installer.exe DESTINATION ${TARGET_APP_PATH})
file(COPY ${PROJECT_ROOT_DIR}/ci_tools_atomic_dex/installer/windows/${DEX_PROJECT_NAME}_installer.exe DESTINATION ${TARGET_APP_PATH})

message(STATUS "Contents of folder: ls ${TARGET_APP_PATH}")
execute_process(COMMAND ls "${TARGET_APP_PATH}")

message(STATUS "===== Windows Post Install Complete =====")
6 changes: 6 additions & 0 deletions cmake/project.metadata.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ if (DEFINED ENV{PROJECT_ROOT})
else ()
set(PROJECT_ROOT ${CMAKE_SOURCE_DIR})
endif ()
if (DEFINED ENV{CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
endif ()
if (DEFINED ENV{PROJECT_QML_DIR})
set(PROJECT_QML_DIR $ENV{PROJECT_QML_DIR})
endif ()


# Shows project metadata
Expand Down