Skip to content

Commit

Permalink
Merge branch 'develop2' into feature/remote_caching
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Dec 11, 2024
2 parents b5d0086 + c238022 commit 09c65cd
Show file tree
Hide file tree
Showing 21 changed files with 232 additions and 103 deletions.
26 changes: 16 additions & 10 deletions .ci/docker/conan-tests
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ ENV PY36=3.6.15 \
GXX_11=/usr/bin/g++-11 \
CLANG_14=/usr/bin/clang-14 \
CLANGXX_14=/usr/bin/clang++-14 \
BAZEL_6_3_2=6.3.2 \
BAZEL_7_1_2=7.1.2
BAZEL_6_5_0=6.5.0 \
BAZEL_7_4_1=7.4.1 \
BAZEL_8_0_0=8.0.0

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -131,14 +132,19 @@ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 10 && \
update-alternatives --set clang /usr/bin/clang-14 && \
update-alternatives --set clang++ /usr/bin/clang++-14

RUN mkdir -p /usr/share/bazel-$BAZEL_6_3_2/bin && \
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_6_3_2}/bazel-${BAZEL_6_3_2}-linux-x86_64 && \
chmod +x bazel-${BAZEL_6_3_2}-linux-x86_64 && \
mv bazel-${BAZEL_6_3_2}-linux-x86_64 /usr/share/bazel-$BAZEL_6_3_2/bin/bazel && \
mkdir -p /usr/share/bazel-$BAZEL_7_1_2/bin && \
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_7_1_2}/bazel-${BAZEL_7_1_2}-linux-x86_64 && \
chmod +x bazel-${BAZEL_7_1_2}-linux-x86_64 && \
mv bazel-${BAZEL_7_1_2}-linux-x86_64 /usr/share/bazel-$BAZEL_7_1_2/bin/bazel
RUN mkdir -p /usr/share/bazel-$BAZEL_6_5_0/bin && \
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_6_5_0}/bazel-${BAZEL_6_5_0}-linux-x86_64 && \
chmod +x bazel-${BAZEL_6_5_0}-linux-x86_64 && \
mv bazel-${BAZEL_6_5_0}-linux-x86_64 /usr/share/bazel-$BAZEL_6_5_0/bin/bazel && \
mkdir -p /usr/share/bazel-$BAZEL_7_4_1/bin && \
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_7_4_1}/bazel-${BAZEL_7_4_1}-linux-x86_64 && \
chmod +x bazel-${BAZEL_7_4_1}-linux-x86_64 && \
mv bazel-${BAZEL_7_4_1}-linux-x86_64 /usr/share/bazel-$BAZEL_7_4_1/bin/bazel && \
mkdir -p /usr/share/bazel-$BAZEL_8_0_0/bin && \
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_8_0_0}/bazel-${BAZEL_8_0_0}-linux-x86_64 && \
chmod +x bazel-${BAZEL_8_0_0}-linux-x86_64 && \
mv bazel-${BAZEL_8_0_0}-linux-x86_64 /usr/share/bazel-$BAZEL_8_0_0/bin/bazel


USER conan
WORKDIR $HOME
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/osx-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ jobs:
~/Applications/CMake/3.15.7
~/Applications/CMake/3.19.7
~/Applications/CMake/3.23.5
~/Applications/bazel/6.3.2
~/Applications/bazel/7.1.2
~/Applications/bazel/6.5.0
~/Applications/bazel/7.4.1
~/Applications/bazel/8.0.0
key: ${{ runner.os }}-conan-tools-cache

- name: Build CMake old versions not available for ARM
Expand Down Expand Up @@ -111,7 +112,7 @@ jobs:
if: steps.cache-tools.outputs.cache-hit != 'true'
run: |
set -e
for version in 6.3.2 7.1.2; do
for version in 6.5.0 7.4.1 8.0.0; do
mkdir -p ${HOME}/Applications/bazel/${version}
wget -q -O ${HOME}/Applications/bazel/${version}/bazel https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64
chmod +x ${HOME}/Applications/bazel/${version}/bazel
Expand Down Expand Up @@ -146,8 +147,9 @@ jobs:
~/Applications/CMake/3.15.7
~/Applications/CMake/3.19.7
~/Applications/CMake/3.23.5
~/Applications/bazel/6.3.2
~/Applications/bazel/7.1.2
~/Applications/bazel/6.5.0
~/Applications/bazel/7.4.1
~/Applications/bazel/8.0.0
key: ${{ runner.os }}-conan-tools-cache

- name: Set up Python ${{ matrix.python-version }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/win-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ jobs:
C:\tools\cmake\3.15.7
C:\tools\cmake\3.19.7
C:\tools\cmake\3.23.5
C:\tools\bazel\6.3.2
C:\tools\bazel\7.1.2
C:\tools\bazel\6.5.0
C:\tools\bazel\7.4.1
C:\tools\bazel\8.0.0
key: ${{ runner.os }}-conan-tools-cache

- name: Build CMake old versions of CMake
Expand Down Expand Up @@ -211,7 +212,7 @@ jobs:
- name: Install Bazel versions
if: steps.cache-tools.outputs.cache-hit != 'true'
run: |
$BAZEL_BUILD_VERSIONS = "6.3.2", "7.1.2"
$BAZEL_BUILD_VERSIONS = "6.5.0", "7.4.1", "8.0.0"
foreach ($version in $BAZEL_BUILD_VERSIONS) {
Write-Host "Downloading Bazel version $version for Windows..."
$destination = "C:\tools\bazel\$version"
Expand Down
5 changes: 4 additions & 1 deletion conan/internal/api/profile/profile_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ def _load_profile(self, profile_name, cwd):
"conan_version": conan_version,
"detect_api": detect_api}

rtemplate = Environment(loader=FileSystemLoader(base_path)).from_string(text)
# Always include the root Conan home "profiles" folder as secondary route for loading
# imports and includes from jinja2 templates.
loader_paths = [base_path, profiles_folder]
rtemplate = Environment(loader=FileSystemLoader(loader_paths)).from_string(text)

try:
text = rtemplate.render(context)
Expand Down
3 changes: 2 additions & 1 deletion conan/tools/cmake/cmakedeps2/target_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import jinja2
from jinja2 import Template

from conan.api.output import ConanOutput
from conan.errors import ConanException
from conans.client.graph.graph import CONTEXT_BUILD, CONTEXT_HOST
from conans.model.pkg_type import PackageType
Expand Down Expand Up @@ -166,7 +167,7 @@ def _get_cmake_lib(self, info, components, pkg_folder, pkg_folder_var):
"system_libs": system_libs}

if info.frameworks:
self._conanfile.output.warning("frameworks not supported yet in new CMakeDeps generator")
ConanOutput(scope=str(self._conanfile)).warning("frameworks not supported yet in new CMakeDeps generator")

if info.libs:
if len(info.libs) != 1:
Expand Down
4 changes: 3 additions & 1 deletion conan/tools/google/bazeldeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ class _BazelBUILDGenerator:
{% for bindir in obj["bindirs"] %}
"{{ bindir }}/**",
{% endfor %}
]),
],
allow_empty = True
),
visibility = ["//visibility:public"],
)
{% endif %}
Expand Down
16 changes: 8 additions & 8 deletions conan/tools/microsoft/visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,17 @@ def _vcvars_versions(conanfile):
return None, None
toolset_version = conanfile.settings.get_safe("compiler.runtime_version")
vs_version = {"v140": "14",
"v141": "15",
"v142": "16",
"v143": "17",
"v144": "17"}.get(toolset_version)
"v141": "15",
"v142": "16",
"v143": "17",
"v144": "17"}.get(toolset_version)
if vs_version is None:
raise ConanException("Visual Studio Runtime version (v140-v144) not defined")
vcvars_ver = {"v140": "14.0",
"v141": "14.1",
"v142": "14.2",
"v143": "14.3",
"v144": "14.4"}.get(toolset_version)
"v141": "14.1",
"v142": "14.2",
"v143": "14.3",
"v144": "14.4"}.get(toolset_version)
if vcvars_ver and msvc_update is not None:
vcvars_ver += f"{msvc_update}"
else:
Expand Down
9 changes: 4 additions & 5 deletions conans/client/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def propagate_downstream(self, require, node, src_node=None):
return

if src_node is not None: # This happens when closing a loop, and we need to know the edge
d = [d for d in self.dependants if d.src is src_node][0] # TODO: improve ugly
d = next(d for d in self.dependants if d.src is src_node)
else:
assert len(self.dependants) == 1
d = self.dependants[0]
Expand All @@ -131,7 +131,7 @@ def propagate_downstream(self, require, node, src_node=None):
# But if the files are not needed in this graph branch, can be marked "Skip"
if down_require.files:
down_require.required_nodes = require.required_nodes.copy()
down_require.required_nodes.append(self)
down_require.required_nodes.add(self)
return d.src.propagate_downstream(down_require, node)

def check_downstream_exists(self, require):
Expand Down Expand Up @@ -216,7 +216,6 @@ def pref(self):

def add_edge(self, edge):
if edge.src == self:
assert edge not in self.dependencies
self.dependencies.append(edge)
else:
self.dependants.append(edge)
Expand Down Expand Up @@ -360,8 +359,8 @@ def root(self):
def add_node(self, node):
self.nodes.append(node)

def add_edge(self, src, dst, require):
assert src in self.nodes and dst in self.nodes
@staticmethod
def add_edge(src, dst, require):
edge = Edge(src, dst, require)
src.add_edge(edge)
dst.add_edge(edge)
Expand Down
8 changes: 5 additions & 3 deletions conans/model/build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,11 @@ def _find_matching(dirs, pattern):
elif ext == ".dll":
dll_location = _find_matching(bindirs, libname)
else:
regex_static = re.compile(rf"(?:lib)?{libname}(?:[._-].+)?\.(?:a|lib)")
regex_shared = re.compile(rf"(?:lib)?{libname}(?:[._-].+)?\.(?:so|dylib)")
regex_dll = re.compile(rf"(?:.+)?({libname}|{component_name})(?:.+)?\.dll")
lib_sanitized = re.escape(libname)
component_sanitized = re.escape(component_name)
regex_static = re.compile(rf"(?:lib)?{lib_sanitized}(?:[._-].+)?\.(?:a|lib)")
regex_shared = re.compile(rf"(?:lib)?{lib_sanitized}(?:[._-].+)?\.(?:so|dylib)")
regex_dll = re.compile(rf".*(?:{lib_sanitized}|{component_sanitized}).*\.dll")
static_location = _find_matching(libdirs, regex_static)
shared_location = _find_matching(libdirs, regex_shared)
if static_location or not shared_location:
Expand Down
4 changes: 2 additions & 2 deletions conans/model/requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, ref, *, headers=None, libs=None, build=False, run=None, visib
self.override_ref = None # to store if the requirement has been overriden (store new ref)
self.is_test = test # to store that it was a test, even if used as regular requires too
self.skip = False
self.required_nodes = [] # store which intermediate nodes are required, to compute "Skip"
self.required_nodes = set() # store which intermediate nodes are required, to compute "Skip"

@property
def files(self): # require needs some files in dependency package
Expand Down Expand Up @@ -260,7 +260,7 @@ def aggregate(self, other):
# current require already defined it or not
if self.package_id_mode is None:
self.package_id_mode = other.package_id_mode
self.required_nodes.extend(other.required_nodes)
self.required_nodes.update(other.required_nodes)

def transform_downstream(self, pkg_type, require, dep_pkg_type):
"""
Expand Down
2 changes: 1 addition & 1 deletion conans/model/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def __delattr__(self, field):
del self._data[field]

def __setattr__(self, field, value):
if field[0] == "_" or field.startswith("values"):
if field[0] == "_":
return super(Settings, self).__setattr__(field, value)

self._check_field(field)
Expand Down
45 changes: 0 additions & 45 deletions test/_performance/test_large_graph.py

This file was deleted.

17 changes: 10 additions & 7 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,16 @@
"system": {"path": {'Windows': "C:/tools/cygwin/bin"}},
},
'bazel': {
"default": "6.3.2",
"6.3.2": {"path": {'Linux': '/usr/share/bazel-6.3.2/bin',
'Windows': 'C:/tools/bazel/6.3.2',
'Darwin': '/Users/runner/Applications/bazel/6.3.2'}},
"7.1.2": {"path": {'Linux': '/usr/share/bazel-7.1.2/bin',
'Windows': 'C:/tools/bazel/7.1.2',
'Darwin': '/Users/runner/Applications/bazel/7.1.2'}},
"default": "7",
"6.5.0": {"path": {'Linux': '/usr/share/bazel-6.5.0/bin',
'Windows': 'C:/tools/bazel/6.5.0',
'Darwin': '/Users/runner/Applications/bazel/6.5.0'}},
"7.4.1": {"path": {'Linux': '/usr/share/bazel-7.4.1/bin',
'Windows': 'C:/tools/bazel/7.4.1',
'Darwin': '/Users/runner/Applications/bazel/7.4.1'}},
"8.0.0": {"path": {'Linux': '/usr/share/bazel-8.0.0/bin',
'Windows': 'C:/tools/bazel/8.0.0',
'Darwin': '/Users/runner/Applications/bazel/8.0.0'}},
},
'premake': {
"disabled": True,
Expand Down
19 changes: 15 additions & 4 deletions test/functional/toolchains/google/test_bazel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def base_profile():


@pytest.mark.parametrize("build_type", ["Debug", "Release", "RelWithDebInfo", "MinSizeRel"])
@pytest.mark.tool("bazel", "6.3.2")
@pytest.mark.tool("bazel", "6.5.0")
def test_basic_exe_6x(bazelrc, build_type, base_profile, bazel_output_root_dir):
client = TestClient(path_with_spaces=False)
client.run(f"new bazel_exe -d name=myapp -d version=1.0 -d output_root_dir={bazel_output_root_dir}")
Expand All @@ -56,7 +56,7 @@ def test_basic_exe_6x(bazelrc, build_type, base_profile, bazel_output_root_dir):


@pytest.mark.parametrize("build_type", ["Debug", "Release", "RelWithDebInfo", "MinSizeRel"])
@pytest.mark.tool("bazel", "7.1.2")
@pytest.mark.tool("bazel", "7.4.1")
def test_basic_exe(bazelrc, build_type, base_profile, bazel_output_root_dir):
client = TestClient(path_with_spaces=False)
client.run(f"new bazel_7_exe -d name=myapp -d version=1.0 -d output_root_dir={bazel_output_root_dir}")
Expand All @@ -73,8 +73,19 @@ def test_basic_exe(bazelrc, build_type, base_profile, bazel_output_root_dir):
assert "myapp/1.0: Hello World Debug!" in client.out


@pytest.mark.tool("bazel", "8.0.0")
def test_basic_lib(bazelrc, base_profile, bazel_output_root_dir):
"""
Issue related: https://github.com/conan-io/conan/issues/17438
"""
client = TestClient(path_with_spaces=False)
client.run(f"new bazel_7_lib -d name=mylib -d version=1.0 -d output_root_dir={bazel_output_root_dir}")
client.run("create .")
assert "mylib/1.0: Hello World Release!" in client.out


@pytest.mark.parametrize("shared", [False, True])
@pytest.mark.tool("bazel", "6.3.2")
@pytest.mark.tool("bazel", "6.5.0")
def test_transitive_libs_consuming_6x(shared, bazel_output_root_dir):
"""
Testing the next dependencies structure for shared/static libs
Expand Down Expand Up @@ -200,7 +211,7 @@ def test_transitive_libs_consuming_6x(shared, bazel_output_root_dir):


@pytest.mark.parametrize("shared", [False, True])
@pytest.mark.tool("bazel", "7.1.2")
@pytest.mark.tool("bazel", "7.4.1")
@pytest.mark.skipif(platform.system() == "Linux",
reason="Conan CI fails (likely related to parallel "
"tests running??). Skipping it for now!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@pytest.mark.skipif(platform.system() != "Darwin", reason="Only for Darwin")
@pytest.mark.tool("bazel", "6.3.2") # not working for Bazel 7.x
@pytest.mark.tool("bazel", "6.5.0") # not working for Bazel 7.x
def test_bazel_simple_cross_compilation():
profile = textwrap.dedent("""
[settings]
Expand Down
Loading

0 comments on commit 09c65cd

Please sign in to comment.