diff options
Diffstat (limited to 'tools/build_rules/closure/closure_repositories.bzl')
-rw-r--r-- | tools/build_rules/closure/closure_repositories.bzl | 69 |
1 files changed, 66 insertions, 3 deletions
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", ) |