File tree 2 files changed +69
-1
lines changed 2 files changed +69
-1
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,20 @@ class Entrypoint {
255
255
if (! sdkMatches) changed = null ;
256
256
257
257
var graph = await loadPackageGraph ();
258
+
259
+ // Clean out any outdated snapshots.
260
+ if (dirExists (binDir)) {
261
+ for (var entry in listDir (binDir)) {
262
+ if (! dirExists (entry)) continue ;
263
+
264
+ var package = path.basename (entry);
265
+ if (! graph.packages.containsKey (package) ||
266
+ graph.isPackageMutable (package)) {
267
+ deleteEntry (entry);
268
+ }
269
+ }
270
+ }
271
+
258
272
var executables = new Map .fromIterable (root.immediateDependencies,
259
273
key: (dep) => dep.name,
260
274
value: (dep) => _executablesForPackage (graph, dep.name, changed));
@@ -319,7 +333,7 @@ class Entrypoint {
319
333
return executables;
320
334
}
321
335
322
- // If any executables doesn 't exist, precompile them regardless of what
336
+ // If any executables don 't exist, precompile them regardless of what
323
337
// changed. Since we delete the bin directory before recompiling, we need to
324
338
// recompile all executables.
325
339
var executablesExist = executables.every ((executable) =>
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+
5
+ import '../descriptor.dart' as d;
6
+ import '../test_pub.dart' ;
7
+ import '../serve/utils.dart' ;
8
+
9
+ main () {
10
+ initConfig ();
11
+ // Regression test for issue 23113
12
+ integration ('runs a named Dart application in a dependency' , () {
13
+ servePackages ((builder) {
14
+ builder.serve ('foo' , '1.0.0' , pubspec: {
15
+ 'name' : 'foo' ,
16
+ 'version' : '1.0.0'
17
+ }, contents: [
18
+ d.dir ("bin" , [
19
+ d.file ("bar.dart" , "main() => print('foobar');" )
20
+ ])
21
+ ]);
22
+ });
23
+
24
+ d.dir (appPath, [
25
+ d.appPubspec ({"foo" : null })
26
+ ]).create ();
27
+
28
+ pubGet ();
29
+
30
+ var pub = pubRun (args: ["foo:bar" ]);
31
+ pub.stdout.expect ("foobar" );
32
+ pub.shouldExit ();
33
+
34
+ d.dir ("foo" , [
35
+ d.libPubspec ("foo" , "2.0.0" ),
36
+ d.dir ("bin" , [
37
+ d.file ("bar.dart" , "main() => print('different');" )
38
+ ])
39
+ ]).create ();
40
+
41
+ d.dir (appPath, [
42
+ d.pubspec ({
43
+ "name" : "myapp" ,
44
+ "dependencies" : {"foo" : {"path" : "../foo" }}
45
+ })
46
+ ]).create ();
47
+
48
+ pubGet ();
49
+
50
+ pub = pubRun (args: ["foo:bar" ]);
51
+ pub.stdout.expect ("different" );
52
+ pub.shouldExit ();
53
+ });
54
+ }
You can’t perform that action at this time.
0 commit comments