[dotnet] Templateify some build logic. (#10618)

* [dotnet-linker] Templateify the install logic.

* [builds] Templateify the Versions.plist install logic.

* [dotnet] Create a per-platform Versions.props file with only the values applicable to that platform.

Also move the definition of the default TargetPlatformVersion to Make.versions, where we have other versions.

* [dotnet] Templateify some build code.
This commit is contained in:
Rolf Bjarne Kvinge 2021-02-11 20:17:12 +01:00 коммит произвёл GitHub
Родитель bce08d0773
Коммит f127e614c9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 95 добавлений и 110 удалений

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

@ -531,6 +531,9 @@ DOTNET_MACOS_RUNTIME_IDENTIFIERS=osx-x64
# Create variables prefixed with the correctly cased platform name from the upper-cased platform name. This simplifies code in a few areas (whenever we foreach over DOTNET_PLATFORMS).
$(foreach platform,$(DOTNET_PLATFORMS),$(eval DOTNET_$(platform)_RUNTIME_IDENTIFIERS:=$(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS)))
# Create a variable with the platform in uppercase
DOTNET_PLATFORMS_UPPERCASE:=$(shell echo $(DOTNET_PLATFORMS) | tr a-z A-Z)
# If we should inject an x86_64 slice into every binary that doesn't have one.
# This is sometimes necessary to work around an Apple bug wrt notarization where Apple flags all binaries that don't have a x86_64 slice, even if they're correctly signed.
INJECT_X86_64_SLICE=

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

@ -71,3 +71,17 @@ TVOS_NUGET_VERSION=14.3.100
WATCHOS_NUGET_VERSION=7.2.100
MACOS_NUGET_VERSION=11.1.100
MACCATALYST_NUGET_VERSION=14.3.100
# Defines the default platform version if it's not specified in the TFM. The default should not change for a given .NET version:
# * We release support for iOS 14.5 with .NET 6
# * Apple releases iOS 15.0, we're still using .NET 6. This default continues to be iOS 14.5
# * .NET 7 is shipped, and at this point we bump the default to iOS 15.0
# Basically: this should be the last OS version of the platform in question when the current major .NET version is first released to stable.
# Ref: https://github.com/dotnet/designs/blob/8e6394406d44f75f30ea2259a425cb9e38d75b69/accepted/2020/net5/net5.md#os-versions
DEFAULT_TARGET_PLATFORM_VERSION_IOS=13.6
DEFAULT_TARGET_PLATFORM_VERSION_TVOS=13.4
DEFAULT_TARGET_PLATFORM_VERSION_WATCHOS=6.2
DEFAULT_TARGET_PLATFORM_VERSION_MACOS=10.15
DEFAULT_TARGET_PLATFORM_VERSION_MACCATALYST=13.5

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

@ -701,7 +701,6 @@ all-local:: install-mac-common
MAC_COMMON_DIRECTORIES = \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR) \
$(DOTNET_DESTDIR)/$(MACOS_NUGET).Sdk \
MAC_COMMON_TARGETS = \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions/Current \
@ -710,7 +709,6 @@ MAC_COMMON_TARGETS = \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Version \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/updateinfo \
$(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Versions.plist \
$(DOTNET_DESTDIR)/$(MACOS_NUGET).Sdk/Versions.plist \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions/Current: | $(MAC_DESTDIR)$(MAC_FRAMEWORK_DIR)/Versions
$(Q_LN) ln -hfs $(MAC_INSTALL_VERSION) $@
@ -802,9 +800,6 @@ all-local:: install-ios-common
IOS_COMMON_DIRECTORIES = \
$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) \
$(DOTNET_DESTDIR)/$(IOS_NUGET).Sdk \
$(DOTNET_DESTDIR)/$(TVOS_NUGET).Sdk \
$(DOTNET_DESTDIR)/$(WATCHOS_NUGET).Sdk \
IOS_COMMON_TARGETS = \
$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current \
@ -812,9 +807,6 @@ IOS_COMMON_TARGETS = \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Version \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/updateinfo \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Versions.plist \
$(DOTNET_DESTDIR)/$(IOS_NUGET).Sdk/Versions.plist \
$(DOTNET_DESTDIR)/$(TVOS_NUGET).Sdk/Versions.plist \
$(DOTNET_DESTDIR)/$(WATCHOS_NUGET).Sdk/Versions.plist \
$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current: | $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions
$(Q_LN) ln -hfs $(IOS_INSTALL_VERSION) $@
@ -1110,6 +1102,24 @@ $(TVOS_DIRECTORIES):
install-tvos: $(TVOS_TARGETS)
#
# .NET
#
DOTNET_COMMON_DIRECTORIES += \
$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(DOTNET_DESTDIR)/$($(platform)_NUGET).Sdk) \
DOTNET_COMMON_TARGETS = \
$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(DOTNET_DESTDIR)/$($(platform)_NUGET).Sdk/Versions.plist) \
$(DOTNET_COMMON_DIRECTORIES):
$(Q) mkdir -p $@
install-dotnet: $(DOTNET_COMMON_TARGETS)
install-local:: install-dotnet
all-local:: install-dotnet
#
# Cross compilers
#

1
dotnet/.gitignore поставляемый
Просмотреть файл

@ -4,5 +4,6 @@ WorkloadManifest.json
nupkgs
Microsoft.*.Sdk/targets/Microsoft.*.Sdk.SupportedTargetPlatforms.props
Microsoft.*.Sdk/targets/Microsoft.*.Sdk.DefaultItems.props
Microsoft.*.Sdk/targets/Microsoft.*.Sdk.Versions.props
_pkg
.stamp-*

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

@ -38,7 +38,7 @@ Files are imported in the following order:
versions of _platform_ are supported
* targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props: some TargetFramework
logic.
* targets/Xamarin.Shared.Sdk.Versions.props: declares various properties related to
* targets/Microsoft._platform_.Sdk.Versions.props: declares various properties related to
version information.
* targets/Xamarin.Shared.Sdk.props: imports other props files.

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

@ -17,12 +17,13 @@ $(1)_NUGET_TARGETS = \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.SupportedTargetPlatforms.props \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.DefaultItems.props \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.props \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.Versions.props \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.targets \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Xamarin.Shared.Sdk.DefaultItems.targets \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Xamarin.Shared.Sdk.props \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Xamarin.Shared.Sdk.targets \
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/Xamarin.Shared.Sdk.Versions.props
endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call DefineTargets,$(platform))))
@ -46,31 +47,28 @@ CURRENT_HASH_LONG:=$(shell git log -1 --pretty=%H)
$(DOTNET_DESTDIR)/Microsoft.%: Microsoft.% | $(foreach platform,$(DOTNET_PLATFORMS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/Sdk $(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/targets)
$(Q) $(CP) $< $@
$(DOTNET_DESTDIR)/Microsoft.iOS.Sdk/targets/%: targets/% | $(DOTNET_DESTDIR)/Microsoft.iOS.Sdk/targets
$(Q) $(CP) $< $@
define CopyTargets
$$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets/%: targets/% | $$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/targets
$$(Q) $$(CP) $$< $$@
endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call CopyTargets,$(platform))))
$(DOTNET_DESTDIR)/Microsoft.tvOS.Sdk/targets/%: targets/% | $(DOTNET_DESTDIR)/Microsoft.tvOS.Sdk/targets
$(Q) $(CP) $< $@
define VersionsTemplate
targets/Microsoft.$(1).Sdk.Versions.props: targets/Microsoft.Sdk.Versions.template.props Makefile $(TOP)/Make.config.inc $(TOP)/.git/HEAD $(TOP)/.git/index
$$(Q_GEN) sed \
-e "s/@PLATFORM@/$(1)/g" \
-e "s/@NUGET_VERSION_NO_METADATA@/$$($(2)_NUGET_VERSION_NO_METADATA)/g" \
-e "s/@NUGET_VERSION_FULL@/$$($(2)_NUGET_VERSION_FULL)/g" \
-e "s/@DEFAULT_TARGET_PLATFORM_VERSION@/$$(DEFAULT_TARGET_PLATFORM_VERSION_$(2))/g" \
-e "s/@CURRENT_BRANCH@/$$(CURRENT_BRANCH_SED_ESCAPED)/g" \
-e "s/@CURRENT_HASH_LONG@/$$(CURRENT_HASH_LONG)/g" \
$$< > $$@.tmp
$$(Q) mv $$@.tmp $$@
$(DOTNET_DESTDIR)/Microsoft.watchOS.Sdk/targets/%: targets/% | $(DOTNET_DESTDIR)/Microsoft.watchOS.Sdk/targets
$(Q) $(CP) $< $@
$(DOTNET_DESTDIR)/Microsoft.macOS.Sdk/targets/%: targets/% | $(DOTNET_DESTDIR)/Microsoft.macOS.Sdk/targets
$(Q) $(CP) $< $@
targets/%.props: targets/%.template.props Makefile $(TOP)/Make.config.inc $(TOP)/.git/HEAD $(TOP)/.git/index
$(Q_GEN) sed \
-e "s/@IOS_NUGET_VERSION_NO_METADATA@/$(IOS_NUGET_VERSION_NO_METADATA)/g" \
-e "s/@TVOS_NUGET_VERSION_NO_METADATA@/$(TVOS_NUGET_VERSION_NO_METADATA)/g" \
-e "s/@WATCHOS_NUGET_VERSION_NO_METADATA@/$(WATCHOS_NUGET_VERSION_NO_METADATA)/g" \
-e "s/@MACOS_NUGET_VERSION_NO_METADATA@/$(MACOS_NUGET_VERSION_NO_METADATA)/g" \
-e "s/@IOS_NUGET_VERSION_FULL@/$(IOS_NUGET_VERSION_FULL)/g" \
-e "s/@TVOS_NUGET_VERSION_FULL@/$(TVOS_NUGET_VERSION_FULL)/g" \
-e "s/@WATCHOS_NUGET_VERSION_FULL@/$(WATCHOS_NUGET_VERSION_FULL)/g" \
-e "s/@MACOS_NUGET_VERSION_FULL@/$(MACOS_NUGET_VERSION_FULL)/g" \
-e "s/@CURRENT_BRANCH@/$(CURRENT_BRANCH_SED_ESCAPED)/g" \
-e "s/@CURRENT_HASH_LONG@/$(CURRENT_HASH_LONG)/g" \
$< > $@
Microsoft.$1.Sdk/targets/Microsoft.$1.Sdk.Versions.props: targets/Microsoft.$1.Sdk.Versions.props
$$(Q) $$(CP) $$< $$@
endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call VersionsTemplate,$(platform),$(shell echo $(platform) | tr a-z A-Z))))
define DefaultItems
Microsoft.$1.Sdk/targets/Microsoft.$1.Sdk.DefaultItems.props: targets/Microsoft.Sdk.DefaultItems.template.props Makefile
@ -107,18 +105,15 @@ endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call WorkloadTargets,$(platform),$(shell echo $(platform) | tr A-Z a-z),$($(platform)_NUGET_VERSION_NO_METADATA))))
TEMPLATED_FILES = \
targets/Xamarin.Shared.Sdk.Versions.props \
$(foreach platform,$(DOTNET_PLATFORMS),Microsoft.$(platform).Sdk/targets/Microsoft.$(platform).Sdk.Versions.props) \
$(foreach platform,$(DOTNET_PLATFORMS),Microsoft.$(platform).Sdk/targets/Microsoft.$(platform).Sdk.SupportedTargetPlatforms.props) \
nupkgs/$(IOS_NUGET).%.nupkg: CURRENT_VERSION_NO_METADATA=$(IOS_NUGET_VERSION_NO_METADATA)
nupkgs/$(TVOS_NUGET).%.nupkg: CURRENT_VERSION_NO_METADATA=$(TVOS_NUGET_VERSION_NO_METADATA)
nupkgs/$(WATCHOS_NUGET).%.nupkg: CURRENT_VERSION_NO_METADATA=$(WATCHOS_NUGET_VERSION_NO_METADATA)
nupkgs/$(MACOS_NUGET).%.nupkg: CURRENT_VERSION_NO_METADATA=$(MACOS_NUGET_VERSION_NO_METADATA)
nupkgs/$(IOS_NUGET).%.nupkg: CURRENT_VERSION_FULL=$(IOS_NUGET_VERSION_FULL)
nupkgs/$(TVOS_NUGET).%.nupkg: CURRENT_VERSION_FULL=$(TVOS_NUGET_VERSION_FULL)
nupkgs/$(WATCHOS_NUGET).%.nupkg: CURRENT_VERSION_FULL=$(WATCHOS_NUGET_VERSION_FULL)
nupkgs/$(MACOS_NUGET).%.nupkg: CURRENT_VERSION_FULL=$(MACOS_NUGET_VERSION_FULL)
define NupkgDefinition
nupkgs/$($(1)_NUGET).%.nupkg: CURRENT_VERSION_NO_METADATA=$($(1)_NUGET_VERSION_NO_METADATA)
nupkgs/$($(1)_NUGET).%.nupkg: CURRENT_VERSION_FULL=$($(1)_NUGET_VERSION_FULL)
endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call NupkgDefinition,$(platform))))
# Create the nuget in a temporary directory (nupkgs/)
define CreateNuGetTemplate
@ -143,28 +138,16 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(foreach rid,$(DOTNET_$(platform)_RUNTIM
$(DOTNET_NUPKG_DIR)/%.nupkg: nupkgs/%.nupkg | $(DOTNET_NUPKG_DIR)
$(Q) $(CP) $< $@
RUNTIME_PACKS_IOS = $(foreach rid,$(DOTNET_IOS_RUNTIME_IDENTIFIERS),$(DOTNET_NUPKG_DIR)/$(IOS_NUGET).Runtime.$(rid).$(IOS_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS_TVOS = $(foreach rid,$(DOTNET_TVOS_RUNTIME_IDENTIFIERS),$(DOTNET_NUPKG_DIR)/$(TVOS_NUGET).Runtime.$(rid).$(TVOS_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS_WATCHOS = $(foreach rid,$(DOTNET_WATCHOS_RUNTIME_IDENTIFIERS),$(DOTNET_NUPKG_DIR)/$(WATCHOS_NUGET).Runtime.$(rid).$(WATCHOS_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS_MACOS = $(foreach rid,$(DOTNET_MACOS_RUNTIME_IDENTIFIERS),$(DOTNET_NUPKG_DIR)/$(MACOS_NUGET).Runtime.$(rid).$(MACOS_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS = $(RUNTIME_PACKS_IOS) $(RUNTIME_PACKS_TVOS) $(RUNTIME_PACKS_WATCHOS) $(RUNTIME_PACKS_MACOS)
REF_PACK_IOS = $(DOTNET_NUPKG_DIR)/$(IOS_NUGET).Ref.$(IOS_NUGET_VERSION_FULL).nupkg
REF_PACK_TVOS = $(DOTNET_NUPKG_DIR)/$(TVOS_NUGET).Ref.$(TVOS_NUGET_VERSION_FULL).nupkg
REF_PACK_WATCHOS = $(DOTNET_NUPKG_DIR)/$(WATCHOS_NUGET).Ref.$(WATCHOS_NUGET_VERSION_FULL).nupkg
REF_PACK_MACOS = $(DOTNET_NUPKG_DIR)/$(MACOS_NUGET).Ref.$(MACOS_NUGET_VERSION_FULL).nupkg
REF_PACKS = $(REF_PACK_IOS) $(REF_PACK_TVOS) $(REF_PACK_WATCHOS) $(REF_PACK_MACOS)
SDK_PACK_IOS = $(DOTNET_NUPKG_DIR)/$(IOS_NUGET).Sdk.$(IOS_NUGET_VERSION_FULL).nupkg
SDK_PACK_TVOS = $(DOTNET_NUPKG_DIR)/$(TVOS_NUGET).Sdk.$(TVOS_NUGET_VERSION_FULL).nupkg
SDK_PACK_WATCHOS = $(DOTNET_NUPKG_DIR)/$(WATCHOS_NUGET).Sdk.$(WATCHOS_NUGET_VERSION_FULL).nupkg
SDK_PACK_MACOS = $(DOTNET_NUPKG_DIR)/$(MACOS_NUGET).Sdk.$(MACOS_NUGET_VERSION_FULL).nupkg
SDK_PACKS = $(SDK_PACK_IOS) $(SDK_PACK_TVOS) $(SDK_PACK_WATCHOS) $(SDK_PACK_MACOS)
pack-ios: $(RUNTIME_PACKS_IOS) $(REF_PACK_IOS) $(SDK_PACK_IOS)
pack-tvos: $(RUNTIME_PACKS_TVOS) $(REF_PACK_TVOS) $(SDK_PACK_TVOS)
pack-watchos: $(RUNTIME_PACKS_WATCHOS) $(REF_PACK_WATCHOS) $(SDK_PACK_WATCHOS)
pack-macos: $(RUNTIME_PACKS_MACOS) $(REF_PACK_MACOS) $(SDK_PACK_MACOS)
define PacksDefinitions
RUNTIME_PACKS_$(1) = $$(foreach rid,$$(DOTNET_$(1)_RUNTIME_IDENTIFIERS),$(DOTNET_NUPKG_DIR)/$($(1)_NUGET).Runtime.$$(rid).$($(1)_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS += $$(RUNTIME_PACKS_$(1))
REF_PACKS_$(1) = $(DOTNET_NUPKG_DIR)/$($(1)_NUGET).Ref.$($(1)_NUGET_VERSION_FULL).nupkg
REF_PACKS += $$(REF_PACKS_$(1))
SDK_PACKS_$(1) = $(DOTNET_NUPKG_DIR)/$($(1)_NUGET).Sdk.$($(1)_NUGET_VERSION_FULL).nupkg
SDK_PACKS += $$(SDK_PACKS_$(1))
pack-$(shell echo $(1) | tr A-Z a-z): $$(RUNTIME_PACKS_$(1)) $$(REF_PACKS_$(1)) $$(SDK_PACKS_$(1))
endef
$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(eval $(call PacksDefinitions,$(platform))))
TARGETS += $(RUNTIME_PACKS) $(REF_PACKS) $(SDK_PACKS)
@ -281,7 +264,7 @@ msi: $(MSI_TARGETS)
package: $(PACKAGE_TARGETS) $(MSI_TARGETS)
ifdef ENABLE_DOTNET
all-local:: $(TARGETS) targets/Xamarin.Shared.Sdk.Versions.props
all-local:: $(TARGETS)
endif
# This tells NuGet to use the exact same dotnet version we've configured in Make.config

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

@ -1,5 +1,5 @@
<Project>
<Import Project="../targets/Xamarin.Shared.Sdk.Versions.props" />
<Import Project="../targets/Microsoft.$(_PlatformName).Sdk.Versions.props" />
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>

2
dotnet/targets/.gitignore поставляемый
Просмотреть файл

@ -1,2 +1,2 @@
Xamarin.Shared.Sdk.Versions.props
Microsoft.*.Sdk.Versions.props

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

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CurrentBranch>@CURRENT_BRANCH@</CurrentBranch>
<CurrentHash>@CURRENT_HASH_LONG@</CurrentHash>
<_ShortPackageVersion>@NUGET_VERSION_NO_METADATA@</_ShortPackageVersion>
<_PackageVersion>@NUGET_VERSION_FULL@</_PackageVersion>
<_DefaultTargetPlatformVersion>@DEFAULT_TARGET_PLATFORM_VERSION@</_DefaultTargetPlatformVersion>
</PropertyGroup>
</Project>

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

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CurrentBranch>@CURRENT_BRANCH@</CurrentBranch>
<CurrentHash>@CURRENT_HASH_LONG@</CurrentHash>
<_ShortPackageVersion Condition=" '$(_PlatformName)' == 'iOS' ">@IOS_NUGET_VERSION_NO_METADATA@</_ShortPackageVersion>
<_ShortPackageVersion Condition=" '$(_PlatformName)' == 'tvOS' ">@TVOS_NUGET_VERSION_NO_METADATA@</_ShortPackageVersion>
<_ShortPackageVersion Condition=" '$(_PlatformName)' == 'watchOS' ">@WATCHOS_NUGET_VERSION_NO_METADATA@</_ShortPackageVersion>
<_ShortPackageVersion Condition=" '$(_PlatformName)' == 'macOS' ">@MACOS_NUGET_VERSION_NO_METADATA@</_ShortPackageVersion>
<_PackageVersion Condition=" '$(_PlatformName)' == 'iOS' ">@IOS_NUGET_VERSION_FULL@</_PackageVersion>
<_PackageVersion Condition=" '$(_PlatformName)' == 'tvOS' ">@TVOS_NUGET_VERSION_FULL@</_PackageVersion>
<_PackageVersion Condition=" '$(_PlatformName)' == 'watchOS' ">@WATCHOS_NUGET_VERSION_FULL@</_PackageVersion>
<_PackageVersion Condition=" '$(_PlatformName)' == 'macOS' ">@MACOS_NUGET_VERSION_FULL@</_PackageVersion>
</PropertyGroup>
<!-- Defines the default platform version if it's not specified in the TFM. The default should not change for a given .NET version:
* We release support for iOS 14.5 with .NET 6
* Apple releases iOS 15.0, we're still using .NET 6. This default continues to be iOS 14.5
* .NET 7 is shipped, and at this point we bump the default to iOS 15.0
Ref: https://github.com/dotnet/designs/blob/8e6394406d44f75f30ea2259a425cb9e38d75b69/accepted/2020/net5/net5.md#os-versions
-->
<PropertyGroup>
<!-- This section specifies the default platform version for .NET 5.0 -->
<_DefaultTargetPlatformVersion Condition=" '$(_PlatformName)' == 'iOS' ">13.6</_DefaultTargetPlatformVersion>
<_DefaultTargetPlatformVersion Condition=" '$(_PlatformName)' == 'tvOS' ">13.4</_DefaultTargetPlatformVersion>
<_DefaultTargetPlatformVersion Condition=" '$(_PlatformName)' == 'watchOS' ">6.2</_DefaultTargetPlatformVersion>
<_DefaultTargetPlatformVersion Condition=" '$(_PlatformName)' == 'macOS' ">10.15</_DefaultTargetPlatformVersion>
</PropertyGroup>
</Project>

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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Version information -->
<Import Project="Xamarin.Shared.Sdk.Versions.props" />
<Import Project="Microsoft.$(_PlatformName).Sdk.Versions.props" />
<!-- This contains the OS versions we support for target platform -->
<Import Project="Microsoft.$(_PlatformName).Sdk.SupportedTargetPlatforms.props" />

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

@ -22,17 +22,11 @@ dotnet-linker.csproj.inc: global.json
$(BUILD_DIR)/dotnet-linker%dll $(BUILD_DIR)/dotnet-linker%pdb: Makefile global.json $(dotnet_linker_dependencies)
$(Q_DOTNET_BUILD) $(DOTNET6) build dotnet-linker.csproj $(DOTNET_BUILD_VERBOSITY)
$(DOTNET_DESTDIR)/Microsoft.iOS.Sdk/tools/dotnet-linker/%: $(BUILD_DIR)/% | $(DOTNET_DESTDIR)/Microsoft.iOS.Sdk/tools/dotnet-linker
$(Q) $(CP) $< $@
$(DOTNET_DESTDIR)/Microsoft.tvOS.Sdk/tools/dotnet-linker/%: $(BUILD_DIR)/% | $(DOTNET_DESTDIR)/Microsoft.tvOS.Sdk/tools/dotnet-linker
$(Q) $(CP) $< $@
$(DOTNET_DESTDIR)/Microsoft.watchOS.Sdk/tools/dotnet-linker/%: $(BUILD_DIR)/% | $(DOTNET_DESTDIR)/Microsoft.watchOS.Sdk/tools/dotnet-linker
$(Q) $(CP) $< $@
$(DOTNET_DESTDIR)/Microsoft.macOS.Sdk/tools/dotnet-linker/%: $(BUILD_DIR)/% | $(DOTNET_DESTDIR)/Microsoft.macOS.Sdk/tools/dotnet-linker
$(Q) $(CP) $< $@
define InstallTemplate
$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/tools/dotnet-linker/%: $(BUILD_DIR)/% | $(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/tools/dotnet-linker
$$(Q) $$(CP) $$< $$@
endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call InstallTemplate,$(platform))))
$(DOTNET_DIRECTORIES):
$(Q) mkdir -p $@