diff --git a/.bazelrc b/.bazelrc index 629081c3deb5..174fe13d7304 100644 --- a/.bazelrc +++ b/.bazelrc @@ -58,11 +58,6 @@ build:release --stamp build:snapshot-build --workspace_status_command="pnpm -s ng-dev:stamp --mode=snapshot" build:snapshot-build --stamp -#################################### -# Bazel custom flags # -#################################### -build --flag_alias=partial_compilation=@rules_angular//src/ng_project/config:partial_compilation - ################################## # Always enable Ivy compilation # ################################## diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f41042b0b4d2..1cb336b2fcf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,52 +120,6 @@ jobs: JOB_NAME: 'Integration test' SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }} - linker_aot_tests: - runs-on: ubuntu-latest-4core - steps: - - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b - with: - cache-node-modules: true - - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - with: - google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} - - name: Install node modules - run: pnpm install --frozen-lockfile - - name: Run linker AOT tests - run: pnpm test-linker-aot - - uses: ./.github/actions/slack - if: failure() - with: - JOB_NAME: 'Link AOT test' - SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }} - - linker_jit_tests: - runs-on: ubuntu-latest-4core - steps: - - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b - with: - cache-node-modules: true - - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - with: - google_credential: ${{ secrets.RBE_TRUSTED_BUILDS_USER }} - - name: Install node modules - run: pnpm install --frozen-lockfile - - name: Run linker JIT tests - run: pnpm test-linker-jit - - uses: ./.github/actions/slack - if: failure() - with: - JOB_NAME: 'Link JIT test' - SLACK_BOT_TOKEN: ${{ secrets.ANGULAR_ROBOT_SLACK_TOKEN }} - test: runs-on: ubuntu-latest-16core steps: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c65f0bffcbc1..73543a97a9ac 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -99,38 +99,6 @@ jobs: - name: Run integration tests run: pnpm integration-tests - linker_aot_tests: - runs-on: ubuntu-latest-4core - steps: - - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b - with: - cache-node-modules: true - - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - - name: Install node modules - run: pnpm install --frozen-lockfile - - name: Run linker AOT tests - run: pnpm test-linker-aot - - linker_jit_tests: - runs-on: ubuntu-latest-4core - steps: - - name: Initialize environment - uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@e4bf37af223483ce00f9316d227fd62cd744dc4b - with: - cache-node-modules: true - - name: Setup Bazel - uses: angular/dev-infra/github-actions/bazel/setup@e4bf37af223483ce00f9316d227fd62cd744dc4b - - name: Setup Bazel RBE - uses: angular/dev-infra/github-actions/bazel/configure-remote@e4bf37af223483ce00f9316d227fd62cd744dc4b - - name: Install node modules - run: pnpm install --frozen-lockfile - - name: Run linker JIT tests - run: pnpm test-linker-jit - test: runs-on: ubuntu-latest-16core steps: diff --git a/WORKSPACE b/WORKSPACE index 1a6ad37ab764..baef7e2f1de5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -12,16 +12,6 @@ http_archive( urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.4/rules_nodejs-5.8.4.tar.gz"], ) -# Add sass rules -http_archive( - name = "io_bazel_rules_sass", - sha256 = "1c89680ca9cbbba33cb9cd462eb328e5782e14c0aa1286b794c71b5333385407", - strip_prefix = "rules_sass-1.68.0", - urls = [ - "https://github.com/bazelbuild/rules_sass/archive/1.68.0.zip", - ], -) - # Add skylib which contains common Bazel utilities. Note that `rules_nodejs` would also # bring in the skylib repository but with an older version that does not support shorthands # for declaring Bazel build setting flags. @@ -109,11 +99,6 @@ yarn_install( yarn_lock = "//tools/bazel/legacy-rnjs:yarn.lock", ) -# Setup the Sass rule repositories. -load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories") - -sass_repositories() - load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock") npm_translate_lock( @@ -295,3 +280,13 @@ rules_browsers_setup_1() load("@rules_browsers//setup:step_2.bzl", "rules_browsers_setup_2") rules_browsers_setup_2() + +git_repository( + name = "rules_sass", + commit = "a32f75ce6fa0c5370bd3f29a5306478c681ad124", + remote = "https://github.com/devversion/rules_sass.git", +) + +load("@rules_sass//src/toolchain:repositories.bzl", "setup_rules_sass") + +setup_rules_sass() diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel index 558e37aeaf2a..e971f88f0d87 100644 --- a/docs/BUILD.bazel +++ b/docs/BUILD.bazel @@ -43,6 +43,7 @@ ng_app( "//docs:node_modules/@stackblitz/sdk", "//docs:node_modules/moment", "//docs:node_modules/path-normalize", + "//src/material:tokens", ], ) diff --git a/docs/src/app/pages/component-viewer/component-styling.ts b/docs/src/app/pages/component-viewer/component-styling.ts index ada02b7d01a4..8d297b21d1c4 100644 --- a/docs/src/app/pages/component-viewer/component-styling.ts +++ b/docs/src/app/pages/component-viewer/component-styling.ts @@ -2,7 +2,7 @@ import {Component, inject, Injectable} from '@angular/core'; import {DomSanitizer} from '@angular/platform-browser'; import {HttpClient} from '@angular/common/http'; import {AsyncPipe} from '@angular/common'; -import {Observable} from 'rxjs'; +import {Observable, of} from 'rxjs'; import {map, shareReplay, switchMap} from 'rxjs/operators'; import {ComponentViewer} from './component-viewer'; import {DocItem} from '../../shared/documentation-items/documentation-items'; @@ -24,7 +24,11 @@ class TokenService { private _cache: Record> = {}; getTokenData(item: DocItem): Observable { - const url = `/docs-content/tokens/${item.packageName}/${item.id}/${item.id}.json`; + if (item.packageName !== 'material') { + console.error('Requested styling token data for package without token data.'); + return of({example: null, themes: []}); + } + const url = `/assets/tokens/tokens/${item.id}/${item.id}.json`; if (this._cache[url]) { return this._cache[url]; diff --git a/docs/src/assets/tokens/BUILD.bazel b/docs/src/assets/tokens/BUILD.bazel new file mode 100644 index 000000000000..986fef96e3fb --- /dev/null +++ b/docs/src/assets/tokens/BUILD.bazel @@ -0,0 +1,10 @@ +load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory") + +copy_to_directory( + name = "tokens", + srcs = ["//src/material:tokens"], + replace_prefixes = { + "src/material/": "", + }, + visibility = ["//docs:__pkg__"], +) diff --git a/package.json b/package.json index 158598aa8533..ef5bb250e5b9 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,9 @@ }, "version": "20.0.0-next.6", "dependencies": { - "@angular-devkit/architect-cli": "^0.2000.0-next.3", + "@angular-devkit/core": "catalog:", + "@angular-devkit/schematics": "catalog:", + "@angular-devkit/architect-cli": "catalog:", "@angular/animations": "catalog:", "@angular/common": "catalog:", "@angular/compiler": "catalog:", @@ -74,11 +76,6 @@ "zone.js": "~0.15.0" }, "devDependencies": { - "@angular-devkit/build-angular": "catalog:", - "@angular-devkit/core": "catalog:", - "@angular-devkit/schematics": "catalog:", - "@angular/build": "catalog:", - "@angular/cli": "catalog:", "@angular/compiler-cli": "catalog:", "@angular/localize": "catalog:", "@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#a9e4627eb45742d81068087a5b57a676104fe053", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1bc442671d90..726c2123ae40 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,9 +24,6 @@ catalogs: '@angular/animations': specifier: 20.0.0-next.5 version: 20.0.0-next.5 - '@angular/build': - specifier: 20.0.0-next.5 - version: 20.0.0-next.5 '@angular/cli': specifier: 20.0.0-next.5 version: 20.0.0-next.5 @@ -85,8 +82,14 @@ importers: .: dependencies: '@angular-devkit/architect-cli': - specifier: ^0.2000.0-next.3 + specifier: 'catalog:' version: 0.2000.0-next.5(patch_hash=6yxjg7dhfbtwlh5fb7noiwxhxa)(chokidar@4.0.3) + '@angular-devkit/core': + specifier: 'catalog:' + version: 20.0.0-next.5(chokidar@4.0.3) + '@angular-devkit/schematics': + specifier: 'catalog:' + version: 20.0.0-next.5(chokidar@4.0.3) '@angular/animations': specifier: 'catalog:' version: 20.0.0-next.5(@angular/common@20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(rxjs@6.6.7))(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0)) @@ -136,21 +139,6 @@ importers: specifier: ~0.15.0 version: 0.15.0 devDependencies: - '@angular-devkit/build-angular': - specifier: 'catalog:' - version: 20.0.0-next.5(nxkypkowz6xyee7hopver4ls5y) - '@angular-devkit/core': - specifier: 'catalog:' - version: 20.0.0-next.5(chokidar@4.0.3) - '@angular-devkit/schematics': - specifier: 'catalog:' - version: 20.0.0-next.5(chokidar@4.0.3) - '@angular/build': - specifier: 'catalog:' - version: 20.0.0-next.5(co6zyplo4qnunjexzkyjtoni3u) - '@angular/cli': - specifier: 'catalog:' - version: 20.0.0-next.5(@types/node@22.14.1)(chokidar@4.0.3) '@angular/compiler-cli': specifier: 'catalog:' version: 20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2) @@ -9656,97 +9644,6 @@ snapshots: transitivePeerDependencies: - chokidar - '@angular-devkit/build-angular@20.0.0-next.5(nxkypkowz6xyee7hopver4ls5y)': - dependencies: - '@ampproject/remapping': 2.3.0 - '@angular-devkit/architect': 0.2000.0-next.5(chokidar@4.0.3) - '@angular-devkit/build-webpack': 0.2000.0-next.5(chokidar@4.0.3)(webpack-dev-server@5.2.1(webpack@5.99.5(esbuild@0.25.2)))(webpack@5.99.5(esbuild@0.25.2)) - '@angular-devkit/core': 20.0.0-next.5(chokidar@4.0.3) - '@angular/build': 20.0.0-next.5(co6zyplo4qnunjexzkyjtoni3u) - '@angular/compiler-cli': 20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2) - '@babel/core': 7.26.10 - '@babel/generator': 7.27.0 - '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-split-export-declaration': 7.24.7 - '@babel/plugin-transform-async-generator-functions': 7.26.8(@babel/core@7.26.10) - '@babel/plugin-transform-async-to-generator': 7.25.9(@babel/core@7.26.10) - '@babel/plugin-transform-runtime': 7.26.10(@babel/core@7.26.10) - '@babel/preset-env': 7.26.9(@babel/core@7.26.10) - '@babel/runtime': 7.27.0 - '@discoveryjs/json-ext': 0.6.3 - '@ngtools/webpack': 20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(typescript@5.8.2)(webpack@5.99.5(esbuild@0.25.2)) - '@vitejs/plugin-basic-ssl': 2.0.0(vite@6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@1.10.2)) - ansi-colors: 4.1.3 - autoprefixer: 10.4.21(postcss@8.5.3) - babel-loader: 10.0.0(@babel/core@7.26.10)(webpack@5.99.5(esbuild@0.25.2)) - browserslist: 4.24.4 - copy-webpack-plugin: 13.0.0(webpack@5.99.5(esbuild@0.25.2)) - css-loader: 7.1.2(webpack@5.99.5(esbuild@0.25.2)) - esbuild-wasm: 0.25.2 - fast-glob: 3.3.3 - http-proxy-middleware: 3.0.3 - istanbul-lib-instrument: 6.0.3 - jsonc-parser: 3.3.1 - karma-source-map-support: 1.4.0 - less: 4.3.0 - less-loader: 12.2.0(less@4.3.0)(webpack@5.99.5(esbuild@0.25.2)) - license-webpack-plugin: 4.0.2(webpack@5.99.5(esbuild@0.25.2)) - loader-utils: 3.3.1 - mini-css-extract-plugin: 2.9.2(webpack@5.99.5(esbuild@0.25.2)) - open: 10.1.0 - ora: 5.4.1 - picomatch: 4.0.2 - piscina: 4.9.2 - postcss: 8.5.3 - postcss-loader: 8.1.1(postcss@8.5.3)(typescript@5.8.2)(webpack@5.99.5(esbuild@0.25.2)) - resolve-url-loader: 5.0.0 - rxjs: 7.8.2 - sass: 1.86.3 - sass-loader: 16.0.5(sass@1.86.3)(webpack@5.99.5(esbuild@0.25.2)) - semver: 7.7.1 - source-map-loader: 5.0.0(webpack@5.99.5(esbuild@0.25.2)) - source-map-support: 0.5.21 - terser: 5.39.0 - tree-kill: 1.2.2 - tslib: 2.8.1 - typescript: 5.8.2 - webpack: 5.99.5(esbuild@0.25.2) - webpack-dev-middleware: 7.4.2(webpack@5.99.5(esbuild@0.25.2)) - webpack-dev-server: 5.2.1(webpack@5.99.5(esbuild@0.25.2)) - webpack-merge: 6.0.1 - webpack-subresource-integrity: 5.1.0(webpack@5.99.5(esbuild@0.25.2)) - optionalDependencies: - '@angular/core': 20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0) - '@angular/localize': 20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/compiler@20.0.0-next.5) - '@angular/platform-browser': 20.0.0-next.5(@angular/animations@20.0.0-next.5(@angular/common@20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(rxjs@6.6.7))(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0)))(@angular/common@20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(rxjs@6.6.7))(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0)) - '@angular/platform-server': 20.0.0-next.5(7ldc76mrnn32nlj5qb6nodvy7i) - '@angular/ssr': 20.0.0-next.5(@angular/common@20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(rxjs@6.6.7))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(@angular/platform-server@20.0.0-next.5(7ldc76mrnn32nlj5qb6nodvy7i))(@angular/router@20.0.0-next.5(y6o4mmzwixcdow4qwhwxqkbyxe)) - esbuild: 0.25.2 - karma: 6.4.4 - protractor: 7.0.0 - transitivePeerDependencies: - - '@angular/compiler' - - '@rspack/core' - - '@swc/core' - - '@types/node' - - bufferutil - - chokidar - - debug - - html-webpack-plugin - - jiti - - lightningcss - - node-sass - - sass-embedded - - stylus - - sugarss - - supports-color - - tsx - - uglify-js - - utf-8-validate - - vite - - webpack-cli - - yaml - '@angular-devkit/build-angular@20.0.0-next.5(xomw6as5tm6jityr54yfpr3pvu)': dependencies: '@ampproject/remapping': 2.3.0 @@ -9935,61 +9832,6 @@ snapshots: - '@angular/compiler-cli' - supports-color - '@angular/build@20.0.0-next.5(co6zyplo4qnunjexzkyjtoni3u)': - dependencies: - '@ampproject/remapping': 2.3.0 - '@angular-devkit/architect': 0.2000.0-next.5(chokidar@4.0.3) - '@angular/compiler': 20.0.0-next.5 - '@angular/compiler-cli': 20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2) - '@babel/core': 7.26.10 - '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-split-export-declaration': 7.24.7 - '@inquirer/confirm': 5.1.9(@types/node@22.14.1) - '@vitejs/plugin-basic-ssl': 2.0.0(vite@6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@1.10.2)) - beasties: 0.3.2 - browserslist: 4.24.4 - esbuild: 0.25.2 - https-proxy-agent: 7.0.6(supports-color@10.0.0) - istanbul-lib-instrument: 6.0.3 - jsonc-parser: 3.3.1 - listr2: 8.2.5 - magic-string: 0.30.17 - mrmime: 2.0.1 - parse5-html-rewriting-stream: 7.0.0 - picomatch: 4.0.2 - piscina: 4.9.2 - rollup: 4.39.0 - sass: 1.86.3 - semver: 7.7.1 - source-map-support: 0.5.21 - tinyglobby: 0.2.12 - tslib: 2.8.1 - typescript: 5.8.2 - vite: 6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@1.10.2) - watchpack: 2.4.2 - optionalDependencies: - '@angular/core': 20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0) - '@angular/localize': 20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/compiler@20.0.0-next.5) - '@angular/platform-browser': 20.0.0-next.5(@angular/animations@20.0.0-next.5(@angular/common@20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(rxjs@6.6.7))(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0)))(@angular/common@20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(rxjs@6.6.7))(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0)) - '@angular/platform-server': 20.0.0-next.5(7ldc76mrnn32nlj5qb6nodvy7i) - '@angular/ssr': 20.0.0-next.5(@angular/common@20.0.0-next.5(@angular/compiler-cli@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(typescript@5.8.2))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(rxjs@6.6.7))(@angular/core@20.0.0-next.5(@angular/compiler@20.0.0-next.5)(rxjs@6.6.7)(zone.js@0.15.0))(@angular/platform-server@20.0.0-next.5(7ldc76mrnn32nlj5qb6nodvy7i))(@angular/router@20.0.0-next.5(y6o4mmzwixcdow4qwhwxqkbyxe)) - karma: 6.4.4 - less: 4.3.0 - lmdb: 3.2.6 - postcss: 8.5.3 - transitivePeerDependencies: - - '@types/node' - - chokidar - - jiti - - lightningcss - - sass-embedded - - stylus - - sugarss - - supports-color - - terser - - tsx - - yaml - '@angular/build@20.0.0-next.5(yqu5gitk2ajo26skr7tftlt3jm)': dependencies: '@ampproject/remapping': 2.3.0 @@ -12484,10 +12326,6 @@ snapshots: '@ungap/structured-clone@1.3.0': {} - '@vitejs/plugin-basic-ssl@2.0.0(vite@6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@1.10.2))': - dependencies: - vite: 6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@1.10.2) - '@vitejs/plugin-basic-ssl@2.0.0(vite@6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@2.7.1))': dependencies: vite: 6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@2.7.1) @@ -19874,20 +19712,6 @@ snapshots: unist-util-stringify-position: 1.1.2 vfile-message: 1.1.1 - vite@6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@1.10.2): - dependencies: - esbuild: 0.25.2 - postcss: 8.5.3 - rollup: 4.39.0 - optionalDependencies: - '@types/node': 22.14.1 - fsevents: 2.3.3 - jiti: 1.21.7 - less: 4.3.0 - sass: 1.86.3 - terser: 5.39.0 - yaml: 1.10.2 - vite@6.2.5(@types/node@22.14.1)(jiti@1.21.7)(less@4.3.0)(sass@1.86.3)(terser@5.39.0)(yaml@2.7.1): dependencies: esbuild: 0.25.2 diff --git a/src/cdk/coercion/BUILD.bazel b/src/cdk/coercion/BUILD.bazel index 466495f4ea93..af96c507b219 100644 --- a/src/cdk/coercion/BUILD.bazel +++ b/src/cdk/coercion/BUILD.bazel @@ -1,5 +1,5 @@ -load("//tools:defaults.bzl", "karma_web_test_suite", "markdown_to_html") -load("//tools:defaults2.bzl", "ts_project") +load("//tools:defaults.bzl", "markdown_to_html") +load("//tools:defaults2.bzl", "ng_web_test_suite", "ts_project") package(default_visibility = ["//visibility:public"]) @@ -27,7 +27,7 @@ ts_project( ], ) -karma_web_test_suite( +ng_web_test_suite( name = "unit_tests", deps = [":unit_test_sources"], ) diff --git a/src/cdk/keycodes/BUILD.bazel b/src/cdk/keycodes/BUILD.bazel index 17458595420c..14d9ee796e3c 100644 --- a/src/cdk/keycodes/BUILD.bazel +++ b/src/cdk/keycodes/BUILD.bazel @@ -1,5 +1,5 @@ -load("//tools:defaults.bzl", "karma_web_test_suite", "markdown_to_html") -load("//tools:defaults2.bzl", "ng_project", "ts_project") +load("//tools:defaults.bzl", "markdown_to_html") +load("//tools:defaults2.bzl", "ng_project", "ng_web_test_suite", "ts_project") package(default_visibility = ["//visibility:public"]) @@ -31,7 +31,7 @@ ts_project( ], ) -karma_web_test_suite( +ng_web_test_suite( name = "unit_tests", deps = [":unit_test_sources"], ) diff --git a/src/components-examples/BUILD.bazel b/src/components-examples/BUILD.bazel index 0adf4047646a..bcaba1551c54 100644 --- a/src/components-examples/BUILD.bazel +++ b/src/components-examples/BUILD.bazel @@ -42,9 +42,6 @@ package_docs_content( "//src/cdk:overviews": "overviews/cdk", "//src/material:overviews": "overviews/material", - # Package the extracted token information into the docs content. - "//src/material:tokens": "tokens/material", - # Package the API docs for the Material and CDK package into the docs-content "//src:api-docs": "api-docs", diff --git a/src/dev-app/BUILD.bazel b/src/dev-app/BUILD.bazel index 400d2b5b5a06..cf79498ef5d1 100644 --- a/src/dev-app/BUILD.bazel +++ b/src/dev-app/BUILD.bazel @@ -109,6 +109,8 @@ esbuild( ] + ["%s:index.js" % e for e in ALL_EXAMPLES], minify = True, platform = "browser", + sourcemap = "linked", + sources_content = True, splitting = True, # We cannot use `ES2017` or higher as that would result in `async/await` not being downleveled. # ZoneJS needs to be able to intercept these as otherwise change detection would not work properly. diff --git a/src/e2e-app/test_suite.bzl b/src/e2e-app/test_suite.bzl index f0a9a9dee8c1..d95e59c8d984 100644 --- a/src/e2e-app/test_suite.bzl +++ b/src/e2e-app/test_suite.bzl @@ -1,4 +1,4 @@ -load("//tools:defaults.bzl", "protractor_web_test_suite") +load("//tools:defaults2.bzl", "protractor_web_test_suite") def e2e_test_suite(name, tags = ["e2e"], deps = []): protractor_web_test_suite( diff --git a/src/material/core/theming/tests/test-theming-bundle.scss b/src/material/core/theming/tests/test-theming-bundle.scss index 27a1e3920ac6..4763e52c9446 100644 --- a/src/material/core/theming/tests/test-theming-bundle.scss +++ b/src/material/core/theming/tests/test-theming-bundle.scss @@ -1,7 +1,7 @@ // Imports the theming bundle. Needs to be an absolute bin-dir import path as on Windows, // runfiles are not symlinked, so the Sass compilation happens in the workspace directory // with the include paths being set to the `bazel-bin` directory. -@use 'src/material' as mat; +@use '../../../index' as mat; // Disable theme style duplication warnings. This test intentionally generates // the same themes multiple times. diff --git a/src/universal-app/BUILD.bazel b/src/universal-app/BUILD.bazel index 6ede2638b7fe..4eecc7db6647 100644 --- a/src/universal-app/BUILD.bazel +++ b/src/universal-app/BUILD.bazel @@ -1,7 +1,7 @@ load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_run_binary") -load("//tools:defaults.bzl", "protractor_web_test_suite", "sass_binary") -load("//tools:defaults2.bzl", "http_server", "ng_project", "ts_project") +load("//tools:defaults.bzl", "sass_binary") +load("//tools:defaults2.bzl", "http_server", "ng_project", "protractor_web_test_suite", "ts_project") load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config") load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild") load("//src/cdk:config.bzl", "CDK_TARGETS") diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 0c1e4461e71c..04a0ab442d65 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -1,4 +1,3 @@ -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config") package(default_visibility = ["//visibility:public"]) @@ -18,31 +17,6 @@ rules_js_tsconfig( ], ) -# Bazel config setting that matches if the partial compilation is enabled. -config_setting( - name = "partial_compilation_enabled", - flag_values = { - "@rules_angular//src/ng_project/config:partial_compilation": "True", - }, -) - -# Command line flag that can be specified to force the JIT compilation to be used for tests -# with partial compilation. By default, tests are processed with the linker at build time. -bool_flag( - name = "force_partial_jit_compilation", - build_setting_default = False, -) - -# Config setting that matches if the force JIT compilation build setting is enabled. -# This setting needs to be used in combination of the partial compilation build setting. -config_setting( - name = "force_partial_jit_compilation_enabled", - flag_values = { - "@rules_angular//src/ng_project/config:partial_compilation": "True", - ":force_partial_jit_compilation": "True", - }, -) - # Detect if the build is running with stamping enabled. config_setting( name = "stamp", diff --git a/tools/bazel/web_test_suite.bzl b/tools/bazel/web_test_suite.bzl new file mode 100644 index 000000000000..c2177119ffe1 --- /dev/null +++ b/tools/bazel/web_test_suite.bzl @@ -0,0 +1,70 @@ +load("@rules_browsers//src/wtr:index.bzl", "wtr_test") +load("@devinfra//bazel/spec-bundling:index_rjs.bzl", "spec_bundle") + +def _web_test(name, tags = [], deps = [], bootstrap = [], **kwargs): + spec_bundle( + name = "%s_bundle" % name, + srcs = ["//src:build-tsconfig"], + bootstrap = bootstrap, + deps = deps, + config = { + "resolveExtensions": [".js"], + "tsconfig": "./src/bazel-tsconfig-build.json", + }, + ) + + test_tags = ["partial-compilation-integration"] + tags + + wtr_test( + name = name, + deps = [":%s_bundle" % name], + tags = test_tags, + **kwargs + ) + +def ng_web_test_suite(deps = [], static_css = [], **kwargs): + # Always include a prebuilt theme in the test suite because otherwise tests, which depend on CSS + # that is needed for measuring, will unexpectedly fail. Also always adding a prebuilt theme + # reduces the amount of setup that is needed to create a test suite Bazel target. Note that the + # prebuilt theme will be also added to CDK test suites but shouldn't affect anything. + static_css = static_css + [ + "//src/material/prebuilt-themes:azure-blue", + ] + + bootstrap = [] + + # Workaround for https://github.com/bazelbuild/rules_typescript/issues/301 + # Since some of our tests depend on CSS files which are not part of the `ng_project` rule, + # we need to somehow load static CSS files within Karma (e.g. overlay prebuilt). Those styles + # are required for successful test runs. Since the `karma_web_test_suite` rule currently only + # allows JS files to be included and served within Karma, we need to create a JS file that + # loads the given CSS file. + for css_label in static_css: + css_id = "static-css-file-%s" % (css_label.replace("/", "_").replace(":", "-")) + bootstrap.append(":%s" % css_id) + + native.genrule( + name = css_id, + srcs = [css_label], + outs = ["%s.css.init.js" % css_id], + output_to_bindir = True, + cmd = """ + files=($(execpaths %s)) + # Escape all double-quotes so that the content can be safely inlined into the + # JS template. Note that it needs to be escaped a second time because the string + # will be evaluated first in Bash and will then be stored in the JS output. + css_content=$$(cat $${files[0]} | sed 's/"/\\\\"/g') + js_template='var cssElement = document.createElement("style"); \ + cssElement.type = "text/css"; \ + cssElement.innerHTML = "'"$$css_content"'"; \ + document.head.appendChild(cssElement);' + echo "$$js_template" > $@ + """ % css_label, + ) + + _web_test( + # Depend on our custom test initialization script. This needs to be the first dependency. + deps = deps, + bootstrap = ["//test:angular_test_init"] + bootstrap, + **kwargs + ) diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 88002e038bfb..e93acc27e373 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -2,15 +2,14 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar") load("@build_bazel_rules_nodejs//:index.bzl", _pkg_npm = "pkg_npm") -load("@io_bazel_rules_sass//:defs.bzl", _sass_binary = "sass_binary", _sass_library = "sass_library") +load("@rules_sass//src:index.bzl", _sass_binary = "sass_binary", _sass_library = "sass_library") load("@npm//@angular/bazel:index.bzl", _ng_package = "ng_package") load("//:packages.bzl", "NO_STAMP_NPM_PACKAGE_SUBSTITUTIONS", "NPM_PACKAGE_SUBSTITUTIONS") load("//:pkg-externals.bzl", "PKG_EXTERNALS") load("//tools/markdown-to-html:index.bzl", _markdown_to_html = "markdown_to_html") load("//tools/extract-tokens:index.bzl", _extract_tokens = "extract_tokens") load("//tools/bazel:ng_package_interop.bzl", "ng_package_interop") -load("//tools:defaults2.bzl", "spec_bundle", _karma_web_test_suite = "karma_web_test_suite") -load("@rules_browsers//src/protractor_test:index.bzl", "protractor_test") +load("//tools:defaults2.bzl", _ng_web_test_suite = "ng_web_test_suite") npmPackageSubstitutions = select({ "//tools:stamp": NPM_PACKAGE_SUBSTITUTIONS, @@ -20,13 +19,17 @@ npmPackageSubstitutions = select({ # Re-exports to simplify build file load statements markdown_to_html = _markdown_to_html extract_tokens = _extract_tokens -karma_web_test_suite = _karma_web_test_suite +ng_web_test_suite = _ng_web_test_suite def sass_binary(sourcemap = False, include_paths = [], **kwargs): _sass_binary( sourcemap = sourcemap, - include_paths = include_paths + ["external/npm/node_modules"], - compiler = "//tools/sass:compiler", + include_paths = include_paths, + module_mappings = { + "@angular/cdk": "/".join([".."] * (native.package_name().count("/") + 1)) + "/src/cdk", + "@angular/material": "/".join([".."] * (native.package_name().count("/") + 1)) + "/src/material", + "@angular/material-experimental": "/".join([".."] * (native.package_name().count("/") + 1)) + "/src/material-experimental", + }, **kwargs ) @@ -118,89 +121,3 @@ def pkg_npm(name, visibility = None, **kwargs): visibility = visibility, **kwargs ) - - pkg_tar( - name = name + "_archive", - srcs = [":%s" % name], - package_dir = "package/", - extension = "tar.gz", - strip_prefix = "./%s" % name, - # Target should not build on CI unless it is explicitly requested. - tags = ["manual"], - visibility = visibility, - ) - -def protractor_web_test_suite(name, deps, **kwargs): - spec_bundle( - name = "%s_bundle" % name, - deps = deps, - external = ["protractor", "selenium-webdriver"], - ) - - protractor_test( - name = name, - deps = [":%s_bundle" % name], - extra_config = { - "useAllAngular2AppRoots": True, - "allScriptsTimeout": 120000, - "getPageTimeout": 120000, - "jasmineNodeOpts": { - "defaultTimeoutInterval": 120000, - }, - # Since we want to use async/await we don't want to mix up with selenium's promise - # manager. In order to enforce this, we disable the promise manager. - "SELENIUM_PROMISE_MANAGER": False, - }, - data = [ - "//:node_modules/protractor", - "//:node_modules/selenium-webdriver", - ], - **kwargs - ) - -def ng_web_test_suite(deps = [], static_css = [], **kwargs): - # Always include a prebuilt theme in the test suite because otherwise tests, which depend on CSS - # that is needed for measuring, will unexpectedly fail. Also always adding a prebuilt theme - # reduces the amount of setup that is needed to create a test suite Bazel target. Note that the - # prebuilt theme will be also added to CDK test suites but shouldn't affect anything. - static_css = static_css + [ - "//src/material/prebuilt-themes:azure-blue", - ] - - bootstrap = [] - - # Workaround for https://github.com/bazelbuild/rules_typescript/issues/301 - # Since some of our tests depend on CSS files which are not part of the `ng_project` rule, - # we need to somehow load static CSS files within Karma (e.g. overlay prebuilt). Those styles - # are required for successful test runs. Since the `karma_web_test_suite` rule currently only - # allows JS files to be included and served within Karma, we need to create a JS file that - # loads the given CSS file. - for css_label in static_css: - css_id = "static-css-file-%s" % (css_label.replace("/", "_").replace(":", "-")) - bootstrap.append(":%s" % css_id) - - native.genrule( - name = css_id, - srcs = [css_label], - outs = ["%s.css.init.js" % css_id], - output_to_bindir = True, - cmd = """ - files=($(execpaths %s)) - # Escape all double-quotes so that the content can be safely inlined into the - # JS template. Note that it needs to be escaped a second time because the string - # will be evaluated first in Bash and will then be stored in the JS output. - css_content=$$(cat $${files[0]} | sed 's/"/\\\\"/g') - js_template='var cssElement = document.createElement("style"); \ - cssElement.type = "text/css"; \ - cssElement.innerHTML = "'"$$css_content"'"; \ - document.head.appendChild(cssElement);' - echo "$$js_template" > $@ - """ % css_label, - ) - - karma_web_test_suite( - # Depend on our custom test initialization script. This needs to be the first dependency. - deps = deps, - bootstrap = ["//test:angular_test_init"] + bootstrap, - **kwargs - ) diff --git a/tools/defaults2.bzl b/tools/defaults2.bzl index 04c96b7dfbdd..dc5e008b108c 100644 --- a/tools/defaults2.bzl +++ b/tools/defaults2.bzl @@ -1,14 +1,16 @@ load("@aspect_rules_jasmine//jasmine:defs.bzl", _jasmine_test = "jasmine_test") -load("//tools/bazel:ts_project_interop.bzl", _ts_project = "ts_project") -load("//tools/bazel:module_name.bzl", "compute_module_name") load("@aspect_rules_js//npm:defs.bzl", _npm_package = "npm_package") -load("@rules_angular//src/ng_project:index.bzl", _ng_project = "ng_project") -load("@devinfra//bazel/spec-bundling:index_rjs.bzl", _spec_bundle = "spec_bundle") -load("@rules_browsers//src/wtr:index.bzl", "wtr_test") load("@devinfra//bazel/http-server:index.bzl", _http_server = "http_server") +load("@devinfra//bazel/spec-bundling:index_rjs.bzl", _spec_bundle = "spec_bundle") +load("@rules_angular//src/ng_project:index.bzl", _ng_project = "ng_project") +load("@rules_browsers//src/protractor_test:index.bzl", "protractor_test") +load("//tools/bazel:module_name.bzl", "compute_module_name") +load("//tools/bazel:ts_project_interop.bzl", _ts_project = "ts_project") +load("//tools/bazel:web_test_suite.bzl", _ng_web_test_suite = "ng_web_test_suite") spec_bundle = _spec_bundle http_server = _http_server +ng_web_test_suite = _ng_web_test_suite def npm_package(**kwargs): _npm_package(**kwargs) @@ -79,23 +81,30 @@ def jasmine_test(name, data = [], args = [], **kwargs): **kwargs ) -def karma_web_test_suite(name, tags = [], deps = [], bootstrap = [], **kwargs): +def protractor_web_test_suite(name, deps, **kwargs): spec_bundle( name = "%s_bundle" % name, - srcs = ["//src:build-tsconfig"], - bootstrap = bootstrap, deps = deps, - config = { - "resolveExtensions": [".js"], - "tsconfig": "./src/bazel-tsconfig-build.json", - }, + external = ["protractor", "selenium-webdriver"], ) - test_tags = ["partial-compilation-integration"] + tags - - wtr_test( + protractor_test( name = name, deps = [":%s_bundle" % name], - tags = test_tags, + extra_config = { + "useAllAngular2AppRoots": True, + "allScriptsTimeout": 120000, + "getPageTimeout": 120000, + "jasmineNodeOpts": { + "defaultTimeoutInterval": 120000, + }, + # Since we want to use async/await we don't want to mix up with selenium's promise + # manager. In order to enforce this, we disable the promise manager. + "SELENIUM_PROMISE_MANAGER": False, + }, + data = [ + "//:node_modules/protractor", + "//:node_modules/selenium-webdriver", + ], **kwargs ) diff --git a/tools/extract-tokens/index.bzl b/tools/extract-tokens/index.bzl index 863ea7619e6a..8428d2fef233 100644 --- a/tools/extract-tokens/index.bzl +++ b/tools/extract-tokens/index.bzl @@ -16,23 +16,23 @@ def _extract_tokens(ctx): expected_outputs = [output_file_name] # Pass the necessary information like the package name and files to the script. - args.add(ctx.label.package, output_file_name) + args.add(ctx.label.package) + args.add(output_file_name.short_path) for input_file in input_files: - args.add(input_file.path) + args.add(input_file.short_path) # Run the token extraction executable. Note that we specify the outputs because Bazel # can throw an error if the script didn't generate the required outputs. ctx.actions.run( inputs = input_files, env = { - # Not needed as we operate with source files; not inside `bazel-bin`. - "JS_BINARY__NO_CD_BINDIR": "1", + "BAZEL_BINDIR": ctx.bin_dir.path, }, executable = ctx.executable._extract_tokens, outputs = expected_outputs, arguments = [args], - progress_message = "ExtractTokens", + progress_message = "Extracting theme tokens %s:%s" % (ctx.label.package, ctx.attr.name), ) return DefaultInfo(files = depset(expected_outputs))