From 5fe95b2d063a5531912d86a794b97841cccc44a3 Mon Sep 17 00:00:00 2001 From: EnderdracheLP Date: Wed, 10 Jul 2024 22:19:42 +0200 Subject: [PATCH] Cleanup and tweaks --- .github/workflows/Pre-Release.yml | 116 +++++++++++++----------------- .github/workflows/Release.yml | 3 +- .github/workflows/buildMod.yml | 2 +- build.ps1 | 8 ++- buildQMOD.ps1 | 49 +------------ include/ClockViewController.hpp | 4 -- src/ClockViewContoller.cpp | 1 - 7 files changed, 58 insertions(+), 125 deletions(-) diff --git a/.github/workflows/Pre-Release.yml b/.github/workflows/Pre-Release.yml index 2b2aa06..f806cf9 100644 --- a/.github/workflows/Pre-Release.yml +++ b/.github/workflows/Pre-Release.yml @@ -5,9 +5,7 @@ on: env: module_id: ClockMod - version: 1.8.0-rc.1 - ndkname: android-ndk-r24 - + prebuildnumber: 0 jobs: build: @@ -19,107 +17,91 @@ jobs: with: submodules: true lfs: true - - name: Install Powershell - run: sudo apt-get install -y powershell - - name: Cache Android NDK - id: cache-ndk - uses: actions/cache@v2 - env: - cache-name: cache-ndk - with: - path: ndk - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.ndkname }} - restore-keys: | - ${{ runner.os }}-${{ env.cache-name }}-${{ env.ndkname }} - - - name: Install Android NDK - if: steps.cache-ndk.outputs.cache-hit != 'true' + - uses: seanmiddleditch/gha-setup-ninja@v3 + + - name: Get the tag name + run: echo "version=${GITHUB_REF/refs\/tags\//}-rc.${prebuildnumber}" >> $GITHUB_ENV + + - name: Get BSVersion and Version + shell: pwsh run: | - wget -q -O ndk.zip https://dl.google.com/android/repository/${ndkname}-linux-x86_64.zip - unzip -q ndk.zip - mv ${ndkname} ndk - + echo "BSVersion=$((Get-Content ./mod.template.json -Raw | ConvertFrom-Json).packageVersion)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + #echo "version=$((Get-Content ./qpm.shared.json -Raw | ConvertFrom-Json).config.info.version.Split('-')[0])-rc.$($env:prebuildnumber)" + - name: Create ndkpath.txt run: | - cd ndk - pwd > ${GITHUB_WORKSPACE}/ndkpath.txt + echo "$ANDROID_NDK_LATEST_HOME" > ${GITHUB_WORKSPACE}/ndkpath.txt + - name: Get QPM if: steps.cache-qpm.outputs.cache-hit != 'true' uses: dawidd6/action-download-artifact@v2 with: github_token: ${{secrets.GITHUB_TOKEN}} - workflow: main.yml - name: QPM-ubuntu-x64 + workflow: cargo-build.yml + name: linux-qpm path: QPM - repo: sc2ad/QuestPackageManager - + repo: QuestPackageManager/QPM.CLI + + - name: QPM Collapse + run: | + chmod +x ./QPM/qpm + ./QPM/qpm collapse + - name: QPM Dependencies Cache id: cache-qpm-deps uses: actions/cache@v2 env: cache-name: cache-qpm-deps with: - path: QPM_Temp - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('qpm_${{ env.BSVersion }}.json', '.github/BuildMod.yml') }} + path: /home/runner/.local/share/QPM-RS/cache + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('qpm.json') }} restore-keys: | ${{ runner.os }}-${{ env.cache-name }}- ${{ runner.os }}-${{ env.cache-name }} - - name: QPM Restore + - name: QPM Set Version & Restore run: | - chmod +x ./QPM/QPM - ./QPM/QPM restore + ./QPM/qpm package edit --version ${{ env.version }} + ./QPM/qpm restore - name: Check dependency Folders run: | - echo "Checking extern Folder" - ls -lh ${GITHUB_WORKSPACE}/extern/ + echo "Checking extern includes" + ls -lh ${GITHUB_WORKSPACE}/extern/includes echo "" - echo "Checking QPM_Temp Folders" - ls -lh QPM_Temp/ + echo "Checking libs" + ls -lh ${GITHUB_WORKSPACE}/extern/libs echo "" - echo "Listing beatsaber-hook folder" - ls QPM_Temp/beatsaber-hook/ + echo "Checking QPM/cache Folder" + ls -lh $HOME/.local/share/QPM-RS/cache echo "" - echo "Listing all .so files in QPM_Temp" - find QPM_Temp -type f -name "*.so" - name: Build run: | cd ${GITHUB_WORKSPACE} - ./QPM/qpm-rust package edit --version ${{ env.version }} - ./QPM/qpm-rust qmod build - pwsh -Command ./build.ps1 --actions + pwsh -Command ./build.ps1 -actions + - name: Get Library Name id: libname run: | - cd ./libs/arm64-v8a/ + cd ./build/ pattern="lib${module_id}*.so" files=( $pattern ) - echo ::set-output name=NAME::"${files[0]}" + echo "NAME=${files[0]}" >> $GITHUB_OUTPUT + - name: Package QMOD run: | cd ${GITHUB_WORKSPACE} - pwsh -Command ./buildQMOD.ps1 -package - - name: Create Release - id: create_pre-release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.version }} - release_name: ${{ env.module_id }} ${{ env.version }} for Beat Saber ${{ env.BSVersion }} - body_path: ./pre-rl-notes.md - draft: false - prerelease: true - - name: Upload QMOD Pre-Release Asset - id: upload-prerelease-QMOD - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ./QPM/qpm qmod zip -i ./build/ -i ./extern/libs/ ${module_id}_${version}.qmod + + - name: Pre-Release + uses: softprops/action-gh-release@v1 with: - upload_url: ${{ steps.create_pre-release.outputs.upload_url }} - asset_path: ./${{ env.module_id }}.qmod - asset_name: ${{ env.module_id }}.qmod - asset_content_type: application/qmod \ No newline at end of file + name: ${{ env.module_id }} ${{ env.version }} for Beat Saber ${{ env.BSVersion }} + files: | + ./${{ env.module_id }}_${{ env.version }}.qmod + body_path: ./pre-rl-notes.md + generate_release_notes: true + prerelease: true + draft: true \ No newline at end of file diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 24d22d3..f7248ad 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -82,7 +82,6 @@ jobs: - name: Build run: | cd ${GITHUB_WORKSPACE} - ./QPM/qpm package edit --version ${{ env.version }} pwsh -Command ./build.ps1 -actions - name: Get Library Name @@ -91,7 +90,7 @@ jobs: cd ./build/ pattern="lib${module_id}*.so" files=( $pattern ) - echo ::set-output name=NAME::"${files[0]}" + echo "NAME=${files[0]}" >> $GITHUB_OUTPUT - name: Package QMOD run: | diff --git a/.github/workflows/buildMod.yml b/.github/workflows/buildMod.yml index 54839c0..ba47957 100644 --- a/.github/workflows/buildMod.yml +++ b/.github/workflows/buildMod.yml @@ -101,7 +101,7 @@ jobs: cd ./build/ pattern="lib${module_id}*.so" files=( $pattern ) - echo ::set-output name=NAME::"${files[0]}" + echo "NAME=${files[0]}" >> $GITHUB_OUTPUT - name: Package QMOD run: | diff --git a/build.ps1 b/build.ps1 index c050591..66702ab 100644 --- a/build.ps1 +++ b/build.ps1 @@ -20,9 +20,9 @@ echo "Arg $($i) is $($args[$i])" if ($args.Count -eq 0 -or $actions -ne $true) { $qpmshared = "./qpm.shared.json" $qpmsharedJson = Get-Content $qpmshared -Raw | ConvertFrom-Json - $ModID = "ClockMod" + $ModID = $qpmsharedJson.config.info.id $VERSION = $qpmsharedJson.config.info.version.replace("-Dev", "") - if ($null -eq $VERSION) { + if ([string]::IsNullOrEmpty($VERSION)) { $VERSION = "0.0.1" } if ($release -ne $true) { @@ -34,6 +34,10 @@ if ($args.Count -eq 0 -or $actions -ne $true) { if ($actions -eq $true) { $ModID = $env:module_id $VERSION = $env:version + if ([string]::IsNullOrEmpty($VERSION)) { + $qpmsharedJson = Get-Content $qpmshared -Raw | ConvertFrom-Json + $VERSION = $qpmsharedJson.config.info.version.replace("-Dev", "") + } } else { & qpm package edit --version $VERSION } diff --git a/buildQMOD.ps1 b/buildQMOD.ps1 index f271719..245c84d 100644 --- a/buildQMOD.ps1 +++ b/buildQMOD.ps1 @@ -16,7 +16,7 @@ Param( [Switch] $package ) -# Builds a .qmod file for loading with QP or BMBF +# Builds a .qmod file for loading with QP or MBF if ($help -eq $true) { @@ -47,25 +47,8 @@ echo "Packaging QMod $qmodName" echo "Failed to build, exiting..." exit $LASTEXITCODE } - - # qpm qmod build } -echo "Creating qmod from mod.json" - -# $mod = "./mod.json" -# $modJson = Get-Content $mod -Raw | ConvertFrom-Json - -# $filelist = @($mod) - -# $cover = "./" + $modJson.coverImage -# if ((-not ($cover -eq "./")) -and (Test-Path $cover)) -# { -# $filelist += ,$cover -# } else { -# echo "No cover Image found" -# } - $qpmshared = "./qpm.shared.json" $qpmsharedJson = Get-Content $qpmshared -Raw | ConvertFrom-Json @@ -86,38 +69,8 @@ echo "Actions: Packaging QMod $qmodName" $qmodName += "_$($qpmsharedJson.config.info.version)" } -# foreach ($mod in $modJson.lateModFiles) -# { -# $path = "./build/" + $mod -# if (-not (Test-Path $path)) -# { -# $path = "./extern/libs/" + $mod -# } -# $filelist += $path -# } - -# foreach ($lib in $modJson.libraryFiles) -# { -# $path = "./extern/libs/" + $lib -# if (-not (Test-Path $path)) -# { -# $path = "./build/" + $lib -# } -# $filelist += $path -# } - -# $zip = $qmodName + ".zip" $qmod = $qmodName + ".qmod" -# if ((-not ($clean.IsPresent)) -and (Test-Path $qmod)) -# { -# echo "Making Clean Qmod" -# Move-Item $qmod $zip -Force -# } - -# Compress-Archive -Path $filelist -DestinationPath $zip -Update -# Move-Item $zip $qmod -Force - qpm qmod zip -i ./build/ -i ./extern/libs/ $qmod echo "Task Completed" \ No newline at end of file diff --git a/include/ClockViewController.hpp b/include/ClockViewController.hpp index dfd46ef..b70ecf1 100644 --- a/include/ClockViewController.hpp +++ b/include/ClockViewController.hpp @@ -4,8 +4,6 @@ #include "UnityEngine/Color.hpp" #include "HMUI/CurvedTextMeshPro.hpp" #include "bsml/shared/BSML/Components/ModalColorPicker.hpp" -//#include "questui/shared/BeatSaberUI.hpp" -//#include "TMPro/TextMeshProUGUI.hpp" DECLARE_CLASS_CODEGEN(ClockMod, ClockViewController, HMUI::ViewController, @@ -17,6 +15,4 @@ DECLARE_CLASS_CODEGEN(ClockMod, ClockViewController, HMUI::ViewController, custom_types::Helpers::Coroutine UpdateTimeText(); bool SettingsOpen; - - //UnityEngine::Color lastChangedColor; ); \ No newline at end of file diff --git a/src/ClockViewContoller.cpp b/src/ClockViewContoller.cpp index 6be96b4..829faf1 100644 --- a/src/ClockViewContoller.cpp +++ b/src/ClockViewContoller.cpp @@ -27,7 +27,6 @@ using namespace ClockMod; #include "bsml/shared/BSML-Lite/Creation/Settings.hpp" #include "bsml/shared/BSML-Lite/Creation/Text.hpp" -//#include "GlobalNamespace/ColorChangeUIEventType.hpp" // Added for Colorpicker using namespace UnityEngine; using namespace HMUI;