Updated tasks even more

This commit is contained in:
Profitroll 2023-01-28 18:45:57 +01:00
parent 3bae2b646a
commit b39a0253d1
11 changed files with 72 additions and 37 deletions

57
.vscode/tasks.json vendored
View File

@ -5,6 +5,7 @@
"tasks": [ "tasks": [
{ {
"label": "Clean up", "label": "Clean up",
"detail": "Remove all .pyco and and __pycache__ in the whole project",
"type": "shell", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/cleanup.bat" "command": "./.vscode/tasks/windows/cleanup.bat"
@ -16,6 +17,7 @@
}, },
{ {
"label": "Clean up everything", "label": "Clean up everything",
"detail": "Remove all .pyco and __pycache__ as well as virtual envs, build and dist dirs",
"type": "shell", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/cleanup_everything.bat" "command": "./.vscode/tasks/windows/cleanup_everything.bat"
@ -23,36 +25,46 @@
"linux": { "linux": {
"command": "bash ./.vscode/tasks/linux/cleanup_everything.sh" "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", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/build.bat" "command": "./.vscode/tasks/windows/run_python.bat"
}, },
"linux": { "linux": {
"command": "bash ./.vscode/tasks/linux/build.sh" "command": "bash ./.vscode/tasks/linux/run_python.sh"
},
"group": {
"kind": "test",
"isDefault": true
}, },
"problemMatcher": [], "problemMatcher": [],
"group": { "dependsOn": ["Clean up", "Install requirements"]
"kind": "build",
"isDefault": true
}
}, },
{ {
"label": "Test", "label": "Run (Binary)",
"detail": "Copy compiled binaries from 'dest/%os%' dir into 'testbinary/%os%' and start it",
"type": "shell", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/test.bat" "command": "./.vscode/tasks/windows/run_binary.bat"
}, },
"linux": { "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", "label": "Configure Setup",
"detail": "Configure IF setup file on Windows and .deb package on Linux",
"type": "shell", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/configure_setup.bat" "command": "./.vscode/tasks/windows/configure_setup.bat"
@ -60,10 +72,12 @@
"linux": { "linux": {
"command": "echo \"Not implemented\"" "command": "echo \"Not implemented\""
}, },
"problemMatcher": [] "problemMatcher": [],
"dependsOn": ["Clean up"]
}, },
{ {
"label": "Install build requirements", "label": "Install build requirements",
"detail": "Create buildenv and install the modules to run Pyinstaller's build",
"type": "shell", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/install_build_requirements.bat" "command": "./.vscode/tasks/windows/install_build_requirements.bat"
@ -75,6 +89,7 @@
}, },
{ {
"label": "Install requirements", "label": "Install requirements",
"detail": "Create venv and install the modules to run 'src/main.py'",
"type": "shell", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/install_requirements.bat" "command": "./.vscode/tasks/windows/install_requirements.bat"
@ -85,15 +100,21 @@
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"label": "Run", "label": "Build",
"detail": "Configure .spec and run Pyinstaller",
"type": "shell", "type": "shell",
"windows": { "windows": {
"command": "./.vscode/tasks/windows/run.bat" "command": "./.vscode/tasks/windows/build.bat"
}, },
"linux": { "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
}
},
] ]
} }

View File

@ -1,8 +1,5 @@
#!/bin/bash #!/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/linux/*
rm -rf build/windows/* rm -rf build/windows/*

View File

@ -1,3 +0,0 @@
#!/bin/bash
source venv/bin/activate && bash .vscode/tasks/linux/cleanup.sh && cd ./src && python ./main.py && deactivate

12
.vscode/tasks/linux/run_binary.sh vendored Normal file
View File

@ -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"

8
.vscode/tasks/linux/run_python.sh vendored Normal file
View File

@ -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

View File

@ -1,7 +0,0 @@
#!/bin/bash
cd "dist/linux/StardewSync"
chmod +x "StardewSync"
"./StardewSync"

View File

@ -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\linux\*
rmdir /S /Q build\windows\* rmdir /S /Q build\windows\*

View File

@ -1 +0,0 @@
.\.vscode\tasks\windows\cleanup.bat && venv\Scripts\activate && cd .\src && python .\main.py && deactivate

7
.vscode/tasks/windows/run_binary.bat vendored Normal file
View File

@ -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"

6
.vscode/tasks/windows/run_python.bat vendored Normal file
View File

@ -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

View File

@ -1,2 +0,0 @@
cd "dist\windows\StardewSync"
".\StardewSync.exe"