-
Notifications
You must be signed in to change notification settings - Fork 3k
exporters - group by directories in prj root #3559
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
Conversation
key = basename(dirname(src)) | ||
if key == ".": | ||
key = basename(realpath(self.export_dir)) | ||
rel_path = os.path.relpath(src, self.project_path) |
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.
This will not work on the online environment. Please use relpath(src, self.resources.file_basepath[src])
Update exporter grouping code to group by directories in the root of the project rather than by the parent directory of each file. This reduces the number of groups and allows all mbed-os code to reside in its own folder.
ab564dd
to
329be06
Compare
/morph export-build |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 76 All exports and builds passed! |
@VeliMattiLahtela the cliapp job failed for this PR so I restarted it. |
@c1728p9 Do you mind showing a before and after of the project layout? So for https://github.com/ARMmbed/mbed-os-example-client would it look something like: Before:
After:
|
@c1728p9 Are all of the mbed-os files flattened within the "mbed-os" directory in the "After" picture? |
yeah |
If that's true, one folder will contain all mbed-os files without any structure? I don't like that. Having at least some tree there would be nice. As it is it's not ideal neither. |
I agree, having a tree structure would be ideal. Correct me if I'm wrong but I was under the assumption that uvision only allowed one level of groups (directories). With this patch those groups match those of the root directory of the project. Prior to this patch each file was placed in a group with the name of its parent directory. |
I believe that's correct yes. |
I restarted jenkins CI. Once that green, should be ready to integrate |
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.
The non-nested groups is a limitation of uvision. It might be annoying now to edit mbed-os, as those files will be flattened, as mentioned above. However, the normal user probably wants to use uvision to modify their own source anyway.
key = basename(realpath(self.export_dir)) | ||
rel_path = relpath(src, self.resources.file_basepath[src]) | ||
path_list = os.path.normpath(rel_path).split(os.sep) | ||
assert path_list >= 1 |
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.
Why the assert here? Wouldn't this trigger a runtime traceback if it were true?
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.
Additionally, what is the check trying to accomplish? It is not comparing the length of the list.
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.
Good catch. This is a mistake and should be removed or updated to be "len(path_list )".
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.
Thanks @c1728p9. Probably the easiest way to fix this is to just submit another PR, changing this assert to an exception that actually checks len(path_list)
. @sarahmarshy feel free to submit this if you know the proper way of handling the exception!
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.
Is that correct behavior though? say src is C:\Project\mbed-os\src.cpp
. Then relpath=mbed-os\src.cpp
, then path_list = [mbed-os, src.cpp]
, which would be a list length >=1.
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.
I created #3574 to fix this. This assert triggers in the case where the list is empty, as this is invalid and would cause an exception later anyway. This assert doesn't really matter though and I can remove it if you would like.
Update exporter grouping code to group by directories in the root of the project rather than by the parent directory of each file. This reduces the number of groups and allows all mbed-os code to reside in its own folder.