diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 95cf18b200..0594c2dfb4 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -16,10 +16,6 @@ tasks: - "//internal/npm_install/test:index" # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 #- "@fine_grained_deps_yarn//typescript/bin:tsc" - - "@bazel_workspace_a//:bin" - - "@bazel_workspace_a//subdir:bin" - - "@bazel_workspace_b//:bin" - - "@bazel_workspace_b//subdir:bin" build_targets: - "//..." build_flags: @@ -118,10 +114,6 @@ tasks: - "//internal/npm_install/test:index" # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 #- "@fine_grained_deps_yarn//typescript/bin:tsc" - - "@bazel_workspace_a//:bin" - - "@bazel_workspace_a//subdir:bin" - - "@bazel_workspace_b//:bin" - - "@bazel_workspace_b//subdir:bin" build_targets: - "//..." build_flags: @@ -277,10 +269,6 @@ tasks: - "//internal/npm_install/test:index" # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 #- "@fine_grained_deps_yarn//typescript/bin:tsc" - - "@bazel_workspace_a//:bin" - - "@bazel_workspace_a//subdir:bin" - - "@bazel_workspace_b//:bin" - - "@bazel_workspace_b//subdir:bin" build_targets: - "//..." test_flags: @@ -387,10 +375,6 @@ tasks: - "//internal/npm_install/test:index" # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486 #- "@fine_grained_deps_yarn//typescript/bin:tsc" - - "@bazel_workspace_a//:bin" - - "@bazel_workspace_a//subdir:bin" - - "@bazel_workspace_b//:bin" - - "@bazel_workspace_b//subdir:bin" build_flags: - "--build_tag_filters=-e2e,-examples,-fix-windows,-manual" build_targets: diff --git a/WORKSPACE b/WORKSPACE index d5a91f6441..8dd222bd2b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -91,13 +91,6 @@ yarn_install( yarn_lock = "//packages/cypress/test:yarn.lock", ) -# Install all Bazel dependencies needed for integration test -# tools/npm_packages/bazel_workspaces -# (tested on CI and in the scripts/test_all.sh) -load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") - -install_bazel_dependencies(suppress_warning = True) - # We have a source dependency on build_bazel_rules_typescript # so we must repeat its transitive toolchain deps load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dev_dependencies") @@ -250,7 +243,6 @@ filegroup( name = "golden_files", srcs = [ "//:BUILD.bazel", - "//:install_bazel_dependencies.bzl", "//:manual_build_file_contents", "//:WORKSPACE", "//@angular/core:BUILD.bazel", diff --git a/docs/repositories.html b/docs/repositories.html index 2fe5133e89..cbd909e986 100755 --- a/docs/repositories.html +++ b/docs/repositories.html @@ -221,7 +221,6 @@

@npm

  • If you had a dependency on the foo package, you can reference @npm//foo to get all the files. We mirror the npm dependency graph, so if foo declares a dependency on another package dep, Bazel will include that dependency when foo is used.
  • If the foo package has an executable program bar, then @npm//foo/bin:bar is a nodejs_binary that you can call with bazel run or can pass as the executable to your own rules.
  • Sometimes you need a UMD bundle, but a package doesn’t ship one. For example, the concatjs_devserver rule depends on third-party libraries having a named UMD entry point. The @npm//foo:foo__umd target will automatically run Browserify to convert the package’s main entry into UMD.
  • -
  • DEPRECATED: A helper to install npm packages into their own Bazel repository: @npm//:install_bazel_dependencies.bzl provides a install_bazel_dependencies function. Some npm packages ship custom bazel rules, for example, the @angular/bazel package provides rules which you should load from @npm_angular_bazel//:index.bzl. However this causes the build to always fetch npm packages even when not needed, so we plan to remove this in a future release.
  • diff --git a/docs/repositories.md b/docs/repositories.md index bf04e786d5..d503ba73e8 100644 --- a/docs/repositories.md +++ b/docs/repositories.md @@ -53,7 +53,6 @@ Commonly used ones are: - If you had a dependency on the `foo` package, you can reference `@npm//foo` to get all the files. We mirror the npm dependency graph, so if `foo` declares a dependency on another package `dep`, Bazel will include that dependency when `foo` is used. - If the `foo` package has an executable program `bar`, then `@npm//foo/bin:bar` is a `nodejs_binary` that you can call with `bazel run` or can pass as the `executable` to your own rules. - Sometimes you need a UMD bundle, but a package doesn't ship one. For example, the `concatjs_devserver` rule depends on third-party libraries having a named UMD entry point. The `@npm//foo:foo__umd` target will automatically run Browserify to convert the package's `main` entry into UMD. -- DEPRECATED: A helper to install npm packages into their own Bazel repository: `@npm//:install_bazel_dependencies.bzl` provides a `install_bazel_dependencies` function. Some npm packages ship custom bazel rules, for example, the `@angular/bazel` package provides rules which you should load from `@npm_angular_bazel//:index.bzl`. However this causes the build to always fetch npm packages even when not needed, so we plan to remove this in a future release. > One convenient (maybe also confusing) way to understand what BUILD files are generated is to look at our integration test at https://github.com/bazelbuild/rules_nodejs/tree/stable/internal/npm_install/test/golden - this directory looks similar to the content of an `@npm` repository. diff --git a/examples/angular_view_engine/WORKSPACE b/examples/angular_view_engine/WORKSPACE index 867e54a655..81eeaf77aa 100644 --- a/examples/angular_view_engine/WORKSPACE +++ b/examples/angular_view_engine/WORKSPACE @@ -41,13 +41,6 @@ yarn_install( yarn_lock = "//:yarn.lock", ) -# Install the @angular/bazel package into @npm_angular_bazel -# Note, this will probably break in a future rules_nodejs release. -# It causes all builds to fetch npm packages even if not needed (eg. only building go code) -load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") - -install_bazel_dependencies(suppress_warning = True) - # Load @bazel/protractor dependencies load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies") diff --git a/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch b/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch index 75cda84485..b657db0fe0 100644 --- a/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch +++ b/examples/angular_view_engine/patches/@angular+bazel+9.0.5.patch @@ -1,3 +1,776 @@ +diff --git a/node_modules/@angular/bazel/_BUILD.bazel b/node_modules/@angular/bazel/_BUILD.bazel +index 7501525..172d4af 100755 +--- a/node_modules/@angular/bazel/_BUILD.bazel ++++ b/node_modules/@angular/bazel/_BUILD.bazel +@@ -6,12 +6,12 @@ pkg_npm( + ["*"], + exclude = ["yarn.lock"], + ) + [ +- "//src:package_assets", +- "//src/api-extractor:package_assets", +- "//src/builders:package_assets", +- "//src/ng_package:package_assets", +- "//src/ngc-wrapped:package_assets", +- "//src/schematics:package_assets", ++ "//@angular/bazel/src:package_assets", ++ "//@angular/bazel/src/api-extractor:package_assets", ++ "//@angular/bazel/src/builders:package_assets", ++ "//@angular/bazel/src/ng_package:package_assets", ++ "//@angular/bazel/src/ngc-wrapped:package_assets", ++ "//@angular/bazel/src/schematics:package_assets", + "//third_party/github.com/bazelbuild/bazel/src/main/protobuf:package_assets", + ], + nested_packages = [ +@@ -27,11 +27,11 @@ pkg_npm( + # Dependencies on the full npm_package cause long re-builds. + visibility = ["//integration:__pkg__"], + deps = [ +- "//src/api-extractor:lib", +- "//src/builders", +- "//src/ng_package:lib", +- "//src/ngc-wrapped:ngc_lib", +- "//src/schematics/ng-add", +- "//src/schematics/ng-new", ++ "//@angular/bazel/src/api-extractor:lib", ++ "//@angular/bazel/src/builders", ++ "//@angular/bazel/src/ng_package:lib", ++ "//@angular/bazel/src/ngc-wrapped:ngc_lib", ++ "//@angular/bazel/src/schematics/ng-add", ++ "//@angular/bazel/src/schematics/ng-new", + ], + ) +diff --git a/node_modules/@angular/bazel/docs/src/ng_package/ng_package.html b/node_modules/@angular/bazel/docs/src/ng_package/ng_package.html +index ec81d4a..d4e6615 100755 +--- a/node_modules/@angular/bazel/docs/src/ng_package/ng_package.html ++++ b/node_modules/@angular/bazel/docs/src/ng_package/ng_package.html +@@ -1,59 +1,80 @@ +- +- + + + + +- ++ + +- ++ + + Package Angular libraries for npm distribution + +- +- +- ++ ++ ++ + +- ++ + + +-
    ++
    +
    +
    +- Package Angular libraries for npm distribution ++ Package Angular libraries for npm distribution +
    +
    + +@@ -62,120 +83,187 @@ Documentation generated by Skydoc +
    +

    Package Angular libraries for npm distribution

    + +- +-
    ++ ++
    +

    Overview

    +-

    If all users of an Angular library use Bazel (e.g. internal usage in your company) +-then you should simply add your library to the deps of the consuming application.

    +-

    These rules exist for compatibility with non-Bazel consumers of your library.

    +-

    It packages your library following the Angular Package Format, see the +-specification of this format at https://goo.gl/jB3GVv

    +- +-
    ++

    ++ If all users of an Angular library use Bazel (e.g. internal usage in ++ your company) then you should simply add your library to the ++ deps of the consuming application. ++

    ++

    ++ These rules exist for compatibility with non-Bazel consumers of your ++ library. ++

    ++

    ++ It packages your library following the Angular Package Format, see ++ the specification of this format at ++ https://goo.gl/jB3GVv ++

    ++ ++
    + +

    primary_entry_point_name

    + +
    primary_entry_point_name(name, entry_point, entry_point_name)
    + +

    This is not a public API.

    +-

    Compute the name of the primary entry point in the library.

    +-

    Returns: +- name of the entry point, which will appear in the name of generated bundles

    +- ++

    Compute the name of the primary entry point in the library.

    ++

    ++ Returns: name of the entry point, which will appear in the name of ++ generated bundles ++

    + +

    Attributes

    + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
    name +-

    Name; Required

    +-

    the name of the ng_package rule, as a fallback.

    +-
    entry_point +-

    Unknown; Required

    +-

    The starting point of the application, see rollup_bundle.

    +-
    entry_point_name +-

    Unknown; Required

    +-

    if set, this is the returned value.

    +-
    +-
    ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
    name ++

    ++ Name; Required ++

    ++

    ++ the name of the ng_package rule, as a fallback. ++

    ++
    entry_point ++

    Unknown; Required

    ++

    ++ The starting point of the application, see rollup_bundle. ++

    ++
    entry_point_name ++

    Unknown; Required

    ++

    if set, this is the returned value.

    ++
    ++
    + +

    ng_package

    + +
    ng_package(name, deps, data, srcs, entry_point, entry_point_name, globals, include_devmode_srcs, license_banner, ng_packager, readme_md, rollup, rollup_config_tmpl, terser, terser_config_file)
    + +-

    ng_package produces an npm-ready package from an Angular library.

    +- ++

    ++ ng_package produces an npm-ready package from an Angular library. ++

    + +

    Attributes

    + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
    name +-

    Name; Required

    +-

    A unique name for this rule.

    +-
    deps +-

    List of labels; Optional; Default is []

    +-

    Other rules that produce JavaScript outputs, such as ts_library.

    +-
    data +-

    List of labels; Optional; Default is []

    +-

    Additional, non-Angular files to be added to the package, e.g. global CSS assets.

    +-
    srcs +-

    List of labels; Optional; Default is []

    +-

    JavaScript source files from the workspace. +- These can use ES2015 syntax and ES Modules (import/export)

    +-
    entry_point +-

    Label; Required

    +-

    The starting point of the application, passed as the --input flag to rollup.

    +-
        If the entry JavaScript file belongs to the same package (as the BUILD file),
    ++          
    ++            ++              ++              ++            
    ++            
    ++              
    ++                
    ++                
    ++              
    ++              
    ++                
    ++                
    ++              
    ++              
    ++                
    ++                
    ++              
    ++              
    ++                
    ++                
    ++              
    ++              
    ++                
    ++                
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-    
    +-      
    +-      
    +-    
    +-  
    +-
    name ++

    ++ Name; Required ++

    ++

    A unique name for this rule.

    ++
    deps ++

    ++ List of ++ labels; Optional; Default is [] ++

    ++

    ++ Other rules that produce JavaScript outputs, such as ++ ts_library. ++

    ++
    data ++

    ++ List of ++ labels; Optional; Default is [] ++

    ++

    ++ Additional, non-Angular files to be added to the package, ++ e.g. global CSS assets. ++

    ++
    srcs ++

    ++ List of ++ labels; Optional; Default is [] ++

    ++

    ++ JavaScript source files from the workspace. These can use ++ ES2015 syntax and ES Modules (import/export) ++

    ++
    entry_point ++

    ++ Label; Required ++

    ++

    ++ The starting point of the application, passed as the ++ --input flag to rollup. ++

    ++
        If the entry JavaScript file belongs to the same package (as the BUILD file),
    +     you can simply reference it by its relative name to the package directory:
    + 
    +     ```
    +@@ -218,93 +306,155 @@ specification of this format at https://goo.gl/j
    +     )
    +     ```
    + 
    +-
    entry_point_name +-

    String; Optional; Default is ''

    +-

    Name to use when generating bundle files for the primary entry-point.

    +-
    globals +-

    Dictionary mapping strings to string; Optional; Default is {}

    +-

    A dict of symbols that reference external scripts. +- The keys are variable names that appear in the program, +- and the values are the symbol to reference at runtime in a global context (UMD bundles). +- For example, a program referencing @angular/core should use ng.core +- as the global reference, so Angular users should include the mapping +- "@angular/core":"ng.core" in the globals.

    +-
    include_devmode_srcs +-

    Boolean; Optional; Default is False

    +- +-
    license_banner +-

    Label; Optional

    +-

    A .txt file passed to the banner config option of rollup. +- The contents of the file will be copied to the top of the resulting bundles. +- Note that you can replace a version placeholder in the license file, by using +- the special version 9.0.5. See the section on stamping in the README.

    +-
    ng_packager +-

    Label; Optional; Default is @npm//@angular/bazel/bin:packager

    +- +-
    readme_md +-

    Label; Optional

    +- +-
    rollup +-

    Label; Optional; Default is @npm_angular_bazel//src/ng_package:rollup_for_ng_package

    +- +-
    rollup_config_tmpl +-

    Label; Optional; Default is @npm_angular_bazel//src/ng_package:rollup.config.js

    +- +-
    terser +-

    Label; Optional; Default is @npm//terser/bin:terser

    +- +-
    terser_config_file +-

    Label; Optional; Default is @npm_angular_bazel//src/ng_package:terser_config.default.json

    +-

    A JSON file containing Terser minify() options.

    +-

    This is the file you would pass to the --config-file argument in terser's CLI. +-https://github.com/terser-js/terser#minify-options documents the content of the file.

    +-

    If config_file isn't supplied, Bazel will use a default config file.

    +-
    +- +- ++
    entry_point_name ++

    String; Optional; Default is ''

    ++

    ++ Name to use when generating bundle files for the primary ++ entry-point. ++

    ++
    globals ++

    ++ Dictionary mapping strings to string; Optional; Default ++ is {} ++

    ++

    ++ A dict of symbols that reference external scripts. The keys ++ are variable names that appear in the program, and the ++ values are the symbol to reference at runtime in a global ++ context (UMD bundles). For example, a program referencing ++ @angular/core should use ng.core as the global reference, so ++ Angular users should include the mapping ++ "@angular/core":"ng.core" in the globals. ++

    ++
    include_devmode_srcs ++

    Boolean; Optional; Default is False

    ++
    license_banner ++

    ++ Label; Optional ++

    ++

    ++ A .txt file passed to the banner config option ++ of rollup. The contents of the file will be copied to the ++ top of the resulting bundles. Note that you can replace a ++ version placeholder in the license file, by using the ++ special version 9.0.5. See the section on ++ stamping in the README. ++

    ++
    ng_packager ++

    ++ Label; Optional; Default is ++ @npm//@angular/bazel/bin:packager ++

    ++
    readme_md ++

    ++ Label; Optional ++

    ++
    rollup ++

    ++ Label; Optional; Default is ++ @npm_angular_bazel//@angular/bazel/src/ng_package:rollup_for_ng_package ++

    ++
    rollup_config_tmpl ++

    ++ Label; Optional; Default is ++ @npm_angular_bazel//@angular/bazel/src/ng_package:rollup.config.js ++

    ++
    terser ++

    ++ Label; Optional; Default is @npm//terser/bin:terser ++

    ++
    terser_config_file ++

    ++ Label; Optional; Default is ++ @npm_angular_bazel//@angular/bazel/src/ng_package:terser_config.default.json ++

    ++

    A JSON file containing Terser minify() options.

    ++

    ++ This is the file you would pass to the --config-file ++ argument in terser's CLI. ++ https://github.com/terser-js/terser#minify-options ++ documents the content of the file. ++

    ++

    ++ If config_file isn't supplied, Bazel will use a ++ default config file. ++

    ++
    +
    + +