Skip to content
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

Comments more comments! #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions colcon_ros_cargo/task/ament_cargo/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,25 @@ class AmentCargoBuildTask(CargoBuildTask):
"""

def __init__(self): # noqa: D107
"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is just a line-by-line read of the code, doesn't add anything

Initialize the AmentCargoBuildTask.

This method calls the __init__ method of the parent class CargoBuildTask
and checks the version compatibility.
"""
super().__init__()
satisfies_version(TaskExtensionPoint.EXTENSION_POINT_VERSION, '^1.0')

def add_arguments(self, *, parser): # noqa: D102
"""
Add command-line arguments for the AmentCargoBuildTask.

This method adds an argument to the parser for looking up dependencies
in the workspace directory.

Args:
parser: The argument parser to add arguments to.
"""
parser.add_argument(
'--lookup-in-workspace',
action='store_true',
Expand All @@ -47,6 +62,17 @@ def add_arguments(self, *, parser): # noqa: D102
'.cargo/config.toml for subsequent builds with cargo.')

def _prepare(self, env, additional_hooks):
"""
Prepare the build environment.

This method resolves the package paths for dependencies, writes the
resolved paths to a .cargo/config.toml file, and creates an environment
hook for the AMENT_PREFIX_PATH.

Args:
env: The environment to prepare.
additional_hooks: Additional hooks to be executed.
"""
args = self.context.args

global package_paths
Expand Down