Lock Cache before downloading Dart SDK on Windows#7931
Lock Cache before downloading Dart SDK on Windows#7931goderbauer merged 2 commits intoflutter:masterfrom
Conversation
bin/.gitignore
Outdated
| @@ -1,2 +1,2 @@ | |||
| cache | |||
|
|
|||
| flutter.lock | |||
There was a problem hiding this comment.
we have a lockfile already, i would just use the same one that we have for linux
There was a problem hiding this comment.
On Linux, the bash script itself is used as the lock file [1]. This doesn't work on Windows because a file that's open for write cannot be opened for read: Trying to start a flutter.bat instance while another flutter.bat is running and holding a write lock on flutter.bat results in an (uncatchable) OS-level error.
Maybe you are thinking about the lockfile we use on all platforms in dart land [2]. Re-using that one would change the semantics slightly because now dart land and the batch script would share the same lock. That's not necessary, though, because the batch script's download of the dart-sdk in one instance of flutter_tools and dart land's download of engine artifacts in another instance of flutter_tools can happen in parallel without problems.
[1] https://github.com/flutter/flutter/blob/master/bin/flutter#L79
[2] https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/cache.dart#L57
There was a problem hiding this comment.
Ah, fair enough. In that case I would create a second file next to the first specifically for the batch file.
The point of having the file be on the filesystem at all times is to discourage people from thinking that the file's existence is relevant to whether things are locked. It should be trivially provable that everyone should always have the file, and thus the lock can't be based on the existence of the file.
There was a problem hiding this comment.
Talked in person. The other lockfile is also never checked in. We decided to move this lock file into the cache dir, though.
2a161df to
366ac27
Compare

fixes #7921