Make "--no-packages-dir" the default.
The actual change itself is tiny. However, almost all of pub's existing
integration tests validated the correct output by looking at the
contents of the generated "packages" dirs. :(
I fixed most of those to instead validate against the .packages file.
I didn't change the Git ones because the .packages files end up
containing paths that point to specific Git commits. Getting that
working felt like more work than it was worth right now.
When we fully remove support for packages directories, we'll want to
fix that.
Fix #1450.
R=nweiz@google.com
Review URL: https://codereview.chromium.org//2377063002 .
diff --git a/lib/src/command/downgrade.dart b/lib/src/command/downgrade.dart
index c9d2f7d..a9eef56 100644
--- a/lib/src/command/downgrade.dart
+++ b/lib/src/command/downgrade.dart
@@ -26,7 +26,7 @@
help: "Report what dependencies would change but don't change any.");
argParser.addFlag('packages-dir',
- negatable: true, defaultsTo: true,
+ negatable: true,
help: "Generate a packages/ directory when installing packages.");
}
diff --git a/lib/src/command/get.dart b/lib/src/command/get.dart
index ea2b900..96db4d7 100644
--- a/lib/src/command/get.dart
+++ b/lib/src/command/get.dart
@@ -27,7 +27,7 @@
help: "Precompile executables and transformed dependencies.");
argParser.addFlag('packages-dir',
- negatable: true, defaultsTo: true,
+ negatable: true,
help: "Generate a packages/ directory when installing packages.");
}
diff --git a/lib/src/command/upgrade.dart b/lib/src/command/upgrade.dart
index 25c22f9..a16d8f2 100644
--- a/lib/src/command/upgrade.dart
+++ b/lib/src/command/upgrade.dart
@@ -30,7 +30,7 @@
help: "Precompile executables and transformed dependencies.");
argParser.addFlag('packages-dir',
- negatable: true, defaultsTo: true,
+ negatable: true,
help: "Generate a packages/ directory when installing packages.");
}
diff --git a/test/dependency_override_test.dart b/test/dependency_override_test.dart
index eb1727a..a895b99 100644
--- a/test/dependency_override_test.dart
+++ b/test/dependency_override_test.dart
@@ -30,7 +30,7 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "2.0.0"
}).validate();
});
@@ -51,7 +51,7 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0"
}).validate();
});
@@ -80,7 +80,7 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "2.0.0",
"bar": "1.0.0"
}).validate();
@@ -106,7 +106,7 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0"
}).validate();
});
diff --git a/test/descriptor.dart b/test/descriptor.dart
index d4855be..ec7fea1 100644
--- a/test/descriptor.dart
+++ b/test/descriptor.dart
@@ -203,3 +203,11 @@
/// path to a path dependency, relative to the application directory.
Descriptor packagesFile([Map<String, String> dependencies]) =>
new PackagesFileDescriptor(dependencies);
+
+/// Describes a `.packages` file in the application directory, including the
+/// implicit entry for the app itself.
+Descriptor appPackagesFile(Map<String, String> dependencies) {
+ var copied = new Map.from(dependencies);
+ copied["myapp"] = ".";
+ return dir(appPath, [packagesFile(copied)]);
+}
diff --git a/test/descriptor/packages.dart b/test/descriptor/packages.dart
index a7470c6..6e986f6 100644
--- a/test/descriptor/packages.dart
+++ b/test/descriptor/packages.dart
@@ -9,6 +9,7 @@
import 'package:package_config/packages_file.dart' as packages_file;
import 'package:path/path.dart' as p;
+import 'package:pub_semver/pub_semver.dart';
import 'package:scheduled_test/descriptor.dart';
import 'package:scheduled_test/scheduled_test.dart';
@@ -16,11 +17,6 @@
/// Describes a `.packages` file and its contents.
class PackagesFileDescriptor extends Descriptor {
- // RegExp recognizing semantic version numbers.
- static final _semverRE =
- new RegExp(r"^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)"
- r"(?:-[a-zA-Z\d-]+)?(?:\+[a-zA-Z\d-]+)?$");
-
/// A map from package names to strings describing where the packages are
/// located on disk.
final Map<String, String> _dependencies;
@@ -38,8 +34,8 @@
var mapping = <String, Uri>{};
_dependencies.forEach((package, version) {
var packagePath;
- if (_semverRE.hasMatch(version)) {
- // If it's a semver, it's a cache reference.
+ if (_isSemver(version)) {
+ // It's a cache reference.
packagePath = p.join(cachePath, "$package-$version");
} else {
// Otherwise it's a path relative to the pubspec file,
@@ -84,7 +80,7 @@
}
var description = _dependencies[package];
- if (_semverRE.hasMatch(description)) {
+ if (_isSemver(description)) {
if (!map[package].path.contains(description)) {
fail(".packages of $package has incorrect version. "
"Expected $description, found location: ${map[package]}.");
@@ -109,5 +105,17 @@
}
}
+ /// Returns `true` if [text] is a valid semantic version number string.
+ bool _isSemver(String text) {
+ try {
+ // See if it's a semver.
+ new Version.parse(text);
+ return true;
+ } on FormatException catch (_) {
+ // Do nothing.
+ }
+ return false;
+ }
+
String describe() => name;
}
diff --git a/test/dev_dependency_test.dart b/test/dev_dependency_test.dart
index fd464aa..b00c690 100644
--- a/test/dev_dependency_test.dart
+++ b/test/dev_dependency_test.dart
@@ -29,14 +29,10 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ]),
- d.dir("bar", [
- d.file("bar.dart", 'main() => "bar";')
- ])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo",
+ "bar": "../bar"
+ }).validate();
});
integration("includes dev dependency's transitive dependencies", () {
@@ -63,14 +59,10 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ]),
- d.dir("bar", [
- d.file("bar.dart", 'main() => "bar";')
- ])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo",
+ "bar": "../bar"
+ }).validate();
});
integration("ignores transitive dependency's dev dependencies", () {
@@ -98,11 +90,8 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ]),
- d.nothing("bar")
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo"
+ }).validate();
});
}
\ No newline at end of file
diff --git a/test/downgrade/doesnt_change_git_dependencies_test.dart b/test/downgrade/doesnt_change_git_dependencies_test.dart
index 0fa2944..c4ac3b9 100644
--- a/test/downgrade/doesnt_change_git_dependencies_test.dart
+++ b/test/downgrade/doesnt_change_git_dependencies_test.dart
@@ -18,7 +18,9 @@
"foo": {"git": "../foo.git"}
}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -31,7 +33,9 @@
d.libPubspec('foo', '1.0.0')
]).commit();
- pubDowngrade();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubDowngrade(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/downgrade/unlock_dependers_test.dart b/test/downgrade/unlock_dependers_test.dart
index 6a644c6..a85c537 100644
--- a/test/downgrade/unlock_dependers_test.dart
+++ b/test/downgrade/unlock_dependers_test.dart
@@ -17,7 +17,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "2.0.0",
"bar": "2.0.0"
}).validate();
@@ -29,7 +29,7 @@
pubDowngrade(args: ['bar']);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0"
}).validate();
diff --git a/test/downgrade/unlock_if_necessary_test.dart b/test/downgrade/unlock_if_necessary_test.dart
index a8f4e5f..8120035 100644
--- a/test/downgrade/unlock_if_necessary_test.dart
+++ b/test/downgrade/unlock_if_necessary_test.dart
@@ -17,7 +17,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "2.0.0",
"foo_dep": "2.0.0"
}).validate();
@@ -29,7 +29,7 @@
pubDowngrade(args: ['foo']);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"foo_dep": "1.0.0"
}).validate();
diff --git a/test/get/broken_symlink_test.dart b/test/get/broken_symlink_test.dart
index 73861e2..450d84e 100644
--- a/test/get/broken_symlink_test.dart
+++ b/test/get/broken_symlink_test.dart
@@ -18,7 +18,7 @@
// Create a broken "packages" symlink in "bin".
scheduleSymlink("nonexistent", path.join(appPath, "packages"));
- pubGet();
+ pubGet(args: ["--packages-dir"]);
d.dir(appPath, [
d.dir("bin", [
@@ -41,7 +41,7 @@
// Create a broken "packages" symlink in "bin".
scheduleSymlink("nonexistent", path.join(appPath, "bin", "packages"));
- pubGet();
+ pubGet(args: ["--packages-dir"]);
d.dir(appPath, [
d.dir("bin", [
diff --git a/test/get/git/check_out_and_upgrade_test.dart b/test/get/git/check_out_and_upgrade_test.dart
index 670ee37..318403b 100644
--- a/test/get/git/check_out_and_upgrade_test.dart
+++ b/test/get/git/check_out_and_upgrade_test.dart
@@ -18,7 +18,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(cachePath, [
d.dir('git', [
@@ -38,7 +40,11 @@
d.libPubspec('foo', '1.0.0')
]).commit();
- pubUpgrade(output: contains("Changed 1 dependency!"));
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubUpgrade(
+ args: ["--packages-dir"],
+ output: contains("Changed 1 dependency!"));
// When we download a new version of the git package, we should re-use the
// git/cache directory but create a new git/ directory.
diff --git a/test/get/git/check_out_branch_test.dart b/test/get/git/check_out_branch_test.dart
index 240a863..7ff0503 100644
--- a/test/get/git/check_out_branch_test.dart
+++ b/test/get/git/check_out_branch_test.dart
@@ -25,7 +25,9 @@
"foo": {"git": {"url": "../foo.git", "ref": "old"}}
}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/get/git/check_out_revision_test.dart b/test/get/git/check_out_revision_test.dart
index 0b9a0da..0172356 100644
--- a/test/get/git/check_out_revision_test.dart
+++ b/test/get/git/check_out_revision_test.dart
@@ -25,7 +25,9 @@
"foo": {"git": {"url": "../foo.git", "ref": commit}}
}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/get/git/check_out_test.dart b/test/get/git/check_out_test.dart
index 0b55ea1..8dc9dff 100644
--- a/test/get/git/check_out_test.dart
+++ b/test/get/git/check_out_test.dart
@@ -16,7 +16,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(cachePath, [
d.dir('git', [
diff --git a/test/get/git/check_out_transitive_test.dart b/test/get/git/check_out_transitive_test.dart
index eb2ab7e..67265ba 100644
--- a/test/get/git/check_out_transitive_test.dart
+++ b/test/get/git/check_out_transitive_test.dart
@@ -23,7 +23,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(cachePath, [
d.dir('git', [
diff --git a/test/get/git/check_out_twice_test.dart b/test/get/git/check_out_twice_test.dart
index 9272833..00f0d30 100644
--- a/test/get/git/check_out_twice_test.dart
+++ b/test/get/git/check_out_twice_test.dart
@@ -16,7 +16,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(cachePath, [
d.dir('git', [
diff --git a/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart b/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
index 3caa557..e501470 100644
--- a/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
+++ b/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
@@ -47,7 +47,9 @@
});
// Get the updated version of the git dependency based on the lockfile.
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(cachePath, [
d.dir('git', [
diff --git a/test/get/git/check_out_with_trailing_slash_test.dart b/test/get/git/check_out_with_trailing_slash_test.dart
index 34b3d6f..06b80d1 100644
--- a/test/get/git/check_out_with_trailing_slash_test.dart
+++ b/test/get/git/check_out_with_trailing_slash_test.dart
@@ -19,7 +19,9 @@
d.appDir({"foo": {"git": "../foo.git/"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(cachePath, [
d.dir('git', [
diff --git a/test/get/git/different_repo_name_test.dart b/test/get/git/different_repo_name_test.dart
index 14afbe5..08a676d 100644
--- a/test/get/git/different_repo_name_test.dart
+++ b/test/get/git/different_repo_name_test.dart
@@ -21,7 +21,9 @@
})
]).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('weirdname', [
diff --git a/test/get/git/doesnt_fetch_if_nothing_changes_test.dart b/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
index e0ba454..c7684fa 100644
--- a/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
+++ b/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
@@ -23,7 +23,9 @@
"foo": {"git": {"url": "../foo.git"}}
}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -35,7 +37,9 @@
// re-fetch.
schedule(() => deleteEntry(p.join(sandboxDir, 'foo.git')));
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/get/git/lock_version_test.dart b/test/get/git/lock_version_test.dart
index 06d2759..3c3ceaf 100644
--- a/test/get/git/lock_version_test.dart
+++ b/test/get/git/lock_version_test.dart
@@ -21,7 +21,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
// This get should lock the foo.git dependency to the current revision.
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -38,7 +40,9 @@
]).commit();
// This get shouldn't upgrade the foo.git dependency due to the lockfile.
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/get/git/locked_revision_without_repo_test.dart b/test/get/git/locked_revision_without_repo_test.dart
index 69e918e..dc1ec59 100644
--- a/test/get/git/locked_revision_without_repo_test.dart
+++ b/test/get/git/locked_revision_without_repo_test.dart
@@ -23,7 +23,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
// This get should lock the foo.git dependency to the current revision.
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -42,7 +44,9 @@
]).commit();
// This get shouldn't upgrade the foo.git dependency due to the lockfile.
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/get/git/stay_locked_if_compatible_test.dart b/test/get/git/stay_locked_if_compatible_test.dart
index ab6eb51..9a30ba8 100644
--- a/test/get/git/stay_locked_if_compatible_test.dart
+++ b/test/get/git/stay_locked_if_compatible_test.dart
@@ -17,7 +17,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -32,7 +34,9 @@
d.appDir({"foo": {"git": "../foo.git", "version": ">=1.0.0"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/get/git/unlock_if_incompatible_test.dart b/test/get/git/unlock_if_incompatible_test.dart
index 1e062ab..76fff86 100644
--- a/test/get/git/unlock_if_incompatible_test.dart
+++ b/test/get/git/unlock_if_incompatible_test.dart
@@ -17,7 +17,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -32,7 +34,9 @@
d.appDir({"foo": {"git": "../foo.git", "version": ">=1.0.0"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/get/hosted/avoid_network_requests_test.dart b/test/get/hosted/avoid_network_requests_test.dart
index 54647e9..522622c 100644
--- a/test/get/hosted/avoid_network_requests_test.dart
+++ b/test/get/hosted/avoid_network_requests_test.dart
@@ -38,7 +38,7 @@
// Run the solver again.
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.2.0",
"bar": "1.2.0"
}).validate();
diff --git a/test/get/hosted/cached_pubspec_test.dart b/test/get/hosted/cached_pubspec_test.dart
index 7d3cf08..8f1d7d7 100644
--- a/test/get/hosted/cached_pubspec_test.dart
+++ b/test/get/hosted/cached_pubspec_test.dart
@@ -21,7 +21,7 @@
globalServer.clearRequestedPaths();
d.cacheDir({"foo": "1.2.3"}).validate();
- d.packagesDir({"foo": "1.2.3"}).validate();
+ d.appPackagesFile({"foo": "1.2.3"}).validate();
// Run the solver again now that it's cached.
pubGet();
diff --git a/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart b/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
index 5b0a21b..6adc636 100644
--- a/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
+++ b/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
@@ -19,7 +19,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0",
"shared_dep": "1.0.0"
@@ -29,9 +29,8 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
- "bar": null,
"shared_dep": "1.0.0"
}).validate();
});
diff --git a/test/get/hosted/does_no_network_requests_when_possible_test.dart b/test/get/hosted/does_no_network_requests_when_possible_test.dart
index 9330121..466fe3a 100644
--- a/test/get/hosted/does_no_network_requests_when_possible_test.dart
+++ b/test/get/hosted/does_no_network_requests_when_possible_test.dart
@@ -30,7 +30,7 @@
pubGet();
d.cacheDir({"foo": "1.2.0"}).validate();
- d.packagesDir({"foo": "1.2.0"}).validate();
+ d.appPackagesFile({"foo": "1.2.0"}).validate();
// The get should not have done any network requests since the lock file is
// up to date.
diff --git a/test/get/hosted/get_test.dart b/test/get/hosted/get_test.dart
index 01e2f50..3a54828 100644
--- a/test/get/hosted/get_test.dart
+++ b/test/get/hosted/get_test.dart
@@ -16,7 +16,7 @@
pubGet();
d.cacheDir({"foo": "1.2.3"}).validate();
- d.packagesDir({"foo": "1.2.3"}).validate();
+ d.appPackagesFile({"foo": "1.2.3"}).validate();
});
integration('URL encodes the package name', () {
@@ -52,6 +52,6 @@
pubGet();
d.cacheDir({"foo": "1.2.3"}, port: server.port).validate();
- d.packagesDir({"foo": "1.2.3"}).validate();
+ d.appPackagesFile({"foo": "1.2.3"}).validate();
});
}
diff --git a/test/get/hosted/get_transitive_test.dart b/test/get/hosted/get_transitive_test.dart
index 8034a1b..c0fffd1 100644
--- a/test/get/hosted/get_transitive_test.dart
+++ b/test/get/hosted/get_transitive_test.dart
@@ -19,6 +19,6 @@
pubGet();
d.cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).validate();
- d.packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).validate();
+ d.appPackagesFile({"foo": "1.2.3", "bar": "2.0.4"}).validate();
});
}
diff --git a/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart b/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
index dbbbf88..3e6e65a 100644
--- a/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
+++ b/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
@@ -22,6 +22,6 @@
pubGet();
d.cacheDir({"foo": "1.2.3"}).validate();
- d.packagesDir({"foo": "1.2.3"}).validate();
+ d.appPackagesFile({"foo": "1.2.3"}).validate();
});
}
diff --git a/test/get/hosted/resolve_constraints_test.dart b/test/get/hosted/resolve_constraints_test.dart
index 845925d..51800de 100644
--- a/test/get/hosted/resolve_constraints_test.dart
+++ b/test/get/hosted/resolve_constraints_test.dart
@@ -25,7 +25,7 @@
"baz": "2.0.4"
}).validate();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.2.3",
"bar": "2.3.4",
"baz": "2.0.4"
diff --git a/test/get/hosted/stay_locked_if_compatible_test.dart b/test/get/hosted/stay_locked_if_compatible_test.dart
index 75f07b0..ad82344 100644
--- a/test/get/hosted/stay_locked_if_compatible_test.dart
+++ b/test/get/hosted/stay_locked_if_compatible_test.dart
@@ -14,7 +14,7 @@
pubGet();
- d.packagesDir({"foo": "1.0.0"}).validate();
+ d.appPackagesFile({"foo": "1.0.0"}).validate();
globalPackageServer.add((builder) => builder.serve("foo", "1.0.1"));
@@ -22,6 +22,6 @@
pubGet();
- d.packagesDir({"foo": "1.0.0"}).validate();
+ d.appPackagesFile({"foo": "1.0.0"}).validate();
});
}
diff --git a/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart b/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
index 7873c35..3253117 100644
--- a/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
+++ b/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
@@ -18,7 +18,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0",
"baz": "1.0.0"
@@ -35,7 +35,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0",
"baz": "1.0.0",
diff --git a/test/get/hosted/stay_locked_test.dart b/test/get/hosted/stay_locked_test.dart
index a1f47ba..92e60c8 100644
--- a/test/get/hosted/stay_locked_test.dart
+++ b/test/get/hosted/stay_locked_test.dart
@@ -10,7 +10,7 @@
import '../../test_pub.dart';
main() {
- integration('keeps a pub server package locked to the version in the '
+ integration('keeps a hosted package locked to the version in the '
'lockfile', () {
servePackages((builder) => builder.serve("foo", "1.0.0"));
@@ -19,10 +19,10 @@
// This should lock the foo dependency to version 1.0.0.
pubGet();
- d.packagesDir({"foo": "1.0.0"}).validate();
+ d.appPackagesFile({"foo": "1.0.0"}).validate();
- // Delete the packages path to simulate a new checkout of the application.
- schedule(() => deleteEntry(path.join(sandboxDir, packagesPath)));
+ // Delete the .packages file to simulate a new checkout of the application.
+ schedule(() => deleteEntry(path.join(sandboxDir, packagesFilePath)));
// Start serving a newer package as well.
globalPackageServer.add((builder) => builder.serve("foo", "1.0.1"));
@@ -30,6 +30,6 @@
// This shouldn't upgrade the foo dependency due to the lockfile.
pubGet();
- d.packagesDir({"foo": "1.0.0"}).validate();
+ d.appPackagesFile({"foo": "1.0.0"}).validate();
});
}
diff --git a/test/get/hosted/unlock_if_incompatible_test.dart b/test/get/hosted/unlock_if_incompatible_test.dart
index 08d011c..7ecf0f5 100644
--- a/test/get/hosted/unlock_if_incompatible_test.dart
+++ b/test/get/hosted/unlock_if_incompatible_test.dart
@@ -14,12 +14,12 @@
pubGet();
- d.packagesDir({"foo": "1.0.0"}).validate();
+ d.appPackagesFile({"foo": "1.0.0"}).validate();
globalPackageServer.add((builder) => builder.serve("foo", "1.0.1"));
d.appDir({"foo": ">1.0.0"}).create();
pubGet();
- d.packagesDir({"foo": "1.0.1"}).validate();
+ d.appPackagesFile({"foo": "1.0.1"}).validate();
});
}
diff --git a/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart b/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
index fd65adc..985a348 100644
--- a/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
+++ b/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
@@ -19,7 +19,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0",
"baz": "1.0.0",
@@ -38,7 +38,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "2.0.0",
"bar": "2.0.0",
"baz": "2.0.0",
diff --git a/test/get/hosted/unlock_if_version_doesnt_exist_test.dart b/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
index c48f071..b587c1a 100644
--- a/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
+++ b/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
@@ -16,12 +16,12 @@
d.appDir({"foo": "any"}).create();
pubGet();
- d.packagesDir({"foo": "1.0.0"}).validate();
+ d.appPackagesFile({"foo": "1.0.0"}).validate();
schedule(() => deleteEntry(p.join(sandboxDir, cachePath)));
globalPackageServer.replace((builder) => builder.serve("foo", "1.0.1"));
pubGet();
- d.packagesDir({"foo": "1.0.1"}).validate();
+ d.appPackagesFile({"foo": "1.0.1"}).validate();
});
}
diff --git a/test/get/package_name_test.dart b/test/get/package_name_test.dart
index 85955a2..a9ae0f8 100644
--- a/test/get/package_name_test.dart
+++ b/test/get/package_name_test.dart
@@ -65,6 +65,10 @@
pubGet();
- d.packagesDir({"foo.bar.baz": "1.0.0"}).validate();
+ d.dir(appPath, [
+ d.packagesFile({
+ "foo.bar.baz": "."
+ })
+ ]).validate();
});
}
diff --git a/test/get/path/absolute_path_test.dart b/test/get/path/absolute_path_test.dart
index 48cbd6c..a374249 100644
--- a/test/get/path/absolute_path_test.dart
+++ b/test/get/path/absolute_path_test.dart
@@ -20,23 +20,10 @@
})
]).create();
- pubGet();
+ pubGet(args: ["--packages-dir"]);
- d.dir(packagesPath, [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ])
- ]).validate();
-
- // Move the packages directory and ensure the symlink still works. That
- // will validate that we actually created an absolute symlink.
- d.dir("moved").create();
- scheduleRename(packagesPath, "moved/packages");
-
- d.dir("moved/packages", [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ])
- ]).validate();
+ d.appPackagesFile({
+ "foo": path.join(sandboxDir, "foo")
+ }).validate();
});
-}
\ No newline at end of file
+}
diff --git a/test/get/path/absolute_symlink_test.dart b/test/get/path/absolute_symlink_test.dart
index ec8c1d0..87c6525 100644
--- a/test/get/path/absolute_symlink_test.dart
+++ b/test/get/path/absolute_symlink_test.dart
@@ -21,7 +21,7 @@
})
]).create();
- pubGet();
+ pubGet(args: ["--packages-dir"]);
d.dir("moved").create();
diff --git a/test/get/path/relative_path_test.dart b/test/get/path/relative_path_test.dart
index 42938eb..dd278fd 100644
--- a/test/get/path/relative_path_test.dart
+++ b/test/get/path/relative_path_test.dart
@@ -25,14 +25,12 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo"
+ }).validate();
});
- integration("path is relative to containing d.pubspec", () {
+ integration("path is relative to containing pubspec", () {
d.dir("relative", [
d.dir("foo", [
d.libDir("foo"),
@@ -54,14 +52,10 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ]),
- d.dir("bar", [
- d.file("bar.dart", 'main() => "bar";')
- ])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../relative/foo",
+ "bar": "../relative/bar"
+ }).validate();
});
integration("relative path preserved in the lockfile", () {
diff --git a/test/get/path/relative_symlink_test.dart b/test/get/path/relative_symlink_test.dart
index a775931..cf667cd 100644
--- a/test/get/path/relative_symlink_test.dart
+++ b/test/get/path/relative_symlink_test.dart
@@ -29,7 +29,7 @@
})
]).create();
- pubGet();
+ pubGet(args: ["--packages-dir"]);
d.dir("moved").create();
diff --git a/test/get/path/shared_dependency_symlink_test.dart b/test/get/path/shared_dependency_symlink_test.dart
index 4da178b..6e573d7 100644
--- a/test/get/path/shared_dependency_symlink_test.dart
+++ b/test/get/path/shared_dependency_symlink_test.dart
@@ -38,7 +38,7 @@
d.dir("link").create();
scheduleSymlink("shared", path.join("link", "shared"));
- pubGet();
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
diff --git a/test/get/path/shared_dependency_test.dart b/test/get/path/shared_dependency_test.dart
index b215016..6f9581c 100644
--- a/test/get/path/shared_dependency_test.dart
+++ b/test/get/path/shared_dependency_test.dart
@@ -37,11 +37,11 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
- d.dir("bar", [d.file("bar.dart", 'main() => "bar";')]),
- d.dir("shared", [d.file("shared.dart", 'main() => "shared";')])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo",
+ "bar": "../bar",
+ "shared": "../shared"
+ }).validate();
});
integration("shared dependency with paths that normalize the same", () {
@@ -73,11 +73,11 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
- d.dir("bar", [d.file("bar.dart", 'main() => "bar";')]),
- d.dir("shared", [d.file("shared.dart", 'main() => "shared";')])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo",
+ "bar": "../bar",
+ "shared": "../shared"
+ }).validate();
});
integration("shared dependency with absolute and relative path", () {
@@ -109,10 +109,10 @@
pubGet();
- d.dir(packagesPath, [
- d.dir("foo", [d.file("foo.dart", 'main() => "foo";')]),
- d.dir("bar", [d.file("bar.dart", 'main() => "bar";')]),
- d.dir("shared", [d.file("shared.dart", 'main() => "shared";')])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo",
+ "bar": "../bar",
+ "shared": path.join(sandboxDir, "shared")
+ }).validate();
});
}
\ No newline at end of file
diff --git a/test/get/relative_symlink_test.dart b/test/get/relative_symlink_test.dart
index 72ce591..8dab96f 100644
--- a/test/get/relative_symlink_test.dart
+++ b/test/get/relative_symlink_test.dart
@@ -20,7 +20,7 @@
d.libDir('foo')
]).create();
- pubGet();
+ pubGet(args: ["--packages-dir"]);
scheduleRename(appPath, "moved");
@@ -40,7 +40,7 @@
d.dir("bin")
]).create();
- pubGet();
+ pubGet(args: ["--packages-dir"]);
scheduleRename(appPath, "moved");
diff --git a/test/get/switch_source_test.dart b/test/get/switch_source_test.dart
index f863d4b..7efe431 100644
--- a/test/get/switch_source_test.dart
+++ b/test/get/switch_source_test.dart
@@ -18,11 +18,11 @@
pubGet();
- d.packagesDir({"foo": "0.0.1"}).validate();
+ d.appPackagesFile({"foo": "../foo"}).validate();
d.appDir({"foo": "any"}).create();
pubGet();
- d.packagesDir({"foo": "1.2.3"}).validate();
+ d.appPackagesFile({"foo": "1.2.3"}).validate();
});
}
diff --git a/test/hosted/offline_test.dart b/test/hosted/offline_test.dart
index 4be597a..492045d 100644
--- a/test/hosted/offline_test.dart
+++ b/test/hosted/offline_test.dart
@@ -31,7 +31,7 @@
pubCommand(command, args: ['--offline'], warning: warning);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.2.3",
"bar": "1.2.3"
}).validate();
@@ -57,7 +57,7 @@
pubCommand(command, args: ['--offline'], warning: warning);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.2.3-alpha.1"
}).validate();
});
@@ -120,7 +120,7 @@
pubCommand(command, args: ['--offline']);
- d.packagesDir({"foo": "1.2.3"}).validate();
+ d.appPackagesFile({"foo": "1.2.3"}).validate();
});
});
}
diff --git a/test/hosted/remove_removed_dependency_test.dart b/test/hosted/remove_removed_dependency_test.dart
index f6bfdc3..9dc05c0 100644
--- a/test/hosted/remove_removed_dependency_test.dart
+++ b/test/hosted/remove_removed_dependency_test.dart
@@ -17,7 +17,7 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0"
}).validate();
@@ -26,9 +26,8 @@
pubCommand(command);
- d.packagesDir({
- "foo": "1.0.0",
- "bar": null
+ d.appPackagesFile({
+ "foo": "1.0.0"
}).validate();
});
});
diff --git a/test/hosted/remove_removed_transitive_dependency_test.dart b/test/hosted/remove_removed_transitive_dependency_test.dart
index ed79583..a4f5fac 100644
--- a/test/hosted/remove_removed_transitive_dependency_test.dart
+++ b/test/hosted/remove_removed_transitive_dependency_test.dart
@@ -28,7 +28,7 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0",
"shared_dep": "1.0.0",
@@ -39,11 +39,9 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
- "bar": null,
- "shared_dep": "1.0.0",
- "bar_dep": null,
+ "shared_dep": "1.0.0"
}).validate();
});
});
diff --git a/test/implicit_barback_dependency_test.dart b/test/implicit_barback_dependency_test.dart
index 23954cf..a53cf0e 100644
--- a/test/implicit_barback_dependency_test.dart
+++ b/test/implicit_barback_dependency_test.dart
@@ -38,8 +38,11 @@
pubCommand(command);
- d.packagesDir({
- "barback": nextPatch
+ d.appPackagesFile({
+ "async": asyncVersion,
+ "barback": nextPatch,
+ "source_span": sourceSpanVersion,
+ "stack_trace": stackTraceVersion
}).validate();
});
@@ -67,9 +70,12 @@
pubCommand(command);
- d.packagesDir({
+ d.appPackagesFile({
+ "async": asyncVersion,
"barback": nextPatch,
- "foo": "0.0.1"
+ "source_span": sourceSpanVersion,
+ "stack_trace": stackTraceVersion,
+ "foo": "../foo"
}).validate();
});
@@ -97,8 +103,11 @@
pubCommand(command);
- d.packagesDir({
- "barback": current
+ d.appPackagesFile({
+ "async": asyncVersion,
+ "barback": "../barback",
+ "source_span": sourceSpanVersion,
+ "stack_trace": stackTraceVersion,
}).validate();
});
});
@@ -122,8 +131,11 @@
pubGet();
// It should be upgraded.
- d.packagesDir({
- "barback": current
+ d.appPackagesFile({
+ "async": asyncVersion,
+ "barback": current,
+ "source_span": sourceSpanVersion,
+ "stack_trace": stackTraceVersion,
}).validate();
});
diff --git a/test/implicit_dependency_test.dart b/test/implicit_dependency_test.dart
index 4c77978..000a30e 100644
--- a/test/implicit_dependency_test.dart
+++ b/test/implicit_dependency_test.dart
@@ -27,7 +27,12 @@
pubCommand(command);
- d.packagesDir({"stack_trace": nextPatch("stack_trace")}).validate();
+ d.appPackagesFile({
+ "async": current("async"),
+ "barback": current("barback"),
+ "source_span": current("source_span"),
+ "stack_trace": nextPatch("stack_trace")
+ }).validate();
});
integration("pub's implicit constraint uses the same source and "
@@ -58,8 +63,11 @@
// Validate that we're using the path dependency version of stack_trace
// rather than the hosted version.
- d.packagesDir({
- "stack_trace": current("stack_trace")
+ d.appPackagesFile({
+ "async": current("async"),
+ "barback": current("barback"),
+ "source_span": current("source_span"),
+ "stack_trace": "../stack_trace"
}).validate();
});
@@ -80,7 +88,7 @@
pubCommand(command);
- d.packagesDir({"stack_trace": max("stack_trace")}).validate();
+ d.appPackagesFile({"stack_trace": max("stack_trace")}).validate();
});
});
@@ -105,7 +113,10 @@
pubGet();
// It should be upgraded.
- d.packagesDir({
+ d.appPackagesFile({
+ "async": current("async"),
+ "barback": current("barback"),
+ "source_span": current("source_span"),
"stack_trace": current("stack_trace")
}).validate();
});
diff --git a/test/no_packages_dir_test.dart b/test/no_packages_dir_test.dart
index 579788e..2e590c1 100644
--- a/test/no_packages_dir_test.dart
+++ b/test/no_packages_dir_test.dart
@@ -9,69 +9,7 @@
main() {
forBothPubGetAndUpgrade((command) {
- group("with --no-packages-dir", () {
- integration("installs hosted dependencies to the cache", () {
- servePackages((builder) {
- builder.serve("foo", "1.0.0");
- builder.serve("bar", "1.0.0");
- });
-
- d.appDir({"foo": "any", "bar": "any"}).create();
-
- pubCommand(command, args: ["--no-packages-dir"]);
-
- d.nothing("$appPath/packages").validate();
-
- d.hostedCache([
- d.dir("foo-1.0.0", [
- d.dir("lib", [d.file("foo.dart", 'main() => "foo 1.0.0";')])
- ]),
- d.dir("bar-1.0.0", [
- d.dir("lib", [d.file("bar.dart", 'main() => "bar 1.0.0";')])
- ])
- ]).validate();
- });
-
- integration("installs git dependencies to the cache", () {
- ensureGit();
-
- d.git('foo.git', [
- d.libDir('foo'),
- d.libPubspec('foo', '1.0.0')
- ]).create();
-
- d.appDir({"foo": {"git": "../foo.git"}}).create();
-
- pubCommand(command, args: ["--no-packages-dir"]);
-
- d.nothing("$appPath/packages").validate();
-
- d.dir(cachePath, [
- d.dir('git', [
- d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
- d.gitPackageRevisionCacheDir('foo')
- ])
- ]).validate();
- });
-
- integration("locks path dependencies", () {
- d.dir("foo", [
- d.libDir("foo"),
- d.libPubspec("foo", "0.0.1")
- ]).create();
-
- d.dir(appPath, [
- d.appPubspec({
- "foo": {"path": "../foo"}
- })
- ]).create();
-
- pubCommand(command, args: ["--no-packages-dir"]);
-
- d.nothing("$appPath/packages").validate();
- d.matcherFile("$appPath/pubspec.lock", contains("foo"));
- });
-
+ group("without --packages-dir", () {
integration("removes package directories near entrypoints", () {
d.dir(appPath, [
d.appPubspec(),
@@ -81,7 +19,7 @@
d.dir("web/subdir/packages")
]).create();
- pubCommand(command, args: ["--no-packages-dir"]);
+ pubCommand(command);
d.dir(appPath, [
d.nothing("packages"),
@@ -100,7 +38,7 @@
d.dir("lib/packages")
]).create();
- pubCommand(command, args: ["--no-packages-dir"]);
+ pubCommand(command);
d.dir(appPath, [
d.nothing("packages"),
diff --git a/test/pub_get_and_upgrade_test.dart b/test/pub_get_and_upgrade_test.dart
index d7c45e2..5d1c601 100644
--- a/test/pub_get_and_upgrade_test.dart
+++ b/test/pub_get_and_upgrade_test.dart
@@ -30,20 +30,26 @@
});
});
- integration('adds itself to the packages', () {
- // The symlink should use the name in the pubspec, not the name of the
+ integration('adds itself to the packages directory and .packages file', () {
+ // The package should use the name in the pubspec, not the name of the
// directory.
d.dir(appPath, [
d.pubspec({"name": "myapp_name"}),
d.libDir('myapp_name')
]).create();
- pubCommand(command);
+ pubCommand(command, args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir("myapp_name", [
d.file('myapp_name.dart', 'main() => "myapp_name";')
])
+ ]).validate();
+
+ d.dir("myapp", [
+ d.packagesFile({
+ "myapp_name": "."
+ })
]).validate();
});
@@ -55,7 +61,7 @@
d.pubspec({"name": "myapp_name"}),
]).create();
- pubCommand(command);
+ pubCommand(command, args: ["--packages-dir"]);
d.dir(packagesPath, [
d.nothing("myapp_name")
@@ -73,7 +79,7 @@
d.appPubspec({"foo": {"path": "../foo"}})
]).create();
- pubCommand(command);
+ pubCommand(command, args: ["--packages-dir"]);
d.packagesDir({"foo": null}).validate();
});
diff --git a/test/sdk_test.dart b/test/sdk_test.dart
index 988e7e2..7c10f74 100644
--- a/test/sdk_test.dart
+++ b/test/sdk_test.dart
@@ -40,8 +40,6 @@
'bar': '1.0.0'
})
]).validate();
-
- d.packagesDir({'foo': '0.0.1', 'bar': '1.0.0'}).validate();
});
group("fails if", () {
@@ -71,7 +69,7 @@
'- myapp',
exitCode: exit_codes.UNAVAILABLE);
});
-
+
integration("the SDK doesn't contain the package", () {
d.appDir({"bar": {"sdk": "flutter"}}).create();
pubCommand(command,
diff --git a/test/test_pub.dart b/test/test_pub.dart
index 4269750..12848dc 100644
--- a/test/test_pub.dart
+++ b/test/test_pub.dart
@@ -75,6 +75,10 @@
/// to the sandbox directory.
final String packagesPath = "$appPath/packages";
+/// The path of the ".packages" file in the mock app used for tests, relative
+/// to the sandbox directory.
+final String packagesFilePath = "$appPath/.packages";
+
/// Set to true when the current batch of scheduled events should be aborted.
bool _abortScheduled = false;
diff --git a/test/unknown_source_test.dart b/test/unknown_source_test.dart
index 65bc476..89c66f3 100644
--- a/test/unknown_source_test.dart
+++ b/test/unknown_source_test.dart
@@ -60,11 +60,9 @@
pubCommand(command);
// Should upgrade to the new one.
- d.dir(packagesPath, [
- d.dir("foo", [
- d.file("foo.dart", 'main() => "foo";')
- ])
- ]).validate();
+ d.appPackagesFile({
+ "foo": "../foo"
+ }).validate();
});
});
}
diff --git a/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart b/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
index 69459c7..c05a630 100644
--- a/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
+++ b/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
@@ -24,7 +24,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -47,7 +49,9 @@
d.libPubspec('foo_dep', '1.0.0')
]).commit();
- pubUpgrade(args: ['foo']);
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubUpgrade(args: ["--packages-dir", 'foo']);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/upgrade/git/upgrade_locked_test.dart b/test/upgrade/git/upgrade_locked_test.dart
index ecbea87..767ba02 100644
--- a/test/upgrade/git/upgrade_locked_test.dart
+++ b/test/upgrade/git/upgrade_locked_test.dart
@@ -24,7 +24,9 @@
"bar": {"git": "../bar.git"}
}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -45,7 +47,9 @@
d.libPubspec('bar', '1.0.0')
]).commit();
- pubUpgrade();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubUpgrade(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/upgrade/git/upgrade_one_locked_test.dart b/test/upgrade/git/upgrade_one_locked_test.dart
index d6819ef..5d07132 100644
--- a/test/upgrade/git/upgrade_one_locked_test.dart
+++ b/test/upgrade/git/upgrade_one_locked_test.dart
@@ -24,7 +24,9 @@
"bar": {"git": "../bar.git"}
}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ['--packages-dir']);
d.dir(packagesPath, [
d.dir('foo', [
@@ -45,7 +47,9 @@
d.libPubspec('bar', '1.0.0')
]).commit();
- pubUpgrade(args: ['foo']);
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubUpgrade(args: ['--packages-dir', 'foo']);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart b/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
index 670a535..e669251 100644
--- a/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
+++ b/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
@@ -19,7 +19,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -32,8 +34,12 @@
d.libPubspec('zoo', '1.0.0')
]).commit();
- pubUpgrade(error: contains('"name" field doesn\'t match expected name '
- '"foo".'), exitCode: exit_codes.DATA);
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubUpgrade(
+ args: ['--packages-dir'],
+ error: contains('"name" field doesn\'t match expected name "foo".'),
+ exitCode: exit_codes.DATA);
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart b/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
index 1991861..23faced 100644
--- a/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
+++ b/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
@@ -17,7 +17,9 @@
d.appDir({"foo": {"git": "../foo.git"}}).create();
- pubGet();
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubGet(args: ["--packages-dir"]);
d.dir(packagesPath, [
d.dir('foo', [
@@ -28,8 +30,12 @@
repo.runGit(['rm', 'pubspec.yaml']);
repo.runGit(['commit', '-m', 'delete']);
- pubUpgrade(error: new RegExp(r'Could not find a file named "pubspec.yaml" '
- r'in [^\n]*\.'));
+ // TODO(rnystrom): Remove "--packages-dir" and validate using the
+ // ".packages" file instead of looking in the "packages" directory.
+ pubUpgrade(
+ args: ["--packages-dir"],
+ error: new RegExp(r'Could not find a file named "pubspec.yaml" '
+ r'in [^\n]*\.'));
d.dir(packagesPath, [
d.dir('foo', [
diff --git a/test/upgrade/hosted/unlock_dependers_test.dart b/test/upgrade/hosted/unlock_dependers_test.dart
index 11dcc3c..dd57e69 100644
--- a/test/upgrade/hosted/unlock_dependers_test.dart
+++ b/test/upgrade/hosted/unlock_dependers_test.dart
@@ -17,7 +17,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0"
}).validate();
@@ -29,7 +29,7 @@
pubUpgrade(args: ['bar']);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "2.0.0",
"bar": "2.0.0"
}).validate();
diff --git a/test/upgrade/hosted/unlock_if_necessary_test.dart b/test/upgrade/hosted/unlock_if_necessary_test.dart
index 1b01507..26e7a5a 100644
--- a/test/upgrade/hosted/unlock_if_necessary_test.dart
+++ b/test/upgrade/hosted/unlock_if_necessary_test.dart
@@ -17,7 +17,7 @@
pubGet();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"foo_dep": "1.0.0"
}).validate();
@@ -29,7 +29,7 @@
pubUpgrade(args: ['foo']);
- d.packagesDir({
+ d.appPackagesFile({
"foo": "2.0.0",
"foo_dep": "2.0.0"
}).validate();
diff --git a/test/upgrade/hosted/upgrade_removed_constraints_test.dart b/test/upgrade/hosted/upgrade_removed_constraints_test.dart
index b6f1c36..70e4d79 100644
--- a/test/upgrade/hosted/upgrade_removed_constraints_test.dart
+++ b/test/upgrade/hosted/upgrade_removed_constraints_test.dart
@@ -18,7 +18,7 @@
pubUpgrade();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
"bar": "1.0.0",
"shared_dep": "1.0.0"
@@ -28,9 +28,8 @@
pubUpgrade();
- d.packagesDir({
+ d.appPackagesFile({
"foo": "1.0.0",
- "bar": null,
"shared_dep": "2.0.0"
}).validate();
});