From 58345727418a5b1b6b0d3e78ce834cffafb1ed4c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 13 May 2020 15:23:29 +0200 Subject: [PATCH] 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). --- Make.config | 76 ++++++++++++-- Make.versions | 27 ++++- Makefile | 11 ++- builds/Makefile | 14 +++ dotnet/.gitignore | 2 + dotnet/Makefile | 93 ++++++++++++++++++ dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.props | 3 + dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.targets | 3 + .../Microsoft.iOS.Sdk.DefaultItems.props | 4 + .../targets/Microsoft.iOS.Sdk.props | 8 ++ .../targets/Microsoft.iOS.Sdk.targets | 4 + ...osoft.iOS.TargetFrameworkInference.targets | 3 + dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.props | 3 + dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.targets | 3 + .../Microsoft.macOS.Sdk.DefaultItems.props | 4 + .../targets/Microsoft.macOS.Sdk.props | 8 ++ .../targets/Microsoft.macOS.Sdk.targets | 4 + ...oft.macOS.TargetFrameworkInference.targets | 3 + dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.props | 3 + dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.targets | 3 + .../Microsoft.tvOS.Sdk.DefaultItems.props | 4 + .../targets/Microsoft.tvOS.Sdk.props | 8 ++ .../targets/Microsoft.tvOS.Sdk.targets | 4 + ...soft.tvOS.TargetFrameworkInference.targets | 3 + dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.props | 3 + dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.targets | 3 + .../Microsoft.watchOS.Sdk.DefaultItems.props | 4 + .../targets/Microsoft.watchOS.Sdk.props | 8 ++ .../targets/Microsoft.watchOS.Sdk.targets | 4 + ...t.watchOS.TargetFrameworkInference.targets | 3 + dotnet/VERSIONS.md | 55 +++++++++++ dotnet/global.json | 8 ++ .../package/Microsoft.iOS.Ref/package.csproj | 8 ++ .../package.csproj | 9 ++ .../package.csproj | 9 ++ .../package.csproj | 9 ++ .../package.csproj | 9 ++ .../package/Microsoft.iOS.Sdk/package.csproj | 8 ++ .../Microsoft.macOS.Ref/package.csproj | 8 ++ .../package.csproj | 9 ++ .../Microsoft.macOS.Sdk/package.csproj | 8 ++ .../package/Microsoft.tvOS.Ref/package.csproj | 8 ++ .../package.csproj | 9 ++ .../package.csproj | 9 ++ .../package/Microsoft.tvOS.Sdk/package.csproj | 8 ++ .../Microsoft.watchOS.Ref/package.csproj | 8 ++ .../package.csproj | 9 ++ .../package.csproj | 9 ++ .../Microsoft.watchOS.Sdk/package.csproj | 8 ++ dotnet/package/common.csproj | 93 ++++++++++++++++++ dotnet/package/microsoft.ref.csproj | 8 ++ dotnet/package/microsoft.runtime.csproj | 8 ++ dotnet/package/microsoft.sdk.csproj | 7 ++ dotnet/targets/.gitignore | 1 + .../Xamarin.Shared.Sdk.DefaultItems.props | 3 + .../Xamarin.Shared.Sdk.DefaultItems.targets | 3 + ...hared.Sdk.TargetFrameworkInference.targets | 11 +++ ...Xamarin.Shared.Sdk.Versions.template.props | 17 ++++ dotnet/targets/Xamarin.Shared.Sdk.props | 8 ++ dotnet/targets/Xamarin.Shared.Sdk.targets | 8 ++ jenkins/Jenkinsfile | 40 +++++++- jenkins/build-nugets.sh | 7 ++ jenkins/publish-to-nuget.sh | 98 +++++++++++++++++++ mk/quiet.mk | 10 +- src/Makefile | 2 - system-dependencies.sh | 9 +- tests/Makefile | 8 ++ 67 files changed, 854 insertions(+), 18 deletions(-) create mode 100644 dotnet/.gitignore create mode 100644 dotnet/Makefile create mode 100644 dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.props create mode 100644 dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.targets create mode 100644 dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.DefaultItems.props create mode 100644 dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.props create mode 100644 dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.targets create mode 100644 dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.TargetFrameworkInference.targets create mode 100644 dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.props create mode 100644 dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.targets create mode 100644 dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.DefaultItems.props create mode 100644 dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.props create mode 100644 dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.targets create mode 100644 dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.TargetFrameworkInference.targets create mode 100644 dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.props create mode 100644 dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.targets create mode 100644 dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.DefaultItems.props create mode 100644 dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.props create mode 100644 dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.targets create mode 100644 dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.TargetFrameworkInference.targets create mode 100644 dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.props create mode 100644 dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.targets create mode 100644 dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.DefaultItems.props create mode 100644 dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.props create mode 100644 dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.targets create mode 100644 dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.TargetFrameworkInference.targets create mode 100644 dotnet/VERSIONS.md create mode 100644 dotnet/global.json create mode 100644 dotnet/package/Microsoft.iOS.Ref/package.csproj create mode 100644 dotnet/package/Microsoft.iOS.Runtime.ios-arm/package.csproj create mode 100644 dotnet/package/Microsoft.iOS.Runtime.ios-arm64/package.csproj create mode 100644 dotnet/package/Microsoft.iOS.Runtime.ios-x64/package.csproj create mode 100644 dotnet/package/Microsoft.iOS.Runtime.ios-x86/package.csproj create mode 100644 dotnet/package/Microsoft.iOS.Sdk/package.csproj create mode 100644 dotnet/package/Microsoft.macOS.Ref/package.csproj create mode 100644 dotnet/package/Microsoft.macOS.Runtime.osx-x64/package.csproj create mode 100644 dotnet/package/Microsoft.macOS.Sdk/package.csproj create mode 100644 dotnet/package/Microsoft.tvOS.Ref/package.csproj create mode 100644 dotnet/package/Microsoft.tvOS.Runtime.tvos-arm64/package.csproj create mode 100644 dotnet/package/Microsoft.tvOS.Runtime.tvos-x64/package.csproj create mode 100644 dotnet/package/Microsoft.tvOS.Sdk/package.csproj create mode 100644 dotnet/package/Microsoft.watchOS.Ref/package.csproj create mode 100644 dotnet/package/Microsoft.watchOS.Runtime.watchos-arm/package.csproj create mode 100644 dotnet/package/Microsoft.watchOS.Runtime.watchos-x86/package.csproj create mode 100644 dotnet/package/Microsoft.watchOS.Sdk/package.csproj create mode 100644 dotnet/package/common.csproj create mode 100644 dotnet/package/microsoft.ref.csproj create mode 100644 dotnet/package/microsoft.runtime.csproj create mode 100644 dotnet/package/microsoft.sdk.csproj create mode 100644 dotnet/targets/.gitignore create mode 100644 dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.props create mode 100644 dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets create mode 100644 dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.targets create mode 100644 dotnet/targets/Xamarin.Shared.Sdk.Versions.template.props create mode 100644 dotnet/targets/Xamarin.Shared.Sdk.props create mode 100644 dotnet/targets/Xamarin.Shared.Sdk.targets create mode 100755 jenkins/build-nugets.sh create mode 100755 jenkins/publish-to-nuget.sh diff --git a/Make.config b/Make.config index 0366d1b3d1..1b9169363d 100644 --- a/Make.config +++ b/Make.config @@ -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. diff --git a/Make.versions b/Make.versions index fb81bf3c67..b5d077c6ad 100644 --- a/Make.versions +++ b/Make.versions @@ -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 diff --git a/Makefile b/Makefile index c2c2460584..eae5de318f 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/builds/Makefile b/builds/Makefile index 58ba0e8b9c..8b73239daa 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -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 $@ diff --git a/dotnet/.gitignore b/dotnet/.gitignore new file mode 100644 index 0000000000..34b91bda33 --- /dev/null +++ b/dotnet/.gitignore @@ -0,0 +1,2 @@ +nupkgs + diff --git a/dotnet/Makefile b/dotnet/Makefile new file mode 100644 index 0000000000..e2f08bfcb0 --- /dev/null +++ b/dotnet/Makefile @@ -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: diff --git a/dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.props b/dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.props new file mode 100644 index 0000000000..68a4260937 --- /dev/null +++ b/dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.props @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.targets b/dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.targets new file mode 100644 index 0000000000..e4cca59767 --- /dev/null +++ b/dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.DefaultItems.props b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.DefaultItems.props new file mode 100644 index 0000000000..e0f97df9d4 --- /dev/null +++ b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.DefaultItems.props @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.props b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.props new file mode 100644 index 0000000000..b9e0c3db22 --- /dev/null +++ b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.props @@ -0,0 +1,8 @@ + + + + <_PlatformName>iOS + + + + diff --git a/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.targets b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.targets new file mode 100644 index 0000000000..b4fe76fb6a --- /dev/null +++ b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.targets @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.TargetFrameworkInference.targets b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.TargetFrameworkInference.targets new file mode 100644 index 0000000000..2c6b078eab --- /dev/null +++ b/dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.TargetFrameworkInference.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.props b/dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.props new file mode 100644 index 0000000000..88b0e01c48 --- /dev/null +++ b/dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.props @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.targets b/dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.targets new file mode 100644 index 0000000000..0e46e7499b --- /dev/null +++ b/dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.DefaultItems.props b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.DefaultItems.props new file mode 100644 index 0000000000..e0f97df9d4 --- /dev/null +++ b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.DefaultItems.props @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.props b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.props new file mode 100644 index 0000000000..77eadfc2ac --- /dev/null +++ b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.props @@ -0,0 +1,8 @@ + + + + <_PlatformName>macOS + + + + diff --git a/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.targets b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.targets new file mode 100644 index 0000000000..b4fe76fb6a --- /dev/null +++ b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.Sdk.targets @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.TargetFrameworkInference.targets b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.TargetFrameworkInference.targets new file mode 100644 index 0000000000..2c6b078eab --- /dev/null +++ b/dotnet/Microsoft.macOS.Sdk/targets/Microsoft.macOS.TargetFrameworkInference.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.props b/dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.props new file mode 100644 index 0000000000..8af8c4d423 --- /dev/null +++ b/dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.props @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.targets b/dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.targets new file mode 100644 index 0000000000..299d5ef631 --- /dev/null +++ b/dotnet/Microsoft.tvOS.Sdk/Sdk/Sdk.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.DefaultItems.props b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.DefaultItems.props new file mode 100644 index 0000000000..e0f97df9d4 --- /dev/null +++ b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.DefaultItems.props @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.props b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.props new file mode 100644 index 0000000000..0a2e039722 --- /dev/null +++ b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.props @@ -0,0 +1,8 @@ + + + + <_PlatformName>tvOS + + + + diff --git a/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.targets b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.targets new file mode 100644 index 0000000000..b4fe76fb6a --- /dev/null +++ b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.Sdk.targets @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.TargetFrameworkInference.targets b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.TargetFrameworkInference.targets new file mode 100644 index 0000000000..2c6b078eab --- /dev/null +++ b/dotnet/Microsoft.tvOS.Sdk/targets/Microsoft.tvOS.TargetFrameworkInference.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.props b/dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.props new file mode 100644 index 0000000000..0d715c2e1f --- /dev/null +++ b/dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.props @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.targets b/dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.targets new file mode 100644 index 0000000000..fa84c2e590 --- /dev/null +++ b/dotnet/Microsoft.watchOS.Sdk/Sdk/Sdk.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.DefaultItems.props b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.DefaultItems.props new file mode 100644 index 0000000000..e0f97df9d4 --- /dev/null +++ b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.DefaultItems.props @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.props b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.props new file mode 100644 index 0000000000..ec1b669780 --- /dev/null +++ b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.props @@ -0,0 +1,8 @@ + + + + <_PlatformName>watchOS + + + + diff --git a/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.targets b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.targets new file mode 100644 index 0000000000..b4fe76fb6a --- /dev/null +++ b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.Sdk.targets @@ -0,0 +1,4 @@ + + + + diff --git a/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.TargetFrameworkInference.targets b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.TargetFrameworkInference.targets new file mode 100644 index 0000000000..2c6b078eab --- /dev/null +++ b/dotnet/Microsoft.watchOS.Sdk/targets/Microsoft.watchOS.TargetFrameworkInference.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/VERSIONS.md b/dotnet/VERSIONS.md new file mode 100644 index 0000000000..8335127ebe --- /dev/null +++ b/dotnet/VERSIONS.md @@ -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 + we’d still be able to figure out it’s 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 diff --git a/dotnet/global.json b/dotnet/global.json new file mode 100644 index 0000000000..2c2011139e --- /dev/null +++ b/dotnet/global.json @@ -0,0 +1,8 @@ +{ + "sdk": { + "version": "5.0.*" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.20120.1" + } +} diff --git a/dotnet/package/Microsoft.iOS.Ref/package.csproj b/dotnet/package/Microsoft.iOS.Ref/package.csproj new file mode 100644 index 0000000000..ca8308b8b5 --- /dev/null +++ b/dotnet/package/Microsoft.iOS.Ref/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>iOS + + + + diff --git a/dotnet/package/Microsoft.iOS.Runtime.ios-arm/package.csproj b/dotnet/package/Microsoft.iOS.Runtime.ios-arm/package.csproj new file mode 100644 index 0000000000..8ae39575ab --- /dev/null +++ b/dotnet/package/Microsoft.iOS.Runtime.ios-arm/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>iOS + <_RuntimeIdentifier>ios-arm + + + + diff --git a/dotnet/package/Microsoft.iOS.Runtime.ios-arm64/package.csproj b/dotnet/package/Microsoft.iOS.Runtime.ios-arm64/package.csproj new file mode 100644 index 0000000000..8f9fb44d84 --- /dev/null +++ b/dotnet/package/Microsoft.iOS.Runtime.ios-arm64/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>iOS + <_RuntimeIdentifier>ios-arm64 + + + + diff --git a/dotnet/package/Microsoft.iOS.Runtime.ios-x64/package.csproj b/dotnet/package/Microsoft.iOS.Runtime.ios-x64/package.csproj new file mode 100644 index 0000000000..e36f5560a2 --- /dev/null +++ b/dotnet/package/Microsoft.iOS.Runtime.ios-x64/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>iOS + <_RuntimeIdentifier>ios-x64 + + + + diff --git a/dotnet/package/Microsoft.iOS.Runtime.ios-x86/package.csproj b/dotnet/package/Microsoft.iOS.Runtime.ios-x86/package.csproj new file mode 100644 index 0000000000..fd9526e79c --- /dev/null +++ b/dotnet/package/Microsoft.iOS.Runtime.ios-x86/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>iOS + <_RuntimeIdentifier>ios-x86 + + + + diff --git a/dotnet/package/Microsoft.iOS.Sdk/package.csproj b/dotnet/package/Microsoft.iOS.Sdk/package.csproj new file mode 100644 index 0000000000..ebcf1007d2 --- /dev/null +++ b/dotnet/package/Microsoft.iOS.Sdk/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>iOS + + + + diff --git a/dotnet/package/Microsoft.macOS.Ref/package.csproj b/dotnet/package/Microsoft.macOS.Ref/package.csproj new file mode 100644 index 0000000000..6b30db297a --- /dev/null +++ b/dotnet/package/Microsoft.macOS.Ref/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>macOS + + + + diff --git a/dotnet/package/Microsoft.macOS.Runtime.osx-x64/package.csproj b/dotnet/package/Microsoft.macOS.Runtime.osx-x64/package.csproj new file mode 100644 index 0000000000..8da25fbed0 --- /dev/null +++ b/dotnet/package/Microsoft.macOS.Runtime.osx-x64/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>macOS + <_RuntimeIdentifier>osx-x64 + + + + diff --git a/dotnet/package/Microsoft.macOS.Sdk/package.csproj b/dotnet/package/Microsoft.macOS.Sdk/package.csproj new file mode 100644 index 0000000000..55dcc14501 --- /dev/null +++ b/dotnet/package/Microsoft.macOS.Sdk/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>macOS + + + + diff --git a/dotnet/package/Microsoft.tvOS.Ref/package.csproj b/dotnet/package/Microsoft.tvOS.Ref/package.csproj new file mode 100644 index 0000000000..b9bad4bf1c --- /dev/null +++ b/dotnet/package/Microsoft.tvOS.Ref/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>tvOS + + + + diff --git a/dotnet/package/Microsoft.tvOS.Runtime.tvos-arm64/package.csproj b/dotnet/package/Microsoft.tvOS.Runtime.tvos-arm64/package.csproj new file mode 100644 index 0000000000..994bc0535c --- /dev/null +++ b/dotnet/package/Microsoft.tvOS.Runtime.tvos-arm64/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>tvOS + <_RuntimeIdentifier>tvos-arm64 + + + + diff --git a/dotnet/package/Microsoft.tvOS.Runtime.tvos-x64/package.csproj b/dotnet/package/Microsoft.tvOS.Runtime.tvos-x64/package.csproj new file mode 100644 index 0000000000..9ee1ebfc07 --- /dev/null +++ b/dotnet/package/Microsoft.tvOS.Runtime.tvos-x64/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>tvOS + <_RuntimeIdentifier>tvos-x64 + + + + diff --git a/dotnet/package/Microsoft.tvOS.Sdk/package.csproj b/dotnet/package/Microsoft.tvOS.Sdk/package.csproj new file mode 100644 index 0000000000..43ca50897d --- /dev/null +++ b/dotnet/package/Microsoft.tvOS.Sdk/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>tvOS + + + + diff --git a/dotnet/package/Microsoft.watchOS.Ref/package.csproj b/dotnet/package/Microsoft.watchOS.Ref/package.csproj new file mode 100644 index 0000000000..c342d3c19b --- /dev/null +++ b/dotnet/package/Microsoft.watchOS.Ref/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>watchOS + + + + diff --git a/dotnet/package/Microsoft.watchOS.Runtime.watchos-arm/package.csproj b/dotnet/package/Microsoft.watchOS.Runtime.watchos-arm/package.csproj new file mode 100644 index 0000000000..6569ddfa83 --- /dev/null +++ b/dotnet/package/Microsoft.watchOS.Runtime.watchos-arm/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>watchOS + <_RuntimeIdentifier>watchos-arm + + + + diff --git a/dotnet/package/Microsoft.watchOS.Runtime.watchos-x86/package.csproj b/dotnet/package/Microsoft.watchOS.Runtime.watchos-x86/package.csproj new file mode 100644 index 0000000000..7fb345f590 --- /dev/null +++ b/dotnet/package/Microsoft.watchOS.Runtime.watchos-x86/package.csproj @@ -0,0 +1,9 @@ + + + + <_PlatformName>watchOS + <_RuntimeIdentifier>watchos-x86 + + + + diff --git a/dotnet/package/Microsoft.watchOS.Sdk/package.csproj b/dotnet/package/Microsoft.watchOS.Sdk/package.csproj new file mode 100644 index 0000000000..69afc61cce --- /dev/null +++ b/dotnet/package/Microsoft.watchOS.Sdk/package.csproj @@ -0,0 +1,8 @@ + + + + <_PlatformName>watchOS + + + + diff --git a/dotnet/package/common.csproj b/dotnet/package/common.csproj new file mode 100644 index 0000000000..fdf84e969e --- /dev/null +++ b/dotnet/package/common.csproj @@ -0,0 +1,93 @@ + + + + + netcoreapp5.0 + false + $(_PackageVersion) + https://github.com/xamarin/xamarin-macios + $(CurrentBranch) + $(CurrentHash) + Xamarin + + + $(NoWarn);NU5105 + + + + <_RepositoryPath>$(MSBuildThisFileDirectory)/../.. + <_buildPath>$(_RepositoryPath)/_build + <_packagePath>$(_buildPath)\$(PackageId)\ + + + + + true + \ + + + + + + + + + + + + + + + + <_FrameworkListFile>$(IntermediateOutputPath)FrameworkList.xml + <_PackTargetPath>ref/netcoreapp5.0 + <_PackNativePath>runtimes/$(_RuntimeIdentifier)/native + + + <_FrameworkListFile>$(IntermediateOutputPath)RuntimeList.xml + <_PackTargetPath>runtimes/$(_RuntimeIdentifier)/lib/netcoreapp5.0 + <_PackNativePath>runtimes/$(_RuntimeIdentifier)/native + + + <_FrameworkListFileClass Include="@(_PackageFiles->'%(Filename)%(Extension)')" Profile="$(_PlatformName)" /> + + + + + <_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" /> + + + + + + + + + + + _GenerateFrameworkListFile; + $(BeforePack); + + + + + + true + data + + + true + data + + + diff --git a/dotnet/package/microsoft.ref.csproj b/dotnet/package/microsoft.ref.csproj new file mode 100644 index 0000000000..abe8d953d1 --- /dev/null +++ b/dotnet/package/microsoft.ref.csproj @@ -0,0 +1,8 @@ + + + Microsoft.$(_PlatformName).Ref + Microsoft $(_PlatformName) reference assemblies. Please do not reference directly. + <_CreateFrameworkList>true + + + diff --git a/dotnet/package/microsoft.runtime.csproj b/dotnet/package/microsoft.runtime.csproj new file mode 100644 index 0000000000..cc2c812992 --- /dev/null +++ b/dotnet/package/microsoft.runtime.csproj @@ -0,0 +1,8 @@ + + + Microsoft.$(_PlatformName).Runtime.$(_RuntimeIdentifier) + Microsoft $(_PlatformName) runtime pack for $(_RuntimeIdentifier). Please do not reference directly. + <_CreateRuntimeList>true + + + diff --git a/dotnet/package/microsoft.sdk.csproj b/dotnet/package/microsoft.sdk.csproj new file mode 100644 index 0000000000..eb8075a66b --- /dev/null +++ b/dotnet/package/microsoft.sdk.csproj @@ -0,0 +1,7 @@ + + + Microsoft.$(_PlatformName).Sdk + Managed Tools and Bindings for the $(_PlatformName) SDK + + + diff --git a/dotnet/targets/.gitignore b/dotnet/targets/.gitignore new file mode 100644 index 0000000000..448deea088 --- /dev/null +++ b/dotnet/targets/.gitignore @@ -0,0 +1 @@ +Xamarin.Shared.Sdk.Versions.props diff --git a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.props b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.props new file mode 100644 index 0000000000..4617c3b226 --- /dev/null +++ b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.props @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets new file mode 100644 index 0000000000..4617c3b226 --- /dev/null +++ b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets @@ -0,0 +1,3 @@ + + + diff --git a/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.targets b/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.targets new file mode 100644 index 0000000000..d265a4d20c --- /dev/null +++ b/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.targets @@ -0,0 +1,11 @@ + + + + + <_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'iOS'">ios + <_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'tvOS'">tvos + <_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'watchOS'">watchos + <_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'macOS'">macos + <_ComputedTargetFrameworkMoniker Condition=" '$(_TargetFrameworkPlatform)' != '' ">$(TargetFrameworkMoniker),Profile=$(_TargetFrameworkPlatform) + + diff --git a/dotnet/targets/Xamarin.Shared.Sdk.Versions.template.props b/dotnet/targets/Xamarin.Shared.Sdk.Versions.template.props new file mode 100644 index 0000000000..d0bffa8596 --- /dev/null +++ b/dotnet/targets/Xamarin.Shared.Sdk.Versions.template.props @@ -0,0 +1,17 @@ + + + + @CURRENT_BRANCH@ + @CURRENT_HASH_LONG@ + + <_ShortPackageVersion Condition=" '$(_PlatformName)' == 'iOS' ">@IOS_NUGET_VERSION_NO_METADATA@ + <_ShortPackageVersion Condition=" '$(_PlatformName)' == 'tvOS' ">@TVOS_NUGET_VERSION_NO_METADATA@ + <_ShortPackageVersion Condition=" '$(_PlatformName)' == 'watchOS' ">@WATCHOS_NUGET_VERSION_NO_METADATA@ + <_ShortPackageVersion Condition=" '$(_PlatformName)' == 'macOS' ">@MACOS_NUGET_VERSION_NO_METADATA@ + + <_PackageVersion Condition=" '$(_PlatformName)' == 'iOS' ">@IOS_NUGET_VERSION_FULL@ + <_PackageVersion Condition=" '$(_PlatformName)' == 'tvOS' ">@TVOS_NUGET_VERSION_FULL@ + <_PackageVersion Condition=" '$(_PlatformName)' == 'watchOS' ">@WATCHOS_NUGET_VERSION_FULL@ + <_PackageVersion Condition=" '$(_PlatformName)' == 'macOS' ">@MACOS_NUGET_VERSION_FULL@ + + diff --git a/dotnet/targets/Xamarin.Shared.Sdk.props b/dotnet/targets/Xamarin.Shared.Sdk.props new file mode 100644 index 0000000000..b3306c9612 --- /dev/null +++ b/dotnet/targets/Xamarin.Shared.Sdk.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets new file mode 100644 index 0000000000..d8c0aa2eea --- /dev/null +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index bfd9c0c0c7..600e7fd612 100644 --- a/jenkins/Jenkinsfile +++ b/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++) diff --git a/jenkins/build-nugets.sh b/jenkins/build-nugets.sh new file mode 100755 index 0000000000..6bc2ff1823 --- /dev/null +++ b/jenkins/build-nugets.sh @@ -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/ diff --git a/jenkins/publish-to-nuget.sh b/jenkins/publish-to-nuget.sh new file mode 100755 index 0000000000..8e01e97e08 --- /dev/null +++ b/jenkins/publish-to-nuget.sh @@ -0,0 +1,98 @@ +#!/bin/bash -e + +# Script to publish nugets. +# +# Arguments (all required): +# --apikey=: The api key to authenticate with the nuget server. +# --source=: 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=)" + exit 1 +fi + +if test -z "$SOURCE"; then + echo "The source is required (--source=)" + exit 1 +fi + +if [[ "x${#NUGETS[@]}" == "x0" ]]; then + echo "No nupkgs provided." + exit 1 +fi + +# create empty config for auth +echo '' > $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 diff --git a/mk/quiet.mk b/mk/quiet.mk index fc8dcfb682..9eb03fa1ec 100644 --- a/mk/quiet.mk +++ b/mk/quiet.mk @@ -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) diff --git a/src/Makefile b/src/Makefile index 6d0d985f95..44adb57fce 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 # diff --git a/system-dependencies.sh b/system-dependencies.sh index a46f5256b7..aee3eaa90e 100755 --- a/system-dependencies.sh +++ b/system-dependencies.sh @@ -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 diff --git a/tests/Makefile b/tests/Makefile index e0b851afed..d4f4507aae 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -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