diff --git a/aio/.gitignore b/aio/.gitignore index 52da86e74fb..94034a8d165 100644 --- a/aio/.gitignore +++ b/aio/.gitignore @@ -5,7 +5,6 @@ /tmp /out-tsc /bazel-out -/src/generated # Node /node_modules diff --git a/aio/BUILD.bazel b/aio/BUILD.bazel index 6e1b2181ad6..8c2fe273da1 100644 --- a/aio/BUILD.bazel +++ b/aio/BUILD.bazel @@ -6,10 +6,6 @@ load(":local_packages_util.bzl", "link_local_packages", "substitute_local_packag load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") load("//aio/scripts:local_server_test.bzl", "local_server_test") -# The write_source_files macro is used to write bazel outputs to the source tree and test that they are up to date. -# See: https://docs.aspect.build/aspect-build/bazel-lib/v0.5.0/docs/docs/write_source_files-docgen.html -load("@aspect_bazel_lib//lib:write_source_files.bzl", generated_files_test = "write_source_files") - exports_files([ "firebase.json", "ngsw-config.json", @@ -30,22 +26,6 @@ config_setting( }, ) -# Generate ngsw-config -npm_package_bin( - name = "ngsw-config", - outs = ["ngsw-config_generated.json"], - args = ["$@"], - tool = "//aio/scripts:build-ngsw-config", -) - -# Write ngsw-config to the source directory and test that it's up to date -generated_files_test( - name = "write-ngsw-config", - files = { - "ngsw-config.json": ":ngsw-config", - }, -) - # Run dgeni generation npm_package_bin( name = "dgeni", @@ -88,7 +68,6 @@ copy_to_directory( # All source and configuration files required to build the docs app APPLICATION_FILES = [ "angular.json", - "ngsw-config.json", "package.json", "tsconfig.app.json", "tsconfig.json", @@ -112,6 +91,7 @@ APPLICATION_DEPS = [ ":dgeni", ":stackblitz", ":example-zips", + "//aio/src/generated:ngsw-config", "@aio_npm//@angular-devkit/build-angular", "@aio_npm//@angular-eslint/builder", "@aio_npm//@angular/animations", diff --git a/aio/angular.json b/aio/angular.json index 8377f15c892..85282dd9509 100644 --- a/aio/angular.json +++ b/aio/angular.json @@ -32,7 +32,7 @@ "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", - "ngswConfigPath": "ngsw-config.json", + "ngswConfigPath": "src/generated/ngsw-config.json", "tsConfig": "tsconfig.app.json", "webWorkerTsConfig": "tsconfig.worker.json", "optimization": { diff --git a/aio/src/generated/BUILD.bazel b/aio/src/generated/BUILD.bazel new file mode 100644 index 00000000000..5417f92ef52 --- /dev/null +++ b/aio/src/generated/BUILD.bazel @@ -0,0 +1,11 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "npm_package_bin") + +package(default_visibility = ["//aio:__pkg__"]) + +# Generate ngsw-config +npm_package_bin( + name = "ngsw-config", + outs = ["ngsw-config.json"], + args = ["$@"], + tool = "//aio/scripts:build-ngsw-config", +)