Ausführen /Debuggen in vscode nun mit Version

This commit is contained in:
eneuber committed 2026-03-23 20:48:56 +01:00
1 parent e96af3ac7e
commit e6c60d0707
5 files changed
+32 -3

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
# Patch Cargo.toml version from VERSION file before build
VERSION=$(cat VERSION)
sed -i "s/^version = ".*"/version = \"$VERSION\"/" Cargo.toml
sed -i 's/^version = ".*"/version = "'"$VERSION"'"/' Cargo.toml
exec cargo build
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
set -e
sed -i 's/^version = ".*"/version = "__VERSION__"/' Cargo.toml
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
reset_version() {
sed -i 's/^version = ".*"/version = "__VERSION__"/' Cargo.toml
}
trap reset_version EXIT
VERSION=$(cat VERSION)
sed -i 's/^version = ".*"/version = "'"$VERSION"'"/' Cargo.toml
cargo run
+2 -1
View File
@@ -9,7 +9,8 @@
"args": [],
"cwd": "${workspaceFolder}",
"sourceLanguages": ["rust"],
"preLaunchTask": "cargo build"
"preLaunchTask": "cargo build",
"postDebugTask": "cargo reset version placeholder"
}
]
}
+13 -1
View File
@@ -9,7 +9,19 @@
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$rustc"]
"problemMatcher": ["$codelldb-rustc"]
},
{
"label": "cargo reset version placeholder",
"type": "shell",
"command": "bash .vscode/cargo-reset-version.sh",
"problemMatcher": []
},
{
"label": "cargo run",
"type": "shell",
"command": "bash .vscode/cargo-run-version.sh",
"problemMatcher": ["$codelldb-rustc"]
}
]
}