From 5b15159fc0996a36fee125bf023535340ae93a09 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 11 Jun 2021 15:22:31 +0200 Subject: [PATCH] [dotnet] Try to implement a workaround for xamarin/maccore#2427. (#11897) We randomly run into a NuGet restore failure, which breaks the build, and is quite annoying. This might be due to a problem with multiple simultaneous restores, so this is an attempt to first restore the packages we need, in a single serialized restore, and once that's done we can process everything else in parallel. Ref: https://github.com/xamarin/maccore/issues/2427 Ref: https://github.com/NuGet/Home/issues/10935 --- dotnet/Makefile | 11 +++++++++-- .../workaround-for-maccore-issue-2427/restore.csproj | 7 +++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 dotnet/package/workaround-for-maccore-issue-2427/restore.csproj diff --git a/dotnet/Makefile b/dotnet/Makefile index 16fe67d47469..dfc9f95a4b2f 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -122,6 +122,9 @@ Workloads/Microsoft.NET.Sdk.$(1)/LICENSE: $(TOP)/LICENSE WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/LICENSE + +LOCAL_WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json +LOCAL_WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/LICENSE endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call WorkloadTargets,$(platform),$(shell echo $(platform) | tr A-Z a-z),$($(platform)_NUGET_VERSION_NO_METADATA)))) @@ -140,7 +143,7 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call NupkgDefinition,$(platform) # Create the nuget in a temporary directory (nupkgs/) define CreateNuGetTemplate -nupkgs/$(1)$(4).$(2)+$(NUGET_BUILD_METADATA).nupkg: $(TEMPLATED_FILES) $(WORKLOAD_TARGETS) $(3) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) global.json +nupkgs/$(1)$(4).$(2)+$(NUGET_BUILD_METADATA).nupkg: $(TEMPLATED_FILES) $(WORKLOAD_TARGETS) $(3) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) global.json .stamp-workaround-for-maccore-issue-2427 @# Delete any versions of the nuget we're building $$(Q) rm -f nupkgs/$(1).*.nupkg $$(Q_PACK) $(DOTNET6) pack package/$(1)/package.csproj -p:VersionBand=$(DOTNET6_VERSION_BAND) --output "$$(dir $$@)" $(DOTNET_PACK_VERBOSITY) "/bl:$$@.binlog" @@ -153,7 +156,7 @@ nupkgs/$(1)$(4).$(2)+$(NUGET_BUILD_METADATA).nupkg: $(TEMPLATED_FILES) $(WORKLOA endef define CreateWindowsNuGetTemplate -nupkgs/$(1).$(2)+$(NUGET_BUILD_METADATA).nupkg: $(3) $(WORKLOAD_TARGETS) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) global.json +nupkgs/$(1).$(2)+$(NUGET_BUILD_METADATA).nupkg: $(3) $(WORKLOAD_TARGETS) package/$(1)/package.csproj $(wildcard package/*.csproj) $(wildcard $(DOTNET_DESTDIR)/$(1)/* $(DOTNET_DESTDIR)/$(1)/*/* $(DOTNET_DESTDIR)/$(1)/*/*/* $(DOTNET_DESTDIR)/$(1)/*/*/*/*) global.json .stamp-workaround-for-maccore-issue-2427 @# Delete any versions of the nuget we're building $$(Q) rm -f nupkgs/$(1).*.nupkg $$(Q_PACK) $(DOTNET6) pack package/$(1)/package.csproj --output "$$(dir $$@)" $(DOTNET_PACK_VERBOSITY) "/bl:$$@.binlog" @@ -387,3 +390,7 @@ Workloads/NuGet.config: $(TOP)/tests/dotnet/NuGet.config clean-local:: $(Q) rm -Rf $(DOTNET_NUPKG_DIR) $(DOTNET_FEED_DIR) $(Q) git clean -xfdq + +.stamp-workaround-for-maccore-issue-2427: global.json $(TOP)/eng/Versions.props $(LOCAL_WORKLOAD_TARGETS) + $(Q) $(DOTNET6) restore package/workaround-for-maccore-issue-2427/restore.csproj /bl:package/workaround-for-maccore-issue-2427/restore.binlog $(MSBUILD_VERBOSITY) + $(Q) touch $@ diff --git a/dotnet/package/workaround-for-maccore-issue-2427/restore.csproj b/dotnet/package/workaround-for-maccore-issue-2427/restore.csproj new file mode 100644 index 000000000000..85a5e1375719 --- /dev/null +++ b/dotnet/package/workaround-for-maccore-issue-2427/restore.csproj @@ -0,0 +1,7 @@ + + + netstandard2.0 + + + +