Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Unified Diff: utils/tests/pub/test_pub.dart

Issue 12782016: Switch pkg packages, pub, and dartdoc to use package: imports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/tests/pub/sdk_constraint_test.dart ('k') | utils/tests/pub/update/pub_update_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/test_pub.dart
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
index bf3722b422c35ca267669eea6db711dea6f4a9cc..156f61691350979adf19161cbf0f9c6ed9096b97 100644
--- a/utils/tests/pub/test_pub.dart
+++ b/utils/tests/pub/test_pub.dart
@@ -16,15 +16,14 @@ import 'dart:math';
import 'dart:uri';
import 'dart:utf';
-import '../../../pkg/http/lib/testing.dart';
-import '../../../pkg/oauth2/lib/oauth2.dart' as oauth2;
-import '../../../pkg/pathos/lib/path.dart' as path;
-import '../../../pkg/scheduled_test/lib/scheduled_process.dart';
-import '../../../pkg/scheduled_test/lib/scheduled_server.dart';
-import '../../../pkg/scheduled_test/lib/scheduled_test.dart';
-import '../../../pkg/yaml/lib/yaml.dart';
-
-import '../../lib/file_system.dart' as fs;
+import 'package:http/testing.dart';
+import 'package:oauth2/oauth2.dart' as oauth2;
+import 'package:pathos/path.dart' as path;
+import 'package:scheduled_test/scheduled_process.dart';
+import 'package:scheduled_test/scheduled_server.dart';
+import 'package:scheduled_test/scheduled_test.dart';
+import 'package:yaml/yaml.dart';
+
import '../../pub/entrypoint.dart';
// TODO(rnystrom): Using "gitlib" as the prefix here is ugly, but "git" collides
// with the git descriptor method. Maybe we should try to clean up the top level
@@ -341,9 +340,10 @@ ScheduledProcess startPub({List args, Future<Uri> tokenEndpoint}) {
}
// Find the main pub entrypoint.
- var pubPath = fs.joinPaths(testDirectory, '../../pub/pub.dart');
+ var pubPath = path.join(testDirectory, '..', '..', 'pub', 'pub.dart');
- var dartArgs = ['--checked', pubPath, '--trace'];
+ var dartArgs = ['--package-root=$_packageRoot/', '--checked', pubPath,
+ '--trace'];
dartArgs.addAll(args);
if (tokenEndpoint == null) tokenEndpoint = new Future.immediate(null);
@@ -365,6 +365,22 @@ ScheduledProcess startPub({List args, Future<Uri> tokenEndpoint}) {
description: args.isEmpty ? 'pub' : 'pub ${args.first}');
}
+/// Whether pub is running from within the Dart SDK, as opposed to from the Dart
+/// source repository.
+bool get _runningFromSdk => path.dirname(relativeToPub('..')) == 'util';
+
+// TODO(nweiz): use the built-in mechanism for accessing this once it exists
+// (issue 9119).
+/// The path to the `packages` directory from which pub loads its dependencies.
+String get _packageRoot {
+ if (_runningFromSdk) {
+ return path.absolute(relativeToPub(path.join('..', '..', 'packages')));
+ } else {
+ return path.absolute(path.join(
+ path.dirname(new Options().executable), '..', '..', 'packages'));
+ }
+}
+
/// Skips the current test if Git is not installed. This validates that the
/// current test is running on a buildbot in which case we expect git to be
/// installed. If we are not running on the buildbot, we will instead see if
« no previous file with comments | « utils/tests/pub/sdk_constraint_test.dart ('k') | utils/tests/pub/update/pub_update_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698