@@ -18,16 +18,13 @@ class TestProject {
18
18
final String webAssetsPath;
19
19
final String dartEntryFileName;
20
20
final String htmlEntryFileName;
21
- final bool editable;
22
21
23
22
late Directory _fixturesCopy;
24
23
25
24
/// The top level directory in which we run the test server, e.g.
26
- /// "/workstation/webdev/fixtures /_testSound".
25
+ /// "/tmp /_testSound".
27
26
String get absolutePackageDirectory =>
28
- editable
29
- ? p.join (_fixturesCopy.absolute.path, packageDirectory)
30
- : absolutePath (pathFromFixtures: packageDirectory);
27
+ p.join (_fixturesCopy.absolute.path, packageDirectory);
31
28
32
29
/// The directory to build and serve, e.g. "example".
33
30
String get directoryToServe => p.split (webAssetsPath).first;
@@ -42,17 +39,13 @@ class TestProject {
42
39
}
43
40
44
41
/// The path to the Dart entry file, e.g,
45
- /// "/workstation/webdev/fixtures/_testSound/example/hello_world/main.dart":
46
- String get dartEntryFilePath {
47
- final entryFilePathInPkg = [
48
- packageDirectory,
49
- webAssetsPath,
50
- dartEntryFileName,
51
- ];
52
- return editable
53
- ? p.joinAll ([_fixturesCopy.absolute.path, ...entryFilePathInPkg])
54
- : absolutePath (pathFromFixtures: p.joinAll (entryFilePathInPkg));
55
- }
42
+ /// "/tmp/_testSound/example/hello_world/main.dart":
43
+ String get dartEntryFilePath => p.joinAll ([
44
+ _fixturesCopy.absolute.path,
45
+ packageDirectory,
46
+ webAssetsPath,
47
+ dartEntryFileName,
48
+ ]);
56
49
57
50
/// The URI for the package_config.json is located in:
58
51
/// `<project directory>/.dart_tool/package_config`
@@ -100,7 +93,6 @@ class TestProject {
100
93
webAssetsPath: 'example/hello_world' ,
101
94
dartEntryFileName: 'main.dart' ,
102
95
htmlEntryFileName: 'index.html' ,
103
- editable: true ,
104
96
);
105
97
106
98
static final testScopes = TestProject ._(
@@ -117,7 +109,6 @@ class TestProject {
117
109
webAssetsPath: webCompatiblePath (['example' , 'append_body' ]),
118
110
dartEntryFileName: 'main.dart' ,
119
111
htmlEntryFileName: 'index.html' ,
120
- editable: true ,
121
112
);
122
113
123
114
static final testExperiment = TestProject ._(
@@ -144,7 +135,6 @@ class TestProject {
144
135
webAssetsPath: 'web' ,
145
136
dartEntryFileName: 'main.dart' ,
146
137
htmlEntryFileName: 'index.html' ,
147
- editable: true ,
148
138
);
149
139
150
140
static final testHotRestartBreakpoints = TestProject ._(
@@ -153,7 +143,6 @@ class TestProject {
153
143
webAssetsPath: 'web' ,
154
144
dartEntryFileName: 'main.dart' ,
155
145
htmlEntryFileName: 'index.html' ,
156
- editable: true ,
157
146
);
158
147
159
148
static final testHotReload = TestProject ._(
@@ -162,7 +151,6 @@ class TestProject {
162
151
webAssetsPath: 'web' ,
163
152
dartEntryFileName: 'main.dart' ,
164
153
htmlEntryFileName: 'index.html' ,
165
- editable: true ,
166
154
);
167
155
168
156
static final testHotReloadBreakpoints = TestProject ._(
@@ -171,7 +159,6 @@ class TestProject {
171
159
webAssetsPath: 'web' ,
172
160
dartEntryFileName: 'main.dart' ,
173
161
htmlEntryFileName: 'index.html' ,
174
- editable: true ,
175
162
);
176
163
177
164
TestProject ._({
@@ -180,7 +167,6 @@ class TestProject {
180
167
required this .webAssetsPath,
181
168
required this .dartEntryFileName,
182
169
required this .htmlEntryFileName,
183
- this .editable = false ,
184
170
});
185
171
186
172
static void _copyPackageAndPathDependenciesIntoTempDirectory (
@@ -225,21 +211,19 @@ class TestProject {
225
211
Future <void > setUp () async {
226
212
// Verify that the web assets path has no starting slash.
227
213
assert (! webAssetsPath.startsWith ('/' ));
228
- // If this project is editable, we should use a copy of the package to edit
229
- // instead.
230
- if (editable) {
231
- final systemTempDir = Directory (
232
- // Resolve symbolic links as build_daemon tests rely on paths matching
233
- // between the client and the daemon.
234
- Directory .systemTemp.resolveSymbolicLinksSync (),
235
- );
236
- _fixturesCopy = systemTempDir.createTempSync ();
237
- _copyPackageAndPathDependenciesIntoTempDirectory (
238
- _fixturesCopy,
239
- packageDirectory,
240
- {},
241
- );
242
- }
214
+ // Copy the package into a temporary directory to allow editing of files if
215
+ // needed.
216
+ final systemTempDir = Directory (
217
+ // Resolve symbolic links as build_daemon tests rely on paths matching
218
+ // between the client and the daemon.
219
+ Directory .systemTemp.resolveSymbolicLinksSync (),
220
+ );
221
+ _fixturesCopy = systemTempDir.createTempSync ();
222
+ _copyPackageAndPathDependenciesIntoTempDirectory (
223
+ _fixturesCopy,
224
+ packageDirectory,
225
+ {},
226
+ );
243
227
244
228
// Clean up the project.
245
229
// Called when we need to rebuild sdk and the app from previous test
@@ -251,26 +235,24 @@ class TestProject {
251
235
], workingDirectory: absolutePackageDirectory);
252
236
}
253
237
254
- /// Delete the project if we made a copy .
238
+ /// Delete the copy of the project .
255
239
Future <void > tearDown () async {
256
- if (editable) {
257
- try {
258
- _fixturesCopy.deleteSync (recursive: true );
259
- } on FileSystemException catch (_) {
260
- // On Windows, the build daemon process might still be accessing the
261
- // working directory, so wait a second and then try again.
262
- await Future .delayed (const Duration (seconds: 1 ));
263
- _fixturesCopy.deleteSync (recursive: true );
264
- }
240
+ try {
241
+ _fixturesCopy.deleteSync (recursive: true );
242
+ } on FileSystemException catch (_) {
243
+ // On Windows, the build daemon process might still be accessing the
244
+ // working directory, so wait a second and then try again.
245
+ await Future .delayed (const Duration (seconds: 1 ));
246
+ _fixturesCopy.deleteSync (recursive: true );
265
247
}
266
248
}
267
249
268
250
/// The path to the Dart specified file in the 'lib' directory, e.g,
269
- /// "/workstation/webdev/fixtures /_testSound/lib/library.dart":
270
- String dartLibFilePath (String dartLibFileName) {
271
- final libFilePathInPkg = [packageDirectory, 'lib' , dartLibFileName];
272
- return editable
273
- ? p. joinAll ([_fixturesCopy.absolute.path, ...libFilePathInPkg])
274
- : absolutePath (pathFromFixtures : p. joinAll (libFilePathInPkg));
275
- }
251
+ /// "/tmp /_testSound/lib/library.dart":
252
+ String dartLibFilePath (String dartLibFileName) => p. joinAll ([
253
+ _fixturesCopy.absolute.path,
254
+ packageDirectory,
255
+ 'lib' ,
256
+ dartLibFileName,
257
+ ]);
276
258
}
0 commit comments