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
Exclude a package when building all from sources #8483
Merged
memsharded
merged 19 commits into
conan-io:develop
from
uilianries:feature/skip-build-package
Apr 20, 2021
Merged
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
815746f
Build all package when --build= is listed
uilianries f868074
Argument value None is a valid entry
uilianries 767f854
Validate build parameter
uilianries 4e94449
Revert last 3 commits
uilianries f4bfd1b
Validate graph build mode
uilianries 96ede96
Add test for ignore build package
uilianries 210b8c9
Accept skipped build package
uilianries 44e64ae
Fix empty argument validation
uilianries 4304f48
Validate build message
uilianries de3ef30
transform namespace.build in a list
uilianries 2151c9f
Improve build argument filter
uilianries e79eea8
Update --build help description
uilianries 15a15f7
#8442 Replace --build=! by --build-exclude
uilianries e55e19b
Merge branch 'develop' into feature/skip-build-package
uilianries 6528be5
Merge branch 'develop' into feature/skip-build-package
memsharded eaa884e
fix broken arg
memsharded a3c8855
same behavior as --build --build=pattern
memsharded 709217a
more test
memsharded 2e4ce6e
#8442 Add --build=! command help
uilianries File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import pytest | ||
from conans.test.assets.genconanfile import GenConanfile | ||
from conans.test.utils.tools import TestClient | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def build_all(): | ||
""" Build a simple graph to test --build option | ||
|
||
foobar <- bar <- foo | ||
<--------| | ||
|
||
All packages are built from sources to keep a cache. | ||
:return: TestClient instance | ||
""" | ||
client = TestClient() | ||
client.save({"conanfile.py": GenConanfile().with_setting("build_type")}) | ||
client.run("export . foo/1.0@user/testing") | ||
client.save({"conanfile.py": GenConanfile().with_require("foo/1.0@user/testing") | ||
.with_setting("build_type")}) | ||
client.run("export . bar/1.0@user/testing") | ||
client.save({"conanfile.py": GenConanfile().with_require("foo/1.0@user/testing") | ||
.with_require("bar/1.0@user/testing") | ||
.with_setting("build_type")}) | ||
client.run("export . foobar/1.0@user/testing") | ||
client.run("install foobar/1.0@user/testing --build") | ||
|
||
return client | ||
|
||
|
||
def test_install_build_single(build_all): | ||
""" When only --build=<ref> is passed, only <ref> must be built | ||
""" | ||
build_all.run("install foobar/1.0@user/testing --build=foo") | ||
|
||
assert "bar/1.0@user/testing:7839863d5a059fc6579f28026763e1021268c55e - Cache" in build_all.out | ||
assert "foo/1.0@user/testing:4024617540c4f240a6a5e8911b0de9ef38a11a72 - Build" in build_all.out | ||
assert "foobar/1.0@user/testing:89636fbae346e3983af2dd63f2c5246505e74be7 - Cache" in build_all.out | ||
|
||
|
||
def test_install_build_double(build_all): | ||
""" When both --build=<ref1> and --build=<ref2> are passed, only both should be built | ||
""" | ||
build_all.run("install foobar/1.0@user/testing --build=foo --build=bar") | ||
|
||
assert "bar/1.0@user/testing:7839863d5a059fc6579f28026763e1021268c55e - Build" in build_all.out | ||
assert "foo/1.0@user/testing:4024617540c4f240a6a5e8911b0de9ef38a11a72 - Build" in build_all.out | ||
assert "foobar/1.0@user/testing:89636fbae346e3983af2dd63f2c5246505e74be7 - Cache" in build_all.out | ||
|
||
|
||
@pytest.mark.parametrize("build_arg", ["--build", "--build=", "--build=*"]) | ||
def test_install_build_asterisk(build_arg, build_all): | ||
""" When only --build is passed, all packages must be built from sources | ||
""" | ||
build_all.run("install foobar/1.0@user/testing {}".format(build_arg)) | ||
|
||
assert "bar/1.0@user/testing:7839863d5a059fc6579f28026763e1021268c55e - Build" in build_all.out | ||
assert "foo/1.0@user/testing:4024617540c4f240a6a5e8911b0de9ef38a11a72 - Build" in build_all.out | ||
assert "foobar/1.0@user/testing:89636fbae346e3983af2dd63f2c5246505e74be7 - Build" in build_all.out | ||
|
||
|
||
@pytest.mark.parametrize("build_arg", ["--build", "--build=", "--build=*"]) | ||
def test_install_build_all_with_single(build_arg, build_all): | ||
""" When --build is passed with another package, all packages must be built from sources. | ||
""" | ||
build_all.run("install foobar/1.0@user/testing --build=foo {}".format(build_arg)) | ||
|
||
assert "bar/1.0@user/testing:7839863d5a059fc6579f28026763e1021268c55e - Build" in build_all.out | ||
assert "foo/1.0@user/testing:4024617540c4f240a6a5e8911b0de9ef38a11a72 - Build" in build_all.out | ||
assert "foobar/1.0@user/testing:89636fbae346e3983af2dd63f2c5246505e74be7 - Build" in build_all.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If
--build
,--build=
or--build=*
is passed, build ALL from sources.