Git Product home page Git Product logo

isabella232 / bazel-bloop-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stripe-archive/bazel-bloop-exporter

0.0 0.0 0.0 14 KB

This proof of concept exports a bazel project to bloop. The motivation is to allow the use of any tooling that already has a bloop integration, such as the metals language server.

License: MIT License

Starlark 73.75% Python 23.70% Scala 1.91% Thrift 0.64%

bazel-bloop-exporter's Introduction

bazel-bloop exporter

This is an unsupported project that we're releasing as a proof of concept.

This proof of concept exports a bazel project to bloop. The motivation is to allow the use of any tooling that already has a bloop integration, such as the metals language server.

Proof of concept

This repo contains a bazel project compiled with rules_scala. In src there are Scala, thrift, and protobuf files which can be compiled with bazel. The following command exports the //src/scala/com/stripe/test:dummy_lib target to bloop.

python3 bloop/scripts/gen_bloop.py -v -t //src/scala/com/stripe/test:dummy_lib

Which populates the .bloop folder with a bloop project config for the dummy_lib target. Now you can try opening the project with metals.

Using in another project

The bazel rules that export this information can be imported into other bazel projects by adding something like this to the project's WORKSPACE file:

git_repository(
    name = "bloop",
    commit = "710cdd154641bcfeeaf4a3a568a71b1cd82e43a2", //update as necessary 
    remote = "[email protected]:stripe-archive/bazel-bloop-exporter.git",
)

You can then create a bloop_target rule for each target that you want to export. It's recommended that you use the tools/prelude file to do this automatically by creating a set of macros like the ones below:

load(
    "@io_bazel_rules_scala//scala:scala.bzl",
    upstream_scala_library = "scala_library",
    upstream_scala_binary = "scala_binary",
    upstream_scala_test = "scala_test"
)

load(
    "@bloop//bloop:bloop.bzl",
    "bloop_target",
)

def scala_library(**kwargs):
    bloop_target(**kwargs)
    upstream_scala_library(**kwargs)

def scala_binary(**kwargs):
    bloop_target(**kwargs)
    upstream_scala_binary(**kwargs)

def scala_test(**kwargs):
    bloop_target(**kwargs)
    upstream_scala_test(**kwargs)

You can now copy the bloop/scripts/gen_bloop.py script into your project and use it to generate bloop configs.

Contributors

  • Carmen Kwan
  • Alex Beal
  • Andy Scott

bazel-bloop-exporter's People

Contributors

beala-stripe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.