Comments (6)
Maybe --import-dir
should be set to external/repo-name
instead of "." and " ".
from emboss.
src.path resolves to the right path (external/repo-name/.../src), but src.root resolves to the directory containing "external" and is used for --import-dir. It seems like we want to use "src.root + /external/repo-name" to resolve imports.
from emboss.
Yes, imports = ["--import-dir=" + root.path + "external/pigweed/" for root in dep_roots.to_list()]
in _emboss_library_impl works. I'm not sure how to properly calculate "external/pigweed" though.
from emboss.
This seems to work:
adjusted_src_root = src.root.path
if src.path.startswith("external/"):
segments = src.path.split("/")
first_two_segments = "/".join(segments[:3])
adjusted_src_root = paths.dirname(first_two_segments)
dep_roots = depset(
direct = [adjusted_src_root],
transitive = [dep.transitive_roots for dep in deps],
)
imports = ["--import-dir=" + root for root in dep_roots.to_list()]
from emboss.
That's sort of horrible, but probably good enough for now.
It would probably be worth reaching out to the Bazel team to see if they have any suggestions -- I was basically trying to copy the aspect for Proto, but that aspect is allowlisted for a bunch of interfaces that I could not use directly.
from emboss.
Sounds like proto has the same problem. I found a similar solution on stackoverflow:
https://stackoverflow.com/questions/55796252/how-to-write-bazel-rules-that-work-with-external-repositories
from emboss.
Related Issues (20)
- Improve performance of `ir_traverse._call_with_optional_args` HOT 1
- `embossc` unnecessarily spawns 2 subprocesses
- `requires` on a field cannot reference other fields HOT 1
- Improve perf of C++ backend
- Struct-level `[requires]` aren't enforced on field writes HOT 1
- C++ backend generates excessively large headers HOT 1
- `$next` isn't usable in setting virtual fields
- emboss fails to run on python 3.8
- Introduce keyword like $previous to clearly indicate overlapping fields HOT 4
- Provide support for private Aliases
- No way to place long boolean expressions on separate lines
- Update code to not have deprecated-copy warnings
- Build error in new version of Clang HOT 3
- Add .gni containing lists of files needed by GN HOT 2
- Missing inner array type dimensions errors do not include correct source locations HOT 3
- Bazel: cannot apply `tags` or `target_compatible_with` on `emboss_cc_library` rules
- Extraneous `<ostream>` in generated headers
- Use standard formatting and add automated checks for formatting
- Add automated typechecking
- Add automated checks for supported language versions/toolchains
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emboss.