Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 69 additions & 7 deletions Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -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" >> $@

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Evil question, can you use a template for this? It just changes the grep param, correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Two things change: the grep parameter and the output variable. I'm not sure using a template is a net win in terms of code size, since it's only 6 lines of duplication. If something should be done it's probably to extract the logic for the whole target into a shell script, which would also make it possible to not run git blame 6 times, which a template wouldn't do. In any case, that's unrelated to this PR and can be done later.

@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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
27 changes: 26 additions & 1 deletion Make.versions
Original file line number Diff line number Diff line change
@@ -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
#

Expand Down Expand Up @@ -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
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions builds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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) $@
Expand All @@ -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 $@

Expand Down Expand Up @@ -713,13 +718,19 @@ 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 \
$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/buildinfo \
$(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) $@
Expand All @@ -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 $@

Expand Down
2 changes: 2 additions & 0 deletions dotnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nupkgs

93 changes: 93 additions & 0 deletions dotnet/Makefile
Original file line number Diff line number Diff line change
@@ -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:
3 changes: 3 additions & 0 deletions dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.iOS.Sdk.props" />
</Project>
3 changes: 3 additions & 0 deletions dotnet/Microsoft.iOS.Sdk/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.iOS.Sdk.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -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>
8 changes: 8 additions & 0 deletions dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.props
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 4 additions & 0 deletions dotnet/Microsoft.iOS.Sdk/targets/Microsoft.iOS.Sdk.targets
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Xamarin.Shared.Sdk.TargetFrameworkInference.targets" />
</Project>
3 changes: 3 additions & 0 deletions dotnet/Microsoft.macOS.Sdk/Sdk/Sdk.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)..\targets\Microsoft.macOS.Sdk.props" />
</Project>
Loading