-
Notifications
You must be signed in to change notification settings - Fork 104
MINIFICPP-2859 Extend Conan usage and integrate it in Windows and MacOS CI jobs #2212
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
Open
lordgamez
wants to merge
6
commits into
apache:main
Choose a base branch
from
lordgamez:MINIFICPP-2859
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1c559b0
MINIFICPP-2859 Extend Conan usage and integrate it in Windows and Mac…
lordgamez 3edcdc2
Review update
lordgamez 9caff91
remove unnecessary get_safe calls
lordgamez 4b69578
Remove unused mqtt patch
lordgamez 65aa73d
Fix kafka compilation options
lordgamez 26e7d3c
Fix fips compilation with conan
lordgamez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from conan.tools.build import supported_cppstd, supported_cstd | ||
|
|
||
|
|
||
| def cppstd_compat(conanfile): | ||
| # It will try to find packages with all the cppstd versions | ||
| extension_properties = getattr(conanfile, "extension_properties", {}) | ||
| compiler = conanfile.settings.get_safe("compiler") | ||
| compiler_version = conanfile.settings.get_safe("compiler.version") | ||
| cppstd = conanfile.settings.get_safe("compiler.cppstd") | ||
| if not compiler or not compiler_version: | ||
| return [] | ||
| factors = [] # List of list, each sublist is a potential combination | ||
| if cppstd is not None and extension_properties.get("compatibility_cppstd") is not False: | ||
| cppstd_possible_values = supported_cppstd(conanfile) | ||
| if cppstd_possible_values is None: | ||
| conanfile.output.warning(f'No cppstd compatibility defined for compiler "{compiler}"') | ||
| else: # The current cppst must be included in case there is other factor | ||
| factors.append([{"compiler.cppstd": v} for v in cppstd_possible_values]) | ||
|
|
||
| cstd = conanfile.settings.get_safe("compiler.cstd") | ||
| if cstd is not None and extension_properties.get("compatibility_cstd") is not False: | ||
| cstd_possible_values = supported_cstd(conanfile) | ||
| if cstd_possible_values is None: | ||
| conanfile.output.warning(f'No cstd compatibility defined for compiler "{compiler}"') | ||
| else: | ||
| factors.append([{"compiler.cstd": v} for v in cstd_possible_values if v != cstd]) | ||
| return factors | ||
|
|
||
|
|
||
| def compatibility(conanfile): | ||
| # By default, different compiler.cppstd are compatible | ||
| # factors is a list of lists | ||
| factors = cppstd_compat(conanfile) | ||
|
|
||
| # MSVC fallback compatibility | ||
| compiler = conanfile.settings.get_safe("compiler") | ||
| compiler_version = conanfile.settings.get_safe("compiler.version") | ||
| if compiler == "msvc": | ||
| msvc_fallbacks = { | ||
| "195": ["194", "193"], | ||
| "194": ["193"], | ||
| }.get(compiler_version, []) | ||
|
|
||
| if msvc_fallbacks: | ||
| factors.append([{"compiler.version": v} for v in msvc_fallbacks]) | ||
|
|
||
| # macOS / apple-clang: accept any compiler.version >= 13 as compatible | ||
| os_ = conanfile.settings.get_safe("os") | ||
| if os_ == "Macos" and compiler == "apple-clang" and compiler_version is not None: | ||
| try: | ||
| current_version = int(str(compiler_version).split(".")[0]) | ||
| except ValueError: | ||
| current_version = None | ||
| if current_version is not None: | ||
| min_version = 13 | ||
| max_version = 21 # support up to Xcode 27 with apple-clang 21 for now | ||
| candidate_versions = [ | ||
| str(v) for v in range(min_version, max_version + 1) | ||
| if v != current_version | ||
| ] | ||
| factors.append([{"compiler.version": v} for v in candidate_versions]) | ||
|
|
||
| combinations = _factors_combinations(factors) | ||
| return [{"settings": [(k, v) for k, v in comb.items()]} for comb in combinations] | ||
|
|
||
|
|
||
| def _factors_combinations(factors): | ||
| combinations = [] | ||
| for factor in factors: | ||
| if not combinations: | ||
| combinations = list(factor) | ||
| continue | ||
| new_combinations = [] | ||
| for comb in combinations: | ||
| for f in factor: | ||
| new_comb = comb.copy() | ||
| new_comb.update(f) | ||
| new_combinations.append(new_comb) | ||
| combinations.extend(new_combinations) | ||
| return combinations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.