Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"containerEnv": {
"CONAN_PROFILE": "debug",
"CONAN_OPTS": "--options celix/*:build_all=True -o celix/*:enable_address_sanitizer=True -o celix/*:enable_testing=True -o celix/*:enable_ccache=True -o celix/*:enable_code_coverage=True",
"CONAN_OPTS": "--options celix/*:build_all=True -o celix/*:enable_address_sanitizer=True -o celix/*:enable_testing=True -o celix/*:enable_ccache=True -o celix/*:enable_code_coverage=True -o mosquitto/*:broker=True -o *:shared=True",
"CONAN_CONF": "--conf tools.cmake.cmaketoolchain:generator=Ninja",
},
"securityOpt": [
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/conan_create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ jobs:
CC: ${{ matrix.compiler[0] }}
CXX: ${{ matrix.compiler[1] }}
run: |
conan create . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:build_all=True -o celix/*:enable_ccache=True -pr:b default -pr:h default -s:h build_type=${{ matrix.type }} -o celix/*:celix_cxx17=True -o celix/*:celix_install_deprecated_api=True
conan create . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:build_all=True -o celix/*:enable_ccache=True -pr:b default -pr:h default -s:h build_type=${{ matrix.type }} -o celix/*:celix_cxx17=True -o celix/*:celix_install_deprecated_api=True -o mosquitto/*:broker=True -o *:shared=True
- name: Dependency Deduction Test
env:
CC: ${{ matrix.compiler[0] }}
CXX: ${{ matrix.compiler[1] }}
run: |
conan inspect . | awk 'BEGIN { FS="[\t:]+"; output=0 } /build/ && !/build_all/ { if(output) print $1} /^options/ {output=1} /^options_definitions/ {output=0}' | while read option; do conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:${option}=True -pr:b default -pr:h default -s:h build_type=${{ matrix.type }} -of ${option}_dir -o celix/*:celix_cxx17=True -o celix/*:enable_ccache=True -o celix/*:celix_install_deprecated_api=True || exit 1; done
conan inspect . | awk 'BEGIN { FS="[\t:]+"; output=0 } /build/ && !/build_all/ { if(output) print $1} /^options/ {output=1} /^options_definitions/ {output=0}' | while read option; do conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:${option}=True -pr:b default -pr:h default -s:h build_type=${{ matrix.type }} -of ${option}_dir -o celix/*:celix_cxx17=True -o celix/*:enable_ccache=True -o celix/*:celix_install_deprecated_api=True -o mosquitto/*:broker=True -o *:shared=True || exit 1; done
- name: Remove Celix
run: |
conan remove -c celix/*
Expand Down Expand Up @@ -116,10 +116,10 @@ jobs:
${{ runner.os }}-ccache-Release-
- name: Create Celix
run: |
conan create . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:build_all=True -o celix/*:enable_ccache=True -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -o celix/*:celix_cxx17=True -o celix/*:celix_install_deprecated_api=True -o celix/*:enable_address_sanitizer=True
conan create . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:build_all=True -o celix/*:enable_ccache=True -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -o celix/*:celix_cxx17=True -o celix/*:celix_install_deprecated_api=True -o celix/*:enable_address_sanitizer=True -o mosquitto/*:broker=True -o *:shared=True
- name: Dependency Deduction Test
run: |
conan inspect . | awk 'BEGIN { FS="[\t:]+"; output=0 } /build/ && !/build_all/ && !/build_rsa_remote_service_admin_shm_v2/ && !/build_rsa_discovery_zeroconf/ { if(output) print $1} /^options/ {output=1} /^options_definitions/ {output=0}' | while read option; do conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:${option}=True -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -of ${option}_dir -o celix/*:celix_cxx17=True -o celix/*:enable_ccache=True -o celix/*:celix_install_deprecated_api=True || exit 1; done
conan inspect . | awk 'BEGIN { FS="[\t:]+"; output=0 } /build/ && !/build_all/ && !/build_rsa_remote_service_admin_shm_v2/ && !/build_rsa_discovery_zeroconf/ { if(output) print $1} /^options/ {output=1} /^options_definitions/ {output=0}' | while read option; do conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -b missing -o celix/*:${option}=True -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release -of ${option}_dir -o celix/*:celix_cxx17=True -o celix/*:enable_ccache=True -o celix/*:celix_install_deprecated_api=True -o mosquitto/*:broker=True -o *:shared=True || exit 1; done
- name: Remove Celix
run: |
conan remove -c celix/*
1 change: 1 addition & 0 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
conan build . -pr:b release -pr:h debug --build=missing \
--options celix/*:build_all=True --options celix/*:enable_address_sanitizer=True \
--options celix/*:enable_testing=True --options celix/*:enable_ccache=True \
-o mosquitto/*:broker=True -o *:shared=True \
--conf:build tools.cmake.cmaketoolchain:generator=Ninja"
- name: Test Celix
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
-o celix/*:enable_code_coverage=True
-o celix/*:enable_testing_on_ci=True
-o celix/*:enable_ccache=True
-o mosquitto/*:broker=True
-o *:shared=True
run: |
conan build . -pr:b release -pr:h default ${CONAN_BUILD_OPTIONS} -b missing
- name: Test with coverage
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/fuzzing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
-o celix/*:enable_address_sanitizer=True
-o celix/*:enable_undefined_sanitizer=True
-o celix/*:celix_err_buffer_size=5120
-o *:shared=True
run: conan build -c tools.cmake.cmaketoolchain:generator=Ninja ${CONAN_BUILD_OPTIONS} -b missing
- name: Set fuzzer run time
id: set-runtime
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
-o celix/*:enable_testing_on_ci=True
-o celix/*:framework_curlinit=False
-o celix/*:enable_ccache=True
-o mosquitto/*:broker=True
-o *:shared=True
run: |
conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b default -pr:h default -s:b build_type=Release -s:h build_type=Release ${CONAN_BUILD_OPTIONS} -b missing
- name: Test
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ jobs:
-o celix/*:enable_testing_on_ci=True
-o celix/*:framework_curlinit=False
-o celix/*:enable_ccache=True
-o mosquitto/*:broker=True
-o *:shared=True
run: |
conan build . -c tools.cmake.cmaketoolchain:generator=Ninja -pr:b release -pr:h default ${CONAN_BUILD_OPTIONS} -b missing
- name: Test
Expand Down
102 changes: 64 additions & 38 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,67 @@ def validate(self):
self.validate_config_option_is_positive_number("celix_properties_optimization_string_buffer_size")
self.validate_config_option_is_positive_number("celix_properties_optimization_entries_buffer_size")

# Helper function to safely get dependency option value
def _get_dependency_option_value(self, dep_name, option_name):
"""Safely get dependency option value, handling get_safe vs direct attribute access"""
if dep_name in self.dependencies:
dep = self.dependencies[dep_name]
# First try get_safe, if that fails try direct attribute access
value = dep.options.get_safe(option_name)
if value is None:
# Try direct attribute access
try:
value = getattr(dep.options, option_name)
except AttributeError:
# Option does not exist
return None
return value
return None

# Validate dependency shared options based on Celix options
# Split OR conditions into individual checks with detailed error messages
from collections import namedtuple

ValidationRule = namedtuple('ValidationRule', ['condition', 'dep_name', 'option_name', 'expected_value', 'condition_desc'])

validation_rules = [
ValidationRule(self.options.build_utils, 'libzip', "shared", True, 'build_utils=True'),
ValidationRule(self.options.build_utils, 'libuv', "shared", True, 'build_utils=True'),
ValidationRule(self.options.build_framework, 'util-linux-libuuid', "shared", True, 'build_framework=True'),
ValidationRule(self.options.build_framework and self.options.framework_curlinit, 'libcurl', "shared", True, 'build_framework=True and framework_curlinit=True'),
ValidationRule(self.options.build_framework and self.options.framework_curlinit, 'openssl', "shared", True, 'build_framework=True and framework_curlinit=True'),
ValidationRule(self.options.build_celix_etcdlib, 'libcurl', "shared", True, 'build_celix_etcdlib=True'),
ValidationRule(self.options.build_celix_etcdlib, 'openssl', "shared", True, 'build_celix_etcdlib=True'),
ValidationRule(self.options.build_rsa_discovery_common, 'libcurl', "shared", True, 'build_rsa_discovery_common=True'),
ValidationRule(self.options.build_rsa_discovery_common, 'openssl', "shared", True, 'build_rsa_discovery_common=True'),
ValidationRule(self.options.build_rsa_remote_service_admin_dfi, 'libcurl', "shared", True, 'build_rsa_remote_service_admin_dfi=True'),
ValidationRule(self.options.build_rsa_remote_service_admin_dfi, 'openssl', "shared", True, 'build_rsa_remote_service_admin_dfi=True'),
ValidationRule(self.options.build_launcher, 'libcurl', "shared", True, 'build_launcher=True'),
ValidationRule(self.options.build_launcher, 'openssl', "shared", True, 'build_launcher=True'),
ValidationRule(self.options.enable_testing, 'gtest', "shared", True, 'enable_testing=True'),
ValidationRule(self.options.enable_benchmarking, 'benchmark', "shared", True, 'enable_benchmarking=True'),
ValidationRule(self.options.build_rsa_discovery_common, 'libxml2', "shared", True, 'build_rsa_discovery_common=True'),
ValidationRule(self.options.build_rsa_remote_service_admin_dfi and self.options.enable_testing, 'libxml2', "shared", True, 'build_rsa_remote_service_admin_dfi=True and enable_testing=True'),
ValidationRule(self.options.build_http_admin, 'civetweb', "shared", True, 'build_http_admin=True'),
ValidationRule(self.options.build_http_admin, 'openssl', "shared", True, 'build_http_admin=True'),
ValidationRule(self.options.build_rsa_discovery_common, 'civetweb', "shared", True, 'build_rsa_discovery_common=True'),
ValidationRule(self.options.build_rsa_discovery_common, 'openssl', "shared", True, 'build_rsa_discovery_common=True'),
ValidationRule(self.options.build_rsa_remote_service_admin_dfi, 'civetweb', "shared", True, 'build_rsa_remote_service_admin_dfi=True'),
ValidationRule(self.options.build_rsa_remote_service_admin_dfi, 'openssl', "shared", True, 'build_rsa_remote_service_admin_dfi=True'),
ValidationRule(self.options.build_celix_dfi, 'libffi', "shared", True, 'build_celix_dfi=True'),
ValidationRule(self.options.build_utils, 'jansson', "shared", True, 'build_utils=True'),
ValidationRule(self.options.build_celix_dfi, 'jansson', "shared", True, 'build_celix_dfi=True'),
ValidationRule(self.options.build_celix_etcdlib, 'jansson', "shared", True, 'build_celix_etcdlib=True'),
ValidationRule(self.options.build_event_admin_remote_provider_mqtt, 'jansson', "shared", True, 'build_event_admin_remote_provider_mqtt=True'),
ValidationRule(self.options.build_event_admin_remote_provider_mqtt and self.options.enable_testing, "mosquitto", "broker", True, "build_event_admin_remote_provider_mqtt=True and enable_testing=True"),
]

for rule in validation_rules:
if rule.condition and rule.dep_name in self.dependencies:
actual_value = _get_dependency_option_value(self, rule.dep_name, rule.option_name)
if actual_value is not None and actual_value != rule.expected_value:
raise ConanInvalidConfiguration(f"Celix configuration `{rule.condition_desc}` requires {rule.dep_name}/*:{rule.option_name}={rule.expected_value}")

def package_id(self):
del self.info.options.build_all
# the followings are not installed
Expand Down Expand Up @@ -304,39 +365,6 @@ def configure(self):
setattr(self.options, opt, options[opt])
del options

# Conan 2 does not support set dependency option in requirements()
# https://github.com/conan-io/conan/issues/14528#issuecomment-1685344080
if self.options.build_utils:
self.options['libzip'].shared = True
self.options['libuv'].shared = True
if self.options.build_framework:
self.options['util-linux-libuuid'].shared = True
if ((self.options.build_framework and self.options.framework_curlinit)
or self.options.build_celix_etcdlib
or self.options.build_rsa_discovery_common or self.options.build_rsa_remote_service_admin_dfi
or self.options.build_launcher):
self.options['libcurl'].shared = True
self.options['openssl'].shared = True
if self.options.enable_testing:
self.options['gtest'].shared = True
if self.options.enable_benchmarking:
self.options['benchmark'].shared = True
if (self.options.build_rsa_discovery_common
or (self.options.build_rsa_remote_service_admin_dfi and self.options.enable_testing)):
self.options['libxml2'].shared = True
if self.options.build_http_admin or self.options.build_rsa_discovery_common \
or self.options.build_rsa_remote_service_admin_dfi:
self.options['civetweb'].shared = True
self.options['openssl'].shared = True
if self.options.build_celix_dfi:
self.options['libffi'].shared = True
if self.options.build_utils or self.options.build_celix_dfi or self.options.build_celix_etcdlib or self.options.build_event_admin_remote_provider_mqtt:
self.options['jansson'].shared = True
if self.options.build_event_admin_remote_provider_mqtt:
self.options['mosquitto'].shared = True
if self.options.enable_testing:
self.options['mosquitto'].broker = True

def requirements(self):
if self.options.build_utils:
self.requires("libzip/[>=1.7.3 <2.0.0]")
Expand Down Expand Up @@ -371,7 +399,7 @@ def requirements(self):
self.requires("zlib/1.3.1", override=True)
if self.options.build_event_admin_remote_provider_mqtt:
self.requires("mosquitto/[>=2.0.3 <3.0.0]")
self.validate()


def layout(self):
cmake_layout(self)
Expand Down Expand Up @@ -425,7 +453,5 @@ def package_info(self):
# enable imports() of conanfile.py to collect bundles from the local cache using @bindirs
# check https://docs.conan.io/en/latest/reference/conanfile/methods.html#imports
self.cpp_info.bindirs = ["bin", os.path.join("share", self.name, "bundles")]
self.cpp_info.build_modules["cmake"].append(os.path.join("lib", "cmake", "Celix", "CelixConfig.cmake"))
self.cpp_info.build_modules["cmake_find_package"].append(os.path.join("lib", "cmake",
"Celix", "CelixConfig.cmake"))
self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "Celix", "CelixConfig.cmake")])
self.cpp_info.builddirs.append(os.path.join("lib", "cmake", "Celix"))
self.cpp_info.set_property("cmake_find_mode", "none")
5 changes: 4 additions & 1 deletion documents/building/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ conan install . --build=missing --profile:build default --profile:host debug \
-o "celix/*:build_all=True" \
-o "celix/*:enable_testing=True" \
-o "celix/*:enable_ccache=True" \
-o "mosquitto/*:broker=True" \
-o "*:shared=True" \
--conf tools.cmake.cmaketoolchain:generator=Ninja
```

Expand All @@ -110,7 +112,8 @@ For example, to only build the framework and utils libraries:
```bash
conan install . --build=missing --profile:build default --profile:host debug \
-o "celix/*:build_framework=True" \
-o "celix/*:build_utils=True"
-o "celix/*:build_utils=True" \
-o "*:shared=True"
cmake --build --preset conan-debug --parallel
```

Expand Down
Loading
Loading