Ausführen /Debuggen in vscode nun mit Version
This commit is contained in:
parent
e96af3ac7e
commit
e6c60d0707
3
.vscode/cargo-build-version.sh
vendored
3
.vscode/cargo-build-version.sh
vendored
@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
# Patch Cargo.toml version from VERSION file before build
|
# Patch Cargo.toml version from VERSION file before build
|
||||||
VERSION=$(cat VERSION)
|
VERSION=$(cat VERSION)
|
||||||
sed -i "s/^version = ".*"/version = \"$VERSION\"/" Cargo.toml
|
sed -i 's/^version = ".*"/version = "'"$VERSION"'"/' Cargo.toml
|
||||||
exec cargo build
|
exec cargo build
|
||||||
|
|||||||
3
.vscode/cargo-reset-version.sh
vendored
Normal file
3
.vscode/cargo-reset-version.sh
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
sed -i 's/^version = ".*"/version = "__VERSION__"/' Cargo.toml
|
||||||
12
.vscode/cargo-run-version.sh
vendored
Normal file
12
.vscode/cargo-run-version.sh
vendored
Normal 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
|
||||||
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
@ -9,7 +9,8 @@
|
|||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"sourceLanguages": ["rust"],
|
"sourceLanguages": ["rust"],
|
||||||
"preLaunchTask": "cargo build"
|
"preLaunchTask": "cargo build",
|
||||||
|
"postDebugTask": "cargo reset version placeholder"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
14
.vscode/tasks.json
vendored
14
.vscode/tasks.json
vendored
@ -9,7 +9,19 @@
|
|||||||
"kind": "build",
|
"kind": "build",
|
||||||
"isDefault": true
|
"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"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user