From 2cf52c1b555576710a01cc0a5328b55f59a09ba7 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 26 Sep 2017 09:44:47 -0700 Subject: [PATCH] test: Enable sass compiler for bazel integration test (#19357) --- integration/bazel/.bazelrc | 3 +++ integration/bazel/WORKSPACE | 10 ++++++++++ integration/bazel/src/hello-world/BUILD.bazel | 9 +++++++-- .../bazel/src/hello-world/hello-world.component.scss | 5 +++++ .../bazel/src/hello-world/hello-world.component.ts | 3 +-- 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 integration/bazel/.bazelrc create mode 100644 integration/bazel/src/hello-world/hello-world.component.scss diff --git a/integration/bazel/.bazelrc b/integration/bazel/.bazelrc new file mode 100644 index 0000000000..c5102a05a2 --- /dev/null +++ b/integration/bazel/.bazelrc @@ -0,0 +1,3 @@ +# Workaround https://github.com/bazelbuild/bazel/issues/3645 +# Limit Bazel to consuming 3072K of RAM +build --local_resources=3072,2.0,1.0 diff --git a/integration/bazel/WORKSPACE b/integration/bazel/WORKSPACE index a5fa8576c3..bf231610f0 100644 --- a/integration/bazel/WORKSPACE +++ b/integration/bazel/WORKSPACE @@ -18,3 +18,13 @@ local_repository( name = "angular", path = "node_modules/@angular/bazel", ) + +git_repository( + name = "io_bazel_rules_sass", + remote = "https://github.com/bazelbuild/rules_sass.git", + tag = "0.0.2", +) + +load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories") + +sass_repositories() diff --git a/integration/bazel/src/hello-world/BUILD.bazel b/integration/bazel/src/hello-world/BUILD.bazel index 51e2ff6fc6..51fd096815 100644 --- a/integration/bazel/src/hello-world/BUILD.bazel +++ b/integration/bazel/src/hello-world/BUILD.bazel @@ -1,10 +1,15 @@ package(default_visibility = ["//visibility:public"]) load("@angular//:index.bzl", "ng_module") +load("@io_bazel_rules_sass//sass:sass.bzl", "sass_binary") + +sass_binary( + name = "hello-world-styles", + src = "hello-world.component.scss", +) ng_module( name = "hello-world", srcs = glob(["*.ts"]), tsconfig = "//src:tsconfig.json", - # TODO(alexeagle): re-enable - # assets = [":styles"], + assets = [":hello-world-styles.css"], ) diff --git a/integration/bazel/src/hello-world/hello-world.component.scss b/integration/bazel/src/hello-world/hello-world.component.scss new file mode 100644 index 0000000000..c5a2b03af2 --- /dev/null +++ b/integration/bazel/src/hello-world/hello-world.component.scss @@ -0,0 +1,5 @@ +$example-red: #ff0000; + +h1 { + color: $example-red; +} diff --git a/integration/bazel/src/hello-world/hello-world.component.ts b/integration/bazel/src/hello-world/hello-world.component.ts index 753d4ab22f..d741a1833b 100644 --- a/integration/bazel/src/hello-world/hello-world.component.ts +++ b/integration/bazel/src/hello-world/hello-world.component.ts @@ -8,8 +8,7 @@ import {Component, NgModule} from '@angular/core'; `, // TODO: might be better to point to .scss so this looks valid at design-time - // TODO(alexeagle): re-enable SASS - // styleUrls: ['./styles.css'] + styleUrls: ['./hello-world-styles.css'], }) export class HelloWorldComponent { name: string = 'world';