salesforce / bazel-jdt-java-toolchain

Eclipse Java Compiler (ECJ) for Bazel
Apache License 2.0
9 stars 6 forks source link

Delete empty directs jars check #18

Closed rsalvador closed 1 year ago

rsalvador commented 1 year ago

Reports bogus errors for packages with no deps

guw commented 1 year ago

@rsalvador Can you provide an example?

rsalvador commented 1 year ago

@rsalvador Can you provide an example?

$ bazel build //mobile-shield-shared/test/func
...
ERROR: /Users/rsalvador/gitcore/core-public/core/mobile-shield-shared/test/func/BUILD.bazel:4:17: Building mobile-shield-shared/test/func/libfunc.jar (1 source file) failed: (Exit 1): java failed: error executing command (from target //mobile-shield-shared/test/func:func) external/onejdk_macos_aarch64/bin/java -XX:-CompactStrings '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 16 arguments skipped)
No direct jars information supplied by Bazel. Please adjust Bazel settings to allow submission of direct dependency information (e.g., don't use --strict_java_deps=off).Target //mobile-shield-shared/test/func:func failed to build
guw commented 1 year ago

I remember now why I put in the error message. When using -Xecj_use_direct_deps_only then --strict_java_deps=off must not be used because with --strict_java_deps=off the direct jars option is always empty. I think removing the check is not ok. It should be moved somewhere else instead.

guw commented 1 year ago

On the other hand, when you have a java_library without any dependencies the option -Xecj_use_direct_deps_only should probably not be declared.