From 513c69169e9a7aed0853898da17a553e98edb529 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Fri, 24 Jan 2020 13:08:55 -0800 Subject: [PATCH] build: update to rules_nodejs 1.2.0 (#34961) This brings in a fix so that yarn_install picks up the yarn-path attribute of the .yarnrc file. PR Close #34961 --- WORKSPACE | 6 +- integration/bazel/WORKSPACE | 4 +- integration/bazel/package.json | 10 ++-- integration/bazel/yarn.lock | 60 +++++++++---------- package.json | 10 ++-- .../src/builders/files/WORKSPACE.template | 4 +- .../ng_package/collect-type-definitions.bzl | 6 +- packages/bazel/src/schematics/ng-add/index.ts | 10 ++-- .../example-with-ts-library/BUILD.bazel | 2 +- .../example_with_ts_library_package.golden | 34 ++++++++++- yarn.lock | 40 ++++++------- 11 files changed, 108 insertions(+), 78 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 962c89254e..f15aee29a5 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Fetch rules_nodejs so we can install our npm dependencies http_archive( name = "build_bazel_rules_nodejs", - sha256 = "c97bf38546c220fa250ff2cc052c1a9eac977c662c1fc23eda797b0ce8e70a43", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.1.0/rules_nodejs-1.1.0.tar.gz"], + sha256 = "591d2945b09ecc89fde53e56dd54cfac93322df3bc9d4747cb897ce67ba8cdbf", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.2.0/rules_nodejs-1.2.0.tar.gz"], ) # Check the bazel version and download npm dependencies @@ -29,7 +29,7 @@ Try running `yarn bazel` instead. minimum_bazel_version = "1.1.0", ) -check_rules_nodejs_version(minimum_version_string = "1.0.0") +check_rules_nodejs_version(minimum_version_string = "1.2.0") # Setup the Node.js toolchain node_repositories( diff --git a/integration/bazel/WORKSPACE b/integration/bazel/WORKSPACE index 6a01de9078..342748c940 100644 --- a/integration/bazel/WORKSPACE +++ b/integration/bazel/WORKSPACE @@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Fetch rules_nodejs so we can install our npm dependencies http_archive( name = "build_bazel_rules_nodejs", - sha256 = "c97bf38546c220fa250ff2cc052c1a9eac977c662c1fc23eda797b0ce8e70a43", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.1.0/rules_nodejs-1.1.0.tar.gz"], + sha256 = "591d2945b09ecc89fde53e56dd54cfac93322df3bc9d4747cb897ce67ba8cdbf", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/1.2.0/rules_nodejs-1.2.0.tar.gz"], ) # Fetch sass rules for compiling sass files diff --git a/integration/bazel/package.json b/integration/bazel/package.json index 09eadcbd56..6798acc4f7 100644 --- a/integration/bazel/package.json +++ b/integration/bazel/package.json @@ -23,11 +23,11 @@ "@angular/compiler": "file:../../dist/packages-dist/compiler", "@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli", "@bazel/bazel": "file:../../node_modules/@bazel/bazel", - "@bazel/karma": "1.1.0", - "@bazel/protractor": "1.1.0", - "@bazel/rollup": "1.1.0", - "@bazel/terser": "1.1.0", - "@bazel/typescript": "1.1.0", + "@bazel/karma": "1.2.0", + "@bazel/protractor": "1.2.0", + "@bazel/rollup": "1.2.0", + "@bazel/terser": "1.2.0", + "@bazel/typescript": "1.2.0", "@types/jasmine": "2.8.8", "http-server": "0.12.0", "karma": "4.4.1", diff --git a/integration/bazel/yarn.lock b/integration/bazel/yarn.lock index 7c69f8e77b..d7d0576ee2 100644 --- a/integration/bazel/yarn.lock +++ b/integration/bazel/yarn.lock @@ -3,10 +3,10 @@ "@angular/animations@file:../../dist/packages-dist/animations": - version "0.0.0" + version "9.0.0-rc.1" "@angular/bazel@file:../../dist/packages-dist/bazel": - version "0.0.0" + version "9.0.0-rc.1" dependencies: "@microsoft/api-extractor" "^7.3.9" shelljs "0.8.2" @@ -22,10 +22,10 @@ parse5 "^5.0.0" "@angular/common@file:../../dist/packages-dist/common": - version "0.0.0" + version "9.0.0-rc.1" "@angular/compiler-cli@file:../../dist/packages-dist/compiler-cli": - version "0.0.0" + version "9.0.0-rc.1" dependencies: canonical-path "1.0.0" chokidar "^2.1.1" @@ -39,13 +39,13 @@ yargs "13.1.0" "@angular/compiler@file:../../dist/packages-dist/compiler": - version "0.0.0" + version "9.0.0-rc.1" "@angular/core@file:../../dist/packages-dist/core": - version "0.0.0" + version "9.0.0-rc.1" "@angular/forms@file:../../dist/packages-dist/forms": - version "0.0.0" + version "9.0.0-rc.1" "@angular/material@8.0.1": version "8.0.1" @@ -55,13 +55,13 @@ tslib "^1.7.1" "@angular/platform-browser-dynamic@file:../../dist/packages-dist/platform-browser-dynamic": - version "0.0.0" + version "9.0.0-rc.1" "@angular/platform-browser@file:../../dist/packages-dist/platform-browser": - version "0.0.0" + version "9.0.0-rc.1" "@angular/router@file:../../dist/packages-dist/router": - version "0.0.0" + version "9.0.0-rc.1" "@bazel/bazel-darwin_x64@2.0.0": version "2.0.0" @@ -92,32 +92,32 @@ resolved "https://registry.yarnpkg.com/@bazel/hide-bazel-files/-/hide-bazel-files-0.38.3.tgz#e98231d3d360d51860d9c1a7c3345b40dab4cf81" integrity sha512-o+dNkfDm3qxWQ8h/04cWuTcjR7qnjZi3pQGv4aklVb16oPWx2jF8BzbkwvWuIkdbOl9VnqYP0vaHzwQVJRRcIA== -"@bazel/karma@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.1.0.tgz#3340904942acd970964ad40a28177f780d2d658a" - integrity sha512-4AwY86r/MNPCcVkR4z5wO9d4dftdSWi7nFnIEFGsl++Mzpgrfc70dGReu35BFC38JavWrEkZuh7RU1d8bbD8WQ== +"@bazel/karma@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.2.0.tgz#ef06efa689494181040cc2c7af982675d02aad52" + integrity sha512-Afv2LGm5jgPWHAoPkZl5vSSN0hSQxahqk/jlL6KJ4JI5WNy47R2oRgxjQtsthjBGVzJKGGMgfy4CTBnc6UOS2w== dependencies: tmp "0.1.0" -"@bazel/protractor@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.1.0.tgz#0adf7c76a73ee437e0ba223662d98ba2f1a3356d" - integrity sha512-k1Oqt0FMmnxk4lJZ4vA/CHOWcMKWuCr85Ljlq0hZrxfDokuxwGBMAUZgTQIh5KkvRnAo0utYRESMhWed8H2DpA== +"@bazel/protractor@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.2.0.tgz#db6848a72fd8e5a80279d451a54a7fd8cdecc523" + integrity sha512-X+ahKakCfHRQW/76YqGcGCRDNI38QcUKCJ49V21hvON984iluLnQ4m5kRU1KKdESbj3vQ6BJs2b/LFFKRQXrfA== -"@bazel/rollup@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-1.1.0.tgz#e1e496d77fcd55971ff4ef51e982476dfe092ac8" - integrity sha512-FiSiXZ/AOWnAVR39gLVYlATe/clGyvap5skiILtDksVtm6C620Rkqr/4QfIdFHZzdMb+eaxbRbMkOxux4O2McQ== +"@bazel/rollup@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-1.2.0.tgz#8b9569ed6f1c00d2a833567901f8ee4600a389fb" + integrity sha512-yrXW+AAUoqc9qN/CweD5p8OEN9bNKFjXnXPBRE4w84LxpkmaJFx+yQJ++c1F57zWMoq2o9EV4CM7y+mK8zxwUg== -"@bazel/terser@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-1.1.0.tgz#e737ed06ef445e2c510ac08f956607434771dbf1" - integrity sha512-oGnRvDi/ESZ+fY7BzTvlUiLa5kbzY370gLtByFFX0Ix2PlVIs558bsbLMmt3Lbnts75t4GQTkB5NanZkk1Sjkg== +"@bazel/terser@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-1.2.0.tgz#b750ef8b887ee6e47ceac3ed14b577c22597e110" + integrity sha512-zZvUvwURvYmcRvkV3KEMZp8+/Q73UMVwnmUUJvrw9MPEgTWnxHLdzvTkKzl8f/zza1moL3E9bX+shdU94aKdRg== -"@bazel/typescript@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.1.0.tgz#b57ac6c6d627577f394a60fb540fbbdf53bcff0d" - integrity sha512-QnTdb6rwZUR+KfUuAdyazpkA7BOvrWRe7tkPDdyIZHJdBPYdpJW+AapnFSfxvXEIP0Nwesl5KP6Saau0GPiBLg== +"@bazel/typescript@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.2.0.tgz#ab2016e1d6eb7a86b44536e887f51eaf3d75f1a7" + integrity sha512-hPEG8K0psyEcs6HFRiqZNQwXL/dQ8sXKdrNFWv87+rh+YUNfd58uktoynhllympOPThcbUZcZicLWBEFQOc8nA== dependencies: protobufjs "6.8.8" semver "5.6.0" diff --git a/package.json b/package.json index ff9e287f19..beaac2d152 100644 --- a/package.json +++ b/package.json @@ -42,12 +42,12 @@ "@angular/bazel": "file:./tools/npm/@angular_bazel", "@babel/core": "7.8.3", "@babel/generator": "7.8.3", - "@bazel/jasmine": "1.1.0", - "@bazel/karma": "1.1.0", + "@bazel/jasmine": "1.2.0", + "@bazel/karma": "1.2.0", "@bazel/protractor": "1.2.0", - "@bazel/rollup": "1.1.0", - "@bazel/terser": "1.1.0", - "@bazel/typescript": "1.1.0", + "@bazel/rollup": "1.2.0", + "@bazel/terser": "1.2.0", + "@bazel/typescript": "1.2.0", "@microsoft/api-extractor": "^7.3.9", "@schematics/angular": "9.0.0-rc.8", "@types/angular": "^1.6.47", diff --git a/packages/bazel/src/builders/files/WORKSPACE.template b/packages/bazel/src/builders/files/WORKSPACE.template index 8d0eeb92e5..00e4d13c11 100644 --- a/packages/bazel/src/builders/files/WORKSPACE.template +++ b/packages/bazel/src/builders/files/WORKSPACE.template @@ -15,8 +15,8 @@ workspace( load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -RULES_NODEJS_VERSION = "1.1.0" -RULES_NODEJS_SHA256 = "c97bf38546c220fa250ff2cc052c1a9eac977c662c1fc23eda797b0ce8e70a43" +RULES_NODEJS_VERSION = "1.2.0" +RULES_NODEJS_SHA256 = "591d2945b09ecc89fde53e56dd54cfac93322df3bc9d4747cb897ce67ba8cdbf" http_archive( name = "build_bazel_rules_nodejs", sha256 = RULES_NODEJS_SHA256, diff --git a/packages/bazel/src/ng_package/collect-type-definitions.bzl b/packages/bazel/src/ng_package/collect-type-definitions.bzl index 0f2f616ffa..e47d649613 100644 --- a/packages/bazel/src/ng_package/collect-type-definitions.bzl +++ b/packages/bazel/src/ng_package/collect-type-definitions.bzl @@ -8,6 +8,8 @@ This is used to find all files that will be copied into a "ng_package". """ +load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo") + def _filter_typing_files(files): return [file for file in files if file.path.endswith(".d.ts")] @@ -35,7 +37,7 @@ def collect_type_definitions(ctx): # Collect all TypeScript definition files from the specified dependencies. for dep in ctx.attr.deps: - if hasattr(dep, "typescript"): - collected_files += dep.typescript.transitive_declarations.to_list() + if DeclarationInfo in dep: + collected_files += dep[DeclarationInfo].transitive_declarations.to_list() return collected_files diff --git a/packages/bazel/src/schematics/ng-add/index.ts b/packages/bazel/src/schematics/ng-add/index.ts index f03f9525bc..2140ad091d 100644 --- a/packages/bazel/src/schematics/ng-add/index.ts +++ b/packages/bazel/src/schematics/ng-add/index.ts @@ -40,11 +40,11 @@ function addDevDependenciesToPackageJson(options: Schema) { ['@angular/bazel', angularCore.version], ['@bazel/bazel', '2.0.0'], ['@bazel/ibazel', '0.10.3'], - ['@bazel/karma', '1.1.0'], - ['@bazel/protractor', '1.1.0'], - ['@bazel/rollup', '1.1.0'], - ['@bazel/terser', '1.1.0'], - ['@bazel/typescript', '1.1.0'], + ['@bazel/karma', '1.2.0'], + ['@bazel/protractor', '1.2.0'], + ['@bazel/rollup', '1.2.0'], + ['@bazel/terser', '1.2.0'], + ['@bazel/typescript', '1.2.0'], ['history-server', '1.3.1'], ['html-insert-assets', '0.2.0'], ['karma', '4.4.1'], diff --git a/packages/bazel/test/ng_package/example-with-ts-library/BUILD.bazel b/packages/bazel/test/ng_package/example-with-ts-library/BUILD.bazel index 35d25011f4..a4da6f6fca 100644 --- a/packages/bazel/test/ng_package/example-with-ts-library/BUILD.bazel +++ b/packages/bazel/test/ng_package/example-with-ts-library/BUILD.bazel @@ -5,7 +5,7 @@ package(default_visibility = ["//packages/bazel/test:__subpackages__"]) ts_library( name = "example", srcs = glob(["*.ts"]), - module_name = "example", + module_name = "example-with-ts-library", deps = [], ) diff --git a/packages/bazel/test/ng_package/example_with_ts_library_package.golden b/packages/bazel/test/ng_package/example_with_ts_library_package.golden index 50c0baeace..459aeb7f02 100644 --- a/packages/bazel/test/ng_package/example_with_ts_library_package.golden +++ b/packages/bazel/test/ng_package/example_with_ts_library_package.golden @@ -62,6 +62,9 @@ utils utils/package.json utils/testing.d.ts utils.d.ts +with-ts-library + with-ts-library/package.json +with-ts-library.d.ts --- README.md --- Angular @@ -437,8 +440,8 @@ e.dispatchFakeEvent=function t(e,n){e.dispatchEvent(n)},Object.defineProperty(e, (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define('example', ['exports'], factory) : - (global = global || self, factory(global.example = {})); + typeof define === 'function' && define.amd ? define('example-with-ts-library', ['exports'], factory) : + (global = global || self, factory(global.exampleWithTsLibrary = {})); }(this, (function (exports) { 'use strict'; /** @@ -465,7 +468,7 @@ e.dispatchFakeEvent=function t(e,n){e.dispatchEvent(n)},Object.defineProperty(e, * (c) 2010-2020 Google LLC. https://angular.io/ * License: MIT */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("example",["exports"],t):t((e=e||self).example={})}(this,(function(e){"use strict"; +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("example-with-ts-library",["exports"],t):t((e=e||self).exampleWithTsLibrary={})}(this,(function(e){"use strict"; /** * @license * Copyright Google Inc. All Rights Reserved. @@ -989,3 +992,28 @@ export declare function dispatchFakeEvent(el: HTMLElement, ev: Event): void; export * from './utils/index'; + +--- with-ts-library/package.json --- + +{ + "name": "example-with-ts-library", + "main": "./bundles/example-with-ts-library.umd.js", + "fesm5": "./fesm5/example-with-ts-library.js", + "fesm2015": "./fesm2015/example-with-ts-library.js", + "esm5": "../esm5/index.js", + "esm2015": "../esm2015/index.js", + "typings": "../index.d.ts", + "module": "./fesm5/example-with-ts-library.js", + "es2015": "./fesm2015/example-with-ts-library.js" +} + +--- with-ts-library.d.ts --- + +/** + * @license Angular v0.0.0 + * (c) 2010-2020 Google LLC. https://angular.io/ + * License: MIT + */ + +export * from './index'; + diff --git a/yarn.lock b/yarn.lock index cf7968deee..7465b47612 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1110,19 +1110,19 @@ resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.11.1.tgz#c07ceaded388f1e39d6aa732953e0dd04f3dbdf0" integrity sha512-qAdEquFAudYyN+CYfLzvuRWNubdsh6C8+o5CiViUEfchq1HQM5Rs8xAOE3fzGsTZ1EUsvgca/PY0kn0VIxckBA== -"@bazel/jasmine@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-1.1.0.tgz#3900a99b57ceac1e979aa0d64b624a70a4ebd92e" - integrity sha512-3KuA7eNBu4OyHWP5k8pZJlpdThPfvFQViNDMawmz80KLfp1qbHkMYaVd5Drfa6MmDXjC7QNAGG7zRe0DOrEJ2Q== +"@bazel/jasmine@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-1.2.0.tgz#0225cba4d678fabc9da4f70dc48ba22b7f523dd1" + integrity sha512-o6OjPHOfnNSRPWsEslGmN9k5PqqsyY6FS7zhn/xQMy/oOqveOPlva0tx/aAKJRLpLIw2Rpp7WoY/GaVDbfUqVA== dependencies: jasmine "~3.4.0" jasmine-core "~3.4.0" v8-coverage "1.0.9" -"@bazel/karma@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.1.0.tgz#3340904942acd970964ad40a28177f780d2d658a" - integrity sha512-4AwY86r/MNPCcVkR4z5wO9d4dftdSWi7nFnIEFGsl++Mzpgrfc70dGReu35BFC38JavWrEkZuh7RU1d8bbD8WQ== +"@bazel/karma@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-1.2.0.tgz#ef06efa689494181040cc2c7af982675d02aad52" + integrity sha512-Afv2LGm5jgPWHAoPkZl5vSSN0hSQxahqk/jlL6KJ4JI5WNy47R2oRgxjQtsthjBGVzJKGGMgfy4CTBnc6UOS2w== dependencies: tmp "0.1.0" @@ -1131,20 +1131,20 @@ resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-1.2.0.tgz#db6848a72fd8e5a80279d451a54a7fd8cdecc523" integrity sha512-X+ahKakCfHRQW/76YqGcGCRDNI38QcUKCJ49V21hvON984iluLnQ4m5kRU1KKdESbj3vQ6BJs2b/LFFKRQXrfA== -"@bazel/rollup@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-1.1.0.tgz#e1e496d77fcd55971ff4ef51e982476dfe092ac8" - integrity sha512-FiSiXZ/AOWnAVR39gLVYlATe/clGyvap5skiILtDksVtm6C620Rkqr/4QfIdFHZzdMb+eaxbRbMkOxux4O2McQ== +"@bazel/rollup@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-1.2.0.tgz#8b9569ed6f1c00d2a833567901f8ee4600a389fb" + integrity sha512-yrXW+AAUoqc9qN/CweD5p8OEN9bNKFjXnXPBRE4w84LxpkmaJFx+yQJ++c1F57zWMoq2o9EV4CM7y+mK8zxwUg== -"@bazel/terser@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-1.1.0.tgz#e737ed06ef445e2c510ac08f956607434771dbf1" - integrity sha512-oGnRvDi/ESZ+fY7BzTvlUiLa5kbzY370gLtByFFX0Ix2PlVIs558bsbLMmt3Lbnts75t4GQTkB5NanZkk1Sjkg== +"@bazel/terser@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-1.2.0.tgz#b750ef8b887ee6e47ceac3ed14b577c22597e110" + integrity sha512-zZvUvwURvYmcRvkV3KEMZp8+/Q73UMVwnmUUJvrw9MPEgTWnxHLdzvTkKzl8f/zza1moL3E9bX+shdU94aKdRg== -"@bazel/typescript@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.1.0.tgz#b57ac6c6d627577f394a60fb540fbbdf53bcff0d" - integrity sha512-QnTdb6rwZUR+KfUuAdyazpkA7BOvrWRe7tkPDdyIZHJdBPYdpJW+AapnFSfxvXEIP0Nwesl5KP6Saau0GPiBLg== +"@bazel/typescript@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-1.2.0.tgz#ab2016e1d6eb7a86b44536e887f51eaf3d75f1a7" + integrity sha512-hPEG8K0psyEcs6HFRiqZNQwXL/dQ8sXKdrNFWv87+rh+YUNfd58uktoynhllympOPThcbUZcZicLWBEFQOc8nA== dependencies: protobufjs "6.8.8" semver "5.6.0"