Skip to content

Commit

Permalink
Tools - Add a VS Code task to just build a given addon (#10756)
Browse files Browse the repository at this point in the history
* Add a VS Code task to just build the given addon

* Automatically get current addon
  • Loading branch information
DartRuffian authored Feb 25, 2025
1 parent 77a9519 commit 95834b2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
}
},
{
"label": "Build: Hemtt",
"label": "Build: HEMTT",
"command": "hemtt.exe",
"options": {
"cwd": "${workspaceFolder}"
Expand All @@ -107,6 +107,20 @@
"isDefault": true
}
},
{
"label": "Build: HEMTT --just",
"command": "python",
"options": {
"cwd": "${workspaceFolder}"
},
"args": [
"tools/build_current_addon.py",
"${relativeFile}"
],
"group": {
"kind": "build"
}
},
{
"label": "Extension: make move_x64_release",
"command": "cargo",
Expand Down Expand Up @@ -135,5 +149,13 @@
"kind": "build"
}
}
],
"inputs": [
{
"id": "addon",
"description": "Addon Name:",
"default": "common",
"type": "promptString"
}
]
}
20 changes: 20 additions & 0 deletions tools/build_current_addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""
Author: DartRuffian
Builds the current addon, intended to be executed from a VS Code task
"""

import sys
import os

def main() -> None:
filepath = sys.argv[1]
if not (filepath.startswith("addons")):
sys.exit(os.system(f"echo Failed to build: {filepath} is not an addon path"))

addon = filepath.split("\\")[1]
os.system(f"echo Building addon: {addon}")
os.system(f"hemtt build --just {addon}")

if __name__ == "__main__":
main()

0 comments on commit 95834b2

Please sign in to comment.