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

Add build filters #18

Merged
merged 10 commits into from
Apr 10, 2024
Merged

Conversation

martingeorgiu
Copy link
Collaborator

Hi, I've added build filters similar to the ones in build_runner.

Would you please @polina-c review it?

@martingeorgiu martingeorgiu requested a review from polina-c April 5, 2024 15:53
@martingeorgiu martingeorgiu self-assigned this Apr 5, 2024
README.md Outdated

If you want to generate the `DEPENDENCIES.md` only for a specific folders, you can use `--build-filter` option. For example, to generate the diagram only for the root `lib/` folder, you run following `dart run layerlens --build-filter "lib"`.

You can specify multiple build filters and you should use [glob](https://pub.dev/packages/glob) syntax. The mechanism is inspired by `--build-filter` in Dart's [`build_runner`](https://github.com/dart-lang/build/blob/master/docs/partial_builds.md)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add example of multiple filters?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@polina-c
Copy link
Owner

polina-c commented Apr 5, 2024

Thank you for putting this together! Can you test cover the new code?

@martingeorgiu
Copy link
Collaborator Author

@polina-c I've added the tests, feel free to re-review it:)

@martingeorgiu martingeorgiu requested a review from polina-c April 8, 2024 10:49
});

test('build root and one subfolder', () async {
final deps = await collectDeps(rootDir: rootDir);
Copy link
Owner

@polina-c polina-c Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Can you add test for the case:

lib
lib/subfolder1
lib/subfolder2/**
lib/subfolder2/a

assuming folder structure:

lib
  subfolder1
    a
    b
  subfolder2  
    a
    b

Check it generate all subtree for subfolder2, and just subfolder1 for subfolder1.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've implemented this test and added a bunch of other tests to really check if it is behaving right and is covered.

README.md Outdated

If you want to generate the `DEPENDENCIES.md` only for a specific folders, you can use `--build-filter` option and you should use [glob](https://pub.dev/packages/glob) syntax. For example, to generate the diagram only for the root `lib/` folder, you run following `dart run layerlens --build-filter "lib"`.

You can specify multiple build filters . The mechanism is inspired by `--build-filter` in Dart's [`build_runner`](https://github.com/dart-lang/build/blob/master/docs/partial_builds.md). For example, to run the layerlens for root `lib/` and it's subfolder `lib/subfolder1` run `layerlens --build-filter "lib" --build-filter "lib/subfolder1"`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
Can you also add example how to generate diagrams for entire subtrre of one of subfolders?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've updated the readme and added this case to the tests as well

@martingeorgiu martingeorgiu requested a review from polina-c April 9, 2024 09:42
README.md Show resolved Hide resolved
Copy link
Owner

@polina-c polina-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, lgtm. Just one minor comment.

@polina-c polina-c merged commit 29f157d into polina-c:main Apr 10, 2024
1 check passed
@polina-c
Copy link
Owner

Merged. Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants