question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add plugin support for Bazel

See original GitHub issue

Bazel is something which has interested me for a while now, so writing a Spotless plugin for it may prove to be a good way to get my feet wet with it. However I’m limited for time with my studies and I suspect I won’t be able to work on something this big until late May 2017 or later.

Here’s what I currently understand about Bazel with regards to plugin-writing:

  1. Bazel uses a subset of Python called Skylark for writing extensions (Bazel’s terminology for plugins AFAICT). So it may very well be that Spotless would need to be ported to Skylark first, which isn’t ideal.
  2. There seem to be ways of integrating shell scripts and binaries as extensions into Bazel. I’m hoping that we can use one of these options or some another option to call spotless-lib (or a Java binary wrapper around it) without porting it to Skylark.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
t-rad679commented, Feb 18, 2020

A colleague and I have been thinking about this a lot, and the cleanest way we’ve found is to start with a binary wrapper (as Jonathan suggested early on in this thread) that takes a config that specifies the same stuff you would in a build.gradle, use a custom Bazel rule to generate the config from attributes passed from the target, then write another Bazel rule calling the executable as an action. The config generation is a bit wonky, but this is still more or less in line with how Bazel was intended to work. We unfortunately did not run across any functionality in Starlark that allows interoperation between it and Java libraries in its extensions. Someone please let me know if they find out I missed something.

Seems to me like implementing said binary wrapper would basically amount to building a command line application, so it seems silly not to expose it as such for any users who want that (even if it’s not really a standard use case). Would you guys accept a well written and tested implementation of a command line application for Spotless? It might be a while before I have the time, but we’d be willing to work on such a thing. Let me know and I’ll open a ticket for it. Then I’d also be willing to put in some work on this ticket after that is complete.

2reactions
nedtwiggcommented, Jul 11, 2017

Just upload anything you think might be useful to somebody else who might wanna do this 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bazel Plugin - IntelliJ with Bazel
Install it from within the IDE (Settings > Plugins > Install > Browse Repositories, and search for 'Bazel'). · Download from the JetBrains...
Read more >
Bazel - IntelliJ IDEs Plugin - JetBrains Marketplace
Bazel project support. Features: Import BUILD files into the IDE. BUILD file custom language support. Support for Bazel run configurations for certain rule ......
Read more >
Building IntelliJ Bazel Plugin from Sources
Bazel is pretty well supported by the VSCode plugin vscode-bazel. ... You can install this plugin in the following IntelliJ products:.
Read more >
Building with Bazel - Gerrit Code Review
It takes care of downloading and installing Bazel itself, ... Java 17 is supported. ... The Gerrit build works with Bazel's IntelliJ plugin....
Read more >
Gerrit Code Review - Building with Bazel
Alternatively use Bazelisk to use the latest supported Bazel version on different ... Install {extension,plugin,gwt}-api to the local maven repository:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found