Skip to content

Bazel Rollup Broken with Well Known Types #200

@awmichel

Description

@awmichel

Versions of relevant software used

Bazel 0.28.0
ts-protoc-gen master

What happened

The src/bazel/change_import_style.ts script throws an error when upstream protobufs use well known types.

What you expected to happen

Well known types to correctly map to the google-protobuf package equivalents.

How to reproduce it (as minimally and precisely as possible):

  1. Checkout this commit awmichel@fd591d4
  2. Run bazel build //test/bazel:test_es6_bundling

Full logs to relevant components

Logs

INFO: Analyzed target //test/bazel:test_es6_bundling (4 packages loaded, 68 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_amichel/6eec92f57cc3fca72fd63041ff52acbd/external/com_google_protobuf/BUILD:266:2: error executing shell command: '/bin/bash -c bazel-out/host/bin/external/com_google_protobuf/protoc --plugin=protoc-gen-ts=bazel-out/host/bin/external/ts_protoc_gen/bin/protoc-gen-ts --ts_out=service=grpc-web:bazel-out/darwin-fas...' failed (Exit 1) bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
Error: ENOENT: no such file or directory, open 'bazel-out/darwin-fastbuild/bin/external/com_google_protobuf/timestamp_pb.js'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at main (/private/var/tmp/_bazel_amichel/6eec92f57cc3fca72fd63041ff52acbd/sandbox/darwin-sandbox/206/execroot/ts_protoc_gen/bazel-out/host/bin/src/bazel/change_import_style.runfiles/ts_protoc_gen/src/bazel/change_import_style.js:16:36)
    at /private/var/tmp/_bazel_amichel/6eec92f57cc3fca72fd63041ff52acbd/sandbox/darwin-sandbox/206/execroot/ts_protoc_gen/bazel-out/host/bin/src/bazel/change_import_style.runfiles/ts_protoc_gen/src/bazel/change_import_style.js:79:5
    at /private/var/tmp/_bazel_amichel/6eec92f57cc3fca72fd63041ff52acbd/sandbox/darwin-sandbox/206/execroot/ts_protoc_gen/bazel-out/host/bin/src/bazel/change_import_style.runfiles/ts_protoc_gen/src/bazel/change_import_style.js:3:17
    at Object.<anonymous> (/private/var/tmp/_bazel_amichel/6eec92f57cc3fca72fd63041ff52acbd/sandbox/darwin-sandbox/206/execroot/ts_protoc_gen/bazel-out/host/bin/src/bazel/change_import_style.runfiles/ts_protoc_gen/src/bazel/change_import_style.js:9:3)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Target //test/bazel:test_es6_bundling failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 23.698s, Critical Path: 20.37s
INFO: 4 processes: 3 darwin-sandbox, 1 worker.
FAILED: Build did NOT complete successfully

Anything else we need to know

There are a couple similar issues, but nothing specifically addresses the problem when using Rollup. #170 solves a similar, but slightly different issue with external packages. I tested my sample code using that PR, but the same issue occurs. #178 seems like a potential fix, but was abandoned in favor of #170.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions