Prevent CargoCleanTask & RustUpTargetAddTask from running in parallel
requested to merge paxbun/uniffi-kotlin-multiplatform-bindings:fix/cargo-clean-task-race-condition into main
An error occurs when multiple cargoClean
tasks that clean the same workspace run in parallel. This PR fixes that issue using a global lock as in RustUpTargetAddTask.
Changes
- Added
GloballyLockedTask
.GloballyLockedTask.globalLock
takes an identifier string and a code block and executes the code block while other code blocks with the same identifier are suspended. - Made
CargoCleanTask
andRustUpTargetAddTask
useGloballyLockedTask
.-
CargoCleanTask
does not block anotherCargoCleanTask
if it cleans a different workspace. -
RustUpTargetAddTask
blocks every otherRustUpTargetAddTask
. For some reason, sometimes simultaneousrustup target add
commands fail even when they're installing different triples.
-
Edited by Chanjung Kim