Skip to content

Commit

Permalink
fix(bazel): hack in a working compiler-cli dependency.
Browse files Browse the repository at this point in the history
Need a more principled answer, requires design discussion
  • Loading branch information
alexeagle committed Feb 21, 2018
1 parent 62efa9f commit 7f6fcc1
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 8 deletions.
2 changes: 0 additions & 2 deletions build.sh
Expand Up @@ -417,8 +417,6 @@ if [[ ${BUILD_TOOLS} == true || ${BUILD_ALL} == true ]]; then
mkdir -p ./dist/packages-dist
rsync -a packages/bazel/ ./dist/packages-dist/bazel
echo "workspace(name=\"angular\")" > ./dist/packages-dist/bazel/WORKSPACE
# Internally we resolve compiler-cli from a bazel dependency. Users need to fetch it from NPM.
perl -0777 -n -i -e 's/"dependencies": {}/"dependencies": {"\@angular\/compiler-cli": "0.0.0-PLACEHOLDER"}/; print' ./dist/packages-dist/bazel/src/runtime-deps.json
# 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
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
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/src/ng_module.bzl
Expand Up @@ -250,7 +250,7 @@ def _write_bundle_index(ctx):
if ctx.attr.module_name:
tsconfig["angularCompilerOptions"]["flatModuleId"] = ctx.attr.module_name

entry_point = ctx.attr.entry_point if hasattr(ctx.attr, "entry_point") and ctx.attr.entry_point else "index.ts"
entry_point = ctx.attr.entry_point if ctx.attr.entry_point else "index.ts"
# createBundleIndexHost in bundle_index_host.ts will throw if the "files" has more than one entry.
# We don't want to fail() here, however, because not all ng_module's will have the bundle index written.
# So we make the assumption that the index.ts file in the highest parent directory is the entry point.
Expand Down
1 change: 0 additions & 1 deletion packages/bazel/src/ng_package/BUILD.bazel
Expand Up @@ -8,7 +8,6 @@ exports_files(["rollup.config.js"])
ts_library(
name = "lib",
srcs = glob(["*.ts"]),
# deps = ["//packages:types"],
node_modules = "@angular_bazel_runtime_deps//:node_modules",
tsconfig = ":tsconfig.json",
)
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/src/ng_package/rollup.config.js
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

// Rollup configuration
// Rollup configuration
// GENERATED BY Bazel

// TODO(alexeagle): maybe re-use the rollup.config from rules_nodejs
Expand Down
4 changes: 2 additions & 2 deletions packages/bazel/src/runtime-deps.json
Expand Up @@ -3,6 +3,7 @@
"private": true,
"description": "This package.json is for compile-time deps for Bazel rules, not seen by users.",
"devDependencies": {
"@angular/compiler-cli": "angular/compiler-cli-builds#75773390d9e799e6445290180bcdb2cda032a95f",
"@types/node": "6.0.84",
"@types/shelljs": "0.7.7",
"shelljs": "0.7.8",
Expand All @@ -11,6 +12,5 @@
"tsickle": "0.27.2",
"typescript": "2.6.x",
"uglify-js": "2.8.29"
},
"dependencies": {}
}
}
2 changes: 1 addition & 1 deletion packages/bazel/test/ng_package/core_package.spec.ts
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import * as path from 'path';
import * as path from 'path';
import * as shx from 'shelljs';

const corePackagePath =
Expand Down

0 comments on commit 7f6fcc1

Please sign in to comment.