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

Colcon warning if a package doesn't install anything #122

Open
quarkytale opened this issue Jun 27, 2022 · 0 comments
Open

Colcon warning if a package doesn't install anything #122

quarkytale opened this issue Jun 27, 2022 · 0 comments

Comments

@quarkytale
Copy link

A package not integrating any artifacts, makes the build system think there's a bug and it throws out a warning. It's usually ignored for packages not intended to be ever distributed.

logger.warning(
"Could not run installation step for package '{pkg.name}' "
"because it has no 'install' target".format_map(locals()))

But in some cases, like for a package whose entire purpose is to run tests and is only integrated when -DBUILD_TESTING=ON, the above assumption doesn't hold true.

If the warning is bothersome, brute force fixes (just for reference):

  • Have the test package install some innocuous empty hello_world.txt file.
  • Set "cmake-target": "all" in colcon.pkg will ensure when a specific target is specified, the install target is no longer added implicitly.

The short-term clean fix is to include the required artifacts will added when BUILD_TESTING is true and allowing the ament_package() call to happen even when its false, resulting in the package.xml getting installed. See test_rclcpp example.

if(BUILD_TESTING)
  ### code block
endif()

# TODO should not install anything
ament_package()

A more elegant but time consuming fix might be to add support for a field in colcon.pkg "ignore-no-install-target": true which does nothing but suppresses that message when there is no install target. Then give these packages a colcon.pkg file that's simply

{
    "ignore-no-install-target": true
}

This is an under-serviced scenario for both ament and colcon. The "no install target" warning message should not be disabled entirely. Possibly a new package type for test-only CMake projects could be introduced, but needs further discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant