test for build with debug using release deps
import os
+import textwrap
import unittest
from conans.model.ref import PackageReference
@@ -6,6 +7,7 @@ from conans.paths import BUILD_INFO, CONANFILE
from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient
from conans.util.files import load, mkdir
+
conanfile_scope_env = """
from conans import ConanFile
@@ -347,3 +349,29 @@ class BarConan(ConanFile):
client.run("create --build foo/1.0@user/stable --build bar/1.0@user/testing . user/testing")
self.assertIn("foo/1.0@user/stable: WARN: Forced build from source", client.out)
self.assertIn("bar/1.0@user/testing: WARN: Forced build from source", client.out)
+
+ def debug_build_release_deps_test(self):
+ # https://github.com/conan-io/conan/issues/2899
+ client = TestClient()
+ conanfile = textwrap.dedent("""
+ from conans import ConanFile
+ class Conan(ConanFile):
+ name = "{name}"
+ {requires}
+ settings = "build_type"
+ def build(self):
+ self.output.info("BUILD: %s BuildType=%s!"
+ % (self.name, self.settings.build_type))
+ def package_info(self):
+ self.output.info("PACKAGE_INFO: %s BuildType=%s!"
+ % (self.name, self.settings.build_type))
+ """)
+ client.save({CONANFILE: conanfile.format(name="Dep", requires="")})
+ client.run("create . Dep/0.1@user/testing -s build_type=Release")
+ client.save({CONANFILE: conanfile.format(name="MyPkg",
+ requires="requires = 'Dep/0.1@user/testing'")})
+ client.run("install . -s MyPkg:build_type=Debug -s build_type=Release")
+ self.assertIn("Dep/0.1@user/testing: PACKAGE_INFO: Dep BuildType=Release!", client.out)
+ client.run("build .")
+ self.assertIn("conanfile.py (MyPkg/None@None/None): BUILD: MyPkg BuildType=Debug!",
+ client.out)
