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

Failing The Build Scalafmt #994

Open
borkaehw opened this issue Feb 7, 2020 · 3 comments
Open

Failing The Build Scalafmt #994

borkaehw opened this issue Feb 7, 2020 · 3 comments

Comments

@borkaehw
Copy link
Contributor

borkaehw commented Feb 7, 2020

  1. Have an independent macro that users set up in addition to their scalafmt_scala_library targets which looks something like:
def scala_fmt_test(name,target):
    native.sh_test(
        name = name + "_scala_fmt_test",
        srcs = [target + ".format-test"],
    )
  1. Have scalafmt_scala_library actually be a macro that delegates to _scalafmt_scala_library_rule and scala_fmt_test.
  2. If you want this to be toggled via a toolchain then you can do something like 2 but instead of using a regular sh_test you can write one of your own that will depend on the toolchain.

Reference from #912 (comment)

@ittaiz
Copy link
Member

ittaiz commented Feb 8, 2020

Thanks!
Can you elaborate on 3? The rule will use the toolchain to decide it to run the action or not?

@gergelyfabian
Copy link
Contributor

This would be very useful. In fact rules_scala implementation from higherkindness provides a similar feature: https://github.com/higherkindness/rules_scala/blob/master/docs/scalafmt.md#scalafmt.

@virusdave
Copy link
Contributor

I don't suppose anyone has made this work? I also went down the "create a wrapping sh_test that invokes the foo.format-test path, and ran into the same issue of missing manifest file (and, presumably, the formatted output files)

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

No branches or pull requests

4 participants