Add Bazel path mapping support#71
Open
arohner wants to merge 1 commit into
Open
Conversation
english
approved these changes
Oct 6, 2025
Comment on lines
+151
to
+159
| [[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]]) |
Contributor
There was a problem hiding this comment.
does this need --srcs and --resources too?
Comment on lines
+144
to
+145
| ;; [--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] | ||
|
|
Contributor
There was a problem hiding this comment.
Suggested change
| ;; [--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] |
Comment on lines
+51
to
+52
| ;; bazel requires us to write to stdout, and doesn't reliably report | ||
| ;; stderr, so log to a temp file to guarantee we find everything. |
Contributor
There was a problem hiding this comment.
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 [...]
Contributor
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under Bazel, building for the compilation platform is considered a separate architecture than the production platform, typically e.g.
darwin-opt-execvs.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
Fileto 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=stripin 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.