Skip to content

Commit

Permalink
Fix stray files check (#4464)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm authored Dec 10, 2024
1 parent b3b6b87 commit 7745ee7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/src/entrypoint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1355,10 +1355,11 @@ See https://dart.dev/go/sdk-constraint
break;
}
void deleteIfPresent(String path, String type) {
fileExists(path);
log.warning('Deleting old $type: `$path`.');
deleteEntry(path);
deletedAny = true;
if (fileExists(path)) {
log.warning('Deleting old $type: `$path`.');
deleteEntry(path);
deletedAny = true;
}
}

deleteIfPresent(p.join(dir, 'pubspec.lock'), 'lock-file');
Expand Down
9 changes: 8 additions & 1 deletion test/workspace_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ foo:foomain''',
'myapp',
'1.2.3',
extras: {
'workspace': ['pkgs/a'],
'workspace': ['pkgs/a', 'pkgs/b'],
},
sdk: '^3.5.0',
),
Expand All @@ -861,6 +861,12 @@ foo:foomain''',
dir('test_data', []),
],
),
dir(
'b',
[
libPubspec('b', '1.1.1', resolutionWorkspace: true),
],
),
]),
]).create();
// Directories outside the workspace should not be affected.
Expand Down Expand Up @@ -902,6 +908,7 @@ foo:foomain''',
environment: {'_PUB_TEST_SDK_VERSION': '3.5.0'},
warning: allOf(
contains('Deleting old lock-file: `.${s}pkgs/a${s}pubspec.lock'),
isNot(contains('.${s}pkgs/b${s}pubspec.lock')),
contains(
'Deleting old package config: '
'`.${s}pkgs/a$s.dart_tool${s}package_config.json`',
Expand Down

0 comments on commit 7745ee7

Please sign in to comment.