Skip to content
Snippets Groups Projects
Commit d0adc378 authored by nweiz@google.com's avatar nweiz@google.com
Browse files

Validate that a package doesn't depend on itself.

BUG=7045

Review URL: https://codereview.chromium.org//11737013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@16614 260f80e4-7a28-3924-810f-c04153c831b5
parent 06c96abb
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,14 @@ class DependencyValidator extends Validator { ...@@ -23,6 +23,14 @@ class DependencyValidator extends Validator {
return _warnAboutSource(dependency); return _warnAboutSource(dependency);
} }
if (dependency.name == entrypoint.root.name) {
warnings.add('You don\'t need to explicitly depend on your own '
'package.\n'
'Pub enables "package:${entrypoint.root.name}" imports '
'implicitly.');
return new Future.immediate(null);
}
if (dependency.constraint.isAny && if (dependency.constraint.isAny &&
// TODO(nweiz): once we have development dependencies (issue 5358), we // TODO(nweiz): once we have development dependencies (issue 5358), we
// should warn about unittest. Until then, it's reasonable not to put // should warn about unittest. Until then, it's reasonable not to put
......
...@@ -531,5 +531,17 @@ main() { ...@@ -531,5 +531,17 @@ main() {
}); });
}); });
}); });
test('has a hosted dependency on itself', () {
dir(appPath, [
libPubspec("test_pkg", "1.0.0", [
{'hosted': {'name': 'test_pkg', 'version': '>=1.0.0'}}
])
]).scheduleCreate();
expectValidationWarning(dependency);
run();
});
}); });
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment