diff --git a/Make.config b/Make.config index 3f73d1c20bb6..2e4c277b8b6b 100644 --- a/Make.config +++ b/Make.config @@ -11,6 +11,7 @@ $(TOP)/Make.config.inc: $(TOP)/Make.config $(TOP)/mk/mono.mk @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" >> $@ + @printf "MACCATALYST_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep MACCATALYST_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. @@ -110,6 +111,13 @@ 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) +MACCATALYST_NUGET=Microsoft.MacCatalyst +MACCATALYST_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(MACCATALYST_NUGET_VERSION))) +MACCATALYST_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(MACCATALYST_NUGET_VERSION))) +MACCATALYST_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(MACCATALYST_NUGET_VERSION))) +MACCATALYST_NUGET_VERSION_NO_METADATA=$(MACCATALYST_NUGET_VERSION)-$(NUGET_PRERELEASE_IDENTIFIER)$(MACCATALYST_NUGET_COMMIT_DISTANCE) +MACCATALYST_NUGET_VERSION_FULL=$(MACCATALYST_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=12.2 XCODE_URL=http://xamarin-storage/bot-provisioning/xcodes/Xcode_12.2.xip @@ -154,6 +162,8 @@ IOS_SDK_VERSION=$(word 1, $(subst ., ,$(IOS_NUGET_VERSION))).$(word 2, $(subst . 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))) +MACCATALYST_SDK_VERSION=$(IOS_SDK_VERSION) +MACCATALYST_MAC_SDK_VERSION=$(OSX_SDK_VERSION) MAX_IOS_DEPLOYMENT_TARGET=$(IOS_SDK_VERSION) MAX_WATCH_DEPLOYMENT_TARGET=$(WATCH_SDK_VERSION) @@ -170,6 +180,7 @@ MIN_WATCHOS_SDK_VERSION=2.0 MIN_WATCHOS64_32_SDK_VERSION=5.1 MIN_WATCH_OS_VERSION=2.0 MIN_TVOS_SDK_VERSION=9.0 +MIN_MACCATALYST_SDK_VERSION=13.1 # The min simulator version available in the Xcode we're using MIN_IOS_SIMULATOR_VERSION=10.3 @@ -184,6 +195,7 @@ INCLUDE_IOS=1 INCLUDE_MAC=1 INCLUDE_WATCH=1 INCLUDE_TVOS=1 +INCLUDE_MACCATALYST=1 INCLUDE_DEVICE=1 # disable source code install by default (it's enabled for CI builds) @@ -228,6 +240,7 @@ MONOTOUCH_PREFIX := $(abspath $(MONOTOUCH_PREFIX)) MONOTOUCH_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS MONOTOUCH_TV_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS MONOTOUCH_WATCH_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS +MONOTOUCH_MACCATALYST_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst IOS_PACKAGE_FILENAME=$(IOS_PACKAGE_NAME_LOWER)-$(IOS_PACKAGE_VERSION).pkg IOS_PACKAGE_UTI=com.xamarin.$(IOS_PACKAGE_NAME_LOWER).pkg @@ -258,6 +271,13 @@ COMMON_SIMULATOR_OBJC_CFLAGS=-fobjc-abi-version=2 -fobjc-legacy-dispatch $(CFLAG SIMULATOR86_OBJC_CFLAGS=$(COMMON_SIMULATOR_OBJC_CFLAGS) $(SIMULATOR86_CFLAGS) SIMULATOR64_OBJC_CFLAGS=$(COMMON_SIMULATOR_OBJC_CFLAGS) $(SIMULATOR64_CFLAGS) +MACCATALYST_COMMON_CFLAGS=-target x86_64-apple-ios$(MIN_MACCATALYST_SDK_VERSION)-macabi -arch x86_64 -g $(IOS_COMMON_DEFINES) \ + -isysroot $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(OSX_SDK_VERSION).sdk \ + -isystem $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(OSX_SDK_VERSION).sdk/System/iOSSupport/usr/include \ + -iframework $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(OSX_SDK_VERSION).sdk/System/iOSSupport/System/Library/Frameworks +MACCATALYST_OBJC_CFLAGS=$(MACCATALYST_COMMON_CFLAGS) -fobjc-abi-version=2 -fobjc-legacy-dispatch $(OBJC_CFLAGS) +MACCATALYST_CFLAGS=$(MACCATALYST_COMMON_CFLAGS) + MONOTOUCH_SIMULATOR_SDK=$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphonesimulator.sdk DEVICE_BIN_PATH=$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin @@ -267,6 +287,7 @@ DEVICE_CXX=$(IOS_CXX) IOS_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_MONO_PATH)/System.dll -r:$(MONOTOUCH_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic TV_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_TV_MONO_PATH)/System.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_TV_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_TV_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic WATCH_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic +MACCATALYST_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic DEVICE_OBJC_CFLAGS=$(OBJC_CFLAGS) $(BITCODE_CFLAGS) @@ -284,6 +305,10 @@ MONOTOUCH_DEVICE_SDK=$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphoneos.sdk XAMARIN_IOSSIMULATOR_SDK = $(MONOTOUCH_SIMULATOR_SDK) XAMARIN_IPHONEOS_SDK = $(MONOTOUCH_DEVICE_SDK) +# MacCatalyst + +XAMARIN_MACCATALYST_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.MacCatalyst.sdk + # WatchOS XAMARIN_WATCHSIMULATOR_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.WatchSimulator.sdk @@ -421,15 +446,19 @@ MONO_IOS_FILENAME:=ios-release-Darwin-$(MONO_HASH).7z MONO_IOS_URL:=https://xamjenkinsartifact.azureedge.net/mono-sdks/$(XCODE_ARCHIVE_VERSION)/$(MONO_IOS_FILENAME) MONO_MAC_FILENAME:=mac-release-Darwin-$(MONO_HASH).7z MONO_MAC_URL:=https://xamjenkinsartifact.azureedge.net/mono-sdks/$(XCODE_ARCHIVE_VERSION)/$(MONO_MAC_FILENAME) +MONO_MACCATALYST_FILENAME:=maccat-release-Darwin-$(MONO_HASH).7z +MONO_MACCATALYST_URL:=https://xamjenkinsartifact.azureedge.net/mono-sdks/$(XCODE_ARCHIVE_VERSION)/$(MONO_MACCATALYST_FILENAME) # Setup various variables depending on whether mono is downloaded or built from source ifeq ($(MONO_BUILD_FROM_SOURCE),) MONO_IOS_SDK_DESTDIR:=$(abspath $(TOP)/builds/downloads/$(basename $(MONO_IOS_FILENAME))) MONO_MAC_SDK_DESTDIR:=$(abspath $(TOP)/builds/downloads/$(basename $(MONO_MAC_FILENAME))) +MONO_MACCATALYST_SDK_DESTDIR:=$(abspath $(TOP)/builds/downloads/$(basename $(MONO_MACCATALYST_FILENAME))) MONO_BUILD_MODE=download-mono else MONO_IOS_SDK_DESTDIR:=$(abspath $(MONO_PATH)/sdks/out) MONO_MAC_SDK_DESTDIR:=$(abspath $(MONO_PATH)/sdks/out) +MONO_MACCATALYST_SDK_DESTDIR:=$(abspath $(MONO_PATH)/sdks/out) MONO_BUILD_MODE=compile-mono endif @@ -492,6 +521,10 @@ DOTNET_WATCHOS_RUNTIME_IDENTIFIERS_64=watchos-x64 endif endif +ifdef INCLUDE_MACCATALYST +DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS=maccatalyst-x64 +endif + DOTNET_PLATFORMS+=macOS DOTNET_MACOS_RUNTIME_IDENTIFIERS=osx-x64 diff --git a/Make.versions b/Make.versions index 79387a582e23..566492a19b82 100644 --- a/Make.versions +++ b/Make.versions @@ -70,3 +70,4 @@ IOS_NUGET_VERSION=14.2.100 TVOS_NUGET_VERSION=14.2.100 WATCHOS_NUGET_VERSION=7.1.100 MACOS_NUGET_VERSION=11.0.100 +MACCATALYST_NUGET_VERSION=14.2.100 diff --git a/Versions-ios.plist.in b/Versions-ios.plist.in index 400c37875abd..e8e97d442d58 100644 --- a/Versions-ios.plist.in +++ b/Versions-ios.plist.in @@ -91,6 +91,30 @@ 7.0 7.1 + MacCatalyst + + 13.1 + 13.2 + 13.3 + 13.4 + 13.5 + 14.2 + + + MacCatalystVersionMap + + 13.1 + 10.15 + 13.2 + 10.15.1 + 13.3 + 10.15.2 + 13.4 + 10.15.4 + 13.5 + 10.15.5 + 14.2 + 11.0 RecommendedXcodeVersion @XCODE_VERSION@ @@ -172,6 +196,7 @@ sgen-concurrent arm64_32 altool + maccatalyst Optimizations diff --git a/builds/Makefile b/builds/Makefile index bca2a50656ba..6696f1a0564b 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -11,10 +11,14 @@ PREFIX=$(abspath $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/) ## download: download-mono -download-mono: downloads/$(basename $(MONO_IOS_FILENAME)) downloads/$(basename $(MONO_MAC_FILENAME)) +download-mono: \ + downloads/$(basename $(MONO_IOS_FILENAME)) \ + downloads/$(basename $(MONO_MAC_FILENAME)) \ + downloads/$(basename $(MONO_MACCATALYST_FILENAME)) \ downloads/$(basename $(MONO_IOS_FILENAME)): MONO_URL=$(MONO_IOS_URL) downloads/$(basename $(MONO_MAC_FILENAME)): MONO_URL=$(MONO_MAC_URL) +downloads/$(basename $(MONO_MACCATALYST_FILENAME)): MONO_URL=$(MONO_MACCATALYST_URL) downloads/$(DOTNET5_BCL_REF_NAME): MONO_URL=$(DOTNET5_BCL_REF_URL) downloads/$(DOTNET6_TARBALL_NAME): MONO_URL=$(DOTNET6_TARBALL) @@ -23,6 +27,7 @@ include $(TOP)/mk/colors.mk DOWNLOADS = \ downloads/$(MONO_IOS_FILENAME) \ downloads/$(MONO_MAC_FILENAME) \ + downloads/$(MONO_MACCATALYST_FILENAME) \ downloads/$(DOTNET5_BCL_REF_NAME) \ downloads/$(DOTNET6_TARBALL_NAME) \ @@ -79,6 +84,30 @@ downloads/%: downloads/%.nupkg $(Q) mv $@.tmp $@ $(Q) echo "Unzipped $*." +# Fix the BCL assemblies we get for Mac Catalyst +fix-maccatalyst-assembly/bin/Debug/fix-maccatalyst-assembly.exe: $(wildcard fix-maccatalyst-assembly/*.cs*) Makefile + $(Q) $(SYSTEM_MSBUILD) /r fix-maccatalyst-assembly/fix-maccatalyst-assembly.csproj $(MSBUILD_VERBOSITY) + +define FixMacCatalystAssembly +downloads/$(basename $(MONO_MACCATALYST_FILENAME))/maccat-bcl/monotouch/$(1).dll: .stamp-$(MONO_BUILD_MODE) + +downloads/fix-maccatalyst-tmpdir/$(1).dll: downloads/$(basename $(MONO_MACCATALYST_FILENAME))/maccat-bcl/monotouch/$(1).dll Makefile fix-maccatalyst-assembly/bin/Debug/fix-maccatalyst-assembly.exe + $(Q) mkdir -p $$(dir $$@) + $(Q) mono fix-maccatalyst-assembly/bin/Debug/fix-maccatalyst-assembly.exe $$(abspath $$<) $$(abspath $$@).tmp + $(Q) mv $$(abspath $$@).tmp $$(abspath $$@) + +$(PREFIX)/lib/mono/Xamarin.MacCatalyst/$(1).dll: downloads/fix-maccatalyst-tmpdir/$(1).dll | $(PREFIX)/lib/mono/Xamarin.MacCatalyst + $(Q) $(CP) $$< $$@ +endef +$(eval $(call FixMacCatalystAssembly,Mono.Security)) +$(eval $(call FixMacCatalystAssembly,mscorlib)) +$(eval $(call FixMacCatalystAssembly,System)) +$(eval $(call FixMacCatalystAssembly,System.Net.Http)) + +x: + echo foo + $(MAKE) $(PREFIX)/lib/mono/Xamarin.MacCatalyst/Mono.Security.dll + .stamp-download-mono: $(TOP)/Make.config $(TOP)/mk/mono.mk $(MAKE) download-mono $(Q) touch $@ @@ -168,7 +197,7 @@ INSTALL_STRIP_FLAG=-s endif # -# Xamarin.iOS/WatchOS/TVOS/Mac BCL assemblies +# Xamarin.iOS/WatchOS/TVOS/Mac/MacCatalyst BCL assemblies # install-local:: install-bcl all-local:: install-bcl @@ -422,16 +451,19 @@ MOBILE_ADDITIONAL_FACADE_ASSEMBLIES = \ TVOS_ASSEMBLIES = $(IOS_ASSEMBLIES) WATCHOS_ASSEMBLIES = $(filter-out Mono.Security Mono.Data.Tds,$(IOS_ASSEMBLIES)) +MACCATALYST_ASSEMBLIES = $(IOS_ASSEMBLIES) IOS_REPL_ASSEMBLIES = mscorlib System System.Core System.Xml Mono.CSharp TVOS_REPL_ASSEMBLIES = $(IOS_REPL_ASSEMBLIES) WATCHOS_REPL_ASSEMBLIES = $(IOS_REPL_ASSEMBLIES) +MACCATALYST_REPL_ASSEMBLIES = $(IOS_REPL_ASSEMBLIES) IOS_FACADE_ASSEMBLIES = $(COMMON_FACADE_ASSEMBLIES) $(MOBILE_ADDITIONAL_FACADE_ASSEMBLIES) TVOS_FACADE_ASSEMBLIES = $(COMMON_FACADE_ASSEMBLIES) $(MOBILE_ADDITIONAL_FACADE_ASSEMBLIES) WATCHOS_FACADE_ASSEMBLIES = $(COMMON_FACADE_ASSEMBLIES) $(MOBILE_ADDITIONAL_FACADE_ASSEMBLIES) MAC_FACADE_ASSEMBLIES = $(COMMON_FACADE_ASSEMBLIES) $(MOBILE_ADDITIONAL_FACADE_ASSEMBLIES) MAC_4_5_FACADE_ASSEMBLIES = $(COMMON_FACADE_ASSEMBLIES) System.Net.Http.Rtc +MACCATALYST_FACADE_ASSEMBLIES = $(COMMON_FACADE_ASSEMBLIES) $(MOBILE_ADDITIONAL_FACADE_ASSEMBLIES) IOS_BCL_DIRECTORIES = \ $(PREFIX)/lib/mono/2.1 \ @@ -451,6 +483,11 @@ TVOS_BCL_DIRECTORIES = \ $(PREFIX)/lib/mono/Xamarin.TVOS/Facades \ $(PREFIX)/lib/mono/Xamarin.TVOS/repl +MACCATALYST_BCL_DIRECTORIES = \ + $(PREFIX)/lib/mono/Xamarin.MacCatalyst \ + $(PREFIX)/lib/mono/Xamarin.MacCatalyst/Facades \ + $(PREFIX)/lib/mono/Xamarin.MacCatalyst/repl + MAC_BCL_DIRECTORIES = \ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac \ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Facades \ @@ -486,6 +523,16 @@ TVOS_BCL_TARGETS = \ $(foreach file,$(TVOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.TVOS/repl/$(file).dll) \ $(foreach file,$(TVOS_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.TVOS/repl/$(file).pdb) \ +MACCATALYST_BCL_TARGETS = \ + $(foreach file,$(MACCATALYST_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.MacCatalyst/$(file).dll) \ + $(foreach file,$(filter-out $(NO_PDB_ASSEMBLIES),$(MACCATALYST_ASSEMBLIES)),$(PREFIX)/lib/mono/Xamarin.MacCatalyst/$(file).pdb) \ + $(foreach file,$(MACCATALYST_FACADE_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.MacCatalyst/Facades/$(file).dll) \ + +# the mono archive doesn't have the repl assemblies yet +MACCATALYST_BCL_TARGETS_DISABLED = \ + $(foreach file,$(MACCATALYST_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.MacCatalyst/repl/$(file).dll) \ + $(foreach file,$(MACCATALYST_REPL_ASSEMBLIES),$(PREFIX)/lib/mono/Xamarin.MacCatalyst/repl/$(file).pdb) \ + MAC_BCL_TARGETS = \ $(foreach file,$(MAC_ASSEMBLIES),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/$(file).dll) \ $(foreach file,$(filter-out $(MAC_NO_PDB_ASSEMBLIES),$(MAC_ASSEMBLIES)),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/$(file).pdb) \ @@ -530,6 +577,15 @@ $(PREFIX)/lib/mono/Xamarin.TVOS/repl/%: .stamp-$(MONO_BUILD_MODE) | $(PREFIX)/li $(PREFIX)/lib/mono/Xamarin.TVOS/%: .stamp-$(MONO_BUILD_MODE) | $(PREFIX)/lib/mono/Xamarin.TVOS $(Q) install -m 0755 $(MONO_IOS_SDK_DESTDIR)/ios-bcl/monotouch_tv/$(notdir $@) $@ +$(PREFIX)/lib/mono/Xamarin.MacCatalyst/Facades/%: .stamp-$(MONO_BUILD_MODE) | $(PREFIX)/lib/mono/Xamarin.MacCatalyst/Facades + $(Q) install -m 0755 $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-bcl/monotouch/Facades/$(notdir $@) $@ + +$(PREFIX)/lib/mono/Xamarin.MacCatalyst/repl/%: .stamp-$(MONO_BUILD_MODE) | $(PREFIX)/lib/mono/Xamarin.MacCatalyst/repl + $(Q) install -m 0755 $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-bcl/monotouch_runtime/$(notdir $@) $@ + +$(PREFIX)/lib/mono/Xamarin.MacCatalyst/%: .stamp-$(MONO_BUILD_MODE) | $(PREFIX)/lib/mono/Xamarin.MacCatalyst + $(Q) install -m 0755 $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-bcl/monotouch/$(notdir $@) $@ + $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Facades/%: .stamp-$(MONO_BUILD_MODE) | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Facades $(Q) install -m 0755 $(MONO_MAC_SDK_DESTDIR)/mac-bcl/xammac/Facades/$(notdir $@) $@ @@ -542,7 +598,7 @@ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/Facades/%: .stamp-$(MONO $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/%: .stamp-$(MONO_BUILD_MODE) | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 $(Q) install -m 0755 $(MONO_MAC_SDK_DESTDIR)/mac-bcl/xammac_net_4_5/$(notdir $@) $@ -$(IOS_BCL_DIRECTORIES) $(WATCHOS_BCL_DIRECTORIES) $(TVOS_BCL_DIRECTORIES) $(MAC_BCL_DIRECTORIES): +$(IOS_BCL_DIRECTORIES) $(WATCHOS_BCL_DIRECTORIES) $(TVOS_BCL_DIRECTORIES) $(MAC_BCL_DIRECTORIES) $(MACCATALYST_BCL_DIRECTORIES): $(Q) mkdir -p $@ MONO_ARCHIVE_IOS_IGNORED_ASSEMBLIES = Mono.Simd System.Runtime.CompilerServices.Unsafe nunitlite # TODO check if we should add them @@ -584,15 +640,24 @@ mac-45-assemblies-check: $(MAC_BCL_TARGETS) $(Q) if ! diff -u .$@1 .$@2; then echo "\n*** There are assemblies in "$(MONO_MAC_SDK_DESTDIR)/mac-bcl/xammac_net_4_5 " not defined in MAC_4_5_ASSEMBLIES or MAC_4_5_FACADE_ASSEMBLIES ***\n"; exit 1; fi $(Q) rm -f .$@* +maccatalyst-assemblies-check: $(MACCATALYST_BCL_TARGETS) + $(Q) rm -f .$@* + $(Q) echo $(MACCATALYST_ASSEMBLIES) $(MACCATALYST_FACADE_ASSEMBLIES) $(MONO_ARCHIVE_IOS_IGNORED_ASSEMBLIES) | tr ' ' '\n' | sort > .$@1 + $(Q) ls -1 $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-bcl/monotouch $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-bcl/monotouch/Facades | grep dll$$ | sed 's/[.]dll//' | sort > .$@2 + $(Q) if ! diff -u .$@1 .$@2; then echo "\n*** There are assemblies in "$(MONO_MACCATALYST_SDK_DESTDIR)/maccat-bcl/monotouch" not defined in MACCATALYST_ASSEMBLIES or MACCATALYST_FACADE_ASSEMBLIES ***\n"; exit 1; fi + $(Q) rm -f .$@* + install-bcl-ios: $(IOS_BCL_TARGETS) ios-assemblies-check install-bcl-tvos: $(TVOS_BCL_TARGETS) tvos-assemblies-check install-bcl-watchos: $(WATCHOS_BCL_TARGETS) watchos-assemblies-check install-bcl-mac: $(MAC_BCL_TARGETS) mac-assemblies-check mac-45-assemblies-check +install-bcl-maccatalyst: $(MACCATALYST_BCL_TARGETS) maccatalyst-assemblies-check install-bcl:: install-bcl-ios install-bcl:: install-bcl-watchos install-bcl:: install-bcl-tvos install-bcl:: install-bcl-mac +install-bcl:: install-bcl-maccatalyst ### TODO END verify-signature: @@ -665,7 +730,7 @@ $(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Version: $(TOP)/Make.config.inc $(Q) echo $(MAC_PACKAGE_VERSION) > $@ $(MAC_DESTDIR)/$(MAC_FRAMEWORK_CURRENT_DIR)/Versions.plist: $(TOP)/Versions-mac.plist.in Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/versions-check.csharp .stamp-$(MONO_BUILD_MODE) - $(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) $(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)" "$(MIN_MACCATALYST_SDK_VERSION)" "$(MACCATALYST_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 @@ -766,7 +831,7 @@ $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/updateinfo: $(TOP)/Make.config.inc $(Q) echo "4569c276-1397-4adb-9485-82a7696df22e $(IOS_PACKAGE_UPDATE_ID)" > $@ $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/Versions.plist: $(TOP)/Versions-ios.plist.in Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/versions-check.csharp .stamp-$(MONO_BUILD_MODE) - $(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) $(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)" "$(MIN_MACCATALYST_SDK_VERSION)" "$(MACCATALYST_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 @@ -879,6 +944,39 @@ $(TVSIMULATOR_DIRECTORIES): install-tvsimulator: $(TVSIMULATOR_TARGETS) +# +# Mac Catalyst Mono runtime pieces +# +install-local:: install-maccatalyst +all-local:: install-maccatalyst + +MACCATALYST_DIRECTORIES = \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/Frameworks \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib \ + +MACCATALYST_TARGETS = \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/libmonosgen-2.0.a \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/libmono-profiler-log.a \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/libmono-native.a \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/libmonosgen-2.0.dylib \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/libmono-native.dylib \ + +$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/%: .stamp-$(MONO_BUILD_MODE) | $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib + $(Q) $(CP) $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-libs/$(notdir $@) $@ + $(Q) if test -d $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-libs/$(notdir $@).dSYM; then $(CP) -R $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-libs/$(notdir $@).dSYM $(dir $@); fi + +$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/Frameworks/Mono.framework/Mono: .stamp-$(MONO_BUILD_MODE) | $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/Frameworks + $(Q) $(CP) -R $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-frameworks/ios-sim/Mono.framework $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/Frameworks + $(Q) $(CP) -R $(MONO_MACCATALYST_SDK_DESTDIR)/maccat-frameworks/ios-sim/Mono.framework.dSYM $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/Frameworks + +$(XAMARIN_MACCATALYST_SDK_DIRECTORIES): + $(Q) mkdir -p $@ + +$(MACCATALYST_DIRECTORIES): + $(Q) mkdir -p $@ + +install-maccatalyst:: $(MACCATALYST_TARGETS) + # # iPhone device Mono runtime pieces # diff --git a/builds/fix-maccatalyst-assembly/Program.cs b/builds/fix-maccatalyst-assembly/Program.cs new file mode 100644 index 000000000000..979ac8b6b56c --- /dev/null +++ b/builds/fix-maccatalyst-assembly/Program.cs @@ -0,0 +1,47 @@ +using System; +using System.IO; + +using Mono.Cecil; + +namespace fixcatalystsystemnethttp { + class MainClass { + public static int Main (string [] args) + { + var input = args [0]; + var output = args [1]; + return Fix (input, output); + } + + static int Fix (string input, string output) + { + var rp = new ReaderParameters { ReadSymbols = true }; + var resolver = new DefaultAssemblyResolver (); + resolver.AddSearchDirectory (Path.GetDirectoryName (input)); + rp.AssemblyResolver = resolver; + + var ad = AssemblyDefinition.ReadAssembly (input, rp); + foreach (var ca in ad.CustomAttributes) { + if (ca.AttributeType.Name != "InternalsVisibleToAttribute") + continue; + + var arg = (string) ca.ConstructorArguments [0].Value; + if (!arg.StartsWith ("Xamarin.iOS", StringComparison.Ordinal)) + continue; + arg = "Xamarin.MacCatalyst" + arg.Substring ("Xamarin.iOS".Length); + ca.ConstructorArguments [0] = new CustomAttributeArgument (ca.ConstructorArguments [0].Type, arg); + Console.WriteLine ("Changed InternalsVisibleToAttribute to point to Xamarin.MacCatalyst instead of Xamarin.iOS."); + } + foreach (var ar in ad.MainModule.AssemblyReferences) { + if (ar.Name == "Xamarin.iOS") { + ar.Name = "Xamarin.MacCatalyst"; + Console.WriteLine ("Changed assembly reference to point to Xamarin.MacCatalyst instead of Xamarin.iOS."); + } + } + + ad.Write (output, new WriterParameters { WriteSymbols = true }); + Console.WriteLine ($"Fixed assembly written to {output}"); + return 0; + } + } +} + diff --git a/builds/fix-maccatalyst-assembly/README.md b/builds/fix-maccatalyst-assembly/README.md new file mode 100644 index 000000000000..1b1bcf2ecef4 --- /dev/null +++ b/builds/fix-maccatalyst-assembly/README.md @@ -0,0 +1,11 @@ +# BCL assembly fixer + +This is a tool that fixes: + +* InternalsVisibleTo attributes to Xamarin.iOS +* Assembly references to Xamarin.iOS + +for Mac Catalyst, and changes these to reference Xamarin.MacCatalyst instead. + +This is a temporary workaround until we have a mono archive with properly +built BCL assemblies. diff --git a/builds/fix-maccatalyst-assembly/fix-maccatalyst-assembly.csproj b/builds/fix-maccatalyst-assembly/fix-maccatalyst-assembly.csproj new file mode 100644 index 000000000000..f94797adc49b --- /dev/null +++ b/builds/fix-maccatalyst-assembly/fix-maccatalyst-assembly.csproj @@ -0,0 +1,37 @@ + + + + Debug + anycpu + {EDD3CE4B-218D-4B38-82CC-5BAAEDFC1BFC} + Exe + fixmaccatalystassembly + fix-maccatalyst-assembly + v4.7.2 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + true + bin\Release + prompt + 4 + true + + + + + + + + + + \ No newline at end of file diff --git a/builds/fix-maccatalyst-assembly/fix-maccatalyst-assembly.sln b/builds/fix-maccatalyst-assembly/fix-maccatalyst-assembly.sln new file mode 100644 index 000000000000..8688b21ca6dc --- /dev/null +++ b/builds/fix-maccatalyst-assembly/fix-maccatalyst-assembly.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.808.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fix-maccatalyst-assembly", "fix-maccatalyst-assembly.csproj", "{EDD3CE4B-218D-4B38-82CC-5BAAEDFC1BFC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|anycpu = Debug|anycpu + Release|anycpu = Release|anycpu + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EDD3CE4B-218D-4B38-82CC-5BAAEDFC1BFC}.Debug|anycpu.ActiveCfg = Debug|anycpu + {EDD3CE4B-218D-4B38-82CC-5BAAEDFC1BFC}.Debug|anycpu.Build.0 = Debug|anycpu + {EDD3CE4B-218D-4B38-82CC-5BAAEDFC1BFC}.Release|anycpu.ActiveCfg = Release|anycpu + {EDD3CE4B-218D-4B38-82CC-5BAAEDFC1BFC}.Release|anycpu.Build.0 = Release|anycpu + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DCAC0510-C3C5-461F-BAB6-9A3D031EB2B9} + EndGlobalSection +EndGlobal diff --git a/external/Touch.Unit b/external/Touch.Unit index a94d56ee10d0..05db76923adb 160000 --- a/external/Touch.Unit +++ b/external/Touch.Unit @@ -1 +1 @@ -Subproject commit a94d56ee10d0e75ee36202df1c59e345179ab710 +Subproject commit 05db76923adb03b3bbca5b2a354a1bb531e4982d diff --git a/mk/mono.mk b/mk/mono.mk index dc9da703aee6..0a176476480d 100644 --- a/mk/mono.mk +++ b/mk/mono.mk @@ -1,4 +1,4 @@ -NEEDED_MONO_VERSION := ac596375c762c6b8dbe3c802f0ce626004eab51c +NEEDED_MONO_VERSION := dfbfe5eed1992905b0dac80a8dc7d6f1f9647735 NEEDED_MONO_BRANCH := 2020-02 MONO_DIRECTORY := mono diff --git a/mk/rules.mk b/mk/rules.mk index bfcf325bbc33..3d7d20079d43 100644 --- a/mk/rules.mk +++ b/mk/rules.mk @@ -89,6 +89,23 @@ define NativeCompilationTemplate .libs/iphoneos/%$(1).arm64.framework: | .libs/iphoneos $$(call Q_2,LD, [iphoneos]) $(DEVICE_CC) $(DEVICE64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_IPHONEOS_SDK)/Frameworks -fapplication-extension -miphoneos-version-min=8.0 +## maccatalyst (ios on macOS / Catalyst) + +.libs/maccatalyst/%$(1).x86_64.o: %.m $(EXTRA_DEPENDENCIES) | .libs/maccatalyst + $$(call Q_2,OBJC, [maccatalyst]) $(SIMULATOR_CC) $(MACCATALYST_OBJC_CFLAGS) $$(EXTRA_DEFINES) $(COMMON_I) -g $(2) -c $$< -o $$@ + +.libs/maccatalyst/%$(1).x86_64.o: %.c $(EXTRA_DEPENDENCIES) | .libs/maccatalyst + $$(call Q_2,CC, [maccatalyst]) $(SIMULATOR_CC) $(MACCATALYST_CFLAGS) $$(EXTRA_DEFINES) $(COMMON_I) -g $(2) -c $$< -o $$@ + +.libs/maccatalyst/%$(1).x86_64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/maccatalyst + $$(call Q_2,ASM, [maccatalyst]) $(SIMULATOR_CC) $(MACCATALYST_CFLAGS) $(COMMON_I) -g $(2) -c $$< -o $$@ + +.libs/maccatalyst/%$(1).x86_64.dylib: | .libs/maccatalyst + $$(call Q_2,LD, [maccatalyst]) $(SIMULATOR_CC) $(MACCATALYST_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib -fapplication-extension + +.libs/maccatalyst/%$(1).x86_64.framework: | .libs/maccatalyst + $$(call Q_2,LD, [maccatalyst]) $(SIMULATOR_CC) $(MACCATALYST_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/Frameworks -fapplication-extension + ## watch simulator .libs/watchsimulator/%$(1).x86.o: %.m $(EXTRA_DEPENDENCIES) | .libs/watchsimulator @@ -185,7 +202,7 @@ endef $(eval $(call NativeCompilationTemplate,,-O2)) $(eval $(call NativeCompilationTemplate,-debug,-DDEBUG)) -.libs/iphoneos .libs/iphonesimulator .libs/watchos .libs/watchsimulator .libs/tvos .libs/tvsimulator .libs/iosmac: +.libs/iphoneos .libs/iphonesimulator .libs/watchos .libs/watchsimulator .libs/tvos .libs/tvsimulator .libs/maccatalyst: $(Q) mkdir -p $@ %.csproj.inc: %.csproj $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/tools/common/create-makefile-fragment.sh diff --git a/msbuild/Makefile b/msbuild/Makefile index b4f88369beb7..48568fd4e354 100644 --- a/msbuild/Makefile +++ b/msbuild/Makefile @@ -78,6 +78,36 @@ MSBUILD_SYMLINKS += symlinks-ios MSBUILD_TASK_ASSEMBLIES += $(IOS_TASK_ASSEMBLIES) endif +## +## MacCatalyst definitions +## + +MACCATALYST_TARGETS = \ + $(wildcard Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.*.props) \ + $(wildcard Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.*.targets) \ + +MACCATALYST_DIRECTORIES = \ + $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.MacCatalyst/v1.0/RedistList \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst \ + +MACCATALYST_SYMLINKS = \ + $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.MacCatalyst/v1.0/RedistList/FrameworkList.xml \ + $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/MacCatalyst \ + +MACCATALYST_PRODUCTS += \ + $(MACCATALYST_SYMLINKS) \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst/FrameworkList.xml \ + $(foreach target,$(MACCATALYST_TARGETS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst/$(notdir $(target))) \ + +all-maccatalyst: $(MACCATALYST_PRODUCTS) +symlinks-maccatalyst: $(MACCATALYST_SYMLINKS) + +ifdef INCLUDE_MACCATALYST +MSBUILD_PRODUCTS += all-maccatalyst +MSBUILD_DIRECTORIES += $(MACCATALYST_DIRECTORIES) +MSBUILD_SYMLINKS += symlinks-maccatalyst +endif + ## ## XW definitions ## @@ -236,6 +266,22 @@ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/iOS/%: Xamarin.iOS.Tasks/bin/$(CON $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/iOS/%: Xamarin.Localization.MSBuild/bin/$(CONFIG)/$(TARGETFRAMEWORK)/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/iOS $(Q) install -m 644 $< $@ +## +## MacCatalyst +## + +$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.MacCatalyst/v1.0/RedistList/FrameworkList.xml: | $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.MacCatalyst/v1.0/RedistList + $(Q) ln -fs $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/msbuild/MacCatalyst/$(notdir $@) $@ + +$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/MacCatalyst: | $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild/Xamarin + $(Q) ln -Fhs $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/msbuild/MacCatalyst $@ + +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst/FrameworkList.xml: Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst-FrameworkList.xml.in Makefile | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst + $(Q) sed 's@%TargetFrameworkDirectory%@$(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.MacCatalyst@' $< > $@ + +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst/%: Xamarin.iOS.Tasks.Core/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst + $(Q) install -m 644 $< $@ + ## ## XW ## diff --git a/msbuild/Xamarin.Mac.Tasks.Core/Tasks/ArchiveTaskBase.cs b/msbuild/Xamarin.Mac.Tasks.Core/Tasks/ArchiveTaskBase.cs index aae694759023..99d156a58b4a 100644 --- a/msbuild/Xamarin.Mac.Tasks.Core/Tasks/ArchiveTaskBase.cs +++ b/msbuild/Xamarin.Mac.Tasks.Core/Tasks/ArchiveTaskBase.cs @@ -17,7 +17,7 @@ public override bool Execute () var archiveDir = CreateArchiveDirectory (); try { - var plist = PDictionary.FromFile (Path.Combine (AppBundleDir.ItemSpec, "Contents", "Info.plist")); + var plist = PDictionary.FromFile (PlatformFrameworkHelper.GetAppManifestPath (Platform, AppBundleDir.ItemSpec)); var productsDir = Path.Combine (archiveDir, "Products"); // Archive the Applications... diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/PlatformFramework.cs b/msbuild/Xamarin.MacDev.Tasks.Core/PlatformFramework.cs index d1ee1c2c6d6d..5bb7bf23a1eb 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/PlatformFramework.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/PlatformFramework.cs @@ -24,6 +24,7 @@ // THE SOFTWARE. using System; +using System.IO; using Xamarin.Utils; @@ -61,6 +62,7 @@ public static string GetMinimumOSVersionKey (ApplePlatform platform) case ApplePlatform.WatchOS: return ManifestKeys.MinimumOSVersion; case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: return ManifestKeys.LSMinimumSystemVersion; default: throw new InvalidOperationException ($"Invalid platform: {platform}"); @@ -90,5 +92,20 @@ public static string GetMinimumVersionArgument (string targetFrameworkMoniker, b { return $"-m{GetMinimumVersionOperatingSystem (targetFrameworkMoniker, isSimulator)}-version-min={minimumOSVersion}"; } + + public static string GetAppManifestPath (ApplePlatform platform, string appBundlePath) + { + switch (platform) { + case ApplePlatform.iOS: + case ApplePlatform.TVOS: + case ApplePlatform.WatchOS: + return Path.Combine (appBundlePath, "Info.plist"); + case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: + return Path.Combine (appBundlePath, "Contents", "Info.plist"); + default: + throw new InvalidOperationException ($"Invalid platform: {platform}"); + } + } } } diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/PlatformUtils.cs b/msbuild/Xamarin.MacDev.Tasks.Core/PlatformUtils.cs index d64ddbc360d1..23196a072b19 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/PlatformUtils.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/PlatformUtils.cs @@ -19,6 +19,8 @@ public static string GetTargetPlatform (string sdkPlatform, bool isWatchApp) return "appletvsimulator"; case "AppleTVOS": return "appletvos"; + case "MacCatalyst": + return "macosx"; } return null; diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs index 046dc367b9c8..08788e4804ee 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs @@ -310,7 +310,6 @@ public override bool Execute () PDictionary compiled; PDictionary archived; string path; - bool save; switch (SdkPlatform) { case "AppleTVSimulator": @@ -326,6 +325,9 @@ public override bool Execute () case "MacOSX": platform = MobileProvisionPlatform.MacOS; break; + case "MacCatalyst": + platform = MobileProvisionPlatform.MacOS; + break; default: Log.LogError (MSBStrings.E0048, SdkPlatform); return false; @@ -369,26 +371,7 @@ public override bool Execute () return false; } - path = Path.Combine (EntitlementBundlePath, "archived-expanded-entitlements.xcent"); - - if (File.Exists (path)) { - var plist = PDictionary.FromFile (path); - var src = archived.ToXml (); - var dest = plist.ToXml (); - - save = src != dest; - } else { - save = true; - } - - if (save) { - try { - archived.Save (path, true); - } catch (Exception ex) { - Log.LogError (MSBStrings.E0115, ex.Message); - return false; - } - } + SaveArchivedExpandedEntitlements (archived); if (SdkIsSimulator) { if (compiled.Count > 0) { @@ -400,5 +383,33 @@ public override bool Execute () return !Log.HasLoggedErrors; } + + bool SaveArchivedExpandedEntitlements (PDictionary archived) + { + if (Platform == Utils.ApplePlatform.MacCatalyst) { + // I'm not sure if we need this in catalyst or not, but skip it until it's proven we actually need it. + return true; + } + + var path = Path.Combine (EntitlementBundlePath, "archived-expanded-entitlements.xcent"); + + if (File.Exists (path)) { + var plist = PDictionary.FromFile (path); + var src = archived.ToXml (); + var dest = plist.ToXml (); + + if (src == dest) + return true; + } + + try { + archived.Save (path, true); + } catch (Exception ex) { + Log.LogError (MSBStrings.E0115, ex.Message); + return false; + } + + return true; + } } } diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs index 136807d34a6c..44a2b5524ff8 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs @@ -426,6 +426,9 @@ public override bool Execute () case "MacOSX": platform = MobileProvisionPlatform.MacOS; break; + case "MacCatalyst": + platform = MobileProvisionPlatform.MacOS; + break; default: Log.LogError (MSBStrings.E0048, SdkPlatform); return false; @@ -455,7 +458,7 @@ public override bool Execute () return false; } - if (Platform == ApplePlatform.MacOSX) { + if (Platform == ApplePlatform.MacOSX || Platform == ApplePlatform.MacCatalyst) { if (!RequireCodeSigning || !string.IsNullOrEmpty (DetectedCodeSigningKey)) { DetectedBundleId = identity.BundleId; DetectedAppId = DetectedBundleId; diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/XamarinTask.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/XamarinTask.cs index c9fedb45388d..8ba128d14f16 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/XamarinTask.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/XamarinTask.cs @@ -28,6 +28,7 @@ public string Product { case ApplePlatform.iOS: case ApplePlatform.TVOS: case ApplePlatform.WatchOS: + case ApplePlatform.MacCatalyst: return "Xamarin.iOS"; case ApplePlatform.MacOSX: return "Xamarin.Mac"; @@ -70,6 +71,8 @@ public string PlatformName { return "watchOS"; case ApplePlatform.MacOSX: return "macOS"; + case ApplePlatform.MacCatalyst: + return "MacCatalyst"; default: throw new InvalidOperationException ($"Invalid platform: {Platform}"); } @@ -87,6 +90,8 @@ protected string GetSdkPlatform (bool isSimulator) return isSimulator ? "WatchSimulator" : "WatchOS"; case ApplePlatform.MacOSX: return "MacOSX"; + case ApplePlatform.MacCatalyst: + return "MacCatalyst"; default: throw new InvalidOperationException ($"Invalid platform: {Platform}"); } diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.props b/msbuild/Xamarin.Shared/Xamarin.Shared.props index 63f470635048..8978e42a95e9 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.props +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.props @@ -22,9 +22,12 @@ Copyright (C) 2020 Microsoft. All rights reserved. <_PlatformName Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.iOS'">iOS + <_PlatformName Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.MacCatalyst'">iOS <_PlatformName Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.TVOS'">tvOS <_PlatformName Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.WatchOS'">watchOS <_PlatformName Condition="'$(_PlatformName)' == ''">macOS + + <_IsMacCatalyst Condition="'$(TargetFrameworkIdentifier)' == 'Xamarin.MacCatalyst'">true @@ -83,12 +86,14 @@ Copyright (C) 2020 Microsoft. All rights reserved. - <_XamarinBclPath Condition="'$(_PlatformName)' == 'iOS'">$(_XamarinSdkRoot)/lib/mono/Xamarin.iOS/ + <_XamarinBclPath Condition="'$(_PlatformName)' == 'iOS' And '$(_IsMacCatalyst)' == 'true'">$(_XamarinSdkRoot)/lib/mono/Xamarin.MacCatalyst/ + <_XamarinBclPath Condition="'$(_PlatformName)' == 'iOS' And '$(_IsMacCatalyst)' != 'true'">$(_XamarinSdkRoot)/lib/mono/Xamarin.iOS/ <_XamarinBclPath Condition="'$(_PlatformName)' == 'tvOS'">$(_XamarinSdkRoot)/lib/mono/Xamarin.TVOS/ <_XamarinBclPath Condition="'$(_PlatformName)' == 'watchOS'">$(_XamarinSdkRoot)/lib/mono/Xamarin.WatchOS/ - <_XamarinPlatformAssemblyName Condition="'$(_PlatformName)' == 'iOS'">Xamarin.iOS.dll + <_XamarinPlatformAssemblyName Condition="'$(_PlatformName)' == 'iOS' And '$(_IsMacCatalyst)' == 'true'">Xamarin.MacCatalyst.dll + <_XamarinPlatformAssemblyName Condition="'$(_PlatformName)' == 'iOS' And '$(_IsMacCatalyst)' != 'true'">Xamarin.iOS.dll <_XamarinPlatformAssemblyName Condition="'$(_PlatformName)' == 'tvOS'">Xamarin.TVOS.dll <_XamarinPlatformAssemblyName Condition="'$(_PlatformName)' == 'watchOS'">Xamarin.WatchOS.dll <_XamarinPlatformAssemblyName Condition="'$(_PlatformName)' == 'macOS'">Xamarin.Mac.dll @@ -208,6 +213,8 @@ Copyright (C) 2020 Microsoft. All rights reserved. <_EmbeddedResourcePrefix Condition="'$(_PlatformName)' == 'macOS'">xammac <_EmbeddedResourcePrefix Condition="'$(_PlatformName)' != 'macOS'">monotouch + + <_AppBundleManifestRelativePath Condition="'$(_PlatformName)' == 'macOS' Or '$(_IsMacCatalyst)' == 'true'">Contents/ @@ -281,6 +288,7 @@ Copyright (C) 2020 Microsoft. All rights reserved. <_IsTVOSDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__TVOS__($|;)')) <_IsWatchOSDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__WATCHOS__($|;)')) <_IsMacOSDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__MACOS__($|;)')) + <_IsMacCatalystDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)__MACCATALYST__($|;)')) __UNIFIED__;$(DefineConstants) __MOBILE__;$(DefineConstants) @@ -288,6 +296,7 @@ Copyright (C) 2020 Microsoft. All rights reserved. __TVOS__;$(DefineConstants) __WATCHOS__;$(DefineConstants) __MACOS__;$(DefineConstants) + __MACCATALYST__;$(DefineConstants) - <_PkgInfoPath Condition="'$(_PlatformName)' == 'macOS'">$(_AppBundlePath)Contents\PkgInfo <_PkgInfoPath Condition="'$(_PlatformName)' != 'macOS'">$(_AppBundlePath)PkgInfo + <_PkgInfoPath Condition="'$(_PlatformName)' == 'macOS' Or '$(_IsMacCatalyst)' == 'true'">$(_AppBundlePath)Contents\PkgInfo @@ -676,6 +676,9 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + <_AppBundleManifestPath>$(_AppBundlePath)$(_AppBundleManifestRelativePath)$(_AppManifest) + diff --git a/msbuild/Xamarin.iOS.Tasks.Core/IPhoneSdks.cs b/msbuild/Xamarin.iOS.Tasks.Core/IPhoneSdks.cs index ac5ee81e713b..3b021fdc69be 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/IPhoneSdks.cs +++ b/msbuild/Xamarin.iOS.Tasks.Core/IPhoneSdks.cs @@ -54,6 +54,8 @@ public static AppleSdk GetSdk (ApplePlatform framework) return IPhoneSdks.Watch; case ApplePlatform.TVOS: return IPhoneSdks.TVOS; + case ApplePlatform.MacCatalyst: + return IPhoneSdks.Native; default: throw new InvalidOperationException (string.Format ("Invalid framework: {0}", framework)); } diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/EmbedMobileProvisionTaskBase.cs b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/EmbedMobileProvisionTaskBase.cs index e7c8fb3e0068..be8e31f2a396 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/EmbedMobileProvisionTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/EmbedMobileProvisionTaskBase.cs @@ -39,6 +39,9 @@ public override bool Execute () case "WatchOS": platform = MobileProvisionPlatform.iOS; break; + case "MacCatalyst": + platform = MobileProvisionPlatform.MacOS; + break; default: Log.LogError (MSBStrings.E0048, SdkPlatform); return false; diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ValidateAppBundleTaskBase.cs b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ValidateAppBundleTaskBase.cs index 397137a1d6e4..c32aa3334f6c 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ValidateAppBundleTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/ValidateAppBundleTaskBase.cs @@ -279,7 +279,7 @@ void ValidateWatchExtension (string path, string watchAppBundleIdentifier, strin public override bool Execute () { - var mainInfoPath = Path.Combine (AppBundlePath, "Info.plist"); + var mainInfoPath = PlatformFrameworkHelper.GetAppManifestPath (Platform, AppBundlePath); if (!File.Exists (mainInfoPath)) { Log.LogError (7040, AppBundlePath, MSBStrings.E7040, AppBundlePath); return false; @@ -309,8 +309,14 @@ public override bool Execute () var deviceTypes = plist.GetUIDeviceFamily (); var deviceFamilies = deviceTypes.ToDeviceFamily (); AppleDeviceFamily[] validFamilies = null; + AppleDeviceFamily [] requiredFamilies = null; switch (Platform) { + case ApplePlatform.MacCatalyst: + requiredFamilies = new AppleDeviceFamily [] { + AppleDeviceFamily.IPad, + }; + goto case ApplePlatform.iOS; case ApplePlatform.iOS: validFamilies = new AppleDeviceFamily[] { AppleDeviceFamily.IPhone, @@ -340,6 +346,14 @@ public override bool Execute () } } + if (requiredFamilies != null) { + foreach (var family in requiredFamilies) { + if (!deviceFamilies.Contains (family)) { + Log.LogError (7044, mainInfoPath, MSBStrings.E7044_A, mainInfoPath, family); + } + } + } + var mainShortVersionString = plist.GetCFBundleShortVersionString (); var mainVersion = plist.GetCFBundleVersion (); diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst-FrameworkList.xml.in b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst-FrameworkList.xml.in new file mode 100644 index 000000000000..c2e04224193d --- /dev/null +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst-FrameworkList.xml.in @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.CSharp.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.CSharp.targets new file mode 100644 index 000000000000..b80a419f95b3 --- /dev/null +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.CSharp.targets @@ -0,0 +1,32 @@ + + + + + + + Xamarin.MacCatalyst + v1.0 + + + + + + + + diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.Common.targets new file mode 100644 index 000000000000..b40957ee3920 --- /dev/null +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.Common.targets @@ -0,0 +1,29 @@ + + + + + + xamarinios10;$(AssetTargetFallback) + + + + + + + diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.FSharp.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.FSharp.targets new file mode 100644 index 000000000000..999f691c85a9 --- /dev/null +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.MacCatalyst.FSharp.targets @@ -0,0 +1,41 @@ + + + + + + + Xamarin.MacCatalyst + v1.0 + + + + + + + + + + + diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets index a17d5b78b1c1..812a29bcc2ae 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets @@ -292,7 +292,8 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. - <_AppResourcesPath>$(_AppBundlePath) + <_AppResourcesPath Condition="'$(_IsMacCatalyst)' == 'true'">$(_AppBundlePath)Contents\Resources\ + <_AppResourcesPath Condition="'$(_IsMacCatalyst)' != 'true'">$(_AppBundlePath) @@ -384,7 +385,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. @@ -636,7 +637,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. - + Outputs="$(_AppResourcesPath)MonoTouchDebugConfiguration.txt" > $@ + +$(MACCATALYST_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/Make.config $(TOP)/.git/HEAD | $(MACCATALYST_BUILD_DIR) + $(call Q_PROF_GEN,maccatalyst) sed \ + -e 's|@PRODUCT_NAME@|Xamarin.MacCatalyst|g' \ + -e 's|@PACKAGE_HEAD_REV@|$(PACKAGE_HEAD_REV)|g' \ + -e 's|@PACKAGE_HEAD_BRANCH@|$(CURRENT_BRANCH_SED_ESCAPED)|g' \ + -e 's|@PACKAGE_VERSION_MAJOR@|$(IOS_PACKAGE_VERSION_MAJOR)|g' \ + -e 's|@PACKAGE_VERSION_MINOR@|$(IOS_PACKAGE_VERSION_MINOR)|g' \ + -e 's|@PACKAGE_VERSION_REV@|$(IOS_PACKAGE_VERSION_REV)|g' \ + -e 's|@PACKAGE_VERSION_BUILD@|$(IOS_PACKAGE_VERSION_BUILD)|g' \ + $< > $@.tmp + $(Q) diff $@ $@.tmp >/dev/null 2>&1 || mv -f $@.tmp $@ + $(Q) rm -f $@.tmp + $(Q) touch $@ + + +$(MACCATALYST_BUILD_DIR)/maccatalyst/core.dll: $(MACCATALYST_CORE_SOURCES) frameworks.sources Makefile $(BUILD_DIR)/maccatalyst-defines.rsp | $(MACCATALYST_BUILD_DIR)/maccatalyst + @mkdir -p $(MACCATALYST_BUILD_DIR)/maccatalyst + $(call Q_PROF_CSC,maccatalyst) $(TV_CSC) -nologo -out:$@ -target:library -debug -unsafe \ + -nowarn:219,618,114,414,1635,3021,$(IOS_WARNINGS_THAT_YOU_SHOULD_FIX) \ + -define:COREBUILD \ + @$(BUILD_DIR)/maccatalyst-defines.rsp \ + $(MACCATALYST_DEFINES) \ + $(MACCATALYST_CORE_DEFINES) \ + $(MACCATALYST_CORE_SOURCES) + +# generated_sources +$(MACCATALYST_BUILD_DIR)/maccatalyst/generated_sources: $(MACCATALYST_GENERATOR) $(MACCATALYST_APIS) $(MACCATALYST_BUILD_DIR)/maccatalyst/core.dll $(MACCATALYST_BUILD_DIR)/Xamarin.MacCatalyst.BindingAttributes.dll $(BUILD_DIR)/maccatalyst.rsp + $(call Q_PROF_GEN,maccatalyst) $(MACCATALYST_GENERATE) @$(BUILD_DIR)/maccatalyst.rsp + +$(BUILD_DIR)/maccatalyst.rsp: Makefile Makefile.generator frameworks.sources + $(Q_GEN) echo \ + -inline-selectors \ + -process-enums \ + -warnaserror:$(MACCATALYST_GENERATOR_WARNASERROR) \ + -core \ + -sourceonly=$(MACCATALYST_BUILD_DIR)/maccatalyst/generated_sources \ + -compiler=$(MACCATALYST_CSC) \ + -nologo -nostdlib -noconfig \ + -tmpdir=$(MACCATALYST_BUILD_DIR)/maccatalyst \ + -baselib=$(MACCATALYST_BUILD_DIR)/maccatalyst/core.dll \ + -attributelib=$(MACCATALYST_BUILD_DIR)/Xamarin.MacCatalyst.BindingAttributes.dll \ + $(MACCATALYST_GENERATED_DEFINES) \ + -native-exception-marshalling \ + --ns:ObjCRuntime \ + $(MACCATALYST_APIS) \ + --target-framework=Xamarin.MacCatalyst,v1.0 \ + @$(BUILD_DIR)/maccatalyst-defines.rsp \ + > $@ + +### .NET ### + +$(MACCATALYST_DOTNET_BUILD_DIR)/core-maccatalyst.dll: $(TVOS_CORE_SOURCES) frameworks.sources Makefile | $(MACCATALYST_DOTNET_BUILD_DIR) + $(Q_DOTNET_GEN) \ + $(SYSTEM_CSC) $(DOTNET_FLAGS) \ + $(MACCATALYST_WARNINGS_TO_FIX) \ + @$(BUILD_DIR)/maccatalyst-defines.rsp \ + $(MACCATALYST_CORE_DEFINES) \ + $(MACCATALYST_CORE_SOURCES) \ + -out:$@ \ + +$(MACCATALYST_DOTNET_BUILD_DIR)/maccatalyst-generated-sources: $(DOTNET_GENERATOR) $(TVOS_APIS) $(MACCATALYST_DOTNET_BUILD_DIR)/core-maccatalyst.dll $(DOTNET_BINDING_ATTRIBUTES) $(MACCATALYST_DOTNET_BUILD_DIR)/maccatalyst.rsp | $(MACCATALYST_DOTNET_BUILD_DIR)/generated-sources + $(Q_DOTNET_GEN) $< @$(MACCATALYST_DOTNET_BUILD_DIR)/maccatalyst.rsp + +$(MACCATALYST_DOTNET_BUILD_DIR)/maccatalyst.rsp: Makefile Makefile.generator frameworks.sources $(DOTNET_COMPILER) | $(MACCATALYST_DOTNET_BUILD_DIR) + $(Q) echo \ + $(MACCATALYST_GENERATOR_DEFINES) \ + $(DOTNET_GENERATOR_FLAGS) -inline-selectors \ + -warnaserror:$(MACCATALYST_GENERATOR_WARNASERROR) \ + -sourceonly=$(MACCATALYST_DOTNET_BUILD_DIR)/maccatalyst-generated-sources \ + -tmpdir=$(MACCATALYST_DOTNET_BUILD_DIR)/generated-sources \ + -baselib=$(MACCATALYST_DOTNET_BUILD_DIR)/core-maccatalyst.dll \ + --target-framework=.NETCoreApp,Version=6.0,Profile=maccatalyst \ + $(MACCATALYST_APIS) \ + @$(BUILD_DIR)/maccatalyst-defines.rsp \ + > $@ + +$(MACCATALYST_DOTNET_BUILD_DIR)/64/Xamarin.MacCatalyst%dll $(MACCATALYST_DOTNET_BUILD_DIR)/64/Xamarin.MacCatalyst%pdb $(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.MacCatalyst%dll: $(MACCATALYST_DOTNET_BUILD_DIR)/maccatalyst-generated-sources $(MACCATALYST_SOURCES) $(PRODUCT_KEY_PATH) | $(MACCATALYST_DOTNET_BUILD_DIR)/64 $(MACCATALYST_DOTNET_BUILD_DIR)/ref + $(Q_DOTNET_GEN) \ + $(SYSTEM_CSC) $(DOTNET_FLAGS) -out:$(MACCATALYST_DOTNET_BUILD_DIR)/64/Xamarin.MacCatalyst.dll -optimize \ + -publicsign -keyfile:$(PRODUCT_KEY_PATH) \ + -refout:$(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.MacCatalyst.dll \ + $(MACCATALYST_DEFINES) \ + $(ARGS_64) \ + $(MACCATALYST_WARNINGS_TO_FIX) \ + -warnaserror:$(NULLABILITY_WARNINGS) \ + $(IOS_CSC_FLAGS_XI) \ + $(MACCATALYST_SOURCES) \ + @$(BUILD_DIR)/maccatalyst-defines.rsp \ + @$< + +$(MACCATALYST_BUILD_DIR)/maccatalyst-64/Xamarin.MacCatalyst%dll $(MACCATALYST_BUILD_DIR)/maccatalyst-64/Xamarin.MacCatalyst%pdb: $(MACCATALYST_SOURCES) $(MACCATALYST_BUILD_DIR)/maccatalyst/generated_sources $(PRODUCT_KEY_PATH) | $(MACCATALYST_BUILD_DIR)/maccatalyst-64 + $(call Q_PROF_CSC,maccatalyst) $(MACCATALYST_CSC) -nologo -out:$(basename $@).dll -target:library -debug -unsafe -optimize \ + -publicsign -keyfile:$(PRODUCT_KEY_PATH) $(MACCATALYST_DEFINES) \ + -deterministic \ + $(ARGS_64) \ + -nowarn:219,618,114,414,1635,3021,$(IOS_WARNINGS_THAT_YOU_SHOULD_FIX) \ + @$(BUILD_DIR)/maccatalyst-defines.rsp \ + $(MACCATALYST_SOURCES) @$(MACCATALYST_BUILD_DIR)/maccatalyst/generated_sources + +$(MACCATALYST_BUILD_DIR)/reference/Xamarin.MacCatalyst.dll: $(MACCATALYST_BUILD_DIR)/maccatalyst-64/Xamarin.MacCatalyst.dll | $(MACCATALYST_BUILD_DIR)/reference + $(Q_STRIP) mono-cil-strip -q $< $@ + +$(MACCATALYST_BUILD_DIR)/reference/Xamarin.MacCatalyst.pdb: $(MACCATALYST_BUILD_DIR)/maccatalyst-64/Xamarin.MacCatalyst.pdb | $(MACCATALYST_BUILD_DIR)/reference + $(Q) $(CP) $< $@ + +# MonoTouch.NUnitLite +$(MACCATALYST_BUILD_DIR)/reference/MonoTouch.NUnitLite%dll $(MACCATALYST_BUILD_DIR)/reference/MonoTouch.NUnitLite%pdb: $(MACCATALYST_TOUCHUNIT_SOURCES) $(PRODUCT_KEY_PATH) $(MACCATALYST_BUILD_DIR)/reference/Xamarin.MacCatalyst.dll $(MACCATALYST_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll + $(call Q_PROF_CSC,maccatalyst) $(SYSTEM_CSC) -features:strict -nologo -r:$(MONOTOUCH_TV_MONO_PATH)/mscorlib.dll -out:$(basename $@).dll -target:library -debug:portable -optimize -noconfig -nostdlib -publicsign \ + -keyfile:$(PRODUCT_KEY_PATH) -r:$(MACCATALYST_BUILD_DIR)/reference/Xamarin.MacCatalyst.dll -r:$(MACCATALYST_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Xml.dll \ + -r:$(MONOTOUCH_TV_MONO_PATH)/System.Core.dll \ + -nowarn:3006,612,649,414,1635,659 \ + -define:NUNITLITE,CLR_4_0,NET_4_5,__MOBILE__,MONO $(MACCATALYST_DEFINES) \ + -define:XAMCORE_2_0,__UNIFIED__ \ + -deterministic \ + $(MACCATALYST_TOUCHUNIT_SOURCES) + +$(PROJECT_DIR)/xammaccatalyst.csproj: xammaccatalyst.tmpl.csproj Makefile $(wildcard $(TOP)/*.sources) + @sed -e 's**$(foreach file,$(MACCATALYST_SOURCES),)*' -e 's**$(foreach file,$(MACCATALYST_APIS),)*' $< | xmllint --format - > $@ + +$(PROJECT_DIR)/MonoTouch.NUnitLite.maccatalyst.csproj: MonoTouch.NUnitLite.maccatalyst.templ.csproj Makefile touch-unit.sources $(TOP)/Make.config $(TOP)/mk/mono.mk + $(Q) sed -e 's**$(foreach file,$(MACCATALYST_TOUCHUNIT_SOURCES),)*' $< | xmllint --format - > $@ + +# Type forwarder assembly from Xamarin.iOS.dll -> Xamarin.MacCatalyst.dll + +GENERATE_TYPE_FORWARDERS=generate-type-forwarders/bin/Debug/generate-type-forwarders.exe + +$(GENERATE_TYPE_FORWARDERS): $(wildcard generate-type-forwarders/*.cs*) Makefile + $(Q) $(SYSTEM_MSBUILD) /r generate-type-forwarders/generate-type-forwarders.csproj $(MSBUILD_VERBOSITY) + +$(MACCATALYST_BUILD_DIR)/reference/Xamarin.iOS.cs: $(MACCATALYST_BUILD_DIR)/reference/Xamarin.MacCatalyst.dll $(IOS_BUILD_DIR)/reference/Xamarin.iOS.dll Makefile $(GENERATE_TYPE_FORWARDERS) + $(Q) mono $(GENERATE_TYPE_FORWARDERS) $(IOS_BUILD_DIR)/reference/Xamarin.iOS.dll $(MACCATALYST_BUILD_DIR)/reference/Xamarin.MacCatalyst.dll $@.tmp + $(Q) mv $@.tmp $@ + +$(MACCATALYST_BUILD_DIR)/reference/Xamarin.iOS.dll: $(MACCATALYST_BUILD_DIR)/reference/Xamarin.iOS.cs + $(Q) $(MACCATALYST_CSC) $< -out:$@ -r:$(MACCATALYST_BUILD_DIR)/reference/Xamarin.MacCatalyst.dll -target:library -deterministic -publicsign -keyfile:$(PRODUCT_KEY_PATH) -nologo -nowarn:618 + +$(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.iOS.cs: $(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.MacCatalyst.dll $(IOS_DOTNET_BUILD_DIR)/ref/Xamarin.iOS.dll Makefile $(GENERATE_TYPE_FORWARDERS) + $(Q) mono $(GENERATE_TYPE_FORWARDERS) $(IOS_DOTNET_BUILD_DIR)/ref/Xamarin.iOS.dll $(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.MacCatalyst.dll $@.tmp + $(Q) mv $@.tmp $@ + +$(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.iOS.dll: $(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.iOS.cs + $(Q) $(SYSTEM_CSC) $(DOTNET_FLAGS) $< -out:$@ -r:$(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.MacCatalyst.dll -target:library -deterministic -publicsign -keyfile:$(PRODUCT_KEY_PATH) -nologo -nowarn:618 + +PROJECT_FILES += $(PROJECT_DIR)/xammaccatalyst.csproj $(PROJECT_DIR)/MonoTouch.NUnitLite.maccatalyst.csproj + +clean-maccatalyst: + $(Q) rm -rf $(MACCATALYST_BUILD_DIR) + $(Q) rm -f $(MACCATALYST_TARGETS) + +MACCATALYST_TARGETS_DIRS += \ + $(MACCATALYST_BUILD_DIR) \ + $(MACCATALYST_BUILD_DIR)/maccatalyst \ + $(MACCATALYST_BUILD_DIR)/maccatalyst-64 \ + $(MACCATALYST_BUILD_DIR)/reference \ + $(MACCATALYST_BUILD_DIR)/reference/Facades \ + $(MACCATALYST_BUILD_DIR)/NativeTypes \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/Facades \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/share/doc/Xamarin.MacCatalyst \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst \ + +MACCATALYST_TARGETS += \ + $(PROJECT_DIR)/xammaccatalyst.csproj \ + $(PROJECT_DIR)/MonoTouch.NUnitLite.maccatalyst.csproj \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/Xamarin.MacCatalyst.dll \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/Xamarin.MacCatalyst.pdb \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/Xamarin.iOS.dll \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst/Xamarin.MacCatalyst.dll \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst/Xamarin.MacCatalyst.pdb \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst/Xamarin.iOS.dll \ + +DOTNET_TARGETS += \ + $(MACCATALYST_DOTNET_BUILD_DIR)/64/Xamarin.MacCatalyst.dll \ + $(MACCATALYST_DOTNET_BUILD_DIR)/ref/Xamarin.MacCatalyst.dll \ + $(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Ref/ref/net6.0/Xamarin.MacCatalyst.dll \ + $(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Ref/ref/net6.0/Xamarin.iOS.dll \ + $(foreach rid,$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Runtime.$(rid)/runtimes/$(rid)/lib/net6.0/Xamarin.MacCatalyst.dll) \ + $(foreach rid,$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Runtime.$(rid)/runtimes/$(rid)/lib/net6.0/Xamarin.MacCatalyst.pdb) \ + +DOTNET_TARGETS_DIRS += \ + $(MACCATALYST_DOTNET_BUILD_DIR) \ + $(MACCATALYST_DOTNET_BUILD_DIR)/generated-sources \ + $(MACCATALYST_DOTNET_BUILD_DIR)/64 \ + $(MACCATALYST_DOTNET_BUILD_DIR)/ref \ + $(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Ref/ref/net6.0 \ + $(foreach rid,$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Runtime.$(rid)/runtimes/$(rid)/lib/net6.0) \ + +# reference assemblies, this is just for compilation with XS +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/%.dll: $(MACCATALYST_BUILD_DIR)/reference/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/Facades + $(Q) install -m 0755 $< $@ + +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/%.pdb: $(MACCATALYST_BUILD_DIR)/reference/%.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst + $(Q) install -m 0644 $< $@ + +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/%.config: $(MACCATALYST_BUILD_DIR)/reference/%.config | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst + $(Q) install -m 0644 $< $@ + +$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Ref/ref/net6.0/%.dll: $(MACCATALYST_DOTNET_BUILD_DIR)/ref/%.dll | $(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Ref/ref/net6.0 + $(Q) $(CP) $< $@ + +# the actual architecture-specific versions +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst/Xamarin.MacCatalyst.dll: $(MACCATALYST_BUILD_DIR)/maccatalyst-64/Xamarin.MacCatalyst.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst + $(Q) install -m 0755 $< $@ + +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst/Xamarin.MacCatalyst.pdb: $(MACCATALYST_BUILD_DIR)/maccatalyst-64/Xamarin.MacCatalyst.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst + $(Q) install -m 0644 $< $@ + +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst/Xamarin.iOS.dll: $(MACCATALYST_BUILD_DIR)/reference/Xamarin.iOS.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/MacCatalyst + $(Q) install -m 0755 $< $@ + +$(foreach rid,$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Runtime.$(rid)/runtimes/$(rid)/lib/net6.0/Xamarin.MacCatalyst.dll): $(MACCATALYST_DOTNET_BUILD_DIR)/64/Xamarin.MacCatalyst.dll | $(foreach rid,$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Runtime.$(rid)/runtimes/$(rid)/lib/net6.0) + $(Q) $(CP) $< $@ + +$(foreach rid,$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Runtime.$(rid)/runtimes/$(rid)/lib/net6.0/Xamarin.MacCatalyst.pdb): $(MACCATALYST_DOTNET_BUILD_DIR)/64/Xamarin.MacCatalyst.pdb | $(foreach rid,$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$(MACCATALYST_NUGET).Runtime.$(rid)/runtimes/$(rid)/lib/net6.0) + $(Q) $(CP) $< $@ + +$(MACCATALYST_TARGETS_DIRS): + $(Q) mkdir -p $@ + +all-maccatalyst: $(MACCATALYST_TARGETS) +install-maccatalyst: $(MACCATALYST_TARGETS) + +ifdef INCLUDE_MACCATALYST +ALL_TARGETS += all-maccatalyst +INSTALL_TARGETS += install-maccatalyst +endif + +### .NET ### + DOTNET_TARGETS += \ $(TVOS_DOTNET_BUILD_DIR)/64/Xamarin.TVOS.dll \ $(TVOS_DOTNET_BUILD_DIR)/ref/Xamarin.TVOS.dll \ diff --git a/src/Makefile.generator b/src/Makefile.generator index debdd934cc3c..a34dd1b7236c 100644 --- a/src/Makefile.generator +++ b/src/Makefile.generator @@ -49,7 +49,7 @@ DOTNET_TARGETS_DIRS += \ $(BUILD_DIR)/generator-frameworks.g.cs: frameworks.sources Makefile.generator generate-frameworks.csharp @mkdir -p $(dir $@) - $(Q) ./generate-frameworks.csharp $@.tmp '$(IOS_FRAMEWORKS)' '$(MAC_FRAMEWORKS)' '$(WATCHOS_FRAMEWORKS)' '$(TVOS_FRAMEWORKS)' + $(Q) ./generate-frameworks.csharp $@.tmp '$(IOS_FRAMEWORKS)' '$(MAC_FRAMEWORKS)' '$(WATCHOS_FRAMEWORKS)' '$(TVOS_FRAMEWORKS)' '$(MACCATALYST_FRAMEWORKS)' $(Q) mv $@.tmp $@ # This rule means: generate a -defines.rsp for the frameworks in the variable _FRAMEWORKS @@ -148,6 +148,21 @@ $(TVOS_BUILD_DIR)/Xamarin.TVOS.BindingAttributes.dll: generator-attributes.cs Ma $(Q) mkdir -p $(dir $@) $(Q_GEN) $(SYSTEM_CSC) -features:strict -nologo -debug -out:$@ -debug generator-attributes.cs -target:library -deterministic +# +# Xamarin.MacCatalyst +# + +MACCATALYST_TARGETS += \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.MacCatalyst.BindingAttributes.dll \ + +$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/%.dll: $(MACCATALYST_BUILD_DIR)/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen + $(Q) install -m 0755 $< $@ + $(Q) install -m 0644 $(<:.dll=.pdb) $(@:.dll=.pdb) + +$(MACCATALYST_BUILD_DIR)/Xamarin.MacCatalyst.BindingAttributes.dll: generator-attributes.cs Makefile.generator + $(Q) mkdir -p $(dir $@) + $(Q_GEN) $(SYSTEM_CSC) -features:strict -nologo -debug -out:$@ -debug generator-attributes.cs -target:library -deterministic + # # Xamarin.Mac (bmac) # @@ -201,6 +216,7 @@ install-bgen: \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.iOS.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.TVOS.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.WatchOS.BindingAttributes.dll \ + $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.MacCatalyst.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/bgen.exe \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bgen \ diff --git a/src/MediaPlayer/MediaPlayer.cs b/src/MediaPlayer/MediaPlayer.cs index 579de54ff70a..bd8c021139a0 100644 --- a/src/MediaPlayer/MediaPlayer.cs +++ b/src/MediaPlayer/MediaPlayer.cs @@ -319,6 +319,7 @@ public enum MPErrorCode : long { [NoTV] [NoWatch] [iOS (9,3)] + [MacCatalyst (13, 0)] [Native] public enum MPMediaLibraryAuthorizationStatus : long { NotDetermined = 0, @@ -331,6 +332,7 @@ public enum MPMediaLibraryAuthorizationStatus : long { [iOS (10,0)] [TV (10,0)] [Watch (5,0)] + [MacCatalyst (13, 0)] [Native] public enum MPNowPlayingInfoMediaType : ulong { @@ -341,8 +343,9 @@ public enum MPNowPlayingInfoMediaType : ulong [Mac (10,12,2)] [Watch (5,0)] - [NoiOS] - [NoTV] + [iOS (11, 0)] + [TV (11, 0)] + [MacCatalyst (13, 0)] [Native] public enum MPNowPlayingPlaybackState : ulong { diff --git a/src/MediaToolbox/MTAudioProcessingTap.cs b/src/MediaToolbox/MTAudioProcessingTap.cs index 00ab72599d05..94a0d7584bac 100644 --- a/src/MediaToolbox/MTAudioProcessingTap.cs +++ b/src/MediaToolbox/MTAudioProcessingTap.cs @@ -1,4 +1,4 @@ -#if IOS || TVOS || MONOMAC +#if HAS_MEDIATOOLBOX // // MTAudioProcessingTap.cs: Type wrapper for MTAudioProcessingTap // @@ -298,4 +298,4 @@ public delegate void MTAudioProcessingTapProcessDelegate (MTAudioProcessingTap t public class AudioBufferList {} #endif } -#endif // IOS || TVOS +#endif // HAS_MEDIATOOLBOX diff --git a/src/Metal/MTLEnums.cs b/src/Metal/MTLEnums.cs index 6ab1edcc5f5a..80acf9ae07f2 100644 --- a/src/Metal/MTLEnums.cs +++ b/src/Metal/MTLEnums.cs @@ -1089,17 +1089,17 @@ public enum MTLMultisampleStencilResolveFilter : ulong DepthResolvedSample = 1, } - [Unavailable (PlatformName.MacCatalyst)] + [Flags, Mac (11,0), NoTV, iOS (13,0)] - [Native, Advice ("This API is not available when using UIKit on macOS.")] + [Native] public enum MTLSparseTextureRegionAlignmentMode : ulong { Outward = 0x0, Inward = 0x1, } - [Unavailable (PlatformName.MacCatalyst)] [Flags, Mac (11,0), NoTV, iOS (13,0)] - [Native, Advice ("This API is not available when using UIKit on macOS.")] + [MacCatalyst (14, 0)] + [Native] public enum MTLSparseTextureMappingMode : ulong { Map = 0x0, Unmap = 0x1, diff --git a/src/MetalPerformanceShaders/MPSMatrixDescriptor.cs b/src/MetalPerformanceShaders/MPSMatrixDescriptor.cs index 2e5babbb0551..07f631b81072 100644 --- a/src/MetalPerformanceShaders/MPSMatrixDescriptor.cs +++ b/src/MetalPerformanceShaders/MPSMatrixDescriptor.cs @@ -1,4 +1,4 @@ -#if !MONOMAC && !XAMCORE_4_0 +#if !MONOMAC && !XAMCORE_4_0 && !__MACCATALYST__ using System; using Metal; using Foundation; diff --git a/src/MonoTouch.NUnitLite.maccatalyst.templ.csproj b/src/MonoTouch.NUnitLite.maccatalyst.templ.csproj new file mode 100644 index 000000000000..7f75978499b7 --- /dev/null +++ b/src/MonoTouch.NUnitLite.maccatalyst.templ.csproj @@ -0,0 +1,46 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + + MonoTouch.NUnitLite + True + NUNITLITE;CLR_4_0;NET_4_5;XAMCORE_2_0;MONOTOUCH;MONO + build\maccatalyst\reference + $(OutputPath) + true + ..\product.snk + false + + + true + full + false + prompt + 4 + true + True + + + none + false + prompt + 4 + true + + + + + + + + + + + \ No newline at end of file diff --git a/src/ObjCRuntime/PlatformAvailability2.cs b/src/ObjCRuntime/PlatformAvailability2.cs index c42b53a570d6..511832fd8825 100644 --- a/src/ObjCRuntime/PlatformAvailability2.cs +++ b/src/ObjCRuntime/PlatformAvailability2.cs @@ -263,6 +263,19 @@ public WatchAttribute (byte major, byte minor, byte subminor, bool onlyOn64) #endif } + public sealed class MacCatalystAttribute : IntroducedAttribute + { + public MacCatalystAttribute (byte major, byte minor) + : base (PlatformName.MacCatalyst, (int) major, (int) minor) + { + } + + public MacCatalystAttribute (byte major, byte minor, byte subminor) + : base (PlatformName.MacCatalyst, (int) major, (int) minor, subminor) + { + } + } + public sealed class NoMacAttribute : UnavailableAttribute { public NoMacAttribute () @@ -294,5 +307,13 @@ public NoTVAttribute () { } } + + public sealed class NoMacCatalystAttribute : UnavailableAttribute + { + public NoMacCatalystAttribute () + : base (PlatformName.MacCatalyst) + { + } + } } diff --git a/src/ObjCRuntime/Registrar.cs b/src/ObjCRuntime/Registrar.cs index 1fa7a6499753..c127f24719ae 100644 --- a/src/ObjCRuntime/Registrar.cs +++ b/src/ObjCRuntime/Registrar.cs @@ -1273,6 +1273,8 @@ internal string AssemblyName return "Xamarin.TVOS"; case ApplePlatform.MacOSX: return "Xamarin.Mac"; + case ApplePlatform.MacCatalyst: + return "Xamarin.MacCatalyst"; default: throw ErrorHelper.CreateError (71, Errors.MX0071, App.Platform, App.ProductName); } @@ -1284,6 +1286,8 @@ internal string AssemblyName internal const string AssemblyName = "Xamarin.WatchOS"; #elif TVOS internal const string AssemblyName = "Xamarin.TVOS"; +#elif __MACCATALYST__ + internal const string AssemblyName = "Xamarin.MacCatalyst"; #elif IOS internal const string AssemblyName = "Xamarin.iOS"; #else diff --git a/src/SceneKit/SCNCompat.cs b/src/SceneKit/SCNCompat.cs index c0a1dbe01c64..3467ead6063f 100644 --- a/src/SceneKit/SCNCompat.cs +++ b/src/SceneKit/SCNCompat.cs @@ -149,7 +149,7 @@ public SCNHitTestSearchMode? OptionSearchMode { } } -#if !MONOMAC && !WATCH +#if !MONOMAC && !WATCH && !__MACCATALYST__ public partial class SCNView { [Watch (6,0), TV (13,0), iOS (13,0)] [Obsolete ("Empty stub. (not a public API).")] diff --git a/src/SceneKit/SCNRenderingOptions.cs b/src/SceneKit/SCNRenderingOptions.cs index e9cf7e838fa9..6eaec96f2cdf 100644 --- a/src/SceneKit/SCNRenderingOptions.cs +++ b/src/SceneKit/SCNRenderingOptions.cs @@ -1,4 +1,4 @@ -#if !WATCH +#if !WATCH && !__MACCATALYST__ using System; using ObjCRuntime; diff --git a/src/UIKit/NSLayoutManager.cs b/src/UIKit/NSLayoutManager.cs index 92efd00f5cd4..056cccfe805c 100644 --- a/src/UIKit/NSLayoutManager.cs +++ b/src/UIKit/NSLayoutManager.cs @@ -79,7 +79,7 @@ public unsafe nuint GetGlyphs ( } } -#if !XAMCORE_4_0 +#if !XAMCORE_4_0 && !__MACCATALYST__ #if MONOMAC [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use the overload that takes 'nint glyphCount' instead.")] [Deprecated (PlatformName.iOS, 13, 0, message: "Use the overload that takes 'nint glyphCount' instead.")] diff --git a/src/UIKit/UIKeyboard.cs b/src/UIKit/UIKeyboard.cs index 6a359bac9c05..b6dac2a8dac6 100644 --- a/src/UIKit/UIKeyboard.cs +++ b/src/UIKit/UIKeyboard.cs @@ -22,7 +22,7 @@ static CGRect RectangleFFrom (NSObject key, NSNotification n) return CGRect.Empty; } -#if !TVOS +#if !TVOS && !__MACCATALYST__ [Deprecated (PlatformName.iOS, 3, 2)] public static CGRect BoundsFromNotification (NSNotification n) { @@ -60,7 +60,7 @@ static CGPoint PointFFrom (NSObject key, NSNotification n) return val.CGPointValue; } -#if !TVOS +#if !TVOS && !__MACCATALYST__ [Deprecated (PlatformName.iOS, 3, 2)] static public CGPoint CenterBeginFromNotification (NSNotification n) { diff --git a/src/VideoSubscriberAccount/VSAccountManager.cs b/src/VideoSubscriberAccount/VSAccountManager.cs index a6f4fe280a7a..f772cb85fe2f 100644 --- a/src/VideoSubscriberAccount/VSAccountManager.cs +++ b/src/VideoSubscriberAccount/VSAccountManager.cs @@ -7,7 +7,7 @@ // Copyright 2016 Xamarin Inc. All rights reserved. // -#if !MONOMAC +#if !MONOMAC && !__MACCATALYST__ using System; using System.Threading.Tasks; diff --git a/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs b/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs index 1ff1564cb077..289f04d0a276 100644 --- a/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs +++ b/src/VideoSubscriberAccount/VSAccountMetadataRequest.cs @@ -1,3 +1,4 @@ +#if !__MACCATALYST__ using System; using System.Threading.Tasks; using ObjCRuntime; @@ -17,3 +18,4 @@ public VSAccountProviderAuthenticationScheme[] SupportedAuthenticationSchemes { } } } +#endif // !__MACCATALYST__ diff --git a/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs b/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs index f03cc9f9c108..49f7265efc28 100644 --- a/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs +++ b/src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs @@ -1,3 +1,4 @@ +#if !__MACCATALYST__ using System; using System.Threading.Tasks; using Foundation; @@ -31,3 +32,4 @@ public static VSAccountProviderAuthenticationScheme[] GetValues (NSString[] cons } } } +#endif // !__MACCATALYST__ diff --git a/src/avfoundation.cs b/src/avfoundation.cs index c5bec9205777..2c35fc3ac93a 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -3347,6 +3347,7 @@ interface AVSampleBufferAudioRenderer : AVQueuedSampleBufferRendering NSError Error { get; } [NullAllowed, Export ("audioOutputDeviceUniqueID"), NoWatch, NoTV, NoiOS] + [NoMacCatalyst] string AudioOutputDeviceUniqueId { get; set; } [Export ("audioTimePitchAlgorithm")] diff --git a/src/avkit.cs b/src/avkit.cs index c8b87db62469..b84668ce3b62 100644 --- a/src/avkit.cs +++ b/src/avkit.cs @@ -10,6 +10,9 @@ using CoreMedia; using CoreVideo; using AVFoundation; +#if HAS_OPENGLES +using OpenGLES; +#endif #if !MONOMAC using AVCaptureViewControlsStyle = Foundation.NSObject; using AVPlayerViewControlsStyle = Foundation.NSObject; @@ -17,7 +20,6 @@ using NSColor = UIKit.UIColor; using NSMenu = Foundation.NSObject; using NSView = UIKit.UIView; -using OpenGLES; using UIKit; #else using AppKit; diff --git a/src/btouch.cs b/src/btouch.cs index 8ded6f5f169f..100d816c2ac8 100644 --- a/src/btouch.cs +++ b/src/btouch.cs @@ -105,6 +105,8 @@ string GetAttributeLibraryPath () return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.WatchOS.BindingAttributes.dll"); case PlatformName.TvOS: return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.TVOS.BindingAttributes.dll"); + case PlatformName.MacCatalyst: + return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.MacCatalyst.BindingAttributes.dll"); case PlatformName.MacOSX: if (target_framework == TargetFramework.Xamarin_Mac_4_5_Full) { return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.Mac-full.BindingAttributes.dll"); @@ -133,6 +135,9 @@ IEnumerable GetLibraryDirectories () case PlatformName.TvOS: yield return Path.Combine (GetSDKRoot (), "lib", "mono", "Xamarin.TVOS"); break; + case PlatformName.MacCatalyst: + yield return Path.Combine (GetSDKRoot (), "lib", "mono", "Xamarin.MacCatalyst"); + break; case PlatformName.MacOSX: if (target_framework == TargetFramework.Xamarin_Mac_4_5_Full) { yield return Path.Combine (GetSDKRoot (), "lib", "reference", "full"); @@ -186,6 +191,7 @@ string GetSDKRoot () case PlatformName.iOS: case PlatformName.WatchOS: case PlatformName.TvOS: + case PlatformName.MacCatalyst: var sdkRoot = Environment.GetEnvironmentVariable ("MD_MTOUCH_SDK_ROOT"); if (string.IsNullOrEmpty (sdkRoot)) sdkRoot = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current"; @@ -371,6 +377,16 @@ int Main3 (string [] args) ReferenceFixer.FixSDKReferences (GetSDKRoot (), "lib/mono/Xamarin.WatchOS", references); } break; + case ApplePlatform.MacCatalyst: + CurrentPlatform = PlatformName.MacCatalyst; + nostdlib = true; + if (string.IsNullOrEmpty (baselibdll)) + baselibdll = Path.Combine (GetSDKRoot (), "lib/mono/Xamarin.MacCatalyst/Xamarin.MacCatalyst.dll"); + if (!IsDotNet) { + // references.Add ("Facades/System.Drawing.Common"); + ReferenceFixer.FixSDKReferences (GetSDKRoot (), "lib/mono/Xamarin.MacCatalyst", references); + } + break; case ApplePlatform.MacOSX: CurrentPlatform = PlatformName.MacOSX; nostdlib = true; diff --git a/src/fileprovider.cs b/src/fileprovider.cs index f3fac4b8fb0e..08e26ec7edb9 100644 --- a/src/fileprovider.cs +++ b/src/fileprovider.cs @@ -15,7 +15,7 @@ using Foundation; using UniformTypeIdentifiers; -#if IOS && !XAMCORE_4_0 +#if IOS && !XAMCORE_4_0 && !__MACCATALYST__ using FileProvider; // This is the original (iOS 8) location of `NSFileProviderExtension` @@ -215,7 +215,7 @@ interface NSFileProviderFavoriteRank { [iOS (11,0)] [Mac (11,0)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Static] interface NSFileProviderItemIdentifier { @@ -232,7 +232,7 @@ interface NSFileProviderItemIdentifier { [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Native] [Flags] enum NSFileProviderItemCapabilities : ulong { @@ -258,7 +258,7 @@ enum NSFileProviderItemCapabilities : ulong { [iOS (11,0)] [Mac (11,0)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Static] interface NSFileProviderPage { @@ -326,7 +326,7 @@ interface INSFileProviderEnumerationObserver { } [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderEnumerationObserver { @@ -352,7 +352,7 @@ interface INSFileProviderChangeObserver { } [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderChangeObserver { @@ -382,7 +382,7 @@ interface INSFileProviderEnumerator { } [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderEnumerator { @@ -405,7 +405,7 @@ interface INSFileProviderItem { } [iOS (11,0)] [Mac (10,15)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using Catalyst on macOS.")] + [MacCatalyst (13, 0)] [Protocol] interface NSFileProviderItem { diff --git a/src/foundation.cs b/src/foundation.cs index da3a32da7b64..11f187616f98 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -4075,18 +4075,21 @@ interface NSError : NSSecureCoding, NSCopying { [iOS (11,0)] [Mac (10,15)] + [NoMacCatalyst] [Static] [Export ("fileProviderErrorForCollisionWithItem:")] NSError GetFileProviderError (INSFileProviderItem existingItem); [iOS (11,0)] [Mac (10,15)] + [NoMacCatalyst] [Static] [Export ("fileProviderErrorForNonExistentItemWithIdentifier:")] NSError GetFileProviderError (string nonExistentItemIdentifier); [NoiOS] [Mac (11,0)] + [NoMacCatalyst] [Static] [Export ("fileProviderErrorForRejectedDeletionOfItem:")] NSError GetFileProviderErrorForRejectedDeletion (INSFileProviderItem updatedVersion); diff --git a/src/frameworks.sources b/src/frameworks.sources index eef85dba7eb0..babe7c930df9 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -5,6 +5,7 @@ # Xamarin.Mac: XamMac.dll and Xamarin.Mac.dll # Xamarin.WatchOS: Xamarin.WatchOS.dll # Xamarin.TVOS: Xamarin.TVOS.dll +# Xamarin.MacCatalyst: Xamarin.MacCatalyst.dll # # First we build an assembly that contains the bare-bones code required # to compile the bindings. This is core.dll, and the source code is listed @@ -2130,6 +2131,103 @@ TVOS_FRAMEWORKS = \ VideoToolbox \ Vision \ +MACCATALYST_FRAMEWORKS = \ + $(COMMON_FRAMEWORKS) \ + AVKit \ + Accounts \ + AdSupport \ + AddressBook \ + AddressBookUI \ + AppClip \ + AppTrackingTransparency \ + ARKit \ + AssetsLibrary \ + AudioToolbox \ + AudioUnit \ + AutomaticAssessmentConfiguration \ + BackgroundTasks \ + BusinessChat \ + CallKit \ + CarPlay \ + CFNetwork \ + ClassKit \ + CloudKit \ + Contacts \ + ContactsUI \ + CoreAnimation \ + CoreAudioKit \ + CoreGraphics \ + CoreHaptics \ + CoreImage \ + CoreLocation \ + CoreMIDI \ + CoreMotion \ + CoreNFC \ + CoreSpotlight \ + CoreTelephony \ + CoreText \ + DeviceCheck \ + EventKit \ + EventKitUI \ + ExternalAccessory \ + FileProvider \ + GameController \ + GameplayKit \ + HealthKit \ + HealthKitUI \ + HomeKit \ + IdentityLookup \ + IdentityLookupUI \ + ImageIO \ + Intents \ + IntentsUI \ + IOSurface \ + JavaScriptCore \ + LinkPresentation \ + LocalAuthentication \ + MapKit \ + MediaAccessibility \ + MediaPlayer \ + MediaToolbox \ + Messages \ + MessageUI \ + Metal \ + MetalKit \ + MetalPerformanceShaders \ + MetricKit \ + MLCompute \ + MobileCoreServices \ + ModelIO \ + MultipeerConnectivity \ + NearbyInteraction \ + NetworkExtension \ + PassKit \ + PdfKit \ + PencilKit \ + Photos \ + PhotosUI \ + PushKit \ + QuickLook \ + QuickLookThumbnailing \ + ReplayKit \ + SafariServices \ + ScreenTime \ + Security \ + SensorKit \ + Social \ + Speech \ + SystemConfiguration \ + UIKit XKit \ + UserNotifications \ + UserNotificationsUI \ + VideoToolbox \ + VideoSubscriberAccount \ + Vision \ + VisionKit \ + WatchConnectivity \ + WKWebKit \ + iAd \ + # # Compute the SOURCES variables. # @@ -2153,3 +2251,8 @@ TVOS_CORE_SOURCES := $(foreach framework,$(shell echo $(TVOS_FRAMEWORKS) | t TVOS_API_SOURCES := $(foreach framework,$(shell echo $(TVOS_FRAMEWORKS) | tr '[:lower:]' '[:upper:]'),$($(framework)_API_SOURCES)) $(SHARED_API_SOURCES) TVOS_APIS := $(foreach framework,$(shell echo $(TVOS_FRAMEWORKS) | tr '[:upper:]' '[:lower:]'),$(framework).cs) $(TVOS_API_SOURCES) TVOS_SOURCES := $(foreach framework,$(shell echo $(TVOS_FRAMEWORKS) | tr '[:lower:]' '[:upper:]'),$($(framework)_SOURCES)) $(SHARED_SOURCES) $(TVOS_CORE_SOURCES) + +MACCATALYST_CORE_SOURCES := $(foreach framework,$(shell echo $(MACCATALYST_FRAMEWORKS) | tr '[:lower:]' '[:upper:]'),$($(framework)_CORE_SOURCES)) $(SHARED_CORE_SOURCES) +MACCATALYST_API_SOURCES := $(foreach framework,$(shell echo $(MACCATALYST_FRAMEWORKS) | tr '[:lower:]' '[:upper:]'),$($(framework)_API_SOURCES)) $(SHARED_API_SOURCES) +MACCATALYST_APIS := $(foreach framework,$(shell echo $(MACCATALYST_FRAMEWORKS) | tr '[:upper:]' '[:lower:]'),$(framework).cs) $(MACCATALYST_API_SOURCES) +MACCATALYST_SOURCES := $(foreach framework,$(shell echo $(MACCATALYST_FRAMEWORKS) | tr '[:lower:]' '[:upper:]'),$($(framework)_SOURCES)) $(SHARED_SOURCES) $(MACCATALYST_CORE_SOURCES) diff --git a/src/gamekit.cs b/src/gamekit.cs index ac57a9b09b09..176a91e64920 100644 --- a/src/gamekit.cs +++ b/src/gamekit.cs @@ -1700,6 +1700,7 @@ interface GKFriendRequestComposeViewController : GKViewController { #else [NoTV] [Deprecated (PlatformName.iOS, 10, 0)] + [NoMacCatalyst] [BaseType (typeof (UINavigationController), Events=new Type [] { typeof (GKFriendRequestComposeViewControllerDelegate)}, Delegates=new string[] {"WeakComposeViewDelegate"})] interface GKFriendRequestComposeViewController : UIAppearance { #endif @@ -1738,6 +1739,7 @@ interface GKFriendRequestComposeViewController : UIAppearance { [BaseType (typeof (NSObject))] [Deprecated (PlatformName.iOS, 10,0)] [Deprecated (PlatformName.MacOSX, 10,12)] + [NoMacCatalyst] [Model] [Protocol] interface GKFriendRequestComposeViewControllerDelegate { diff --git a/src/generate-frameworks.csharp b/src/generate-frameworks.csharp index e83dafa85299..d972ca97ee75 100755 --- a/src/generate-frameworks.csharp +++ b/src/generate-frameworks.csharp @@ -6,7 +6,7 @@ using System.Text; try { var args = Environment.GetCommandLineArgs (); var defaultArgumentCount = 3; - var actualArgumentCount = 5; + var actualArgumentCount = 6; if (args.Length != defaultArgumentCount + actualArgumentCount) { Console.WriteLine ($"Need {actualArgumentCount} arguments, got {args.Length - defaultArgumentCount} arguments"); Environment.Exit (1); @@ -23,8 +23,21 @@ try { var macosframeworks = args [1].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var watchosframeworks = args [2].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var tvosframeworks = args [3].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var allframeworks = new string [] [] { iosframeworks, macosframeworks, watchosframeworks, tvosframeworks }; - var names = new string [] { "iosframeworks", "macosframeworks", "watchosframeworks", "tvosframeworks" }; + var maccatalystframeworks = args [4].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var allframeworks = new string [] [] { + iosframeworks, + macosframeworks, + watchosframeworks, + tvosframeworks, + maccatalystframeworks, + }; + var names = new string [] { + "iosframeworks", + "macosframeworks", + "watchosframeworks", + "tvosframeworks", + "maccatalystframeworks", + }; var all = new HashSet (); foreach (var fws in allframeworks) diff --git a/src/generate-type-forwarders/Program.cs b/src/generate-type-forwarders/Program.cs new file mode 100644 index 000000000000..6d245a815e67 --- /dev/null +++ b/src/generate-type-forwarders/Program.cs @@ -0,0 +1,62 @@ +using System; +using System.IO; +using System.Linq; +using System.Text; + +using Mono.Cecil; + +namespace GenerateTypeForwarders { + class MainClass { + public static int Main (string [] args) + { + var forwardFrom = args [0]; + var forwardTo = args [1]; + var output = args [2]; + return Fix (forwardFrom, forwardTo, output); + } + + static int Fix (string forwardFrom, string forwardTo, string output) + { + var from = AssemblyDefinition.ReadAssembly (forwardFrom); + var to = AssemblyDefinition.ReadAssembly (forwardTo); + var sb = new StringBuilder (); + + sb.AppendLine ("using System.Runtime.CompilerServices;"); + foreach (var type in from.MainModule.Types) { + if (type.IsNotPublic) + continue; + + var toType = to.MainModule.GetType (type.FullName); + if (toType == null) { + // FIXME: emit a class that throws PlatformNotSupportedExceptions + sb.AppendLine ($"// Can't forward to {type.FullName}, it doesn't exist in the target assembly"); + continue; + } else if (toType.IsNotPublic) { + // FIXME: emit a class that throws PlatformNotSupportedExceptions + sb.AppendLine ($"// Can't forward to {type.FullName}, it's not public in the target assembly"); + continue; + } + + sb.Append ($"[assembly: TypeForwardedToAttribute (typeof ("); + sb.Append (type.Namespace); + sb.Append ("."); + + if (type.HasGenericParameters) { + var nonGeneric = type.Name.Substring (0, type.Name.IndexOf ('`')); + sb.Append (nonGeneric); + sb.Append ('<'); + for (var i = 1; i < type.GenericParameters.Count; i++) + sb.Append (','); + sb.Append ('>'); + } else { + sb.Append (type.Name); + } + sb.AppendLine ("))]"); + } + File.WriteAllText (output, sb.ToString ()); + Console.WriteLine ($"Created type forwarders: {output}"); + return 0; + } + } +} + diff --git a/src/generate-type-forwarders/generate-type-forwarders.csproj b/src/generate-type-forwarders/generate-type-forwarders.csproj new file mode 100644 index 000000000000..51b6505c4c3b --- /dev/null +++ b/src/generate-type-forwarders/generate-type-forwarders.csproj @@ -0,0 +1,39 @@ + + + + Debug + anycpu + {7E25BC67-7748-4403-B3E5-1737602064EF} + Exe + generatetypeforwarders + generate-type-forwarders + v4.7.2 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + true + bin\Release + prompt + 4 + true + + + + + + + + + + + + \ No newline at end of file diff --git a/src/generate-type-forwarders/generate-type-forwarders.sln b/src/generate-type-forwarders/generate-type-forwarders.sln new file mode 100644 index 000000000000..c58043c12141 --- /dev/null +++ b/src/generate-type-forwarders/generate-type-forwarders.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.808.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generate-type-forwarders", "generate-type-forwarders.csproj", "{7E25BC67-7748-4403-B3E5-1737602064EF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|anycpu = Debug|anycpu + Release|anycpu = Release|anycpu + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E25BC67-7748-4403-B3E5-1737602064EF}.Debug|anycpu.ActiveCfg = Debug|anycpu + {7E25BC67-7748-4403-B3E5-1737602064EF}.Debug|anycpu.Build.0 = Debug|anycpu + {7E25BC67-7748-4403-B3E5-1737602064EF}.Release|anycpu.ActiveCfg = Release|anycpu + {7E25BC67-7748-4403-B3E5-1737602064EF}.Release|anycpu.Build.0 = Release|anycpu + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DCAC0510-C3C5-461F-BAB6-9A3D031EB2B9} + EndGlobalSection +EndGlobal diff --git a/src/generator-attribute-manager.cs b/src/generator-attribute-manager.cs index 10a962d1d176..d4f8f7032164 100644 --- a/src/generator-attribute-manager.cs +++ b/src/generator-attribute-manager.cs @@ -261,6 +261,8 @@ Type ConvertType (System.Type type, ICustomAttributeProvider provider) return AttributeConversionManager.ConvertPlatformAttribute (attribute, PlatformName.WatchOS).Yield (); case "TVAttribute": return AttributeConversionManager.ConvertPlatformAttribute (attribute, PlatformName.TvOS).Yield (); + case "MacCatalystAttribute": + return AttributeConversionManager.ConvertPlatformAttribute (attribute, PlatformName.MacCatalyst).Yield (); case "LionAttribute": return AttributeFactory.CreateNewIntroducedAttribute (PlatformName.MacOSX, 10, 7).Yield (); case "MountainLionAttribute": @@ -275,6 +277,8 @@ Type ConvertType (System.Type type, ICustomAttributeProvider provider) return AttributeFactory.CreateUnavailableAttribute (PlatformName.WatchOS).Yield (); case "NoTVAttribute": return AttributeFactory.CreateUnavailableAttribute (PlatformName.TvOS).Yield (); + case "NoMacCatalystAttribute": + return AttributeFactory.CreateUnavailableAttribute (PlatformName.MacCatalyst).Yield (); case "AvailabilityAttribute": return AttributeConversionManager.ConvertAvailability (attribute); default: diff --git a/src/generator.cs b/src/generator.cs index 81e79b379065..c5b4c7ed50ff 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -94,11 +94,27 @@ public static Type GetBaseType (Type type, Generator generator) // public static bool IsUnavailable (this ICustomAttributeProvider provider, Generator generator) { - return generator.AttributeManager.GetCustomAttributes (provider) - .Any (attr => attr.AvailabilityKind == AvailabilityKind.Unavailable && - attr.Platform == generator.CurrentPlatform); + var attributes = generator.AttributeManager.GetCustomAttributes (provider); + var platform = generator.CurrentPlatform; + return IsUnavailable (attributes, platform); } + public static bool IsUnavailable (AvailabilityBaseAttribute[] attributes, PlatformName platform) + { + if (attributes.Any (attr => attr.AvailabilityKind == AvailabilityKind.Unavailable && attr.Platform == platform)) + return true; + + if (platform == PlatformName.MacCatalyst) { + // If we're targetting Mac Catalyst, and we don't have any availability information for Mac Catalyst, + // then use the availability for iOS + var anyCatalyst = attributes.Any (v => v.Platform == PlatformName.MacCatalyst); + if (!anyCatalyst) + return IsUnavailable (attributes, PlatformName.iOS); + } + + return false; + } + public static AvailabilityBaseAttribute GetAvailability (this ICustomAttributeProvider attrProvider, AvailabilityKind availabilityKind, Generator generator) { return generator.AttributeManager.GetCustomAttributes (attrProvider) @@ -822,6 +838,9 @@ bool GetValue (string framework) case PlatformName.MacOSX: frameworks = macosframeworks; break; + case PlatformName.MacCatalyst: + frameworks = maccatalystframeworks; + break; default: throw new BindingException (1047, CurrentPlatform); } @@ -871,6 +890,7 @@ public string ApplicationClassName { case PlatformName.iOS: case PlatformName.WatchOS: case PlatformName.TvOS: + case PlatformName.MacCatalyst: return "UIApplication"; case PlatformName.MacOSX: return "NSApplication"; @@ -972,6 +992,7 @@ string CoreImageMap { case PlatformName.iOS: case PlatformName.WatchOS: case PlatformName.TvOS: + case PlatformName.MacCatalyst: return "CoreImage"; case PlatformName.MacOSX: return "Quartz"; @@ -987,6 +1008,7 @@ string CoreServicesMap { case PlatformName.iOS: case PlatformName.WatchOS: case PlatformName.TvOS: + case PlatformName.MacCatalyst: return "MobileCoreServices"; case PlatformName.MacOSX: return "CoreServices"; @@ -1000,6 +1022,7 @@ string PDFKitMap { get { switch (CurrentPlatform) { case PlatformName.iOS: + case PlatformName.MacCatalyst: return "PDFKit"; case PlatformName.MacOSX: return "Quartz"; @@ -6250,6 +6273,8 @@ string GetAssemblyName () return "Xamarin.TVOS"; case ApplePlatform.WatchOS: return "Xamarin.WatchOS"; + case ApplePlatform.MacCatalyst: + return "Xamarin.MacCatalyst"; default: throw ErrorHelper.CreateError (1053, /* Internal error: unknown target framework '{0}'. */ BindingTouch.TargetFramework); } diff --git a/src/generator.csproj b/src/generator.csproj index 4d46a6ee3759..4f722eed4d5c 100644 --- a/src/generator.csproj +++ b/src/generator.csproj @@ -48,6 +48,14 @@ + + Project + @build/$(RunConfiguration).rsp + $(ProjectDir) + + + + Project @build/$(RunConfiguration).rsp diff --git a/src/homekit.cs b/src/homekit.cs index eca5629479b4..4f58426cd785 100644 --- a/src/homekit.cs +++ b/src/homekit.cs @@ -81,6 +81,7 @@ partial interface HMHomeManagerDelegate { void DidRemoveHome (HMHomeManager manager, HMHome home); [iOS (13,0), NoWatch, NoTV, NoMac] + [NoMacCatalyst] [Export("homeManager:didReceiveAddAccessoryRequest:"), EventArgs ("HMHomeManagerAddAccessoryRequest")] void DidReceiveAddAccessoryRequest (HMHomeManager manager, HMAddAccessoryRequest request); @@ -222,6 +223,7 @@ partial interface HMAccessoryDelegate { // __WATCHOS_PROHIBITED [NoTV] [iOS (8,0)] + [NoMacCatalyst] [BaseType (typeof (NSObject), Delegates=new string[] {"WeakDelegate"}, Events=new Type[] {typeof(HMAccessoryBrowserDelegate)})] partial interface HMAccessoryBrowser { @@ -245,6 +247,7 @@ partial interface HMAccessoryBrowser { [NoTV] [iOS (8,0)] + [NoMacCatalyst] [Model, Protocol] [BaseType (typeof (NSObject))] partial interface HMAccessoryBrowserDelegate { @@ -1700,6 +1703,7 @@ interface HMAccessoryOwnershipToken { } [iOS (13,0), NoWatch, NoMac, NoTV] + [NoMacCatalyst] [BaseType (typeof(NSObject))] [DisableDefaultCtor] interface HMAddAccessoryRequest { diff --git a/src/metal.cs b/src/metal.cs index 60a722ef8b5d..90763319adbf 100644 --- a/src/metal.cs +++ b/src/metal.cs @@ -1401,13 +1401,11 @@ partial interface MTLDevice { [Introduced (PlatformName.MacCatalyst, 14, 0)] [Mac (11,0), NoTV, iOS (13,0)] - [Advice ("This API is not available when using UIKit on macOS.")] [Export ("convertSparseTileRegions:toPixelRegions:withTileSize:numRegions:")] void ConvertSparseTileRegions (IntPtr tileRegions, IntPtr pixelRegions, MTLSize tileSize, nuint numRegions); [Introduced (PlatformName.MacCatalyst, 14, 0)] [Mac (11,0), NoTV, iOS (13,0)] - [Advice ("This API is not available when using UIKit on macOS.")] [Export ("convertSparsePixelRegions:toTileRegions:withTileSize:alignmentMode:numRegions:")] void ConvertSparsePixelRegions (IntPtr pixelRegions, IntPtr tileRegions, MTLSize tileSize, MTLSparseTextureRegionAlignmentMode mode, nuint numRegions); diff --git a/src/scenekit.cs b/src/scenekit.cs index e1beb1344265..fb14c2a8cd68 100644 --- a/src/scenekit.cs +++ b/src/scenekit.cs @@ -67,14 +67,17 @@ #else using UIKit; +#if HAS_OPENGLES +using OpenGLES; +using GLContext = global::OpenGLES.EAGLContext; +#else +using GLContext = global::Foundation.NSObject; // won't be used -> but must compile +#endif + #if WATCH -using GLContext = global::Foundation.NSObject; // won't be used -> [NoWatch] but must compile using NSView = global::Foundation.NSObject; // won't be used -> [NoWatch] but must compile using SCNGeometryTessellator = global::Foundation.NSObject; // won't be used -> [NoWatch] but must compile #else -using OpenGLES; - -using GLContext = global::OpenGLES.EAGLContext; using NSView = global::UIKit.UIView; #endif @@ -2546,6 +2549,7 @@ interface SCNRenderer : SCNSceneRenderer, SCNTechniqueSupport { SCNRenderer FromContext (IntPtr context, [NullAllowed] NSDictionary options); [NoWatch] + [NoMacCatalyst] [Static] [Wrap ("FromContext (context.GetHandle (), options)")] // GetHandle will return IntPtr.Zero is context is null @@ -3478,7 +3482,7 @@ interface SCNView : SCNSceneRenderer, SCNTechniqueSupport { [Export ("pixelFormat", ArgumentSemantic.Retain)] [NullAllowed] NSOpenGLPixelFormat PixelFormat { get; set; } -#elif !WATCH +#elif !WATCH && !__MACCATALYST__ [Deprecated (PlatformName.iOS, 12, 0, message: "Please use Metal instead of OpenGL API.")] [Deprecated (PlatformName.TvOS, 12, 0, message: "Please use Metal instead of OpenGL API.")] [Export ("eaglContext", ArgumentSemantic.Retain)] @@ -3532,6 +3536,7 @@ interface SCNView : SCNSceneRenderer, SCNTechniqueSupport { bool RendersContinuously { get; set; } [NoWatch, NoTV, Mac (10,15), NoiOS] + [NoMacCatalyst] [Export ("drawableResizesAsynchronously")] bool DrawableResizesAsynchronously { get; set; } } diff --git a/src/videosubscriberaccount.cs b/src/videosubscriberaccount.cs index 9a9f0542a33a..7d6d3b4c049d 100644 --- a/src/videosubscriberaccount.cs +++ b/src/videosubscriberaccount.cs @@ -76,6 +76,7 @@ interface VSErrorInfoKeys { [iOS (10, 0)] [TV (10, 0)] [Mac (10,14)] + [NoMacCatalyst] [Unavailable (PlatformName.WatchOS)] [StrongDictionary ("VSErrorInfoKeys")] interface VSErrorInfo { @@ -118,26 +119,23 @@ interface VSAccountManagerDelegate { [TV (10, 0)] [Mac (10,14)] [Unavailable (PlatformName.WatchOS)] - [Unavailable (PlatformName.MacCatalyst)][Advice ("This API is not available when using UIKit on macOS.")] + [NoMacCatalyst] [BaseType (typeof (NSObject))] interface VSAccountManager { [NullAllowed, Export ("delegate", ArgumentSemantic.Weak)] IVSAccountManagerDelegate Delegate { get; set; } - [Unavailable (PlatformName.UIKitForMac)][Advice ("This API is not available when using UIKit on macOS.")] [NoMac] [Async] [Export ("checkAccessStatusWithOptions:completionHandler:")] void CheckAccessStatus (NSDictionary options, Action completionHandler); - [Unavailable (PlatformName.UIKitForMac)][Advice ("This API is not available when using UIKit on macOS.")] [NoMac] [Async] [Export ("enqueueAccountMetadataRequest:completionHandler:")] VSAccountManagerResult Enqueue (VSAccountMetadataRequest accountMetadataRequest, Action completionHandler); - [Unavailable (PlatformName.UIKitForMac)][Advice ("This API is not available when using UIKit on macOS.")] [NoMac] [TV (13,0)][iOS (13,0)] [Field ("VSOpenTVProviderSettingsURLString")] @@ -161,6 +159,7 @@ interface VSCheckAccessOptionKeys { [TV (10, 0)] [Mac (10,14)] [Unavailable (PlatformName.WatchOS)] + [NoMacCatalyst] [StrongDictionary ("VSCheckAccessOptionKeys")] interface VSAccountManagerAccessOptions { diff --git a/src/xammaccatalyst.tmpl.csproj b/src/xammaccatalyst.tmpl.csproj new file mode 100644 index 000000000000..7dda211df6ae --- /dev/null +++ b/src/xammaccatalyst.tmpl.csproj @@ -0,0 +1,56 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + + Xamarin.MacCatalyst + true + ..\product.snk + build\IDE\obj\MacCatalyst\$(Configuration) + latest + + + true + full + false + build\IDE\bin\MacCatalyst\Debug + IPHONE;MACCATALYST;MINIMAL;MONOTOUCH + prompt + 4 + false + true + True + 3021,3014,3003 + + + none + false + build\IDE\bin\MacCatalyst\Release + IPHONE;MACCATALYST;MINIMAL;MONOTOUCH + prompt + 4 + false + true + + + + + + + + + + + build\maccatalyst\native\%(RecursiveDir)%(Filename).cs + + + + + + \ No newline at end of file diff --git a/src/xkit.cs b/src/xkit.cs index dbae9fdd22ec..95211442bf1e 100644 --- a/src/xkit.cs +++ b/src/xkit.cs @@ -96,6 +96,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 // This was removed in the headers in the macOS 10.11 SDK [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11)] [Export ("layoutOptions")] NSGlyphStorageOptions LayoutOptions { get; } @@ -160,6 +161,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11, Message = "Use ProcessEditing (NSTextStorage textStorage, NSTextStorageEditActions editMask, NSRange newCharacterRange, nint delta, NSRange invalidatedCharacterRange) instead).")] [Export ("textStorage:edited:range:changeInLength:invalidatedRange:")] void TextStorageEdited (NSTextStorage str, NSTextStorageEditedFlags editedMask, NSRange newCharRange, nint changeInLength, NSRange invalidatedCharRange); @@ -193,6 +195,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11, Message = "Use 'SetGlyphs' instead.")] [Export ("insertGlyph:atGlyphIndex:characterIndex:")] void InsertGlyph (NSGlyph glyph, nint glyphIndex, nint charIndex); @@ -200,6 +203,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11, Message = "Use 'SetGlyphs' instead.")] [Export ("replaceGlyphAtIndex:withGlyph:")] void ReplaceGlyphAtIndex (nint glyphIndex, NSGlyph newGlyph); @@ -207,6 +211,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11, Message = "Use 'SetGlyphs' instead.")] [Export ("deleteGlyphsInRange:")] void DeleteGlyphs (NSRange glyphRange); @@ -214,6 +219,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11, Message = "Use 'SetGlyphs' instead.")] [Export ("setCharacterIndex:forGlyphAtIndex:")] void SetCharacterIndex (nint charIndex, nint glyphIndex); @@ -221,6 +227,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11, Message = "Use 'SetGlyphs' instead.")] [Export ("setIntAttribute:value:forGlyphAtIndex:")] void SetIntAttribute (nint attributeTag, nint value, nint glyphIndex); @@ -228,6 +235,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11, Message = "Use 'SetGlyphs' instead.")] [Export ("invalidateGlyphsOnLayoutInvalidationForGlyphRange:")] void InvalidateGlyphsOnLayoutInvalidation (NSRange glyphRange); @@ -516,14 +524,17 @@ partial interface NSLayoutManager : NSSecureCoding { #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("setLayoutRect:forTextBlock:glyphRange:")] void SetLayoutRect (CGRect layoutRect, NSTextBlock forTextBlock, NSRange glyphRange); [NoiOS][NoTV] + [NoMacCatalyst] [Export ("setBoundsRect:forTextBlock:glyphRange:")] void SetBoundsRect (CGRect boundsRect, NSTextBlock forTextBlock, NSRange glyphRange); [NoiOS][NoTV] + [NoMacCatalyst] [Export ("layoutRectForTextBlock:glyphRange:")] #if XAMCORE_4_0 CGRect GetLayoutRect (NSTextBlock block, NSRange glyphRange); @@ -532,6 +543,7 @@ partial interface NSLayoutManager : NSSecureCoding { #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("boundsRectForTextBlock:glyphRange:")] #if XAMCORE_4_0 CGRect GetBoundsRect (NSTextBlock block, NSRange glyphRange); @@ -542,15 +554,18 @@ partial interface NSLayoutManager : NSSecureCoding { /* GetLayoutRect (NSTextBlock, NSUInteger, nullable NSRangePointer) */ [NoiOS][NoTV] + [NoMacCatalyst] [Protected] [Export ("layoutRectForTextBlock:atIndex:effectiveRange:")] CGRect GetLayoutRect (NSTextBlock block, nuint glyphIndex, IntPtr effectiveGlyphRange); [NoiOS][NoTV] + [NoMacCatalyst] [Wrap ("GetLayoutRect (block, glyphIndex, IntPtr.Zero)")] CGRect GetLayoutRect (NSTextBlock block, nuint glyphIndex); [NoiOS][NoTV] + [NoMacCatalyst] [Sealed] [Export ("layoutRectForTextBlock:atIndex:effectiveRange:")] CGRect GetLayoutRect (NSTextBlock block, nuint glyphIndex, out NSRange effectiveGlyphRange); @@ -558,15 +573,18 @@ partial interface NSLayoutManager : NSSecureCoding { /* GetBoundsRect (NSTextBlock, NSUInteger, nullable NSRangePointer) */ [NoiOS][NoTV] + [NoMacCatalyst] [Protected] [Export ("boundsRectForTextBlock:atIndex:effectiveRange:")] CGRect GetBoundsRect (NSTextBlock block, nuint glyphIndex, IntPtr effectiveGlyphRange); [NoiOS][NoTV] + [NoMacCatalyst] [Wrap ("GetBoundsRect (block, glyphIndex, IntPtr.Zero)")] CGRect GetBoundsRect (NSTextBlock block, nuint glyphIndex); [NoiOS][NoTV] + [NoMacCatalyst] [Sealed] [Export ("boundsRectForTextBlock:atIndex:effectiveRange:")] CGRect GetBoundsRect (NSTextBlock block, nuint glyphIndex, out NSRange effectiveGlyphRange); @@ -590,6 +608,7 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Obsolete ("Use 'GetGlyphRange' instead.")] [Export ("glyphRangeForCharacterRange:actualCharacterRange:")] NSRange GlyphRangeForCharacterRange (NSRange charRange, out NSRange actualCharRange); @@ -631,6 +650,7 @@ partial interface NSLayoutManager : NSSecureCoding { [Internal] [NoiOS][NoTV] + [NoMacCatalyst] [Export ("rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:")] [Availability (Deprecated = Platform.Mac_10_11)] IntPtr GetRectArray (NSRange glyphRange, NSRange selectedGlyphRange, IntPtr textContainerHandle, out nuint rectCount); @@ -718,24 +738,29 @@ partial interface NSLayoutManager : NSSecureCoding { /* GetTemporaryAttributes (NSUInteger, nullable NSRangePointer) */ [NoiOS][NoTV] + [NoMacCatalyst] [Protected] [Export ("temporaryAttributesAtCharacterIndex:effectiveRange:")] NSDictionary GetTemporaryAttributes (nuint characterIndex, IntPtr effectiveCharacterRange); [NoiOS][NoTV] + [NoMacCatalyst] [Wrap ("GetTemporaryAttributes (characterIndex, IntPtr.Zero)")] NSDictionary GetTemporaryAttributes (nuint characterIndex); [NoiOS][NoTV] + [NoMacCatalyst] [Sealed] [Export ("temporaryAttributesAtCharacterIndex:effectiveRange:")] NSDictionary GetTemporaryAttributes (nuint characterIndex, out NSRange effectiveCharacterRange); [NoiOS, NoTV, NoWatch] + [NoMacCatalyst] [Export ("setTemporaryAttributes:forCharacterRange:")] void SetTemporaryAttributes (NSDictionary attrs, NSRange charRange); [NoiOS][NoTV] + [NoMacCatalyst] [Export ("addTemporaryAttributes:forCharacterRange:")] #if XAMCORE_4_0 void AddTemporaryAttributes (NSDictionary attributes, NSRange characterRange); @@ -750,6 +775,7 @@ partial interface NSLayoutManager : NSSecureCoding { [Sealed] #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("removeTemporaryAttribute:forCharacterRange:")] void RemoveTemporaryAttribute (NSString attributeName, NSRange characterRange); @@ -757,6 +783,7 @@ partial interface NSLayoutManager : NSSecureCoding { [Sealed] #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("removeTemporaryAttribute:forCharacterRange:")] #if XAMCORE_4_0 void RemoveTemporaryAttribute (string attributeName, NSRange characterRange); @@ -767,15 +794,18 @@ partial interface NSLayoutManager : NSSecureCoding { /* GetTemporaryAttribute (NSString, NSUInteger, nullable NSRangePointer) */ [Protected] [NoiOS][NoTV] + [NoMacCatalyst] [Export ("temporaryAttribute:atCharacterIndex:effectiveRange:")] NSObject GetTemporaryAttribute (NSString attributeName, nuint characterIndex, /* nullable NSRangePointer */ IntPtr effectiveRange); [Wrap ("GetTemporaryAttribute (attributeName, characterIndex, IntPtr.Zero)")] [NoiOS][NoTV] + [NoMacCatalyst] NSObject GetTemporaryAttribute (NSString attributeName, nuint characterIndex); [Sealed] [NoiOS][NoTV] + [NoMacCatalyst] [Export ("temporaryAttribute:atCharacterIndex:effectiveRange:")] NSObject GetTemporaryAttribute (NSString attributeName, nuint characterIndex, /* nullable NSRangePointer */ out NSRange effectiveRange); @@ -783,15 +813,18 @@ partial interface NSLayoutManager : NSSecureCoding { [Protected] [NoiOS][NoTV] + [NoMacCatalyst] [Export ("temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:")] NSObject GetTemporaryAttribute (NSString attributeName, nuint characterIndex, /* nullable NSRangePointer */ IntPtr longestEffectiveRange, NSRange rangeLimit); [Wrap ("GetTemporaryAttribute (attributeName, characterIndex, IntPtr.Zero, rangeLimit)")] [NoiOS][NoTV] + [NoMacCatalyst] NSObject GetTemporaryAttribute (NSString attributeName, nuint characterIndex, NSRange rangeLimit); [Sealed] [NoiOS][NoTV] + [NoMacCatalyst] [Export ("temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:")] NSObject GetTemporaryAttribute (NSString attributeName, nuint characterIndex, /* nullable NSRangePointer */ out NSRange longestEffectiveRange, NSRange rangeLimit); @@ -799,15 +832,18 @@ partial interface NSLayoutManager : NSSecureCoding { [Protected] [NoiOS][NoTV] + [NoMacCatalyst] [Export ("temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:")] NSDictionary GetTemporaryAttributes (nuint characterIndex, /* nullable NSRangePointer */ IntPtr longestEffectiveRange, NSRange rangeLimit); [Wrap ("GetTemporaryAttributes (characterIndex, IntPtr.Zero, rangeLimit)")] [NoiOS][NoTV] + [NoMacCatalyst] NSDictionary GetTemporaryAttributes (nuint characterIndex, NSRange rangeLimit); [Sealed] [NoiOS][NoTV] + [NoMacCatalyst] [Export ("temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:")] NSDictionary GetTemporaryAttributes (nuint characterIndex, /* nullable NSRangePointer */ out NSRange longestEffectiveRange, NSRange rangeLimit); @@ -818,6 +854,7 @@ partial interface NSLayoutManager : NSSecureCoding { [Sealed] #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("addTemporaryAttribute:value:forCharacterRange:")] void AddTemporaryAttribute (NSString attributeName, NSObject value, NSRange characterRange); @@ -825,6 +862,7 @@ partial interface NSLayoutManager : NSSecureCoding { [Sealed] #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("addTemporaryAttribute:value:forCharacterRange:")] #if XAMCORE_4_0 void AddTemporaryAttribute (string attributeName, NSObject value, NSRange characterRange); @@ -834,12 +872,14 @@ partial interface NSLayoutManager : NSSecureCoding { #if !XAMCORE_4_0 [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11)] [Export ("substituteFontForFont:")] NSFont SubstituteFontForFont (NSFont originalFont); #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("defaultLineHeightForFont:")] #if XAMCORE_4_0 nfloat GetDefaultLineHeight (NSFont font); @@ -848,6 +888,7 @@ partial interface NSLayoutManager : NSSecureCoding { #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("defaultBaselineOffsetForFont:")] #if XAMCORE_4_0 nfloat GetDefaultBaselineOffset (NSFont font); @@ -860,11 +901,13 @@ partial interface NSLayoutManager : NSSecureCoding { NSTextStorage TextStorage { get; set; } [NoiOS][NoTV] + [NoMacCatalyst] [Availability (Deprecated = Platform.Mac_10_11)] [Export ("glyphGenerator", ArgumentSemantic.Retain)] NSGlyphGenerator GlyphGenerator { get; set; } [NoiOS][NoTV] + [NoMacCatalyst] [Export ("typesetter", ArgumentSemantic.Retain)] NSTypesetter Typesetter { get; set; } @@ -895,6 +938,7 @@ partial interface NSLayoutManager : NSSecureCoding { [Deprecated (PlatformName.TvOS, 13, 0, message: "Please use 'UsesDefaultHyphenation' or 'NSParagraphStyle.HyphenationFactor' instead.")] [Unavailable (PlatformName.UIKitForMac)] [Advice ("This API is not available when using UIKit on macOS.")] + [NoMacCatalyst] [Export ("hyphenationFactor")] #if MONOMAC float HyphenationFactor { get; set; } /* This is defined as float in AppKit headers. */ @@ -903,10 +947,12 @@ partial interface NSLayoutManager : NSSecureCoding { #endif [NoiOS][NoTV] + [NoMacCatalyst] [Export ("defaultAttachmentScaling")] NSImageScaling DefaultAttachmentScaling { get; set; } [NoiOS][NoTV] + [NoMacCatalyst] [Export ("typesetterBehavior")] NSTypesetterBehavior TypesetterBehavior { get; set; } @@ -1050,6 +1096,7 @@ partial interface NSLayoutManager : NSSecureCoding { void Strikethrough (NSRange glyphRange, NSUnderlineStyle strikethroughVal, CGRect lineRect, NSRange lineGlyphRange, CGPoint containerOrigin); [NoiOS][NoTV] + [NoMacCatalyst] [Export ("showAttachmentCell:inRect:characterIndex:")] void ShowAttachmentCell (NSCell cell, CGRect rect, nuint characterIndex); @@ -1065,6 +1112,7 @@ partial interface NSLayoutManager : NSSecureCoding { } [NoiOS][NoWatch][NoTV] + [NoMacCatalyst] [Category] [BaseType (typeof (NSLayoutManager))] interface NSLayoutManager_NSTextViewSupport { @@ -1465,6 +1513,7 @@ interface NSMutableParagraphStyle { void SetParagraphStyle (NSParagraphStyle paragraphStyle); [NoiOS, NoTV, NoWatch] + [NoMacCatalyst] [Override] [Export ("textBlocks")] #if XAMCORE_4_0 @@ -1474,6 +1523,7 @@ interface NSMutableParagraphStyle { #endif [NoiOS, NoTV, NoWatch] + [NoMacCatalyst] [Override] [Export ("textLists")] NSTextList [] TextLists { get; set; } @@ -1484,6 +1534,7 @@ interface NSMutableParagraphStyle { float TighteningFactorForTruncation { get; set; } /* float, not CGFloat */ [NoiOS, NoTV, NoWatch] + [NoMacCatalyst] [Export ("headerLevel")] [Override] nint HeaderLevel { get; set; } diff --git a/tests/common/TestProjects/MyCatalystApp/AppDelegate.cs b/tests/common/TestProjects/MyCatalystApp/AppDelegate.cs new file mode 100644 index 000000000000..5b7f420d9554 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/AppDelegate.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Foundation; +using UIKit; + +namespace MySingleView +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to + // application events from iOS. + [Register ("AppDelegate")] + public partial class AppDelegate : UIApplicationDelegate + { + // class-level declarations + public override UIWindow Window { + get; + set; + } + // This method is invoked when the application is about to move from active to inactive state. + // OpenGL applications should use this method to pause. + public override void OnResignActivation (UIApplication application) + { + } + // This method should be used to release shared resources and it should store the application state. + // If your application supports background execution this method is called instead of WillTerminate + // when the user quits. + public override void DidEnterBackground (UIApplication application) + { + } + + /// This method is called as part of the transition from background to active state. + public override void WillEnterForeground (UIApplication application) + { + } + + /// This method is called when the application is about to terminate. Save data, if needed. + public override void WillTerminate (UIApplication application) + { + } + } +} + diff --git a/tests/common/TestProjects/MyCatalystApp/Entitlements.plist b/tests/common/TestProjects/MyCatalystApp/Entitlements.plist new file mode 100644 index 000000000000..9ae599370b42 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Entitlements.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/common/TestProjects/MyCatalystApp/Folder/BundleResource.txt b/tests/common/TestProjects/MyCatalystApp/Folder/BundleResource.txt new file mode 100644 index 000000000000..d107ae508e20 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Folder/BundleResource.txt @@ -0,0 +1 @@ +BundleResource \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/Folder/Content.txt b/tests/common/TestProjects/MyCatalystApp/Folder/Content.txt new file mode 100644 index 000000000000..24a90d89d473 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Folder/Content.txt @@ -0,0 +1 @@ +Content \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/Folder/EmbeddedResource.txt b/tests/common/TestProjects/MyCatalystApp/Folder/EmbeddedResource.txt new file mode 100644 index 000000000000..58fa843b66de --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Folder/EmbeddedResource.txt @@ -0,0 +1 @@ +EmbeddedResource \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/Folder/FolderView.xib b/tests/common/TestProjects/MyCatalystApp/Folder/FolderView.xib new file mode 100644 index 000000000000..98488b68b84f --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Folder/FolderView.xib @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/common/TestProjects/MyCatalystApp/Info.plist b/tests/common/TestProjects/MyCatalystApp/Info.plist new file mode 100644 index 000000000000..ceae892c20c3 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Info.plist @@ -0,0 +1,28 @@ + + + + + UIDeviceFamily + + 2 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIMainStoryboardFile + MainStoryboard + LSMinimumSystemVersion + 10.15 + CFBundleDisplayName + ApplicationName + CFBundleIdentifier + com.your-company.mysingleview + XSAppIconAssets + Resources/Images.xcassets/AppIcons.appiconset + XSLaunchImageAssets + Resources/Images.xcassets/LaunchImage.launchimage + + diff --git a/tests/common/TestProjects/MyCatalystApp/LinkedBundleResource.txt b/tests/common/TestProjects/MyCatalystApp/LinkedBundleResource.txt new file mode 100644 index 000000000000..8b1d0ad79e59 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/LinkedBundleResource.txt @@ -0,0 +1 @@ +Linked Bundle Resource \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/LinkedContent.txt b/tests/common/TestProjects/MyCatalystApp/LinkedContent.txt new file mode 100644 index 000000000000..30cf1329164a --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/LinkedContent.txt @@ -0,0 +1 @@ +Linked Content \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/LinkedEmbeddedResource.txt b/tests/common/TestProjects/MyCatalystApp/LinkedEmbeddedResource.txt new file mode 100644 index 000000000000..7d4275092d47 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/LinkedEmbeddedResource.txt @@ -0,0 +1 @@ +Linked embedded resource \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/Main.cs b/tests/common/TestProjects/MyCatalystApp/Main.cs new file mode 100644 index 000000000000..1d6bbbe03732 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Main.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Foundation; +using UIKit; + +namespace MySingleView +{ + public class Application + { + // This is the main entry point of the application. + static void Main (string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main (args, null, "AppDelegate"); + } + } +} diff --git a/tests/common/TestProjects/MyCatalystApp/MainStoryboard.storyboard b/tests/common/TestProjects/MyCatalystApp/MainStoryboard.storyboard new file mode 100644 index 000000000000..5e7da48007ef --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/MainStoryboard.storyboard @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/Makefile b/tests/common/TestProjects/MyCatalystApp/Makefile new file mode 100644 index 000000000000..8afe674b605f --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Makefile @@ -0,0 +1,3 @@ +all: + msbuild /bl + $(PWD)/bin/MacCatalyst/Debug/MyCatalystApp.app/Contents/MacOS/MyCatalystApp diff --git a/tests/common/TestProjects/MyCatalystApp/MyCatalystApp.csproj b/tests/common/TestProjects/MyCatalystApp/MyCatalystApp.csproj new file mode 100644 index 000000000000..596cf6f90cba --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/MyCatalystApp.csproj @@ -0,0 +1,118 @@ + + + + Debug + MacCatalyst + 8.0.30703 + 2.0 + {8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Exe + MySingleView + Resources + MyCatalystApp + + + true + full + false + bin\MacCatalyst\Debug + DEBUG; + prompt + 4 + None + true + x86_64 + Entitlements.plist + + + full + true + bin\MacCatalyst\Release + prompt + 4 + None + x86_64 + Entitlements.plist + + + + + + + + + + + + + + + + + + + + + + + + MySingleViewViewController.cs + + + + + Folder\LinkedBundleResource.txt + + + + + + + Folder\LinkedEmbeddedResource.txt + + + + + + + Folder\LinkedContent.txt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/common/TestProjects/MyCatalystApp/MyCatalystApp.sln b/tests/common/TestProjects/MyCatalystApp/MyCatalystApp.sln new file mode 100644 index 000000000000..0386f556dd1a --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/MyCatalystApp.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyCatalystApp", "MyCatalystApp.csproj", "{8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|MacCatalyst = Debug|MacCatalyst + Release|MacCatalyst = Release|MacCatalyst + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB}.Debug|MacCatalyst.ActiveCfg = Debug|MacCatalyst + {8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB}.Debug|MacCatalyst.Build.0 = Debug|MacCatalyst + {8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB}.Release|MacCatalyst.ActiveCfg = Release|MacCatalyst + {8F2D37C2-BF1F-408A-8E7E-1B89D2126DFB}.Release|MacCatalyst.Build.0 = Release|MacCatalyst + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = MyCatalystApp.csproj + EndGlobalSection +EndGlobal diff --git a/tests/common/TestProjects/MyCatalystApp/MySingleViewViewController.cs b/tests/common/TestProjects/MyCatalystApp/MySingleViewViewController.cs new file mode 100644 index 000000000000..d83f4d40214b --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/MySingleViewViewController.cs @@ -0,0 +1,60 @@ +using System; +using CoreGraphics; +using Foundation; +using UIKit; + +namespace MySingleView +{ + public partial class MySingleViewViewController : UIViewController + { + public MySingleViewViewController (IntPtr handle) : base (handle) + { + } + + public override void DidReceiveMemoryWarning () + { + // Releases the view if it doesn't have a superview. + base.DidReceiveMemoryWarning (); + + // Release any cached data, images, etc that aren't in use. + } + + #region View lifecycle + + public override void ViewDidLoad () + { + base.ViewDidLoad (); + + // Perform any additional setup after loading the view, typically from a nib. + } + + public override void ViewWillAppear (bool animated) + { + base.ViewWillAppear (animated); + } + + public override void ViewDidAppear (bool animated) + { + base.ViewDidAppear (animated); + } + + public override void ViewWillDisappear (bool animated) + { + base.ViewWillDisappear (animated); + } + + public override void ViewDidDisappear (bool animated) + { + base.ViewDidDisappear (animated); + } + + #endregion + + public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) + { + // Return true for supported orientations + return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown); + } + } +} + diff --git a/tests/common/TestProjects/MyCatalystApp/MySingleViewViewController.designer.cs b/tests/common/TestProjects/MyCatalystApp/MySingleViewViewController.designer.cs new file mode 100644 index 000000000000..946fc18beabf --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/MySingleViewViewController.designer.cs @@ -0,0 +1,17 @@ +// +// This file has been generated automatically by MonoDevelop to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace MySingleView +{ + [Register ("MySingleViewViewController")] + partial class MySingleViewViewController + { + void ReleaseDesignerOutlets () + { + } + } +} diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0001.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0001.png new file mode 100755 index 000000000000..dc402d053af5 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0001.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0002.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0002.png new file mode 100755 index 000000000000..2b582a026859 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0002.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0003.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0003.png new file mode 100755 index 000000000000..c918758fc835 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0003.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0004.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0004.png new file mode 100755 index 000000000000..cbb733eea0dd Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0004.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0005.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0005.png new file mode 100755 index 000000000000..f65b92a4c8c2 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0005.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0006.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0006.png new file mode 100755 index 000000000000..0f1aba579ed8 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0006.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0007.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0007.png new file mode 100755 index 000000000000..7d89c0b22d05 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0007.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0008.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0008.png new file mode 100755 index 000000000000..0eb8f42d171f Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0008.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0009.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0009.png new file mode 100755 index 000000000000..30173910a945 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0009.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0010.png b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0010.png new file mode 100755 index 000000000000..973a9ce9e6cf Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Archer/Archer_Attack.atlas/archer_attack_0010.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..8a17bc134927 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Contents.json @@ -0,0 +1,94 @@ +{ + "images": [ + { + "filename": "Icon-Small.png", + "size": "29x29", + "scale": "1x", + "idiom": "iphone" + }, + { + "filename": "Icon-Small@2x.png", + "size": "29x29", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon-Small-40@2x.png", + "size": "40x40", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon.png", + "size": "57x57", + "scale": "1x", + "idiom": "iphone" + }, + { + "filename": "Icon@2x.png", + "size": "57x57", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "Icon-60@2x.png", + "size": "60x60", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "29x29", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "29x29", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "40x40", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "40x40", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "50x50", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "50x50", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "72x72", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "72x72", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "76x76", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "76x76", + "scale": "2x", + "idiom": "ipad" + } + ], + "info": { + "version": 1, + "author": "xcode" + }, +} diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-60@2x.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-60@2x.png new file mode 100644 index 000000000000..c8bd3bde2ebc Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-60@2x.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small-40@2x.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small-40@2x.png new file mode 100644 index 000000000000..6effae110f49 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small-40@2x.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small.png new file mode 100644 index 000000000000..9cbe189939a5 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small@2x.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small@2x.png new file mode 100644 index 000000000000..e33ac58c6fe4 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon-Small@2x.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon.png new file mode 100644 index 000000000000..af8016ccbfb8 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png new file mode 100644 index 000000000000..7a29a3749994 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/AppIcons.appiconset/Icon@2x.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..fb285c8d9c17 --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,33 @@ +{ + "images": [ + { + "orientation": "portrait", + "idiom": "iphone", + "extent": "full-screen", + "filename": "Default.png", + "size": "320x480", + "scale": "1x" + }, + { + "orientation": "portrait", + "idiom": "iphone", + "extent": "full-screen", + "filename": "Default@2x.png", + "size": "320x480", + "scale": "2x" + }, + { + "orientation": "portrait", + "idiom": "iphone", + "extent": "full-screen", + "filename": "Default-568h@2x.png", + "size": "320x568", + "subtype": "retina4", + "scale": "2x" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png new file mode 100644 index 000000000000..b3f66780c138 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default.png new file mode 100644 index 000000000000..7ad63b04328e Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png new file mode 100644 index 000000000000..8d59426f3b39 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/Images.xcassets/LaunchImage.launchimage/Default@2x.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/Resources/image.png b/tests/common/TestProjects/MyCatalystApp/Resources/image.png new file mode 100755 index 000000000000..399ffaf1a53d Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/Resources/image.png differ diff --git a/tests/common/TestProjects/MyCatalystApp/en.lproj/TranslatedView.xib b/tests/common/TestProjects/MyCatalystApp/en.lproj/TranslatedView.xib new file mode 100644 index 000000000000..98488b68b84f --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/en.lproj/TranslatedView.xib @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/common/TestProjects/MyCatalystApp/iPhoneView.xib b/tests/common/TestProjects/MyCatalystApp/iPhoneView.xib new file mode 100644 index 000000000000..98488b68b84f --- /dev/null +++ b/tests/common/TestProjects/MyCatalystApp/iPhoneView.xib @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/common/TestProjects/MyCatalystApp/iTunesArtwork b/tests/common/TestProjects/MyCatalystApp/iTunesArtwork new file mode 100644 index 000000000000..0baf1223761a Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/iTunesArtwork differ diff --git a/tests/common/TestProjects/MyCatalystApp/iTunesArtwork@2x b/tests/common/TestProjects/MyCatalystApp/iTunesArtwork@2x new file mode 100644 index 000000000000..85346748c1f3 Binary files /dev/null and b/tests/common/TestProjects/MyCatalystApp/iTunesArtwork@2x differ diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs index b811dcf9461b..24a9d2de7289 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs @@ -43,6 +43,7 @@ public override void Setup () task.ProvisioningProfile = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "Resources", "profile.mobileprovision"); task.SdkPlatform = "iPhoneOS"; task.SdkVersion = "6.1"; + task.TargetFrameworkMoniker = "Xamarin.iOS,v1.0"; compiledEntitlements = task.CompiledEntitlements.ItemSpec; } diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index 538ac3ae8ff2..d59b174f76b7 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -556,6 +556,16 @@ int ConfigureIOS () today_targets.Add (today); } } + + if (!proj.SkipMacCatalystVariation) { + var macCatalyst = new MacCatalystTarget { + TemplateProjectPath = file, + Harness = this, + TestProject = proj, + ShouldSkipProjectGeneration = proj.IsDotNetProject, + }; + macCatalyst.Execute (); + } } SolutionGenerator.CreateSolution (this, watchos_targets, "watchos", DevicePlatform.watchOS); diff --git a/tests/xharness/Jenkins/Jenkins.cs b/tests/xharness/Jenkins/Jenkins.cs index 51ded45033cc..87f524b0f33e 100644 --- a/tests/xharness/Jenkins/Jenkins.cs +++ b/tests/xharness/Jenkins/Jenkins.cs @@ -61,6 +61,7 @@ class Jenkins { public bool IncludeNonMonotouch = true; public bool IncludeMonotouch = true; public bool IncludeDotNet; + public bool IncludeMacCatalyst; public bool CleanSuccessfulTestRuns = true; public bool UninstallTestApp = true; @@ -234,9 +235,65 @@ Task PopulateTasksAsync () Console.WriteLine ("Got device tasks completed"); Tasks.AddRange (v.Result); }); + + // Generate Mac Catalyst tests + Tasks.AddRange (CreateMacCatalystTests (crashReportSnapshotFactory)); + return Task.WhenAll (loadsim, loaddev); } + IEnumerable CreateMacCatalystTests (CrashSnapshotReporterFactory crashSnapshotReporterFactory) + { + var projectTasks = new List (); + + foreach (var project in Harness.IOSTestProjects) { + if (!project.IsExecutableProject) + continue; + + if (project.SkipMacCatalystVariation) + continue; + + if (!project.GenerateVariations) + continue; + + var ignored = project.Ignore ?? !IncludeMacCatalyst; + if (!IsIncluded (project)) + ignored = true; + + var macCatalystProject = project.GenerateVariations ? project.AsMacCatalystProject () : project; + var build = new MSBuildTask (jenkins: this, testProject: macCatalystProject, processManager: processManager) { + ProjectConfiguration = "Debug", + ProjectPlatform = "iPhoneSimulator", + Platform = TestPlatform.MacCatalyst, + TestName = project.Name, + }; + build.CloneTestProject (MainLog, processManager, macCatalystProject, HarnessConfiguration.RootDirectory); + + RunTestTask task; + if (project.IsNUnitProject) { + var dll = Path.Combine (Path.GetDirectoryName (build.TestProject.Path), project.Xml.GetOutputAssemblyPath (build.ProjectPlatform, build.ProjectConfiguration).Replace ('\\', '/')); + task = new NUnitExecuteTask (this, build, processManager) { + TestLibrary = dll, + Mode = "MacCatalyst", + }; + } else { + task = new MacExecuteTask (this, build, processManager, crashSnapshotReporterFactory) { + IsUnitTest = true, + }; + } + task.Ignored = ignored; + task.Platform = build.Platform; + task.TestName = project.Name; + task.Timeout = TimeSpan.FromMinutes (120); + task.Variation = task.ProjectConfiguration; + if (project.IsDotNetProject) + task.Variation += " [dotnet]"; + projectTasks.Add (task); + } + + return projectTasks; + } + public int Run () { try { diff --git a/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs b/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs index 658e33a9a151..87ba74d5f562 100644 --- a/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs +++ b/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs @@ -44,6 +44,7 @@ public override void SetEnvironmentVariables (Process process) case TestPlatform.watchOS: case TestPlatform.watchOS_32: case TestPlatform.watchOS_64_32: + case TestPlatform.MacCatalyst: process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot; process.StartInfo.EnvironmentVariables ["MD_MTOUCH_SDK_ROOT"] = Path.Combine (Jenkins.Harness.IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current"); process.StartInfo.EnvironmentVariables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine (Jenkins.Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); @@ -71,7 +72,7 @@ public override void SetEnvironmentVariables (Process process) process.StartInfo.EnvironmentVariables ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine (Jenkins.Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); break; default: - throw new NotImplementedException (); + throw new NotImplementedException ($"Unknown test platform: {Platform}"); } foreach (var kvp in Environment) { diff --git a/tests/xharness/Jenkins/TestTasks/BuildProject.cs b/tests/xharness/Jenkins/TestTasks/BuildProject.cs index ab5cf8de53a6..2cb628c68618 100644 --- a/tests/xharness/Jenkins/TestTasks/BuildProject.cs +++ b/tests/xharness/Jenkins/TestTasks/BuildProject.cs @@ -32,6 +32,8 @@ public bool RestoreNugets { get { if (TestProject.IsDotNetProject) return false; + if (Platform == TestPlatform.MacCatalyst) + return false; return TestProject.RestoreNugetsInProject || !string.IsNullOrEmpty (SolutionPath); } } diff --git a/tests/xharness/Jenkins/TestTasks/MSBuild.cs b/tests/xharness/Jenkins/TestTasks/MSBuild.cs index 58fb5ea7053e..a8ae46b40d11 100644 --- a/tests/xharness/Jenkins/TestTasks/MSBuild.cs +++ b/tests/xharness/Jenkins/TestTasks/MSBuild.cs @@ -29,6 +29,8 @@ public virtual List GetToolArguments (string projectPlatform, string pro args.Add ($"/p:Platform={projectPlatform}"); if (SpecifyConfiguration) args.Add ($"/p:Configuration={projectConfiguration}"); + if (Platform == TestPlatform.MacCatalyst) + args.Add ("/r"); args.Add (projectFile); return args; } diff --git a/tests/xharness/Jenkins/TestTasks/MSBuildTask.cs b/tests/xharness/Jenkins/TestTasks/MSBuildTask.cs index 881183db8ae5..9925d2dd84d5 100644 --- a/tests/xharness/Jenkins/TestTasks/MSBuildTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MSBuildTask.cs @@ -20,6 +20,8 @@ public override bool RestoreNugets { get { if (TestProject.IsDotNetProject) // 'dotnet build' will restore return false; + if (TestProject.TestPlatform == TestPlatform.MacCatalyst) + return false; // we have to do 'msbuild /r' return base.RestoreNugets; } } diff --git a/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs b/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs index ece6965f7794..66e848e9cd49 100644 --- a/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs @@ -92,16 +92,26 @@ public override async Task RunTestAsync () var type = useXmlOutput ? LogType.XmlLog : LogType.NUnitResult; xmlLog = Logs.Create ($"test-{Platform}-{Timestamp}.{extension}", type.ToString ()); arguments.Add ($"-transport:FILE"); + proc.StartInfo.EnvironmentVariables ["NUNIT_TRANSPORT"] = "FILE"; arguments.Add ($"--logfile:{xmlLog.FullPath}"); + proc.StartInfo.EnvironmentVariables ["NUNIT_LOG_FILE"] = xmlLog.FullPath; if (useXmlOutput) { arguments.Add ("--enablexml"); + proc.StartInfo.EnvironmentVariables ["NUNIT_ENABLE_XML_OUTPUT"] = "true"; arguments.Add ("--xmlmode=wrapped"); + proc.StartInfo.EnvironmentVariables ["NUNIT_ENABLE_XML_MODE"] = "wrapped"; arguments.Add ("--xmlversion=nunitv3"); + proc.StartInfo.EnvironmentVariables ["NUNIT_XML_VERSION"] = "nunitv3"; } + arguments.Add ("--autostart"); + proc.StartInfo.EnvironmentVariables ["NUNIT_AUTOSTART"] = "true"; + arguments.Add ("--autoexit"); + proc.StartInfo.EnvironmentVariables ["NUNIT_AUTOEXIT"] = "true"; } if (!Harness.GetIncludeSystemPermissionTests (Platform, false)) proc.StartInfo.EnvironmentVariables ["DISABLE_SYSTEM_PERMISSION_TESTS"] = "1"; proc.StartInfo.EnvironmentVariables ["MONO_DEBUG"] = "no-gdb-backtrace"; + proc.StartInfo.EnvironmentVariables.Remove ("DYLD_FALLBACK_LIBRARY_PATH"); // VSMac might set this, and the test may end up crashing proc.StartInfo.Arguments = StringUtils.FormatArguments (arguments); Jenkins.MainLog.WriteLine ("Executing {0} ({1})", TestName, Mode); var log = Logs.Create ($"execute-{Platform}-{Timestamp}.txt", LogType.ExecutionLog.ToString ()); diff --git a/tests/xharness/Jenkins/TestTasks/MacTask.cs b/tests/xharness/Jenkins/TestTasks/MacTask.cs index f280245b0390..c3747ad7867e 100644 --- a/tests/xharness/Jenkins/TestTasks/MacTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MacTask.cs @@ -20,6 +20,8 @@ public override string Mode { return "Mac Full"; case TestPlatform.Mac_System: return "Mac System"; + case TestPlatform.MacCatalyst: + return "Mac Catalyst"; default: throw new NotImplementedException (Platform.ToString ()); } diff --git a/tests/xharness/Targets/MacCatalystTarget.cs b/tests/xharness/Targets/MacCatalystTarget.cs new file mode 100644 index 000000000000..13f5c3c412ed --- /dev/null +++ b/tests/xharness/Targets/MacCatalystTarget.cs @@ -0,0 +1,149 @@ +using System; +using System.IO; +using System.Xml; + +using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; +using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; + +namespace Xharness.Targets { + public class MacCatalystTarget : UnifiedTarget { + public override string DotNetSdk => throw new NotImplementedException (); + + public override string RuntimeIdentifier => throw new NotImplementedException (); + + public override DevicePlatform ApplePlatform => throw new NotImplementedException (); + + public override string PlatformString => "MacCatalyst"; + + public override string TargetFramework => "net6.0-maccatalyst"; + + public override string TargetFrameworkForNuGet => throw new NotImplementedException (); + + public override string Suffix { + get { + return "-maccatalyst"; + } + } + + public override string ExtraLinkerDefsSuffix { + get { + return "-maccatalyst"; + } + } + + public override string ProjectFileSuffix { + get { + return Suffix; + } + } + + protected override string TargetFrameworkIdentifier { + get { + return "Xamarin.MacCatalyst"; + } + } + + protected override string Imports { + get { + return IsFSharp ? "MacCatalyst\\Xamarin.MacCatalyst.FSharp.targets" : "MacCatalyst\\Xamarin.MacCatalyst.CSharp.targets"; + } + } + + protected override string BindingsImports { + get { + return IsFSharp ? "MacCatalyst\\Xamarin.MacCatalyst.ObjCBinding.FSharp.targets" : "MacCatalyst\\Xamarin.MacCatalyst.ObjCBinding.CSharp.targets"; + } + } + + public override string SimulatorArchitectures { + get { + return "x86_64"; + } + } + + public override string DeviceArchitectures { + get { + return "NotApplicable"; + } + } + + protected override string GetMinimumOSVersion (string templateMinimumOSVersion) + { + return "10.15"; + } + + protected override int [] UIDeviceFamily { + get { + return new int [] { 2 }; + } + } + + protected override string AdditionalDefines { + get { + return "XAMCORE_3_0;__MACCATALYST__"; + } + } + + public override string Platform { + get { + return "maccatalyst"; + } + } + + protected override bool SupportsBitcode { + get { + return false; + } + } + + protected override void ProcessProject () + { + base.ProcessProject (); + + inputProject.ResolveAllPaths (TemplateProjectPath); + + // I couldn't figure out why the NUnit package reference doesn't end up referencing nunit.framework.dll, so instead reference nunit.framework.dll directly + var itemGroup = inputProject.SelectNodes ("//*[local-name() = 'ItemGroup' and not(@Condition)]") [0]; + var xmlElement = AddElement (inputProject, itemGroup, "PackageReference"); + AddAttribute (inputProject, xmlElement, "Include", "NUnit"); + AddAttribute (inputProject, xmlElement, "Version", "3.12.0"); + AddAttribute (inputProject, xmlElement, "GeneratePathProperty", "true"); + + xmlElement = AddElement (inputProject, itemGroup, "Reference"); + AddAttribute (inputProject, xmlElement, "Include", "$(PkgNUnit)\\lib\\netstandard2.0\\nunit.framework.dll"); + } + + static XmlElement AddElement (XmlDocument doc, XmlNode parent, string element) + { + var xmlElement = doc.CreateElement (element, doc.GetNamespace ()); + parent.AppendChild (xmlElement); + return xmlElement; + } + + static void AddAttribute (XmlDocument doc, XmlNode node, string attribute, string value) + { + var attrib = doc.CreateAttribute (attribute); + attrib.Value = value; + node.Attributes.Append (attrib); + } + + protected override void UpdateInfoPList () + { + var info_plist = new XmlDocument (); + var target_info_plist = Path.Combine (TargetDirectory, "Info" + Suffix + ".plist"); + info_plist.LoadWithoutNetworkAccess (Path.Combine (TargetDirectory, OriginalInfoPListInclude)); + BundleIdentifier = info_plist.GetCFBundleIdentifier (); + + // Remove MinimumOSVersion + var node = info_plist.SelectSingleNode ("//dict/key[text()='MinimumOSVersion']"); + node.ParentNode.RemoveChild (node.NextSibling); + node.ParentNode.RemoveChild (node); + + // Add LSMinimumSystemVersion + info_plist.SetMinimummacOSVersion (GetMinimumOSVersion (null)); + + info_plist.SetUIDeviceFamily (UIDeviceFamily); + info_plist.Save (target_info_plist, Harness); + } + } +} diff --git a/tests/xharness/Targets/Target.cs b/tests/xharness/Targets/Target.cs index 3c1b38262d2b..6cc5f06f2e3f 100644 --- a/tests/xharness/Targets/Target.cs +++ b/tests/xharness/Targets/Target.cs @@ -91,7 +91,7 @@ protected string GetTargetSpecificDir (string customSuffix = null) return rv.TrimStart ('-'); } - public string PlatformString { + public virtual string PlatformString { get { return ApplePlatform.AsString (); } diff --git a/tests/xharness/TestPlatform.cs b/tests/xharness/TestPlatform.cs index ae6a84e7b7e4..bf618a1b7cb9 100644 --- a/tests/xharness/TestPlatform.cs +++ b/tests/xharness/TestPlatform.cs @@ -12,6 +12,7 @@ public enum TestPlatform { watchOS, watchOS_32, watchOS_64_32, + MacCatalyst, Mac, Mac_Modern, diff --git a/tests/xharness/TestProjectExtensions.cs b/tests/xharness/TestProjectExtensions.cs index d6c2b705df54..c2f47d4275da 100644 --- a/tests/xharness/TestProjectExtensions.cs +++ b/tests/xharness/TestProjectExtensions.cs @@ -44,6 +44,16 @@ public static TestProject AsTodayExtensionProject (this TestProject self) return clone; } + public static TestProject AsMacCatalystProject (this TestProject self) + { + var clone = self.Clone (); + var suffix = string.Empty; + if (self.IsDotNetProject) + suffix = "-dotnet"; + clone.Path = Path.Combine (Path.GetDirectoryName (self.Path), Target.ProjectsDir, "maccatalyst" + suffix, Path.GetFileNameWithoutExtension (self.Path) + "-maccatalyst" + Path.GetExtension (self.Path)); + return clone; + } + // Get the referenced today extension project (if any) public static TestProject GetTodayExtension (this TestProject self) { diff --git a/tests/xharness/iOSTestProject.cs b/tests/xharness/iOSTestProject.cs index 709a02e5082c..027ef391cc53 100644 --- a/tests/xharness/iOSTestProject.cs +++ b/tests/xharness/iOSTestProject.cs @@ -10,6 +10,7 @@ public class iOSTestProject : TestProject { public bool SkipwatchOSARM64_32Variation; public bool SkipwatchOS32Variation; public bool SkiptvOSVariation; + public bool SkipMacCatalystVariation; public bool SkipTodayExtensionVariation; public bool SkipDeviceVariations; public bool BuildOnly; diff --git a/tests/xharness/xharness.csproj b/tests/xharness/xharness.csproj index 9f89a2c4a749..85adacad13dd 100644 --- a/tests/xharness/xharness.csproj +++ b/tests/xharness/xharness.csproj @@ -177,6 +177,7 @@ + diff --git a/tests/xtro-sharpie/iOS-MediaPlayer.ignore b/tests/xtro-sharpie/iOS-MediaPlayer.ignore index d6582bb8424c..9aaa91c1f7d9 100644 --- a/tests/xtro-sharpie/iOS-MediaPlayer.ignore +++ b/tests/xtro-sharpie/iOS-MediaPlayer.ignore @@ -1,5 +1,4 @@ ## incorrect macro/parsing - decorated with `MP_API(macos(10.12.2))` -!missing-enum! MPNowPlayingPlaybackState not bound !missing-selector! MPNowPlayingInfoCenter::playbackState not bound !missing-selector! MPNowPlayingInfoCenter::setPlaybackState: not bound diff --git a/tests/xtro-sharpie/tvOS-MediaPlayer.ignore b/tests/xtro-sharpie/tvOS-MediaPlayer.ignore index 00ff2321b7a7..3d24f57579d2 100644 --- a/tests/xtro-sharpie/tvOS-MediaPlayer.ignore +++ b/tests/xtro-sharpie/tvOS-MediaPlayer.ignore @@ -1,5 +1,4 @@ ## incorrect macro/parsing - decorated with `MP_API(macos(10.12.2))` -!missing-enum! MPNowPlayingPlaybackState not bound !missing-selector! MPNowPlayingInfoCenter::playbackState not bound !missing-selector! MPNowPlayingInfoCenter::setPlaybackState: not bound diff --git a/tools/common/ApplePlatform.cs b/tools/common/ApplePlatform.cs index b9cc7620c1e0..39f2b84454ee 100644 --- a/tools/common/ApplePlatform.cs +++ b/tools/common/ApplePlatform.cs @@ -11,6 +11,7 @@ public enum ApplePlatform { iOS, WatchOS, TVOS, + MacCatalyst, } public static class ApplePlatformExtensions { @@ -25,6 +26,8 @@ public static string AsString (this ApplePlatform @this) return "watchOS"; case ApplePlatform.TVOS: return "tvOS"; + case ApplePlatform.MacCatalyst: + return "MacCatalyst"; case ApplePlatform.None: return "None"; default: diff --git a/tools/common/Application.cs b/tools/common/Application.cs index 3a704c7415fe..4d51dc28f9e1 100644 --- a/tools/common/Application.cs +++ b/tools/common/Application.cs @@ -113,7 +113,7 @@ public bool IsDefaultMarshalManagedExceptionMode { public bool? DisableLldbAttach = null; // Only applicable to Xamarin.Mac public bool? DisableOmitFramePointer = null; // Only applicable to Xamarin.Mac - public string CustomBundleName = "MonoBundle"; // Only applicable to Xamarin.Mac + public string CustomBundleName = "MonoBundle"; // Only applicable to Xamarin.Mac and Mac Catalyst public bool? UseMonoFramework; @@ -132,6 +132,22 @@ public bool IsDefaultMarshalManagedExceptionMode { // This variable does not apply to macOS (if assemblies are AOT-compiled, the AOT compiler will output a .dylib next to the assembly and there's nothing extra for us) Dictionary> assembly_build_targets = new Dictionary> (); + public string ContentDirectory { + get { + switch (Platform) { + case ApplePlatform.iOS: + case ApplePlatform.TVOS: + case ApplePlatform.WatchOS: + return AppDirectory; + case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: + return Path.Combine (AppDirectory, "Contents", CustomBundleName); + default: + throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName); + } + } + } + // How Mono should be embedded into the app. public AssemblyBuildTarget LibMonoLinkMode { get { @@ -230,6 +246,7 @@ bool RequiresXcodeHeaders { case ApplePlatform.iOS: case ApplePlatform.TVOS: case ApplePlatform.WatchOS: + case ApplePlatform.MacCatalyst: return LinkMode == LinkMode.None; case ApplePlatform.MacOSX: return Registrar == RegistrarMode.Static && LinkMode == LinkMode.None; @@ -245,6 +262,7 @@ public string LocalBuildDir { case ApplePlatform.iOS: case ApplePlatform.TVOS: case ApplePlatform.WatchOS: + case ApplePlatform.MacCatalyst: return "_ios-build"; case ApplePlatform.MacOSX: return "_mac-build"; @@ -260,6 +278,7 @@ public string FrameworkLocationVariable { case ApplePlatform.iOS: case ApplePlatform.TVOS: case ApplePlatform.WatchOS: + case ApplePlatform.MacCatalyst: return "MD_MTOUCH_SDK_ROOT"; case ApplePlatform.MacOSX: return "XAMMAC_FRAMEWORK_PATH"; @@ -277,6 +296,7 @@ public bool IsDeviceBuild { case ApplePlatform.WatchOS: return BuildTarget == BuildTarget.Device; case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: return false; default: throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName); @@ -292,6 +312,7 @@ public bool IsSimulatorBuild { case ApplePlatform.WatchOS: return BuildTarget == BuildTarget.Simulator; case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: return false; default: throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName); @@ -329,6 +350,51 @@ public bool Is32Build { } } + // Versions for Mac Catalyst are complicated. In some cases we have to use the + // corresponding iOS version of the SDK, and in some cases we have to use the + // macOS version that iOS version correspond to. In Xcode, when you select the + // deployment target, you select a macOS version in the UI, but the corresponding + // iOS version is written to the project file. This means that there's a mapping + // between the two, and we've captured that mapping in our Versions.plist for + // Xamarin.iOS (in the MacCatalystVersionMap plist dictionary). Here we provide + // two methods that can convert between iOS version and macOS version either way. + Dictionary mac_catalyst_ios_to_macos_map; + Dictionary GetCatalystiOSTomacOSMap () + { + if (mac_catalyst_ios_to_macos_map == null) { + var file = Path.Combine (Driver.GetFrameworkCurrentDirectory (this), "Versions.plist"); + var plist = Driver.FromPList (file); + var dict = plist.Get ("MacCatalystVersionMap"); + + mac_catalyst_ios_to_macos_map = new Dictionary (); + foreach (var kvp in dict) { + // The input here is fixed, so don't try to parse, just do it, because it should succeed. + mac_catalyst_ios_to_macos_map [Version.Parse (kvp.Key)] = Version.Parse (((PString) kvp.Value).Value); + } + } + return mac_catalyst_ios_to_macos_map; + } + + public Version GetMacCatalystmacOSVersion (Version iOSVersion) + { + var map = GetCatalystiOSTomacOSMap (); + + if (!map.TryGetValue (iOSVersion, out var value)) + throw ErrorHelper.CreateError (183, Errors.MX0183 /* Could not map the iOS version {0} to a macOS version for Mac Catalyst */, iOSVersion.ToString ()); + + return value; + } + + public Version GetMacCatalystiOSVersion (Version macVersion) + { + var map = GetCatalystiOSTomacOSMap (); + var iosVersions = map.Where (kvp => kvp.Value == macVersion).Select (v => v.Key).ToArray (); + if (iosVersions.Length != 1) + throw ErrorHelper.CreateError (184, Errors.MX0184 /* Could not map the Mac Catalyst version {0} to an iOS version */, macVersion.ToString ()); + + return iosVersions [0]; + } + public string GetProductName () { return ProductName; @@ -408,8 +474,7 @@ public string ExtensionIdentifier { if (!IsExtension) return null; - var info_plist = Path.Combine (AppDirectory, "Info.plist"); - var plist = Driver.FromPList (info_plist); + var plist = Driver.FromPList (InfoPListPath); var dict = plist.Get ("NSExtension"); if (dict == null) return null; @@ -417,6 +482,22 @@ public string ExtensionIdentifier { } } + public string InfoPListPath { + get { + switch (Platform) { + case ApplePlatform.iOS: + case ApplePlatform.TVOS: + case ApplePlatform.WatchOS: + return Path.Combine (AppDirectory, "Info.plist"); + case ApplePlatform.MacCatalyst: + case ApplePlatform.MacOSX: + return Path.Combine (AppDirectory, "Contents", "Info.plist"); + default: + throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName); + } + } + } + // This is just a name for this app to show in log/error messages, etc. public string Name { get { return Path.GetFileNameWithoutExtension (AppDirectory); } @@ -430,6 +511,9 @@ public bool RequiresPInvokeWrappers { if (IsSimulatorBuild) return false; + if (Platform == ApplePlatform.MacCatalyst) + return false; + return MarshalObjectiveCExceptions == MarshalObjectiveCExceptionMode.ThrowManagedException || MarshalObjectiveCExceptions == MarshalObjectiveCExceptionMode.Abort; } } @@ -445,6 +529,8 @@ public string PlatformName { return "watchOS"; case ApplePlatform.MacOSX: return "macOS"; + case ApplePlatform.MacCatalyst: + return "MacCatalyst"; default: throw new NotImplementedException (); } @@ -726,6 +812,9 @@ void SelectMonoNative () else MonoNativeMode = MonoNativeMode.Compat; break; + case ApplePlatform.MacCatalyst: + MonoNativeMode = MonoNativeMode.Unified; + break; default: throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName); } @@ -735,6 +824,9 @@ public string GetLibNativeName () { switch (MonoNativeMode) { case MonoNativeMode.Unified: + if (Platform == ApplePlatform.MacCatalyst) + return "libmono-native"; + return "libmono-native-unified"; case MonoNativeMode.Compat: return "libmono-native-compat"; @@ -872,6 +964,10 @@ public void SetDefaultAbi () if (abis.Count == 0) abis.Add (Abi.x86_64); break; + case ApplePlatform.MacCatalyst: + if (abis.Count == 0) + throw ErrorHelper.CreateError (76, Errors.MT0076, "Xamarin.MacCatalyst"); + break; default: throw ErrorHelper.CreateError (71, Errors.MX0071, Platform, ProductName); } @@ -921,6 +1017,7 @@ public void ValidateAbi () } break; case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: validAbis.Add (Abi.x86_64); break; default: @@ -1083,6 +1180,7 @@ public string MonoGCParams { else ret += ",major=marksweep"; return ret; + case ApplePlatform.MacCatalyst: case ApplePlatform.MacOSX: return EnableSGenConc ? "major=marksweep-conc" : "major=marksweep"; default: @@ -1177,6 +1275,7 @@ public void SetManagedExceptionMode () MarshalManagedExceptions = EnableDebug && IsSimulatorBuild ? MarshalManagedExceptionMode.UnwindNativeCode : MarshalManagedExceptionMode.Disable; break; case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: MarshalManagedExceptions = EnableDebug ? MarshalManagedExceptionMode.UnwindNativeCode : MarshalManagedExceptionMode.Disable; break; default: @@ -1207,6 +1306,7 @@ public void SetObjectiveCExceptionMode () MarshalObjectiveCExceptions = EnableDebug && IsSimulatorBuild ? MarshalObjectiveCExceptionMode.UnwindManagedCode : MarshalObjectiveCExceptionMode.Disable; break; case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: MarshalObjectiveCExceptions = EnableDebug ? MarshalObjectiveCExceptionMode.ThrowManagedException : MarshalObjectiveCExceptionMode.Disable; break; default: @@ -1284,6 +1384,7 @@ internal ProductConstants ProductConstants { get { switch (Platform) { case ApplePlatform.iOS: + case ApplePlatform.MacCatalyst: return ProductConstants.iOS; case ApplePlatform.TVOS: return ProductConstants.tvOS; diff --git a/tools/common/Assembly.cs b/tools/common/Assembly.cs index f858192a185b..ddd43aaa05c4 100644 --- a/tools/common/Assembly.cs +++ b/tools/common/Assembly.cs @@ -462,18 +462,26 @@ public static LinkWithAttribute GetLinkWithAttribute (CustomAttribute attr) void AddFramework (string file) { - if (Driver.GetFrameworks (App).TryGetValue (file, out var framework) && framework.Version > App.SdkVersion) - ErrorHelper.Warning (135, Errors.MX0135, file, FileName, App.PlatformName, framework.Version, App.SdkVersion); - else { - var strong = (framework == null) || (App.DeploymentTarget >= (App.IsSimulatorBuild ? framework.VersionAvailableInSimulator ?? framework.Version : framework.Version)); - if (strong) { - if (Frameworks.Add (file)) - Driver.Log (3, "Linking with the framework {0} because it's referenced by a module reference in {1}", file, FileName); - } else { - if (WeakFrameworks.Add (file)) - Driver.Log (3, "Linking (weakly) with the framework {0} because it's referenced by a module reference in {1}", file, FileName); + if (Driver.GetFrameworks (App).TryGetValue (file, out var framework)) { + if (framework.Unavailable) { + ErrorHelper.Warning (182, Errors.MX0182 /* Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). */, framework.Name, FileName, App.PlatformName); + return; + } + + if (framework.Version > App.SdkVersion) { + ErrorHelper.Warning (135, Errors.MX0135, file, FileName, App.PlatformName, framework.Version, App.SdkVersion); + return; } } + + var strong = (framework == null) || (App.DeploymentTarget >= (App.IsSimulatorBuild ? framework.VersionAvailableInSimulator ?? framework.Version : framework.Version)); + if (strong) { + if (Frameworks.Add (file)) + Driver.Log (3, "Linking with the framework {0} because it's referenced by a module reference in {1}", file, FileName); + } else { + if (WeakFrameworks.Add (file)) + Driver.Log (3, "Linking (weakly) with the framework {0} because it's referenced by a module reference in {1}", file, FileName); + } } public string GetCompressionLinkingFlag () @@ -484,6 +492,7 @@ public string GetCompressionLinkingFlag () return "-lcompression"; return "-weak-lcompression"; case ApplePlatform.iOS: + case ApplePlatform.MacCatalyst: if (App.DeploymentTarget >= new Version (9,0)) return "-lcompression"; return "-weak-lcompression"; diff --git a/tools/common/Driver.cs b/tools/common/Driver.cs index ffd0defc650a..d395a6d89a00 100644 --- a/tools/common/Driver.cs +++ b/tools/common/Driver.cs @@ -773,6 +773,8 @@ public static string GetPlatformFrameworkDirectory (Application app) return Path.Combine (GetFrameworkLibDirectory (app), "mono", "Xamarin.WatchOS"); case ApplePlatform.TVOS: return Path.Combine (GetFrameworkLibDirectory (app), "mono", "Xamarin.TVOS"); + case ApplePlatform.MacCatalyst: + return Path.Combine (GetFrameworkLibDirectory (app), "mono", "Xamarin.MacCatalyst"); case ApplePlatform.MacOSX: #if MMP if (IsUnifiedMobile) @@ -853,6 +855,9 @@ public static string GetProductSdkDirectory (Application app) case ApplePlatform.MacOSX: sdkName = "Xamarin.macOS.sdk"; break; + case ApplePlatform.MacCatalyst: + sdkName = "Xamarin.MacCatalyst.sdk"; + break; default: throw ErrorHelper.CreateError (71, Errors.MX0071, app.Platform, app.ProductName); } @@ -870,6 +875,7 @@ public static string GetPlatform (Application app) case ApplePlatform.TVOS: return app.IsDeviceBuild ? "AppleTVOS" : "AppleTVSimulator"; case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: return "MacOSX"; default: throw ErrorHelper.CreateError (71, Errors.MX0071, app.Platform, app.ProductName); @@ -880,7 +886,12 @@ public static string GetPlatform (Application app) public static string GetFrameworkDirectory (Application app) { var platform = GetPlatform (app); - return Path.Combine (PlatformsDirectory, platform + ".platform", "Developer", "SDKs", platform + app.SdkVersion.ToString () + ".sdk"); + switch (app.Platform) { + case ApplePlatform.MacCatalyst: + return Path.Combine (PlatformsDirectory, platform + ".platform", "Developer", "SDKs", platform + app.GetMacCatalystmacOSVersion (app.SdkVersion).ToString () + ".sdk"); + default: + return Path.Combine (PlatformsDirectory, platform + ".platform", "Developer", "SDKs", platform + app.SdkVersion.ToString () + ".sdk"); + } } public static string GetProductAssembly (Application app) @@ -894,6 +905,8 @@ public static string GetProductAssembly (Application app) return "Xamarin.TVOS"; case ApplePlatform.MacOSX: return "Xamarin.Mac"; + case ApplePlatform.MacCatalyst: + return "Xamarin.MacCatalyst"; default: throw ErrorHelper.CreateError (71, Errors.MX0071, app.Platform, app.ProductName); } diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index 382aea2d1fce..ce3697872456 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -17,6 +17,7 @@ public class Framework public Version Version; public Version VersionAvailableInSimulator; public bool AlwaysWeakLinked; + public bool Unavailable; #if MTOUCH || MMP || BUNDLER public bool IsFrameworkAvailableInSimulator (Application app) @@ -232,8 +233,14 @@ public static Frameworks MacFrameworks { static Frameworks ios_frameworks; public static Frameworks GetiOSFrameworks (bool is_simulator_build) { - if (ios_frameworks == null) { - ios_frameworks = new Frameworks () { + if (ios_frameworks == null) + ios_frameworks = CreateiOSFrameworks (is_simulator_build); + return ios_frameworks; + } + + public static Frameworks CreateiOSFrameworks (bool is_simulator_build) + { + return new Frameworks () { { "AddressBook", "AddressBook", 3 }, { "Security", "Security", 3 }, { "AudioUnit", "AudioToolbox", 3 }, @@ -379,8 +386,6 @@ public static Frameworks GetiOSFrameworks (bool is_simulator_build) // // * RegistrarTest.MT4134 }; - } - return ios_frameworks; } static Frameworks watch_frameworks; @@ -531,6 +536,47 @@ public static Frameworks TVOSFrameworks { } } + static Frameworks catalyst_frameworks; + public static Frameworks GetMacCatalystFrameworks () + { + if (catalyst_frameworks == null) { + catalyst_frameworks = CreateiOSFrameworks (false); + + // These frameworks are not available on Mac Catalyst + catalyst_frameworks ["OpenGLES"].Unavailable = true; + catalyst_frameworks ["NewsstandKit"].Unavailable = true; + catalyst_frameworks ["MediaSetup"].Unavailable = true; + catalyst_frameworks ["NotificationCenter"].Unavailable = true; + catalyst_frameworks ["GLKit"].Unavailable = true; + catalyst_frameworks ["VideoSubscriberAccount"].Unavailable = true; + + // The headers for FileProviderUI exist, but the native linker fails + catalyst_frameworks ["FileProviderUI"].Unavailable = true; + + // The headers for Twitter are there, , but no documentation whatsoever online and the native linker fails too + catalyst_frameworks ["Twitter"].Unavailable = true; + + // These frameworks were added to Catalyst after they were added to iOS, so we have to adjust the Versions fields + var fourteenTwoFrameworks = new [] { + "AddressBook", + "AddressBookUI", + "ARKit", + "AssetsLibrary", + "CarPlay", + "ClassKit", + "HomeKit", + "Messages", + "UserNotificationsUI", + }; + foreach (var fw in fourteenTwoFrameworks) { + var f = catalyst_frameworks [fw]; + f.Version = new Version (14, 2); + f.VersionAvailableInSimulator = new Version (14, 2); + } + } + return catalyst_frameworks; + } + // returns null if the platform doesn't exist (the ErrorHandler machinery is heavy and this file is included in several projects, which makes throwing an exception complicated) public static Frameworks GetFrameworks (ApplePlatform platform, bool is_simulator_build) { @@ -543,6 +589,8 @@ public static Frameworks GetFrameworks (ApplePlatform platform, bool is_simulato return TVOSFrameworks; case ApplePlatform.MacOSX: return MacFrameworks; + case ApplePlatform.MacCatalyst: + return GetMacCatalystFrameworks (); default: return null; } diff --git a/tools/common/Make.common b/tools/common/Make.common index b16500b6ac2f..8d546ba45245 100644 --- a/tools/common/Make.common +++ b/tools/common/Make.common @@ -1,7 +1,9 @@ ../common/SdkVersions.cs: ../common/SdkVersions.cs.in Makefile $(TOP)/Make.config $(Q_GEN) sed \ -e 's/@IOS_SDK_VERSION@/$(IOS_SDK_VERSION)/g' -e 's/@WATCHOS_SDK_VERSION@/$(WATCH_SDK_VERSION)/' -e 's/@TVOS_SDK_VERSION@/$(TVOS_SDK_VERSION)/' -e 's/@OSX_SDK_VERSION@/$(OSX_SDK_VERSION)/' \ + -e 's/@MACCATALYST_SDK_VERSION@/$(MACCATALYST_SDK_VERSION)/g' \ -e 's/@MIN_IOS_SDK_VERSION@/$(MIN_IOS_SDK_VERSION)/g' -e 's/@MIN_WATCHOS_SDK_VERSION@/$(MIN_WATCHOS_SDK_VERSION)/' -e 's/@MIN_TVOS_SDK_VERSION@/$(MIN_TVOS_SDK_VERSION)/' -e 's/@MIN_OSX_SDK_VERSION@/$(MIN_OSX_SDK_VERSION)/' \ + -e 's/@MIN_MACCATALYST_SDK_VERSION@/$(MIN_MACCATALYST_SDK_VERSION)/g' \ -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' \ -e 's/@MIN_XM_MONO_VERSION@/$(MIN_XM_MONO_VERSION)/g' \ -e 's/@MIN_IOS_SIMULATOR_VERSION@/$(MIN_IOS_SIMULATOR_VERSION)/g' \ diff --git a/tools/common/SdkVersions.cs.in b/tools/common/SdkVersions.cs.in index f33eb93f1e60..e83916a7cfaa 100644 --- a/tools/common/SdkVersions.cs.in +++ b/tools/common/SdkVersions.cs.in @@ -16,11 +16,13 @@ namespace Xamarin { public const string iOS = "@IOS_SDK_VERSION@"; public const string WatchOS = "@WATCHOS_SDK_VERSION@"; public const string TVOS = "@TVOS_SDK_VERSION@"; + public const string MacCatalyst = "@MACCATALYST_SDK_VERSION@"; public const string MinOSX = "@MIN_OSX_SDK_VERSION@"; public const string MiniOS = "@MIN_IOS_SDK_VERSION@"; public const string MinWatchOS = "@MIN_WATCHOS_SDK_VERSION@"; public const string MinTVOS = "@MIN_TVOS_SDK_VERSION@"; + public const string MinMacCatalyst = "@MIN_MACCATALYST_SDK_VERSION@"; public const string MiniOSSimulator = "@MIN_IOS_SIMULATOR_VERSION@"; public const string MinWatchOSSimulator = "@MIN_WATCHOS_SIMULATOR_VERSION@"; @@ -40,6 +42,7 @@ namespace Xamarin { public static Version iOSVersion { get { return new Version (iOS); }} public static Version WatchOSVersion { get { return new Version (WatchOS); }} public static Version TVOSVersion { get { return new Version (TVOS); }} + public static Version MacCatalystVersion { get { return new Version (MacCatalyst); }} public static Version iOSTargetVersion { get { return new Version (MaxiOSDeploymentTarget); }} public static Version WatchOSTargetVersion { get { return new Version (MaxWatchDeploymentTarget); }} @@ -49,6 +52,7 @@ namespace Xamarin { public static Version MiniOSVersion { get { return new Version (MiniOS); }} public static Version MinWatchOSVersion { get { return new Version (MinWatchOS); }} public static Version MinTVOSVersion { get { return new Version (MinTVOS); }} + public static Version MinMacCatalystVersion { get { return new Version (MinMacCatalyst); }} public static Version MiniOSSimulatorVersion { get { return new Version (MiniOSSimulator); }} public static Version MinWatchOSSimulatorVersion { get { return new Version (MinWatchOSSimulator); }} @@ -70,6 +74,7 @@ namespace Xamarin { case ApplePlatform.iOS: return iOSVersion; case ApplePlatform.WatchOS: return WatchOSVersion; case ApplePlatform.TVOS: return TVOSVersion; + case ApplePlatform.MacCatalyst: return MacCatalystVersion; default: throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", app.Platform, app.ProductName); } @@ -94,6 +99,7 @@ namespace Xamarin { case ApplePlatform.iOS: return MiniOSVersion; case ApplePlatform.WatchOS: return MinWatchOSVersion; case ApplePlatform.TVOS: return MinTVOSVersion; + case ApplePlatform.MacCatalyst: return MinMacCatalystVersion; default: throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", app.Platform, app.ProductName); } diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index e689f477cfff..2414b22d4da0 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -1571,6 +1571,9 @@ void CollectAvailabilityAttributes (IEnumerable attributes, re case ApplePlatform.MacOSX: currentPlatform = global::ObjCRuntime.PlatformName.MacOSX; break; + case ApplePlatform.MacCatalyst: + currentPlatform = global::ObjCRuntime.PlatformName.MacCatalyst; + break; default: throw ErrorHelper.CreateError (71, Errors.MX0071, App.Platform, App.ProductName); } @@ -2113,6 +2116,9 @@ void CheckNamespace (string ns, List exceptions) if (App.IsSimulatorBuild && !App.IsFrameworkAvailableInSimulator (ns)) { Driver.Log (5, "Not importing the framework {0} in the generated registrar code because it's not available in the simulator.", ns); return; + } else if (Frameworks.GetFrameworks (App.Platform, false).TryGetValue (ns, out var fw) && fw.Unavailable) { + Driver.Log (5, "Not importing the framework {0} in the generated registrar code because it's not available in the current platform.", ns); + return; } string h; diff --git a/tools/common/Target.cs b/tools/common/Target.cs index 54c950947d72..79d4bc68caf0 100644 --- a/tools/common/Target.cs +++ b/tools/common/Target.cs @@ -258,6 +258,11 @@ public void GatherFrameworks () #endif } + if (framework.Unavailable) { + ErrorHelper.Warning (181, Errors.MX0181 /* Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). */, framework.Name, td.FullName, App.PlatformName); + continue; + } + if (App.SdkVersion >= framework.Version) { var add_to = framework.AlwaysWeakLinked || App.DeploymentTarget < framework.Version ? asm.WeakFrameworks : asm.Frameworks; add_to.Add (framework.Name); @@ -320,10 +325,18 @@ public void CollectAllSymbols () bool has_dyn_msgSend; - if (App.Platform == ApplePlatform.MacOSX) { - has_dyn_msgSend = App.MarshalObjectiveCExceptions != MarshalObjectiveCExceptionMode.Disable && !App.RequiresPInvokeWrappers && Is64Build; - } else { + switch (App.Platform) { + case ApplePlatform.iOS: + case ApplePlatform.TVOS: + case ApplePlatform.WatchOS: has_dyn_msgSend = App.IsSimulatorBuild; + break; + case ApplePlatform.MacCatalyst: + case ApplePlatform.MacOSX: + has_dyn_msgSend = App.MarshalObjectiveCExceptions != MarshalObjectiveCExceptionMode.Disable && !App.RequiresPInvokeWrappers && Is64Build; + break; + default: + throw ErrorHelper.CreateError (71, Errors.MX0071, App.Platform, App.ProductName); } if (has_dyn_msgSend) { @@ -380,6 +393,8 @@ bool IsRequiredSymbol (Symbol symbol, Assembly single_assembly = null) // functions are not required if they're used in an assembly which isn't using dlsym, and we're AOT-compiling. if (App.IsSimulatorBuild) return true; + if (App.Platform == ApplePlatform.MacCatalyst) + return true; if (single_assembly != null) return App.UseDlsym (single_assembly.FileName); @@ -537,6 +552,7 @@ public void GenerateMain (StringBuilder sb, ApplePlatform platform, Abi abi, str case ApplePlatform.iOS: case ApplePlatform.TVOS: case ApplePlatform.WatchOS: + case ApplePlatform.MacCatalyst: GenerateIOSMain (sw, abi); break; case ApplePlatform.MacOSX: diff --git a/tools/common/TargetFramework.cs b/tools/common/TargetFramework.cs index 209c0ec5a3a6..6718c9f1aff1 100644 --- a/tools/common/TargetFramework.cs +++ b/tools/common/TargetFramework.cs @@ -18,6 +18,7 @@ public struct TargetFramework : IEquatable public const string DotNet_6_0_tvOS_String = ".NETCoreApp,Version=6.0,Profile=tvos"; // Short form: net6.0-tvos public const string DotNet_6_0_watchOS_String = ".NETCoreApp,Version=6.0,Profile=watchos"; // Short form: net6.0-watchos public const string DotNet_6_0_macOS_String = ".NETCoreApp,Version=6.0,Profile=macos"; // Short form: net6.0-macos + public const string DotNet_6_0_MacCatalyst_String = ".NETCoreApp,Version=6.0,Profile=maccatalyst"; // Short form: net6.0-maccatalyst public static readonly TargetFramework Empty = new TargetFramework (); public static readonly TargetFramework Net_2_0 = Parse ("2.0"); @@ -30,6 +31,7 @@ public struct TargetFramework : IEquatable public static readonly TargetFramework Xamarin_iOS_1_0 = Parse ("Xamarin.iOS,v1.0"); public static readonly TargetFramework Xamarin_WatchOS_1_0 = Parse ("Xamarin.WatchOS,v1.0"); public static readonly TargetFramework Xamarin_TVOS_1_0 = Parse ("Xamarin.TVOS,v1.0"); + public static readonly TargetFramework Xamarin_MacCatalyst_1_0 = Parse ("Xamarin.MacCatalyst,v1.0"); public static readonly TargetFramework Xamarin_Mac_2_0_Mobile = Parse ("Xamarin.Mac,Version=v2.0,Profile=Mobile"); public static readonly TargetFramework Xamarin_Mac_4_5_Full = Parse ("Xamarin.Mac,Version=v4.5,Profile=Full"); @@ -39,6 +41,7 @@ public struct TargetFramework : IEquatable public static readonly TargetFramework DotNet_5_0_tvOS = Parse (DotNet_6_0_tvOS_String); public static readonly TargetFramework DotNet_5_0_watchOS = Parse (DotNet_6_0_watchOS_String); public static readonly TargetFramework DotNet_5_0_macOS = Parse (DotNet_6_0_macOS_String); + public static readonly TargetFramework DotNet_5_0_MacCatalyst = Parse (DotNet_6_0_MacCatalyst_String); public static readonly TargetFramework [] ValidFrameworksMac = new [] { Xamarin_Mac_2_0_Mobile, Xamarin_Mac_4_5_Full, Xamarin_Mac_4_5_System, @@ -47,7 +50,8 @@ public struct TargetFramework : IEquatable public static readonly TargetFramework [] ValidFrameworksiOS = new [] { Xamarin_iOS_1_0, Xamarin_WatchOS_1_0, Xamarin_TVOS_1_0, - DotNet_5_0_iOS, DotNet_5_0_tvOS, DotNet_5_0_watchOS, + Xamarin_MacCatalyst_1_0, + DotNet_5_0_iOS, DotNet_5_0_tvOS, DotNet_5_0_watchOS, DotNet_5_0_MacCatalyst, }; public static IEnumerable AllValidFrameworks { @@ -220,6 +224,8 @@ public ApplePlatform Platform { return ApplePlatform.WatchOS; case "Xamarin.TVOS": return ApplePlatform.TVOS; + case "Xamarin.MacCatalyst": + return ApplePlatform.MacCatalyst; case ".NETCoreApp": switch (Profile) { case "ios": @@ -230,6 +236,8 @@ public ApplePlatform Platform { return ApplePlatform.WatchOS; case "macos": return ApplePlatform.MacOSX; + case "maccatalyst": + return ApplePlatform.MacCatalyst; default: throw new InvalidOperationException (string.Format ("Invalid .NETCoreApp Profile for Apple platforms: {0}", Profile)); } diff --git a/tools/mtouch/Application.mtouch.cs b/tools/mtouch/Application.mtouch.cs index 10945a8b21ab..b8bec636bc3a 100644 --- a/tools/mtouch/Application.mtouch.cs +++ b/tools/mtouch/Application.mtouch.cs @@ -381,12 +381,11 @@ public string BundleId { string GetStringFromInfoPList (string key) { - return GetStringFromInfoPList (AppDirectory, key); + return GetStringFromInfoPList (InfoPListPath, key); } - string GetStringFromInfoPList (string directory, string key) + string GetStringFromInfoPList (string info_plist, string key) { - var info_plist = Path.Combine (directory, "Info.plist"); if (!File.Exists (info_plist)) return null; @@ -813,19 +812,21 @@ void Initialize () throw new ProductException (3, true, Errors.MX0003, root_wo_ext); } + var appContentDirectory = ContentDirectory; + if (IsDualBuild) { var target32 = new Target (this); var target64 = new Target (this); target32.ArchDirectory = Path.Combine (Cache.Location, "32"); - target32.TargetDirectory = IsSimulatorBuild ? Path.Combine (AppDirectory, ".monotouch-32") : Path.Combine (target32.ArchDirectory, "Output"); - target32.AppTargetDirectory = Path.Combine (AppDirectory, ".monotouch-32"); + target32.TargetDirectory = IsSimulatorBuild ? Path.Combine (appContentDirectory, ".monotouch-32") : Path.Combine (target32.ArchDirectory, "Output"); + target32.AppTargetDirectory = Path.Combine (appContentDirectory, ".monotouch-32"); target32.Resolver.ArchDirectory = Driver.GetArch32Directory (this); target32.Abis = SelectAbis (abis, Abi.Arch32Mask); target64.ArchDirectory = Path.Combine (Cache.Location, "64"); - target64.TargetDirectory = IsSimulatorBuild ? Path.Combine (AppDirectory, ".monotouch-64") : Path.Combine (target64.ArchDirectory, "Output"); - target64.AppTargetDirectory = Path.Combine (AppDirectory, ".monotouch-64"); + target64.TargetDirectory = IsSimulatorBuild ? Path.Combine (appContentDirectory, ".monotouch-64") : Path.Combine (target64.ArchDirectory, "Output"); + target64.AppTargetDirectory = Path.Combine (appContentDirectory, ".monotouch-64"); target64.Resolver.ArchDirectory = Driver.GetArch64Directory (this); target64.Abis = SelectAbis (abis, Abi.Arch64Mask); @@ -834,8 +835,8 @@ void Initialize () } else { var target = new Target (this); - target.TargetDirectory = AppDirectory; - target.AppTargetDirectory = IsSimulatorBuild ? AppDirectory : Path.Combine (AppDirectory, Is64Build ? ".monotouch-64" : ".monotouch-32"); + target.TargetDirectory = appContentDirectory; + target.AppTargetDirectory = IsSimulatorBuild ? appContentDirectory : Path.Combine (appContentDirectory, Is64Build ? ".monotouch-64" : ".monotouch-32"); target.ArchDirectory = Cache.Location; target.Resolver.ArchDirectory = Driver.GetArchDirectory (this, Is64Build); target.Abis = abis; @@ -844,10 +845,10 @@ void Initialize () // Make sure there aren't any lingering .monotouch-* directories. if (IsSimulatorBuild) { - var dir = Path.Combine (AppDirectory, ".monotouch-32"); + var dir = Path.Combine (appContentDirectory, ".monotouch-32"); if (Directory.Exists (dir)) Directory.Delete (dir, true); - dir = Path.Combine (AppDirectory, ".monotouch-64"); + dir = Path.Combine (appContentDirectory, ".monotouch-64"); if (Directory.Exists (dir)) Directory.Delete (dir, true); } @@ -899,6 +900,13 @@ void Initialize () DeploymentTarget = new Version (8, 0); } + if (Platform == ApplePlatform.MacCatalyst) { + // The deployment target we expect for Mac Catalyst is the macOS version, + // but we're expected to provide the corresponding iOS version pretty much + // everywhere, so convert here. + DeploymentTarget = GetMacCatalystiOSVersion (DeploymentTarget); + } + if (!enable_msym.HasValue) enable_msym = !EnableDebug && IsDeviceBuild; @@ -1012,6 +1020,10 @@ public string Executable { get { if (Embeddinator) return Path.Combine (AppDirectory, "Frameworks", ExecutableName + ".framework", ExecutableName); + + if (Platform == ApplePlatform.MacCatalyst) + return Path.Combine (AppDirectory, "Contents", "MacOS", ExecutableName); + return Path.Combine (AppDirectory, ExecutableName); } } @@ -1077,7 +1089,7 @@ void BuildApp () link_tasks.AddRange (target.NativeLink (build_tasks)); } - if (IsDeviceBuild) { + if (IsDeviceBuild || Platform == ApplePlatform.MacCatalyst) { // If building for the simulator, the executable is written directly into the expected location within the .app, and no lipo/file copying is needed. if (link_tasks.Count > 1) { // If we have more than one executable, we must lipo them together. @@ -1218,7 +1230,7 @@ void BuildBundle () foreach (var kvp in bundle_files) { var name = kvp.Key; var info = kvp.Value; - var targetPath = Path.Combine (AppDirectory, name); + var targetPath = Path.Combine (ContentDirectory, name); var files = info.Sources; var isFramework = Directory.Exists (files.First ()); @@ -1773,10 +1785,10 @@ public void BundleAssemblies () assemblies [0].CopyToDirectory (assemblies [0].Target.AppTargetDirectory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); assemblies [1].CopyToDirectory (assemblies [1].Target.AppTargetDirectory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); } else { - assemblies [0].CopyToDirectory (AppDirectory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); + assemblies [0].CopyToDirectory (ContentDirectory, copy_debug_symbols: PackageManagedDebugSymbols, strip: strip, only_copy: true); } foreach (var asm in assemblies) - asm.CopyAotDataFilesToDirectory (size_specific ? asm.Target.AppTargetDirectory : AppDirectory); + asm.CopyAotDataFilesToDirectory (size_specific ? asm.Target.AppTargetDirectory : ContentDirectory); break; case AssemblyBuildTarget.Framework: // Put our resources in a subdirectory in the framework @@ -1807,7 +1819,7 @@ public void GenerateRuntimeOptions () if (LinkMode != LinkMode.None) return; - RuntimeOptions.Write (AppDirectory); + RuntimeOptions.Write (ContentDirectory); } public void CreateFrameworkNotice (string output_path) diff --git a/tools/mtouch/BuildTasks.mtouch.cs b/tools/mtouch/BuildTasks.mtouch.cs index 3c22e75b3034..264b864a5f26 100644 --- a/tools/mtouch/BuildTasks.mtouch.cs +++ b/tools/mtouch/BuildTasks.mtouch.cs @@ -438,6 +438,16 @@ public static void GetCompilerFlags (Application app, CompilerFlags flags, bool flags.AddOtherFlag ("-Qunused-arguments"); // don't complain about unused arguments (clang reports -std=c99 and -Isomething as unused). } + public static void GetCatalystCompilerFlags (CompilerFlags flags, Abi abi, Application app) + { + GetCompilerFlags (app, flags, false); + flags.AddOtherFlag ($"-target", $"{abi.AsArchString ()}-apple-ios{app.DeploymentTarget}-macabi"); + var isysroot = Driver.GetFrameworkDirectory (app); + flags.AddOtherFlag ($"-isystem", Path.Combine (isysroot, "System", "iOSSupport", "usr", "include")); + flags.AddOtherFlag ($"-iframework", Path.Combine (isysroot, "System", "iOSSupport", "System", "Library", "Frameworks")); + flags.AddOtherFlag ($"-L{Path.Combine (isysroot, "System", "iOSSupport", "usr", "lib")}"); + } + public static void GetSimulatorCompilerFlags (CompilerFlags flags, bool is_assembler, Application app, string language = null) { GetCompilerFlags (app, flags, is_assembler, language); @@ -517,6 +527,8 @@ protected async Task CompileAsync () { if (App.IsDeviceBuild) { GetDeviceCompilerFlags (CompilerFlags, IsAssembler); + } else if (App.Platform == ApplePlatform.MacCatalyst) { + GetCatalystCompilerFlags (CompilerFlags, Abi, App); } else { GetSimulatorCompilerFlags (CompilerFlags, IsAssembler, App, Language); } diff --git a/tools/mtouch/Errors.designer.cs b/tools/mtouch/Errors.designer.cs index 153c2a8d116d..042f49b4f2ff 100644 --- a/tools/mtouch/Errors.designer.cs +++ b/tools/mtouch/Errors.designer.cs @@ -1097,6 +1097,30 @@ internal static string MX0180 { } } + internal static string MX0181 { + get { + return ResourceManager.GetString("MX0181", resourceCulture); + } + } + + internal static string MX0182 { + get { + return ResourceManager.GetString("MX0182", resourceCulture); + } + } + + internal static string MX0183 { + get { + return ResourceManager.GetString("MX0183", resourceCulture); + } + } + + internal static string MX0184 { + get { + return ResourceManager.GetString("MX0184", resourceCulture); + } + } + internal static string MX1009 { get { return ResourceManager.GetString("MX1009", resourceCulture); diff --git a/tools/mtouch/Errors.resx b/tools/mtouch/Errors.resx index 89f4f6110d38..9da3193416d4 100644 --- a/tools/mtouch/Errors.resx +++ b/tools/mtouch/Errors.resx @@ -915,6 +915,22 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/Makefile b/tools/mtouch/Makefile index 06178575534b..c034b02e442a 100644 --- a/tools/mtouch/Makefile +++ b/tools/mtouch/Makefile @@ -251,6 +251,7 @@ $(eval $(call RunRegistrar,watchos,x86_64,64,$(WATCH_SDK_VERSION),WatchOS,$(SIMU $(eval $(call RunRegistrar,watchos,i386,32,$(WATCH_SDK_VERSION),WatchOS,$(SIMULATORWATCH_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/include,$(MONOTOUCH_WATCH_MONO_PATH),watchOS,watchos-x86)) $(eval $(call RunRegistrar,watchos,armv7k,32,$(WATCH_SDK_VERSION),WatchOS,$(DEVICEWATCH_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/include,$(MONOTOUCH_WATCH_MONO_PATH),watchOS,armv7k)) $(eval $(call RunRegistrar,watchos,arm64_32,32,$(WATCH_SDK_VERSION),WatchOS,$(DEVICEWATCH64_32_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/include,$(MONOTOUCH_WATCH_MONO_PATH),watchOS,arm64_32)) +$(eval $(call RunRegistrar,maccatalyst,x86_64,64,$(MACCATALYST_SDK_VERSION),MacCatalyst,$(MACCATALYST_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/include,$(MONOTOUCH_MACCATALYST_MONO_PATH),MacCatalyst,maccatalyst-x64)) %.registrar.ios.simulator.a: %.registrar.ios.i386.a %.registrar.ios.x86_64.a $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ @@ -302,6 +303,12 @@ TARGETS += $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib/Xamarin.TVOS.registrar.a endif endif +ifdef INCLUDE_MACCATALYST +TARGETS += \ + $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/Xamarin.MacCatalyst.registrar.a \ + +endif + TARGET_DIRS_DOTNET = \ $(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/Microsoft.$(platform).Runtime.$(rid)/runtimes/$(rid)/native)) \ @@ -355,6 +362,9 @@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib/%.registrar.a: %.registrar.watchos.devi $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib/%.registrar.a: %.registrar.tvos.arm64.a | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib $(Q) $(CP) $< $@ +$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib/%.registrar.a: %.registrar.maccatalyst.x86_64.a | $(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib + $(Q) $(CP) $< $@ + define InstallRegistrar $(DOTNET_DESTDIR)/Microsoft.$(1).Runtime.$(2)/runtimes/$(2)/native/Microsoft.$(1).registrar.a: .libs/Microsoft.$(1).registrar.$(rid).a | $(DOTNET_DESTDIR)/Microsoft.$(1).Runtime.$(2)/runtimes/$(2)/native $(Q) $(CP) $$< $$@ diff --git a/tools/mtouch/Target.mtouch.cs b/tools/mtouch/Target.mtouch.cs index 843e59c1f2ab..2d2dfb8c5fad 100644 --- a/tools/mtouch/Target.mtouch.cs +++ b/tools/mtouch/Target.mtouch.cs @@ -382,8 +382,14 @@ void ComputeListOfAssemblies (HashSet assemblies, AssemblyDefinition ass case "Xamarin.iOS": case "Xamarin.TVOS": case "Xamarin.WatchOS": - if (reference.Name != Driver.GetProductAssembly (App)) + case "Xamarin.MacCatalyst": + if (reference.Name != Driver.GetProductAssembly (App)) { + if (App.Platform == ApplePlatform.MacCatalyst && reference.Name == "Xamarin.iOS") { + // This is allowed, because it's a facade + break; + } exceptions.Add (ErrorHelper.CreateError (34, Errors.MT0034, reference.Name, Driver.TargetFramework.Identifier, assembly.FullName)); + } break; } @@ -944,6 +950,9 @@ void AOTCompile () if (App.IsSimulatorBuild) return; + if (App.Platform == ApplePlatform.MacCatalyst) + return; + // Here we create the tasks to run the AOT compiler. foreach (var a in Assemblies) { if (!a.IsAOTCompiled) @@ -1323,6 +1332,10 @@ public void Compile () method = "xamarin_create_classes_Xamarin_TVOS"; library = "Xamarin.TVOS.registrar.a"; break; + case ApplePlatform.MacCatalyst: + method = "xamarin_create_classes_Xamarin_MacCatalyst"; + library = "Xamarin.MacCatalyst.registrar.a"; + break; default: throw ErrorHelper.CreateError (71, Errors.MX0071, App.Platform, "Xamarin.iOS"); } @@ -1430,6 +1443,8 @@ public NativeLinkTask NativeLink (BuildTasks build_tasks, Abi abi, string output if (App.IsDeviceBuild) { linker_flags.AddOtherFlag ($"-m{Driver.GetTargetMinSdkName (App)}-version-min={App.DeploymentTarget}"); linker_flags.AddOtherFlag ($"-isysroot", Driver.GetFrameworkDirectory (App)); + } else if (App.Platform == ApplePlatform.MacCatalyst) { + CompileTask.GetCatalystCompilerFlags (linker_flags, abi, App); } else { CompileTask.GetSimulatorCompilerFlags (linker_flags, false, App); } @@ -1622,6 +1637,7 @@ void HandleMonoNative (Application app, CompilerFlags compiler_flags) compiler_flags.AddLinkWith (libnative); switch (app.Platform) { case ApplePlatform.iOS: + case ApplePlatform.MacCatalyst: Driver.Log (3, "Adding GSS framework reference."); compiler_flags.AddFramework ("GSS"); break; diff --git a/tools/mtouch/mtouch.cs b/tools/mtouch/mtouch.cs index 5630f7513de8..456f165794ad 100644 --- a/tools/mtouch/mtouch.cs +++ b/tools/mtouch/mtouch.cs @@ -156,6 +156,7 @@ public static string GetArch64Directory (Application app) case ApplePlatform.iOS: case ApplePlatform.TVOS: case ApplePlatform.WatchOS: + case ApplePlatform.MacCatalyst: return Path.Combine (GetPlatformFrameworkDirectory (app), "..", "..", "64bits", app.PlatformName); default: throw ErrorHelper.CreateError (71, Errors.MX0071, app.Platform, "Xamarin.iOS"); diff --git a/tools/mtouch/xlf/Errors.cs.xlf b/tools/mtouch/xlf/Errors.cs.xlf index 39198f3ac9dd..eabfadc679b6 100644 --- a/tools/mtouch/xlf/Errors.cs.xlf +++ b/tools/mtouch/xlf/Errors.cs.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.de.xlf b/tools/mtouch/xlf/Errors.de.xlf index 9290b5f8c4d9..e1dbe09eeb4d 100644 --- a/tools/mtouch/xlf/Errors.de.xlf +++ b/tools/mtouch/xlf/Errors.de.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.es.xlf b/tools/mtouch/xlf/Errors.es.xlf index d82d1fc9a874..22a21a1aa095 100644 --- a/tools/mtouch/xlf/Errors.es.xlf +++ b/tools/mtouch/xlf/Errors.es.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.fr.xlf b/tools/mtouch/xlf/Errors.fr.xlf index 29b257fc7d17..64140a44aac2 100644 --- a/tools/mtouch/xlf/Errors.fr.xlf +++ b/tools/mtouch/xlf/Errors.fr.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.it.xlf b/tools/mtouch/xlf/Errors.it.xlf index 929bd7bc685f..77a8c3106eeb 100644 --- a/tools/mtouch/xlf/Errors.it.xlf +++ b/tools/mtouch/xlf/Errors.it.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.ja.xlf b/tools/mtouch/xlf/Errors.ja.xlf index a967d5868295..76420eb0c30c 100644 --- a/tools/mtouch/xlf/Errors.ja.xlf +++ b/tools/mtouch/xlf/Errors.ja.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.ko.xlf b/tools/mtouch/xlf/Errors.ko.xlf index 97b74f55360f..09a25b0fdd6c 100644 --- a/tools/mtouch/xlf/Errors.ko.xlf +++ b/tools/mtouch/xlf/Errors.ko.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.pl.xlf b/tools/mtouch/xlf/Errors.pl.xlf index c7797ac1e20d..f0a036922425 100644 --- a/tools/mtouch/xlf/Errors.pl.xlf +++ b/tools/mtouch/xlf/Errors.pl.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.pt-BR.xlf b/tools/mtouch/xlf/Errors.pt-BR.xlf index 760abf3bf0e3..eaea005867f4 100644 --- a/tools/mtouch/xlf/Errors.pt-BR.xlf +++ b/tools/mtouch/xlf/Errors.pt-BR.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.ru.xlf b/tools/mtouch/xlf/Errors.ru.xlf index 3a2537cfb213..c2eb9f5cd258 100644 --- a/tools/mtouch/xlf/Errors.ru.xlf +++ b/tools/mtouch/xlf/Errors.ru.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.tr.xlf b/tools/mtouch/xlf/Errors.tr.xlf index 04fc925a9a51..04a8730375de 100644 --- a/tools/mtouch/xlf/Errors.tr.xlf +++ b/tools/mtouch/xlf/Errors.tr.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.zh-Hans.xlf b/tools/mtouch/xlf/Errors.zh-Hans.xlf index 734f48d3deab..99b574d2bb07 100644 --- a/tools/mtouch/xlf/Errors.zh-Hans.xlf +++ b/tools/mtouch/xlf/Errors.zh-Hans.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/tools/mtouch/xlf/Errors.zh-Hant.xlf b/tools/mtouch/xlf/Errors.zh-Hant.xlf index a98ab6cb27f2..0b4b1d74b9e1 100644 --- a/tools/mtouch/xlf/Errors.zh-Hant.xlf +++ b/tools/mtouch/xlf/Errors.zh-Hant.xlf @@ -2592,6 +2592,26 @@ This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or set the managed linker behaviour to Link Framework SDKs Only in your project's iOS Build Options > Linker Behavior (to try to avoid the new APIs). + + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (used by the type {1}) because it's not available on the current platform ({2}). + + + + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + Not linking with the framework {0} (referenced by a module reference in {1}) because it's not available on the current platform ({2}). + + + + Could not map the iOS version {0} to a macOS version for Mac Catalyst + Could not map the iOS version {0} to a macOS version for Mac Catalyst + + + + Could not map the Mac Catalyst version {0} to an iOS version + Could not map the Mac Catalyst version {0} to an iOS version + + Could not copy the assembly '{0}' to '{1}': {2} diff --git a/versions-check.csharp b/versions-check.csharp index 99be081488a2..288dd00603bd 100755 --- a/versions-check.csharp +++ b/versions-check.csharp @@ -2,17 +2,17 @@ // this script is to make sure our versions.plist files are not out of date with our min/max supported OS versions. -// arguments are: plistPath iOSMinVersion iOSMaxVersion tvOSMinVersion tvOSMaxVersion watchOSMinVersion watchOSMaxVersion macOSMinVersion macOSMaxVersion +// arguments are: plistPath iOSMinVersion iOSMaxVersion tvOSMinVersion tvOSMaxVersion watchOSMinVersion watchOSMaxVersion macOSMinVersion macOSMaxVersion MacCatalystOSMinVersion MacCatalystOSMaxVersion using System.IO; using System.Xml; var args = Environment.GetCommandLineArgs (); -if (args.Length != 11 /* 2 default + 9 real */) { +if (args.Length != 13 /* 2 default + 9 real */) { // first arg is "/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/4.5/csharp.exe" // second arg the script itself // then comes the ones we care about - Console.WriteLine ("Need 9 arguments, got {0}", args.Length - 2); + Console.WriteLine ("Need 11 arguments, got {0}", args.Length - 2); Environment.Exit (1); return; } @@ -26,6 +26,8 @@ var watchOSMin = args [7]; var watchOSMax = args [8]; var macOSMin = args [9]; var macOSMax = args [10]; +var MacCatalystMin = args [11]; +var MacCatalystMax = args [12]; var doc = new System.Xml.XmlDocument (); doc.Load (plistPath); @@ -53,11 +55,11 @@ var check = new Action ((product, min, max) => } else if (version > maxVersion) { Console.Error.WriteLine ($"Found the {product} version {v} in {Path.GetFileName (plistPath)}, but it's higher than the supported max {product} version we support ({max})."); failed = true; - } else if (version == maxVersion) { + } + if (version == maxVersion) foundMax = true; - } else if (version == minVersion) { + if (version == minVersion) foundMin = true; - } } if (!foundMax) { Console.Error.WriteLine ($"Could not find the max {product} version {max} in {Path.GetFileName (plistPath)}."); @@ -73,5 +75,6 @@ check ("iOS", iOSMin, iOSMax); check ("tvOS", tvOSMin, tvOSMax); check ("watchOS", watchOSMin, watchOSMax); check ("macOS", macOSMin, macOSMax); +check ("MacCatalyst", MacCatalystMin, MacCatalystMax); Environment.Exit (failed ? 1 : 0);