Add npm, maven, conan configs (excluding cache)

This commit is contained in:
Riz Ashraf
2026-02-12 09:59:21 +00:00
parent adabc7fff2
commit c6e86575d0
62 changed files with 7292 additions and 0 deletions
@@ -0,0 +1,68 @@
# This file was generated by Conan. Remove this comment if you edit this file or Conan
# will destroy your changes.
from conan.tools.build import supported_cppstd, supported_cstd
from conan.errors import ConanException
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 194->193 fallback compatibility
compiler = conanfile.settings.get_safe("compiler")
compiler_version = conanfile.settings.get_safe("compiler.version")
if compiler == "msvc":
msvc_fallback = {"194": "193"}.get(compiler_version)
if msvc_fallback:
factors.append([{"compiler.version": msvc_fallback}])
# Append more factors for your custom compatibility rules here
# Combine factors to compute all possible configurations
combinations = _factors_combinations(factors)
# Final compatibility settings combinations to check
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 = 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
@@ -0,0 +1,46 @@
# This file was generated by Conan. Remove this comment if you edit this file or Conan
# will destroy your changes.
def profile_plugin(profile):
settings = profile.settings
if settings.get("compiler") in ("msvc", "clang") and settings.get("compiler.runtime"):
if settings.get("compiler.runtime_type") is None:
runtime = "Debug" if settings.get("build_type") == "Debug" else "Release"
try:
settings["compiler.runtime_type"] = runtime
except ConanException:
pass
_check_correct_cppstd(settings)
_check_correct_cstd(settings)
def _check_correct_cppstd(settings):
cppstd = settings.get("compiler.cppstd")
version = settings.get("compiler.version")
if cppstd and version:
compiler = settings.get("compiler")
from conan.tools.build.cppstd import supported_cppstd
supported = supported_cppstd(None, compiler, version)
# supported is None when we don't have information about the compiler
# but an empty list when no flags are supported for this version
if supported is not None and cppstd not in supported:
from conan.errors import ConanException
raise ConanException(f"The provided compiler.cppstd={cppstd} is not supported by {compiler} {version}. "
f"Supported values are: {supported}")
def _check_correct_cstd(settings):
cstd = settings.get("compiler.cstd")
version = settings.get("compiler.version")
if cstd and version:
compiler = settings.get("compiler")
from conan.tools.build.cstd import supported_cstd
supported = supported_cstd(None, compiler, version)
# supported is None when we don't have information about the compiler
# but an empty list when no flags are supported for this version
if supported is not None and cstd not in supported:
from conan.errors import ConanException
raise ConanException(f"The provided compiler.cstd={cstd} is not supported by {compiler} {version}. "
f"Supported values are: {supported}")