Skip to content

Dependencies Option Conflict Detection.#838

Open
PengZheng wants to merge 1 commit intomasterfrom
feature/option-conflict-detection
Open

Dependencies Option Conflict Detection.#838
PengZheng wants to merge 1 commit intomasterfrom
feature/option-conflict-detection

Conversation

@PengZheng
Copy link
Contributor

@PengZheng PengZheng commented Mar 13, 2026

Key Changes

1. Shift from Deduction to Detection in conanfile.py

  • Removed Automatic Option Setting: The code that used to force dependencies (like libzip, libcurl, openssl, etc.) to be shared=True based on Celix options has been removed.
  • Implemented validate() Logic: A new validation loop was added to the validate() method. It checks if the current configuration (e.g., build_utils=True) matches the actual state of the dependencies.
  • Detailed Error Reporting: If a dependency is not configured as required (e.g., if libcurl is static but Celix needs it shared), Conan now throws a ConanInvalidConfiguration error with a clear message explaining which Celix option requires which dependency setting.

2. Infrastructure & Workflow Updates

  • CI Configuration: Since Conan no longer automatically sets these options, the GitHub Actions workflows (e.g., ubuntu.yml, macos.yml) were updated to explicitly pass -o *:shared=True and -o mosquitto/*:broker=True. This ensures that the CI environment continues to use the correct shared library configurations.
  • Documentation: The building instructions (e.g., dev_celix_with_clion.md) were updated to reflect Conan 2.x usage.

Why this change was made

Automatic dependency option deduction is both expensive (NP-hard) and completely broken (for conan 2.x). There is a known limitation in Conan 2, where attempting to modify dependency options from a downstream package (Celix) can lead to graph inconsistencies or unexpected behavior. By moving to "conflict detection," the responsibility of providing a compatible graph is shifted to the user (or the CI profile), while the conanfile.py acts as a guard to ensure requirements are met before building.

Note that to make dependency option deduction to work in my day job, we have to patch Conan 1.x (without any upstream blessing) to redraw the dependency graph wherever an option conflict is encountered. Therefore, it is slow with hundreds of packages, each of which can have dozens of options.

Verification of the Change

This PR implemented this following suggestions from a Conan issue (conan-io/conan#19692), ensuring that the Celix recipe is more robust and compliant with modern Conan standards.

Replace expensive and broken dependencies option deduction with conflict detection, following the suggestions given in conan-io/conan#19692
@PengZheng PengZheng requested a review from pnoltes March 13, 2026 09:07
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.36%. Comparing base (36ce8b1) to head (b30e173).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #838   +/-   ##
=======================================
  Coverage   91.36%   91.36%           
=======================================
  Files         235      235           
  Lines       28686    28686           
=======================================
+ Hits        26209    26210    +1     
+ Misses       2477     2476    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants