build(bazel): do not build rxjs from source under Bazel (#28720)
PR Close #28720
This commit is contained in:
@ -25,7 +25,6 @@ ts_library(
|
||||
"@ngdeps//@angular-devkit/architect",
|
||||
"@ngdeps//@angular-devkit/core",
|
||||
"@ngdeps//@types/node",
|
||||
"@rxjs",
|
||||
"@rxjs//operators",
|
||||
"@ngdeps//rxjs",
|
||||
],
|
||||
)
|
||||
|
@ -28,13 +28,6 @@ http_archive(
|
||||
strip_prefix = "angular-%s" % ANGULAR_VERSION,
|
||||
)
|
||||
|
||||
# RxJS
|
||||
RXJS_VERSION = "<%= RXJS_VERSION %>"
|
||||
http_archive(
|
||||
name = "rxjs",
|
||||
url = "https://registry.yarnpkg.com/rxjs/-/rxjs-%s.tgz" % RXJS_VERSION,
|
||||
strip_prefix = "package/src",
|
||||
)
|
||||
<% if (sass) { %>
|
||||
# Rules for compiling sass
|
||||
RULES_SASS_VERSION = "<%= RULES_SASS_VERSION %>"
|
||||
|
@ -7,6 +7,15 @@ load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_pac
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver", "ts_library")
|
||||
<% if (sass) { %>load("@io_bazel_rules_sass//:defs.bzl", "multi_sass_binary")
|
||||
|
||||
filegroup(
|
||||
name = "rxjs_umd_modules",
|
||||
srcs = [
|
||||
# do not sort
|
||||
"@npm//node_modules/rxjs:bundles/rxjs.umd.js",
|
||||
":rxjs_shims.js",
|
||||
],
|
||||
)
|
||||
|
||||
multi_sass_binary(
|
||||
name = "styles",
|
||||
srcs = glob(["**/*.scss"]),
|
||||
@ -32,13 +41,17 @@ ng_module(
|
||||
"@angular//packages/platform-browser",<% if (routing) { %>
|
||||
"@angular//packages/router",<% } %>
|
||||
"@npm//@types",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
rollup_bundle(
|
||||
name = "bundle",
|
||||
entry_point = "src/main.prod",
|
||||
deps = ["//src"],
|
||||
deps = [
|
||||
"//src",
|
||||
"@npm//rxjs",
|
||||
],
|
||||
)
|
||||
|
||||
web_package(
|
||||
@ -63,15 +76,14 @@ history_server(
|
||||
ts_devserver(
|
||||
name = "devserver",
|
||||
port = 4200,
|
||||
additional_root_paths = [
|
||||
"npm/node_modules/zone.js/dist",
|
||||
"npm/node_modules/tslib",
|
||||
],
|
||||
entry_module = "<%= utils.underscore(name) %>/src/main.dev",
|
||||
serving_path = "/bundle.min.js",
|
||||
scripts = [
|
||||
"@npm//node_modules/tslib:tslib.js",
|
||||
":rxjs_umd_modules",
|
||||
],
|
||||
static_files = [
|
||||
"@npm//node_modules/zone.js:dist/zone.min.js",
|
||||
"@npm//node_modules/tslib:tslib.js",
|
||||
],
|
||||
index_html = "index.html",
|
||||
deps = [":src"],
|
||||
@ -116,6 +128,7 @@ ts_web_test_suite(
|
||||
"@io_bazel_rules_webtesting//browsers:chromium-local",
|
||||
],
|
||||
deps = [
|
||||
":rxjs_umd_modules",
|
||||
":test_lib",
|
||||
"@npm//karma-jasmine",
|
||||
],
|
||||
|
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @fileoverview Provides named UMD shims for `rxjs/operators` and `rxjs/testing`.
|
||||
* This file should be included in the "scripts" of a "ts_devserver"
|
||||
* rule and the "deps" of a "ts_web_test_suite" rule.
|
||||
*/
|
||||
// rxjs/operators
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define('rxjs/operators', ['exports', 'rxjs'], factory);
|
||||
}
|
||||
})(function(exports, rxjs) {
|
||||
'use strict';
|
||||
Object.keys(rxjs.operators).forEach(function(key) { exports[key] = rxjs.operators[key]; });
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
});
|
||||
|
||||
// rxjs/testing
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define('rxjs/testing', ['exports', 'rxjs'], factory);
|
||||
}
|
||||
})(function(exports, rxjs) {
|
||||
'use strict';
|
||||
Object.keys(rxjs.testing).forEach(function(key) { exports[key] = rxjs.testing[key]; });
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
});
|
@ -94,7 +94,6 @@ export default function(options: BazelWorkspaceOptions): Rule {
|
||||
'RULES_NODEJS_VERSION': '0.18.6',
|
||||
'RULES_NODEJS_SHA256': '1416d03823fed624b49a0abbd9979f7c63bbedfd37890ddecedd2fe25cccebc6',
|
||||
'ANGULAR_VERSION': existingVersions.Angular || clean(latestVersions.Angular),
|
||||
'RXJS_VERSION': existingVersions.RxJs || clean(latestVersions.RxJs),
|
||||
// TODO(kyliau): Consider moving this to latest-versions.ts
|
||||
'RULES_SASS_VERSION': '1.17.0',
|
||||
};
|
||||
|
Reference in New Issue
Block a user