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

Tell analyzer about bin/ and web/ directories #42

Merged
merged 1 commit into from
Sep 9, 2021
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
3 changes: 2 additions & 1 deletion lib/src/find_class_elements.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ Future<Iterable<ClassElement>> findClassElements({

final contextCollection = AnalysisContextCollection(
includedPaths: [
// TODO: Handle other possible directories like web/ and bin/
makePackageSubPath('lib'),
makePackageSubPath('lib', 'src'),
makePackageSubPath('bin'),
makePackageSubPath('web'),
],
);

Expand Down
Empty file.
8 changes: 8 additions & 0 deletions test/fixtures/bindir/bin/bindir.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Foo {
String message = 'hello, world';
}

void main() {
final f = Foo();
print(f.message);
}
1 change: 1 addition & 0 deletions test/fixtures/bindir/lib/external.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Bar {}
166 changes: 166 additions & 0 deletions test/fixtures/bindir/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "17.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
dcdg:
dependency: "direct dev"
description:
path: "../../.."
relative: true
source: path
version: "3.1.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
7 changes: 7 additions & 0 deletions test/fixtures/bindir/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: bindir_fixture
description: A test fixture that uses the bin/ directory
environment:
sdk: '>=2.12.0 <3.0.0'
dev_dependencies:
dcdg:
path: ../../../
23 changes: 23 additions & 0 deletions test/functional/bindir_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:test/test.dart';

import 'utils.dart';

void main() {
setUpAll(() {
pubGetFixtures();
});

group('dcdg tool (bindir cases)', () {
test('should run successfully on a project bin/ directory', () {
final result = runWith(
[
'-s',
'bin',
],
'test/fixtures/bindir/',
);
expect(result.stderr, '');
expect(result.exitCode, 0);
});
});
}