admin管理员组文章数量:1293969
Is it possible to change or provide a custom path for execRoot in Bazel 7.4 with Bazelmod enabled ?
Or at least change the name of the main repository from _main
to something else ?
My problem is, before enabling Bazelmod, Some files were available at path like:
/home/ssahoo/.cache/bazel/_bazel_ssahoo/eb5a6bd7163c3bba3080b98009823a76/execroot/<workspace_name>/APP_NAME/app/javascript/styles/charges/charges.sass
Now, after enabling Bzlmod, the path has changed to
/home/ssahoo/.cache/bazel/_bazel_ssahoo/eb5a6bd7163c3bba3080b98009823a76/execroot/_main/APP_NAME/app/javascript/styles/charges/charges.sass
So TS imports that are using path <workspace_name>/APP_NAME/app/javascript/styles/charges/charges.sass
fails as there is no workspace_name in the path anymore.
I know I can use _main
or a relative path here, but I am trying to avoid making changes to too many files. There are hundreds of files in this mono repo using such import paths. Can I use the module name or workspace name here instead of _main
? Or are there any other solutions?
Is it possible to change or provide a custom path for execRoot in Bazel 7.4 with Bazelmod enabled ?
Or at least change the name of the main repository from _main
to something else ?
My problem is, before enabling Bazelmod, Some files were available at path like:
/home/ssahoo/.cache/bazel/_bazel_ssahoo/eb5a6bd7163c3bba3080b98009823a76/execroot/<workspace_name>/APP_NAME/app/javascript/styles/charges/charges.sass
Now, after enabling Bzlmod, the path has changed to
/home/ssahoo/.cache/bazel/_bazel_ssahoo/eb5a6bd7163c3bba3080b98009823a76/execroot/_main/APP_NAME/app/javascript/styles/charges/charges.sass
So TS imports that are using path <workspace_name>/APP_NAME/app/javascript/styles/charges/charges.sass
fails as there is no workspace_name in the path anymore.
I know I can use _main
or a relative path here, but I am trying to avoid making changes to too many files. There are hundreds of files in this mono repo using such import paths. Can I use the module name or workspace name here instead of _main
? Or are there any other solutions?
- Maybe I'm misunderstanding your approach, but I'd say that those paths inside Bazel's cache are implementation details which you should never build upon. Instead, declare these dependencies explicitly. – Ulrich Eckhardt Commented Feb 12 at 14:46
- @UlrichEckhardt I don't think those are implementation details, as those are packages defined by our code and referenced in the build. Anyway, we should have used relative paths(relative to the package not the workspace) instead of building on these but it's a very old project so I am not sure about the reason. – Sajan Commented Feb 12 at 15:01
1 Answer
Reset to default 0You can set a different output base directory (--output_base=...
flag), but within that output base directory, you cannot change the main repository name; the name "_main"
is hard-coded in bazel's BazelRuleClassProvider.java.
Using paths that contain a hard-coded repo name in your import statements seems fragile and generally a bad idea. For one thing, such import statements will break depending on whether your bzlmod module is the root module or a dependency of another module (even if you think you wouldn't need to use it as a dependency, it might be treated a dependency in some integration tests).
本文标签: Change execRoot in Bazel 7Stack Overflow
版权声明:本文标题:Change execRoot in Bazel 7? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741591032a2387127.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论