refactor(bazel): convert most ts_library to ng_module (#22176)
This is necessary so we can produce ng metadata for our packages that are published as libraries PR Close #22176
This commit is contained in:
parent
03d93c96a3
commit
a069e08354
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "animations",
|
name = "animations",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "browser",
|
name = "browser",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
Users should not load files under "/src"
|
Users should not load files under "/src"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
load("//src:ng_module.bzl", _ng_module = "ng_module")
|
load("//packages/bazel/src:ng_module.bzl", _ng_module = "ng_module")
|
||||||
|
|
||||||
ng_module = _ng_module
|
ng_module = _ng_module
|
||||||
|
|
|
@ -12,8 +12,8 @@ ts_library(
|
||||||
visibility = ["//packages/bazel/test/ngc-wrapped:__subpackages__"],
|
visibility = ["//packages/bazel/test/ngc-wrapped:__subpackages__"],
|
||||||
deps = [
|
deps = [
|
||||||
# BEGIN-INTERNAL
|
# BEGIN-INTERNAL
|
||||||
# Only needed when compiling Angular from sources.
|
# Only needed when compiling within the Angular repo.
|
||||||
# Users with an npm depnedency will get this dependency from node_modules.
|
# Users will get this dependency from node_modules.
|
||||||
"//packages/compiler-cli",
|
"//packages/compiler-cli",
|
||||||
# END-INTERNAL
|
# END-INTERNAL
|
||||||
"@build_bazel_rules_typescript//internal/tsc_wrapped",
|
"@build_bazel_rules_typescript//internal/tsc_wrapped",
|
||||||
|
|
|
@ -10,12 +10,8 @@ ts_library(
|
||||||
],
|
],
|
||||||
tsconfig = ":tsconfig.json",
|
tsconfig = ":tsconfig.json",
|
||||||
deps = [
|
deps = [
|
||||||
# BEGIN-INTERNAL
|
|
||||||
# Only needed when compiling within the Angular repo.
|
|
||||||
# Users will get this dependency from node_modules.
|
|
||||||
"//packages/compiler-cli",
|
|
||||||
# END-INTERNAL
|
|
||||||
"//packages/bazel/src/ngc-wrapped:ngc_lib",
|
"//packages/bazel/src/ngc-wrapped:ngc_lib",
|
||||||
|
"//packages/compiler-cli",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
"*.ts",
|
"*.ts",
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
module_name = "@angular/common/testing",
|
module_name = "@angular/common/testing",
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -22,6 +22,7 @@ ts_library(
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
module_name = "@angular/compiler-cli",
|
module_name = "@angular/compiler-cli",
|
||||||
|
node_modules = "@//:node_modules",
|
||||||
tsconfig = ":tsconfig",
|
tsconfig = ":tsconfig",
|
||||||
deps = [
|
deps = [
|
||||||
"//packages/compiler",
|
"//packages/compiler",
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
},
|
},
|
||||||
"outDir": "../../dist/packages/compiler-cli"
|
"outDir": "../../dist/packages/compiler-cli"
|
||||||
},
|
},
|
||||||
|
"bazelOptions": {
|
||||||
|
"suppressTsconfigOverrideWarnings": true
|
||||||
|
},
|
||||||
|
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"integrationtest"
|
"integrationtest"
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
module_name = "@angular/core/testing",
|
module_name = "@angular/core/testing",
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Compiler, CompilerOptions, Component, ComponentFactory, Directive, Injector, NgModule, Pipe, Type} from '@angular/core';
|
import {Compiler, CompilerOptions, Component, ComponentFactory, Directive, Injectable, Injector, NgModule, Pipe, Type} from '@angular/core';
|
||||||
|
|
||||||
import {MetadataOverride} from './metadata_override';
|
import {MetadataOverride} from './metadata_override';
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ function unimplemented(): any {
|
||||||
*
|
*
|
||||||
* @experimental
|
* @experimental
|
||||||
*/
|
*/
|
||||||
|
@Injectable()
|
||||||
export class TestingCompiler extends Compiler {
|
export class TestingCompiler extends Compiler {
|
||||||
get injector(): Injector { throw unimplemented(); }
|
get injector(): Injector { throw unimplemented(); }
|
||||||
overrideModule(module: Type<any>, overrides: MetadataOverride<NgModule>): void {
|
overrideModule(module: Type<any>, overrides: MetadataOverride<NgModule>): void {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "platform-browser-dynamic",
|
name = "platform-browser-dynamic",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "platform-webworker",
|
name = "platform-webworker",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "router",
|
name = "router",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "service-worker",
|
name = "service-worker",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "testing",
|
name = "testing",
|
||||||
testonly = 1,
|
testonly = 1,
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
module_name = "@angular/service-worker/testing",
|
module_name = "@angular/service-worker/testing",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//packages/core",
|
||||||
"@rxjs",
|
"@rxjs",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,6 +8,7 @@ ts_library(
|
||||||
srcs = glob(["**/*.ts"]),
|
srcs = glob(["**/*.ts"]),
|
||||||
deps = [
|
deps = [
|
||||||
"//packages:types",
|
"//packages:types",
|
||||||
|
"//packages/core",
|
||||||
"//packages/service-worker/worker",
|
"//packages/service-worker/worker",
|
||||||
"@rxjs",
|
"@rxjs",
|
||||||
],
|
],
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
"target": "es2017",
|
"target": "es2017",
|
||||||
"typeRoots": []
|
"typeRoots": []
|
||||||
},
|
},
|
||||||
|
"bazelOptions": {
|
||||||
|
"suppressTsconfigOverrideWarnings": true
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"main.ts",
|
"main.ts",
|
||||||
"src/service-worker.d.ts"
|
"src/service-worker.d.ts"
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"types": ["angularjs"]
|
"types": ["angularjs"]
|
||||||
},
|
},
|
||||||
|
"bazelOptions": {
|
||||||
|
"suppressTsconfigOverrideWarnings": true
|
||||||
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"bazel",
|
"bazel",
|
||||||
"compiler-cli/integrationtest",
|
"compiler-cli/integrationtest",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load("//tools:defaults.bzl", "ts_library")
|
load("//tools:defaults.bzl", "ng_module")
|
||||||
|
|
||||||
ts_library(
|
ng_module(
|
||||||
name = "upgrade",
|
name = "upgrade",
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Re-export of some bazel rules with repository-wide defaults."""
|
"""Re-export of some bazel rules with repository-wide defaults."""
|
||||||
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library")
|
load("@build_bazel_rules_typescript//:defs.bzl", _ts_library = "ts_library")
|
||||||
load("//packages/bazel/src:ng_module.bzl", _ng_module = "ng_module")
|
load("//packages/bazel:index.bzl", _ng_module = "ng_module")
|
||||||
|
|
||||||
DEFAULT_TSCONFIG = "//packages:tsconfig-build.json"
|
DEFAULT_TSCONFIG = "//packages:tsconfig-build.json"
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ def ts_library(tsconfig = None, **kwargs):
|
||||||
tsconfig = DEFAULT_TSCONFIG
|
tsconfig = DEFAULT_TSCONFIG
|
||||||
_ts_library(tsconfig = tsconfig, **kwargs)
|
_ts_library(tsconfig = tsconfig, **kwargs)
|
||||||
|
|
||||||
def ng_module(tsconfig = None, **kwargs):
|
def ng_module(name, tsconfig = None, **kwargs):
|
||||||
if not tsconfig:
|
if not tsconfig:
|
||||||
tsconfig = DEFAULT_TSCONFIG
|
tsconfig = DEFAULT_TSCONFIG
|
||||||
_ng_module(tsconfig = tsconfig, **kwargs)
|
_ng_module(name = name, tsconfig = tsconfig, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue