OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
7 * | 7 * |
8 * This library includes: | 8 * This library includes: |
9 * | 9 * |
10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
872 // pubspec.yaml if there is no lib directory. | 872 // pubspec.yaml if there is no lib directory. |
873 var packageLink = newPackageRoot.append(packageName); | 873 var packageLink = newPackageRoot.append(packageName); |
874 var packageLinkTarget = packageDir.append('lib'); | 874 var packageLinkTarget = packageDir.append('lib'); |
875 | 875 |
876 // NOTE: We make a link in the package-root to pkg/expect, since | 876 // NOTE: We make a link in the package-root to pkg/expect, since |
877 // 'package:expect' is not available on pub.dartlang.org! | 877 // 'package:expect' is not available on pub.dartlang.org! |
878 var expectLink = newPackageRoot.append('expect'); | 878 var expectLink = newPackageRoot.append('expect'); |
879 var expectLinkTarget = TestUtils.dartDir | 879 var expectLinkTarget = TestUtils.dartDir |
880 .append('pkg').append('expect').append('lib'); | 880 .append('pkg').append('expect').append('lib'); |
881 | 881 |
882 // NOTE: We make a link in the package-root to pkg/package_test_data, | |
883 // since 'package:package_test_data' is not available on pub.dartlang.org! | |
884 var testDataLink = newPackageRoot.append('package_test_data'); | |
885 var testDataLinkTarget = TestUtils.dartDir | |
886 .append('pkg').append('package_test_data').append('lib'); | |
887 | |
Lasse Reichstein Nielsen
2015/08/10 10:41:51
Is this actually necessary?
Bill Hesse
2015/08/10 11:37:43
No, this is not needed. Only those tests that are
| |
882 // Generate dependency overrides if we use repository packages. | 888 // Generate dependency overrides if we use repository packages. |
883 var packageDirectories = {}; | 889 var packageDirectories = {}; |
884 if (configuration['use_repository_packages']) { | 890 if (configuration['use_repository_packages']) { |
885 packageDirectories = new Map.from(localPackageDirectories); | 891 packageDirectories = new Map.from(localPackageDirectories); |
886 // Do not create an dependency override for the package itself. | 892 // Do not create an dependency override for the package itself. |
887 if (packageDirectories.containsKey(packageName)) { | 893 if (packageDirectories.containsKey(packageName)) { |
888 packageDirectories.remove(packageName); | 894 packageDirectories.remove(packageName); |
889 } | 895 } |
890 } | 896 } |
891 var overrides = buildPubspecDependencyOverrides(packageDirectories); | 897 var overrides = buildPubspecDependencyOverrides(packageDirectories); |
892 | 898 |
893 commands.add(CommandBuilder.instance.getModifyPubspecCommand( | 899 commands.add(CommandBuilder.instance.getModifyPubspecCommand( |
894 pubspecYamlFile.toNativePath(), overrides, | 900 pubspecYamlFile.toNativePath(), overrides, |
895 destinationFile: modifiedYamlFile.toNativePath())); | 901 destinationFile: modifiedYamlFile.toNativePath())); |
896 commands.add(CommandBuilder.instance.getPubCommand( | 902 commands.add(CommandBuilder.instance.getPubCommand( |
897 "get", pubPath, checkoutDirectory, pubCacheDirectory.toNativePath())); | 903 "get", pubPath, checkoutDirectory, pubCacheDirectory.toNativePath())); |
898 if (new Directory(packageLinkTarget.toNativePath()).existsSync()) { | 904 if (new Directory(packageLinkTarget.toNativePath()).existsSync()) { |
899 commands.add(CommandBuilder.instance.getMakeSymlinkCommand( | 905 commands.add(CommandBuilder.instance.getMakeSymlinkCommand( |
900 packageLink.toNativePath(), packageLinkTarget.toNativePath())); | 906 packageLink.toNativePath(), packageLinkTarget.toNativePath())); |
901 } | 907 } |
902 commands.add(CommandBuilder.instance.getMakeSymlinkCommand( | 908 commands.add(CommandBuilder.instance.getMakeSymlinkCommand( |
903 expectLink.toNativePath(), expectLinkTarget.toNativePath())); | 909 expectLink.toNativePath(), expectLinkTarget.toNativePath())); |
910 commands.add(CommandBuilder.instance.getMakeSymlinkCommand( | |
911 testDataLink.toNativePath(), testDataLinkTarget.toNativePath())); | |
Bill Hesse
2015/08/10 11:37:43
Also not needed.
| |
904 | 912 |
905 return { | 913 return { |
906 'commands' : commands, | 914 'commands' : commands, |
907 'package-root' : newPackageRoot, | 915 'package-root' : newPackageRoot, |
908 }; | 916 }; |
909 } | 917 } |
910 | 918 |
911 // If this test is inside a package, we will check if there is a | 919 // If this test is inside a package, we will check if there is a |
912 // pubspec.yaml file and if so, create a custom package root for it. | 920 // pubspec.yaml file and if so, create a custom package root for it. |
913 List<Command> baseCommands = <Command>[]; | 921 List<Command> baseCommands = <Command>[]; |
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2393 for (var key in PATH_REPLACEMENTS.keys) { | 2401 for (var key in PATH_REPLACEMENTS.keys) { |
2394 if (path.startsWith(key)) { | 2402 if (path.startsWith(key)) { |
2395 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2403 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
2396 break; | 2404 break; |
2397 } | 2405 } |
2398 } | 2406 } |
2399 } | 2407 } |
2400 return path; | 2408 return path; |
2401 } | 2409 } |
2402 } | 2410 } |
OLD | NEW |