@ -1,9 +0,0 @@
|
||||
# By convention, the name should "describe the project in reverse-DNS form"
|
||||
# https://docs.bazel.build/versions/master/be/functions.html#workspace
|
||||
# But if we use "io_angular" then the loads used in BUILD files will
|
||||
# be unfamiliar to Angular users who import from '@angular/pkg' in
|
||||
# TypeScript files. We want to reduce the impedance between the Bazel
|
||||
# and node naming schemes.
|
||||
# We take the name "angular" so that users can write
|
||||
# load("@angular//:index.bzl", "ng_module")
|
||||
workspace(name = "angular")
|
@ -265,13 +265,13 @@ NG_MODULE_ATTRIBUTES = {
|
||||
"no_i18n": attr.bool(default = False),
|
||||
|
||||
"compiler": attr.label(
|
||||
default = Label("//src/ngc-wrapped"),
|
||||
default = Label("//packages/bazel/src/ngc-wrapped"),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
|
||||
"_ng_xi18n": attr.label(
|
||||
default = Label("//src/ngc-wrapped:xi18n"),
|
||||
default = Label("//packages/bazel/src/ngc-wrapped:xi18n"),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
|
@ -9,12 +9,12 @@ ts_library(
|
||||
],
|
||||
module_name = "@angular/bazel",
|
||||
tsconfig = ":tsconfig.json",
|
||||
visibility = ["//test/ngc-wrapped:__subpackages__"],
|
||||
visibility = ["//packages/bazel/test/ngc-wrapped:__subpackages__"],
|
||||
deps = [
|
||||
# BEGIN-INTERNAL
|
||||
# Only needed when compiling within the Angular repo.
|
||||
# Users will get this dependency from node_modules.
|
||||
"@//packages/compiler-cli",
|
||||
# Only needed when compiling Angular from sources.
|
||||
# Users with an npm depnedency will get this dependency from node_modules.
|
||||
"//packages/compiler-cli",
|
||||
# END-INTERNAL
|
||||
"@build_bazel_rules_typescript//internal/tsc_wrapped",
|
||||
],
|
||||
@ -26,9 +26,7 @@ nodejs_binary(
|
||||
":ngc_lib",
|
||||
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
|
||||
],
|
||||
# Entry point assumes the user is outside this WORKSPACE,
|
||||
# and references our rules with @angular//src/ngc-wrapped
|
||||
entry_point = "angular/src/ngc-wrapped/index.js",
|
||||
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js",
|
||||
node_modules = "@build_bazel_rules_typescript_deps//:node_modules",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
@ -38,8 +36,6 @@ nodejs_binary(
|
||||
data = [
|
||||
":ngc_lib",
|
||||
],
|
||||
# Entry point assumes the user is outside this WORKSPACE,
|
||||
# and references our rules with @angular//src/ngc-wrapped
|
||||
entry_point = "angular/src/ngc-wrapped/index.js/extract_i18n.js",
|
||||
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js/extract_i18n.js",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -45,7 +45,13 @@ export function runOneBuild(args: string[], inputs?: {[path: string]: string}):
|
||||
if (args[0] === '-p') args.shift();
|
||||
// Strip leading at-signs, used to indicate a params file
|
||||
const project = args[0].replace(/^@+/, '');
|
||||
const [{options: tsOptions, bazelOpts, files, config}] = parseTsconfig(project);
|
||||
|
||||
const [parsedOptions, errors] = parseTsconfig(project);
|
||||
if (errors && errors.length) {
|
||||
console.error(ng.formatDiagnostics(errors));
|
||||
return false;
|
||||
}
|
||||
const {options: tsOptions, bazelOpts, files, config} = parsedOptions;
|
||||
const expectedOuts = config['angularCompilerOptions']['expectedOut'];
|
||||
|
||||
const {basePath} = ng.calcProjectFileAndBasePath(project);
|
||||
|
@ -13,9 +13,9 @@ ts_library(
|
||||
# BEGIN-INTERNAL
|
||||
# Only needed when compiling within the Angular repo.
|
||||
# Users will get this dependency from node_modules.
|
||||
"@//packages/compiler-cli",
|
||||
"//packages/compiler-cli",
|
||||
# END-INTERNAL
|
||||
"//src/ngc-wrapped:ngc_lib",
|
||||
"//packages/bazel/src/ngc-wrapped:ngc_lib",
|
||||
],
|
||||
)
|
||||
|
||||
@ -23,7 +23,7 @@ ts_library(
|
||||
# .d.ts files (by default, jasmine_node_test would get the .js files).
|
||||
filegroup(
|
||||
name = "angular_core",
|
||||
srcs = ["@//packages/core"],
|
||||
srcs = ["//packages/core"],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
@ -32,8 +32,8 @@ jasmine_node_test(
|
||||
srcs = [":ngc_test_lib"],
|
||||
data = [
|
||||
":angular_core",
|
||||
"//test/ngc-wrapped/empty:empty_tsconfig.json",
|
||||
"//test/ngc-wrapped/empty:tsconfig.json",
|
||||
"//packages/bazel/test/ngc-wrapped/empty:empty_tsconfig.json",
|
||||
"//packages/bazel/test/ngc-wrapped/empty:tsconfig.json",
|
||||
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
|
||||
],
|
||||
)
|
||||
|
@ -1,10 +1,10 @@
|
||||
load("@angular//:index.bzl", "ng_module")
|
||||
load("//tools:defaults.bzl", "ng_module")
|
||||
|
||||
package(default_visibility = ["//test:__subpackages__"])
|
||||
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
|
||||
|
||||
ng_module(
|
||||
name = "empty",
|
||||
srcs = ["empty.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = ["@//packages/core"],
|
||||
deps = ["//packages/core"],
|
||||
)
|
||||
|
@ -47,7 +47,7 @@ export function setup(
|
||||
const bazelBinPath = path.resolve(basePath, bazelBin);
|
||||
fs.mkdirSync(bazelBinPath);
|
||||
|
||||
const angularCorePath = path.resolve(runfilesPath, 'angular_src', 'packages', 'core');
|
||||
const angularCorePath = path.resolve(runfilesPath, 'angular', 'packages', 'core');
|
||||
const ngFiles = listFilesRecursive(angularCorePath);
|
||||
|
||||
const tsConfigJsonPath = path.resolve(basePath, tsconfig);
|
||||
@ -113,7 +113,8 @@ export function setup(
|
||||
|
||||
const emptyTsConfig = ts.readConfigFile(
|
||||
path.resolve(
|
||||
runfilesPath, 'angular', 'test', 'ngc-wrapped', 'empty', 'empty_tsconfig.json'),
|
||||
runfilesPath, 'angular', 'packages', 'bazel', 'test', 'ngc-wrapped', 'empty',
|
||||
'empty_tsconfig.json'),
|
||||
read);
|
||||
|
||||
const tsconfig = createTsConfig({
|
||||
|
@ -32,7 +32,7 @@ export function createTsConfig(options: TsConfigOptions) {
|
||||
const result = options.defaultTsConfig;
|
||||
|
||||
return {
|
||||
'extends': '../angular/test/ngc-wrapped/empty/tsconfig',
|
||||
'extends': '../angular/packages/bazel/test/ngc-wrapped/empty/tsconfig',
|
||||
'compilerOptions': {
|
||||
...result.compilerOptions,
|
||||
'outDir': options.outDir,
|
||||
@ -70,7 +70,7 @@ export function createTsConfig(options: TsConfigOptions) {
|
||||
'tsickleExternsPath': '',
|
||||
// we don't copy the node_modules into our tmp dir, so we should look in
|
||||
// the original workspace directory for it
|
||||
'nodeModulesPrefix': '../angular_src/node_modules',
|
||||
'nodeModulesPrefix': '../angular/node_modules',
|
||||
},
|
||||
'files': options.files,
|
||||
'angularCompilerOptions': {
|
||||
|
Reference in New Issue
Block a user