Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEA-3685: Reverted non-dev bin import usage errors #115

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.0.1
- Reverted "non-dev packages that are only used within bin/", this was an invalid assumption and would cause
failures for any consumer which treats `/bin` as apart of the public api.

# 4.0.0

- **Breaking Change:** Added "non-dev packages that are only used within bin/" check to cover this edge case.
Expand Down
13 changes: 0 additions & 13 deletions lib/src/dependency_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,6 @@ Future<void> run() async {
return binDir.listSync().any((entity) => entity.path.endsWith('.dart'));
}).toSet();

final nonDevPackagesWithExecutables = packagesWithExecutables
.where(pubspec.dependencies.containsKey)
.toSet();
if (nonDevPackagesWithExecutables.isNotEmpty) {
logIntersection(
Level.WARNING,
'The following packages contain executables, and are only used outside of lib/. These should be downgraded to dev_dependencies:',
unusedDependencies,
nonDevPackagesWithExecutables,
);
exitCode = 1;
}

logIntersection(
Level.INFO,
'The following packages contain executables, they are assumed to be used:',
Expand Down
34 changes: 0 additions & 34 deletions test/executable_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -576,40 +576,6 @@ void main() {
expect(result.stdout, contains('No dependency issues found!'));
});

test('fails when dependencies not used provide executables, but are not dev_dependencies', () async {
final pubspec = unindent('''
name: common_binaries
version: 0.0.0
private: true
environment:
sdk: '>=2.12.0 <4.0.0'
dependencies:
build_runner: ^2.3.3
coverage: any
dart_style: ^2.3.2
dependency_validator:
path: ${Directory.current.path}
dependency_overrides:
build_config:
git:
url: https://github.com/dart-lang/build.git
path: build_config
ref: $buildConfigRef
''');

await d.dir('common_binaries', [
d.dir('lib', [
d.file('fake.dart', 'bool fake = true;'),
]),
d.file('pubspec.yaml', pubspec),
]).create();

result = checkProject('${d.sandbox}/common_binaries');

expect(result.exitCode, 1);
expect(result.stderr, contains('The following packages contain executables, and are only used outside of lib/. These should be downgraded to dev_dependencies'));
});

test(
'passes when dependencies are not imported but provide auto applied builders',
() async {
Expand Down
Loading