diff --git a/Make.config b/Make.config index 9cda89d2fa36..37f686f7ca98 100644 --- a/Make.config +++ b/Make.config @@ -289,12 +289,12 @@ MAX_TVOS_SIMULATOR_VERSION=$(TVOS_SDK_VERSION) MAX_WATCH_SIMULATOR_VERSION=$(WATCH_SDK_VERSION) # Minimum OS versions for running XI/XM apps. -MIN_IOS_SDK_VERSION=11.0 +MIN_IOS_SDK_VERSION=12.2 MIN_MACOS_SDK_VERSION=12.0 MIN_WATCHOS_SDK_VERSION=4.0 MIN_WATCHOS64_32_SDK_VERSION=5.1 MIN_WATCH_OS_VERSION=4.0 -MIN_TVOS_SDK_VERSION=11.0 +MIN_TVOS_SDK_VERSION=12.2 MIN_MACCATALYST_SDK_VERSION=15.0 # Minimum OS versions for .NET 9 support @@ -314,11 +314,9 @@ EXTRA_SIMULATORS=com.apple.pkg.iPhoneSimulatorSDK15_0 com.apple.pkg.AppleTVSimul INCLUDE_IOS=1 INCLUDE_MAC=1 -INCLUDE_WATCH=1 INCLUDE_TVOS=1 INCLUDE_MACCATALYST=1 INCLUDE_DEVICE=1 -INCLUDE_DOTNET_WATCHOS= INCLUDE_XAMARIN_LEGACY= INCLUDE_HOTRESTART=1 @@ -408,7 +406,10 @@ SIMULATOR_SDK=$(XCODE_DEVELOPER_ROOT)/Platforms/iPhoneSimulator.platform/Develop # Ref: https://github.com/xamarin/xamarin-macios/issues/16223 OBJC_CFLAGS=-ObjC++ -std=c++14 -fno-exceptions -fno-objc-msgsend-selector-stubs -COMMON_SIMULATOR_CFLAGS=-mios-simulator-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(SIMULATOR_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) +COMMON_SIMULATOR_CFLAGS=-mios-simulator-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(SIMULATOR_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) \ + -L$(SIMULATOR_SDK)/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator \ + -Wno-unused-command-line-argument SIMULATOR86_CFLAGS=$(COMMON_SIMULATOR_CFLAGS) -arch i386 SIMULATOR64_CFLAGS=$(COMMON_SIMULATOR_CFLAGS) -arch x86_64 SIMULATOR_ARM64_CFLAGS=$(COMMON_SIMULATOR_CFLAGS) -arch arm64 @@ -420,14 +421,20 @@ SIMULATOR_ARM64_OBJC_CFLAGS=$(COMMON_SIMULATOR_OBJC_CFLAGS) $(SIMULATOR_ARM64_CF 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$(MACOS_SDK_VERSION).sdk \ -isystem $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/System/iOSSupport/usr/include \ - -iframework $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/System/iOSSupport/System/Library/Frameworks + -iframework $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/System/iOSSupport/System/Library/Frameworks \ + -L$(SIMULATOR_SDK)/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator \ + -Wno-unused-command-line-argument MACCATALYST_OBJC_CFLAGS=$(MACCATALYST_COMMON_CFLAGS) -fobjc-abi-version=2 -fobjc-legacy-dispatch $(OBJC_CFLAGS) MACCATALYST_CFLAGS=$(MACCATALYST_COMMON_CFLAGS) MACCATALYST_COMMON_CFLAGS=$(CFLAGS) -g $(IOS_COMMON_DEFINES) \ -isysroot $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk \ -isystem $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/System/iOSSupport/usr/include \ - -iframework $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/System/iOSSupport/System/Library/Frameworks + -iframework $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/System/iOSSupport/System/Library/Frameworks \ + -L$(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx \ + -Wno-unused-command-line-argument MACCATALYST_COMMON_OBJC_CFLAGS=$(MACCATALYST_COMMON_CFLAGS) -fobjc-abi-version=2 -fobjc-legacy-dispatch $(OBJC_CFLAGS) MACCATALYST_X86_64_OBJC_CFLAGS=$(MACCATALYST_COMMON_OBJC_CFLAGS) -target x86_64-apple-ios$(MIN_MACCATALYST_SDK_VERSION)-macabi -arch x86_64 MACCATALYST_X86_64_CFLAGS=$(MACCATALYST_COMMON_CFLAGS) -target x86_64-apple-ios$(MIN_MACCATALYST_SDK_VERSION)-macabi -arch x86_64 @@ -448,9 +455,13 @@ MACCATALYST_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUC DEVICE_OBJC_CFLAGS=$(OBJC_CFLAGS) DEVICE_SDK=$(XCODE_DEVELOPER_ROOT)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(IOS_SDK_VERSION).sdk -DEVICE7_CFLAGS= -arch armv7 -mno-thumb -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(DEVICE_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) -DEVICE7S_CFLAGS=-arch armv7s -mno-thumb -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(DEVICE_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) -DEVICE64_CFLAGS=-arch arm64 -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(DEVICE_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) +DEVICE_SWIFT_CFLAGS=\ + -L$(DEVICE_SDK)/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos \ + -Wno-unused-command-line-argument +DEVICE7_CFLAGS= -arch armv7 -mno-thumb -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(DEVICE_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) $(DEVICE_SWIFT_CFLAGS) +DEVICE7S_CFLAGS=-arch armv7s -mno-thumb -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(DEVICE_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) $(DEVICE_SWIFT_CFLAGS) +DEVICE64_CFLAGS=-arch arm64 -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -isysroot $(DEVICE_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) $(DEVICE_SWIFT_CFLAGS) DEVICE7_OBJC_CFLAGS =$(DEVICE7_CFLAGS) $(DEVICE_OBJC_CFLAGS) DEVICE7S_OBJC_CFLAGS=$(DEVICE7S_CFLAGS) $(DEVICE_OBJC_CFLAGS) DEVICE64_OBJC_CFLAGS=$(DEVICE64_CFLAGS) $(DEVICE_OBJC_CFLAGS) @@ -488,13 +499,22 @@ XAMARIN_TVSIMULATOR_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.AppleTVSimulator.s XAMARIN_TVOS_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.AppleTVOS.sdk SIMULATORTV_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator$(TVOS_SDK_VERSION).sdk -SIMULATORTV_CFLAGS = -arch x86_64 -mtvos-simulator-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(SIMULATORTV_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) -SIMULATORTV_ARM64_CFLAGS = -arch arm64 -mtvos-simulator-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(SIMULATORTV_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) +SIMULATORTV_CFLAGS = -arch x86_64 -mtvos-simulator-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(SIMULATORTV_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) \ + -L$(SIMULATORTV_SDK)/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvsimulator \ + -Wno-unused-command-line-argument +SIMULATORTV_ARM64_CFLAGS = -arch arm64 -mtvos-simulator-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(SIMULATORTV_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) \ + -L$(SIMULATORTV_SDK)/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvsimulator \ + -Wno-unused-command-line-argument SIMULATORTV_OBJC_CFLAGS = $(SIMULATORTV_CFLAGS) $(COMMON_SIMULATOR_OBJC_CFLAGS) SIMULATORTV_ARM64_OBJC_CFLAGS = $(SIMULATORTV_ARM64_CFLAGS) $(COMMON_SIMULATOR_OBJC_CFLAGS) DEVICETV_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS$(TVOS_SDK_VERSION).sdk -DEVICETV_CFLAGS = -arch arm64 -mtvos-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(DEVICETV_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) +DEVICETV_CFLAGS = -arch arm64 -mtvos-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(DEVICETV_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES)\ + -L$(DEVICETV_SDK)/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/appletvos \ + -Wno-unused-command-line-argument DEVICETV_OBJC_CFLAGS = $(DEVICETV_CFLAGS) $(DEVICE_OBJC_CFLAGS) # macOS @@ -502,7 +522,10 @@ DEVICETV_OBJC_CFLAGS = $(DEVICETV_CFLAGS) $(DEVICE_OBJC_CFLAGS) XAMARIN_MACOS_SDK = $(MAC_FRAMEWORK_CURRENT_DIR)/SDKs/Xamarin.macOS.sdk MAC_OBJC_CFLAGS= -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -DMONOMAC -DMIN_XM_MONO_VERSION=\"$(MIN_XM_MONO_VERSION)\" $(CFLAGS) $(OBJC_CFLAGS) -MAC_CFLAGS = -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -DMONOMAC -g -DMIN_XM_MONO_VERSION=\"$(MIN_XM_MONO_VERSION)\" $(CFLAGS) +MAC_CFLAGS = -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -DMONOMAC -g -DMIN_XM_MONO_VERSION=\"$(MIN_XM_MONO_VERSION)\" $(CFLAGS) \ + -L$(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk/usr/lib/swift \ + -L$(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx \ + -Wno-unused-command-line-argument MAC_LDFLAGS = -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -framework AppKit # Swift compiler flags @@ -529,7 +552,7 @@ WATCHOS_DEVICE_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(DEVICEWATCH_SDK) WATCHOS_DEVICE_ARM64_32_SWIFTFLAGS=$(WATCHOS_DEVICE_COMMON_SWIFTFLAGS) -target arm64_32-apple-watchos$(MIN_WATCHOS_SDK_VERSION) WATCHOS_DEVICE_ARMV7K_SWIFTFLAGS=$(WATCHOS_DEVICE_COMMON_SWIFTFLAGS) -target armv7k-apple-watchos$(MIN_WATCHOS_SDK_VERSION) -MACCATALYST_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(XCODE_MAC_SDKROOT) +MACCATALYST_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(XCODE_MAC_SDKROOT) -Fsystem $(XCODE_MAC_SDKROOT)/System/iOSSupport/System/Library/Frameworks MACCATALYST_ARM64_SWIFTFLAGS=$(MACCATALYST_COMMON_SWIFTFLAGS) -target arm64-apple-ios$(MIN_MACCATALYST_SDK_VERSION)-macabi MACCATALYST_X64_SWIFTFLAGS=$(MACCATALYST_COMMON_SWIFTFLAGS) -target x86_64-apple-ios$(MIN_MACCATALYST_SDK_VERSION)-macabi @@ -785,18 +808,6 @@ DOTNET_TVOS_RUNTIME_IDENTIFIERS_64+=$(DOTNET_TVOS_RUNTIME_IDENTIFIERS) endif # ENABLE_DOTNET endif -ifdef INCLUDE_DOTNET_WATCHOS -DOTNET_PLATFORMS+=watchOS -ifdef INCLUDE_DEVICE -DOTNET_WATCHOS_RUNTIME_IDENTIFIERS=watchos-arm watchos-x86 -DOTNET_WATCHOS_RUNTIME_IDENTIFIERS_32=watchos-arm watchos-x86 -else -DOTNET_WATCHOS_RUNTIME_IDENTIFIERS=watchos-x86 watchos-x64 -DOTNET_WATCHOS_RUNTIME_IDENTIFIERS_32=watchos-x86 -DOTNET_WATCHOS_RUNTIME_IDENTIFIERS_64=watchos-x64 -endif -endif - ifdef INCLUDE_MACCATALYST ifdef ENABLE_DOTNET DOTNET_PLATFORMS+=MacCatalyst diff --git a/configure b/configure index 4fa03300a985..83f2ec39fb81 100755 --- a/configure +++ b/configure @@ -66,7 +66,6 @@ while test "x$1" != x; do echo "INCLUDE_MAC=" >> $CONFIGURED_FILE echo "INCLUDE_IOS=" >> $CONFIGURED_FILE echo "INCLUDE_TVOS=" >> $CONFIGURED_FILE - echo "INCLUDE_WATCH=" >> $CONFIGURED_FILE echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE echo "Disabled all platforms" shift @@ -105,16 +104,6 @@ while test "x$1" != x; do echo "tvOS Build enabled" shift ;; - --disable-watchos) - echo "INCLUDE_WATCH=" >> $CONFIGURED_FILE - echo "watchOS Build disabled" - shift - ;; - --enable-watchos) - echo "INCLUDE_WATCH=1" >> $CONFIGURED_FILE - echo "watchOS Build enabled" - shift - ;; --disable-maccatalyst) echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE echo "Mac Catalyst Build disabled" diff --git a/docs/build-apps/build-properties.md b/docs/build-apps/build-properties.md index 5a478bbcbe6d..52101278797d 100644 --- a/docs/build-apps/build-properties.md +++ b/docs/build-apps/build-properties.md @@ -30,3 +30,15 @@ Example: ``` This property was introduced in .NET 9. + +## MetalLibPath + +The full path to the `metallib` tool (the Metal Linker). + +The default behavior is to use `xcrun metallib`. + +## MetalPath + +The full path to the Metal compiler. + +The default behavior is to use `xcrun metal`. diff --git a/docs/preview-apis.md b/docs/preview-apis.md index e056d55a8bac..7e6ad5448848 100644 --- a/docs/preview-apis.md +++ b/docs/preview-apis.md @@ -96,4 +96,17 @@ We've tentatively set .NET 11 as the release when we'll stop marking FSKit as pr The diagnostic id for FSKit is APL0002. +## StoreKit.AppStore.RequestReview (APL0004) + +The +[AppStore.RequestReview](https://developer.apple.com/documentation/storekit/appstore/3954432-requestreview/) +method is Swift API we've bound manually, and as such it's marked as experimental until .NET 10. + [1]: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.experimentalattribute?view=net-8.0 + +## Rgen (APL0003) + +Rgen is the new Roslyn codegenerator based binding tool. The tool is underdevelopment and its API is open to change until +a stable release is announced. + +The diagnostic id for Rgen is APL0003. diff --git a/dotnet/generate-vs-workload.csharp b/dotnet/generate-vs-workload.csharp index f5e53c5274bf..810254d11c29 100755 --- a/dotnet/generate-vs-workload.csharp +++ b/dotnet/generate-vs-workload.csharp @@ -57,6 +57,7 @@ using (TextWriter writer = new StreamWriter (outputPath)) { var manifestBuildVersion = iOSPlatform.Any () ? iOSPlatform.First ().Item2 : platforms.First ().Item2; writer.WriteLine ($" {manifestBuildVersion}"); writer.WriteLine ($" true"); + writer.WriteLine ($" true"); writer.WriteLine ($" "); writer.WriteLine ($" "); writer.WriteLine ($" "); diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d4a2a1a92b6d..d70b434e4bf9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -95,9 +95,9 @@ https://github.com/dotnet/templating - + https://github.com/dotnet/xharness - 973ef6c89b67f2f746f62c413e3aeeb01a9034a3 + 8c6d5afd99c713777165f4378462085a5679c223 diff --git a/eng/Versions.props b/eng/Versions.props index 760ddee27d26..a9c51618bc68 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,7 +12,7 @@ 9.0.0-rc.2.24462.10 7.0.100-alpha.1.21601.1 0.11.5-alpha.24467.1 - 10.0.0-prerelease.24509.1 + 10.0.0-prerelease.24511.1 $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) diff --git a/mk/rules.mk b/mk/rules.mk index 2d8fd7c512d3..32f808353331 100644 --- a/mk/rules.mk +++ b/mk/rules.mk @@ -52,6 +52,9 @@ define NativeCompilationTemplate .libs/iphonesimulator/%$(1).x86_64.dylib: %.swift | .libs/iphonesimulator $$(call Q_2,SWIFT, [iphonesimulator]) $(SWIFTC) $(IOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@ +.libs/iphonesimulator/%$(1).x86_64.o: %.swift | .libs/iphonesimulator + $$(call Q_2,SWIFT, [iphonesimulator]) $(SWIFTC) $(IOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/iphonesimulator/%$(1).x86_64.dylib: | .libs/iphonesimulator $$(call Q_2,LD, [iphonesimulator]) $(SIMULATOR_CC) $(SIMULATOR64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_IOSSIMULATOR_SDK)/lib -fapplication-extension @@ -72,6 +75,9 @@ define NativeCompilationTemplate .libs/iphonesimulator/%$(1).arm64.dylib: %.swift | .libs/iphonesimulator $$(call Q_2,SWIFT, [iphonesimulator]) $(SWIFTC) $(IOS_SIMULATOR_ARM64_SWIFTFLAGS) $$< -o $$@ +.libs/iphonesimulator/%$(1).arm64.o: %.swift | .libs/iphonesimulator + $$(call Q_2,SWIFT, [iphonesimulator]) $(SWIFTC) $(IOS_SIMULATOR_ARM64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/iphonesimulator/%$(1).arm64.dylib: | .libs/iphonesimulator $$(call Q_2,LD, [iphonesimulator]) $(SIMULATOR_CC) $(SIMULATOR_ARM64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_IOSSIMULATOR_SDK)/lib -fapplication-extension @@ -117,6 +123,9 @@ define NativeCompilationTemplate .libs/iphoneos/%$(1).arm64.dylib: %.swift | .libs/iphoneos $$(call Q_2,SWIFT, [iphoneos]) $(SWIFTC) $(IOS_DEVICE_ARM64_SWIFTFLAGS) $$< -o $$@ +.libs/iphoneos/%$(1).arm64.o: %.swift | .libs/iphoneos + $$(call Q_2,SWIFT, [iphoneos]) $(SWIFTC) $(IOS_DEVICE_ARM64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/iphoneos/%$(1).arm64.dylib: | .libs/iphoneos $$(call Q_2,LD, [iphoneos]) $(DEVICE_CC) $(DEVICE64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_IPHONEOS_SDK)/lib -fapplication-extension @@ -137,6 +146,9 @@ define NativeCompilationTemplate .libs/maccatalyst/%$(1).x86_64.dylib: %.swift | .libs/maccatalyst $$(call Q_2,SWIFT, [maccatalyst]) $(SWIFTC) $(MACCATALYST_X64_SWIFTFLAGS) $$< -o $$@ +.libs/maccatalyst/%$(1).x86_64.o: %.swift | .libs/maccatalyst + $$(call Q_2,SWIFT, [maccatalyst]) $(SWIFTC) $(MACCATALYST_X64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/maccatalyst/%$(1).x86_64.dylib: | .libs/maccatalyst $$(call Q_2,LD, [maccatalyst]) $(XCODE_CC) $(MACCATALYST_X86_64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib -fapplication-extension @@ -155,6 +167,9 @@ define NativeCompilationTemplate .libs/maccatalyst/%$(1).arm64.dylib: %.swift | .libs/maccatalyst $$(call Q_2,SWIFT, [maccatalyst]) $(SWIFTC) $(MACCATALYST_ARM64_SWIFTFLAGS) $$< -o $$@ +.libs/maccatalyst/%$(1).arm64.o: %.swift | .libs/maccatalyst + $$(call Q_2,SWIFT, [maccatalyst]) $(SWIFTC) $(MACCATALYST_ARM64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/maccatalyst/%$(1).arm64.dylib: | .libs/maccatalyst $$(call Q_2,LD, [maccatalyst]) $(XCODE_CC) $(MACCATALYST_ARM64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/lib -fapplication-extension @@ -247,6 +262,9 @@ define NativeCompilationTemplate .libs/tvsimulator/%$(1).x86_64.dylib: %.swift | .libs/tvsimulator $$(call Q_2,SWIFT, [tvsimulator]) $(SWIFTC) $(TVOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@ +.libs/tvsimulator/%$(1).x86_64.o: %.swift | .libs/tvsimulator + $$(call Q_2,SWIFT, [tvsimulator]) $(SWIFTC) $(TVOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/tvsimulator/%$(1).x86_64.dylib: | .libs/tvsimulator $$(call Q_2,LD, [tvsimulator]) $(SIMULATOR_CC) $(SIMULATORTV_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib -fapplication-extension @@ -267,6 +285,9 @@ define NativeCompilationTemplate .libs/tvsimulator/%$(1).arm64.dylib: %.swift | .libs/tvsimulator $$(call Q_2,SWIFT, [tvsimulator]) $(SWIFTC) $(TVOS_SIMULATOR_ARM64_SWIFTFLAGS) $$< -o $$@ +.libs/tvsimulator/%$(1).arm64.o: %.swift | .libs/tvsimulator + $$(call Q_2,SWIFT, [tvsimulator]) $(SWIFTC) $(TVOS_SIMULATOR_ARM64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/tvsimulator/%$(1).arm64.dylib: | .libs/tvsimulator $$(call Q_2,LD, [tvsimulator]) $(SIMULATOR_CC) $(SIMULATORTV_ARM64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib -fapplication-extension @@ -287,6 +308,9 @@ define NativeCompilationTemplate .libs/tvos/%$(1).arm64.dylib: %.swift | .libs/tvos $$(call Q_2,SWIFT, [tvos]) $(SWIFTC) $(TVOS_DEVICE_ARM64_SWIFTFLAGS) $$< -o $$@ +.libs/tvos/%$(1).arm64.o: %.swift | .libs/tvos + $$(call Q_2,SWIFT, [tvos]) $(SWIFTC) $(TVOS_DEVICE_ARM64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/tvos/%$(1).arm64.dylib: | .libs/tvos $$(call Q_2,LD, [tvos]) $(DEVICE_CC) $(DEVICETV_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib -fapplication-extension @@ -307,6 +331,15 @@ define NativeCompilationTemplate .libs/mac/%$(1).x86_64.dylib: %.swift | .libs/mac $$(call Q_2,SWIFT, [mac]) $(SWIFTC) $(MACOS_X64_SWIFTFLAGS) $$< -o $$@ +.libs/mac/%$(1).x86_64.o: %.swift | .libs/mac + $$(call Q_2,SWIFT, [mac]) $(SWIFTC) $(MACOS_X64_SWIFTFLAGS) $$< -o $$@ -emit-object + +.libs/macos/%$(1).x86_64.dylib: %.swift | .libs/mac + $$(call Q_2,SWIFT, [macos]) $(SWIFTC) $(MACOS_X64_SWIFTFLAGS) $$< -o $$@ + +.libs/macos/%$(1).x86_64.o: %.swift | .libs/mac + $$(call Q_2,SWIFT, [mac]) $(SWIFTC) $(MACOS_X64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/macos/%$(1).x86_64.dylib: %.swift | .libs/mac $$(call Q_2,SWIFT, [macos]) $(SWIFTC) $(MACOS_X64_SWIFTFLAGS) $$< -o $$@ @@ -328,9 +361,15 @@ define NativeCompilationTemplate .libs/mac/%$(1).arm64.dylib: %.swift | .libs/mac $$(call Q_2,SWIFT, [mac]) $(SWIFTC) $(MACOS_ARM64_SWIFTFLAGS) $$< -o $$@ +.libs/mac/%$(1).arm64.o: %.swift | .libs/mac + $$(call Q_2,SWIFT, [mac]) $(SWIFTC) $(MACOS_ARM64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/macos/%$(1).arm64.dylib: %.swift | .libs/mac $$(call Q_2,SWIFT, [macos]) $(SWIFTC) $(MACOS_ARM64_SWIFTFLAGS) $$< -o $$@ +.libs/macos/%$(1).arm64.o: %.swift | .libs/mac + $$(call Q_2,SWIFT, [macos]) $(SWIFTC) $(MACOS_ARM64_SWIFTFLAGS) $$< -o $$@ -emit-object + .libs/mac/%$(1).arm64.dylib: | .libs/mac $$(call Q_2,LD, [mac]) $(MAC_CC) $(MAC_CFLAGS) $$(EXTRA_FLAGS) -arch arm64 -dynamiclib -o $$@ $$^ -L$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/lib -fapplication-extension diff --git a/msbuild/Makefile b/msbuild/Makefile index f614321fc427..9cc8d6cc1731 100644 --- a/msbuild/Makefile +++ b/msbuild/Makefile @@ -9,19 +9,16 @@ endif ifdef INCLUDE_TVOS BUILD_IOS=1 endif -ifdef INCLUDE_WATCH -BUILD_IOS=1 -endif ifdef INCLUDE_MACCATALYST BUILD_IOS=1 endif # -# To add a new MSBuild assembly, add the base name to the corresponding [IOS|MAC|WATCH]_[BINDING]_TASK_ASSEMBLIES variable. +# To add a new MSBuild assembly, add the base name to the corresponding [IOS|MAC]_[BINDING]_TASK_ASSEMBLIES variable. # # New .targets and .props files are picked up automatically if they're in a directory with already # existing .targets or .props files. If .targets or .props are added in a new directory, add that -# directory using a wildcard function to the corresponding [IOS|MAC|WATCH]_TARGETS variable. +# directory using a wildcard function to the corresponding [IOS|MAC]_TARGETS variable. # ## @@ -144,44 +141,6 @@ MSBUILD_DIRECTORIES += $(MACCATALYST_DIRECTORIES) MSBUILD_SYMLINKS += symlinks-maccatalyst endif -## -## XW definitions -## - -WATCH_TARGETS = \ - $(wildcard Xamarin.Shared/Xamarin.WatchOS.*.props) \ - $(wildcard Xamarin.Shared/Xamarin.WatchOS.*.targets) \ - Xamarin.MacDev.Tasks/NoCode.cs \ - $(wildcard Xamarin.Shared/Xamarin.ImplicitFacade.targets) \ - -WATCH_DIRECTORIES = \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/RedistList \ - $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.WatchOS/v1.0/RedistList \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS \ - -# XW symlinks the entire $(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS directory to -# /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/WatchOS instead of -# each separate file (like XI does). - -WATCH_SYMLINKS = \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/RedistList/FrameworkList.xml \ - $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.WatchOS/v1.0/RedistList/FrameworkList.xml \ - $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/WatchOS \ - -WATCH_PRODUCTS = \ - $(WATCH_SYMLINKS) \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS/FrameworkList.xml \ - $(foreach target,$(WATCH_TARGETS) ,$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS/$(notdir $(target))) \ - -all-watch: $(WATCH_PRODUCTS) -symlinks-watch: $(WATCH_SYMLINKS) - -ifdef INCLUDE_WATCH -MSBUILD_PRODUCTS += all-watch -MSBUILD_DIRECTORIES += $(WATCH_DIRECTORIES) -MSBUILD_SYMLINKS += symlinks-watch -endif - ## ## Xamarin.TVOS definitions ## @@ -333,25 +292,6 @@ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst/RedistList/Framew $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst/%: Xamarin.Shared/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/MacCatalyst $(Q) install -m 644 $< $@ -## -## XW -## - -$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.WatchOS/v1.0/RedistList/FrameworkList.xml: | $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks/Xamarin.WatchOS/v1.0/RedistList - $(Q) ln -fs $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/msbuild/WatchOS/$(notdir $@) $@ - -$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/WatchOS: | $(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild/Xamarin - $(Q) ln -Fhs $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/msbuild/WatchOS $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS/FrameworkList.xml: Xamarin.Shared/Xamarin.WatchOS-FrameworkList.xml.in Makefile | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS - $(Q) sed 's@%TargetFrameworkDirectory%@$(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.WatchOS@' $< > $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/RedistList/FrameworkList.xml: $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS/FrameworkList.xml | $(WATCH_DIRECTORIES) - $(Q) ln -fs $(IOS_TARGETDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/msbuild/WatchOS/$(notdir $@) $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS/%: Xamarin.Shared/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/msbuild/WatchOS - $(Q) install -m 644 $< $@ - ## ## Xamarin.TVOS ## @@ -415,11 +355,10 @@ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/%: Xamarin.Localization.M ## net5 targets ## ## -# tvOS and watchOS ships most of the iOS targets as well (for now, we don't need all of these, so this is optimizable) +# tvOS ships most of the iOS targets as well (for now, we don't need all of these, so this is optimizable) DOTNET_SHARED_FILES = $(IOS_TARGETS) $(IOS_BINDING_TARGETS) $(foreach dll,$(IOS_TASK_ASSEMBLIES),$(dll).dll $(dll).pdb) DOTNET_IOS_FILES = $(DOTNET_SHARED_FILES) FrameworkList.xml DOTNET_TVOS_FILES = $(TVOS_TARGETS) FrameworkList.xml -DOTNET_WATCHOS_FILES = $(WATCH_TARGETS) FrameworkList.xml DOTNET_MACOS_FILES = $(MAC_TARGETS) $(MAC_BINDING_TARGETS) $(foreach dll,$(MAC_TASK_ASSEMBLIES),$(dll).dll $(dll).pdb) FrameworkList.xml DOTNET_MACCATALYST_FILES = $(MACCATALYST_TARGETS) FrameworkList.xml diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs index dffb0dd4724a..bf3f7b927e8d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Collections.Generic; +using System.Threading; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -11,77 +12,53 @@ using Xamarin.Localization.MSBuild; using Xamarin.Messaging.Build.Client; -// Disable until we get around to enable + fix any issues. -#nullable disable - namespace Xamarin.MacDev.Tasks { - public class Metal : XamarinToolTask { + public class Metal : XamarinTask { + CancellationTokenSource? cancellationTokenSource; + #region Inputs [Required] - public string IntermediateOutputPath { get; set; } + public string IntermediateOutputPath { get; set; } = string.Empty; + + public string MetalPath { get; set; } = string.Empty; [Required] - public string MinimumOSVersion { get; set; } + public string MinimumOSVersion { get; set; } = string.Empty; [Required] - public string ProjectDir { get; set; } + public string ProjectDir { get; set; } = string.Empty; [Required] - public string ResourcePrefix { get; set; } + public string ResourcePrefix { get; set; } = string.Empty; [Required] - public string SdkDevPath { get; set; } + public string SdkDevPath { get; set; } = string.Empty; [Required] - public string SdkVersion { get; set; } + public string SdkVersion { get; set; } = string.Empty; [Required] public bool SdkIsSimulator { get; set; } [Required] - public string SdkRoot { get; set; } + public string SdkRoot { get; set; } = string.Empty; [Required] - public ITaskItem SourceFile { get; set; } + public ITaskItem? SourceFile { get; set; } #endregion [Output] - public ITaskItem OutputFile { get; set; } - - string DevicePlatformBinDir { - get { - switch (Platform) { - case ApplePlatform.iOS: - case ApplePlatform.TVOS: - case ApplePlatform.WatchOS: - return AppleSdkSettings.XcodeVersion.Major >= 11 - ? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin") - : Path.Combine (SdkDevPath, "Platforms", "iPhoneOS.platform", "usr", "bin"); - case ApplePlatform.MacOSX: - case ApplePlatform.MacCatalyst: - return AppleSdkSettings.XcodeVersion.Major >= 10 - ? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin") - : Path.Combine (SdkDevPath, "Platforms", "MacOSX.platform", "usr", "bin"); - default: - throw new InvalidOperationException (string.Format (MSBStrings.InvalidPlatform, Platform)); - } - } - } + public ITaskItem? OutputFile { get; set; } - protected override string ToolName { - get { return "metal"; } - } - - protected override string GenerateFullPathToTool () + static string GetExecutable (List arguments, string toolName, string toolPathOverride) { - if (!string.IsNullOrEmpty (ToolPath)) - return Path.Combine (ToolPath, ToolExe); - - var path = Path.Combine (DevicePlatformBinDir, ToolExe); - - return File.Exists (path) ? path : ToolExe; + if (string.IsNullOrEmpty (toolPathOverride)) { + arguments.Insert (0, toolName); + return "xcrun"; + } + return toolPathOverride; } public override bool Execute () @@ -89,37 +66,36 @@ public override bool Execute () if (ShouldExecuteRemotely ()) return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; - if (AppleSdkSettings.XcodeVersion.Major >= 11) - EnvironmentVariables = EnvironmentVariables.CopyAndAdd ($"SDKROOT={SdkRoot}"); - return base.Execute (); - } + var env = new Dictionary { + { "SDKROOT", SdkRoot }, + }; - protected override string GenerateCommandLineCommands () - { var prefixes = BundleResource.SplitResourcePrefixes (ResourcePrefix); - var intermediate = Path.Combine (IntermediateOutputPath, ToolName); - var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, SourceFile, !string.IsNullOrEmpty (SessionId)); + var intermediate = Path.Combine (IntermediateOutputPath, MetalPath); + var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, SourceFile!, !string.IsNullOrEmpty (SessionId)); var path = Path.Combine (intermediate, logicalName); - var args = new CommandLineArgumentBuilder (); + var args = new List (); var dir = Path.GetDirectoryName (path); - if (!Directory.Exists (dir)) - Directory.CreateDirectory (dir); + Directory.CreateDirectory (dir); OutputFile = new TaskItem (Path.ChangeExtension (path, ".air")); OutputFile.SetMetadata ("LogicalName", Path.ChangeExtension (logicalName, ".air")); - args.Add ("-arch", "air64"); + var executable = GetExecutable (args, "metal", MetalPath); + + args.Add ("-arch"); + args.Add ("air64"); args.Add ("-emit-llvm"); args.Add ("-c"); args.Add ("-gline-tables-only"); args.Add ("-ffast-math"); args.Add ("-serialize-diagnostics"); - args.AddQuoted (Path.ChangeExtension (path, ".dia")); + args.Add (Path.ChangeExtension (path, ".dia")); args.Add ("-o"); - args.AddQuoted (Path.ChangeExtension (path, ".air")); + args.Add (Path.ChangeExtension (path, ".air")); if (Platform == ApplePlatform.MacCatalyst) { args.Add ($"-target"); @@ -127,23 +103,21 @@ protected override string GenerateCommandLineCommands () } else { args.Add (PlatformFrameworkHelper.GetMinimumVersionArgument (TargetFrameworkMoniker, SdkIsSimulator, MinimumOSVersion)); } - args.AddQuoted (SourceFile.ItemSpec); + args.Add (SourceFile!.ItemSpec); - return args.ToString (); - } + cancellationTokenSource = new CancellationTokenSource (); + ExecuteAsync (Log, executable, args, environment: env, cancellationToken: cancellationTokenSource.Token).Wait (); - protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance) - { - // TODO: do proper parsing of error messages and such - Log.LogMessage (messageImportance, "{0}", singleLine); + return !Log.HasLoggedErrors; } - public override void Cancel () + public void Cancel () { - if (ShouldExecuteRemotely ()) + if (ShouldExecuteRemotely ()) { BuildConnection.CancelAsync (BuildEngine4).Wait (); - - base.Cancel (); + } else { + cancellationTokenSource?.Cancel (); + } } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs index a98654fb4dd4..2c689669a2f1 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -10,78 +11,35 @@ using Xamarin.Messaging.Build.Client; using Xamarin.Utils; -// Disable until we get around to enable + fix any issues. -#nullable disable - namespace Xamarin.MacDev.Tasks { - public class MetalLib : XamarinToolTask, ITaskCallback { + public class MetalLib : XamarinTask, ITaskCallback { + CancellationTokenSource? cancellationTokenSource; + #region Inputs [Required] - public ITaskItem [] Items { get; set; } + public ITaskItem [] Items { get; set; } = Array.Empty (); + + public string MetalLibPath { get; set; } = string.Empty; [Required] - public string OutputLibrary { get; set; } + public string OutputLibrary { get; set; } = string.Empty; [Required] - public string SdkDevPath { get; set; } + public string SdkDevPath { get; set; } = string.Empty; [Required] - public string SdkRoot { get; set; } + public string SdkRoot { get; set; } = string.Empty; #endregion - string DevicePlatformBinDir { - get { - switch (Platform) { - case ApplePlatform.iOS: - case ApplePlatform.TVOS: - case ApplePlatform.WatchOS: - return AppleSdkSettings.XcodeVersion.Major >= 11 - ? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin") - : Path.Combine (SdkDevPath, "Platforms", "iPhoneOS.platform", "usr", "bin"); - case ApplePlatform.MacOSX: - case ApplePlatform.MacCatalyst: - return AppleSdkSettings.XcodeVersion.Major >= 10 - ? Path.Combine (SdkDevPath, "Toolchains", "XcodeDefault.xctoolchain", "usr", "bin") - : Path.Combine (SdkDevPath, "Platforms", "MacOSX.platform", "usr", "bin"); - default: - throw new InvalidOperationException (string.Format (MSBStrings.InvalidPlatform, Platform)); - } - } - } - - protected override string ToolName { - get { return "metallib"; } - } - - protected override string GenerateFullPathToTool () + static string GetExecutable (List arguments, string toolName, string toolPathOverride) { - if (!string.IsNullOrEmpty (ToolPath)) - return Path.Combine (ToolPath, ToolExe); - - var path = Path.Combine (DevicePlatformBinDir, ToolExe); - - return File.Exists (path) ? path : ToolExe; - } - - protected override string GenerateCommandLineCommands () - { - var args = new CommandLineArgumentBuilder (); - - args.Add ("-o"); - args.AddQuoted (OutputLibrary); - - foreach (var item in Items) - args.AddQuoted (item.ItemSpec); - - return args.ToString (); - } - - protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance) - { - // TODO: do proper parsing of error messages and such - Log.LogMessage (messageImportance, "{0}", singleLine); + if (string.IsNullOrEmpty (toolPathOverride)) { + arguments.Insert (0, toolName); + return "xcrun"; + } + return toolPathOverride; } public override bool Execute () @@ -90,14 +48,24 @@ public override bool Execute () return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; var dir = Path.GetDirectoryName (OutputLibrary); + Directory.CreateDirectory (dir); - if (!Directory.Exists (dir)) - Directory.CreateDirectory (dir); + var env = new Dictionary { + { "SDKROOT", SdkRoot }, + }; - if (AppleSdkSettings.XcodeVersion.Major >= 11) - EnvironmentVariables = EnvironmentVariables.CopyAndAdd ($"SDKROOT={SdkRoot}"); + var args = new List (); + args.Add ("-o"); + args.Add (OutputLibrary); + foreach (var item in Items) + args.Add (item.ItemSpec); + + var executable = GetExecutable (args, "metallib", MetalLibPath); + + cancellationTokenSource = new CancellationTokenSource (); + ExecuteAsync (Log, executable, args, environment: env, cancellationToken: cancellationTokenSource.Token).Wait (); - return base.Execute (); + return !Log.HasLoggedErrors; } public bool ShouldCopyToBuildServer (ITaskItem item) => false; @@ -106,12 +74,13 @@ public override bool Execute () public IEnumerable GetAdditionalItemsToBeCopied () => Enumerable.Empty (); - public override void Cancel () + public void Cancel () { - base.Cancel (); - - if (ShouldExecuteRemotely ()) + if (ShouldExecuteRemotely ()) { BuildConnection.CancelAsync (BuildEngine4).Wait (); + } else { + cancellationTokenSource?.Cancel (); + } } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs index e17775c17c75..ab5fc5e04ed0 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading; using Microsoft.Build.Framework; using Microsoft.Build.Tasks; @@ -120,7 +121,7 @@ protected System.Threading.Tasks.Task ExecuteAsync (string fileName, return ExecuteAsync (Log, fileName, arguments, sdkDevPath, environment, mergeOutput, showErrorIfFailure, workingDirectory); } - internal protected static async System.Threading.Tasks.Task ExecuteAsync (TaskLoggingHelper log, string fileName, IList arguments, string? sdkDevPath = null, Dictionary? environment = null, bool mergeOutput = true, bool showErrorIfFailure = true, string? workingDirectory = null) + internal protected static async System.Threading.Tasks.Task ExecuteAsync (TaskLoggingHelper log, string fileName, IList arguments, string? sdkDevPath = null, Dictionary? environment = null, bool mergeOutput = true, bool showErrorIfFailure = true, string? workingDirectory = null, CancellationToken? cancellationToken = null) { // Create a new dictionary if we're given one, to make sure we don't change the caller's dictionary. var launchEnvironment = environment is null ? new Dictionary () : new Dictionary (environment); @@ -128,7 +129,7 @@ internal protected static async System.Threading.Tasks.Task ExecuteAs launchEnvironment ["DEVELOPER_DIR"] = sdkDevPath; log.LogMessage (MessageImportance.Normal, MSBStrings.M0001, fileName, StringUtils.FormatArguments (arguments)); - var rv = await Execution.RunAsync (fileName, arguments, environment: launchEnvironment, mergeOutput: mergeOutput, workingDirectory: workingDirectory); + var rv = await Execution.RunAsync (fileName, arguments, environment: launchEnvironment, mergeOutput: mergeOutput, workingDirectory: workingDirectory, cancellationToken: cancellationToken); log.LogMessage (rv.ExitCode == 0 ? MessageImportance.Low : MessageImportance.High, MSBStrings.M0002, fileName, rv.ExitCode); // Show the output diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.targets index bc155c936ad5..e92e02dae188 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.targets @@ -1398,6 +1398,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true' and '%(Metal.Identity)' != ''" IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)" + MetalPath="$(MetalPath)" MinimumOSVersion="$(_MinimumOSVersion)" ProjectDir="$(MSBuildProjectDirectory)" TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)" @@ -1417,6 +1418,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Items="@(_SmeltedMetal)" + MetalLibPath="$(MetalLibPath)" SdkDevPath="$(_SdkDevPath)" SdkRoot="$(_SdkRoot)" OutputLibrary="$(_AppResourcesPath)default.metallib"> diff --git a/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets b/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets index 3e7f4b9de394..4ed1bd93a17b 100644 --- a/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets +++ b/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets @@ -403,6 +403,10 @@ Copyright (C) 2011-2013 Xamarin. All rights reserved. + + + <_ILLinkExitCode Condition="'$(_ILLinkExitCode)' == '' And '$(MSBuildLastTaskResult)' != 'true'">-1 + diff --git a/runtime/Makefile b/runtime/Makefile index 2d95fa5973a5..72ca9932f4d9 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -22,7 +22,7 @@ SHIPPED_HEADERS += \ xamarin/monovm-bridge.h \ xamarin/coreclr-bridge.h \ -SHARED_SOURCES += mono-runtime.m bindings.m bindings-generated.m shared.m runtime.m trampolines.m trampolines-invoke.m xamarin-support.m nsstring-localization.m trampolines-varargs.m monovm-bridge.m coreclr-bridge.m nativeaot-bridge.m +SHARED_SOURCES += mono-runtime.m bindings.m bindings-generated.m shared.m runtime.m trampolines.m trampolines-invoke.m xamarin-support.m nsstring-localization.m trampolines-varargs.m monovm-bridge.m coreclr-bridge.m nativeaot-bridge.m swift-functions.swift SHARED_I386_SOURCES += trampolines-i386.m trampolines-i386-asm.s trampolines-i386-objc_msgSend.s trampolines-i386-objc_msgSendSuper.s trampolines-i386-objc_msgSend_stret.s trampolines-i386-objc_msgSendSuper_stret.s SHARED_X86_64_SOURCES += trampolines-x86_64.m trampolines-x86_64-asm.s trampolines-x86_64-objc_msgSend.s trampolines-x86_64-objc_msgSendSuper.s trampolines-x86_64-objc_msgSend_stret.s trampolines-x86_64-objc_msgSendSuper_stret.s SHARED_ARM64_SOURCES += trampolines-arm64.m trampolines-arm64-asm.s trampolines-arm64-objc_msgSend.s trampolines-arm64-objc_msgSendSuper.s @@ -69,14 +69,14 @@ bindings-generated.m: $(BINDINGS_GENERATOR) # our makefiles don't support building the same source file multiple times with different defines, # so just symlink extension-main.m to another file and compile that instead. -app-main.m watchextension-main.m tvextension-main.m: extension-main.m +app-main.m tvextension-main.m: extension-main.m $(Q_LN) ln -fs $< $@ product.h: product.in.h Makefile $(GIT_DIRECTORY)/index $(Q) sed -e 's/@PRODUCT_HASH@/$(CURRENT_HASH_LONG)/' $< > $@.tmp $(Q) mv $@.tmp $@ # -# MonoTouch defines (used for all MonoTouch platforms: iOS, WatchOS and TVOS) +# MonoTouch defines (used for all MonoTouch platforms: iOS and TVOS) # MONOTOUCH_SOURCES = \ @@ -99,7 +99,7 @@ MONOTOUCH_FRAMEWORKS = \ Xamarin \ Xamarin-debug \ -MONOTOUCH_SOURCE_STEMS = $(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_SOURCES) $(MONOTOUCH_SOURCES))) +MONOTOUCH_SOURCE_STEMS = $(patsubst %.swift,%,$(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_SOURCES) $(MONOTOUCH_SOURCES)))) MONOTOUCH_I386_SOURCE_STEMS = $(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_I386_SOURCES))) MONOTOUCH_X86_64_SOURCE_STEMS = $(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_X86_64_SOURCES))) MONOTOUCH_ARM64_SOURCE_STEMS = $(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_ARM64_SOURCES))) @@ -166,17 +166,6 @@ endif $(eval $(call FrameworkTemplate,iphonesimulator,IOSSIMULATOR,$(IOS_SIMULATOR_ARCHITECTURES))) endif -ifdef INCLUDE_WATCH -ifdef INCLUDE_DEVICE -ifdef WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES -$(eval $(call FrameworkTemplate,watchos,WATCHOS,armv7k arm64_32)) -else -$(eval $(call FrameworkTemplate,watchos,WATCHOS,arm64_32)) -endif -endif -$(eval $(call FrameworkTemplate,watchsimulator,WATCHSIMULATOR,x86)) -endif - ifdef INCLUDE_TVOS ifdef INCLUDE_DEVICE $(eval $(call FrameworkTemplate,tvos,TVOS,arm64)) @@ -241,17 +230,6 @@ ifdef INCLUDE_MACCATALYST $(eval $(call PlatformTemplate,maccatalyst,MACCATALYST,x86_64)) endif -ifdef INCLUDE_WATCH -ifdef INCLUDE_DEVICE -ifdef WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES -$(eval $(call PlatformTemplate,watchos,WATCHOS,armv7k arm64_32)) -else -$(eval $(call PlatformTemplate,watchos,WATCHOS,arm64_32)) -endif -endif -$(eval $(call PlatformTemplate,watchsimulator,WATCHSIMULATOR,x86 x86_64)) -endif - ifdef INCLUDE_TVOS ifdef INCLUDE_DEVICE $(eval $(call PlatformTemplate,tvos,TVOS,arm64)) @@ -269,7 +247,6 @@ endif define LibTemplate $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/extension-main.$$(arch).o): EXTRA_DEFINES=-DEXTENSION -$$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/watchextension-main.$$(arch).o): EXTRA_DEFINES=-DWATCH_EXTENSION $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/tvextension-main.$$(arch).o): EXTRA_DEFINES=-DTV_EXTENSION .libs/$(1)/libextension.%.a: .libs/$(1)/extension-main.%.o @@ -322,8 +299,6 @@ endef $(eval $(call LibTemplate,iphoneos,IPHONEOS)) $(eval $(call LibTemplate,iphonesimulator,IOSSIMULATOR)) $(eval $(call LibTemplate,maccatalyst,MACCATALYST)) -$(eval $(call LibTemplate,watchos,WATCHOS)) -$(eval $(call LibTemplate,watchsimulator,WATCHSIMULATOR)) $(eval $(call LibTemplate,tvos,TVOS)) $(eval $(call LibTemplate,tvsimulator,TVSIMULATOR)) @@ -406,10 +381,6 @@ $(eval $(call LibXamarinTemplate,iphonesimulator,IOSSIMULATOR)) $(eval $(call LibXamarinTemplate,iphonesimulator,IOSSIMULATOR,_DEBUG,-debug)) $(eval $(call LibXamarinTemplate,maccatalyst,MACCATALYST)) $(eval $(call LibXamarinTemplate,maccatalyst,MACCATALYST,_DEBUG,-debug)) -$(eval $(call LibXamarinTemplate,watchos,WATCHOS)) -$(eval $(call LibXamarinTemplate,watchos,WATCHOS,_DEBUG,-debug)) -$(eval $(call LibXamarinTemplate,watchsimulator,WATCHSIMULATOR)) -$(eval $(call LibXamarinTemplate,watchsimulator,WATCHSIMULATOR,_DEBUG,-debug)) $(eval $(call LibXamarinTemplate,tvos,TVOS)) $(eval $(call LibXamarinTemplate,tvos,TVOS,_DEBUG,-debug)) $(eval $(call LibXamarinTemplate,tvsimulator,TVSIMULATOR)) diff --git a/runtime/swift-functions.swift b/runtime/swift-functions.swift new file mode 100644 index 000000000000..1f826a771560 --- /dev/null +++ b/runtime/swift-functions.swift @@ -0,0 +1,29 @@ +#if os(macOS) +import AppKit +#endif +import Foundation +import StoreKit +#if !os(macOS) +import UIKit +#endif + +@objc(XamarinSwiftFunctions) +public class XamarinSwiftFunctions : NSObject { +#if os(macOS) + @MainActor + @objc(requestReview:) + @available(macOS 13, *) + public static func StoreKit_RequestReview(scene: NSViewController) + { + AppStore.requestReview(in: scene) + } +#elseif !os(tvOS) + @MainActor + @objc(requestReview:) + @available(iOS 16, macCatalyst 16, *) + public static func StoreKit_RequestReview(scene: UIWindowScene) + { + AppStore.requestReview(in: scene) + } +#endif +} diff --git a/src/AVFoundation/AVCaptureReactionType.rgen.cs b/src/AVFoundation/AVCaptureReactionType.rgen.cs new file mode 100644 index 000000000000..de1bc4ee63f7 --- /dev/null +++ b/src/AVFoundation/AVCaptureReactionType.rgen.cs @@ -0,0 +1,44 @@ +#pragma warning disable APL0003 +using System; +using System.Runtime.Versioning; + +using Foundation; +using ObjCRuntime; +using ObjCBindings; + +#nullable enable + +namespace AVFoundation { + + [BindingTypeAttribute] + [SupportedOSPlatform ("ios17.0")] + [SupportedOSPlatform ("tvos17.0")] + [SupportedOSPlatform ("maccatalyst17.0")] + [SupportedOSPlatform ("macos14.0")] + public enum AVCaptureReactionType { + [Field ("AVCaptureReactionTypeThumbsUp")] + ThumbsUp, + + [Field ("AVCaptureReactionTypeThumbsDown")] + ThumbsDown, + + [Field ("AVCaptureReactionTypeBalloons")] + Balloons, + + [Field ("AVCaptureReactionTypeHeart")] + Heart, + + [Field ("AVCaptureReactionTypeFireworks")] + Fireworks, + + [Field ("AVCaptureReactionTypeRain")] + Rain, + + [Field ("AVCaptureReactionTypeConfetti")] + Confetti, + + [Field ("AVCaptureReactionTypeLasers")] + Lasers, + } +} +#pragma warning restore APL0003 diff --git a/src/Makefile b/src/Makefile index ea2a4162dcb4..bb088101958c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -103,6 +103,7 @@ DOTNET_WARNINGS_TO_FIX = -nowarn:$(CSC_WARNINGS_TO_FIX) DOTNET_CORE_WARNINGS_TO_FIX = -nowarn:$(CSC_WARNINGS_TO_FIX),$(BGEN_WARNINGS_TO_FIX) include ./Makefile.generator +include ./Makefile.rgenerator include ./generator-diff.mk SHARED_RESX = $(TOP)/tools/mtouch/Errors.resx @@ -355,7 +356,7 @@ $($(2)_DOTNET_BUILD_DIR)/core-$(3).dll: $($(2)_DOTNET_CORE_SOURCES) frameworks.s $($(2)_DOTNET_BUILD_DIR)/$(3)-generated-sources: $(DOTNET_GENERATOR) $($(2)_DOTNET_APIS) $($(2)_DOTNET_BUILD_DIR)/core-$(3).dll $(DOTNET_BINDING_ATTRIBUTES) $($(2)_DOTNET_BUILD_DIR)/$(3).rsp | $($(2)_DOTNET_BUILD_DIR)/generated-sources $$(Q_DOTNET_GEN) $$< @$($(2)_DOTNET_BUILD_DIR)/$(3).rsp -$($(2)_DOTNET_BUILD_DIR)/$(3).rsp: Makefile Makefile.generator frameworks.sources $(DOTNET_COMPILER) | $($(2)_DOTNET_BUILD_DIR) +$($(2)_DOTNET_BUILD_DIR)/$(3).rsp: Makefile Makefile.generator Makefile.rgenerator frameworks.sources $(ROSLYN_GENERATOR) $(DOTNET_COMPILER) | $($(2)_DOTNET_BUILD_DIR) $(Q) echo \ $($(2)_GENERATOR_FLAGS) \ $(DOTNET_GENERATOR_FLAGS) \ @@ -450,10 +451,11 @@ $(2)_DOTNET_PLATFORM_ASSEMBLY_DIR_DEPENDENCIES = \ $($(2)_DOTNET_BUILD_DIR)/$(4) \ $($(2)_DOTNET_BUILD_DIR)/ref \ -$($(2)_DOTNET_BUILD_DIR)/$(4)/Microsoft.$(1)%dll $($(2)_DOTNET_BUILD_DIR)/$(4)/Microsoft.$(1)%pdb $$($(2)_$(4)_REF_TARGET) $$($(2)_$(4)_DOC_TARGET): $$($(2)_DOTNET_PLATFORM_ASSEMBLY_DEPENDENCIES) | $$($(2)_DOTNET_PLATFORM_ASSEMBLY_DIR_DEPENDENCIES) +$($(2)_DOTNET_BUILD_DIR)/$(4)/Microsoft.$(1)%dll $($(2)_DOTNET_BUILD_DIR)/$(4)/Microsoft.$(1)%pdb $$($(2)_$(4)_REF_TARGET) $$($(2)_$(4)_DOC_TARGET): $$($(2)_DOTNET_PLATFORM_ASSEMBLY_DEPENDENCIES) $$(ROSLYN_GENERATOR) | $$($(2)_DOTNET_PLATFORM_ASSEMBLY_DIR_DEPENDENCIES) $$(call Q_PROF_CSC,dotnet/$(4)-bit) \ $(DOTNET_CSC) \ $(DOTNET_FLAGS) \ + /analyzer:$(ROSLYN_GENERATOR) \ -unsafe \ -optimize \ $$(ARGS_$(1)) \ diff --git a/src/Makefile.rgenerator b/src/Makefile.rgenerator new file mode 100644 index 000000000000..e3bd9f2b997a --- /dev/null +++ b/src/Makefile.rgenerator @@ -0,0 +1,8 @@ +# Roslyn code generator +ROSLYN_GENERATOR=$(DOTNET_BUILD_DIR)/common/rgen/Microsoft.Macios.Generator.dll +ROSLYN_GENERATOR_FILES := $(wildcard rgen/Microsoft.Macios.Generator/*.cs) + +$(ROSLYN_GENERATOR): Makefile.rgenerator $(ROSLYN_GENERATOR_FILES) + $(Q_DOTNET_BUILD) $(DOTNET) publish rgen/Microsoft.Macios.Generator/Microsoft.Macios.Generator.csproj $(DOTNET_BUILD_VERBOSITY) /p:Configuration=Debug /p:IntermediateOutputPath=$(abspath $(DOTNET_BUILD_DIR)/IDE/obj/common/rgen)/ /p:OutputPath=$(abspath $(DOTNET_BUILD_DIR)/IDE/bin/common/rgen/)/ + @mkdir -p $(dir $@) + $(Q) $(CP) -r $(DOTNET_BUILD_DIR)/IDE/bin/common/rgen/publish/* $(dir $@) diff --git a/src/ObjCBindings/BindingTypeAttribute.cs b/src/ObjCBindings/BindingTypeAttribute.cs new file mode 100644 index 000000000000..6f936d77c69a --- /dev/null +++ b/src/ObjCBindings/BindingTypeAttribute.cs @@ -0,0 +1,25 @@ +using System; +using System.Reflection; +using System.Diagnostics.CodeAnalysis; + +namespace ObjCBindings { + + /// + /// Attribute that indicates that a class or enum is a binding type. This attribute is used by the binding generator + /// to generate all the necessary code for the binding. The attribute can be used in a class or enum and it is required. + /// + /// If the attribute is used in a class, the class must be partial otherwise the generator will fail. + /// + [Experimental ("APL0003")] + [AttributeUsage (AttributeTargets.Class | System.AttributeTargets.Enum, AllowMultiple = false)] + public class BindingTypeAttribute : Attribute { + + /// + /// Indicates the name of the binding type. This is the name that will be used by the registrar to make the + /// class available in the ObjC runtime. The default value is string.Empty, in that case the generator + /// will use the name of the C# class. + /// + public string Name { get; set; } = string.Empty; + } + +} diff --git a/src/StoreKit/SwiftAPI.cs b/src/StoreKit/SwiftAPI.cs new file mode 100644 index 000000000000..3ea8d380acfb --- /dev/null +++ b/src/StoreKit/SwiftAPI.cs @@ -0,0 +1,37 @@ +#if __IOS__ || __MACCATALYST__ || __MACOS__ + +using System.Diagnostics.CodeAnalysis; + +#if HAS_APPKIT +using AppKit; +#endif + +#if HAS_UIKIT +using UIKit; +#endif + +namespace StoreKit { + + /// A class to interact with the App Store. +#if !NET10_0_OR_GREATER + [Experimental ("APL0004")] +#endif + public static class AppStore { + /// Ask StoreKit to request an App Store review or rating from the user. + /// The scene or view controller to display the interface in. + [SupportedOSPlatform ("ios16.0")] + [SupportedOSPlatform ("maccatalyst16.0")] + [SupportedOSPlatform ("macos13.0")] + [UnsupportedOSPlatform ("tvos")] +#if __MACOS__ + public static void RequestReview (NSViewController @in) +#else + public static void RequestReview (UIWindowScene @in) +#endif + { + XamarinSwiftFunctions.RequestReview (@in); + } + } +} + +#endif // __IOS__ || __MACCATALYST__ || __MACOS__ diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 47cbefb4c0a6..0692efe5c98e 100644 --- a/src/bgen/Generator.cs +++ b/src/bgen/Generator.cs @@ -50,6 +50,7 @@ using System.Text; using System.ComponentModel; using System.Reflection; +using ObjCBindings; using ObjCRuntime; using Foundation; using Xamarin.Utils; @@ -5630,6 +5631,13 @@ string GetAssemblyName () public void Generate (Type type) { + + // check if the type has been marked as a type that will be generated by the new code generator, if that + // is the case, bgen will ignore it allowing the rgen code generator add the type to the final assembly + bool is_rgen_type = AttributeManager.HasAttribute (type); + if (is_rgen_type) + return; + if (ZeroCopyStrings) { ErrorHelper.Warning (1027); ZeroCopyStrings = false; diff --git a/src/bgen/bgen.csproj b/src/bgen/bgen.csproj index 1444c86b365a..693c569025ba 100644 --- a/src/bgen/bgen.csproj +++ b/src/bgen/bgen.csproj @@ -9,6 +9,7 @@ $(DefineConstants);XAMMACIOS_DEBUGGER Nullable enable + APL0003 @@ -26,6 +27,9 @@ + + BindingTypeAttribute.cs + generator-errors.md diff --git a/src/frameworks.sources b/src/frameworks.sources index e129ca7cd91b..ec3f51ec8d61 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -296,6 +296,7 @@ AVFOUNDATION_SOURCES = \ AVFoundation/Events.cs \ AVFoundation/AVPlayerLooper.cs \ AVFoundation/AudioRendererWasFlushedAutomaticallyEventArgs.cs \ + AVFoundation/AVCaptureReactionType.rgen.cs \ # AVKit @@ -1760,6 +1761,7 @@ STOREKIT_SOURCES = \ StoreKit/SKCloudServiceSetupOptions.cs \ StoreKit/SKPayment.cs \ StoreKit/SKPaymentTransactionObserver.cs \ + StoreKit/SwiftAPI.cs \ # SystemConfiguration @@ -2012,6 +2014,7 @@ SHARED_CORE_SOURCES = \ DotNetGlobals.cs \ MinimumVersions.cs \ MonoPInvokeCallbackAttribute.cs \ + ObjCBindings/BindingTypeAttribute.cs \ ObjCRuntime/ArgumentSemantic.cs \ ObjCRuntime/BindAsAttribute.cs \ ObjCRuntime/Blocks.cs \ diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Examples.cs b/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Examples.cs new file mode 100644 index 000000000000..fe4905a77980 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Examples.cs @@ -0,0 +1,12 @@ +namespace Microsoft.Macios.Bindings.Analyzer.Sample; + +// If you don't see warnings, build the Analyzers Project. + +[BindingType] +public class Examples { +} + +[BindingType] +public class Foo { + +} diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Microsoft.Macios.Bindings.Analyzer.Sample.csproj b/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Microsoft.Macios.Bindings.Analyzer.Sample.csproj new file mode 100644 index 000000000000..bc9520bfbacf --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Microsoft.Macios.Bindings.Analyzer.Sample.csproj @@ -0,0 +1,19 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + + + + + + + + + + external\Attributes.cs + + + + diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Shipped.md b/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Shipped.md new file mode 100644 index 000000000000..5a165075fbca --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Shipped.md @@ -0,0 +1,7 @@ +## Release 1.0 + +### New Rules + +| Rule ID | Category | Severity | Notes | +|---------|----------|----------|------------------------------------------------------| +| RBI0001 | Usage | Error | Binding types should be declared as partial classes. | \ No newline at end of file diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Unshipped.md b/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Unshipped.md new file mode 100644 index 000000000000..44f7c8f4ef7c --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Unshipped.md @@ -0,0 +1,4 @@ +### New Rules + +| Rule ID | Category | Severity | Notes | +|---------|----------|----------|-------| \ No newline at end of file diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/BindingTypeCodeFixProvider.cs b/src/rgen/Microsoft.Macios.Bindings.Analyzer/BindingTypeCodeFixProvider.cs new file mode 100644 index 000000000000..17b8a2983607 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/BindingTypeCodeFixProvider.cs @@ -0,0 +1,59 @@ +using System.Collections.Immutable; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +using SyntaxFactory = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; +using SyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; + +namespace Microsoft.Macios.Bindings.Analyzer; + +/// +/// Code fix provider that adds the 'partial' modifier to the class decorated with BindingTypeAttribute. +/// +[ExportCodeFixProvider (LanguageNames.CSharp, Name = nameof (BindingTypeCodeFixProvider)), Shared] +public class BindingTypeCodeFixProvider : CodeFixProvider { + // Specify the diagnostic IDs of analyzers that are expected to be linked. + public sealed override ImmutableArray FixableDiagnosticIds { get; } = + ImmutableArray.Create (BindingTypeSemanticAnalyzer.DiagnosticId); + + // If you don't need the 'fix all' behaviour, return null. + public override FixAllProvider? GetFixAllProvider () => null; + + public sealed override async Task RegisterCodeFixesAsync (CodeFixContext context) + { + var diagnostic = context.Diagnostics.Single (); + var diagnosticSpan = diagnostic.Location.SourceSpan; + var root = await context.Document.GetSyntaxRootAsync (context.CancellationToken).ConfigureAwait (false); + var diagnosticNode = root?.FindNode (diagnosticSpan); + + // To get the required metadata, we should match the Node to the specific type: 'ClassDeclarationSyntax'. + if (diagnosticNode is not ClassDeclarationSyntax declaration) + return; + + // Register a code action that will invoke the fix. + context.RegisterCodeFix ( + CodeAction.Create ( + title: Resources.RBI0001CodeFixTitle, + createChangedDocument: c => MakePartialClassAsync (context.Document, declaration, c), + equivalenceKey: nameof (Resources.RBI0001CodeFixTitle)), + diagnostic); + } + + async Task MakePartialClassAsync (Document document, + ClassDeclarationSyntax classDeclarationSyntax, CancellationToken cancellationToken) + { + var partialClass = classDeclarationSyntax.AddModifiers (SyntaxFactory.Token (SyntaxKind.PartialKeyword)); + var oldRoot = await document.GetSyntaxRootAsync (cancellationToken).ConfigureAwait (false); + if (oldRoot is null) + return document; + + var newRoot = oldRoot.ReplaceNode (classDeclarationSyntax, partialClass); + return document.WithSyntaxRoot (newRoot); + } +} diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/BindingTypeSemanticAnalyzer.cs b/src/rgen/Microsoft.Macios.Bindings.Analyzer/BindingTypeSemanticAnalyzer.cs new file mode 100644 index 000000000000..fd5df71a0e8b --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/BindingTypeSemanticAnalyzer.cs @@ -0,0 +1,72 @@ +using System.Collections.Immutable; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; + +namespace Microsoft.Macios.Bindings.Analyzer; + +/// +/// Analyzer that ensures that the types that have been declared as binding types are partial and follow the correct +/// pattern. +/// +[DiagnosticAnalyzer (LanguageNames.CSharp)] +public class BindingTypeSemanticAnalyzer : DiagnosticAnalyzer { + internal const string DiagnosticId = "RBI0001"; + static readonly LocalizableString Title = new LocalizableResourceString (nameof (Resources.RBI0001Title), + Resources.ResourceManager, typeof (Resources)); + static readonly LocalizableString MessageFormat = + new LocalizableResourceString (nameof (Resources.RBI0001MessageFormat), Resources.ResourceManager, + typeof (Resources)); + static readonly LocalizableString Description = + new LocalizableResourceString (nameof (Resources.RBI0001Description), Resources.ResourceManager, + typeof (Resources)); + const string Category = "Usage"; + + static readonly DiagnosticDescriptor RBI0001 = new (DiagnosticId, Title, MessageFormat, Category, + DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description); + + public override ImmutableArray SupportedDiagnostics { get; } = + ImmutableArray.Create (RBI0001); + + public override void Initialize (AnalysisContext context) + { + context.ConfigureGeneratedCodeAnalysis (GeneratedCodeAnalysisFlags.None); + context.EnableConcurrentExecution (); + context.RegisterSyntaxNodeAction (AnalysisContext, SyntaxKind.ClassDeclaration); + } + + void AnalysisContext (SyntaxNodeAnalysisContext context) + { + // only care about classes + if (context.Node is not ClassDeclarationSyntax classDeclarationNode) + return; + + var classSymbol = context.SemanticModel.GetDeclaredSymbol (classDeclarationNode); + if (classSymbol is null) + return; + + var boundAttributes = classSymbol.GetAttributes (); + if (boundAttributes.Length == 0) { + return; + } + + // the c# syntax is a a list of lists of attributes. That is why we need to iterate through the list of lists + foreach (var attributeData in boundAttributes) { + // based on the type use the correct parser to retrieve the data + var attributeType = attributeData.AttributeClass?.ToDisplayString (); + switch (attributeType) { + case "ObjCBindings.BindingTypeAttribute": + // validate that the class is partial, else we need to report an error + if (!classDeclarationNode.Modifiers.Any (x => x.IsKind (SyntaxKind.PartialKeyword))) { + var diagnostic = Diagnostic.Create (RBI0001, + classDeclarationNode.Identifier.GetLocation (), // point to where the 'class' keyword is used + classSymbol.ToDisplayString ()); + context.ReportDiagnostic (diagnostic); + } + break; + } + } + } +} diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/Microsoft.Macios.Bindings.Analyzer.csproj b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Microsoft.Macios.Bindings.Analyzer.csproj new file mode 100644 index 000000000000..6f9e0902e438 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Microsoft.Macios.Bindings.Analyzer.csproj @@ -0,0 +1,46 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + false + enable + latest + + true + true + + Microsoft.Macios.Bindings.Analyzer + Microsoft.Macios.Bindings.Analyzer + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + <_Parameter1>Microsoft.Macios.Bindings.Analyzer.Tests + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + True + True + Resources.resx + + + + diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/Properties/launchSettings.json b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Properties/launchSettings.json new file mode 100644 index 000000000000..874ffd77b7e5 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "DebugRoslynAnalyzers": { + "commandName": "DebugRoslynComponent", + "targetProject": "../Microsoft.Macios.Bindings.Analyzer.Sample/Microsoft.Macios.Bindings.Analyzer.Sample.csproj" + } + } +} \ No newline at end of file diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/Readme.md b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Readme.md new file mode 100644 index 000000000000..d3a566c3c1cd --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Readme.md @@ -0,0 +1,26 @@ +# Roslyn Analyzers Sample + +Roslyn analyzer to be installed along side the Roslyn Conde generator that will help developers work on Microsoft.Macios bindings. + +## Content +### Microsoft.Macios.Bindings.Analyzer + +A .NET Standard project with implementations of sample analyzers and code fix providers. +**You must build this project to see the results (warnings) in the IDE.** + +### Microsoft.Macios.Bindings.Analyzer.Sample +A project that references the sample analyzers. Note the parameters of `ProjectReference` in [Microsoft.Macios.Bindings.Analyzer.Sample.csproj](../Microsoft.Macios.Bindings.Analyzer.Sample/Microsoft.Macios.Bindings.Analyzer.Sample.csproj), they make sure that the project is referenced as a set of analyzers. + +### Microsoft.Macios.Bindings.Analyzer.Tests +Unit tests for the sample analyzers and code fix provider. The easiest way to develop language-related features is to start with unit tests. + +## How To? +### How to debug? +- Use the [launchSettings.json](Properties/launchSettings.json) profile. +- Debug tests (in VSCode). + +### How can I determine which syntax nodes I should expect? +Consider installing the Roslyn syntax tree viewer plugin [Rossynt](https://plugins.jetbrains.com/plugin/16902-rossynt/). + +### Learn more about wiring analyzers +The complete set of information is available at [roslyn github repo wiki](https://github.com/dotnet/roslyn/blob/main/docs/wiki/README.md). \ No newline at end of file diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/Resources.Designer.cs b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Resources.Designer.cs new file mode 100644 index 000000000000..bfe0d3152b0f --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Resources.Designer.cs @@ -0,0 +1,96 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Macios.Bindings.Analyzer { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Microsoft.Macios.Bindings.Analyzer.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static string AB0001Description { + get { + return ResourceManager.GetString("AB0001Description", resourceCulture); + } + } + + internal static string AB0001MessageFormat { + get { + return ResourceManager.GetString("AB0001MessageFormat", resourceCulture); + } + } + + internal static string AB0001Title { + get { + return ResourceManager.GetString("AB0001Title", resourceCulture); + } + } + + internal static string RBI0001CodeFixTitle { + get { + return ResourceManager.GetString("RBI0001CodeFixTitle", resourceCulture); + } + } + + internal static string RBI0001Description { + get { + return ResourceManager.GetString("RBI0001Description", resourceCulture); + } + } + + internal static string RBI0001MessageFormat { + get { + return ResourceManager.GetString("RBI0001MessageFormat", resourceCulture); + } + } + + internal static string RBI0001Title { + get { + return ResourceManager.GetString("RBI0001Title", resourceCulture); + } + } + + internal static string AB0002Description { + get { + return ResourceManager.GetString("AB0002Description", resourceCulture); + } + } + } +} diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/Resources.resx b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Resources.resx new file mode 100644 index 000000000000..2f228a310c3f --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Resources.resx @@ -0,0 +1,37 @@ + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Make Binding Type class partial + The title of the code fix. + + + In order for the code to be generated all binding types have to be declared as partial classes. + An optional longer localizable description of the diagnostic. + + + The binding type '{0}' must declared as a partial class + The format-able message the diagnostic displays. + + + Binding type declaration must be partial + The title of the diagnostic. + + diff --git a/src/rgen/Microsoft.Macios.Generator.Sample/Microsoft.Macios.Generator.Sample.csproj b/src/rgen/Microsoft.Macios.Generator.Sample/Microsoft.Macios.Generator.Sample.csproj new file mode 100644 index 000000000000..f21144e77c4c --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator.Sample/Microsoft.Macios.Generator.Sample.csproj @@ -0,0 +1,19 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + Microsoft.Macios.Generator.Sample + + + + + + + + + external\Attributes.cs + + + + diff --git a/src/rgen/Microsoft.Macios.Generator.Sample/SampleBinding.cs b/src/rgen/Microsoft.Macios.Generator.Sample/SampleBinding.cs new file mode 100644 index 000000000000..28d28329ae21 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator.Sample/SampleBinding.cs @@ -0,0 +1,9 @@ +namespace Microsoft.Macios.Generator.Sample; + +// This code will not compile until you build the project with the Source Generators + +[BindingType] +public partial class SampleBinding { + public int Id { get; } = 42; + public string? Name { get; } = "Sample"; +} diff --git a/src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs b/src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs new file mode 100644 index 000000000000..fcc630f160ce --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs @@ -0,0 +1,24 @@ +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.Macios.Generator; + +/// +/// A sample source generator that creates a custom report based on class properties. The target class should be annotated with the 'Generators.ReportAttribute' attribute. +/// When using the source code as a baseline, an incremental source generator is preferable because it reduces the performance overhead. +/// +[Generator] +public class BindingSourceGeneratorGenerator : IIncrementalGenerator { + + public void Initialize (IncrementalGeneratorInitializationContext context) + { + // Add the binding generator attributes to the compilation. This are only available when the + // generator is used, similar to how bgen works. + foreach ((string fileName, string content) in ExtraSources.Sources) { + context.RegisterPostInitializationOutput (ctx => ctx.AddSource ( + fileName, SourceText.From (content, Encoding.UTF8))); + } + } + +} diff --git a/src/rgen/Microsoft.Macios.Generator/ExtraSources.cs b/src/rgen/Microsoft.Macios.Generator/ExtraSources.cs new file mode 100644 index 000000000000..916949db8768 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/ExtraSources.cs @@ -0,0 +1,5 @@ +namespace Microsoft.Macios.Generator; + +public static class ExtraSources { + public static readonly (string FileName, string Content) [] Sources = new (string, string) [0]; +} diff --git a/src/rgen/Microsoft.Macios.Generator/Microsoft.Macios.Generator.csproj b/src/rgen/Microsoft.Macios.Generator/Microsoft.Macios.Generator.csproj new file mode 100644 index 000000000000..f9c73ed0396a --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Microsoft.Macios.Generator.csproj @@ -0,0 +1,26 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + false + enable + latest + + true + true + + Microsoft.Macios.Generator + Microsoft.Macios.Generator + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + diff --git a/src/rgen/Microsoft.Macios.Generator/Properties/launchSettings.json b/src/rgen/Microsoft.Macios.Generator/Properties/launchSettings.json new file mode 100644 index 000000000000..5687e6130138 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "DebugRoslynSourceGenerator": { + "commandName": "DebugRoslynComponent", + "targetProject": "../Microsoft.Macios.Generator.Sample/Microsoft.Macios.Generator.Sample.csproj" + } + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Readme.md b/src/rgen/Microsoft.Macios.Generator/Readme.md new file mode 100644 index 000000000000..8151de594361 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Readme.md @@ -0,0 +1,21 @@ +# Roslyn binding code generator + +This directory contains the code generator for binding code. The generator is the implementation of [RFC: Migrate bgen to use roslyn instead of the reflection API](https://github.com/xamarin/xamarin-macios/issues/21308) + +## Content + +### Microsoft.Macios.Generator +A .NET Standard project with implementations of sample source generators. + +**You must build this project to see the result (generated code) in the IDE.** + +### Microsoft.Macios.Generator.Sample +A project that references source generators. Note the parameters of `ProjectReference` in [Microsoft.Macios.Generator.Sample.csproj](../Microsoft.Macios.Generator.Sample/Microsoft.Macios.Generator.Sample.csproj), they make sure that the project is referenced as a set of source generators. + +### Microsoft.Macios.Generator.Tests +Unit tests for source generators. The easiest way to develop language-related features is to start with unit tests. + +## How To? +### How to debug? +- Use the [launchSettings.json](Properties/launchSettings.json) profile. +- Debug tests. \ No newline at end of file diff --git a/src/rgen/rgen.sln b/src/rgen/rgen.sln new file mode 100644 index 000000000000..684992039540 --- /dev/null +++ b/src/rgen/rgen.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Macios.Generator", "Microsoft.Macios.Generator\Microsoft.Macios.Generator.csproj", "{8E9CF45D-E836-447E-9290-03A9CACE2704}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Macios.Generator.Sample", "Microsoft.Macios.Generator.Sample\Microsoft.Macios.Generator.Sample.csproj", "{AD0A1FDC-350F-47E2-AA9D-A6F32793C130}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Macios.Bindings.Analyzer", "Microsoft.Macios.Bindings.Analyzer\Microsoft.Macios.Bindings.Analyzer.csproj", "{27A7CBB0-A30D-4A08-A475-6D2DFD94C634}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Macios.Bindings.Analyzer.Sample", "Microsoft.Macios.Bindings.Analyzer.Sample\Microsoft.Macios.Bindings.Analyzer.Sample.csproj", "{65649B5A-9C23-4AA8-A687-82319EF4FA7E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Macios.Generator.Tests", "..\..\tests\rgen\Microsoft.Macios.Generator.Tests\Microsoft.Macios.Generator.Tests.csproj", "{CD222ACD-A54F-49D9-81CA-6D795CC31195}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Macios.Bindings.Analyzer.Tests", "..\..\tests\rgen\Microsoft.Macios.Bindings.Analyzer.Tests\Microsoft.Macios.Bindings.Analyzer.Tests.csproj", "{1AC4A248-CC98-4392-8690-4E2CAF6E194B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E9CF45D-E836-447E-9290-03A9CACE2704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9CF45D-E836-447E-9290-03A9CACE2704}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9CF45D-E836-447E-9290-03A9CACE2704}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9CF45D-E836-447E-9290-03A9CACE2704}.Release|Any CPU.Build.0 = Release|Any CPU + {AD0A1FDC-350F-47E2-AA9D-A6F32793C130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD0A1FDC-350F-47E2-AA9D-A6F32793C130}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD0A1FDC-350F-47E2-AA9D-A6F32793C130}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD0A1FDC-350F-47E2-AA9D-A6F32793C130}.Release|Any CPU.Build.0 = Release|Any CPU + {27A7CBB0-A30D-4A08-A475-6D2DFD94C634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27A7CBB0-A30D-4A08-A475-6D2DFD94C634}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27A7CBB0-A30D-4A08-A475-6D2DFD94C634}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27A7CBB0-A30D-4A08-A475-6D2DFD94C634}.Release|Any CPU.Build.0 = Release|Any CPU + {65649B5A-9C23-4AA8-A687-82319EF4FA7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65649B5A-9C23-4AA8-A687-82319EF4FA7E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65649B5A-9C23-4AA8-A687-82319EF4FA7E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65649B5A-9C23-4AA8-A687-82319EF4FA7E}.Release|Any CPU.Build.0 = Release|Any CPU + {CD222ACD-A54F-49D9-81CA-6D795CC31195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD222ACD-A54F-49D9-81CA-6D795CC31195}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD222ACD-A54F-49D9-81CA-6D795CC31195}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD222ACD-A54F-49D9-81CA-6D795CC31195}.Release|Any CPU.Build.0 = Release|Any CPU + {1AC4A248-CC98-4392-8690-4E2CAF6E194B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1AC4A248-CC98-4392-8690-4E2CAF6E194B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1AC4A248-CC98-4392-8690-4E2CAF6E194B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1AC4A248-CC98-4392-8690-4E2CAF6E194B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/storekit.cs b/src/storekit.cs index cb1bfa1cb909..bd0308d34a44 100644 --- a/src/storekit.cs +++ b/src/storekit.cs @@ -9,6 +9,9 @@ // Copyright 2012 Xamarin Inc. // Copyright 2020 Microsoft Corp. // + +using System.ComponentModel; + using ObjCRuntime; using Foundation; using CoreFoundation; @@ -34,6 +37,21 @@ namespace StoreKit { + [EditorBrowsable (EditorBrowsableState.Never)] + [Internal] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface XamarinSwiftFunctions { + [Export ("requestReview:")] + [Static] + [iOS (16, 0), MacCatalyst (16, 0), Mac (13, 0), NoTV] +#if MONOMAC + void RequestReview (NSViewController viewController); +#else + void RequestReview (UIWindowScene windowScene); +#endif + } + [ErrorDomain ("SKANErrorDomain")] [NoWatch, NoTV, NoMac, iOS (15, 4), MacCatalyst (17, 0)] [Native] @@ -1112,6 +1130,9 @@ interface SKStoreReviewController { [Export ("requestReview")] void RequestReview (); + [Deprecated (PlatformName.iOS, 18, 0, message: "Use the 'AppStore.RequestReview (UIWindowScene)' API instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use the 'AppStore.RequestReview (UIWindowScene)' API instead.")] + [Deprecated (PlatformName.MacOSX, 15, 0, message: "Use the 'AppStore.RequestReview (NSViewController)' API instead.")] [Introduced (PlatformName.MacCatalyst, 14, 0)] [NoWatch, NoTV, iOS (14, 0), NoMac] [Static] diff --git a/tests/Makefile b/tests/Makefile index f13e4860ebe9..6b57f8b34d4f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -189,11 +189,9 @@ logdev: build-test-libraries: @$(MAKE) -C $(TOP)/tests/test-libraries -.stamp-xharness-configure: $(XHARNESS_EXECUTABLE) - $(Q_GEN) $(DOTNET) $< $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR) - $(Q) touch $@ +xharness: $(XHARNESS_EXECUTABLE) -all-local:: .stamp-xharness-configure +all-local:: xharness $(TOP)/tools/common/SdkVersions.cs: $(TOP)/tools/common/SdkVersions.in.cs @$(MAKE) -C $(TOP)/tools/mtouch ../common/SdkVersions.cs @@ -240,14 +238,6 @@ else @echo Not enabled endif -ifdef INCLUDE_DOTNET -dotnet-test-package.7z: - ./package-dotnet-tests.sh -else -dotnet-test-package.7z: - @echo Not enabled -endif - #XI ifdef INCLUDE_IOS wrench-mtouch: @@ -356,13 +346,5 @@ package-test-libraries.zip: $(Q) $(MAKE) all -C test-libraries/custom-type-assembly build-assembly $(Q_GEN) rm -f "$@" "$@.tmp" $(Q_GEN) cd $(TOP) && zip -9r --symlinks $(abspath $@).tmp ./tests/test-libraries - $(Q_GEN) cd $(TOP) && find tests -regex '.*/generated-projects/.*[c|f]sproj' -exec zip -9r --symlinks $(abspath $@).tmp {} + - $(Q_GEN) cd $(TOP) && find tests -regex '.*/generated-projects/.*sln' -exec zip -9r --symlinks $(abspath $@).tmp {} + $(Q_GEN) cd $(TOP) && find tests -regex 'tests/test-libraries/custom-type-assembly/.libs/.*dll' -exec zip -9r --symlinks $(abspath $@).tmp {} + - $(Q_GEN) cd $(TOP) && git ls-files -o -- 'tests/*/Info-*plist' | zip -9r --symlinks $(abspath $@).tmp -@ -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_IOS - $(Q_GEN) cd $(TOP) && zip -9r --symlinks $(abspath $@).tmp ./tools/mtouch/simlauncher*-sgen* -endif -endif $(Q) mv "$@".tmp "$@" diff --git a/tests/bgen/bgen-tests.csproj b/tests/bgen/bgen-tests.csproj index 6ee37f30a0a8..cef7c5856f16 100644 --- a/tests/bgen/bgen-tests.csproj +++ b/tests/bgen/bgen-tests.csproj @@ -48,6 +48,9 @@ Configuration.cs + + ConfigurationNUnit.cs + ExecutionHelper.cs diff --git a/tests/cecil-tests/AttributeTest.cs b/tests/cecil-tests/AttributeTest.cs index 38c197e05cd6..220bdf8a6768 100644 --- a/tests/cecil-tests/AttributeTest.cs +++ b/tests/cecil-tests/AttributeTest.cs @@ -181,6 +181,9 @@ public void FindSupportedOnElementsThatDoNotExistInThatAssembly () // Walk every class/struct/enum/property/method/enum value/pinvoke/event foreach (var module in assembly.Modules) { foreach (var type in module.Types) { + if (!type.IsPubliclyVisible ()) + continue; + switch (type.Namespace) { case "AppKit": case "UIKit": @@ -289,10 +292,6 @@ static HashSet IgnoreElementsThatDoNotExistInThatAssembly { // These methods have different optional/required semantics between platforms. "PassKit.PKPaymentAuthorizationControllerDelegate_Extensions.GetPresentationWindow (PassKit.IPKPaymentAuthorizationControllerDelegate, PassKit.PKPaymentAuthorizationController)", - "Metal.MTLTextureWrapper.FirstMipmapInTail", - "Metal.MTLTextureWrapper.IsSparse", - "Metal.MTLTextureWrapper.TailSizeInBytes", - // HKSeriesBuilder doesn't implement the ISNCopying protocol on all platforms (and shouldn't on any according to the headers, so removed for XAMCORE_5_0). "HealthKit.HKSeriesBuilder.EncodeTo (Foundation.NSCoder)", @@ -325,6 +324,10 @@ static HashSet IgnoreElementsThatDoNotExistInThatAssembly { "Foundation.NSAttributedString.ReadableTypeIdentifiers", "Foundation.NSAttributedString.WritableTypeIdentifiers", "Foundation.NSAttributedString.WritableTypeIdentifiersForItemProvider", + + // Same method, but different arguments due to platform differences. We should treat this as the same method, so ignore this failure. + "StoreKit.AppStore.RequestReview (XKit.XWindowScene)", // iOS, MacCatalyst + "StoreKit.AppStore.RequestReview (XKit.XViewController)", // macOS }; } } diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 41a7ee58be76..8fcf9b1d7d30 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -5311,6 +5311,14 @@ F:AVFoundation.AVCapturePrimaryConstituentDeviceSwitchingBehavior.Auto F:AVFoundation.AVCapturePrimaryConstituentDeviceSwitchingBehavior.Locked F:AVFoundation.AVCapturePrimaryConstituentDeviceSwitchingBehavior.Restricted F:AVFoundation.AVCapturePrimaryConstituentDeviceSwitchingBehavior.Unsupported +F:AVFoundation.AVCaptureReactionType.Balloons +F:AVFoundation.AVCaptureReactionType.Confetti +F:AVFoundation.AVCaptureReactionType.Fireworks +F:AVFoundation.AVCaptureReactionType.Heart +F:AVFoundation.AVCaptureReactionType.Lasers +F:AVFoundation.AVCaptureReactionType.Rain +F:AVFoundation.AVCaptureReactionType.ThumbsDown +F:AVFoundation.AVCaptureReactionType.ThumbsUp F:AVFoundation.AVCaptureSessionInterruptionReason.AudioDeviceInUseByAnotherClient F:AVFoundation.AVCaptureSessionInterruptionReason.VideoDeviceInUseByAnotherClient F:AVFoundation.AVCaptureSessionInterruptionReason.VideoDeviceNotAvailableDueToSystemPressure @@ -44900,6 +44908,7 @@ M:NotificationCenter.NSExtensionContext_NCWidgetAdditions.GetWidgetMaximumSize(F M:NotificationCenter.NSExtensionContext_NCWidgetAdditions.SetWidgetLargestAvailableDisplayMode(Foundation.NSExtensionContext,NotificationCenter.NCWidgetDisplayMode) M:NotificationCenter.NSWidgetSearchForTermEventArgs.#ctor(System.String,System.UIntPtr) M:NotificationCenter.NSWidgetSearchResultSelectedEventArgs.#ctor(Foundation.NSObject) +M:ObjCBindings.BindingTypeAttribute.#ctor M:ObjCRuntime.AdoptsAttribute.#ctor(System.String) M:ObjCRuntime.AssemblyRegistrationEventArgs.#ctor M:ObjCRuntime.BaseWrapper.#ctor(ObjCRuntime.NativeHandle,System.Boolean) @@ -81590,6 +81599,7 @@ T:AVFoundation.AVCapturePhotoQualityPrioritization T:AVFoundation.AVCapturePhotoSettingsThumbnailFormat T:AVFoundation.AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions T:AVFoundation.AVCapturePrimaryConstituentDeviceSwitchingBehavior +T:AVFoundation.AVCaptureReactionType T:AVFoundation.AVCaptureSessionInterruptionReason T:AVFoundation.AVCaptureSessionRuntimeErrorEventArgs T:AVFoundation.AVCaptureSystemPressureFactors diff --git a/tests/cecil-tests/Helper.cs b/tests/cecil-tests/Helper.cs index e5d32d0ed35a..67b01aaaecf4 100644 --- a/tests/cecil-tests/Helper.cs +++ b/tests/cecil-tests/Helper.cs @@ -449,11 +449,6 @@ static IEnumerable PlatformAssemblies { yield return Path.Combine (Configuration.MonoTouchRootDirectory, "lib", "64bits", "iOS", "Xamarin.iOS.dll"); } - if (Configuration.include_watchos) { - // XamarinWatchOSDll is stripped of its IL - yield return Path.Combine (Configuration.MonoTouchRootDirectory, "lib", "32bits", "watchOS", "Xamarin.WatchOS.dll"); - } - if (Configuration.include_tvos) { // XamarinTVOSDll is stripped of it's IL yield return Path.Combine (Configuration.MonoTouchRootDirectory, "lib", "64bits", "tvOS", "Xamarin.TVOS.dll"); diff --git a/tests/cecil-tests/cecil-tests.csproj b/tests/cecil-tests/cecil-tests.csproj index 50d9f62c8f53..eac1c64fe7d1 100644 --- a/tests/cecil-tests/cecil-tests.csproj +++ b/tests/cecil-tests/cecil-tests.csproj @@ -19,6 +19,9 @@ Configuration.cs + + ConfigurationNUnit.cs + Profile.cs diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index 5fdbd955485d..741c1c2fd21d 100644 --- a/tests/common/Configuration.cs +++ b/tests/common/Configuration.cs @@ -7,8 +7,6 @@ using System.Text; using System.Threading; -using NUnit.Framework; - using Xamarin.Utils; #nullable disable // until we get around to fixing this file @@ -42,8 +40,6 @@ static partial class Configuration { public static bool include_ios; public static bool include_mac; public static bool include_tvos; - public static bool include_watchos; - public static bool include_dotnet_watchos; public static bool include_maccatalyst; public static bool include_device; public static bool include_dotnet; @@ -299,8 +295,6 @@ static Configuration () include_ios = !string.IsNullOrEmpty (GetVariable ("INCLUDE_IOS", "")); include_mac = !string.IsNullOrEmpty (GetVariable ("INCLUDE_MAC", "")); include_tvos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_TVOS", "")); - include_watchos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_WATCH", "")); - include_dotnet_watchos = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DOTNET_WATCH", "")); include_maccatalyst = !string.IsNullOrEmpty (GetVariable ("INCLUDE_MACCATALYST", "")); include_device = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DEVICE", "")); include_dotnet = !string.IsNullOrEmpty (GetVariable ("ENABLE_DOTNET", "")); @@ -333,7 +327,6 @@ static Configuration () Console.WriteLine (" INCLUDE_IOS={0}", include_ios); Console.WriteLine (" INCLUDE_MAC={0}", include_mac); Console.WriteLine (" INCLUDE_TVOS={0}", include_tvos); - Console.WriteLine (" INCLUDE_WATCHOS={0}", include_watchos); Console.WriteLine (" INCLUDE_MACCATALYST={0}", include_maccatalyst); Console.WriteLine (" ENABLE_DOTNET={0}", include_dotnet); } @@ -384,12 +377,6 @@ public static bool TryGetRootPath (out string rootPath) } } - static string TestAssemblyDirectory { - get { - return TestContext.CurrentContext.WorkDirectory; - } - } - public static string SourceRoot { get { if (mt_src_root is null) @@ -682,25 +669,6 @@ public static string MlaunchPath { } #if !XAMMAC_TESTS - public static void AssertRuntimeIdentifierAvailable (ApplePlatform platform, string runtimeIdentifier) - { - if (string.IsNullOrEmpty (runtimeIdentifier)) - return; - - if (GetRuntimeIdentifiers (platform).Contains (runtimeIdentifier)) - return; - - Assert.Ignore ($"The runtime identifier {runtimeIdentifier} is not available on {platform}"); - } - - public static void AssertRuntimeIdentifiersAvailable (ApplePlatform platform, string runtimeIdentifiers) - { - if (string.IsNullOrEmpty (runtimeIdentifiers)) - return; - - foreach (var rid in runtimeIdentifiers.Split (new char [] { ';' }, StringSplitOptions.RemoveEmptyEntries)) - AssertRuntimeIdentifierAvailable (platform, rid); - } public static string GetBaseLibrary (Profile profile) { @@ -913,12 +881,6 @@ public static string GetCompiler (Profile profile, IList args) return "/Library/Frameworks/Mono.framework/Commands/csc"; } - public static void AssertiOS32BitAvailable () - { - if (iOSSupports32BitArchitectures) - return; - Assert.Ignore ($"32-bit iOS support is not available in the current build."); - } #endif // !XAMMAC_TESTS public static IEnumerable GetIncludedPlatforms (bool dotnet) @@ -934,8 +896,6 @@ public static IEnumerable GetIncludedPlatforms (bool dotnet) yield return ApplePlatform.MacOSX; if (include_maccatalyst) yield return ApplePlatform.MacCatalyst; - if (include_watchos && !dotnet) - yield return ApplePlatform.WatchOS; } public static IEnumerable GetAllPlatforms (bool dotnet) @@ -959,27 +919,6 @@ public static string XIBuildPath { get { return Path.GetFullPath (Path.Combine (RootPath, "tools", "xibuild", "xibuild")); } } - public static void AssertDeviceAvailable () - { - if (include_device) - return; - Assert.Ignore ("This build does not include device support."); - } - - public static void AssertDotNetAvailable () - { - if (include_dotnet) - return; - Assert.Ignore (".NET tests not enabled"); - } - - public static void AssertLegacyXamarinAvailable () - { - if (include_legacy_xamarin) - return; - Assert.Ignore ("Legacy xamarin build not enabled"); - } - public static string CloneTestDirectory (string directory) { // Copy the test projects to a temporary directory so that we can run the tests from there without affecting the working directory. @@ -1072,102 +1011,6 @@ public static void SetBuildVariables (ApplePlatform platform, ref Dictionary notIncluded) - { - var allPlatforms = GetAllPlatforms (dotnet); - var includedPlatforms = GetIncludedPlatforms (dotnet); - notIncluded = allPlatforms.Where (v => !includedPlatforms.Contains (v)).ToArray (); - return notIncluded.Any (); - } - - public static void IgnoreIfAnyIgnoredPlatforms (bool dotnet = true) - { - if (AnyIgnoredPlatforms (dotnet, out var notIncluded)) - Assert.Ignore ($"This test requires all platforms to be included, but the following platforms aren't included: {string.Join (", ", notIncluded.Select (v => v.AsString ()))}"); - } - - public static void IgnoreIfNotOnMacOS () - { - IgnoreIfNotOn (System.Runtime.InteropServices.OSPlatform.OSX); - } - - public static void IgnoreIfNotOnWindows () - { - IgnoreIfNotOn (System.Runtime.InteropServices.OSPlatform.Windows); - } - - public static void IgnoreIfNotOn (System.Runtime.InteropServices.OSPlatform platform) - { - if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (platform)) - return; - Assert.Ignore ($"This test is only applicable on {platform}"); - } - - public static void IgnoreIfNotXamarinEnabled () - { - if (EnableXamarin) - return; - Assert.Ignore ($"This test is only applicable if Xamarin-specific bits are enabled."); - } - public static string GetTestLibraryDirectory (ApplePlatform platform, bool? simulator = null) { string dir; @@ -1278,3 +1121,4 @@ public static IEnumerable GetUndefinedNativeSymbols (string file, string } } } + diff --git a/tests/common/ConfigurationNUnit.cs b/tests/common/ConfigurationNUnit.cs new file mode 100644 index 000000000000..885d91cf844b --- /dev/null +++ b/tests/common/ConfigurationNUnit.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; + +using NUnit.Framework; + +using Xamarin.Utils; + +#nullable disable // until we get around to fixing this file + +namespace Xamarin.Tests { + static partial class Configuration { + + static string TestAssemblyDirectory { + get { + return TestContext.CurrentContext.WorkDirectory; + } + } + +#if !XAMMAC_TESTS + public static void AssertRuntimeIdentifierAvailable (ApplePlatform platform, string runtimeIdentifier) + { + if (string.IsNullOrEmpty (runtimeIdentifier)) + return; + + if (GetRuntimeIdentifiers (platform).Contains (runtimeIdentifier)) + return; + + Assert.Ignore ($"The runtime identifier {runtimeIdentifier} is not available on {platform}"); + } + + public static void AssertRuntimeIdentifiersAvailable (ApplePlatform platform, string runtimeIdentifiers) + { + if (string.IsNullOrEmpty (runtimeIdentifiers)) + return; + + foreach (var rid in runtimeIdentifiers.Split (new char [] { ';' }, StringSplitOptions.RemoveEmptyEntries)) + AssertRuntimeIdentifierAvailable (platform, rid); + } + + public static void AssertiOS32BitAvailable () + { + if (iOSSupports32BitArchitectures) + return; + Assert.Ignore ($"32-bit iOS support is not available in the current build."); + } +#endif // !XAMMAC_TESTS + + public static void AssertDeviceAvailable () + { + if (include_device) + return; + Assert.Ignore ("This build does not include device support."); + } + + public static void AssertDotNetAvailable () + { + if (include_dotnet) + return; + Assert.Ignore (".NET tests not enabled"); + } + + public static void AssertLegacyXamarinAvailable () + { + if (include_legacy_xamarin) + return; + Assert.Ignore ("Legacy xamarin build not enabled"); + } + + // Calls Assert.Ignore if the given platform isn't included in the current build. + public static void IgnoreIfIgnoredPlatform (ApplePlatform platform) + { + switch (platform) { + case ApplePlatform.iOS: + if (!include_ios) + Assert.Ignore ("iOS is not included in this build"); + break; + case ApplePlatform.TVOS: + if (!include_tvos) + Assert.Ignore ("tvOS is not included in this build"); + break; + case ApplePlatform.MacOSX: + if (!include_mac) + Assert.Ignore ("macOS is not included in this build"); + break; + case ApplePlatform.MacCatalyst: + if (!include_maccatalyst) + Assert.Ignore ("Mac Catalyst is not included in this build"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + } + + // Calls Assert.Ignore if the given platform isn't included in the current build. + public static void IgnoreIfIgnoredPlatform (string platform) + { + switch (platform.ToLower ()) { + case "ios": + case "tvos": + case "watchos": + case "macosx": + case "maccatalyst": + IgnoreIfIgnoredPlatform ((ApplePlatform) Enum.Parse (typeof (ApplePlatform), platform, true)); + break; + case "macos": + IgnoreIfIgnoredPlatform (ApplePlatform.MacOSX); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + } + + public static bool AnyIgnoredPlatforms (bool dotnet = true) + { + return AnyIgnoredPlatforms (dotnet, out var _); + } + + public static bool AnyIgnoredPlatforms (bool dotnet, out IEnumerable notIncluded) + { + var allPlatforms = GetAllPlatforms (dotnet); + var includedPlatforms = GetIncludedPlatforms (dotnet); + notIncluded = allPlatforms.Where (v => !includedPlatforms.Contains (v)).ToArray (); + return notIncluded.Any (); + } + + public static void IgnoreIfAnyIgnoredPlatforms (bool dotnet = true) + { + if (AnyIgnoredPlatforms (dotnet, out var notIncluded)) + Assert.Ignore ($"This test requires all platforms to be included, but the following platforms aren't included: {string.Join (", ", notIncluded.Select (v => v.AsString ()))}"); + } + + public static void IgnoreIfNotOnMacOS () + { + IgnoreIfNotOn (System.Runtime.InteropServices.OSPlatform.OSX); + } + + public static void IgnoreIfNotOnWindows () + { + IgnoreIfNotOn (System.Runtime.InteropServices.OSPlatform.Windows); + } + + public static void IgnoreIfNotOn (System.Runtime.InteropServices.OSPlatform platform) + { + if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (platform)) + return; + Assert.Ignore ($"This test is only applicable on {platform}"); + } + + public static void IgnoreIfNotXamarinEnabled () + { + if (EnableXamarin) + return; + Assert.Ignore ($"This test is only applicable if Xamarin-specific bits are enabled."); + } + + } +} diff --git a/tests/common/ConfigurationXUnit.cs b/tests/common/ConfigurationXUnit.cs new file mode 100644 index 000000000000..d1555af04e69 --- /dev/null +++ b/tests/common/ConfigurationXUnit.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Xamarin.Utils; +using Xunit.Sdk; + +namespace Xamarin.Tests { + + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = true)] + public sealed class PlatformInlineDataAttribute : DataAttribute { + readonly object [] dataValues; + public PlatformInlineDataAttribute (ApplePlatform platform, params object [] parameters) + { + // data values are the join of the platform and all other values passed to the attr + dataValues = parameters.Prepend (platform).ToArray (); + // based on the passed platform and the configuration, decide if we skip the test + switch (platform) { + case ApplePlatform.iOS: + if (!Configuration.include_ios) + Skip = "iOS is not included in this build"; + break; + case ApplePlatform.TVOS: + if (!Configuration.include_tvos) + Skip = "tvOS is not included in this build"; + break; + case ApplePlatform.MacOSX: + if (!Configuration.include_mac) + Skip = "macOS is not included in this build"; + break; + case ApplePlatform.MacCatalyst: + if (!Configuration.include_maccatalyst) + Skip = "Mac Catalyst is not included in this build"; + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + } + + public object [] DataValues { + get { return dataValues; } + } + + public override IEnumerable GetData (MethodInfo testMethod) + { + yield return dataValues; + } + } + + public partial class Configuration { + static string TestAssemblyDirectory { + get { + return Assembly.GetExecutingAssembly ().Location; + } + } + } +} diff --git a/tests/common/DotNet.cs b/tests/common/DotNet.cs index 15be67b95b77..0f1f37d81b55 100644 --- a/tests/common/DotNet.cs +++ b/tests/common/DotNet.cs @@ -270,7 +270,11 @@ public static ExecutionResult Execute (string verb, string project, Dictionary external\Configuration.cs + + external\ConfigurationNUnit.cs + external\DotNet.cs diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index 5e881d167ffc..d84277be6802 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -859,16 +859,6 @@ public void LibraryReferencingBindingLibrary (ApplePlatform platform) if (rx == "bindings-framework-test") { foreach (var lib in new string [] { "XStaticArTest", "XStaticObjectTest" }) { - addHere = Configuration.include_watchos ? mustHaveContents : mayHaveContents; - addHere.AddRange (new string [] { - $"{lib}.xcframework/watchos-arm64_32_armv7k", - $"{lib}.xcframework/watchos-arm64_32_armv7k/{lib}.framework", - $"{lib}.xcframework/watchos-arm64_32_armv7k/{lib}.framework/{lib}", - $"{lib}.xcframework/watchos-x86_64-simulator", - $"{lib}.xcframework/watchos-x86_64-simulator/{lib}.framework", - $"{lib}.xcframework/watchos-x86_64-simulator/{lib}.framework/{lib}", - }); - addHere = Configuration.include_tvos ? mustHaveContents : mayHaveContents; addHere.AddRange (new string [] { $"{lib}.xcframework/tvos-arm64", @@ -967,18 +957,6 @@ public void LibraryReferencingBindingLibrary (ApplePlatform platform) "XTest.xcframework/tvos-arm64_x86_64-simulator/XTest.framework/XTest", }); - addHere = Configuration.include_watchos ? mustHaveContents : mayHaveContents; - addHere.AddRange (new string [] { - "XTest.xcframework/watchos-arm64_32_armv7k", - "XTest.xcframework/watchos-arm64_32_armv7k/XTest.framework", - "XTest.xcframework/watchos-arm64_32_armv7k/XTest.framework/Info.plist", - "XTest.xcframework/watchos-arm64_32_armv7k/XTest.framework/XTest", - "XTest.xcframework/watchos-x86_64-simulator", - "XTest.xcframework/watchos-x86_64-simulator/XTest.framework", - "XTest.xcframework/watchos-x86_64-simulator/XTest.framework/Info.plist", - "XTest.xcframework/watchos-x86_64-simulator/XTest.framework/XTest", - }); - var missing = mustHaveContents.ToHashSet ().Except (zipContents); Assert.That (missing, Is.Empty, "No missing files"); diff --git a/tests/dotnet/Windows/InstallDotNet.csproj b/tests/dotnet/Windows/InstallDotNet.csproj index 2f208f0f270d..3fdd23ec26eb 100644 --- a/tests/dotnet/Windows/InstallDotNet.csproj +++ b/tests/dotnet/Windows/InstallDotNet.csproj @@ -171,6 +171,7 @@ Command=""$(DotNetToolPath)" workload install %(_WorkloadIds.Identity) --skip-manifest-update --verbosity diag --temp-dir "$(DotNetTempDirectory)" --configfile "$(MacIosRootDirectory)NuGet.config" --skip-sign-check" WorkingDirectory="$(MSBuildThisFileDirectory)" EnvironmentVariables="DOTNET_MULTILEVEL_LOOKUP=0" + IgnoreStandardErrorWarningFormat="true" /> diff --git a/tests/dotnet/Windows/collect-binlogs.sh b/tests/dotnet/Windows/collect-binlogs.sh index 903097dbba82..7baca9a9c0d1 100755 --- a/tests/dotnet/Windows/collect-binlogs.sh +++ b/tests/dotnet/Windows/collect-binlogs.sh @@ -7,6 +7,15 @@ cd "$(dirname "${BASH_SOURCE[0]}")" TOPLEVEL="$(git rev-parse --show-toplevel)" +# Abort any agents that are still alive. +# Aborting creates a crash report, and we can investigate why they got stuck. +ps auxww || true +pkill -6 -f Broker.exe || true +pkill -6 -f Build.exe || true +pkill -6 -f Broker.dll || true +pkill -6 -f Build.dll || true +ps auxww || true + # Collect and zip up all the binlogs mkdir -p ~/remote_build_testing/binlogs rsync -avv --prune-empty-dirs --exclude 'artifacts/' --include '*/' --include '*.binlog' --exclude '*' "$TOPLEVEL/.." ~/remote_build_testing/binlogs @@ -35,6 +44,9 @@ fi ps auxww > ~/remote_build_testing/processes.txt || true +# Collect any crash reports. +zip -9r ~/remote_build_testing/windows-remote-logs.zip ~/Library/Logs/DiagnosticReports || true + ls -la ~/Library/Caches/Xamarin/XMA/SDKs/dotnet/ >> ~/remote_build_testing/dotnet-debug.txt 2>&1 || true cat ~/Library/Caches/Xamarin/XMA/SDKs/dotnet/NuGet.config >> ~/remote_build_testing/dotnet-debug.txt 2>&1 || true cat ~/Library/Caches/Xamarin/XMA/SDKs/.home/.nuget/NuGet/NuGet.Config >> ~/remote_build_testing/dotnet-debug.txt 2>&1 || true diff --git a/tests/generator/generator-tests.csproj b/tests/generator/generator-tests.csproj index 4b177794bf2b..0a39b4fab9c5 100644 --- a/tests/generator/generator-tests.csproj +++ b/tests/generator/generator-tests.csproj @@ -55,6 +55,9 @@ Configuration.cs + + ConfigurationNUnit.cs + Cache.cs diff --git a/tests/introspection/ApiFrameworkTest.cs b/tests/introspection/ApiFrameworkTest.cs index f95e01192736..96e0ef866bf7 100644 --- a/tests/introspection/ApiFrameworkTest.cs +++ b/tests/introspection/ApiFrameworkTest.cs @@ -43,6 +43,9 @@ public bool Skip (string @namespace) // not a framework, largely p/invokes to /usr/lib/libobjc.dylib case "ObjCRuntime": return true; + // no a framework, namespace for the binding attrs for rgen + case "ObjCBindings": + return true; // pinvokes into OpenGL[ES] case "OpenTK": return true; diff --git a/tests/introspection/ApiProtocolTest.cs b/tests/introspection/ApiProtocolTest.cs index 80613da909a2..7fa9cc29b317 100644 --- a/tests/introspection/ApiProtocolTest.cs +++ b/tests/introspection/ApiProtocolTest.cs @@ -34,6 +34,9 @@ static bool ConformTo (IntPtr klass, IntPtr protocol) protected virtual bool Skip (Type type) { + if (MemberHasEditorBrowsableNever (type)) + return true; + switch (type.Namespace) { // Xcode 15: case "MetalFX": diff --git a/tests/introspection/ApiSelectorTest.cs b/tests/introspection/ApiSelectorTest.cs index 4704c66635b1..567ff8e224e6 100644 --- a/tests/introspection/ApiSelectorTest.cs +++ b/tests/introspection/ApiSelectorTest.cs @@ -38,6 +38,9 @@ public abstract class ApiSelectorTest : ApiBaseTest { protected virtual bool Skip (Type type) { + if (MemberHasEditorBrowsableNever (type)) + return true; + if (type.ContainsGenericParameters) return true; diff --git a/tests/mmptest/mmptest.csproj b/tests/mmptest/mmptest.csproj index a8ae33a8f6ae..addb3187d5b4 100644 --- a/tests/mmptest/mmptest.csproj +++ b/tests/mmptest/mmptest.csproj @@ -57,6 +57,9 @@ Configuration.cs + + ConfigurationNUnit.cs + ErrorHelper.cs diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs index b2787b3199ae..6028436dfef1 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTestGenerated.cs @@ -9,7 +9,7 @@ public partial class RegistrarTestGenerated { void AssertIfIgnored ([CallerMemberName] string testCase = null) { switch (testCase) { -#if __MACCATALYST__ || __IOS__ +#if __MACCATALYST__ || __IOS__ || __TVOS__ case "NSNumberBindAs_Boolean_Array_Overrides": case "NSNumberBindAs_Byte_Array_Overrides": case "NSNumberBindAs_Double_Array_Overrides": @@ -27,7 +27,7 @@ void AssertIfIgnored ([CallerMemberName] string testCase = null) // https://github.com/xamarin/xamarin-macios/issues/19781 #if __MACCATALYST__ if (Runtime.IsARM64CallingConvention) -#elif __IOS__ +#elif __IOS__ || __TVOS__ if (Runtime.IsARM64CallingConvention && Runtime.Arch == Arch.SIMULATOR) #endif Assert.Ignore ("https://github.com/xamarin/xamarin-macios/issues/19781"); diff --git a/tests/monotouch-test/dotnet/macOS/monotouch-test.csproj b/tests/monotouch-test/dotnet/macOS/monotouch-test.csproj index 2636ce5187f9..71ad519b8fb2 100644 --- a/tests/monotouch-test/dotnet/macOS/monotouch-test.csproj +++ b/tests/monotouch-test/dotnet/macOS/monotouch-test.csproj @@ -12,6 +12,9 @@ Configuration.cs + + ConfigurationNUnit.cs + ExecutionHelper.cs diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs index cd6218df2379..45d50c328686 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs @@ -13,7 +13,6 @@ namespace Xamarin.MacDev.Tasks { public class FrameworkListTests { [TestCase ("Xamarin.iOS-FrameworkList.xml.in")] [TestCase ("Xamarin.TVOS-FrameworkList.xml.in")] - [TestCase ("Xamarin.WatchOS-FrameworkList.xml.in")] [TestCase ("Xamarin.Mac-Full-FrameworkList.xml.in")] [TestCase ("Xamarin.Mac-Mobile-FrameworkList.xml.in")] public void CheckFrameworkListFile (string frameworkListFile) @@ -31,10 +30,6 @@ public void CheckFrameworkListFile (string frameworkListFile) if (!Configuration.include_tvos) Assert.Inconclusive ("include_tvos is disabled"); break; - case "Xamarin.WatchOS": - if (!Configuration.include_watchos) - Assert.Inconclusive ("include_watchos is disabled"); - break; case "Xamarin.Mac": if (!Configuration.include_mac) Assert.Inconclusive ("include_mac is disabled"); diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitApp.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitApp.cs deleted file mode 100644 index 0092621f708f..000000000000 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitApp.cs +++ /dev/null @@ -1,22 +0,0 @@ -using NUnit.Framework; - -namespace Xamarin.MacDev.Tasks { - [TestFixture (false)] - public class GeneratePlistTaskTests_watchOS_WatchKitApp : GeneratePlistTaskTests_watchOS { - public GeneratePlistTaskTests_watchOS_WatchKitApp (bool isDotNet) - : base (isDotNet) - { - } - - protected override void ConfigureTask (bool isDotNet) - { - base.ConfigureTask (isDotNet); - Task.IsWatchApp = true; - } - - public override void XamarinVersion () - { - // WatchKit App doesn't require the com.xamarin.ios key. - } - } -} diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitExtension.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitExtension.cs deleted file mode 100644 index ab63451577c3..000000000000 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitExtension.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Linq; -using NUnit.Framework; -using Xamarin.MacDev; - -namespace Xamarin.MacDev.Tasks { - [TestFixture (false)] - public class GeneratePlistTaskTests_watchOS_WatchKitExtension : GeneratePlistTaskTests_watchOS { - public GeneratePlistTaskTests_watchOS_WatchKitExtension (bool isDotNet) - : base (isDotNet) - { - } - - protected override void ConfigureTask (bool isDotNet) - { - base.ConfigureTask (isDotNet); - Task.IsWatchExtension = true; - } - - /// - /// watchOS 2 WatchKitExtension projects shouldn't have the UIRequiredDeviceCapabilities watch-companion value defined. - /// As this is the only value added to UIRequiredDeviceCapabilities for a watchOS project, the test passes if undefined. - /// - [Test] - public void NoWatchCompanion () - { - Assert.That (CompiledPlist.ContainsKey (ManifestKeys.UIRequiredDeviceCapabilities) == false, "#1"); - } - } -} diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ToolTasksBinPathTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ToolTasksBinPathTest.cs deleted file mode 100644 index 1417c28fbd51..000000000000 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ToolTasksBinPathTest.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Diagnostics; -using NUnit.Framework; -using Xamarin.Tests; - -namespace AppleSdkSettings { - - public static class XcodeVersion { - public static int Major { get { return Configuration.XcodeVersion.Major; } } - } -} - -namespace Xamarin.MacDev.Tasks { - - public class MetalPoker : Metal { - public new string GenerateFullPathToTool () - { - return base.GenerateFullPathToTool (); - } - } - - public class MetalLibPoker : MetalLib { - - public new string GenerateFullPathToTool () - { - return base.GenerateFullPathToTool (); - } - } - - [TestFixture] - public class ToolTasksBinPathTest { - - [Test] - public void MetalBinPathTest () - { - var metalTask = new MetalPoker (); - metalTask.SdkDevPath = string.Empty; - CheckToolBinDir ("metal", metalTask.GenerateFullPathToTool ()); - } - - [Test] - public void MetalLibBinPathTest () - { - var metalLibTask = new MetalLibPoker (); - metalLibTask.SdkDevPath = string.Empty; - CheckToolBinDir ("metallib", metalLibTask.GenerateFullPathToTool ()); - } - - public void CheckToolBinDir (string taskName, string binDirToCheck) - { - var psi = new ProcessStartInfo ("xcrun") { - Arguments = $"-f {taskName}", - UseShellExecute = false, - CreateNoWindow = true, - RedirectStandardOutput = true, - RedirectStandardError = true, - }; - psi.EnvironmentVariables ["DEVELOPER_DIR"] = Configuration.xcode_root; - psi.EnvironmentVariables.Remove ("XCODE_DEVELOPER_DIR_PATH"); // VSfM sets XCODE_DEVELOPER_DIR_PATH, which confuses the command-line tools if it doesn't match xcode-select, so just unset it. - var proc = Process.Start (psi); - - string output = proc.StandardOutput.ReadToEnd (); - string err = proc.StandardError.ReadToEnd (); - - Assert.True (output.Contains (binDirToCheck), err); - } - } -} diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/Xamarin.MacDev.Tasks.Tests.csproj b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/Xamarin.MacDev.Tasks.Tests.csproj index 23074d2e2d40..33fb783ef82f 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/Xamarin.MacDev.Tasks.Tests.csproj +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/Xamarin.MacDev.Tasks.Tests.csproj @@ -52,6 +52,9 @@ external\Configuration.cs + + external\ConfigurationNUnit.cs + external\DotNet.cs diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs index 0699ebb458d4..a57513b1b989 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs @@ -46,12 +46,6 @@ void AssertProperlyCodesigned (bool expected) foreach (var appex in Directory.EnumerateDirectories (AppBundlePath, "*.appex", SearchOption.AllDirectories)) Assert.AreEqual (expected, IsCodesigned (appex), "{0} is not properly codesigned.", appex); - - var watchDir = Path.Combine (AppBundlePath, "Watch"); - if (Directory.Exists (watchDir)) { - foreach (var watchApp in Directory.EnumerateDirectories (watchDir, "*.app", SearchOption.TopDirectoryOnly)) - Assert.AreEqual (expected, IsCodesigned (watchApp), "{0} is not properly codesigned.", watchApp); - } } [Test] @@ -154,93 +148,5 @@ public void CodesignAfterModifyingAppExtensionTest () File.WriteAllText (viewController, text); } } - - [Test] - public void RebuildWatchAppNoChanges () - { - Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS); - Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.WatchOS); - Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET - - bool expectedCodesignResults = Platform != "iPhoneSimulator"; - - BuildProject ("MyWatch2Container"); - - AssertProperlyCodesigned (expectedCodesignResults); - - EnsureFilestampChange (); - - // Rebuild w/ no changes - BuildProject ("MyWatch2Container", clean: false); - - // make sure everything is still codesigned properly - AssertProperlyCodesigned (expectedCodesignResults); - - if (Platform == "iPhone") { - // make sure the dSYMs exist - - var mainDsymDir = Path.GetFullPath (Path.Combine (AppBundlePath, "..", "MyWatch2Container.app.dSYM")); - Assert.That (mainDsymDir, Does.Exist, "MyWatch2Container dSYMs not found"); - - var appexDsymDir = Path.GetFullPath (Path.Combine (AppBundlePath, "..", "MyWatchKit2Extension.appex.dSYM")); - Assert.That (appexDsymDir, Does.Exist, "MyWatchKit2Extension dSYMs not found"); - - var appex2DsymDir = Path.GetFullPath (Path.Combine (AppBundlePath, "..", "MyWatchKit2IntentsExtension.appex.dSYM")); - Assert.That (appex2DsymDir, Does.Exist, "MyWatchKit2IntentsExtension/ dSYMs not found"); - } - } - - [Test] - public void CodesignAfterModifyingWatchApp2Test () - { - Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS); - Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.WatchOS); - Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET - - var csproj = BuildProject ("MyWatch2Container", clean: true).ProjectCSProjPath; - var testsDir = Path.GetDirectoryName (Path.GetDirectoryName (csproj)); - var appexProjectDir = Path.Combine (testsDir, "MyWatchKit2Extension"); - var viewController = Path.Combine (appexProjectDir, "InterfaceController.cs"); - var mainExecutable = Path.Combine (AppBundlePath, "MyWatch2Container"); - bool expectedCodesignResults = Platform != "iPhoneSimulator"; - var timestamp = File.GetLastWriteTimeUtc (mainExecutable); - var text = File.ReadAllText (viewController); - - AssertProperlyCodesigned (expectedCodesignResults); - - EnsureFilestampChange (); - - // replace "bool imageFound = false;" with "bool imageFound = true;" so that we force the appex to get rebuilt - text = text.Replace ("{0} awake with context", "{0} The Awakening..."); - File.WriteAllText (viewController, text); - - try { - BuildProject ("MyWatch2Container", clean: false); - - AssertProperlyCodesigned (expectedCodesignResults); - - var newTimestamp = File.GetLastWriteTimeUtc (mainExecutable); - - // make sure that the main app bundle was codesigned due to the changes in the appex - Assert.IsTrue (newTimestamp > timestamp, "The main app bundle does not seem to have been re-codesigned"); - } finally { - // restore the original ActionViewController.cs code... - text = text.Replace ("{0} The Awakening...", "{0} awake with context"); - File.WriteAllText (viewController, text); - } - - if (Platform == "iPhone") { - // make sure the dSYMs exist - - var mainDsymDir = Path.GetFullPath (Path.Combine (AppBundlePath, "..", "MyWatch2Container.app.dSYM")); - Assert.That (mainDsymDir, Does.Exist, "MyWatch2Container dSYMs not found"); - - var appexDsymDir = Path.GetFullPath (Path.Combine (AppBundlePath, "..", "MyWatchKit2Extension.appex.dSYM")); - Assert.That (appexDsymDir, Does.Exist, "MyWatchKit2Extension dSYMs not found"); - - var appex2DsymDir = Path.GetFullPath (Path.Combine (AppBundlePath, "..", "MyWatchKit2IntentsExtension.appex.dSYM")); - Assert.That (appex2DsymDir, Does.Exist, "MyWatchKit2IntentsExtension/ dSYMs not found"); - } - } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs deleted file mode 100644 index 26a5f8e1882b..000000000000 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs +++ /dev/null @@ -1,25 +0,0 @@ -using NUnit.Framework; - -using Xamarin.Tests; -using Xamarin.Utils; - -namespace Xamarin.MacDev.Tasks { - [TestFixture ("iPhone")] - [TestFixture ("iPhoneSimulator")] - public class WatchKit : ExtensionTestBase { - - public WatchKit (string platform) : base (platform) - { - } - - [Test] - public void BasicTest () - { - Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.WatchOS); - Configuration.AssertLegacyXamarinAvailable (); - - BuildExtension ("MyWatchApp", "MyWatchKitExtension", expectedErrorCount: 1); - Assert.AreEqual ("Xamarin.iOS 14+ does not support watchOS 1 apps. Please migrate your project to watchOS 2+.", Engine.Logger.ErrorEvents [0].Message, "WK 1 error message"); - } - } -} diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs deleted file mode 100644 index 4e0af66c6dd3..000000000000 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.IO; - -using NUnit.Framework; - -using Xamarin.Tests; -using Xamarin.Utils; - -namespace Xamarin.MacDev.Tasks { - [TestFixture ("iPhone")] - [TestFixture ("iPhoneSimulator")] - public class WatchKit2 : ExtensionTestBase { - - public WatchKit2 (string platform) : base (platform) - { - } - - [Test] - public void BasicTest () - { - Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.WatchOS); - Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET - - BuildExtension ("MyWatchApp2", "MyWatchKit2Extension"); - } - - public override string TargetFrameworkIdentifier { - get { - return "Xamarin.WatchOS"; - } - } - } -} diff --git a/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj b/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj index 771e95f8bcb2..2e130dd64d2a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj +++ b/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj @@ -26,6 +26,9 @@ external\Configuration.cs + + external\ConfigurationNUnit.cs + external\ApplePlatform.cs diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index e8afc9e148d2..4577b916752f 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -1028,37 +1028,6 @@ public void MT0075 () } } - [Test] - [TestCase (Profile.watchOS)] - [TestCase (Profile.tvOS)] - public void MT0076 (Profile profile) - { - if (!Configuration.include_watchos || !Configuration.include_tvos) - Assert.Ignore ("This test requires WatchOS and TVOS to be enabled."); - - using (var mtouch = new MTouchTool ()) { - mtouch.Profile = profile; - mtouch.Abi = MTouchTool.None; - mtouch.CreateTemporaryApp (); - mtouch.AssertExecuteFailure (MTouchAction.BuildDev, "build"); - mtouch.AssertError (76, $"No architecture specified (using the --abi argument). An architecture is required for {GetPlatformName (profile)} projects."); - } - } - - [Test] - public void MT0077 () - { - if (!Configuration.include_watchos) - Assert.Ignore ("This test requires WatchOS and TVOS to be enabled."); - - using (var mtouch = new MTouchTool ()) { - mtouch.Profile = Profile.watchOS; - mtouch.CreateTemporaryApp (); - mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build"); - mtouch.AssertError (77, "WatchOS projects must be extensions."); - } - } - [Test] [TestCase (Profile.tvOS)] [TestCase (Profile.watchOS)] diff --git a/tests/mtouch/mtouchtests.csproj b/tests/mtouch/mtouchtests.csproj index c207827fbe0b..be319512d85d 100644 --- a/tests/mtouch/mtouchtests.csproj +++ b/tests/mtouch/mtouchtests.csproj @@ -44,6 +44,9 @@ Configuration.cs + + ConfigurationNUnit.cs + diff --git a/tests/package-dotnet-tests.sh b/tests/package-dotnet-tests.sh deleted file mode 100755 index b22146d9a783..000000000000 --- a/tests/package-dotnet-tests.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -ex - -cd "$(dirname "${BASH_SOURCE[0]}")" - -# Clone files instead of copying them on APFS file systems. Much faster. -CP="cp" -if df -t apfs / >/dev/null 2>&1; then - CP="cp -c" -fi - -#git clean -xfdq - -rm -Rf "$(pwd)/dotnet-test-package" -DIR=$(pwd)/dotnet-test-package/xamarin-macios -ZIP=$DIR.7z -mkdir -p $DIR -mkdir -p $DIR/tests/dotnet/UnitTests/bin/Debug/net5.0/ -mkdir -p $DIR/.git - -make -j8 -make -C dotnet/UnitTests publish - -$CP -r dotnet $DIR/tests/ -rm -Rf $DIR/tests/dotnet/packages - -# Various files to make 'make' work -$CP -p ../Make.config $DIR -$CP -p ../Make.versions $DIR -$CP -p ../Make.config $DIR -mkdir -p $DIR/mk -$CP -p ../Make.config $DIR -$CP -p ../mk/subdirs.mk $DIR/mk -$CP -p ../mk/rules.mk $DIR/mk -$CP -p ../mk/quiet.mk $DIR/mk -$CP -p ../mk/mono.mk "$DIR/mk" - -# Files to make the unit tests run -$CP -p ../global.json $DIR -$CP -p ../NuGet.config $DIR -$CP -p test.config $DIR/tests - -# Zip it all up -rm -f dotnet-test-package.7z -cd dotnet-test-package -7z a ../dotnet-test-package.7z * diff --git a/tests/package-mac-tests.sh b/tests/package-mac-tests.sh index c096193d9224..f4d3ba4c335a 100755 --- a/tests/package-mac-tests.sh +++ b/tests/package-mac-tests.sh @@ -23,7 +23,6 @@ export MD_APPLE_SDK_ROOT="$(dirname "$(dirname "$XCODE_DEVELOPER_ROOT")")" export RootTestsDirectory="$(pwd)" make -make .stamp-xharness-configure TEST_SUITE_DEPENDENCIES+=(bindings-test) TEST_SUITE_DEPENDENCIES+=(EmbeddedResources) diff --git a/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/BaseGeneratorWithAnalyzerTestClass.cs b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/BaseGeneratorWithAnalyzerTestClass.cs new file mode 100644 index 000000000000..e3df3d973dda --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/BaseGeneratorWithAnalyzerTestClass.cs @@ -0,0 +1,35 @@ +using System.Collections.Immutable; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.Macios.Generator.Tests; +using Xunit; + +namespace Microsoft.Macios.Bindings.Analyzer.Tests; + +public class BaseGeneratorWithAnalyzerTestClass : BaseGeneratorTestClass { + + protected Task> RunAnalyzer (T analyzer, Compilation compilation) + where T : DiagnosticAnalyzer + { + var compilationWithAnalyzers = + // run generators on the compilation + RunGeneratorsAndUpdateCompilation (compilation, out _) + // attach analyzers + .WithAnalyzers (ImmutableArray.Create (analyzer)); + return compilationWithAnalyzers.GetAllDiagnosticsAsync (); + } + + protected static void VerifyDiagnosticMessage (Diagnostic diagnostic, string diagnosticId, + DiagnosticSeverity severity, string message) + { + Assert.Equal (diagnosticId, diagnostic.Id); + Assert.Equal (severity, diagnostic.Severity); + Assert.Equal (message, diagnostic.GetMessage ()); + } + protected static void VerifyDiagnosticMessage (Diagnostic diagnostic, string diagnosticId, string message) + { + Assert.Equal (diagnosticId, diagnostic.Id); + Assert.Equal (message, diagnostic.GetMessage ()); + } +} diff --git a/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/BindingTypeSemanticAnalyzerTests.cs b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/BindingTypeSemanticAnalyzerTests.cs new file mode 100644 index 000000000000..48cba5be3fbd --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/BindingTypeSemanticAnalyzerTests.cs @@ -0,0 +1,36 @@ +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Bindings.Analyzer.Tests; + +public class BindingTypeSemanticAnalyzerTests : BaseGeneratorWithAnalyzerTestClass { + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacOSX)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + public async Task BindingTypeMustBePartial (ApplePlatform platform) + { + const string inputText = @" +using ObjCBindings; + +namespace Test { + [BindingType] + public class Examples { + } +} +"; + + var compilation = CreateCompilation (nameof (CompareGeneratedCode), platform, inputText); + var diagnostics = await RunAnalyzer (new BindingTypeSemanticAnalyzer (), compilation); + Assert.Single (diagnostics); + // verify the diagnostic message + var location = diagnostics [0].Location; + VerifyDiagnosticMessage (diagnostics [0], BindingTypeSemanticAnalyzer.DiagnosticId, + DiagnosticSeverity.Error, "The binding type 'Test.Examples' must declared as a partial class"); + } +} diff --git a/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj new file mode 100644 index 000000000000..f508fcca942a --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj @@ -0,0 +1,27 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + + false + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/BaseGeneratorTestClass.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/BaseGeneratorTestClass.cs new file mode 100644 index 000000000000..1ed459e25ccc --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/BaseGeneratorTestClass.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests; + +/// +/// Base class that allows to test the generator. +/// +public class BaseGeneratorTestClass { + protected BindingSourceGeneratorGenerator GeneratorGenerator; + protected CSharpGeneratorDriver _driver; + + public BaseGeneratorTestClass () + { + GeneratorGenerator = new BindingSourceGeneratorGenerator (); + _driver = CSharpGeneratorDriver.Create (GeneratorGenerator); + } + + protected Compilation RunGeneratorsAndUpdateCompilation (Compilation compilation, out ImmutableArray diagnostics) + { + _driver.RunGeneratorsAndUpdateCompilation (compilation, out var updatedCompilation, out diagnostics); + return updatedCompilation; + } + + protected GeneratorDriverRunResult RunGenerators (Compilation compilation) + => _driver.RunGenerators (compilation).GetRunResult (); + + protected Compilation CreateCompilation (string name, ApplePlatform platform, params string [] sources) + { + // get the dotnet bcl and fully load it for the test. + var references = Directory.GetFiles (Configuration.DotNetBclDir, "*.dll") + .Select (assembly => MetadataReference.CreateFromFile (assembly)).ToList (); + // get the dll for the current platform + var targetFramework = TargetFramework.GetTargetFramework (platform, isDotNet: true); + var platformDll = Configuration.GetBaseLibrary (targetFramework); + if (!string.IsNullOrEmpty (platformDll)) { + references.Add (MetadataReference.CreateFromFile (platformDll)); + } else { + throw new InvalidOperationException ($"Could not find platform dll for {platform}"); + } + var trees = sources.Select (s => CSharpSyntaxTree.ParseText (s)); + var options = new CSharpCompilationOptions (OutputKind.NetModule); + return CSharpCompilation.Create (name, trees, references, options); + } + + protected void CompareGeneratedCode (ApplePlatform platform, string className, string inputFileName, string inputText, string outputFileName, string expectedOutputText) + { + // We need to create a compilation with the required source code. + var compilation = CreateCompilation (nameof (CompareGeneratedCode), platform, inputText); + + // Run generators and retrieve all results. + var runResult = RunGenerators (compilation); + + // All generated files can be found in 'RunResults.GeneratedTrees'. + var generatedFileSyntax = runResult.GeneratedTrees.Single (t => t.FilePath.EndsWith ($"{className}.g.cs")); + + // Complex generators should be tested using text comparison. + Assert.Equal (expectedOutputText, generatedFileSyntax.GetText ().ToString (), + ignoreLineEndingDifferences: true); + + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/BaseTestDataGenerator.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/BaseTestDataGenerator.cs new file mode 100644 index 000000000000..b587edeceac1 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/BaseTestDataGenerator.cs @@ -0,0 +1,13 @@ +using System.IO; +using System.Runtime.CompilerServices; + +namespace Microsoft.Macios.Generator.Tests; + +public class BaseTestDataGenerator { + public static string ReadFileAsString (string file, [CallerFilePath] string filePath = "") + { + var directoryPath = Path.GetDirectoryName (filePath); + var fullPath = Path.Join (directoryPath, "Data", file); + return File.ReadAllText (fullPath); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs new file mode 100644 index 000000000000..a101ccbbd214 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs @@ -0,0 +1,44 @@ +using System.Linq; +using Microsoft.CodeAnalysis.CSharp; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests; + +// Unit test that ensures that all the generator attributes are correctly added in the compilation initialization +public class BindingSourceGeneratorGeneratorTests : BaseGeneratorTestClass { + + const string SampleBindingType = @" +namespace TestNamespace; + +[BindingType (Name = ""AVAudioPCMBuffer"")] +interface AVAudioPcmBuffer : AVAudioBuffer { +} +"; + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacOSX)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + public void AttributesAreNotPresent (ApplePlatform platform) + { + // We need to create a compilation with the required source code. + var compilation = CreateCompilation (nameof (AttributesAreNotPresent), + platform, SampleBindingType); + + // Run generators and retrieve all results. + var runResult = _driver.RunGenerators (compilation).GetRunResult (); + + // ensure that we do have all the needed attributes present + var expectedGeneratedAttributes = new [] { + "BindingTypeAttribute.g.cs", + }; + + foreach (string generatedAttribute in expectedGeneratedAttributes) { + var generatedFile = runResult.GeneratedTrees.SingleOrDefault (t => t.FilePath.EndsWith (generatedAttribute)); + Assert.Null (generatedFile); + } + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj b/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj new file mode 100644 index 000000000000..417b2c63d198 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj @@ -0,0 +1,59 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + + false + + Microsoft.Macios.Generator.Tests + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + external\Configuration.cs + + + external\ConfigurationXUnit.cs + + + external\Profile.cs + + + external\ExecutionHelper.cs + + + external\ApplePlatform.cs + + + external\TargetFramework.cs + + + external\StringUtils.cs + + + external\Execution.cs + + + external\SdkVersions.cs + + + external\Cache.cs + + + + diff --git a/tests/test-libraries/Makefile b/tests/test-libraries/Makefile index 61725d4db362..c50be1a4ad85 100644 --- a/tests/test-libraries/Makefile +++ b/tests/test-libraries/Makefile @@ -235,18 +235,6 @@ ifdef INCLUDE_TVOS $(eval $(call Template,tvsimulator,TVSIMULATOR,x86_64 arm64,AppleTVSimulator,-mtvos-simulator-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(SIMULATORTV_SDK))) $(eval $(call Template,tvos,TVOS,arm64,AppleTVOS,-mtvos-version-min=$(MIN_TVOS_SDK_VERSION) -isysroot $(DEVICETV_SDK))) endif -ifdef INCLUDE_WATCH -ifdef WATCHOS_SUPPORTS_32BIT_SIMULATOR_ARCHITECTURES -$(eval $(call Template,watchsimulator,WATCHSIMULATOR,x86 x86_64,WatchSimulator,-mwatchos-simulator-version-min=$(MIN_WATCH_OS_VERSION) -isysroot $(SIMULATORWATCH_SDK))) -else -$(eval $(call Template,watchsimulator,WATCHSIMULATOR,x86_64,WatchSimulator,-mwatchos-simulator-version-min=$(MIN_WATCH_OS_VERSION) -isysroot $(SIMULATORWATCH_SDK))) -endif -ifdef WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES -$(eval $(call Template,watchos,WATCHOS,armv7k arm64_32,WatchOS,-mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK))) -else -$(eval $(call Template,watchos,WATCHOS,arm64_32,WatchOS,-mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK))) -endif -endif ifdef INCLUDE_MAC $(eval $(call Template,macos,MACOS,x86_64 arm64,MacOSX,-mmacosx-version-min=$(MIN_OSX_VERSION_FOR_MAC) -isysroot $(XCODE_DEVELOPER_ROOT)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(MACOS_SDK_VERSION).sdk)) endif @@ -254,7 +242,7 @@ ifdef INCLUDE_MACCATALYST $(eval $(call Template,maccatalyst,MACCATALYST,x86_64 arm64,MacCatalyst,$(MACCATALYST_COMMON_CFLAGS))) endif -.libs/ios-fat .libs/tvos-fat .libs/watchos-fat .libs/maccatalyst-fat .libs/macos-fat: +.libs/ios-fat .libs/tvos-fat .libs/maccatalyst-fat .libs/macos-fat: $(Q) mkdir -p $@ define LibTemplate @@ -276,14 +264,6 @@ ifdef INCLUDE_TVOS $(eval $(call LibTemplate,arm64+x86_64,.libs/tvos/libtest.arm64.o,.libs/tvsimulator/libtest.x86_64.o,tvos-fat,TVOS)) endif -ifdef INCLUDE_WATCH -ifdef WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES -ifdef WATCHOS_SUPPORTS_32BIT_SIMULATOR_ARCHITECTURES -$(eval $(call LibTemplate,armv7k+x86,.libs/watchos/libtest.armv7k.o,.libs/watchsimulator/libtest.x86.o,watchos-fat,WATCHOS)) -endif -endif -endif - ifdef INCLUDE_MACCATALYST $(eval $(call LibTemplate,x86_64+arm64,.libs/maccatalyst/libtest.x86_64.o,.libs/maccatalyst/libtest.arm64.o,maccatalyst-fat,MACCATALYST)) endif @@ -339,9 +319,6 @@ $(eval $(call FatFrameworkTemplate,ios-fat,iphoneos,iphonesimulator,IPHONESIMULA ifdef INCLUDE_TVOS $(eval $(call FatFrameworkTemplate,tvos-fat,tvos,tvsimulator,TVSIMULATOR)) endif -ifdef INCLUDE_WATCH -$(eval $(call FatFrameworkTemplate,watchos-fat,watchos,watchsimulator,WATCHSIMULATOR)) -endif ifdef INCLUDE_MACCATALYST $(eval $(call FatFrameworkTemplate,maccatalyst-fat,maccatalyst,maccatalyst,MACCATALYST)) endif @@ -383,9 +360,6 @@ endif ifdef INCLUDE_TVOS XCPLATFORMS+= tvos tvsimulator endif -ifdef INCLUDE_WATCH -XCPLATFORMS+= watchos watchsimulator -endif ifdef INCLUDE_MAC XCPLATFORMS+= macos endif @@ -406,9 +380,6 @@ endif ifdef INCLUDE_TVOS $(eval $(call ZippedFrameworkTemplate,tvos-fat,TVSIMULATOR)) endif -ifdef INCLUDE_WATCH -$(eval $(call ZippedFrameworkTemplate,watchos-fat,WATCHSIMULATOR)) -endif ifdef INCLUDE_MACCATALYST $(eval $(call ZippedFrameworkTemplate,maccatalyst-fat,MACCATALYST)) endif diff --git a/tests/test-libraries/SwiftTest-Info-watchos.plist b/tests/test-libraries/SwiftTest-Info-watchos.plist deleted file mode 100644 index 98092178ebd2..000000000000 --- a/tests/test-libraries/SwiftTest-Info-watchos.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.ios.swifttest - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - SwiftTest - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - SwiftTest - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - WatchOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - watchos - DTPlatformVersion - 2.0 - DTSDKBuild - 12D508 - DTSDKName - watchos2.0 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 4.0 - UIDeviceFamily - - 4 - - - diff --git a/tests/test-libraries/SwiftTest-Info-watchsimulator.plist b/tests/test-libraries/SwiftTest-Info-watchsimulator.plist deleted file mode 100644 index 98092178ebd2..000000000000 --- a/tests/test-libraries/SwiftTest-Info-watchsimulator.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.ios.swifttest - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - SwiftTest - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - SwiftTest - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - WatchOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - watchos - DTPlatformVersion - 2.0 - DTSDKBuild - 12D508 - DTSDKName - watchos2.0 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 4.0 - UIDeviceFamily - - 4 - - - diff --git a/tests/test-libraries/XTest-Info-watchos.plist b/tests/test-libraries/XTest-Info-watchos.plist deleted file mode 100644 index 46684862038b..000000000000 --- a/tests/test-libraries/XTest-Info-watchos.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.ios.xtest - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - XTest - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - XTest - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - WatchOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - watchos - DTPlatformVersion - 2.0 - DTSDKBuild - 12D508 - DTSDKName - watchos2.0 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 4.0 - UIDeviceFamily - - 4 - - - diff --git a/tests/test-libraries/XTest-Info-watchsimulator.plist b/tests/test-libraries/XTest-Info-watchsimulator.plist deleted file mode 100644 index 46684862038b..000000000000 --- a/tests/test-libraries/XTest-Info-watchsimulator.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.ios.xtest - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - XTest - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - XTest - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - WatchOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - watchos - DTPlatformVersion - 2.0 - DTSDKBuild - 12D508 - DTSDKName - watchos2.0 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 4.0 - UIDeviceFamily - - 4 - - - diff --git a/tests/test-libraries/frameworks/Info-watchos.plist b/tests/test-libraries/frameworks/Info-watchos.plist deleted file mode 100644 index 9962985101ed..000000000000 --- a/tests/test-libraries/frameworks/Info-watchos.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.ios.%NAME% - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - %NAME% - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - %NAME% - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - WatchOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - watchos - DTPlatformVersion - 2.0 - DTSDKBuild - 12D508 - DTSDKName - watchos2.0 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 4.0 - UIDeviceFamily - - 4 - - - diff --git a/tests/test-libraries/frameworks/Info-watchsimulator.plist b/tests/test-libraries/frameworks/Info-watchsimulator.plist deleted file mode 100644 index 9962985101ed..000000000000 --- a/tests/test-libraries/frameworks/Info-watchsimulator.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.ios.%NAME% - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - %NAME% - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - %NAME% - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - WatchOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - watchos - DTPlatformVersion - 2.0 - DTSDKBuild - 12D508 - DTSDKName - watchos2.0 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 4.0 - UIDeviceFamily - - 4 - - - diff --git a/tests/test-libraries/libSwiftTest.swift b/tests/test-libraries/libSwiftTest.swift index a49e6a88a429..a674cc709c61 100644 --- a/tests/test-libraries/libSwiftTest.swift +++ b/tests/test-libraries/libSwiftTest.swift @@ -1,7 +1,7 @@ import Foundation @objc(SwiftTestClass) -@available(iOS 15, tvOS 15, macOS 12, macCatalyst 12, watchOS 8, *) +@available(iOS 15, tvOS 15, macOS 12, macCatalyst 12, *) public class SwiftTestClass : NSObject { @objc public func SayHello() -> String { diff --git a/tests/test-libraries/libtest.h b/tests/test-libraries/libtest.h index fa765586d097..2f21a56d2bc9 100644 --- a/tests/test-libraries/libtest.h +++ b/tests/test-libraries/libtest.h @@ -4,10 +4,7 @@ #include "rename.h" -#if !TARGET_OS_WATCH #import -#endif - #import #ifdef __cplusplus @@ -32,11 +29,9 @@ void x_get_matrix_float3x3 (id self, const char *sel, float* r0c0, float* r0c1, void x_get_matrix_float4x4 (id self, const char *sel, float* r0c0, float* r0c1, float* r0c2, float* r0c3, float* r1c0, float* r1c1, float* r1c2, float* r1c3, float* r2c0, float* r2c1, float* r2c2, float* r2c3, float* r3c0, float* r3c1, float* r3c2, float* r3c3); void x_get_matrix_float4x3 (id self, const char *sel, float* r0c0, float* r0c1, float* r0c2, float* r0c3, float* r1c0, float* r1c1, float* r1c2, float* r1c3, float* r2c0, float* r2c1, float* r2c2, float* r2c3); -#if !TARGET_OS_WATCH void x_mdltransformcomponent_get_local_transform (id self, NSTimeInterval time, float* r0c0, float* r0c1, float* r0c2, float* r0c3, float* r1c0, float* r1c1, float* r1c2, float* r1c3, float* r2c0, float* r2c1, float* r2c2, float* r2c3, float* r3c0, float* r3c1, float* r3c2, float* r3c3); void x_mdltransform_create_global_transform (MDLObject *object, NSTimeInterval time, float* r0c0, float* r0c1, float* r0c2, float* r0c3, float* r1c0, float* r1c1, float* r1c2, float* r1c3, float* r2c0, float* r2c1, float* r2c2, float* r2c3, float* r3c0, float* r3c1, float* r3c2, float* r3c3); void x_mdltransform_get_rotation_matrix (MDLTransform *self, NSTimeInterval time, float* r0c0, float* r0c1, float* r0c2, float* r0c3, float* r1c0, float* r1c1, float* r1c2, float* r1c3, float* r2c0, float* r2c1, float* r2c2, float* r2c3, float* r3c0, float* r3c1, float* r3c2, float* r3c3); -#endif #if TARGET_OS_OSX #define pfloat CGFloat diff --git a/tests/test-libraries/libtest.m b/tests/test-libraries/libtest.m index 527778581999..6964c16f5e1b 100644 --- a/tests/test-libraries/libtest.m +++ b/tests/test-libraries/libtest.m @@ -166,7 +166,7 @@ void x_call_block (x_block_callback block) *r2c2 = rv.columns[2][2]; *r2c3 = rv.columns[3][2]; } -#if !TARGET_OS_WATCH + void x_mdltransformcomponent_get_local_transform (id self, NSTimeInterval time, float* r0c0, float* r0c1, float* r0c2, float* r0c3, @@ -256,7 +256,6 @@ void x_call_block (x_block_callback block) *r3c2 = rv.columns[2][3]; *r3c3 = rv.columns[3][3]; } -#endif // !TARGET_OS_WATCH SCNMatrix4 x_SCNMatrix4MakeTranslation (pfloat tx, pfloat ty, pfloat tz) diff --git a/tests/test-libraries/testgenerator.cs b/tests/test-libraries/testgenerator.cs index 6aa578232032..fe80a5d85112 100644 --- a/tests/test-libraries/testgenerator.cs +++ b/tests/test-libraries/testgenerator.cs @@ -334,7 +334,7 @@ static void WriteFrameworkDefines (StringBuilder w) #define HAVE_COREMEDIA #endif -#if __IOS__ || __WATCHOS__ || __TVOS__ +#if __IOS__ || __TVOS__ #define HAVE_UIKIT #endif diff --git a/tests/xammac_tests/xammac_tests.csproj b/tests/xammac_tests/xammac_tests.csproj index 76d9f3409811..73d0756eef6c 100644 --- a/tests/xammac_tests/xammac_tests.csproj +++ b/tests/xammac_tests/xammac_tests.csproj @@ -75,6 +75,9 @@ Configuration.cs + + ConfigurationNUnit.cs + PlatformInfo.cs diff --git a/tests/xharness/AppRunner.cs b/tests/xharness/AppRunner.cs index 0efd5c0c68a1..bcc9d631abe6 100644 --- a/tests/xharness/AppRunner.cs +++ b/tests/xharness/AppRunner.cs @@ -42,9 +42,7 @@ public class AppRunner { readonly string buildConfiguration; string deviceName; - string companionDeviceName; ISimulatorDevice simulator; - ISimulatorDevice companionSimulator; bool ensureCleanSimulatorState = true; bool EnsureCleanSimulatorState { @@ -80,9 +78,7 @@ public AppRunner (IMlaunchProcessManager processManager, string projectFilePath, string buildConfiguration, ISimulatorDevice simulator = null, - ISimulatorDevice companionSimulator = null, string deviceName = null, - string companionDeviceName = null, bool ensureCleanSimulatorState = false, double timeoutMultiplier = 1, string variation = null, @@ -102,10 +98,8 @@ public AppRunner (IMlaunchProcessManager processManager, this.Logs = logs ?? throw new ArgumentNullException (nameof (logs)); this.timeoutMultiplier = timeoutMultiplier; this.deviceName = deviceName; - this.companionDeviceName = companionDeviceName; this.ensureCleanSimulatorState = ensureCleanSimulatorState; this.simulator = simulator; - this.companionSimulator = companionSimulator; this.buildTask = buildTask; this.target = target; this.variation = variation; @@ -129,7 +123,7 @@ async Task FindSimulatorAsync () var sims = simulatorsLoaderFactory.CreateLoader (); await sims.LoadDevices (Logs.Create ($"simulator-list-{Harness.Helpers.Timestamp}.log", "Simulator list"), false, false); - (simulator, companionSimulator) = await sims.FindSimulators (target.GetTargetOs (false), MainLog); + (simulator, _) = await sims.FindSimulators (target.GetTargetOs (false), MainLog); return simulator is not null; } @@ -149,9 +143,6 @@ async Task FindDevice () var device = await devs.FindDevice (runMode, MainLog, false, false); deviceName = device?.Name; - - if (runMode == RunMode.WatchOS) - companionDeviceName = (await devs.FindCompanionDevice (MainLog, device)).Name; } public async Task InstallAsync (CancellationToken cancellation_token) @@ -172,14 +163,10 @@ public async Task InstallAsync (CancellationToken cancel args.Add (new VerbosityArgument ()); args.Add (new InstallAppOnDeviceArgument (AppInformation.AppPath)); - args.Add (new DeviceNameArgument (companionDeviceName ?? deviceName)); - - if (runMode == RunMode.WatchOS) { - args.Add (new DeviceArgument ("ios,watchos")); - } + args.Add (new DeviceNameArgument (deviceName)); var totalSize = Directory.GetFiles (AppInformation.AppPath, "*", SearchOption.AllDirectories).Select ((v) => new FileInfo (v).Length).Sum (); - MainLog.WriteLine ($"Installing '{AppInformation.AppPath}' to '{companionDeviceName ?? deviceName}'. Size: {totalSize} bytes = {totalSize / 1024.0 / 1024.0:N2} MB"); + MainLog.WriteLine ($"Installing '{AppInformation.AppPath}' to '{deviceName}'. Size: {totalSize} bytes = {totalSize / 1024.0 / 1024.0:N2} MB"); return await processManager.ExecuteCommandAsync (args, MainLog, TimeSpan.FromHours (1), cancellationToken: cancellation_token); } @@ -197,7 +184,7 @@ public async Task UninstallAsync () args.Add (new VerbosityArgument ()); args.Add (new UninstallAppFromDeviceArgument (AppInformation.BundleIdentifier)); - args.Add (new DeviceNameArgument (companionDeviceName ?? deviceName)); + args.Add (new DeviceNameArgument (deviceName)); return await processManager.ExecuteCommandAsync (args, MainLog, TimeSpan.FromMinutes (1)); } @@ -302,16 +289,7 @@ public async Task RunAsync () args.AddRange (harness.EnvironmentVariables.Select (kvp => new SetEnvVariableArgument (kvp.Key, kvp.Value))); if (IsExtension) { - switch (AppInformation.Extension) { - case Extension.TodayExtension: - args.Add (isSimulator - ? (MlaunchArgument) new LaunchSimulatorExtensionArgument (AppInformation.LaunchAppPath, AppInformation.BundleIdentifier) - : new LaunchDeviceExtensionArgument (AppInformation.LaunchAppPath, AppInformation.BundleIdentifier)); - break; - case Extension.WatchKit2: - default: - throw new NotImplementedException (); - } + throw new NotImplementedException ("Extensions aren't supported in xharness at the moment (no .NET extension tests yet)"); } else { args.Add (isSimulator ? (MlaunchArgument) new LaunchSimulatorAppArgument (AppInformation.LaunchAppPath) @@ -329,14 +307,12 @@ public async Task RunAsync () args.Add (new SetStdoutArgument (stdout_log)); args.Add (new SetStderrArgument (stderr_log)); - var simulators = new [] { simulator, companionSimulator }.Where (s => s is not null); + var simulators = new [] { simulator }; var systemLogs = new List (); foreach (var sim in simulators) { // Upload the system log MainLog.WriteLine ("System log for the '{1}' simulator is: {0}", sim.SystemLog, sim.Name); - bool isCompanion = sim != simulator; - - var logDescription = isCompanion ? LogType.CompanionSystemLog.ToString () : LogType.SystemLog.ToString (); + var logDescription = LogType.SystemLog.ToString (); var log = captureLogFactory.Create ( Path.Combine (Logs.Directory, sim.Name + ".log"), sim.SystemLog, @@ -393,12 +369,7 @@ public async Task RunAsync () } else { MainLog.WriteLine ("*** Executing {0}/{1} on device '{2}' ***", AppInformation.AppName, runMode, deviceName); - if (runMode == RunMode.WatchOS) { - args.Add (new AttachNativeDebuggerArgument ()); // this prevents the watch from backgrounding the app. - } else { - args.Add (new WaitForExitArgument ()); - } - + args.Add (new WaitForExitArgument ()); args.Add (new DeviceNameArgument (deviceName)); var deviceSystemLog = Logs.Create ($"device-{deviceName}-{Harness.Helpers.Timestamp}.log", "Device log"); diff --git a/tests/xharness/Harness.cs b/tests/xharness/Harness.cs index ffcba7d2e4c3..4706bf66aa50 100644 --- a/tests/xharness/Harness.cs +++ b/tests/xharness/Harness.cs @@ -15,14 +15,12 @@ using Microsoft.DotNet.XHarness.iOS.Shared.Listeners; using Microsoft.DotNet.XHarness.iOS.Shared.Logging; using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; -using Xharness.Targets; using Xamarin.Utils; namespace Xharness { public enum HarnessAction { None, - Configure, Run, Install, Uninstall, @@ -48,8 +46,6 @@ public class HarnessConfiguration { public double TimeoutInMinutes { get; set; } = 15; public bool UseSystemXamarinIOSMac { get; set; } public int Verbosity { get; set; } - public string WatchOSAppTemplate { get; set; } - public string WatchOSContainerTemplate { get; set; } public XmlResultJargon XmlJargon { get; set; } = XmlResultJargon.NUnitV3; // This is the maccore/tests directory. @@ -157,9 +153,6 @@ bool TryGetMlaunchDotnetPath (out string value) { value = null; - if (!ENABLE_DOTNET) - return false; - ApplePlatform platform; if (INCLUDE_IOS) { platform = ApplePlatform.iOS; @@ -185,9 +178,6 @@ string MlaunchPath { if (TryGetMlaunchDotnetPath (out var mlaunch)) return mlaunch; - if (INCLUDE_XAMARIN_LEGACY && (INCLUDE_IOS || INCLUDE_TVOS || INCLUDE_WATCH)) - return Path.Combine (IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current", "bin", "mlaunch"); - return $"Not building any mobile platform, so can't provide a location to mlaunch."; } } @@ -210,28 +200,14 @@ string GetVariable (string variable, string @default = null) public List IOSTestProjects { get; } public List MacTestProjects { get; } = new List (); - // Configure readonly bool useSystemXamarinIOSMac; // if the system XI/XM should be used, or the locally build XI/XM. readonly bool autoConf; - public string WatchOSContainerTemplate { get; private set; } - public string WatchOSAppTemplate { get; private set; } - public string WatchOSExtensionTemplate { get; private set; } - public string TodayContainerTemplate { get; private set; } - public string TodayExtensionTemplate { get; private set; } - public string MONO_PATH { get; } // Use same name as in Makefiles, so that a grep finds it. - public string TVOS_MONO_PATH { get; } // Use same name as in Makefiles, so that a grep finds it. public bool INCLUDE_IOS { get; } public bool INCLUDE_TVOS { get; } - public bool INCLUDE_WATCH { get; } public bool INCLUDE_MAC { get; } public bool INCLUDE_MACCATALYST { get; } public string JENKINS_RESULTS_DIRECTORY { get; } // Use same name as in Makefiles, so that a grep finds it. - public string MAC_DESTDIR { get; } - public string IOS_DESTDIR { get; } - public bool ENABLE_DOTNET { get; } - public bool INCLUDE_XAMARIN_LEGACY { get; } - public string SYSTEM_MONO { get; set; } public string DOTNET_DIR { get; set; } public string DOTNET_TFM { get; set; } @@ -279,8 +255,6 @@ public Harness (IResultParser resultParser, HarnessAction action, HarnessConfigu if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("TESTS_USE_SYSTEM"))) useSystemXamarinIOSMac = true; Verbosity = configuration.Verbosity; - WatchOSAppTemplate = configuration.WatchOSAppTemplate; - WatchOSContainerTemplate = configuration.WatchOSContainerTemplate; XmlJargon = configuration.XmlJargon; if (configuration.Labels is not null) @@ -294,20 +268,12 @@ public Harness (IResultParser resultParser, HarnessAction action, HarnessConfigu config = ParseConfigFiles (); var src_root = Path.GetDirectoryName (Path.GetFullPath (RootDirectory)); - MONO_PATH = Path.GetFullPath (Path.Combine (src_root, "external", "mono")); - TVOS_MONO_PATH = MONO_PATH; INCLUDE_IOS = IsVariableSet (nameof (INCLUDE_IOS)); INCLUDE_TVOS = IsVariableSet (nameof (INCLUDE_TVOS)); JENKINS_RESULTS_DIRECTORY = GetVariable (nameof (JENKINS_RESULTS_DIRECTORY)); - INCLUDE_WATCH = IsVariableSet (nameof (INCLUDE_WATCH)); INCLUDE_MAC = IsVariableSet (nameof (INCLUDE_MAC)); INCLUDE_MACCATALYST = IsVariableSet (nameof (INCLUDE_MACCATALYST)); - MAC_DESTDIR = GetVariable (nameof (MAC_DESTDIR)); - IOS_DESTDIR = GetVariable (nameof (IOS_DESTDIR)); - ENABLE_DOTNET = IsVariableSet (nameof (ENABLE_DOTNET)); - SYSTEM_MONO = GetVariable (nameof (SYSTEM_MONO)); DOTNET_DIR = GetVariable (nameof (DOTNET_DIR)); - INCLUDE_XAMARIN_LEGACY = IsVariableSet (nameof (INCLUDE_XAMARIN_LEGACY)); DOTNET_TFM = GetVariable (nameof (DOTNET_TFM)); if (string.IsNullOrEmpty (SdkRoot)) @@ -328,9 +294,6 @@ public bool GetIncludeSystemPermissionTests (TestPlatform platform, bool device) switch (platform) { case TestPlatform.iOS: case TestPlatform.Mac: - case TestPlatform.Mac_Full: - case TestPlatform.Mac_Modern: - case TestPlatform.Mac_System: // On macOS we can't edit the TCC database easily // (it requires adding the mac has to be using MDM: https://carlashley.com/2018/09/28/tcc-round-up/) // So by default ignore any tests that would pop up permission dialogs in CI. @@ -393,7 +356,6 @@ void AutoConfigureDotNet () }; // If .NET is not enabled, then ignore, otherwise leave undecided for other code to determine. - bool? dotnetIgnored = ENABLE_DOTNET ? null : (bool?) true; foreach (var projectInfo in projects) { var projectPath = projectInfo.ProjectPath; var projectName = Path.GetFileName (projectPath); @@ -405,11 +367,8 @@ void AutoConfigureDotNet () IsDotNetProject = true, SkipiOSVariation = false, SkiptvOSVariation = true, - SkipwatchOSVariation = true, - SkipTodayExtensionVariation = true, SkipDeviceVariations = false, - TestPlatform = TestPlatform.iOS_Unified, - Ignore = dotnetIgnored, + TestPlatform = TestPlatform.iOS, Configurations = projectInfo.Configurations, }); } @@ -420,12 +379,9 @@ void AutoConfigureDotNet () IsDotNetProject = true, SkipiOSVariation = true, SkiptvOSVariation = true, - SkipwatchOSVariation = true, - SkipTodayExtensionVariation = true, SkipDeviceVariations = false, GenerateVariations = false, TestPlatform = TestPlatform.tvOS, - Ignore = dotnetIgnored, Configurations = projectInfo.Configurations, }); } @@ -435,8 +391,6 @@ void AutoConfigureDotNet () Name = projectName, IsDotNetProject = true, TargetFrameworkFlavors = MacFlavors.DotNet, - Platform = "AnyCPU", - Ignore = dotnetIgnored, TestPlatform = TestPlatform.Mac, Configurations = projectInfo.Configurations, }); @@ -447,8 +401,6 @@ void AutoConfigureDotNet () Name = projectName, IsDotNetProject = true, TargetFrameworkFlavors = MacFlavors.MacCatalyst, - Platform = "AnyCPU", - Ignore = dotnetIgnored, TestPlatform = TestPlatform.MacCatalyst, Configurations = projectInfo.Configurations, }); @@ -456,152 +408,6 @@ void AutoConfigureDotNet () } } - int AutoConfigureMac (bool generate_projects) - { - int rv = 0; - - var test_suites = new [] { - new { Label = TestLabel.Linker, Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", Flavors = MacFlavors.Modern | MacFlavors.Full | MacFlavors.System }, - }; - foreach (var p in test_suites) { - MacTestProjects.Add (new MacTestProject (p.Label, Path.GetFullPath (Path.Combine (RootDirectory, p.Directory, p.ProjectFile + ".csproj"))) { - Name = p.Name, - TargetFrameworkFlavors = p.Flavors, - }); - } - - MacTestProjects.Add (new MacTestProject (TestLabel.Introspection, Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "introspection" }); - MacTestProjects.Add (new MacTestProject (TestLabel.Framework, Path.GetFullPath (Path.Combine (RootDirectory, "framework-test", "macOS", "framework-test-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "framework-test" }); - MacTestProjects.Add (new MacTestProject (TestLabel.Xcframework, Path.GetFullPath (Path.Combine (RootDirectory, "xcframework-test", "macOS", "xcframework-test-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "xcframework-test" }); - - var hard_coded_test_suites = new [] { - new { Label = TestLabel.Mmp, Directory = "mmptest", ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[]) null, Platform = "x86", Flavors = MacFlavors.Console, }, - new { Label = TestLabel.Xammac, Directory = "xammac_tests", ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "AnyCPU", Flavors = MacFlavors.Modern, }, - new { Label = TestLabel.Linker, Directory = "linker/mac/link all", ProjectFile = "link all-mac", Name = "link all", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, }, - new { Label = TestLabel.Linker, Directory = "linker/mac/link sdk", ProjectFile = "link sdk-mac", Name = "link sdk", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, }, - }; - foreach (var p in hard_coded_test_suites) { - MacTestProjects.Add (new MacTestProject (p.Label, Path.GetFullPath (Path.Combine (RootDirectory, p.Directory, p.ProjectFile + ".csproj")), targetFrameworkFlavor: p.Flavors) { - Name = p.Name, - IsNUnitProject = p.IsNUnit, - SolutionPath = Path.GetFullPath (Path.Combine (RootDirectory, "tests-mac.sln")), - Configurations = p.Configurations, - Platform = p.Platform, - Ignore = !INCLUDE_XAMARIN_LEGACY, - }); - } - - - // All test projects should be either Modern projects or NUnit/console executables at this point. - // If we need to generate Full/System variations, we do that here. - var unified_targets = new List (); - - Action configureTarget = (MacTarget target, string file, bool isNUnitProject, bool skip_generation) => { - target.TemplateProjectPath = file; - target.Harness = this; - target.IsNUnitProject = isNUnitProject; - if (!generate_projects || skip_generation) - target.ShouldSkipProjectGeneration = true; - target.Execute (); - }; - - foreach (var proj in MacTestProjects) { - var target = new MacTarget (MacFlavors.Modern); - configureTarget (target, proj.Path, proj.IsNUnitProject, true); - unified_targets.Add (target); - } - - foreach (var proj in MacTestProjects.Where ((v) => v.GenerateVariations).ToArray ()) { - var file = proj.Path; - if (!File.Exists (file)) { - Console.WriteLine ($"Can't find the project file {file}."); - rv = 1; - continue; - } - - // Generate variations if requested - if (proj.GenerateFull) { - var target = new MacTarget (MacFlavors.Full); - configureTarget (target, file, proj.IsNUnitProject, false); - unified_targets.Add (target); - - var cloned_project = (MacTestProject) proj.Clone (); - cloned_project.TargetFrameworkFlavors = MacFlavors.Full; - cloned_project.Path = target.ProjectPath; - MacTestProjects.Add (cloned_project); - } - - if (proj.GenerateSystem) { - var target = new MacTarget (MacFlavors.System); - configureTarget (target, file, proj.IsNUnitProject, false); - unified_targets.Add (target); - - var cloned_project = (MacTestProject) proj.Clone (); - cloned_project.TargetFrameworkFlavors = MacFlavors.System; - cloned_project.Path = target.ProjectPath; - MacTestProjects.Add (cloned_project); - } - - // We're done generating now - // Re-use the existing TestProject instance instead of creating a new one. - proj.TargetFrameworkFlavors = MacFlavors.Modern; // the default/template flavor is 'Modern' - } - - return rv; - } - - void AutoConfigureIOS () - { - var library_projects = new string [] { "BundledResources", "EmbeddedResources", "bindings-test2" }; - var fsharp_test_suites = new string [] { "fsharp" }; - var fsharp_library_projects = new string [] { "fsharplibrary" }; - - IOSTestProjects.Add (new iOSTestProject (TestLabel.Monotouch, Path.GetFullPath (Path.Combine (RootDirectory, "monotouch-test", "monotouch-test.csproj"))) { - Name = "monotouch-test", - }); - - foreach (var p in fsharp_test_suites) - IOSTestProjects.Add (new iOSTestProject (TestLabel.Fsharp, Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj"))) { Name = p }); - foreach (var p in library_projects) - IOSTestProjects.Add (new iOSTestProject (TestLabel.LibraryProjects, Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".csproj")), false) { Name = p }); - foreach (var p in fsharp_library_projects) - IOSTestProjects.Add (new iOSTestProject (TestLabel.Fsharp, Path.GetFullPath (Path.Combine (RootDirectory, p + "/" + p + ".fsproj")), false) { Name = p }); - - IOSTestProjects.Add (new iOSTestProject (TestLabel.BindingFramework, Path.GetFullPath (Path.Combine (RootDirectory, "bindings-framework-test", "iOS", "bindings-framework-test.csproj")), false) { - Name = "bindings-framework-test", - }); - IOSTestProjects.Add (new iOSTestProject (TestLabel.BindingsXcframework, Path.GetFullPath (Path.Combine (RootDirectory, "bindings-xcframework-test", "iOS", "bindings-xcframework-test.csproj")), false) { - Name = "bindings-xcframework-test", - }); - IOSTestProjects.Add (new iOSTestProject (TestLabel.Framework, Path.GetFullPath (Path.Combine (RootDirectory, "framework-test", "iOS", "framework-test-ios.csproj"))) { - Name = "framework-test", - }); - IOSTestProjects.Add (new iOSTestProject (TestLabel.Xcframework, Path.GetFullPath (Path.Combine (RootDirectory, "xcframework-test", "iOS", "xcframework-test-ios.csproj"))) { - Name = "xcframework-test", - }); - - IOSTestProjects.Add (new iOSTestProject (TestLabel.Binding, Path.GetFullPath (Path.Combine (RootDirectory, "bindings-test", "iOS", "bindings-test.csproj")), false) { Name = "bindings-test" }); - - IOSTestProjects.Add (new iOSTestProject (TestLabel.InterdependentBindingProjects, Path.GetFullPath (Path.Combine (RootDirectory, "interdependent-binding-projects", "interdependent-binding-projects.csproj"))) { Name = "interdependent-binding-projects" }); - IOSTestProjects.Add (new iOSTestProject (TestLabel.Linker, Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "dont link", "dont link.csproj"))) { - Configurations = new string [] { "Debug", "Release" }, - }); - IOSTestProjects.Add (new iOSTestProject (TestLabel.Linker, Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link all", "link all.csproj"))) { - Configurations = new string [] { "Debug", "Release" }, - }); - IOSTestProjects.Add (new iOSTestProject (TestLabel.Linker, Path.GetFullPath (Path.Combine (RootDirectory, "linker", "ios", "link sdk", "link sdk.csproj"))) { - Configurations = new string [] { "Debug", "Release" }, - }); - - // add all the tests that are using the precompiled mono assemblies - WatchOSContainerTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "templates/WatchContainer")); - WatchOSAppTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "templates/WatchApp")); - WatchOSExtensionTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "templates/WatchExtension")); - - TodayContainerTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "templates", "TodayContainer")); - TodayExtensionTemplate = Path.GetFullPath (Path.Combine (RootDirectory, "templates", "TodayExtension")); - } - // Dictionary make_config = new Dictionary (); IEnumerable FindConfigFiles (string name) { @@ -648,92 +454,6 @@ void ParseConfigFile (string file, Dictionary configuration) } } - int Configure () - { - var rv = AutoConfigureMac (true); - if (rv != 0) - return rv; - return ConfigureIOS (); - } - - // At startup we: - // * Load a list of well-known test projects IOSTestProjects/MacTestProjects. This happens in AutoConfigureIOS/AutoConfigureMac. - // Example projects: - // * introspection - // * dont link, link all, link sdk - // * Each of these test projects can used to generate other platform variations (tvOS, watchOS, macOS full, etc), - // if the the TestProject.GenerateVariations property is true. - - int ConfigureIOS () - { - var rv = 0; - var unified_targets = new List (); - var tvos_targets = new List (); - var watchos_targets = new List (); - var today_targets = new List (); - - if (autoConf) - AutoConfigureIOS (); - - foreach (var proj in IOSTestProjects.Where ((v) => v.GenerateVariations)) { - var file = proj.Path; - - if (!File.Exists (file)) { - Console.WriteLine ($"Can't find the project file {file}."); - rv = 1; - continue; - } - - if (!proj.SkipwatchOSVariation) { - var watchos = new WatchOSTarget () { - TemplateProjectPath = file, - Harness = this, - TestProject = proj, - }; - watchos.Execute (); - watchos_targets.Add (watchos); - } - - if (!proj.SkiptvOSVariation) { - var tvos = new TVOSTarget () { - TemplateProjectPath = file, - Harness = this, - TestProject = proj, - }; - tvos.Execute (); - tvos_targets.Add (tvos); - } - - if (!proj.SkipiOSVariation) { - var unified = new UnifiedTarget () { - TemplateProjectPath = file, - Harness = this, - TestProject = proj, - ShouldSkipProjectGeneration = proj.IsDotNetProject, - }; - unified.Execute (); - unified_targets.Add (unified); - - if (!proj.SkipTodayExtensionVariation) { - var today = new TodayExtensionTarget { - TemplateProjectPath = file, - Harness = this, - TestProject = proj, - ShouldSkipProjectGeneration = proj.IsDotNetProject, - }; - today.Execute (); - today_targets.Add (today); - } - } - } - - SolutionGenerator.CreateSolution (this, watchos_targets, "watchos", DevicePlatform.watchOS); - SolutionGenerator.CreateSolution (this, tvos_targets, "tvos", DevicePlatform.tvOS); - SolutionGenerator.CreateSolution (this, today_targets, "today", DevicePlatform.iOS); - - return rv; - } - int Install () { HarnessLog ??= GetAdHocLog (); @@ -825,8 +545,6 @@ public string VSDropsUri { public int Execute () { switch (Action) { - case HarnessAction.Configure: - return Configure (); case HarnessAction.Run: return Run (); case HarnessAction.Install: @@ -844,8 +562,6 @@ int Jenkins () { if (autoConf) { AutoConfigureDotNet (); - AutoConfigureIOS (); - AutoConfigureMac (false); } var jenkins = new Jenkins.Jenkins (this, processManager, ResultParser, TunnelBore); @@ -871,16 +587,6 @@ public void Save (StringWriter doc, string path) } } - bool? disable_watchos_on_wrench; - - public bool DisableWatchOSOnWrench { - get { - if (!disable_watchos_on_wrench.HasValue) - disable_watchos_on_wrench = !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("DISABLE_WATCH_ON_WRENCH")); - return disable_watchos_on_wrench.Value; - } - } - AppRunner CreateAppRunner (TestProject project) { var rv = new AppRunner (processManager, diff --git a/tests/xharness/IAppBundleInformationParserExtensions.cs b/tests/xharness/IAppBundleInformationParserExtensions.cs index c462cf405dbe..ac25d71c2157 100644 --- a/tests/xharness/IAppBundleInformationParserExtensions.cs +++ b/tests/xharness/IAppBundleInformationParserExtensions.cs @@ -5,8 +5,6 @@ using System.IO; using System.Xml; -using Xharness.Targets; - #nullable enable namespace Xharness { @@ -56,9 +54,7 @@ public async static Task ParseFromProject2 (this IAppBundl if (!Directory.Exists (appPath)) throw new DirectoryNotFoundException ($"The app bundle directory `{appPath}` does not exist"); - var launchAppPath = target.ToRunMode () == RunMode.WatchOS - ? Directory.GetDirectories (Path.Combine (appPath, "Watch"), "*.app") [0] - : appPath; + var launchAppPath = appPath; return new AppBundleInformation ( appName, diff --git a/tests/xharness/IHarness.cs b/tests/xharness/IHarness.cs index b20f6a2f006e..caca1a62d07a 100644 --- a/tests/xharness/IHarness.cs +++ b/tests/xharness/IHarness.cs @@ -25,24 +25,11 @@ public interface IHarness { string XIBuildPath { get; } List IOSTestProjects { get; } List MacTestProjects { get; } - string WatchOSContainerTemplate { get; } - string WatchOSAppTemplate { get; } - string WatchOSExtensionTemplate { get; } - string TodayContainerTemplate { get; } - string TodayExtensionTemplate { get; } - string MONO_PATH { get; } - string TVOS_MONO_PATH { get; } bool INCLUDE_IOS { get; } bool INCLUDE_TVOS { get; } - bool INCLUDE_WATCH { get; } bool INCLUDE_MAC { get; } bool INCLUDE_MACCATALYST { get; } string JENKINS_RESULTS_DIRECTORY { get; } - string MAC_DESTDIR { get; } - string IOS_DESTDIR { get; } - bool ENABLE_DOTNET { get; } - bool INCLUDE_XAMARIN_LEGACY { get; } - string SYSTEM_MONO { get; set; } string DOTNET_DIR { get; set; } string DOTNET_TFM { get; } string XcodeRoot { get; } @@ -60,7 +47,6 @@ public interface IHarness { bool InCI { get; } bool UseTcpTunnel { get; } string VSDropsUri { get; } - bool DisableWatchOSOnWrench { get; } #endregion diff --git a/tests/xharness/Jenkins/Jenkins.cs b/tests/xharness/Jenkins/Jenkins.cs index 1cbb0b369728..5661bc2b907a 100644 --- a/tests/xharness/Jenkins/Jenkins.cs +++ b/tests/xharness/Jenkins/Jenkins.cs @@ -106,11 +106,6 @@ public bool IsIncluded (TestProject project) return false; } - if (!project.IsDotNetProject && !TestSelection.IsEnabled (PlatformLabel.LegacyXamarin)) { - MainLog.WriteLine ($"Ignoring {project.Name} with label {project.Label} because it's a legacy Xamarin project and legacy Xamarin projects are not included."); - return false; - } - var rv = TestSelection.IsEnabled (project.Label); MainLog.WriteLine ($"Including {project.Name} with label {project.Label.ToString ()}: {rv}"); return rv; @@ -145,8 +140,7 @@ Task PopulateTasksAsync () // all factories are enumerators \o/ var testFactories = new IEnumerable [] { new MacTestTasksEnumerable (this, processManager, crashReportSnapshotFactory, testVariationsFactory), - new NUnitTestTasksEnumerable (this, processManager), - new MakeTestTaskEnumerable (this, processManager) + new NUnitTestTasksEnumerable (this, processManager) }; // add all tests defined by the factory @@ -193,6 +187,42 @@ Task PopulateTasksAsync () }; Tasks.Add (runDotNetGenerator); + var buildDotNetRoslynGeneratorProject = new TestProject (TestLabel.Generator, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "rgen", "Microsoft.Macios.Generator.Tests", "Microsoft.Macios.Generator.Tests.csproj"))) { + IsDotNetProject = true, + }; + var buildDotNetRoslynGenerator = new MSBuildTask (jenkins: this, testProject: buildDotNetRoslynGeneratorProject, processManager: processManager) { + TestProject = buildDotNetRoslynGeneratorProject, + SpecifyPlatform = false, + SpecifyConfiguration = false, + Platform = TestPlatform.iOS, + }; + var runDotNetRoslynGenerator = new DotNetTestTask (this, buildDotNetRoslynGenerator, processManager) { + TestProject = buildDotNetRoslynGeneratorProject, + Platform = TestPlatform.iOS, + TestName = "Roslyn Generator tests", + Mode = ".NET", + Ignored = !TestSelection.IsEnabled (TestLabel.Generator) || !TestSelection.IsEnabled (PlatformLabel.Dotnet), + }; + Tasks.Add (runDotNetRoslynGenerator); + + var buildDotNetRoslynAnalyzerProject = new TestProject (TestLabel.Generator, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "rgen", "Microsoft.Macios.Bindings.Analyzer.Tests", "Microsoft.Macios.Bindings.Analyzer.Tests.csproj"))) { + IsDotNetProject = true, + }; + var buildDotNetRoslynAnalyzer = new MSBuildTask (jenkins: this, testProject: buildDotNetRoslynAnalyzerProject, processManager: processManager) { + TestProject = buildDotNetRoslynAnalyzerProject, + SpecifyPlatform = false, + SpecifyConfiguration = false, + Platform = TestPlatform.iOS, + }; + var runDotNetRoslynAnalyzer = new DotNetTestTask (this, buildDotNetRoslynAnalyzer, processManager) { + TestProject = buildDotNetRoslynAnalyzerProject, + Platform = TestPlatform.iOS, + TestName = "Roslyn Analyzer tests", + Mode = ".NET", + Ignored = !TestSelection.IsEnabled (TestLabel.Generator) || !TestSelection.IsEnabled (PlatformLabel.Dotnet), + }; + Tasks.Add (runDotNetRoslynAnalyzer); + var buildDotNetTestsProject = new TestProject (TestLabel.DotnetTest, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "dotnet", "UnitTests", "DotNetUnitTests.csproj"))) { IsDotNetProject = true, }; diff --git a/tests/xharness/Jenkins/JenkinsDeviceLoader.cs b/tests/xharness/Jenkins/JenkinsDeviceLoader.cs index 4472356efe71..107b8d67c65e 100644 --- a/tests/xharness/Jenkins/JenkinsDeviceLoader.cs +++ b/tests/xharness/Jenkins/JenkinsDeviceLoader.cs @@ -31,18 +31,12 @@ public JenkinsDeviceLoader (ISimulatorLoader simulators, IHardwareDeviceLoader d static string BuildDevicesDescription (IHardwareDeviceLoader deviceLoader, string name) { var devicesTypes = new StringBuilder (); - if (deviceLoader.Connected32BitIOS.Any ()) { - devicesTypes.Append ("iOS 32 bit"); - } if (deviceLoader.Connected64BitIOS.Any ()) { - devicesTypes.Append (devicesTypes.Length == 0 ? "iOS 64 bit" : ", iOS 64 bit"); + devicesTypes.Append (devicesTypes.Length == 0 ? "iOS" : ", iOS"); } if (deviceLoader.ConnectedTV.Any ()) { devicesTypes.Append (devicesTypes.Length == 0 ? "tvOS" : ", tvOS"); } - if (deviceLoader.ConnectedWatch.Any ()) { - devicesTypes.Append (devicesTypes.Length == 0 ? "watchOS" : ", watchOS"); - } return (devicesTypes.Length == 0) ? $"{name} Listing (ok - no devices found)." : $"{name} Listing (ok). Devices types are: {devicesTypes}"; } diff --git a/tests/xharness/Jenkins/MacTestTasksEnumerable.cs b/tests/xharness/Jenkins/MacTestTasksEnumerable.cs index ce7898c4dc6c..f8df3ce234a4 100644 --- a/tests/xharness/Jenkins/MacTestTasksEnumerable.cs +++ b/tests/xharness/Jenkins/MacTestTasksEnumerable.cs @@ -75,9 +75,6 @@ public IEnumerator GetEnumerator () if (project.Ignore == true) ignored = true; - if (!jenkins.TestSelection.IsEnabled (TestLabel.Mmp) && project.Path.Contains ("mmptest")) - ignored = true; - if (!jenkins.IsIncluded (project)) ignored = true; @@ -91,7 +88,6 @@ public IEnumerator GetEnumerator () build.Platform = platform; build.CloneTestProject (jenkins.MainLog, processManager, project, HarnessConfiguration.RootDirectory); build.ProjectConfiguration = config; - build.ProjectPlatform = project.Platform; build.SpecifyPlatform = false; build.SpecifyConfiguration = build.ProjectConfiguration != "Debug"; build.Dependency = project.Dependency; diff --git a/tests/xharness/Jenkins/MakeTestTaskEnumerable.cs b/tests/xharness/Jenkins/MakeTestTaskEnumerable.cs deleted file mode 100644 index 4cc64229f87e..000000000000 --- a/tests/xharness/Jenkins/MakeTestTaskEnumerable.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using Microsoft.DotNet.XHarness.Common.Execution; -using Xharness.Jenkins.TestTasks; - -namespace Xharness.Jenkins { - class MakeTestTaskEnumerable : IEnumerable { - - readonly Jenkins jenkins; - readonly IProcessManager processManager; - - public MakeTestTaskEnumerable (Jenkins jenkins, IProcessManager processManager) - { - this.jenkins = jenkins ?? throw new ArgumentNullException (nameof (jenkins)); - this.processManager = processManager ?? throw new ArgumentNullException (nameof (processManager)); - } - - public IEnumerator GetEnumerator () - { - var run_mmp = new MakeTask (jenkins: jenkins, processManager: processManager) { - Platform = TestPlatform.Mac, - TestName = "MMP Regression Tests", - Target = "all", // -j" + Environment.ProcessorCount, - WorkingDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "mmp-regression"), - Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Mmp) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac), - Timeout = TimeSpan.FromMinutes (30), - SupportsParallelExecution = false, // Already doing parallel execution by running "make -jX" - }; - run_mmp.CompletedTask = new Task (() => { - foreach (var log in Directory.GetFiles (Path.GetFullPath (run_mmp.WorkingDirectory), "*.log", SearchOption.AllDirectories)) - run_mmp.Logs.AddFile (log, log.Substring (run_mmp.WorkingDirectory.Length + 1)); - }); - run_mmp.Environment.Add ("BUILD_REVISION", "jenkins"); // This will print "@MonkeyWrench: AddFile: " lines, which we can use to get the log filenames. - yield return run_mmp; - - var runMacBindingProject = new MakeTask (jenkins: jenkins, processManager: processManager) { - Platform = TestPlatform.Mac, - TestName = "Mac Binding Projects", - Target = "all", - WorkingDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "mac-binding-project"), - Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.MacBindingProject) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) || !jenkins.TestSelection.IsEnabled (PlatformLabel.LegacyXamarin), - Timeout = TimeSpan.FromMinutes (15), - }; - yield return runMacBindingProject; - } - - IEnumerator IEnumerable.GetEnumerator () => GetEnumerator (); - } -} diff --git a/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs b/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs index bc991bce25c2..7fdc30573980 100644 --- a/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs +++ b/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs @@ -22,9 +22,7 @@ public IEnumerator GetEnumerator () var msbuildTasksTestsProject = new TestProject (TestLabel.Msbuild, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tasks.Tests", "Xamarin.MacDev.Tasks.Tests.csproj"))) { IsDotNetProject = true, }; - var env = new Dictionary - { - { "SYSTEM_MONO", this.jenkins.Harness.SYSTEM_MONO }, + var env = new Dictionary { }; var buildiOSMSBuild = new MSBuildTask (jenkins: jenkins, testProject: msbuildTasksTestsProject, processManager: processManager) { SpecifyPlatform = false, @@ -67,44 +65,6 @@ public IEnumerator GetEnumerator () }; yield return nunitExecutioniOSMSBuildIntegration; - var buildMTouch = new MakeTask (jenkins: jenkins, processManager: processManager) { - TestProject = new TestProject (TestLabel.Mtouch, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "mtouchtests.sln"))), - SpecifyPlatform = false, - SpecifyConfiguration = false, - Platform = TestPlatform.iOS, - Target = "dependencies", - WorkingDirectory = Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "mtouch")), - }; - var nunitExecutionMTouch = new NUnitExecuteTask (jenkins, buildMTouch, processManager) { - TestLibrary = Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "bin", "Debug", "mtouchtests.dll"), - TestProject = new TestProject (TestLabel.Mtouch, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "mtouch", "mtouchtests.csproj"))), - Platform = TestPlatform.iOS, - TestName = "MTouch tests", - Timeout = TimeSpan.FromMinutes (180), - Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Mtouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.iOS), - InProcess = true, - }; - yield return nunitExecutionMTouch; - - var buildGenerator = new MakeTask (jenkins: jenkins, processManager: processManager) { - TestProject = new TestProject (TestLabel.Generator, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "..", "src", "generator.sln"))), - SpecifyPlatform = false, - SpecifyConfiguration = false, - Platform = TestPlatform.iOS, - Target = "build-unit-tests", - WorkingDirectory = Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "generator")), - }; - var runGenerator = new NUnitExecuteTask (jenkins, buildGenerator, processManager) { - TestLibrary = Path.Combine (HarnessConfiguration.RootDirectory, "generator", "bin", "Debug", "generator-tests.dll"), - TestProject = new TestProject (TestLabel.Generator, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "generator", "generator-tests.csproj"))), - Platform = TestPlatform.iOS, - TestName = "Generator tests", - Mode = "NUnit", - Timeout = TimeSpan.FromMinutes (10), - Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Generator) || !jenkins.Harness.INCLUDE_XAMARIN_LEGACY, - }; - yield return runGenerator; - var buildCecilTestsProject = new TestProject (TestLabel.Cecil, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "cecil-tests", "cecil-tests.csproj"))) { IsDotNetProject = true, }; diff --git a/tests/xharness/Jenkins/Reports/HtmlReportWriter.cs b/tests/xharness/Jenkins/Reports/HtmlReportWriter.cs index b044b13583d6..ace5e7b056a3 100644 --- a/tests/xharness/Jenkins/Reports/HtmlReportWriter.cs +++ b/tests/xharness/Jenkins/Reports/HtmlReportWriter.cs @@ -172,7 +172,6 @@ public void Write (IList allTasks, StreamWriter writer)
  • All simulator tests
  • All iOS tests
  • All tvOS tests
  • -
  • All watchOS tests
  • All Mac tests
  • @@ -183,7 +182,6 @@ public void Write (IList allTasks, StreamWriter writer)
  • All simulator tests
  • All iOS tests
  • All tvOS tests
  • -
  • All watchOS tests
  • All Mac tests
  • @@ -418,11 +416,7 @@ public void Write (IList allTasks, StreamWriter writer) writer.WriteLine ($"Time Elapsed: {test.TestName} - (waiting time : {test.WaitingDuration} , running time : {test.Duration})
    "); var runDeviceTest = runTest as RunDeviceTask; if (runDeviceTest?.Device is not null) { - if (runDeviceTest.CompanionDevice is not null) { - writer.WriteLine ($"Device: {runDeviceTest.Device.Name} ({runDeviceTest.CompanionDevice.Name})
    "); - } else { - writer.WriteLine ($"Device: {runDeviceTest.Device.Name}
    "); - } + writer.WriteLine ($"Device: {runDeviceTest.Device.Name}
    "); } } else { if (test.Duration.Ticks > 0) diff --git a/tests/xharness/Jenkins/RunDeviceTasksFactory.cs b/tests/xharness/Jenkins/RunDeviceTasksFactory.cs index 1c6611949938..32833f6e34c3 100644 --- a/tests/xharness/Jenkins/RunDeviceTasksFactory.cs +++ b/tests/xharness/Jenkins/RunDeviceTasksFactory.cs @@ -29,27 +29,21 @@ public Task> CreateAsync (Jenkins jenkins, IMlaunchProces projectTasks.Clear (); bool createiOS; - bool createTodayExtension; bool createtvOS; - bool createwatchOS; if (project.GenerateVariations) { createiOS = !project.SkipiOSVariation; - createTodayExtension = !project.SkipTodayExtensionVariation; createtvOS = !project.SkiptvOSVariation; - createwatchOS = !project.SkipwatchOSVariation; } else { - createiOS = project.TestPlatform == TestPlatform.iOS_Unified; - createTodayExtension = project.TestPlatform == TestPlatform.iOS_TodayExtension64; + createiOS = project.TestPlatform == TestPlatform.iOS; createtvOS = project.TestPlatform == TestPlatform.tvOS; - createwatchOS = project.TestPlatform == TestPlatform.watchOS; } if (createiOS) { var build64 = new MSBuildTask (jenkins: jenkins, testProject: project, processManager: processManager) { ProjectConfiguration = "Debug", ProjectPlatform = "iPhone", - Platform = TestPlatform.iOS_Unified64, + Platform = TestPlatform.iOS, TestName = project.Name, }; build64.CloneTestProject (jenkins.MainLog, processManager, project, HarnessConfiguration.RootDirectory); @@ -62,26 +56,6 @@ public Task> CreateAsync (Jenkins jenkins, IMlaunchProces errorKnowledgeBase: jenkins.ErrorKnowledgeBase, useTcpTunnel: jenkins.Harness.UseTcpTunnel, candidates: jenkins.Devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !jenkins.TestSelection.IsEnabled (PlatformLabel.iOS) }); - - if (createTodayExtension) { - var todayProject = project.GenerateVariations ? project.AsTodayExtensionProject () : project; - var buildToday = new MSBuildTask (jenkins: jenkins, testProject: todayProject, processManager: processManager) { - ProjectConfiguration = "Debug", - ProjectPlatform = "iPhone", - Platform = TestPlatform.iOS_TodayExtension64, - TestName = project.Name, - }; - buildToday.CloneTestProject (jenkins.MainLog, processManager, todayProject, HarnessConfiguration.RootDirectory); - projectTasks.Add (new RunDeviceTask ( - jenkins: jenkins, - devices: jenkins.Devices, - buildTask: buildToday, - processManager: processManager, - tunnelBore: jenkins.TunnelBore, - errorKnowledgeBase: jenkins.ErrorKnowledgeBase, - useTcpTunnel: jenkins.Harness.UseTcpTunnel, - candidates: jenkins.Devices.Connected64BitIOS.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !jenkins.TestSelection.IsEnabled (PlatformLabel.iOSExtension), BuildOnly = jenkins.ForceExtensionBuildOnly }); - } } if (createtvOS) { @@ -104,27 +78,6 @@ public Task> CreateAsync (Jenkins jenkins, IMlaunchProces candidates: jenkins.Devices.ConnectedTV.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !jenkins.TestSelection.IsEnabled (PlatformLabel.tvOS) }); } - if (createwatchOS) { - var watchOSProject = project.GenerateVariations ? project.AsWatchOSProject () : project; - if (!project.SkipwatchOSARM64_32Variation) { - var buildWatch64_32 = new MSBuildTask (jenkins: jenkins, testProject: watchOSProject, processManager: processManager) { - ProjectConfiguration = "Release", // We don't support Debug for ARM64_32 yet. - ProjectPlatform = "iPhone", - Platform = TestPlatform.watchOS_64_32, - TestName = project.Name, - }; - buildWatch64_32.CloneTestProject (jenkins.MainLog, processManager, watchOSProject, HarnessConfiguration.RootDirectory); - projectTasks.Add (new RunDeviceTask ( - jenkins: jenkins, - devices: jenkins.Devices, - buildTask: buildWatch64_32, - processManager: processManager, - tunnelBore: jenkins.TunnelBore, - errorKnowledgeBase: jenkins.ErrorKnowledgeBase, - useTcpTunnel: jenkins.Harness.UseTcpTunnel, - candidates: jenkins.Devices.ConnectedWatch32_64.Where (d => project.IsSupported (d.DevicePlatform, d.ProductVersion))) { Ignored = !jenkins.TestSelection.IsEnabled (PlatformLabel.watchOS) }); - } - } foreach (var task in projectTasks) { task.TimeoutMultiplier = project.TimeoutMultiplier; task.BuildOnly |= project.BuildOnly; diff --git a/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs b/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs index b0821bfb9aa2..6555f78cf291 100644 --- a/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs +++ b/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs @@ -29,11 +29,9 @@ public async Task> CreateAsync (Jenkins jenkins, IMlaunch ps.Add (new Tuple (project, project.TestPlatform, ignored)); } else { if (!project.SkipiOSVariation) - ps.Add (new Tuple (project, TestPlatform.iOS_Unified, ignored)); + ps.Add (new Tuple (project, TestPlatform.iOS, ignored)); if (!project.SkiptvOSVariation) ps.Add (new Tuple (project.AsTvOSProject (), TestPlatform.tvOS, ignored)); - if (!project.SkipwatchOSVariation) - ps.Add (new Tuple (project.AsWatchOSProject (), TestPlatform.watchOS, ignored)); } var configurations = project.Configurations; @@ -44,16 +42,12 @@ public async Task> CreateAsync (Jenkins jenkins, IMlaunch var configIgnored = pair.Item3; var testPlatform = pair.Item2; switch (testPlatform) { - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_TodayExtension64: + case TestPlatform.iOS: configIgnored |= !jenkins.TestSelection.IsEnabled (PlatformLabel.iOS); break; case TestPlatform.tvOS: configIgnored |= !jenkins.TestSelection.IsEnabled (PlatformLabel.tvOS); break; - case TestPlatform.watchOS: - configIgnored |= !jenkins.TestSelection.IsEnabled (PlatformLabel.watchOS); - break; default: Console.WriteLine ("Unknown test platform for ignore check: {0}", testPlatform); break; @@ -116,16 +110,8 @@ IEnumerable CreateAsync (Jenkins jenkins, IMlaunchProcessManag platforms = new TestPlatform [] { TestPlatform.tvOS }; ignored = new [] { false }; break; - case TestPlatform.watchOS: - platforms = new TestPlatform [] { TestPlatform.watchOS_32 }; - ignored = new [] { false }; - break; - case TestPlatform.iOS_Unified: - platforms = new TestPlatform [] { TestPlatform.iOS_Unified64 }; - ignored = new [] { false }; - break; - case TestPlatform.iOS_TodayExtension64: - platforms = new TestPlatform [] { TestPlatform.iOS_TodayExtension64 }; + case TestPlatform.iOS: + platforms = new TestPlatform [] { TestPlatform.iOS }; ignored = new [] { false }; break; default: diff --git a/tests/xharness/Jenkins/TestData.cs b/tests/xharness/Jenkins/TestData.cs index 423702dc0150..62606cf308eb 100644 --- a/tests/xharness/Jenkins/TestData.cs +++ b/tests/xharness/Jenkins/TestData.cs @@ -15,11 +15,9 @@ class TestData { public string Undefines; public bool? Ignored; public bool EnableSGenConc; - public bool UseThumb; public bool UseLlvm; public bool? UseMonoRuntime; public IEnumerable Candidates; - public string XamMacArch; public string RuntimeIdentifier; public string Registrar; public bool PublishAot; // NativeAOT diff --git a/tests/xharness/Jenkins/TestSelector.cs b/tests/xharness/Jenkins/TestSelector.cs index 632734ef94cf..2df4c53e1cf5 100644 --- a/tests/xharness/Jenkins/TestSelector.cs +++ b/tests/xharness/Jenkins/TestSelector.cs @@ -20,11 +20,9 @@ class TestSelection { PlatformLabel platform = PlatformLabel.None | PlatformLabel.tvOS | - PlatformLabel.watchOS | PlatformLabel.iOS | PlatformLabel.iOSSimulator | PlatformLabel.MacCatalyst | - PlatformLabel.LegacyXamarin | PlatformLabel.Dotnet; public bool ForceExtensionBuildOnly { get; set; } @@ -248,11 +246,6 @@ public void SelectTests (TestSelection selection) selection.SetEnabled (PlatformLabel.iOS, false); } - if (!Harness.INCLUDE_WATCH) { - MainLog?.WriteLine ("The watchOS build is disabled, so any watchOS tests will be disabled as well."); - selection.SetEnabled (PlatformLabel.watchOS, false); - } - if (!Harness.INCLUDE_TVOS) { MainLog?.WriteLine ("The tvOS build is disabled, so any tvOS tests will be disabled as well."); selection.SetEnabled (PlatformLabel.tvOS, false); @@ -268,20 +261,6 @@ public void SelectTests (TestSelection selection) selection.SetEnabled (PlatformLabel.MacCatalyst, false); } - if (!Harness.ENABLE_DOTNET) { - MainLog?.WriteLine ("The .NET build is disabled, so any .NET tests will be disabled as well."); - selection.SetEnabled (PlatformLabel.Dotnet, false); - } - - if (!Harness.INCLUDE_XAMARIN_LEGACY) { - MainLog?.WriteLine ("The legacy Xamarin build is disabled, so any legacy Xamarin tests will be disabled as well."); - selection.SetEnabled (PlatformLabel.LegacyXamarin, false); - selection.SetEnabled (PlatformLabel.watchOS, false); - selection.SetEnabled (TestLabel.Mmp, false); - selection.SetEnabled (TestLabel.Mtouch, false); - selection.SetEnabled (TestLabel.Xammac, false); - } - MainLog?.WriteLine ($"Final test selection: tests: {selection.SelectedTests} platforms: {selection.SelectedPlatforms}"); } } diff --git a/tests/xharness/Jenkins/TestServer.cs b/tests/xharness/Jenkins/TestServer.cs index 3b372eff3bae..3ae207a9a13f 100644 --- a/tests/xharness/Jenkins/TestServer.cs +++ b/tests/xharness/Jenkins/TestServer.cs @@ -153,10 +153,6 @@ IEnumerable find_tasks (StreamWriter writer, string ids) case "?all-ios": switch (task.Platform) { case TestPlatform.iOS: - case TestPlatform.iOS_TodayExtension64: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_Unified32: - case TestPlatform.iOS_Unified64: is_match = true; break; default: @@ -176,25 +172,9 @@ IEnumerable find_tasks (StreamWriter writer, string ids) break; } break; - case "?all-watchos": - switch (task.Platform) { - case TestPlatform.watchOS: - case TestPlatform.watchOS_32: - case TestPlatform.watchOS_64_32: - is_match = true; - break; - default: - if (task.Platform.ToString ().StartsWith ("watchOS", StringComparison.Ordinal)) - throw new NotImplementedException (); - break; - } - break; case "?all-mac": switch (task.Platform) { case TestPlatform.Mac: - case TestPlatform.Mac_Modern: - case TestPlatform.Mac_Full: - case TestPlatform.Mac_System: is_match = true; break; default: diff --git a/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs b/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs index 31c1cea5b172..135558692cd1 100644 --- a/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs +++ b/tests/xharness/Jenkins/TestTasks/AppleTestTask.cs @@ -38,29 +38,12 @@ public override void SetEnvironmentVariables (Process process) switch (Platform) { case TestPlatform.iOS: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_Unified32: - case TestPlatform.iOS_Unified64: - case TestPlatform.iOS_TodayExtension64: case TestPlatform.tvOS: - 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"); - process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine (Jenkins.Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); break; case TestPlatform.Mac: - case TestPlatform.Mac_Modern: - case TestPlatform.Mac_Full: - case TestPlatform.Mac_System: process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot; - process.StartInfo.EnvironmentVariables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine (Jenkins.Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); - process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine (Jenkins.Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); - process.StartInfo.EnvironmentVariables ["XamarinMacFrameworkRoot"] = Path.Combine (Jenkins.Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); - process.StartInfo.EnvironmentVariables ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine (Jenkins.Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); break; case TestPlatform.All: // Don't set: @@ -69,9 +52,6 @@ public override void SetEnvironmentVariables (Process process) // because these values used by both XM and XI and we can't set it to two different values at the same time. // Any test that depends on these values should not be using 'TestPlatform.All' 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 ["XamarinMacFrameworkRoot"] = Path.Combine (Jenkins.Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); - process.StartInfo.EnvironmentVariables ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine (Jenkins.Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); break; default: throw new NotImplementedException ($"Unknown test platform: {Platform}"); diff --git a/tests/xharness/Jenkins/TestTasks/IRunXITask.cs b/tests/xharness/Jenkins/TestTasks/IRunXITask.cs index 2a4a512129e6..f2aab4b305d9 100644 --- a/tests/xharness/Jenkins/TestTasks/IRunXITask.cs +++ b/tests/xharness/Jenkins/TestTasks/IRunXITask.cs @@ -10,6 +10,5 @@ public interface IRunXITask : IRunTestTask where TDevice : class, IDevi TestTarget AppRunnerTarget { get; set; } IEnumerable Candidates { get; } TDevice Device { get; set; } - TDevice CompanionDevice { get; set; } } } diff --git a/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs b/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs index 785ce2e0e68d..16e1bd6ea469 100644 --- a/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MacExecuteTask.cs @@ -27,14 +27,6 @@ public MacExecuteTask (Jenkins jenkins, BuildToolTask build_task, IMlaunchProces public override bool SupportsParallelExecution { get { - if (TestName.Contains ("xammac")) { - // We run the xammac tests in both Debug and Release configurations. - // These tests are not written to support parallel execution - // (there are hard coded paths used for instance), so disable - // parallel execution for these tests. - return false; - } - return base.SupportsParallelExecution; } } @@ -52,17 +44,6 @@ public override async Task RunTestAsync () if (string.Equals ("mac", name, StringComparison.OrdinalIgnoreCase)) name = System.IO.Path.GetFileName (System.IO.Path.GetDirectoryName (projectDir)); var suffix = string.Empty; - switch (Platform) { - case TestPlatform.Mac_Modern: - suffix = "-modern"; - break; - case TestPlatform.Mac_Full: - suffix = "-full"; - break; - case TestPlatform.Mac_System: - suffix = "-system"; - break; - } if (ProjectFile.EndsWith (".sln", StringComparison.Ordinal)) { Path = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (ProjectFile), "bin", BuildTask.ProjectPlatform, BuildTask.ProjectConfiguration + suffix, name + ".app", "Contents", "MacOS", name); } else { diff --git a/tests/xharness/Jenkins/TestTasks/MacTask.cs b/tests/xharness/Jenkins/TestTasks/MacTask.cs index a7037c9d5652..3a51f44b5850 100644 --- a/tests/xharness/Jenkins/TestTasks/MacTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MacTask.cs @@ -12,13 +12,7 @@ public override string Mode { get { switch (Platform) { case TestPlatform.Mac: - return TestProject?.IsDotNetProject == true ? "Mac [dotnet]" : "Mac"; - case TestPlatform.Mac_Modern: - return "Mac Modern"; - case TestPlatform.Mac_Full: - return "Mac Full"; - case TestPlatform.Mac_System: - return "Mac System"; + return "Mac [dotnet]"; case TestPlatform.MacCatalyst: return "Mac Catalyst [dotnet]"; default: diff --git a/tests/xharness/Jenkins/TestTasks/RunDevice.cs b/tests/xharness/Jenkins/TestTasks/RunDevice.cs index 751eeb928ee0..dcf107c59dfb 100644 --- a/tests/xharness/Jenkins/TestTasks/RunDevice.cs +++ b/tests/xharness/Jenkins/TestTasks/RunDevice.cs @@ -58,22 +58,11 @@ public RunDevice (IRunDeviceTask testTask, switch (testTask.BuildTask.Platform) { case TestPlatform.iOS: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_Unified32: - case TestPlatform.iOS_Unified64: - testTask.AppRunnerTarget = TestTarget.Device_iOS; - break; - case TestPlatform.iOS_TodayExtension64: testTask.AppRunnerTarget = TestTarget.Device_iOS; break; case TestPlatform.tvOS: testTask.AppRunnerTarget = TestTarget.Device_tvOS; break; - case TestPlatform.watchOS: - case TestPlatform.watchOS_32: - case TestPlatform.watchOS_64_32: - testTask.AppRunnerTarget = TestTarget.Device_watchOS; - break; } } @@ -86,8 +75,6 @@ public async Task RunTestAsync () try { // Set the device we acquired. testTask.Device = testTask.Candidates.First ((d) => d.UDID == device_resource.Resource.Name); - if (testTask.Device.DevicePlatform == DevicePlatform.watchOS) - testTask.CompanionDevice = await devices.FindCompanionDevice (deviceLoadLog, testTask.Device); mainLog.WriteLine ("Acquired device '{0}' for '{1}'", testTask.Device.Name, testTask.ProjectFile); ITunnelBore tunnelBore = null; @@ -115,7 +102,6 @@ public async Task RunTestAsync () logs: new Logs (testTask.LogDirectory ?? defaultLogDirectory), buildConfiguration: testTask.ProjectConfiguration, deviceName: testTask.Device.Name, - companionDeviceName: testTask.CompanionDevice?.Name, timeoutMultiplier: testTask.TimeoutMultiplier, variation: testTask.Variation, buildTask: testTask.BuildTask); @@ -172,45 +158,7 @@ public async Task RunTestAsync () mainLog.WriteLine ($"Test run has a known failure: '{testTask.KnownFailure}'"); } - if (testTask.Runner.Result == TestExecutingResult.Succeeded && testTask.Platform == TestPlatform.iOS_TodayExtension64) { - // For the today extension, the main app is just a single test. - // This is because running the today extension will not wake up the device, - // nor will it close & reopen the today app (but launching the main app - // will do both of these things, preparing the device for launching the today extension). - - AppRunner todayRunner = new AppRunner (testTask.ProcessManager, - new AppBundleInformationParser (testTask.ProcessManager, testTask.Harness.AppBundleLocator), - new SimulatorLoaderFactory (testTask.ProcessManager), - new SimpleListenerFactory (tunnelBore), - new DeviceLoaderFactory (testTask.ProcessManager), - new CrashSnapshotReporterFactory (testTask.ProcessManager), - new CaptureLogFactory (), - new DeviceLogCapturerFactory (testTask.ProcessManager), - new TestReporterFactory (testTask.ProcessManager), - testTask.AppRunnerTarget, - testTask.Harness, - projectFilePath: testTask.ProjectFile, - mainLog: testTask.Logs.Create ($"extension-run-{testTask.Device.UDID}-{Harness.Helpers.Timestamp}.log", "Extension run log"), - logs: new Logs (testTask.LogDirectory ?? defaultLogDirectory), - buildConfiguration: testTask.ProjectConfiguration, - deviceName: testTask.Device.Name, - companionDeviceName: testTask.CompanionDevice?.Name, - timeoutMultiplier: testTask.TimeoutMultiplier, - variation: testTask.Variation, - buildTask: testTask.BuildTask); - await todayRunner.InitializeAsync (); - - testTask.AdditionalRunner = todayRunner; - await todayRunner.RunAsync (); - foreach (var log in todayRunner.Logs.Where ((v) => !v.Description.StartsWith ("Extension ", StringComparison.Ordinal))) - log.Description = "Extension " + log.Description [0].ToString ().ToLower () + log.Description.Substring (1); - testTask.ExecutionResult = todayRunner.Result; - - if (!string.IsNullOrEmpty (todayRunner.FailureMessage)) - testTask.FailureMessage = todayRunner.FailureMessage; - } else { - testTask.ExecutionResult = testTask.Runner.Result; - } + testTask.ExecutionResult = testTask.Runner.Result; } } finally { // Uninstall again, so that we don't leave junk behind and fill up the device. diff --git a/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs b/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs index 2ede0e1b8598..19788fbefd1c 100644 --- a/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs +++ b/tests/xharness/Jenkins/TestTasks/RunDeviceTask.cs @@ -18,14 +18,14 @@ public override string ProgressMessage { if (log is null) return base.ProgressMessage; - var percent_complete = log.CopyingApp ? log.AppPercentComplete : log.WatchAppPercentComplete; - var bytes = log.CopyingApp ? log.AppBytes : log.WatchAppBytes; - var total_bytes = log.CopyingApp ? log.AppTotalBytes : log.WatchAppTotalBytes; - var elapsed = log.CopyingApp ? log.AppCopyDuration : log.WatchAppCopyDuration; + var percent_complete = log.AppPercentComplete; + var bytes = log.AppBytes; + var total_bytes = log.AppTotalBytes; + var elapsed = log.AppCopyDuration; var speed_bps = elapsed.Ticks == 0 ? -1 : bytes / elapsed.TotalSeconds; var estimated_left = TimeSpan.FromSeconds ((total_bytes - bytes) / speed_bps); var transfer_percent = 100 * (double) bytes / total_bytes; - var str = log.CopyingApp ? "App" : "Watch App"; + var str = "App"; var rv = $"{str} installation: {percent_complete}% done.\n" + $"\tApp size: {total_bytes:N0} bytes ({total_bytes / 1024.0 / 1024.0:N2} MB)\n" + $"\tTransferred: {bytes:N0} bytes ({bytes / 1024.0 / 1024.0:N2} MB)\n" + diff --git a/tests/xharness/Jenkins/TestTasks/RunSimulator.cs b/tests/xharness/Jenkins/TestTasks/RunSimulator.cs index 802149ef7863..3ca44c032ae6 100644 --- a/tests/xharness/Jenkins/TestTasks/RunSimulator.cs +++ b/tests/xharness/Jenkins/TestTasks/RunSimulator.cs @@ -21,11 +21,10 @@ public class RunSimulator { public IEnumerable Simulators { get { - if (testTask.Device is null) return Array.Empty (); - else if (testTask.CompanionDevice is null) { - return new ISimulatorDevice [] { testTask.Device }; + if (testTask.Device is null) { + return Array.Empty (); } else { - return new ISimulatorDevice [] { testTask.Device, testTask.CompanionDevice }; + return new ISimulatorDevice [] { testTask.Device }; } } } @@ -43,9 +42,8 @@ public RunSimulator (IRunSimulatorTask testTask, this.simulatorLoadLog = simulatorLoadLog ?? throw new ArgumentNullException (nameof (simulatorLoadLog)); var project = Path.GetFileNameWithoutExtension (testTask.ProjectFile); - if (project.EndsWith ("-tvos", StringComparison.Ordinal)) testTask.AppRunnerTarget = TestTarget.Simulator_tvOS; - else if (project.EndsWith ("-watchos", StringComparison.Ordinal)) { - testTask.AppRunnerTarget = TestTarget.Simulator_watchOS; + if (project.EndsWith ("-tvos", StringComparison.Ordinal)) { + testTask.AppRunnerTarget = TestTarget.Simulator_tvOS; } else { testTask.AppRunnerTarget = TestTarget.Simulator_iOS64; } @@ -66,8 +64,6 @@ public async Task FindSimulatorAsync () testTask.FailureMessage = "No applicable devices found."; } else { testTask.Device = testTask.Candidates.First (); - if (testTask.Platform == TestPlatform.watchOS) - testTask.CompanionDevice = await simulators.FindCompanionDevice (simulatorLoadLog, testTask.Device); } } catch (Exception e) { testTask.ExecutionResult = TestExecutingResult.DeviceNotFound; @@ -87,7 +83,7 @@ public async Task SelectSimulatorAsync () await FindSimulatorAsync (); - var clean_state = false;//Platform == TestPlatform.watchOS; + var clean_state = false; testTask.Runner = new AppRunner (testTask.ProcessManager, new AppBundleInformationParser (testTask.ProcessManager, testTask.Harness.AppBundleLocator), new SimulatorLoaderFactory (testTask.ProcessManager), @@ -107,8 +103,7 @@ public async Task SelectSimulatorAsync () timeoutMultiplier: testTask.TimeoutMultiplier, variation: testTask.Variation, buildTask: testTask.BuildTask, - simulator: testTask.Device, - companionSimulator: testTask.CompanionDevice); + simulator: testTask.Device); await testTask.Runner.InitializeAsync (); } diff --git a/tests/xharness/Jenkins/TestTasks/RunXITask.cs b/tests/xharness/Jenkins/TestTasks/RunXITask.cs index a58db1ae76f5..24e1f513d10f 100644 --- a/tests/xharness/Jenkins/TestTasks/RunXITask.cs +++ b/tests/xharness/Jenkins/TestTasks/RunXITask.cs @@ -45,20 +45,9 @@ public override string Mode { switch (Platform) { 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: - return "iOS Unified 64-bits - " + XIMode; - case TestPlatform.iOS_TodayExtension64: - return "iOS Unified Today Extension 64-bits - " + XIMode; - case TestPlatform.iOS_Unified: - return "iOS Unified - " + XIMode; + case TestPlatform.iOS: + return "iOS - " + XIMode; default: throw new NotImplementedException (); } diff --git a/tests/xharness/Jenkins/TestTasks/TestTask.cs b/tests/xharness/Jenkins/TestTasks/TestTask.cs index 0aac8a450fc9..758dbb66ae08 100644 --- a/tests/xharness/Jenkins/TestTasks/TestTask.cs +++ b/tests/xharness/Jenkins/TestTasks/TestTask.cs @@ -142,20 +142,9 @@ public virtual string TestName { switch (Platform) { case TestPlatform.Mac: return rv; - case TestPlatform.Mac_Modern: - return rv;//.Substring (0, rv.Length - "-unified".Length); - case TestPlatform.Mac_Full: - return rv.Substring (0, rv.Length - "-full".Length); - case TestPlatform.Mac_System: - return rv.Substring (0, rv.Length - "-system".Length); default: - if (rv.EndsWith ("-watchos", StringComparison.Ordinal)) return rv.Substring (0, rv.Length - 8); - else if (rv.EndsWith ("-tvos", StringComparison.Ordinal)) { + if (rv.EndsWith ("-tvos", StringComparison.Ordinal)) { return rv.Substring (0, rv.Length - 5); - } else if (rv.EndsWith ("-unified", StringComparison.Ordinal)) { - return rv.Substring (0, rv.Length - 8); - } else if (rv.EndsWith ("-today", StringComparison.Ordinal)) { - return rv.Substring (0, rv.Length - 6); } else { return rv; } diff --git a/tests/xharness/Jenkins/TestVariationsFactory.cs b/tests/xharness/Jenkins/TestVariationsFactory.cs index 946116e9759e..3b8c2d1165a6 100644 --- a/tests/xharness/Jenkins/TestVariationsFactory.cs +++ b/tests/xharness/Jenkins/TestVariationsFactory.cs @@ -30,8 +30,8 @@ IEnumerable GetTestData (RunTestTask test) // This function returns additional test configurations (in addition to the default one) for the specific 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; + var supports_interpreter = true; + var supports_dynamic_registrar_on_device = true; var ignore = test.TestProject.Ignore; var mac_supports_arm64 = Harness.CanRunArm64; var arm64_runtime_identifier = string.Empty; @@ -49,8 +49,6 @@ IEnumerable GetTestData (RunTestTask test) x64_runtime_identifier = "maccatalyst-x64"; break; case TestPlatform.iOS: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_Unified64: arm64_sim_runtime_identifier = "iossimulator-arm64"; x64_sim_runtime_identifier = "iossimulator-x64"; break; @@ -62,22 +60,9 @@ IEnumerable GetTestData (RunTestTask test) switch (test.ProjectPlatform) { case "iPhone": - // arm64_32 is only supported for Release builds for now. - // arm32 bits too big for debug builds - https://github.com/xamarin/maccore/issues/2080 - var supports_debug = test.Platform != TestPlatform.watchOS_64_32 && !(test.TestName == "dont link" && test.Platform == TestPlatform.iOS_Unified32); - - /* we don't add --assembly-build-target=@all=staticobject because that's the default in all our test projects */ - if (supports_debug && !test.TestProject.IsDotNetProject) { - yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug)", AppBundleExtraOptions = $"--assembly-build-target=@all=dynamiclibrary", Debug = true, Profiling = false, Ignored = ignore }; - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = true, Profiling = false, Ignored = ignore }; - yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug, profiling)", AppBundleExtraOptions = $"--assembly-build-target=@all=dynamiclibrary", Debug = true, Profiling = true, Ignored = ignore }; - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (debug, profiling)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = true, Profiling = true, Ignored = ignore }; - } - + var supports_debug = true; if (test.ProjectConfiguration.Contains ("Debug")) yield return new TestData { Variation = "Release", Debug = false, Profiling = false }; - if (test.Platform == TestPlatform.iOS_Unified32 && !test.TestProject.IsDotNetProject) - yield return new TestData { Variation = "Release: UseThumb", Debug = false, Profiling = false, UseThumb = true }; // Disable this by default for tvOS/Release because the app ends up being too big (https://github.com/xamarin/maccore/issues/2282) var sdk_release_skip = test.Platform == TestPlatform.tvOS && test.TestName == "dont link"; @@ -125,9 +110,6 @@ IEnumerable GetTestData (RunTestTask test) } break; case "iPhoneSimulator": - if (test.Platform == TestPlatform.iOS_Unified32) - ignore = true; - switch (test.TestName) { case "monotouch-test": // The default is to run monotouch-test with the dynamic registrar (in the simulator), so that's already covered @@ -162,6 +144,8 @@ IEnumerable GetTestData (RunTestTask test) break; case "AnyCPU": case "x86": + case "": + case null: switch (test.TestName) { case "monotouch-test": if (test.TestProject.IsDotNetProject) { @@ -192,18 +176,6 @@ IEnumerable GetTestData (RunTestTask test) } } break; - case "xammac tests": - switch (test.ProjectConfiguration) { - case "Release": - yield return new TestData { Variation = "Release (all optimizations)", AppBundleExtraOptions = "--optimize:all", Registrar = "static", Debug = false, LinkMode = "Full", Defines = "OPTIMIZEALL" }; - yield return new TestData { Variation = "Release (ARM64)", XamMacArch = "ARM64", Debug = false, Ignored = !mac_supports_arm64 || !jenkins.TestSelection.IsEnabled (TestLabel.Xammac) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) }; - break; - case "Debug": - yield return new TestData { Variation = "Debug (all optimizations)", AppBundleExtraOptions = "--optimize:all,-remove-uithread-checks", Registrar = "static", Debug = true, LinkMode = "Full", Defines = "OPTIMIZEALL", Ignored = !(jenkins.TestSelection.IsEnabled (TestLabel.All) && jenkins.TestSelection.IsEnabled (PlatformLabel.Mac)) }; - yield return new TestData { Variation = "Debug (ARM64)", XamMacArch = "ARM64", Debug = true, Ignored = !mac_supports_arm64 || !jenkins.TestSelection.IsEnabled (TestLabel.Xammac) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) }; - break; - } - break; } break; default: @@ -236,7 +208,6 @@ public IEnumerable CreateTestVariations (IEnumerable tests, Func CreateTestVariations (IEnumerable tests, Func CreateTestVariations (IEnumerable tests, Func TestPlatform.Mac, - MacFlavors.Full => TestPlatform.Mac_Full, - MacFlavors.Modern => TestPlatform.Mac_Modern, - MacFlavors.System => TestPlatform.Mac_System, MacFlavors.DotNet => TestPlatform.Mac, MacFlavors.MacCatalyst => TestPlatform.MacCatalyst, - (MacFlavors.Full | MacFlavors.Modern) => (TestPlatform.Mac | TestPlatform.Mac_Modern), _ => throw new NotImplementedException (flavor.ToString ()), }; } diff --git a/tests/xharness/MacTestProject.cs b/tests/xharness/MacTestProject.cs index 6857d3d03076..5e9d78798d87 100644 --- a/tests/xharness/MacTestProject.cs +++ b/tests/xharness/MacTestProject.cs @@ -3,10 +3,7 @@ namespace Xharness { [Flags] public enum MacFlavors { - Modern = 1, // Xamarin.Mac/Modern app - Full = 2, // Xamarin.Mac/Full app - System = 4, // Xamarin.Mac/System app - Console = 8, // Console executable + None = 0, DotNet = 16, MacCatalyst = 32, } @@ -14,38 +11,29 @@ public enum MacFlavors { public class MacTestProject : TestProject { public MacFlavors TargetFrameworkFlavors; - public bool GenerateFull => GenerateVariations && (TargetFrameworkFlavors & MacFlavors.Full) == MacFlavors.Full; - public bool GenerateSystem => GenerateVariations && (TargetFrameworkFlavors & MacFlavors.System) == MacFlavors.System; - public override bool GenerateVariations { get { - if (IsDotNetProject) - return false; - - // If a bitwise combination of flavors, then we're generating variations - return TargetFrameworkFlavors != MacFlavors.Modern && TargetFrameworkFlavors != MacFlavors.Full && TargetFrameworkFlavors != MacFlavors.System && TargetFrameworkFlavors != MacFlavors.Console; + return false; } set { throw new Exception ("This value is read-only"); } } - public string Platform = "x86"; - - public MacTestProject (TestLabel label, string path, bool isExecutableProject = true, MacFlavors targetFrameworkFlavor = MacFlavors.Full | MacFlavors.Modern) : base (label, path, isExecutableProject) + public MacTestProject (TestLabel label, string path) + : base (label, path, true) { - TargetFrameworkFlavors = targetFrameworkFlavor; } public override TestProject Clone () { - return CompleteClone (new MacTestProject (Label, Path, IsExecutableProject, TargetFrameworkFlavors)); + return CompleteClone (new MacTestProject (Label, Path)); } protected override TestProject CompleteClone (TestProject project) { var rv = (MacTestProject) project; - rv.Platform = Platform; + rv.TargetFrameworkFlavors = TargetFrameworkFlavors; return base.CompleteClone (rv); } diff --git a/tests/xharness/Program.cs b/tests/xharness/Program.cs index b2b88d5471ed..1991d170b51d 100644 --- a/tests/xharness/Program.cs +++ b/tests/xharness/Program.cs @@ -12,22 +12,22 @@ public static int Main (string [] args) xcode: Xamarin.SdkVersions.Xcode, osx: Xamarin.SdkVersions.OSX, iOS: Xamarin.SdkVersions.iOS, - watchOS: Xamarin.SdkVersions.WatchOS, + watchOS: "99.99", tVOS: Xamarin.SdkVersions.TVOS, minOSX: Xamarin.SdkVersions.MinOSX, miniOS: Xamarin.SdkVersions.MiniOS, - minWatchOS: Xamarin.SdkVersions.LegacyMinWatchOS, + minWatchOS: "99.99", minTVOS: Xamarin.SdkVersions.MinTVOS, miniOSSimulator: Xamarin.SdkVersions.MiniOSSimulator, - minWatchOSSimulator: Xamarin.SdkVersions.MinWatchOSSimulator, - minWatchOSCompanionSimulator: Xamarin.SdkVersions.MinWatchOSCompanionSimulator, + minWatchOSSimulator: "99.99", + minWatchOSCompanionSimulator: "99.99", minTVOSSimulator: Xamarin.SdkVersions.MinTVOSSimulator, maxiOSSimulator: Xamarin.SdkVersions.MaxiOSSimulator, - maxWatchOSSimulator: Xamarin.SdkVersions.MaxWatchOSSimulator, - maxWatchOSCompanionSimulator: Xamarin.SdkVersions.MaxWatchOSCompanionSimulator, + maxWatchOSSimulator: "99.99", + maxWatchOSCompanionSimulator: "99.99", maxTVOSSimulator: Xamarin.SdkVersions.MaxTVOSSimulator, maxiOSDeploymentTarget: Xamarin.SdkVersions.MaxiOSDeploymentTarget, - maxWatchDeploymentTarget: Xamarin.SdkVersions.MaxWatchDeploymentTarget, + maxWatchDeploymentTarget: "99.99", maxTVOSDeploymentTarget: Xamarin.SdkVersions.MaxTVOSDeploymentTarget); Action showHelp = null; @@ -39,13 +39,9 @@ public static int Main (string [] args) { "h|?|help", "Displays the help", (v) => showHelp () }, { "v|verbose", "Show verbose output", (v) => configuration.Verbosity++ }, { "use-system:", "Use the system version of Xamarin.iOS/Xamarin.Mac or the locally build version. Default: the locally build version.", (v) => configuration.UseSystemXamarinIOSMac = v == "1" || v == "true" || string.IsNullOrEmpty (v) }, - // Configure - { "configure", "Creates project files and makefiles.", (v) => action = HarnessAction.Configure }, { "autoconf", "Automatically decide what to configure.", (v) => configuration.AutoConf = true }, { "rootdir=", "The root directory for the tests.", (v) => HarnessConfiguration.RootDirectory = v }, { "project=", "Add a project file to process. This can be specified multiple times.", (v) => configuration.IOSTestProjects.Add (new iOSTestProject (TestLabel.None, v)) }, - { "watchos-container-template=", "The directory to use as a template for a watchos container app.", (v) => configuration.WatchOSContainerTemplate = v }, - { "watchos-app-template=", "The directory to use as a template for a watchos app.", (v) => configuration.WatchOSAppTemplate = v }, // Run { "run=", "Executes a project.", (v) => { @@ -66,8 +62,7 @@ public static int Main (string [] args) } }, { "sdkroot=", "Where Xcode is", (v) => configuration.SdkRoot = v }, - { "sdkroot94=", "Where Xcode 9.4 is", (v) => Console.WriteLine ("--sdkroot94 is deprecated"), true }, - { "target=", "Where to run the project ([ios|watchos|tvos]-[device|simulator|simulator-32|simulator-64]).", (v) => configuration.Target = v.ParseAsAppRunnerTarget () }, + { "target=", "Where to run the project ([ios|tvos]-[device|simulator).", (v) => configuration.Target = v.ParseAsAppRunnerTarget () }, { "configuration=", "Which configuration to run (defaults to Debug).", (v) => configuration.BuildConfiguration = v }, { "logdirectory=", "Where to store logs.", (v) => configuration.LogDirectory = v }, { "logfile=", "Where to store the log.", (v) => Console.WriteLine("The logfile option is deprecated. Please use logdirectory."), true }, diff --git a/tests/xharness/SimulatorLoaderFactory.cs b/tests/xharness/SimulatorLoaderFactory.cs index 65f5ffebad83..e23979a7ce63 100644 --- a/tests/xharness/SimulatorLoaderFactory.cs +++ b/tests/xharness/SimulatorLoaderFactory.cs @@ -28,7 +28,6 @@ public override string GetDeviceType (TestTargetOs target, bool minVersion) return target.Platform switch { TestTarget.Simulator_iOS64 => GetiOSDeviceType (Version.Parse (target.OSVersion!)), TestTarget.Simulator_tvOS => "com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p", - TestTarget.Simulator_watchOS => GetWatchOSDeviceType (Version.Parse (target.OSVersion!)), _ => throw new Exception (string.Format ("Invalid simulator target: {0}", target)) }; } @@ -47,25 +46,10 @@ string GetiOSDeviceType (Version iOSVersion) return "com.apple.CoreSimulator.SimDeviceType.iPhone-14"; } - string GetWatchOSDeviceType (Version watchOSVersion) - { - if (watchOSVersion.Major < 7) - return "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-3-38mm"; - if (watchOSVersion.Major < 8) - return "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-40mm"; - return "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-7-41mm"; - } - public override void GetCompanionRuntimeAndDeviceType (TestTargetOs target, bool minVersion, out string? companionRuntime, out string? companionDeviceType) { companionRuntime = null; companionDeviceType = null; - - if (target.Platform == TestTarget.Simulator_watchOS) { - var companionVersion = minVersion ? Xamarin.SdkVersions.MinWatchOSCompanionSimulator : Xamarin.SdkVersions.MaxWatchOSCompanionSimulator; - companionRuntime = "com.apple.CoreSimulator.SimRuntime.iOS-" + companionVersion.Replace ('.', '-'); - companionDeviceType = GetiOSDeviceType (Version.Parse (companionVersion)); - } } } } diff --git a/tests/xharness/SolutionGenerator.cs b/tests/xharness/SolutionGenerator.cs deleted file mode 100644 index 8b885f46056d..000000000000 --- a/tests/xharness/SolutionGenerator.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml; -using System.Text; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; -using Xharness.Targets; - -namespace Xharness { - public static class SolutionGenerator { - static void AddProjectToSolution (IHarness harness, string sln_path, TextWriter solution, string project_path, out string configurations) - { - var project = new XmlDocument (); - project.LoadWithoutNetworkAccess (project_path); - var guid = project.GetProjectGuid (); - solution.WriteLine ("Project(\"{3}\") = \"{0}\", \"{1}\", \"{2}\"", Path.GetFileNameWithoutExtension (project_path), FixProjectPath (sln_path, project_path), guid, project_path.EndsWith (".csproj") ? Target.CSharpGuid : Target.FSharpGuid); - solution.WriteLine ("EndProject"); - - configurations = string.Format ( - "\t\t{0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n" + - "\t\t{0}.Debug|Any CPU.Build.0 = Debug|Any CPU\n" + - "\t\t{0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU\n" + - "\t\t{0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU\n" + - "\t\t{0}.Debug|iPhone.ActiveCfg = Debug|Any CPU\n" + - "\t\t{0}.Debug|iPhone.Build.0 = Debug|Any CPU\n" + - "\t\t{0}.Release|Any CPU.ActiveCfg = Release|Any CPU\n" + - "\t\t{0}.Release|Any CPU.Build.0 = Release|Any CPU\n" + - "\t\t{0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU\n" + - "\t\t{0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU\n" + - "\t\t{0}.Release|iPhone.ActiveCfg = Release|Any CPU\n" + - "\t\t{0}.Release|iPhone.Build.0 = Release|Any CPU\n", guid); - } - - static string FixProjectPath (string sln_path, string project_path) - { - var sln_dir = Path.GetDirectoryName (sln_path); - if (project_path.StartsWith (sln_dir + Path.PathSeparator, StringComparison.OrdinalIgnoreCase)) - project_path = project_path.Substring (sln_dir.Length + 1); - project_path = project_path.Replace ('/', '\\'); - return project_path; - } - - public static void CreateSolution (IHarness harness, IEnumerable targets, string infix, DevicePlatform testPlatform) - { - CreateSolution (harness, targets, null, infix, testPlatform); - } - - public static void CreateSolution (IHarness harness, IEnumerable targets, Target exeTarget, string infix, DevicePlatform testPlatform) - { - var folders = new StringBuilder (); - - var srcDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "..", "src"); - var sln_path = exeTarget is null ? Path.Combine (HarnessConfiguration.RootDirectory, "tests-" + infix + ".sln") : Path.Combine (Path.GetDirectoryName (exeTarget.ProjectPath), Path.GetFileNameWithoutExtension (exeTarget.ProjectPath) + ".sln"); - - using (var writer = new StringWriter ()) { - writer.WriteLine (); - writer.WriteLine ("Microsoft Visual Studio Solution File, Format Version 11.00"); - writer.WriteLine ("# Visual Studio 2010"); - foreach (var target in targets) { - var relatedProjects = target.GetRelatedProjects (); - var hasRelatedProjects = relatedProjects is not null; - var folderGuid = string.Empty; - var useFolders = hasRelatedProjects && target.IsExe && exeTarget is null; - - if (hasRelatedProjects && target.IsExe) { - if (exeTarget is null) { - CreateSolution (harness, targets, target, infix, testPlatform); // create a solution for just this test project as well - } else if (exeTarget != target) { - continue; - } - } - - if (useFolders) { - folderGuid = Guid.NewGuid ().ToString ().ToUpperInvariant (); - writer.WriteLine ("Project(\"{{2150E333-8FDC-42A3-9474-1A3956D46DE8}}\") = \"{0}\", \"{0}\", \"{{{1}}}\"", target.Name, folderGuid); - writer.WriteLine ("EndProject"); - } - - writer.WriteLine ("Project(\"{3}\") = \"{0}\", \"{1}\", \"{2}\"", Path.GetFileNameWithoutExtension (target.ProjectPath), FixProjectPath (sln_path, Path.GetFullPath (target.ProjectPath)), target.ProjectGuid, target.LanguageGuid); - writer.WriteLine ("EndProject"); - - if (hasRelatedProjects && target.IsExe) { - foreach (var rp in relatedProjects) { - writer.WriteLine ("Project(\"{3}\") = \"{0}\", \"{1}\", \"{2}\"", Path.GetFileNameWithoutExtension (rp.ProjectPath), FixProjectPath (sln_path, Path.GetFullPath (rp.ProjectPath)), rp.Guid, target.LanguageGuid); - writer.WriteLine ("EndProject"); - } - } - - if (useFolders) { - folders.AppendFormat ("\t\t{0} = {{{1}}}\n", target.ProjectGuid, folderGuid); - foreach (var rp in relatedProjects) - folders.AppendFormat ("\t\t{0} = {{{1}}}\n", rp.Guid, folderGuid); - } - } - - // Add reference to the Touch.Client project - string configuration; - var proj_path = Path.GetFullPath (Path.Combine (srcDirectory, "..", "external", "Touch.Unit", "Touch.Client", testPlatform.AsString (), "Touch.Client-" + testPlatform.AsString () + ".csproj")); - AddProjectToSolution (harness, sln_path, writer, proj_path, out configuration); - - writer.WriteLine ("Global"); - - writer.WriteLine ("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - writer.WriteLine ("\t\tDebug|iPhoneSimulator = Debug|iPhoneSimulator"); - writer.WriteLine ("\t\tRelease|iPhoneSimulator = Release|iPhoneSimulator"); - writer.WriteLine ("\t\tDebug|iPhone = Debug|iPhone"); - writer.WriteLine ("\t\tRelease|iPhone = Release|iPhone"); - writer.WriteLine ("\t\tDebug|Any CPU = Debug|Any CPU"); - writer.WriteLine ("\t\tRelease|Any CPU = Release|Any CPU"); - writer.WriteLine ("\tEndGlobalSection"); - - writer.WriteLine ("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - var exePlatforms = new string [] { "iPhone", "iPhoneSimulator" }; - var configurations = new string [] { "Debug", "Release" }; - foreach (var target in targets) { - if (target.IsExe && exeTarget is not null && target != exeTarget) - continue; - - foreach (var conf in configurations) { - if (target.IsExe) { - foreach (var platform in exePlatforms) { - writer.WriteLine ("\t\t{0}.{1}|{2}.ActiveCfg = {1}|{2}", target.ProjectGuid, conf, platform); - writer.WriteLine ("\t\t{0}.{1}|{2}.Build.0 = {1}|{2}", target.ProjectGuid, conf, platform); - - } - } else { - foreach (var platform in new string [] { "Any CPU", "iPhone", "iPhoneSimulator" }) { - writer.WriteLine ("\t\t{0}.{1}|{2}.ActiveCfg = {1}|Any CPU", target.ProjectGuid, conf, platform); - writer.WriteLine ("\t\t{0}.{1}|{2}.Build.0 = {1}|Any CPU", target.ProjectGuid, conf, platform); - } - } - } - - if (target.IsExe) { - var relatedProjects = target.GetRelatedProjects (); - if (relatedProjects is not null) { - foreach (var rp in relatedProjects) { - foreach (var conf in configurations) { - foreach (var platform in exePlatforms) { - writer.WriteLine ("\t\t{0}.{1}|{2}.ActiveCfg = {1}|{2}", rp.Guid, conf, platform); - writer.WriteLine ("\t\t{0}.{1}|{2}.Build.0 = {1}|{2}", rp.Guid, conf, platform); - } - } - } - } - - } - - } - writer.Write (configuration); - writer.WriteLine ("\tEndGlobalSection"); - - if (folders.Length > 0) { - writer.WriteLine ("\tGlobalSection(NestedProjects) = preSolution"); - writer.Write (folders.ToString ()); - writer.WriteLine ("\tEndGlobalSection"); - } - - writer.WriteLine ("EndGlobal"); - - harness.Save (writer, sln_path); - } - } - } -} diff --git a/tests/xharness/Targets/MacTarget.cs b/tests/xharness/Targets/MacTarget.cs deleted file mode 100644 index b6dae3e64b7e..000000000000 --- a/tests/xharness/Targets/MacTarget.cs +++ /dev/null @@ -1,186 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; - -namespace Xharness.Targets { - public class MacTarget : Target { - public MacFlavors Flavor { get; private set; } - public bool Modern => Flavor == MacFlavors.Modern; - public bool System => Flavor == MacFlavors.System; - public bool Full => Flavor == MacFlavors.Full; - - public MacTarget (MacFlavors flavor) - { - Flavor = flavor; - } - - public override string Suffix { - get { - switch (Flavor) { - case MacFlavors.Modern: - return string.Empty; - case MacFlavors.Full: - return "-full"; - case MacFlavors.System: - return "-system"; - default: - throw new NotImplementedException ($"Suffix for {Flavor}"); - } - } - } - - public override string MakefileWhereSuffix { - get { - switch (Flavor) { - case MacFlavors.Modern: - return "modern"; - case MacFlavors.Full: - return "full"; - case MacFlavors.System: - return "system"; - default: - throw new NotImplementedException ($"Suffix for {Flavor}"); - } - } - } - - protected override string ProjectTypeGuids { - get { - return "{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};" + LanguageGuid; - } - } - - protected override string BindingsProjectTypeGuids { - get { - return "{810C163F-4746-4721-8B8E-88A3673A62EA}"; - } - } - - protected override string TargetFrameworkIdentifier { - get { - return "Xamarin.Mac"; - } - } - - protected override string Imports { - get { - return IsFSharp ? "Mac\\Xamarin.Mac.FSharp.targets" : "Mac\\Xamarin.Mac.CSharp.targets"; - } - } - - protected override string BindingsImports { - get { - return "Mac\\Xamarin.Mac.ObjcBinding.CSharp"; - } - } - - protected override string AdditionalDefines { - get { - var rv = ""; - - if (Full) - rv += "XAMMAC_4_5"; - - return rv; - } - } - - protected override string RemoveDefines { - get { - var rv = string.Empty; - - if (!Modern) - rv += ";XAMMAC;MOBILE"; - - return rv; - } - } - - public override string Platform { - get { - return "mac"; - } - } - - public override string DotNetSdk => "Microsoft.macOS.Sdk"; - public override string RuntimeIdentifier => "osx-x64"; - public override DevicePlatform ApplePlatform => DevicePlatform.macOS; - public override string TargetFramework => DotNetTfm + "-macos"; - public override string TargetFrameworkForNuGet => "xamarinmac10"; - - protected override bool FixProjectReference (string include, string subdir, string suffix, out string fixed_include) - { - var fn = Path.GetFileName (include); - - switch (fn) { - case "Touch.Client-macOS-mobile.csproj": - switch (Flavor) { - case MacFlavors.Full: - case MacFlavors.System: - var dir = Path.GetDirectoryName (include); - var parentDir = Path.GetDirectoryName (dir); - dir = Path.Combine (parentDir, "full"); - fixed_include = Path.Combine (dir, fn.Replace ("-mobile", "-full")); - return true; - case MacFlavors.Modern: - default: - break; - } - break; - } - - return base.FixProjectReference (include, subdir, suffix, out fixed_include); - } - - public string SimplifiedName { - get { - return Name.EndsWith ("-mac", StringComparison.Ordinal) ? Name.Substring (0, Name.Length - 4) : Name; - } - } - - public override string DefaultAssemblyReference { get { return "Xamarin.Mac"; } } - - public override IEnumerable ReferenceToRemove { get { yield return "System.Drawing"; } } - - public override bool ShouldSetTargetFrameworkIdentifier { get { return Modern; } } - - public override Dictionary NewPropertiesToAdd { - get { - var props = new Dictionary (); - - - if (System) { - props.Add ("TargetFrameworkVersion", "v4.7.1"); - props.Add ("AppBundleExtraOptions", "--embed-mono=no"); - } else if (Modern) { - props.Add ("TargetFrameworkVersion", "v2.0"); - } else { - props.Add ("TargetFrameworkVersion", "v4.5"); - props.Add ("UseXamMacFullFramework", "true"); - } - - props.Add ("XamMacArch", "x86_64"); - return props; - } - } - - public override HashSet PropertiesToRemove { - get { - if (!ShouldSetTargetFrameworkIdentifier) - return new HashSet { "TargetFrameworkIdentifier" }; - return null; - } - } - - protected override void PostProcessExecutableProject () - { - base.PostProcessExecutableProject (); - - ProjectGuid = "{" + Xharness.Harness.Helpers.GenerateStableGuid ().ToString ().ToUpper () + "}"; - inputProject.SetProjectGuid (ProjectGuid); - inputProject.ResolveAllPaths (TemplateProjectPath); - } - } -} diff --git a/tests/xharness/Targets/TVOSTarget.cs b/tests/xharness/Targets/TVOSTarget.cs deleted file mode 100644 index b3bf5c5de289..000000000000 --- a/tests/xharness/Targets/TVOSTarget.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Xml; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; -using Microsoft.DotNet.XHarness.iOS.Shared; - -namespace Xharness.Targets { - public class TVOSTarget : iOSTarget { - public override string Suffix { - get { - return "-tvos"; - } - } - - public override string ExtraLinkerDefsSuffix { - get { - return "-tvos"; - } - } - - protected override string BindingsProjectTypeGuids { - get { - return "{4A1ED743-3331-459B-915A-4B17C7B6DBB6}"; - } - } - - protected override string ProjectTypeGuids { - get { - return "{06FA79CB-D6CD-4721-BB4B-1BD202089C55}"; - } - } - - protected override string TargetFrameworkIdentifier { - get { - return "Xamarin.TVOS"; - } - } - - protected override string Imports { - get { - return IsFSharp ? "TVOS\\Xamarin.TVOS.FSharp.targets" : "TVOS\\Xamarin.TVOS.CSharp.targets"; - } - } - - protected override string BindingsImports { - get { - return IsFSharp ? "TVOS\\Xamarin.TVOS.ObjCBinding.FSharp.targets" : "TVOS\\Xamarin.TVOS.ObjCBinding.CSharp.targets"; - } - } - - public override string SimulatorArchitectures { - get { - return "x86_64"; - } - } - - public override string DeviceArchitectures { - get { - return "ARM64"; - } - } - - protected override string GetMinimumOSVersion (string templateMinimumOSVersion) - { - return Xamarin.SdkVersions.MinTVOS; - } - - protected override int [] UIDeviceFamily { - get { - return new int [] { 3 }; - } - } - - protected override string AdditionalDefines { - get { - return "XAMCORE_3_0;MONOTOUCH_TV;"; - } - } - - public override string Platform { - get { - return "tvos"; - } - } - - public override string DotNetSdk => "Microsoft.tvOS.Sdk"; - public override string RuntimeIdentifier => "tvossimulator-x64"; - public override DevicePlatform ApplePlatform => DevicePlatform.tvOS; - public override string TargetFramework => DotNetTfm + "-tvos"; - public override string TargetFrameworkForNuGet => "xamarintvos10"; - - static Dictionary project_guids = new Dictionary (); - - protected override void ProcessProject () - { - base.ProcessProject (); - - var srcDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "..", "src"); - - inputProject.AddExtraMtouchArgs ("--bitcode:asmonly", "iPhone", "Release"); - inputProject.SetMtouchUseLlvm (true, "iPhone", "Release"); - inputProject.ResolveAllPaths (TemplateProjectPath); - - // Remove bitcode from executables, since we don't need it for testing, and it makes test apps bigger (and the Apple TV might refuse to install them). - var configurations = new string [] { "Debug", "Release" }; - foreach (var c in configurations) { - inputProject.AddExtraMtouchArgs ($"--gcc_flags=-fembed-bitcode-marker", "iPhone", c); - } - } - } -} diff --git a/tests/xharness/Targets/Target.cs b/tests/xharness/Targets/Target.cs index 3d62d717fcc1..088f2b673de1 100644 --- a/tests/xharness/Targets/Target.cs +++ b/tests/xharness/Targets/Target.cs @@ -1,284 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; -using Microsoft.DotNet.XHarness.iOS.Shared; - namespace Xharness.Targets { public abstract class Target { - public IHarness Harness; - - protected XmlDocument inputProject; - protected string OriginalInfoPListInclude { get; private set; } - string outputType; - string bundleIdentifier; - string targetDirectory; - - public string Name { get; protected set; } - public string ProjectGuid { get; protected set; } - public string ProjectPath { get; protected set; } - - public string ProjectFileExtension { get { return IsFSharp ? "fsproj" : "csproj"; } } - public bool IsFSharp { get { return (ProjectPath ?? TemplateProjectPath).EndsWith (".fsproj", StringComparison.Ordinal); } } - - public string TemplateProjectPath { get; set; } - - bool? is_dotnet_project; - public bool IsDotNetProject { get { return is_dotnet_project ?? (is_dotnet_project = inputProject.IsDotNetProject ()).Value; } } - public string OutputType { get { return outputType; } } - public string TargetDirectory { get { return targetDirectory; } } - public bool IsLibrary { get { return outputType == "Library"; } } - public bool IsExe { get { return outputType == "Exe"; } } - public bool IsBindingProject { get; private set; } - public bool IsNUnitProject { get; set; } - - public string BundleIdentifier { get { return bundleIdentifier; } protected set { bundleIdentifier = value; } } - - public virtual string Suffix { get { throw new NotImplementedException (); } } - public virtual string MakefileWhereSuffix { get { return string.Empty; } } - public virtual string ProjectFileSuffix { get { return Suffix; } } - public virtual string ExtraLinkerDefsSuffix { get { return Suffix; } } - protected virtual string ProjectTypeGuids { get { throw new NotImplementedException (); } } - protected virtual string BindingsProjectTypeGuids { get { throw new NotImplementedException (); } } - protected virtual string TargetFrameworkIdentifier { get { throw new NotImplementedException (); } } - protected virtual string Imports { get { throw new NotImplementedException (); } } - protected virtual string BindingsImports { get { throw new NotImplementedException (); } } - public virtual bool IsMultiArchitecture { get { return false; } } - public virtual string SimulatorArchitectures { get { throw new NotImplementedException (); } } - public virtual string DeviceArchitectures { get { throw new NotImplementedException (); } } - protected virtual string GetMinimumOSVersion (string templateMinimumOSVersion) { throw new NotImplementedException (); } - protected virtual int [] UIDeviceFamily { get { throw new NotImplementedException (); } } - protected virtual string AdditionalDefines { get { return string.Empty; } } - protected virtual string RemoveDefines { get { return string.Empty; } } - public virtual string Platform { get { throw new NotImplementedException (); } } - - public bool ShouldSkipProjectGeneration { get; set; } - public virtual bool ShouldSetTargetFrameworkIdentifier { get { return true; } } - public virtual string DefaultAssemblyReference { get { return "Xamarin.iOS"; } } - public virtual IEnumerable ReferenceToRemove { get { return Enumerable.Empty (); } } - public virtual Dictionary NewPropertiesToAdd { get { return new Dictionary (); } } - public virtual HashSet PropertiesToRemove { get { return null; } } - - public const string FSharpGuid = "{F2A71F9B-5D33-465A-A702-920D77279786}"; - public const string CSharpGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"; - public string DotNetTfm => Harness.DOTNET_TFM; - - public string LanguageGuid { get { return IsFSharp ? FSharpGuid : CSharpGuid; } } - - public abstract string DotNetSdk { get; } - public abstract string RuntimeIdentifier { get; } - public abstract DevicePlatform ApplePlatform { get; } - public abstract string TargetFramework { get; } - public abstract string TargetFrameworkForNuGet { get; } - public static string ProjectsDir { get { return "generated-projects"; } } - protected string GetTargetSpecificDir (string customSuffix = null) - { - string rv; - if (string.IsNullOrEmpty (customSuffix)) { - rv = Suffix; - } else { - rv = Suffix + "-" + customSuffix; - } - if (IsDotNetProject) - rv += "-dotnet"; - return rv.TrimStart ('-'); - } - - public virtual string PlatformString { - get { - return ApplePlatform.AsString (); - } - } - - protected virtual bool FixProjectReference (string include, string subdir, string suffix, out string fixed_include) - { - var fn = Path.GetFileName (include); - - switch (fn) { - case "Touch.Client-iOS.dotnet.csproj": - case "Touch.Client-iOS.csproj": - var dir = Path.GetDirectoryName (include); - var parentDir = Path.GetFileName (dir); - if (parentDir == "iOS") - dir = Path.Combine (Path.GetDirectoryName (dir), PlatformString); - fixed_include = Path.Combine (dir, fn.Replace ("-iOS", "-" + PlatformString)); - break; - default: - include = include.Replace (".csproj", suffix + ".csproj"); - include = include.Replace (".fsproj", suffix + ".fsproj"); - - if (!string.IsNullOrEmpty (subdir)) - include = Path.Combine (Path.GetDirectoryName (include), subdir, Path.GetFileName (include)); - - fixed_include = include; - break; - } - - return true; - } - - protected virtual void ProcessDotNetProject () - { - inputProject.SetSdk (DotNetSdk); - inputProject.SetRuntimeIdentifier (RuntimeIdentifier); - inputProject.FixProjectReferences (Path.Combine (ProjectsDir, GetTargetSpecificDir ()), Suffix, FixProjectReference); - inputProject.SetNode ("TargetFramework", TargetFramework); - var fixedAssetTargetFallback = inputProject.GetAssetTargetFallback ()?.Replace ("xamarinios10", TargetFrameworkForNuGet); - if (fixedAssetTargetFallback is not null) - inputProject.SetAssetTargetFallback (fixedAssetTargetFallback); - inputProject.ResolveAllPaths (TemplateProjectPath); - } - - protected virtual void ProcessProject () - { - inputProject.SetOutputPath ("bin\\$(Platform)\\$(Configuration)" + Suffix); - inputProject.SetIntermediateOutputPath ("obj\\$(Platform)\\$(Configuration)" + Suffix); - - if (ShouldSetTargetFrameworkIdentifier) - inputProject.SetTargetFrameworkIdentifier (TargetFrameworkIdentifier); - - inputProject.SetAssemblyReference (DefaultAssemblyReference, TargetFrameworkIdentifier); - - foreach (var r in ReferenceToRemove) - inputProject.RemoveReferences (r); - - var newProperties = NewPropertiesToAdd; - foreach (var k in newProperties.Keys) - inputProject.SetTopLevelPropertyGroupValue (k, newProperties [k]); - - var removedProperties = PropertiesToRemove; - if (removedProperties is not null) { - foreach (var p in removedProperties) - inputProject.RemoveNode (p, false); - } - - inputProject.FixProjectReferences (Path.Combine (ProjectsDir, GetTargetSpecificDir ()), Suffix, FixProjectReference); - inputProject.SetAssemblyReference ("OpenTK", "OpenTK-1.0"); - inputProject.SetProjectTypeGuids (IsBindingProject ? BindingsProjectTypeGuids : ProjectTypeGuids); - inputProject.SetImport ("$(MSBuildExtensionsPath)\\Xamarin\\" + (IsBindingProject ? BindingsImports : Imports)); - inputProject.FixTestLibrariesReferences (Platform); - if (!string.IsNullOrEmpty (AdditionalDefines)) - inputProject.AddAdditionalDefines (AdditionalDefines); - if (!string.IsNullOrEmpty (RemoveDefines)) - inputProject.RemoveDefines (RemoveDefines); - } - - protected void CreateExecutableProject () - { - ProcessProject (); - PostProcessExecutableProject (); - inputProject.Save (ProjectPath, Harness); - - UpdateInfoPList (); - } - - protected virtual void PostProcessExecutableProject () - { - } - - protected virtual void UpdateInfoPList () - { - } - - protected void CreateLibraryProject () - { - ProcessProject (); - inputProject.ResolveAllPaths (TemplateProjectPath); - inputProject.Save (ProjectPath, Harness); - - ProjectGuid = inputProject.GetProjectGuid (); - } - - protected virtual void CreateDotNetProject () - { - ProcessDotNetProject (); - inputProject.Save (ProjectPath, Harness); - UpdateInfoPList (); - } - - protected virtual void ExecuteInternal () - { - if (IsDotNetProject) { - CreateDotNetProject (); - return; - } - switch (OutputType) { - case "Exe": - CreateExecutableProject (); - break; - case "Library": - CreateLibraryProject (); - break; - default: - throw new Exception (string.Format ("Unknown OutputType: {0}", OutputType)); - } - } - - protected virtual void CalculateName () - { - Name = Path.GetFileName (targetDirectory); - if (string.Equals (Name, "ios", StringComparison.OrdinalIgnoreCase) || string.Equals (Name, "mac", StringComparison.OrdinalIgnoreCase)) - Name = Path.GetFileName (Path.GetDirectoryName (targetDirectory)); - } - - public void Execute () - { - targetDirectory = Path.GetDirectoryName (TemplateProjectPath); - CalculateName (); - - var templateName = Path.GetFileName (TemplateProjectPath); - if (templateName.EndsWith (".template", StringComparison.OrdinalIgnoreCase)) - templateName = Path.GetFileNameWithoutExtension (templateName); - templateName = Path.GetFileNameWithoutExtension (templateName); - - if (!ShouldSkipProjectGeneration) { - inputProject = new XmlDocument (); - inputProject.LoadWithoutNetworkAccess (TemplateProjectPath); - OriginalInfoPListInclude = inputProject.GetInfoPListInclude ()?.Replace ('\\', '/'); - - ProjectPath = Path.Combine (targetDirectory, ProjectsDir, GetTargetSpecificDir (), templateName + ProjectFileSuffix + "." + ProjectFileExtension); - - outputType = inputProject.GetOutputType (); - - if (inputProject.IsDotNetProject ()) { - IsBindingProject = string.Equals (inputProject.GetIsBindingProject (), "true", StringComparison.OrdinalIgnoreCase); - } else { - switch (inputProject.GetImport ()) { - case "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.CSharp.targets": - case "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.FSharp.targets": - case "$(MSBuildExtensionsPath)\\Xamarin\\Mac\\Xamarin.Mac.CSharp.targets": - case "$(MSBuildExtensionsPath": - case "$(MSBuildBinPath)\\Microsoft.CSharp.targets": - IsBindingProject = false; - break; - case "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.ObjCBinding.CSharp.targets": - case "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.ObjCBinding.FSharp.targets": - case "$(MSBuildExtensionsPath)\\Xamarin\\Mac\\Xamarin.Mac.ObjcBinding.CSharp": - IsBindingProject = true; - break; - default: - throw new Exception (string.Format ("Unknown Imports: {0} in {1}", inputProject.GetImport (), TemplateProjectPath)); - } - } - - ExecuteInternal (); - } else { - ProjectPath = TemplateProjectPath; - } - } - - public virtual IEnumerable GetRelatedProjects () - { - return null; - } - } - - public class RelatedProject { - public string ProjectPath; - public string Guid; } } diff --git a/tests/xharness/Targets/TodayExtensionTarget.cs b/tests/xharness/Targets/TodayExtensionTarget.cs deleted file mode 100644 index 262f053b466f..000000000000 --- a/tests/xharness/Targets/TodayExtensionTarget.cs +++ /dev/null @@ -1,142 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; -using Microsoft.DotNet.XHarness.iOS.Shared; - -namespace Xharness.Targets { - public class TodayExtensionTarget : UnifiedTarget { - public string AppName { get; private set; } - public string ExtensionName { get; private set; } - - public string TodayContainerGuid { get; private set; } - public string TodayExtensionGuid { get; private set; } - - public string TodayContainerProjectPath { get; private set; } - public string TodayExtensionProjectPath { get; private set; } - - public override string Suffix { - get { - return "-today"; - } - } - - public override string ExtraLinkerDefsSuffix { - get { - return "-today"; - } - } - - public override string ProjectFileSuffix { - get { - return "-today"; - } - } - - void CreateTodayContainerProject () - { - var csproj = new XmlDocument (); - var suffix = Suffix; - csproj.LoadWithoutNetworkAccess (Path.Combine (Harness.TodayContainerTemplate, "TodayContainer.csproj")); - csproj.SetOutputPath ("bin\\$(Platform)\\$(Configuration)" + suffix, false); - csproj.SetIntermediateOutputPath ("obj\\$(Platform)\\$(Configuration)" + suffix); - csproj.SetProjectReferenceValue ("TodayExtension.csproj", "Name", Path.GetFileNameWithoutExtension (TodayExtensionProjectPath)); - csproj.SetProjectReferenceValue ("TodayExtension.csproj", "Project", TodayExtensionGuid); - csproj.SetProjectReferenceInclude ("TodayExtension.csproj", TodayExtensionProjectPath.Replace ('/', '\\')); - csproj.FixCompileInclude ("Main.cs", Path.Combine (Harness.TodayContainerTemplate, "Main.cs").Replace ('/', '\\')); - csproj.FixInfoPListInclude (suffix, Path.GetDirectoryName (TemplateProjectPath)); - TodayContainerGuid = "{" + Xharness.Harness.Helpers.GenerateStableGuid ().ToString ().ToUpper () + "}"; - ProjectGuid = TodayContainerGuid; - csproj.SetProjectGuid (TodayContainerGuid); - csproj.ResolveAllPaths (Harness.TodayContainerTemplate); - csproj.Save (TodayContainerProjectPath, Harness); - - XmlDocument info_plist = new XmlDocument (); - var target_info_plist = Path.Combine (TargetDirectory, $"Info{suffix}.plist"); - info_plist.LoadWithoutNetworkAccess (Path.Combine (Harness.TodayContainerTemplate, "Info.plist")); - info_plist.SetCFBundleIdentifier (BundleIdentifier); - info_plist.SetCFBundleName (Name); - info_plist.SetMinimumOSVersion (GetMinimumOSVersion (Xamarin.SdkVersions.MiniOS)); - info_plist.Save (target_info_plist, Harness); - } - - void CreateTodayExtensionProject () - { - var csproj = inputProject; - var suffix = Suffix + "-extension"; - csproj.SetProjectTypeGuids ("{EE2C853D-36AF-4FDB-B1AD-8E90477E2198};" + LanguageGuid); - csproj.SetOutputPath ("bin\\$(Platform)\\$(Configuration)" + suffix); - csproj.SetIntermediateOutputPath ("obj\\$(Platform)\\$(Configuration)" + suffix); - csproj.SetImport (IsFSharp ? "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.AppExtension.FSharp.targets" : "$(MSBuildExtensionsPath)\\Xamarin\\iOS\\Xamarin.iOS.AppExtension.CSharp.targets"); - csproj.FixInfoPListInclude (suffix, Path.GetDirectoryName (TemplateProjectPath)); - csproj.SetOutputType ("Library"); - csproj.AddAdditionalDefines ("XAMCORE_3_0;TODAY_EXTENSION"); - var ext = IsFSharp ? "fs" : "cs"; - csproj.AddCompileInclude ("TodayExtensionMain." + ext, Path.Combine (Harness.TodayExtensionTemplate, "TodayExtensionMain." + ext), true); - csproj.AddInterfaceDefinition (Path.Combine (Harness.TodayExtensionTemplate, "TodayView.storyboard").Replace ('/', '\\')); - csproj.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); - csproj.FixProjectReferences (Path.Combine (ProjectsDir, GetTargetSpecificDir ()), "-today", FixProjectReference); - csproj.ResolveAllPaths (TemplateProjectPath); - csproj.Save (TodayExtensionProjectPath, Harness); - - TodayExtensionGuid = csproj.GetProjectGuid (); - - XmlDocument info_plist = new XmlDocument (); - var target_info_plist = Path.Combine (TargetDirectory, $"Info{suffix}.plist"); - var original_info_plist_include = HarnessConfiguration.EvaluateRootTestsDirectory (OriginalInfoPListInclude); - info_plist.LoadWithoutNetworkAccess (Path.Combine (TargetDirectory, original_info_plist_include)); - BundleIdentifier = info_plist.GetCFBundleIdentifier () + "-today"; - info_plist.SetCFBundleIdentifier (BundleIdentifier + ".todayextension"); - info_plist.SetMinimumOSVersion (GetMinimumOSVersion (Xamarin.SdkVersions.MiniOS)); - info_plist.AddPListStringValue ("CFBundlePackageType", "XPC!"); - info_plist.SetCFBundleDisplayName (Name); - info_plist.AddPListKeyValuePair ("NSExtension", "dict", -@" - NSExtensionMainStoryboard - TodayView - NSExtensionPointIdentifier - com.apple.widget-extension - "); - info_plist.Save (target_info_plist, Harness); - } - - protected override void ExecuteInternal () - { - ExtensionName = Name + " Today Extension"; - AppName = Name + " Today"; - - var templateName = Path.GetFileName (TemplateProjectPath); - if (templateName.EndsWith (".template", StringComparison.OrdinalIgnoreCase)) - templateName = Path.GetFileNameWithoutExtension (templateName); - templateName = Path.GetFileNameWithoutExtension (templateName); - - switch (OutputType) { - case "Exe": - TodayExtensionProjectPath = Path.Combine (TargetDirectory, ProjectsDir, GetTargetSpecificDir ("extension"), templateName + Suffix + "-extension." + ProjectFileExtension); - TodayContainerProjectPath = Path.Combine (TargetDirectory, ProjectsDir, GetTargetSpecificDir (), templateName + Suffix + "." + ProjectFileExtension); - CreateTodayExtensionProject (); - CreateTodayContainerProject (); - break; - case "Library": - CreateLibraryProject (); - break; - default: - throw new Exception (string.Format ("Unknown OutputType: {0}", OutputType)); - } - } - - protected override string GetMinimumOSVersion (string templateMinimumOSVersion) - { - return templateMinimumOSVersion; - } - - public override IEnumerable GetRelatedProjects () - { - return new RelatedProject [] { - new RelatedProject { Guid = TodayExtensionGuid, ProjectPath = TodayExtensionProjectPath }, - }; - } - } -} diff --git a/tests/xharness/Targets/UnifiedTarget.cs b/tests/xharness/Targets/UnifiedTarget.cs deleted file mode 100644 index e5d6c138abda..000000000000 --- a/tests/xharness/Targets/UnifiedTarget.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.IO; -using System.Xml; -using Microsoft.DotNet.XHarness.iOS.Shared; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; - -namespace Xharness.Targets { - public class UnifiedTarget : iOSTarget { - public override string Suffix { - get { - return "-ios"; - } - } - - public override string ExtraLinkerDefsSuffix { - get { - return string.Empty; - } - } - - protected override string ProjectTypeGuids { - get { - return "{FEACFBD2-3405-455C-9665-78FE426C6842};" + LanguageGuid; - } - } - - protected override string BindingsProjectTypeGuids { - get { - return "{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC}"; - } - } - - protected override string TargetFrameworkIdentifier { - get { - return "Xamarin.iOS"; - } - } - - protected override string Imports { - get { - return IsFSharp ? "iOS\\Xamarin.iOS.FSharp.targets" : "iOS\\Xamarin.iOS.CSharp.targets"; - } - } - - protected override string BindingsImports { - get { - return IsFSharp ? "iOS\\Xamarin.iOS.ObjCBinding.FSharp.targets" : "iOS\\Xamarin.iOS.ObjCBinding.CSharp.targets"; - } - } - - public override string SimulatorArchitectures { - get { - return "x86_64"; - } - } - - public override string DeviceArchitectures { - get { - return "ARM64"; - } - } - - protected override string GetMinimumOSVersion (string templateMinimumOSVersion) - { - return templateMinimumOSVersion; - } - - protected override int [] UIDeviceFamily { - get { - return new int [] { 1, 2 }; - } - } - - protected override string AdditionalDefines { - get { - return ""; - } - } - - public override bool IsMultiArchitecture { - get { - return true; - } - } - - public override string Platform { - get { - return "ios"; - } - } - - public override string ProjectFileSuffix { - get { - return string.Empty; - } - } - - public override string DotNetSdk => "Microsoft.iOS.Sdk"; - public override string RuntimeIdentifier => "iossimulator-x64"; - public override DevicePlatform ApplePlatform => DevicePlatform.iOS; - public override string TargetFramework => DotNetTfm + "-ios"; - public override string TargetFrameworkForNuGet => "xamarinios10"; - } -} diff --git a/tests/xharness/Targets/WatchOSTarget.cs b/tests/xharness/Targets/WatchOSTarget.cs deleted file mode 100644 index b1490c0df9da..000000000000 --- a/tests/xharness/Targets/WatchOSTarget.cs +++ /dev/null @@ -1,249 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml; -using Microsoft.DotNet.XHarness.iOS.Shared; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; - -namespace Xharness.Targets { - public class WatchOSTarget : iOSTarget { - public string AppName { get; private set; } - public string ExtensionName { get; private set; } - - public string WatchOSAppGuid { get; private set; } - public string WatchOSExtensionGuid { get; private set; } - public string WatchOSGuid { get { return ProjectGuid; } private set { ProjectGuid = value; } } - - public string WatchOSAppProjectPath { get; private set; } - public string WatchOSExtensionProjectPath { get; private set; } - public string WatchOSProjectPath { get { return ProjectPath; } private set { ProjectPath = value; } } - - public override string SimulatorArchitectures { - get { return "x86_64"; } - } - - public override string DeviceArchitectures { - get { return "ARM64_32"; } - } - - public override string DotNetSdk => "Microsoft.watchOS.Sdk"; - public override string RuntimeIdentifier => throw new NotImplementedException (); - public override DevicePlatform ApplePlatform => DevicePlatform.watchOS; - public override string TargetFramework => DotNetTfm + "-watchos"; - public override string TargetFrameworkForNuGet => "xamarinwatch10"; - - void CreateWatchOSAppProject () - { - var csproj = new XmlDocument (); - var suffix = Suffix + "-app"; - csproj.LoadWithoutNetworkAccess (Path.Combine (Harness.WatchOSAppTemplate, "App.csproj")); - csproj.FindAndReplace ("%WATCHAPP_PATH%", Path.GetFullPath (Harness.WatchOSAppTemplate).Replace ('/', '\\') + "\\"); - csproj.FindAndReplace ("%WATCHEXTENSION_CSPROJ%", WatchOSExtensionProjectPath); - csproj.SetProjectReferenceValue (WatchOSExtensionProjectPath, "Project", WatchOSExtensionGuid); - csproj.SetProjectReferenceValue (WatchOSExtensionProjectPath, "Name", Path.GetFileNameWithoutExtension (WatchOSExtensionProjectPath)); - WatchOSAppGuid = "{" + Xharness.Harness.Helpers.GenerateStableGuid ().ToString ().ToUpper () + "}"; - csproj.SetProjectGuid (WatchOSAppGuid); - csproj.FixInfoPListInclude (suffix, Path.GetDirectoryName (TemplateProjectPath)); - csproj.ResolveAllPaths (TemplateProjectPath); - csproj.Save (WatchOSAppProjectPath, Harness); - - XmlDocument info_plist = new XmlDocument (); - var target_info_plist = Path.Combine (TargetDirectory, $"Info{Suffix}-app.plist"); - info_plist.LoadWithoutNetworkAccess (Path.Combine (Harness.WatchOSAppTemplate, "Info.plist")); - info_plist.SetCFBundleIdentifier (BundleIdentifier + ".watchkitapp"); - info_plist.SetPListStringValue ("WKCompanionAppBundleIdentifier", BundleIdentifier); - info_plist.SetPListStringValue ("CFBundleName", Name); - info_plist.SetMinimumOSVersion (GetMinimumOSVersion (info_plist.GetMinimumOSVersion ())); - info_plist.Save (target_info_plist, Harness); - } - - void CreateWatchOSContainerProject () - { - var csproj = new XmlDocument (); - csproj.LoadWithoutNetworkAccess (Path.Combine (Harness.WatchOSContainerTemplate, "Container.csproj")); - - csproj.FindAndReplace ("%CONTAINER_PATH%", Path.GetFullPath (Harness.WatchOSContainerTemplate).Replace ('/', '\\') + "\\"); - csproj.FindAndReplace ("%WATCHAPP_CSPROJ%", WatchOSAppProjectPath); - csproj.SetProjectReferenceValue (WatchOSAppProjectPath, "Name", Path.GetFileNameWithoutExtension (WatchOSAppProjectPath)); - WatchOSGuid = "{" + Xharness.Harness.Helpers.GenerateStableGuid ().ToString ().ToUpper () + "}"; - csproj.SetProjectGuid (WatchOSGuid); - csproj.FixInfoPListInclude (Suffix, Path.GetDirectoryName (TemplateProjectPath)); - csproj.ResolveAllPaths (TemplateProjectPath); - csproj.Save (WatchOSProjectPath, Harness); - - XmlDocument info_plist = new XmlDocument (); - var target_info_plist = Path.Combine (TargetDirectory, $"Info{Suffix}.plist"); - info_plist.LoadWithoutNetworkAccess (Path.Combine (Harness.WatchOSContainerTemplate, "Info.plist")); - info_plist.SetCFBundleIdentifier (BundleIdentifier); - info_plist.SetCFBundleName (Name); - info_plist.SetMinimumOSVersion (Xamarin.SdkVersions.MiniOS); - info_plist.Save (target_info_plist, Harness); - } - - void CreateWatchOSExtensionProject () - { - var csproj = inputProject; - var suffix = Suffix + "-extension"; - - 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); - csproj.RemoveTargetFrameworkIdentifier (); - 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 (Path.Combine (ProjectsDir, GetTargetSpecificDir ()), "-watchos", FixProjectReference); - - csproj.FixInfoPListInclude (suffix, Path.GetDirectoryName (TemplateProjectPath)); - csproj.SetOutputType ("Library"); - csproj.AddAdditionalDefines ("XAMCORE_3_0;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;"); - csproj.RemoveReferences ("OpenTK-1.0"); - csproj.RemovePackageReference ("MonoTouch.Dialog"); - var ext = IsFSharp ? "fs" : "cs"; - csproj.AddCompileInclude ("InterfaceController." + ext, Path.Combine (Harness.WatchOSExtensionTemplate, "InterfaceController." + ext)); - csproj.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); - csproj.SetMtouchUseBitcode (true, "iPhone", "Release"); - csproj.SetMtouchUseLlvm (true, "iPhone", "Release"); - csproj.ResolveAllPaths (TemplateProjectPath); - - // Not linking a watch extensions requires passing -Os to the native compiler. - // https://github.com/mono/mono/issues/9867 - var configurations = new string [] { "Debug", "Release" }; - foreach (var c in configurations) { - var flags = "-fembed-bitcode-marker"; - if (csproj.GetMtouchLink ("iPhone", c) == "None") - flags += " -Os"; - - csproj.AddExtraMtouchArgs ($"--gcc_flags='{flags}'", "iPhone", c); - } - - csproj.Save (WatchOSExtensionProjectPath, Harness); - - WatchOSExtensionGuid = csproj.GetProjectGuid (); - - XmlDocument info_plist = new XmlDocument (); - var target_info_plist = Path.Combine (TargetDirectory, $"Info{Suffix}-extension.plist"); - var original_info_plist_include = HarnessConfiguration.EvaluateRootTestsDirectory (OriginalInfoPListInclude); - info_plist.LoadWithoutNetworkAccess (Path.Combine (TargetDirectory, original_info_plist_include)); - BundleIdentifier = info_plist.GetCFBundleIdentifier () + "_watch"; - if (BundleIdentifier.Length >= 58) - BundleIdentifier = BundleIdentifier.Substring (0, 57); // If the main app's bundle id is 58 characters (or sometimes more), then the watch extension crashes at launch. radar #29847128. - info_plist.SetCFBundleIdentifier (BundleIdentifier + ".watchkitapp.watchkitextension"); - info_plist.SetMinimumOSVersion (GetMinimumOSVersion (Xamarin.SdkVersions.LegacyMinWatchOS)); - info_plist.SetUIDeviceFamily (4); - info_plist.AddPListStringValue ("RemoteInterfacePrincipleClass", "InterfaceController"); - info_plist.AddPListKeyValuePair ("NSExtension", "dict", string.Format ( -@" - NSExtensionAttributes - - WKAppBundleIdentifier - {0}.watchkitapp - - NSExtensionPointIdentifier - com.apple.watchkit -", BundleIdentifier)); - if (!info_plist.ContainsKey ("NSAppTransportSecurity")) { - info_plist.AddPListKeyValuePair ("NSAppTransportSecurity", "dict", - @" - NSAllowsArbitraryLoads - - "); - } - info_plist.Save (target_info_plist, Harness); - } - - protected override string Imports { - get { - return IsFSharp ? "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.FSharp.targets" : "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.CSharp.targets"; - } - } - - protected override string BindingsImports { - get { - return IsFSharp ? "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.ObjCBinding.FSharp.targets" : "$(MSBuildExtensionsPath)\\Xamarin\\WatchOS\\Xamarin.WatchOS.ObjCBinding.CSharp.targets"; - } - } - - void CreateWatchOSLibraryProject () - { - var csproj = inputProject; - csproj.SetProjectTypeGuids ("{FC940695-DFE0-4552-9F25-99AF4A5619A1};" + LanguageGuid); - csproj.SetOutputPath ("bin\\$(Platform)\\$(Configuration)" + Suffix); - csproj.SetIntermediateOutputPath ("obj\\$(Platform)\\$(Configuration)" + Suffix); - csproj.RemoveTargetFrameworkIdentifier (); - csproj.SetPlatformAssembly ("Xamarin.WatchOS"); - csproj.SetImport (IsBindingProject ? BindingsImports : Imports); - csproj.AddAdditionalDefines ("XAMCORE_3_0;MONOTOUCH_WATCH;"); - csproj.FixProjectReferences (Path.Combine (ProjectsDir, GetTargetSpecificDir ()), Suffix, FixProjectReference); - csproj.RemovePackageReference ("MonoTouch.Dialog"); - csproj.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); - csproj.FixTestLibrariesReferences (Platform); - csproj.ResolveAllPaths (TemplateProjectPath); - csproj.Save (WatchOSProjectPath, Harness); - - WatchOSGuid = csproj.GetProjectGuid (); - } - - protected override void ExecuteInternal () - { - ExtensionName = Name + " Extension"; - AppName = Name + " App"; - - var templateName = Path.GetFileName (TemplateProjectPath); - if (templateName.EndsWith (".template", StringComparison.OrdinalIgnoreCase)) - templateName = Path.GetFileNameWithoutExtension (templateName); - templateName = Path.GetFileNameWithoutExtension (templateName); - - switch (OutputType) { - case "Exe": - WatchOSExtensionProjectPath = Path.Combine (TargetDirectory, ProjectsDir, GetTargetSpecificDir ("extension"), templateName + Suffix + "-extension.csproj"); - WatchOSAppProjectPath = Path.Combine (TargetDirectory, ProjectsDir, GetTargetSpecificDir ("app"), templateName + Suffix + "-app.csproj"); - CreateWatchOSExtensionProject (); - CreateWatchOSAppProject (); - CreateWatchOSContainerProject (); - break; - case "Library": - CreateWatchOSLibraryProject (); - break; - default: - throw new Exception (string.Format ("Unknown OutputType: {0}", OutputType)); - } - } - - protected override string GetMinimumOSVersion (string templateMinimumOSVersion) - { - return templateMinimumOSVersion; - } - - public override string Suffix { - get { - return "-watchos"; - } - } - - public override string ExtraLinkerDefsSuffix { - get { - return "-watchos"; - } - } - - public override string Platform { - get { - return "watchos"; - } - } - - public override IEnumerable GetRelatedProjects () - { - return new RelatedProject [] { - new RelatedProject { Guid = WatchOSExtensionGuid, ProjectPath = WatchOSExtensionProjectPath }, - new RelatedProject { Guid = WatchOSAppGuid, ProjectPath = WatchOSAppProjectPath }, - }; - } - } -} diff --git a/tests/xharness/Targets/iOSTarget.cs b/tests/xharness/Targets/iOSTarget.cs deleted file mode 100644 index 208c88a815d3..000000000000 --- a/tests/xharness/Targets/iOSTarget.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.IO; -using System.Xml; -using Microsoft.DotNet.XHarness.iOS.Shared; -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; - -namespace Xharness.Targets { - // iOS here means Xamarin.iOS, not iOS as opposed to tvOS/watchOS. - public abstract class iOSTarget : Target { - public iOSTestProject TestProject; - - protected override void PostProcessExecutableProject () - { - base.PostProcessExecutableProject (); - - inputProject.FixArchitectures (SimulatorArchitectures, DeviceArchitectures); - inputProject.FixInfoPListInclude (Suffix); - inputProject.SetExtraLinkerDefs ("extra-linker-defs" + ExtraLinkerDefsSuffix + ".xml"); - - ProjectGuid = inputProject.GetProjectGuid (); - } - - protected override void UpdateInfoPList () - { - XmlDocument info_plist = new XmlDocument (); - var target_info_plist = Path.Combine (TargetDirectory, "Info" + Suffix + ".plist"); - var original_info_plist_include = HarnessConfiguration.EvaluateRootTestsDirectory (OriginalInfoPListInclude); - info_plist.LoadWithoutNetworkAccess (Path.Combine (TargetDirectory, original_info_plist_include)); - BundleIdentifier = info_plist.GetCFBundleIdentifier (); - info_plist.SetMinimumOSVersion (GetMinimumOSVersion (info_plist.GetMinimumOSVersion ())); - info_plist.SetUIDeviceFamily (UIDeviceFamily); - info_plist.Save (target_info_plist, Harness); - } - } -} diff --git a/tests/xharness/TestLabel.cs b/tests/xharness/TestLabel.cs index de55a4774f0f..22514fa3e325 100644 --- a/tests/xharness/TestLabel.cs +++ b/tests/xharness/TestLabel.cs @@ -51,23 +51,19 @@ public enum TestLabel : Int64 { Linker = 1 << 15, [Label ("library-projects")] LibraryProjects = 1 << 16, - [Label ("mac-binding-project")] - MacBindingProject = 1 << 17, - [Label ("mmp")] - Mmp = 1 << 18, + // 1 << 17 is unused + // 1 << 18 is unused // 1 << 19 is unused [Label ("monotouch")] Monotouch = 1 << 20, [Label ("msbuild")] Msbuild = 1 << 21, - [Label ("mtouch")] - Mtouch = 1 << 22, + // 1 << 22 is unused [Label ("sampletester")] SampleTester = 1 << 23, [Label ("system-permission")] SystemPermission = 1 << 24, - [Label ("xammac")] - Xammac = 1 << 25, + // 1 << 25 is unused [Label ("xcframework")] Xcframework = 1 << 26, [Label ("xtro")] @@ -100,12 +96,10 @@ public enum PlatformLabel : uint { OldiOSSimulator = 1 << 9, [Label ("tvos")] tvOS = 1 << 10, - [Label ("watchos")] - watchOS = 1 << 11, + // 1 << 11 is unused [Label ("dotnet")] Dotnet = 1 << 12, - [Label ("legacy-xamarin")] - LegacyXamarin = 1 << 13, + // 1 << 13 is unused [Label ("all")] All = 0xFFFFFFFF, } diff --git a/tests/xharness/TestPlatform.cs b/tests/xharness/TestPlatform.cs index c205266a1514..00d45ed9d64c 100644 --- a/tests/xharness/TestPlatform.cs +++ b/tests/xharness/TestPlatform.cs @@ -4,19 +4,8 @@ public enum TestPlatform { All, iOS, - iOS_Unified, - iOS_Unified32, - iOS_Unified64, - iOS_TodayExtension64, tvOS, - watchOS, - watchOS_32, - watchOS_64_32, MacCatalyst, - Mac, - Mac_Modern, - Mac_Full, - Mac_System, } } diff --git a/tests/xharness/TestPlatformExtensions.cs b/tests/xharness/TestPlatformExtensions.cs index 8687615ab3b6..0b062a0e839c 100644 --- a/tests/xharness/TestPlatformExtensions.cs +++ b/tests/xharness/TestPlatformExtensions.cs @@ -8,17 +8,9 @@ public static string GetSimulatorMinVersion (this TestPlatform platform) { switch (platform) { case TestPlatform.iOS: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_TodayExtension64: - case TestPlatform.iOS_Unified32: - case TestPlatform.iOS_Unified64: return "iOS " + Xamarin.SdkVersions.MiniOSSimulator; 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 ()); } @@ -28,9 +20,6 @@ public static bool IsMac (this TestPlatform platform) { switch (platform) { case TestPlatform.Mac: - case TestPlatform.Mac_Modern: - case TestPlatform.Mac_Full: - case TestPlatform.Mac_System: return true; default: return false; @@ -41,10 +30,6 @@ public static bool CanSymlink (this TestPlatform platform) { switch (platform) { case TestPlatform.iOS: - case TestPlatform.iOS_TodayExtension64: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_Unified32: - case TestPlatform.iOS_Unified64: return true; default: return false; @@ -56,23 +41,12 @@ public static string ToPlatformName (this TestPlatform platform) { switch (platform) { case TestPlatform.iOS: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_Unified32: - case TestPlatform.iOS_Unified64: - case TestPlatform.iOS_TodayExtension64: return "iOS"; case TestPlatform.tvOS: return "tvOS"; - case TestPlatform.watchOS: - case TestPlatform.watchOS_32: - case TestPlatform.watchOS_64_32: - return "watchOS"; case TestPlatform.MacCatalyst: return "MacCatalyst"; case TestPlatform.Mac: - case TestPlatform.Mac_Modern: - case TestPlatform.Mac_Full: - case TestPlatform.Mac_System: return "macOS"; default: return null; diff --git a/tests/xharness/TestProject.cs b/tests/xharness/TestProject.cs index a645531746c4..e749522c3df9 100644 --- a/tests/xharness/TestProject.cs +++ b/tests/xharness/TestProject.cs @@ -112,22 +112,11 @@ async Task CreateCopyAsync (ILog log, IProcessManager processManager, ITestTask if (test.ProjectPlatform == "iPhone") { switch (test.Platform) { case TestPlatform.iOS: - case TestPlatform.iOS_Unified: - case TestPlatform.iOS_Unified64: - case TestPlatform.iOS_TodayExtension64: doc.SetTopLevelPropertyGroupValue ("RuntimeIdentifier", "ios-arm64"); break; - case TestPlatform.iOS_Unified32: - doc.SetTopLevelPropertyGroupValue ("RuntimeIdentifier", "ios-arm"); - break; case TestPlatform.tvOS: doc.SetTopLevelPropertyGroupValue ("RuntimeIdentifier", "tvos-arm64"); break; - case TestPlatform.watchOS: - case TestPlatform.watchOS_32: - case TestPlatform.watchOS_64_32: - doc.SetTopLevelPropertyGroupValue ("RuntimeIdentifier", "watchos-arm"); - break; } } diff --git a/tests/xharness/TestProjectExtensions.cs b/tests/xharness/TestProjectExtensions.cs index 4190d0becb59..1ebe17f92289 100644 --- a/tests/xharness/TestProjectExtensions.cs +++ b/tests/xharness/TestProjectExtensions.cs @@ -19,31 +19,5 @@ public static TestProject AsTvOSProject (this TestProject self) clone.Path = Path.Combine (Path.GetDirectoryName (self.Path), Target.ProjectsDir, "tvos" + suffix, Path.GetFileNameWithoutExtension (self.Path) + "-tvos" + Path.GetExtension (self.Path)); return clone; } - - public static TestProject AsWatchOSProject (this TestProject self) - { - var clone = self.Clone (); - var fileName = Path.GetFileNameWithoutExtension (self.Path); - clone.Path = Path.Combine (Path.GetDirectoryName (self.Path), Target.ProjectsDir, "watchos", fileName + (fileName.Contains ("-watchos") ? "" : "-watchos") + Path.GetExtension (self.Path)); - return clone; - } - - public static TestProject AsTodayExtensionProject (this TestProject self) - { - var clone = self.Clone (); - clone.Path = Path.Combine (Path.GetDirectoryName (self.Path), Target.ProjectsDir, "today", Path.GetFileNameWithoutExtension (self.Path) + "-today" + Path.GetExtension (self.Path)); - return clone; - } - - // Get the referenced today extension project (if any) - public static TestProject GetTodayExtension (this TestProject self) - { - var extensions = self.Xml.GetExtensionProjectReferences ().ToArray (); - if (!extensions.Any ()) - return null; - if (extensions.Count () != 1) - throw new NotImplementedException (); - return new TestProject (self.Label, Path.GetFullPath (Path.Combine (Path.GetDirectoryName (self.Path), Target.ProjectsDir, "today-extension", extensions.First ().Replace ('\\', '/')))); - } } } diff --git a/tests/xharness/TestTargetExtensions.cs b/tests/xharness/TestTargetExtensions.cs index 08f86dd0fe77..1d5eadab3d21 100644 --- a/tests/xharness/TestTargetExtensions.cs +++ b/tests/xharness/TestTargetExtensions.cs @@ -10,16 +10,7 @@ public static TestTarget [] GetAppRunnerTargets (this TestPlatform platform) switch (platform) { case TestPlatform.tvOS: return new TestTarget [] { TestTarget.Simulator_tvOS }; - case TestPlatform.watchOS: - case TestPlatform.watchOS_32: - case TestPlatform.watchOS_64_32: - return new TestTarget [] { TestTarget.Simulator_watchOS }; - case TestPlatform.iOS_Unified: - return new TestTarget [] { TestTarget.Simulator_iOS64 }; - case TestPlatform.iOS_Unified32: - throw new NotSupportedException ($"32-bit simulators aren't supported anymore."); - case TestPlatform.iOS_Unified64: - case TestPlatform.iOS_TodayExtension64: + case TestPlatform.iOS: return new TestTarget [] { TestTarget.Simulator_iOS64 }; default: throw new NotImplementedException (platform.ToString ()); @@ -31,7 +22,6 @@ public static TestTargetOs GetTargetOs (this TestTarget target, bool minVersion) return target switch { TestTarget.Simulator_iOS64 => new TestTargetOs (target, minVersion ? Xamarin.SdkVersions.MiniOSSimulator : Xamarin.SdkVersions.MaxiOSSimulator), TestTarget.Simulator_tvOS => new TestTargetOs (target, minVersion ? Xamarin.SdkVersions.MinTVOSSimulator : Xamarin.SdkVersions.MaxTVOSSimulator), - TestTarget.Simulator_watchOS => new TestTargetOs (target, minVersion ? Xamarin.SdkVersions.MinWatchOSSimulator : Xamarin.SdkVersions.MaxWatchOSSimulator), _ => throw new Exception (string.Format ("Invalid simulator target: {0}", target)) }; diff --git a/tests/xharness/Xharness.Tests/Jenkins/JenkinsDeviceLoadterTests.cs b/tests/xharness/Xharness.Tests/Jenkins/JenkinsDeviceLoadterTests.cs index c631410a3ff2..f6cd6d2c5ebd 100644 --- a/tests/xharness/Xharness.Tests/Jenkins/JenkinsDeviceLoadterTests.cs +++ b/tests/xharness/Xharness.Tests/Jenkins/JenkinsDeviceLoadterTests.cs @@ -27,7 +27,6 @@ public static IEnumerable GetDeviceTestCases { devices.Setup (d => d.Connected32BitIOS).Returns (Array.Empty ()); devices.Setup (d => d.Connected64BitIOS).Returns (Array.Empty ()); devices.Setup (d => d.ConnectedTV).Returns (Array.Empty ()); - devices.Setup (d => d.ConnectedWatch).Returns (Array.Empty ()); yield return new TestCaseData (simulators.Object, devices.Object, $"Device Listing (ok - no devices found)."); @@ -36,7 +35,6 @@ public static IEnumerable GetDeviceTestCases { devices.Setup (d => d.Connected32BitIOS).Returns (new IHardwareDevice [] { aDevice.Object }); devices.Setup (d => d.Connected64BitIOS).Returns (Array.Empty ()); devices.Setup (d => d.ConnectedTV).Returns (Array.Empty ()); - devices.Setup (d => d.ConnectedWatch).Returns (Array.Empty ()); yield return new TestCaseData (simulators.Object, devices.Object, $"Device Listing (ok). Devices types are: iOS 32 bit"); @@ -44,7 +42,6 @@ public static IEnumerable GetDeviceTestCases { devices.Setup (d => d.Connected32BitIOS).Returns (new IHardwareDevice [] { aDevice.Object }); devices.Setup (d => d.Connected64BitIOS).Returns (new IHardwareDevice [] { aDevice.Object }); devices.Setup (d => d.ConnectedTV).Returns (Array.Empty ()); - devices.Setup (d => d.ConnectedWatch).Returns (Array.Empty ()); yield return new TestCaseData (simulators.Object, devices.Object, $"Device Listing (ok). Devices types are: iOS 32 bit, iOS 64 bit"); @@ -52,15 +49,13 @@ public static IEnumerable GetDeviceTestCases { devices.Setup (d => d.Connected32BitIOS).Returns (new IHardwareDevice [] { aDevice.Object }); devices.Setup (d => d.Connected64BitIOS).Returns (new IHardwareDevice [] { aDevice.Object }); devices.Setup (d => d.ConnectedTV).Returns (new IHardwareDevice [] { aDevice.Object }); - devices.Setup (d => d.ConnectedWatch).Returns (Array.Empty ()); yield return new TestCaseData (simulators.Object, devices.Object, $"Device Listing (ok). Devices types are: iOS 32 bit, iOS 64 bit, tvOS"); devices = new Mock (); devices.Setup (d => d.Connected32BitIOS).Returns (new IHardwareDevice [] { aDevice.Object }); devices.Setup (d => d.Connected64BitIOS).Returns (new IHardwareDevice [] { aDevice.Object }); devices.Setup (d => d.ConnectedTV).Returns (new IHardwareDevice [] { aDevice.Object }); - devices.Setup (d => d.ConnectedWatch).Returns (new IHardwareDevice [] { aDevice.Object }); - yield return new TestCaseData (simulators.Object, devices.Object, $"Device Listing (ok). Devices types are: iOS 32 bit, iOS 64 bit, tvOS, watchOS"); + yield return new TestCaseData (simulators.Object, devices.Object, $"Device Listing (ok). Devices types are: iOS 32 bit, iOS 64 bit, tvOS"); } } diff --git a/tests/xharness/Xharness.Tests/Jenkins/MakeTestTaskEnumerableTests.cs b/tests/xharness/Xharness.Tests/Jenkins/MakeTestTaskEnumerableTests.cs deleted file mode 100644 index ddd6a76df976..000000000000 --- a/tests/xharness/Xharness.Tests/Jenkins/MakeTestTaskEnumerableTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Linq; -using Microsoft.DotNet.XHarness.iOS.Shared; -using Microsoft.DotNet.XHarness.iOS.Shared.Execution; -using Microsoft.DotNet.XHarness.iOS.Shared.Listeners; -using Moq; -using NUnit.Framework; -using Xharness.Jenkins; - -namespace Xharness.Tests.Jenkins { - - [TestFixture] - public class MakeTestTaskEnumerableTests { - - Mock processManager; - Mock resultParser; - Mock tunnel; - - Harness harness; - HarnessConfiguration configuration; - Xharness.Jenkins.Jenkins jenkins; - MakeTestTaskEnumerable factory; - - [SetUp] - public void SetUp () - { - processManager = new Mock (); - resultParser = new Mock (); - tunnel = new Mock (); - configuration = new HarnessConfiguration (); - harness = new Harness (resultParser.Object, HarnessAction.Jenkins, configuration); - jenkins = new Xharness.Jenkins.Jenkins (harness, processManager.Object, resultParser.Object, tunnel.Object); - - factory = new MakeTestTaskEnumerable (jenkins, processManager.Object); - } - - [TearDown] - public void TearDown () - { - processManager = null; - resultParser = null; - configuration = null; - harness = null; - jenkins = null; - factory = null; - } - - [TestCase ("MMP Regression Tests")] - [TestCase ("Mac Binding Projects")] - [TestCase ("Documentation")] - public void ContainsTest (string testName) - => Assert.True (factory.Select (t => t.TestName == testName).Any (), testName); - - [Test] - public void CountTest () - => Assert.AreEqual (3, factory.Count (), "Added or removed tests?"); - } -} diff --git a/tests/xharness/Xharness.Tests/Jenkins/TestSelectionTests.cs b/tests/xharness/Xharness.Tests/Jenkins/TestSelectionTests.cs index a1158a88d1c7..900cda0407a4 100644 --- a/tests/xharness/Xharness.Tests/Jenkins/TestSelectionTests.cs +++ b/tests/xharness/Xharness.Tests/Jenkins/TestSelectionTests.cs @@ -34,9 +34,6 @@ public void DefaultSelectionTest () Assert.IsTrue (selection.SelectedPlatforms.HasFlag (PlatformLabel.tvOS), "tvos"); Assert.IsTrue (selection.IsEnabled (PlatformLabel.tvOS), "IsEnabled (tvOS)"); - Assert.IsTrue (selection.SelectedPlatforms.HasFlag (PlatformLabel.watchOS), "watchOS"); - Assert.IsTrue (selection.IsEnabled (PlatformLabel.watchOS), "IsEnabled (watchOS)"); - Assert.IsTrue (selection.SelectedPlatforms.HasFlag (PlatformLabel.iOS), "iOS"); Assert.IsTrue (selection.IsEnabled (PlatformLabel.iOS), "IsEnabled (iOS)"); diff --git a/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/AssemblyLocatorTest.cs b/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/AssemblyLocatorTest.cs index 9262469a9ca6..98933167fb6d 100644 --- a/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/AssemblyLocatorTest.cs +++ b/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/AssemblyLocatorTest.cs @@ -5,7 +5,7 @@ namespace Xharness.Tests.TestImporter.Xamarin.Tests { - // very simple class, but we want to make sure that iOS, tvOS, watchOS get the iosDownload and the mac + // very simple class, but we want to make sure that iOS, tvOS get the iosDownload and the mac // versions get the mac download [TestFixture] public class AssemblyLocatorTest { @@ -19,18 +19,7 @@ public class AssemblyLocatorTest { [TestCase (Platform.iOS, iOSPath)] [TestCase (Platform.TvOS, iOSPath)] - [TestCase (Platform.WatchOS, iOSPath)] - [TestCase (Platform.MacOSFull, macOSPath)] - [TestCase (Platform.MacOSModern, macOSPath)] public void GetAssembliesRootLocationTest (Platform platform, string expected) => Assert.AreEqual (expected, assemblyLocator.GetAssembliesRootLocation (platform)); - - [TestCase (Platform.iOS, iOSPath, "ios-bcl", "monotouch", "tests")] - [TestCase (Platform.TvOS, iOSPath, "ios-bcl", "monotouch_tv", "tests")] - [TestCase (Platform.WatchOS, iOSPath, "ios-bcl", "monotouch_watch", "tests")] - [TestCase (Platform.MacOSFull, macOSPath, "mac-bcl", "xammac_net_4_5", "tests")] - public void GetAssembliesLocation (Platform platform, params string [] expected) - => Assert.AreEqual (Path.Combine (expected), assemblyLocator.GetAssembliesLocation (platform)); - } } diff --git a/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/XamariniOSTemplateTest.cs b/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/XamariniOSTemplateTest.cs index 4eab2c86148e..c58af8e9e845 100644 --- a/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/XamariniOSTemplateTest.cs +++ b/tests/xharness/Xharness.Tests/TestImporter/Xamarin/Tests/XamariniOSTemplateTest.cs @@ -42,10 +42,7 @@ public void TearDown () template = null; } [TestCase ("iOSProject", Platform.iOS, "iOSProject.csproj")] - [TestCase ("WatchOSProject", Platform.WatchOS, "WatchOSProject-watchos.csproj")] [TestCase ("TvOSProject", Platform.TvOS, "TvOSProject-tvos.csproj")] - [TestCase ("macOSProject", Platform.MacOSFull, "macOSProject-mac-full.csproj")] - [TestCase ("macOSProject", Platform.MacOSModern, "macOSProject-mac-modern.csproj")] public void GetProjectPathTest (string projectName, Platform platform, string expectedName) { // ignore the fact that all params are the same, we do not care @@ -53,34 +50,14 @@ public void GetProjectPathTest (string projectName, Platform platform, string ex Assert.AreEqual (Path.Combine (template.OutputDirectoryPath, "generated", platform.ToString (), projectName, expectedName), path); } - [TestCase ("WatchApp", WatchAppType.App, "WatchApp-watchos-app.csproj")] - [TestCase ("WatchExtension", WatchAppType.Extension, "WatchExtension-watchos-extension.csproj")] - public void GetProjectPathWatchOSTest (string projectName, WatchAppType appType, string expectedName) - { - // ignore the fact that all params are the same, we do not care - var path = template.GetProjectPath (projectName, appType); - Assert.AreEqual (Path.Combine (template.OutputDirectoryPath, "generated", Platform.WatchOS.ToString (), projectName, appType.ToString ().ToLowerInvariant (), expectedName), path); - } - [TestCase ("/usr/path", Platform.iOS, "Info.plist")] [TestCase ("/usr/second/path", Platform.TvOS, "Info-tvos.plist")] - [TestCase ("/usr/other/path", Platform.WatchOS, "Info-watchos.plist")] - [TestCase ("/usr/other/path", Platform.MacOSFull, "Info-mac.plist")] - [TestCase ("/usr/other/path", Platform.MacOSModern, "Info-mac.plist")] public void GetPListPathTest (string rootDir, Platform platform, string expectedName) { var path = XamariniOSTemplate.GetPListPath (rootDir, platform); Assert.AreEqual (Path.Combine (rootDir, expectedName), path); } - [TestCase ("/usr/bin", WatchAppType.App, "Info-watchos-app.plist")] - [TestCase ("/usr/local", WatchAppType.Extension, "Info-watchos-extension.plist")] - public void GetPListPathWatchOSTest (string rootDir, WatchAppType appType, string expectedName) - { - var path = XamariniOSTemplate.GetPListPath (rootDir, appType); - Assert.AreEqual (Path.Combine (rootDir, expectedName), path); - } - [TestCase ("System.Xml.dll")] [TestCase ("MyAssembly.dll")] public void GetReferenceNodeNullHintTest (string assembly) diff --git a/tests/xharness/Xharness.Tests/Tests/MacFlavorsExtensionsTests.cs b/tests/xharness/Xharness.Tests/Tests/MacFlavorsExtensionsTests.cs deleted file mode 100644 index b9def59cd83d..000000000000 --- a/tests/xharness/Xharness.Tests/Tests/MacFlavorsExtensionsTests.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.DotNet.XHarness.iOS.Shared; -using NUnit.Framework; - -namespace Xharness.Tests.Tests { - - [TestFixture] - public class MacFlavorsExtensionsTests { - - [TestCase (MacFlavors.Console, TestPlatform.Mac)] - [TestCase (MacFlavors.Full, TestPlatform.Mac_Full)] - [TestCase (MacFlavors.Modern, TestPlatform.Mac_Modern)] - [TestCase (MacFlavors.System, TestPlatform.Mac_System)] - public void ToTestPlatformTest (MacFlavors flavor, TestPlatform expected) - => Assert.AreEqual (flavor.ToTestPlatform (), expected); - } -} diff --git a/tests/xharness/Xharness.Tests/Tests/TestPlatformExtensionsTests.cs b/tests/xharness/Xharness.Tests/Tests/TestPlatformExtensionsTests.cs index d925fd696742..f18dcf10b3d6 100644 --- a/tests/xharness/Xharness.Tests/Tests/TestPlatformExtensionsTests.cs +++ b/tests/xharness/Xharness.Tests/Tests/TestPlatformExtensionsTests.cs @@ -10,19 +10,10 @@ public class TestPlatformExtensionsTests { public class TestCasesData { public static IEnumerable GetSimulatorTestCases { get { - foreach (var platform in new [] { TestPlatform.iOS, - TestPlatform.iOS_Unified, - TestPlatform.iOS_TodayExtension64, - TestPlatform.iOS_Unified32, - TestPlatform.iOS_Unified64,}) { + foreach (var platform in new [] { TestPlatform.iOS }) { yield return new TestCaseData (platform).Returns ("iOS " + Xamarin.SdkVersions.MiniOSSimulator); } yield return new TestCaseData (TestPlatform.tvOS).Returns ("tvOS " + Xamarin.SdkVersions.MinTVOSSimulator); - foreach (var platform in new [] { TestPlatform.watchOS, - TestPlatform.watchOS_32, - TestPlatform.watchOS_64_32}) { - yield return new TestCaseData (platform).Returns ("watchOS " + Xamarin.SdkVersions.MinWatchOSSimulator); - } } } @@ -32,21 +23,11 @@ public static IEnumerable IsMacTestCases { foreach (var platform in new [] { TestPlatform.None, TestPlatform.All, TestPlatform.iOS, - TestPlatform.iOS_Unified, - TestPlatform.iOS_Unified32, - TestPlatform.iOS_Unified64, - TestPlatform.iOS_TodayExtension64, - TestPlatform.tvOS, - TestPlatform.watchOS, - TestPlatform.watchOS_32, - TestPlatform.watchOS_64_32 }) { + TestPlatform.tvOS }) { yield return new TestCaseData (platform).Returns (false); } - foreach (var platform in new [] { TestPlatform.Mac, - TestPlatform.Mac_Modern, - TestPlatform.Mac_Full, - TestPlatform.Mac_System }) { + foreach (var platform in new [] { TestPlatform.Mac }) { yield return new TestCaseData (platform).Returns (true); } } @@ -54,24 +35,14 @@ public static IEnumerable IsMacTestCases { public static IEnumerable CanSymlinkTestCases { get { - foreach (var platform in new [] { TestPlatform.iOS, - TestPlatform.iOS_TodayExtension64, - TestPlatform.iOS_Unified, - TestPlatform.iOS_Unified32, - TestPlatform.iOS_Unified64 }) { + foreach (var platform in new [] { TestPlatform.iOS }) { yield return new TestCaseData (platform).Returns (true); } foreach (var platform in new [] {TestPlatform.None, TestPlatform.tvOS, - TestPlatform.watchOS, - TestPlatform.watchOS_32, - TestPlatform.watchOS_64_32, - TestPlatform.Mac, - TestPlatform.Mac_Modern, - TestPlatform.Mac_Full, - TestPlatform.Mac_System}) { + TestPlatform.Mac }) { yield return new TestCaseData (platform).Returns (false); } } diff --git a/tests/xharness/Xharness.Tests/Tests/TestTargetExtensionsTests.cs b/tests/xharness/Xharness.Tests/Tests/TestTargetExtensionsTests.cs index 0722b6fb4c39..64efc73be642 100644 --- a/tests/xharness/Xharness.Tests/Tests/TestTargetExtensionsTests.cs +++ b/tests/xharness/Xharness.Tests/Tests/TestTargetExtensionsTests.cs @@ -9,12 +9,6 @@ namespace Xharness.Tests.Tests { public class TestTargetExtensionsTests { [TestCase (TestPlatform.tvOS, new [] { TestTarget.Simulator_tvOS })] - [TestCase (TestPlatform.watchOS, new [] { TestTarget.Simulator_watchOS })] - [TestCase (TestPlatform.watchOS_32, new [] { TestTarget.Simulator_watchOS })] - [TestCase (TestPlatform.watchOS_64_32, new [] { TestTarget.Simulator_watchOS })] - [TestCase (TestPlatform.iOS_Unified, new [] { TestTarget.Simulator_iOS64 })] - [TestCase (TestPlatform.iOS_Unified64, new [] { TestTarget.Simulator_iOS64 })] - [TestCase (TestPlatform.iOS_TodayExtension64, new [] { TestTarget.Simulator_iOS64 })] public void GetAppRunnerTargetsTest (TestPlatform platform, TestTarget [] expectedTargets) { var targets = platform.GetAppRunnerTargets (); diff --git a/tests/xharness/Xharness.Tests/Xharness.Tests.csproj b/tests/xharness/Xharness.Tests/Xharness.Tests.csproj index c443b6eff265..aa9e19d2f69c 100644 --- a/tests/xharness/Xharness.Tests/Xharness.Tests.csproj +++ b/tests/xharness/Xharness.Tests/Xharness.Tests.csproj @@ -16,8 +16,6 @@ - - diff --git a/tests/xharness/iOSTestProject.cs b/tests/xharness/iOSTestProject.cs index 6d8a9cf2c214..ec6f171726a4 100644 --- a/tests/xharness/iOSTestProject.cs +++ b/tests/xharness/iOSTestProject.cs @@ -4,15 +4,12 @@ namespace Xharness { public class iOSTestProject : TestProject { public bool SkipiOSVariation; - public bool SkipwatchOSVariation; // skip both - public bool SkipwatchOSARM64_32Variation; public bool SkiptvOSVariation; - public bool SkipTodayExtensionVariation; public bool SkipDeviceVariations; public bool BuildOnly; - public iOSTestProject (TestLabel label, string path, bool isExecutableProject = true) - : base (label, path, isExecutableProject) + public iOSTestProject (TestLabel label, string path) + : base (label, path, true) { Name = System.IO.Path.GetFileNameWithoutExtension (path); } @@ -24,17 +21,14 @@ public bool IsSupported (DevicePlatform devicePlatform, string productVersion) public override TestProject Clone () { - return CompleteClone (new iOSTestProject (Label, Path, IsExecutableProject)); + return CompleteClone (new iOSTestProject (Label, Path)); } protected override TestProject CompleteClone (TestProject project) { var rv = (iOSTestProject) project; rv.SkipiOSVariation = SkipiOSVariation; - rv.SkipwatchOSVariation = SkipwatchOSVariation; - rv.SkipwatchOSARM64_32Variation = SkipwatchOSARM64_32Variation; rv.SkiptvOSVariation = SkiptvOSVariation; - rv.SkipTodayExtensionVariation = SkipTodayExtensionVariation; rv.SkipDeviceVariations = SkipDeviceVariations; rv.BuildOnly = BuildOnly; return base.CompleteClone (rv); diff --git a/tests/xharness/xharness.csproj b/tests/xharness/xharness.csproj index 1fb000b19799..7899035397d6 100644 --- a/tests/xharness/xharness.csproj +++ b/tests/xharness/xharness.csproj @@ -26,15 +26,11 @@ Project - --verbose --jenkins --autoconf --rootdir .. --label=skip-mac-tests,skip-ios-simulator-tests,skip-ios-msbuild-tests,skip-system-permission-tests,run-ios-device-tests,run-ios-extensions-tests --markdown-summary=../TestSummary.md --label=run-watchos-tests + --verbose --jenkins --autoconf --rootdir .. --label=skip-mac-tests,skip-ios-simulator-tests,skip-ios-msbuild-tests,skip-system-permission-tests,run-ios-device-tests,run-ios-extensions-tests --markdown-summary=../TestSummary.md - - Project - --configure --autoconf --rootdir ../../../.. - @@ -56,7 +52,6 @@ - @@ -108,14 +103,7 @@ - - - - - - - diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVFoundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVFoundation.todo index 4e37b3aa228b..747df9b01d3e 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVFoundation.todo +++ b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AVFoundation.todo @@ -315,14 +315,6 @@ !missing-field! AVAudioSessionRenderingModeNewRenderingModeKey not bound !missing-field! AVCaptureDeviceTypeContinuityCamera not bound !missing-field! AVCaptureDeviceTypeMicrophone not bound -!missing-field! AVCaptureReactionTypeBalloons not bound -!missing-field! AVCaptureReactionTypeConfetti not bound -!missing-field! AVCaptureReactionTypeFireworks not bound -!missing-field! AVCaptureReactionTypeHeart not bound -!missing-field! AVCaptureReactionTypeLasers not bound -!missing-field! AVCaptureReactionTypeRain not bound -!missing-field! AVCaptureReactionTypeThumbsDown not bound -!missing-field! AVCaptureReactionTypeThumbsUp not bound !missing-field! AVFileTypeAHAP not bound !missing-field! AVMediaCharacteristicCarriesVideoStereoMetadata not bound !missing-field! AVMediaCharacteristicContainsStereoMultiviewVideo not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-StoreKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-StoreKit.ignore new file mode 100644 index 000000000000..1295a3d58015 --- /dev/null +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-StoreKit.ignore @@ -0,0 +1,2 @@ +# This is one of our own types. +!unknown-type! XamarinSwiftFunctions bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo index 344b5208ca20..eb05e8cd30f0 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo @@ -319,14 +319,6 @@ !missing-field! AVAudioApplicationMuteStateKey not bound !missing-field! AVAudioSessionPortContinuityMicrophone not bound !missing-field! AVCaptureDeviceTypeMicrophone not bound -!missing-field! AVCaptureReactionTypeBalloons not bound -!missing-field! AVCaptureReactionTypeConfetti not bound -!missing-field! AVCaptureReactionTypeFireworks not bound -!missing-field! AVCaptureReactionTypeHeart not bound -!missing-field! AVCaptureReactionTypeLasers not bound -!missing-field! AVCaptureReactionTypeRain not bound -!missing-field! AVCaptureReactionTypeThumbsDown not bound -!missing-field! AVCaptureReactionTypeThumbsUp not bound !missing-field! AVFileTypeAHAP not bound !missing-field! AVMediaCharacteristicCarriesVideoStereoMetadata not bound !missing-field! AVMediaCharacteristicContainsStereoMultiviewVideo not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo index dd9cbbc39fdc..bddf52e047b9 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo @@ -315,14 +315,6 @@ !missing-field! AVAudioApplicationInputMuteStateChangeNotification not bound !missing-field! AVAudioApplicationMuteStateKey not bound !missing-field! AVCaptureDeviceTypeMicrophone not bound -!missing-field! AVCaptureReactionTypeBalloons not bound -!missing-field! AVCaptureReactionTypeConfetti not bound -!missing-field! AVCaptureReactionTypeFireworks not bound -!missing-field! AVCaptureReactionTypeHeart not bound -!missing-field! AVCaptureReactionTypeLasers not bound -!missing-field! AVCaptureReactionTypeRain not bound -!missing-field! AVCaptureReactionTypeThumbsDown not bound -!missing-field! AVCaptureReactionTypeThumbsUp not bound !missing-field! AVFileTypeAHAP not bound !missing-field! AVMediaCharacteristicCarriesVideoStereoMetadata not bound !missing-field! AVMediaCharacteristicContainsStereoMultiviewVideo not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo index e04df5211b2c..19a70995a792 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo +++ b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.todo @@ -323,14 +323,6 @@ !missing-field! AVCaptureISOCurrent not bound !missing-field! AVCaptureLensPositionCurrent not bound !missing-field! AVCaptureMaxAvailableTorchLevel not bound -!missing-field! AVCaptureReactionTypeBalloons not bound -!missing-field! AVCaptureReactionTypeConfetti not bound -!missing-field! AVCaptureReactionTypeFireworks not bound -!missing-field! AVCaptureReactionTypeHeart not bound -!missing-field! AVCaptureReactionTypeLasers not bound -!missing-field! AVCaptureReactionTypeRain not bound -!missing-field! AVCaptureReactionTypeThumbsDown not bound -!missing-field! AVCaptureReactionTypeThumbsUp not bound !missing-field! AVCaptureSessionDidStartRunningNotification not bound !missing-field! AVCaptureSessionDidStopRunningNotification not bound !missing-field! AVCaptureSessionErrorKey not bound diff --git a/tools/Makefile b/tools/Makefile index 5a840a4d286d..8a3c97c0bd7e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -19,9 +19,6 @@ endif ifdef INCLUDE_TVOS INCLUDE_MTOUCH=1 endif -ifdef INCLUDE_WATCH -INCLUDE_MTOUCH=1 -endif ifdef INCLUDE_MACCATALYST INCLUDE_MTOUCH=1 endif diff --git a/tools/common/SdkVersions.cs b/tools/common/SdkVersions.cs index ff9018a54da3..7032b3d82396 100644 --- a/tools/common/SdkVersions.cs +++ b/tools/common/SdkVersions.cs @@ -28,9 +28,9 @@ static class SdkVersions { public const string MinMacCatalyst = "15.0"; #else public const string MinOSX = "12.0"; - public const string MiniOS = "11.0"; + public const string MiniOS = "12.2"; public const string MinWatchOS = "4.0"; - public const string MinTVOS = "11.0"; + public const string MinTVOS = "12.2"; public const string MinMacCatalyst = "15.0"; #endif @@ -39,9 +39,9 @@ static class SdkVersions { public const string DotNetMinTVOS = "12.2"; public const string DotNetMinMacCatalyst = "15.0"; public const string LegacyMinOSX = "12.0"; - public const string LegacyMiniOS = "11.0"; + public const string LegacyMiniOS = "12.2"; public const string LegacyMinWatchOS = "4.0"; - public const string LegacyMinTVOS = "11.0"; + public const string LegacyMinTVOS = "12.2"; public const string MiniOSSimulator = "15.0"; public const string MinWatchOSSimulator = "8.0"; diff --git a/tools/compare-commits.sh b/tools/compare-commits.sh index ab9b7c6c337d..9d0906f85ea4 100755 --- a/tools/compare-commits.sh +++ b/tools/compare-commits.sh @@ -221,10 +221,10 @@ mkdir -p "$(dirname "$GH_COMMENTS_FILE")" if test -z "$SKIP_DIRTY_CHECK"; then if [ -n "$(git status --porcelain --ignore-submodule)" ]; then - report_error_line "${RED}** Error: Working directory isn't clean:${CLEAR}" + report_error_line "${RED}** Error: Working directory isn't clean - check build log for more information.${CLEAR}" # The funny GIT_COLOR_P syntax is explained here: https://stackoverflow.com/a/61551944/183422 - git ${GIT_COLOR_P[@]+"${GIT_COLOR_P[@]}"} status --ignore-submodules | sed 's/^/ /' | while read -r line; do report_error_line "$line"; done || true - git ${GIT_COLOR_P[@]+"${GIT_COLOR_P[@]}"} diff --ignore-submodules | sed 's/^/ /' | while read -r line; do report_error_line "$line"; done || true + git ${GIT_COLOR_P[@]+"${GIT_COLOR_P[@]}"} status --ignore-submodules | sed 's/^/ /' || true + git ${GIT_COLOR_P[@]+"${GIT_COLOR_P[@]}"} diff --ignore-submodules | sed 's/^/ /' || true exit 1 fi fi @@ -445,7 +445,6 @@ fi if [ -z ${INCLUDE_IOS+x} ]; then INCLUDE_IOS=$(make -C "$ROOT_DIR"/tools/devops print-variable VARIABLE=INCLUDE_IOS | sed 's/.*=//'); fi if [ -z ${INCLUDE_TVOS+x} ]; then INCLUDE_TVOS=$(make -C "$ROOT_DIR"/tools/devops print-variable VARIABLE=INCLUDE_TVOS | sed 's/.*=//'); fi if [ -z ${INCLUDE_MAC+x} ]; then INCLUDE_MAC=$(make -C "$ROOT_DIR"/tools/devops print-variable VARIABLE=INCLUDE_MAC | sed 's/.*=//'); fi -if [ -z ${INCLUDE_WATCH+x} ]; then INCLUDE_WATCH=$(make -C "$ROOT_DIR"/tools/devops print-variable VARIABLE=INCLUDE_WATCH | sed 's/.*=//'); fi if [ -z ${DOTNET_PLATFORMS+x} ]; then DOTNET_PLATFORMS=$(make -C "$ROOT_DIR"/tools/devops print-variable VARIABLE=DOTNET_PLATFORMS | sed 's/.*=//'); fi if [ -z ${DOTNET_TFM+x} ]; then DOTNET_TFM=$(make -C "$ROOT_DIR"/tools/devops print-variable VARIABLE=DOTNET_TFM | sed 's/.*=//'); fi diff --git a/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 b/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 index 8e4cbd27a126..b60750abc45c 100644 --- a/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 +++ b/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 @@ -5,7 +5,6 @@ TestConfiguration unit tests. $ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path Import-Module $ScriptDir/TestConfiguration.psm1 -Force -$Env:CONFIGURE_PLATFORMS_INCLUDE_WATCH = "1" $Env:CONFIGURE_PLATFORMS_INCLUDE_XAMARIN_LEGACY = "1" Describe 'Get-TestConfiguration' { @@ -154,15 +153,6 @@ Describe 'Get-TestConfiguration' { "TEST_PREFIX": "test-prefix_monotouchtest_tvos", "TEST_PLATFORM": "tvOS", "TEST_FILTER": "Category != MultiPlatform" - }, - "monotouchtest_watchos": { - "LABEL": "monotouchtest", - "TESTS_LABELS": "extra-test-labels,run-monotouchtest-tests", - "LABEL_WITH_PLATFORM": "monotouchtest_watchOS", - "STATUS_CONTEXT": "status-context - monotouchtest - watchOS", - "TEST_PREFIX": "test-prefix_monotouchtest_watchos", - "TEST_PLATFORM": "watchOS", - "TEST_FILTER": "Category != MultiPlatform" } } "@ @@ -206,15 +196,6 @@ Describe 'Get-TestConfiguration' { "TEST_PREFIX": "test-prefix_monotouchtest_ios", "TEST_PLATFORM": "iOS", "TEST_FILTER": "Category != MultiPlatform" - }, - "monotouchtest_watchos": { - "LABEL": "monotouchtest", - "TESTS_LABELS": "extra-test-labels,run-monotouchtest-tests", - "LABEL_WITH_PLATFORM": "monotouchtest_watchOS", - "STATUS_CONTEXT": "status-context - monotouchtest - watchOS", - "TEST_PREFIX": "test-prefix_monotouchtest_watchos", - "TEST_PLATFORM": "watchOS", - "TEST_FILTER": "Category != MultiPlatform" } } "@ @@ -240,15 +221,6 @@ Describe 'Get-TestConfiguration' { "STATUS_CONTEXT": "status-context - cecil", "TEST_PREFIX": "test-prefix_cecil", "TEST_PLATFORM": "" - }, - "monotouchtest_watchos": { - "LABEL": "monotouchtest", - "TESTS_LABELS": "extra-test-labels,run-monotouchtest-tests", - "LABEL_WITH_PLATFORM": "monotouchtest_watchOS", - "STATUS_CONTEXT": "status-context - monotouchtest - watchOS", - "TEST_PREFIX": "test-prefix_monotouchtest_watchos", - "TEST_PLATFORM": "watchOS", - "TEST_FILTER": "Category != MultiPlatform" } } "@ @@ -337,15 +309,6 @@ Describe 'Get-TestConfiguration' { "TEST_PREFIX": "test-prefix_monotouchtest_maccatalyst", "TEST_PLATFORM": "MacCatalyst", "TEST_FILTER": "Category != MultiPlatform" - }, - "monotouchtest_watchos": { - "LABEL": "monotouchtest", - "TESTS_LABELS": "extra-test-labels,run-monotouchtest-tests", - "LABEL_WITH_PLATFORM": "monotouchtest_watchOS", - "STATUS_CONTEXT": "status-context - monotouchtest - watchOS", - "TEST_PREFIX": "test-prefix_monotouchtest_watchos", - "TEST_PLATFORM": "watchOS", - "TEST_FILTER": "Category != MultiPlatform" } } "@ diff --git a/tools/devops/automation/scripts/TestResults.Tests.ps1 b/tools/devops/automation/scripts/TestResults.Tests.ps1 index f73f03020875..bf9c580358be 100644 --- a/tools/devops/automation/scripts/TestResults.Tests.ps1 +++ b/tools/devops/automation/scripts/TestResults.Tests.ps1 @@ -18,7 +18,7 @@ Describe "TestResults tests" { { "dotnettests_ios": { "LABEL": "dotnettests", - "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests,run-dotnettests-tests", + "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-dotnettests-tests", "LABEL_WITH_PLATFORM": "dotnettests_iOS", "STATUS_CONTEXT": "VSTS: simulator tests - dotnettests - iOS", "TEST_simulator_tests": "simulator_dotnettests_ios", @@ -27,7 +27,7 @@ Describe "TestResults tests" { }, "dotnettests_tvos": { "LABEL": "dotnettests", - "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests,run-dotnettests-tests", + "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-dotnettests-tests", "LABEL_WITH_PLATFORM": "dotnettests_tvOS", "STATUS_CONTEXT": "VSTS: simulator tests - dotnettests - tvOS", "TEST_simulator_tests": "simulator_dotnettests_tvos", @@ -36,7 +36,7 @@ Describe "TestResults tests" { }, "dotnettests_maccatalyst": { "LABEL": "dotnettests", - "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests,run-dotnettests-tests", + "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-dotnettests-tests", "LABEL_WITH_PLATFORM": "dotnettests_MacCatalyst", "STATUS_CONTEXT": "VSTS: simulator tests - dotnettests - MacCatalyst", "TEST_simulator_tests": "simulator_dotnettests_maccatalyst", @@ -45,7 +45,7 @@ Describe "TestResults tests" { }, "dotnettests_macos": { "LABEL": "dotnettests", - "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests,run-dotnettests-tests", + "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-dotnettests-tests", "LABEL_WITH_PLATFORM": "dotnettests_macOS", "STATUS_CONTEXT": "VSTS: simulator tests - dotnettests - macOS", "TEST_simulator_tests": "simulator_dotnettests_macos", @@ -54,7 +54,7 @@ Describe "TestResults tests" { }, "dotnettests_multiple": { "LABEL": "dotnettests", - "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests,run-dotnettests-tests", + "TESTS_LABELS": "--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-dotnettests-tests", "LABEL_WITH_PLATFORM": "dotnettests_Multiple", "STATUS_CONTEXT": "VSTS: simulator tests - dotnettests - Multiple", "TEST_simulator_tests": "simulator_dotnettests_multiple", @@ -64,7 +64,7 @@ Describe "TestResults tests" { "cecil": { "LABEL": "cecil", - "TESTS_LABELS": "--label=skip-all-tests,run-ios-64-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests,run-cecil-tests", + "TESTS_LABELS": "--label=skip-all-tests,run-ios-64-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-cecil-tests", "LABEL_WITH_PLATFORM": "cecil", "STATUS_CONTEXT": "VSTS: simulator tests - cecil", "TEST_simulator_tests": "simulator_cecil", diff --git a/tools/devops/automation/scripts/VSTS.psm1 b/tools/devops/automation/scripts/VSTS.psm1 index 716e2f070986..440929afe300 100644 --- a/tools/devops/automation/scripts/VSTS.psm1 +++ b/tools/devops/automation/scripts/VSTS.psm1 @@ -488,7 +488,7 @@ class BuildConfiguration { # if xamarin legacy has been included, check if we need to include the xamarin sdk for each of the platforms, otherewise it will be # false for all - $xamarinPlatforms = @("ios", "macos", "tvos", "watchos", "maccatalyst") + $xamarinPlatforms = @("ios", "macos", "tvos", "maccatalyst") if ($configuration.INCLUDE_XAMARIN_LEGACY -eq "true") { foreach ($platform in $xamarinPlatforms) { $variableName = "INCLUDE_LEGACY_$($platform.ToUpper())" diff --git a/tools/devops/automation/scripts/bash/configure-platforms.sh b/tools/devops/automation/scripts/bash/configure-platforms.sh index 2613227e3e80..e8d525389f72 100755 --- a/tools/devops/automation/scripts/bash/configure-platforms.sh +++ b/tools/devops/automation/scripts/bash/configure-platforms.sh @@ -26,9 +26,6 @@ INCLUDE_IOS=$(cat "$FILE") make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=INCLUDE_TVOS INCLUDE_TVOS=$(cat "$FILE") -make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=INCLUDE_WATCH -INCLUDE_WATCH=$(cat "$FILE") - make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=INCLUDE_MAC INCLUDE_MAC=$(cat "$FILE") @@ -95,18 +92,15 @@ echo "##vso[task.setvariable variable=INCLUDE_XAMARIN_LEGACY;isOutput=true]$INCL if test -n "$INCLUDE_XAMARIN_LEGACY"; then echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]$INCLUDE_IOS" echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]$INCLUDE_TVOS" - echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]$INCLUDE_WATCH" echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]$INCLUDE_MAC" else echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]" echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]" - echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]" echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]" fi echo "##vso[task.setvariable variable=INCLUDE_IOS;isOutput=true]$INCLUDE_IOS" echo "##vso[task.setvariable variable=INCLUDE_TVOS;isOutput=true]$INCLUDE_TVOS" -echo "##vso[task.setvariable variable=INCLUDE_WATCH;isOutput=true]$INCLUDE_WATCH" echo "##vso[task.setvariable variable=INCLUDE_MAC;isOutput=true]$INCLUDE_MAC" echo "##vso[task.setvariable variable=INCLUDE_MACCATALYST;isOutput=true]$INCLUDE_MACCATALYST" diff --git a/tools/devops/automation/scripts/clean-for-remote-tests.sh b/tools/devops/automation/scripts/clean-for-remote-tests.sh index d05b9e0ec1a2..f796367149c4 100755 --- a/tools/devops/automation/scripts/clean-for-remote-tests.sh +++ b/tools/devops/automation/scripts/clean-for-remote-tests.sh @@ -18,6 +18,8 @@ rm -rf ~/remote_build_testing # Kill any existing brokers and builders ps auxww || true -pkill -f Broker.exe || true -pkill -f Build.exe || true +pkill -6 -f Broker.exe || true +pkill -6 -f Build.exe || true +pkill -6 -f Broker.dll || true +pkill -6 -f Build.dll || true ps auxww || true diff --git a/tools/devops/automation/scripts/prepare-for-remote-tests.sh b/tools/devops/automation/scripts/prepare-for-remote-tests.sh index bf60da1366dc..f7a3aa1495aa 100755 --- a/tools/devops/automation/scripts/prepare-for-remote-tests.sh +++ b/tools/devops/automation/scripts/prepare-for-remote-tests.sh @@ -1,10 +1,12 @@ #!/bin/bash -eux +cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." + # Install the local .NET we're using into XMA's directory # (we can't point XMA to our local directory) mkdir -p ~/Library/Caches/Xamarin/XMA/SDKs -cp -cRH "$BUILD_SOURCESDIRECTORY"/xamarin-macios/builds/downloads/dotnet ~/Library/Caches/Xamarin/XMA/SDKs -sed '/local-tests-feed/d' "$BUILD_SOURCESDIRECTORY"/xamarin-macios/NuGet.config > ~/Library/Caches/Xamarin/XMA/SDKs/dotnet/NuGet.config +cp -cRH ./builds/downloads/dotnet ~/Library/Caches/Xamarin/XMA/SDKs +sed '/local-tests-feed/d' ./NuGet.config > ~/Library/Caches/Xamarin/XMA/SDKs/dotnet/NuGet.config mkdir -p ~/Library/Caches/Xamarin/XMA/SDKs/.home/.nuget/NuGet/ cp ~/Library/Caches/Xamarin/XMA/SDKs/dotnet/NuGet.config ~/Library/Caches/Xamarin/XMA/SDKs/.home/.nuget/NuGet/NuGet.Config diff --git a/tools/devops/automation/templates/api-diff-stage.yml b/tools/devops/automation/templates/api-diff-stage.yml index 3fb0a7a00cb9..33496b6eb59a 100644 --- a/tools/devops/automation/templates/api-diff-stage.yml +++ b/tools/devops/automation/templates/api-diff-stage.yml @@ -67,7 +67,7 @@ stages: parameters: repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} - testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests' + testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true use1ES: false diff --git a/tools/devops/automation/templates/main-stage.yml b/tools/devops/automation/templates/main-stage.yml index f8b10cb71838..1481d120804c 100644 --- a/tools/devops/automation/templates/main-stage.yml +++ b/tools/devops/automation/templates/main-stage.yml @@ -186,14 +186,6 @@ parameters: stages: - - ${{ if eq(parameters.runGovernanceTests, true) }}: - - template: ./governance/stage.yml - parameters: - isPR: ${{ parameters.isPR }} - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - stageDisplayNamePrefix: ${{ parameters.stageDisplayNamePrefix }} - - stage: configure_build displayName: '${{ parameters.stageDisplayNamePrefix }}Configure' dependsOn: ${{ parameters.dependsOn }} @@ -236,7 +228,7 @@ stages: commit: ${{ parameters.commit }} testConfigurations: ${{ parameters.testConfigurations }} supportedPlatforms: ${{ parameters.supportedPlatforms }} - testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests' + testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true use1ES: true diff --git a/tools/devops/automation/templates/pipelines/run-api-scan.yml b/tools/devops/automation/templates/pipelines/run-api-scan.yml index 14f6ae850785..3b493eb6a157 100644 --- a/tools/devops/automation/templates/pipelines/run-api-scan.yml +++ b/tools/devops/automation/templates/pipelines/run-api-scan.yml @@ -119,7 +119,7 @@ stages: commit: HEAD testConfigurations: ${{ parameters.testConfigurations }} supportedPlatforms: ${{ parameters.supportedPlatforms }} - testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests' + testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true diff --git a/tools/devops/automation/templates/pipelines/run-macos-tests-pipeline.yml b/tools/devops/automation/templates/pipelines/run-macos-tests-pipeline.yml index 30aefb1eabde..c596c8ebdab9 100644 --- a/tools/devops/automation/templates/pipelines/run-macos-tests-pipeline.yml +++ b/tools/devops/automation/templates/pipelines/run-macos-tests-pipeline.yml @@ -238,7 +238,7 @@ stages: commit: ${{ parameters.commit }} testConfigurations: ${{ parameters.testConfigurations }} supportedPlatforms: ${{ parameters.supportedPlatforms }} - testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests' + testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true diff --git a/tools/devops/automation/templates/tests-stage.yml b/tools/devops/automation/templates/tests-stage.yml index 8916e575cf35..f9f4eca20bb1 100644 --- a/tools/devops/automation/templates/tests-stage.yml +++ b/tools/devops/automation/templates/tests-stage.yml @@ -202,7 +202,7 @@ stages: commit: ${{ parameters.commit }} testConfigurations: ${{ parameters.testConfigurations }} supportedPlatforms: ${{ parameters.supportedPlatforms }} - testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-watchos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests,run-legacy-xamarin-tests' + testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-dotnet-tests,run-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true diff --git a/tools/devops/automation/templates/windows/reserve-mac.yml b/tools/devops/automation/templates/windows/reserve-mac.yml index 8298a73c0da2..83ab5a98fb4a 100644 --- a/tools/devops/automation/templates/windows/reserve-mac.yml +++ b/tools/devops/automation/templates/windows/reserve-mac.yml @@ -33,7 +33,7 @@ steps: - checkout: maccore persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail -- pwsh: '"$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' +- pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' displayName: 'Show Bot Info' - bash: '$SYSTEM_DEFAULTWORKINGDIRECTORY/${BUILD_REPOSITORY_NAME/#*\//}/tools/devops/automation/scripts/bash/clean-bot.sh' diff --git a/tools/mtouch/Makefile b/tools/mtouch/Makefile index 6e63837bae44..80d83328ddab 100644 --- a/tools/mtouch/Makefile +++ b/tools/mtouch/Makefile @@ -337,16 +337,6 @@ ifdef INCLUDE_DEVICE TARGETS += $(IOS_DESTDIR)$(MONOTOUCH_DEVICE_SDK)/lib/Xamarin.iOS.registrar.a endif -ifdef INCLUDE_WATCH -TARGETS += \ - $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib/Xamarin.WatchOS.registrar.a \ - -ifdef INCLUDE_DEVICE -TARGETS += $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib/Xamarin.WatchOS.registrar.a -endif -endif - - ifdef INCLUDE_TVOS TARGETS += \ $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib/Xamarin.TVOS.registrar.a \