Skip to content

Commit 70c6899

Browse files
committed
refactor: move rules_sass into repo
1 parent 1092fe0 commit 70c6899

56 files changed

Lines changed: 5849 additions & 146 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 1 addition & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,12 @@
1-
# Enable debugging tests with --config=debug
2-
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
3-
4-
# By default, network access should be disabled unless explicitly granted for certain targets
5-
# using the `requires-network` tag. https://docs.bazel.build/versions/main/be/common-definitions.html
6-
build --sandbox_default_allow_network=false
7-
test --sandbox_default_allow_network=false
8-
9-
# Frozen lockfile
10-
common --lockfile_mode=error
111

122
# Required by `rules_ts`.
133
common --@aspect_rules_ts//ts:skipLibCheck=always
144
common --@aspect_rules_ts//ts:default_to_tsc_transpiler
15-
# TODO(josephperrott): remove this flag once we get to bazel version >7.
16-
common --incompatible_merge_fixed_and_default_shell_env
17-
18-
# Turn off legacy external runfiles
19-
build --nolegacy_external_runfiles
20-
run --nolegacy_external_runfiles
21-
test --nolegacy_external_runfiles
225

236
# The nested Bazel integration test workspace should not be analysed as part of
247
# Skyframe, but should also not be ignored in order to be able to glob for its files.
258
# TODO: Simplify this once https://github.com/bazelbuild/bazel/issues/12034 is fixed
269
build --deleted_packages=bazel/integration/tests/nested_bazel_workspaces/basic
2710
query --deleted_packages=bazel/integration/tests/nested_bazel_workspaces/basic
2811

29-
###############################
30-
# Filesystem interactions #
31-
###############################
32-
33-
# Create symlinks in the project:
34-
# - dist/bin for outputs
35-
# - dist/testlogs, dist/genfiles
36-
# - bazel-out
37-
build --symlink_prefix=dist/
38-
39-
# Write testing errors to log on test failure
40-
test --test_output=errors
41-
42-
# Do not build runfile forests by default. If an execution strategy relies on runfile
43-
# forests, the forest is created on-demand. See: https://github.com/bazelbuild/bazel/issues/6627
44-
# and https://github.com/bazelbuild/bazel/commit/03246077f948f2790a83520e7dccc2625650e6df. This
45-
# also helps with: https://github.com/bazelbuild/bazel/issues/4327#issuecomment-922106293.
46-
build --nobuild_runfile_links
47-
48-
# Turn on --incompatible_strict_action_env which was on by default
49-
# in Bazel 0.21.0 but turned off again in 0.22.0. Follow
50-
# https://github.com/bazelbuild/bazel/issues/7026 for more details.
51-
# This flag is needed to so that the bazel cache is not invalidated
52-
# when running bazel via `yarn bazel`.
53-
# See https://github.com/angular/angular/issues/27514.
54-
build --incompatible_strict_action_env
55-
run --incompatible_strict_action_env
56-
test --incompatible_strict_action_env
57-
58-
################################
59-
# Remote Execution Setup #
60-
################################
61-
62-
# Use the Angular team internal GCP instance for remote execution.
63-
build:remote --remote_instance_name=projects/internal-200822/instances/primary_instance
64-
build:remote --bes_instance_name=internal-200822
65-
66-
# Needed due to: https://github.com/bazelbuild/bazel/issues/7254
67-
build:remote --define=EXECUTOR=remote
68-
69-
# Since remote builds run within Google Cloud `k8`-based containers, we set the
70-
# host and target CPU accordingly.
71-
build:remote --cpu=k8
72-
build:remote --host_cpu=k8
73-
74-
# Bazel detects maximum number of jobs based on host resources.
75-
# Since we run remotely, we can increase this number significantly.
76-
common:remote --jobs=100
77-
78-
# Setup the remote build execution servers.
79-
build:remote --remote_cache=remotebuildexecution.googleapis.com
80-
build:remote --remote_executor=remotebuildexecution.googleapis.com
81-
build:remote --google_default_credentials
82-
83-
# Setup the toolchain and platform for the remote build execution. The platform
84-
# is provided by the shared dev-infra package and targets k8 remote containers.
85-
build:remote --extra_execution_platforms=//bazel/remote-execution:platform_with_network
86-
build:remote --host_platform=//bazel/remote-execution:platform_with_network
87-
build:remote --platforms=//bazel/remote-execution:platform_with_network
88-
89-
# Set remote caching settings
90-
build:remote --remote_accept_cached=true
91-
build:remote --remote_upload_local_results=false
92-
93-
# Enable Build Event Service
94-
build:remote --bes_backend=buildeventservice.googleapis.com
95-
build:remote --bes_instance_name=internal-200822
96-
build:remote --bes_header=X-Goog-User-Project=internal-200822
97-
build:remote --bes_results_url=https://source.cloud.google.com/results/invocations
98-
build:remote --bes_upload_mode=fully_async
99-
100-
# Use HTTP remote cache
101-
build:remote-cache --remote_cache=https://storage.googleapis.com/angular-team-cache
102-
build:remote-cache --remote_accept_cached=true
103-
build:remote-cache --remote_upload_local_results=false
104-
build:remote-cache --google_default_credentials
105-
106-
107-
# Additional flags added when running a "trusted build" with additional access
108-
build:trusted-build --remote_upload_local_results=true
109-
110-
################################
111-
# Release setup #
112-
################################
113-
114-
# Releases should always be stamped with version control info. The dev-infra project
115-
# does not have actual versions so we need to skip version stamping. Our NPM package
116-
# will have a version composed with the current SHA from the SCM stamping info.
117-
# Note: We usually would use the `ng-dev` tool directly, but that one would need to be
118-
# built with Bazel and building with Bazel inside the Bazel-invoked workspace status
119-
# script does not work. To workaround this, we have a `tsx`-based stamping script.
120-
# TODO: Consider using `ng-dev` directly if this is possible.
121-
build:release --workspace_status_command="pnpm --silent build-env-stamp --mode=release --include-version=false"
122-
build:release --stamp
123-
124-
####################################################
125-
# User bazel configuration
126-
# NOTE: This needs to be the *last* entry in the config to allow for it to override other
127-
# configuration in this file.
128-
####################################################
129-
130-
# Load any settings which are specific to the current user. Needs to be *last* statement
131-
# in this config, as the user configuration should be able to overwrite flags from this file.
132-
try-import .bazelrc.user
12+
import .bazelrc.common

.bazelrc.common

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# TODO(josephperrott): remove this flag once we get to bazel version >7.
2+
common --incompatible_merge_fixed_and_default_shell_env
3+
4+
# Turn off legacy external runfiles
5+
build --nolegacy_external_runfiles
6+
run --nolegacy_external_runfiles
7+
test --nolegacy_external_runfiles
8+
9+
# Enable debugging tests with --config=debug
10+
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
11+
12+
# By default, network access should be disabled unless explicitly granted for certain targets
13+
# using the `requires-network` tag. https://docs.bazel.build/versions/main/be/common-definitions.html
14+
build --sandbox_default_allow_network=false
15+
test --sandbox_default_allow_network=false
16+
17+
# Frozen lockfile
18+
common --lockfile_mode=error
19+
20+
###############################
21+
# Filesystem interactions #
22+
###############################
23+
24+
# Create symlinks in the project:
25+
# - dist/bin for outputs
26+
# - dist/testlogs, dist/genfiles
27+
# - bazel-out
28+
build --symlink_prefix=dist/
29+
30+
# Write testing errors to log on test failure
31+
test --test_output=errors
32+
33+
# Do not build runfile forests by default. If an execution strategy relies on runfile
34+
# forests, the forest is created on-demand. See: https://github.com/bazelbuild/bazel/issues/6627
35+
# and https://github.com/bazelbuild/bazel/commit/03246077f948f2790a83520e7dccc2625650e6df. This
36+
# also helps with: https://github.com/bazelbuild/bazel/issues/4327#issuecomment-922106293.
37+
build --nobuild_runfile_links
38+
39+
# Turn on --incompatible_strict_action_env which was on by default
40+
# in Bazel 0.21.0 but turned off again in 0.22.0. Follow
41+
# https://github.com/bazelbuild/bazel/issues/7026 for more details.
42+
# This flag is needed to so that the bazel cache is not invalidated
43+
# when running bazel via `yarn bazel`.
44+
# See https://github.com/angular/angular/issues/27514.
45+
build --incompatible_strict_action_env
46+
run --incompatible_strict_action_env
47+
test --incompatible_strict_action_env
48+
49+
################################
50+
# Remote Execution Setup #
51+
################################
52+
53+
# Use the Angular team internal GCP instance for remote execution.
54+
build:remote --remote_instance_name=projects/internal-200822/instances/primary_instance
55+
build:remote --bes_instance_name=internal-200822
56+
57+
# Needed due to: https://github.com/bazelbuild/bazel/issues/7254
58+
build:remote --define=EXECUTOR=remote
59+
60+
# Since remote builds run within Google Cloud `k8`-based containers, we set the
61+
# host and target CPU accordingly.
62+
build:remote --cpu=k8
63+
build:remote --host_cpu=k8
64+
65+
# Bazel detects maximum number of jobs based on host resources.
66+
# Since we run remotely, we can increase this number significantly.
67+
common:remote --jobs=100
68+
69+
# Setup the remote build execution servers.
70+
build:remote --remote_cache=remotebuildexecution.googleapis.com
71+
build:remote --remote_executor=remotebuildexecution.googleapis.com
72+
build:remote --google_default_credentials
73+
74+
# Setup the toolchain and platform for the remote build execution. The platform
75+
# is provided by the shared dev-infra package and targets k8 remote containers.
76+
build:remote --extra_execution_platforms=@devinfra//bazel/remote-execution:platform_with_network
77+
build:remote --host_platform=@devinfra//bazel/remote-execution:platform_with_network
78+
build:remote --platforms=@devinfra//bazel/remote-execution:platform_with_network
79+
80+
# Set remote caching settings
81+
build:remote --remote_accept_cached=true
82+
build:remote --remote_upload_local_results=false
83+
84+
# Enable Build Event Service
85+
build:remote --bes_backend=buildeventservice.googleapis.com
86+
build:remote --bes_instance_name=internal-200822
87+
build:remote --bes_header=X-Goog-User-Project=internal-200822
88+
build:remote --bes_results_url=https://source.cloud.google.com/results/invocations
89+
build:remote --bes_upload_mode=fully_async
90+
91+
# Use HTTP remote cache
92+
build:remote-cache --remote_cache=https://storage.googleapis.com/angular-team-cache
93+
build:remote-cache --remote_accept_cached=true
94+
build:remote-cache --remote_upload_local_results=false
95+
build:remote-cache --google_default_credentials
96+
97+
98+
# Additional flags added when running a "trusted build" with additional access
99+
build:trusted-build --remote_upload_local_results=true
100+
101+
################################
102+
# Release setup #
103+
################################
104+
105+
# Releases should always be stamped with version control info. The dev-infra project
106+
# does not have actual versions so we need to skip version stamping. Our NPM package
107+
# will have a version composed with the current SHA from the SCM stamping info.
108+
# Note: We usually would use the `ng-dev` tool directly, but that one would need to be
109+
# built with Bazel and building with Bazel inside the Bazel-invoked workspace status
110+
# script does not work. To workaround this, we have a `tsx`-based stamping script.
111+
# TODO: Consider using `ng-dev` directly if this is possible.
112+
build:release --workspace_status_command="pnpm --silent build-env-stamp --mode=release --include-version=false"
113+
build:release --stamp
114+
115+
####################################################
116+
# User bazel configuration
117+
# NOTE: This needs to be the *last* entry in the config to allow for it to override other
118+
# configuration in this file.
119+
####################################################
120+
121+
# Load any settings which are specific to the current user. Needs to be *last* statement
122+
# in this config, as the user configuration should be able to overwrite flags from this file.
123+
try-import .bazelrc.user
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Compiler Binaries
2+
3+
on:
4+
schedule:
5+
# Runs at minute 0 of every 6th hour (00:00, 06:00, 12:00, 18:00 UTC)
6+
- cron: '0 */6 * * *'
7+
workflow_dispatch: # Allows you to trigger it manually.
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, macos-15-intel, macos-latest]
15+
include:
16+
- os: ubuntu-latest
17+
bin_name: sass_linux_x64
18+
- os: macos-15-intel
19+
bin_name: sass_mac_x64
20+
- os: macos-latest
21+
bin_name: sass_mac_arm
22+
- os: ubuntu-24.04-arm
23+
bin_name: sass_linux_arm
24+
runs-on: ${{ matrix.os }}
25+
steps:
26+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
27+
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c # v1
28+
- run: dart pub get
29+
- run: mkdir -p bazel/rules/rules_sass/src/compiler/built/
30+
- run: dart compile exe ./bazel/rules/rules_sass/src/compiler/built/x_sass.dart -o bazel/rules/rules_sass/src/compiler/built/${{ matrix.bin_name }}
31+
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
32+
with:
33+
name: ${{ matrix.bin_name }}
34+
path: bazel/rules/rules_sass/src/compiler/built/${{ matrix.bin_name }}
35+
retention-days: 1
36+
37+
create_pr:
38+
needs: build
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
42+
with:
43+
persist-credentials: false
44+
- run: mkdir -p bazel/rules/rules_sass/src/compiler/built/
45+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
46+
with:
47+
path: bazel/rules/rules_sass/src/compiler/built/
48+
merge-multiple: true
49+
- name: chmod binaries
50+
run: chmod +x bazel/rules/rules_sass/src/compiler/built/*
51+
- name: Create Pull Request
52+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
53+
with:
54+
token: ${{ secrets.ANGULAR_ROBOT_ACCESS_TOKEN }}
55+
push-to-fork: 'angular-robot/rules_sass'
56+
delete-branch: true
57+
maintainer-can-modify: true
58+
branch: compiler-binary-updates
59+
committer: Angular Robot <angular-robot@google.com>
60+
author: Angular Robot <angular-robot@google.com>
61+
title: 'Update compiler binaries to latest version'
62+
commit-message: 'build: update compiler binaries to latest version'
63+
body: |
64+
Updated Sass compiler binaries.
65+
labels: |
66+
action: merge

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,5 @@ angular-*.tgz
6262
!.gemini/styleguide.md
6363
# GitHub App credentials
6464
gha-creds-*.json
65+
66+
**/.dart_tool/

MODULE.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ local_path_override(
2828
)
2929

3030
bazel_dep(name = "rules_sass")
31-
git_override(
31+
local_path_override(
3232
module_name = "rules_sass",
33-
commit = "23dbc96e739352b52f14b806d022aa16eb74e81c",
34-
remote = "https://github.com/angular/rules_sass.git",
33+
path = "bazel/rules/rules_sass",
3534
)
3635

3736
bazel_dep(name = "rules_angular")

bazel/rules/rules_angular/.bazelrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
# Flag for validation/demonstration of partial compilation usage.
22
build --flag_alias=partial_compilation=//src/ng_project/config:partial_compilation
33

4-
import ../../../.bazelrc
5-
6-
# Toolchain and platform related flags
7-
build:remote --extra_execution_platforms=@devinfra//bazel/remote-execution:platform_with_network
8-
build:remote --host_platform=@devinfra//bazel/remote-execution:platform_with_network
9-
build:remote --platforms=@devinfra//bazel/remote-execution:platform_with_network
4+
import ../../../.bazelrc.common
105

116
####################################################
127
# User bazel configuration

bazel/rules/rules_angular/MODULE.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ local_path_override(
1717
)
1818

1919
bazel_dep(name = "rules_sass", dev_dependency = True)
20-
git_override(
20+
local_path_override(
2121
module_name = "rules_sass",
22-
commit = "781c41bf7a48147bb20103e250f7215475e915a1",
23-
remote = "https://github.com/angular/rules_sass.git",
22+
path = "../rules_sass",
2423
)
2524

2625
bazel_dep(name = "devinfra", dev_dependency = True)

bazel/rules/rules_browsers/.bazelrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
try-import ../../../.bazelrc
2-
3-
# Toolchain and platform related flags
4-
build:remote --extra_execution_platforms=@devinfra//bazel/remote-execution:platform_with_network
5-
build:remote --host_platform=@devinfra//bazel/remote-execution:platform_with_network
6-
build:remote --platforms=@devinfra//bazel/remote-execution:platform_with_network
1+
try-import ../../../.bazelrc.common
72

83
####################################################
94
# User bazel configuration

bazel/rules/rules_browsers/MODULE.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@ local_path_override(
4040
)
4141

4242
bazel_dep(name = "rules_sass", dev_dependency = True)
43-
git_override(
43+
local_path_override(
4444
module_name = "rules_sass",
45-
commit = "781c41bf7a48147bb20103e250f7215475e915a1",
46-
remote = "https://github.com/angular/rules_sass.git",
45+
path = "../rules_sass",
4746
)
4847

4948
bazel_dep(name = "devinfra", dev_dependency = True)

0 commit comments

Comments
 (0)