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

Clean up unused rules_closure deps. #1

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @alexeagle @soldair @gregmagolan @gkdn @jDramaix
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion CODEOWNERS

This file was deleted.

3 changes: 3 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ Justine Tunney <[email protected]>
Kamil Jiwa <[email protected]>
Andy Hochhaus <[email protected]>
Paul Johnston <[email protected]>
Yannic Bonenberger <[email protected]>
Rob Figueroa <[email protected]>
Sam Gammon <[email protected]>
113 changes: 30 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ JavaScript | Templating | Stylesheets | Miscellaneous
--- | --- | --- | ---
[closure_js_library] | [closure_js_template_library] | [closure_css_library] | [closure_js_proto_library]
[closure_js_binary] | [closure_java_template_library] | [closure_css_binary] | [phantomjs_test]
[closure_js_deps] | [closure_py_template_library] | | [closure_proto_library] \(Experimental\)
[closure_js_test] | | | [closure_grpc_web_library] \(Experimental\)
[closure_js_test] | [closure_py_template_library] | | [closure_proto_library] \(Experimental\)
| | | | [closure_grpc_web_library] \(Experimental\)

## Overview

Expand Down Expand Up @@ -69,49 +69,46 @@ notes.
First you must [install Bazel]. Then you add the following to your `WORKSPACE`
file:

```python
```starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_closure",
sha256 = "a80acb69c63d5f6437b099c111480a4493bad4592015af2127a2f49fb7512d8d",
strip_prefix = "rules_closure-0.7.0",
sha256 = "7d206c2383811f378a5ef03f4aacbcf5f47fd8650f6abbc3fa89f3a27dd8b176",
strip_prefix = "rules_closure-0.10.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.7.0.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/0.7.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.10.0.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/0.10.0.tar.gz",
],
)

load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")

closure_repositories()
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")
rules_closure_dependencies()
rules_closure_toolchains()
```

You are not required to install the Closure Tools, PhantomJS, or anything else
for that matter; they will be fetched automatically by Bazel.

### Overriding Dependency Versions

When you call `closure_repositories()` in your `WORKSPACE` file, it causes a
When you call `rules_closure_dependencies()` in your `WORKSPACE` file, it causes a
few dozen external dependencies to be added to your project, e.g. Guava, Guice,
JSR305, etc. You might need to customize this behavior.

To override the version of any dependency, modify your `WORKSPACE` file to pass
`omit_<dependency_name>=True` to `closure_repositories()`. Next define your
`omit_<dependency_name>=True` to `rules_closure_dependencies()`. Next define your
custom dependency version. A full list of dependencies is available from
[repositories.bzl]. For example, to override the version of Guava:

```python
load(
"@io_bazel_rules_closure//closure:defs.bzl",
"closure_repositories",
"java_import_external",
)

closure_repositories(
```starlark
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")
rules_closure_dependencies(
omit_com_google_guava=True,
)
rules_closure_toolchains()

load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
java_import_external(
name = "com_google_guava",
licenses = ["notice"], # Apache 2.0
Expand All @@ -133,7 +130,6 @@ Please see the test directories within this project for concrete examples of usa

- [//closure/testing/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/testing/test)
- [//closure/compiler/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/compiler/test)
- [//closure/library/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/library/test)
- [//closure/templates/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/templates/test)
- [//closure/stylesheets/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/stylesheets/test)
- [//closure/protobuf/test](https://github.com/bazelbuild/rules_closure/tree/master/closure/protobuf/test)
Expand All @@ -144,7 +140,7 @@ Please see the test directories within this project for concrete examples of usa

## closure\_js\_library

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
closure_js_library(name, srcs, data, deps, exports, suppress, convention,
no_closure_library)
Expand Down Expand Up @@ -245,7 +241,7 @@ This rule can be referenced as though it were the following:

## closure\_js\_binary

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary")
closure_js_binary(name, deps, css, debug, language, entry_points,
dependency_mode, compilation_level, formatting,
Expand Down Expand Up @@ -332,7 +328,7 @@ This rule can be referenced as though it were the following:

- `WHITESPACE_ONLY`: Tells the Closure Compiler to strip whitespace and
comments. Transpilation between languages will still work. Type checking
becomes disabled. No symbols will not be renamed. Nothing will be inlined.
becomes disabled. No symbols will be renamed. Nothing will be inlined.
Dependency statements will not be removed. **ProTip:** If you're using the
Closure Library, you'll need to look into the `CLOSURE_NO_DEPS` and
`goog.ENABLE_DEBUG_LOADER` options in order to execute the compiled output.)
Expand Down Expand Up @@ -367,7 +363,7 @@ When compiling AngularJS applications, you need to pass custom flags to the
Closure Compiler. This can be accomplished by adding the following to your
[closure_js_binary] rule:

```python
```starlark
closure_js_binary(
# ...
defs = [
Expand All @@ -379,7 +375,7 @@ closure_js_binary(

## closure\_js\_test

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_test")
closure_js_test(name, srcs, data, deps, css, html, language, suppress,
compilation_level, entry_points, defs)
Expand Down Expand Up @@ -428,8 +424,7 @@ This rule can be referenced as though it were the following:
register test functions.

- **deps:** (List of [labels]; optional) Direct dependency list passed along to
[closure_js_library]. This list will almost certainly need
`"@io_bazel_rules_closure//closure/library:testing"`.
[closure_js_library].

- **data:** (List of [labels]; optional) Passed to [closure_js_library].

Expand All @@ -452,7 +447,7 @@ This rule can be referenced as though it were the following:

## phantomjs\_test

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "phantomjs_test")
phantomjs_test(name, data, deps, html, harness, runner)
```
Expand Down Expand Up @@ -498,56 +493,9 @@ This rule can be referenced as though it were the following:
to report the result to the `harness`.


## closure\_js\_deps

```python
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_deps")
closure_js_deps(name, deps)
```

Generates a dependency file, for an application using the Closure Library.

Generating this file is necessary for running an application in raw sources
mode, because it tells the Closure Library how to load namespaces from the web
server that are requested by `goog.require()`.

For example, if you've made your source runfiles available under a protected
admin-only path named `/filez/`, then raw source mode could be used as follows:

```html
<script src="/filez/external/closure_library/closure/goog/base.js"></script>
<script src="/filez/myapp/deps.js"></script>
<script>goog.require('myapp.main');</script>
<script>myapp.main();</script>
```

#### Implicit Output Targets

- *name*.js: A JavaScript source file containing `goog.addDependency()`
statements which map Closure Library namespaces to JavaScript source paths.
Each path is expressed relative to the location of the Closure Library
[base.js] file.

#### Rule Polymorphism

This rule can be referenced as though it were the following:

- [filegroup]: `srcs` will be the deps.js output files and `data` will contain
that file in addition to all transitive JS sources and data.

### Arguments

- **name:** ([Name]; required) A unique name for this rule. Convention states
that this be `"deps"`.

- **deps:** (List of [labels]; required) List of [closure_js_library] and
[closure_js_template_library] targets which define all JavaScript sources in
your application.


## closure\_js\_template\_library

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_template_library")
closure_js_template_library(name, srcs, data, deps, globals, plugin_modules,
should_generate_js_doc,
Expand Down Expand Up @@ -634,7 +582,7 @@ This rule can be referenced as though it were the following:

## closure\_java\_template\_library

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_java_template_library")
closure_java_template_library(name, srcs, data, deps, java_package)
```
Expand Down Expand Up @@ -699,7 +647,7 @@ TODO

## closure\_css\_library

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_library")
closure_css_library(name, srcs, data, deps)
```
Expand Down Expand Up @@ -763,7 +711,7 @@ This rule can be referenced as though it were the following:

## closure\_css\_binary

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_binary")
closure_css_binary(name, deps, renaming, debug, defs)
```
Expand Down Expand Up @@ -872,7 +820,7 @@ This rule can be referenced as though it were the following:

## closure\_js\_proto\_library

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_proto_library")
closure_js_proto_library(name, srcs, add_require_for_enums, binary,
import_style)
Expand Down Expand Up @@ -929,7 +877,7 @@ This rule can be referenced as though it were the following:

## closure\_proto\_library

```python
```starlark
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_proto_library")
closure_proto_library(name, deps)
```
Expand Down Expand Up @@ -976,7 +924,6 @@ This rule can be referenced as though it were the following:
[closure_grpc_web_library]: https://github.com/grpc/grpc-web/blob/9b7b2d5411c486aa646ba2491cfd894d5352775b/bazel/closure_grpc_web_library.bzl#L149
[closure_java_template_library]: #closure_java_template_library
[closure_js_binary]: #closure_js_binary
[closure_js_deps]: #closure_js_deps
[closure_js_library]: #closure_js_library
[closure_js_proto_library]: #closure_js_proto_library
[closure_js_template_library]: #closure_js_template_library
Expand Down
23 changes: 8 additions & 15 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
workspace(name = "io_bazel_rules_closure")

load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//closure/private:java_import_external.bzl", "java_import_external")
load("//closure:repositories.bzl", "closure_repositories")

closure_repositories()

http_archive(
name = "zlib",
build_file = "//:third_party/zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = ["https://zlib.net/zlib-1.2.11.tar.gz"],
)
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")
rules_closure_dependencies()
rules_closure_toolchains()

http_archive(
name = "bazel_skylib",
sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
sha256 = "7ac0fa88c0c4ad6f5b9ffb5e09ef81e235492c873659e6bb99efb89d11246bcb",
strip_prefix = "bazel-skylib-1.0.3",
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/1.0.3.tar.gz"],
)

java_import_external(
Expand Down Expand Up @@ -131,7 +124,7 @@ java_import_external(
jar_sha256 = "0f7dced2a16e55a77e44fc3ff9c5be98d4bf4bb30abc18d78ffd735df950a69f",
jar_urls = [
"https://mirror.bazel.build/repo1.maven.org/maven2/com/google/truth/truth/0.45/truth-0.45.jar",
"http://repo1.maven.org/maven2/com/google/truth/truth/0.45/truth-0.45.jar",
"https://repo1.maven.org/maven2/com/google/truth/truth/0.45/truth-0.45.jar",
"http://maven.ibiblio.org/maven2/com/google/truth/truth/0.45/truth-0.45.jar",
],
licenses = ["notice"], # Apache 2.0
Expand Down
11 changes: 11 additions & 0 deletions closure/compiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

load("@rules_java//java:defs.bzl", "java_library")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

java_library(
name = "compiler",
exports = ["@com_google_javascript_closure_compiler"],
)

bzl_library(
name = "compiler_bzl",
srcs = glob(["*.bzl"]),
deps = [
"//closure/private:defs_bzl",
],
)
Loading