build: serve largetable benchmark tests with bazel (#28645)
PR Close #28645
This commit is contained in:
parent
28bdeeef3e
commit
1a326d5690
|
@ -4,14 +4,8 @@ load("//tools:defaults.bzl", "ts_library")
|
|||
|
||||
ts_library(
|
||||
name = "util_lib",
|
||||
srcs = [
|
||||
"util.ts",
|
||||
],
|
||||
deps = [
|
||||
"//modules/benchmarks/src:util_lib",
|
||||
"//packages:types",
|
||||
"//packages/core",
|
||||
],
|
||||
srcs = ["util.ts"],
|
||||
deps = ["//modules/benchmarks/src:util_lib"],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
ts_library(
|
||||
name = "baseline",
|
||||
srcs = glob(["*.ts"]),
|
||||
tsconfig = "//modules/benchmarks:tsconfig-build.json",
|
||||
deps = [
|
||||
"//modules/benchmarks/src:util_lib",
|
||||
"//modules/benchmarks/src/largetable:util_lib",
|
||||
],
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
entry_module = "angular/modules/benchmarks/src/largetable/baseline/index",
|
||||
index_html = "index.html",
|
||||
port = 4200,
|
||||
deps = [":baseline"],
|
||||
)
|
|
@ -1,5 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Prevent the browser from requesting any favicon. -->
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
|
@ -24,11 +28,5 @@
|
|||
<div>
|
||||
<largetable id="root">Loading...</largetable>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|
||||
|| '../../bootstrap_plain.js';
|
||||
document.write('<script src="' + mainUrl + '">\u003c/script>');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
ts_library(
|
||||
name = "incremental_dom",
|
||||
srcs = glob(["*.ts"]),
|
||||
tsconfig = "//modules/benchmarks:tsconfig-build.json",
|
||||
deps = [
|
||||
"//modules/benchmarks/src:util_lib",
|
||||
"//modules/benchmarks/src/largetable:util_lib",
|
||||
],
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
entry_module = "angular/modules/benchmarks/src/largetable/incremental_dom/index",
|
||||
index_html = "index.html",
|
||||
port = 4200,
|
||||
static_files = [
|
||||
"@ngdeps//node_modules/incremental-dom:dist/incremental-dom.js",
|
||||
],
|
||||
deps = [":incremental_dom"],
|
||||
)
|
|
@ -1,5 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Prevent the browser from requesting any favicon. -->
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
|
@ -24,7 +28,5 @@
|
|||
<div>
|
||||
<largetable id="root"></largetable>
|
||||
</div>
|
||||
|
||||
<script src="../../bootstrap_plain.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -10,24 +10,26 @@ import {bindAction, profile} from '../../util';
|
|||
import {buildTable, emptyTable} from '../util';
|
||||
import {TableComponent} from './table';
|
||||
|
||||
export function main() {
|
||||
let table: TableComponent;
|
||||
let table: TableComponent;
|
||||
|
||||
function destroyDom() { table.data = emptyTable; }
|
||||
|
||||
function createDom() { table.data = buildTable(); }
|
||||
|
||||
function noop() {}
|
||||
|
||||
function init() {
|
||||
table = new TableComponent(document.querySelector('largetable'));
|
||||
|
||||
bindAction('#destroyDom', destroyDom);
|
||||
bindAction('#createDom', createDom);
|
||||
|
||||
bindAction('#updateDomProfile', profile(createDom, noop, 'update'));
|
||||
bindAction('#createDomProfile', profile(createDom, destroyDom, 'create'));
|
||||
}
|
||||
|
||||
init();
|
||||
function destroyDom() {
|
||||
table.data = emptyTable;
|
||||
}
|
||||
|
||||
function createDom() {
|
||||
table.data = buildTable();
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
function init() {
|
||||
table = new TableComponent(document.querySelector('largetable'));
|
||||
|
||||
bindAction('#destroyDom', destroyDom);
|
||||
bindAction('#createDom', createDom);
|
||||
|
||||
bindAction('#updateDomProfile', profile(createDom, noop, 'update'));
|
||||
bindAction('#createDomProfile', profile(createDom, destroyDom, 'create'));
|
||||
}
|
||||
|
||||
init();
|
||||
|
|
|
@ -7,8 +7,12 @@
|
|||
*/
|
||||
|
||||
import {TableCell} from '../util';
|
||||
|
||||
// We load "IncrementalDOM" as a AMD global because the "incremental-dom" NPM package does not
|
||||
// come with a named UMD module, and it's easier to just import the AMD file and use it globally.
|
||||
declare const IncrementalDOM: any;
|
||||
const {patch, elementOpen, elementClose, elementOpenStart, elementOpenEnd, attr, text} =
|
||||
require('incremental-dom');
|
||||
IncrementalDOM;
|
||||
|
||||
export class TableComponent {
|
||||
constructor(private _rootEl: any) {}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
index_html = "index.html",
|
||||
port = 4200,
|
||||
static_files = ["largetable.js"],
|
||||
)
|
|
@ -1,5 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Prevent the browser from requesting any favicon. -->
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
|
@ -24,8 +28,5 @@
|
|||
<div>
|
||||
<largetable id="root"></largetable>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="largetable.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
load("//tools:defaults.bzl", "ng_module")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
# Note that this benchmark has been designed for Angular with ViewEngine, but once
|
||||
# ViewEngine is removed, we should should consider removing this one since there
|
||||
# already is a "render3" benchmark.
|
||||
ng_module(
|
||||
name = "ng2",
|
||||
srcs = glob(["*.ts"]),
|
||||
tsconfig = "//modules/benchmarks:tsconfig-build.json",
|
||||
# TODO: FW-1004 Type checking is currently not complete.
|
||||
type_check = False,
|
||||
deps = [
|
||||
"//modules/benchmarks/src:util_lib",
|
||||
"//modules/benchmarks/src/largetable:util_lib",
|
||||
"//packages/core",
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-browser-dynamic",
|
||||
],
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
entry_module = "angular/modules/benchmarks/src/largetable/ng2/index",
|
||||
index_html = "index.html",
|
||||
port = 4200,
|
||||
scripts = ["@ngdeps//node_modules/tslib:tslib.js"],
|
||||
static_files = [
|
||||
"@ngdeps//node_modules/zone.js:dist/zone.js",
|
||||
"@ngdeps//node_modules/reflect-metadata:Reflect.js",
|
||||
],
|
||||
deps = [":ng2"],
|
||||
)
|
|
@ -1,5 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Prevent the browser from requesting any favicon. -->
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
|
@ -24,11 +28,5 @@
|
|||
<div>
|
||||
<largetable id="root">Loading...</largetable>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|
||||
|| '../../bootstrap_ng2.js';
|
||||
document.write('<script src="' + mainUrl + '">\u003c/script>');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,7 +12,5 @@ import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
|||
import {init} from './init';
|
||||
import {AppModule} from './table';
|
||||
|
||||
export function main() {
|
||||
enableProdMode();
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).then(init);
|
||||
}
|
||||
enableProdMode();
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).then(init);
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
load("//tools:defaults.bzl", "ng_module")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
package(default_visibility = ["//modules/benchmarks:__subpackages__"])
|
||||
|
||||
ng_module(
|
||||
name = "ng2_switch",
|
||||
srcs = glob(["*.ts"]),
|
||||
tsconfig = "//modules/benchmarks:tsconfig-build.json",
|
||||
# TODO: FW-1004 Type checking is currently not complete.
|
||||
type_check = False,
|
||||
deps = [
|
||||
"//modules/benchmarks/src:util_lib",
|
||||
"//modules/benchmarks/src/largetable:util_lib",
|
||||
"//packages/core",
|
||||
"//packages/platform-browser",
|
||||
"//packages/platform-browser-dynamic",
|
||||
],
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
entry_module = "angular/modules/benchmarks/src/largetable/ng2_switch/index",
|
||||
index_html = "index.html",
|
||||
port = 4200,
|
||||
scripts = ["@ngdeps//node_modules/tslib:tslib.js"],
|
||||
static_files = [
|
||||
"@ngdeps//node_modules/zone.js:dist/zone.js",
|
||||
"@ngdeps//node_modules/reflect-metadata:Reflect.js",
|
||||
],
|
||||
deps = [":ng2_switch"],
|
||||
)
|
|
@ -1,5 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Prevent the browser from requesting any favicon. -->
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
|
@ -24,11 +28,5 @@
|
|||
<div>
|
||||
<largetable id="root">Loading...</largetable>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|
||||
|| '../../bootstrap_ng2.js';
|
||||
document.write('<script src="' + mainUrl + '">\u003c/script>');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,7 +12,5 @@ import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
|||
import {init} from './init';
|
||||
import {AppModule} from './table';
|
||||
|
||||
export function main() {
|
||||
enableProdMode();
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).then(init);
|
||||
}
|
||||
enableProdMode();
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).then(init);
|
||||
|
|
|
@ -32,20 +32,12 @@ ng_rollup_bundle(
|
|||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "favicon",
|
||||
srcs = ["//modules/benchmarks:favicon"],
|
||||
outs = ["favicon.ico"],
|
||||
cmd = "cp $< $@",
|
||||
)
|
||||
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
static_files = [
|
||||
":bundle.min_debug.js",
|
||||
":bundle.min.js",
|
||||
"index.html",
|
||||
":favicon",
|
||||
],
|
||||
tags = ["ivy-only"],
|
||||
)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<!-- Prevent the browser from requesting any favicon. -->
|
||||
<link rel="icon" href="data:,">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
|
|
Loading…
Reference in New Issue