build(bazel): fix bazel types reference directive resolves (#25774)
PR Close #25774
This commit is contained in:
parent
815d1ffa19
commit
b404d47b16
@ -13,7 +13,7 @@
|
|||||||
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
|
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
|
||||||
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
|
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
|
||||||
var_1: &docker_image angular/ngcontainer:0.4.0
|
var_1: &docker_image angular/ngcontainer:0.4.0
|
||||||
var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.4.0
|
var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-bust1-0.4.0
|
||||||
|
|
||||||
# Define common ENV vars
|
# Define common ENV vars
|
||||||
var_3: &define_env_vars
|
var_3: &define_env_vars
|
||||||
|
@ -26,9 +26,9 @@ http_archive(
|
|||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "build_bazel_rules_typescript",
|
name = "build_bazel_rules_typescript",
|
||||||
url = "https://github.com/bazelbuild/rules_typescript/archive/0.16.0.zip",
|
url = "https://github.com/bazelbuild/rules_typescript/archive/0.16.2.zip",
|
||||||
strip_prefix = "rules_typescript-0.16.0",
|
strip_prefix = "rules_typescript-0.16.2",
|
||||||
sha256 = "e65c5639a42e2f6d3f9d2bda62487d6b42734830dda45be1620c3e2b1115070c",
|
sha256 = "31601b777840fbf600dbd1893ade0d1de37166e7ba52b90735b107cfb67e38c7",
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
|
@ -27,9 +27,9 @@ http_archive(
|
|||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "build_bazel_rules_typescript",
|
name = "build_bazel_rules_typescript",
|
||||||
url = "https://github.com/bazelbuild/rules_typescript/archive/0.16.0.zip",
|
url = "https://github.com/bazelbuild/rules_typescript/archive/0.16.2.zip",
|
||||||
strip_prefix = "rules_typescript-0.16.0",
|
strip_prefix = "rules_typescript-0.16.2",
|
||||||
sha256 = "e65c5639a42e2f6d3f9d2bda62487d6b42734830dda45be1620c3e2b1115070c",
|
sha256 = "31601b777840fbf600dbd1893ade0d1de37166e7ba52b90735b107cfb67e38c7",
|
||||||
)
|
)
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
|
@ -21,9 +21,7 @@
|
|||||||
"prebuildifier": "bazel build --noshow_progress @com_github_bazelbuild_buildtools//buildifier",
|
"prebuildifier": "bazel build --noshow_progress @com_github_bazelbuild_buildtools//buildifier",
|
||||||
"buildifier": "find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/*/buildifier",
|
"buildifier": "find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/*/buildifier",
|
||||||
"preinstall": "node tools/yarn/check-yarn.js",
|
"preinstall": "node tools/yarn/check-yarn.js",
|
||||||
"postinstall": "yarn update-webdriver && node ./tools/postinstall-patches.js && yarn patch-types",
|
"postinstall": "yarn update-webdriver && node ./tools/postinstall-patches.js",
|
||||||
"//patch-types": "work-around for issue https://github.com/angular/angular/issues/25051",
|
|
||||||
"patch-types": "node -e \"var sh = require('shelljs'); sh.set('-e'); sh.mkdir('-p', 'node_modules/@types/zone.js'); sh.cp('-f', 'node_modules/zone.js/dist/zone.js.d.ts', 'node_modules/@types/zone.js/index.d.ts')\"",
|
|
||||||
"update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG",
|
"update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG",
|
||||||
"check-env": "gulp check-env",
|
"check-env": "gulp check-env",
|
||||||
"commitmsg": "node ./scripts/git/commit-msg.js"
|
"commitmsg": "node ./scripts/git/commit-msg.js"
|
||||||
|
@ -21,4 +21,5 @@ def ng_setup_workspace():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 0.16.0: minimal version required to work with ng_module
|
# 0.16.0: minimal version required to work with ng_module
|
||||||
check_rules_typescript_version("0.16.0")
|
# 0.16.2: bazel type resolution for zone.js types
|
||||||
|
check_rules_typescript_version("0.16.2")
|
||||||
|
@ -34,7 +34,16 @@ export interface CompilerHost extends ts.CompilerHost {
|
|||||||
* Implementation of `CompilerHost` which delegates to a native TypeScript host in most cases.
|
* Implementation of `CompilerHost` which delegates to a native TypeScript host in most cases.
|
||||||
*/
|
*/
|
||||||
export class NgtscCompilerHost implements CompilerHost {
|
export class NgtscCompilerHost implements CompilerHost {
|
||||||
constructor(private delegate: ts.CompilerHost) {}
|
constructor(private delegate: ts.CompilerHost) {
|
||||||
|
if (delegate.resolveTypeReferenceDirectives) {
|
||||||
|
this.resolveTypeReferenceDirectives = (names: string[], containingFile: string) =>
|
||||||
|
delegate.resolveTypeReferenceDirectives !(names, containingFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resolveTypeReferenceDirectives?:
|
||||||
|
(names: string[],
|
||||||
|
containingFile: string) => (ts.ResolvedTypeReferenceDirective | undefined)[];
|
||||||
|
|
||||||
getSourceFile(
|
getSourceFile(
|
||||||
fileName: string, languageVersion: ts.ScriptTarget,
|
fileName: string, languageVersion: ts.ScriptTarget,
|
||||||
|
@ -82,6 +82,9 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
|
|||||||
trace !: (s: string) => void;
|
trace !: (s: string) => void;
|
||||||
// TODO(issue/24571): remove '!'.
|
// TODO(issue/24571): remove '!'.
|
||||||
getDirectories !: (path: string) => string[];
|
getDirectories !: (path: string) => string[];
|
||||||
|
resolveTypeReferenceDirectives?:
|
||||||
|
(names: string[],
|
||||||
|
containingFile: string) => (ts.ResolvedTypeReferenceDirective | undefined)[];
|
||||||
directoryExists?: (directoryName: string) => boolean;
|
directoryExists?: (directoryName: string) => boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -106,6 +109,10 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
|
|||||||
if (context.getDefaultLibLocation) {
|
if (context.getDefaultLibLocation) {
|
||||||
this.getDefaultLibLocation = () => context.getDefaultLibLocation !();
|
this.getDefaultLibLocation = () => context.getDefaultLibLocation !();
|
||||||
}
|
}
|
||||||
|
if (context.resolveTypeReferenceDirectives) {
|
||||||
|
this.resolveTypeReferenceDirectives = (names: string[], containingFile: string) =>
|
||||||
|
context.resolveTypeReferenceDirectives !(names, containingFile);
|
||||||
|
}
|
||||||
if (context.trace) {
|
if (context.trace) {
|
||||||
this.trace = s => context.trace !(s);
|
this.trace = s => context.trace !(s);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user