[builds] Add support for using cached downloads of the mono archives from ~/Library/Caches. (#5961)

* [builds] Add support for using cached downloads of the mono archives from ~/Library/Caches.

* [apidiff] Add support for using cached downloads of apidiff bundle from ~/Library/Caches.
This commit is contained in:
Rolf Bjarne Kvinge 2019-04-30 15:56:38 +02:00 коммит произвёл GitHub
Родитель b72a0d9bc1
Коммит 8d004e617e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -8,10 +8,19 @@ download: downloads/$(basename $(MONO_IOS_FILENAME)) downloads/$(basename $(MONO
downloads/$(basename $(MONO_IOS_FILENAME)): MONO_URL=$(MONO_IOS_URL)
downloads/$(basename $(MONO_MAC_FILENAME)): MONO_URL=$(MONO_MAC_URL)
# This target downloads the mono archives, there's one for Xamarin.iOS and one for Xamarin.Mac.
# If doing many clean builds, it's possible to copy the downloaded zip file to ~/Library/Caches/xamarin-macios
# to avoid having to download it every time. The zip files have to be copied manually, otherwise
# we'd end up filling up a lot of hard drives around the world.
downloads/$(MONO_IOS_FILENAME) downloads/$(MONO_MAC_FILENAME):
$(Q) mkdir -p downloads
$(Q) echo "Downloading $(MONO_URL)..."
$(Q) curl -f -L $(if $(V),-v,-s) $(MONO_URL) --output $@.tmp
$(Q) if test -f ~/Library/Caches/xamarin-macios/$(notdir $@); then \
echo "Found a cached version of $(MONO_URL) in ~/Library/Caches/xamarin-macios/$(notdir $@)."; \
$(CP) ~/Library/Caches/xamarin-macios/$(notdir $@) $@.tmp; \
else \
curl -f -L $(if $(V),-v,-s) $(MONO_URL) --output $@.tmp; \
fi
$(Q) mv $@.tmp $@
$(Q) echo "Downloaded $(MONO_URL)"

Просмотреть файл

@ -170,7 +170,12 @@ all-local:: $(BUNDLE_ZIP) $(APIDIFF_DIR)/api-diff.html
BUNDLE_ZIP=$(APIDIFF_DIR)/bundle-$(word 6,$(subst /, ,$(APIDIFF_REFERENCES))).zip
$(BUNDLE_ZIP):
# download to a temporary filename so interrupted downloads won't prevent re-downloads.
$(Q_GEN) curl -L $(APIDIFF_REFERENCES) > $@.tmp
$(Q) if test -f ~/Library/Caches/xamarin-macios/$(notdir $@); then \
echo "Found a cached version of $(APIDIFF_REFERENCES)) in ~/Library/Caches/xamarin-macios/$(notdir $@)."; \
$(CP) ~/Library/Caches/xamarin-macios/$(notdir $@) $@.tmp; \
else \
curl -L $(APIDIFF_REFERENCES) > $@.tmp; \
fi
$(Q) mv $@.tmp $@
UNZIP_STAMP=$(APIDIFF_DIR)/.unzip.stamp