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

bazel rule does not work on windows #384

Open
davireis opened this issue Mar 22, 2023 · 1 comment
Open

bazel rule does not work on windows #384

davireis opened this issue Mar 22, 2023 · 1 comment
Assignees

Comments

@davireis
Copy link

The call to zipper in

ctx.actions.run(
is not correctly quoted. You can see the error below.

SUBCOMMAND: # //xproto:trash_kotlin_grpc_DO_NOT_DEPEND_kt_grpc [action 'Generating Kotlin gRPC srcjar for @//xproto:trash_proto', configuration: 3c3c60205ba406340ca3fe604761519a6b598e882333b2b95db0f40329290033, execution platform: @local_config_platform//:host]
cd /d C:/users/davir/_bazel_davir/ouzjcgzh/execroot/__main__
C:\WINDOWS\system32\bash.exe -c external/bazel_tools/tools/zip/zipper/zipper.exe $@  c bazel-out/x64_windows-fastbuild/bin/xproto/trash_kotlin_grpc_DO_NOT_DEPEND_kt_grpc.srcjar bazel-out/x64_windows-fastbuild/bin/xproto/trash_kotlin_grpc_DO_NOT_DEPEND_kt_grpc/ktgrpc/com/trash/tracker/v1/TrackerServiceProtoGrpcKt.kt
# Configuration: 3c3c60205ba406340ca3fe604761519a6b598e882333b2b95db0f40329290033
# Execution platform: @local_config_platform//:host
ERROR: C:/users/davir/code/trash/libs/xproto/BUILD.bazel:33:20: Generating Kotlin gRPC srcjar for @//xproto:trash_proto failed: (Exit 1): bash.exe failed: error executing command (from target //xproto:trash_kotlin_grpc_DO_NOT_DEPEND_kt_grpc) C:\WINDOWS\system32\bash.exe -c external/bazel_tools/tools/zip/zipper/zipper.exe $@  c bazel-out/x64_windows-fastbuild/bin/xproto/trash_kotlin_grpc_DO_NOT_DEPEND_kt_grpc.srcjar ... (remaining 1 argument skipped)
Usage: zipper.exe [vxc[fC]] x.zip [-d exdir] [[zip_path1=]file1 ... [zip_pathn=]filen]
  v verbose - list all file in x.zip
  x extract - extract files in x.zip to current directory, or     an optional directory relative to the current directory     specified through -d option
  c create  - add files to x.zip
  f flatten - flatten files to use with create or extract operation
  C compress - compress files when using the create operation
x and c cannot be used in the same command-line.

For every file, a path in the zip can be specified. Examples:
  zipper c x.zip a/b/__init__.py= # Add an empty file at a/b/__init__.py
  zipper c x.zip a/b/main.py=foo/bar/bin.py # Add file foo/bar/bin.py at a/b/main.py

If the zip path is not specified, it is assumed to be the file path.
INFO: Elapsed time: 0.697s, Critical Path: 0.24s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

If the same command is called as bash.exe -c "zipper.exe arg1 arg2" instead of bash.exe -c zipper.exe arg1 arg2 (notice the lack of quotes) everything works. Not sure if the bug should be attributed to bazel ctx.actions.run itself, or if it should be worked around here by maybe feeding the args together with the command in a single string.

@davireis
Copy link
Author

FWIW, I downloaded the newest kt_jvm_grpc.bzl (wget https://raw.githubusercontent.com/grpc/grpc-kotlin/5a7bbdb87054cb39bfc11334b571fe9b6ba938f0/kt_jvm_grpc.bzl), imported it directly and it worked!

So this should be fixed with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants