aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_rules
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-02-12 14:17:55 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-02-12 15:24:44 +0000
commit175b267569219100ac756b0ef016211b0cfa90c4 (patch)
tree61ef0c539e20085e1d953be96b83623beb2de2bb /tools/build_rules
parent14c49ac248fc4d16d7ce1ca699b33891fea96873 (diff)
Use build_file_content attribute of new_* repositories instead of build_file in Skylark rules
Loading those skylark rules where failing now they are in a remote repository because the build file could not be found. Fixes #883. -- MOS_MIGRATED_REVID=114528630
Diffstat (limited to 'tools/build_rules')
-rw-r--r--tools/build_rules/appengine/appengine.BUILD34
-rw-r--r--tools/build_rules/appengine/appengine.bzl25
-rw-r--r--tools/build_rules/closure/closure_compiler.BUILD25
-rw-r--r--tools/build_rules/closure/closure_library.BUILD38
-rw-r--r--tools/build_rules/closure/closure_repositories.bzl69
-rw-r--r--tools/build_rules/closure/closure_templates.BUILD33
-rw-r--r--tools/build_rules/go/def.bzl19
-rw-r--r--tools/build_rules/go/toolchain/BUILD1
-rw-r--r--tools/build_rules/go/toolchain/BUILD.go-toolchain12
-rw-r--r--tools/build_rules/rust/rust.BUILD59
-rw-r--r--tools/build_rules/rust/rust.bzl66
11 files changed, 171 insertions, 210 deletions
diff --git a/tools/build_rules/appengine/appengine.BUILD b/tools/build_rules/appengine/appengine.BUILD
deleted file mode 100644
index c1942a24de..0000000000
--- a/tools/build_rules/appengine/appengine.BUILD
+++ /dev/null
@@ -1,34 +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.
-
-# BUILD file to use the Java AppEngine SDK with a remote repository.
-java_import(
- name = "jars",
- jars = glob(["**/*.jar"]),
- visibility = ["//visibility:public"],
-)
-
-java_import(
- name = "api",
- jars = ["appengine-java-sdk-1.9.23/lib/impl/appengine-api.jar"],
- visibility = ["//visibility:public"],
- neverlink = 1,
-)
-
-filegroup(
- name = "sdk",
- srcs = glob(["appengine-java-sdk-1.9.23/**"]),
- visibility = ["//visibility:public"],
- path = "appengine-java-sdk-1.9.23",
-) \ No newline at end of file
diff --git a/tools/build_rules/appengine/appengine.bzl b/tools/build_rules/appengine/appengine.bzl
index a9f5b4756a..62e843767a 100644
--- a/tools/build_rules/appengine/appengine.bzl
+++ b/tools/build_rules/appengine/appengine.bzl
@@ -233,12 +233,35 @@ def java_war(name, data=[], data_path=None, **kwargs):
data=data,
data_path=data_path)
+APPENGINE_BUILD_FILE = """
+# BUILD file to use the Java AppEngine SDK with a remote repository.
+java_import(
+ name = "jars",
+ jars = glob(["**/*.jar"]),
+ visibility = ["//visibility:public"],
+)
+
+java_import(
+ name = "api",
+ jars = ["appengine-java-sdk-1.9.23/lib/impl/appengine-api.jar"],
+ visibility = ["//visibility:public"],
+ neverlink = 1,
+)
+
+filegroup(
+ name = "sdk",
+ srcs = glob(["appengine-java-sdk-1.9.23/**"]),
+ visibility = ["//visibility:public"],
+ path = "appengine-java-sdk-1.9.23",
+)
+"""
+
def appengine_repositories():
native.new_http_archive(
name = "com_google_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",
+ build_file_content = APPENGINE_BUILD_FILE,
)
native.bind(
diff --git a/tools/build_rules/closure/closure_compiler.BUILD b/tools/build_rules/closure/closure_compiler.BUILD
deleted file mode 100644
index dfc5411ea7..0000000000
--- a/tools/build_rules/closure/closure_compiler.BUILD
+++ /dev/null
@@ -1,25 +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.
-
-java_import(
- name = "closure_compiler_jar",
- jars = ["compiler.jar"],
-)
-
-java_binary(
- name = "closure_compiler",
- main_class = "com.google.javascript.jscomp.CommandLineRunner",
- visibility = ["//visibility:public"],
- runtime_deps = [":closure_compiler_jar"],
-)
diff --git a/tools/build_rules/closure/closure_library.BUILD b/tools/build_rules/closure/closure_library.BUILD
deleted file mode 100644
index a4804539b9..0000000000
--- a/tools/build_rules/closure/closure_library.BUILD
+++ /dev/null
@@ -1,38 +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.
-
-load("/tools/build_rules/closure/closure_js_library", "closure_js_library")
-load("/tools/build_rules/closure/closure_stylesheet_library", "closure_stylesheet_library")
-
-closure_js_library(
- name = "closure_library",
- srcs = glob(
- [
- "closure/goog/**/*.js",
- "third_party/closure/goog/**/*.js",
- ],
- exclude = [
- "closure/goog/**/*_test.js",
- "closure/goog/demos/**/*.js",
- "third_party/closure/goog/**/*_test.js",
- ],
- ),
- visibility = ["//visibility:public"],
-)
-
-closure_stylesheet_library(
- name = "closure_library_css",
- srcs = glob(["closure/goog/css/**/*.css"]),
- visibility = ["//visibility:public"],
-)
diff --git a/tools/build_rules/closure/closure_repositories.bzl b/tools/build_rules/closure/closure_repositories.bzl
index 38aee0282a..29ab5f1a53 100644
--- a/tools/build_rules/closure/closure_repositories.bzl
+++ b/tools/build_rules/closure/closure_repositories.bzl
@@ -12,17 +12,80 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+CLOSURE_COMPILER_BUILD_FILE = """
+java_import(
+ name = "closure_compiler_jar",
+ jars = ["compiler.jar"],
+)
+
+java_binary(
+ name = "closure_compiler",
+ main_class = "com.google.javascript.jscomp.CommandLineRunner",
+ visibility = ["//visibility:public"],
+ runtime_deps = [":closure_compiler_jar"],
+)
+"""
+
+CLOSURE_LIBRARY_BUILD_FILE = """
+load("@bazel_tools//tools/build_rules/closure:closure_js_library.bzl", "closure_js_library")
+load("@bazel_tools//tools/build_rules/closure:closure_stylesheet_library.bzl", "closure_stylesheet_library")
+
+closure_js_library(
+ name = "closure_library",
+ srcs = glob(
+ [
+ "closure/goog/**/*.js",
+ "third_party/closure/goog/**/*.js",
+ ],
+ exclude = [
+ "closure/goog/**/*_test.js",
+ "closure/goog/demos/**/*.js",
+ "third_party/closure/goog/**/*_test.js",
+ ],
+ ),
+ visibility = ["//visibility:public"],
+)
+
+closure_stylesheet_library(
+ name = "closure_library_css",
+ srcs = glob(["closure/goog/css/**/*.css"]),
+ visibility = ["//visibility:public"],
+)
+"""
+
+CLOSURE_TEMPLATES_BUILD_FILE = """
+load("@bazel_tools//tools/build_rules/closure:closure_js_library.bzl", "closure_js_library")
+
+java_import(
+ name = "closure_templates_jar",
+ jars = ["SoyToJsSrcCompiler.jar"],
+)
+
+java_binary(
+ name = "closure_templates",
+ main_class = "com.google.template.soy.SoyToJsSrcCompiler",
+ visibility = ["//visibility:public"],
+ runtime_deps = [":closure_templates_jar"],
+)
+
+closure_js_library(
+ name = "closure_templates_js",
+ srcs = ["soyutils_usegoog.js"],
+ visibility = ["//visibility:public"],
+)
+"""
+
def closure_repositories():
native.new_http_archive(
name = "closure_compiler",
- build_file = "tools/build_rules/closure/closure_compiler.BUILD",
+ build_file_content = CLOSURE_COMPILER_BUILD_FILE,
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",
+ build_file_content = CLOSURE_LIBRARY_BUILD_FILE,
commit = "748b32441093c1474db2e0b3d074250e0bc47778",
remote = "https://github.com/google/closure-library.git",
)
@@ -35,7 +98,7 @@ def closure_repositories():
native.new_http_archive(
name = "closure_templates",
- build_file = "tools/build_rules/closure/closure_templates.BUILD",
+ build_file_content = CLOSURE_TEMPLATES_BUILD_FILE,
sha256 = "cdd94123cd0d1c3a183c15e855739c0aa5390297c22dddc731b8d7b23815e8a2",
url = "http://dl.google.com/closure-templates/closure-templates-for-javascript-latest.zip",
)
diff --git a/tools/build_rules/closure/closure_templates.BUILD b/tools/build_rules/closure/closure_templates.BUILD
deleted file mode 100644
index 7037b8b49e..0000000000
--- a/tools/build_rules/closure/closure_templates.BUILD
+++ /dev/null
@@ -1,33 +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.
-
-load("/tools/build_rules/closure/closure_js_library", "closure_js_library")
-
-java_import(
- name = "closure_templates_jar",
- jars = ["SoyToJsSrcCompiler.jar"],
-)
-
-java_binary(
- name = "closure_templates",
- main_class = "com.google.template.soy.SoyToJsSrcCompiler",
- visibility = ["//visibility:public"],
- runtime_deps = [":closure_templates_jar"],
-)
-
-closure_js_library(
- name = "closure_templates_js",
- srcs = ["soyutils_usegoog.js"],
- visibility = ["//visibility:public"],
-)
diff --git a/tools/build_rules/go/def.bzl b/tools/build_rules/go/def.bzl
index 1ce34770bd..647371fff1 100644
--- a/tools/build_rules/go/def.bzl
+++ b/tools/build_rules/go/def.bzl
@@ -380,17 +380,32 @@ go_test = rule(
test = True,
)
+GO_TOOLCHAIN_BUILD_FILE = """
+package(
+ default_visibility = [ "//visibility:public" ])
+
+filegroup(
+ name = "toolchain",
+ srcs = glob(["go/bin/*", "go/pkg/**", ]),
+)
+
+filegroup(
+ name = "go_tool",
+ srcs = [ "go/bin/go" ],
+)
+"""
+
def go_repositories():
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",
+ build_file_content = GO_TOOLCHAIN_BUILD_FILE,
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",
+ build_file_content = GO_TOOLCHAIN_BUILD_FILE,
sha256 = "e94487b8cd2e0239f27dc51e6c6464383b10acb491f753584605e9b28abf48fb"
)
diff --git a/tools/build_rules/go/toolchain/BUILD b/tools/build_rules/go/toolchain/BUILD
index d7d8be8e22..c3afba9268 100644
--- a/tools/build_rules/go/toolchain/BUILD
+++ b/tools/build_rules/go/toolchain/BUILD
@@ -34,7 +34,6 @@ filegroup(
name = "srcs",
srcs = [
"BUILD",
- "BUILD.go-toolchain",
],
visibility = [
"//src:__subpackages__",
diff --git a/tools/build_rules/go/toolchain/BUILD.go-toolchain b/tools/build_rules/go/toolchain/BUILD.go-toolchain
deleted file mode 100644
index 5624a3bc2f..0000000000
--- a/tools/build_rules/go/toolchain/BUILD.go-toolchain
+++ /dev/null
@@ -1,12 +0,0 @@
-package(
- default_visibility = [ "//visibility:public" ])
-
-filegroup(
- name = "toolchain",
- srcs = glob(["go/bin/*", "go/pkg/**", ]),
-)
-
-filegroup(
- name = "go_tool",
- srcs = [ "go/bin/go" ],
-)
diff --git a/tools/build_rules/rust/rust.BUILD b/tools/build_rules/rust/rust.BUILD
deleted file mode 100644
index 86d2c7abf0..0000000000
--- a/tools/build_rules/rust/rust.BUILD
+++ /dev/null
@@ -1,59 +0,0 @@
-config_setting(
- name = "darwin",
- values = {"host_cpu": "darwin"},
-)
-
-config_setting(
- name = "k8",
- values = {"host_cpu": "k8"},
-)
-
-filegroup(
- name = "rustc",
- srcs = select({
- ":darwin": ["rustc/bin/rustc"],
- ":k8": ["rustc/bin/rustc"],
- }),
- visibility = ["//visibility:public"],
-)
-
-filegroup(
- name = "rustc_lib",
- srcs = select({
- ":darwin": glob(["rustc/lib/*.dylib"]),
- ":k8": glob(["rustc/lib/*.so"]),
- }),
- visibility = ["//visibility:public"],
-)
-
-filegroup(
- name = "rustdoc",
- srcs = select({
- ":darwin": ["rustc/bin/rustdoc"],
- ":k8": ["rustc/bin/rustdoc"],
- }),
- visibility = ["//visibility:public"],
-)
-
-filegroup(
- name = "rustlib",
- srcs = select({
- ":darwin": glob([
- "rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/*.rlib",
- "rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/*.dylib",
- "rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/*.a",
- "rustc/lib/rustlib/x86_64-apple-darwin/lib/*.rlib",
- "rustc/lib/rustlib/x86_64-apple-darwin/lib/*.dylib",
- "rustc/lib/rustlib/x86_64-apple-darwin/lib/*.a",
- ]),
- ":k8": glob([
- "rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.rlib",
- "rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.so",
- "rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.a",
- "rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.rlib",
- "rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.so",
- "rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.a",
- ]),
- }),
- visibility = ["//visibility:public"],
-)
diff --git a/tools/build_rules/rust/rust.bzl b/tools/build_rules/rust/rust.bzl
index 8b96051d9b..84b6c2856a 100644
--- a/tools/build_rules/rust/rust.bzl
+++ b/tools/build_rules/rust/rust.bzl
@@ -673,13 +673,75 @@ rust_doc_test = rule(
test = True,
)
+RUST_BUILD_FILE = """
+config_setting(
+ name = "darwin",
+ values = {"host_cpu": "darwin"},
+)
+
+config_setting(
+ name = "k8",
+ values = {"host_cpu": "k8"},
+)
+
+filegroup(
+ name = "rustc",
+ srcs = select({
+ ":darwin": ["rustc/bin/rustc"],
+ ":k8": ["rustc/bin/rustc"],
+ }),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "rustc_lib",
+ srcs = select({
+ ":darwin": glob(["rustc/lib/*.dylib"]),
+ ":k8": glob(["rustc/lib/*.so"]),
+ }),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "rustdoc",
+ srcs = select({
+ ":darwin": ["rustc/bin/rustdoc"],
+ ":k8": ["rustc/bin/rustdoc"],
+ }),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "rustlib",
+ srcs = select({
+ ":darwin": glob([
+ "rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/*.rlib",
+ "rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/*.dylib",
+ "rust-std-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/*.a",
+ "rustc/lib/rustlib/x86_64-apple-darwin/lib/*.rlib",
+ "rustc/lib/rustlib/x86_64-apple-darwin/lib/*.dylib",
+ "rustc/lib/rustlib/x86_64-apple-darwin/lib/*.a",
+ ]),
+ ":k8": glob([
+ "rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.rlib",
+ "rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.so",
+ "rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.a",
+ "rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.rlib",
+ "rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.so",
+ "rustc/lib/rustlib/x86_64-unknown-linux-gnu/lib/*.a",
+ ]),
+ }),
+ visibility = ["//visibility:public"],
+)
+"""
+
def rust_repositories():
native.new_http_archive(
name = "rust_linux_x86_64",
url = "https://static.rust-lang.org/dist/rust-1.6.0-x86_64-unknown-linux-gnu.tar.gz",
strip_prefix = "rust-1.6.0-x86_64-unknown-linux-gnu",
sha256 = "8630cc02432b4423d64eeae4ef071ec58e5dd1f3d555a3a3cc34b759202813f6",
- build_file = "tools/build_rules/rust/rust.BUILD",
+ build_file_content = RUST_BUILD_FILE,
)
native.new_http_archive(
@@ -687,5 +749,5 @@ def rust_repositories():
url = "https://static.rust-lang.org/dist/rust-1.6.0-x86_64-apple-darwin.tar.gz",
strip_prefix = "rust-1.6.0-x86_64-apple-darwin",
sha256 = "8c6897ed37ef6fd2890b176afa65306cc8943e3c770c9530a701f1aefd3942b1",
- build_file = "tools/build_rules/rust/rust.BUILD",
+ build_file_content = RUST_BUILD_FILE,
)