rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

Compile Line Length Limit hit under Windows 10.0 with bazel 4.0.0

Open lee-csu opened this issue 2 years ago • 5 comments

Description of the problem / feature request:

I tried to compile the Java project on Windows 10, but because the project has too many dependencies, an error message is displayed during dependency parsing, indicating that command is longer than CreateProcessW's limit. My maven_install() defines nearly 500 dependencies.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

workspace maven_install( artifacts = [ "org.apache.zookeeper:zookeeper-jute:3.6.0", "org.apache.zookeeper:zookeeper-jute:3.6.2", "org.apache.zookeeper:zookeeper:3.6.2-h0.gdd.sop.r18", "io.grpc:grpc-api:1.36.1", ... #....nearly 500 dependencies ] )

What operating system are you running Bazel on?

windows10 Bazel verison:4.0.0 rules_jvm_external version:4.0

What's the output of bazel info release?

no such package '@maven//': Error while fetching artifact with coursier: java.io.IOException: ERROR: src/main/native/windows/process.cc(165): CreateProcessWithExplicitHandles("D:\tools\javajdk\bin\java" -noverify -jar C:/users/xxx/esyrauaw/external/maven/coursier fetch org.apache.zookeeper:zookeeper-jute:3.6.0 org.apache.zookeeper:zookeeper-jute:3.6.2 org.apache.zookeeper:zookeeper:3.6.2-h0.gdd.sop.r18 io.grpc:grpc-api:1.36.1 io.grpc:grpc-context:1.36.1 io.grpc:grpc-core:1.36.1 io.grpc:grpc-grpclb:1.36.1 io.grpc:grpc-netty:1.36.1 io.grpc:grpc-protobuf- lite:1.36.1 io.grpc:grpc-protobuf:1.36.1 io.grpc:grpc-stub:1.36.1 org.quartz-scheduler.in(...)): command is longer than CreateProcessW's limit (32767 characters)

lee-csu avatar Nov 22 '21 08:11 lee-csu

This is a limitation of coursier -- I don't think coursier supports argument files/flag files, but that would be the approach to fix this problem.

jin avatar Nov 25 '21 03:11 jin

Has anyone opened this as an issue with Coursier yet?

I raised one: https://github.com/coursier/coursier/issues/2443

cjohnstoniv avatar Jun 09 '22 04:06 cjohnstoniv

Coursier seems to have added the ability now to specify a file (PR: https://github.com/coursier/coursier/pull/2604) to pass the arguments as a file.

Without personally ever touching the lower level Bazel code, would any maintainers have any pointers and/or a quick way we could make use of this with Bazel?

cjohnstoniv avatar Apr 26 '23 15:04 cjohnstoniv

https://github.com/bazelbuild/rules_jvm_external/blob/d211f3b057528f06d0414a56c10ddb8849ede78b/coursier.bzl#L656 is where the coursier command is constructed. One way is to pipe all of the artifacts into a file with repository_ctx.file and pass that file as an arg into the coursier command with the --dependency-file flag.

jin avatar Apr 26 '23 16:04 jin

Thank you @jin , will try to find some time later this week/this weekend to see I can get this working on my own custom JVM rules build.

cjohnstoniv avatar Apr 26 '23 16:04 cjohnstoniv