diff --git a/.vscode/launch.json b/.vscode/launch.json index a22fa13..0667611 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,7 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "Python: Build", + "name": "build", "type": "python", "request": "launch", "program": "tools/build.py", @@ -10,13 +10,13 @@ "justMyCode": true }, { - "name": "Python: Test OpenAPI Serialize", + "name": "test", "type": "python", "request": "launch", "program": "test/python/test_serialize.py", "console": "integratedTerminal", "justMyCode": false, - "preLaunchTask": "build", + "preLaunchTask": "build-task", "env": { "ERROR_UNCATCHED": "True" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5edb68e..e7dff9e 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,9 +2,44 @@ "version": "2.0.0", "tasks": [ { - "label": "build", + "label": "build-task", "type": "shell", - "command": "python3 tools/build.py && java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python && python3 -m pip install ./python_generated" + "linux": { + "command": [ + "python3 tools/build.py;", + "java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;", + "python3 -m pip install ./python_generated;" + ] + }, + "windows": { + "command": [ + ".venv/Scripts/activate;", + "python tools/build.py;", + "java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;", + "python -m pip install ./python_generated;" + ] + } + }, + { + "label": "init-venv", + "type": "shell", + "runOptions": { + "runOn": "folderOpen" + }, + "linux": { + "command": [ + "python3 -m venv .venv;", + ".venv/bin/python3 -m pip install -r requirements.txt;", + "wget https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.2.0/openapi-generator-cli.jar -O openapi-generator-cli.jar;" + ] + }, + "windows": { + "command": [ + "python -m venv .venv;", + ".venv/Scripts/python -m pip install -r requirements.txt;", + "Invoke-WebRequest https://github.com/fa0311/openapi-generator/releases/download/twitter_openapi_python_1.2.0/openapi-generator-cli.jar -OutFile openapi-generator-cli.jar;" + ] + } } ] }