Create and publish .NET NuGet packages. (#8576)

Create the various NuGet packages to support .NET 5+. The packages are
currently empty (and not very useful), but the actual content will come later.

The current set of NuGet packages are (this list is duplicated for each
platform: iOS, tvOS, watchOS and macOS):

* Microsoft.iOS.Sdk: currently contains the basic MSBuild targets files for an
  MSBuild Project SDK. Will eventually contain all the build logic. Might also
  eventually contain other tools (mlaunch, bgen, etc.), but these might also
  end up in a different package.
* Microsoft.iOS.Ref: will contain the Xamarin.iOS.dll reference assembly.
* Microsoft.iOS.Runtime.[RID]: will contain architecture-specific files
  (libxamarin*.dylib, the Xamarin.iOS.dll implementation assembly, etc.):

The NuGets built on CI are automatically published to a NuGet feed.

The versioning for the NuGet packages required a few changes: OS bumps are now
changed in Make.versions instead of Make.config (this is explained in the
files themselves as well).
This commit is contained in:
Rolf Bjarne Kvinge 2020-05-13 15:23:29 +02:00 коммит произвёл GitHub
Родитель bf201c105e
Коммит 5834572741
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
67 изменённых файлов: 854 добавлений и 18 удалений

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

@ -7,6 +7,10 @@ $(TOP)/Make.config.inc: $(TOP)/Make.config $(TOP)/mk/mono.mk
@rm -f $@
@printf "IOS_COMMIT_DISTANCE:=$(shell LANG=C; export LANG && git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep IOS_PACKAGE_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@
@printf "MAC_COMMIT_DISTANCE:=$(shell LANG=C; export LANG && git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep MAC_PACKAGE_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@
@printf "IOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep IOS_NUGET_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@
@printf "TVOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep TVOS_NUGET_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@
@printf "WATCHOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep WATCHOS_NUGET_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@
@printf "MACOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep MACOS_NUGET_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@
@if which ccache > /dev/null 2>&1; then printf "ENABLE_CCACHE=1\nexport CCACHE_BASEDIR=$(abspath $(TOP)/..)\n" >> $@; echo "Found ccache on the system, enabling it"; fi
@if test -d $(TOP)/../maccore; then printf "ENABLE_XAMARIN=1\n" >> $@; echo "Detected the maccore repository, automatically enabled the Xamarin build"; fi
@# Build from source if we're on CI and packages aren't available.
@ -48,6 +52,33 @@ CURRENT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD)
else
CURRENT_BRANCH:=$(BRANCH_NAME)
endif
CURRENT_BRANCH_SED_ESCAPED:=$(subst |,\|,$(subst &,\&,$(subst $$,\$$,$(subst /,\/,$(CURRENT_BRANCH)))))
# The branch name in the nuget version has to be alphanumeric, and we follow the semantic versioning spec,
# which defines "alphanumeric" as the letters, numbers and the dash character (and nothing else).
# So here we replace all non-alphanumeric characters in the branch name with a dash.
CURRENT_BRANCH_ALPHANUMERIC:=$(shell export LANG=C; printf "%s" "$(CURRENT_BRANCH)" | tr -c '[a-zA-Z0-9-]' '-')
# Get the current hash
CURRENT_HASH:=$(shell git log -1 --pretty=%h)
# Get the pull request number, if this is a pull request
# Jenkins may set either CHANGE_ID or ghprbPullId
# Azure Devops sets SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
ifneq ($(CHANGE_ID),)
PULL_REQUEST_ID=$(CHANGE_ID)
else ifneq ($(ghprbPullId),)
PULL_REQUEST_ID=$(ghprbPullId)
else ifneq ($(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER),)
PULL_REQUEST_ID=$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)
endif
# The prerelease identifier is missing the per-product commit distance, which is added below
ifneq ($(PULL_REQUEST_ID),)
NUGET_PRERELEASE_IDENTIFIER=ci.pr.gh$(PULL_REQUEST_ID).
else
NUGET_PRERELEASE_IDENTIFIER=ci.$(CURRENT_BRANCH_ALPHANUMERIC).
endif
NUGET_BUILD_METADATA=sha.$(CURRENT_HASH)
IOS_PRODUCT=Xamarin.iOS
IOS_PACKAGE_NAME=Xamarin.iOS
@ -58,6 +89,27 @@ IOS_PACKAGE_VERSION_REV:=$(word 3, $(subst ., ,$(IOS_PACKAGE_VERSION)))
IOS_PACKAGE_VERSION_BUILD=$(IOS_COMMIT_DISTANCE)
IOS_PACKAGE_UPDATE_ID=$(shell printf "2%02d%02d%02d%03d" $(IOS_PACKAGE_VERSION_MAJOR) $(IOS_PACKAGE_VERSION_MINOR) $(IOS_PACKAGE_VERSION_REV) $(IOS_PACKAGE_VERSION_BUILD))
IOS_NUGET=Microsoft.iOS
IOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(IOS_NUGET_VERSION)))
IOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(IOS_NUGET_VERSION)))
IOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(IOS_NUGET_VERSION)))
IOS_NUGET_VERSION_NO_METADATA=$(IOS_NUGET_VERSION)-$(NUGET_PRERELEASE_IDENTIFIER)$(IOS_NUGET_COMMIT_DISTANCE)
IOS_NUGET_VERSION_FULL=$(IOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA)
TVOS_NUGET=Microsoft.tvOS
TVOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(TVOS_NUGET_VERSION)))
TVOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(TVOS_NUGET_VERSION)))
TVOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(TVOS_NUGET_VERSION)))
TVOS_NUGET_VERSION_NO_METADATA=$(TVOS_NUGET_VERSION)-$(NUGET_PRERELEASE_IDENTIFIER)$(TVOS_NUGET_COMMIT_DISTANCE)
TVOS_NUGET_VERSION_FULL=$(TVOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA)
WATCHOS_NUGET=Microsoft.watchOS
WATCHOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(WATCHOS_NUGET_VERSION)))
WATCHOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(WATCHOS_NUGET_VERSION)))
WATCHOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(WATCHOS_NUGET_VERSION)))
WATCHOS_NUGET_VERSION_NO_METADATA=$(WATCHOS_NUGET_VERSION)-$(NUGET_PRERELEASE_IDENTIFIER)$(WATCHOS_NUGET_COMMIT_DISTANCE)
WATCHOS_NUGET_VERSION_FULL=$(WATCHOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA)
# Xcode version should have both a major and a minor version (even if the minor version is 0)
XCODE_VERSION=11.4
XCODE_URL=http://xamarin-storage/bot-provisioning/xcodes/Xcode_11.4.xip
@ -97,12 +149,11 @@ MIN_OSX_BUILD_VERSION=10.15.2
MIN_OSX_VERSION_FOR_IOS=10.11
MIN_OSX_VERSION_FOR_MAC=10.11
# WARNING: Do **not** use versions higher than the available Xcode SDK or else we will have issues with mtouch (See https://github.com/xamarin/xamarin-macios/issues/7705)
IOS_SDK_VERSION=13.4
# When bumping OSX_SDK_VERSION also update the macOS version where we execute on bots in jenkins/Jenkinsfile (in the 'node' element)
OSX_SDK_VERSION=10.15
WATCH_SDK_VERSION=6.2
TVOS_SDK_VERSION=13.4
# Bump the *_NUGET_VERSION variables in Make.versions instead, because that makes sure the computed commit distance for the version is correct.
IOS_SDK_VERSION=$(word 1, $(subst ., ,$(IOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(IOS_NUGET_VERSION)))
OSX_SDK_VERSION=$(word 1, $(subst ., ,$(MACOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(MACOS_NUGET_VERSION)))
WATCH_SDK_VERSION=$(word 1, $(subst ., ,$(WATCHOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(WATCHOS_NUGET_VERSION)))
TVOS_SDK_VERSION=$(word 1, $(subst ., ,$(TVOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(TVOS_NUGET_VERSION)))
MAX_IOS_DEPLOYMENT_TARGET=$(IOS_SDK_VERSION)
MAX_WATCH_DEPLOYMENT_TARGET=$(WATCH_SDK_VERSION)
@ -299,6 +350,13 @@ MAC_PACKAGE_VERSION_MAJOR_MINOR=$(MAC_PACKAGE_VERSION_MAJOR).$(MAC_PACKAGE_VERSI
MAC_PACKAGE_UPDATE_ID=$(shell echo $(subst ., ,$(MAC_PACKAGE_VERSION).$(MAC_PACKAGE_VERSION_BUILD)) | awk '{printf "2%02d%02d%02d%03d",$$1,$$2,$$3,$$4}')
MAC_PACKAGE_TITLE=Xamarin $(MAC_PACKAGE_NAME) $(MAC_PACKAGE_VERSION)
MACOS_NUGET=Microsoft.macOS
MACOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(MACOS_NUGET_VERSION)))
MACOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(MACOS_NUGET_VERSION)))
MACOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(MACOS_NUGET_VERSION)))
MACOS_NUGET_VERSION_NO_METADATA=$(MACOS_NUGET_VERSION)-$(NUGET_PRERELEASE_IDENTIFIER)$(MACOS_NUGET_COMMIT_DISTANCE)
MACOS_NUGET_VERSION_FULL=$(MACOS_NUGET_VERSION_NO_METADATA)+$(NUGET_BUILD_METADATA)
MAC_DESTDIR ?= $(TOP)/_mac-build
MAC_TARGETDIR ?= $(MAC_DESTDIR)
@ -377,6 +435,10 @@ DOTNET_BCL_REF_URL=https://www.nuget.org/api/v2/package/Microsoft.NETCore.App.Re
DOTNET_BCL_REF_NAME=microsoft.netcore.app.ref.3.1.0.nupkg
DOTNET_BCL_DIR:=$(abspath $(TOP)/builds/downloads/$(basename $(DOTNET_BCL_REF_NAME)))/ref/netcoreapp3.1
DOTNET_DESTDIR ?= $(TOP)/_build
DOTNET_NUPKG_DIR ?= $(DOTNET_DESTDIR)/nupkgs
DOTNET_FEED_DIR ?= $(DOTNET_DESTDIR)/nuget-feed
# Configuration for .NET 5.
# 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
# avoid consuming a lot of disk space (since they're never automatically deleted). The system-dependencies.sh script will install locally as long
@ -388,7 +450,7 @@ DOTNET5_TARBALL=https://dotnetcli.blob.core.windows.net/dotnet/Sdk/5.0.100-previ
ifneq ($(wildcard /usr/local/share/dotnet/sdk/$(DOTNET5_VERSION)),)
DOTNET5=$(DOTNET)
else
DOTNET5=$(abspath builds/downloads/dotnet/$(DOTNET5_VERSION))/dotnet
DOTNET5=$(abspath $(TOP)/builds/downloads/dotnet/$(DOTNET5_VERSION))/dotnet
endif
# If we should inject an x86_64 slice into every binary that doesn't have one.

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

@ -1,9 +1,14 @@
#
# A release branch requires updating the following two variables at the bottom of this file:
# A release branch requires updating the following six variables at the bottom of this file:
#
# IOS_PACKAGE_VERSION (major/minor/revision #)
# MAC_PACKAGE_VERSION (major/minor/revision #)
#
# IOS_NUGET_VERSION (major/minor/patch #)
# TVOS_NUGET_VERSION (major/minor/patch #)
# WATCHOS_NUGET_VERSION (major/minor/patch #)
# MACOS_NUGET_VERSION (major/minor/patch #)
#
# Update version numbers on master as well, to the next version
#
@ -45,3 +50,23 @@
IOS_PACKAGE_VERSION=13.21.0.$(IOS_COMMIT_DISTANCE)
MAC_PACKAGE_VERSION=6.21.0.$(MAC_COMMIT_DISTANCE)
#
# ** NuGet package version numbers **
#
# See dotnet/VERSIONS.md.
#
# Rules:
# * The first two numbers represent the major and minor version of the corresponding OS.
# * Reset patch version (third number) to 100 every time either major or minor version is bumped.
# * Bump last two digits of the patch version for service releases.
# * Bump first digit of the patch version for feature releases (and reset the first two digits to 0)
#
# WARNING: Do **not** use versions higher than the available Xcode SDK or else we will have issues with mtouch (See https://github.com/xamarin/xamarin-macios/issues/7705)
# When bumping the major macOS version in MACOS_NUGET_VERSION also update the macOS version where we execute on bots in jenkins/Jenkinsfile (in the 'node' element)
IOS_NUGET_VERSION=13.4.100
TVOS_NUGET_VERSION=13.4.100
WATCHOS_NUGET_VERSION=6.2.100
MACOS_NUGET_VERSION=10.15.100

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

@ -1,5 +1,5 @@
TOP=.
SUBDIRS=builds runtime fsharp src msbuild tools
SUBDIRS=builds runtime fsharp src msbuild tools dotnet
include $(TOP)/Make.config
include $(TOP)/mk/versions.mk
@ -30,7 +30,14 @@ check-system:
exit 1; \
fi
@./system-dependencies.sh
@echo "Building Xamarin.iOS $(IOS_PACKAGE_VERSION) and Xamarin.Mac $(MAC_PACKAGE_VERSION)"
@echo "Building the packages:"
@echo " Xamarin.iOS $(IOS_PACKAGE_VERSION)"
@echo " Xamarin.Mac $(MAC_PACKAGE_VERSION)"
@echo "and the NuGets:"
@echo " Xamarin.iOS $(IOS_NUGET_VERSION_FULL)"
@echo " Xamarin.tvOS $(TVOS_NUGET_VERSION_FULL)"
@echo " Xamarin.watchOS $(WATCHOS_NUGET_VERSION_FULL)"
@echo " Xamarin.macOS $(MACOS_NUGET_VERSION_FULL)"
check-permissions:
ifdef INCLUDE_MAC

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

@ -617,6 +617,7 @@ 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 \
@ -625,6 +626,7 @@ 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) $@
@ -648,6 +650,9 @@ $(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Versions.plist: $(TOP)/Versions-mac.
$(Q) $(TOP)/versions-check.csharp $< "$(MIN_IOS_SDK_VERSION)" "$(MAX_IOS_DEPLOYMENT_TARGET)" "$(MIN_TVOS_SDK_VERSION)" "$(MAX_TVOS_DEPLOYMENT_TARGET)" "$(MIN_WATCH_OS_VERSION)" "$(MAX_WATCH_DEPLOYMENT_TARGET)" "$(MIN_OSX_SDK_VERSION)" "$(OSX_SDK_VERSION)"
$(Q_GEN) sed -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' -e "s/@MONO_VERSION@/$(shell cat $(MONO_MAC_SDK_DESTDIR)/mac-mono-version.txt)/g" -e "s/@MIN_XM_MONO_VERSION@/$(MIN_XM_MONO_VERSION)/g" $< > $@
$(DOTNET_DESTDIR)/$(MACOS_NUGET).Sdk/Versions.plist: $(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Versions.plist | $(DOTNET_DESTDIR)/$(MACOS_NUGET).Sdk
$(Q) $(CP) $< $@
$(MAC_COMMON_DIRECTORIES):
$(Q) mkdir -p $@
@ -713,6 +718,9 @@ 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 \
@ -720,6 +728,9 @@ 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) $@
@ -740,6 +751,9 @@ $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Versions.plist: $(TOP)/Versions-ios.plist.in
$(Q) $(TOP)/versions-check.csharp $< "$(MIN_IOS_SDK_VERSION)" "$(MAX_IOS_DEPLOYMENT_TARGET)" "$(MIN_TVOS_SDK_VERSION)" "$(MAX_TVOS_DEPLOYMENT_TARGET)" "$(MIN_WATCH_OS_VERSION)" "$(MAX_WATCH_DEPLOYMENT_TARGET)" "$(MIN_OSX_SDK_VERSION)" "$(OSX_SDK_VERSION)"
$(Q_GEN) sed -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' -e "s/@MONO_VERSION@/$(shell cat $(MONO_IOS_SDK_DESTDIR)/ios-mono-version.txt)/g" $< > $@
$(DOTNET_DESTDIR)/%.Sdk/Versions.plist: $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Versions.plist | $(DOTNET_DESTDIR)/%.Sdk
$(Q) $(CP) $< $@
$(IOS_COMMON_DIRECTORIES):
$(Q) mkdir -p $@

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

@ -0,0 +1,2 @@
nupkgs

93
dotnet/Makefile Normal file
Просмотреть файл

@ -0,0 +1,93 @@
TOP = ..
include $(TOP)/Make.config
include $(TOP)/mk/rules.mk
PLATFORMS=iOS tvOS watchOS macOS
IOS_RIDS=arm64 arm x86 x64
TVOS_RIDS=arm64 x64
WATCHOS_RIDS=arm x86
MACOS_RIDS=x64
DIRECTORIES += \
$(DOTNET_NUPKG_DIR) \
$(DOTNET_FEED_DIR) \
$(DIRECTORIES):
$(Q) mkdir -p $@
CURRENT_HASH_LONG:=$(shell git log -1 --pretty=%H)
targets/%.props: targets/%.template.props Makefile $(TOP)/Make.config.inc
$(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" \
$< > $@
TEMPLATED_FILES = \
targets/Xamarin.Shared.Sdk.Versions.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)
# Create the nuget in a temporary directory (nupkgs/)
nupkgs/%.nupkg: $(TEMPLATED_FILES)
$(Q) rm -f $@
$(Q_PACK) $(DOTNET5) pack package/$(shell echo $(notdir $@) | sed 's/[.]$(CURRENT_VERSION_FULL).*//')/package.csproj --output "$(dir $@)" $(DOTNET_PACK_VERBOSITY)
@# Nuget pack doesn't add the metadata to the filename, but we want that, so rename nuget to contain the full name
$(Q) mv "nupkgs/$(shell echo $(notdir $@) | sed -e 's/[+]$(NUGET_BUILD_METADATA)//')" "$@"
@# Add the nupkg to our local feed
$(Q_NUGET_ADD) nuget add "$@" -source $(DOTNET_FEED_DIR) $(NUGET_VERBOSITY)
# Copy the nuget from the temporary directory into the final directory
$(DOTNET_NUPKG_DIR)/%.nupkg: nupkgs/%.nupkg | $(DOTNET_NUPKG_DIR)
$(Q) cp $< $@
RUNTIME_PACKS_IOS = $(foreach rid,$(IOS_RIDS),$(DOTNET_NUPKG_DIR)/$(IOS_NUGET).Runtime.ios-$(rid).$(IOS_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS_TVOS = $(foreach rid,$(TVOS_RIDS),$(DOTNET_NUPKG_DIR)/$(TVOS_NUGET).Runtime.tvos-$(rid).$(TVOS_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS_WATCHOS = $(foreach rid,$(WATCHOS_RIDS),$(DOTNET_NUPKG_DIR)/$(WATCHOS_NUGET).Runtime.watchos-$(rid).$(WATCHOS_NUGET_VERSION_FULL).nupkg)
RUNTIME_PACKS_MACOS = $(foreach rid,$(MACOS_RIDS),$(DOTNET_NUPKG_DIR)/$(MACOS_NUGET).Runtime.osx-$(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)
TARGETS += $(RUNTIME_PACKS) $(REF_PACKS) $(SDK_PACKS)
all-local:: $(TARGETS) targets/Xamarin.Shared.Sdk.Versions.props
clean-local::
$(Q) rm -Rf $(DOTNET_DESTDIR) $(DOTNET_NUPKG_DIR) $(DOTNET_FEED_DIR)
$(Q) git clean -xfdq
.SECONDARY:

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.iOS.Sdk.props" />
</Project>

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.iOS.Sdk.targets" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.DefaultItems.props" />
</Project>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PlatformName>iOS</_PlatformName>
</PropertyGroup>
<Import Project="Xamarin.Shared.Sdk.props" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.targets" />
</Project>

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

@ -0,0 +1,3 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.TargetFrameworkInference.targets" />
</Project>

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.macOS.Sdk.props" />
</Project>

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.macOS.Sdk.targets" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.DefaultItems.props" />
</Project>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PlatformName>macOS</_PlatformName>
</PropertyGroup>
<Import Project="Xamarin.Shared.Sdk.props" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.targets" />
</Project>

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

@ -0,0 +1,3 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.TargetFrameworkInference.targets" />
</Project>

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.tvOS.Sdk.props" />
</Project>

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.tvOS.Sdk.targets" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.DefaultItems.props" />
</Project>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PlatformName>tvOS</_PlatformName>
</PropertyGroup>
<Import Project="Xamarin.Shared.Sdk.props" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.targets" />
</Project>

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

@ -0,0 +1,3 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.TargetFrameworkInference.targets" />
</Project>

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.watchOS.Sdk.props" />
</Project>

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

@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.watchOS.Sdk.targets" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.DefaultItems.props" />
</Project>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PlatformName>watchOS</_PlatformName>
</PropertyGroup>
<Import Project="Xamarin.Shared.Sdk.props" />
</Project>

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.targets" />
</Project>

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

@ -0,0 +1,3 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.TargetFrameworkInference.targets" />
</Project>

55
dotnet/VERSIONS.md Normal file
Просмотреть файл

@ -0,0 +1,55 @@
# Versioning
## Scheme
Our NuGet packages are versioned using [Semver 2.0.0][2].
This is the scheme: `OsMajor.OsMinor.InternalRelease[-prereleaseX]+sha.1b2c3d4`.
* Major: The major OS version.
* Minor: The minor OS version.
* Patch: Our internal release version based on `100` as a starting point.
* Service releases will bump the last two digits of the patch version
* Feature releases will round the patch version up to the nearest 100
(this is the same as bumping the first digit of the patch version, and
resetting the last two digits to 0).
* This follows [how the dotnet SDK does it][1].
* Pre-release: Optional (e.g.: Xcode previews, CI, etc.)
* For CI we use a `ci` prefix + the branch name (cleaned up to only be
alphanumeric) + the commit distance (number of commits since any of the
major.minor.patch versions changed).
* Example: `iOS 15.0.100-ci.master.1234`
* Alphanumeric means `a-zA-Z0-9-`: any character not in this range
will be replaced with a `-`.
* Pull requests have `pr` prefix, followed by `gh`+ PR number + commit
distance.
* Example: `tvOS 15.1.200-ci.pr.gh3333.1234`
* If we have a particular feature we want people to subscribe to (such as
an Xcode release), we publish previews with a custom pre-release
identifier:
* Example: `iOS 15.1.100-xcode13-1.beta.1`
* This way people can sign up for only official previews, by
referencing `iOS *-xcode13-1.beta.*`
* It's still possible to sign up for all `xcode13-1` builds, by
referencing `iOS *-ci.xcode11-3.*`
* Build metadata: Required Hash
* This is `sha.` + the short commit hash.
* Use the short hash because the long hash is quite long and
cumbersome. This leaves the complete version open for duplication,
but this is extremely unlikely.
* Example: `iOS 14.0.100+sha.1a2b3c`
* Example (CI build): `iOS 15.0.100-ci.master.1234+sha.1a2b3c`
* Since the build metadata is required for all builds, we're able to
recognize incomplete version numbers and determine if a particular
version string refers to a stable version or not.
* Example: `iOS 15.0.100`: incomplete version
* Example: `iOS 15.0.100+sha.1a2b3c`: stable
* Example: `iOS 15.0.100-ci.d17-0.1234+sha.1a2b3c`: CI build
* Example: `iOS 15.0.100-xcode13-1.beta.1+sha.1a2b3c`: official
preview
* Technically it's possible to remove the prerelease part, but
wed still be able to figure out its not a stable version by
using the commit hash.
[1]: https://github.com/dotnet/designs/blob/master/accepted/2018/sdk-version-scheme.md
[2]: https://semver.org

8
dotnet/global.json Normal file
Просмотреть файл

@ -0,0 +1,8 @@
{
"sdk": {
"version": "5.0.*"
},
"msbuild-sdks": {
"Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.20120.1"
}
}

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>iOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.ref.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>iOS</_PlatformName>
<_RuntimeIdentifier>ios-arm</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>iOS</_PlatformName>
<_RuntimeIdentifier>ios-arm64</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>iOS</_PlatformName>
<_RuntimeIdentifier>ios-x64</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>iOS</_PlatformName>
<_RuntimeIdentifier>ios-x86</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>iOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.sdk.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>macOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.ref.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>macOS</_PlatformName>
<_RuntimeIdentifier>osx-x64</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>macOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.sdk.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>tvOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.ref.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>tvOS</_PlatformName>
<_RuntimeIdentifier>tvos-arm64</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>tvOS</_PlatformName>
<_RuntimeIdentifier>tvos-x64</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>tvOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.sdk.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>watchOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.ref.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>watchOS</_PlatformName>
<_RuntimeIdentifier>watchos-arm</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>watchOS</_PlatformName>
<_RuntimeIdentifier>watchos-x86</_RuntimeIdentifier>
</PropertyGroup>
<Import Project="../microsoft.runtime.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<_PlatformName>watchOS</_PlatformName>
</PropertyGroup>
<Import Project="../microsoft.sdk.csproj" />
</Project>

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

@ -0,0 +1,93 @@
<Project>
<Import Project="../targets/Xamarin.Shared.Sdk.Versions.props" />
<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<PackageVersion>$(_PackageVersion)</PackageVersion>
<RepositoryUrl>https://github.com/xamarin/xamarin-macios</RepositoryUrl>
<RepositoryBranch>$(CurrentBranch)</RepositoryBranch>
<RepositoryCommit>$(CurrentHash)</RepositoryCommit>
<Authors>Xamarin</Authors>
<!-- NU5105: The package version '#.#.#-alpha.##+hash' uses SemVer 2.0.0 or components of SemVer 1.0.0 that are not supported on legacy clients. Change the package version to a SemVer 1.0.0 string. If the version contains a release label it must start with a letter. This message can be ignored if the package is not intended for older clients. -->
<NoWarn>$(NoWarn);NU5105</NoWarn>
</PropertyGroup>
<PropertyGroup>
<_RepositoryPath>$(MSBuildThisFileDirectory)/../..</_RepositoryPath>
<_buildPath>$(_RepositoryPath)/_build</_buildPath>
<_packagePath>$(_buildPath)\$(PackageId)\</_packagePath>
</PropertyGroup>
<ItemGroup>
<Content Include="$(_packagePath)**">
<Pack>true</Pack>
<PackagePath>\</PackagePath>
</Content>
</ItemGroup>
<!-- Code to automatically create FrameworkList.xml or RuntimeList.xml -->
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="5.0.0-beta.20120.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk" Version="5.0.0-beta.20120.1" PrivateAssets="all" />
</ItemGroup>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk" />
<UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(DotNetBuildTasksSharedFrameworkTaskFile)"/>
<Target Name="_GenerateFrameworkListFile" Condition=" '$(_CreateFrameworkList)' == 'true' Or '$(_CreateRuntimeList)' == 'true' ">
<!-- https://github.com/dotnet/runtime/blob/0647ec314948904319da5eb15e9931f7c85ed1e2/src/installer/pkg/projects/Directory.Build.targets#L281 -->
<PropertyGroup Condition="'$(_CreateFrameworkList)' == 'true'">
<_FrameworkListFile>$(IntermediateOutputPath)FrameworkList.xml</_FrameworkListFile>
<_PackTargetPath>ref/netcoreapp5.0</_PackTargetPath>
<_PackNativePath>runtimes/$(_RuntimeIdentifier)/native</_PackNativePath>
</PropertyGroup>
<PropertyGroup Condition="'$(_CreateRuntimeList)' == 'true'">
<_FrameworkListFile>$(IntermediateOutputPath)RuntimeList.xml</_FrameworkListFile>
<_PackTargetPath>runtimes/$(_RuntimeIdentifier)/lib/netcoreapp5.0</_PackTargetPath>
<_PackNativePath>runtimes/$(_RuntimeIdentifier)/native</_PackNativePath>
</PropertyGroup>
<ItemGroup>
<_FrameworkListFileClass Include="@(_PackageFiles->'%(Filename)%(Extension)')" Profile="$(_PlatformName)" />
</ItemGroup>
<ItemGroup>
<!-- Hardcode framework attributes -->
<_FrameworkListRootAttributes Include="Name" Value="Microsoft $(_PlatformName) - NET 5.0" />
<_FrameworkListRootAttributes Include="TargetFrameworkIdentifier" Value=".NETCoreApp" />
<_FrameworkListRootAttributes Include="TargetFrameworkVersion" Value="5.0" />
<_FrameworkListRootAttributes Include="FrameworkName" Value="Microsoft.$(_PlatformName)" />
<_PackageFiles Include="$(_FrameworkListFile)" PackagePath="data" />
<!-- The CreateFrameworkListFile task will add _PackageFiles to the files to pack, so remove them if they're already there -->
<Content Remove="@(_PackageFiles)" />
</ItemGroup>
<!-- https://github.com/dotnet/arcade/blob/1924d7ea148c9f26ca3d82b60f0a775a5389ed22/src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/src/CreateFrameworkListFile.cs -->
<CreateFrameworkListFile
Files="@(_PackageFiles)"
FileClassifications="@(_FrameworkListFileClass)"
TargetFile="$(_FrameworkListFile)"
TargetFilePrefixes="ref;runtimes"
RootAttributes="@(_FrameworkListRootAttributes)"
/>
</Target>
<PropertyGroup>
<BeforePack>
_GenerateFrameworkListFile;
$(BeforePack);
</BeforePack>
</PropertyGroup>
<ItemGroup>
<Content Include="$(IntermediateOutputPath)RuntimeList.xml" Condition="Exists ('$(IntermediateOutputPath)RuntimeList.xml')">
<Pack>true</Pack>
<PackagePath>data</PackagePath>
</Content>
<Content Include="$(IntermediateOutputPath)FrameworkList.xml" Condition="Exists ('$(IntermediateOutputPath)FrameworkList.xml')">
<Pack>true</Pack>
<PackagePath>data</PackagePath>
</Content>
</ItemGroup>
</Project>

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

@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<PackageId>Microsoft.$(_PlatformName).Ref</PackageId>
<Description>Microsoft $(_PlatformName) reference assemblies. Please do not reference directly.</Description>
<_CreateFrameworkList>true</_CreateFrameworkList>
</PropertyGroup>
<Import Project="common.csproj" />
</Project>

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

@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<PackageId>Microsoft.$(_PlatformName).Runtime.$(_RuntimeIdentifier)</PackageId>
<Description>Microsoft $(_PlatformName) runtime pack for $(_RuntimeIdentifier). Please do not reference directly.</Description>
<_CreateRuntimeList>true</_CreateRuntimeList>
</PropertyGroup>
<Import Project="common.csproj" />
</Project>

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

@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<PackageId>Microsoft.$(_PlatformName).Sdk</PackageId>
<Description>Managed Tools and Bindings for the $(_PlatformName) SDK</Description>
</PropertyGroup>
<Import Project="common.csproj" />
</Project>

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

@ -0,0 +1 @@
Xamarin.Shared.Sdk.Versions.props

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

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

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

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

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

@ -0,0 +1,11 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This is a hack until we get the TFM values for real from the .NET build logic -->
<PropertyGroup>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'iOS'">ios</_TargetFrameworkPlatform>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'tvOS'">tvos</_TargetFrameworkPlatform>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'watchOS'">watchos</_TargetFrameworkPlatform>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'macOS'">macos</_TargetFrameworkPlatform>
<_ComputedTargetFrameworkMoniker Condition=" '$(_TargetFrameworkPlatform)' != '' ">$(TargetFrameworkMoniker),Profile=$(_TargetFrameworkPlatform)</_ComputedTargetFrameworkMoniker>
</PropertyGroup>
</Project>

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

@ -0,0 +1,17 @@
<?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>
</Project>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Project="Xamarin.Shared.Sdk.Versions.props" />
<!-- Default item includes (globs and implicit references) -->
<Import Project="Microsoft.$(_PlatformName).Sdk.DefaultItems.props" />
</Project>

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

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<!-- Default item includes (globs and implicit references) -->
<Import Project="Xamarin.Shared.Sdk.DefaultItems.targets" />
<Import Project="Xamarin.Shared.Sdk.TargetFrameworkInference.targets" />
</Project>

40
jenkins/Jenkinsfile поставляемый
Просмотреть файл

@ -521,6 +521,18 @@ timestamps {
}
}
stage ('Nugetizing') {
currentStage = "${STAGE_NAME}"
echo ("Building on ${env.NODE_NAME}")
def skipNugets = getLabels ().contains ("skip-nugets")
if (!skipNugets) {
sh ("${workspace}/xamarin-macios/jenkins/build-nugets.sh")
sh (script: "ls -la ${workspace}/package", returnStatus: true /* don't throw exceptions if something goes wrong */)
} else {
echo ("Nugetizing skipped because the label 'skip-nugets' was found")
}
}
stage ('Signing') {
def entitlements = "${workspace}/xamarin-macios/mac-entitlements.plist"
currentStage = "${STAGE_NAME}"
@ -698,10 +710,36 @@ timestamps {
utils.reportGitHubStatus (gitHash, "msbuild.zip", "${msbuildZipUrl}", 'SUCCESS', "${msbuildZipFilename}")
}
def nupkgs = findFiles (glob: "package/*.nupkg")
for (def i = 0; i < nupkgs.size (); i++) {
def nupkg = nupkgs [i]
def nupkg_name = nupkg.name
def nupkgUrl = "${packagePrefix}/${nupkg_name}"
utils.reportGitHubStatus (gitHash, nupkg_name, nupkgUrl, "SUCCESS", nupkg_name)
packagesMessage += "* [${nupkg_name}](${nupkgUrl})\n"
}
if (packagesMessage != "")
appendFileComment ("✅ Packages: \n${packagesMessage}\n")
}
stage ('Publish Nugets') {
currentStage = "${STAGE_NAME}"
withCredentials ([string (credentialsId: 'azdo-package-feed-token', variable: 'AZDO_PACKAGE_FEED_TOKEN')]) {
def nugetResult = sh (script: "${workspace}/xamarin-macios/jenkins/publish-to-nuget.sh --apikey=${AZDO_PACKAGE_FEED_TOKEN} --source=https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json package/*.nupkg", returnStatus: true)
if (nugetResult != 0) {
failedStages.add (currentStage)
manualException = true
def msg = "Failed to publish NuGet packages. Please review log for details."
echo ("⚠️ ${msg} ⚠️")
manager.addWarningBadge (msg)
appendFileComment ("⚠️ [${msg}](${env.RUN_DISPLAY_URL}) 🔥\n")
} else {
echo ("${currentStage} succeeded")
}
}
}
dir ('xamarin-macios') {
stage ('Launch external tests') {
currentStage = "${STAGE_NAME}"
@ -820,7 +858,7 @@ timestamps {
// The trims/splits/toIntegers at the end are to select the minor part of the macOS version number,
// then we just loop from the minor part of the min version to the minor part of the current version.
def firstOS = sh (returnStdout: true, script: "grep ^MIN_OSX_SDK_VERSION= '${workspace}/xamarin-macios/Make.config' | sed 's/.*=//'").trim ().split ("\\.")[1].toInteger ()
def lastOS = sh (returnStdout: true, script: "grep ^OSX_SDK_VERSION= '${workspace}/xamarin-macios/Make.config' | sed 's/.*=//'").trim ().split ("\\.")[1].toInteger ()
def lastOS = sh (returnStdout: true, script: "grep ^MACOS_NUGET_VERSION= '${workspace}/xamarin-macios/Make.versions' | sed -e 's/.*=//' -e 's/.[0-9]*\$//'").trim ().split ("\\.")[1].toInteger ()
def macOSes = []
def excludedOSes = []
for (os = firstOS; os <= lastOS; os++)

7
jenkins/build-nugets.sh Executable file
Просмотреть файл

@ -0,0 +1,7 @@
#!/bin/bash -ex
cd "$(dirname "${BASH_SOURCE[0]}")/.."
mkdir -p ../package/
rm -f ../package/*.nupkg
cp -c dotnet/nupkgs/*.nupkg ../package/

98
jenkins/publish-to-nuget.sh Executable file
Просмотреть файл

@ -0,0 +1,98 @@
#!/bin/bash -e
# Script to publish nugets.
#
# Arguments (all required):
# --apikey=<pat>: The api key to authenticate with the nuget server.
# --source=<url>: The nuget server
#
INITIAL_CD=$(pwd)
cd "$(dirname "${BASH_SOURCE[0]}")/.."
WORKSPACE=$(pwd)
CONFIG_FILE=.nuget.config.tmp
report_error ()
{
# remove config
rm -f $CONFIG_FILE
# Show error
printf "🔥 [Failed to publish to nuget](%s/console) 🔥\\n" "$BUILD_URL" >> "$WORKSPACE/jenkins/pr-comments.md"
}
trap report_error ERR
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$INITIAL_CD/${1#./}"
}
APIKEY=
SOURCE=
VERBOSITY=()
NUGETS=()
while ! test -z "${1:-}"; do
case "$1" in
--apikey=*)
APIKEY="${1:9}"
shift
;;
--apikey)
APIKEY="$2"
shift 2
;;
--source=*)
SOURCE="${1:9}"
shift
;;
--source)
SOURCE="$2"
shift 2
;;
-v | --verbose)
VERBOSITY=("-Verbosity" "detailed")
set -x
shift
;;
-*)
echo "Unknown argument: $1"
exit 1
;;
*)
NUGETS+=("$1")
shift
;;
esac
done
if test -z "$APIKEY"; then
echo "The API key is required (--apikey=<apikey>)"
exit 1
fi
if test -z "$SOURCE"; then
echo "The source is required (--source=<source>)"
exit 1
fi
if [[ "x${#NUGETS[@]}" == "x0" ]]; then
echo "No nupkgs provided."
exit 1
fi
# create empty config for auth
echo '<?xml version="1.0" encoding="utf-8"?><configuration></configuration>' > $CONFIG_FILE
# add the feed
nuget sources add -name FEEDME -source "$SOURCE" -username WHATEVER -password "$APIKEY" -config $CONFIG_FILE
# push
for nuget in "${NUGETS[@]}"; do
nuget="$(realpath "$nuget")"
nuget push "$nuget" -Source FEEDME -ApiKey WHATEVER -NonInteractive "${VERBOSITY[@]}" -ConfigFile $CONFIG_FILE
done
# remove config
rm -f $CONFIG_FILE

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

@ -25,6 +25,8 @@ Q_LIPO= $(if $(V),,@echo "LIPO $(@F)";)
QT_LIPO= $(if $(V),,@echo "LIPO $$(@F)";)
Q_MDB= $(if $(V),,@echo "MDB $(@F)";)
Q_NUNIT= $(if $(V),,@echo "NUNIT $(@F)";)
Q_PACK =$(if $(V),,@echo "PACK $(@F)";)
Q_NUGET_ADD=$(if $(V),,@echo "NUGET ADD $(@F)";)
Q_SN= $(if $(V),,@echo "SN $(@F)";)
Q_XBUILD=$(if $(V),,@echo "XBUILD $(@F)";)
@ -66,13 +68,17 @@ XBUILD_VERBOSITY_QUIET=/nologo /verbosity:quiet
MMP_VERBOSITY=-q
MTOUCH_VERBOSITY=-q
MDTOOL_VERBOSITY=
DOTNET_PACK_VERBOSITY=--verbosity:quiet --nologo
NUGET_VERBOSITY=-verbosity quiet
else
# wrench build
# CI build
XBUILD_VERBOSITY=/nologo /verbosity:normal
XBUILD_VERBOSITY_QUIET=/nologo /verbosity:quiet
MMP_VERBOSITY=-vvvv
MTOUCH_VERBOSITY=-vvvv
MDTOOL_VERBOSITY=-v -v -v -v
DOTNET_PACK_VERBOSITY=
NUGET_VERBOSITY=
endif
else
# verbose build
@ -81,6 +87,8 @@ XBUILD_VERBOSITY_QUIET=/verbosity:diagnostic
MMP_VERBOSITY=-vvvv
MTOUCH_VERBOSITY=-vvvv
MDTOOL_VERBOSITY=-v -v -v -v
DOTNET_PACK_VERBOSITY=--verbosity:detailed
NUGET_VERBOSITY=-verbosity detailed
endif
MSBUILD_VERBOSITY=$(XBUILD_VERBOSITY)
MSBUILD_VERBOSITY_QUIET=$(XBUILD_VERBOSITY_QUIET)

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

@ -94,8 +94,6 @@ COMMON_TARGET_DIRS = \
ARGS_32 = -define:ARCH_32
ARGS_64 = -define:ARCH_64
CURRENT_BRANCH_SED_ESCAPED:=$(subst |,\|,$(subst &,\&,$(subst $$,\$$,$(subst /,\/,$(CURRENT_BRANCH))))))
SHARED_SYSTEM_DRAWING_SOURCES = System.Drawing/PointSizeRectangleTypeForwarders.cs
#

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

@ -550,11 +550,12 @@ function check_xcode () {
check_specific_xcode
install_coresimulator
local IOS_SDK_VERSION OSX_SDK_VERSION WATCH_SDK_VERSION TVOS_SDK_VERSION
local XCODE_DEVELOPER_ROOT=`grep ^XCODE_DEVELOPER_ROOT= Make.config | sed 's/.*=//'`
local IOS_SDK_VERSION=`grep ^IOS_SDK_VERSION= Make.config | sed 's/.*=//'`
local OSX_SDK_VERSION=`grep ^OSX_SDK_VERSION= Make.config | sed 's/.*=//'`
local WATCH_SDK_VERSION=`grep ^WATCH_SDK_VERSION= Make.config | sed 's/.*=//'`
local TVOS_SDK_VERSION=`grep ^TVOS_SDK_VERSION= Make.config | sed 's/.*=//'`
IOS_SDK_VERSION=$(grep ^IOS_NUGET_VERSION= Make.versions | sed -e 's/.*=//' -e 's/.[0-9]*$//')
OSX_SDK_VERSION=$(grep ^MACOS_NUGET_VERSION= Make.versions | sed -e 's/.*=//' -e 's/.[0-9]*$//')
WATCH_SDK_VERSION=$(grep ^WATCHOS_NUGET_VERSION= Make.versions | sed -e 's/.*=//' -e 's/.[0-9]*$//')
TVOS_SDK_VERSION=$(grep ^TVOS_NUGET_VERSION= Make.versions | sed -e 's/.*=//' -e 's/.[0-9]*$//')
local D=$XCODE_DEVELOPER_ROOT/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk
if test ! -d $D -a -z "$FAIL"; then

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

@ -94,6 +94,10 @@ test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk
@echo "MONO_MAC_SDK_DESTDIR=$(MONO_MAC_SDK_DESTDIR)" >> $@
@echo "ENABLE_XAMARIN=$(ENABLE_XAMARIN)" >> $@
@echo "DOTNET=$(DOTNET)" >> $@
@echo "IOS_SDK_VERSION=$(IOS_SDK_VERSION)" >> $@
@echo "TVOS_SDK_VERSION=$(TVOS_SDK_VERSION)" >> $@
@echo "WATCH_SDK_VERSION=$(WATCH_SDK_VERSION)" >> $@
@echo "OSX_SDK_VERSION=$(OSX_SDK_VERSION)" >> $@
test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk
@rm -f $@
@ -105,6 +109,10 @@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk
@echo "MONO_IOS_SDK_DESTDIR=$(MONO_IOS_SDK_DESTDIR)" >> $@
@echo "MONO_MAC_SDK_DESTDIR=$(MONO_MAC_SDK_DESTDIR)" >> $@
@echo "DOTNET=$(DOTNET)" >> $@
@echo "IOS_SDK_VERSION=$(IOS_SDK_VERSION)" >> $@
@echo "TVOS_SDK_VERSION=$(TVOS_SDK_VERSION)" >> $@
@echo "WATCH_SDK_VERSION=$(WATCH_SDK_VERSION)" >> $@
@echo "OSX_SDK_VERSION=$(OSX_SDK_VERSION)" >> $@
clean-local::
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhoneSimulator /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests.sln