diff --git a/Make.config b/Make.config index 673608c612a6..cf6441445f81 100644 --- a/Make.config +++ b/Make.config @@ -226,7 +226,9 @@ SIMULATORWATCH_OBJC_CFLAGS = $(SIMULATORWATCH_CFLAGS) $(COMMON_SIMULATOR_OBJC_CF DEVICEWATCH_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/WatchOS.platform/Developer/SDKs/WatchOS$(WATCH_SDK_VERSION).sdk DEVICEWATCH_CFLAGS = -arch armv7k -mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK) $(CFLAGS) -fembed-bitcode $(IOS_COMMON_DEFINES) +DEVICEWATCH64_32_CFLAGS = -arch arm64_32 -mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK) $(CFLAGS) -fembed-bitcode $(IOS_COMMON_DEFINES) DEVICEWATCH_OBJC_CFLAGS = $(DEVICEWATCH_CFLAGS) $(DEVICE_OBJC_CFLAGS) +DEVICEWATCH64_32_OBJC_CFLAGS = $(DEVICEWATCH64_32_CFLAGS) $(DEVICE_OBJC_CFLAGS) # TVOS diff --git a/Versions-ios.plist.in b/Versions-ios.plist.in index 7e03641bd020..9f6c68e394f4 100644 --- a/Versions-ios.plist.in +++ b/Versions-ios.plist.in @@ -142,6 +142,7 @@ http-client-handlers mono-symbol-archive sgen-concurrent-gc + arm64_32 Optimizations diff --git a/builds/Makefile b/builds/Makefile index 6bd3a23d4af8..d13a34694eaf 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -1310,15 +1310,16 @@ WATCHOS_BIN_PATH = $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/u ifdef INCLUDE_WATCH ifdef INCLUDE_DEVICE -build:: build-targetwatch -clean-local:: clean-targetwatch +build:: build-targetwatch build-targetwatch64_32 +clean-local:: clean-targetwatch clean-targetwatch64_32 install-local:: install-watchos all-local:: install-watchos targetwatch: build-targetwatch install-watchos -watchos:: targetwatch +targetwatch64_32: build-targetwatch64_32 install-watch64_32 +watchos:: targetwatch targetwatch64_32 -.PHONY: targetwatch +.PHONY: targetwatch targetwatch64_32 .stamp-build-targetwatch: .stamp-build-crosswatch $(MONO_PATH)/configure $(SDK_CONFIG) $(MONO_DEPENDENCIES) $(MAKE) -C $(SDK_BUILDDIR) package-ios-targetwatch $(SDK_ARGS) @@ -1326,39 +1327,84 @@ watchos:: targetwatch $(Q) $(CP) -r $(SDK_DESTDIR)/ios-targetwatch-release/* $(BUILD_DESTDIR)/targetwatch $(Q) touch $@ +.stamp-build-targetwatch64_32: $(MONO_PATH)/configure $(SDK_CONFIG) $(MONO_DEPENDENCIES) + $(MAKE) -C $(SDK_BUILDDIR) package-ios-targetwatch64_32 $(SDK_ARGS) + $(Q) mkdir -p $(BUILD_DESTDIR)/targetwatch64_32 + $(Q) $(CP) -r $(SDK_DESTDIR)/ios-targetwatch64_32-release/* $(BUILD_DESTDIR)/targetwatch64_32 + $(Q) touch $@ + build-targetwatch: .stamp-build-targetwatch +build-targetwatch64_32: .stamp-build-targetwatch64_32 clean-targetwatch: $(Q) rm -rf $(BUILD_DESTDIR)/targetwatch .stamp-*-targetwatch $(MAKE) -C $(SDK_BUILDDIR) clean-ios-targetwatch $(SDK_ARGS) -setup-watchos: setup-targetwatch -build-watchos: build-targetwatch -clean-watchos: clean-targetwatch - -WATCHOS_TARGET_LIBMONOSGEN = $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.a -WATCHOS_TARGET_SHAREDMONOSGEN = $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.dylib -WATCHOS_TARGET_LIBLOGPROFILER = $(BUILD_DESTDIR)/targetwatch/lib/libmono-profiler-log-static.a -WATCHOS_TARGET_LIBMONOEEINTERP = $(BUILD_DESTDIR)/targetwatch/lib/libmono-ee-interp.a -WATCHOS_TARGET_LIBMONOICALLTABLE = $(BUILD_DESTDIR)/targetwatch/lib/libmono-icall-table.a -WATCHOS_TARGET_LIBMONOILGEN = $(BUILD_DESTDIR)/targetwatch/lib/libmono-ilgen.a -WATCHOS_TARGET_SHAREDLIBLOGPROFILER = $(BUILD_DESTDIR)/targetwatch/lib/libmono-profiler-log.0.dylib -WATCHOS_TARGET_LIBMONONATIVECOMPAT = $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-compat.a -WATCHOS_TARGET_LIBMONONATIVEUNIFIED = $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-unified.a -WATCHOS_TARGET_SHAREDLIBMONONATIVECOMPAT = $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-compat.dylib -WATCHOS_TARGET_SHAREDLIBMONONATIVEUNIFIED = $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-unified.dylib - -$(WATCHOS_TARGET_LIBMONOSGEN): .stamp-build-targetwatch -$(WATCHOS_TARGET_SHAREDMONOSGEN): .stamp-build-targetwatch -$(WATCHOS_TARGET_LIBLOGPROFILER): .stamp-build-targetwatch -$(WATCHOS_TARGET_LIBMONOEEINTERP): .stamp-build-targetwatch -$(WATCHOS_TARGET_LIBMONOICALLTABLE): .stamp-build-targetwatch -$(WATCHOS_TARGET_LIBMONOILGEN): .stamp-build-targetwatch -$(WATCHOS_TARGET_SHAREDLIBLOGPROFILER): .stamp-build-targetwatch -$(WATCHOS_TARGET_LIBMONONATIVECOMPAT): .stamp-build-targetwatch -$(WATCHOS_TARGET_LIBMONONATIVEUNIFIED): .stamp-build-targetwatch -$(WATCHOS_TARGET_SHAREDLIBMONONATIVECOMPAT): .stamp-build-targetwatch -$(WATCHOS_TARGET_SHAREDLIBMONONATIVEUNIFIED): .stamp-build-targetwatch +clean-targetwatch64_32: + $(Q) rm -rf $(BUILD_DESTDIR)/targetwatch64_32 .stamp-*-targetwatch64_32 + $(MAKE) -C $(SDK_BUILDDIR) clean-ios-targetwatch64_32 $(SDK_ARGS) + +setup-watchos: setup-targetwatch setup-targetwatch64_32 +build-watchos: build-targetwatch build-targetwatch64_32 +clean-watchos: clean-targetwatch clean-targetwatch64_32 + +WATCHOS_TARGET_LIBMONOSGEN = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.a \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmonosgen-2.0.a + +WATCHOS_TARGET_SHAREDMONOSGEN = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.dylib \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmonosgen-2.0.dylib + +WATCHOS_TARGET_LIBLOGPROFILER = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-profiler-log-static.a \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-profiler-log-static.a + +WATCHOS_TARGET_LIBMONOEEINTERP = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-ee-interp.a \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-ee-interp.a + +WATCHOS_TARGET_LIBMONOICALLTABLE = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-icall-table.a \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-icall-table.a + +WATCHOS_TARGET_LIBMONOILGEN = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-ilgen.a \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-ilgen.a + +WATCHOS_TARGET_SHAREDLIBLOGPROFILER = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-profiler-log.0.dylib \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-profiler-log.0.dylib + +WATCHOS_TARGET_LIBMONONATIVECOMPAT = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-compat.a \ + +WATCHOS_TARGET_LIBMONONATIVEUNIFIED = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-unified.a \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-native.a \ + +WATCHOS_TARGET_SHAREDLIBMONONATIVECOMPAT = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-compat.dylib \ + +WATCHOS_TARGET_SHAREDLIBMONONATIVEUNIFIED = \ + $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-unified.dylib \ + $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-native.dylib \ + +WATCHOS_TARGET_MONOFRAMEWORK = \ + $(BUILD_DESTDIR)/targetwatch/tmp-lib/Mono \ + $(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/Mono + +$(WATCHOS_TARGET_LIBMONOSGEN): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_SHAREDMONOSGEN): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_LIBLOGPROFILER): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_LIBMONOEEINTERP): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_LIBMONOICALLTABLE): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_LIBMONOILGEN): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_SHAREDLIBLOGPROFILER): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_LIBMONONATIVECOMPAT): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_LIBMONONATIVEUNIFIED): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_SHAREDLIBMONONATIVECOMPAT): .stamp-build-targetwatch .stamp-build-targetwatch64_32 +$(WATCHOS_TARGET_SHAREDLIBMONONATIVEUNIFIED): .stamp-build-targetwatch .stamp-build-targetwatch64_32 device:: watchos @@ -1385,7 +1431,9 @@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmonosgen-2.0.a: $(WATCHOS_TARGET $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHOS_TARGET_LIBMONOSGEN) -create -output $@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmonosgen-2.0.dylib: $(WATCHOS_TARGET_SHAREDMONOSGEN) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib - $(Q_STRIP) $(WATCHOS_BIN_PATH)/bitcode_strip $(WATCHOS_TARGET_SHAREDMONOSGEN) -m -o $@ + $(Q_STRIP) $(WATCHOS_BIN_PATH)/bitcode_strip $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.dylib -m -o $(BUILD_DESTDIR)/targetwatch/tmp-lib/libmonosgen-2.0.dylib + $(Q_STRIP) $(WATCHOS_BIN_PATH)/bitcode_strip $(BUILD_DESTDIR)/targetwatch64_32/lib/libmonosgen-2.0.dylib -m -o $(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/libmonosgen-2.0.dylib + $(Q_STRIP) $(WATCHOS_BIN_PATH)/lipo $(BUILD_DESTDIR)/targetwatch/tmp-lib/libmonosgen-2.0.dylib $(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/libmonosgen-2.0.dylib -create -output $@ $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @rpath/libmonosgen-2.0.dylib $@ $(Q) dsymutil -t 4 -o $@.dSYM $@ @@ -1402,8 +1450,13 @@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-ilgen.a: $(WATCHOS_TARGET_L $(Q) $(WATCHOS_BIN_PATH)/lipo $(WATCHOS_TARGET_LIBMONOILGEN) -create -output $@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-profiler-log.dylib: $(WATCHOS_TARGET_SHAREDLIBLOGPROFILER) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib - $(Q) $(WATCHOS_BIN_PATH)/bitcode_strip $(WATCHOS_TARGET_SHAREDLIBLOGPROFILER) -m -o $@ - $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @rpath/libmono-profiler-log.dylib -change $(SDK_DESTDIR)/ios-targetwatch-release/lib/libmonosgen-2.0.1.dylib @rpath/libmonosgen-2.0.dylib $@ + $(Q) $(WATCHOS_BIN_PATH)/bitcode_strip $(BUILD_DESTDIR)/targetwatch/lib/libmono-profiler-log.0.dylib -m -o $(BUILD_DESTDIR)/targetwatch/tmp-lib/libmono-profiler-log.0.dylib + $(Q) $(WATCHOS_BIN_PATH)/bitcode_strip $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-profiler-log.0.dylib -m -o $(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/libmono-profiler-log.0.dylib + $(Q) $(WATCHOS_BIN_PATH)/lipo $(BUILD_DESTDIR)/targetwatch/tmp-lib/libmono-profiler-log.0.dylib $(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/libmono-profiler-log.0.dylib -create -output $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @rpath/libmono-profiler-log.dylib \ + -change $(SDK_DESTDIR)/ios-targetwatch-release/lib/libmonosgen-2.0.1.dylib @rpath/libmonosgen-2.0.dylib \ + -change $(SDK_DESTDIR)/ios-targetwatch64_32-release/lib/libmonosgen-2.0.1.dylib @rpath/libmonosgen-2.0.dylib \ + $@ $(Q) dsymutil -t 4 -o $@.dSYM $@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-native-compat.a: $(WATCHOS_TARGET_LIBMONONATIVECOMPAT) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib @@ -1418,15 +1471,22 @@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-native-compat.dylib: $(WATC $(Q) dsymutil -t 4 -o $@.dSYM $@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib/libmono-native-unified.dylib: $(WATCHOS_TARGET_SHAREDLIBMONONATIVEUNIFIED) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib - $(Q) $(WATCHOS_BIN_PATH)/bitcode_strip $(WATCHOS_TARGET_SHAREDLIBMONONATIVEUNIFIED) -m -o $@ - $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @rpath/libmono-native-unified.dylib -change $(SDK_DESTDIR)/ios-targetwatch-release/lib/libmono-native-unified.dylib @rpath/libmono-native-unified.dylib -change $(SDK_DESTDIR)/ios-targetwatch-release/lib/libmonosgen-2.0.1.dylib @rpath/libmonosgen-2.0.dylib $@ + $(Q_STRIP) $(WATCHOS_BIN_PATH)/bitcode_strip $(BUILD_DESTDIR)/targetwatch/lib/libmono-native-unified.dylib -m -o $(BUILD_DESTDIR)/targetwatch/tmp-lib/libmono-native-unified.dylib + $(Q_STRIP) $(WATCHOS_BIN_PATH)/bitcode_strip $(BUILD_DESTDIR)/targetwatch64_32/lib/libmono-native.dylib -m -o $(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/libmono-native.dylib + $(Q_STRIP) $(WATCHOS_BIN_PATH)/lipo $(BUILD_DESTDIR)/targetwatch/tmp-lib/libmono-native-unified.dylib $(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/libmono-native.dylib -create -output $@ + $(Q) $(WATCHOS_BIN_PATH)/install_name_tool -id @rpath/libmono-native-unified.dylib \ + -change $(SDK_DESTDIR)/ios-targetwatch64_32-release/lib/libmono-native.dylib @rpath/libmono-native-unified.dylib \ + -change $(SDK_DESTDIR)/ios-targetwatch64_32-release/lib/libmonosgen-2.0.1.dylib @rpath/libmonosgen-2.0.dylib \ + -change $(SDK_DESTDIR)/ios-targetwatch-release/lib/libmono-native-unified.dylib @rpath/libmono-native-unified.dylib \ + -change $(SDK_DESTDIR)/ios-targetwatch-release/lib/libmonosgen-2.0.1.dylib @rpath/libmonosgen-2.0.dylib \ + $@ $(Q) dsymutil -t 4 -o $@.dSYM $@ $(WATCHOS_DIRECTORIES): $(Q) mkdir -p $@ -$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Mono: $(BUILD_DESTDIR)/targetwatch/tmp-lib/Mono | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework - $(Q) $(CP) $< $@ +$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Mono: $(WATCHOS_TARGET_MONOFRAMEWORK) | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework + $(Q) lipo $(WATCHOS_TARGET_MONOFRAMEWORK) -create -output $@ $(Q) dsymutil -t 4 -o $(patsubst %/,%,$(dir $@)).dSYM $@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Info.plist: Mono.framework-watchos.Info.plist | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework @@ -1435,6 +1495,9 @@ $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks/Mono.framework/Info.plist: Mono. $(BUILD_DESTDIR)/targetwatch/tmp-lib/Mono: $(BUILD_DESTDIR)/targetwatch/lib/libmonosgen-2.0.a $(Q_GEN) CC="$(IOS_CC)" ./create-shared-library.sh $< $@ -arch armv7k -install_name @rpath/Mono.framework/Mono -mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK) -lc++ -fembed-bitcode +$(BUILD_DESTDIR)/targetwatch64_32/tmp-lib/Mono: $(BUILD_DESTDIR)/targetwatch64_32/lib/libmonosgen-2.0.a + $(Q_GEN) CC="$(IOS_CC)" ./create-shared-library.sh $< $@ -arch arm64_32 -install_name @rpath/Mono.framework/Mono -mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK) -lc++ -fembed-bitcode + install-watchos: $(WATCHOS_TARGETS) endif # INCLUDE_DEVICE diff --git a/external/mono b/external/mono index 7361a4f01c77..16c6ac81b39b 160000 --- a/external/mono +++ b/external/mono @@ -1 +1 @@ -Subproject commit 7361a4f01c77f0d643f3e4b6d1bc58a7ced9289c +Subproject commit 16c6ac81b39bdb26786c2fda155a0a3500961798 diff --git a/mk/rules.mk b/mk/rules.mk index 3900858a9de8..79aadf8ff4bd 100644 --- a/mk/rules.mk +++ b/mk/rules.mk @@ -12,6 +12,7 @@ DEV64_I := $(COMMON_I) SIMW_I := $(COMMON_I) DEVW_I := $(COMMON_I) +DEVW64_32_I := $(COMMON_I) SIM_TV_I:= $(COMMON_I) DEV_TV_I:= $(COMMON_I) @@ -120,6 +121,18 @@ define NativeCompilationTemplate .libs/watchos/%$(1).armv7k.framework: | .libs/watchos $$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks -fapplication-extension +.libs/watchos/%$(1).arm64_32.o: %.m $(EXTRA_DEPENDENCIES) | .libs/watchos + $$(call Q_2,OBJC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_OBJC_CFLAGS) $$(EXTRA_DEFINES) $(DEVW64_32_I) -g $(2) -c $$< -o $$@ + +.libs/watchos/%$(1).arm64_32.o: %.c $(EXTRA_DEPENDENCIES) | .libs/watchos + $$(call Q_2,CC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_DEFINES) $(DEVW64_32_I) -g $(2) -c $$< -o $$@ + +.libs/watchos/%$(1).arm64_32.dylib: | .libs/watchos + $$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/usr/lib -fapplication-extension + +.libs/watchos/%$(1).arm64_32.framework: | .libs/watchos + $$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks -fapplication-extension + ## tv simulator .libs/tvos/%$(1).x86_64.o: %.m $(EXTRA_DEPENDENCIES) | .libs/tvos diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs index 0f04fe30e215..f0d283a2eba4 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs @@ -24,6 +24,7 @@ enum TargetArchitecture ARMv7s = 16, ARMv7k = 32, ARM64 = 64, + ARM64_32 = 128, // Note: needed for backwards compatability ARMv6_ARMv7 = ARMv6 | ARMv7, @@ -486,6 +487,9 @@ protected override string GenerateCommandLineCommands () if (architectures.HasFlag (TargetArchitecture.ARMv7k)) abi += (abi.Length > 0 ? "," : "") + "armv7k" + llvm; + if (architectures.HasFlag (TargetArchitecture.ARM64_32)) + abi += (abi.Length > 0 ? "," : "") + "arm64_32" + llvm; + if (string.IsNullOrEmpty (abi)) abi = "armv7" + llvm + thumb; } diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS.AppExtension.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS.AppExtension.Common.targets index 2dc84bbb1c20..0434bd6561a3 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS.AppExtension.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS.AppExtension.Common.targets @@ -28,7 +28,7 @@ Copyright (C) 2015-2016 Xamarin. All rights reserved. true - True + False diff --git a/runtime/Makefile b/runtime/Makefile index e8b3c8a9964c..fbb01e156ceb 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -197,7 +197,7 @@ $(eval $(call PlatformTemplate,ios,IOS,armv7 armv7s arm64,x86 x86_64,IOS,IPHONE) endif ifdef INCLUDE_WATCH -$(eval $(call PlatformTemplate,watchos,WATCHOS,armv7k,x86,WATCH,WATCH)) +$(eval $(call PlatformTemplate,watchos,WATCHOS,armv7k arm64_32,x86,WATCH,WATCH)) endif ifdef INCLUDE_TVOS @@ -336,6 +336,7 @@ armv7_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).armv7.o,$$($(2)_SOURCE_ armv7s_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).armv7s.o,$$($(2)_SOURCE_STEMS)) armv7k_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).armv7k.o,$$($(2)_SOURCE_STEMS)) arm64_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).arm64.o,$$($(2)_SOURCE_STEMS)) $$(patsubst %,.libs/$(1)/%$(4).arm64.o,$$($(2)_ARM64_SOURCE_STEMS)) +arm64_32_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).arm64_32.o,$$($(2)_SOURCE_STEMS)) $$(foreach arch,$$($(2)_ARCHITECTURES),$$(eval $$(call LibXamarinArchTemplate,$(1),$(2),$(3),$(4),$$(arch)))) @@ -361,6 +362,9 @@ $$(foreach arch,$$($(2)_ARCHITECTURES),$$(eval $$(call LibXamarinArchTemplate,$( .libs/$(1)/libxamarin$(4).armv7k.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) .libs/$(1)/libxamarin$(4).armv7k.dylib: $$(armv7k_$(1)$(3)_OBJECTS) +.libs/$(1)/libxamarin$(4).arm64_32.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) +.libs/$(1)/libxamarin$(4).arm64_32.dylib: $$(arm64_32_$(1)$(3)_OBJECTS) + .libs/$(1)/Xamarin$(4).x86.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) .libs/$(1)/Xamarin$(4).x86.framework: $$(x86_$(1)$(3)_OBJECTS) @@ -378,6 +382,9 @@ $$(foreach arch,$$($(2)_ARCHITECTURES),$$(eval $$(call LibXamarinArchTemplate,$( .libs/$(1)/Xamarin$(4).armv7k.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) .libs/$(1)/Xamarin$(4).armv7k.framework: $$(armv7k_$(1)$(3)_OBJECTS) + +.libs/$(1)/Xamarin$(4).arm64_32.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) +.libs/$(1)/Xamarin$(4).arm64_32.framework: $$(arm64_32_$(1)$(3)_OBJECTS) endef $(eval $(call LibXamarinTemplate,ios,IOS)) diff --git a/runtime/bindings.h b/runtime/bindings.h index 9b10ee2825bf..0a623df70ee4 100644 --- a/runtime/bindings.h +++ b/runtime/bindings.h @@ -226,7 +226,7 @@ struct MPSImageHistogramInfoWrapper { // entire struct on a 16-byte boundary, which doesn't match how we've // defined it in managed code (explicit layout, but no specific alignment). // So we need to manually pad the struct to match the managed definition. -#if defined (__x86_64__) || defined (__arm64__) +#if !defined(__ILP32__) uint8_t dummy[7]; #else uint8_t dummy[11]; diff --git a/runtime/trampolines-varargs.m b/runtime/trampolines-varargs.m index 0979b419ac46..70f2eb169978 100644 --- a/runtime/trampolines-varargs.m +++ b/runtime/trampolines-varargs.m @@ -1,4 +1,4 @@ -#if !defined (__i386__) && !defined (__x86_64__) && !defined (__arm64__) +#if !defined (__i386__) && !defined (__x86_64__) && !(defined (__arm64__) && !defined(__ILP32__)) #define __VARARGS_TRAMPOLINES__ 1 #endif diff --git a/src/CoreGraphics/CGColorConversionInfo.cs b/src/CoreGraphics/CGColorConversionInfo.cs index 3434020c3ff8..178cb7232ad2 100644 --- a/src/CoreGraphics/CGColorConversionInfo.cs +++ b/src/CoreGraphics/CGColorConversionInfo.cs @@ -57,16 +57,20 @@ internal CGColorConversionInfo (IntPtr handle, bool owns) /* CGColorSpaceRef __nullable */ IntPtr space3, CGColorConversionInfoTransformType transform3, CGColorRenderingIntent intent3, IntPtr lastSpaceMarker); -#if !MONOMAC && !WATCH +#if !MONOMAC // https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html // Declare dummies until we're on the stack then the arguments // C language requires arguments smaller than int to be promoted before a call, but beyond that, unused bytes on the stack are not specified by this ABI + // The 'transformX' argument is a CGColorConversionInfoTransformType, which is defined as uint (uint32_t in the header), + // but since each parameter must be pointer-sized (to occupy the right amount of stack space), + // we define it as nuint (and not the enum type, which is 32-bit even on 64-bit platforms). + // Same for the 'intentX' argument (except that it's signed instead of unsigned). [DllImport(Constants.CoreGraphicsLibrary, EntryPoint="CGColorConversionInfoCreateFromList")] extern static /* CGColorConversionInfoRef __nullable */ IntPtr CGColorConversionInfoCreateFromList_arm64 (/* __nullable CFDictionaryRef */ IntPtr options, - IntPtr space1, long transform1, long intent1, // varargs starts after them + IntPtr space1, nuint transform1, nint intent1, // varargs starts after them IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, // dummies so the rest goes to the stack - IntPtr space2, long transform2, long intent2, - IntPtr space3, long transform3, long intent3, + IntPtr space2, nuint transform2, nint intent2, + IntPtr space3, nuint transform3, nint intent3, IntPtr lastSpaceMarker); #endif @@ -92,12 +96,12 @@ public CGColorConversionInfo (NSDictionary options, params GColorConversionInfoT var first = triples [0]; // there's always one var second = triples.Length > 1 ? triples [1] : empty; var third = triples.Length > 2 ? triples [2] : empty; -#if !MONOMAC && !WATCH +#if !MONOMAC if (Runtime.IsARM64CallingConvention) { - Handle = CGColorConversionInfoCreateFromList_arm64 (o, NativeObjectHelper.GetHandle (first.Space), (long) first.Transform, (long) first.Intent, + Handle = CGColorConversionInfoCreateFromList_arm64 (o, NativeObjectHelper.GetHandle (first.Space), (uint) first.Transform, (int) first.Intent, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, - NativeObjectHelper.GetHandle (second.Space), (long) second.Transform, (long) second.Intent, - NativeObjectHelper.GetHandle (third.Space), (long) third.Transform, (long) third.Intent, + NativeObjectHelper.GetHandle (second.Space), (uint) second.Transform, (int) second.Intent, + NativeObjectHelper.GetHandle (third.Space), (uint) third.Transform, (int) third.Intent, IntPtr.Zero); } else { #endif @@ -105,7 +109,7 @@ public CGColorConversionInfo (NSDictionary options, params GColorConversionInfoT NativeObjectHelper.GetHandle (second.Space), second.Transform, second.Intent, NativeObjectHelper.GetHandle (third.Space), third.Transform, third.Intent, IntPtr.Zero); -#if !MONOMAC && !WATCH +#if !MONOMAC } #endif if (Handle == IntPtr.Zero) diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index 05d427a59aed..363149ffff21 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -1573,7 +1573,7 @@ static void NSLog (IntPtr format, string s) extern static void NSLog (IntPtr format, [MarshalAs (UnmanagedType.LPStr)] string s); #endif -#if !MONOMAC && !WATCHOS +#if !MONOMAC [DllImport (Constants.FoundationLibrary, EntryPoint = "NSLog")] extern static void NSLog_arm64 (IntPtr format, IntPtr p2, IntPtr p3, IntPtr p4, IntPtr p5, IntPtr p6, IntPtr p7, IntPtr p8, [MarshalAs (UnmanagedType.LPStr)] string s); #endif @@ -1583,7 +1583,7 @@ internal static void NSLog (string format, params object[] args) { var fmt = NSString.CreateNative ("%s"); var val = (args == null || args.Length == 0) ? format : string.Format (format, args); -#if !MONOMAC && !WATCHOS +#if !MONOMAC if (IsARM64CallingConvention) NSLog_arm64 (fmt, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val); else diff --git a/src/generator.cs b/src/generator.cs index f084a925717a..b820d38e9c80 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -3863,7 +3863,12 @@ void GenerateNewStyleInvoke (bool supercall, MethodInfo mi, MemberInformation mi if (is_stret_multi) { print ("if (Runtime.Arch == Arch.DEVICE) {"); indent++; - print ("if (IntPtr.Size == 8) {"); + if (BindingTouch.CurrentPlatform == PlatformName.WatchOS) { + print ("if (global::ObjCRuntime.Runtime.IsARM64CallingConvention) {"); + } else { + print ("if (IntPtr.Size == 8) {"); + + } indent++; GenerateInvoke (false, supercall, mi, minfo, selector, args [index64], assign_to_temp, category_type, false, EnumMode.Bit64); indent--; diff --git a/tests/BundledResources/BundledResources.csproj b/tests/BundledResources/BundledResources.csproj index 68f341c960ba..1f9e3f0e83d9 100644 --- a/tests/BundledResources/BundledResources.csproj +++ b/tests/BundledResources/BundledResources.csproj @@ -15,7 +15,7 @@ obj\$(Platform)\$(Configuration)-unified XAMCORE_2_0 - + True full False @@ -24,7 +24,7 @@ prompt 4 - + none True bin\Any CPU\$(Configuration)-unified diff --git a/tests/EmbeddedResources/EmbeddedResources.csproj b/tests/EmbeddedResources/EmbeddedResources.csproj index f48a4c471769..959b2f9527d0 100644 --- a/tests/EmbeddedResources/EmbeddedResources.csproj +++ b/tests/EmbeddedResources/EmbeddedResources.csproj @@ -17,7 +17,7 @@ obj\$(Platform)\$(Configuration)-unified XAMCORE_2_0 - + True full False @@ -26,7 +26,7 @@ prompt 4 - + none True bin\Any CPU\$(Configuration)-unified diff --git a/tests/bcl-test/BCLTests/BCLTests-watchos-app.csproj.in b/tests/bcl-test/BCLTests/BCLTests-watchos-app.csproj.in index 6e4601c25ada..a5da7b00d80b 100644 --- a/tests/bcl-test/BCLTests/BCLTests-watchos-app.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-watchos-app.csproj.in @@ -29,7 +29,7 @@ true true - + bin\%NAME%-watchos-app\iPhone\$(Configuration)-watchos-app full true @@ -50,7 +50,7 @@ None iPhone Developer - + bin\%NAME%-watchos-app\iPhone\$(Configuration)-watchos-app true full diff --git a/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in b/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in index 0a4240d91a51..d67594a5f55e 100644 --- a/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-watchos-extension.csproj.in @@ -56,12 +56,37 @@ True iPhone Developer - ARMv7k + ARMv7k, ARM64_32 True - - + SdkOnly cjk,mideast,other,rare,west + + true + false + bin\%NAME%-watchos-extension\iPhone\Debug64_32-watchos-extension + prompt + 4 + true + iPhone Developer + ARM64_32 + + true + SdkOnly + + + true + false + bin\%NAME%-watchos-extension\iPhone\Debug32-watchos-extension + prompt + 4 + true + iPhone Developer + ARMv7k + + true + SdkOnly + none False @@ -76,6 +101,31 @@ true true cjk,mideast,other,rare,west + SdkOnly + + + true + bin\%NAME%-watchos-extension\iPhone\Release64_32-watchos-extension + prompt + 4 + iPhone Developer + true + --nostrip --nosymbolstrip: --aot-options=-O=float32 --gcc_flags='-fembed-bitcode-marker' + ARM64_32 + True + SdkOnly + + + true + bin\%NAME%-watchos-extension\iPhone\Release32-watchos-extension + prompt + 4 + iPhone Developer + true + --nostrip --nosymbolstrip: --aot-options=-O=float32 --gcc_flags='-fembed-bitcode-marker' + ARMv7k + True + SdkOnly diff --git a/tests/bcl-test/BCLTests/BCLTests-watchos.csproj.in b/tests/bcl-test/BCLTests/BCLTests-watchos.csproj.in index a78cd43a0fc2..3dfb6d2cfb97 100644 --- a/tests/bcl-test/BCLTests/BCLTests-watchos.csproj.in +++ b/tests/bcl-test/BCLTests/BCLTests-watchos.csproj.in @@ -26,7 +26,7 @@ iPhone Developer true - + bin\%NAME%\iPhone\$(Configuration)-watchos full true @@ -48,7 +48,7 @@ None iPhone Developer - + bin\%NAME%\iPhone\$(Configuration)-watchos true full diff --git a/tests/bcl-test/BCLTests/templates/watchOS/Container/Container.csproj b/tests/bcl-test/BCLTests/templates/watchOS/Container/Container.csproj index 6b168de33783..84ea65e7c93c 100644 --- a/tests/bcl-test/BCLTests/templates/watchOS/Container/Container.csproj +++ b/tests/bcl-test/BCLTests/templates/watchOS/Container/Container.csproj @@ -26,7 +26,7 @@ iPhone Developer true - + bin\iPhone\$(Configuration)-watchos full true @@ -48,7 +48,7 @@ None iPhone Developer - + bin\iPhone\$(Configuration)-watchos true full diff --git a/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs b/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs index 7088beb818ab..05a98a48d40f 100644 --- a/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs +++ b/tests/bcl-test/BCLTests/templates/watchOS/Extension/InterfaceController.cs @@ -25,6 +25,7 @@ public partial class InterfaceController : WKInterfaceController { bool running; Xamarin.iOS.UnitTests.TestRunner runner; + HttpTextWriter http_writer; [Action ("runTests:")] partial void RunTests (NSObject obj); @@ -93,10 +94,14 @@ void RunTests () { var options = ApplicationOptions.Current; TextWriter writer = null; - if (!string.IsNullOrEmpty (options.HostName) && string.IsNullOrEmpty(options.LogFile)) - writer = new HttpTextWriter () { HostName = options.HostName, Port = options.HostPort }; - if (!string.IsNullOrEmpty (options.LogFile)) + if (!string.IsNullOrEmpty (options.HostName) && string.IsNullOrEmpty (options.LogFile)) { + http_writer = new HttpTextWriter () { HostName = options.HostName.Split (',')[0], Port = options.HostPort }; + Console.WriteLine ("Sending results to {0}:{1} using HTTP", http_writer.HostName, http_writer.Port); + http_writer.Open (); + writer = http_writer; + } else if (!string.IsNullOrEmpty (options.LogFile)) { writer = new StreamWriter (options.LogFile); + } // we generate the logs in two different ways depending if the generate xml flag was // provided. If it was, we will write the xml file to the tcp writer if present, else @@ -157,8 +162,16 @@ void RunTests () logger.Info ($"Xml result can be found {resultsFilePath}"); } logger.Info ($"Tests run: {runner.TotalTests} Passed: {runner.PassedTests} Inconclusive: {runner.InconclusiveTests} Failed: {runner.FailedTests} Ignored: {runner.FilteredTests}"); - if (options.TerminateAfterExecution) - TerminateWithSuccess (); + if (options.TerminateAfterExecution) { + var writer_finished_task = http_writer?.FinishedTask; + http_writer?.Close (); + Task.Run (async () => { + if (writer_finished_task != null) { + await writer_finished_task; + } + TerminateWithSuccess (); + }); + } }); }); } diff --git a/tests/bcl-test/mscorlib/mscorlib-split.csproj.template b/tests/bcl-test/mscorlib/mscorlib-split.csproj.template index 0705d8035515..42bc16158f73 100644 --- a/tests/bcl-test/mscorlib/mscorlib-split.csproj.template +++ b/tests/bcl-test/mscorlib/mscorlib-split.csproj.template @@ -15,7 +15,7 @@ Xamarin.iOS XAMCORE_2_0;XAMCORE_3_0 - + True full False @@ -25,7 +25,7 @@ 4 True - + none True bin\Any CPU\$(Configuration)-unified diff --git a/tests/bindings-framework-test/bindings-framework-test.csproj b/tests/bindings-framework-test/bindings-framework-test.csproj index 50a4832fe80f..db0661a1567a 100644 --- a/tests/bindings-framework-test/bindings-framework-test.csproj +++ b/tests/bindings-framework-test/bindings-framework-test.csproj @@ -17,7 +17,7 @@ obj\$(Platform)\$(Configuration)-unified XAMCORE_2_0 - + True full False @@ -27,7 +27,7 @@ 4 True - + none True bin\Any CPU\$(Configuration)-unified diff --git a/tests/bindings-test/bindings-test.csproj b/tests/bindings-test/bindings-test.csproj index b48d61312d4d..91a1e10b16ae 100644 --- a/tests/bindings-test/bindings-test.csproj +++ b/tests/bindings-test/bindings-test.csproj @@ -17,7 +17,7 @@ obj\$(Platform)\$(Configuration)-unified XAMCORE_2_0 - + True full False @@ -27,7 +27,7 @@ 4 True - + none True bin\Any CPU\$(Configuration)-unified diff --git a/tests/bindings-test2/bindings-test2.csproj b/tests/bindings-test2/bindings-test2.csproj index 2dd7659f967e..0497fd9609b9 100644 --- a/tests/bindings-test2/bindings-test2.csproj +++ b/tests/bindings-test2/bindings-test2.csproj @@ -17,7 +17,7 @@ obj\$(Platform)\$(Configuration)-unified XAMCORE_2_0 - + True full False @@ -27,7 +27,7 @@ 4 True - + none True bin\Any CPU\$(Configuration)-unified diff --git a/tests/common/ProductTests.cs b/tests/common/ProductTests.cs index eb08cfb2a95e..8ad2d089280a 100644 --- a/tests/common/ProductTests.cs +++ b/tests/common/ProductTests.cs @@ -104,6 +104,7 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach Version alternate_version = null; Version mono_native_compat_version; Version mono_native_unified_version; + Version alternate_mono_native_unified_version = null; switch (load_command) { case MachO.LoadCommands.MinMacOSX: version = SdkVersions.MinOSXVersion; @@ -129,8 +130,12 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach break; case MachO.LoadCommands.MinwatchOS: version = SdkVersions.MinWatchOSVersion; + if (device) + alternate_version = new Version (5, 1, 0); // arm64_32 has min OS 5.1 mono_native_compat_version = SdkVersions.MinWatchOSVersion; mono_native_unified_version = new Version (5, 0, 0); + if (device) + alternate_mono_native_unified_version = new Version (5, 1, 0); // armv7k has 5.0, arm64_32 has 5.1 break; default: throw new NotImplementedException (load_command.ToString ()); @@ -141,6 +146,8 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach mono_native_unified_version = mono_native_unified_version.WithBuild (); if (alternate_version == null) alternate_version = version; + if (alternate_mono_native_unified_version == null) + alternate_mono_native_unified_version = mono_native_unified_version; switch (Path.GetFileName (machoFile)) { case "libmono-native-compat.dylib": @@ -150,7 +157,7 @@ public void MinOSVersion (Profile profile, MachO.LoadCommands load_command, Mach break; case "libmono-native-unified.dylib": case "libmono-native-unified.a": - if (mono_native_unified_version != lc_min_version) + if (mono_native_unified_version != lc_min_version && alternate_mono_native_unified_version != lc_min_version) failed.Add ($"Unexpected minOS version (expected {mono_native_unified_version}, found {lc_min_version}) in {machoFile} ({slice.Filename})."); break; default: diff --git a/tests/fsharplibrary/fsharplibrary.fsproj b/tests/fsharplibrary/fsharplibrary.fsproj index 67806ae3462a..b41f8506d127 100644 --- a/tests/fsharplibrary/fsharplibrary.fsproj +++ b/tests/fsharplibrary/fsharplibrary.fsproj @@ -17,7 +17,7 @@ obj\$(Platform)\$(Configuration)-unified XAMCORE_2_0 - + true full false @@ -27,7 +27,7 @@ - + true bin\Any CPU\$(Configuration)-unified ;$(DefineConstants) diff --git a/tests/introspection/iOS/iOSApiCtorInitTest.cs b/tests/introspection/iOS/iOSApiCtorInitTest.cs index 189879f97b2b..817941f26bda 100644 --- a/tests/introspection/iOS/iOSApiCtorInitTest.cs +++ b/tests/introspection/iOS/iOSApiCtorInitTest.cs @@ -225,6 +225,11 @@ protected override bool Skip (Type type) case "INGetRestaurantGuestIntentResponse": // Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Unable to initialize 'INGetRestaurantGuestIntentResponse'. Please make sure that your intent definition file is valid. return TestRuntime.CheckXcodeVersion (10,0); case "CMMovementDisorderManager": // Not available in simulator, added info to radar://41110708 +#if __WATCHOS__ + // Doesn't exist in the simulator; aborts on device if the required entitlement isn't available. + return true; +#endif + return Runtime.Arch == Arch.SIMULATOR; case "RPSystemBroadcastPickerView": // Symbol not available in simulator return Runtime.Arch == Arch.SIMULATOR; default: diff --git a/tests/introspection/iOS/iOSApiPInvokeTest.cs b/tests/introspection/iOS/iOSApiPInvokeTest.cs index 8ce4ffa3a204..a79b030c518f 100644 --- a/tests/introspection/iOS/iOSApiPInvokeTest.cs +++ b/tests/introspection/iOS/iOSApiPInvokeTest.cs @@ -64,10 +64,10 @@ protected override bool Skip (string symbolName) case "MPSSetHeapCacheDuration": return simulator; - // it's not needed for ARM64 and Apple does not have stubs for them in libobjc.dylib + // it's not needed for ARM64/ARM64_32 and Apple does not have stubs for them in libobjc.dylib case "objc_msgSend_stret": case "objc_msgSendSuper_stret": - return IntPtr.Size == 8 && !simulator; + return !simulator; default: return base.Skip (symbolName); diff --git a/tests/introspection/iOS/iOSApiProtocolTest.cs b/tests/introspection/iOS/iOSApiProtocolTest.cs index 1a2336f5c4fc..9f8c0d35b950 100644 --- a/tests/introspection/iOS/iOSApiProtocolTest.cs +++ b/tests/introspection/iOS/iOSApiProtocolTest.cs @@ -82,6 +82,17 @@ protected override bool Skip (Type type) // but that web page doesn't explain anything (it's mostly empty, so this is probably just lagging documentation) // I also tried enabling every entitlement in Xcode, but it still didn't work. return true; +#if __WATCHOS__ && !XAMCORE_4_0 + case "INCarAirCirculationModeResolutionResult": + case "INCarAudioSourceResolutionResult": + case "INCarDefrosterResolutionResult": + case "INCarSeatResolutionResult": + case "INRadioTypeResolutionResult": + case "INRelativeSettingResolutionResult": + case "INRelativeReferenceResolutionResult": + // These were bound by mistake, and they're gone in XAMCORE_4_0. + return true; +#endif } return base.Skip (type); diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs index 375969f10748..4f448874c69b 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs @@ -1389,7 +1389,7 @@ public void TestTypeEncodings () #if MONOMAC var boolEncoding = "c"; #else - var boolEncoding = (IntPtr.Size == 8 || TrampolineTest.IsArmv7k) ? "B" : "c"; + var boolEncoding = (IntPtr.Size == 8 || TrampolineTest.IsArmv7k || TrampolineTest.IsArm64CallingConvention) ? "B" : "c"; #endif var exp = new string [] { "@", ":", "^v", "C", "c", "s", "s", "S", "i", "I", "q", "Q", "f", "d", boolEncoding, "@", ":", "#" }; diff --git a/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs b/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs index 7abbe0efd482..6fae88dc4996 100644 --- a/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs +++ b/tests/monotouch-test/ObjCRuntime/TrampolineTest.cs @@ -62,10 +62,16 @@ public static bool IsArm32 { } #endif + public static bool IsArm64CallingConvention { + get { + return Runtime.IsARM64CallingConvention; + } + } + public static bool IsArmv7k { get { #if __WATCHOS__ - return Runtime.Arch == Arch.DEVICE; + return Runtime.Arch == Arch.DEVICE && !IsArm64CallingConvention; #else return false; #endif @@ -78,7 +84,7 @@ public void StretTrampolineTest () { CMTimeRange tr; using (var obj = new StretTrampolines ()) { - if (IsArm64) { + if (IsArm64CallingConvention) { tr = CMTimeRange_objc_msgSend (obj.Handle, Selector.GetHandle ("myTimeRange")); } else { CMTimeRange_objc_msgSend (out tr, obj.Handle, Selector.GetHandle ("myTimeRange")); @@ -221,21 +227,21 @@ public void FloatingPointStretTrampolineTest () int i; rect2 = new RectangleF (1.2f, 2.3f, 3.4f, 4.5f); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = RectangleF_objc_msgSend_IntPtr_IntPtr_RectangleF (obj.Handle, new Selector ("testRectangleF_string_string_RectangleF:b:c:").Handle, new NSString ("a").Handle, new NSString ("b").Handle, rect2); } else { RectangleF_objc_msgSend_stret_IntPtr_IntPtr_RectangleF (out rect, obj.Handle, new Selector ("testRectangleF_string_string_RectangleF:b:c:").Handle, new NSString ("a").Handle, new NSString ("b").Handle, rect2); } Assert.That (rect == new RectangleF (rect2.X * pi, rect2.Y * pi, rect2.Width * pi, rect2.Height * pi), "#testRectangleF_string_string_RectangleF:b:c:"); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend (obj.Handle, new Selector ("testRectangleF").Handle); } else { Messaging.RectangleF_objc_msgSend_stret (out rect, obj.Handle, new Selector ("testRectangleF").Handle); } Assert.That (rect == new RectangleF (1.2f, 2.3f, 3.4f, 4.5f), "#testRectangleF"); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend (class_ptr, new Selector ("staticTestRectangleF").Handle); } else { Messaging.RectangleF_objc_msgSend_stret (out rect, class_ptr, new Selector ("staticTestRectangleF").Handle); @@ -243,14 +249,14 @@ public void FloatingPointStretTrampolineTest () Assert.That (rect == new RectangleF (1.2f, 2.3f, 3.4f, 4.5f), "#static testRectangleF"); i = 152; - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_int (obj.Handle, new Selector ("testRectangleF_int:").Handle, 152); } else { Messaging.RectangleF_objc_msgSend_stret_int (out rect, obj.Handle, new Selector ("testRectangleF_int:").Handle, 152); } Assert.That (rect == new RectangleF (i + .1f, i + .2f, i + .3f, i + .4f), "#ret RectF-int", "#testRectangleF_int:"); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_IntPtr (obj.Handle, new Selector ("testRectangleF_IntPtr:").Handle, tmp_obj.Handle); } else { Messaging.RectangleF_objc_msgSend_stret_IntPtr (out rect, obj.Handle, new Selector ("testRectangleF_IntPtr:").Handle, tmp_obj.Handle); @@ -259,7 +265,7 @@ public void FloatingPointStretTrampolineTest () #if !__TVOS__ mkregion = new MKCoordinateRegion (new CLLocationCoordinate2D (123.456, 345.678), new MKCoordinateSpan (987.654, 654.321)); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_MKCoordinateRegion_IntPtr (obj.Handle, new Selector ("testRectangleF_MCCoordinateRegion_IntPtr:str:").Handle, mkregion, tmp_obj.Handle); } else { Messaging.RectangleF_objc_msgSend_stret_MKCoordinateRegion_IntPtr (out rect, obj.Handle, new Selector ("testRectangleF_MCCoordinateRegion_IntPtr:str:").Handle, mkregion, tmp_obj.Handle); @@ -267,7 +273,7 @@ public void FloatingPointStretTrampolineTest () Assert.That (rect == new RectangleF (123.456f+pi, 345.678f-pi, 987.654f*pi, 654.321f/pi), "#testRectangleF_MCCoordinateRegion_IntPtr:str:"); mkmaprect = new MKMapRect (111.1, 222.2, 333.3, 444.4); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_MKMapRect (obj.Handle, new Selector ("testRectangleF_MKMapRect:").Handle, mkmaprect); } else { Messaging.RectangleF_objc_msgSend_stret_MKMapRect (out rect, obj.Handle, new Selector ("testRectangleF_MKMapRect:").Handle, mkmaprect); @@ -276,7 +282,7 @@ public void FloatingPointStretTrampolineTest () #endif // !__TVOS__ rect2 = new RectangleF (9.9f, 8.8f, 7.7f, 6.6f); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF (obj.Handle, new Selector ("testRectangleF_RectangleF:").Handle, rect2); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF:").Handle, rect2); @@ -285,7 +291,7 @@ public void FloatingPointStretTrampolineTest () rect2 = new RectangleF (5.44f, 4.33f, 3.22f, 2.11f); i = 8; - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_int (obj.Handle, new Selector ("testRectangleF_RectangleF_int:i:").Handle, rect2, 8); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_int (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_int:i:").Handle, rect2, 8); @@ -293,7 +299,7 @@ public void FloatingPointStretTrampolineTest () AreAlmostEqual (rect, new RectangleF (5.44f*i, 4.33f+i, 3.22f-i, 2.11f/i), "testRectangleF_RectangleF_int:i:"); rect2 = new RectangleF (5.4f, 4.3f, 3.2f, 2.1f); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_IntPtr (obj.Handle, new Selector ("testRectangleF_RectangleF_IntPtr:str:").Handle, rect2, tmp_obj.Handle); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_IntPtr (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_IntPtr:str:").Handle, rect2, tmp_obj.Handle); @@ -302,7 +308,7 @@ public void FloatingPointStretTrampolineTest () rect2 = new RectangleF (1, 2, 3, 4); rect3 = new RectangleF (9, 8, 7, 6); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_RectangleF_float ( obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_float:b:c:").Handle, rect2, rect3, (float) pi); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_RectangleF_float (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_float:b:c:").Handle, rect2, rect3, (float) pi); @@ -312,7 +318,7 @@ public void FloatingPointStretTrampolineTest () rect2 = new RectangleF (1, 2, 3, 4); rect3 = new RectangleF (9, 8, 7, 6); rect4 = new RectangleF (10, 20, 30, 40); - if (IsArm64 || IsArmv7k) { + if (IsArm64CallingConvention || IsArmv7k) { rect = Messaging.RectangleF_objc_msgSend_RectangleF_RectangleF_RectangleF (obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_RectangleF:b:c:").Handle, rect2, rect3, rect4); } else { Messaging.RectangleF_objc_msgSend_stret_RectangleF_RectangleF_RectangleF (out rect, obj.Handle, new Selector ("testRectangleF_RectangleF_RectangleF_RectangleF:b:c:").Handle, rect2, rect3, rect4); @@ -320,21 +326,21 @@ public void FloatingPointStretTrampolineTest () Assert.That (rect == new RectangleF (20, 30, 40, 50), "#testRectangleF_RectangleF_RectangleF_RectangleF:b:c:"); #if !__WATCHOS__ - if (IsArm64) { + if (IsArm64CallingConvention) { matrix3 = Messaging.Matrix3_objc_msgSend (obj.Handle, new Selector ("testMatrix3").Handle); } else { Messaging.Matrix3_objc_msgSend_stret (out matrix3, obj.Handle, new Selector ("testMatrix3").Handle); } Assert.That (matrix3.Equals (new Matrix3 (1, 2, 3, 4, 5, 6, 7, 8, 9)), "#testMatrix3"); - if (IsArm64) { + if (IsArm64CallingConvention) { matrix4 = Matrix4_objc_msgSend (obj.Handle, new Selector ("testMatrix4").Handle); } else { Matrix4_objc_msgSend_stret (out matrix4, obj.Handle, new Selector ("testMatrix4").Handle); } Assert.That (matrix4.Equals (new Matrix4 (9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3)), "#testMatrix4"); - if (IsArm64) { + if (IsArm64CallingConvention) { catransform3d = Messaging.CATransform3D_objc_msgSend (obj.Handle, new Selector ("testCATransform3D").Handle); } else { Messaging.CATransform3D_objc_msgSend_stret (out catransform3d, obj.Handle, new Selector ("testCATransform3D").Handle); diff --git a/tests/monotouch-test/mono/MonoWeakReferenceTest.cs b/tests/monotouch-test/mono/MonoWeakReferenceTest.cs index 749abb074114..7ae7bcdb4fd3 100644 --- a/tests/monotouch-test/mono/MonoWeakReferenceTest.cs +++ b/tests/monotouch-test/mono/MonoWeakReferenceTest.cs @@ -84,7 +84,11 @@ public void WeakTest () Assert.That (t.Obj3, Is.Not.Null, "'t.Obj3' should not be null"); //overflow the nursery, make sure we fill it +#if __WATCHOS__ + for (int i = 0; i < 1000 * 100; ++i) // the apple watch doesn't have much memory, so try to not run into OOMs either. The nursery is 512k, so 100k objects should be more than enough to fill it. +#else for (int i = 0; i < 1000 * 1000 * 10; ++i) +#endif new OneField (); Exception ex = null; diff --git a/tests/monotouch-test/mono/Symbols.cs b/tests/monotouch-test/mono/Symbols.cs index 4a9ab88db6b0..692130c91218 100644 --- a/tests/monotouch-test/mono/Symbols.cs +++ b/tests/monotouch-test/mono/Symbols.cs @@ -27,6 +27,7 @@ public void FunctionNames () Collect (); bool aot = symbols [1].Contains ("MonoTouchFixtures_Symbols_Collect"); + bool llvmonly = symbols [1].Contains ("mono_llvmonly_runtime_invoke"); // LLVM inlines the Collect function, so 'Collect' doesn't show up in the stack trace :/ bool interp = false; if (!aot) { @@ -38,7 +39,7 @@ public void FunctionNames () } } - Assert.IsTrue (aot || interp, "#1"); + Assert.IsTrue (aot || interp || llvmonly, $"#1\n\t{string.Join ("\n\t", symbols)}"); } void Collect () diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index 8b64263d798b..3b881f670251 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -676,7 +676,7 @@ public void MT0015 () mtouch.CreateTemporaryApp (); mtouch.Abi = "invalid-arm"; mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build"); - mtouch.AssertError (15, "Invalid ABI: invalid-arm. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64 and arm64+llvm."); + mtouch.AssertError (15, "Invalid ABI: invalid-arm. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64, arm64+llvm, arm64_32 and arm64_32+llvm."); } } @@ -2416,7 +2416,7 @@ public void Architectures_Unified_Invalid () mtouch.TargetVer = "10.3"; mtouch.Abi = "armv6"; Assert.AreEqual (1, mtouch.Execute (MTouchAction.BuildDev)); - mtouch.AssertError ("MT", 15, "Invalid ABI: armv6. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64 and arm64+llvm."); + mtouch.AssertError ("MT", 15, "Invalid ABI: armv6. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64, arm64+llvm, arm64_32 and arm64_32+llvm."); mtouch.Abi = "armv7"; Assert.AreEqual (1, mtouch.Execute (MTouchAction.BuildSim)); @@ -2459,6 +2459,42 @@ public void Architectures_TVOS_Invalid () } } + [Test] + [TestCase (Target.Dev, null, "ARMv7k")] + [TestCase (Target.Dev, "arm64_32+llvm", "ARM64_32")] + [TestCase (Target.Dev, "armv7k+llvm,arm64_32+llvm", "ARMv7k,ARM64_32")] + [TestCase (Target.Sim, null, "i386")] + public void Architectures_WatchOS (Target target, string abi, string expected_abi) + { + AssertDeviceAvailable (); + + using (var mtouch = new MTouchTool ()) { + mtouch.Profile = Profile.watchOS; + mtouch.Abi = abi; + mtouch.CreateTemporaryCacheDirectory (); + mtouch.CreateTemporaryWatchKitExtension (); + mtouch.Action = target == Target.Dev ? MTouchAction.BuildDev : MTouchAction.BuildSim; + mtouch.AssertExecute ("build"); + VerifyArchitectures (mtouch.NativeExecutablePath, "arch", expected_abi.Split (',')); + } + } + + [Test] + public void Architectures_WatchOS_Invalid () + { + AssertDeviceAvailable (); + + using (var mtouch = new MTouchTool ()) { + mtouch.Profile = Profile.watchOS; + mtouch.CreateTemporaryWatchKitExtension (); + + mtouch.Abi = "armv7"; + mtouch.AssertExecuteFailure (MTouchAction.BuildDev, "device - armv7"); + mtouch.AssertError ("MT", 75, "Invalid architecture 'ARMv7' for WatchOS projects. Valid architectures are: ARMv7k, ARMv7k+LLVM, ARM64_32, ARM64_32+LLVM"); + mtouch.AssertErrorCount (1); + } + } + [Test] public void MonoFrameworkArchitectures () { diff --git a/tests/templates/WatchApp/App.csproj b/tests/templates/WatchApp/App.csproj index 2e4ab614d16a..ac82d5428db8 100644 --- a/tests/templates/WatchApp/App.csproj +++ b/tests/templates/WatchApp/App.csproj @@ -30,6 +30,28 @@ true + bin\iPhone\$(Configuration)-watchos-app + full + true + prompt + 4 + ARMv7k,ARM64_32 + %WATCHAPP_PATH%Entitlements.plist + true + iPhone Developer + + + bin\iPhone\$(Configuration)-watchos-app + full + true + prompt + 4 + ARMv7k + %WATCHAPP_PATH%Entitlements.plist + true + iPhone Developer + + bin\iPhone\$(Configuration)-watchos-app full true @@ -51,6 +73,22 @@ iPhone Developer + bin\iPhone\$(Configuration)-watchos-app + true + full + false + DEBUG; + prompt + 4 + ARMv7k,ARM64_32 + %WATCHAPP_PATH%Entitlements.plist + true + iPhone Developer + true + true + true + + bin\iPhone\$(Configuration)-watchos-app true full @@ -66,6 +104,22 @@ true true + + bin\iPhone\$(Configuration)-watchos-app + true + full + false + DEBUG; + prompt + 4 + ARM64_32 + %WATCHAPP_PATH%Entitlements.plist + true + iPhone Developer + true + true + true + diff --git a/tests/templates/WatchContainer/Container.csproj b/tests/templates/WatchContainer/Container.csproj index bfe59b724cd8..37cb73eb9c93 100644 --- a/tests/templates/WatchContainer/Container.csproj +++ b/tests/templates/WatchContainer/Container.csproj @@ -26,7 +26,7 @@ iPhone Developer true - + bin\iPhone\$(Configuration)-watchos full true @@ -48,7 +48,7 @@ None iPhone Developer - + bin\iPhone\$(Configuration)-watchos true full diff --git a/tests/templates/WatchExtension/Extension.csproj b/tests/templates/WatchExtension/Extension.csproj index 255cbce9c574..1630ee888263 100644 --- a/tests/templates/WatchExtension/Extension.csproj +++ b/tests/templates/WatchExtension/Extension.csproj @@ -43,6 +43,20 @@ i386 + True + full + False + bin\iPhone\Debug-watchos-extension + DEBUG;;$(DefineConstants) + prompt + 0 + True + iPhone Developer + + ARMv7k,ARM64_32 + True + + True full False @@ -55,10 +69,36 @@ ARMv7k True - - + + + True + full + False + bin\iPhone\Debug-watchos-extension + DEBUG;;$(DefineConstants) + prompt + 0 + True + iPhone Developer + + ARM64_32 + True + none + False + bin\iPhone\Release-watchos-extension + MONOTOUCH;;$(DefineConstants) + prompt + 4 + iPhone Developer + -v -v -v -v --nosymbolstrip + ARMv7k,ARM64_32 + True + true + true + + none False bin\iPhone\Release-watchos-extension @@ -72,6 +112,20 @@ true true + + none + False + bin\iPhone\Release-watchos-extension + MONOTOUCH;;$(DefineConstants) + prompt + 4 + iPhone Developer + -v -v -v -v --nosymbolstrip + ARM64_32 + True + true + true + diff --git a/tests/test-libraries/Makefile b/tests/test-libraries/Makefile index eedb07230a08..eb1b9b7a84db 100644 --- a/tests/test-libraries/Makefile +++ b/tests/test-libraries/Makefile @@ -126,7 +126,7 @@ ifdef INCLUDE_TVOS $(eval $(call Template,tvos,TVOS,arm64 x86_64,x86_64,arm64,AppleTVSimulator,AppleTVOS,-mtvos-simulator-version-min=9.0,-mtvos-version-min=9.0 -fembed-bitcode)) endif ifdef INCLUDE_WATCH -$(eval $(call Template,watchos,WATCHOS,armv7k x86,i386,armv7k,WatchSimulator,WatchOS,-mwatchos-simulator-version-min=2.0,-mwatchos-version-min=2.0 -fembed-bitcode)) +$(eval $(call Template,watchos,WATCHOS,armv7k x86 arm64_32,i386,armv7k arm64_32,WatchSimulator,WatchOS,-mwatchos-simulator-version-min=2.0,-mwatchos-version-min=2.0 -fembed-bitcode)) endif ifdef INCLUDE_MAC $(eval $(call Template,macos,MACOS,x86_64,x86_64,,MacOSX,MacOSX,-mmacosx-version-min=$(MIN_OSX_VERSION_FOR_MAC),-mmacosx-version-min=$(MIN_OSX_VERSION_FOR_MAC))) diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index bd35bda256a5..d8f344f027ac 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -340,7 +340,8 @@ void AutoConfigureIOS () var monoNativeInfo = new MonoNativeInfo (this, flavor); var iosTestProject = new iOSTestProject (monoNativeInfo.ProjectPath, generateVariations: false) { MonoNativeInfo = monoNativeInfo, - Name = monoNativeInfo.ProjectName + Name = monoNativeInfo.ProjectName, + SkipwatchOSARM64_32Variation = monoNativeInfo.ProjectName.Contains ("compat"), }; IOSTestProjects.Add (iosTestProject); diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs index fe29943f3636..22915b44d9e9 100644 --- a/tests/xharness/Jenkins.cs +++ b/tests/xharness/Jenkins.cs @@ -143,6 +143,8 @@ AppRunnerTarget[] GetAppRunnerTargets (TestPlatform platform) case TestPlatform.tvOS: return new AppRunnerTarget [] { AppRunnerTarget.Simulator_tvOS }; case TestPlatform.watchOS: + case TestPlatform.watchOS_32: + case TestPlatform.watchOS_64_32: return new AppRunnerTarget [] { AppRunnerTarget.Simulator_watchOS }; case TestPlatform.iOS_Unified: return new AppRunnerTarget [] { AppRunnerTarget.Simulator_iOS32, AppRunnerTarget.Simulator_iOS64 }; @@ -168,6 +170,8 @@ string GetSimulatorMinVersion (TestPlatform platform) case TestPlatform.tvOS: return "tvOS " + Xamarin.SdkVersions.MinTVOSSimulator; case TestPlatform.watchOS: + case TestPlatform.watchOS_32: + case TestPlatform.watchOS_64_32: return "watchOS " + Xamarin.SdkVersions.MinWatchOSSimulator; default: throw new NotImplementedException (platform.ToString ()); @@ -188,7 +192,7 @@ IEnumerable CreateRunSimulatorTaskAsync (XBuildTask buildTask) ignored = new [] { false }; break; case TestPlatform.watchOS: - platforms = new TestPlatform [] { TestPlatform.watchOS }; + platforms = new TestPlatform [] { TestPlatform.watchOS_32 }; ignored = new [] { false }; break; case TestPlatform.iOS_Unified: @@ -234,7 +238,7 @@ class TestData public string LinkMode; public string Defines; public string Undefines; - public bool Ignored; + public bool? Ignored; public bool EnableSGenConc; public bool UseThumb; public MonoNativeFlavor MonoNativeFlavor; @@ -262,17 +266,21 @@ IEnumerable GetTestData (RunTestTask test) // 32-bit interpreter doesn't work yet: https://github.com/mono/mono/issues/9871 var supports_interpreter = test.Platform != TestPlatform.iOS_Unified32; var supports_dynamic_registrar_on_device = test.Platform == TestPlatform.iOS_Unified64 || test.Platform == TestPlatform.tvOS; + // arm64_32 is only supported for Release builds for now. + var supports_debug = test.Platform != TestPlatform.watchOS_64_32; switch (test.ProjectPlatform) { case "iPhone": /* we don't add --assembly-build-target=@all=staticobject because that's the default in all our test projects */ - yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug)", MTouchExtraArgs = $"--assembly-build-target=@all=dynamiclibrary {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, MonoNativeFlavor = flavor }; - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug)", MTouchExtraArgs = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, MonoNativeFlavor = flavor }; - - yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug, profiling)", MTouchExtraArgs = $"--assembly-build-target=@all=dynamiclibrary {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = true, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, MonoNativeFlavor = flavor }; - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug, profiling)", MTouchExtraArgs = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = true, MonoNativeLinkMode = MonoNativeLinkMode.Static, MonoNativeFlavor = flavor }; + if (supports_debug) { + yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug)", MTouchExtraArgs = $"--assembly-build-target=@all=dynamiclibrary {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, MonoNativeFlavor = flavor }; + yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug)", MTouchExtraArgs = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, MonoNativeFlavor = flavor }; + yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug, profiling)", MTouchExtraArgs = $"--assembly-build-target=@all=dynamiclibrary {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = true, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, MonoNativeFlavor = flavor }; + yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug, profiling)", MTouchExtraArgs = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject {test.TestProject.MTouchExtraArgs}", Debug = true, Profiling = true, MonoNativeLinkMode = MonoNativeLinkMode.Static, MonoNativeFlavor = flavor }; + } - yield return new TestData { Variation = "Release", MTouchExtraArgs = test.TestProject.MTouchExtraArgs, Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static }; + if (test.ProjectConfiguration.Contains ("Debug")) + yield return new TestData { Variation = "Release", MTouchExtraArgs = test.TestProject.MTouchExtraArgs, Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static }; if (test.Platform == TestPlatform.iOS_Unified32) yield return new TestData { Variation = "Release: UseThumb", MTouchExtraArgs = test.TestProject.MTouchExtraArgs, Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, UseThumb = true }; yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (release)", MTouchExtraArgs = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject {test.TestProject.MTouchExtraArgs}", Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, MonoNativeFlavor = flavor }; @@ -282,29 +290,37 @@ IEnumerable GetTestData (RunTestTask test) if (supports_dynamic_registrar_on_device) yield return new TestData { Variation = "Debug (dynamic registrar)", MTouchExtraArgs = "--registrar:dynamic", Debug = true, Profiling = false }; yield return new TestData { Variation = "Release (all optimizations)", MTouchExtraArgs = "--registrar:static --optimize:all", Debug = false, Profiling = false, Defines = "OPTIMIZEALL" }; - yield return new TestData { Variation = "Debug (all optimizations)", MTouchExtraArgs = "--registrar:static --optimize:all", Debug = true, Profiling = false, Defines = "OPTIMIZEALL" }; - yield return new TestData { Variation = "Debug: SGenConc", MTouchExtraArgs = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true}; + if (supports_debug) { + yield return new TestData { Variation = "Debug (all optimizations)", MTouchExtraArgs = "--registrar:static --optimize:all", Debug = true, Profiling = false, Defines = "OPTIMIZEALL" }; + yield return new TestData { Variation = "Debug: SGenConc", MTouchExtraArgs = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true}; + } if (supports_interpreter) { // interpreter is broken for monotouch-test: https://github.com/xamarin/maccore/issues/1613, so ignore for now var ignore_interpreter_because_of_1613 = true; - yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Ignored = ignore_interpreter_because_of_1613, }; - yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Ignored = ignore_interpreter_because_of_1613, }; + if (supports_debug) { + yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Ignored = ignore_interpreter_because_of_1613, }; + yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Ignored = ignore_interpreter_because_of_1613, }; + } yield return new TestData { Variation = "Release (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = false, Profiling = false, Ignored = ignore_interpreter_because_of_1613, }; } break; case "mscorlib": yield return new TestData { Variation = "Debug: SGenConc", MTouchExtraArgs = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true}; if (supports_interpreter) { - yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; - yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; + if (supports_debug) { + yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; + yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; + } yield return new TestData { Variation = "Release (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = false, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; } break; case "mini": yield return new TestData { Variation = "Debug: SGenConc", MTouchExtraArgs = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true}; if (supports_interpreter) { - yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; - yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; + if (supports_debug) { + yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; + yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; + } yield return new TestData { Variation = "Release (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = false, Profiling = false, Undefines = "FULL_AOT_RUNTIME" }; } break; @@ -354,7 +370,7 @@ IEnumerable CreateTestVariations (IEnumerable tests, Func (tests); @@ -450,7 +466,7 @@ IEnumerable CreateTestVariations (IEnumerable tests, Func CreateRunDeviceTasks () if (!project.SkipwatchOSVariation) { var watchOSProject = project.AsWatchOSProject (); - var buildWatch = new XBuildTask { + var buildWatch32 = new XBuildTask { Jenkins = this, - ProjectConfiguration = "Debug", + ProjectConfiguration = "Debug32", ProjectPlatform = "iPhone", - Platform = TestPlatform.watchOS, + Platform = TestPlatform.watchOS_32, TestName = project.Name, }; - buildWatch.CloneTestProject (watchOSProject); - rv.Add (new RunDeviceTask (buildWatch, Devices.ConnectedWatch.Where (d => d.IsSupported (project))) { Ignored = ignored || !IncludewatchOS, BuildOnly = project.BuildOnly }); + buildWatch32.CloneTestProject (watchOSProject); + rv.Add (new RunDeviceTask (buildWatch32, Devices.ConnectedWatch) { Ignored = ignored || !IncludewatchOS, BuildOnly = project.BuildOnly }); + + if (!project.SkipwatchOSARM64_32Variation) { + var buildWatch64_32 = new XBuildTask { + Jenkins = this, + ProjectConfiguration = "Release64_32", // We don't support Debug for ARM64_32 yet. + ProjectPlatform = "iPhone", + Platform = TestPlatform.watchOS_64_32, + TestName = project.Name, + }; + buildWatch64_32.CloneTestProject (watchOSProject); + rv.Add (new RunDeviceTask (buildWatch64_32, Devices.ConnectedWatch32_64.Where (d => d.IsSupported (project))) { Ignored = ignored || !IncludewatchOS, BuildOnly = project.BuildOnly }); + } } } @@ -1368,6 +1396,8 @@ IEnumerable find_tasks (StreamWriter writer, string ids) case "?all-watchos": switch (task.Platform) { case TestPlatform.watchOS: + case TestPlatform.watchOS_32: + case TestPlatform.watchOS_64_32: is_match = true; break; default: @@ -2629,6 +2659,8 @@ protected void SetEnvironmentVariables (Process process) case TestPlatform.iOS_TodayExtension64: case TestPlatform.tvOS: case TestPlatform.watchOS: + case TestPlatform.watchOS_32: + case TestPlatform.watchOS_64_32: process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot; process.StartInfo.EnvironmentVariables ["MD_MTOUCH_SDK_ROOT"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current"); process.StartInfo.EnvironmentVariables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); @@ -3546,6 +3578,10 @@ public override string Mode { case TestPlatform.tvOS: case TestPlatform.watchOS: return Platform.ToString () + " - " + XIMode; + case TestPlatform.watchOS_32: + return "watchOS 32-bits - " + XIMode; + case TestPlatform.watchOS_64_32: + return "watchOS 64-bits (ARM64_32) - " + XIMode; case TestPlatform.iOS_Unified32: return "iOS Unified 32-bits - " + XIMode; case TestPlatform.iOS_Unified64: @@ -3631,6 +3667,8 @@ public RunDeviceTask (XBuildTask build_task, IEnumerable candidates) AppRunnerTarget = AppRunnerTarget.Device_tvOS; break; case TestPlatform.watchOS: + case TestPlatform.watchOS_32: + case TestPlatform.watchOS_64_32: AppRunnerTarget = AppRunnerTarget.Device_watchOS; break; default: @@ -3647,7 +3685,7 @@ protected override async Task RunTestAsync () try { // Set the device we acquired. Device = Candidates.First ((d) => d.UDID == device_resource.Resource.Name); - if (Platform == TestPlatform.watchOS) + if (Device.DevicePlatform == DevicePlatform.watchOS) CompanionDevice = Jenkins.Devices.FindCompanionDevice (Jenkins.DeviceLoadLog, Device); Jenkins.MainLog.WriteLine ("Acquired device '{0}' for '{1}'", Device.Name, ProjectFile); @@ -4119,6 +4157,8 @@ public enum TestPlatform iOS_TodayExtension64, tvOS, watchOS, + watchOS_32, + watchOS_64_32, Mac, Mac_Classic, diff --git a/tests/xharness/ProjectFileExtensions.cs b/tests/xharness/ProjectFileExtensions.cs index 63f9a8d4e620..02f09cf92021 100644 --- a/tests/xharness/ProjectFileExtensions.cs +++ b/tests/xharness/ProjectFileExtensions.cs @@ -120,7 +120,10 @@ static bool EvaluateCondition (XmlNode node, string platform, string configurati return true; var conditionValue = condition.Value; - conditionValue = conditionValue.Replace ("$(Configuration)", configuration).Replace ("$(Platform)", platform); + if (configuration != null) + conditionValue = conditionValue.Replace ("$(Configuration)", configuration); + if (platform != null) + conditionValue = conditionValue.Replace ("$(Platform)", platform); var orsplits = conditionValue.Split (orsplitter, StringSplitOptions.None); foreach (var orsplit in orsplits) { @@ -353,7 +356,9 @@ public static void AddToNode (this XmlDocument csproj, string node, string value if (!IsNodeApplicable (mea, platform, configuration)) continue; - mea.InnerText += " " + value; + if (mea.InnerText.Length > 0 && mea.InnerText [mea.InnerText.Length - 1] != ' ') + mea.InnerText += " "; + mea.InnerText += value; found = true; } @@ -499,12 +504,24 @@ public static void FixTestLibrariesReferences (this XmlDocument csproj, string p } } - public static void FixArchitectures (this XmlDocument csproj, string simulator_arch, string device_arch) + public static void SetArchitecture (this XmlDocument csproj, string platform, string configuration, string architecture) + { + var nodes = csproj.SelectNodes ("/*/*/*[local-name() = 'MtouchArch']"); + foreach (XmlNode n in nodes) { + if (!IsNodeApplicable (n, platform, configuration)) + continue; + n.InnerText = architecture; + } + } + + public static void FixArchitectures (this XmlDocument csproj, string simulator_arch, string device_arch, string platform = null, string configuration = null) { var nodes = csproj.SelectNodes ("/*/*/*[local-name() = 'MtouchArch']"); if (nodes.Count == 0) throw new Exception (string.Format ("Could not find MtouchArch at all")); foreach (XmlNode n in nodes) { + if (platform != null && configuration != null && !IsNodeApplicable (n, platform, configuration)) + continue; switch (n.InnerText.ToLower ()) { case "i386": case "x86_64": @@ -514,11 +531,14 @@ public static void FixArchitectures (this XmlDocument csproj, string simulator_a case "armv7": case "armv7s": case "arm64": + case "arm64_32": + case "armv7k": case "armv7, arm64": + case "armv7k, arm64_32": n.InnerText = device_arch; break; default: - throw new NotImplementedException (string.Format ("Unhandled architecture: {0}", n.Value)); + throw new NotImplementedException (string.Format ("Unhandled architecture: {0}", n.InnerText)); } } @@ -770,13 +790,8 @@ public static void RemoveNode (this XmlDocument csproj, string node) public static void CloneConfiguration (this XmlDocument csproj, string platform, string configuration, string new_configuration) { - var projnode = csproj.SelectNodes ("//*[local-name() = 'PropertyGroup']"); + var projnode = csproj.GetPropertyGroups (platform, configuration); foreach (XmlNode xmlnode in projnode) { - if (xmlnode.Attributes ["Condition"] == null) - continue; - if (!IsNodeApplicable (xmlnode, platform, configuration)) - continue; - var clone = xmlnode.Clone (); var condition = clone.Attributes ["Condition"]; condition.InnerText = condition.InnerText.Replace (configuration, new_configuration); @@ -784,23 +799,14 @@ public static void CloneConfiguration (this XmlDocument csproj, string platform, return; } - throw new Exception ("Configuration not found."); + throw new Exception ($"Configuration {platform}|{configuration} not found."); } public static void DeleteConfiguration (this XmlDocument csproj, string platform, string configuration) { - var projnode = csproj.SelectNodes ("//*[local-name() = 'PropertyGroup']"); - foreach (XmlNode xmlnode in projnode) { - if (xmlnode.Attributes ["Condition"] == null) - continue; - if (!IsNodeApplicable (xmlnode, platform, configuration)) - continue; + var projnode = csproj.GetPropertyGroups (platform, configuration); + foreach (XmlNode xmlnode in projnode) xmlnode.ParentNode.RemoveChild (xmlnode); - - return; - } - - throw new Exception ($"Configuration not found: {platform}:{configuration}"); } static IEnumerable SelectElementNodes (this XmlNode node, string name) diff --git a/tests/xharness/Simulators.cs b/tests/xharness/Simulators.cs index 8f7e02bb7228..ed9a06f27e54 100644 --- a/tests/xharness/Simulators.cs +++ b/tests/xharness/Simulators.cs @@ -690,7 +690,14 @@ public class Devices : ILoadAsync public IEnumerable Connected64BitIOS => connected_devices.Where (x => x.DevicePlatform == DevicePlatform.iOS && x.Supports64Bit); public IEnumerable Connected32BitIOS => connected_devices.Where (x => x.DevicePlatform == DevicePlatform.iOS && x.Supports32Bit); public IEnumerable ConnectedTV => connected_devices.Where (x => x.DevicePlatform == DevicePlatform.tvOS); - public IEnumerable ConnectedWatch => connected_devices.Where (x => x.DevicePlatform == DevicePlatform.watchOS); + public IEnumerable ConnectedWatch => connected_devices.Where (x => x.DevicePlatform == DevicePlatform.watchOS && x.Architecture == Architecture.ARMv7k); + public IEnumerable ConnectedWatch32_64 { + get { + return connected_devices.Where ((x) => { + return x.DevicePlatform == DevicePlatform.watchOS && x.Architecture == Architecture.ARM64_32; + }); + } + } Task ILoadAsync.LoadAsync (Log log, bool include_locked, bool force) { diff --git a/tests/xharness/TestProject.cs b/tests/xharness/TestProject.cs index 0a4d798a07bf..641fa7505a21 100644 --- a/tests/xharness/TestProject.cs +++ b/tests/xharness/TestProject.cs @@ -152,6 +152,7 @@ public class iOSTestProject : TestProject { public bool SkipiOSVariation; public bool SkipwatchOSVariation; + public bool SkipwatchOSARM64_32Variation; public bool SkiptvOSVariation; public bool BuildOnly; diff --git a/tests/xharness/WatchOSTarget.cs b/tests/xharness/WatchOSTarget.cs index 5f29b40de043..badc67d202c1 100644 --- a/tests/xharness/WatchOSTarget.cs +++ b/tests/xharness/WatchOSTarget.cs @@ -21,6 +21,14 @@ public class WatchOSTarget : iOSTarget public string WatchOSExtensionProjectPath { get; private set; } public string WatchOSProjectPath { get { return ProjectPath; } private set { ProjectPath = value; } } + public override string SimulatorArchitectures { + get { return "i386"; } + } + + public override string DeviceArchitectures { + get { return "ARMv7k, ARM64_32"; } + } + void CreateWatchOSAppProject () { var csproj = new XmlDocument (); @@ -81,6 +89,28 @@ void CreateWatchOSExtensionProject () { var csproj = inputProject; var suffix = Suffix + "-extension"; + + // Remove unused configurations + csproj.DeleteConfiguration ("iPhone", "Release-bitcode"); + csproj.DeleteConfiguration ("iPhone", "Release64"); + csproj.DeleteConfiguration ("iPhone", "Debug64"); + + csproj.FixArchitectures ("i386", "ARMv7k", "iPhone", "Release32"); + csproj.FixArchitectures ("i386", "ARMv7k", "iPhone", "Debug32"); + + // add Release64_32 and set the correct architecture + csproj.CloneConfiguration ("iPhone", "Release", "Release64_32"); + csproj.FixArchitectures ("i386", "ARM64_32", "iPhone", "Release64_32"); + + // add Debug64_32 and set the correct architecture + csproj.CloneConfiguration ("iPhone", "Debug", "Debug64_32"); + csproj.FixArchitectures ("i386", "ARM64_32", "iPhone", "Debug64_32"); + + csproj.FixArchitectures (SimulatorArchitectures, DeviceArchitectures, "iPhoneSimulator", "Debug"); + csproj.FixArchitectures (SimulatorArchitectures, DeviceArchitectures, "iPhoneSimulator", "Release"); + csproj.FixArchitectures (SimulatorArchitectures, DeviceArchitectures, "iPhone", "Debug"); + csproj.FixArchitectures (SimulatorArchitectures, DeviceArchitectures, "iPhone", "Release"); + csproj.SetProjectTypeGuids ("{1E2E965C-F6D2-49ED-B86E-418A60C69EEF};" + LanguageGuid); csproj.SetOutputPath ("bin\\$(Platform)\\$(Configuration)" + suffix); csproj.SetIntermediateOutputPath ("obj\\$(Platform)\\$(Configuration)" + suffix); @@ -88,7 +118,7 @@ void CreateWatchOSExtensionProject () csproj.SetPlatformAssembly ("Xamarin.WatchOS"); csproj.SetImport (IsFSharp ? "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.AppExtension.FSharp.targets" : "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.AppExtension.CSharp.targets"); csproj.FixProjectReferences ("-watchos"); - csproj.FixArchitectures ("i386", "ARMv7k"); + csproj.FixInfoPListInclude (suffix); csproj.SetOutputType ("Library"); csproj.AddAdditionalDefines ("BITCODE", "iPhone", "Release"); @@ -108,7 +138,7 @@ void CreateWatchOSExtensionProject () // Not linking a watch extensions requires passing -Os to the native compiler. // https://github.com/mono/mono/issues/9867 - var configurations = new string [] { "Debug", "Debug32", "Release", "Release32", "Release-bitcode" }; + var configurations = new string [] { "Debug", "Debug32", "Debug64_32", "Release", "Release32", "Release64_32" }; foreach (var c in configurations) { var flags = "-fembed-bitcode-marker"; if (csproj.GetMtouchLink ("iPhone", c) == "None") diff --git a/tools/mtouch/Application.cs b/tools/mtouch/Application.cs index 6cec4954da11..a5e7d5d16e8e 100644 --- a/tools/mtouch/Application.cs +++ b/tools/mtouch/Application.cs @@ -706,6 +706,8 @@ public void ValidateAbi () if (IsDeviceBuild) { validAbis.Add (Abi.ARMv7k); validAbis.Add (Abi.ARMv7k | Abi.LLVM); + validAbis.Add (Abi.ARM64_32); + validAbis.Add (Abi.ARM64_32 | Abi.LLVM); } else { validAbis.Add (Abi.i386); } @@ -777,6 +779,12 @@ public void ParseAbi (string abi) case "arm64+llvm": value = Abi.ARM64 | Abi.LLVM; break; + case "arm64_32": + value = Abi.ARM64_32; + break; + case "arm64_32+llvm": + value = Abi.ARM64_32 | Abi.LLVM; + break; case "armv7k": value = Abi.ARMv7k; break; @@ -784,7 +792,7 @@ public void ParseAbi (string abi) value = Abi.ARMv7k | Abi.LLVM; break; default: - throw new MonoTouchException (15, true, "Invalid ABI: {0}. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64 and arm64+llvm.", str); + throw new MonoTouchException (15, true, "Invalid ABI: {0}. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64, arm64+llvm, arm64_32 and arm64_32+llvm.", str); } // merge this value with any existing ARMv? already specified. diff --git a/tools/mtouch/Target.cs b/tools/mtouch/Target.cs index 00c99c11b567..effff6eb116a 100644 --- a/tools/mtouch/Target.cs +++ b/tools/mtouch/Target.cs @@ -106,7 +106,11 @@ public void SelectMonoNative () MonoNativeMode = App.DeploymentTarget.Major >= 10 ? MonoNativeMode.Unified : MonoNativeMode.Compat; break; case ApplePlatform.WatchOS: - MonoNativeMode = App.DeploymentTarget.Major >= 3 ? MonoNativeMode.Unified : MonoNativeMode.Compat; + if (Application.IsArchEnabled (Abis, Abi.ARM64_32)) { + MonoNativeMode = MonoNativeMode.Unified; + } else { + MonoNativeMode = App.DeploymentTarget.Major >= 3 ? MonoNativeMode.Unified : MonoNativeMode.Compat; + } break; default: throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in Xamarin.iOS; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", App.Platform); diff --git a/tools/mtouch/mtouch.cs b/tools/mtouch/mtouch.cs index 3668f1e29ee6..92329c06d71c 100644 --- a/tools/mtouch/mtouch.cs +++ b/tools/mtouch/mtouch.cs @@ -1067,7 +1067,7 @@ static Application ParseArguments (string [] args, out Action a) }, true // do not show the option anymore }, - { "abi=", "Comma-separated list of ABIs to target. Currently supported: armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, arm64, arm64+llvm, i386, x86_64", v => app.ParseAbi (v) }, + { "abi=", "Comma-separated list of ABIs to target. Currently supported: armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, arm64, arm64+llvm, arm64_32, arm64_32+llvm, i386, x86_64", v => app.ParseAbi (v) }, { "override-abi=", "Override any previous abi. Only used for testing.", v => { app.ClearAbi (); app.ParseAbi (v); }, true }, // Temporary command line arg until XS has better support for 64bit architectures. { "cxx", "Enable C++ support", v => { app.EnableCxx = true; }}, { "enable-repl:", "Enable REPL support. For simulator only and disabling linking is recommended.", v => { app.EnableRepl = ParseBool (v, "enable-repl"); } },