aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar David Chen <dzc@google.com>2015-12-04 13:25:38 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-12-04 21:06:34 +0000
commit7019ff9a0bb59c1e9e665cd39f858cb2c9205e63 (patch)
treecf1d73325c2976115741821fd37c6ea7d970ad1a
parentb4d482bee65fbb83351fc562bca2a30e55a90a49 (diff)
Use load() to add external repositories for Skylark rules.
-- MOS_MIGRATED_REVID=109405753
-rw-r--r--WORKSPACE71
-rw-r--r--tools/build_defs/d/README.md10
-rw-r--r--tools/build_defs/d/d.WORKSPACE13
-rw-r--r--tools/build_defs/d/d.bzl15
-rw-r--r--tools/build_defs/dotnet/README.md52
-rw-r--r--tools/build_defs/dotnet/csharp.bzl9
-rw-r--r--tools/build_defs/dotnet/dotnet.WORKSPACE7
-rw-r--r--tools/build_defs/groovy/README.md10
-rw-r--r--tools/build_defs/groovy/groovy.WORKSPACE32
-rw-r--r--tools/build_defs/groovy/groovy.bzl34
-rw-r--r--tools/build_defs/jsonnet/README.md10
-rw-r--r--tools/build_defs/jsonnet/jsonnet.WORKSPACE5
-rw-r--r--tools/build_defs/jsonnet/jsonnet.bzl7
-rw-r--r--tools/build_defs/sass/README.md9
-rw-r--r--tools/build_defs/sass/sass.WORKSPACE13
-rw-r--r--tools/build_defs/sass/sass.bzl15
-rw-r--r--tools/build_rules/appengine/README.md10
-rw-r--r--tools/build_rules/appengine/appengine.WORKSPACE51
-rw-r--r--tools/build_rules/appengine/appengine.bzl38
-rw-r--r--tools/build_rules/closure/README.md11
-rw-r--r--tools/build_rules/closure/closure.WORKSPACE36
-rw-r--r--tools/build_rules/closure/closure_repositories.bzl51
-rw-r--r--tools/build_rules/go/README.md9
-rw-r--r--tools/build_rules/go/def.bzl20
-rw-r--r--tools/build_rules/go/toolchain/WORKSPACE.go-toolchain19
25 files changed, 287 insertions, 270 deletions
diff --git a/WORKSPACE b/WORKSPACE
index 3d570ff790..4bb08eda15 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,6 +1,16 @@
+load("/tools/build_defs/d/d", "d_repositories")
+load("/tools/build_defs/dotnet/csharp", "csharp_repositories")
+load("/tools/build_defs/jsonnet/jsonnet", "jsonnet_repositories")
+load("/tools/build_defs/sass/sass", "sass_repositories")
+load("/tools/build_rules/go/def", "go_repositories")
load("/tools/build_rules/rust/rust", "rust_repositories")
+csharp_repositories()
+d_repositories()
+go_repositories()
+jsonnet_repositories()
rust_repositories()
+sass_repositories()
# In order to run the Android integration tests, uncomment these rules, point
# them to the Android NDK and the SDK, and point the bind rules under them
@@ -33,64 +43,3 @@ bind(
# actual = "@androidndk//:files",
actual = "//:dummy",
)
-
-new_http_archive(
- name = "dmd-linux-x86_64",
- build_file = "tools/build_defs/d/dmd.BUILD",
- sha256 = "a5014886773853b4a42df19ee9591774cf281d33fbc511b265df30ba832926cd",
- url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
-)
-
-new_http_archive(
- name = "dmd-darwin-x86_64",
- build_file = "tools/build_defs/d/dmd.BUILD",
- sha256 = "aa76bb83c38b3f7495516eb08977fc9700c664d7a945ba3ac3c0004a6a8509f2",
- url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.osx.zip",
-)
-
-git_repository(
- name = "jsonnet",
- remote = "https://github.com/google/jsonnet.git",
- tag = "v0.8.1",
-)
-
-new_http_archive(
- name = "libsass",
- build_file = "tools/build_defs/sass/libsass.BUILD",
- sha256 = "6a4da39cc0b585f7a6ee660dc522916f0f417c890c3c0ac7ebbf6a85a16d220f",
- url = "https://github.com/sass/libsass/archive/3.3.0-beta1.tar.gz",
-)
-
-new_http_archive(
- name = "sassc",
- build_file = "tools/build_defs/sass/sassc.BUILD",
- sha256 = "87494218eea2441a7a24b40f227330877dbba75c5fa9014ac6188711baed53f6",
- url = "https://github.com/sass/sassc/archive/3.3.0-beta1.tar.gz",
-)
-
-bind(
- name = "go_prefix",
- actual = "//:go_prefix",
-)
-
-new_http_archive(
- name = "golang-darwin-amd64",
- build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
- sha256 = "e94487b8cd2e0239f27dc51e6c6464383b10acb491f753584605e9b28abf48fb",
- url = "https://storage.googleapis.com/golang/go1.5.1.darwin-amd64.tar.gz",
-)
-
-new_http_archive(
- name = "golang-linux-amd64",
- build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
- sha256 = "2593132ca490b9ee17509d65ee2cd078441ff544899f6afb97a03d08c25524e7",
- url = "https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz",
-)
-
-new_http_archive(
- name = "nunit",
- build_file = "tools/build_defs/dotnet/nunit.BUILD",
- sha256 = "1bd925514f31e7729ccde40a38a512c2accd86895f93465f3dfe6d0b593d7170",
- type = "zip",
- url = "https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip",
-)
diff --git a/tools/build_defs/d/README.md b/tools/build_defs/d/README.md
index 35e7955d59..3a7d503ba3 100644
--- a/tools/build_defs/d/README.md
+++ b/tools/build_defs/d/README.md
@@ -15,8 +15,14 @@
## Setup
-To use the D rules, simply copy the contents of `d.WORKSPACE` into your
-`WORKSPACE` file.
+To use the D rules, add the following to your `WORKSPACE` file to add the
+external repositories for the D toolchain:
+
+```python
+load("/tools/build_defs/d/d", "d_repositories")
+
+d_repositories()
+```
## Roadmap
diff --git a/tools/build_defs/d/d.WORKSPACE b/tools/build_defs/d/d.WORKSPACE
deleted file mode 100644
index 004276473e..0000000000
--- a/tools/build_defs/d/d.WORKSPACE
+++ /dev/null
@@ -1,13 +0,0 @@
-new_http_archive(
- name = "dmd-linux-x86_64",
- url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
- sha256 = "a5014886773853b4a42df19ee9591774cf281d33fbc511b265df30ba832926cd",
- build_file = "tools/build_defs/d/dmd.BUILD",
-)
-
-new_http_archive(
- name = "dmd-darwin-x86_64",
- url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
- sha256 = "aa76bb83c38b3f7495516eb08977fc9700c664d7a945ba3ac3c0004a6a8509f2",
- build_file = "tools/build_defs/d/dmd.BUILD",
-)
diff --git a/tools/build_defs/d/d.bzl b/tools/build_defs/d/d.bzl
index c83e6dc48a..074473f244 100644
--- a/tools/build_defs/d/d.bzl
+++ b/tools/build_defs/d/d.bzl
@@ -448,3 +448,18 @@ d_docs = rule(
"d_docs": "%{name}-docs.zip",
},
)
+
+def d_repositories():
+ native.new_http_archive(
+ name = "dmd-linux-x86_64",
+ url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
+ sha256 = "a5014886773853b4a42df19ee9591774cf281d33fbc511b265df30ba832926cd",
+ build_file = "tools/build_defs/d/dmd.BUILD",
+ )
+
+ native.new_http_archive(
+ name = "dmd-darwin-x86_64",
+ url = "http://downloads.dlang.org/releases/2.x/2.067.1/dmd.2.067.1.linux.zip",
+ sha256 = "aa76bb83c38b3f7495516eb08977fc9700c664d7a945ba3ac3c0004a6a8509f2",
+ build_file = "tools/build_defs/d/dmd.BUILD",
+ )
diff --git a/tools/build_defs/dotnet/README.md b/tools/build_defs/dotnet/README.md
index abe5cc9793..6c4369df64 100644
--- a/tools/build_defs/dotnet/README.md
+++ b/tools/build_defs/dotnet/README.md
@@ -20,34 +20,46 @@ might become especially valuable.
## Setup
-Copy the contents of the dotnet.WORKSPACE file into your WORKSPACE file.
+Add the following to your `WORKSPACE` file to add the external repositories:
+
+```python
+load("/tools/build_defs/dotnet/csharp", "csharp_repositories")
+
+csharp_repositories()
+```
## Examples
-* `csharp_library`
+### csharp_library
- csharp_library(
- name="MyLib",
- srcs=["MyLib.cs"],
- deps=["//my/dependency:SomeLib"],
- )
+```python
+csharp_library(
+ name = "MyLib",
+ srcs = ["MyLib.cs"],
+ deps = ["//my/dependency:SomeLib"],
+)
+```
-* `csharp_binary`
+### csharp_binary
- csharp_binary(
- name="MyApp",
- main="MyApp", # optional name of the main class.
- srcs=["MyApp.cs"],
- deps=["//my/dependency:MyLib"],
- )
+```python
+csharp_binary(
+ name = "MyApp",
+ main = "MyApp", # optional name of the main class.
+ srcs = ["MyApp.cs"],
+ deps = ["//my/dependency:MyLib"],
+)
+```
-* `csharp_nunit_test`
+### csharp\_nunit\_test
- csharp_nunit_test(
- name="MyApp",
- srcs=["MyApp.cs"],
- deps=["//my/dependency:MyLib"],
- )
+```python
+csharp_nunit_test(
+ name = "MyApp",
+ srcs = ["MyApp.cs"],
+ deps = ["//my/dependency:MyLib"],
+)
+```
## Things still missing:
diff --git a/tools/build_defs/dotnet/csharp.bzl b/tools/build_defs/dotnet/csharp.bzl
index 2fcea4af15..1433cc6d0d 100644
--- a/tools/build_defs/dotnet/csharp.bzl
+++ b/tools/build_defs/dotnet/csharp.bzl
@@ -281,3 +281,12 @@ csharp_nunit_test = rule(
outputs = _LIB_OUTPUTS,
test=True
)
+
+def csharp_repositories():
+ native.new_http_archive(
+ name = "nunit",
+ build_file = "tools/build_defs/dotnet/BUILD.nunit",
+ sha256 = "1bd925514f31e7729ccde40a38a512c2accd86895f93465f3dfe6d0b593d7170",
+ type = "zip",
+ url = "https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip",
+ )
diff --git a/tools/build_defs/dotnet/dotnet.WORKSPACE b/tools/build_defs/dotnet/dotnet.WORKSPACE
deleted file mode 100644
index e2ffd93881..0000000000
--- a/tools/build_defs/dotnet/dotnet.WORKSPACE
+++ /dev/null
@@ -1,7 +0,0 @@
-new_http_archive(
- name = "nunit",
- build_file = "tools/build_defs/dotnet/BUILD.nunit",
- sha256 = "1bd925514f31e7729ccde40a38a512c2accd86895f93465f3dfe6d0b593d7170",
- type = "zip",
- url = "https://github.com/nunit/nunitv2/releases/download/2.6.4/NUnit-2.6.4.zip",
-)
diff --git a/tools/build_defs/groovy/README.md b/tools/build_defs/groovy/README.md
index b96a38336f..c030e151fd 100644
--- a/tools/build_defs/groovy/README.md
+++ b/tools/build_defs/groovy/README.md
@@ -28,8 +28,14 @@ targets:
* `//external:junit`, pointing at JUnit (only required if using `groovy_test`)
* `//external:spock`, pointing at Spock (only required if using `spock_test`)
-The easiest way to do so is by copying the content of `groovy.WORKSPACE` to your
-workspace file and putting `groovy.BUILD` at the root of your workspace.
+The easiest way to do so is to add the following to your `WORKSPACE` file and
+putting `groovy.BUILD` at the root of your workspace:
+
+```python
+load("/tools/build_defs/groovy/groovy", "groovy_repositories")
+
+groovy_repositories()
+```
<a name="basic-example"></a>
## Basic Example
diff --git a/tools/build_defs/groovy/groovy.WORKSPACE b/tools/build_defs/groovy/groovy.WORKSPACE
deleted file mode 100644
index 1bdf6ed480..0000000000
--- a/tools/build_defs/groovy/groovy.WORKSPACE
+++ /dev/null
@@ -1,32 +0,0 @@
-new_http_archive(
- name = "groovy-sdk-artifact",
- url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.4.zip",
- sha256 = "a7cc1e5315a14ea38db1b2b9ce0792e35174161141a6a3e2ef49b7b2788c258c",
- build_file = "groovy.BUILD",
-)
-bind(
- name = "groovy-sdk",
- actual = "@groovy-sdk-artifact//:sdk",
-)
-bind(
- name = "groovy",
- actual = "@groovy-sdk-artifact//:groovy",
-)
-
-maven_jar(
- name = "junit-artifact",
- artifact = "junit:junit:4.12",
-)
-bind(
- name = "junit",
- actual = "@junit-artifact//jar",
-)
-
-maven_jar(
- name = "spock-artifact",
- artifact = "org.spockframework:spock-core:0.7-groovy-2.0",
-)
-bind(
- name = "spock",
- actual = "@spock-artifact//jar",
-)
diff --git a/tools/build_defs/groovy/groovy.bzl b/tools/build_defs/groovy/groovy.bzl
index 945f905e1e..7cffbd173a 100644
--- a/tools/build_defs/groovy/groovy.bzl
+++ b/tools/build_defs/groovy/groovy.bzl
@@ -312,3 +312,37 @@ def spock_test(
size = size,
tags = tags,
)
+
+def groovy_repositories():
+ native.new_http_archive(
+ name = "groovy-sdk-artifact",
+ url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.4.zip",
+ sha256 = "a7cc1e5315a14ea38db1b2b9ce0792e35174161141a6a3e2ef49b7b2788c258c",
+ build_file = "groovy.BUILD",
+ )
+ native.bind(
+ name = "groovy-sdk",
+ actual = "@groovy-sdk-artifact//:sdk",
+ )
+ native.bind(
+ name = "groovy",
+ actual = "@groovy-sdk-artifact//:groovy",
+ )
+
+ native.maven_jar(
+ name = "junit-artifact",
+ artifact = "junit:junit:4.12",
+ )
+ native.bind(
+ name = "junit",
+ actual = "@junit-artifact//jar",
+ )
+
+ native.maven_jar(
+ name = "spock-artifact",
+ artifact = "org.spockframework:spock-core:0.7-groovy-2.0",
+ )
+ native.bind(
+ name = "spock",
+ actual = "@spock-artifact//jar",
+ )
diff --git a/tools/build_defs/jsonnet/README.md b/tools/build_defs/jsonnet/README.md
index 72a21ec9bb..afdea804f8 100644
--- a/tools/build_defs/jsonnet/README.md
+++ b/tools/build_defs/jsonnet/README.md
@@ -17,8 +17,14 @@ These are build rules for working with [Jsonnet][jsonnet] files with Bazel.
## Setup
-To use the Jsonnet rules, simply copy the contents of `jsonnet.WORKSPACE` into
-your `WORKSPACE` file.
+To use the Jsonnet rules, add the following to your `WORKSPACE` file to add the
+external repositories for Jsonnet:
+
+```python
+load("/tools/build_defs/jsonnet/jsonnet", "jsonnet_repositories")
+
+jsonnet_repositories()
+```
<a name="#jsonnet_library"></a>
## jsonnet_library
diff --git a/tools/build_defs/jsonnet/jsonnet.WORKSPACE b/tools/build_defs/jsonnet/jsonnet.WORKSPACE
deleted file mode 100644
index bce62ccff2..0000000000
--- a/tools/build_defs/jsonnet/jsonnet.WORKSPACE
+++ /dev/null
@@ -1,5 +0,0 @@
-git_repository(
- name = "jsonnet",
- remote = "https://github.com/google/jsonnet.git",
- tag = "v0.8.1",
-)
diff --git a/tools/build_defs/jsonnet/jsonnet.bzl b/tools/build_defs/jsonnet/jsonnet.bzl
index 294266d756..2936024399 100644
--- a/tools/build_defs/jsonnet/jsonnet.bzl
+++ b/tools/build_defs/jsonnet/jsonnet.bzl
@@ -237,3 +237,10 @@ jsonnet_to_json_test = rule(
executable = True,
test = True,
)
+
+def jsonnet_repositories():
+ native.git_repository(
+ name = "jsonnet",
+ remote = "https://github.com/google/jsonnet.git",
+ tag = "v0.8.1",
+ )
diff --git a/tools/build_defs/sass/README.md b/tools/build_defs/sass/README.md
index 97537e7db4..ee4b65cc9c 100644
--- a/tools/build_defs/sass/README.md
+++ b/tools/build_defs/sass/README.md
@@ -15,7 +15,14 @@ These build rules are used for building [Sass][sass] projects with Bazel.
<a name="setup"></a>
## Setup
-To use the Sass rules, simply copy the contents of `sass.WORKSPACE` to your own top level `WORKSPACE` file.
+To use the Sass rules, add the following to your `WORKSPACE` file to add the
+external repositories for Sass:
+
+```python
+load("/tools/build_defs/sass/sass", "sass_repositories")
+
+sass_repositories()
+```
<a name="basic-example"></a>
## Basic Example
diff --git a/tools/build_defs/sass/sass.WORKSPACE b/tools/build_defs/sass/sass.WORKSPACE
deleted file mode 100644
index 95cf3322cb..0000000000
--- a/tools/build_defs/sass/sass.WORKSPACE
+++ /dev/null
@@ -1,13 +0,0 @@
-new_http_archive(
- name = "libsass",
- url = "https://github.com/sass/libsass/archive/3.3.0-beta1.tar.gz",
- sha256 = "6a4da39cc0b585f7a6ee660dc522916f0f417c890c3c0ac7ebbf6a85a16d220f",
- build_file = "tools/build_defs/sass/libsass.BUILD",
-)
-
-new_http_archive(
- name = "sassc",
- url = "https://github.com/sass/sassc/archive/3.3.0-beta1.tar.gz",
- sha256 = "87494218eea2441a7a24b40f227330877dbba75c5fa9014ac6188711baed53f6",
- build_file = "tools/build_defs/sass/sassc.BUILD",
-)
diff --git a/tools/build_defs/sass/sass.bzl b/tools/build_defs/sass/sass.bzl
index 5b165029c9..e15a2efc18 100644
--- a/tools/build_defs/sass/sass.bzl
+++ b/tools/build_defs/sass/sass.bzl
@@ -87,3 +87,18 @@ sass_binary = rule(
"css_map_file": "%{name}.css.map",
},
)
+
+def sass_repositories():
+ native.new_http_archive(
+ name = "libsass",
+ url = "https://github.com/sass/libsass/archive/3.3.0-beta1.tar.gz",
+ sha256 = "6a4da39cc0b585f7a6ee660dc522916f0f417c890c3c0ac7ebbf6a85a16d220f",
+ build_file = "tools/build_defs/sass/libsass.BUILD",
+ )
+
+ native.new_http_archive(
+ name = "sassc",
+ url = "https://github.com/sass/sassc/archive/3.3.0-beta1.tar.gz",
+ sha256 = "87494218eea2441a7a24b40f227330877dbba75c5fa9014ac6188711baed53f6",
+ build_file = "tools/build_defs/sass/sassc.BUILD",
+ )
diff --git a/tools/build_rules/appengine/README.md b/tools/build_rules/appengine/README.md
index 8c806f1d9a..3477c61586 100644
--- a/tools/build_rules/appengine/README.md
+++ b/tools/build_rules/appengine/README.md
@@ -19,8 +19,14 @@ support but can be easily modified to handle a standard web application.
## Setup
To be able to use the Java App Engine rules, you must make the App Engine SDK
-available to Bazel. The easiest way to do so is by copying the content of
-`appengine.WORKSPACE` to your workspace file.
+available to Bazel. The easiest way to do so is by adding the following to your
+`WORKSPACE` file:
+
+```python
+load("/tools/build_rules/appengine/appengine", "appengine_repositories")
+
+appengine_repositories()
+```
<a name="basic-example"></a>
## Basic Example
diff --git a/tools/build_rules/appengine/appengine.WORKSPACE b/tools/build_rules/appengine/appengine.WORKSPACE
deleted file mode 100644
index 7006dcfa7f..0000000000
--- a/tools/build_rules/appengine/appengine.WORKSPACE
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2015 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# WORKSPACE file example to download Java AppEngine dependencies.
-new_http_archive(
- name = "appengine-java",
- url = "http://central.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.9.23/appengine-java-sdk-1.9.23.zip",
- sha256 = "05e667036e9ef4f999b829fc08f8e5395b33a5a3c30afa9919213088db2b2e89",
- build_file = "tools/build_rules/appengine/appengine.BUILD",
-)
-
-bind(
- name = "appengine/java/sdk",
- actual = "@appengine-java//:sdk",
-)
-
-bind(
- name = "appengine/java/api",
- actual = "@appengine-java//:api",
-)
-
-bind(
- name = "appengine/java/jars",
- actual = "@appengine-java//:jars",
-)
-
-maven_jar(
- name = "javax-servlet-api",
- artifact = "javax.servlet:servlet-api:2.5",
-)
-
-bind(
- name = "javax/servlet/api",
- actual = "//tools/build_rules/appengine:javax.servlet.api",
-)
-
-maven_jar(
- name = "commons-lang",
- artifact = "commons-lang:commons-lang:2.6",
-)
diff --git a/tools/build_rules/appengine/appengine.bzl b/tools/build_rules/appengine/appengine.bzl
index b915b370e1..2245bd507d 100644
--- a/tools/build_rules/appengine/appengine.bzl
+++ b/tools/build_rules/appengine/appengine.bzl
@@ -222,3 +222,41 @@ def java_war(name, data=[], data_path=None, **kwargs):
jars = ["lib%s" % name],
data=data,
data_path=data_path)
+
+def appengine_repositories():
+ native.new_http_archive(
+ name = "appengine-java",
+ url = "http://central.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.9.23/appengine-java-sdk-1.9.23.zip",
+ sha256 = "05e667036e9ef4f999b829fc08f8e5395b33a5a3c30afa9919213088db2b2e89",
+ build_file = "tools/build_rules/appengine/appengine.BUILD",
+ )
+
+ native.bind(
+ name = "appengine/java/sdk",
+ actual = "@appengine-java//:sdk",
+ )
+
+ native.bind(
+ name = "appengine/java/api",
+ actual = "@appengine-java//:api",
+ )
+
+ native.bind(
+ name = "appengine/java/jars",
+ actual = "@appengine-java//:jars",
+ )
+
+ native.maven_jar(
+ name = "javax-servlet-api",
+ artifact = "javax.servlet:servlet-api:2.5",
+ )
+
+ native.bind(
+ name = "javax/servlet/api",
+ actual = "//tools/build_rules/appengine:javax.servlet.api",
+ )
+
+ native.maven_jar(
+ name = "commons-lang",
+ artifact = "commons-lang:commons-lang:2.6",
+ )
diff --git a/tools/build_rules/closure/README.md b/tools/build_rules/closure/README.md
index 791e4e213a..fc4633fd24 100644
--- a/tools/build_rules/closure/README.md
+++ b/tools/build_rules/closure/README.md
@@ -12,9 +12,14 @@ be compiled with the Closure Tools toolchain.
## Setup
-The rules defined in `//tools/build_rules/closure/closure.WORKSPACE` must be
-copied into your `WORKSPACE` file before using these rules. These rules define
-the locations of the various Closure Tools binaries and the Closure Library.
+Add the following to your `WORKSPACE` file to add the external repositories
+for the various Closure Tools binaries and the Closure Library:
+
+```python
+load("/tools/build_rules/closure/closure_repositories", "closure_repositories")
+
+closure_repositories()
+```
## Usage
diff --git a/tools/build_rules/closure/closure.WORKSPACE b/tools/build_rules/closure/closure.WORKSPACE
deleted file mode 100644
index 5ea09a3bdc..0000000000
--- a/tools/build_rules/closure/closure.WORKSPACE
+++ /dev/null
@@ -1,36 +0,0 @@
-new_http_archive(
- name = "closure_compiler",
- build_file = "tools/build_rules/closure/closure_compiler.BUILD",
- sha256 = "e4e0cb49ad21ec26dd47693bdbd48f67aefe2d94fe8d9239312d2bcc74986538",
- url = "http://dl.google.com/closure-compiler/compiler-20150729.zip",
-)
-
-new_git_repository(
- name = "closure_library",
- build_file = "tools/build_rules/closure/closure_library.BUILD",
- commit = "748b32441093c1474db2e0b3d074250e0bc47778",
- remote = "https://github.com/google/closure-library.git",
-)
-
-http_jar(
- name = "closure_stylesheets",
- sha256 = "8b2ae8ec3733171ec0c2e6536566df0b3c6da3e59b4784993bc9e73125d29c82",
- url = "https://closure-stylesheets.googlecode.com/files/closure-stylesheets-20111230.jar",
-)
-
-new_http_archive(
- name = "closure_templates",
- build_file = "tools/build_rules/closure/closure_templates.BUILD",
- sha256 = "cdd94123cd0d1c3a183c15e855739c0aa5390297c22dddc731b8d7b23815e8a2",
- url = "http://dl.google.com/closure-templates/closure-templates-for-javascript-latest.zip",
-)
-
-bind(
- name = "closure_compiler_",
- actual = "@closure_compiler//:closure_compiler",
-)
-
-bind(
- name = "closure_templates_",
- actual = "@closure_templates//:closure_templates",
-)
diff --git a/tools/build_rules/closure/closure_repositories.bzl b/tools/build_rules/closure/closure_repositories.bzl
new file mode 100644
index 0000000000..38aee0282a
--- /dev/null
+++ b/tools/build_rules/closure/closure_repositories.bzl
@@ -0,0 +1,51 @@
+# Copyright 2015 The Bazel Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+def closure_repositories():
+ native.new_http_archive(
+ name = "closure_compiler",
+ build_file = "tools/build_rules/closure/closure_compiler.BUILD",
+ sha256 = "e4e0cb49ad21ec26dd47693bdbd48f67aefe2d94fe8d9239312d2bcc74986538",
+ url = "http://dl.google.com/closure-compiler/compiler-20150729.zip",
+ )
+
+ native.new_git_repository(
+ name = "closure_library",
+ build_file = "tools/build_rules/closure/closure_library.BUILD",
+ commit = "748b32441093c1474db2e0b3d074250e0bc47778",
+ remote = "https://github.com/google/closure-library.git",
+ )
+
+ native.http_jar(
+ name = "closure_stylesheets",
+ sha256 = "8b2ae8ec3733171ec0c2e6536566df0b3c6da3e59b4784993bc9e73125d29c82",
+ url = "https://closure-stylesheets.googlecode.com/files/closure-stylesheets-20111230.jar",
+ )
+
+ native.new_http_archive(
+ name = "closure_templates",
+ build_file = "tools/build_rules/closure/closure_templates.BUILD",
+ sha256 = "cdd94123cd0d1c3a183c15e855739c0aa5390297c22dddc731b8d7b23815e8a2",
+ url = "http://dl.google.com/closure-templates/closure-templates-for-javascript-latest.zip",
+ )
+
+ native.bind(
+ name = "closure_compiler_",
+ actual = "@closure_compiler//:closure_compiler",
+ )
+
+ native.bind(
+ name = "closure_templates_",
+ actual = "@closure_templates//:closure_templates",
+ )
diff --git a/tools/build_rules/go/README.md b/tools/build_rules/go/README.md
index 3db331c06b..a7a7b8a83d 100644
--- a/tools/build_rules/go/README.md
+++ b/tools/build_rules/go/README.md
@@ -32,7 +32,14 @@ They currently do not support (in order of importance):
## Setup
* Decide on the name of your package, eg. `github.com/joe/project`
-* Copy `tools/build_rules/go/toolchain/WORKSPACE.go-toolchain` to `WORKSPACE`
+* Add the following to your WORKSPACE file:
+
+ ```python
+ load("/tools/build_rules/go/def", "go_repositories")
+
+ go_repositories()
+ ```
+
* Add a `BUILD` file to the top of your workspace, containing
```python
diff --git a/tools/build_rules/go/def.bzl b/tools/build_rules/go/def.bzl
index 44a637f369..0cbe85c179 100644
--- a/tools/build_rules/go/def.bzl
+++ b/tools/build_rules/go/def.bzl
@@ -379,3 +379,23 @@ go_test = rule(
},
test = True,
)
+
+# TODO(bazel-team): support darwin
+def go_repositories():
+ native.bind(name = "go_prefix",
+ actual = "//:go_prefix",
+ )
+
+ native.new_http_archive(
+ name= "golang-linux-amd64",
+ url = "https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz",
+ build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
+ sha256 = "2593132ca490b9ee17509d65ee2cd078441ff544899f6afb97a03d08c25524e7"
+ )
+
+ native.new_http_archive(
+ name= "golang-darwin-amd64",
+ url = "https://storage.googleapis.com/golang/go1.5.1.darwin-amd64.tar.gz",
+ build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
+ sha256 = "e94487b8cd2e0239f27dc51e6c6464383b10acb491f753584605e9b28abf48fb"
+ )
diff --git a/tools/build_rules/go/toolchain/WORKSPACE.go-toolchain b/tools/build_rules/go/toolchain/WORKSPACE.go-toolchain
deleted file mode 100644
index 3e303e079d..0000000000
--- a/tools/build_rules/go/toolchain/WORKSPACE.go-toolchain
+++ /dev/null
@@ -1,19 +0,0 @@
-# TODO(bazel-team): support darwin
-
-bind(name = "go_prefix",
- actual = "//:go_prefix",
-)
-
-new_http_archive(
- name= "golang-linux-amd64",
- url = "https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz",
- build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
- sha256 = "2593132ca490b9ee17509d65ee2cd078441ff544899f6afb97a03d08c25524e7"
-)
-
-new_http_archive(
- name= "golang-darwin-amd64",
- url = "https://storage.googleapis.com/golang/go1.5.1.darwin-amd64.tar.gz",
- build_file = "tools/build_rules/go/toolchain/BUILD.go-toolchain",
- sha256 = "e94487b8cd2e0239f27dc51e6c6464383b10acb491f753584605e9b28abf48fb"
-)