mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +08:00
build: use ts_json_schema's ts output directly
This PR changes ts_json_schema to not create a ts_library rule for the json schema, and instead let consuming ts_libraries use and compile the resulting .ts files themselves. This is needed in order to maintain the module_name of the consuming libraries on the .ts files resulting from json compilation.
This commit is contained in:
parent
b668cacd45
commit
7c746a444b
@ -18,7 +18,28 @@ ts_library(
|
|||||||
"**/*_spec.ts",
|
"**/*_spec.ts",
|
||||||
"**/*_spec_large.ts",
|
"**/*_spec_large.ts",
|
||||||
],
|
],
|
||||||
),
|
) + [
|
||||||
|
"//packages/angular/cli:lib/config/schema.ts",
|
||||||
|
"//packages/angular/cli:commands/analytics.ts",
|
||||||
|
"//packages/angular/cli:commands/add.ts",
|
||||||
|
"//packages/angular/cli:commands/build.ts",
|
||||||
|
"//packages/angular/cli:commands/deploy.ts",
|
||||||
|
"//packages/angular/cli:commands/config.ts",
|
||||||
|
"//packages/angular/cli:commands/deprecated.ts",
|
||||||
|
"//packages/angular/cli:commands/doc.ts",
|
||||||
|
"//packages/angular/cli:commands/e2e.ts",
|
||||||
|
"//packages/angular/cli:commands/easter-egg.ts",
|
||||||
|
"//packages/angular/cli:commands/generate.ts",
|
||||||
|
"//packages/angular/cli:commands/help.ts",
|
||||||
|
"//packages/angular/cli:commands/lint.ts",
|
||||||
|
"//packages/angular/cli:commands/new.ts",
|
||||||
|
"//packages/angular/cli:commands/serve.ts",
|
||||||
|
"//packages/angular/cli:commands/test.ts",
|
||||||
|
"//packages/angular/cli:commands/update.ts",
|
||||||
|
"//packages/angular/cli:commands/version.ts",
|
||||||
|
"//packages/angular/cli:commands/run.ts",
|
||||||
|
"//packages/angular/cli:commands/xi18n.ts",
|
||||||
|
],
|
||||||
data = glob([
|
data = glob([
|
||||||
"**/*.json",
|
"**/*.json",
|
||||||
"**/*.md",
|
"**/*.md",
|
||||||
@ -26,7 +47,6 @@ ts_library(
|
|||||||
module_name = "@angular/cli",
|
module_name = "@angular/cli",
|
||||||
# strict_checks = False,
|
# strict_checks = False,
|
||||||
deps = [
|
deps = [
|
||||||
":command_schemas",
|
|
||||||
"//packages/angular_devkit/architect",
|
"//packages/angular_devkit/architect",
|
||||||
"//packages/angular_devkit/architect:node",
|
"//packages/angular_devkit/architect:node",
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
@ -45,33 +65,6 @@ ts_library(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
ts_library(
|
|
||||||
name = "command_schemas",
|
|
||||||
srcs = [],
|
|
||||||
deps = [
|
|
||||||
":add_schema",
|
|
||||||
":analytics_schema",
|
|
||||||
":build_schema",
|
|
||||||
":cli_schema",
|
|
||||||
":config_schema",
|
|
||||||
":deploy_schema",
|
|
||||||
":deprecated_schema",
|
|
||||||
":doc_schema",
|
|
||||||
":e2e_schema",
|
|
||||||
":easter_egg_schema",
|
|
||||||
":generate_schema",
|
|
||||||
":help_schema",
|
|
||||||
":lint_schema",
|
|
||||||
":new_schema",
|
|
||||||
":run_schema",
|
|
||||||
":serve_schema",
|
|
||||||
":test_schema",
|
|
||||||
":update_schema",
|
|
||||||
":version_schema",
|
|
||||||
":xi18n_schema",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
ts_json_schema(
|
ts_json_schema(
|
||||||
name = "cli_schema",
|
name = "cli_schema",
|
||||||
src = "lib/config/schema.json",
|
src = "lib/config/schema.json",
|
||||||
|
@ -24,9 +24,10 @@ ts_library(
|
|||||||
"**/*_spec.ts",
|
"**/*_spec.ts",
|
||||||
"**/*_spec_large.ts",
|
"**/*_spec_large.ts",
|
||||||
],
|
],
|
||||||
),
|
) + [
|
||||||
|
"//packages/angular/pwa:pwa/schema.ts",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":pwa_schema",
|
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/schematics",
|
"//packages/angular_devkit/schematics",
|
||||||
"@npm//@types/node",
|
"@npm//@types/node",
|
||||||
|
@ -49,9 +49,6 @@ ts_library(
|
|||||||
# strict_checks = False,
|
# strict_checks = False,
|
||||||
deps = [
|
deps = [
|
||||||
":architect",
|
":architect",
|
||||||
":builder_builders_schema",
|
|
||||||
":builder_input_schema",
|
|
||||||
":builder_output_schema",
|
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/core:node",
|
"//packages/angular_devkit/core:node",
|
||||||
"@npm//@types/node",
|
"@npm//@types/node",
|
||||||
@ -67,15 +64,17 @@ ts_library(
|
|||||||
"**/*_spec.ts",
|
"**/*_spec.ts",
|
||||||
"**/*_spec_large.ts",
|
"**/*_spec_large.ts",
|
||||||
],
|
],
|
||||||
),
|
) + [
|
||||||
|
"//packages/angular_devkit/architect:src/input-schema.ts",
|
||||||
|
"//packages/angular_devkit/architect:src/output-schema.ts",
|
||||||
|
"//packages/angular_devkit/architect:src/builders-schema.ts",
|
||||||
|
"//packages/angular_devkit/architect:src/progress-schema.ts",
|
||||||
|
],
|
||||||
# strict_checks = False,
|
# strict_checks = False,
|
||||||
data = glob(["**/*.json"]),
|
data = glob(["**/*.json"]),
|
||||||
module_name = "@angular-devkit/architect",
|
module_name = "@angular-devkit/architect",
|
||||||
module_root = "src/index.d.ts",
|
module_root = "src/index.d.ts",
|
||||||
deps = [
|
deps = [
|
||||||
":builder_input_schema",
|
|
||||||
":builder_output_schema",
|
|
||||||
":progress_schema",
|
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/core:node",
|
"//packages/angular_devkit/core:node",
|
||||||
"@npm//@types/node",
|
"@npm//@types/node",
|
||||||
|
@ -12,7 +12,7 @@ load("//tools:ts_json_schema.bzl", "ts_json_schema")
|
|||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
# Create a list of Tuple("path/file.json", "path_file") to be used as rules
|
# Create a list of Tuple("path/file.json", "path_file") to be used as rules
|
||||||
ALL_SCHEMA_TARGETS_PAIR = [
|
ALL_SCHEMA_TARGETS = [
|
||||||
(
|
(
|
||||||
x,
|
x,
|
||||||
x.replace("/", "_").replace("-", "_").replace(".json", ""),
|
x.replace("/", "_").replace("-", "_").replace(".json", ""),
|
||||||
@ -26,11 +26,9 @@ ALL_SCHEMA_TARGETS_PAIR = [
|
|||||||
name = name,
|
name = name,
|
||||||
src = src,
|
src = src,
|
||||||
)
|
)
|
||||||
for (src, name) in ALL_SCHEMA_TARGETS_PAIR
|
for (src, name) in ALL_SCHEMA_TARGETS
|
||||||
]
|
]
|
||||||
|
|
||||||
ALL_SCHEMA_DEPS = [":" + name for (_, name) in ALL_SCHEMA_TARGETS_PAIR]
|
|
||||||
|
|
||||||
ts_library(
|
ts_library(
|
||||||
name = "angular",
|
name = "angular",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
@ -45,10 +43,13 @@ ts_library(
|
|||||||
# Exclude test helpers.
|
# Exclude test helpers.
|
||||||
"utility/test/**/*.ts",
|
"utility/test/**/*.ts",
|
||||||
],
|
],
|
||||||
),
|
) + [
|
||||||
|
"//packages/schematics/angular:" + src.replace(".json", ".ts")
|
||||||
|
for (src, _) in ALL_SCHEMA_TARGETS
|
||||||
|
],
|
||||||
module_name = "@schematics/angular",
|
module_name = "@schematics/angular",
|
||||||
# strict_checks = False,
|
# strict_checks = False,
|
||||||
deps = ALL_SCHEMA_DEPS + [
|
deps = [
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/schematics",
|
"//packages/angular_devkit/schematics",
|
||||||
"//packages/angular_devkit/schematics:tasks",
|
"//packages/angular_devkit/schematics:tasks",
|
||||||
@ -87,7 +88,7 @@ ts_library(
|
|||||||
),
|
),
|
||||||
# @external_begin
|
# @external_begin
|
||||||
tsconfig = "//:tsconfig-test.json",
|
tsconfig = "//:tsconfig-test.json",
|
||||||
deps = ALL_SCHEMA_DEPS + [
|
deps = [
|
||||||
":angular",
|
":angular",
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/core:node_testing",
|
"//packages/angular_devkit/core:node_testing",
|
||||||
|
@ -22,10 +22,11 @@ ts_library(
|
|||||||
"blank/project-files/**",
|
"blank/project-files/**",
|
||||||
"blank/schematic-files/**",
|
"blank/schematic-files/**",
|
||||||
],
|
],
|
||||||
),
|
) + [
|
||||||
|
"//packages/schematics/schematics:blank/schema.ts",
|
||||||
|
"//packages/schematics/schematics:schematic/schema.ts",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":blank_schema",
|
|
||||||
":schematic_schema",
|
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/schematics",
|
"//packages/angular_devkit/schematics",
|
||||||
"//packages/angular_devkit/schematics:tasks",
|
"//packages/angular_devkit/schematics:tasks",
|
||||||
|
@ -20,10 +20,11 @@ ts_library(
|
|||||||
"**/*_spec_large.ts",
|
"**/*_spec_large.ts",
|
||||||
"**/*_benchmark.ts",
|
"**/*_benchmark.ts",
|
||||||
],
|
],
|
||||||
),
|
) + [
|
||||||
|
"//packages/schematics/update:update/schema.ts",
|
||||||
|
"//packages/schematics/update:migrate/schema.ts",
|
||||||
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":migrate_schema",
|
|
||||||
":update_schema",
|
|
||||||
"//packages/angular_devkit/core",
|
"//packages/angular_devkit/core",
|
||||||
"//packages/angular_devkit/schematics",
|
"//packages/angular_devkit/schematics",
|
||||||
"//packages/angular_devkit/schematics:tasks",
|
"//packages/angular_devkit/schematics:tasks",
|
||||||
|
@ -46,9 +46,9 @@ _ts_json_schema_interface = rule(
|
|||||||
)
|
)
|
||||||
# @external_end
|
# @external_end
|
||||||
|
|
||||||
# Generates a library that contains the interface for a JSON Schema file. Takes a single `src`
|
# Generates a TS file that contains the interface for a JSON Schema file. Takes a single `src`
|
||||||
# argument as input, an optional data field for reference files, and produces a ts_library()
|
# argument as input, an optional data field for reference files, and produces a
|
||||||
# rule containing the typescript interface.
|
# _ts_json_schema_interface() rule containing the typescript interface.
|
||||||
# The file produced will have the same name, with the extension replaced from `.json` to `.ts`.
|
# The file produced will have the same name, with the extension replaced from `.json` to `.ts`.
|
||||||
# Any filename collision will be an error thrown by Bazel.
|
# Any filename collision will be an error thrown by Bazel.
|
||||||
def ts_json_schema(name, src, data = []):
|
def ts_json_schema(name, src, data = []):
|
||||||
@ -62,16 +62,3 @@ def ts_json_schema(name, src, data = []):
|
|||||||
data = data,
|
data = data,
|
||||||
)
|
)
|
||||||
# @external_end
|
# @external_end
|
||||||
|
|
||||||
ts_library(
|
|
||||||
name = name,
|
|
||||||
deps = [
|
|
||||||
"@npm//@types/node",
|
|
||||||
],
|
|
||||||
# Remove these to empty the rule, since those files are also compiled elsewhere.
|
|
||||||
# @external_begin
|
|
||||||
srcs = [
|
|
||||||
out,
|
|
||||||
],
|
|
||||||
# @external_end
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user