Skip to content

Latest commit

 

History

History

closure

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Closure Javascript Rules

Rule Description
closure_proto_repositories Load WORKSPACE dependencies.
closure_proto_compile Generate closure js protobuf source files.
closure_proto_library Generate and compiles closure js source files.

closure_proto_repositories

Enable closure support by loading the dependencies in your workspace.

IMPORTANT: Closure rules require rules_closure.

load("@org_pubref_rules_protobuf//closure:rules.bzl", "closure_proto_repositories")
closure_proto_repositories()

closure_proto_compile

This is a thin wrapper over the proto_compile rule having language @org_pubref_rules_protobuf//closure.

load("@org_pubref_rules_protobuf//closure:rules.bzl", "closure_proto_compile")

closure_proto_compile(
  name = "protos",
  protos = ["message.proto"],
)
$ bazel build :protos
Target //:protos up-to-date:
  bazel-genfiles/message.js

closure_proto_library

Pass the set of protobuf source files to the protos attribute.

load("@org_pubref_rules_protobuf//closure:rules.bzl", "closure_proto_library")

closure_proto_library(
  name = "protolib",
  protos = ["message.proto"],
)
$ bazel build :Helloworld
Target //:Helloworld up-to-date:
  bazel-bin/protolib.js

Note that closure_js_proto_library is implemented in rules_closure. This rule is definitely a viable option but does not at the time of this writing support imports or proto::proto dependencies.