mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
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/dart@16614 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
e481bdca9a
commit
09afa8f485
2 changed files with 20 additions and 0 deletions
|
@ -23,6 +23,14 @@ class DependencyValidator extends Validator {
|
|||
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 &&
|
||||
// TODO(nweiz): once we have development dependencies (issue 5358), we
|
||||
// should warn about unittest. Until then, it's reasonable not to put
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue