Skip to content

Commit 8d0c1c9

Browse files
[dotnet] use **FromWorkload** for targeting/runtime pack versions (#12449)
Context: dotnet/sdk#19596 Context: dotnet/android#6184 If we use the version number string of `**FromWorkload**`, then our runtime packages don't need to be resolved from a NuGet feed. They can be resolved from the `dotnet/packs` directory. This completely eliminates the need for a `NuGet.config` file when building a .NET 6 app with a local build of xamarin-macios. You will no longer need a feed such as: <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" /> To further clean things up, I removed the need for: * Any NuGet feed named `local-dotnet-feed` * `$(DOTNET_FEED_DIR)` * Generation of `dotnet/Workloads/NuGet.config`
1 parent 335d757 commit 8d0c1c9

File tree

5 files changed

+8
-21
lines changed

5 files changed

+8
-21
lines changed

Make.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ DOTNET=/usr/local/share/dotnet/dotnet
519519
DOTNET_DESTDIR ?= $(TOP)/_build
520520
DOTNET_NUPKG_DIR ?= $(DOTNET_DESTDIR)/nupkgs
521521
DOTNET_PKG_DIR ?= $(DOTNET_DESTDIR)/pkgs
522-
DOTNET_FEED_DIR ?= $(DOTNET_DESTDIR)/nuget-feed
523522

524523
# Configuration for .NET 6.
525524
# We're using preview versions, and there will probably be many of them, so install locally (into builds/downloads) if there's no system version to

dotnet/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
NuGet.config
21
global.json
32
tmpdir
43
Workloads/Microsoft.NET.Sdk.*/LICENSE

dotnet/Makefile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ $(foreach platform,$(DOTNET_WINDOWS_PLATFORMS),$(eval $(call DefineWindowsTarget
4545
DIRECTORIES += \
4646
$(DOTNET_NUPKG_DIR) \
4747
$(DOTNET_PKG_DIR) \
48-
$(DOTNET_FEED_DIR) \
4948
$(foreach platform,$(DOTNET_PLATFORMS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/data) \
5049
$(foreach platform,$(DOTNET_PLATFORMS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/Sdk) \
5150
$(foreach platform,$(DOTNET_PLATFORMS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/targets) \
@@ -165,21 +164,13 @@ nupkgs/$(1)$(4).$(2).nupkg: $(TEMPLATED_FILES) $(WORKLOAD_TARGETS) $(3) package/
165164
@# Delete any versions of the nuget we're building
166165
$$(Q) rm -f nupkgs/$(1).*.nupkg
167166
$$(Q_PACK) $(DOTNET6) pack package/$(1)/package.csproj -p:VersionBand=$(DOTNET6_VERSION_BAND) --output "$$(dir $$@)" $(DOTNET_PACK_VERBOSITY) "/bl:$$@.binlog"
168-
@# Clean the local feed
169-
$$(Q_NUGET_DEL) if test -d $(DOTNET_FEED_DIR)/$(shell echo $(1) | tr A-Z a-z)/$(2); then nuget delete $(1) $(2) -source $(abspath $(DOTNET_FEED_DIR)) -NonInteractive $(NUGET_VERBOSITY); fi
170-
@# Add the nupkg to our local feed
171-
$$(Q_NUGET_ADD) nuget add "$$@" -source $(DOTNET_FEED_DIR) -NonInteractive $(NUGET_VERBOSITY)
172167
endef
173168

174169
define CreateWindowsNuGetTemplate
175170
nupkgs/$(1).$(2).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
176171
@# Delete any versions of the nuget we're building
177172
$$(Q) rm -f nupkgs/$(1).*.nupkg
178173
$$(Q_PACK) $(DOTNET6) pack package/$(1)/package.csproj --output "$$(dir $$@)" $(DOTNET_PACK_VERBOSITY) "/bl:$$@.binlog"
179-
@# Clean the local feed
180-
$$(Q_NUGET_DEL) if test -d $(DOTNET_FEED_DIR)/$(shell echo $(1) | tr A-Z a-z)/$(2); then nuget delete $(1) $(2) -source $(abspath $(DOTNET_FEED_DIR)) -NonInteractive $(NUGET_VERBOSITY); fi
181-
@# Add the nupkg to our local feed
182-
$$(Q_NUGET_ADD) nuget add "$$@" -source $(DOTNET_FEED_DIR) -NonInteractive $(NUGET_VERBOSITY)
183174
endef
184175

185176
# Create the NuGet packaging targets. It's amazing what make allows you to do...
@@ -359,10 +350,12 @@ $(foreach platform,$(DOTNET_WINDOWS_PLATFORMS),$(eval $(call CreateMsi,$(platfor
359350

360351
export DOTNETSDK_WORKLOAD_MANIFEST_ROOTS:=$(abspath ./Workloads)
361352

362-
.stamp-install-workloads: Makefile Workloads/NuGet.config $(WORKLOAD_TARGETS) $(RUNTIME_PACKS) $(REF_PACKS) $(SDK_PACKS) $(TEMPLATE_PACKS) $(WORKLOAD_PACKS)
353+
.stamp-install-workloads: Makefile $(WORKLOAD_TARGETS) $(RUNTIME_PACKS) $(REF_PACKS) $(SDK_PACKS) $(TEMPLATE_PACKS) $(WORKLOAD_PACKS)
363354
@# The microsoft.net.sdk.maui workload has a reference to the microsoft-ios-sdk-full workload, which has been renamed, so 'dotnet workload install' fails. Just remove the maui workload, we don't need it here.
364355
$(Q) rm -Rf $(DOTNET6_DIR)/sdk-manifests/6.0.100/microsoft.net.sdk.maui
365-
$(Q) cd Workloads && $(DOTNET6) workload install --skip-manifest-update \
356+
$(Q) $(DOTNET6) workload install --skip-manifest-update \
357+
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json \
358+
--source $(DOTNET_NUPKG_DIR) --verbosity diag \
366359
$(foreach platform,$(DOTNET_PLATFORMS),$(shell echo $(platform) | tr A-Z a-z))
367360
$(Q) touch $@
368361

@@ -397,11 +390,8 @@ global.json: $(TOP)/global6.json
397390
$(TOP)/tests/dotnet/NuGet.config:
398391
$(Q) $(MAKE) -C $(TOP)/tests/dotnet NuGet.config
399392

400-
Workloads/NuGet.config: $(TOP)/tests/dotnet/NuGet.config
401-
$(Q) $(CP) $< $@
402-
403393
clean-local::
404-
$(Q) rm -Rf $(DOTNET_NUPKG_DIR) $(DOTNET_FEED_DIR)
394+
$(Q) rm -Rf $(DOTNET_NUPKG_DIR)
405395
$(Q) git clean -xfdq
406396

407397
.stamp-workaround-for-maccore-issue-2427: global.json $(TOP)/eng/Versions.props $(LOCAL_WORKLOAD_TARGETS)

dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@
8585
<KnownFrameworkReference Include="Microsoft.$(_PlatformName)"
8686
TargetFramework="net6.0"
8787
RuntimeFrameworkName="Microsoft.$(_PlatformName)"
88-
DefaultRuntimeFrameworkVersion="$(_ShortPackageVersion)"
89-
LatestRuntimeFrameworkVersion="$(_ShortPackageVersion)"
88+
DefaultRuntimeFrameworkVersion="**FromWorkload**"
89+
LatestRuntimeFrameworkVersion="**FromWorkload**"
9090
TargetingPackName="Microsoft.$(_PlatformName).Ref"
91-
TargetingPackVersion="$(_ShortPackageVersion)"
91+
TargetingPackVersion="**FromWorkload**"
9292
RuntimePackNamePatterns="Microsoft.$(_PlatformName).Runtime.**RID**"
9393
RuntimePackRuntimeIdentifiers="$(_RuntimePackRuntimeIdentifiers)"
9494
Profile="$(_PlatformName)"

tests/dotnet/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ include $(TOP)/Make.config
66
# and to put any extracted packages in the 'packages' directory (to not clutter up ~/.nuget/packages)
77
NuGet.config: $(TOP)/NuGet.config Makefile
88
$(Q) $(CP) $< $@.tmp
9-
$(Q) nuget sources add -Name local-dotnet-feed -Source $(abspath $(DOTNET_FEED_DIR)) -ConfigFile $@.tmp
109
ifdef CUSTOM_DOTNET
1110
$(Q) nuget sources add -Name dev-runtime-feed -Source $(abspath $(DOTNET_RUNTIME_PATH)/artifacts/packages/Release/Shipping) -ConfigFile [email protected]
1211
endif

0 commit comments

Comments
 (0)