
When the Java server was updated to render the index HTML from Soy, the run-server.sh development server had not been upgraded, and continued to render the static index file. As a result, the static file was kept so that the development server would continue working. Problematically, however, this meant that the two index files had to be kept in sync. With this change, the Go server used by run-server.sh loads and renders the same Soy template as the Java server. Allowing the static index to be removed. This adds the robfig/soy Go dependency for development only. Bug: Issue 5919 Change-Id: I5a45b5f779d79d8aa2b2725e3570b89e3a7aa9ad
97 lines
3.0 KiB
Python
97 lines
3.0 KiB
Python
load("//tools/bzl:genrule2.bzl", "genrule2")
|
|
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library", "closure_js_binary")
|
|
load(
|
|
"//tools/bzl:js.bzl",
|
|
"vulcanize",
|
|
"bower_component",
|
|
"js_component",
|
|
)
|
|
|
|
def polygerrit_bundle(name, srcs, outs, app):
|
|
appName = app.split(".html")[0].split("/").pop() # eg: gr-app
|
|
|
|
closure_js_binary(
|
|
name = name + "_closure_bin",
|
|
# Known issue: Closure compilation not compatible with Polymer behaviors.
|
|
# See: https://github.com/google/closure-compiler/issues/2042
|
|
compilation_level = "WHITESPACE_ONLY",
|
|
defs = [
|
|
"--polymer_version=1",
|
|
"--jscomp_off=duplicate",
|
|
"--force_inject_library=es6_runtime",
|
|
],
|
|
language = "ECMASCRIPT5",
|
|
deps = [name + "_closure_lib"],
|
|
)
|
|
|
|
closure_js_library(
|
|
name = name + "_closure_lib",
|
|
srcs = [appName + ".js"],
|
|
convention = "GOOGLE",
|
|
# TODO(davido): Clean up these issues: http://paste.openstack.org/show/608548
|
|
# and remove this supression
|
|
suppress = [
|
|
"JSC_JSDOC_MISSING_TYPE_WARNING",
|
|
"JSC_UNNECESSARY_ESCAPE",
|
|
"JSC_UNUSED_LOCAL_ASSIGNMENT",
|
|
],
|
|
deps = [
|
|
"//lib/polymer_externs:polymer_closure",
|
|
"@io_bazel_rules_closure//closure/library",
|
|
],
|
|
)
|
|
|
|
vulcanize(
|
|
name = appName,
|
|
srcs = srcs,
|
|
app = app,
|
|
deps = ["//polygerrit-ui:polygerrit_components.bower_components"],
|
|
)
|
|
|
|
native.filegroup(
|
|
name = name + "_app_sources",
|
|
srcs = [
|
|
name + "_closure_bin.js",
|
|
appName + ".html",
|
|
],
|
|
)
|
|
|
|
native.filegroup(
|
|
name = name + "_css_sources",
|
|
srcs = native.glob(["styles/**/*.css"]),
|
|
)
|
|
|
|
native.filegroup(
|
|
name = name + "_top_sources",
|
|
srcs = [
|
|
"favicon.ico",
|
|
],
|
|
)
|
|
|
|
genrule2(
|
|
name = name,
|
|
srcs = [
|
|
name + "_app_sources",
|
|
name + "_css_sources",
|
|
name + "_top_sources",
|
|
"//lib/fonts:robotofonts",
|
|
"//lib/js:highlightjs_files",
|
|
# we extract from the zip, but depend on the component for license checking.
|
|
"@webcomponentsjs//:zipfile",
|
|
"//lib/js:webcomponentsjs"
|
|
],
|
|
outs = outs,
|
|
cmd = " && ".join([
|
|
"mkdir -p $$TMP/polygerrit_ui/{styles,fonts,bower_components/{highlightjs,webcomponentsjs},elements}",
|
|
"for f in $(locations " + name + "_app_sources); do ext=$${f##*.}; cp -p $$f $$TMP/polygerrit_ui/elements/" + appName + ".$$ext; done",
|
|
"cp $(locations //lib/fonts:robotofonts) $$TMP/polygerrit_ui/fonts/",
|
|
"for f in $(locations " + name + "_top_sources); do cp $$f $$TMP/polygerrit_ui/; done",
|
|
"for f in $(locations "+ name + "_css_sources); do cp $$f $$TMP/polygerrit_ui/styles; done",
|
|
"for f in $(locations //lib/js:highlightjs_files); do cp $$f $$TMP/polygerrit_ui/bower_components/highlightjs/ ; done",
|
|
"unzip -qd $$TMP/polygerrit_ui/bower_components $(location @webcomponentsjs//:zipfile) webcomponentsjs/webcomponents-lite.js",
|
|
"cd $$TMP",
|
|
"find . -exec touch -t 198001010000 '{}' ';'",
|
|
"zip -qr $$ROOT/$@ *",
|
|
]),
|
|
)
|