build: update to latest @bazel/typescript (#19277)

Switches devmode output of an ng_module to UMD
This commit is contained in:
Alex Eagle 2017-09-25 12:40:22 -07:00 committed by Victor Berchet
parent e224e3d62d
commit 9ad4b3bd31
12 changed files with 40 additions and 18 deletions

View File

@ -1,9 +1,11 @@
workspace(name = "angular_src")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "build_bazel_rules_nodejs",
remote = "https://github.com/bazelbuild/rules_nodejs.git",
tag = "0.0.2",
tag = "0.1.6",
)
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")

View File

@ -32,7 +32,7 @@
"fsevents": "1.1.2"
},
"devDependencies": {
"@bazel/typescript": "0.1.x",
"@bazel/typescript": "0.2.x",
"@types/angularjs": "1.5.14-alpha",
"@types/base64-js": "1.2.5",
"@types/chokidar": "1.7.3",

1
packages/BUILD.bazel Normal file
View File

@ -0,0 +1 @@
exports_files(["tsconfig-build.json"])

View File

@ -9,7 +9,7 @@
"typescript": "^2.4.2"
},
"dependencies": {
"@bazel/typescript": "0.1.x",
"@bazel/typescript": "0.2.x",
"@types/node": "6.0.84"
},
"repository": {

View File

@ -6,6 +6,7 @@
load(":rules_typescript.bzl",
"tsc_wrapped_tsconfig",
"COMMON_ATTRIBUTES",
"COMMON_OUTPUTS",
"compile_ts",
"DEPS_ASPECTS",
"ts_providers_dict_to_struct",
@ -189,4 +190,5 @@ ng_module = rule(
default = Label("@//:node_modules")
),
},
)
outputs = COMMON_OUTPUTS,
)

View File

@ -8,7 +8,7 @@
// TODO(tbosch): figure out why we need this as it breaks node code within ngc-wrapped
/// <reference types="node" />
import * as ng from '@angular/compiler-cli';
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, fixUmdModuleDeclarations, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
import * as fs from 'fs';
import * as path from 'path';
import * as tsickle from 'tsickle';
@ -163,7 +163,10 @@ export function compile(
program, bazelHost, bazelHost, compilerOpts, targetSourceFile, writeFile,
cancellationToken, emitOnlyDtsFiles, {
beforeTs: customTransformers.before,
afterTs: customTransformers.after,
afterTs: [
...(customTransformers.after || []),
fixUmdModuleDeclarations((sf: ts.SourceFile) => bazelHost.amdModuleName(sf)),
],
});
const {diagnostics, emitResult, program} = ng.performCompilation(

View File

@ -1,9 +1,12 @@
# Allows different paths for these imports in google3
load("@build_bazel_rules_typescript//internal:build_defs.bzl", "tsc_wrapped_tsconfig")
load(
"@build_bazel_rules_typescript//internal:common/compilation.bzl",
"COMMON_ATTRIBUTES", "compile_ts", "DEPS_ASPECTS", "ts_providers_dict_to_struct"
load("@build_bazel_rules_typescript//internal:common/compilation.bzl",
"COMMON_ATTRIBUTES",
"COMMON_OUTPUTS",
"compile_ts",
"DEPS_ASPECTS",
"ts_providers_dict_to_struct",
)
load("@build_bazel_rules_typescript//internal:common/json_marshal.bzl", "json_marshal")

View File

@ -1,5 +1,11 @@
package(default_visibility=["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_config")
ts_config(
name = "tsconfig",
src = "tsconfig-build.json",
deps = ["//packages:tsconfig-build.json"]
)
ts_library(
name = "compiler-cli",
@ -11,5 +17,5 @@ ts_library(
deps = [
"//packages/compiler"
],
tsconfig = ":tsconfig-build.json",
tsconfig = ":tsconfig",
)

View File

@ -8,6 +8,5 @@ ts_library(
"testing/**",
]),
module_name = "@angular/compiler",
deps = [],
tsconfig = ":tsconfig-build.json",
)

View File

@ -36,6 +36,7 @@ fi
setEnvVar NODE_VERSION 6.9.5
setEnvVar YARN_VERSION 1.0.2
setEnvVar BAZEL_VERSION 0.5.4
setEnvVar SAUCE_CONNECT_VERSION 4.4.9
setEnvVar ANGULAR_CLI_VERSION 1.4.0-rc.2
setEnvVar PROJECT_ROOT $(cd ${thisDir}/../..; pwd)

View File

@ -63,9 +63,9 @@ if [[ ${TRAVIS} && (${CI_MODE} == "bazel" || ${CI_MODE} == "e2e_2") ]]; then
(
mkdir tmp
cd tmp
curl --location --compressed https://github.com/bazelbuild/bazel/releases/download/0.5.2/bazel-0.5.2-installer-linux-x86_64.sh > bazel-0.5.2-installer-linux-x86_64.sh
chmod +x bazel-0.5.2-installer-linux-x86_64.sh
./bazel-0.5.2-installer-linux-x86_64.sh --user
curl --location --compressed https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh > bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
chmod +x bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh --user
cd ..
rm -rf tmp
)

View File

@ -2,11 +2,12 @@
# yarn lockfile v1
"@bazel/typescript@0.1.x":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.1.0.tgz#14a0a74d06e0acf7cf60295963adbcc5d3f41217"
"@bazel/typescript@0.2.x":
version "0.2.2"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-0.2.2.tgz#0a0d09924508c946de32e6acdb2b5cc1ee32c506"
dependencies:
"@types/node" "7.0.18"
"@types/source-map" "^0.5.1"
protobufjs "5.0.0"
tsickle "0.24.x"
typescript "2.4.x"
@ -134,6 +135,10 @@
version "2.53.42"
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-2.53.42.tgz#74cb77fb6052edaff2a8984ddafd88d419f25cac"
"@types/source-map@^0.5.1":
version "0.5.1"
resolved "https://registry.yarnpkg.com/@types/source-map/-/source-map-0.5.1.tgz#7e74db5d06ab373a712356eebfaea2fad0ea2367"
"@types/systemjs@0.19.32":
version "0.19.32"
resolved "https://registry.yarnpkg.com/@types/systemjs/-/systemjs-0.19.32.tgz#e9204c4cdbc8e275d645c00e6150e68fc5615a24"