parent
c8a1a14b87
commit
a1492a73ce
|
@ -62,7 +62,7 @@ jobs:
|
||||||
# Use bazel query so that we explicitly ask for all buildable targets to be built as well
|
# Use bazel query so that we explicitly ask for all buildable targets to be built as well
|
||||||
# This avoids waiting for a build command to finish before running the first test
|
# This avoids waiting for a build command to finish before running the first test
|
||||||
# See https://github.com/bazelbuild/bazel/issues/4257
|
# See https://github.com/bazelbuild/bazel/issues/4257
|
||||||
- run: bazel query --output=label '//modules/... union //packages/... union //tools/... union @angular//...' | xargs bazel test --config=ci
|
- run: bazel query --output=label '//modules/... union //packages/... union //tools/...' | xargs bazel test --config=ci
|
||||||
|
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: *cache_key
|
key: *cache_key
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
workspace(name = "angular_src")
|
workspace(name = "angular")
|
||||||
|
|
||||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||||
|
|
||||||
|
@ -24,11 +24,6 @@ load("@build_bazel_rules_typescript//:setup.bzl", "ts_setup_workspace")
|
||||||
|
|
||||||
ts_setup_workspace()
|
ts_setup_workspace()
|
||||||
|
|
||||||
local_repository(
|
|
||||||
name = "angular",
|
|
||||||
path = "packages/bazel",
|
|
||||||
)
|
|
||||||
|
|
||||||
local_repository(
|
local_repository(
|
||||||
name = "rxjs",
|
name = "rxjs",
|
||||||
path = "node_modules/rxjs/src",
|
path = "node_modules/rxjs/src",
|
||||||
|
|
4
build.sh
4
build.sh
|
@ -416,9 +416,13 @@ if [[ ${BUILD_TOOLS} == true || ${BUILD_ALL} == true ]]; then
|
||||||
|
|
||||||
mkdir -p ./dist/packages-dist
|
mkdir -p ./dist/packages-dist
|
||||||
rsync -a packages/bazel/ ./dist/packages-dist/bazel
|
rsync -a packages/bazel/ ./dist/packages-dist/bazel
|
||||||
|
echo "workspace(name=\"angular\")" > ./dist/packages-dist/bazel/WORKSPACE
|
||||||
# Remove BEGIN-INTERNAL...END-INTERAL blocks
|
# Remove BEGIN-INTERNAL...END-INTERAL blocks
|
||||||
# https://stackoverflow.com/questions/24175271/how-can-i-match-multi-line-patterns-in-the-command-line-with-perl-style-regex
|
# https://stackoverflow.com/questions/24175271/how-can-i-match-multi-line-patterns-in-the-command-line-with-perl-style-regex
|
||||||
perl -0777 -n -i -e "s/(?m)^.*BEGIN-INTERNAL[\w\W]*END-INTERNAL.*\n//g; print" $(grep -ril BEGIN-INTERNAL dist/packages-dist/bazel) < /dev/null 2> /dev/null
|
perl -0777 -n -i -e "s/(?m)^.*BEGIN-INTERNAL[\w\W]*END-INTERNAL.*\n//g; print" $(grep -ril BEGIN-INTERNAL dist/packages-dist/bazel) < /dev/null 2> /dev/null
|
||||||
|
# Re-host //packages/bazel/ which is just // in the public distro
|
||||||
|
perl -0777 -n -i -e "s#//packages/bazel/#//#g; print" $(grep -ril packages/bazel dist/packages-dist/bazel) < /dev/null 2> /dev/null
|
||||||
|
perl -0777 -n -i -e "s#angular/packages/bazel/#angular/#g; print" $(grep -ril packages/bazel dist/packages-dist/bazel) < /dev/null 2> /dev/null
|
||||||
updateVersionReferences dist/packages-dist/bazel
|
updateVersionReferences dist/packages-dist/bazel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -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")
|
|
|
@ -268,13 +268,13 @@ NG_MODULE_ATTRIBUTES = {
|
||||||
"no_i18n": attr.bool(default = False),
|
"no_i18n": attr.bool(default = False),
|
||||||
|
|
||||||
"compiler": attr.label(
|
"compiler": attr.label(
|
||||||
default = Label("//src/ngc-wrapped"),
|
default = Label("//packages/bazel/src/ngc-wrapped"),
|
||||||
executable = True,
|
executable = True,
|
||||||
cfg = "host",
|
cfg = "host",
|
||||||
),
|
),
|
||||||
|
|
||||||
"_ng_xi18n": attr.label(
|
"_ng_xi18n": attr.label(
|
||||||
default = Label("//src/ngc-wrapped:xi18n"),
|
default = Label("//packages/bazel/src/ngc-wrapped:xi18n"),
|
||||||
executable = True,
|
executable = True,
|
||||||
cfg = "host",
|
cfg = "host",
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,12 +9,12 @@ ts_library(
|
||||||
],
|
],
|
||||||
module_name = "@angular/bazel",
|
module_name = "@angular/bazel",
|
||||||
tsconfig = ":tsconfig.json",
|
tsconfig = ":tsconfig.json",
|
||||||
visibility = ["//test/ngc-wrapped:__subpackages__"],
|
visibility = ["//packages/bazel/test/ngc-wrapped:__subpackages__"],
|
||||||
deps = [
|
deps = [
|
||||||
# BEGIN-INTERNAL
|
# BEGIN-INTERNAL
|
||||||
# Only needed when compiling within the Angular repo.
|
# Only needed when compiling Angular from sources.
|
||||||
# Users will get this dependency from node_modules.
|
# Users with an npm depnedency 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",
|
||||||
],
|
],
|
||||||
|
@ -26,9 +26,7 @@ nodejs_binary(
|
||||||
":ngc_lib",
|
":ngc_lib",
|
||||||
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
|
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
|
||||||
],
|
],
|
||||||
# Entry point assumes the user is outside this WORKSPACE,
|
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js",
|
||||||
# and references our rules with @angular//src/ngc-wrapped
|
|
||||||
entry_point = "angular/src/ngc-wrapped/index.js",
|
|
||||||
node_modules = "@build_bazel_rules_typescript_deps//:node_modules",
|
node_modules = "@build_bazel_rules_typescript_deps//:node_modules",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
@ -38,8 +36,6 @@ nodejs_binary(
|
||||||
data = [
|
data = [
|
||||||
":ngc_lib",
|
":ngc_lib",
|
||||||
],
|
],
|
||||||
# Entry point assumes the user is outside this WORKSPACE,
|
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js/extract_i18n.js",
|
||||||
# and references our rules with @angular//src/ngc-wrapped
|
|
||||||
entry_point = "angular/src/ngc-wrapped/index.js/extract_i18n.js",
|
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -45,7 +45,13 @@ export function runOneBuild(args: string[], inputs?: {[path: string]: string}):
|
||||||
if (args[0] === '-p') args.shift();
|
if (args[0] === '-p') args.shift();
|
||||||
// Strip leading at-signs, used to indicate a params file
|
// Strip leading at-signs, used to indicate a params file
|
||||||
const project = args[0].replace(/^@+/, '');
|
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 expectedOuts = config['angularCompilerOptions']['expectedOut'];
|
||||||
|
|
||||||
const {basePath} = ng.calcProjectFileAndBasePath(project);
|
const {basePath} = ng.calcProjectFileAndBasePath(project);
|
||||||
|
|
|
@ -13,9 +13,9 @@ ts_library(
|
||||||
# BEGIN-INTERNAL
|
# BEGIN-INTERNAL
|
||||||
# Only needed when compiling within the Angular repo.
|
# Only needed when compiling within the Angular repo.
|
||||||
# Users 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
|
||||||
"//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).
|
# .d.ts files (by default, jasmine_node_test would get the .js files).
|
||||||
filegroup(
|
filegroup(
|
||||||
name = "angular_core",
|
name = "angular_core",
|
||||||
srcs = ["@//packages/core"],
|
srcs = ["//packages/core"],
|
||||||
)
|
)
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
|
@ -32,8 +32,8 @@ jasmine_node_test(
|
||||||
srcs = [":ngc_test_lib"],
|
srcs = [":ngc_test_lib"],
|
||||||
data = [
|
data = [
|
||||||
":angular_core",
|
":angular_core",
|
||||||
"//test/ngc-wrapped/empty:empty_tsconfig.json",
|
"//packages/bazel/test/ngc-wrapped/empty:empty_tsconfig.json",
|
||||||
"//test/ngc-wrapped/empty:tsconfig.json",
|
"//packages/bazel/test/ngc-wrapped/empty:tsconfig.json",
|
||||||
"@build_bazel_rules_typescript//internal:worker_protocol.proto",
|
"@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(
|
ng_module(
|
||||||
name = "empty",
|
name = "empty",
|
||||||
srcs = ["empty.ts"],
|
srcs = ["empty.ts"],
|
||||||
tsconfig = ":tsconfig.json",
|
tsconfig = ":tsconfig.json",
|
||||||
deps = ["@//packages/core"],
|
deps = ["//packages/core"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -47,7 +47,7 @@ export function setup(
|
||||||
const bazelBinPath = path.resolve(basePath, bazelBin);
|
const bazelBinPath = path.resolve(basePath, bazelBin);
|
||||||
fs.mkdirSync(bazelBinPath);
|
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 ngFiles = listFilesRecursive(angularCorePath);
|
||||||
|
|
||||||
const tsConfigJsonPath = path.resolve(basePath, tsconfig);
|
const tsConfigJsonPath = path.resolve(basePath, tsconfig);
|
||||||
|
@ -113,7 +113,8 @@ export function setup(
|
||||||
|
|
||||||
const emptyTsConfig = ts.readConfigFile(
|
const emptyTsConfig = ts.readConfigFile(
|
||||||
path.resolve(
|
path.resolve(
|
||||||
runfilesPath, 'angular', 'test', 'ngc-wrapped', 'empty', 'empty_tsconfig.json'),
|
runfilesPath, 'angular', 'packages', 'bazel', 'test', 'ngc-wrapped', 'empty',
|
||||||
|
'empty_tsconfig.json'),
|
||||||
read);
|
read);
|
||||||
|
|
||||||
const tsconfig = createTsConfig({
|
const tsconfig = createTsConfig({
|
||||||
|
|
|
@ -32,7 +32,7 @@ export function createTsConfig(options: TsConfigOptions) {
|
||||||
const result = options.defaultTsConfig;
|
const result = options.defaultTsConfig;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'extends': '../angular/test/ngc-wrapped/empty/tsconfig',
|
'extends': '../angular/packages/bazel/test/ngc-wrapped/empty/tsconfig',
|
||||||
'compilerOptions': {
|
'compilerOptions': {
|
||||||
...result.compilerOptions,
|
...result.compilerOptions,
|
||||||
'outDir': options.outDir,
|
'outDir': options.outDir,
|
||||||
|
@ -70,7 +70,7 @@ export function createTsConfig(options: TsConfigOptions) {
|
||||||
'tsickleExternsPath': '',
|
'tsickleExternsPath': '',
|
||||||
// we don't copy the node_modules into our tmp dir, so we should look in
|
// we don't copy the node_modules into our tmp dir, so we should look in
|
||||||
// the original workspace directory for it
|
// the original workspace directory for it
|
||||||
'nodeModulesPrefix': '../angular_src/node_modules',
|
'nodeModulesPrefix': '../angular/node_modules',
|
||||||
},
|
},
|
||||||
'files': options.files,
|
'files': options.files,
|
||||||
'angularCompilerOptions': {
|
'angularCompilerOptions': {
|
||||||
|
|
|
@ -23,7 +23,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
|
|
@ -36,7 +36,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
# dissable since tests are running but not yet passing
|
# dissable since tests are running but not yet passing
|
||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -50,7 +50,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
":test_node_only_lib",
|
":test_node_only_lib",
|
||||||
|
|
|
@ -46,7 +46,7 @@ ts_library(
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "render3",
|
name = "render3",
|
||||||
bootstrap = [
|
bootstrap = [
|
||||||
"angular_src/packages/core/test/render3/load_domino",
|
"angular/packages/core/test/render3/load_domino",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":render3_node_lib",
|
":render3_node_lib",
|
||||||
|
|
|
@ -18,7 +18,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
|
|
@ -19,7 +19,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
|
|
@ -15,7 +15,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
# dissable since tests are running but not yet passing
|
# dissable since tests are running but not yet passing
|
||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -19,7 +19,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
# dissable since tests are running but not yet passing
|
# dissable since tests are running but not yet passing
|
||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -25,7 +25,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
# dissable since tests are running but not yet passing
|
# dissable since tests are running but not yet passing
|
||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -25,7 +25,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
|
|
@ -21,7 +21,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
|
|
@ -22,7 +22,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
|
|
@ -20,7 +20,7 @@ ts_library(
|
||||||
|
|
||||||
jasmine_node_test(
|
jasmine_node_test(
|
||||||
name = "test",
|
name = "test",
|
||||||
bootstrap = ["angular_src/tools/testing/init_node_spec.js"],
|
bootstrap = ["angular/tools/testing/init_node_spec.js"],
|
||||||
deps = [
|
deps = [
|
||||||
":test_lib",
|
":test_lib",
|
||||||
"//tools/testing:node",
|
"//tools/testing:node",
|
||||||
|
|
|
@ -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("@angular//:index.bzl", _ng_module = "ng_module")
|
load("//packages/bazel/src:ng_module.bzl", _ng_module = "ng_module")
|
||||||
|
|
||||||
DEFAULT_TSCONFIG = "//packages:tsconfig-build.json"
|
DEFAULT_TSCONFIG = "//packages:tsconfig-build.json"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue