bazelbuild/rules_typescript

Typescript compile has to do extra work because pyc files change after first run

gregmagolan opened this issue · 3 comments

The first run of ts_library on a fresh exec root will update some pyc files in the build_bazel_rules_typescript external workspace causing the subsequent build to do more work than is necessary.

WARNING: TypeScriptCompile worker (id 0) can no longer be used, because its files have changed on disk:
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.pyc: 9378256dea12e80fc1cb2fc765e76a542ece34b844627ab35f27ddfb2de81d1a -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.pyc: b7977ab7d60abfb04f398d2040af8bf826b6d7ee2ee0be3986773cc8fd92e5bc -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.pyc: 5f70c5b67502617a7dab1ca074b2fc5e2bc4b68683692ce85aec60e11fdd0b1e -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.pyc: 13f404e845f2301f317ca0da401f1d0f7bc61ecfea5accfe5a74ef0341a24b6f -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.pyc: 44d982e12819f4cb4e83931399b174064882b1247d0d3e1f2269a185728e4b33 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.pyc: 63b345478b437a3b27b6a6c179a1648739a8cf81fad444ada6f915659f2f1bff -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.pyc: 488f1840755fc1776fa3494e3b9e38f9e142e59aa1e329981ac09288d0f985f2 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.pyc: 98e8b17c9bac20cd058ef363b086dba9f2715924b3739da0b9bd8054012d045f -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.pyc: 99a3a5295c7766930ca8046dc770a2d848e17bf2e09de0c06443ccd6f69f90b6 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.pyc: 10bb921b6d95a4bd321346b452e3cfd159077ca10d398b9cd51c0c4420c47ece -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.pyc: 63b646bafd055cdf49a3f217b18cdc606df717183df7fd800e6456a68f1bb47e -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.pyc: 23fff17aa8136d7ac57da068645d5a86779ba922f27e7f3dd9ee9f9007629c75 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.pyc: 25bcb3650151d5562404dd7c4eea8d392cb3e5c6b90249243c0d8aea6964e77a -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.pyc: dffe097465694ef98313ccc71a5d49ed0af5343430009b79fb94d61242fffa86 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/angular_bazel_example/external/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.pyc: f57f2a323e449cc5a30d9caaf6733065e9496e5898f78bb96541794ce1ff15c3 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.pyc: 9378256dea12e80fc1cb2fc765e76a542ece34b844627ab35f27ddfb2de81d1a -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.pyc: b7977ab7d60abfb04f398d2040af8bf826b6d7ee2ee0be3986773cc8fd92e5bc -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.pyc: 5f70c5b67502617a7dab1ca074b2fc5e2bc4b68683692ce85aec60e11fdd0b1e -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.pyc: 13f404e845f2301f317ca0da401f1d0f7bc61ecfea5accfe5a74ef0341a24b6f -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.pyc: 44d982e12819f4cb4e83931399b174064882b1247d0d3e1f2269a185728e4b33 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.pyc: 63b345478b437a3b27b6a6c179a1648739a8cf81fad444ada6f915659f2f1bff -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.pyc: 488f1840755fc1776fa3494e3b9e38f9e142e59aa1e329981ac09288d0f985f2 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.pyc: 98e8b17c9bac20cd058ef363b086dba9f2715924b3739da0b9bd8054012d045f -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.pyc: 99a3a5295c7766930ca8046dc770a2d848e17bf2e09de0c06443ccd6f69f90b6 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.pyc: 10bb921b6d95a4bd321346b452e3cfd159077ca10d398b9cd51c0c4420c47ece -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.pyc: 63b646bafd055cdf49a3f217b18cdc606df717183df7fd800e6456a68f1bb47e -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.pyc: 23fff17aa8136d7ac57da068645d5a86779ba922f27e7f3dd9ee9f9007629c75 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.pyc: 25bcb3650151d5562404dd7c4eea8d392cb3e5c6b90249243c0d8aea6964e77a -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.pyc: dffe097465694ef98313ccc71a5d49ed0af5343430009b79fb94d61242fffa86 -> <none>
bazel-out/host/bin/external/build_bazel_rules_typescript/internal/tsc_wrapped_bin.runfiles/nodejs/bin/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.pyc: f57f2a323e449cc5a30d9caaf6733065e9496e5898f78bb96541794ce1ff15c3 -> <none>

This also breaks cache keys between copies of a workspace with different absolute paths since the .pyc files contain absolute paths to the .py they were compiled from.
I think options are to always exclude the .pyc files, or find a way to use the -d flag.

The referenced rules_nodejs PR is merged, I think that means this issue should be fixed by updating the dependency in rules_typescript?

rules_typescript updated to rules_nodejs 0.15.0 which contains a fix for this. Thanks @JaredNeil