add check root dir#383
Conversation
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## master #383 +/- ##
==========================================
- Coverage 80.01% 78.57% -1.45%
==========================================
Files 56 56
Lines 3272 3290 +18
Branches 543 546 +3
==========================================
- Hits 2618 2585 -33
- Misses 615 654 +39
- Partials 39 51 +12
Continue to review full report at Codecov.
|
dirk-thomas
left a comment
There was a problem hiding this comment.
The docblock / messages could be a bit clearer / more precise (and contain spelling mistakes) but let's first focus on the functional parts.
Why is the check limited to the build and test verbs? (Also the whole ticket description doesn't mention test.)
| :param str this_build_tool: The name of this build tool | ||
| :raises RuntimeError: if marker file is found in parent directory | ||
| """ | ||
| original_path = Path(os.getcwd()) |
There was a problem hiding this comment.
Wouldn't it be clearer (easier to test, and more reusable) if the function would have the start path as an argument rather then getting it internally from global state?
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
|
@dirk-thomas Thanks for the timely review. I tried to address most of the comments, but not sure about a few.
Those are the only two verbs in
I added an arg |
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
|
Thanks so much! This will be a very nice UX improvement. |
dirk-thomas
left a comment
There was a problem hiding this comment.
Those are the only two verbs in
colcon-core, and seem to address the feature request in #369. Is there anywhere else that could also use this check?
The same check seems to be applicable to several other verbs: graph, info, list, test-result.
| self.task_argument_destinations = decorated_parser.get_destinations() | ||
|
|
||
| def main(self, *, context): # noqa: D102 | ||
| check_and_mark_root_dir(context.args.start_path) |
There was a problem hiding this comment.
I think the invocation here in the verb is too late since e.g. the log directory has already been created which isn't desired.
Signed-off-by: claireyywang <22240514+claireyywang@users.noreply.github.com>
Wouldn't it limit the usability of these verbs if they can only be invoked in root directory? |
Isn't that the whole idea of this PR - to limit the locations where |
I think the consequence of not running The idea of this PR is to address discussion in #139 and #369, which both point to the |
|
How about |
lol I've actually never used that verb. I'll take a look and see if I can add the root dir check to it as well. Thanks for the heads up. |
|
@claireyywang Friendly ping. |
|
What is the state of this PR? This as well as #487 are some quite significant UX improvements that people who start out in ROS 2 (coming from ROS 1) find very much annoying. If @claireyywang is not available anymore, I would take a look at it. But I don't want to invest time and effort only for it to end up like #487. |
|
We will address this with a separate colcon extension. There has been discussion in #139. I'll close this PR since this isn't the approach we plan to take. |
Adds a
.root_dirmarker file when first building a workspace. Check for.root_dirfile wheneverbuildortestverbs are invoked, terminate command if marker file not found. closes #369What this PR does not cover:
colcon buildis invoked in~/, no error/warning will be output by this function, and a marker file will be generated in~/.colconfile for this warning function to work properlyTo test this function, follow build from source instruction here https://colcon.readthedocs.io/en/released/developer/bootstrap.html, then run
colcon buildin different directories to see the error msg.Terminal output if
colcon buildin child dir:still need to add test cases...