mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Fix TGUI deconflict hooks, makes them work on windows (#24686)
* Lets us install tgui merge drivers on windows * test this * gamer mode * debug * do it like this * test * test this * stop it being weirdly relative * more relative fixes * try cat * indentation * update CI stuff to cache * correct this * yarn * yarn consistency * do we even need to do this? (no we don't) * properly cache yarn deps in ci * Why do we even have that step --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
+4
-1
@@ -1,3 +1,6 @@
|
||||
## Merger hooks, run tools/hooks/install.bat or install.sh to set up
|
||||
## Merge hooks, run tools/hooks/install.bat or install.sh to set up
|
||||
*.dmm text eol=lf merge=dmm
|
||||
*.dmi binary merge=dmi
|
||||
## TGUI bundle merge drivers
|
||||
*.bundle.* binary merge=tgui-merge-bundle
|
||||
*.chunk.* binary merge=tgui-merge-bundle
|
||||
|
||||
@@ -14,24 +14,34 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: $HOME/SpacemanDMM
|
||||
key: ${{ runner.os }}-spacemandmm
|
||||
|
||||
- name: Install Tools
|
||||
run: |
|
||||
bash tools/ci/install_build_deps.sh
|
||||
bash tools/ci/install_dreamchecker.sh
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: ./tgui/yarn.lock
|
||||
|
||||
- run: pip install -r tools/requirements.txt
|
||||
- name: Run Linters
|
||||
run: |
|
||||
tools/ci/check_json.sh
|
||||
tools/ci/build_tgui.sh
|
||||
tgui/bin/tgui --ci
|
||||
python tools/ci/check_grep2.py
|
||||
python tools/ci/check_line_endings.py
|
||||
python tools/ci/check_file_names.py
|
||||
@@ -41,6 +51,7 @@ jobs:
|
||||
python -m tools.ci.check_icon_conflicts
|
||||
python -m tools.ci.check_icon_dupenames
|
||||
python -m tools.maplint.source --github
|
||||
|
||||
- name: Run DreamChecker
|
||||
shell: bash
|
||||
run: ~/dreamchecker 2>&1 | bash tools/ci/annotate_dm.sh
|
||||
|
||||
@@ -20,9 +20,16 @@ jobs:
|
||||
ref: ${{ env.PR_BRANCH }}
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: ./tgui/yarn.lock
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Perform Merge
|
||||
run: |
|
||||
|
||||
@@ -17,7 +17,5 @@ yarn.lock text eol=lf
|
||||
bin/tgui text eol=lf
|
||||
|
||||
## Treat bundles as binary and ignore them during conflicts
|
||||
*.bundle.* binary merge=tgui-merge-bundle
|
||||
*.chunk.* binary merge=tgui-merge-bundle
|
||||
.yarn/releases/**/* binary
|
||||
.yarn/plugins/**/* binary
|
||||
|
||||
+13
-7
@@ -125,18 +125,24 @@ task-install-git-hooks() {
|
||||
git_root="$(git rev-parse --show-toplevel)"
|
||||
git_base_dir="${base_dir/${git_root}/.}"
|
||||
git config --replace-all merge.tgui-merge-bundle.driver \
|
||||
"${git_base_dir}/bin/tgui --merge=bundle %O %A %B %L"
|
||||
"${git_base_dir}/tgui/bin/tgui --merge=bundle %P %O %A %B %L"
|
||||
echo "tgui: Merge drivers have been successfully installed!"
|
||||
}
|
||||
|
||||
## Bundle merge driver
|
||||
task-merge-bundle() {
|
||||
local file_ancestor="${1}"
|
||||
local file_current="${2}"
|
||||
local file_other="${3}"
|
||||
local conflict_marker_size="${4}"
|
||||
echo "tgui: Discarding a local tgui build"
|
||||
## Do nothing (file_current will be merged and is what we want to keep).
|
||||
local file_path="${1}"
|
||||
local file_ancestor="${2}"
|
||||
local file_current="${3}"
|
||||
local file_other="${4}"
|
||||
local conflict_marker_size="${5}"
|
||||
echo "----------------------"
|
||||
echo "tgui: rebuilding a conflicted tgui bundle, ${file_path}"
|
||||
task-install
|
||||
task-webpack --mode=production
|
||||
echo "tgui: replacing conflicted bundle with newly compiled bundle"
|
||||
cd ../
|
||||
cat $file_path > $file_current
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,13 @@ function task-validate-build {
|
||||
Write-Output "tgui: build is ok"
|
||||
}
|
||||
|
||||
## Installs merge drivers and git hooks
|
||||
function task-install-git-hooks () {
|
||||
Set-Location $global:basedir
|
||||
git config --replace-all merge.tgui-merge-bundle.driver "tgui/bin/tgui --merge=bundle %P %O %A %B %L"
|
||||
Write-Output "tgui: Merge drivers have been successfully installed!"
|
||||
}
|
||||
|
||||
## Main
|
||||
## --------------------------------------------------------
|
||||
|
||||
@@ -113,6 +120,11 @@ if ($Args.Length -gt 0) {
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ($Args[0] -eq "--install-git-hooks") {
|
||||
task-install-git-hooks
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ($Args[0] -eq "--dev") {
|
||||
$Rest = $Args | Select-Object -Skip 1
|
||||
task-install
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source _build_dependencies.sh
|
||||
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm use $NODE_VERSION
|
||||
cd tgui
|
||||
bin/tgui --ci
|
||||
cd ..
|
||||
@@ -1,11 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
source _build_dependencies.sh
|
||||
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm install $NODE_VERSION
|
||||
nvm use $NODE_VERSION
|
||||
npm install --global yarn
|
||||
python3 -m pip install json5
|
||||
|
||||
|
||||
+17
-1
@@ -1,2 +1,18 @@
|
||||
@call "%~dp0\..\bootstrap\python" -m hooks.install %*
|
||||
@pause
|
||||
@echo off
|
||||
set /p choice=Do you want to install TGUI hooks (requires Node.js)? (Y/N):
|
||||
|
||||
if /i "%choice%"=="Y" (
|
||||
@echo off
|
||||
rem Copyright (c) 2020 Aleksej Komarov
|
||||
rem SPDX-License-Identifier: MIT
|
||||
call powershell.exe -NoLogo -ExecutionPolicy Bypass -File "%~dp0\..\..\tgui\bin\tgui_.ps1" --install-git-hooks %*
|
||||
rem Pause if launched in a separate shell unless initiated from powershell
|
||||
echo %PSModulePath% | findstr %USERPROFILE% >NUL
|
||||
if %errorlevel% equ 0 (
|
||||
pause
|
||||
exit 0
|
||||
)
|
||||
echo %cmdcmdline% | find /i "/c"
|
||||
)
|
||||
pause
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
@call "%~dp0\..\bootstrap\python" -m hooks.install --uninstall %*
|
||||
git config --unset merge.tgui-merge-bundle.driver
|
||||
@pause
|
||||
|
||||
Reference in New Issue
Block a user