From 42dc6764a0518ec0937bb9d94949c2af29508371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Wed, 8 Feb 2017 11:53:22 -0800 Subject: [PATCH] Migrate tf_backend to webfiles rules. Change: 146938071 --- .../test/audioDashboardTests.ts | 5 +- .../tensorboard/components/tf_backend/BUILD | 79 +++++++++++++++++++ .../tf_tensorboard/test/autoReloadTests.ts | 4 +- tensorflow/tensorboard/defs.bzl | 14 ++++ 4 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 tensorflow/tensorboard/components/tf_backend/BUILD diff --git a/tensorflow/tensorboard/components/tf_audio_dashboard/test/audioDashboardTests.ts b/tensorflow/tensorboard/components/tf_audio_dashboard/test/audioDashboardTests.ts index bd6f7627107..937654c160a 100644 --- a/tensorflow/tensorboard/components/tf_audio_dashboard/test/audioDashboardTests.ts +++ b/tensorflow/tensorboard/components/tf_audio_dashboard/test/audioDashboardTests.ts @@ -13,8 +13,11 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ declare function stub(el: string, obj: any): void; +declare function fixture(id: string): void; - describe('audio dashboard tests', function() { + +describe( + 'audio dashboard tests', function() { var audioDash; var reloadCount = 0; beforeEach(function() { diff --git a/tensorflow/tensorboard/components/tf_backend/BUILD b/tensorflow/tensorboard/components/tf_backend/BUILD new file mode 100644 index 00000000000..22ab1faff05 --- /dev/null +++ b/tensorflow/tensorboard/components/tf_backend/BUILD @@ -0,0 +1,79 @@ +package(default_visibility = ["//tensorflow:internal"]) + +load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_ts_library") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_typescript_genrule") +load("//tensorflow/tensorboard:defs.bzl", "tensorboard_webcomponent_library") + +licenses(["notice"]) # Apache 2.0 + +# TODO(dandelion): Add webfiles support for the test code. + +webfiles( + name = "tf_backend", + srcs = [ + "tf-backend.html", + ":ts", + ], + path = "/tf-backend", + deps = [ + "//tensorflow/tensorboard/components/tf_imports:d3", + "//tensorflow/tensorboard/components/tf_imports:lodash", + "//tensorflow/tensorboard/components/vz_sorting", + "@org_polymer", + ], +) + +tensorboard_typescript_genrule( + name = "ts", + srcs = [ + "backend.ts", + "behavior.ts", + "requestManager.ts", + "router.ts", + "urlPathHelpers.ts", + ], + typings = [ + "@org_definitelytyped//:d3.d.ts", + "@org_definitelytyped//:lodash.d.ts", + "//tensorflow/tensorboard/components/vz_sorting:ts_typings", + ], +) + +filegroup( + name = "all_files", + srcs = glob(["**"]), + tags = ["notsan"], +) + +################################################################################ +# MARKED FOR DELETION + +tensorboard_webcomponent_library( + name = "legacy", + srcs = [ + "tf-backend.html", + ":legacy_ts", + ], + visibility = ["//visibility:public"], + destdir = "tf-backend", + deps = [ + "//tensorflow/tensorboard/components:tf_imports", + "//third_party/javascript/polymer/v1/polymer:lib", + ], +) + +tensorboard_ts_library( + name = "legacy_ts", + srcs = [ + "backend.ts", + "behavior.ts", + "requestManager.ts", + "router.ts", + "urlPathHelpers.ts", + ], + deps = [ + "//tensorflow/tensorboard/components:common_deps", + "//tensorflow/tensorboard/components/vz_sorting:legacy_ts", + ], +) diff --git a/tensorflow/tensorboard/components/tf_tensorboard/test/autoReloadTests.ts b/tensorflow/tensorboard/components/tf_tensorboard/test/autoReloadTests.ts index dfb1a7af568..0d815cc8826 100644 --- a/tensorflow/tensorboard/components/tf_tensorboard/test/autoReloadTests.ts +++ b/tensorflow/tensorboard/components/tf_tensorboard/test/autoReloadTests.ts @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ var assert = chai.assert; -declare function fixture(id: string): void; window.HTMLImports.whenReady(() => { - +declare function fixture(id: string): void; +window.HTMLImports.whenReady(() => { Polymer({ is: 'autoreload-test-element', behaviors: [TF.TensorBoard.AutoReloadBehavior], diff --git a/tensorflow/tensorboard/defs.bzl b/tensorflow/tensorboard/defs.bzl index 3488978ab2d..1d0b937fe82 100644 --- a/tensorflow/tensorboard/defs.bzl +++ b/tensorflow/tensorboard/defs.bzl @@ -41,6 +41,20 @@ def tensorboard_typescript_genrule(name, srcs, typings=[], **kwargs): tools = ["@com_microsoft_typescript//:tsc"], **kwargs ) + native.genrule( + name = name + "_typings", + srcs = _DEFAULT_TYPINGS + typings + srcs, + outs = [src[:-3] + ".d.ts" for src in srcs], + cmd = "$(location @com_microsoft_typescript//:tsc)" + + " --inlineSourceMap" + + " --inlineSources" + + " --outDir $(@D)" + + " --declaration" + + " $(SRCS)", + tools = ["@com_microsoft_typescript//:tsc"], + **kwargs + ) + def tensorboard_ts_library(**kwargs): """Rules referencing this will be deleted from the codebase soon."""