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"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "animations",
|
||||
srcs = glob(
|
||||
[
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "browser",
|
||||
srcs = glob(
|
||||
[
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
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
|
||||
|
|
|
@ -12,8 +12,8 @@ ts_library(
|
|||
visibility = ["//packages/bazel/test/ngc-wrapped:__subpackages__"],
|
||||
deps = [
|
||||
# BEGIN-INTERNAL
|
||||
# Only needed when compiling Angular from sources.
|
||||
# Users with an npm depnedency will get this dependency from node_modules.
|
||||
# Only needed when compiling within the Angular repo.
|
||||
# Users will get this dependency from node_modules.
|
||||
"//packages/compiler-cli",
|
||||
# END-INTERNAL
|
||||
"@build_bazel_rules_typescript//internal/tsc_wrapped",
|
||||
|
|
|
@ -10,12 +10,8 @@ ts_library(
|
|||
],
|
||||
tsconfig = ":tsconfig.json",
|
||||
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/compiler-cli",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(
|
||||
[
|
||||
"*.ts",
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
module_name = "@angular/common/testing",
|
||||
deps = [
|
||||
|
|
|
@ -22,6 +22,7 @@ ts_library(
|
|||
],
|
||||
),
|
||||
module_name = "@angular/compiler-cli",
|
||||
node_modules = "@//:node_modules",
|
||||
tsconfig = ":tsconfig",
|
||||
deps = [
|
||||
"//packages/compiler",
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
},
|
||||
"outDir": "../../dist/packages/compiler-cli"
|
||||
},
|
||||
"bazelOptions": {
|
||||
"suppressTsconfigOverrideWarnings": true
|
||||
},
|
||||
|
||||
"exclude": [
|
||||
"integrationtest"
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
module_name = "@angular/core/testing",
|
||||
deps = [
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* 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';
|
||||
|
||||
|
@ -19,6 +19,7 @@ function unimplemented(): any {
|
|||
*
|
||||
* @experimental
|
||||
*/
|
||||
@Injectable()
|
||||
export class TestingCompiler extends Compiler {
|
||||
get injector(): Injector { throw unimplemented(); }
|
||||
overrideModule(module: Type<any>, overrides: MetadataOverride<NgModule>): void {
|
||||
|
|
|
@ -24,4 +24,4 @@
|
|||
"flatModuleOutFile": "core.js",
|
||||
"flatModuleId": "@angular/core"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
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",
|
||||
srcs = glob(
|
||||
[
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "platform-webworker",
|
||||
srcs = glob(
|
||||
[
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "router",
|
||||
srcs = glob(
|
||||
[
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "service-worker",
|
||||
srcs = glob(
|
||||
[
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "testing",
|
||||
testonly = 1,
|
||||
srcs = glob(["**/*.ts"]),
|
||||
module_name = "@angular/service-worker/testing",
|
||||
deps = [
|
||||
"//packages/core",
|
||||
"@rxjs",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -8,6 +8,7 @@ ts_library(
|
|||
srcs = glob(["**/*.ts"]),
|
||||
deps = [
|
||||
"//packages:types",
|
||||
"//packages/core",
|
||||
"//packages/service-worker/worker",
|
||||
"@rxjs",
|
||||
],
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
"target": "es2017",
|
||||
"typeRoots": []
|
||||
},
|
||||
"bazelOptions": {
|
||||
"suppressTsconfigOverrideWarnings": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts",
|
||||
"src/service-worker.d.ts"
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
"target": "es5",
|
||||
"types": ["angularjs"]
|
||||
},
|
||||
"bazelOptions": {
|
||||
"suppressTsconfigOverrideWarnings": true
|
||||
},
|
||||
"exclude": [
|
||||
"bazel",
|
||||
"compiler-cli/integrationtest",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
ts_library(
|
||||
ng_module(
|
||||
name = "upgrade",
|
||||
srcs = glob(
|
||||
[
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Re-export of some bazel rules with repository-wide defaults."""
|
||||
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"
|
||||
|
||||
|
@ -9,7 +9,7 @@ def ts_library(tsconfig = None, **kwargs):
|
|||
tsconfig = DEFAULT_TSCONFIG
|
||||
_ts_library(tsconfig = tsconfig, **kwargs)
|
||||
|
||||
def ng_module(tsconfig = None, **kwargs):
|
||||
def ng_module(name, tsconfig = None, **kwargs):
|
||||
if not tsconfig:
|
||||
tsconfig = DEFAULT_TSCONFIG
|
||||
_ng_module(tsconfig = tsconfig, **kwargs)
|
||||
_ng_module(name = name, tsconfig = tsconfig, **kwargs)
|
||||
|
|
Loading…
Reference in New Issue