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

Build: Speed up third party libraries cloning #28567

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

difhel
Copy link

@difhel difhel commented Oct 23, 2024

When I tried to build Telegram Desktop from source code, I realized it was running pretty darn slow.

When I decided to look into it, I suddenly found out that the preparation script clones the entire git repository index of each third party library used, not just the last commit we need to build. So I looked at which stages tdesktop uses just a branch (without explicitly checkingout to a specific commit) and added the --depth 1 parameter. This greatly reduces build preparation time, as well as disk space and traffic used, since some of the libraries used are very large.

@CLAassistant
Copy link

CLAassistant commented Oct 23, 2024

CLA assistant check
All committers have signed the CLA.

@john-preston
Copy link
Member

If this is to be added it should be non-default and somehow configurable, because I really enjoy full repository histories in the dependencies.

docs/building-linux.md Outdated Show resolved Hide resolved
docs/building-win.md Outdated Show resolved Hide resolved
@ilya-fedin
Copy link
Contributor

ilya-fedin commented Oct 26, 2024

Maybe squash 1st, 2nd and 4th commits into one?

@difhel difhel force-pushed the build/speed-up-libraries-cloning branch from a37edfe to 914dc0e Compare October 26, 2024 18:37
docs/building-win.md Outdated Show resolved Hide resolved
Co-authored-by: ilya-fedin <[email protected]>
@difhel difhel force-pushed the build/speed-up-libraries-cloning branch from eddca0c to 2154526 Compare October 26, 2024 19:17
if no_deps_git_history:
print("Notice: Some dependency repositories will be downloaded without full history (via git clone --depth 1) to reduce time and disk space.")

def git(command, args):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does what I asked, but not the way other things are done here. It looks to me that more consistent with how the script already works would be another approach:

  • if 'no-deps-git-history' is passed as an option you add something like 'DEPTH' -> '--depth 1' to the 'environment' map, otherwise set it to an empty string
  • in all places necessary just add $DEPTH in the git command so that the '--depth 1' is added if necessary..

If this way it works as expected, then I'd like that approach to be implemented. If somehow I missed something and this doesn't work then we'll proceed with the one you proposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants