@@ -171,20 +171,19 @@ class TestProject {
171
171
172
172
static Future <void > _copyPackageAndPathDependenciesIntoTempDirectory (
173
173
Directory tempDirectory,
174
- String absolutePackageDirectory ,
174
+ String packageDirectory ,
175
175
Set <String > copiedPackageDirectories,
176
176
) async {
177
177
// There may be cycles in dependencies, so check that we already copied this
178
178
// package.
179
- final packageDirectory = p.basename (absolutePackageDirectory);
180
179
if (copiedPackageDirectories.contains (packageDirectory)) return ;
181
180
final currentPath = absolutePath (pathFromFixtures: packageDirectory);
182
181
final newPath = p.join (tempDirectory.absolute.path, packageDirectory);
183
- Directory (newPath).createSync ();
184
- copyPathSync (currentPath, newPath);
182
+ await Directory (newPath).create ();
183
+ await copyPath (currentPath, newPath);
185
184
copiedPackageDirectories.add (packageDirectory);
186
185
final pubspec = Pubspec .parse (
187
- File (p.join (currentPath, 'pubspec.yaml' )).readAsStringSync (),
186
+ await File (p.join (currentPath, 'pubspec.yaml' )).readAsString (),
188
187
);
189
188
for (final dependency in pubspec.dependencies.values) {
190
189
if (dependency is PathDependency ) {
@@ -202,7 +201,7 @@ class TestProject {
202
201
);
203
202
await _copyPackageAndPathDependenciesIntoTempDirectory (
204
203
tempDirectory,
205
- dependencyDirectory.path,
204
+ p. basename ( dependencyDirectory.path) ,
206
205
copiedPackageDirectories,
207
206
);
208
207
}
@@ -215,7 +214,7 @@ class TestProject {
215
214
'run' ,
216
215
'build_runner' ,
217
216
'clean' ,
218
- ], workingDirectory: absolutePackageDirectory );
217
+ ], workingDirectory: newPath );
219
218
}
220
219
221
220
Future <void > setUp () async {
@@ -226,25 +225,25 @@ class TestProject {
226
225
final systemTempDir = Directory (
227
226
// Resolve symbolic links as build_daemon tests rely on paths matching
228
227
// between the client and the daemon.
229
- Directory .systemTemp.resolveSymbolicLinksSync (),
228
+ await Directory .systemTemp.resolveSymbolicLinks (),
230
229
);
231
- _fixturesCopy = systemTempDir.createTempSync ();
230
+ _fixturesCopy = await systemTempDir.createTemp ();
232
231
await _copyPackageAndPathDependenciesIntoTempDirectory (
233
232
_fixturesCopy,
234
- absolutePackageDirectory ,
233
+ packageDirectory ,
235
234
{},
236
235
);
237
236
}
238
237
239
238
/// Delete the copy of the project.
240
239
Future <void > tearDown () async {
241
240
try {
242
- _fixturesCopy.deleteSync (recursive: true );
241
+ await _fixturesCopy.delete (recursive: true );
243
242
} on FileSystemException catch (_) {
244
243
// On Windows, the build daemon process might still be accessing the
245
244
// working directory, so wait a second and then try again.
246
245
await Future .delayed (const Duration (seconds: 1 ));
247
- _fixturesCopy.deleteSync (recursive: true );
246
+ await _fixturesCopy.delete (recursive: true );
248
247
}
249
248
}
250
249
0 commit comments