-
Notifications
You must be signed in to change notification settings - Fork 991
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
Implement test_package --build-test=missing
for full control of test_package
deps
#14347
Implement test_package --build-test=missing
for full control of test_package
deps
#14347
Conversation
--build-test=missing
for full control of test_package
deps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested this flag with a test_package
like this:
def requirements(self):
self.requires(self.tested_reference_str)
def build_requirements(self):
self.tool_requires(self.tested_reference_str)
while invoking conan create
in a way that results in both of these being satisfied by two different package IDs of the same reference, and this flag works perfectly fine and builds the missing reference.
However I still find it a bit counter intuitive, or perhaps it may need to be better documented
conan create . --build=missing
will fail for the code below if this results in two different package IDs being required:
def requirements(self):
self.requires(self.tested_reference_str)
def build_requirements(self):
self.tool_requires(self.tested_reference_str)
But the following scenario, where:
foobar/123
is exported- it is NOT a dependency of
self.tested_reference_str
and only appears as a requirement of the test package - there is currently no package generated for it
def requirements(self):
self.requires(self.tested_reference_str)
self.requires("foobar/123")
In this scenario,
conan create . --build=missing
will currently succeed (even before this PR), and will generate the missing
package for foobar/1.2.3
. So what is difficult to reason, on documentation alone, is why --build=missing
works for some of the references required by the test package, but specifically not for the one being created. I am aware why, but perhaps it needs a clarification in the documentation.
This can create confusion as to why --build-test=missing
does that --build=missing
doesn't, when passed as an argument to Conan create. I only see two useful scenarios:
- when one knows beforehand that there are multiple requirements on
self.tested_reference_str
and perhaps the more unusual but also valid: - when one wants
conan create
to force a build of the reference, rather than reuse an existing package, but still wants it to build any missing dependencies of the test_package
Thanks very much for the thorough review and testing @jcar87 I think the |
I think it is working fine, adding an extra test to the PR that validates it: def test_build_test_package_dep(self):
c = TestClient()
c.save({"dep/conanfile.py": GenConanfile("dep", "0.1"),
"pkg/conanfile.py": GenConanfile("pkg", "0.1"),
"pkg/test_package/conanfile.py": GenConanfile().with_requires("dep/0.1")
.with_test("pass")})
c.run("export dep")
c.run("create pkg --build=missing", assert_error=True)
c.assert_listed_binary({"pkg/0.1": ("da39a3ee5e6b4b0d3255bfef95601890afd80709", "Build")})
c.assert_listed_binary({"dep/0.1": ("da39a3ee5e6b4b0d3255bfef95601890afd80709", "Missing"),
"pkg/0.1": ("da39a3ee5e6b4b0d3255bfef95601890afd80709", "Cache")},
test_package=True) This works, and raise an error because the binary is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I think the behaviour changes makes sense, that is --build=missing
now applies only to the graph of the reference being created, and --build-test
missing applies to the graph of the test_package, which may contain additional references (if the test package has them).
I think this makes sense with the premise that conan create
has a premise where for the tested reference it should only build what is requested
…`test_package`` deps (conan-io#14347) * fix test_package --build=missing, now it works * wip * removed unused .all in BuildMode * fix unittest * wip * change order build_mode * wip * fix tests * working * new test * better defaults * minor -h improvements
Changelog: Feature:
conan create --build-test=missing
new argument to control what is being built as dependencies of thetest_package
folder.Docs: conan-io/docs#3336
Close #14314
Close #14352