-
Notifications
You must be signed in to change notification settings - Fork 83
Build angular from source #160
Changes from 6 commits
6e8c236
6de71ac
c8a7ad5
8acae88
7cdb988
10c5167
450cc66
ea8b30b
c27ed2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,14 @@ alias( | |
actual = "@nodejs//:yarn", | ||
) | ||
|
||
alias( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a comment that this is the place ts_library will look by default, allows us to omit explicit tsconfig attributes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
name = "tsconfig.json", | ||
actual = "//src:tsconfig.json", | ||
) | ||
|
||
# This export allows targets in other packages to reference files that live | ||
# in this package. | ||
exports_files([ | ||
# Let ts_library targets reference the root tsconfig.json file | ||
"tsconfig.json", | ||
# Let devserver and testing targets reference zone.js distro | ||
"node_modules/zone.js/dist/zone.min.js", | ||
"node_modules/zone.js/dist/zone-testing-bundle.js", | ||
|
@@ -18,46 +21,33 @@ exports_files([ | |
# NOTE: this will move to node_modules/BUILD in a later release | ||
filegroup( | ||
name = "node_modules", | ||
# NB: rxjs is not in this list, because we build it from sources using the | ||
# label @rxjs//:rxjs | ||
# NB: angular & rxjs are not in this list, because we build them from sources | ||
srcs = glob(["/".join([ | ||
"node_modules", | ||
pkg, | ||
"**", | ||
ext, | ||
]) for pkg in [ | ||
"@angular", | ||
"@ngrx", | ||
"@types", | ||
"bytebuffer", | ||
"protobufjs", | ||
"protractor", | ||
"reflect-metadata", | ||
"tsickle", | ||
"tslib", | ||
"tsutils", | ||
"typescript", | ||
"zone.js", | ||
] for ext in [ | ||
"*.js", | ||
"*.json", | ||
"*.d.ts", | ||
]]), | ||
) | ||
|
||
ANGULAR_TESTING = [ | ||
"node_modules/@angular/*/bundles/*-testing.umd.js", | ||
# We use AOT, so the compiler and the dynamic platform-browser should be | ||
# visible only in tests | ||
"node_modules/@angular/compiler/bundles/*.umd.js", | ||
"node_modules/@angular/platform-browser-dynamic/bundles/*.umd.js", | ||
] | ||
|
||
filegroup( | ||
name = "angular_bundles", | ||
srcs = glob( | ||
["node_modules/@angular/*/bundles/*.umd.js"], | ||
exclude = ANGULAR_TESTING, | ||
), | ||
) | ||
|
||
filegroup( | ||
name = "angular_test_bundles", | ||
testonly = 1, | ||
srcs = glob(ANGULAR_TESTING), | ||
]] + [ | ||
"node_modules/protractor/**", | ||
]) + ["@build_bazel_rules_typescript//:node_modules"], | ||
# "@build_bazel_rules_typescript//:node_modules" is incluced | ||
# in `//:node_modules` so that npm dependencies that are hoisted to | ||
# node_modules/@bazel/typescript/node_modules because of conflicting | ||
# versions can be resolved correctly | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,17 @@ workspace(name = "angular_bazel_example") | |
# Allows Bazel to run tooling in Node.js | ||
http_archive( | ||
name = "build_bazel_rules_nodejs", | ||
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.10.0.zip"], | ||
strip_prefix = "rules_nodejs-0.10.0", | ||
sha256 = "2f77623311da8b5009b1c7eade12de8e15fa3cd2adf9dfcc9f87cb2082b2211f", | ||
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.11.3.zip"], | ||
strip_prefix = "rules_nodejs-0.11.3", | ||
sha256 = "e8842fa5f5e38f2c826167ff94323d4b5aabd13217cee867d971d6f860cfd730" | ||
) | ||
|
||
# build_bazel_rules_nodejs depends on skylib | ||
http_archive( | ||
name = "bazel_skylib", | ||
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.3.1.zip"], | ||
strip_prefix = "bazel-skylib-0.3.1", | ||
sha256 = "95518adafc9a2b656667bbf517a952e54ce7f350779d0dd95133db4eb5c27fb1", | ||
) | ||
|
||
# The Bazel buildtools repo contains tools like the BUILD file formatter, buildifier | ||
|
@@ -33,21 +41,32 @@ http_archive( | |
) | ||
|
||
# Runs the TypeScript compiler | ||
http_archive( | ||
local_repository( | ||
name = "build_bazel_rules_typescript", | ||
url = "https://github.com/bazelbuild/rules_typescript/archive/0.15.3.zip", | ||
strip_prefix = "rules_typescript-0.15.3", | ||
sha256 = "a2b26ac3fc13036011196063db1bf7f1eae81334449201dc28087ebfa3708c99", | ||
path = "node_modules/@bazel/typescript", | ||
) | ||
|
||
# build_bazel_rules_typescript depends on io_bazel_skydoc | ||
http_archive( | ||
name = "io_bazel_skydoc", | ||
urls = ["https://github.com/bazelbuild/skydoc/archive/0ef7695c9d70084946a3e99b89ad5a99ede79580.zip"], | ||
strip_prefix = "skydoc-0ef7695c9d70084946a3e99b89ad5a99ede79580", | ||
sha256 = "491f9e142b870b18a0ec8eb3d66636eeceabe5f0c73025706c86f91a1a2acb4d", | ||
) | ||
|
||
# Used by the ts_web_test_suite rule to provision browsers | ||
http_archive( | ||
name = "io_bazel_rules_webtesting", | ||
# Use a commit SHA because we need a release | ||
# https://github.com/bazelbuild/rules_webtesting/issues/273 | ||
url = "https://github.com/bazelbuild/rules_webtesting/archive/bbfc846d98dacb0fb40dd9173acfe4070e3e0f62.zip", | ||
strip_prefix = "rules_webtesting-bbfc846d98dacb0fb40dd9173acfe4070e3e0f62", | ||
sha256 = "a79e2d681b7c9ddc51e7974ddb385b9ee2b389cdc823dd3e78e18936337e4c5a", | ||
url = "https://github.com/bazelbuild/rules_webtesting/archive/0.2.1.zip", | ||
strip_prefix = "rules_webtesting-0.2.1", | ||
sha256 = "7d490aadff9b5262e5251fa69427ab2ffd1548422467cb9f9e1d110e2c36f0fa", | ||
) | ||
|
||
# bazel_gazelle is a transitive dep of rules_typescript and rules_webtesting | ||
http_archive( | ||
name = "bazel_gazelle", | ||
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.13.0/bazel-gazelle-0.13.0.tar.gz"], | ||
sha256 = "bc653d3e058964a5a26dcad02b6c72d7d63e6bb88d94704990b908a1445b8758", | ||
) | ||
|
||
# Runs the Sass CSS preprocessor | ||
|
@@ -65,13 +84,12 @@ http_archive( | |
sha256 = "ba79c532ac400cefd1859cbc8a9829346aa69e3b99482cd5a54432092cbc3933", | ||
) | ||
|
||
#################################### | ||
# Tell Bazel about some workspaces that were installed from npm. | ||
|
||
# The @angular repo contains rule for building Angular applications | ||
local_repository( | ||
http_archive( | ||
name = "angular", | ||
path = "node_modules/@angular/bazel", | ||
url = "https://github.com/angular/angular/archive/6.1.2.zip", | ||
strip_prefix = "angular-6.1.2", | ||
sha256 = "e7553542cebd1113069a92d97a464a2d2aa412242926686653b8cf0101935617", | ||
) | ||
|
||
# The @rxjs repo contains targets for building rxjs with bazel | ||
|
@@ -83,10 +101,13 @@ local_repository( | |
#################################### | ||
# Load and install our dependencies downloaded above. | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install") | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "yarn_install", "check_rules_nodejs_version") | ||
|
||
node_repositories(package_json = ["//:package.json"]) | ||
|
||
# 0.11.3: proper module resolution & check_rules_nodejs_version | ||
check_rules_nodejs_version("0.11.3") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can and it does as well in ts_setup_workspace. Would you rather not have it checked here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah users shouldn't need to do transitive checks |
||
|
||
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains") | ||
|
||
go_rules_dependencies() | ||
|
@@ -100,14 +121,25 @@ browser_repositories( | |
firefox = True, | ||
) | ||
|
||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace") | ||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace", "check_rules_typescript_version") | ||
|
||
ts_setup_workspace() | ||
|
||
# 0.16.0: tsc_wrapped uses user's typescript version & check_rules_typescript_version | ||
check_rules_typescript_version("0.16.0") | ||
|
||
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") | ||
|
||
sass_repositories() | ||
|
||
# | ||
# Load and install our dependencies from local repositories | ||
# | ||
|
||
load("@angular//:index.bzl", "ng_setup_workspace") | ||
|
||
ng_setup_workspace() | ||
|
||
#################################### | ||
# Setup our local toolchain | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file an issue to reference here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bazel-contrib/rules_nodejs#275