From de02724219c72c6f1deb358c934d05a2e5e9f5c7 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:07:44 +0000 Subject: [PATCH 01/72] Add .gitlab-ci.yml --- .gitlab-ci.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f7eb815 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,50 @@ +image: rabis/qt:5.9-desktop + +before_script: + - sudo apt install --no-install-recommends upx zip + - qmake --version + - ./scripts/configure_ubuntu.sh + +build ubuntu x86_64: + stage: build + tags: + - ubuntu + - x86_64 + script: + - qmake + - make -j4 + - upx --lzma -9 --force bin/Attorney_Online + +deploy: + stage: deploy + tags: + - ubuntu + - x86_64 + script: + - mkdir artifact + - cd artifact + + # Base folder + - mkdir base + - mkdir base/themes + - cp -a ../base/themes/default base/themes/ + - cp -a ../base/config.ini base/config.sample.ini + - cp -a ../base/serverlist.txt base/serverlist.sample.txt + + # Miscellaneous files + - cp -a ../README.md README.md.txt + - cp -a ../LICENSE.MIT LICENSE.txt + + # Shared libraries + - cp -a ../lib/* . + + # Platform-specific + - cp -a ../bin/Attorney_Online . + - echo "#!/bin/sh" >> ./run.sh + - echo "LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./Attorney_Online" >> ./run.sh + - chmod +x ./run.sh + + # Zipping + # zip -r -9 -l Attorney_Online_$(git describe --tags)_linux_x86_64.zip . + - tar cavf Attorney_Online_$(git describe --tags)_x64.tar.xz * + - echo "Deployment completed - can we move on with the script now?" \ No newline at end of file From 429b55227e0c9b5fba05c89e02ed39953ba4589b Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:19:17 +0000 Subject: [PATCH 02/72] Fix tags in .gitlab-ci.yml --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7eb815..c3bff37 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,10 +5,10 @@ before_script: - qmake --version - ./scripts/configure_ubuntu.sh -build ubuntu x86_64: +build linux x86_64: stage: build tags: - - ubuntu + - linux - x86_64 script: - qmake @@ -18,7 +18,7 @@ build ubuntu x86_64: deploy: stage: deploy tags: - - ubuntu + - linux - x86_64 script: - mkdir artifact From c3e75f205f076f7a87e10942c24b4272cca833cd Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:22:33 +0000 Subject: [PATCH 03/72] Update .gitlab-ci.yml --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c3bff37..e4176f7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,8 +8,8 @@ before_script: build linux x86_64: stage: build tags: + - docker - linux - - x86_64 script: - qmake - make -j4 @@ -18,8 +18,8 @@ build linux x86_64: deploy: stage: deploy tags: + - docker - linux - - x86_64 script: - mkdir artifact - cd artifact From deee5aad76e1e626a529a1480d94a1c4510d2055 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:23:06 +0000 Subject: [PATCH 04/72] Fix Docker image name in .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e4176f7..aaaecdd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: rabis/qt:5.9-desktop +image: rabits/qt:5.9-desktop before_script: - sudo apt install --no-install-recommends upx zip From 0f61d8fcee9b4dda16a9851cd1fa6661b060240e Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:25:01 +0000 Subject: [PATCH 05/72] Update .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aaaecdd..15f039c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ image: rabits/qt:5.9-desktop before_script: - - sudo apt install --no-install-recommends upx zip + - sudo apt-get install --no-install-recommends -y upx zip - qmake --version - ./scripts/configure_ubuntu.sh From 9f816e16fd59dc0d84b0f8e2c19e6cedc3971e24 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:26:41 +0000 Subject: [PATCH 06/72] Update .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15f039c..696ea52 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ image: rabits/qt:5.9-desktop before_script: - - sudo apt-get install --no-install-recommends -y upx zip + - sudo apt-get install --no-install-recommends -y upx zip unzip - qmake --version - ./scripts/configure_ubuntu.sh From a37212ae7cc483220dc3790fb8800c0a009adce2 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:29:21 +0000 Subject: [PATCH 07/72] Update .gitlab-ci.yml --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 696ea52..01ee7da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: rabits/qt:5.9-desktop before_script: - sudo apt-get install --no-install-recommends -y upx zip unzip - qmake --version + - mkdir lib - ./scripts/configure_ubuntu.sh build linux x86_64: From 15247eeb767f35b9257c69335482c0676e982498 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:33:22 +0000 Subject: [PATCH 08/72] Update .gitlab-ci.yml --- .gitlab-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 01ee7da..9381c87 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,12 @@ image: rabits/qt:5.9-desktop before_script: - - sudo apt-get install --no-install-recommends -y upx zip unzip + - echo Current working directory is $(pwd) - qmake --version - - mkdir lib - - ./scripts/configure_ubuntu.sh + - sudo apt-get install --no-install-recommends -y upx zip unzip + - cd scripts + - ./configure_ubuntu.sh + - cd .. build linux x86_64: stage: build From 291206587013c1c565563cb630d5ab0db2281b63 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:44:27 +0000 Subject: [PATCH 09/72] Update .gitlab-ci.yml --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9381c87..533533f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: rabits/qt:5.9-desktop before_script: - echo Current working directory is $(pwd) - qmake --version + - gcc --version - sudo apt-get install --no-install-recommends -y upx zip unzip - cd scripts - ./configure_ubuntu.sh From 4860be3cdf27662a27bc732ddf120b0301aa0663 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:43:57 +0000 Subject: [PATCH 10/72] Update Attorney_Online.pro for C++14 (cherry picked from commit 032ba33ecff1b108fb1c12d06c14e26d86b21a60) --- Attorney_Online.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 39366c0..c0bc4ab 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -14,7 +14,7 @@ SOURCES += $$files($$PWD/src/*.cpp) HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib -lbass -ldiscord-rpc -CONFIG += c++11 +CONFIG += c++14 RESOURCES += resources.qrc From 9008ec8d9d41e8ce523ecad5ad310fed2dfb3d8c Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 02:49:00 +0000 Subject: [PATCH 11/72] Remove constexpr from aoapplication.h --- include/aoapplication.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 44aef7a..e698030 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -94,9 +94,9 @@ public: //////////////////versioning/////////////// - constexpr int get_release() const { return RELEASE; } - constexpr int get_major_version() const { return MAJOR_VERSION; } - constexpr int get_minor_version() const { return MINOR_VERSION; } + int get_release() const { return RELEASE; } + int get_major_version() const { return MAJOR_VERSION; } + int get_minor_version() const { return MINOR_VERSION; } QString get_version_string(); /////////////////////////////////////////// From 21c9632de0e7132013291c22bff9117fac4f6c70 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Mon, 21 Jan 2019 03:06:30 +0000 Subject: [PATCH 12/72] Add cache and artifacts to .gitlab-ci.yml --- .gitlab-ci.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 533533f..b9c966d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,10 @@ image: rabits/qt:5.9-desktop +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - lib/ + before_script: - echo Current working directory is $(pwd) - qmake --version @@ -18,9 +23,14 @@ build linux x86_64: - qmake - make -j4 - upx --lzma -9 --force bin/Attorney_Online + artifacts: + paths: + - bin/ deploy: stage: deploy + dependencies: + - build linux x86_64 tags: - docker - linux @@ -50,5 +60,10 @@ deploy: # Zipping # zip -r -9 -l Attorney_Online_$(git describe --tags)_linux_x86_64.zip . - - tar cavf Attorney_Online_$(git describe --tags)_x64.tar.xz * - - echo "Deployment completed - can we move on with the script now?" \ No newline at end of file + - mkdir ../zip + - tar cavf ../zip/Attorney_Online_$(git describe --tags)_x64.tar.xz * + - sha1sum ../zip/* + + artifacts: + paths: + - zip/ \ No newline at end of file From 9c895ae6c4410f6b352986481f47cff59993a819 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Fri, 25 Jan 2019 02:13:49 +0000 Subject: [PATCH 13/72] Add Windows static target to .gitlab-ci.yml (incomplete) --- .gitlab-ci.yml | 73 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9c966d..f1ba670 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,3 @@ -image: rabits/qt:5.9-desktop - cache: key: ${CI_COMMIT_REF_SLUG} paths: @@ -15,6 +13,7 @@ before_script: - cd .. build linux x86_64: + image: rabits/qt:5.9-desktop stage: build tags: - docker @@ -27,7 +26,35 @@ build linux x86_64: paths: - bin/ -deploy: +build windows i686: + image: fffaraz/qt + stage: build + tags: + - docker + - linux + script: + - qmake + - make -j4 + - upx --lzma -9 --force bin/Attorney_Online.exe + +# Base folder +.deploy_base: &deploy_base + - mkdir base + - mkdir base/themes + - cp -a ../base/themes/default base/themes/ + - cp -a ../base/config.ini base/config.sample.ini + - cp -a ../base/serverlist.txt base/serverlist.sample.txt + +# Miscellaneous files +.deploy_misc: &deploy_misc + - cp -a ../README.md README.md.txt + - cp -a ../LICENSE.MIT LICENSE.txt + +# Shared libraries +.deploy_libs: &deploy_libs + - cp -a ../lib/* . + +deploy linux: stage: deploy dependencies: - build linux x86_64 @@ -37,20 +64,9 @@ deploy: script: - mkdir artifact - cd artifact - - # Base folder - - mkdir base - - mkdir base/themes - - cp -a ../base/themes/default base/themes/ - - cp -a ../base/config.ini base/config.sample.ini - - cp -a ../base/serverlist.txt base/serverlist.sample.txt - - # Miscellaneous files - - cp -a ../README.md README.md.txt - - cp -a ../LICENSE.MIT LICENSE.txt - - # Shared libraries - - cp -a ../lib/* . + - *deploy_base + - *deploy_misc + - *deploy_libs # Platform-specific - cp -a ../bin/Attorney_Online . @@ -63,7 +79,30 @@ deploy: - mkdir ../zip - tar cavf ../zip/Attorney_Online_$(git describe --tags)_x64.tar.xz * - sha1sum ../zip/* + artifacts: + paths: + - zip/ +deploy windows: + stage: deploy + dependencies: + - build windows i686 + tags: + - docker + - linux + script: + - mkdir artifact + - cd artifact + - *deploy_base + - *deploy_misc + - *deploy_libs + + # Platform-specific + - cp -a ../bin/Attorney_Online.exe . + + # Zipping + # -r: recursive; -9: max compression; -l: convert to CR LF + - zip -r -9 -l Attorney_Online_$(git describe --tags)_windows_i386.zip . artifacts: paths: - zip/ \ No newline at end of file From 5fa37e2557513550ab747f2a15a58bb4a7d130b7 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 20:45:28 +0000 Subject: [PATCH 14/72] Try to fix anchors in .gitlab-ci.yml --- .gitlab-ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f1ba670..13f091d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,21 +38,21 @@ build windows i686: - upx --lzma -9 --force bin/Attorney_Online.exe # Base folder -.deploy_base: &deploy_base - - mkdir base - - mkdir base/themes - - cp -a ../base/themes/default base/themes/ - - cp -a ../base/config.ini base/config.sample.ini - - cp -a ../base/serverlist.txt base/serverlist.sample.txt +.deploy_base: &deploy_base | + mkdir base + mkdir base/themes + cp -a ../base/themes/default base/themes/ + cp -a ../base/config.ini base/config.sample.ini + cp -a ../base/serverlist.txt base/serverlist.sample.txt # Miscellaneous files -.deploy_misc: &deploy_misc - - cp -a ../README.md README.md.txt - - cp -a ../LICENSE.MIT LICENSE.txt +.deploy_misc: &deploy_misc | + cp -a ../README.md README.md.txt + cp -a ../LICENSE.MIT LICENSE.txt # Shared libraries -.deploy_libs: &deploy_libs - - cp -a ../lib/* . +.deploy_libs: &deploy_libs | + cp -a ../lib/* . deploy linux: stage: deploy From 8a5be72f913b75403387485e299ea306a81c24e9 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 20:47:41 +0000 Subject: [PATCH 15/72] Don't use sudo in .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 13f091d..b40d525 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ before_script: - echo Current working directory is $(pwd) - qmake --version - gcc --version - - sudo apt-get install --no-install-recommends -y upx zip unzip + - apt-get install --no-install-recommends -y upx zip unzip - cd scripts - ./configure_ubuntu.sh - cd .. From 72dbc4f3ae160d273649f6596ee12221f47a4003 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 22:42:47 +0000 Subject: [PATCH 16/72] Use a locally-sourced image for Windows builds --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b40d525..198ceab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,9 +5,10 @@ cache: before_script: - echo Current working directory is $(pwd) + - echo Current user is $(whoami) - qmake --version - gcc --version - - apt-get install --no-install-recommends -y upx zip unzip + - sudo apt-get install --no-install-recommends -y upx zip unzip - cd scripts - ./configure_ubuntu.sh - cd .. @@ -27,7 +28,7 @@ build linux x86_64: - bin/ build windows i686: - image: fffaraz/qt + image: ${CI_REGISTRY_IMAGE}/builder-windows-i686 stage: build tags: - docker From 565f18352424d89ef0ab02ec9b3a12b5c7e703be Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 22:50:14 +0000 Subject: [PATCH 17/72] Remove version commands from before_script --- .gitlab-ci.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 198ceab..f8974a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,13 +5,7 @@ cache: before_script: - echo Current working directory is $(pwd) - - echo Current user is $(whoami) - - qmake --version - - gcc --version - sudo apt-get install --no-install-recommends -y upx zip unzip - - cd scripts - - ./configure_ubuntu.sh - - cd .. build linux x86_64: image: rabits/qt:5.9-desktop @@ -20,6 +14,13 @@ build linux x86_64: - docker - linux script: + - qmake --version + - gcc --version + + - cd scripts + - ./configure_ubuntu.sh + - cd .. + - qmake - make -j4 - upx --lzma -9 --force bin/Attorney_Online @@ -34,8 +35,18 @@ build windows i686: - docker - linux script: + # Extract BASS + - mkdir bass + - curl http://www.un4seen.com/files/bass24.zip -o bass.zip + - unzip bass.zip + - cp bass.dll ../../lib + - cd .. + + # Build - qmake - make -j4 + + # Post-processing - upx --lzma -9 --force bin/Attorney_Online.exe # Base folder From a815bb67f90fa2e8866f5904741f8056c2f2e596 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 22:56:03 +0000 Subject: [PATCH 18/72] Move yet another line out of before_script --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8974a0..7f2a517 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,6 @@ cache: before_script: - echo Current working directory is $(pwd) - - sudo apt-get install --no-install-recommends -y upx zip unzip build linux x86_64: image: rabits/qt:5.9-desktop @@ -16,6 +15,7 @@ build linux x86_64: script: - qmake --version - gcc --version + - sudo apt-get install --no-install-recommends -y upx zip unzip - cd scripts - ./configure_ubuntu.sh From 1008a2e8ac38f89c4c320b25c21afbb5912d24c7 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:00:52 +0000 Subject: [PATCH 19/72] Use TARGET_SPEC in Windows build --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f2a517..74ab320 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ build windows i686: - cd .. # Build - - qmake + - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake - make -j4 # Post-processing From c47521baa3d04af86b886506d5d4f23fe23fa86d Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:03:20 +0000 Subject: [PATCH 20/72] Missing `cd bass` --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 74ab320..1780a60 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,6 +37,7 @@ build windows i686: script: # Extract BASS - mkdir bass + - cd bass - curl http://www.un4seen.com/files/bass24.zip -o bass.zip - unzip bass.zip - cp bass.dll ../../lib From 470e0f1902c664f8c192e8251cd123aaa0cf4b2e Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:09:28 +0000 Subject: [PATCH 21/72] One less `..` on copying bass.dll .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1780a60..9307863 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,7 +40,7 @@ build windows i686: - cd bass - curl http://www.un4seen.com/files/bass24.zip -o bass.zip - unzip bass.zip - - cp bass.dll ../../lib + - cp bass.dll ../lib - cd .. # Build From 21465def688370eb8a4132352ae789e7a1fca9cb Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:16:28 +0000 Subject: [PATCH 22/72] Add bin/ folder as artifact on Windows target --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9307863..7b8e68a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,6 +49,9 @@ build windows i686: # Post-processing - upx --lzma -9 --force bin/Attorney_Online.exe + artifacts: + paths: + - bin/ # Base folder .deploy_base: &deploy_base | From 3cbbcd9a5c7a4574fb1edd1e7075345592c3dd75 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:23:55 +0000 Subject: [PATCH 23/72] Add zip dependency to Windows deploy --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b8e68a..5f10805 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ build linux x86_64: script: - qmake --version - gcc --version - - sudo apt-get install --no-install-recommends -y upx zip unzip + - sudo apt-get install --no-install-recommends -y upx unzip - cd scripts - ./configure_ubuntu.sh @@ -107,6 +107,8 @@ deploy windows: - docker - linux script: + - sudo apt-get install --no-install-recommends -y zip + - mkdir artifact - cd artifact - *deploy_base From a453951aead4a4fdc2c5fca9965bb369d5587302 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:28:54 +0000 Subject: [PATCH 24/72] Use apt-get instead of sudo apt-get on Windows deploy --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f10805..8c9b249 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -107,7 +107,7 @@ deploy windows: - docker - linux script: - - sudo apt-get install --no-install-recommends -y zip + - apt-get install --no-install-recommends -y zip - mkdir artifact - cd artifact From 0dca4f14fefb9349c68b3afccec9e997be61a768 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:36:03 +0000 Subject: [PATCH 25/72] Use ubuntu instead of ruby or whatever GitLab CI defaults to --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8c9b249..4f038f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -100,6 +100,7 @@ deploy linux: - zip/ deploy windows: + image: ubuntu stage: deploy dependencies: - build windows i686 @@ -107,6 +108,7 @@ deploy windows: - docker - linux script: + - apt-get update - apt-get install --no-install-recommends -y zip - mkdir artifact From bc0e22464056f3e6e9ef11b7d841f673fe7dff31 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 6 Feb 2019 23:42:08 +0000 Subject: [PATCH 26/72] Fix final zip command in Windows deploy --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f038f4..43809de 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -109,7 +109,7 @@ deploy windows: - linux script: - apt-get update - - apt-get install --no-install-recommends -y zip + - apt-get install --no-install-recommends -y zip git - mkdir artifact - cd artifact @@ -122,7 +122,9 @@ deploy windows: # Zipping # -r: recursive; -9: max compression; -l: convert to CR LF - - zip -r -9 -l Attorney_Online_$(git describe --tags)_windows_i386.zip . + - mkdir ../zip + - zip -r -9 -l ../zip/Attorney_Online_$(git describe --tags)_windows_i386.zip . + - sha1sum ../zip/* artifacts: paths: - zip/ \ No newline at end of file From 68f88350bf7c703b34f24bf3f78735753af877d4 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Thu, 7 Feb 2019 00:52:18 +0000 Subject: [PATCH 27/72] Granularize shared library deployment --- .gitlab-ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43809de..3711c18 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -66,10 +66,6 @@ build windows i686: cp -a ../README.md README.md.txt cp -a ../LICENSE.MIT LICENSE.txt -# Shared libraries -.deploy_libs: &deploy_libs | - cp -a ../lib/* . - deploy linux: stage: deploy dependencies: @@ -82,9 +78,9 @@ deploy linux: - cd artifact - *deploy_base - *deploy_misc - - *deploy_libs # Platform-specific + - cp -a ../lib/*.so . - cp -a ../bin/Attorney_Online . - echo "#!/bin/sh" >> ./run.sh - echo "LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./Attorney_Online" >> ./run.sh @@ -115,9 +111,9 @@ deploy windows: - cd artifact - *deploy_base - *deploy_misc - - *deploy_libs # Platform-specific + - cp -a ../lib/*.dll . - cp -a ../bin/Attorney_Online.exe . # Zipping From b8191f7745b70f3841f2dba90d6576f5d81cfe34 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Thu, 7 Feb 2019 20:03:22 +0000 Subject: [PATCH 28/72] Compile Linux build with Qt 5.4 instead of 5.9 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3711c18..1e2836d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ before_script: - echo Current working directory is $(pwd) build linux x86_64: - image: rabits/qt:5.9-desktop + image: rabits/qt:5.4-desktop stage: build tags: - docker From a2bcf70d1ea56f25edd295c49a98bdd414f941fe Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Thu, 7 Feb 2019 20:14:31 +0000 Subject: [PATCH 29/72] Revert "Compile Linux build with Qt 5.4 instead of 5.9" This reverts commit b8191f7745b70f3841f2dba90d6576f5d81cfe34 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e2836d..3711c18 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,7 @@ before_script: - echo Current working directory is $(pwd) build linux x86_64: - image: rabits/qt:5.4-desktop + image: rabits/qt:5.9-desktop stage: build tags: - docker From 0057ff03da5a2370705252b89561a46a97cfddb1 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sat, 9 Feb 2019 02:47:39 +0000 Subject: [PATCH 30/72] Use latest Ubuntu for Linux builds --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3711c18..8efe154 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,15 +7,15 @@ before_script: - echo Current working directory is $(pwd) build linux x86_64: - image: rabits/qt:5.9-desktop + image: ubuntu stage: build tags: - docker - linux script: + - apt-get install --no-install-recommends -y qt5-default clang make git upx unzip - qmake --version - - gcc --version - - sudo apt-get install --no-install-recommends -y upx unzip + - clang --version - cd scripts - ./configure_ubuntu.sh From c755e3d97d714613486aab3a7bd837b015067955 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sat, 9 Feb 2019 02:49:57 +0000 Subject: [PATCH 31/72] apt-get update --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8efe154..3aa3ee2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,6 +13,7 @@ build linux x86_64: - docker - linux script: + - apt-get update - apt-get install --no-install-recommends -y qt5-default clang make git upx unzip - qmake --version - clang --version From 59f72ffa65a1634e9f4b27d6be88826c59bf1754 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sat, 9 Feb 2019 02:56:10 +0000 Subject: [PATCH 32/72] Use clang-linux mkspec --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3aa3ee2..35a142a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ build linux x86_64: - linux script: - apt-get update - - apt-get install --no-install-recommends -y qt5-default clang make git upx unzip + - apt-get install --no-install-recommends -y qt5-default clang make git sudo curl upx unzip - qmake --version - clang --version @@ -22,7 +22,7 @@ build linux x86_64: - ./configure_ubuntu.sh - cd .. - - qmake + - qmake -spec clang-linux - make -j4 - upx --lzma -9 --force bin/Attorney_Online artifacts: From c8a3fd6560ced28c96f13c2b4c062a1ac93f4880 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sat, 9 Feb 2019 03:10:39 +0000 Subject: [PATCH 33/72] clang-linux -> linux-clang --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35a142a..41456e5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ build linux x86_64: - linux script: - apt-get update - - apt-get install --no-install-recommends -y qt5-default clang make git sudo curl upx unzip + - apt-get install --no-install-recommends -y qt5-default clang make git sudo curl ca-certificates pkg-config upx unzip - qmake --version - clang --version @@ -22,7 +22,7 @@ build linux x86_64: - ./configure_ubuntu.sh - cd .. - - qmake -spec clang-linux + - qmake -spec linux-clang - make -j4 - upx --lzma -9 --force bin/Attorney_Online artifacts: From 830dba62a16c748761c4cb498e58a336f4d288ff Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sat, 9 Feb 2019 03:13:08 +0000 Subject: [PATCH 34/72] Add qtmultimedia5-dev --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41456e5..bf3a9bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ build linux x86_64: - linux script: - apt-get update - - apt-get install --no-install-recommends -y qt5-default clang make git sudo curl ca-certificates pkg-config upx unzip + - apt-get install --no-install-recommends -y qt5-default qtmultimedia5-dev clang make git sudo curl ca-certificates pkg-config upx unzip - qmake --version - clang --version From 3b718808b76f1970eb029f2c48bd4f33ae233052 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sat, 9 Feb 2019 04:42:26 +0000 Subject: [PATCH 35/72] Move Ubuntu configure script to .gitlab-ci.yml Sorry, Omni. I'll probably move everything back to shell scripts in the future. --- .gitlab-ci.yml | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf3a9bf..a94d28c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,17 +13,45 @@ build linux x86_64: - docker - linux script: + # Install dependencies - apt-get update - - apt-get install --no-install-recommends -y qt5-default qtmultimedia5-dev clang make git sudo curl ca-certificates pkg-config upx unzip + - > + apt-get install --no-install-recommends -y qt5-default qtmultimedia5-dev + clang make git sudo curl ca-certificates pkg-config upx unzip + + # Print versions - qmake --version - clang --version - - cd scripts - - ./configure_ubuntu.sh + # Extract BASS + - mkdir bass + - cd bass + - curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip + - unzip bass.zip + - cp x64/libbass.so ../lib - cd .. + # Extract Discord RPC + - mkdir discord-rpc + - cd discord-rpc + - curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-linux.zip -o discord_rpc_linux.zip + - unzip discord_rpc_linux.zip + - cp discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ../lib + - cd .. + + # Extract QtApng + - mkdir qtapng + - cd qtapng + - curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.0-5/build_clang_64_5.12.0.tar.xz -o apng.tar.xz + - tar -xvf apng.tar.xz + - cp clang_64/plugins/imageformats/libqapng.so ../lib + - cd .. + + # Build - qmake -spec linux-clang - make -j4 + + # Post-processing - upx --lzma -9 --force bin/Attorney_Online artifacts: paths: @@ -61,7 +89,7 @@ build windows i686: cp -a ../base/themes/default base/themes/ cp -a ../base/config.ini base/config.sample.ini cp -a ../base/serverlist.txt base/serverlist.sample.txt - + # Miscellaneous files .deploy_misc: &deploy_misc | cp -a ../README.md README.md.txt @@ -84,7 +112,7 @@ deploy linux: - cp -a ../lib/*.so . - cp -a ../bin/Attorney_Online . - echo "#!/bin/sh" >> ./run.sh - - echo "LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./Attorney_Online" >> ./run.sh + - echo "LD_LIBRARY_PATH=.:\$LD_LIBRARY_PATH ./Attorney_Online" >> ./run.sh - chmod +x ./run.sh # Zipping From 757da1624c660496e6cb858285be85c4fb4974b1 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sat, 9 Feb 2019 04:51:44 +0000 Subject: [PATCH 36/72] Oh, so apparently the clang QtApng builds are for Mac... --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a94d28c..b010ba5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,9 +42,9 @@ build linux x86_64: # Extract QtApng - mkdir qtapng - cd qtapng - - curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.0-5/build_clang_64_5.12.0.tar.xz -o apng.tar.xz + - curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.0-5/build_gcc_64_5.12.0.tar.xz -o apng.tar.xz - tar -xvf apng.tar.xz - - cp clang_64/plugins/imageformats/libqapng.so ../lib + - cp gcc_64/plugins/imageformats/libqapng.so ../lib - cd .. # Build From 6261be1dc82e3f113a0392c2cf93449d784cfb08 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sun, 10 Feb 2019 01:04:28 +0000 Subject: [PATCH 37/72] Add Travis script for Mac builds --- .travis.yml | 11 +++++++++++ scripts/macos_build.sh | 30 ++++++++++++++++++++++++++++++ scripts/macos_post_build.sh | 2 -- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .travis.yml create mode 100644 scripts/macos_build.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..855b57d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: cpp +os: osx + +before_install: + - brew update + - brew install qt5 + +script: + # XXX: please chmod +x the shell script. + - sh ./scripts/macos_build.sh + - ./scripts/macos_post_build.sh diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh new file mode 100644 index 0000000..150c338 --- /dev/null +++ b/scripts/macos_build.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +set -Eeuxo pipefail + +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig +export PATH=$PATH:/usr/local/opt/qt5/bin:/usr/local/bin + +mkdir bass +cd bass +curl http://www.un4seen.com/files/bass24-osx.zip -o bass.zip +unzip bass.zip +cp libbass.dylib ../lib +cd .. + +mkdir discord-rpc +cd discord-rpc +curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-osx.zip +unzip discord_rpc_osx.zip +cp discord-rpc/osx-dynamic/lib/libdiscord-rpc.a ../lib +cd .. + +mkdir qtapng +cd qtapng +curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.0-5/build_clang_64_5.12.0.tar.xz -o apng.tar.xz +tar -xvf apng.tar.xz +cp clang_64/plugins/imageformats/libqapng.dylib ../lib +cd .. + +qmake && make -j2 diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh index d69da0b..700361e 100644 --- a/scripts/macos_post_build.sh +++ b/scripts/macos_post_build.sh @@ -2,8 +2,6 @@ DST_FOLDER="./bin/Attorney_Online.app/Contents/Frameworks" -cd .. - mkdir $DST_FOLDER cp ./lib/libbass.dylib $DST_FOLDER From f23d163a277f8546953c2f5c3e334d2e09ec21f6 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sun, 10 Feb 2019 01:52:16 +0000 Subject: [PATCH 38/72] Okay, let's try this again... --- .travis.yml | 4 ++-- scripts/macos_build.sh | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 855b57d..e1fcb36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,5 @@ before_install: script: # XXX: please chmod +x the shell script. - - sh ./scripts/macos_build.sh - - ./scripts/macos_post_build.sh + - bash ./scripts/macos_build.sh + - bash ./scripts/macos_post_build.sh diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index 150c338..86605c5 100644 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -1,9 +1,8 @@ #!/bin/sh -set -Eeuxo pipefail +set -Eexo pipefail -export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig -export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig export PATH=$PATH:/usr/local/opt/qt5/bin:/usr/local/bin mkdir bass From 200008fd81d305ea1641e4b643119071dc3a08a7 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sun, 10 Feb 2019 02:00:13 +0000 Subject: [PATCH 39/72] Actually save the discord-rpc zip --- scripts/macos_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index 86605c5..efe0f7c 100644 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -14,7 +14,7 @@ cd .. mkdir discord-rpc cd discord-rpc -curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-osx.zip +curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-osx.zip -o discord_rpc_osx.zip unzip discord_rpc_osx.zip cp discord-rpc/osx-dynamic/lib/libdiscord-rpc.a ../lib cd .. From f05c3defcfc1cd64147c2f3c7de0ca3c44140050 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sun, 10 Feb 2019 02:08:48 +0000 Subject: [PATCH 40/72] Keep fixing issues with the Mac build script --- .travis.yml | 7 ++++--- scripts/macos_build.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e1fcb36..dfde416 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ language: cpp os: osx -before_install: - - brew update - - brew install qt5 +addons: + homebrew: + packages: + - qt5 script: # XXX: please chmod +x the shell script. diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index efe0f7c..ebe93d3 100644 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -16,7 +16,7 @@ mkdir discord-rpc cd discord-rpc curl -L https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-osx.zip -o discord_rpc_osx.zip unzip discord_rpc_osx.zip -cp discord-rpc/osx-dynamic/lib/libdiscord-rpc.a ../lib +cp discord-rpc/osx-static/lib/libdiscord-rpc.a ../lib cd .. mkdir qtapng From e4c4ecb0fde4c26a8e8dd3719fe2a3401fa6b3fc Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sun, 10 Feb 2019 02:19:12 +0000 Subject: [PATCH 41/72] Use CoreFoundation library --- Attorney_Online.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index c0bc4ab..f4e4cd6 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -13,6 +13,7 @@ MOC_DIR = $$PWD/build SOURCES += $$files($$PWD/src/*.cpp) HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib -lbass -ldiscord-rpc +macx:LIBS += -framework CoreFoundation CONFIG += c++14 From 09ff1755a0238cedf2411a315d1de76a372e3960 Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sun, 10 Feb 2019 02:32:11 +0000 Subject: [PATCH 42/72] Add more frameworks --- Attorney_Online.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index f4e4cd6..e1961a0 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -13,7 +13,7 @@ MOC_DIR = $$PWD/build SOURCES += $$files($$PWD/src/*.cpp) HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib -lbass -ldiscord-rpc -macx:LIBS += -framework CoreFoundation +macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices CONFIG += c++14 From 9a32aa6e849cab35710aaddd5e2323276e8eccfb Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Sun, 10 Feb 2019 02:45:10 +0000 Subject: [PATCH 43/72] Add BASSOPUS to all target platforms --- .gitlab-ci.yml | 6 ++++++ scripts/macos_build.sh | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b010ba5..928352f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,9 @@ build linux x86_64: - curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip - unzip bass.zip - cp x64/libbass.so ../lib + - curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip + - unzip bassopus.zip + - cp x64/libbassopus.so ../lib - cd .. # Extract Discord RPC @@ -70,6 +73,9 @@ build windows i686: - curl http://www.un4seen.com/files/bass24.zip -o bass.zip - unzip bass.zip - cp bass.dll ../lib + - curl http://www.un4seen.com/files/bassopus24.zip -o bassopus.zip + - unzip bassopus.zip + - cp bassopus.dll ../lib - cd .. # Build diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index ebe93d3..22e2d45 100644 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -10,6 +10,10 @@ cd bass curl http://www.un4seen.com/files/bass24-osx.zip -o bass.zip unzip bass.zip cp libbass.dylib ../lib + +curl http://www.un4seen.com/files/bassopus24-osx.zip -o bassopus.zip +unzip bassopus.zip +cp libbassopus.dylib ../lib cd .. mkdir discord-rpc From 5d0044b93cfd5ada490c7c1b296bdd0f1602a8f2 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 29 Mar 2019 21:03:43 -0500 Subject: [PATCH 44/72] Add a bunch of scripts --- .gitlab-ci.yml | 45 +++++++++++++--- .travis.yml | 5 +- scripts/macos_build.sh | 0 scripts/macos_post_build.sh | 0 scripts/package.json | 9 ++++ scripts/update_manifest.js | 84 ++++++++++++++++++++++++++++++ scripts/update_program_manifest.js | 39 ++++++++++++++ scripts/wasabi_asset.sh | 45 ++++++++++++++++ scripts/wasabi_program.sh | 35 +++++++++++++ scripts/windows/Dockerfile | 17 ++++++ scripts/windows/Dockerfile-mxe | 44 ++++++++++++++++ scripts/windows/how-to-push.md | 19 +++++++ 12 files changed, 332 insertions(+), 10 deletions(-) mode change 100644 => 100755 scripts/macos_build.sh mode change 100644 => 100755 scripts/macos_post_build.sh create mode 100644 scripts/package.json create mode 100755 scripts/update_manifest.js create mode 100755 scripts/update_program_manifest.js create mode 100755 scripts/wasabi_asset.sh create mode 100755 scripts/wasabi_program.sh create mode 100644 scripts/windows/Dockerfile create mode 100644 scripts/windows/Dockerfile-mxe create mode 100644 scripts/windows/how-to-push.md diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 928352f..d05a337 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,12 @@ +stages: + - build + - deploy + - publish + cache: key: ${CI_COMMIT_REF_SLUG} paths: - - lib/ + - lib/ before_script: - echo Current working directory is $(pwd) @@ -53,7 +58,7 @@ build linux x86_64: # Build - qmake -spec linux-clang - make -j4 - + # Post-processing - upx --lzma -9 --force bin/Attorney_Online artifacts: @@ -101,7 +106,7 @@ build windows i686: cp -a ../README.md README.md.txt cp -a ../LICENSE.MIT LICENSE.txt -deploy linux: +deploy linux x86_64: stage: deploy dependencies: - build linux x86_64 @@ -124,13 +129,13 @@ deploy linux: # Zipping # zip -r -9 -l Attorney_Online_$(git describe --tags)_linux_x86_64.zip . - mkdir ../zip - - tar cavf ../zip/Attorney_Online_$(git describe --tags)_x64.tar.xz * + - tar cavf ../zip/Attorney_Online_$(git describe --tags)_linux_x64.tar.xz * - sha1sum ../zip/* artifacts: paths: - zip/ -deploy windows: +deploy windows i686: image: ubuntu stage: deploy dependencies: @@ -154,8 +159,34 @@ deploy windows: # Zipping # -r: recursive; -9: max compression; -l: convert to CR LF - mkdir ../zip - - zip -r -9 -l ../zip/Attorney_Online_$(git describe --tags)_windows_i386.zip . + - zip -r -9 -l ../zip/Attorney_Online_$(git describe --tags)_windows_x86.zip . - sha1sum ../zip/* artifacts: paths: - - zip/ \ No newline at end of file + - zip/ + +publish linux x86_64: + image: ubuntu + stage: publish + dependencies: + - deploy linux x86_64 + when: manual + script: + - cd zip + - ../scripts/wasabi.sh + variables: + MANIFEST: program_linux_x86_64.json + ARTIFACT_SUFFIX: _linux_x64.tar.xz + +publish windows i686: + image: ubuntu + stage: publish + dependencies: + - deploy windows i686 + when: manual + script: + - cd zip + - ../scripts/wasabi.sh + variables: + MANIFEST: program_winnt_i386.json + ARTIFACT_SUFFIX: _windows_x86.zip diff --git a/.travis.yml b/.travis.yml index dfde416..4243b3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,5 @@ addons: - qt5 script: - # XXX: please chmod +x the shell script. - - bash ./scripts/macos_build.sh - - bash ./scripts/macos_post_build.sh + - ./scripts/macos_build.sh + - ./scripts/macos_post_build.sh diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh old mode 100644 new mode 100755 diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh old mode 100644 new mode 100755 diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 0000000..126a392 --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,9 @@ +{ + "name": "ao-ci-scripts", + "version": "1.0.0", + "main": "update_manifest.js", + "dependencies": { + "argparse": "^1.0.10" + }, + "license": "ISC" +} diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js new file mode 100755 index 0000000..5f64cfb --- /dev/null +++ b/scripts/update_manifest.js @@ -0,0 +1,84 @@ +#!/usr/bin/env node + +const fs = require("fs"); +const crypto = require("crypto"); +const ArgumentParser = require("argparse").ArgumentParser; + +function isFile(file) { + if (!fs.existsSync(file)) { + console.error(`File '${file}' not found. Try again.`); + throw Error(); + } + return file; +} + +const argParser = new ArgumentParser({ + addHelp: true, + description: "Adds a new latest version to the manifest file based on the " + + "provided zip file, including an incremental update." +}); +argParser.addArgument("manifestFile", { + metavar: "", type: isFile +}); +argParser.addArgument("version", { + metavar: "" +}); +argParser.addArgument([ "-f", "--full" ], { + metavar: "", type: isFile, nargs: 1, + dest: "fullZipFile" +}); +argParser.addArgument([ "-i", "--incremental" ], { + type: isFile, nargs: 2, dest: "incremental", + metavar: ["", ""] +}); +argParser.addArgument([ "-e", "--executable" ], { + metavar: "[executable file]", nargs: 1, + dest: "executable" +}); + +const { + manifestFile, + version, + fullZipFile, + incremental: [incrementalZipFile, deletionsFile], + executable +} = argParser.parseArgs(); + +const manifest = JSON.parse(fs.readFileSync(manifestFile)); + +const deleteActions = deletionsFile ? fs.readFileSync(deletionsFile) + .split("\n").map(file => { + // XXX: This does not delete empty directories. Finding them would + // actually be a substantial amount of work because Git does not + // give us a good way of finding directories that were deleted. + return { action: "delete", target: file }; + }) : []; + +const urlBase = "https://s3.wasabisys.com/ao-downloads/"; + +manifest.versions = [{ + version, + executable, + prev: manifest.version[0] ? manifest.version[0].version : undefined, + full: fullZipFile ? [ + { + action: "dl", + url: urlBase + encodeURIComponent(fullZipFile), + hash: crypto.createHash("sha1") + .update(fs.readFileSync(fullZipFile)) + .digest("hex") + } + ] : undefined, + update: incremental ? [ + ...deleteActions, + { + action: "dl", + url: urlBase + encodeURIComponent(incrementalZipFile), + hash: crypto.createHash("sha1") + .update(fs.readFileSync(incrementalZipFile)) + .digest("hex") + } + ] : undefined +}, ...manifest.versions]; + +fs.writeFileSync(manifestFile, JSON.stringify(manifest, null, 4)); diff --git a/scripts/update_program_manifest.js b/scripts/update_program_manifest.js new file mode 100755 index 0000000..9efc814 --- /dev/null +++ b/scripts/update_program_manifest.js @@ -0,0 +1,39 @@ +#!/usr/bin/env node + +const fs = require("fs"); +const crypto = require("crypto"); + +const [ _nodeExe, _jsPath, manifestFile, version, zipFile ] = process.argv; + +if (!manifestFile || !version || !zipFile) { + console.log(`Usage: update_program_manifest `); + console.log(`Adds a new latest version to the manifest file based on the ` + + `provided zip file.`); + process.exit(1); +} + +if (!fs.existsSync(manifestFile)) { + console.error(`Manifest file '${manifestFile}' not found. Try again.`); + process.exit(2); +} + +if (!fs.existsSync(zipFile)) { + console.error(`Zip file '${zipFile}' not found. Try again.`); + process.exit(2); +} + +const manifest = JSON.parse(fs.readFileSync(manifestFile)); + +manifest.versions = [{ + version, + executable: "Attorney_Online.exe", + full: [ + { + action: "dl", + url: "https://s3.wasabisys.com/ao-downloads/" + encodeURIComponent(zipFile), + hash: crypto.createHash("sha1").update(fs.readFileSync(zipFile)).digest("hex") + } + ] +}, ...manifest.versions]; + +fs.writeFileSync(manifestFile, JSON.stringify(manifest, null, 4)); \ No newline at end of file diff --git a/scripts/wasabi_asset.sh b/scripts/wasabi_asset.sh new file mode 100755 index 0000000..d424183 --- /dev/null +++ b/scripts/wasabi_asset.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Updates the specified program manifest to a new archive and version +# and uploads the new archive and manifest to S3/Wasabi. +# +# Requires: +# MANIFEST: name of the manifest file +# ARTIFACT_SUFFIX: suffix of the archive to be uploaded (including extension) +# S3_ACCESS_KEY and S3_SECRET_KEY + + +# -E: inherit ERR trap by shell functions +# -e: stop script on ERR trap +# -u: stop script on unbound variables +# -x: print command before running it +# -o pipefail: fail if any command in a pipeline fails +set -Eeuxo pipefail + +aws configure set aws_access_key_id ${S3_ACCESS_KEY} +aws configure set aws_secret_access_key ${S3_SECRET_KEY} +aws configure set default.region us-east-1 + +export S3_COPY="aws s3 cp --endpoint-url=https://s3.wasabisys.com" +export S3_MANIFESTS="s3://ao-manifests" +export S3_ARCHIVES="s3://ao-downloads" + +export VERSION=$(git describe --tags) +export ARCHIVE_FULL="vanilla_full_${VERSION}_${ARTIFACT_SUFFIX}" +export ARCHIVE_INCR="vanilla_update_${VERSION}_${ARTIFACT_SUFFIX}" + +git log --diff-filter=D --summary $(git rev-list --tags --skip=1 --max-count=1)..HEAD | \ + grep "delete mode" | cut -d' ' -f 5- > deletions.txt + +${S3_COPY} ${S3_MANIFESTS}/${MANIFEST} . +if [[ -n FULL_ZIP && FULL_ZIP != '0' ]]; then + node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} + -f ${ARCHIVE_FULL} -i ${ARCHIVE_INCR} deletions.txt + ${S3_COPY} ${ARCHIVE_FULL} ${S3_ARCHIVES} +else + node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} + -i ${ARCHIVE_INCR} deletions.txt +fi +${S3_COPY} ${ARCHIVE_INCR} ${S3_ARCHIVES} +${S3_COPY} ${MANIFEST} ${S3_MANIFESTS} + +rm -f ${MANIFEST} diff --git a/scripts/wasabi_program.sh b/scripts/wasabi_program.sh new file mode 100755 index 0000000..41e2e35 --- /dev/null +++ b/scripts/wasabi_program.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Updates the specified program manifest to a new archive and version +# and uploads the new archive and manifest to S3/Wasabi. +# +# Requires: +# MANIFEST: name of the manifest file +# ARTIFACT_SUFFIX: suffix of the archive to be uploaded (including extension) +# S3_ACCESS_KEY and S3_SECRET_KEY + + +# -E: inherit ERR trap by shell functions +# -e: stop script on ERR trap +# -u: stop script on unbound variables +# -x: print command before running it +# -o pipefail: fail if any command in a pipeline fails +set -Eeuxo pipefail + +aws configure set aws_access_key_id ${S3_ACCESS_KEY} +aws configure set aws_secret_access_key ${S3_SECRET_KEY} +aws configure set default.region us-east-1 + +export S3_COPY="aws s3 cp --endpoint-url=https://s3.wasabisys.com" +export S3_MANIFESTS="s3://ao-manifests" +export S3_ARCHIVES="s3://ao-downloads" + +export VERSION=$(git describe --tags) +export ARCHIVE="Attorney_Online_${VERSION}_${ARTIFACT_SUFFIX}" + +${S3_COPY} ${S3_MANIFESTS}/${MANIFEST} . +node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} \ + -f ${ARCHIVE} -e Attorney_Online.exe +${S3_COPY} ${ARCHIVE} ${S3_ARCHIVES} +${S3_COPY} ${MANIFEST} ${S3_MANIFESTS} + +rm -f ${MANIFEST} diff --git a/scripts/windows/Dockerfile b/scripts/windows/Dockerfile new file mode 100644 index 0000000..90d6c27 --- /dev/null +++ b/scripts/windows/Dockerfile @@ -0,0 +1,17 @@ +FROM oldmud0/mxe-qt:5.12.1-win32-static-posix +#FROM fffaraz/qt:windows + +ENV TARGET_SPEC i686-w64-mingw32.static.posix + +# Build Discord RPC statically +RUN git clone https://github.com/discordapp/discord-rpc +WORKDIR discord-rpc/build +RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake .. -DCMAKE_INSTALL_PREFIX=/opt/mxe/usr/${TARGET_SPEC} +RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake --build . --config Release --target install +WORKDIR ../.. + +# Build QtApng statically +RUN git clone https://github.com/Skycoder42/QtApng +WORKDIR QtApng +RUN /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake && make qmake_all && make && make install +WORKDIR .. diff --git a/scripts/windows/Dockerfile-mxe b/scripts/windows/Dockerfile-mxe new file mode 100644 index 0000000..e6caec5 --- /dev/null +++ b/scripts/windows/Dockerfile-mxe @@ -0,0 +1,44 @@ +FROM ubuntu:18.04 + +RUN apt-get update +RUN apt-get install -y \ + autoconf \ + automake \ + autopoint \ + bash \ + bison \ + bzip2 \ + flex \ + g++ \ + g++-multilib \ + gettext \ + git \ + gperf \ + intltool \ + libc6-dev-i386 \ + libgdk-pixbuf2.0-dev \ + libltdl-dev \ + libssl-dev \ + libtool-bin \ + libxml-parser-perl \ + lzip \ + make \ + openssl \ + p7zip-full \ + patch \ + perl \ + pkg-config \ + python \ + ruby \ + sed \ + unzip \ + wget \ + xz-utils + +RUN git clone https://github.com/mxe/mxe.git +RUN mv mxe /opt/mxe +WORKDIR /opt/mxe +RUN make -j4 MXE_TARGETS="i686-w64-mingw32.static.posix" qtbase qtmultimedia +ENV PATH=/opt/mxe/usr/bin:$PATH + +WORKDIR / diff --git a/scripts/windows/how-to-push.md b/scripts/windows/how-to-push.md new file mode 100644 index 0000000..8c1c18d --- /dev/null +++ b/scripts/windows/how-to-push.md @@ -0,0 +1,19 @@ +When you want to build a new version of Qt: +```docker +docker build -t mxe-windows-static . -f Dockerfile-mxe +docker tag mxe-windows-static oldmud0/mxe-qt:5.12.1-win32-static-posix +docker push oldmud0/mxe-qt:5.12.1-win32-static-posix +``` + +Remember to log into Docker Hub before attempting to push. + +When you want to build a new version of any dependency required for building AO: +```docker +docker build -t mxe-windows-static-ao . -f Dockerfile +docker tag mxe-windows-static-ao registry.gitlab.com/attorneyonline/ao2-client/builder-windows-i686 +docker push registry.gitlab.com/attorneyonline/ao2-client/builder-windows-i686 +``` + +Remember to create an access token in GitLab before attempting to push. + +GitLab CI depends on `builder-windows-i686` image to be present in the repository's registry in order for the Windows build to succeed. From edb3c6b538e80c08595baf71d32356bf0cf97795 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 15:28:30 -0500 Subject: [PATCH 45/72] Continue work on manifest scripts --- scripts/.gitignore | 6 ++++ scripts/update_manifest.js | 5 +-- scripts/wasabi.sh | 72 ++++++++++++++++++++++++++++++++++++++ scripts/wasabi_asset.sh | 45 ------------------------ 4 files changed, 81 insertions(+), 47 deletions(-) create mode 100644 scripts/.gitignore create mode 100755 scripts/wasabi.sh delete mode 100755 scripts/wasabi_asset.sh diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 0000000..2f8a2b9 --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1,6 @@ +node_modules/ + +# Cursed file +package-lock.json + +s3_keys.sh diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index 5f64cfb..66df75f 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -2,6 +2,7 @@ const fs = require("fs"); const crypto = require("crypto"); +const path = require("path"); const ArgumentParser = require("argparse").ArgumentParser; function isFile(file) { @@ -63,7 +64,7 @@ manifest.versions = [{ full: fullZipFile ? [ { action: "dl", - url: urlBase + encodeURIComponent(fullZipFile), + url: urlBase + encodeURIComponent(path.basename(fullZipFile)), hash: crypto.createHash("sha1") .update(fs.readFileSync(fullZipFile)) .digest("hex") @@ -73,7 +74,7 @@ manifest.versions = [{ ...deleteActions, { action: "dl", - url: urlBase + encodeURIComponent(incrementalZipFile), + url: urlBase + encodeURIComponent(path.basename(incrementalZipFile)), hash: crypto.createHash("sha1") .update(fs.readFileSync(incrementalZipFile)) .digest("hex") diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh new file mode 100755 index 0000000..5200652 --- /dev/null +++ b/scripts/wasabi.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# Updates the specified program manifest to a new archive and version +# and uploads the new archive and manifest to S3/Wasabi. +# +# Requires: +# MANIFEST: name of the manifest file +# S3_ACCESS_KEY, S3_SECRET_KEY: S3 credentials +# ARCHIVE_FULL: name of the full archive (if desired) +# ARCHIVE_INCR: name of the incremental archive (if desired) +# VERSION: name of the new version + + +# -E: inherit ERR trap by shell functions +# -e: stop script on ERR trap +# -u: stop script on unbound variables +# -x: print command before running it +# -o pipefail: fail if any command in a pipeline fails +set -Eeuxo pipefail + +aws configure set aws_access_key_id ${S3_ACCESS_KEY} +aws configure set aws_secret_access_key ${S3_SECRET_KEY} +aws configure set default.region us-east-1 + +export S3_COPY="aws s3 cp --endpoint-url=https://s3.wasabisys.com" +export S3_MANIFESTS="s3://ao-manifests" +export S3_ARCHIVES="s3://ao-downloads" + +#export VERSION=$(git describe --tags) +#export ARCHIVE_FULL="vanilla_full_${VERSION}_${ARTIFACT_SUFFIX}" +export ARCHIVE_FULL_ARG="" +#export ARCHIVE_INCR="vanilla_update_${VERSION}_${ARTIFACT_SUFFIX}" +export ARCHIVE_INCR_ARG="" + +export LAST_TAGGED_VERSION=$(git rev-list --tags --skip=1 --max-count=1) +echo "Previous tagged version: ${LAST_TAGGED_VERSION}" +echo "Current tagged version: ${VERSION}" + +if [[ -n $ARCHIVE_INCR && -n $LAST_TAGGED_VERSION ]]; then + echo "Incremental archive: ${ARCHIVE_INCR}" + + # Get deleted files + export DELETIONS_FILE="deletions.txt" + git log --diff-filter=D --summary ${LAST_TAGGED_VERSION}..HEAD | \ + grep "delete mode" | cut -d' ' -f 5- > ${DELETIONS_FILE} + + # Get added/modified files + git log --name-only --oneline --diff-filter=d ec5c..HEAD | \ + grep -v -E "^[0-9a-f]{7} " | sort -u | zip ${ARCHIVE_INCR} -@ + + export ARCHIVE_INCR_ARG="-i ${ARCHIVE_INCR} ${DELETIONS_FILE}" +elif [[ -n $ARCHIVE_INCR && -z $LAST_TAGGED_VERSION ]]; then + echo "Incremental archive was requested, but there is no previous version" +fi + +if [[ -n $ARCHIVE_FULL ]]; then + echo "Full archive: ${ARCHIVE_INCR}" + export ARCHIVE_FULL_ARG="-f ${ARCHIVE_FULL}" +fi + +${S3_COPY} ${S3_MANIFESTS}/${MANIFEST} . +node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} \ + ${ARCHIVE_FULL_ARG} ${ARCHIVE_INCR_ARG} + +if [[ -n $ARCHIVE_INCR_ARG ]]; then + ${S3_COPY} ${ARCHIVE_INCR} ${S3_ARCHIVES} +fi + +if [[ -n $ARCHIVE_FULL_ARG ]]; then + ${S3_COPY} ${ARCHIVE_FULL} ${S3_ARCHIVES} +fi + +${S3_COPY} ${MANIFEST} ${S3_MANIFESTS} diff --git a/scripts/wasabi_asset.sh b/scripts/wasabi_asset.sh deleted file mode 100755 index d424183..0000000 --- a/scripts/wasabi_asset.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Updates the specified program manifest to a new archive and version -# and uploads the new archive and manifest to S3/Wasabi. -# -# Requires: -# MANIFEST: name of the manifest file -# ARTIFACT_SUFFIX: suffix of the archive to be uploaded (including extension) -# S3_ACCESS_KEY and S3_SECRET_KEY - - -# -E: inherit ERR trap by shell functions -# -e: stop script on ERR trap -# -u: stop script on unbound variables -# -x: print command before running it -# -o pipefail: fail if any command in a pipeline fails -set -Eeuxo pipefail - -aws configure set aws_access_key_id ${S3_ACCESS_KEY} -aws configure set aws_secret_access_key ${S3_SECRET_KEY} -aws configure set default.region us-east-1 - -export S3_COPY="aws s3 cp --endpoint-url=https://s3.wasabisys.com" -export S3_MANIFESTS="s3://ao-manifests" -export S3_ARCHIVES="s3://ao-downloads" - -export VERSION=$(git describe --tags) -export ARCHIVE_FULL="vanilla_full_${VERSION}_${ARTIFACT_SUFFIX}" -export ARCHIVE_INCR="vanilla_update_${VERSION}_${ARTIFACT_SUFFIX}" - -git log --diff-filter=D --summary $(git rev-list --tags --skip=1 --max-count=1)..HEAD | \ - grep "delete mode" | cut -d' ' -f 5- > deletions.txt - -${S3_COPY} ${S3_MANIFESTS}/${MANIFEST} . -if [[ -n FULL_ZIP && FULL_ZIP != '0' ]]; then - node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} - -f ${ARCHIVE_FULL} -i ${ARCHIVE_INCR} deletions.txt - ${S3_COPY} ${ARCHIVE_FULL} ${S3_ARCHIVES} -else - node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} - -i ${ARCHIVE_INCR} deletions.txt -fi -${S3_COPY} ${ARCHIVE_INCR} ${S3_ARCHIVES} -${S3_COPY} ${MANIFEST} ${S3_MANIFESTS} - -rm -f ${MANIFEST} From 4561f1809feb16dff449daa972466e3ed2dfe494 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 16:12:31 -0500 Subject: [PATCH 46/72] Fix some bugs in manifest script --- scripts/update_manifest.js | 5 +++-- scripts/wasabi.sh | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index 66df75f..ea1f85e 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -41,9 +41,10 @@ const { manifestFile, version, fullZipFile, - incremental: [incrementalZipFile, deletionsFile], + incremental, executable } = argParser.parseArgs(); +const [incrementalZipFile, deletionsFile] = incremental || []; const manifest = JSON.parse(fs.readFileSync(manifestFile)); @@ -60,7 +61,7 @@ const urlBase = "https://s3.wasabisys.com/ao-downloads/"; manifest.versions = [{ version, executable, - prev: manifest.version[0] ? manifest.version[0].version : undefined, + prev: manifest.versions[0] ? manifest.versions[0].version : undefined, full: fullZipFile ? [ { action: "dl", diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh index 5200652..2e8932d 100755 --- a/scripts/wasabi.sh +++ b/scripts/wasabi.sh @@ -8,6 +8,7 @@ # ARCHIVE_FULL: name of the full archive (if desired) # ARCHIVE_INCR: name of the incremental archive (if desired) # VERSION: name of the new version +# EXECUTABLE: name of the executable (if program manifest) # -E: inherit ERR trap by shell functions @@ -25,11 +26,9 @@ export S3_COPY="aws s3 cp --endpoint-url=https://s3.wasabisys.com" export S3_MANIFESTS="s3://ao-manifests" export S3_ARCHIVES="s3://ao-downloads" -#export VERSION=$(git describe --tags) -#export ARCHIVE_FULL="vanilla_full_${VERSION}_${ARTIFACT_SUFFIX}" export ARCHIVE_FULL_ARG="" -#export ARCHIVE_INCR="vanilla_update_${VERSION}_${ARTIFACT_SUFFIX}" export ARCHIVE_INCR_ARG="" +export EXECUTABLE_ARG="" export LAST_TAGGED_VERSION=$(git rev-list --tags --skip=1 --max-count=1) echo "Previous tagged version: ${LAST_TAGGED_VERSION}" @@ -57,9 +56,13 @@ if [[ -n $ARCHIVE_FULL ]]; then export ARCHIVE_FULL_ARG="-f ${ARCHIVE_FULL}" fi +if [[ -n $EXECUTABLE ]]; then + export EXECUTABLE_ARG="-e ${EXECUTABLE}" +fi + ${S3_COPY} ${S3_MANIFESTS}/${MANIFEST} . node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} \ - ${ARCHIVE_FULL_ARG} ${ARCHIVE_INCR_ARG} + ${ARCHIVE_FULL_ARG} ${ARCHIVE_INCR_ARG} ${EXECUTABLE} if [[ -n $ARCHIVE_INCR_ARG ]]; then ${S3_COPY} ${ARCHIVE_INCR} ${S3_ARCHIVES} From 458eea04d31f749c0494cf78d040bf8e80ddf9da Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 16:18:05 -0500 Subject: [PATCH 47/72] Fix unbound variable EXECUTABLE --- scripts/wasabi.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh index 2e8932d..0613ffd 100755 --- a/scripts/wasabi.sh +++ b/scripts/wasabi.sh @@ -56,13 +56,13 @@ if [[ -n $ARCHIVE_FULL ]]; then export ARCHIVE_FULL_ARG="-f ${ARCHIVE_FULL}" fi -if [[ -n $EXECUTABLE ]]; then +if [[ -v $EXECUTABLE ]]; then export EXECUTABLE_ARG="-e ${EXECUTABLE}" fi ${S3_COPY} ${S3_MANIFESTS}/${MANIFEST} . node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} \ - ${ARCHIVE_FULL_ARG} ${ARCHIVE_INCR_ARG} ${EXECUTABLE} + ${ARCHIVE_FULL_ARG} ${ARCHIVE_INCR_ARG} ${EXECUTABLE_ARG} if [[ -n $ARCHIVE_INCR_ARG ]]; then ${S3_COPY} ${ARCHIVE_INCR} ${S3_ARCHIVES} From d75cee4996af64336c7823968c8cdb475b5c5aff Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 16:21:51 -0500 Subject: [PATCH 48/72] Fix unbound variable (again) --- scripts/wasabi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh index 0613ffd..a322b6c 100755 --- a/scripts/wasabi.sh +++ b/scripts/wasabi.sh @@ -56,7 +56,7 @@ if [[ -n $ARCHIVE_FULL ]]; then export ARCHIVE_FULL_ARG="-f ${ARCHIVE_FULL}" fi -if [[ -v $EXECUTABLE ]]; then +if [[ -v EXECUTABLE ]]; then export EXECUTABLE_ARG="-e ${EXECUTABLE}" fi From 153c458f9e6d95a3e1ee205be28dbdbb32ee88eb Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 16:32:10 -0500 Subject: [PATCH 49/72] Fix type errors during argument parsing --- scripts/update_manifest.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index ea1f85e..bcb3ac7 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -40,11 +40,14 @@ argParser.addArgument([ "-e", "--executable" ], { const { manifestFile, version, - fullZipFile, - incremental, - executable + fullZipFileArgs, + incrementalArgs, + executableArgs } = argParser.parseArgs(); -const [incrementalZipFile, deletionsFile] = incremental || []; + +const [incrementalZipFile, deletionsFile] = incrementalArgs || []; +const [fullZipFile] = fullZipFileArgs || []; +const [executable] = executableArgs || []; const manifest = JSON.parse(fs.readFileSync(manifestFile)); @@ -71,7 +74,7 @@ manifest.versions = [{ .digest("hex") } ] : undefined, - update: incremental ? [ + update: incrementalArgs ? [ ...deleteActions, { action: "dl", From bc92942d29eb43b6f8a37ca8ae4ca303a5f28b96 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 16:47:16 -0500 Subject: [PATCH 50/72] Allow overwriting versions of same name --- scripts/update_manifest.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index bcb3ac7..71fa3f8 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -26,15 +26,15 @@ argParser.addArgument("version", { }); argParser.addArgument([ "-f", "--full" ], { metavar: "", type: isFile, nargs: 1, - dest: "fullZipFile" + dest: "fullZipFileArgs" }); argParser.addArgument([ "-i", "--incremental" ], { - type: isFile, nargs: 2, dest: "incremental", + type: isFile, nargs: 2, dest: "incrementalArgs", metavar: ["", ""] }); argParser.addArgument([ "-e", "--executable" ], { metavar: "[executable file]", nargs: 1, - dest: "executable" + dest: "executableArgs" }); const { @@ -49,6 +49,12 @@ const [incrementalZipFile, deletionsFile] = incrementalArgs || []; const [fullZipFile] = fullZipFileArgs || []; const [executable] = executableArgs || []; +// Do one final check +if (!incrementalZipFile && !fullZipFile) { + console.error("No download archive specified! Abort."); + process.exit(1); +} + const manifest = JSON.parse(fs.readFileSync(manifestFile)); const deleteActions = deletionsFile ? fs.readFileSync(deletionsFile) @@ -61,7 +67,7 @@ const deleteActions = deletionsFile ? fs.readFileSync(deletionsFile) const urlBase = "https://s3.wasabisys.com/ao-downloads/"; -manifest.versions = [{ +const versionEntry = { version, executable, prev: manifest.versions[0] ? manifest.versions[0].version : undefined, @@ -84,6 +90,18 @@ manifest.versions = [{ .digest("hex") } ] : undefined -}, ...manifest.versions]; +}; + +const existingVersion = manifest.versions.filter(v => v.version == version); +if (existingVersion) { + console.warn(`Warning: version ${version} already exists. Adding new values.`); + + // Don't overwrite prev - it will cause headaches + delete versionEntry.prev; + + Object.assign(existingVersion, versionEntry); +} else { + manifest.versions = [versionEntry, ...manifest.versions]; +} fs.writeFileSync(manifestFile, JSON.stringify(manifest, null, 4)); From a5435183e4a181c75624442866014c132238c7d8 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 17:04:39 -0500 Subject: [PATCH 51/72] Stronger check for array length --- scripts/update_manifest.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index 71fa3f8..adbdc34 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -92,14 +92,17 @@ const versionEntry = { ] : undefined }; -const existingVersion = manifest.versions.filter(v => v.version == version); -if (existingVersion) { +console.log("Generated version entry:", versionEntry); + +const existingVersions = manifest.versions.filter(v => v.version == version); +if (existingVersions.length > 0) { console.warn(`Warning: version ${version} already exists. Adding new values.`); // Don't overwrite prev - it will cause headaches delete versionEntry.prev; - Object.assign(existingVersion, versionEntry); + Object.assign(existingVersions[0], versionEntry); + console.log("Merged version entry:", existingVersions[0]); } else { manifest.versions = [versionEntry, ...manifest.versions]; } From 190b0d7c1e5e5461958ff7ec0576da7671a161c9 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 17:10:24 -0500 Subject: [PATCH 52/72] Fix issues parsing deletions file --- scripts/update_manifest.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index adbdc34..220439c 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -58,6 +58,8 @@ if (!incrementalZipFile && !fullZipFile) { const manifest = JSON.parse(fs.readFileSync(manifestFile)); const deleteActions = deletionsFile ? fs.readFileSync(deletionsFile) + .toString() + .trim() .split("\n").map(file => { // XXX: This does not delete empty directories. Finding them would // actually be a substantial amount of work because Git does not From ed41f3c4e5964600063bbab2bf27265ede9e4c19 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 17:14:44 -0500 Subject: [PATCH 53/72] Remove S3_MANIFESTS and S3_ARCHIVES --- scripts/wasabi.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh index a322b6c..12b310e 100755 --- a/scripts/wasabi.sh +++ b/scripts/wasabi.sh @@ -5,6 +5,7 @@ # Requires: # MANIFEST: name of the manifest file # S3_ACCESS_KEY, S3_SECRET_KEY: S3 credentials +# S3_MANIFESTS, S3_ARCHIVES: S3 paths to manifests and downloads # ARCHIVE_FULL: name of the full archive (if desired) # ARCHIVE_INCR: name of the incremental archive (if desired) # VERSION: name of the new version @@ -23,8 +24,6 @@ aws configure set aws_secret_access_key ${S3_SECRET_KEY} aws configure set default.region us-east-1 export S3_COPY="aws s3 cp --endpoint-url=https://s3.wasabisys.com" -export S3_MANIFESTS="s3://ao-manifests" -export S3_ARCHIVES="s3://ao-downloads" export ARCHIVE_FULL_ARG="" export ARCHIVE_INCR_ARG="" From f4b31356df011decba4e157a6d8d2c24f17ade2e Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 17:22:05 -0500 Subject: [PATCH 54/72] Fix typo in getting added/modified files --- scripts/wasabi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh index 12b310e..2067e5e 100755 --- a/scripts/wasabi.sh +++ b/scripts/wasabi.sh @@ -42,7 +42,7 @@ if [[ -n $ARCHIVE_INCR && -n $LAST_TAGGED_VERSION ]]; then grep "delete mode" | cut -d' ' -f 5- > ${DELETIONS_FILE} # Get added/modified files - git log --name-only --oneline --diff-filter=d ec5c..HEAD | \ + git log --name-only --oneline --diff-filter=d ${LAST_TAGGED_VERSION}..HEAD | \ grep -v -E "^[0-9a-f]{7} " | sort -u | zip ${ARCHIVE_INCR} -@ export ARCHIVE_INCR_ARG="-i ${ARCHIVE_INCR} ${DELETIONS_FILE}" From 9b4c18e8dc151ca0387e8d4514b8d9886d03caa7 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 22:58:05 -0500 Subject: [PATCH 55/72] Cover rename and deleted directory cases --- scripts/update_manifest.js | 59 +++++++++++++++++++++++++++++++------- scripts/wasabi.sh | 13 ++++----- 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index 220439c..19e1b15 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -30,7 +30,7 @@ argParser.addArgument([ "-f", "--full" ], { }); argParser.addArgument([ "-i", "--incremental" ], { type: isFile, nargs: 2, dest: "incrementalArgs", - metavar: ["", ""] + metavar: ["", ""] }); argParser.addArgument([ "-e", "--executable" ], { metavar: "[executable file]", nargs: 1, @@ -45,7 +45,7 @@ const { executableArgs } = argParser.parseArgs(); -const [incrementalZipFile, deletionsFile] = incrementalArgs || []; +const [incrementalZipFile, changesFile] = incrementalArgs || []; const [fullZipFile] = fullZipFileArgs || []; const [executable] = executableArgs || []; @@ -55,17 +55,56 @@ if (!incrementalZipFile && !fullZipFile) { process.exit(1); } +// Do a quick litmus test to prevent deleting everything incorrectly +if (changesFile && !fs.existsSync("base")) { + console.error("The working directory must be set to an " + + "asset folder in order for deleted directories " + + "to be calculated correctly. Abort."); + process.exit(1); +} + const manifest = JSON.parse(fs.readFileSync(manifestFile)); -const deleteActions = deletionsFile ? fs.readFileSync(deletionsFile) +const dirsDeleted = new Set(); +const specialActions = changesFile ? + fs.readFileSync(changesFile) .toString() .trim() - .split("\n").map(file => { - // XXX: This does not delete empty directories. Finding them would - // actually be a substantial amount of work because Git does not - // give us a good way of finding directories that were deleted. - return { action: "delete", target: file }; - }) : []; + .split("\n") + .map(line => line.split("\t")) + .map(([mode, target, source]) => { + switch (mode[0]) { + case "D": // Deleted + // Check if the folder exists relative to the working + // directory, and if not, add it to the dirsDeleted list. + // Keep going up the tree to see how many directories were + // deleted. + let dir = path.dirname(target); + while (!dirsDeleted.has(dir) && !fs.existsSync(dir)) { + dirsDeleted.add(dir); + dir = path.dirname(dir); + } + + return { action: "delete", target }; + case "R": // Renamed + // NOTE: Make sure that the launcher's implementation of + // the move action also creates directories when needed. + return { action: "move", source, target}; + default: + return null; + } + }) + // Remove ignored file mode changes + .filter(action => action !== null) + // Create actions based on directories to be deleted. + // Always have deeper directories first, to guarantee that deleting + // higher-level directories will succeed. + + Array.from(dirsDeleted.values()) + .sort((a, b) => b.split("/").length - a.split("/").length) + .map(dir => { + return { action: "deleteDir", target: dir }; + }) + : []; const urlBase = "https://s3.wasabisys.com/ao-downloads/"; @@ -83,7 +122,7 @@ const versionEntry = { } ] : undefined, update: incrementalArgs ? [ - ...deleteActions, + ...specialActions, { action: "dl", url: urlBase + encodeURIComponent(path.basename(incrementalZipFile)), diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh index 2067e5e..a20c0e0 100755 --- a/scripts/wasabi.sh +++ b/scripts/wasabi.sh @@ -36,16 +36,15 @@ echo "Current tagged version: ${VERSION}" if [[ -n $ARCHIVE_INCR && -n $LAST_TAGGED_VERSION ]]; then echo "Incremental archive: ${ARCHIVE_INCR}" - # Get deleted files - export DELETIONS_FILE="deletions.txt" - git log --diff-filter=D --summary ${LAST_TAGGED_VERSION}..HEAD | \ - grep "delete mode" | cut -d' ' -f 5- > ${DELETIONS_FILE} + # Get all files + export CHANGES_FILE="changes.txt" + git diff --summary ${LAST_TAGGED_VERSION}..HEAD > ${CHANGES_FILE} # Get added/modified files - git log --name-only --oneline --diff-filter=d ${LAST_TAGGED_VERSION}..HEAD | \ - grep -v -E "^[0-9a-f]{7} " | sort -u | zip ${ARCHIVE_INCR} -@ + git diff --name-only --diff-filter=dr ${LAST_TAGGED_VERSION}..HEAD | \ + zip ${ARCHIVE_INCR} -@ - export ARCHIVE_INCR_ARG="-i ${ARCHIVE_INCR} ${DELETIONS_FILE}" + export ARCHIVE_INCR_ARG="-i ${ARCHIVE_INCR} ${CHANGES_FILE}" elif [[ -n $ARCHIVE_INCR && -z $LAST_TAGGED_VERSION ]]; then echo "Incremental archive was requested, but there is no previous version" fi From eae8ed1552085fccbd87049fe438b2f6284b3b95 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 23:18:28 -0500 Subject: [PATCH 56/72] I hate JavaScript sometimes --- scripts/update_manifest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/update_manifest.js b/scripts/update_manifest.js index 19e1b15..1a06a2d 100755 --- a/scripts/update_manifest.js +++ b/scripts/update_manifest.js @@ -99,11 +99,11 @@ const specialActions = changesFile ? // Create actions based on directories to be deleted. // Always have deeper directories first, to guarantee that deleting // higher-level directories will succeed. - + Array.from(dirsDeleted.values()) + .concat(Array.from(dirsDeleted.values()) .sort((a, b) => b.split("/").length - a.split("/").length) .map(dir => { return { action: "deleteDir", target: dir }; - }) + })) : []; const urlBase = "https://s3.wasabisys.com/ao-downloads/"; From 93b482cbc794c343d9f61a8c37bf900dfd925d1c Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 3 Apr 2019 23:24:37 -0500 Subject: [PATCH 57/72] Use --name-status instead of --summary --- scripts/wasabi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wasabi.sh b/scripts/wasabi.sh index a20c0e0..95fb3ee 100755 --- a/scripts/wasabi.sh +++ b/scripts/wasabi.sh @@ -38,7 +38,7 @@ if [[ -n $ARCHIVE_INCR && -n $LAST_TAGGED_VERSION ]]; then # Get all files export CHANGES_FILE="changes.txt" - git diff --summary ${LAST_TAGGED_VERSION}..HEAD > ${CHANGES_FILE} + git diff --name-status ${LAST_TAGGED_VERSION}..HEAD > ${CHANGES_FILE} # Get added/modified files git diff --name-only --diff-filter=dr ${LAST_TAGGED_VERSION}..HEAD | \ From 744cf727f0102fc51dde5a2f0269433138270448 Mon Sep 17 00:00:00 2001 From: nnoodle Date: Thu, 11 Apr 2019 22:25:40 +0700 Subject: [PATCH 58/72] Use /bin/sh and exit immediately if a command fails. --- scripts/configure_ubuntu.sh | 3 ++- scripts/macos_post_build.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/macos_post_build.sh diff --git a/scripts/configure_ubuntu.sh b/scripts/configure_ubuntu.sh index 3817997..848cf63 100755 --- a/scripts/configure_ubuntu.sh +++ b/scripts/configure_ubuntu.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/sh +set -e #assumes a somewhat recent 64-bit ubuntu diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh old mode 100644 new mode 100755 index d69da0b..1db8c03 --- a/scripts/macos_post_build.sh +++ b/scripts/macos_post_build.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/sh +set -e DST_FOLDER="./bin/Attorney_Online.app/Contents/Frameworks" From 2e4f0117b067c6d795a7d42fe23162d41260ff74 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 9 May 2019 23:49:20 +0200 Subject: [PATCH 59/72] Text is now advanced based on graphemes, rather than bytes. --- include/courtroom.h | 1 + src/courtroom.cpp | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index ec9f9ef..cc08f65 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -48,6 +48,7 @@ #include #include #include +#include #include diff --git a/src/courtroom.cpp b/src/courtroom.cpp index be7629b..c313a98 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2024,6 +2024,7 @@ void Courtroom::chat_tick() //do not perform heavy operations here QString f_message = m_chatmessage[MESSAGE]; + f_message.remove(0, tick_pos); // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); @@ -2038,7 +2039,7 @@ void Courtroom::chat_tick() f_message.remove(0,2); } - if (tick_pos >= f_message.size()) + if (f_message.size() == 0) { text_state = 2; if (anim_state != 4) @@ -2050,7 +2051,16 @@ void Courtroom::chat_tick() else { - QString f_character = f_message.at(tick_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); + QString f_character; + + tbf.toNextBoundary(); + + if (tbf.position() == -1) + f_character = f_message; + else + f_character = f_message.left(tbf.position()); + f_character = f_character.toHtmlEscaped(); if (f_character == " ") @@ -2265,7 +2275,7 @@ void Courtroom::chat_tick() if(blank_blip) qDebug() << "blank_blip found true"; - if (f_message.at(tick_pos) != ' ' || blank_blip) + if (f_character != ' ' || blank_blip) { if (blip_pos % blip_rate == 0 && !formatting_char) @@ -2277,7 +2287,7 @@ void Courtroom::chat_tick() ++blip_pos; } - ++tick_pos; + tick_pos += f_character.length(); // Restart the timer, but according to the newly set speeds, if there were any. // Keep the speed at bay. @@ -2304,6 +2314,7 @@ void Courtroom::chat_tick() } } + void Courtroom::show_testimony() { if (!testimony_in_progress || m_chatmessage[SIDE] != "wit") From c8a4f69d144d4be59a1fd07151579d923bcc8a6e Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 10 May 2019 20:49:59 +0200 Subject: [PATCH 60/72] Fix escaped HTML characters fucking up the grapheme cluster sizes. --- src/courtroom.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c313a98..ce82f88 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2053,6 +2053,7 @@ void Courtroom::chat_tick() { QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); QString f_character; + int f_char_length; tbf.toNextBoundary(); @@ -2061,8 +2062,10 @@ void Courtroom::chat_tick() else f_character = f_message.left(tbf.position()); + f_char_length = f_character.length(); f_character = f_character.toHtmlEscaped(); + if (f_character == " ") ui_vp_message->insertPlainText(" "); @@ -2155,7 +2158,7 @@ void Courtroom::chat_tick() else { next_character_is_not_special = true; - tick_pos--; + tick_pos -= f_char_length; } } @@ -2176,7 +2179,7 @@ void Courtroom::chat_tick() else { next_character_is_not_special = true; - tick_pos--; + tick_pos -= f_char_length; } } @@ -2287,7 +2290,7 @@ void Courtroom::chat_tick() ++blip_pos; } - tick_pos += f_character.length(); + tick_pos += f_char_length; // Restart the timer, but according to the newly set speeds, if there were any. // Keep the speed at bay. From 1f9a1bdd5d17d56fc3bfd4f5a35e3df476e74477 Mon Sep 17 00:00:00 2001 From: cents02 Date: Fri, 31 May 2019 21:47:47 +0000 Subject: [PATCH 61/72] Fixed issues #47 on both client and server --- src/courtroom.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c313a98..c798885 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2707,6 +2707,7 @@ void Courtroom::on_ooc_return_pressed() } else { + other_charid = -1; append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1"); } } @@ -2992,6 +2993,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) QListWidgetItem *f_item = ui_pair_list->item(p_index.row()); QString f_char = f_item->text(); QString real_char; + int f_cid = -1; if (f_char.endsWith(" [x]")) { @@ -2999,17 +3001,19 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_item->setText(real_char); } else - real_char = f_char; - - int f_cid = -1; - - for (int n_char = 0 ; n_char < char_list.size() ; n_char++) { + real_char = f_char; + for (int n_char = 0 ; n_char < char_list.size() ; n_char++) + { if (char_list.at(n_char).name == real_char) f_cid = n_char; + } } - if (f_cid < 0 || f_cid >= char_list.size()) + + + + if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3028,8 +3032,10 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) for (int i = 0; i < ui_pair_list->count(); i++) { ui_pair_list->item(i)->setText(sorted_pair_list.at(i)); } - + if(other_charid != -1) + { f_item->setText(real_char + " [x]"); + } } void Courtroom::on_music_list_double_clicked(QModelIndex p_model) From 09d8e9e7a45d8c7d9557253e1fb48f3e9bd9c894 Mon Sep 17 00:00:00 2001 From: cents02 Date: Fri, 31 May 2019 21:52:22 +0000 Subject: [PATCH 62/72] Update courtroom.cpp --- src/courtroom.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c798885..9fd52d8 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3009,10 +3009,6 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - - - - if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; @@ -3037,7 +3033,6 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_item->setText(real_char + " [x]"); } } - void Courtroom::on_music_list_double_clicked(QModelIndex p_model) { if (is_muted) From ae8552578020dcd515e1fe80f2b95e6be461744c Mon Sep 17 00:00:00 2001 From: cents02 Date: Mon, 3 Jun 2019 09:00:24 +0000 Subject: [PATCH 63/72] Resolved requests/issues. --- src/courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 9fd52d8..020a54c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3009,7 +3009,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - if (f_cid < -2 || f_cid >= char_list.size()) + if (f_cid < -1 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3030,7 +3030,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) } if(other_charid != -1) { - f_item->setText(real_char + " [x]"); + f_item->setText(real_char + " [x]"); } } void Courtroom::on_music_list_double_clicked(QModelIndex p_model) From f2a4ac013dd0cd1b054a8fa604bc75a659cff3ff Mon Sep 17 00:00:00 2001 From: David Skoland Date: Sat, 29 Jun 2019 00:27:31 +0000 Subject: [PATCH 64/72] Mac improvements Just modifying build scripts to make it less painful to build and release on Mac See merge request AttorneyOnline/AO2-Client!64 --- .gitignore | 1 + README_BUILD.md | 34 +++++++++++++++++++++++------- scripts/configure_macos.sh | 42 +++++++++++++++++++++++++++++++++++++ scripts/configure_ubuntu.sh | 10 +++++++-- scripts/macos_post_build.sh | 17 --------------- scripts/release_macos.sh | 22 +++++++++++++++++++ 6 files changed, 99 insertions(+), 27 deletions(-) create mode 100755 scripts/configure_macos.sh delete mode 100755 scripts/macos_post_build.sh create mode 100755 scripts/release_macos.sh diff --git a/.gitignore b/.gitignore index 6ac11d6..0b767f1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.so *.pro.autosave base_override.h +.DS_Store base-full/ bass.lib diff --git a/README_BUILD.md b/README_BUILD.md index 685699c..f7441b8 100644 --- a/README_BUILD.md +++ b/README_BUILD.md @@ -8,22 +8,40 @@ This program has five main dependencies * Discord Rich Presence (https://github.com/discordapp/discord-rpc/releases) * Qt Apng Plugin (https://github.com/Skycoder42/QtApng/releases) +### Help + +If you're having issues with any of this, ask in the offical Discord: https://discord.gg/wWvQ3pw +Alternatively, you can ask OmniTroid#4004 on Discord. + ### How to build dynamically (the easy way) +#### General preparation + What you want to do is first download the latest version of Qt from the first link. (get the prebuilt dynamic version) -If you're on Ubuntu, go to the scripts/ folder and run configure_ubuntu.sh. This should fetch all the required dependencies automatically. -If not, go to each one of the links above and find the right dynamic library for your platform: -* Windows: .dll -* Linux: .so -* Mac: .dylib +After going through the OS-specific steps below, compiling in Qt creator should work. -And put them in BOTH lib/ and the repository root (lib/ is required for linking and root is required for runtime) +#### Windows -Launch Qt creator, open the .pro file and try running it. Ask in the Discord if you're having issues: https://discord.gg/wWvQ3pw +If you're on Windows, you need to go find all the dependencies (see above) and put them in the lib/ folder. + +#### MacOS + +If you're on MacOS, you can simply go to terminal and run ./scripts/configure_macos.sh +This will automatically fetch all the required dependencies. Additionally, if you need to create a standalone release, just run ./scripts/release_macos.sh +This will make the .app bundle in bin/ able to execute as a standalone. + +#### Ubuntu + +If you're on Ubuntu, just go to terminal and run ./scripts/configure_ubuntu.sh +This should fetch all the required dependencies automatically. + +#### Other Linux + +With some tweaks to the ubuntu script, it shouldn't be a big hassle to compile it on a modern linux. Look in the script and see what you may have to modify. ### How to build statically (the hard way) -You're gonna have a bad time. +You're gonna have a bad time. Building statically means you can distribute the final program without needing to pack alongside a lot of dynamic libraries. This is a tricky process and is not recommended unless you know what you're doing. diff --git a/scripts/configure_macos.sh b/scripts/configure_macos.sh new file mode 100755 index 0000000..af08966 --- /dev/null +++ b/scripts/configure_macos.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# This script fetches all build dependencies for MacOS +# Tested on MacOS 10.14 (Mojave), Qt 5.13 and XCode 10.2 + +# Exit on errors and unset variables +set -eu + +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" + +cd ${ROOT_DIR} + +LIB_TARGET="../../lib" +BASS_LINK="http://uk.un4seen.com/files/bass24-osx.zip" +BASSOPUS_LINK="http://www.un4seen.com/files/bassopus24-osx.zip" +DISCORD_RPC_LINK="https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-osx.zip" +APNG_LINK="https://github.com/Skycoder42/QtApng/releases/download/1.1.2-2/qtapng_clang_64_5.13.0.tar.xz" + +# Easier if we don't need to worry about an existing tmp folder tbh smh +# v Add a slash here for free tmp folder cleanup in true javascript community style +rm -rf tmp +mkdir tmp +cd tmp + +curl -Ls ${BASS_LINK} -o bass.zip +unzip -qq bass.zip +cp libbass.dylib ${LIB_TARGET} + +curl -Ls ${BASSOPUS_LINK} -o bassopus.zip +unzip -qq bassopus.zip +cp libbassopus.dylib ${LIB_TARGET} + +curl -Ls ${DISCORD_RPC_LINK} -o discord_rpc.zip +unzip -qq discord_rpc.zip +cp discord-rpc/osx-dynamic/lib/libdiscord-rpc.dylib ${LIB_TARGET} + +curl -Ls ${APNG_LINK} -o apng.tar.xz +tar -xf apng.tar.xz +cp clang_64/plugins/imageformats/libqapng.dylib ../../lib + +cd .. +rm -rf tmp diff --git a/scripts/configure_ubuntu.sh b/scripts/configure_ubuntu.sh index 848cf63..159dc4d 100755 --- a/scripts/configure_ubuntu.sh +++ b/scripts/configure_ubuntu.sh @@ -1,7 +1,13 @@ #!/bin/sh -set -e -#assumes a somewhat recent 64-bit ubuntu +# Assumes a somewhat recent 64-bit ubuntu + +# Exit on errors and unset variables +set -eu + +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" + +cd ${ROOT_DIR} #need some openGL stuff sudo apt install libgl1-mesa-dev diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh deleted file mode 100755 index 1db8c03..0000000 --- a/scripts/macos_post_build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -set -e - -DST_FOLDER="./bin/Attorney_Online.app/Contents/Frameworks" - -cd .. - -mkdir $DST_FOLDER - -cp ./lib/libbass.dylib $DST_FOLDER -cp ./lib/libbassopus.dylib $DST_FOLDER - -install_name_tool -id @executable_path/../Frameworks/libbass.dylib $DST_FOLDER/libbass.dylib - -install_name_tool -id @executable_path/../Frameworks/libbassopus.dylib $DST_FOLDER/libbassopus.dylib - -install_name_tool -change @loader_path/libbass.dylib @executable_path/../Frameworks/libbass.dylib ./bin/Attorney_Online.app/Contents/MacOS/Attorney_Online diff --git a/scripts/release_macos.sh b/scripts/release_macos.sh new file mode 100755 index 0000000..50acb40 --- /dev/null +++ b/scripts/release_macos.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script prepares the compiled bundle for shipping as a standalone release +# Assumes the Qt bin folder is in PATH +# Should be used on a "Release" build from QT creator +# Note that this DOES NOT add the base/ folder + +# Exit on errors and unset variables +set -eu + +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" + +cd ${ROOT_DIR} + +# This thing basically does all the work +macdeployqt ../bin/Attorney_Online.app + +# Need to add the dependencies +cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks + +# libbass has a funny path for some reason, just use rpath +install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online From f826ba390bcf11427aab5058728ad7dbd3f699a6 Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 30 Jun 2019 21:47:48 +0000 Subject: [PATCH 65/72] New feature! /save_case . Takes two parameters, name and cr status. E.g: /save_case case1 lfp . It takes court evidence but leaves the doc and cmdoc options blank to be entered manually(if anybody actually puts anything). --- src/courtroom.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 020a54c..581ce5a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2864,6 +2864,58 @@ void Courtroom::on_ooc_return_pressed() ui_ooc_chat_message->clear(); return; } + else if(ooc_message.startsWith("/save_case")) + { + QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); + + QDir casefolder("base/cases"); + if (!casefolder.exists()) + { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it.", "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini",""); + + if (command.size() < 2) + { + append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!" + caseslist.join(", "), "1"); + ui_ooc_chat_message->clear(); + return; + } + + + if (command.size() > 3) + { + append_server_chatmessage("CLIENT", "Too many arguments to save a case! You only need a filename without extension and the courtroom status!", "1"); + ui_ooc_chat_message->clear(); + return; + } + QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); + casefile.setValue("author",ui_ooc_chat_name->text()); + casefile.setValue("cmdoc",""); + casefile.setValue("doc", ""); + casefile.setValue("status",command[2]); + casefile.sync(); + for(int i = local_evidence_list.size() - 1; i >= 0; i--) + { + casefile.beginGroup(QString::number(i)); + casefile.sync(); + casefile.setValue("name",local_evidence_list[i].name); + casefile.setValue("description",local_evidence_list[i].description); + casefile.setValue("image",local_evidence_list[i].image); + casefile.endGroup(); + } + casefile.sync(); + append_server_chatmessage("CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", "1"); + ui_ooc_chat_message->clear(); + return; + + } QStringList packet_contents; packet_contents.append(ui_ooc_chat_name->text()); @@ -3009,7 +3061,11 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - if (f_cid < -1 || f_cid >= char_list.size()) + + + + + if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3030,9 +3086,10 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) } if(other_charid != -1) { - f_item->setText(real_char + " [x]"); + f_item->setText(real_char + " [x]"); } } + void Courtroom::on_music_list_double_clicked(QModelIndex p_model) { if (is_muted) From 099fea176c018c4aa6b9e7887e4f154866dc2c7d Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 30 Jun 2019 22:09:12 +0000 Subject: [PATCH 66/72] Indentation --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 581ce5a..da05fe9 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3086,7 +3086,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) } if(other_charid != -1) { - f_item->setText(real_char + " [x]"); + f_item->setText(real_char + " [x]"); } } From ca3f113377f85296538f42c355ab2308c05ca982 Mon Sep 17 00:00:00 2001 From: cents02 Date: Mon, 1 Jul 2019 18:50:30 +0000 Subject: [PATCH 67/72] Fixed evidence not recognizing subfolder issue. Can support 1 folder tho. --- src/evidence.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/evidence.cpp b/src/evidence.cpp index 4e79664..14234d8 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -205,8 +205,16 @@ void Courtroom::on_evidence_image_button_clicked() QString filename = filenames.at(0); QStringList split_filename = filename.split("/"); + if(split_filename.at(split_filename.size() - 2) == "evidence") + { + filename = split_filename.at(split_filename.size() - 1); + } + else { + + filename = split_filename.at(split_filename.size() - 2) + "/" + split_filename.at(split_filename.size() - 1); + } + - filename = split_filename.at(split_filename.size() - 1); ui_evidence_image_name->setText(filename); From 6c1d5ea41ebb6631901f00adf11d273e2411997e Mon Sep 17 00:00:00 2001 From: oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> Date: Wed, 3 Jul 2019 02:47:32 +0000 Subject: [PATCH 68/72] CI: install dependencies not in builder container (?!) --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d05a337..cf67615 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,6 +72,10 @@ build windows i686: - docker - linux script: + # Install dependencies + - apt-get update + - apt-get install --no-install-recommends -y make curl ca-certificates upx unzip + # Extract BASS - mkdir bass - cd bass From d07dd1d5fe42f0120d4d5ff1050fcd082123b2e9 Mon Sep 17 00:00:00 2001 From: cents02 Date: Wed, 3 Jul 2019 08:48:04 +0000 Subject: [PATCH 69/72] Permanent and not temporary solution for evidence. Supports up to infite subfolders. --- src/evidence.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/evidence.cpp b/src/evidence.cpp index 14234d8..ebef749 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -188,11 +188,12 @@ void Courtroom::on_evidence_image_name_edited() void Courtroom::on_evidence_image_button_clicked() { + QDir dir(ao_app->get_base_path() + "evidence"); QFileDialog dialog(this); dialog.setFileMode(QFileDialog::ExistingFile); dialog.setNameFilter(tr("Images (*.png)")); dialog.setViewMode(QFileDialog::List); - dialog.setDirectory(ao_app->get_base_path() + "evidence"); + dialog.setDirectory(dir); QStringList filenames; @@ -203,21 +204,8 @@ void Courtroom::on_evidence_image_button_clicked() return; QString filename = filenames.at(0); - - QStringList split_filename = filename.split("/"); - if(split_filename.at(split_filename.size() - 2) == "evidence") - { - filename = split_filename.at(split_filename.size() - 1); - } - else { - - filename = split_filename.at(split_filename.size() - 2) + "/" + split_filename.at(split_filename.size() - 1); - } - - - + filename = dir.relativeFilePath(filename); ui_evidence_image_name->setText(filename); - on_evidence_image_name_edited(); } From 432069844a2073f8d3d5fdfff5c760acacc9a734 Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 7 Jul 2019 22:32:57 +0000 Subject: [PATCH 70/72] Revert "More bug fixing." This reverts commit ca84ba516fc892deaeafc18b23ad5a06822b29f5 --- src/courtroom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2d5cf15..344516a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2886,7 +2886,7 @@ void Courtroom::on_ooc_return_pressed() if (command.size() < 2) { - append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!" + caseslist.join(", "), "1"); + append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1"); ui_ooc_chat_message->clear(); return; } @@ -2906,6 +2906,8 @@ void Courtroom::on_ooc_return_pressed() casefile.sync(); for(int i = local_evidence_list.size() - 1; i >= 0; i--) { + QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("..."), ""); + clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, ""); casefile.beginGroup(QString::number(i)); casefile.sync(); casefile.setValue("name",local_evidence_list[i].name); From b15c6f15f0b13bce4ef7305efa08c1d257401def Mon Sep 17 00:00:00 2001 From: Windrammer Date: Thu, 11 Jul 2019 09:05:26 -0600 Subject: [PATCH 71/72] Fix bug #82 causing a client crash if /save_case was used without providing a courtroom state --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 344516a..3d812e0 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2884,7 +2884,7 @@ void Courtroom::on_ooc_return_pressed() caseslist.removeOne(".."); caseslist.replaceInStrings(".ini",""); - if (command.size() < 2) + if (command.size() < 3) { append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1"); ui_ooc_chat_message->clear(); From 5eccabcad15a52691228aded1d9c1fd5074fb70e Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 12 Jul 2019 23:00:25 +0000 Subject: [PATCH 72/72] Less insane debugging; minor refactoring (!75) --- include/aoapplication.h | 1 + include/aoevidencebutton.h | 2 ++ include/courtroom.h | 12 ++++-------- include/networkmanager.h | 7 ++++--- src/aoapplication.cpp | 14 +++++++------- src/aoevidencebutton.cpp | 2 ++ src/charselect.cpp | 28 ++++++++++++++-------------- src/courtroom.cpp | 10 ++-------- src/discord_rich_presence.cpp | 4 ++-- src/hardware_functions.cpp | 7 +++---- src/networkmanager.cpp | 16 +++++++++------- src/packet_distribution.cpp | 10 ++++++++++ 12 files changed, 60 insertions(+), 53 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index e698030..60856ee 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -22,6 +22,7 @@ #include #include #include +#include class NetworkManager; class Lobby; diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h index 27fb84b..80b747c 100644 --- a/include/aoevidencebutton.h +++ b/include/aoevidencebutton.h @@ -35,8 +35,10 @@ protected: void enterEvent(QEvent *e); void leaveEvent(QEvent *e); void mouseDoubleClickEvent(QMouseEvent *e); + /* void dragLeaveEvent(QMouseEvent *e); void dragEnterEvent(QMouseEvent *e); + */ signals: void evidence_clicked(int p_id); diff --git a/include/courtroom.h b/include/courtroom.h index cc08f65..99a090b 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -273,8 +272,6 @@ private: QVector arup_cms; QVector arup_locks; - QSignalMapper *char_button_mapper; - QVector ic_chatlog_history; // These map music row items and area row items to their actual IDs. @@ -538,6 +535,7 @@ private: void construct_char_select(); void set_char_select(); void set_char_select_page(); + void char_clicked(int n_char); void put_button_in_place(int starting, int chars_on_this_page); void filter_character_list(); @@ -652,14 +650,12 @@ private slots: void on_char_select_left_clicked(); void on_char_select_right_clicked(); - void on_char_search_changed(const QString& newtext); - void on_char_taken_clicked(int newstate); - void on_char_passworded_clicked(int newstate); + void on_char_search_changed(); + void on_char_taken_clicked(); + void on_char_passworded_clicked(); void on_spectator_clicked(); - void char_clicked(int n_char); - void on_switch_area_music_clicked(); void on_casing_clicked(); diff --git a/include/networkmanager.h b/include/networkmanager.h index e28abfd..f26e658 100644 --- a/include/networkmanager.h +++ b/include/networkmanager.h @@ -44,13 +44,14 @@ public: QString ms_nosrv_hostname = "master.aceattorneyonline.com"; #endif - const int ms_port = 27016; + const quint16 ms_port = 27016; const int timeout_milliseconds = 2000; - const int ms_reconnect_delay_ms = 7000; + // in seconds + const int ms_reconnect_delay = 7; // kind of arbitrary max buffer size - const size_t buffer_max_size = 16384; + #define BUFFER_MAX_SIZE 16384 bool ms_partial_packet = false; QString ms_temp_packet = ""; diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index d7c3e66..4ef1edd 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -37,9 +37,9 @@ void AOApplication::construct_lobby() w_lobby = new Lobby(this); lobby_constructed = true; - QRect screenGeometry = QApplication::desktop()->screenGeometry(); - int x = (screenGeometry.width()-w_lobby->width()) / 2; - int y = (screenGeometry.height()-w_lobby->height()) / 2; + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width()-w_lobby->width()) / 2; + int y = (geometry.height()-w_lobby->height()) / 2; w_lobby->move(x, y); if (is_discord_enabled()) @@ -72,9 +72,9 @@ void AOApplication::construct_courtroom() w_courtroom = new Courtroom(this); courtroom_constructed = true; - QRect screenGeometry = QApplication::desktop()->screenGeometry(); - int x = (screenGeometry.width()-w_courtroom->width()) / 2; - int y = (screenGeometry.height()-w_courtroom->height()) / 2; + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width()-w_courtroom->width()) / 2; + int y = (geometry.height()-w_courtroom->height()) / 2; w_courtroom->move(x, y); } @@ -161,7 +161,7 @@ void AOApplication::ms_connect_finished(bool connected, bool will_retry) { if (lobby_constructed) w_lobby->append_error("Error connecting to master server. Will try again in " - + QString::number(net_manager->ms_reconnect_delay_ms / 1000.f) + " seconds."); + + QString::number(net_manager->ms_reconnect_delay) + " seconds."); } else { diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 924aeb8..15b598f 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -86,6 +86,7 @@ void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) evidence_double_clicked(m_id); } +/* void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e) { //QWidget::dragLeaveEvent(e); @@ -99,6 +100,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e) qDebug() << "drag enter event"; } +*/ void AOEvidenceButton::enterEvent(QEvent * e) { diff --git a/src/charselect.cpp b/src/charselect.cpp index 8e1b912..4987cf5 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -44,7 +44,6 @@ void Courtroom::construct_char_select() set_size_and_pos(ui_char_buttons, "char_buttons"); - connect (char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int))); connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked())); connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked())); @@ -52,9 +51,9 @@ void Courtroom::construct_char_select() connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked())); - connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed(const QString&))); - connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked(int))); - connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked(int))); + connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed())); + connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked())); + connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked())); } void Courtroom::set_char_select() @@ -197,14 +196,15 @@ void Courtroom::character_loading_finished() // Later on, we'll be revealing buttons as we need them. for (int n = 0; n < char_list.size(); n++) { - AOCharButton* character = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); - character->reset(); - character->hide(); - character->set_image(char_list.at(n).name); - ui_char_button_list.append(character); + AOCharButton* char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); + char_button->reset(); + char_button->hide(); + char_button->set_image(char_list.at(n).name); + ui_char_button_list.append(char_button); - connect(character, SIGNAL(clicked()), char_button_mapper, SLOT(map())); - char_button_mapper->setMapping(character, ui_char_button_list.size() - 1); + connect(char_button, &AOCharButton::clicked, [this, n](){ + this->char_clicked(n); + }); // This part here serves as a way of showing to the player that the game is still running, it is // just loading the pictures of the characters. @@ -252,17 +252,17 @@ void Courtroom::filter_character_list() set_char_select_page(); } -void Courtroom::on_char_search_changed(const QString& newtext) +void Courtroom::on_char_search_changed() { filter_character_list(); } -void Courtroom::on_char_passworded_clicked(int newstate) +void Courtroom::on_char_passworded_clicked() { filter_character_list(); } -void Courtroom::on_char_taken_clicked(int newstate) +void Courtroom::on_char_taken_clicked() { filter_character_list(); } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3d812e0..a8e9739 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -6,7 +6,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() // Change the default audio output device to be the one the user has given // in his config.ini file for now. - int a = 0; + unsigned int a = 0; BASS_DEVICEINFO info; if (ao_app->get_audio_output_device() == "default") @@ -21,7 +21,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() if (ao_app->get_audio_output_device() == info.name) { BASS_SetDevice(a); - BASS_Init(a, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); + BASS_Init(static_cast(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); load_bass_opus_plugin(); qDebug() << info.name << "was set as the default audio output device."; break; @@ -49,8 +49,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() testimony_hide_timer = new QTimer(this); testimony_hide_timer->setSingleShot(true); - char_button_mapper = new QSignalMapper(this); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); sfx_player = new AOSfxPlayer(this, ao_app); @@ -2223,11 +2221,7 @@ void Courtroom::chat_tick() case INLINE_GREY: ui_vp_message->insertHtml("" + f_character + ""); break; - default: - ui_vp_message->insertHtml(f_character); - break; } - } else { diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp index 10f5833..ac14bb2 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -11,10 +11,10 @@ Discord::Discord() qInfo() << "Discord RPC ready"; }; handlers.disconnected = [](int errorCode, const char* message) { - qInfo() << "Discord RPC disconnected! " << message; + qInfo() << "Discord RPC disconnected! " << message << errorCode; }; handlers.errored = [](int errorCode, const char* message) { - qWarning() << "Discord RPC errored out! " << message; + qWarning() << "Discord RPC errored out! " << message << errorCode; }; qInfo() << "Initializing Discord RPC"; Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index ebba6ab..5d6b6ff 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -5,12 +5,12 @@ #if (defined (_WIN32) || defined (_WIN64)) #include -DWORD dwVolSerial; -BOOL bIsRetrieved; +static DWORD dwVolSerial; +static BOOL bIsRetrieved; QString get_hdid() { - bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), NULL, NULL, &dwVolSerial, NULL, NULL, NULL, NULL); + bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial, nullptr, nullptr, nullptr, 0); if (bIsRetrieved) return QString::number(dwVolSerial, 16); @@ -18,7 +18,6 @@ QString get_hdid() //a totally random string //what could possibly go wrong return "gxsps32sa9fnwic92mfbs0"; - } #elif (defined (LINUX) || defined (__linux__)) diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index 288a900..5b16db4 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -78,9 +78,9 @@ void NetworkManager::ship_server_packet(QString p_packet) void NetworkManager::handle_ms_packet() { - char buffer[buffer_max_size]; - std::memset(buffer, 0, buffer_max_size); - ms_socket->read(buffer, buffer_max_size); + char buffer[BUFFER_MAX_SIZE]; + std::memset(buffer, 0, BUFFER_MAX_SIZE); + ms_socket->read(buffer, BUFFER_MAX_SIZE); QString in_data = buffer; @@ -137,7 +137,9 @@ void NetworkManager::on_srv_lookup() for (const QDnsServiceRecord &record : srv_records) { +#ifdef DEBUG_NETWORK qDebug() << "Connecting to " << record.target() << ":" << record.port(); +#endif ms_socket->connectToHost(record.target(), record.port()); QTime timer; timer.start(); @@ -206,7 +208,7 @@ void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error) emit ms_connect_finished(false, true); - ms_reconnect_timer->start(ms_reconnect_delay_ms); + ms_reconnect_timer->start(ms_reconnect_delay * 1000); } void NetworkManager::retry_ms_connect() @@ -217,9 +219,9 @@ void NetworkManager::retry_ms_connect() void NetworkManager::handle_server_packet() { - char buffer[buffer_max_size]; - std::memset(buffer, 0, buffer_max_size); - server_socket->read(buffer, buffer_max_size); + char buffer[BUFFER_MAX_SIZE]; + std::memset(buffer, 0, BUFFER_MAX_SIZE); + server_socket->read(buffer, BUFFER_MAX_SIZE); QString in_data = buffer; diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 68d2fb9..942c275 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -14,8 +14,10 @@ void AOApplication::ms_packet_received(AOPacket *p_packet) QString header = p_packet->get_header(); QStringList f_contents = p_packet->get_contents(); +#ifdef DEBUG_NETWORK if (header != "CHECK") qDebug() << "R(ms):" << p_packet->to_string(); +#endif if (header == "ALL") { @@ -127,8 +129,10 @@ void AOApplication::server_packet_received(AOPacket *p_packet) QStringList f_contents = p_packet->get_contents(); QString f_packet = p_packet->to_string(); +#ifdef DEBUG_NETWORK if (header != "checkconnection") qDebug() << "R:" << f_packet; +#endif if (header == "decryptor") { @@ -677,7 +681,9 @@ void AOApplication::send_ms_packet(AOPacket *p_packet) net_manager->ship_ms_packet(f_packet); +#ifdef DEBUG_NETWORK qDebug() << "S(ms):" << f_packet; +#endif delete p_packet; } @@ -691,14 +697,18 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) if (encryption_needed) { +#ifdef DEBUG_NETWORK qDebug() << "S(e):" << f_packet; +#endif p_packet->encrypt_header(s_decryptor); f_packet = p_packet->to_string(); } else { +#ifdef DEBUG_NETWORK qDebug() << "S:" << f_packet; +#endif } net_manager->ship_server_packet(f_packet);