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

Adds a rule that can be used out of the box to use Periphery in bazel… #783

Closed
wants to merge 3 commits into from

Conversation

maxwellE
Copy link

@maxwellE maxwellE commented Aug 8, 2024

… projects

Using the example provided here you are able to generate periphery reports for any collection of swift based targets. To run the example run

bazel build //periphery/example:periphery_xcode_report

It is important to note the flags specified in the .bazelrc file, they are critical to periphery working via bazel

… projects

Using the example provided here you are able to generate periphery reports for any collection of swift based targets. To run the example run

`bazel build //periphery/example:periphery_xcode_report`

It is important to note the flags specified in the .bazelrc file, they are critical to periphery working via bazel
@maxwellE maxwellE marked this pull request as ready for review August 8, 2024 20:08
Copy link
Contributor

@ileitch ileitch left a comment

Choose a reason for hiding this comment

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

Thanks so much for adding this, I'm really excited about native Bazel support!

I recently began work on Periphery v3 that aims to make Periphery a simpler to use by removing the need to specify the list of targets to scan. Instead, by default, Periphery will scan all Swift sources in the index store. The --index-exclude, --exclude-targets and --exclude-tests options can then be used to refine the output.

The format of the generic project config file has changed to reflect this: https://github.com/peripheryapp/periphery/blob/v3/Sources/PeripheryKit/Generic/GenericProjectDriver.swift#L8-L10. This should simplify the aspect a bit, since we no longer need to collect the source files. If you're willing, I think it would be great to include this Bazel support in v3.

periphery/collect_periphery_info.bzl Show resolved Hide resolved
periphery/collect_periphery_info.bzl Show resolved Hide resolved
periphery/periphery_report.bzl Outdated Show resolved Hide resolved
periphery/periphery_report.bzl Show resolved Hide resolved
@maxwellE maxwellE requested a review from ileitch August 12, 2024 17:22
@ileitch
Copy link
Contributor

ileitch commented Aug 19, 2024

Closing this now that #786 is merged. This PR was a huge help to me, especially the aspect implementation, thank you!

One difference between this PR and the implementation in master is the generation of the report as an output. I think perhaps we could wrap the scan rule with another that executes the scan and uses tee to pipe the output to a file. That way we get the benefit of the Bazel output while also seeing the output printed to stdout.

@ileitch ileitch closed this Aug 19, 2024
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