之前很傻,每次運行這個setup.bat都要等很久很久才能把4g多的東西下載完成,知道有一天突然發現了世外桃源……
從命令行運行setup.bat -help,可以看到參數的說明(沒錯,參數可選,之前一直以為bat都是拿來雙擊的……):
Usage: GitDependencies [options] Options: --all Sync all folders --include=<X> Include binaries in folders called <X> --exclude=<X> Exclude binaries in folders called <X> --prompt Prompt before overwriting modified files --force Always overwrite modified files --root=<PATH> Set the repository directory to be sync --threads=<N> Use N threads when downloading new files --dry-run Print a list of outdated files and exit --max-retries Override maximum number of retries per file --proxy=<user:password@url> Sets the HTTP proxy address and credentials --cache=<PATH> Specifies a custom path for the download cache --cache-size-multiplier=<N> Cache size as multiplier of current download --cache-days=<N> Number of days to keep entries in the cache --no-cache Disable caching of downloaded files Detected settings: Excluded folders: Mac, Android, Linux Proxy server: none Download cache: disabled Default arguments can be set through the UE4_GITDEPS_ARGS environment variable. Installing prerequisites...
我們的優化都是圍繞這些參數來的:
- --exclude=<XXX> (這些選項前的雙橫線也可以用單橫線)
非常有用,減少不必要的文件下載。可以排除掉自己不需要的平台和VS版本,例如: setup.bat -exclude=Linux -exclude=IOS -exclude=HTML5 -exclude=Android -exclude=VS2013
平台可選的參數:Win32, Win64, osx32,osx64, Linux, Android, IOS, HTML5
VS版本可選參數:VS2012,VS2013,VS2015
警告: 不要排除Win32 和 VS2012, 不然后期編譯會遇到問題 - --threads=<N>
可以多線程下載,速度倍增。例如:setup.bat --threads=20 - --cache=<PATH>
可以把下載的內容緩存在指定的目錄,這樣如果有多人需要,就可以只下載一次,然后分享給大家,例如:setup.bat --cache=D:\Temp - --proxy=<user:password@url>
可以使用代理下載