Repository navigation
Fix build-before-run skipping the build when relaunching within 10 seconds (#5132) - #5157
Open
DHIVAKAR R (dhivadhiva) wants to merge 3 commits into
Open
DHIVAKAR R (dhivadhiva) wants to merge 3 commits into
DHIVAKAR R (dhivadhiva) wants to merge 3 commits into
Conversation
…conds (microsoft#5132) prepareLaunchTargetExecutable() keeps a 10-second cache so that the several ${command:cmake.launchTarget*} substitutions of one launch.json configuration share a single build (microsoft#5051). Since microsoft#5057 that cache also covers the active launch target and was consulted by every caller, so "CMake: Run Without Debugging" and "CMake: Debug" returned the cached target before saving, checking the configuration or building. Rerunning within 10 seconds of a previous launch silently ran the stale executable. Scope the cache to the launch it was populated for: - Only the substitution commands may reuse a recently prepared result. cmake.launchTarget and cmake.debugTarget are a whole launch on their own and now always prepare the target. - Drop the cache when a debug session starts (the launch it served is under way) and when a document is saved (its result may be stale), so a later launch that goes through the substitutions builds again too. Add end-to-end tests covering the coalescing of substitutions, relaunching right away, and relaunching after a saved edit.
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change addresses item #5132
This changes visible behavior
The following changes are proposed:
prepareLaunchTargetExecutable()only reuses a recently prepared result when it is called from the launch-target substitution commands (cmake.launchTargetPath,cmake.launchTargetDirectory,cmake.launchTargetFilename,cmake.launchTargetName).cmake.launchTarget(CMake: Run Without Debugging) andcmake.debugTarget(CMake: Debug) are a whole launch on their own, so they now always save, check the configuration and build.Debug/Launch interfacesuite, updateddocs/debug-launch.mdandCHANGELOG.md.The purpose of this change
With
cmake.buildBeforeRunenabled, rerunning CMake: Run Without Debugging within about 10 seconds of a previous launch runs the old executable: saved edits are ignored and there is no build output. 1.23.52 is not affected.prepareLaunchTargetExecutable()has a 10-second cache so that the several${command:cmake.launchTarget*}substitutions of onelaunch.jsonconfiguration share a single build (#5051). Since #5057 that cache also covers the active launch target, and it was consulted by every caller.launchTarget()anddebugTarget()therefore got the cached target back beforemaybeAutoSaveAll(), the reconfigure check and the build.The cache is meant to deduplicate builds within one launch, not across launches. VS Code does not tell us which substitutions belong to the same launch (see the first attempt in #5057), so this change keeps the TTL as a backstop and narrows the cache to the launch it was populated for:
launch.jsonconfigurationlaunch.jsonsubstitutions, edit and save, F5 again within 10 sOther Notes/Information
test/end-to-end-tests/successful-build/test/debugger.test.ts:Test launch target substitutions of a single launch share one buildguards the [Bug] Using cmake command substitution causes the build to be triggered multiple times #5051 behavior, which had no test.Test launching the target again right away builds againandTest launch target substitution builds again after a document is savedfail onmainwithexpected 1 to equal 2and pass with this change.yarn lint,yarn backendTests(508 passing) and theDebug/Launch interfaceend-to-end suite (28 passing).vscode.debug.startDebugging.