diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 00000000..346f9888
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1 @@
+build --strategy=Closure=worker
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..7a61a332
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,4 @@
+* text=auto whitespace=blank-at-eol,tab-in-indent,trailing-space,tabwidth=2
+
+*.bat text eol=crlf
+*.sh text eol=lf
diff --git a/.gitignore b/.gitignore
index e2c7c1a4..726beb74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,7 @@ private/
node_modules/
node_modules/**/build/
node_modules/.bin/
+yarn.lock
# coverage/etc
scratch/
@@ -67,6 +68,8 @@ build-gen/
build-bin/
build-test/
+bazel-*
+
# ==============================================================================
# WTF
# ==============================================================================
diff --git a/.gitmodules b/.gitmodules
index edca41f3..9cf820da 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,24 +1,9 @@
-[submodule "third_party/closure-compiler"]
- path = third_party/closure-compiler
- url = https://github.com/benvanik/google-closure-compiler-bin.git
-[submodule "third_party/closure-templates"]
- path = third_party/closure-templates
- url = https://github.com/benvanik/google-closure-templates-bin.git
-[submodule "third_party/closure-stylesheets"]
- path = third_party/closure-stylesheets
- url = https://github.com/benvanik/google-closure-stylesheets-bin.git
-[submodule "third_party/anvil-build"]
- path = third_party/anvil-build
- url = https://github.com/google/anvil-build.git
[submodule "third_party/closure-linter"]
path = third_party/closure-linter
url = https://github.com/knutwalker/google-closure-linter.git
[submodule "third_party/normalize.css"]
path = third_party/normalize.css
url = https://github.com/necolas/normalize.css.git
-[submodule "third_party/closure-library"]
- path = third_party/closure-library
- url = https://github.com/google/closure-library.git
[submodule "third_party/firefox-addon-sdk"]
path = third_party/firefox-addon-sdk
url = https://github.com/mozilla/addon-sdk.git
diff --git a/BUILD b/BUILD
new file mode 100644
index 00000000..35a3d979
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,59 @@
+# Description:
+# Javascript and C++ instrumentation-based profiling tools.
+# https://github.com/google/tracing-framework
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # BSD 3-clause
+
+exports_files(["LICENSE"])
+
+# Restricts most packages to use by WTF only.
+# Selective rules we wish to support to external users are set to
+# //visibility:public.
+package_group(
+ name = "internal",
+ packages = [
+ "//addons/...",
+ "//app/...",
+ "//assets/...",
+ "//bin/...",
+ "//bindings/...",
+ "//extensions/...",
+ "//externs/...",
+ "//src/...",
+ "//test/...",
+ "//third_party/...",
+ ],
+)
+
+# Exported for nodejs rules.
+filegroup(
+ name = "node_modules",
+ srcs = glob(["node_modules/**/*"]),
+)
+
+# Debug; all runtime checks, verbose logging, and debug symbols.
+#
+# $ bazel build -c dbg ...
+config_setting(
+ name = "dbg",
+ values = {"compilation_mode": "dbg"},
+)
+
+# Fast build; some runtime checks, detailed logging, and debug symbols.
+# This is the default and will likely be what you want to use unless profiling.
+#
+# $ bazel build -c fastbuild ...
+config_setting(
+ name = "fastbuild",
+ values = {"compilation_mode": "fastbuild"},
+)
+
+# Optimized; no runtime checks and terse logging.
+#
+# $ bazel build -c opt ...
+config_setting(
+ name = "opt",
+ values = {"compilation_mode": "opt"},
+)
diff --git a/BUILD.anvil b/BUILD.anvil
deleted file mode 100644
index 85f9e077..00000000
--- a/BUILD.anvil
+++ /dev/null
@@ -1,673 +0,0 @@
-# Copyright 2012 Google Inc. All Rights Reserved.
-
-__author__ = 'benvanik@google.com (Ben Vanik)'
-
-
-# Master anvil-build BUILD file for wtf
-
-
-# ------------------------------------------------------------------------------
-# Third Party
-# ------------------------------------------------------------------------------
-
-JS_COMPILER_JAR='third_party:closure_compiler_jar'
-SOY_COMPILER_JAR='third_party:closure_templates_jar'
-GSS_COMPILER_JAR='third_party:closure_stylesheets_jar'
-file_set(
- name='all_externs',
- srcs=glob('externs/**/*.js'))
-
-
-# ------------------------------------------------------------------------------
-# CSS
-# ------------------------------------------------------------------------------
-
-file_set(
- name='all_less',
- srcs=glob('src/**/*.less'))
-
-
-# ------------------------------------------------------------------------------
-# Soy Templates
-# ------------------------------------------------------------------------------
-
-closure_soy_library(
- name='wtf_ui_soy_js',
- srcs=glob('src/wtf/ui/**/*.soy'),
- compiler_jar=SOY_COMPILER_JAR)
-closure_soy_library(
- name='wtf_hud_soy_js',
- srcs=glob('src/wtf/hud/**/*.soy'),
- deps=':wtf_ui_soy_js',
- compiler_jar=SOY_COMPILER_JAR)
-closure_soy_library(
- name='wtf_app_soy_js',
- srcs=glob('src/wtf/app/**/*.soy'),
- deps=':wtf_ui_soy_js',
- compiler_jar=SOY_COMPILER_JAR)
-closure_soy_library(
- name='wtf_replay_soy_js',
- srcs=glob('src/wtf/replay/**/*.soy'),
- deps=':wtf_ui_soy_js',
- compiler_jar=SOY_COMPILER_JAR)
-
-file_set(
- name='all_soy_js',
- srcs=[
- ':wtf_ui_soy_js',
- ':wtf_hud_soy_js',
- ':wtf_app_soy_js',
- ':wtf_replay_soy_js',
- ])
-
-
-# ------------------------------------------------------------------------------
-# JavaScript
-# ------------------------------------------------------------------------------
-
-# wtf src/
-file_set(
- name='wtf_src_js',
- srcs=glob('src/**/*.js'))
-
-# third_party js
-file_set(
- name='third_party_js',
- srcs=[
- 'third_party/d3/colorbrewer.js',
- ])
-
-# Testing support files
-file_set(
- name='testing_files',
- srcs=[
- 'node_modules/mocha/mocha.js',
- 'node_modules/mocha/mocha.css',
- 'node_modules/chai/chai.js',
- ])
-
-SHARED_JS_FLAGS=[
- '--summary_detail_level=3',
- '--define=goog.DEBUG=false',
- '--define=goog.asserts.ENABLE_ASSERTS=false',
- '--create_source_map=%outname%.map',
- '--source_map_format=V3',
- ]
-
-RELEASE_JS_FLAGS=[
- '--use_types_for_optimization',
- #'--collapse_variable_declarations',
- #'--collapse_anonymous_functions',
- #'--collapse_properties',
- #'--disambiguate_properties',
- # rewrites things to be smaller but likely not better
- # http://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/javascript/jscomp/FunctionRewriter.java
- #'--rewrite_function_expressions=false',
- # slow - may want disabled
- #'--devirtualize_prototype_methods',
- #'--devirtualize_prototype_methods=false',
- ]
-
-# deps.js only
-closure_js_library(
- name='wtf_js_deps',
- out='wtf_js',
- mode='DEPS',
- entry_points=[
- 'wtf.app.exports',
- 'wtf.db.exports',
- 'wtf.hud.exports',
- 'wtf.remote.exports',
- 'wtf.replay.graphics.exports',
- 'wtf.replay.timeTravel.exports',
- 'wtf.trace.exports',
- ],
- srcs=[
- 'third_party:all_closure_js',
- ':third_party_js',
- ':wtf_src_js',
- ':all_soy_js',
- ],
- compiler_jar=JS_COMPILER_JAR)
-
-
-# ------------------------------------------------------------------------------
-# JavaScript : trace_web
-# ------------------------------------------------------------------------------
-
-less_css_library(
- name='wtf_trace_web_styles_debug',
- srcs=['src/wtf/hud/hud.less', ':all_less'],
- include_paths=['src',],
- compiler_flags=[])
-less_css_library(
- name='wtf_trace_web_styles_release_unminified',
- srcs=['src/wtf/hud/hud.less', ':all_less'],
- include_paths=['src',],
- compiler_flags=[''])
-closure_gss_library(
- name='wtf_trace_web_styles_release',
- mode='COMPILED',
- srcs=':wtf_trace_web_styles_release_unminified',
- compiler_jar=GSS_COMPILER_JAR,
- compiler_flags=[
- '--css-renaming-prefix', 'wtf_',
- '--no-eliminate-dead-styles',
- '--allow-unrecognized-functions',
- ])
-
-WTF_TRACE_WEB_SRCS=[
- ':third_party_js',
- ':wtf_src_js',
- ':wtf_ui_soy_js',
- ':wtf_hud_soy_js',
- ]
-
-# All uncompiled JS
-file_set(
- name='all_trace_web_uncompiled_js',
- srcs=[
- 'third_party:all_closure_js',
- 'third_party:closure_uncompiled_js',
- ] + WTF_TRACE_WEB_SRCS)
-
-# All compiled JS
-file_set(
- name='all_trace_web_compiled_js',
- srcs=[
- 'third_party:all_closure_js',
- ':wtf_trace_web_styles_release',
- ] + WTF_TRACE_WEB_SRCS)
-
-WTF_TRACE_WEB_ENTRY_POINTS=[
- 'wtf.addon',
- 'wtf.trace.exports',
- 'wtf.hud.exports',
- 'wtf.remote.exports',
- ]
-
-WTF_TRACE_WEB_JS_FLAGS=[
- '--language_in=ECMASCRIPT5_STRICT',
- '--define=wtf.hud.exports.ENABLE_EXPORTS=true',
- '--define=wtf.remote.exports.ENABLE_EXPORTS=true',
- '--define=wtf.trace.exports.ENABLE_EXPORTS=true',
- '--output_wrapper="if(!this.wtf){(function(){%output%}).call(this);}"',
- ]
-# wtf_trace_web_js_compiled_debug js
-closure_js_library(
- name='wtf_trace_web_js_compiled_debug_head',
- deps_out='wtf_trace_web_js',
- mode='ADVANCED',
- pretty_print=True,
- entry_points=WTF_TRACE_WEB_ENTRY_POINTS,
- srcs=':all_trace_web_uncompiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS +
- WTF_TRACE_WEB_JS_FLAGS + [
- '--debug',
- '--create_name_map_files',
- ])
-# wtf_trace_web_js_compiled js
-closure_js_library(
- name='wtf_trace_web_js_compiled_head',
- deps_out='wtf_trace_web_js',
- mode='ADVANCED',
- entry_points=WTF_TRACE_WEB_ENTRY_POINTS,
- srcs=':all_trace_web_compiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS + RELEASE_JS_FLAGS +
- WTF_TRACE_WEB_JS_FLAGS + [
- ])
-
-# TODO(benvanik): test in IE
-STYLES_WRAPPER=''.join([
- "if(this.window && !window.wtf_styles){window.wtf_styles=1;",
- "var style = document.createElement('style');",
- "style.innerHTML = '%output%';",
- "(document.documentElement || document.head).appendChild(style);",
- ";}\n"])
-# wtf_trace_web_js_compiled_debug
-embed_files(
- name='wtf_trace_web_styles_debug_js',
- srcs=[':wtf_trace_web_styles_debug'],
- wrapper=STYLES_WRAPPER,
- replace_chars=[['\n', '\\n'], ['\'', '\\\'']])
-concat_files(
- name='wtf_trace_web_js_compiled_debug',
- out='wtf_trace_web_js_compiled_debug.js',
- srcs=[
- ':wtf_trace_web_js_compiled_debug_head',
- ':wtf_trace_web_styles_debug_js',
- 'assets:hud_icons',
- ],
- src_exclude_filter='*-deps.js')
-# wtf_trace_web_js_compiled
-embed_files(
- name='wtf_trace_web_styles_release_js',
- srcs=[':wtf_trace_web_styles_release'],
- wrapper=STYLES_WRAPPER,
- replace_chars=[['\n', '\\n'], ['\'', '\\\'']],
- src_exclude_filter='*.js')
-concat_files(
- name='wtf_trace_web_js_compiled',
- out='wtf_trace_web_js_compiled.js',
- srcs=[
- ':wtf_trace_web_js_compiled_head',
- ':wtf_trace_web_styles_release_js',
- 'assets:hud_icons',
- ],
- src_exclude_filter='*-deps.js')
-
-file_set(
- name='wtf_trace_web_debug',
- srcs=[
- ':testing_files',
- ':wtf_trace_web_js_compiled_debug',
- ':wtf_trace_web_styles_debug',
- ])
-file_set(
- name='wtf_trace_web_release',
- srcs=[
- ':wtf_trace_web_js_compiled',
- ],
- src_exclude_filter='*-deps.js')
-
-
-# ------------------------------------------------------------------------------
-# JavaScript : trace_min
-# ------------------------------------------------------------------------------
-
-WTF_TRACE_MIN_SRCS=[
- ':third_party_js',
- ':wtf_src_js',
- ]
-
-# All uncompiled JS
-file_set(
- name='all_trace_min_uncompiled_js',
- srcs=[
- 'third_party:all_closure_js',
- 'third_party:closure_uncompiled_js',
- ] + WTF_TRACE_MIN_SRCS)
-
-# All compiled JS
-file_set(
- name='all_trace_min_compiled_js',
- srcs=[
- 'third_party:all_closure_js',
- ] + WTF_TRACE_MIN_SRCS)
-
-WTF_TRACE_MIN_ENTRY_POINTS=[
- 'wtf.trace.exports',
- ]
-
-WTF_TRACE_MIN_JS_FLAGS=[
- '--language_in=ECMASCRIPT5_STRICT',
- '--define=wtf.MIN_BUILD=true',
- '--define=wtf.trace.exports.ENABLE_EXPORTS=true',
- '--output_wrapper="if(!this.wtf){(function(){%output%}).call(this);}"',
- ]
-# wtf_trace_min_js_compiled_debug js
-closure_js_library(
- name='wtf_trace_min_js_compiled_debug',
- deps_out='wtf_trace_min_js',
- mode='ADVANCED',
- pretty_print=True,
- entry_points=WTF_TRACE_MIN_ENTRY_POINTS,
- srcs=':all_trace_min_uncompiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS +
- WTF_TRACE_MIN_JS_FLAGS + [
- '--debug',
- '--create_name_map_files',
- ])
-# wtf_trace_min_js_compiled js
-closure_js_library(
- name='wtf_trace_min_js_compiled',
- deps_out='wtf_trace_min_js',
- mode='ADVANCED',
- entry_points=WTF_TRACE_MIN_ENTRY_POINTS,
- srcs=':all_trace_min_compiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS + RELEASE_JS_FLAGS +
- WTF_TRACE_MIN_JS_FLAGS + [
- ])
-
-file_set(
- name='wtf_trace_min_debug',
- srcs=[
- ':testing_files',
- ':wtf_trace_min_js_compiled_debug',
- ])
-file_set(
- name='wtf_trace_min_release',
- srcs=[
- ':wtf_trace_min_js_compiled',
- ],
- src_exclude_filter='*-deps.js')
-
-
-# ------------------------------------------------------------------------------
-# JavaScript : trace_prod
-# ------------------------------------------------------------------------------
-
-WTF_TRACE_PROD_JS_FLAGS=[
- '--language_in=ECMASCRIPT5_STRICT',
- '--define=wtf.MIN_BUILD=true',
- '--define=wtf.PROD_BUILD=true',
- '--define=wtf.trace.exports.ENABLE_EXPORTS=true',
- '--output_wrapper="if(!this.wtf){(function(){%output%}).call(this);}"',
- ]
-# wtf_trace_prod_js_compiled_debug js
-closure_js_library(
- name='wtf_trace_prod_js_compiled_debug',
- deps_out='wtf_trace_prod_js',
- mode='ADVANCED',
- pretty_print=True,
- entry_points=WTF_TRACE_MIN_ENTRY_POINTS,
- srcs=':all_trace_min_uncompiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS +
- WTF_TRACE_PROD_JS_FLAGS + [
- '--debug',
- '--create_name_map_files',
- ])
-# wtf_trace_prod_js_compiled js
-closure_js_library(
- name='wtf_trace_prod_js_compiled',
- deps_out='wtf_trace_prod_js',
- mode='ADVANCED',
- entry_points=WTF_TRACE_MIN_ENTRY_POINTS,
- srcs=':all_trace_min_compiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS + RELEASE_JS_FLAGS +
- WTF_TRACE_PROD_JS_FLAGS + [
- ])
-
-file_set(
- name='wtf_trace_prod_debug',
- srcs=[
- ':wtf_trace_prod_js_compiled_debug',
- ])
-file_set(
- name='wtf_trace_prod_release',
- srcs=[
- ':wtf_trace_prod_js_compiled',
- ],
- src_exclude_filter='*-deps.js')
-
-
-# ------------------------------------------------------------------------------
-# JavaScript : node
-# ------------------------------------------------------------------------------
-
-closure_js_library(
- name='wtf_node_js_compiled',
- deps_out='wtf_node_js',
- # TODO(benvanik): fix exports so ADVANCED can be used
- mode='SIMPLE',
- pretty_print=True,
- entry_points=[
- 'wtf.db.exports',
- 'wtf.db.node',
- 'wtf.replay.graphics.Step',
- 'wtf.trace.exports',
- 'wtf.trace.node',
- ],
- srcs=[
- 'third_party:all_closure_js',
- ':third_party_js',
- ':wtf_src_js',
- ],
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS + RELEASE_JS_FLAGS + [
- '--language_in=ECMASCRIPT5_STRICT',
- '--define=goog.DEBUG=false',
- '--define=goog.asserts.ENABLE_ASSERTS=false',
- '--define=wtf.NODE=true',
- '--define=wtf.db.exports.ENABLE_EXPORTS=true',
- '--define=wtf.trace.exports.ENABLE_EXPORTS=true',
- '--output_wrapper="module.exports = (function(exports){%output%;return this.wtf;}).call(global); delete global.wtf;"',
- ])
-
-file_set(
- name='wtf_node_release',
- srcs=[
- ':wtf_node_js_compiled',
- ],
- src_exclude_filter='*-deps.js')
-
-
-# ------------------------------------------------------------------------------
-# JavaScript : app
-# ------------------------------------------------------------------------------
-# TODO(benvanik): move to app/BUILD?
-
-WTF_UI_SRCS=[
- ':third_party_js',
- ':wtf_src_js',
- ':wtf_ui_soy_js',
- ':wtf_app_soy_js',
- ':wtf_replay_soy_js',
- ]
-
-# All uncompiled JS
-file_set(
- name='all_ui_uncompiled_js',
- srcs=[
- 'third_party:all_closure_js',
- 'third_party:closure_uncompiled_js',
- 'app:debug_js_srcs',
- ] + WTF_UI_SRCS)
-
-# All compiled JS
-file_set(
- name='all_ui_compiled_js',
- srcs=[
- 'third_party:all_closure_js',
- 'app:release_js_srcs',
- ] + WTF_UI_SRCS)
-
-WTF_UI_ENTRY_POINTS=[
- 'wtf.app.exports',
- 'wtf.db.exports',
- 'wtf.replay.graphics.exports',
- 'wtf.replay.timeTravel.exports',
- ]
-
-WTF_UI_JS_FLAGS=[
- # Safari has issues with 'use strict'.
- '--language_in=ECMASCRIPT5',
- ]
-
-# wtf_ui_js_uncompiled
-closure_js_library(
- name='wtf_ui_js_uncompiled',
- deps_out='wtf_ui_js',
- mode='UNCOMPILED',
- entry_points=WTF_UI_ENTRY_POINTS,
- srcs=':all_ui_uncompiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS + WTF_UI_JS_FLAGS + [
- ],
- wrap_with_global='this',
- file_list_out='wtf_ui_js.list')
-
-# wtf_ui_js_compiled
-closure_js_library(
- name='wtf_ui_js_compiled',
- deps_out='wtf_ui_js',
- mode='ADVANCED',
- #pretty_print=True,
- entry_points=WTF_UI_ENTRY_POINTS,
- srcs=':all_ui_compiled_js',
- externs=[':all_externs'],
- compiler_jar=JS_COMPILER_JAR,
- compiler_flags=SHARED_JS_FLAGS + RELEASE_JS_FLAGS + WTF_UI_JS_FLAGS + [
- #'--debug',
- '--define=wtf.app.exports.ENABLE_EXPORTS=true',
- '--define=wtf.db.exports.ENABLE_EXPORTS=true',
- '--define=wtf.replay.graphics.exports.ENABLE_EXPORTS=true',
- '--define=wtf.replay.timeTravel.exports.ENABLE_EXPORTS=true',
- ],
- wrap_with_global='window')
-
-less_css_library(
- name='wtf_ui_styles_debug',
- srcs=['src/wtf/app/app.less', ':all_less'],
- include_paths=['src',],
- compiler_flags=[])
-less_css_library(
- name='wtf_ui_styles_release',
- srcs=['src/wtf/app/app.less', ':all_less'],
- include_paths=['src',],
- compiler_flags=['--compress'])
-
-
-# ------------------------------------------------------------------------------
-# JS linting
-# ------------------------------------------------------------------------------
-
-CLOSURE_LINTER_PATH='third_party/closure-linter/'
-
-file_set(
- name='lint_src',
- srcs=[':wtf_src_js'],
- src_exclude_filter='filterparser.js|eventbuffers_test.js|benchmark.js')
-
-closure_js_fixstyle(
- name='all_js_fixstyle',
- namespaces=['goog', 'wtf',],
- srcs=[':lint_src'],
- linter_path=CLOSURE_LINTER_PATH)
-
-closure_js_lint(
- name='all_js_lint',
- namespaces=['goog', 'wtf',],
- srcs=[':lint_src'],
- linter_path=CLOSURE_LINTER_PATH)
-
-
-# ------------------------------------------------------------------------------
-# Testing
-# ------------------------------------------------------------------------------
-
-TEST_REQUIRES=[
- ('node module', 'mocha@1.4.2'),
- ('node module', 'chai@1.2.0'),
- ]
-
-file_set(
- name='test_external',
- deps=[':fast'],
- requires=TEST_REQUIRES)
-
-shell_execute(
- name='wtf_js_test',
- srcs=glob('src/**/*_test.js'),
- deps=[':fast'],
- command=[
- 'node_modules/mocha/bin/mocha',
- '--ui', 'tdd',
- '--reporter', 'dot',
- '--require', 'src/wtf/bootstrap/mocha.js',
- ],
- requires=TEST_REQUIRES)
-
-
-# ------------------------------------------------------------------------------
-# Target rules
-# ------------------------------------------------------------------------------
-
-file_set(
- name='setup',
- requires=[
- ('node', '>=0.6.14'),
- ] + TEST_REQUIRES)
-
-file_set(
- name='lint',
- deps=':all_js_lint')
-
-file_set(
- name='fixstyle',
- deps=':all_js_fixstyle')
-
-file_set(
- name='fast',
- deps=[
- ':testing_files',
- ':wtf_js_deps',
- ':wtf_trace_web_styles_debug',
- 'app:fast',
- ])
-
-file_set(
- name='deps',
- srcs=[
- ':wtf_js_deps',
- ])
-
-file_set(
- name='test',
- deps=[':wtf_js_test'])
-
-file_set(
- name='debug',
- srcs=[
- ':testing_files',
- ':deps',
- ':wtf_trace_web_debug',
- 'app:debug',
- ])
-
-archive_files(
- name='wtf-trace-web-api',
- srcs=[
- ':wtf_trace_web_release',
- ] + glob('shims/*.*'))
-
-archive_files(
- name='wtf-app',
- srcs=[
- 'app:release',
- ])
-
-file_set(
- name='injector',
- srcs=[
- 'extensions/wtf-injector-chrome:wtf-injector-chrome',
- 'extensions/wtf-injector-firefox:wtf-injector-firefox',
- ])
-
-file_set(
- name='release',
- srcs=[
- ':deps',
- ':wtf_trace_web_release',
- ':wtf_trace_min_release',
- ':wtf_node_release',
- 'app:release',
- ':wtf-trace-web-api',
- ':wtf-app',
- ':injector',
- ],
- src_exclude_filter='*-deps.js',
- deps=[
- #':all_js_lint',
- ])
-
-file_set(
- name='gh-pages',
- srcs=[
- ':wtf_trace_web_release',
- 'app:app_files'
- ])
diff --git a/LICENSE b/LICENSE
index 989d02e4..3bd62820 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright 2012, Google Inc.
+Copyright 2017, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index bf0388e9..d9df771a 100644
--- a/README.md
+++ b/README.md
@@ -26,27 +26,33 @@ See [building](https://github.com/google/tracing-framework/blob/master/docs/buil
## Quickstart
-Just want the extension as fast as possible?
+For more information and other build options, see [building](https://github.com/google/tracing-framework/blob/master/docs/building.md).
+
+### Setup
```bash
-umask 0022
-git clone https://github.com/google/tracing-framework.git
-cd tracing-framework/
-./scripts/setup.sh # or setup.bat on Windows
-source wtfrc && deployext
-# At chrome://extensions load unpacked extension from
-# build-bin/wtf-injector-chrome
+$ git clone --recursive https://github.com/google/tracing-framework.git && cd tracing-framework/
+$ bazel run @yarn//:yarn
```
-If you pull new changes, just redeploy:
+### Chrome Extension
+
+This builds and copies the unpacked extension to
+`bazel-bin/extensions/wtf-injector-chrome/wtf-injector-chrome_pkg`, which can
+then be loaded from chrome://extensions.
```bash
-git pull && git submodule update
-deployext
-# Reload from chrome://extensions
+$ bazel build -c opt //extensions/wtf-injector-chrome
```
-For more information and other build options, see [building](https://github.com/google/tracing-framework/blob/master/docs/building.md).
+### Embedded Tracing Library
+
+This produces `bazel-bin/bindings/js/wtf_trace_web_js_compiled.js`, which can be
+copied and included via script tags on any page.
+
+```bash
+$ bazel build -c opt //bindings/js:wtf_trace_web_js
+```
## License
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 00000000..ca5f08cb
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,27 @@
+workspace(name = "tracing_framework")
+
+http_archive(
+ name = "io_bazel_rules_closure",
+ strip_prefix = "rules_closure-0.4.2",
+ sha256 = "25f5399f18d8bf9ce435f85c6bbf671ec4820bc4396b3022cc5dc4bc66303609",
+ urls = [
+ "http://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.4.2.tar.gz",
+ "https://github.com/bazelbuild/rules_closure/archive/0.4.2.tar.gz",
+ ],
+)
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
+
+closure_repositories()
+
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+
+git_repository(
+ name = "build_bazel_rules_nodejs",
+ remote = "https://github.com/bazelbuild/rules_nodejs.git",
+ tag = "0.1.6",
+)
+
+load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
+
+node_repositories(package_json = ["//:package.json"])
diff --git a/anvil.bat b/anvil.bat
deleted file mode 100644
index 1912edfc..00000000
--- a/anvil.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-@ECHO OFF
-
-third_party\anvil-build\anvil-local.bat %*
diff --git a/app/BUILD b/app/BUILD
new file mode 100644
index 00000000..8b4d204d
--- /dev/null
+++ b/app/BUILD
@@ -0,0 +1,82 @@
+# Description:
+# WTF Javascript app UI.
+
+package(default_visibility = ["//:internal"])
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_binary")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+load("//builddefs:config.bzl", "SHARED_CSS_FLAGS")
+load("//builddefs:config.bzl", "SHARED_JS_FLAGS")
+load("//builddefs:packaging_rules.bzl", "pkg_zip")
+
+filegroup(
+ name = "icons",
+ srcs = glob(["icons/**"]),
+)
+
+closure_js_binary(
+ name = "wtf_ui_js_compiled",
+ defs = SHARED_JS_FLAGS + [
+ "--define=wtf.app.exports.ENABLE_EXPORTS=true",
+ "--define=wtf.db.exports.ENABLE_EXPORTS=true",
+ "--define=wtf.replay.graphics.exports.ENABLE_EXPORTS=true",
+ "--define=wtf.replay.timeTravel.exports.ENABLE_EXPORTS=true",
+ ],
+ dependency_mode = "STRICT",
+ entry_points = [
+ "wtf.app.exports",
+ "wtf.db.exports",
+ "wtf.replay.graphics.exports",
+ "wtf.replay.timeTravel.exports",
+ ],
+ language = "ECMASCRIPT5_STRICT",
+ output_wrapper = "(function(){%output%}).call(window)",
+ deps = [
+ "//src/wtf/addon",
+ "//src/wtf/app",
+ "//src/wtf/db",
+ "@io_bazel_rules_closure//closure/library",
+ ],
+)
+
+closure_css_binary(
+ name = "wtf_ui_styles",
+ defs = SHARED_CSS_FLAGS,
+ renaming = False,
+ deps = ["//src/wtf/app:app_styles"],
+)
+
+filegroup(
+ name = "app",
+ srcs = select({
+ "//:dbg": [
+ # TODO(benvanik): exploded mode.
+ "maindisplay-debug.html",
+ "scripts/debug-prefix.js",
+ "scripts/debug-postfix-maindisplay.js",
+ "//third_party/d3:min",
+ ":wtf_ui_styles",
+ ],
+ "//:fastbuild": [
+ ":wtf_ui_js_compiled",
+ "maindisplay-debug.html",
+ ":wtf_ui_styles",
+ ":icons",
+ "//third_party/d3:min",
+ ],
+ "//:opt": [
+ ":wtf_ui_js_compiled",
+ ":icons",
+ "maindisplay.html",
+ "scripts/release-maindisplay.js",
+ "//third_party/d3:min",
+ ":wtf_ui_styles",
+ ],
+ }),
+)
+
+pkg_zip(
+ name = "wtf-app",
+ srcs = [":app",],
+)
diff --git a/app/BUILD.anvil b/app/BUILD.anvil
deleted file mode 100644
index 3914440b..00000000
--- a/app/BUILD.anvil
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright 2012 Google Inc. All Rights Reserved.
-
-__author__ = 'benvanik@google.com (Ben Vanik)'
-
-
-# Chrome app release output
-
-
-# ------------------------------------------------------------------------------
-# JavaScript
-# ------------------------------------------------------------------------------
-
-file_set(
- name='shared_js_srcs',
- srcs=[
- # soy
- ])
-
-file_set(
- name='debug_js_srcs',
- srcs=[
- ':shared_js_srcs',
- ])
-file_set(
- name='release_js_srcs',
- srcs=[
- ':shared_js_srcs',
- ])
-
-file_set(
- name='third_party_js',
- srcs=[
- '../third_party/d3:min',
- ])
-
-
-# ------------------------------------------------------------------------------
-# Modes
-# ------------------------------------------------------------------------------
-
-file_set(
- name='exploded',
- srcs=[
- '../third_party:all_closure_js',
- '..:wtf_src_js',
- '..:all_soy_js',
- '..:deps',
- '..:wtf_ui_styles_debug',
- 'maindisplay-debug.html',
- 'scripts/debug-prefix.js',
- 'scripts/debug-postfix-maindisplay.js',
- ':third_party_js',
- ])
-
-file_set(
- name='debug',
- srcs=[
- '..:wtf_ui_js_uncompiled',
- '..:wtf_ui_styles_debug',
- 'maindisplay-debug.html',
- ':third_party_js',
- ])
-
-file_set(
- name='release',
- srcs=[
- '..:wtf_ui_js_compiled',
- '..:wtf_ui_styles_release',
- 'maindisplay.html',
- 'scripts/release-maindisplay.js',
- ':third_party_js',
- ] + glob('icons/**/*'),
- src_exclude_filter='*-deps.js')
-
-file_set(
- name='fast',
- srcs=[
- '..:wtf_ui_styles_debug',
- ])
-
-file_set(
- name='app_files',
- srcs=[
- 'maindisplay.html',
- 'scripts/release-maindisplay.js',
-
- ':third_party_js',
-
- # This is bad - should prefix this.
- '..:wtf_ui_styles_release',
- '..:wtf_ui_js_compiled',
- ] + glob('icons/**/*'),
- src_exclude_filter='*-deps.js')
diff --git a/app/graphicsreplay.html b/app/graphicsreplay.html
index fdeb5763..059d6889 100644
--- a/app/graphicsreplay.html
+++ b/app/graphicsreplay.html
@@ -3,8 +3,8 @@
WTF Graphics Replay
-
-
+
+
diff --git a/app/maindisplay-debug.html b/app/maindisplay-debug.html
index db5dc076..585a06b8 100644
--- a/app/maindisplay-debug.html
+++ b/app/maindisplay-debug.html
@@ -5,7 +5,7 @@
-
+
diff --git a/app/maindisplay.html b/app/maindisplay.html
index b9a0772d..2060aa06 100644
--- a/app/maindisplay.html
+++ b/app/maindisplay.html
@@ -3,8 +3,8 @@
Web Tracing Framework
-
-
+
+
diff --git a/assets/BUILD b/assets/BUILD
new file mode 100644
index 00000000..c68e2c9e
--- /dev/null
+++ b/assets/BUILD
@@ -0,0 +1,21 @@
+# Description:
+# Assets such as icons and images.
+
+package(default_visibility = ["//:internal"])
+
+load("//builddefs:file_rules.bzl", "concat_files", "embed_files")
+
+ICON_WRAPPER = "".join([
+ "wtf.ui.icons.setIconData(",
+ "'/%path%', ",
+ "'data:image/png;base64,%output%'",
+ ");\n",
+])
+
+embed_files(
+ name = "hud_icons",
+ srcs = glob(["icons/**/*.png"]),
+ out = "hud_icons.js",
+ encoding = "base64",
+ wrapper = ICON_WRAPPER,
+)
diff --git a/assets/BUILD.anvil b/assets/BUILD.anvil
deleted file mode 100644
index 36f3e6d4..00000000
--- a/assets/BUILD.anvil
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2012 Google Inc. All Rights Reserved.
-
-__author__ = 'benvanik@google.com (Ben Vanik)'
-
-
-# Assets rules.
-# These are used to build javascript code with embedded data assets.
-
-
-ICON_WRAPPER=''.join([
- "wtf.ui.icons.setIconData(",
- "'/assets/%path%', ",
- "'data:image/png;base64,%output%'",
- ");\n"
- ])
-
-
-# ------------------------------------------------------------------------------
-# HUD
-# ------------------------------------------------------------------------------
-
-embed_files(
- name='hud_icons',
- srcs=[
- ] + glob('icons/*.png'),
- wrapper=ICON_WRAPPER,
- encoding='base64',
- replace_chars=[['\n', '\\n'], ['\'', '\\\'']])
diff --git a/assets/store/tile-small.png b/assets/store/tile-small.png
index 4171bbb0..939c6a55 100644
Binary files a/assets/store/tile-small.png and b/assets/store/tile-small.png differ
diff --git a/bindings/js/BUILD b/bindings/js/BUILD
new file mode 100644
index 00000000..02c747a2
--- /dev/null
+++ b/bindings/js/BUILD
@@ -0,0 +1,206 @@
+# Description:
+# WTF Javascript bindings.
+
+package(default_visibility = ["//:internal"])
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_binary")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_deps")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+load("//builddefs:config.bzl", "SHARED_CSS_FLAGS")
+load("//builddefs:config.bzl", "SHARED_JS_FLAGS")
+load("//builddefs:file_rules.bzl", "concat_files", "embed_files")
+load("//builddefs:packaging_rules.bzl", "pkg_zip")
+
+# ------------------------------------------------------------------------------
+# JavaScript
+# ------------------------------------------------------------------------------
+
+# third_party js
+filegroup(
+ name = "third_party_js",
+ srcs = [
+ "//third_party/d3:colorbrewer",
+ ],
+)
+
+# ------------------------------------------------------------------------------
+# JavaScript : node
+# ------------------------------------------------------------------------------
+
+closure_js_binary(
+ name = "wtf_node_js_compiled",
+ compilation_level = "ADVANCED",
+ defs = SHARED_JS_FLAGS + [
+ "--define=goog.DEBUG=false",
+ "--define=goog.asserts.ENABLE_ASSERTS=false",
+ "--define=wtf.NODE=true",
+ "--define=wtf.db.exports.ENABLE_EXPORTS=true",
+ "--define=wtf.trace.exports.ENABLE_EXPORTS=true",
+ ],
+ dependency_mode = "STRICT",
+ entry_points = [
+ "wtf.db.exports",
+ "wtf.db.node",
+ "wtf.trace.exports",
+ "wtf.trace.node",
+ ],
+ language = "ECMASCRIPT5_STRICT",
+ output_wrapper = "module.exports = (function(exports){%output%;return this.wtf;}).call(global); delete global.wtf;",
+ deps = [
+ "//src/wtf/db:node",
+ "//src/wtf/trace:node",
+ "@io_bazel_rules_closure//closure/library",
+ ],
+)
+
+# ------------------------------------------------------------------------------
+# JavaScript : web (minimal)
+# ------------------------------------------------------------------------------
+
+closure_js_binary(
+ name = "wtf_trace_min_js_compiled",
+ compilation_level = "ADVANCED",
+ defs = SHARED_JS_FLAGS + [
+ "--define=wtf.MIN_BUILD=true",
+ "--define=wtf.trace.exports.ENABLE_EXPORTS=true",
+ ],
+ dependency_mode = "STRICT",
+ entry_points = [
+ "wtf.trace.exports",
+ ],
+ language = "ECMASCRIPT5_STRICT",
+ output_wrapper = "if(!this.wtf){(function(){%output%}).call(this);}",
+ deps = [
+ "//src/wtf/trace",
+ "@io_bazel_rules_closure//closure/library",
+ ],
+)
+
+# ------------------------------------------------------------------------------
+# JavaScript : web (minimal with prod flag)
+# ------------------------------------------------------------------------------
+
+closure_js_binary(
+ name = "wtf_trace_prod_js_compiled",
+ compilation_level = "ADVANCED",
+ defs = SHARED_JS_FLAGS + [
+ "--define=wtf.MIN_BUILD=true",
+ "--define=wtf.PROD_BUILD=true",
+ "--define=wtf.trace.exports.ENABLE_EXPORTS=true",
+ ],
+ dependency_mode = "STRICT",
+ entry_points = [
+ "wtf.trace.exports",
+ ],
+ language = "ECMASCRIPT5_STRICT",
+ output_wrapper = "if(!this.wtf){(function(){%output%}).call(this);}",
+ deps = [
+ "//src/wtf/trace",
+ "@io_bazel_rules_closure//closure/library",
+ ],
+)
+
+# ------------------------------------------------------------------------------
+# JavaScript : web (with HUD)
+# ------------------------------------------------------------------------------
+
+WTF_TRACE_WEB_JS_DEPS = [
+ "//src/wtf/addon",
+ "//src/wtf/hud",
+ "//src/wtf/remote",
+ "//src/wtf/trace",
+ "@io_bazel_rules_closure//closure/library",
+]
+
+closure_js_deps(
+ name = "wtf_trace_web_js_uncompiled",
+ deps = WTF_TRACE_WEB_JS_DEPS,
+)
+
+closure_js_binary(
+ name = "wtf_trace_web_js_compiled_head",
+ css = ":wtf_trace_web_css_compiled",
+ defs = SHARED_JS_FLAGS + [
+ "--define=wtf.hud.exports.ENABLE_EXPORTS=true",
+ "--define=wtf.remote.exports.ENABLE_EXPORTS=true",
+ "--define=wtf.trace.exports.ENABLE_EXPORTS=true",
+ ],
+ dependency_mode = "STRICT",
+ entry_points = [
+ "wtf.addon",
+ "wtf.hud.exports",
+ "wtf.remote.exports",
+ "wtf.trace.exports",
+ ],
+ language = "ECMASCRIPT5_STRICT",
+ output_wrapper = "if(!this.wtf){(function(){%output%}).call(this);}",
+ deps = WTF_TRACE_WEB_JS_DEPS,
+)
+
+closure_css_binary(
+ name = "wtf_trace_web_css_compiled",
+ defs = SHARED_CSS_FLAGS,
+ renaming = False,
+ deps = ["//src/wtf/hud:hud_styles"],
+)
+
+STYLES_WRAPPER = "".join([
+ "if(this.window && !window.wtf_styles){window.wtf_styles=1;\n",
+ "var style = document.createElement('style');\n",
+ "style.innerHTML = '%output%';\n",
+ "(document.documentElement || document.head).appendChild(style);\n",
+ "}\n",
+])
+
+embed_files(
+ name = "wtf_trace_web_css_compiled_js",
+ srcs = [":wtf_trace_web_css_compiled.css"],
+ out = "wtf_trace_web_css_compiled.js",
+ wrapper = STYLES_WRAPPER,
+)
+
+concat_files(
+ name = "wtf_trace_web_js_compiled",
+ parts = [
+ # Order matters; JS must go first.
+ ":wtf_trace_web_js_compiled_head.js",
+ ":wtf_trace_web_css_compiled_js",
+ "//assets:hud_icons",
+ ],
+ out = "wtf_trace_web_js_compiled.js",
+)
+
+pkg_zip(
+ name = "wtf-trace-web-api",
+ srcs = [
+ ":wtf_trace_web_js_compiled",
+ "wtf-trace-closure.js",
+ "wtf-trace-disabled.js",
+ "wtf-trace.js",
+ ],
+ path_mapping = {
+ "bindings/js/wtf-trace-closure.js": "shims/wtf-trace-closure.js",
+ "bindings/js/wtf-trace-disabled.js": "shims/wtf-trace-disabled.js",
+ "bindings/js/wtf-trace.js": "shims/wtf-trace.js",
+ "bindings/js/wtf_trace_web_js_compiled.js": "wtf_trace_web_js_compiled.js",
+ },
+)
+
+filegroup(
+ name = "js",
+ srcs = select({
+ "//:dbg": [
+ # TODO(benvanik): exploded.
+ ":wtf_trace_web_css_compiled",
+ ":wtf_trace_web_js_uncompiled",
+ ],
+ "//:fastbuild": [
+ ":wtf_trace_web_js_compiled",
+ ],
+ "//:opt": [
+ ":wtf_trace_web_js_compiled",
+ ],
+ }),
+ visibility = ["//visibility:public"],
+)
diff --git a/shims/wtf-trace-closure.js b/bindings/js/wtf-trace-closure.js
similarity index 100%
rename from shims/wtf-trace-closure.js
rename to bindings/js/wtf-trace-closure.js
diff --git a/shims/wtf-trace-disabled.js b/bindings/js/wtf-trace-disabled.js
similarity index 100%
rename from shims/wtf-trace-disabled.js
rename to bindings/js/wtf-trace-disabled.js
diff --git a/shims/wtf-trace.js b/bindings/js/wtf-trace.js
similarity index 100%
rename from shims/wtf-trace.js
rename to bindings/js/wtf-trace.js
diff --git a/builddefs/BUILD b/builddefs/BUILD
new file mode 100644
index 00000000..b1133829
--- /dev/null
+++ b/builddefs/BUILD
@@ -0,0 +1,30 @@
+# Description:
+# Bazel macros, rules, and defines.
+
+package(default_visibility = ["//:internal"])
+
+load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
+
+# Used by the file_rules.bzl:concat_files rule.
+sh_binary(
+ name = "concat_files",
+ srcs = ["concat_files.sh"],
+)
+
+# Used by the file_rules.bzl:embed_files rule.
+py_binary(
+ name = "embed_files",
+ srcs = ["embed_files.py"],
+)
+
+# Used by the file_rules.bzl:strip_comments rule.
+py_binary(
+ name = "strip_comments",
+ srcs = ["strip_comments.py"],
+)
+
+# Used by the less_rules.bzl:less_css_library rule.
+nodejs_binary(
+ name = "lessc",
+ entry_point = "less/bin/lessc",
+)
diff --git a/builddefs/concat_files.sh b/builddefs/concat_files.sh
new file mode 100755
index 00000000..72da64a3
--- /dev/null
+++ b/builddefs/concat_files.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+out=$1
+shift
+cat $* > $out
diff --git a/builddefs/config.bzl b/builddefs/config.bzl
new file mode 100644
index 00000000..8192dcac
--- /dev/null
+++ b/builddefs/config.bzl
@@ -0,0 +1,62 @@
+# Description:
+# Common configuration options.
+
+COMMON_JS_SUPPRESSIONS = [
+ # TODO(benvanik): somehow make all our code typed correctly ;)
+ "JSC_UNKNOWN_EXPR_TYPE",
+
+ # TODO(benvanik): go replace naked Object with !Object or ?Object.
+ "JSC_IMPLICITLY_NULLABLE_JSDOC",
+
+ # goog.result deprecated in favor of goog.Promise.
+ "JSC_DEPRECATED_CLASS_REASON",
+ "JSC_DEPRECATED_PROP_REASON",
+]
+
+SHARED_CSS_FLAGS = [
+ "--allow-unrecognized-functions",
+] + select({
+ "//:dbg": [
+ "--preserve-comments",
+ "--pretty-print",
+ ],
+ "//:fastbuild": [
+ "--preserve-comments",
+ "--pretty-print",
+ ],
+ "//:opt": [
+ #"--css-renaming-prefix=wtf_",
+ ],
+})
+
+SHARED_JS_FLAGS = [
+ "--summary_detail_level=3",
+ "--create_source_map=%outname%.map",
+ "--source_map_format=V3",
+ "--define=goog.soy.REQUIRE_STRICT_AUTOESCAPE=false",
+] + select({
+ "//:dbg": [
+ "--compilation_level=WHITESPACE_ONLY",
+ "--define=goog.DEBUG=true",
+ "--define=goog.asserts.ENABLE_ASSERTS=true",
+ ],
+ "//:fastbuild": [
+ "--compilation_level=SIMPLE",
+ "--define=goog.DEBUG=true",
+ "--define=goog.asserts.ENABLE_ASSERTS=true",
+ ],
+ "//:opt": [
+ "--compilation_level=ADVANCED",
+ "--use_types_for_optimization",
+ #"--collapse_variable_declarations",
+ #"--collapse_anonymous_functions",
+ #"--collapse_properties",
+ #"--disambiguate_properties",
+ # rewrites things to be smaller but likely not better
+ # http://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/javascript/jscomp/FunctionRewriter.java
+ #"--rewrite_function_expressions=false",
+ # slow - may want disabled
+ #"--devirtualize_prototype_methods",
+ #"--devirtualize_prototype_methods=false",
+ ],
+})
diff --git a/builddefs/embed_files.py b/builddefs/embed_files.py
new file mode 100644
index 00000000..69afdddb
--- /dev/null
+++ b/builddefs/embed_files.py
@@ -0,0 +1,36 @@
+import base64
+import os
+import sys
+
+def main(argv):
+ encoding = argv[1]
+ template_path = argv[2]
+ out_path = argv[3]
+ src_path = argv[4]
+
+ with open(src_path, "r") as file:
+ src_str = file.read()
+
+ if encoding == 'base64':
+ src_str = base64.b64encode(src_str)
+ else:
+ src_str = src_str.replace('\n', '\\n')
+ src_str = src_str.replace('\'', '\\\'')
+
+ sanitized_src_path = src_path
+ sanitized_src_str = src_str
+
+ with open(template_path, "r") as file:
+ template_str = file.read()
+
+ out_str = template_str
+ out_str = out_str.replace('%output%', sanitized_src_str)
+ out_str = out_str.replace('%path%', sanitized_src_path)
+
+ with open(out_path, "w") as file:
+ file.write(out_str)
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/builddefs/file_rules.bzl b/builddefs/file_rules.bzl
new file mode 100644
index 00000000..85fd0cc9
--- /dev/null
+++ b/builddefs/file_rules.bzl
@@ -0,0 +1,118 @@
+# Description:
+# Rules for file manipulation.
+
+
+def _concat_files_impl(ctx):
+ ctx.actions.run(
+ inputs = ctx.files.parts,
+ outputs = [ctx.outputs.out],
+ arguments = [
+ ctx.outputs.out.path,
+ ] + [f.path for f in ctx.files.parts],
+ progress_message = "Concating into %s" % (ctx.outputs.out.short_path),
+ executable = ctx.executable._concat_tool,
+ )
+
+concat_files = rule(
+ implementation = _concat_files_impl,
+ attrs = {
+ "parts": attr.label_list(allow_files = True),
+ "out": attr.output(mandatory = True),
+ "_concat_tool": attr.label(
+ executable = True,
+ cfg = "host",
+ allow_files = True,
+ default = Label("//builddefs:concat_files"),
+ ),
+ },
+)
+
+
+def _embed_files_impl(ctx):
+ # Write template string to a file as that's what expand_template wants.
+ template_file = ctx.actions.declare_file(ctx.label.name + "_template")
+ ctx.actions.write(
+ output = template_file,
+ content = ctx.attr.wrapper,
+ )
+
+ # Convert and template each file.
+ templated_src_files = []
+ for src_file in ctx.files.srcs:
+ # Prepare temporary output file.
+ templated_src_file = ctx.actions.declare_file(src_file.short_path + ".templated")
+ templated_src_files.append(templated_src_file)
+
+ # Issue conversion command.
+ ctx.actions.run(
+ inputs = [template_file, src_file],
+ outputs = [templated_src_file],
+ arguments = [
+ ctx.attr.encoding,
+ template_file.path,
+ templated_src_file.path,
+ src_file.path,
+ ],
+ progress_message = "Embedding %s" % (src_file.short_path),
+ executable = ctx.executable._embed_tool,
+ )
+
+ # Concat all files together.
+ ctx.actions.run(
+ inputs = templated_src_files,
+ outputs = [ctx.outputs.out],
+ arguments = [
+ ctx.outputs.out.path,
+ ] + [f.path for f in templated_src_files],
+ progress_message = "Concating into %s" % (ctx.outputs.out.short_path),
+ executable = ctx.executable._concat_tool,
+ )
+
+embed_files = rule(
+ implementation = _embed_files_impl,
+ attrs = {
+ "srcs": attr.label_list(allow_files = True),
+ "wrapper": attr.string(default = "%output%"),
+ "encoding": attr.string(default = "utf8"),
+ "out": attr.output(mandatory = True),
+ "_embed_tool": attr.label(
+ executable = True,
+ cfg = "host",
+ allow_files = True,
+ default = Label("//builddefs:embed_files"),
+ ),
+ "_concat_tool": attr.label(
+ executable = True,
+ cfg = "host",
+ allow_files = True,
+ default = Label("//builddefs:concat_files"),
+ ),
+ },
+)
+
+
+def _strip_comments_impl(ctx):
+ ctx.actions.run(
+ inputs = ctx.files.srcs,
+ outputs = [ctx.outputs.out],
+ arguments = [
+ ctx.files.srcs[0].path,
+ ctx.outputs.out.path,
+ ],
+ progress_message = "Stripping comments from %s" % (ctx.outputs.out.short_path),
+ executable = ctx.executable._strip_comments_tool,
+ )
+
+strip_comments = rule(
+ implementation = _strip_comments_impl,
+ attrs = {
+ "srcs": attr.label_list(allow_files = True),
+ "out": attr.output(mandatory = True),
+ "_strip_comments_tool": attr.label(
+ executable = True,
+ cfg = "host",
+ allow_files = True,
+ default = Label("//builddefs:strip_comments"),
+ ),
+ },
+)
diff --git a/builddefs/less_rules.bzl b/builddefs/less_rules.bzl
new file mode 100644
index 00000000..051e7eee
--- /dev/null
+++ b/builddefs/less_rules.bzl
@@ -0,0 +1,93 @@
+# Description:
+# Rules for building LESS CSS libraries.
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_library")
+
+
+def _unfurl(deps, provider=""):
+ """Returns deps as well as deps exported by parent rules."""
+ res = []
+ for dep in deps:
+ if not provider or hasattr(dep, provider):
+ res.append(dep)
+ if hasattr(dep, "exports"):
+ for edep in dep.exports:
+ if not provider or hasattr(edep, provider):
+ res.append(edep)
+ return res
+
+
+def _collect_less_deps(deps):
+ """Aggregates transitive LESS source files from unfurled deps."""
+ srcs = []
+ for dep in deps:
+ srcs += getattr(dep.less_css_library, "srcs", [])
+ srcs += getattr(dep.less_css_library, "main_srcs", [])
+ srcs += getattr(dep.less_css_library, "transitive_srcs", [])
+ return srcs
+
+
+def _less_css_library(ctx):
+ deps = _unfurl(ctx.attr.deps, provider="less_css_library")
+ less_deps = _collect_less_deps(deps)
+ less_deps.extend(ctx.files.srcs)
+
+ common_less_args = []
+ include_paths = ["."]
+ if ctx.attr.includes:
+ include_paths.extend(ctx.attr.includes)
+ common_less_args.append("--include-path=" + ":".join(include_paths))
+ if ctx.attr.defs:
+ common_less_args.extend(ctx.attr.defs)
+
+ # Translate each .less into a .css individually.
+ css_files = []
+ for src in ctx.files.main_srcs:
+ css_file = ctx.actions.declare_file(src.short_path[:-5] + ".css")
+ css_files.append(css_file)
+ ctx.actions.run(
+ outputs = [css_file],
+ inputs = [src] + less_deps,
+ executable = ctx.executable._compiler,
+ arguments = common_less_args + [
+ src.path,
+ css_file.path,
+ ],
+ mnemonic = "LessCompile",
+ progress_message = "Translating LESS to CSS: %s" % (src.short_path),
+ )
+
+ return struct(
+ files = depset(css_files),
+ less_css_library = struct(
+ srcs = ctx.files.srcs,
+ main_srcs = ctx.files.main_srcs,
+ transitive_srcs = less_deps,
+ ),
+ closure_css_library = struct(
+ srcs = css_files,
+ deps = deps,
+ data = ctx.attr.srcs,
+ orientation = ctx.attr.orientation,
+ ),
+ )
+
+less_css_library = rule(
+ implementation = _less_css_library,
+ attrs = {
+ "main_srcs": attr.label_list(allow_files=FileType([".css", ".less"])),
+ "srcs": attr.label_list(allow_files=FileType([".css", ".less"])),
+ "deps": attr.label_list(providers=["less_css_library"]),
+ "includes": attr.string_list(),
+ "defs": attr.string_list(),
+ "orientation": attr.string(default="LTR"),
+ "_compiler": attr.label(
+ default = Label("//builddefs:lessc"),
+ allow_files = True,
+ cfg = "host",
+ executable = True,
+ ),
+ },
+ #outputs = {"out": "%{name}.css"},
+)
+
diff --git a/builddefs/packaging_rules.bzl b/builddefs/packaging_rules.bzl
new file mode 100644
index 00000000..9cde56e9
--- /dev/null
+++ b/builddefs/packaging_rules.bzl
@@ -0,0 +1,66 @@
+# Description:
+# Rules for packaging build outputs.
+
+
+def _pkg_zip_impl(ctx):
+ # Copy all files into the staging directory.
+ staging_dir = ctx.attr.name + "_pkg"
+ staged_files = []
+ for src_file in ctx.files.srcs:
+ # Remap path, if desired.
+ original_path = src_file.short_path
+ staged_path = original_path
+ for (prefix, replacement) in ctx.attr.path_mapping.items():
+ if staged_path.startswith(prefix):
+ staged_path = staged_path.replace(prefix, replacement)
+ staged_path = "/".join([staging_dir, staged_path])
+
+ # Copy to staging path.
+ staged_file = ctx.actions.declare_file(staged_path)
+ staged_files.append(staged_file)
+ ctx.actions.run_shell(
+ inputs = [src_file],
+ outputs = [staged_file],
+ command = "cp $1 $2",
+ arguments = [
+ src_file.path,
+ staged_file.path,
+ ],
+ progress_message = "Staging %s" % (src_file.short_path),
+ )
+
+ # Zip all of the files in the staging dir.
+ staged_file_paths = []
+ staged_base_path = "/".join([ctx.label.package, staging_dir]) + "/"
+ for staged_file in staged_files:
+ relative_path = staged_file.short_path.replace(staged_base_path, "")
+ staged_file_paths.append("/".join([relative_path]))
+ ctx.actions.run_shell(
+ inputs = staged_files,
+ outputs = [ctx.outputs.out],
+ command = "\n".join([
+ "ROOT_PATH=`pwd`",
+ "cd %s" % ("/".join([ctx.outputs.out.dirname, staging_dir])),
+ "zip -rqD $ROOT_PATH/%s %s" % (
+ ctx.outputs.out.path,
+ " ".join(staged_file_paths),
+ ),
+ "cd -",
+ ]),
+ progress_message = "Zipping package %s" % (ctx.outputs.out.short_path),
+ )
+
+ return struct(
+ files = depset([ctx.outputs.out]),
+ )
+
+pkg_zip = rule(
+ implementation = _pkg_zip_impl,
+ attrs = {
+ "srcs": attr.label_list(allow_files = True),
+ "path_mapping": attr.string_dict(),
+ },
+ outputs = {
+ "out": "%{name}.zip",
+ },
+)
diff --git a/builddefs/strip_comments.py b/builddefs/strip_comments.py
new file mode 100644
index 00000000..7fe1e9a0
--- /dev/null
+++ b/builddefs/strip_comments.py
@@ -0,0 +1,30 @@
+import os
+import re
+import sys
+
+def main(argv):
+ src_path = argv[1]
+ out_path = argv[2]
+
+ with open(src_path, "r") as file:
+ src_str = file.read()
+
+ # Code from Markus Jarderot, posted to stackoverflow
+ def replacer(match):
+ s = match.group(0)
+ if s.startswith('/'):
+ return ""
+ else:
+ return s
+ pattern = re.compile(
+ r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
+ re.DOTALL | re.MULTILINE)
+ out_str = re.sub(pattern, replacer, src_str)
+
+ with open(out_path, "w") as file:
+ file.write(out_str)
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/extensions/wtf-injector-chrome/BUILD b/extensions/wtf-injector-chrome/BUILD
new file mode 100644
index 00000000..984c4946
--- /dev/null
+++ b/extensions/wtf-injector-chrome/BUILD
@@ -0,0 +1,64 @@
+# Description:
+# WTF Chrome Extension.
+
+package(default_visibility = ["//:internal"])
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_binary")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_deps")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+load("//builddefs:config.bzl", "SHARED_CSS_FLAGS")
+load("//builddefs:config.bzl", "SHARED_JS_FLAGS")
+load("//builddefs:file_rules.bzl", "concat_files", "embed_files", "strip_comments")
+load("//builddefs:less_rules.bzl", "less_css_library")
+load("//builddefs:packaging_rules.bzl", "pkg_zip")
+
+# CWS hates comments in extension manifests - strip them all.
+strip_comments(
+ name = "stripped_manifest",
+ srcs = ["manifest.template.json"],
+ out = "manifest.json",
+)
+
+less_css_library(
+ name = "popup_styles",
+ includes = ["src"],
+ main_srcs = ["popup.less"],
+ deps = [
+ "//src/wtf/ui/styles",
+ ],
+)
+
+filegroup(
+ name = "extension_files",
+ srcs = [
+ "//app",
+ "//bindings/js",
+ ":stripped_manifest",
+ ":popup_styles",
+ "background.js",
+ "debugger.js",
+ "extension.js",
+ "injectedtab.js",
+ "options.js",
+ "popup.html",
+ "popup.js",
+ "tracer.js",
+ "uri.js",
+ "wtf-call-tracing.js",
+ "wtf-injector.js",
+ "wtf-process.js",
+ ] + glob([
+ "assets/icons/*.png",
+ "third_party/*.js",
+ ]),
+)
+
+pkg_zip(
+ name = "wtf-injector-chrome",
+ srcs = [":extension_files"],
+ path_mapping = {
+ "bindings/js/": "",
+ "extensions/wtf-injector-chrome/": "",
+ },
+)
diff --git a/extensions/wtf-injector-chrome/BUILD.anvil b/extensions/wtf-injector-chrome/BUILD.anvil
deleted file mode 100644
index d62be660..00000000
--- a/extensions/wtf-injector-chrome/BUILD.anvil
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright 2012 Google Inc. All Rights Reserved.
-
-__author__ = 'benvanik@google.com (Ben Vanik)'
-
-
-# Chrome injector extension release output
-
-
-# ------------------------------------------------------------------------------
-# Extension
-# ------------------------------------------------------------------------------
-
-# CWS hates comments in extension manifests - strip them all
-strip_comments(
- name='stripped_manifest',
- srcs=['manifest.json'])
-
-# Files relating to the injected tracing code
-file_set(
- name='tracing_files',
- srcs=[
- '../..:wtf_trace_web_js_compiled',
- ])
-
-file_set(
- name='all_less',
- srcs=glob('../../src/**/*.less'))
-less_css_library(
- name='popup_styles',
- srcs=['popup.less', ':all_less'],
- include_paths=['src',],
- compiler_flags=[
- #'--compress'
- ])
-
-file_set(
- name='extension_files',
- srcs=[
- ':stripped_manifest',
- ':tracing_files',
- ':popup_styles',
- 'background.js',
- 'debugger.js',
- 'extension.js',
- 'injectedtab.js',
- 'options.js',
- 'popup.html',
- 'popup.js',
- 'tracer.js',
- 'uri.js',
- 'wtf-call-tracing.js',
- 'wtf-injector.js',
- 'wtf-process.js',
- ] +
- glob('assets/scripts/*.js') +
- glob('assets/icons/*.png') +
- glob('third_party/*.js'),
- src_exclude_filter='*-deps.js')
-
-file_set(
- name='app_files',
- srcs=['../../app:app_files'],
- src_exclude_filter='manifest.json')
-
-file_set(
- name='combined_files',
- srcs=[
- ':extension_files',
- ':app_files'
- ])
-
-copy_files(
- name='deploy',
- srcs=[':combined_files'],
- out='../../wtf-injector-chrome/',
- flatten_paths=['extensions/wtf-injector-chrome/'])
-
-archive_files(
- name='wtf-injector-chrome',
- srcs=':combined_files',
- flatten_paths=['extensions/wtf-injector-chrome/'])
diff --git a/extensions/wtf-injector-chrome/injectedtab.js b/extensions/wtf-injector-chrome/injectedtab.js
index d78bc457..358b6711 100644
--- a/extensions/wtf-injector-chrome/injectedtab.js
+++ b/extensions/wtf-injector-chrome/injectedtab.js
@@ -69,7 +69,9 @@ var InjectedTab = function(extension, tab, pageStatus, pageOptions, port) {
*/
this.debugger_ = null;
- if (pageStatus == PageStatus.WHITELISTED &&
+ // Chrome debugger support is disabled until it's updated.
+ if (false &&
+ pageStatus == PageStatus.WHITELISTED &&
pageOptions['wtf.trace.provider.chromeDebug'] !== false) {
var timelineEnabled =
pageOptions['wtf.trace.provider.chromeDebug.timeline'] !== false;
diff --git a/extensions/wtf-injector-chrome/manifest.json b/extensions/wtf-injector-chrome/manifest.template.json
similarity index 99%
rename from extensions/wtf-injector-chrome/manifest.json
rename to extensions/wtf-injector-chrome/manifest.template.json
index dd64f68a..a69fc4e1 100644
--- a/extensions/wtf-injector-chrome/manifest.json
+++ b/extensions/wtf-injector-chrome/manifest.template.json
@@ -4,7 +4,7 @@
// These can be copy/pasted directly between them.
// ---------------------------------------------------------------------------
"manifest_version": 2,
- "version": "2015.7.15.1",
+ "version": "2017.10.20.1",
"minimum_chrome_version": "23",
"homepage_url": "https://github.com/google/tracing-framework",
diff --git a/extensions/wtf-injector-chrome/popup.html b/extensions/wtf-injector-chrome/popup.html
index 113d78dd..6de7214b 100644
--- a/extensions/wtf-injector-chrome/popup.html
+++ b/extensions/wtf-injector-chrome/popup.html
@@ -2,7 +2,7 @@
-
+
diff --git a/extensions/wtf-injector-firefox/package.json b/extensions/wtf-injector-firefox/package.json
index 52bc6043..ab34d0c7 100644
--- a/extensions/wtf-injector-firefox/package.json
+++ b/extensions/wtf-injector-firefox/package.json
@@ -2,7 +2,7 @@
"name": "web-tracing-framework",
"fullName": "Web Tracing Framework",
"id": "jid1-AdSGhlstK2V5ig",
- "version": "2015.7.15.1",
+ "version": "2017.10.20.1",
"description": "Rich tools for instrumenting, analyzing, and visualizing web apps. Make your app jank-free at 60fps!",
"author": "benvanik@google.com",
"license": "BSD"
diff --git a/externs/BUILD b/externs/BUILD
new file mode 100644
index 00000000..fb746320
--- /dev/null
+++ b/externs/BUILD
@@ -0,0 +1,16 @@
+# Description:
+# Externs for browser/node/etc APIs.
+
+package(default_visibility = ["//:internal"])
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+
+closure_js_library(
+ name = "externs",
+ srcs = [
+ "analytics.js",
+ "chrome.js",
+ "drive.js",
+ "node.js",
+ ],
+)
diff --git a/externs/chrome.js b/externs/chrome.js
index 13dc98c6..98dfc5fe 100644
--- a/externs/chrome.js
+++ b/externs/chrome.js
@@ -13,14 +13,6 @@
*/
-/**
- * @typedef {{
- * addListener: function(!Function),
- * removeListener: function(!Function)
- * }}
- */
-var ChromeEvent;
-
// var chrome;
@@ -61,6 +53,10 @@ chrome.app.runtime.onLaunched;
var ChromeAppWindow;
+/** @type {!ChromeAppWindow} */
+chrome.app.window;
+
+
/**
* @param {string} url
* @param {!Object} options
diff --git a/externs/node.js b/externs/node.js
index 3c224bdd..5ee02406 100644
--- a/externs/node.js
+++ b/externs/node.js
@@ -112,7 +112,7 @@ Buffer.byteLength = function(value) {};
/**
- * @return {string}
+ * @override
*/
Buffer.prototype.toString = function() {};
diff --git a/lint.sh b/lint.sh
new file mode 100755
index 00000000..dfa909ea
--- /dev/null
+++ b/lint.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+find -name 'BUILD' -print0 | xargs -0 buildifier
diff --git a/package.json b/package.json
index b50aecde..457ec228 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "tracing-framework",
- "version": "2015.7.15-1",
+ "version": "2017.10.20-1",
"description": "Web Tracing Framework instrumentation and analysis library.",
"keywords": [
"javascript",
@@ -20,23 +20,23 @@
},
"scripts": {},
"dependencies": {
- "falafel": "0.1.4",
- "mkdirp": "0.3.5",
- "optimist": "0.3.5",
- "ws": "0.4.25",
- "string-hash": "~1.1.0",
- "temporary": "0.0.7"
+ "falafel": "2.1.0",
+ "mkdirp": "0.5.1",
+ "optimist": "0.6.1",
+ "ws": "3.2.0",
+ "string-hash": "~1.1.3",
+ "temporary": "0.0.8"
},
"devDependencies": {
- "benchmark": "1.0.0",
- "chai": "1.2.0",
- "less": "1.4.2",
- "mocha": "1.4.2",
- "pegjs": "~0.7.0",
- "wd": "0.0.32"
+ "benchmark": "2.1.4",
+ "chai": "4.1.2",
+ "less": "2.7.2",
+ "mocha": "3.5.3",
+ "pegjs": "~0.10.0",
+ "wd": "1.4.1"
},
"optionalDependencies": {
- "microtime": "2.1.2"
+ "microtime": "2.1.6"
},
"files": [
"build-out/wtf_node_js_compiled.js",
diff --git a/scripts/prepare-publish.sh b/scripts/prepare-publish.sh
index 2023745d..99442edf 100755
--- a/scripts/prepare-publish.sh
+++ b/scripts/prepare-publish.sh
@@ -15,12 +15,22 @@ if [ ! -d ".git" ]; then
exit 1
fi
+GIT_USERNAME=`git config user.name`
+GIT_USEREMAIL=`git config user.email`
+
# =============================================================================
# Build everything
# =============================================================================
echo "Building everything..."
-./third_party/anvil-build/anvil-local.sh build :fast :debug :release
+bazel build -c opt \
+ //app \
+ //app:wtf-app \
+ //bindings/js \
+ //bindings/js:wtf_trace_min_js_compiled \
+ //bindings/js:wtf_node_js_compiled \
+ //bindings/js:wtf-trace-web-api \
+ //extensions/wtf-injector-chrome
echo ""
# =============================================================================
@@ -28,24 +38,19 @@ echo ""
# =============================================================================
echo "Building extensions..."
-# Chrome.
-rm -rf build-bin/wtf-injector-chrome
-./third_party/anvil-build/anvil-local.sh deploy -o build-bin/ extensions/wtf-injector-chrome:deploy
-./third_party/anvil-build/anvil-local.sh deploy -o build-bin/ :injector
-
# Firefox.
-rm -rf build-bin/wtf-injector-firefox
-./third_party/anvil-build/anvil-local.sh deploy -o build-bin/ extensions/wtf-injector-firefox:deploy
-cd third_party/firefox-addon-sdk/
-source bin/activate
-cd ../..
-cd build-bin/wtf-injector-firefox/
-cfx xpi \
- --update-link https://tracing-framework.appspot.com/CURRENT/web-tracing-framework.xpi \
- --update-url https://tracing-framework.appspot.com/CURRENT/web-tracing-framework.update.rdf
-cd ../..
-mv build-bin/wtf-injector-firefox/web-tracing-framework.xpi build-bin/extensions/
-mv build-bin/wtf-injector-firefox/web-tracing-framework.update.rdf build-bin/extensions/
+# rm -rf build-bin/wtf-injector-firefox
+# ./third_party/anvil-build/anvil-local.sh deploy -o build-bin/ extensions/wtf-injector-firefox:deploy
+# cd third_party/firefox-addon-sdk/
+# source bin/activate
+# cd ../..
+# cd build-bin/wtf-injector-firefox/
+# cfx xpi \
+# --update-link https://tracing-framework.appspot.com/CURRENT/web-tracing-framework.xpi \
+# --update-url https://tracing-framework.appspot.com/CURRENT/web-tracing-framework.update.rdf
+# cd ../..
+# mv build-bin/wtf-injector-firefox/web-tracing-framework.xpi build-bin/extensions/
+# mv build-bin/wtf-injector-firefox/web-tracing-framework.update.rdf build-bin/extensions/
echo ""
# =============================================================================
@@ -53,28 +58,55 @@ echo ""
# =============================================================================
echo "Building gh-pages..."
-# Clean first.
-rm -rf build-bin/gh-pages/
+# Ensure we have a sibling tracking-framework-gh-pages checkout.
+SELF_DIR=$PWD
+GH_PAGES=$PWD/../tracing-framework-gh-pages
+if [ ! -d "$GH_PAGES" ]; then
+ # Not found - create and clone.
+ echo "Creating tracing-framework-gh-pages..."
+ git clone git@github.com:google/tracing-framework.git $GH_PAGES
+ cd $GH_PAGES
+ git checkout gh-pages
+else
+ # Reset hard to the current version.
+ echo "Resetting tracing-framework-gh-pages..."
+ cd $GH_PAGES
+ git reset --hard
+ git pull
+ git merge origin/gh-pages
+fi
+cd $SELF_DIR
+
+# Reset existing bin dir.
+if [ -d "$GH_PAGES/bin" ]; then
+ rm -rf $GH_PAGES/bin/
+fi
-./third_party/anvil-build/anvil-local.sh deploy -o build-bin/gh-pages/ :release
+# Copy binaries from build results and source tree.
+mkdir -p $GH_PAGES/bin
+cp bazel-bin/app/wtf-app.zip $GH_PAGES/bin/
+unzip -q bazel-bin/app/wtf-app.zip -d $GH_PAGES/bin/
+cp bazel-bin/bindings/js/wtf-trace-web-api.zip $GH_PAGES/bin/
+cp bazel-bin/bindings/js/wtf_trace_min_js_compiled.js $GH_PAGES/bin/
+cp bazel-bin/bindings/js/wtf_trace_web_js_compiled.js $GH_PAGES/bin/
+cp bazel-bin/bindings/js/wtf_node_js_compiled.js $GH_PAGES/bin/
-# Copy around extension files.
-cp build-bin/extensions/web-tracing-framework.* build-bin/gh-pages/extensions/
-rm -rf build-bin/gh-pages/extensions/wtf-injector-firefox/
-mv build-bin/gh-pages/extensions/wtf-injector-chrome/wtf-injector-chrome.zip build-bin/gh-pages/extensions/
-rmdir build-bin/gh-pages/extensions/wtf-injector-chrome/
+# Copy extensions from build results.
+mkdir $GH_PAGES/bin/extensions
+cp bazel-bin/extensions/wtf-injector-chrome/wtf-injector-chrome.zip $GH_PAGES/bin/extensions/
+# cp bazel-bin/extensions/web-tracing-framework.* $GH_PAGES/extensions/
echo ""
# =============================================================================
# Done!
# =============================================================================
echo "gh-pages:"
-echo " build-bin/gh-pages/"
+echo " $GH_PAGES/"
echo "Chrome extension:"
-echo " build-bin/extensions/wtf-injector-chrome/wtf-injector-chrome.zip"
-echo "Firefox extension:"
-echo " build-bin/extensions/web-tracing-framework.xpi <-- zip"
-echo " build-bin/extensions/web-tracing-framework.update.rdf <-- update RDF"
+echo " bazel-bin/extensions/wtf-injector-chrome/wtf-injector-chrome.zip"
+# echo "Firefox extension:"
+# echo " build-bin/extensions/web-tracing-framework.xpi <-- zip"
+# echo " build-bin/extensions/web-tracing-framework.update.rdf <-- update RDF"
echo ""
echo "Ready for npm publish and ./scripts/update-gh-pages.sh"
echo ""
diff --git a/scripts/update-third-party.sh b/scripts/publish-gh-pages.sh
similarity index 52%
rename from scripts/update-third-party.sh
rename to scripts/publish-gh-pages.sh
index a1654b0f..d827029c 100755
--- a/scripts/update-third-party.sh
+++ b/scripts/publish-gh-pages.sh
@@ -3,8 +3,11 @@
# Copyright 2012 Google Inc. All Rights Reserved.
# This script is only to be used by contributors.
-# It will attempt to pull the latest versions of third party code and binaries.
-# Before running one should be in a git branch with no pending changes.
+# This will build everything, check out the latest tracing-framework gh-pages
+# branch, update the bin/ path, and prepare a commit.
+
+# Break on error.
+set -e
# This must currently run from the root of the repo
# TODO(benvanik): make this runnable from anywhere (find git directory?)
@@ -13,33 +16,35 @@ if [ ! -d ".git" ]; then
exit 1
fi
+echo ""
# =============================================================================
-# Node modules
+# Look for sibling path or create
# =============================================================================
-npm install
+GH_PAGES=$PWD/../tracing-framework-gh-pages
+if [ ! -d "$GH_PAGES" ]; then
+ # Not found.
+ echo "Run prepare-publish.sh first to create gh-pages repo"
+ exit 1
+fi
+cd $GH_PAGES
# =============================================================================
-# Git submodules
+# Stage all changes
# =============================================================================
-echo "Updating git modules..."
-
-# TODO(benvanik): update each module
-SUBMODULES=( anvil-build closure-compiler closure-library closure-linter closure-stylesheets closure-templates )
-cd third_party
-for m in ${SUBMODULES[@]}
-do
- echo "-> third_party/$m"
- cd $m
- git checkout master
- git pull origin master
- git merge origin/master
- cd ..
-done
-cd ..
-for m in ${SUBMODULES[@]}
-do
- git add third_party/$m
-done
+echo "Staging changes..."
+
+git add --all bin/
+git commit -m "Updating bin/ to the latest version."
echo ""
+# =============================================================================
+# Push!
+# =============================================================================
+echo "Pushing changes..."
+
+git push origin gh-pages
+
+echo ""
+
+cd -
diff --git a/scripts/setup.bat b/scripts/setup.bat
deleted file mode 100644
index 25b620e3..00000000
--- a/scripts/setup.bat
+++ /dev/null
@@ -1,54 +0,0 @@
-@ECHO OFF
-
-REM Copyright 2012 Google Inc. All Rights Reserved.
-REM
-REM wtf Windows setup script
-REM
-REM This script will install all dependencies to the system (that it can).
-REM The dependencies are all local.
-REM
-REM Requires:
-REM - Git 1.7.5+
-REM - Python 2.7+
-REM - Python easy_install: http://pypi.python.org/pypi/setuptools
-REM - node.js v0.6.10+ (containing npm)
-
-ECHO.
-REM ============================================================================
-REM Check for Python/node/etc
-REM ============================================================================
-ECHO Checking for dependencies...
-
-REM TODO(benvanik): check python/node versions
-
-ECHO WARNING: you need to make sure you have Python 2.6+ and node 0.8.4+!
-ECHO WARNING: attempting to install pip - install it yourself if it fails!
-
-easy_install pip
-
-ECHO.
-REM ============================================================================
-REM Git submodules
-REM ============================================================================
-ECHO Fetching submodules...
-
-git submodule init
-git submodule update
-
-ECHO.
-REM ============================================================================
-REM Node modules
-REM ============================================================================
-ECHO Installing node modules...
-
-npm install
-
-ECHO.
-REM ============================================================================
-REM Anvil init
-REM ============================================================================
-ECHO Setting up anvil-build environment...
-
-third_party\anvil-build\setup-local.bat
-
-ECHO.
diff --git a/scripts/setup.sh b/scripts/setup.sh
deleted file mode 100755
index fa71fbc9..00000000
--- a/scripts/setup.sh
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/bin/bash
-
-# Copyright 2012 Google Inc. All Rights Reserved.
-
-# wtf unix setup script
-
-# This script will install all dependencies. Everything is local, no need to
-# run as root.
-#
-# Requires:
-# - All:
-# - Git 1.7.5+
-# - Python 2.6+
-# - Python pip
-# - node.js v0.8.0+ (containing npm)
-
-# Ensure running as root (or on Cygwin, where it doesn't matter)
-if [ "$(id -u)" -eq 0 ]; then
- if [ ! -e "/Cygwin.bat" ]; then
- echo "This script should not be run as root!"
- echo "Run without sudo!"
- exit 1
- fi
-fi
-
-# This must currently run from the root of the repo
-# TODO(benvanik): make this runnable from anywhere (find git directory?)
-if [ ! -d ".git" ]; then
- echo "This script must be run from the root of the repository (the folder containing .git)"
- exit 1
-fi
-
-# ==============================================================================
-# Check for Python/node/etc
-# ==============================================================================
-echo "Checking for dependencies..."
-
-echo "- Python 2.6+:"
-if [ ! -e "$(which python)" ]; then
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "! Python not found or not in PATH - at least version 2.6 is required !"
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- exit 1
-fi
-PYTHON_CHECK=`python -c 'import sys; print(sys.version_info >= (2, 6) and "1" or "0")'`
-PYTHON_VERSION=`python -c 'import sys; print(sys.version_info[:])'`
-if [ "$PYTHON_CHECK" = "0" ]; then
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "! Python is out of date - at least version 2.6 is required !"
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "Your version: $PYTHON_VERSION"
- exit 1
-fi
-echo " path: $(which python)"
-echo " version: $PYTHON_VERSION"
-echo ""
-echo "- Python pip:"
-if [ ! -e "$(which pip)" ]; then
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "! pip not found or not in PATH !"
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "Attemping to install via the system package manager..."
- if [ "$(which easy_install)" ]; then
- # Anything with easy_install (on OS X by default)
- sudo easy_install pip
- elif [ "$(which apt-get 2>/dev/null)" ]; then
- # Linux (Ubuntu)
- sudo apt-get install python-pip
- elif [ "$(which port 2>/dev/null)" ]; then
- # OS X (MacPorts)
- sudo port selfupdate
- sudo port install pip
- else
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "! No supported package manager found! !"
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo " If on OS X ensure you install MacPorts (port) and run again"
- echo " Or, manually install these packages:"
- echo " pip"
- exit 1
- fi
-fi
-echo " path: $(which pip)"
-echo ""
-echo "- node.js 0.8.0+:"
-if [ ! -e "$(which node)" ]; then
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "! node.js not found or not in PATH - at least version 0.8.0 is required !"
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "Grab the latest version from: http://nodejs.org/#download"
- exit 1
-fi
-NODE_CHECK=`node -e "var v = process.version.split('v')[1].split('.'); console.log(v[0] > 0 || v[1] > 8 || v[2] >= 0)"`
-NODE_VERSION=`node -e "console.log(process.version)"`
-if [ "$NODE_CHECK" = "false" ]; then
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "! node.js is out of date - at least version 0.8.0 is required !"
- echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- echo "Your version: $NODE_VERSION"
- echo "Grab the latest version from: http://nodejs.org/#download"
- exit 1
-fi
-echo " path: $(which node)"
-echo " version: $NODE_VERSION"
-
-echo ""
-# ==============================================================================
-# Git submodules
-# ==============================================================================
-echo "Fetching submodules..."
-
-git submodule init
-git submodule update
-
-# On cygwin disable the filemode setting to prevent all the spurious +x diffs.
-# This cannot be set globally as git resets it each repo.
-if [ -e "/Cygwin.bat" ]; then
- git config core.filemode false
- git submodule foreach git config core.filemode false
-fi
-
-# Add an ignored gitignore to closure-linter, as the repo is missing one that
-# ignores .pyc files.
-echo '.gitignore' > third_party/closure-linter/.gitignore
-echo '*.pyc' >> third_party/closure-linter/.gitignore
-
-echo ""
-# =============================================================================
-# Node modules
-# =============================================================================
-echo "Installing node modules..."
-
-npm install
-
-echo ""
-# =============================================================================
-# Anvil init
-# =============================================================================
-echo "Setting up anvil-build environment..."
-
-third_party/anvil-build/setup-local.sh
-
-echo ""
diff --git a/scripts/update-gh-pages.sh b/scripts/update-gh-pages.sh
deleted file mode 100755
index 674533cf..00000000
--- a/scripts/update-gh-pages.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/bash
-
-# Copyright 2012 Google Inc. All Rights Reserved.
-
-# This script is only to be used by contributors.
-# This will build everything, check out the latest tracing-framework gh-pages
-# branch, update the bin/ path, and prepare a commit.
-
-# Break on error.
-set -e
-
-# This must currently run from the root of the repo
-# TODO(benvanik): make this runnable from anywhere (find git directory?)
-if [ ! -d ".git" ]; then
- echo "This script must be run from the root of the repository (the folder containing .git)"
- exit 1
-fi
-
-GIT_USERNAME=`git config user.name`
-GIT_USEREMAIL=`git config user.email`
-
-# =============================================================================
-# Build everything
-# =============================================================================
-echo "Building everything..."
-
-./scripts/prepare-publish.sh
-SRC_PATH=$PWD/build-bin/gh-pages/
-
-echo ""
-# =============================================================================
-# Look for sibling path or create
-# =============================================================================
-
-cd ..
-if [ ! -d "tracing-framework-gh-pages" ]; then
- # Not found - create and clone
- echo "Creating tracing-framework-gh-pages..."
- git clone git@github.com:google/tracing-framework.git tracing-framework-gh-pages
- cd tracing-framework-gh-pages
- git checkout gh-pages
-else
- # Reset hard to the current version
- echo "Resetting tracing-framework-gh-pages..."
- cd tracing-framework-gh-pages
- git reset --hard
- git pull
- git merge origin/gh-pages
-fi
-
-# Be sure to reset username/email to the owner of the source repo
-git config user.name "$GIT_USERNAME"
-git config user.email "$GIT_USEREMAIL"
-
-echo ""
-# =============================================================================
-# Copy bin/
-# =============================================================================
-echo "Updating bin/..."
-
-# Delete all the old contents and recreate
-if [ -d "bin" ]; then
- rm -rf bin/
-fi
-mkdir bin
-
-# Copy bin contents
-cp -R $SRC_PATH/* bin/
-
-echo ""
-# =============================================================================
-# Stage all changes
-# =============================================================================
-echo "Staging changes..."
-
-git add --all bin/
-git commit -m "Updating bin/ to the latest version."
-
-echo ""
-# =============================================================================
-# Push!
-# =============================================================================
-echo "Pushing changes..."
-
-git push origin gh-pages
-
-echo ""
-
diff --git a/scripts/update-version.sh b/scripts/update-version.sh
index 7184ef21..b47c8e8e 100755
--- a/scripts/update-version.sh
+++ b/scripts/update-version.sh
@@ -52,13 +52,13 @@ sed -i.bak \
package.json
rm package.json.bak
-echo "-> extensions/wtf-injector-chrome/manifest.json"
+echo "-> extensions/wtf-injector-chrome/manifest.template.json"
# __"version": "2012.12.17.1",
manifest_string="$ver_major.$ver_minor.$ver_patch.$ver_tag"
sed -i.bak \
"s/^\ \ \"version\": \".*\",$/\ \ \"version\": \"$manifest_string\",/" \
- extensions/wtf-injector-chrome/manifest.json
-rm extensions/wtf-injector-chrome/manifest.json.bak
+ extensions/wtf-injector-chrome/manifest.template.json
+rm extensions/wtf-injector-chrome/manifest.template.json.bak
echo "-> extensions/wtf-injector-firefox/package.json"
# __"version": "2012.12.17.1",
@@ -93,6 +93,6 @@ echo "Committing changes..."
git commit -o -m "Updating version to $ver_string." \
package.json \
- extensions/wtf-injector-chrome/manifest.json \
+ extensions/wtf-injector-chrome/manifest.template.json \
extensions/wtf-injector-firefox/package.json \
src/wtf/version.js
diff --git a/src/BUILD b/src/BUILD
new file mode 100644
index 00000000..c1024820
--- /dev/null
+++ b/src/BUILD
@@ -0,0 +1,9 @@
+# Description:
+# WTF source code for both the tracing library and visualizers.
+
+package(default_visibility = ["//:internal"])
+
+filegroup(
+ name = "all_files",
+ srcs = glob(["**/*.js"]),
+)
diff --git a/src/wtf/BUILD b/src/wtf/BUILD
new file mode 100644
index 00000000..8d737f29
--- /dev/null
+++ b/src/wtf/BUILD
@@ -0,0 +1,19 @@
+# Description:
+# Shared macros and versioning rules.
+
+package(default_visibility = ["//:internal"])
+
+load("//builddefs:config.bzl", "COMMON_JS_SUPPRESSIONS")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+
+closure_js_library(
+ name = "wtf",
+ srcs = [
+ "version.js",
+ "wtf.js",
+ ],
+ suppress = COMMON_JS_SUPPRESSIONS,
+ deps = [
+ "//externs",
+ ],
+)
diff --git a/src/wtf/addon/BUILD b/src/wtf/addon/BUILD
new file mode 100644
index 00000000..5593c5c0
--- /dev/null
+++ b/src/wtf/addon/BUILD
@@ -0,0 +1,23 @@
+# Description:
+# Add-on API.
+
+package(default_visibility = ["//:internal"])
+
+load("//builddefs:config.bzl", "COMMON_JS_SUPPRESSIONS")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+
+closure_js_library(
+ name = "addon",
+ srcs = [
+ "addon.js",
+ "appaddon.js",
+ "manifest.js",
+ "registry.js",
+ "traceaddon.js",
+ ],
+ suppress = COMMON_JS_SUPPRESSIONS,
+ deps = [
+ "//src/wtf/events:eventemitter",
+ "@io_bazel_rules_closure//closure/library",
+ ],
+)
diff --git a/src/wtf/app/BUILD b/src/wtf/app/BUILD
new file mode 100644
index 00000000..27183f65
--- /dev/null
+++ b/src/wtf/app/BUILD
@@ -0,0 +1,135 @@
+# Description:
+# Main application source code.
+# HTML and assets live under //app/.
+
+package(default_visibility = ["//:internal"])
+
+load("//builddefs:config.bzl", "COMMON_JS_SUPPRESSIONS")
+load("//builddefs:less_rules.bzl", "less_css_library")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
+load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_template_library")
+
+closure_js_library(
+ name = "app",
+ srcs = [
+ "addonmanager.js",
+ "app.js",
+ "documentview.js",
+ "exports.js",
+ "framepainter.js",
+ "granularity.js",
+ "graphics/canvaspanel.js",
+ "healthdialog.js",
+ "helpdialog.js",
+ "loader.js",
+ "maindisplay.js",
+ "markpainter.js",
+ "nav/heatmappainter.js",
+ "nav/navbar.js",
+ "nav/statsbox.js",
+ "nav/timelinepainter.js",
+ "query/querypanel.js",
+ "query/querytablesource.js",
+ "selection.js",
+ "selectionpainter.js",
+ "splashdialog.js",
+ "statusbar.js",
+ "tabbar.js",
+ "tabpanel.js",
+ "toolbar.js",
+ "tracks/statisticstablesource.js",
+ "tracks/timerangepainter.js",
+ "tracks/trackinfobar.js",
+ "tracks/trackspanel.js",
+ "tracks/zonepainter.js",
+ ],
+ suppress = COMMON_JS_SUPPRESSIONS,
+ deps = [
+ ":app_templates",
+ "//src/wtf",
+ "//src/wtf/addon",
+ "//src/wtf/data",
+ "//src/wtf/db",
+ "//src/wtf/db:unit",
+ "//src/wtf/doc",
+ "//src/wtf/events",
+ "//src/wtf/events:eventemitter",
+ "//src/wtf/io",
+ "//src/wtf/io/cff",
+ "//src/wtf/ipc",
+ "//src/wtf/math",
+ "//src/wtf/pal",
+ "//src/wtf/replay/graphics",
+ "//src/wtf/replay/graphics/ui",
+ "//src/wtf/replay/timetravel",
+ "//src/wtf/timing",
+ "//src/wtf/ui:color",
+ "//src/wtf/ui:control",
+ "//src/wtf/ui:dialog",
+ "//src/wtf/ui:errordialog",
+ "//src/wtf/ui:gridpainter",
+ "//src/wtf/ui:progressdialog",
+ "//src/wtf/ui:rangepainter",
+ "//src/wtf/ui:rulerpainter",
+ "//src/wtf/ui:searchcontrol",
+ "//src/wtf/ui:settingsdialog",
+ "//src/wtf/ui:timepainter",
+ "//src/wtf/ui:tooltip",
+ "//src/wtf/ui:virtualtable",
+ "//src/wtf/ui:zoom",
+ "//src/wtf/util",
+ "@io_bazel_rules_closure//closure/library",
+ ],
+)
+
+closure_js_template_library(
+ name = "app_templates",
+ srcs = [
+ "documentview.soy",
+ "graphics/canvaspanel.soy",
+ "healthdialog.soy",
+ "helpdialog.soy",
+ "maindisplay.soy",
+ "nav/navbar.soy",
+ "nav/statsbox.soy",
+ "query/querypanel.soy",
+ "splashdialog.soy",
+ "statusbar.soy",
+ "tabbar.soy",
+ "toolbar.soy",
+ "tracks/trackinfobar.soy",
+ "tracks/trackspanel.soy",
+ ],
+)
+
+less_css_library(
+ name = "app_styles",
+ srcs = [
+ "documentview.less",
+ "graphics/canvaspanel.less",
+ "graphics/graphics.less",
+ "healthdialog.less",
+ "helpdialog.less",
+ "maindisplay.less",
+ "nav/nav.less",
+ "nav/navbar.less",
+ "nav/statsbox.less",
+ "query/query.less",
+ "query/querypanel.less",
+ "splashdialog.less",
+ "statusbar.less",
+ "tabbar.less",
+ "toolbar.less",
+ "tracks/trackinfobar.less",
+ "tracks/tracks.less",
+ "tracks/trackspanel.less",
+ ],
+ includes = ["src"],
+ main_srcs = ["app.less"],
+ deps = [
+ "//src/wtf/replay/graphics/ui:graphics_styles",
+ "//src/wtf/replay/timetravel:timetravel_styles",
+ "//src/wtf/ui:ui_styles",
+ "//src/wtf/ui/styles",
+ ],
+)
diff --git a/src/wtf/app/addonmanager.js b/src/wtf/app/addonmanager.js
index c94d451b..f03685aa 100644
--- a/src/wtf/app/addonmanager.js
+++ b/src/wtf/app/addonmanager.js
@@ -18,7 +18,6 @@ goog.require('goog.Disposable');
goog.require('goog.Uri');
goog.require('goog.asserts');
goog.require('goog.dom');
-goog.require('goog.dom.TagName');
goog.require('goog.dom.classes');
goog.require('goog.style');
goog.require('wtf.addon');
@@ -61,7 +60,7 @@ wtf.app.AddonManager = function(documentView) {
* @type {!Element}
* @private
*/
- this.addonsEl_ = dom.createElement(goog.dom.TagName.DIV);
+ this.addonsEl_ = dom.createElement('div');
this.addonsEl_.id = 'wtfAppAddons';
dom.getDocument().body.appendChild(this.addonsEl_);
@@ -124,13 +123,13 @@ wtf.app.AddonManager.prototype.loadAddon = function(addon) {
// Create iframe container.
var iframe = /** @type {!HTMLIFrameElement} */ (
- dom.createElement(goog.dom.TagName.IFRAME));
+ dom.createElement('iframe'));
this.addonsEl_.appendChild(iframe);
// Set base.
var idoc = iframe.contentDocument;
var baseUri = goog.Uri.resolve(window.location.href, manifest.getUrl());
- var baseEl = idoc.createElement(goog.dom.TagName.BASE);
+ var baseEl = idoc.createElement('base');
baseEl.href = baseUri.toString();
idoc.head.appendChild(baseEl);
@@ -141,7 +140,7 @@ wtf.app.AddonManager.prototype.loadAddon = function(addon) {
// Add scripts.
for (var n = 0; n < info.scripts.length; n++) {
- var script = idoc.createElement(goog.dom.TagName.SCRIPT);
+ var script = idoc.createElement('script');
script.src = info.scripts[n];
idoc.body.appendChild(script);
}
@@ -183,7 +182,7 @@ wtf.app.AddonManager.prototype.setupAddonApi_ = function(
function createTabPanel(path, name, options, callback) {
tabbar.addPanel(new wtf.app.AddonTabPanel(
addon, documentView, path, name, options, callback));
- };
+ }
};
@@ -267,7 +266,7 @@ wtf.app.AddonTabPanel.Callback;
* @override
*/
wtf.app.AddonTabPanel.prototype.createDom = function(dom) {
- var el = dom.createElement(goog.dom.TagName.DIV);
+ var el = dom.createElement('div');
goog.dom.classes.add(el, goog.getCssName('appUiTabPanel'));
return el;
};
@@ -287,13 +286,13 @@ wtf.app.AddonTabPanel.prototype.setupIframe_ = function() {
// renamed CSS. Better would be to insert a default stylesheet with some
// common styles (buttons/etc).
var iframe = /** @type {!HTMLIFrameElement} */ (
- this.getDom().createElement(goog.dom.TagName.IFRAME));
+ this.getDom().createElement('iframe'));
this.getRootElement().appendChild(iframe);
// Set base.
var idoc = iframe.contentDocument;
var baseUri = goog.Uri.resolve(window.location.href, manifest.getUrl());
- var baseEl = idoc.createElement(goog.dom.TagName.BASE);
+ var baseEl = idoc.createElement('base');
baseEl.href = baseUri.toString();
idoc.head.appendChild(baseEl);
@@ -306,7 +305,7 @@ wtf.app.AddonTabPanel.prototype.setupIframe_ = function() {
// Add scripts.
var scripts = this.options_['scripts'] || [];
for (var n = 0; n < scripts.length; n++) {
- var script = idoc.createElement(goog.dom.TagName.SCRIPT);
+ var script = idoc.createElement('script');
script.src = scripts[n];
idoc.body.appendChild(script);
}
@@ -314,7 +313,7 @@ wtf.app.AddonTabPanel.prototype.setupIframe_ = function() {
// Add stylesheets.
var stylesheets = this.options_['stylesheets'] || [];
for (var n = 0; n < stylesheets.length; n++) {
- var link = idoc.createElement(goog.dom.TagName.LINK);
+ var link = idoc.createElement('link');
link.rel = 'stylesheet';
link.href = stylesheets[n];
link.type = 'text/css';
diff --git a/src/wtf/app/documentview.js b/src/wtf/app/documentview.js
index 9e77d18b..51fef9a9 100644
--- a/src/wtf/app/documentview.js
+++ b/src/wtf/app/documentview.js
@@ -581,7 +581,7 @@ wtf.app.DocumentView.prototype.saveLocalTrace_ = function() {
self.getDom());
};
xhr.send();
- };
+ }
};
diff --git a/src/wtf/app/framepainter.js b/src/wtf/app/framepainter.js
index 01fcb346..4e56c827 100644
--- a/src/wtf/app/framepainter.js
+++ b/src/wtf/app/framepainter.js
@@ -237,7 +237,7 @@ wtf.app.FramePainter.prototype.getInfoStringInternal =
* @param {number} x X coordinate, relative to canvas.
* @param {number} y Y coordinate, relative to canvas.
* @param {!goog.math.Rect} bounds Draw bounds.
- * @return {wtf.db.Frame|Array.} Frame or an array
+ * @return {!wtf.db.Frame|!Array.} Frame or an array
* containing the two frames on either side of the time.
* @private
*/
diff --git a/src/wtf/app/granularity.js b/src/wtf/app/granularity.js
index 7304bb18..351013a4 100644
--- a/src/wtf/app/granularity.js
+++ b/src/wtf/app/granularity.js
@@ -27,10 +27,11 @@ wtf.app.Granularity = {
CENTISECOND: 10,
/** ms */
MILLISECOND: 1,
-
- // TODO(benvanik): make this a setting on the summary index instead?
- /**
- * The finest granularity to work with.
- */
- FINEST: 100
};
+
+// TODO(benvanik): make this a setting on the summary index instead?
+/**
+ * The finest granularity to work with.
+ * @const {wtf.app.Granularity}
+ */
+wtf.app.Granularity.FINEST = wtf.app.Granularity.DECISECOND;
diff --git a/src/wtf/app/helpdialog.soy b/src/wtf/app/helpdialog.soy
index 2257f0ef..408aa899 100644
--- a/src/wtf/app/helpdialog.soy
+++ b/src/wtf/app/helpdialog.soy
@@ -21,7 +21,7 @@
* @param system_key System command key string (like 'ctrl').
* @param is_chrome_extension Whether this is running in the Chrome extension.
*/
-{template .control}
+{template .control autoescape="deprecated-contextual"}