Skip to content

Commit

Permalink
[dotnet] use **FromWorkload** for targeting/runtime pack versions (#1…
Browse files Browse the repository at this point in the history
…2449)

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`
  • Loading branch information
jonathanpeppers authored Aug 19, 2021
1 parent 335d757 commit 8d0c1c9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 21 deletions.
1 change: 0 additions & 1 deletion Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ DOTNET=/usr/local/share/dotnet/dotnet
DOTNET_DESTDIR ?= $(TOP)/_build
DOTNET_NUPKG_DIR ?= $(DOTNET_DESTDIR)/nupkgs
DOTNET_PKG_DIR ?= $(DOTNET_DESTDIR)/pkgs
DOTNET_FEED_DIR ?= $(DOTNET_DESTDIR)/nuget-feed

# Configuration for .NET 6.
# 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
Expand Down
1 change: 0 additions & 1 deletion dotnet/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
NuGet.config
global.json
tmpdir
Workloads/Microsoft.NET.Sdk.*/LICENSE
Expand Down
20 changes: 5 additions & 15 deletions dotnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ $(foreach platform,$(DOTNET_WINDOWS_PLATFORMS),$(eval $(call DefineWindowsTarget
DIRECTORIES += \
$(DOTNET_NUPKG_DIR) \
$(DOTNET_PKG_DIR) \
$(DOTNET_FEED_DIR) \
$(foreach platform,$(DOTNET_PLATFORMS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/data) \
$(foreach platform,$(DOTNET_PLATFORMS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/Sdk) \
$(foreach platform,$(DOTNET_PLATFORMS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/targets) \
Expand Down Expand Up @@ -165,21 +164,13 @@ nupkgs/$(1)$(4).$(2).nupkg: $(TEMPLATED_FILES) $(WORKLOAD_TARGETS) $(3) package/
@# 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"
@# Clean the local feed
$$(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
@# Add the nupkg to our local feed
$$(Q_NUGET_ADD) nuget add "$$@" -source $(DOTNET_FEED_DIR) -NonInteractive $(NUGET_VERBOSITY)
endef

define CreateWindowsNuGetTemplate
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
@# 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"
@# Clean the local feed
$$(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
@# Add the nupkg to our local feed
$$(Q_NUGET_ADD) nuget add "$$@" -source $(DOTNET_FEED_DIR) -NonInteractive $(NUGET_VERBOSITY)
endef

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

export DOTNETSDK_WORKLOAD_MANIFEST_ROOTS:=$(abspath ./Workloads)

.stamp-install-workloads: Makefile Workloads/NuGet.config $(WORKLOAD_TARGETS) $(RUNTIME_PACKS) $(REF_PACKS) $(SDK_PACKS) $(TEMPLATE_PACKS) $(WORKLOAD_PACKS)
.stamp-install-workloads: Makefile $(WORKLOAD_TARGETS) $(RUNTIME_PACKS) $(REF_PACKS) $(SDK_PACKS) $(TEMPLATE_PACKS) $(WORKLOAD_PACKS)
@# 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.
$(Q) rm -Rf $(DOTNET6_DIR)/sdk-manifests/6.0.100/microsoft.net.sdk.maui
$(Q) cd Workloads && $(DOTNET6) workload install --skip-manifest-update \
$(Q) $(DOTNET6) workload install --skip-manifest-update \
--source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json \
--source $(DOTNET_NUPKG_DIR) --verbosity diag \
$(foreach platform,$(DOTNET_PLATFORMS),$(shell echo $(platform) | tr A-Z a-z))
$(Q) touch $@

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

Workloads/NuGet.config: $(TOP)/tests/dotnet/NuGet.config
$(Q) $(CP) $< $@

clean-local::
$(Q) rm -Rf $(DOTNET_NUPKG_DIR) $(DOTNET_FEED_DIR)
$(Q) rm -Rf $(DOTNET_NUPKG_DIR)
$(Q) git clean -xfdq

.stamp-workaround-for-maccore-issue-2427: global.json $(TOP)/eng/Versions.props $(LOCAL_WORKLOAD_TARGETS)
Expand Down
6 changes: 3 additions & 3 deletions dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
<KnownFrameworkReference Include="Microsoft.$(_PlatformName)"
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.$(_PlatformName)"
DefaultRuntimeFrameworkVersion="$(_ShortPackageVersion)"
LatestRuntimeFrameworkVersion="$(_ShortPackageVersion)"
DefaultRuntimeFrameworkVersion="**FromWorkload**"
LatestRuntimeFrameworkVersion="**FromWorkload**"
TargetingPackName="Microsoft.$(_PlatformName).Ref"
TargetingPackVersion="$(_ShortPackageVersion)"
TargetingPackVersion="**FromWorkload**"
RuntimePackNamePatterns="Microsoft.$(_PlatformName).Runtime.**RID**"
RuntimePackRuntimeIdentifiers="$(_RuntimePackRuntimeIdentifiers)"
Profile="$(_PlatformName)"
Expand Down
1 change: 0 additions & 1 deletion tests/dotnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include $(TOP)/Make.config
# and to put any extracted packages in the 'packages' directory (to not clutter up ~/.nuget/packages)
NuGet.config: $(TOP)/NuGet.config Makefile
$(Q) $(CP) $< $@.tmp
$(Q) nuget sources add -Name local-dotnet-feed -Source $(abspath $(DOTNET_FEED_DIR)) -ConfigFile $@.tmp
ifdef CUSTOM_DOTNET
$(Q) nuget sources add -Name dev-runtime-feed -Source $(abspath $(DOTNET_RUNTIME_PATH)/artifacts/packages/Release/Shipping) -ConfigFile $@.tmp
endif
Expand Down

5 comments on commit 8d0c1c9

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (only version changes)

Packages generated

View packages

Test results

3 tests failed, 247 tests passed.

Failed tests

  • monotouch-test/Mac [dotnet]/Debug (CoreCLR) [dotnet]: Failed (Test run failed.
    Tests run: 2469 Passed: 2402 Inconclusive: 13 Failed: 1 Ignored: 66)
  • monotouch-test/watchOS 32-bits - simulator/Debug (LinkSdk): Failed
  • Documentation/All: Failed

Pipeline on Agent XAMBOT-1027.BigSur'
[dotnet] use FromWorkload for targeting/runtime pack versions (#12449)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[dotnet] use FromWorkload for targeting/runtime pack versions (#12449)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[dotnet] use FromWorkload for targeting/runtime pack versions (#12449)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌

Tests failed on M1 - Mac Big Sur (11.5).

Failed tests are:

  • xammac_tests

Pipeline on Agent
[dotnet] use FromWorkload for targeting/runtime pack versions (#12449)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
[dotnet] use FromWorkload for targeting/runtime pack versions (#12449)

Please sign in to comment.