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
3 changes: 3 additions & 0 deletions conan/internal/graph/build_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def __init__(self, params):
else:
self.patterns.append(clean_pattern)

if self._build_compatible_patterns and self._build_compatible_patterns != ["&"]:
raise ConanException("compatible build mode only supports --build=compatible:& syntax for now")

if self.never and (self.missing or self.patterns or self.cascade):
raise ConanException("--build=never not compatible with other options")

Expand Down
1 change: 1 addition & 0 deletions test/integration/command/info/test_info_build_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ def test_build_order_space_in_options():
assert order["order"][0][0]["build_args"] == '''--requires=dep/1.0 --build=dep/1.0 -o="dep/*:extras=cxx="yes" gnuext='no'" -o="dep/*:flags=define=FOO define=BAR define=BAZ"'''


@pytest.mark.skip(reason="Unsupported --build=compatible syntax")
def test_build_order_build_context_compatible():
c = TestClient()
foo = textwrap.dedent("""
Expand Down
38 changes: 38 additions & 0 deletions test/integration/package_id/compatible_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import json
import textwrap

import pytest

from conan.test.utils.tools import TestClient, GenConanfile


Expand Down Expand Up @@ -546,6 +548,7 @@ def validate_build(self):
c.run("list *:*")
assert "compiler.cppstd: 17" in c.out

@pytest.mark.skip(reason="Unsupported --build=compatible syntax")
def test_multi_level_build_compatible(self):
c = TestClient()
conanfile = textwrap.dedent("""
Expand Down Expand Up @@ -583,6 +586,7 @@ def validate(self):
c.run("list libb:*")
assert "compiler.cppstd: 17" in c.out

@pytest.mark.skip(reason="Unsupported --build=compatible syntax")
def test_multi_level_build_compatible_build_order(self):
c = TestClient()
conanfile = textwrap.dedent("""
Expand Down Expand Up @@ -670,6 +674,40 @@ def validate_build(self):
assert pkga["info"]["compatibility_delta"] == {"settings": [["compiler.cppstd", "14"]]}
assert pkga["build_args"] == "--requires=liba/0.1 --build=compatible:liba/0.1"

@pytest.mark.skip(reason="Unsupported --build=compatible syntax")
def test_compatible_build_test_package(self):
tc = TestClient()
tc.save({"conanfile.py": textwrap.dedent("""
from conan import ConanFile
from conan.tools.build import check_min_cppstd

class Pkg(ConanFile):
name = "pkg"
version = "0.1"
settings = "compiler"

def validate(self):
check_min_cppstd(self, 17)
"""),
"test_package/conanfile.py": textwrap.dedent("""
from conan import ConanFile

class TestPkg(ConanFile):
settings = "compiler"
def requirements(self):
self.requires(self.tested_reference_str)
def test(self):
pass
""")})

tc.run("create . -s compiler.cppstd=14 --build=compatible")
# Without checking if the compatibles are already in the cache, it will build twice,
# once for the package and once for the test_package
assert tc.out.count("pkg/0.1#2e52358a1684ca0bd32277b2630f0080:0b26ee249577d4b7c1e52c7ce646c0b5eb611dfb - Build") == 1
tc.run("create . -s compiler.cppstd=17 --build=compatible")
# This would fail because the package revision is now also included
#assert tc.out.count("pkg/0.1#2e52358a1684ca0bd32277b2630f0080:0b26ee249577d4b7c1e52c7ce646c0b5eb611dfb - Cache") == 2


def test_compatibility_new_setting_forwards_compat():
""" This test tries to reflect the following scenario:
Expand Down
Loading