Open sgammon opened 5 years ago
Thanks for the request. You'll have to bear with me as I'm not very familiar with Bazel, so can you help point me toward some specific things to look into that would be needed to make this work? Is it that we need to provide a BUILD file somewhere in the package that provides a target you can use?
@hsubox76, i think so, yes. i'm also new to Bazel. i'll try to get this right! here is the longer story.
essentially, I have a Bazel project based on rules_closure and rules_sass. In this project, I address a number of projects (internal and external) via a WORKSPACE
file.
in each case, the symbols provided by these internal and external projects amount to the rule types:
sass_library
: for SASS/SCSS sourcesclosure_js_library
: JS sources, in traditional Closure or Closure module format (i.e. goog.provide
or goog.module
)proto_library
: for .proto
files, which I presume are in use somewhere within FirebaseI wanted to build against sources, with the above rules, for firebaseui-web
. so I made a fork, mostly to make changes to support GSS, and fix things that have broken after recent updates in the Closure compiler.
with this fork, I wrote an overlay file to surface it in Bazel. the overlay file is private at the moment, but I'd be up to share it, it makes our fork of firebaseui-web
usable via Bazel.
we had to do the same with MDL, which is the UI library firebaseui-web
is based on.
so this got us to thinking, why not build against the actual firebase-js-sdk
, with Bazel? we tried to write another overlay file, but realized pretty quickly that the firebase SDK is quite different.
for instance, it's written in typescript. I have read in different places that Closure Compiler is involved in the build, but I haven't been able to find how to get those intermediate (Closure-annotated) sources out of the build pipeline. we found the typescript > Closure-annotated-JS conversion to be non-trivial, so we filed the FR :)
I'd be happy to contribute the above-mentioned code to the open source effort, if it helps, and I'd be happy to help on a PR on the main SDK, with development or testing, as you and your team see fit.
hope this helps and thank you for your help on this
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
We have a frontend project using Bazel, specifically
rules_closure
. It would be awesome to gain Bazel support in the Firebase JS SDK, so we could potentially build against the SDK's sources.The gains delivered by this support might include a deeper ability to tree-shake unused code from the Firebase SDK, for a given application.
Steps to reproduce:
1) Try to use Firebase SDK in JS from Bazel with
rules_closure
2) Realize you will probably have to write an overlay file and usenew_git_repository
, or find a fork, or build against externs 3) Externs are not ideal because they are out-of-scope of the Closure compilerThank you in advance Firebase team