Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit 18802ab

Browse files
committed
WIP: add Bazel rules
1 parent 8574425 commit 18802ab

27 files changed

+2286
-6653
lines changed

BUILD.bazel

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package(default_visibility = ["//visibility:public"])
2+
load("@build_bazel_rules_nodejs//:defs.bzl", "node_modules_filegroup")
3+
4+
# This rule belongs in node_modules/BUILD
5+
# It's here as a workaround for
6+
# https://github.com/bazelbuild/bazel/issues/374#issuecomment-296217940
7+
node_modules_filegroup(
8+
name = "node_modules",
9+
packages = [
10+
"@angular",
11+
"@types",
12+
"bytebuffer",
13+
"jasmine",
14+
"minimist",
15+
"protobufjs",
16+
"protractor",
17+
"reflect-metadata",
18+
"rxjs",
19+
"tsickle",
20+
"tslib",
21+
"tsutils",
22+
"typescript",
23+
"zone.js",
24+
]
25+
)
26+
27+
28+
# Glob pattern that matches all Angular testing bundles.
29+
ANGULAR_TESTING = [
30+
"node_modules/@angular/*/bundles/*-testing.umd.js",
31+
# The compiler and the dynamic platform-browser should be visible only in tests
32+
"node_modules/@angular/compiler/bundles/*.umd.js",
33+
"node_modules/@angular/platform-browser-dynamic/bundles/*.umd.js",
34+
]
35+
36+
filegroup(
37+
name = "angular_bundles",
38+
srcs = glob(["node_modules/@angular/*/bundles/*.umd.js"], exclude = ANGULAR_TESTING),
39+
)
40+
41+
filegroup(
42+
name = "angular_test_bundles",
43+
testonly = 1,
44+
srcs = glob(ANGULAR_TESTING),
45+
)
46+
47+
filegroup(
48+
name = "tslib_bundle",
49+
testonly = 1,
50+
srcs = glob(["node_modules/tslib/tslib.js"]),
51+
)
52+
53+
# Files necessary for unit tests that use zonejs
54+
filegroup(
55+
name = "web_test_bootstrap_scripts",
56+
# The order of these deps is important.
57+
# Do not sort.
58+
srcs = [
59+
"//:node_modules/reflect-metadata/Reflect.js",
60+
"//:node_modules/zone.js/dist/zone.js",
61+
"//:node_modules/zone.js/dist/async-test.js",
62+
"//:node_modules/zone.js/dist/sync-test.js",
63+
"//:node_modules/zone.js/dist/fake-async-test.js",
64+
"//:node_modules/zone.js/dist/proxy.js",
65+
"//:node_modules/zone.js/dist/jasmine-patch.js",
66+
],
67+
)

WORKSPACE

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
workspace(name = "preboot")
2+
3+
# Add nodejs rules
4+
http_archive(
5+
name = "build_bazel_rules_nodejs",
6+
url = "https://github.com/bazelbuild/rules_nodejs/archive/99166f8eb7fc628ca561acf9f9a51a1c26edadad.zip",
7+
strip_prefix = "rules_nodejs-99166f8eb7fc628ca561acf9f9a51a1c26edadad",
8+
sha256 = "338e8495e5d1fa16de7190106c5675372ff4a347f6004e203e84a168db96281e",
9+
)
10+
11+
# NOTE: this rule installs nodejs, npm, and yarn, but does NOT install
12+
# your npm dependencies. You must still run the package manager.
13+
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
14+
15+
check_bazel_version("0.9.0")
16+
node_repositories(package_json = ["//:package.json"])
17+
18+
# Add TypeScript rules
19+
http_archive(
20+
name = "build_bazel_rules_typescript",
21+
url = "https://github.com/bazelbuild/rules_typescript/archive/0.11.1.zip",
22+
strip_prefix = "rules_typescript-0.11.1",
23+
sha256 = "7406bea7954e1c906f075115dfa176551a881119f6820b126ea1eacb09f34a1a",
24+
)
25+
26+
# Setup TypeScript Bazel workspace
27+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
28+
ts_setup_workspace()
29+
30+
# Add Angular rules
31+
local_repository(
32+
name = "angular",
33+
path = "node_modules/@angular/bazel",
34+
)
35+
36+
# Add rxjs
37+
local_repository(
38+
name = "rxjs",
39+
path = "node_modules/rxjs/src",
40+
)

angular.tsconfig.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// WORKAROUND https://github.com/angular/angular/issues/18810
2+
// This file is required to run ngc on angular libraries, to write files like
3+
// node_modules/@angular/core/core.ngsummary.json
4+
{
5+
"compilerOptions": {
6+
"lib": [
7+
"dom",
8+
"es2015"
9+
],
10+
"experimentalDecorators": true,
11+
"types": ["jasmine"]
12+
},
13+
"include": [
14+
"node_modules/@angular/**/*"
15+
],
16+
"exclude": [
17+
"node_modules/@angular/bazel/**",
18+
"node_modules/@angular/compiler-cli/**",
19+
"node_modules/@angular/*/testing/**",
20+
"node_modules/@angular/material/schematics/**"
21+
]
22+
}

bazel-out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/private/var/tmp/_bazel_main/6c480a7879f3da8204b7fe407462b9a0/execroot/preboot/bazel-out

integration/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const distDir = path.join(__dirname, 'dist/');
1616
const outDir = path.join(__dirname, 'out-tsc/e2e/');
1717
const rollupConfig = {
1818
entry: `${outDir}main.js`,
19-
sourceMap: false,
19+
sourcemap: false,
2020
format: 'iife',
2121
onwarn: function (warning) {
2222
// Skip certain warnings

0 commit comments

Comments
 (0)