feat: support sourceRoot selection#118
feat: support sourceRoot selection#118RaitoBezarius wants to merge 1 commit intonix-community:mainfrom
sourceRoot selection#118Conversation
src/main.rs
Outdated
| } | ||
|
|
||
| if is_target_for_packaging(subdir.path()) { | ||
| sourceroot_candidates.push(subdir.path()); |
There was a problem hiding this comment.
we might be able to use file_name here instead, so we don't have to do strip_prefix later. the same applies to open_subdirs
There was a problem hiding this comment.
file_name only returns the final component, not the N - 1 final components
figsoda
left a comment
There was a problem hiding this comment.
this doesn't work with cargoHash and probably vendorHash
src/main.rs
Outdated
| .parse() | ||
| .ok() | ||
| .and_then(|i: usize| sourceroot_candidates.get(i)) | ||
| .unwrap_or_else(|| &sourceroot_candidates[0]); |
There was a problem hiding this comment.
we should still allow packages to opt out of sourceRoot even when there are candidates
There was a problem hiding this comment.
e.g. there can be a rust binary at root that also have a library and a python binding of the library in a subdirectory, but we might want the rust binary instead of the python binding
There was a problem hiding this comment.
We only have to make it so that sourceRoot candidate include the root src dir, right?
There was a problem hiding this comment.
actually why
let src_dir = choice
.parse()
.ok()
.and_then(|i: usize| sourceroot_candidates.get(i))
.unwrap_or_else(|| &sourceroot_candidates[0]);
let source_root = if src_dir != &root_src_dir {
Some(src_dir)
} else {
None
};
is not enough?
There was a problem hiding this comment.
if your choice is the rootdir, then you don't get a sourceRoot
There was a problem hiding this comment.
that would also work, but we would need extra logic to be able to omit the sourceRoot = part
There was a problem hiding this comment.
actually why <...> is not enough?
I haven't checked since the current HEAD is not building for me, but I think source_candidates never contains root_src_dir
5ad1ba8 to
3918c06
Compare
This is now possible to package from a mono-repository, check opentelemetry-python for a usecase.
|
FFS, encountered the first thing that overcomes the depth check: https://github.com/NiklasRosenstein/python-nr.util |
|
might be a good idea to add a configuration and cli flag, but we can do that in a separate pr |
This is now possible to package from a mono-repository, check opentelemetry-python for a usecase.