Skip to content
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

Add --only-deps option for caching #870

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions alibuild_helpers/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def doParseArgs():
"in multiple packages. The comment will only be stored if "
"PACKAGE is compiled or downloaded during this run; if it "
"already exists, this does not happen."))
build_parser.add_argument("--only-deps", dest="onlyDeps", default=False, action="store_true",
help="Only build dependencies, not the main package (e.g. for caching)")

build_docker = build_parser.add_argument_group(title="Build inside a container", description="""\
Builds can be done inside a Docker container, to make it easier to get a
Expand Down
6 changes: 6 additions & 0 deletions alibuild_helpers/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,12 @@ def doBuild(args, parser):
deps=",".join(buildOrder[:-1]),
), args.architecture)

# If we are building only the dependencies, the last package in
# the build order can be considered done.
if args.onlyDeps and len(buildOrder) > 1:
mainPackage = buildOrder.pop()
warning("Not rebuilding %s because --only-deps option provided.", mainPackage)

while buildOrder:
p = buildOrder[0]
spec = specs[p]
Expand Down
1 change: 1 addition & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def test_coverDoBuild(self, mock_debug, mock_listdir, mock_warning, mock_sys, mo
environment={},
autoCleanup=False,
noDevel=[],
onlyDeps=False,
fetchRepos=False,
forceTracked=False,
plugin="legacy"
Expand Down
Loading