From 3bab4faa469bdcd4a1322a46311ef636c63462f5 Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sun, 29 Jan 2023 11:06:23 +0100 Subject: [PATCH] Changed run tasks behavior --- .vscode/tasks.json | 40 +++++++++++++++++-- .vscode/tasks/linux/flush_and_run_binary.sh | 12 ++++++ .vscode/tasks/linux/flush_and_run_python.sh | 8 ++++ .vscode/tasks/linux/run_binary.sh | 5 --- .vscode/tasks/linux/run_python.sh | 5 --- .../tasks/windows/flush_and_run_binary.bat | 7 ++++ .../tasks/windows/flush_and_run_python.bat | 6 +++ .vscode/tasks/windows/run_binary.bat | 5 --- .vscode/tasks/windows/run_python.bat | 5 --- 9 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 .vscode/tasks/linux/flush_and_run_binary.sh create mode 100644 .vscode/tasks/linux/flush_and_run_python.sh create mode 100644 .vscode/tasks/windows/flush_and_run_binary.bat create mode 100644 .vscode/tasks/windows/flush_and_run_python.bat diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d9e5007..2bebf63 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -29,8 +29,8 @@ "dependsOn": ["Clean up"] }, { - "label": "Run (Python)", - "detail": "Copy source code from 'src' dir into 'testpython' and start main.py within venv", + "label": "Run (Python) [Dirty]", + "detail": "Remove all cache files and start main.py within venv", "type": "shell", "windows": { "command": "./.vscode/tasks/windows/run_python.bat" @@ -43,10 +43,27 @@ "isDefault": true }, "problemMatcher": [], + "dependsOn": ["Clean up"] + }, + { + "label": "Run (Python) [Clean]", + "detail": "Needs to be ran before the dirty version can be used. Copy source code from 'src' dir into 'testpython', install requirements and start main.py within venv", + "type": "shell", + "windows": { + "command": "./.vscode/tasks/windows/flush_and_run_python.bat" + }, + "linux": { + "command": "bash ./.vscode/tasks/linux/flush_and_run_python.sh" + }, + "group": { + "kind": "test", + "isDefault": true + }, + "problemMatcher": [], "dependsOn": ["Clean up", "Install requirements"] }, { - "label": "Run (Binary)", + "label": "Run (Binary) [Dirty]", "detail": "Copy compiled binaries from 'dest/%os%' dir into 'testbinary/%os%' and start it", "type": "shell", "windows": { @@ -62,6 +79,23 @@ "problemMatcher": [], "dependsOn": ["Build"] }, + { + "label": "Run (Binary) [Clean]", + "detail": "Needs to be ran before the dirty version can be used. Copy compiled binaries from 'dest/%os%' dir into 'testbinary/%os%' and start it", + "type": "shell", + "windows": { + "command": "./.vscode/tasks/windows/flush_and_run_binary.bat" + }, + "linux": { + "command": "bash ./.vscode/tasks/linux/flush_and_run_binary.sh" + }, + "group": { + "kind": "test", + "isDefault": false + }, + "problemMatcher": [], + "dependsOn": ["Build"] + }, { "label": "Configure Setup", "detail": "Configure IF setup file on Windows and .deb package on Linux", diff --git a/.vscode/tasks/linux/flush_and_run_binary.sh b/.vscode/tasks/linux/flush_and_run_binary.sh new file mode 100644 index 0000000..e8daf4e --- /dev/null +++ b/.vscode/tasks/linux/flush_and_run_binary.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +rm -rf ./testbinary/linux +mkdir ./testbinary/linux + +cp -r ./dist/linux/* ./testbinary/linux/ + +cd "testbinary/linux/" + +chmod +x "StardewSync" + +"./StardewSync" \ No newline at end of file diff --git a/.vscode/tasks/linux/flush_and_run_python.sh b/.vscode/tasks/linux/flush_and_run_python.sh new file mode 100644 index 0000000..da3274e --- /dev/null +++ b/.vscode/tasks/linux/flush_and_run_python.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +rm -rf testpython +mkdir testpython + +cp -r ./src/* ./testpython/ + +source venv/bin/activate && cd ./testpython && python ./main.py && deactivate \ No newline at end of file diff --git a/.vscode/tasks/linux/run_binary.sh b/.vscode/tasks/linux/run_binary.sh index e8daf4e..1a3ed80 100644 --- a/.vscode/tasks/linux/run_binary.sh +++ b/.vscode/tasks/linux/run_binary.sh @@ -1,10 +1,5 @@ #!/bin/bash -rm -rf ./testbinary/linux -mkdir ./testbinary/linux - -cp -r ./dist/linux/* ./testbinary/linux/ - cd "testbinary/linux/" chmod +x "StardewSync" diff --git a/.vscode/tasks/linux/run_python.sh b/.vscode/tasks/linux/run_python.sh index da3274e..fd15bdd 100644 --- a/.vscode/tasks/linux/run_python.sh +++ b/.vscode/tasks/linux/run_python.sh @@ -1,8 +1,3 @@ #!/bin/bash -rm -rf testpython -mkdir testpython - -cp -r ./src/* ./testpython/ - source venv/bin/activate && cd ./testpython && python ./main.py && deactivate \ No newline at end of file diff --git a/.vscode/tasks/windows/flush_and_run_binary.bat b/.vscode/tasks/windows/flush_and_run_binary.bat new file mode 100644 index 0000000..465a863 --- /dev/null +++ b/.vscode/tasks/windows/flush_and_run_binary.bat @@ -0,0 +1,7 @@ +rmdir /S /Q testbinary\windows +mkdir testbinary\windows + +xcopy ".\dist\windows\" ".\testbinary\windows\" /h /i /c /k /e /r /y + +cd ".\testbinary\windows\StardewSync" +".\StardewSync.exe" \ No newline at end of file diff --git a/.vscode/tasks/windows/flush_and_run_python.bat b/.vscode/tasks/windows/flush_and_run_python.bat new file mode 100644 index 0000000..762b115 --- /dev/null +++ b/.vscode/tasks/windows/flush_and_run_python.bat @@ -0,0 +1,6 @@ +rmdir /S /Q testpython +mkdir testpython + +xcopy ".\src\" ".\testpython\" /h /i /c /k /e /r /y + +venv\Scripts\activate && cd .\testpython && python .\main.py && deactivate \ No newline at end of file diff --git a/.vscode/tasks/windows/run_binary.bat b/.vscode/tasks/windows/run_binary.bat index 465a863..f716ba7 100644 --- a/.vscode/tasks/windows/run_binary.bat +++ b/.vscode/tasks/windows/run_binary.bat @@ -1,7 +1,2 @@ -rmdir /S /Q testbinary\windows -mkdir testbinary\windows - -xcopy ".\dist\windows\" ".\testbinary\windows\" /h /i /c /k /e /r /y - cd ".\testbinary\windows\StardewSync" ".\StardewSync.exe" \ No newline at end of file diff --git a/.vscode/tasks/windows/run_python.bat b/.vscode/tasks/windows/run_python.bat index 762b115..7c63ccb 100644 --- a/.vscode/tasks/windows/run_python.bat +++ b/.vscode/tasks/windows/run_python.bat @@ -1,6 +1 @@ -rmdir /S /Q testpython -mkdir testpython - -xcopy ".\src\" ".\testpython\" /h /i /c /k /e /r /y - venv\Scripts\activate && cd .\testpython && python .\main.py && deactivate \ No newline at end of file