-
Notifications
You must be signed in to change notification settings - Fork 10
Add Bazel path mapping support #71
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
base: main
Are you sure you want to change the base?
Conversation
[[nil "--classes-dir dir" "output directory where classfiles will be written"] | ||
[nil "--output-jar jar" "output jar name"] | ||
[nil "--resource-strip-prefix path" ] | ||
[nil "--aot-nses ns" "names of namespaces to AOT. May be repeated" | ||
:default [] | ||
:update-fn conj | ||
:multi true] | ||
[nil "--classpath cp" "classpath to use while compiling, separated by :" | ||
:parse-fn parse-classpath]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need --srcs
and --resources
too?
;; [--classes-dir bazel-out/darwin_arm64-fastbuild/bin/external/deps/.ns_metosin_reitit_core_reitit_exception.classes --output-jar bazel-out/darwin_arm64-fastbuild/bin/external/deps/ns_metosin_reitit_core_reitit_exception.jar --resource-strip-prefix '' --aot-ns reitit.exception --classpath external/deps/repository/metosin/reitit-core/0.6.0/reitit-core-0.6.0.jar:external/deps/repository/meta-merge/meta-merge/1.0.0/meta-merge-1.0.0.jar:external/deps/repository/org/clojure/clojure/1.12.2/clojure-1.12.2.jar:external/deps/repository/org/clojure/core.specs.alpha/0.4.74/core.specs.alpha-0.4.74.jar:external/deps/repository/org/clojure/spec.alpha/0.5.238/spec.alpha-0.5.238.jar:bazel-out/darwin_arm64-fastbuild/bin/external/rules_clojure/src/rules_clojure/libcompile.jar] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;; [--classes-dir bazel-out/darwin_arm64-fastbuild/bin/external/deps/.ns_metosin_reitit_core_reitit_exception.classes --output-jar bazel-out/darwin_arm64-fastbuild/bin/external/deps/ns_metosin_reitit_core_reitit_exception.jar --resource-strip-prefix '' --aot-ns reitit.exception --classpath external/deps/repository/metosin/reitit-core/0.6.0/reitit-core-0.6.0.jar:external/deps/repository/meta-merge/meta-merge/1.0.0/meta-merge-1.0.0.jar:external/deps/repository/org/clojure/clojure/1.12.2/clojure-1.12.2.jar:external/deps/repository/org/clojure/core.specs.alpha/0.4.74/core.specs.alpha-0.4.74.jar:external/deps/repository/org/clojure/spec.alpha/0.5.238/spec.alpha-0.5.238.jar:bazel-out/darwin_arm64-fastbuild/bin/external/rules_clojure/src/rules_clojure/libcompile.jar] |
;; bazel requires us to write to stdout, and doesn't reliably report | ||
;; stderr, so log to a temp file to guarantee we find everything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird. these docs say
Writing it to the stderr of the worker process is safe, but the result is collected in a per-worker log file [...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. It works ~80-90% of the time. The main place I've noticed it not working is when rules_clojure hangs forever and you have to interrupt it (Ctrl+C), you get no logs.
Under Bazel, building for the compilation platform is considered a separate architecture than the production platform, typically e.g.
darwin-opt-exec
vs.darwin-fastbuild
. This causes bazel to build some artifacts twice, even if they are architecture independent. This is also the source of a race condition that prevents #70 from merging.This PR adds support for path mapping to rules_clojure. See bazelbuild/bazel#22658 for more detail, but TL;DR, we have to pass Bazel
File
to rules, not String paths, which necessitated getting rid of passing JSON strings to rules_clojure.There are no user visible behavior changes yet, we have to enable path mapping via
--experimental_output_paths=strip
in banksy. We can't enable that until we upgrade e.g. rules_jvm_external, which requires moving to Bazel 8 and modules, coming in another PR.