Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Bash-less test execution #5508

Closed
4 of 6 tasks
laszlocsomor opened this issue Jul 3, 2018 · 2 comments
Closed
4 of 6 tasks

Windows: Bash-less test execution #5508

laszlocsomor opened this issue Jul 3, 2018 · 2 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests category: misc > testing P1 I'll work on this now. (Assignee required) platform: windows team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request

Comments

@laszlocsomor
Copy link
Contributor

laszlocsomor commented Jul 3, 2018

Description of the problem / feature request:

Design and implement a way to run tests without requiring tools/test/test-setup.sh.

Current functionality includes:

  • setting up environment variables, including making execution-root-relative paths absolute
  • handling signals by post-processing the test's output and transforming into an XML file
  • running the test either in a subshell or directly as a subprocess, and streaming its output to stdout
  • zipping up undeclared output files and writing the undeclared outputs manifest

I think the most complicated item is signal handling: on Windows, Bazel calls TerminateProcess when the user interrupts the test, which kills the test process without a chance to clean up. We may need to run two processes per test on Windows, one running the test and the other doing the cleanup work as soon as the first process is terminated.

Feature requests: what underlying problem are you trying to solve with this feature?

Motivation: #4319

Deliverables: (must be added to / linked from this GH issue):

  • doc explaining current test-setup.sh functionality
  • design doc explaining proposed Windows native approach and how the approach implements all important features of test-setup.sh
  • log of outcome of manual testing on a clean Windows installation without Bash
  • commits implementing this feature nativly on Windows
  • commits adding integration and regression tests for all features of test-setup.sh
  • commit dropping test-setup.sh usage on Windows and using only the new code path

Signals:

  • running the newly added tests
  • manual testing: running "bazel test //foo:bar_test" on a clean Windows installation without Bash

What operating system are you running Bazel on?

Windows 10

What's the output of bazel info release?

release 0.15.0
@laszlocsomor
Copy link
Contributor Author

laszlocsomor commented Jul 18, 2018

doc explaining current test-setup.sh functionality

laszlocsomor/proposals@332fa53

I won't merge this branch, instead I'll embed the text in the eventual design doc.

laszlocsomor added a commit to laszlocsomor/proposals that referenced this issue Jul 24, 2018
laszlocsomor added a commit to laszlocsomor/proposals that referenced this issue Jul 24, 2018
laszlocsomor added a commit to laszlocsomor/proposals that referenced this issue Jul 24, 2018
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 7, 2018
In this commit:

- Add the not-yet-documented
  `--windows_native_test_wrapper` flag. This flag
  will guard the new feature and allow the Bazel
  team to roll it out and deprecate the old test
  execution mechanism gradually.

- Add a target for the native implementation of
  the test wrapper.

- Hook up the test action creator logic to use the
  new binary, and add a test to assert this.

See bazelbuild#5508

Change-Id: I980a1a88cfabd04ddcf8a5b26620f8f3255f77ef
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 7, 2018
In this commit:

- Add the not-yet-documented
  `--windows_native_test_wrapper` flag. This flag
  will guard the new feature and allow the Bazel
  team to roll out the feature gradually, as well
  as to deprecate the old test execution mechanism
  gradually.

- Add a target for the native implementation of
  the test wrapper.

- Hook up the test action creator logic to use the
  new binary, and add a test to assert this.

See bazelbuild#5508

Change-Id: I980a1a88cfabd04ddcf8a5b26620f8f3255f77ef
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 7, 2018
In this commit:

- Add the not-yet-documented
  `--windows_native_test_wrapper` flag. This flag
  will guard the new feature and allow the Bazel
  team to roll out the feature gradually, as well
  as to deprecate the old test execution mechanism
  gradually.

- Add a target for the native implementation of
  the test wrapper.

- Hook up the test action creator logic to use the
  new binary, and add a test to assert this.

See bazelbuild#5508

Change-Id: I980a1a88cfabd04ddcf8a5b26620f8f3255f77ef
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 7, 2018
In this commit:

- Add the not-yet-documented
  `--windows_native_test_wrapper` flag. This flag
  will guard the new feature and allow the Bazel
  team to roll out the feature gradually, as well
  as to deprecate the old test execution mechanism
  gradually.

- Add a target for the native implementation of
  the test wrapper.

- Hook up the test action creator logic to use the
  new binary, and add a test to assert this.

See bazelbuild#5508

Change-Id: I980a1a88cfabd04ddcf8a5b26620f8f3255f77ef
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 7, 2018
Motivation: as part of fixing issue bazelbuild#5508, I'll
add a cc_binary to this package. The binary will
be embedded in Bazel as a prebuilt binary (to
avoid requiring a C++ compiler to use it).
Therefore //tools/test/BUILD and
@bazel_tools//tools/test/BUILD will contain
different rules, mandating the BUILD file split.

See bazelbuild#5508

Change-Id: If21bafbc3d83d59e52de498cf3efd2b1b79fa7b6
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 8, 2018
Add empty implementation of the Windows-native
test wrapper, add it to the embedded tools, and
depend on it from test rules.

See bazelbuild#5508
See https://github.com/laszlocsomor/proposals/blob/win-test-runner/designs/2018-07-18-windows-native-test-runner.md

Change-Id: I15ce28beb6eb98cb9dd60e2158b906c5b0ae9bb9
bazel-io pushed a commit that referenced this issue Aug 9, 2018
Motivation: as part of fixing issue #5508, I'll
add a cc_binary to this package. The binary will
be embedded in Bazel as a prebuilt binary (to
avoid requiring a C++ compiler to use it).
Therefore //tools/test/BUILD and
@bazel_tools//tools/test/BUILD will contain
different rules, mandating the BUILD file split.

See #5508

Change-Id: If21bafbc3d83d59e52de498cf3efd2b1b79fa7b6

Closes #5787.

Change-Id: If21bafbc3d83d59e52de498cf3efd2b1b79fa7b6
PiperOrigin-RevId: 208005382
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 10, 2018
This commit adds:

- the skeleton implementation of the Windows
  native test wrapper

- the --windows_native_test_wrapper Bazel flag,
  which is currently a no-op

See bazelbuild#5508

Change-Id: I8df95c8ce8bab53c51c257698ec95416065a836e
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 10, 2018
This commit adds:

- the skeleton implementation of the Windows
  native test wrapper

- a depenency on the native test wrapper from test
  rules, through the new $test_wrapper rule
  attribute

- the --windows_native_test_wrapper Bazel flag,
  which is currently a no-op

See bazelbuild#5508

Change-Id: I8df95c8ce8bab53c51c257698ec95416065a836e
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 10, 2018
This commit adds:

- the skeleton implementation of the Windows
  native test wrapper

- a depenency on the native test wrapper from test
  rules, through the new $test_wrapper rule
  attribute

- the --windows_native_test_wrapper Bazel flag,
  which is currently a no-op

See bazelbuild#5508

Change-Id: I8df95c8ce8bab53c51c257698ec95416065a836e
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 10, 2018
This commit adds:

- the skeleton implementation of the Windows
  native test wrapper

- a depenency on the native test wrapper from test
  rules, through the new $test_wrapper rule
  attribute

- the --windows_native_test_wrapper Bazel flag,
  which is currently a no-op

See bazelbuild#5508

Change-Id: I8df95c8ce8bab53c51c257698ec95416065a836e
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 10, 2018
This commit adds:

- the skeleton implementation of the Windows
  native test wrapper

- a depenency on the native test wrapper from test
  rules, through the new $test_wrapper rule
  attribute

- the --windows_native_test_wrapper Bazel flag,
  which is currently a no-op

See bazelbuild#5508

Change-Id: I8df95c8ce8bab53c51c257698ec95416065a836e
bazel-io pushed a commit that referenced this issue Aug 14, 2018
This commit adds:

- the skeleton implementation of the Windows
  native test wrapper

- a depenency on the native test wrapper from test
  rules, through the new $test_wrapper rule
  attribute

- the --windows_native_test_wrapper Bazel flag,
  which is currently a no-op

See #5508

Change-Id: I8df95c8ce8bab53c51c257698ec95416065a836e

Closes #5854.

Change-Id: I2ffc78bceec5dd867af775b5878f105fa87c3dba
PiperOrigin-RevId: 208650699
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 17, 2018
Use the not-yet-functional test_wrapper on Windows
when --windows_native_test_wrapper is enabled,
otherwise use the test-setup.sh script like other
platforms.

See bazelbuild#5508

Change-Id: I961b5a10b92758045aef4cc6a1fca125a82f7e5b
laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Aug 17, 2018
Use the not-yet-functional test_wrapper on Windows
when --windows_native_test_wrapper is enabled,
otherwise use the test-setup.sh script like other
platforms.

See bazelbuild#5508

Change-Id: I961b5a10b92758045aef4cc6a1fca125a82f7e5b
laszlocsomor added a commit to laszlocsomor/bazel-skylib that referenced this issue Apr 9, 2019
This new test rule compares two files and passes
if the files match.

On Linux/macOS/non-Windows, the test compares
files using 'diff'.

On Windows, the test compares files using
'fc.exe'. This utility is available on all Windows
versions I tried (Windows 2008 Server, Windows
2016 Datacenter Core).

See bazelbuild/bazel#5508
See bazelbuild/bazel#4319
c-parsons pushed a commit to bazelbuild/bazel-skylib that referenced this issue Apr 12, 2019
This new test rule compares two files and passes
if the files match.

On Linux/macOS/non-Windows, the test compares
files using 'diff'.

On Windows, the test compares files using
'fc.exe'. This utility is available on all Windows
versions I tried (Windows 2008 Server, Windows
2016 Datacenter Core).

See bazelbuild/bazel#5508
See bazelbuild/bazel#4319
laszlocsomor added a commit to laszlocsomor/buildtools that referenced this issue Apr 16, 2019
Depend on Skylib [1] and replace the sh_test of
//api_proto:api.gen.pb.go_checkshtest by a
diff_test rule.

This test rule works on Windows without Bash and
with the coming Windows-native test wrapper (see
bazelbuild/bazel#5508).
laszlocsomor added a commit to laszlocsomor/buildtools that referenced this issue Apr 16, 2019
Fix the Starlark rule generating
//api_proto:api.gen.pb.go_checkshtest so it works
on Windows, where a runfiles tree is not
available.

To fix, the generated shell script now uses the
Bash runfiles library to locate the files to
compare.

See bazelbuild/bazel#5508
laszlocsomor added a commit to laszlocsomor/buildtools that referenced this issue Apr 16, 2019
Fix the Starlark rule generating
//api_proto:api.gen.pb.go_checkshtest so it works
on Windows, where a runfiles tree is not
available.

To fix, the generated shell script now uses the
Bash runfiles library to locate the files to
compare.

See bazelbuild/bazel#5508
laszlocsomor added a commit to laszlocsomor/rules_nodejs that referenced this issue Apr 16, 2019
Fix the jasmine_node_test() rule on Windows when
tested with Bazel's Windows-native test wrapper
(see bazelbuild/bazel#5508).

jasmine_node_test now uses nodejs_test_macro, so
on Windows it depends on the sh_test (whose output
is an .exe file) and not on nodejs_test (whose
output is a .sh file). The native test wrapper
can't test nodejs_test directly because it can't
create a subprocess for an .sh file.
pmbethe09 pushed a commit to bazelbuild/buildtools that referenced this issue Apr 16, 2019
Fix the Starlark rule generating
//api_proto:api.gen.pb.go_checkshtest so it works
on Windows, where a runfiles tree is not
available.

To fix, the generated shell script now uses the
Bash runfiles library to locate the files to
compare.

See bazelbuild/bazel#5508
laszlocsomor added a commit to laszlocsomor/rules_go that referenced this issue Apr 18, 2019
Rewrite the files_equal_test() rules as a macro.
The macro creates:
- a sh_test, the actual test rule
- a genrule that writes the source for the sh_test

The old implementation was a Starlark test rule
with a Bash script executable. Such a test cannot
run on Windows with Bazel's Windows-native test
wrapper, because the test wrapper cannot create a
subprocess for .sh file, only for native binaries
like an .exe file.

The new implementation wraps the .sh file in a
sh_test, which builds an .exe file on Windows.
Bazel and the new native test wrapper can now run
files_equal_test.

[1] see bazelbuild/bazel#5508
    and --incompatible_windows_native_test_wrapper
kyliau pushed a commit to bazel-contrib/rules_nodejs that referenced this issue Apr 18, 2019
Fix the jasmine_node_test() rule on Windows when
tested with Bazel's Windows-native test wrapper
(see bazelbuild/bazel#5508).

jasmine_node_test now uses nodejs_test_macro, so
on Windows it depends on the sh_test (whose output
is an .exe file) and not on nodejs_test (whose
output is a .sh file). The native test wrapper
can't test nodejs_test directly because it can't
create a subprocess for an .sh file.
jayconrod pushed a commit to bazel-contrib/rules_go that referenced this issue Apr 19, 2019
Rewrite the files_equal_test() rules as a macro.
The macro creates:
- a sh_test, the actual test rule
- a genrule that writes the source for the sh_test

The old implementation was a Starlark test rule
with a Bash script executable. Such a test cannot
run on Windows with Bazel's Windows-native test
wrapper, because the test wrapper cannot create a
subprocess for .sh file, only for native binaries
like an .exe file.

The new implementation wraps the .sh file in a
sh_test, which builds an .exe file on Windows.
Bazel and the new native test wrapper can now run
files_equal_test.

[1] see bazelbuild/bazel#5508
    and --incompatible_windows_native_test_wrapper

Fixes #2034
jayconrod pushed a commit to bazel-contrib/rules_go that referenced this issue May 8, 2019
Rewrite the files_equal_test() rules as a macro.
The macro creates:
- a sh_test, the actual test rule
- a genrule that writes the source for the sh_test

The old implementation was a Starlark test rule
with a Bash script executable. Such a test cannot
run on Windows with Bazel's Windows-native test
wrapper, because the test wrapper cannot create a
subprocess for .sh file, only for native binaries
like an .exe file.

The new implementation wraps the .sh file in a
sh_test, which builds an .exe file on Windows.
Bazel and the new native test wrapper can now run
files_equal_test.

[1] see bazelbuild/bazel#5508
    and --incompatible_windows_native_test_wrapper

Fixes #2034
jayconrod pushed a commit to bazel-contrib/rules_go that referenced this issue May 8, 2019
Rewrite the files_equal_test() rules as a macro.
The macro creates:
- a sh_test, the actual test rule
- a genrule that writes the source for the sh_test

The old implementation was a Starlark test rule
with a Bash script executable. Such a test cannot
run on Windows with Bazel's Windows-native test
wrapper, because the test wrapper cannot create a
subprocess for .sh file, only for native binaries
like an .exe file.

The new implementation wraps the .sh file in a
sh_test, which builds an .exe file on Windows.
Bazel and the new native test wrapper can now run
files_equal_test.

[1] see bazelbuild/bazel#5508
    and --incompatible_windows_native_test_wrapper

Fixes #2034
jayconrod pushed a commit to bazel-contrib/rules_go that referenced this issue May 8, 2019
Rewrite the files_equal_test() rules as a macro.
The macro creates:
- a sh_test, the actual test rule
- a genrule that writes the source for the sh_test

The old implementation was a Starlark test rule
with a Bash script executable. Such a test cannot
run on Windows with Bazel's Windows-native test
wrapper, because the test wrapper cannot create a
subprocess for .sh file, only for native binaries
like an .exe file.

The new implementation wraps the .sh file in a
sh_test, which builds an .exe file on Windows.
Bazel and the new native test wrapper can now run
files_equal_test.

[1] see bazelbuild/bazel#5508
    and --incompatible_windows_native_test_wrapper

Fixes #2034
blico pushed a commit to blico/rules_go that referenced this issue May 10, 2019
Rewrite the files_equal_test() rules as a macro.
The macro creates:
- a sh_test, the actual test rule
- a genrule that writes the source for the sh_test

The old implementation was a Starlark test rule
with a Bash script executable. Such a test cannot
run on Windows with Bazel's Windows-native test
wrapper, because the test wrapper cannot create a
subprocess for .sh file, only for native binaries
like an .exe file.

The new implementation wraps the .sh file in a
sh_test, which builds an .exe file on Windows.
Bazel and the new native test wrapper can now run
files_equal_test.

[1] see bazelbuild/bazel#5508
    and --incompatible_windows_native_test_wrapper

Fixes bazel-contrib#2034
Globegitter added a commit to Globegitter/rules_nodejs that referenced this issue Jun 6, 2019
Add toolchain files.

Working toolchain setup for normal build.

Early progress on multi-os npm packages.

Introduce @bazel/jasmine package

This will eventually replace the built-in jasmine_node_test rule.
It has the advantage that it brings a transitive dep on the jasmine npm package

Fix broken test; wasn't run on CI

make node_repositories optional

The common WORKSPACE pattern is to pass no arguments to it, and use yarn_install or npm_install
We can make the trivial WORKSPACE file shorter."

Update README

Adds a quickstart section and a listing of rules. I think this can be our manifest of first-party authored rules

Add release instructions for @bazel/jasmine (bazel-contrib#552)

Improve jasmine warning message

rel: 0.18.7

Fix release instructions

Update README.md; fix typo

of -> or

Include install_bazel_workspaces in quickstart

README: fix quickstart

npm_package: allow root package to vendor content from external workspace

Add @bazel/typescript package

I checked the content of the built package by diff'ing it against the currently built one

Add minimal testing for new packages/typescript

Cleanup README, add generated API docs

Increase circleci machine size

Now that we have to compile Go, TypeScript, etc to build rules_typescript from source

Generalize npm release for more packages

Fix @bazel/typescript package for downstream usage

Add missing BUILD file to @bazel/typescript package

Revert "Add missing BUILD file to @bazel/typescript package"

This reverts commit 283f140.
It broke the build

Move load() statement at the top.

Bazel might enforce it in the future (--incompatible_bzl_disallow_load_after_statement)

Move @bazel/karma from rules_typescript (bazel-contrib#558)

* Move @bazel/karma package to rules_nodejs

* ci: split to more jobs

Add e2e tests for @bazel/jasmine, @bazel/karma & @bazel/typescript npm packages

Update docs for release

rel: 0.26.0-beta.0

Clean up new published markdown docs

Move copy_repository from tools to internal

Refactor /internal/test:node_modules into @npm + fixes (bazel-contrib#575)

Fixes:

* `yarn_install/npm_install` `generate_build_file.js` now treats every folder under node_modules as a package regardless of it having a package.json file or not. npm will treat them as such when resolving so we should too.
* jasmine_runner attempts to require jasmine-core from `jasmine/node_modules/jasmine-core` before falling back to `jasmine-core`. this is so that if `jasmine-core`, which is a transitive dep of `jasmine` is not hoisted it can still be required with only the `@npm//jasmine` dep
* jasmine_node_test (in `@bazel/jasmine`) `jasmine` attribute change to `@npm//@bazel/jasmine` since this is the only guaranteed label. `@npm//jasmine` may not exists if it is not hoisted
* symlinked data files in yarn_install & npm_install cause issues if these are used as npm packages via `file://` on linux. copies are made of files instead

Introduce @bazel/labs package.

This follows the same rationale as @angular/labs.
I imagine things like the Webpack plugin should go here until they reach stability

Add renovate.json

Switch build_bazel_rules_typescript to git_repository

Fix commit sha of rules_typescript

rel: 0.26.0

chore(deps): update build_bazel_rules_typescript commit hash to c1b7492

Update rollup_bundle dependencies

We now tree-shake @PURE-annotated code.

Fix @bazel/typescript homepage URL

Fix _copy.sh shebang

/bin/bash does not exist on all systems. E.g. NixOS. This patch uses
`/usr/bin/env bash` instead.

Add yarn 0.13.0 and make it the default version of yarn for node_repositories() (bazel-contrib#590)

Fix launcher_template.sh shebang (bazel-contrib#589)

Fix release version in README.md

The release script didn't know how to replace the "beta.0" segment

chore(deps): update build_bazel_rules_typescript commit hash to 94cfb6d

Produce native ES modules in rollup es2015 mode

Change the names of the chunk directories. Having dots in the names make users assume these are files, not directories.
Also the 'cs' extension isn't as obvious as 'chunks'.

It seems wrong that the test has to change to grab the default export. Need to figure out still.

Switch from uglify-es to terser.

The former is unmaintained, and we want terser so we can minify es2015 code.

Add buildifier settings for VSCode

Use correct name es2015 rather than es6

Fixes for rollup_bundle refactoring

Change the es2015 primary js output to native modules rather than systemjs

Add minified es2015 output to rollup_bundle

Docs (bazel-contrib#596)

* cleanup package.jsons

use repository rather than homepage pointing to github

* fix formatting nits in @bazel/typescript README

Update bazel toolchains pin and add toolchain config target

WIP: switch to stardoc

Move rule docstrings to the doc attribute

Revert docstring move for repository_rule

it doesn't have a doc attribute, and isn't supported by stardoc yet

Fix stardoc to document rules, not the wrapping macros

Add parallelism for test_e2e circleci job

chore(deps): update build_bazel_rules_typescript commit hash to 023eb7b

Add commonjs plugin to rollup_bundle

Lint fix

Update internal/e2e/rollup_fine_grained_deps test after adding commonjs plugin to rollup_bundle

Remove old code

Fix RBE build

Lint fix

Update docs for release

rel: 0.27.0

release process should run locally installed bazel version

fix(@bazel/typescript): remove unknown rules from generated API doc

Hopefully this fixes it so npmjs will render the README

rel: 0.27.1

Remove @bazel/typescript deps on jasmine/karma

These should only be in @bazel/karma package

feat(@bazel/jasmine): add shard_count support

Improve build & reduce ci build time with parallelism

Fixes following big refactoring

rel: 0.27.2

fix(@bazel/jasmine): convert shard vars to number

rel: 0.27.3

Re-do logic from jrunner.execute() in jasmine_runner.js since we're now calling jasmine.getEnv().execute(specs) instead (bazel-contrib#609)

chore(deps): update build_bazel_rules_typescript commit hash to 45cf49b

rel: 0.27.4

Support differential loading

web_package rule will now create separate script tags for ESmodule files and es5 javascript.
See the examples/web_package

Also fixes linting nit in the README for the order of attributes.
Add ibazel dependency for local development

chore(deps): update build_bazel_rules_typescript commit hash to 329ecca

Add examples & e2e tests from rules_typescript & related fixes

Enable clang-format for .proto files

Address review comment

Remove unnecessary fencing in /packages/typescript/BUILD.bazel

Add missing .bazelignore files for nested workspaces with node_modules folders

Link deps in package.json files when building & publishing releases

Remove unused build target

Make test sharding work with jasmine focusing

Instead of manually passing the specs, use the built-in filtering mechanism

Update docs for release

rel: 0.27.5

fix yarn_install and npm_install after changed packages

Previously it did not re-copy the package contents, so the bazel workspace would be stale

Fix jasmine entry_point and bootstrap pattern

Update dependency io_bazel_rules_go to v0.18.1

rel: 0.27.6

Fix web_package injector nomodule issue when no matching script ESModule script

Update rules_typescript to 3a85a90

circleci: remove post_checkout step

it's broken on master, and has fallen behind the setup in angular/angular

rel: 0.27.7

Use cacheable http_archive with sha256 for io_bazel as its a very large download (bazel-contrib#624)

Add rollup-plugin-amd to rollup_bundle to support bundling *.ngfactory.js AMD files generated by ngc

This is a workaround for the following issue angular/angular#29491

rel: 0.27.8

Update README.md

Fixes bazel-contrib#628

chore(deps): update build_bazel_rules_typescript commit hash to d6fe9d4

fix jasmine_node_test with sharding doesn't fail

feat(@bazel/jasmine): add coverage reporting (bazel-contrib#553)

Adds Coverage collection support via the V8 Coverage API's
This feature is disabled by default but can be enabled with `coverage = True`
There is a performance overhead (~20%) by enabling this feature
When enabled the only reported is text-summary which outputs the coverage
summary as stdout, but we plan to integrate with bazel coverage for better reporting
across a whole repository

Don't load the deprecated jasmine_node_test from other rules.

This prints extra warnings in users builds that they can't fix (and the warnings don't even indicate what file has the dependency)

fix(docs): Remove unrelated module mappings comments (bazel-contrib#634)

The comments were copied from module_mappings.bzl but they are unrelated
to the file in context.

Fix jasmine & jasmine-core requires in jasmine_runner.js (bazel-contrib#633)

* Fix jasmine & jasmine-core requires in jasmine_runner.js
* Fix local jasmine package test
* Fix bad require logic that ends up requiring wrong jasmine-core

Don't update gecko driver or selenium stand-alone in webdriver-manager update calls

We don't require either for CI or tests and they are not pinned which led to an intermittent CI failure with the gecko driver recently.

Add jasmine_node_test that fails without fix from bazel-contrib#633

rel: 0.27.9

Checkout and test latest angular-bazel-example with latest nodejs rules in CI

Run examples e2e script if it exists in package.json (for angular-bazel-example testing)

Update to latest rules_typescript

Run buildifier.

Clarify install instructions to fix a pitfall (bazel-contrib#648)

Fixes bazel-contrib#647

Support yarn_install & npm_install `bazelBin` `additionalAttributes` for generated nodejs_binary targets for package.json `bin` files (bazel-contrib#649)

Clean packages from yarn cache in process_package_json step of yarn_install that have file:// URIs (bazel-contrib#639)

Also includes local development script updates

Add visible alias for the metadata entry of ts_devserver

When writing custom web servers that host your development environment,
it is necessary to have the manifest of all development files that need
to be served. This change reexposes the manifest under the provided
visibility for consumption in such purposes.

feat: Add ng_apf_library rule & dev_scripts_aspect

This commit adds detection logic for NPM packages that are in
the Angular Package Format (APF) and generates `ng_apf_library`
target instead of the default filegroup target.

`ng_apf_library` targets provide a custom `scripts` attribute,
which is then later collected by `dev_scripts_aspect` and
exposed through the `dev_scripts` provider.

dev_scripts are automatically appended to ts_devserver `scripts`
and ts_web_test_suite `srcs` so that they no longer need to be
specified manually.

For more info see design doc:
https://docs.google.com/document/d/16t7s3DplajCEbDwZTXyeYWIBHnXc22nngrXfVitFFNo

test(npm_install): Add angular deps and update golden files

refactor(sources_aspect): collect node_sources and dev_scripts

rel: 0.27.10

fix(e2e/karma): workspace name should be e2e_karma_typescript (bazel-contrib#654)

fix(npm_install) exclude test directory (bazel-contrib#653)

PR closes bazel-contrib#652

Delete per platform deps as well as some other unnecessary code.

Download correct nodejs version and have convinience nodejs.

Lint fix.

Rename build file and add toolchain files to the release package.

Fix lint.

Add toolchain bazel libraries.

Added platforms and fix fetching.

Fix host os.

Special case nodejs name.

Added more debugging logs.

Fix windows builds.

Remove debug statements.

test(karma): Add test for aspect collecting from srcs, deps, runtime_deps

build: remove duplicate dependencies

At the moment jasmine-core and semver are listed both as dependencies and dev dependencies.

Update bazel_skylib dependency to 0.8.0

Fix Buildifier warning

chore(deps): update dependency com_github_mattn_go_isatty to v0.0.7

Fix for bazel-contrib#652: Running "bazel run @nodejs//:yarn" twice fails with unlink error

Remove unused file export (bazel-contrib#664)

Update scripts to unlink deps in package.json for nested workspaces after builds & tests to reduce local changes (bazel-contrib#665)

Update lock files in nested workspaces (bazel-contrib#666)

Put @fine_grained_deps_yarn and @fine_grained_deps_npm package.json files in separate folders (bazel-contrib#667)

This is part of pre-factoring for switching to user node_modules in yarn_install & npm_install

Update to rollup-plugin-node-resolve 4.2.0 and use new mainFields option

Add .bazelignore to nested workspaces

Update dependency io_bazel_rules_go to v0.18.2

Cleanup mkdirp and unnecessary code in web_package/assembler.js

Fix yarn & npm determinism tests in /internal/e2e/packages

Cleanup rollup bundle variable name

Update bazel_toolchains commit hash to eedddd4

Setup angular-bazel-example for local testing in test_all.sh script

fix(karma): turn on Karma debug logs in DEBUG mode

Cleanup package_example

* rename workspace to internal_e2e_packages
* separate folders for each yarn_install & npm_install as prefactor for user node_modules

chore(deps): update bazel_toolchains commit hash to ed6370d

Replace genrules with copy_file/write_file rules (bazel-contrib#658)

The new rules are in bazel_skylib 0.8.0. Their
advantages over genrule are:

- cleaner rule interface
- no Bash required on Windows
- compatible with Bazel's Bash-less test execution
  on Windows

See bazelbuild/bazel#6622

Support for transitive npm dependencies (bazel-contrib#675)

Add test for transitive npm deps in rollup_bundle to e2e/typescript_3.1

Preserve symlinks when resolving in rollup_bundle and ensure it does not resolve outside of execroot sandbox

Consolidate node module rules & providers & support transitive npm deps via collect_node_modules_aspect

Introduce a webpack_bundle rule

It lives in the @bazel/labs package for now to set users expectations properly.

Add e2e test for webpack_bundle

chore(deps): update build_bazel_rules_typescript commit hash to 0bd1791

chore(deps): update bazel_toolchains commit hash to 1255911

Fix duplicate deps in yarn_install & npm_install generated scope targets

.

rel: 0.27.11

rel: 0.27.12

chore(deps): update bazel_toolchains commit hash to 9c2e98b

feat(karma): Load karma-* dependencies from @bazel/karma

This commit adds plugins.js to resolve karma-* dependencies installed by
@bazel/karma.

feat(karma): bump karma-jasmine to v2

This would make it consistent with the version of karma-jasmine
used in projects generated by the CLI.
https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/workspace/files/package.json.template#L39

fix(bazel): export getNativeBinary()

`@bazel/bazel` should export getNativeBinary() method so that downstream
consumers can locate the actual Bazel binary and spawn a process using
custom options. If loaded as script the package should work as before.

chore(deps): update dependency io_bazel_rules_go to v0.18.3

Add LICENSE files (bazel-contrib#696)

This makes us work with https://www.npmjs.com/package/license-checker

Simplify versions in package.bzl for renovate (bazel-contrib#695)

feat(rollup): provide output groupings of js+map for each bundle type

Add jasmine-core dependency to @bazel/jasmine since it is required in its index (bazel-contrib#698)

fix: create nodejs_binary rules for non-empty bin entries

Fixes bazel-contrib#692

fix(npm_package): deps should allow files

BREAKING CHANGE: npm_package now throws for any files in `srcs` which
do not reside in the same package as the target.

The `deps` attr of `npm_package` should allow files.
A common use case would be named output of other rules, such as
`rollup_bundle`. In which case, user should be able to add
`bundle.umd.js` from `rollup_bundle` to the deps of npm_package.

Windows: fix jasmine_node_test on Windows with TW

Fix the jasmine_node_test() rule on Windows when
tested with Bazel's Windows-native test wrapper
(see bazelbuild/bazel#5508).

jasmine_node_test now uses nodejs_test_macro, so
on Windows it depends on the sh_test (whose output
is an .exe file) and not on nodejs_test (whose
output is a .sh file). The native test wrapper
can't test nodejs_test directly because it can't
create a subprocess for an .sh file.

Fix //internal/npm_package/test:test

Change the file npm_package.spec.js was locating,
from "test.sh" to just "test".

Add missing progress_message to actions (bazel-contrib#706)

Fixes bazel-contrib#705

chore: update to @bazel/bazel 0.24.1 and other deps (bazel-contrib#712)

Updated deps are pinned and will be added renovate shortly so that deps are updated automatically in the future

Update to buildifier 0.22.0 and fix new lint warnings (bazel-contrib#713)

Don’t check no-effect warning since doc attribute causes a build error in Ubuntu 14.04 only. Need to update to stardoc. See bazelbuild/buildtools#471 for more details.

Don’t gitignore /internal/npm_install/test/golden/node_modules

Also clean *all* node_modules folders in clean script included nested ones

Don't test on Ubuntu 14.04 (bazel-contrib#718)

Ubuntu 14.04 is about to be end-of-life and Bazel CI will stop supporting it shortly afterwards.

Context: https://groups.google.com/d/msg/bazel-dev/_D6XzfNkQQE/8TNKiNmsCAAJ

Remove yarn_install & npm_install dependency on Windows powershell

Fixes angular/angular#29760

Remove /internal/e2e/bazel_workspaces as this coverage is handled by 'bazel run @test_workspace//:bin'

Once bazelbuild/bazel#8090 it can be covered with 'bazel test @test_workspace//...' instead

Run targets in BazelCI

Rollup bundle rule does not resolve external source maps

In order to support external source-maps, the `rollup-plugin-sourcemaps` module has been added to the
rollup configuration. Unfortunately this currently only has an effect on Windows as the sandbox is not
available and the plugin can read the referenced external `.map` files.

When running in the Bazel sandbox or within RBE, these map files can't be read by the plugin because the `.map`
files are omitted from the `run_rollup` action inputs. This causes inconsistent behavior and makes the sourcemaps
plugin a no-op right now.

feat(rollup): provide es5 and minified umd bundles

Closes bazel-contrib#685

update pin to bazel toolchains repo

rel: 0.28.0

feat(rollup): add rollup-plugin-json

No --types for rollup_bundle tsc downleveling & make --libs consistent between tsc and tsc-directory

This fixes an issue observed where types files could break downleveling action if they used higher level language constructs

Add check_bazel_version_range function

Return typescript legacy provider from node_modules_library with the npm package's typescript declaration files

Cleanup srcs/deps/scripts attributes in node_module_library and its usage

Generated __pkg targets should not use srcs but should only specify __files targets in deps so that sources_aspect picks up all dev_scripts via deps tree which means the transitive lookup in node_module_library can be removed

Update dependency io_bazel_rules_go to v0.18.4

chore(deps): update build_bazel_rules_typescript commit hash to e50c806

chore(deps): update dependency com_github_kylelemons_godebug to v1

fix(web_package): normalize root paths consistently with ts_devserver

Fixes bazel-contrib#728

handle  in expand_path_into_runfiles

Update npm fine grained deps targets to support strict npm deps

Add missing strict npm deps

Example of compile error that turning on strict npm deps resulted in:

```
main.spec.ts:1:21 - error TS2307: transitive dependency on external/npm/node_modules/typescript/lib/typescript.d.ts not allowed. Please add the BUILD target to your rule's deps.
1 import * as ts from 'typescript';
```

Add a `@npm//node_modules/package:package__umd` named_umd_bundle target to npm packages. (bazel-contrib#725)

This generates a named-UMD bundle @npm//node_modules/package:package.umd.js if this file does not already exists. For npm packages that don’t ship with named UMD bundles, this target can be used to supply one to rules such as ts_devserver & ts_web_test_suite.

update dependency to v8-coverage@1.0.9

fixes bazel-contrib#748

Update rules_webtesting

This fixes the warning /usr/local/google/home/alexeagle/.cache/bazel/_bazel_alexeagle/5c094f47f582dc47fc598194e749d5c0/external/bazel_skylib/skylark_library.bzl:23:1: WARNING: skylark_library.bzl is deprecated and will go away in the future, please use bzl_library.bzl instead.

Turn on npm strict deps by updating to rules_typescript commit that enables it for ts_library

Update docs for release

rel: 0.29.0

Update to bazel 0.25.1 (bazel-contrib#752)

* Update to bazel 0.25.1

* Load syntax fix

vendor parse5

This allows us to remove one of our nested yarn install commands.
It makes the first build faster and simplifies how installation works.

chore(deps): update build_bazel_rules_typescript commit hash to 2335368

Lint fix.

Some progress.

Fix build with --incompatible_depset_is_not_iterable

Soon, Bazel will forbid iteration on a depset, it needs to be explicitly
converted to list.

Update @bazel/karma to latest sable Chromium 74 for osx & linux (bazel-contrib#766)

OSX Chromium 73+ requires disabling of the sandbox under Bazel
Windows still on Chromium 66 and updating that is a separate task and requires changes to rules_webtesting as the archive name & executable path has changed

Mirror bazel and buildifier

This adds a Windows binary for buildifier

Update build_bazel_rules_typescript commit hash to 695059f

Update protobuf dependency

With this change, the code works with Bazel flag `--incompatible_disable_deprecated_attr_params`, which will be enabled soon.

Add zlib dependency for protobuf

Update dependency io_bazel_rules_go to v0.18.5

rel: 0.29.1

add `ngI18nClosureMode` constant to terser

rel: 0.29.2

feat: user’s workspace node_modules used by yarn_install & npm_install (bazel-contrib#704)

Optimize string.match(regex) to regex.test(string) (bazel-contrib#704)

Cleanup of internal/e2e tests (bazel-contrib#704)

Add clean_legacy_e2e.sh script for local dev (bazel-contrib#704)

Lock file updates (bazel-contrib#704)

Update to Bazel 0.26.0-rc10 (bazel-contrib#704)

Minimum Bazel version is now 0.26.0 as yarn_install & npm_install depend on managed_directories by default (bazel-contrib#704)

choose Bazel RC to get tests passing on buildkite (bazel-contrib#704)

Remove empty attributes from generated BUILD files (bazel-contrib#704)

Filter out .bin and other folders starting with . from list of packages (bazel-contrib#704)

Update golden (bazel-contrib#704)

Fix examples/angular to use bazel version from root package.json (bazel-contrib#704)

update bazel for buildkite again

rc11 was built on wrong platform

Fforward all args to originalResolveFilename

Make sure to test the require resolve behaiour.

Add missing file.

Ensure to pass on all arguments in all cases.

Fix.

Remove debugging statement.

chore(deps): update build_bazel_rules_typescript commit hash to 7b6fde8

chore(deps): update dependency com_github_mattn_go_isatty to v0.0.8

Update docs for release

rel: 0.30.0

Add test coverage for manual_build_file_contents...  (bazel-contrib#780)

* Add test coverage for manual_build_file_contents via an example of how to make a target for node_modules/.bin/*

* Address review comment

* Bazel lint

Extract common bazelrc to a shared file (bazel-contrib#781)

Add `query --experimental_allow_incremental_repository_updates` to common.bazelrc as its needed for bazel query to run

`run --experimental_allow_incremental_repository_updates` is not needed

Only require Bazel 0.26.0 when using symlinked node_modules in yarn_install or npm_install as this requires the managed directories feature

If symlinked node_modules is not used the minimum Bazel version is 0.21.0

rel: 0.30.1

Cleanup examples_angular now that it uses managed directories

Fix angular-bazel-example test in CI which was crashing and flaking out (bazel-contrib#792)

`bazel test //e2e:all` was crashing before the tests even started in CI. Possibly out of memory but not sure how that is possible as it was running in the xlarge 16GB container. This PR moves the angular-bazel-example test to its own CI job (which speeds up overall CI time as its critical path) and runs the same CI tests that angular-bazel-example runs in its own CI.

Add buildozer package mirroring

chore(deps): update build_bazel_rules_typescript commit hash to c160db9

Add jasmine dependency to @bazel/typescript

Update README.md

Fixes bazel-contrib#793

Vendor in removeNPMAbsolutePaths (bazel-contrib#763)

Fixes npm_install target cycle Bazel crash

Test for npm_install remove removeNPMAbsolutePaths target cycle regression (bazel-contrib#763)

This failure only shows up in downstream workspaces so we should use npm_install in a subset of nested workspaces. Changing /examples/parcel & /e2e/bazel_bin to npm_install here.

Remove link_deps & unlink_deps scripts (bazel-contrib#795)

Now that yarn_install runs in the user's WORKSPACE we can use relative `file:../../dist/npm_package_foobar` references in nested workspace package.json. Add a touch_deps.sh script which goes through all nested workspaces and dirties them when a package is generated or re-generated.

fix(karma): static_files overwrite files specified in dependencies

Currently when someone specifies a `static_files` target that
transitively brings in a package "X", and there is a target
in the `deps` that transitively also brings in "X", the files
from "X" are accidentally **not** included in the Karma ConcatJS
bundle and the tests will fail since a required dependency is not
executed/included.

Fix typescript package dependency on jasmine package

Introduce @bazel/create package

This gives us an even simpler novice user on-ramp to create a Bazel/npm project

Add unit test for @bazel/create

Include more .bazelrc settings in new workspaces

Create npm_install unless we run under yarn create

check for valid bazel workspace name

Moved output from bazel-bin to dist/bin

code review feedback

fix: license SPDX should be `Apache-2.0` instead of `Apache 2.0` (bazel-contrib#803)

The Apache license version 2.0 SPDX short identifier is Apache-2.0

Remove bazelWorkspaces version & compatVersion as we now have a single version policy (bazel-contrib#783)

Also fixes & adds test for bazelWorkspaces.rootPath

Remove detection logic for warning on global bazel (bazel-contrib#801)

It was failing in some cases, see attached bug.
We shouldn't recommend a global install anyway. using yarn bazel or npx bazel is probably better

Fixes bazel-contrib#656

@bazel/create: support --packageManager option

@bazel/create: add --typescript option

Update README to recommend @bazel/create for quickstart

fixes for release process

rel: 0.30.2

another release script fix

Fix for @bazel/create --typescript option coming first

Fix npx comment

Set --preserve-symlinks-main flag along with --preserve-symlinks flag when node version is 10.2.0 or greater (bazel-contrib#806)

Bust CircleCI node_modules cache (bazel-contrib#806)

Update examples/vendored_node to reflect best practice of specifying node version (bazel-contrib#810)

The docs for node_repositories() reflect this now and the reason is that node_repositories() will set node options depending on version used

feat: move to husky hook

Remove node_runfiles dependency

Remove node_runfiles.

Fix compatibility for Bazel 0.27

Add --incompatible_string_join_requires_strings to .bazelrc

This will avoid regressions. The flag can be removed at the end of the
month (after Bazel 0.27 release).

jasmine_node_test macro: pass templated_args through to nodejs_test.

without this, a jasmine_node_test target specifying templated_args
will be broken, since the macro unconditionally passes its own
templated_args. (duplicated keywords in a rule is an error in the
loading phase.)

port bazel-contrib#398 to new jasmine_node_test

add a test case for it

Remove es5.min rollup_bundle output from runfiles

Having it there causes it to always be built, whether requested or not.
This partially unblocks using rollup_bundle in dev mode.

BREAKING CHANGE:
if you expect the rollup_bundle es5.min file to be a runtime dependency of a rule, you must now include it in the data[] of that rule

Update to latest rules_typescript commit

Add pre-push hook to check Bazel formatting/lint

It's really annoying to run through an extra CI pass when you forget to do these

chore: add a commit message linter

This sets us up to start automating the changelogs

refactor(bazel): cleanup and simplify the toolchain config

fix(bazel): add missing files

fix(bazel): lint

fix(bazel): lint
cristiancreteanu pushed a commit to cristiancreteanu/buildtools that referenced this issue Aug 30, 2019
Fix the Starlark rule generating
//api_proto:api.gen.pb.go_checkshtest so it works
on Windows, where a runfiles tree is not
available.

To fix, the generated shell script now uses the
Bash runfiles library to locate the files to
compare.

See bazelbuild/bazel#5508
@laszlocsomor
Copy link
Contributor Author

Closing this, since Bazel 1.0 rolled out Bash-less test execution.

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
    On Windows, attempting do delete open files will
    fail with ERROR_ACCESS_DENIED.

    This commit fixes one location where the code
    attempted to delete (in appendStderr) a file that
    had an open stream (in fileOutErr).

    I found this bug while experimenting with the
    Windows-native test wrapper, see bazelbuild/bazel#5508

    Change-Id: I91937847a06a6fa59202f59decbd587a242c94b1

    Closes #6034.

    Change-Id: I91937847a06a6fa59202f59decbd587a242c94b1
    PiperOrigin-RevId: 210905331
ngiloq6 added a commit to ngiloq6/bazel-skylib that referenced this issue Aug 17, 2024
In this commit:

- change unittest.bzl to declare a named output
  file instead of relying on the deprecated [1]
  default output name (ctx.outputs.executable).

- define a new toolchain_type and toolchain rules
  for cmd.exe and for Bash (basically Windows and
  non-Windows)

- register the new toolchains in workspace.bzl

- let unittest.make-created test rules require the
  new toolchain_type

- write the test output script as a Windows batch
  script or as a Shell script, depending on the
  selected toolchain

This PR enables the Bazel team to break the Bash
dependency (for test execution) on Windows, and
can run Starlark unittests with the new,
Windows-native test wrapper (still under
development).

See bazelbuild/bazel#5508
ngiloq6 added a commit to ngiloq6/bazel-skylib that referenced this issue Aug 17, 2024
This new test rule compares two files and passes
if the files match.

On Linux/macOS/non-Windows, the test compares
files using 'diff'.

On Windows, the test compares files using
'fc.exe'. This utility is available on all Windows
versions I tried (Windows 2008 Server, Windows
2016 Datacenter Core).

See bazelbuild/bazel#5508
See bazelbuild/bazel#4319
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests category: misc > testing P1 I'll work on this now. (Assignee required) platform: windows team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request
Projects
None yet
Development

No branches or pull requests

2 participants