Skip to content

Commit

Permalink
build: remove skydoc and rules_sass from repository (angular#42760)
Browse files Browse the repository at this point in the history
Skydoc is no longer used as `@angular/bazel` is no longer a
public API. The Sass rules were only used in a single place
in the repo where Sass is not really needed and has just been
added by accident most likely. We want to remove the Sass dependency
in preparation for Rules NodeJS v4.x where the Sass rules currently
still use an older version of `@bazel/worker` that is incompatible.

PR Close angular#42760
  • Loading branch information
devversion authored and AndrewKushnir committed Jul 9, 2021
1 parent 53b281a commit 12443ea
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 98 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ version: 2.1
# **NOTE 2 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
# **NOTE 3 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_3: &cache_key v4-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
var_3: &cache_key v4-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
# We invalidate the cache if the Bazel version changes because otherwise the `bazelisk` cache
# folder will contain all previously used versions and ultimately cause the cache restoring to
# be slower due to its growing size.
var_4: &cache_key_fallback v4-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}

# Windows needs its own cache key because binaries in node_modules are different.
var_3_win: &cache_key_win v4-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
var_3_win: &cache_key_win v4-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
var_4_win: &cache_key_win_fallback v4-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}

# Cache key for the `components-repo-unit-tests` job. **Note** when updating the SHA in the
Expand Down
15 changes: 0 additions & 15 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ yarn_install(
yarn_lock = "//:yarn.lock",
)

# Load angular dependencies
load("//packages/bazel:package.bzl", "rules_angular_dev_dependencies")

rules_angular_dev_dependencies()

# Load protractor dependencies
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")

Expand All @@ -52,13 +47,3 @@ web_test_repositories()
load("//dev-infra/bazel/browsers:browser_repositories.bzl", "browser_repositories")

browser_repositories()

# Setup the rules_sass toolchain
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")

sass_repositories()

# Setup the skydoc toolchain
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")

skydoc_repositories()
4 changes: 2 additions & 2 deletions integration/bazel/src/hello-world/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package(default_visibility = ["//visibility:public"])

load("@npm//@bazel/concatjs:index.bzl", "karma_web_test_suite")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("@npm//@angular/bazel:index.bzl", "ng_package")
load("//tools:ng_ts_library.bzl", "ng_ts_library")

package(default_visibility = ["//visibility:public"])

sass_binary(
name = "hello-world-styles",
src = "hello-world.component.scss",
Expand Down
10 changes: 2 additions & 8 deletions modules/benchmarks/src/class_bindings/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
package(default_visibility = ["//modules/benchmarks:__subpackages__"])

load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//dev-infra/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark")

sass_binary(
name = "class_bindings_styles",
src = ":styles.scss",
)
package(default_visibility = ["//modules/benchmarks:__subpackages__"])

component_benchmark(
name = "benchmark",
Expand All @@ -28,5 +22,5 @@ component_benchmark(
exclude = ["**/*.perf-spec.ts"],
),
prefix = "",
styles = [":class_bindings_styles"],
styles = ["styles.css"],
)
51 changes: 0 additions & 51 deletions packages/bazel/package.bzl

This file was deleted.

7 changes: 2 additions & 5 deletions packages/bazel/src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

# BEGIN-DEV-ONLY
package(default_visibility = ["//packages/bazel:__subpackages__"])

Expand All @@ -6,11 +8,6 @@ filegroup(
srcs = glob(["*"]),
)

# For generating skydoc
exports_files(glob(["*.bzl"]))

load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")

nodejs_binary(
name = "modify_tsconfig",
data = [
Expand Down
10 changes: 1 addition & 9 deletions packages/bazel/src/ng_module.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -693,19 +693,11 @@ def _ng_module_impl(ctx):

return ts_providers_dict_to_struct(ts_providers)

local_deps_aspects = [node_modules_aspect, _collect_summaries_aspect]

# Workaround skydoc bug which assumes DEPS_ASPECTS is a str type
[local_deps_aspects.append(a) for a in DEPS_ASPECTS]

NG_MODULE_ATTRIBUTES = {
"srcs": attr.label_list(allow_files = [".ts"]),

# Note: DEPS_ASPECTS is already a list, we add the cast to workaround
# https://github.com/bazelbuild/skydoc/issues/21
"deps": attr.label_list(
doc = "Targets that are imported by this target",
aspects = local_deps_aspects,
aspects = [node_modules_aspect, _collect_summaries_aspect] + DEPS_ASPECTS,
),
"assets": attr.label_list(
doc = ".html and .css files needed by the Angular compiler",
Expand Down
12 changes: 6 additions & 6 deletions packages/bazel/src/ng_package/ng_package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ WELL_KNOWN_GLOBALS = {p: _global_name(p) for p in [
"rxjs/operators",
]}

# skydoc fails with type(depset()) so using "depset" here instead
# TODO(gregmagolan): clean this up
_DEPSET_TYPE = "depset"

def _compute_node_modules_root(ctx):
"""Computes the node_modules root from the node_modules and deps attributes.
Expand Down Expand Up @@ -282,7 +278,11 @@ def _flatten_paths(directory):
# Optionally can filter out files that do not belong to a specified package path.
def _filter_out_generated_files(files, extension, package_path = None):
result = []
files_list = files.to_list() if type(files) == _DEPSET_TYPE else files

# If `files` is a depset, convert it to a list. Note that we do not compare the type
# of files against a literal as per best practices within Bazel Starlark.
# https://docs.bazel.build/versions/main/skylark/lib/globals.html#type.
files_list = files.to_list() if type(files) == type(depset()) else files
for file in files_list:
# If the "package_path" parameter has been specified, filter out files
# that do not start with the specified package path.
Expand All @@ -298,7 +298,7 @@ def _filter_out_generated_files(files, extension, package_path = None):
return depset(result)

def _filter_js_inputs(all_inputs):
all_inputs_list = all_inputs.to_list() if type(all_inputs) == _DEPSET_TYPE else all_inputs
all_inputs_list = all_inputs.to_list() if type(all_inputs) == type(depset()) else all_inputs
return [
f
for f in all_inputs_list
Expand Down

0 comments on commit 12443ea

Please sign in to comment.