test(ivy): also track the size of the compressed hello world bundle (#22056)

PR Close #22056
This commit is contained in:
Alex Eagle 2018-02-06 17:56:35 -08:00 committed by Miško Hevery
parent 83d43ac850
commit 16e5b866d2
4 changed files with 30 additions and 3 deletions

View File

@ -69,6 +69,9 @@ jobs:
- store_artifacts:
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js
destination: packages/core/test/bundling/hello_world/bundle.min.js
- store_artifacts:
path: dist/bin/packages/core/test/bundling/hello_world/bundle.min.js.brotli
destination: packages/core/test/bundling/hello_world/bundle.min.js.brotli
- save_cache:
key: *cache_key

View File

@ -68,3 +68,10 @@ git_repository(
remote = "https://github.com/angular/devkit.git",
commit = "69fcdee61c5ff3f08aa609dec69155dfd29c809a",
)
http_archive(
name = "org_brotli",
url = "https://github.com/google/brotli/archive/v1.0.2.zip",
strip_prefix = "brotli-1.0.2",
sha256 = "b43d5d6bc40f2fa6c785b738d86c6bbe022732fe25196ebbe43b9653a025920d",
)

View File

@ -26,6 +26,14 @@ PLUGIN_CONFIG="{sideEffectFreeModules: [\n%s]}" % ",\n".join(
BO_ROLLUP="angular_devkit/packages/angular_devkit/build_optimizer/src/build-optimizer/rollup-plugin.js"
BO_PLUGIN="require('%s').default(%s)" % (BO_ROLLUP, PLUGIN_CONFIG)
def run_brotli(ctx, input, output):
ctx.action(
executable = ctx.executable._brotli,
inputs = [input],
outputs = [output],
arguments = ["--output=%s" % output.path, input.path],
)
def _ng_rollup_bundle(ctx):
# We don't expect anyone to make use of this bundle yet, but it makes this rule
# compatible with rollup_bundle which allows them to be easily swapped back and
@ -52,6 +60,8 @@ def _ng_rollup_bundle(ctx):
run_uglify(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min)
run_uglify(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min_debug, debug = True)
run_brotli(ctx, ctx.outputs.build_es5_min, ctx.outputs.build_es5_min_compressed)
return DefaultInfo(files=depset([ctx.outputs.build_es5_min]))
ng_rollup_bundle = rule(
@ -63,8 +73,14 @@ ng_rollup_bundle = rule(
]),
"_rollup": attr.label(
executable = True,
cfg="host",
cfg = "host",
default = Label("@angular//packages/bazel/src:rollup_with_build_optimizer")),
"_brotli": attr.label(
executable = True,
cfg = "host",
default = Label("@org_brotli//:brotli")),
}),
outputs = ROLLUP_OUTPUTS,
)
outputs = dict(ROLLUP_OUTPUTS, **{
"build_es5_min_compressed": "%{name}.min.js.brotli",
}),
)

View File

@ -39,6 +39,7 @@ jasmine_node_test(
data = [
":bundle",
":bundle.js",
":bundle.min.js.brotli",
":bundle.min_debug.js",
],
deps = [":test_lib"],