From b39a0253d115e25d0c9e3a4fd59d3da2923289dc Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sat, 28 Jan 2023 18:45:57 +0100 Subject: [PATCH] Updated tasks even more --- .vscode/tasks.json | 57 +++++++++++++------- .vscode/tasks/linux/cleanup_everything.sh | 3 -- .vscode/tasks/linux/run.sh | 3 -- .vscode/tasks/linux/run_binary.sh | 12 +++++ .vscode/tasks/linux/run_python.sh | 8 +++ .vscode/tasks/linux/test.sh | 7 --- .vscode/tasks/windows/cleanup_everything.bat | 3 -- .vscode/tasks/windows/run.bat | 1 - .vscode/tasks/windows/run_binary.bat | 7 +++ .vscode/tasks/windows/run_python.bat | 6 +++ .vscode/tasks/windows/test.bat | 2 - 11 files changed, 72 insertions(+), 37 deletions(-) delete mode 100644 .vscode/tasks/linux/run.sh create mode 100644 .vscode/tasks/linux/run_binary.sh create mode 100644 .vscode/tasks/linux/run_python.sh delete mode 100644 .vscode/tasks/linux/test.sh delete mode 100644 .vscode/tasks/windows/run.bat create mode 100644 .vscode/tasks/windows/run_binary.bat create mode 100644 .vscode/tasks/windows/run_python.bat delete mode 100644 .vscode/tasks/windows/test.bat diff --git a/.vscode/tasks.json b/.vscode/tasks.json index cbfbc3a..d9e5007 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -5,6 +5,7 @@ "tasks": [ { "label": "Clean up", + "detail": "Remove all .pyco and and __pycache__ in the whole project", "type": "shell", "windows": { "command": "./.vscode/tasks/windows/cleanup.bat" @@ -16,6 +17,7 @@ }, { "label": "Clean up everything", + "detail": "Remove all .pyco and __pycache__ as well as virtual envs, build and dist dirs", "type": "shell", "windows": { "command": "./.vscode/tasks/windows/cleanup_everything.bat" @@ -23,36 +25,46 @@ "linux": { "command": "bash ./.vscode/tasks/linux/cleanup_everything.sh" }, - "problemMatcher": [] + "problemMatcher": [], + "dependsOn": ["Clean up"] }, { - "label": "Build", + "label": "Run (Python)", + "detail": "Copy source code from 'src' dir into 'testpython' and start main.py within venv", "type": "shell", "windows": { - "command": "./.vscode/tasks/windows/build.bat" + "command": "./.vscode/tasks/windows/run_python.bat" }, "linux": { - "command": "bash ./.vscode/tasks/linux/build.sh" + "command": "bash ./.vscode/tasks/linux/run_python.sh" + }, + "group": { + "kind": "test", + "isDefault": true }, "problemMatcher": [], - "group": { - "kind": "build", - "isDefault": true - } + "dependsOn": ["Clean up", "Install requirements"] }, { - "label": "Test", + "label": "Run (Binary)", + "detail": "Copy compiled binaries from 'dest/%os%' dir into 'testbinary/%os%' and start it", "type": "shell", "windows": { - "command": "./.vscode/tasks/windows/test.bat" + "command": "./.vscode/tasks/windows/run_binary.bat" }, "linux": { - "command": "bash ./.vscode/tasks/linux/test.sh" + "command": "bash ./.vscode/tasks/linux/run_binary.sh" }, - "problemMatcher": [] + "group": { + "kind": "test", + "isDefault": false + }, + "problemMatcher": [], + "dependsOn": ["Build"] }, { "label": "Configure Setup", + "detail": "Configure IF setup file on Windows and .deb package on Linux", "type": "shell", "windows": { "command": "./.vscode/tasks/windows/configure_setup.bat" @@ -60,10 +72,12 @@ "linux": { "command": "echo \"Not implemented\"" }, - "problemMatcher": [] + "problemMatcher": [], + "dependsOn": ["Clean up"] }, { "label": "Install build requirements", + "detail": "Create buildenv and install the modules to run Pyinstaller's build", "type": "shell", "windows": { "command": "./.vscode/tasks/windows/install_build_requirements.bat" @@ -75,6 +89,7 @@ }, { "label": "Install requirements", + "detail": "Create venv and install the modules to run 'src/main.py'", "type": "shell", "windows": { "command": "./.vscode/tasks/windows/install_requirements.bat" @@ -85,15 +100,21 @@ "problemMatcher": [] }, { - "label": "Run", + "label": "Build", + "detail": "Configure .spec and run Pyinstaller", "type": "shell", "windows": { - "command": "./.vscode/tasks/windows/run.bat" + "command": "./.vscode/tasks/windows/build.bat" }, "linux": { - "command": "bash ./.vscode/tasks/linux/run.sh" + "command": "bash ./.vscode/tasks/linux/build.sh" }, - "problemMatcher": [] - } + "problemMatcher": [], + "dependsOn": ["Clean up", "Install build requirements"], + "group": { + "kind": "build", + "isDefault": true + } + }, ] } \ No newline at end of file diff --git a/.vscode/tasks/linux/cleanup_everything.sh b/.vscode/tasks/linux/cleanup_everything.sh index 7784155..d58ceea 100644 --- a/.vscode/tasks/linux/cleanup_everything.sh +++ b/.vscode/tasks/linux/cleanup_everything.sh @@ -1,8 +1,5 @@ #!/bin/bash -python3 -Bc "import pathlib; [p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')]" -python3 -Bc "import pathlib; [p.rmdir() for p in pathlib.Path('.').rglob('__pycache__')]" - rm -rf build/linux/* rm -rf build/windows/* diff --git a/.vscode/tasks/linux/run.sh b/.vscode/tasks/linux/run.sh deleted file mode 100644 index b1e89c8..0000000 --- a/.vscode/tasks/linux/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -source venv/bin/activate && bash .vscode/tasks/linux/cleanup.sh && cd ./src && 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 new file mode 100644 index 0000000..e8daf4e --- /dev/null +++ b/.vscode/tasks/linux/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/run_python.sh b/.vscode/tasks/linux/run_python.sh new file mode 100644 index 0000000..da3274e --- /dev/null +++ b/.vscode/tasks/linux/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/test.sh b/.vscode/tasks/linux/test.sh deleted file mode 100644 index ebc2346..0000000 --- a/.vscode/tasks/linux/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -cd "dist/linux/StardewSync" - -chmod +x "StardewSync" - -"./StardewSync" \ No newline at end of file diff --git a/.vscode/tasks/windows/cleanup_everything.bat b/.vscode/tasks/windows/cleanup_everything.bat index e837748..7a7a15c 100644 --- a/.vscode/tasks/windows/cleanup_everything.bat +++ b/.vscode/tasks/windows/cleanup_everything.bat @@ -1,6 +1,3 @@ -python -Bc "import pathlib; [p.unlink() for p in pathlib.Path('.').rglob('*.py[co]')]" -python -Bc "import pathlib; [p.rmdir() for p in pathlib.Path('.').rglob('__pycache__')]" - rmdir /S /Q build\linux\* rmdir /S /Q build\windows\* diff --git a/.vscode/tasks/windows/run.bat b/.vscode/tasks/windows/run.bat deleted file mode 100644 index ff66816..0000000 --- a/.vscode/tasks/windows/run.bat +++ /dev/null @@ -1 +0,0 @@ -.\.vscode\tasks\windows\cleanup.bat && venv\Scripts\activate && cd .\src && 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 new file mode 100644 index 0000000..465a863 --- /dev/null +++ b/.vscode/tasks/windows/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/run_python.bat b/.vscode/tasks/windows/run_python.bat new file mode 100644 index 0000000..762b115 --- /dev/null +++ b/.vscode/tasks/windows/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/test.bat b/.vscode/tasks/windows/test.bat deleted file mode 100644 index acfee92..0000000 --- a/.vscode/tasks/windows/test.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd "dist\windows\StardewSync" -".\StardewSync.exe" \ No newline at end of file