| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:path/path.dart' as path; | 7 import 'package:path/path.dart' as path; |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import 'source_map_validator_helper.dart'; | 10 import 'source_map_validator_helper.dart'; |
| 11 | 11 |
| 12 void main() { | 12 void main() { |
| 13 asyncTest(() async { | 13 asyncTest(() async { |
| 14 Directory tmpDir = await createTempDir(); | 14 Directory tmpDir = await createTempDir(); |
| 15 try { | 15 try { |
| 16 Directory sunflowerDir = new Directory.fromUri( | 16 Directory sunflowerDir = new Directory.fromUri( |
| 17 Platform.script.resolve('../../../third_party/sunflower')); | 17 Platform.script.resolve('../../../third_party/sunflower')); |
| 18 | 18 |
| 19 print("Copying '${sunflowerDir.path}' to '${tmpDir.path}'."); | 19 print("Copying '${sunflowerDir.path}' to '${tmpDir.path}'."); |
| 20 copyDirectory(sunflowerDir, tmpDir); | 20 copyDirectory(sunflowerDir, tmpDir); |
| 21 String ext = Platform.isWindows ? '.bat' : ''; | 21 String ext = Platform.isWindows ? '.bat' : ''; |
| 22 String command = path.normalize(path.join( | 22 String command = path.normalize(path.join( |
| 23 path.fromUri(Platform.script), | 23 path.fromUri(Platform.script), '../../../../sdk/bin/pub${ext}')); |
| 24 '../../../../sdk/bin/pub${ext}')); | |
| 25 String file = path.join(tmpDir.path, 'build/web/sunflower.dart.js'); | 24 String file = path.join(tmpDir.path, 'build/web/sunflower.dart.js'); |
| 26 | 25 |
| 27 print("Running '$command get' from '${tmpDir}'."); | 26 print("Running '$command get' from '${tmpDir}'."); |
| 28 ProcessResult getResult = await Process.run( | 27 ProcessResult getResult = |
| 29 command, ['get'], workingDirectory: tmpDir.path); | 28 await Process.run(command, ['get'], workingDirectory: tmpDir.path); |
| 30 print(getResult.stdout); | 29 print(getResult.stdout); |
| 31 print(getResult.stderr); | 30 print(getResult.stderr); |
| 32 Expect.equals(0, getResult.exitCode, 'Unexpected exitCode from pub get'); | 31 Expect.equals(0, getResult.exitCode, 'Unexpected exitCode from pub get'); |
| 33 | 32 |
| 34 print("Running '$command build --mode=debug' from '${tmpDir}'."); | 33 print("Running '$command build --mode=debug' from '${tmpDir}'."); |
| 35 ProcessResult buildResult = await Process.run( | 34 ProcessResult buildResult = await Process.run( |
| 36 command, ['build','--mode=debug'], workingDirectory: tmpDir.path); | 35 command, ['build', '--mode=debug'], |
| 36 workingDirectory: tmpDir.path); |
| 37 print(buildResult.stdout); | 37 print(buildResult.stdout); |
| 38 print(buildResult.stderr); | 38 print(buildResult.stderr); |
| 39 Expect.equals(0, buildResult.exitCode, 'Unexpected exitCode from pub'); | 39 Expect.equals(0, buildResult.exitCode, 'Unexpected exitCode from pub'); |
| 40 validateSourceMap(new Uri.file(file, windows: Platform.isWindows)); | 40 validateSourceMap(new Uri.file(file, windows: Platform.isWindows)); |
| 41 print("Deleting '${tmpDir.path}'."); | 41 print("Deleting '${tmpDir.path}'."); |
| 42 } finally { | 42 } finally { |
| 43 tmpDir.deleteSync(recursive: true); | 43 tmpDir.deleteSync(recursive: true); |
| 44 } | 44 } |
| 45 }); | 45 }); |
| 46 } | 46 } |
| OLD | NEW |