diff --git a/.github/ISSUE_TEMPLATE/01-building-an-application.yml b/.github/ISSUE_TEMPLATE/01-building-an-application.yml index c73aeb0cf6de..34eef7a52047 100644 --- a/.github/ISSUE_TEMPLATE/01-building-an-application.yml +++ b/.github/ISSUE_TEMPLATE/01-building-an-application.yml @@ -25,6 +25,7 @@ body: options: - net8.0-* - net9.0-* + - net10.0-* - Other validations: required: true diff --git a/.github/ISSUE_TEMPLATE/02-running-an-application.yml b/.github/ISSUE_TEMPLATE/02-running-an-application.yml index 097f33073bdd..fdb690de07d0 100644 --- a/.github/ISSUE_TEMPLATE/02-running-an-application.yml +++ b/.github/ISSUE_TEMPLATE/02-running-an-application.yml @@ -25,6 +25,7 @@ body: options: - net8.0-* - net9.0-* + - net10.0-* - Other validations: required: true diff --git a/.github/ISSUE_TEMPLATE/03-api.yml b/.github/ISSUE_TEMPLATE/03-api.yml index 747de33ac01c..37232368a583 100644 --- a/.github/ISSUE_TEMPLATE/03-api.yml +++ b/.github/ISSUE_TEMPLATE/03-api.yml @@ -35,6 +35,7 @@ body: options: - net8.0-* - net9.0-* + - net10.0-* - Other validations: required: true diff --git a/.github/ISSUE_TEMPLATE/04-bindings.yml b/.github/ISSUE_TEMPLATE/04-bindings.yml index 6eb890ed27f0..68190269d041 100644 --- a/.github/ISSUE_TEMPLATE/04-bindings.yml +++ b/.github/ISSUE_TEMPLATE/04-bindings.yml @@ -26,6 +26,7 @@ body: options: - net8.0-* - net9.0-* + - net10.0-* - Other validations: required: true diff --git a/.github/ISSUE_TEMPLATE/05-other.yml b/.github/ISSUE_TEMPLATE/05-other.yml index 6b9b1e44be72..3d560f63299f 100644 --- a/.github/ISSUE_TEMPLATE/05-other.yml +++ b/.github/ISSUE_TEMPLATE/05-other.yml @@ -25,6 +25,7 @@ body: options: - net8.0-* - net9.0-* + - net10.0-* - Other validations: required: true diff --git a/.github/workflows/update-single-platform-branches.yml b/.github/workflows/update-single-platform-branches.yml index 0a0deab61fa4..e5c75d63a120 100644 --- a/.github/workflows/update-single-platform-branches.yml +++ b/.github/workflows/update-single-platform-branches.yml @@ -28,7 +28,7 @@ jobs: set -ex git config user.email "github-actions-single-platform-branch-updater@xamarin.com" git config user.name "GitHub Actions Single Platform Branch Updater" - for platform in dotnet-iOS dotnet-tvOS dotnet-MacCatalyst dotnet-macOS dotnet; do + for platform in dotnet-iOS dotnet-tvOS dotnet-MacCatalyst dotnet-macOS; do git checkout -b release-test/only-$platform origin/release-test/only-$platform git merge origin/main git push diff --git a/.gitignore b/.gitignore index f152fefaf654..d7c8df4a40a7 100644 --- a/.gitignore +++ b/.gitignore @@ -34,9 +34,7 @@ tests/bcl-test/SystemCoreXunit*.csproj tests/bcl-test/SystemXunit.csproj global.json .idea -device-tests-provisioning.csx -build-provisioning.csx -provision-xcode.csx +provision-shared.csx mono_crash.*.json *.binlog .vscode diff --git a/.gitmodules b/.gitmodules index aab80f6e4568..b8d9d589ef27 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,11 +1,3 @@ -[submodule "external/macios-binaries"] - path = external/macios-binaries - url = ../../xamarin/macios-binaries - branch = main -[submodule "external/opentk"] - path = external/opentk - url = ../../mono/opentk.git - branch = main [submodule "external/Touch.Unit"] path = external/Touch.Unit url = ../../xamarin/Touch.Unit.git diff --git a/Directory.Build.props b/Directory.Build.props index 3fdd678cd995..d2d76a71d25d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,6 +4,10 @@ true 0.11.5 2.2.158 + 17.11.4 + 17.11.4 + 17.11.4 + 17.11.4 diff --git a/Make.config b/Make.config index 6c49beff1360..d968ab82854b 100644 --- a/Make.config +++ b/Make.config @@ -44,10 +44,10 @@ include $(TOP)/Make.versions # The value is taken from the name + version of the Ref pack. # Example: given the Ref pack "Microsoft.iOS.Ref.net8.0_17.5" with the version "17.5.8030", the value # to write here would be the part after "Microsoft.iOS.Ref." + "/" + version: "net8.0_17.5/17.5.8030" -STABLE_NUGET_VERSION_iOS=net8.0_17.5/17.5.8030 -STABLE_NUGET_VERSION_tvOS=net8.0_17.5/17.5.8030 -STABLE_NUGET_VERSION_MacCatalyst=net8.0_17.5/17.5.8030 -STABLE_NUGET_VERSION_macOS=net8.0_14.5/14.5.8030 +STABLE_NUGET_VERSION_iOS=net9.0_18.0/18.0.9617 +STABLE_NUGET_VERSION_tvOS=net9.0_18.0/18.0.9617 +STABLE_NUGET_VERSION_MacCatalyst=net9.0_18.0/18.0.9617 +STABLE_NUGET_VERSION_macOS=net9.0_15.0/15.0.9617 PACKAGE_HEAD_REV=$(shell git rev-parse HEAD) @@ -201,14 +201,6 @@ TVOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(TVOS_NUGET_VERSION))) TVOS_NUGET_VERSION_NO_METADATA=$(TVOS_NUGET_VERSION)$(NUGET_PRERELEASE_IDENTIFIER) TVOS_NUGET_VERSION_FULL=$(TVOS_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) -WATCHOS_NUGET=Microsoft.watchOS -WATCHOS_NUGET_VERSION=$(WATCHOS_NUGET_OS_VERSION).$(WATCHOS_NUGET_COMMIT_DISTANCE) -WATCHOS_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(WATCHOS_NUGET_VERSION))) -WATCHOS_NUGET_VERSION_MINOR=$(word 2, $(subst ., ,$(WATCHOS_NUGET_VERSION))) -WATCHOS_NUGET_VERSION_PATCH=$(word 3, $(subst ., ,$(WATCHOS_NUGET_VERSION))) -WATCHOS_NUGET_VERSION_NO_METADATA=$(WATCHOS_NUGET_VERSION)$(NUGET_PRERELEASE_IDENTIFIER) -WATCHOS_NUGET_VERSION_FULL=$(WATCHOS_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) - MACCATALYST_NUGET=Microsoft.MacCatalyst MACCATALYST_NUGET_VERSION=$(MACCATALYST_NUGET_OS_VERSION).$(MACCATALYST_NUGET_COMMIT_DISTANCE) MACCATALYST_NUGET_VERSION_MAJOR=$(word 1, $(subst ., ,$(MACCATALYST_NUGET_VERSION))) @@ -218,11 +210,11 @@ MACCATALYST_NUGET_VERSION_NO_METADATA=$(MACCATALYST_NUGET_VERSION)$(NUGET_PREREL MACCATALYST_NUGET_VERSION_FULL=$(MACCATALYST_NUGET_VERSION_NO_METADATA)$(NUGET_BUILD_METADATA) # Xcode version should have both a major and a minor version (even if the minor version is 0) -XCODE_VERSION=16.0 -XCODE_URL=https://dl.internalx.com/internal-files/xcodes/Xcode_16.xip -XCODE_IOS_SIMULATOR_FILENAME=iOS_18_Simulator_Runtime.dmg -XCODE_IOS_SIMULATOR_VERSION=22A3351 -XCODE_DEVELOPER_ROOT=/Applications/Xcode_16.0.0.app/Contents/Developer +XCODE_VERSION=16.1 +XCODE_URL=https://dl.internalx.com/internal-files/xcodes/Xcode_16.1.xip +XCODE_IOS_SIMULATOR_FILENAME=iOS_18.1_Simulator_Runtime.dmg +XCODE_IOS_SIMULATOR_VERSION=22B81 +XCODE_DEVELOPER_ROOT=/Applications/Xcode_16.1.0.app/Contents/Developer XCODE_PRODUCT_BUILD_VERSION:=$(shell /usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion' $(XCODE_DEVELOPER_ROOT)/../version.plist 2>/dev/null || echo " $(shell tput setaf 1 2>/dev/null)The required Xcode ($(XCODE_VERSION)) is not installed in $(basename $(basename $(XCODE_DEVELOPER_ROOT)))$(shell tput sgr0 2>/dev/null)" >&2) # We define stable Xcode as the Xcode app being named like "Xcode_#.#[.#].app" @@ -261,14 +253,10 @@ MIN_MONO_URL=https://download.mono-project.com/archive/6.12.0/macos-10-universal # Minimum Mono version for Xamarin.Mac apps using the system mono MIN_XM_MONO_VERSION=6.4.0.94 -# Minimum CMake version -MIN_CMAKE_URL=https://cmake.org/files/v3.6/cmake-3.6.2-Darwin-x86_64.dmg -MIN_CMAKE_VERSION=2.8.8 - # ObjectiveSharpie min/max versions -MIN_SHARPIE_VERSION=3.5.115 +MIN_SHARPIE_VERSION=3.5.116 MAX_SHARPIE_VERSION=3.5.999 -MIN_SHARPIE_URL=https://download.visualstudio.microsoft.com/download/pr/8445c488-35b2-44d5-a80f-15954ca1fcf8/bb2946f34caefe1ba3bc5cedfda31879/objectivesharpie-3.5.115.pkg +MIN_SHARPIE_URL=https://download.visualstudio.microsoft.com/download/pr/3a748cc2-780d-403c-88ba-700aa9a2d299/88cbfd86e85f56b4c61e092d0f0b9ad9/objectivesharpie-3.5.116.pkg # Minimum OSX versions for building XI/XM MIN_OSX_BUILD_VERSION=13.0 @@ -279,26 +267,20 @@ MIN_OSX_VERSION_FOR_MAC=10.15 # Bump the *_NUGET_VERSION variables in Make.versions instead, because that makes sure the computed commit distance for the version is correct. IOS_SDK_VERSION=$(word 1, $(subst ., ,$(IOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(IOS_NUGET_VERSION))) MACOS_SDK_VERSION=$(word 1, $(subst ., ,$(MACOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(MACOS_NUGET_VERSION))) -WATCH_SDK_VERSION=$(word 1, $(subst ., ,$(WATCHOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(WATCHOS_NUGET_VERSION))) TVOS_SDK_VERSION=$(word 1, $(subst ., ,$(TVOS_NUGET_VERSION))).$(word 2, $(subst ., ,$(TVOS_NUGET_VERSION))) MACCATALYST_SDK_VERSION=$(word 1, $(subst ., ,$(MACCATALYST_NUGET_VERSION))).$(word 2, $(subst ., ,$(MACCATALYST_NUGET_VERSION))) MACCATALYST_MAC_SDK_VERSION=$(MACOS_SDK_VERSION) MAX_IOS_DEPLOYMENT_TARGET=$(IOS_SDK_VERSION) -MAX_WATCH_DEPLOYMENT_TARGET=$(WATCH_SDK_VERSION) MAX_TVOS_DEPLOYMENT_TARGET=$(TVOS_SDK_VERSION) MAX_IOS_SIMULATOR_VERSION=$(IOS_SDK_VERSION) 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 @@ -309,42 +291,17 @@ DOTNET_MIN_MACOS_SDK_VERSION=12.0 # The min simulator version available in the Xcode we're using MIN_IOS_SIMULATOR_VERSION=15.0 -MIN_WATCHOS_SIMULATOR_VERSION=8.0 -# This is the iOS version that matches the watchOS version (i.e same Xcode) -MIN_WATCHOS_COMPANION_SIMULATOR_VERSION=15.0 MIN_TVOS_SIMULATOR_VERSION=15.0 # These are the simulator package ids for the versions above -EXTRA_SIMULATORS=com.apple.pkg.iPhoneSimulatorSDK15_0 com.apple.pkg.AppleTVSimulatorSDK15_0 com.apple.pkg.WatchSimulatorSDK8_0 +EXTRA_SIMULATORS=com.apple.pkg.iPhoneSimulatorSDK15_0 com.apple.pkg.AppleTVSimulatorSDK15_0 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 -ENABLE_DOTNET=1 - -ifeq ($(shell test $(shell echo $(MIN_IOS_SDK_VERSION) | sed 's/[.].*//') -ge 11; echo $$?),0) -IOS_SUPPORTS_32BIT_ARCHITECTURES= -else -IOS_SUPPORTS_32BIT_ARCHITECTURES=1 -endif - -ifeq ($(shell test $(shell echo $(MIN_WATCHOS_SDK_VERSION) | sed 's/[.].*//') -ge 9; echo $$?),0) -WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES= -else -WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES=1 -endif -ifeq ($(shell test $(shell echo $(MIN_WATCHOS_SDK_VERSION) | sed 's/[.].*//') -ge 4; echo $$?),0) -WATCHOS_SUPPORTS_32BIT_SIMULATOR_ARCHITECTURES= -else -WATCHOS_SUPPORTS_32BIT_SIMULATOR_ARCHITECTURES=1 -endif - -include $(TOP)/Make.config.local -include $(TOP)/configure.inc @@ -387,7 +344,6 @@ MONOTOUCH_PREFIX := $(abspath $(MONOTOUCH_PREFIX)) MONOTOUCH_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS MONOTOUCH_TV_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS -MONOTOUCH_WATCH_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS MONOTOUCH_MACCATALYST_MONO_PATH?=$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.MacCatalyst IOS_PACKAGE_FILENAME=$(IOS_PACKAGE_NAME_LOWER)-$(IOS_PACKAGE_VERSION).pkg @@ -412,7 +368,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 @@ -424,14 +383,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 @@ -446,15 +411,18 @@ DEVICE_CXX=$(IOS_CXX) IOS_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_MONO_PATH)/System.dll -r:$(MONOTOUCH_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic TV_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_TV_MONO_PATH)/System.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_TV_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_TV_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic -WATCH_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic MACCATALYST_CSC=$(SYSTEM_CSC) -features:strict -nostdlib -noconfig -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.Core.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.Xml.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/System.Net.Http.dll -r:$(MONOTOUCH_MACCATALYST_MONO_PATH)/Facades/System.Drawing.Common.dll -deterministic DEVICE_OBJC_CFLAGS=$(OBJC_CFLAGS) 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) @@ -469,36 +437,28 @@ XAMARIN_IPHONEOS_SDK = $(MONOTOUCH_DEVICE_SDK) XAMARIN_MACCATALYST_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.MacCatalyst.sdk -# WatchOS - -XAMARIN_WATCHSIMULATOR_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.WatchSimulator.sdk -XAMARIN_WATCHOS_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.WatchOS.sdk - -SIMULATORWATCH_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator$(WATCH_SDK_VERSION).sdk -SIMULATORWATCH_CFLAGS = -arch i386 -mwatchos-simulator-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(SIMULATORWATCH_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) -SIMULATORWATCH64_CFLAGS = -arch x86_64 -mwatchos-simulator-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(SIMULATORWATCH_SDK) $(CFLAGS) -g $(IOS_COMMON_DEFINES) -SIMULATORWATCH_OBJC_CFLAGS = $(SIMULATORWATCH_CFLAGS) $(COMMON_SIMULATOR_OBJC_CFLAGS) -SIMULATORWATCH64_OBJC_CFLAGS = $(SIMULATORWATCH64_CFLAGS) $(COMMON_SIMULATOR_OBJC_CFLAGS) - -DEVICEWATCH_SDK = $(XCODE_DEVELOPER_ROOT)/Platforms/WatchOS.platform/Developer/SDKs/WatchOS$(WATCH_SDK_VERSION).sdk -DEVICEWATCH_CFLAGS = -arch armv7k -mwatchos-version-min=$(MIN_WATCHOS_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) -DEVICEWATCH64_32_CFLAGS = -arch arm64_32 -mwatchos-version-min=$(MIN_WATCHOS64_32_SDK_VERSION) -isysroot $(DEVICEWATCH_SDK) $(CFLAGS) $(IOS_COMMON_DEFINES) -DEVICEWATCH_OBJC_CFLAGS = $(DEVICEWATCH_CFLAGS) $(DEVICE_OBJC_CFLAGS) -DEVICEWATCH64_32_OBJC_CFLAGS = $(DEVICEWATCH64_32_CFLAGS) $(DEVICE_OBJC_CFLAGS) - # TVOS XAMARIN_TVSIMULATOR_SDK = $(MONOTOUCH_PREFIX)/SDKs/Xamarin.AppleTVSimulator.sdk 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 @@ -506,7 +466,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 @@ -525,15 +488,7 @@ TVOS_SIMULATOR_X64_SWIFTFLAGS=$(TVOS_SIMULATOR_COMMON_SWIFTFLAGS) -target x86_64 TVOS_DEVICE_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(DEVICETV_SDK) TVOS_DEVICE_ARM64_SWIFTFLAGS=$(TVOS_DEVICE_COMMON_SWIFTFLAGS) -target arm64-apple-tvos$(MIN_TVOS_SDK_VERSION) -WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS=$(COMMON_SWIFTFLAGS) -sdk $(SIMULATORWATCH_SDK) -WATCHOS_SIMULATOR_ARM64_SWIFTFLAGS=$(WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS) -target arm64-apple-watchos$(MIN_WATCHOS_SDK_VERSION)-simulator -WATCHOS_SIMULATOR_X64_SWIFTFLAGS=$(WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS) -target x86_64-apple-watchos$(MIN_WATCHOS_SDK_VERSION)-simulator -WATCHOS_SIMULATOR_X86_SWIFTFLAGS=$(WATCHOS_SIMULATOR_COMMON_SWIFTFLAGS) -target x86-apple-watchos$(MIN_WATCHOS_SDK_VERSION)-simulator -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 @@ -545,11 +500,8 @@ MACOS_X64_SWIFTFLAGS=$(MACOS_COMMON_SWIFTFLAGS) -target x86_64-apple-macos$(MIN_ # things in other places if they absolutely must. MONO_PATH=$(TOP)/external/mono TOUCH_UNIT_PATH=$(TOP)/external/Touch.Unit -OPENTK_PATH=$(TOP)/external/opentk XAMARIN_MACDEV_PATH=$(TOP)/external/Xamarin.MacDev MACCORE_PATH=$(TOP)/../maccore -MACIOS_BINARIES_PATH=$(TOP)/external/macios-binaries -IKVM_PATH=$(TOP)/external/ikvm-fork MONOTOUCH_DIALOG_PATH=$(TOP)/external/MonoTouch.Dialog API_TOOLS_PATH=$(TOP)/external/api-tools @@ -563,9 +515,6 @@ SYSTEM_XBUILD=$(MONO_PREFIX)/bin/msbuild /p:Features=strict /m SYSTEM_MSBUILD=unset MSBuildExtensionsPath && $(MONO_PREFIX)/bin/msbuild /p:Features=strict /m SYSTEM_RESGEN=$(MONO_PREFIX)/bin/resgen -XIBUILD_EXE_PATH=$(abspath $(TOP)/tools/xibuild/bin/Debug/xibuild.exe) -SYSTEM_XIBUILD=$(SYSTEM_MONO) $(XIBUILD_EXE_PATH) $(XIBUILD_VERBOSITY) - PKG_CONFIG=$(MONO_PREFIX)/bin/pkg-config MAC_PRODUCT=Xamarin.Mac @@ -643,25 +592,9 @@ JENKINS_RESULTS_DIRECTORY ?= $(abspath $(TOP)/jenkins-results) # Clone files instead of copying them on APFS file systems. Much faster. CP:=$(shell df -t apfs / >/dev/null 2>&1 && echo "cp -c" || echo "cp") -# WORKAROUND, Ideally it should be xcode-$(XCODE_PRODUCT_BUILD_VERSION) but mono does not build binaries for each xcode release -# Xcode 12.4 Build 12D4e -XCODE_IOS_ARCHIVE_VERSION=xcode-12D4e -# Xcode 12.4 Build 12D4e -XCODE_MACOS_ARCHIVE_VERSION=xcode-12D4e -MONO_IOS_FILENAME:=ios-release-Darwin-$(MONO_HASH).7z -MONO_IOS_URL:=https://download.mono-project.com/mono-sdks/$(XCODE_IOS_ARCHIVE_VERSION)/$(MONO_IOS_FILENAME) - -# Setup various variables depending on whether mono is downloaded or built from source -ifeq ($(MONO_BUILD_FROM_SOURCE),) -MONO_IOS_SDK_DESTDIR:=$(abspath $(TOP)/builds/downloads/$(basename $(MONO_IOS_FILENAME))) -MONO_BUILD_MODE=download-mono -else -MONO_IOS_SDK_DESTDIR:=$(abspath $(MONO_PATH)/sdks/out) -MONO_BUILD_MODE=compile-mono -endif +MONO_IOS_SDK_DESTDIR:=$(abspath $(TOP)/builds/downloads/mono-ios-sdk-destdir) # This variable includes all the platforms we support, even those that might be disabled in this build. -ALL_PLATFORMS=iOS tvOS watchOS macOS ALL_DOTNET_PLATFORMS=iOS macOS tvOS MacCatalyst # Set this to 1 if the Microsoft.NETCore.App.Ref dependency in eng/Version.Details.xml does *not* specify a CoherentParentDependency on Microsoft.Dotnet.Sdk.Internal. @@ -674,6 +607,7 @@ $(TOP)/dotnet.config: $(TOP)/eng/Versions.props $(TOP)/Build.props $(Q) grep MicrosoftNETCoreAppRefPackageVersion $(TOP)/eng/Versions.props | sed -e 's/<*\/*MicrosoftNETCoreAppRefPackageVersion>//g' -e 's/[ \t]*/BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION=/' >> $@.tmp $(Q) grep "<$$(grep EmscriptenWorkloadVersion $(TOP)/eng/Versions.props | sed -e 's_.*>$$[\(]\(.*\)[\)]<.*_\1_')>" $(TOP)/eng/Versions.props | sed -e 's/.*>\(.*\)<.*/EMSCRIPTEN_MANIFEST_PACKAGE_VERSION=\1/' >> $@.tmp $(Q) $(foreach platform,$(ALL_DOTNET_PLATFORMS),grep '' $(TOP)/eng/Versions.props | sed -e 's/<*\/*Microsoft$(platform)SdkPackageVersion>//g' -e 's/[ \t]*/NET8_$(shell echo $(platform) | tr '[:lower:]' '[:upper:]')_NUGET_VERSION_NO_METADATA=/' >> $@.tmp &&) true + $(Q) grep '' $(TOP)/eng/Versions.props | sed -e 's/<*\/*MicrosoftDotNetArcadeSdkPackageVersion>//g' -e 's/[ \t]*/ARCADE_VERSION=/' >> $@.tmp $(Q) mv $@.tmp $@ $(TOP)/Build.props: Make.config @@ -767,21 +701,11 @@ DOTNET_MACOS_ASSEMBLY_NAME=Microsoft.macOS DOTNET_PLATFORMS= ifdef INCLUDE_IOS -ifdef ENABLE_DOTNET DOTNET_PLATFORMS+=iOS DOTNET_MONOVM_PLATFORMS+=iOS DOTNET_IOS_BITNESSES+=64 DOTNET_NATIVEAOT_PLATFORMS+=iOS -# 32-bit architectures -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -DOTNET_IOS_BITNESSES+=32 -ifdef INCLUDE_DEVICE -DOTNET_IOS_RUNTIME_IDENTIFIERS_32=ios-arm -endif # INCLUDE_DEVICE -DOTNET_IOS_RUNTIME_IDENTIFIERS_32+=iossimulator-x86 -endif # IOS_SUPPORTS_32BIT_ARCHITECTURES - # 64-bit architectures ifdef INCLUDE_DEVICE DOTNET_IOS_RUNTIME_IDENTIFIERS_64=ios-arm64 @@ -790,11 +714,9 @@ DOTNET_IOS_RUNTIME_IDENTIFIERS_64+=iossimulator-x64 iossimulator-arm64 # All of them DOTNET_IOS_RUNTIME_IDENTIFIERS=$(DOTNET_IOS_RUNTIME_IDENTIFIERS_32) $(DOTNET_IOS_RUNTIME_IDENTIFIERS_64) -endif # ENABLE_DOTNET endif # INCLUDE_IOS ifdef INCLUDE_TVOS -ifdef ENABLE_DOTNET DOTNET_PLATFORMS+=tvOS DOTNET_MONOVM_PLATFORMS+=tvOS DOTNET_TVOS_BITNESSES+=64 @@ -805,41 +727,24 @@ else DOTNET_TVOS_RUNTIME_IDENTIFIERS=tvossimulator-x64 tvossimulator-arm64 endif 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 DOTNET_MONOVM_PLATFORMS+=MacCatalyst DOTNET_MACCATALYST_BITNESSES+=64 DOTNET_NATIVEAOT_PLATFORMS+=MacCatalyst DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS=maccatalyst-x64 maccatalyst-arm64 DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS_64+=$(DOTNET_MACCATALYST_RUNTIME_IDENTIFIERS) -endif # ENABLE_DOTNET endif ifdef INCLUDE_MAC -ifdef ENABLE_DOTNET DOTNET_PLATFORMS+=macOS DOTNET_CORECLR_PLATFORMS+=macOS DOTNET_MACOS_BITNESSES+=64 DOTNET_NATIVEAOT_PLATFORMS+=macOS DOTNET_MACOS_RUNTIME_IDENTIFIERS=osx-x64 osx-arm64 DOTNET_MACOS_RUNTIME_IDENTIFIERS_64=$(DOTNET_MACOS_RUNTIME_IDENTIFIERS) -endif # ENABLE_DOTNET endif ifdef INCLUDE_IOS diff --git a/Make.versions b/Make.versions index 7182fdd9abc8..062655186bd3 100644 --- a/Make.versions +++ b/Make.versions @@ -6,8 +6,8 @@ # # IOS_NUGET_VERSION (major/minor/patch #) # TVOS_NUGET_VERSION (major/minor/patch #) -# WATCHOS_NUGET_VERSION (major/minor/patch #) # MACOS_NUGET_VERSION (major/minor/patch #) +# MACCATALYST_NUGET_VERSION (major/minor/patch #) # # Update version numbers on main as well, to the next version # @@ -65,12 +65,17 @@ MAC_PACKAGE_VERSION=9.99.0.$(MAC_COMMIT_DISTANCE) # WARNING: Do **not** use versions higher than the available Xcode SDK or else we will have issues with mtouch (See https://github.com/xamarin/xamarin-macios/issues/7705) -IOS_NUGET_OS_VERSION=18.0 -TVOS_NUGET_OS_VERSION=18.0 -WATCHOS_NUGET_OS_VERSION=11.0 -MACOS_NUGET_OS_VERSION=15.0 -MACCATALYST_NUGET_OS_VERSION=18.0 +IOS_NUGET_OS_VERSION=18.1 +TVOS_NUGET_OS_VERSION=18.1 +MACOS_NUGET_OS_VERSION=15.1 +MACCATALYST_NUGET_OS_VERSION=18.1 +# The following are the OS versions we first supported with the current .NET version. +# These versions must *not* change with minor .NET updates, only major .NET releases. +IOS_TARGET_PLATFORM_VERSION_LIBRARY=18.0 +TVOS_TARGET_PLATFORM_VERSION_LIBRARY=18.0 +MACOS_TARGET_PLATFORM_VERSION_LIBRARY=15.0 +MACCATALYST_TARGET_PLATFORM_VERSION_LIBRARY=18.0 # In theory we should define the default platform version if it's not specified in the TFM. The default should not change for a given .NET version: # * We release support for iOS 14.5 with .NET 6 @@ -100,6 +105,13 @@ MACCATALYST_NUGET_OS_VERSION=18.0 # So we've made the decision that the default target platform version is # always the latest target platform version. +# However, this turns out to be somewhat of a complication for library developers, +# because they typically don't need Xcode to build their projects, and if we auto- +# update their TargetPlatformVersion to the latest, then all their customers +# have to also update their workloads, which for some people end up being a rather +# nasty surprise (because with the above algorithm it happens without developer +# action). Thus we follow .NET's default platform version scheme for library projects: +# it won't change in minor .NET releases. # # Here we list all the releases we support for each platform. @@ -151,3 +163,8 @@ SUPPORTED_API_VERSIONS_IOS+=net8.0-18.0 SUPPORTED_API_VERSIONS_TVOS+=net8.0-18.0 SUPPORTED_API_VERSIONS_MACOS+=net8.0-15.0 SUPPORTED_API_VERSIONS_MACCATALYST+=net8.0-18.0 + +SUPPORTED_API_VERSIONS_IOS+=net9.0-18.0 +SUPPORTED_API_VERSIONS_TVOS+=net9.0-18.0 +SUPPORTED_API_VERSIONS_MACOS+=net9.0-15.0 +SUPPORTED_API_VERSIONS_MACCATALYST+=net9.0-18.0 diff --git a/Makefile b/Makefile index ef263bb0ceaa..37022cb4f2e2 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,9 @@ TOP=. -SUBDIRS=builds runtime fsharp src msbuild tools +SUBDIRS=builds runtime src msbuild tools include $(TOP)/Make.config include $(TOP)/mk/versions.mk -ifdef ENABLE_DOTNET SUBDIRS += dotnet -endif # # Common @@ -42,19 +40,8 @@ endif show-versions: @echo "Building:" -ifdef INCLUDE_XAMARIN_LEGACY - @echo " The legacy package(s):" -ifdef INCLUDE_IOS - @echo " Xamarin.iOS $(IOS_PACKAGE_VERSION)" -endif -ifdef INCLUDE_MAC - @echo " Xamarin.Mac $(MAC_PACKAGE_VERSION)" -endif -endif -ifdef ENABLE_DOTNET @echo " The .NET NuGet(s):" @$(foreach platform,$(DOTNET_PLATFORMS),echo " Microsoft.$(platform) $($(shell echo $(platform) | tr 'a-z' 'A-Z')_NUGET_VERSION_FULL)";) -endif check-permissions: ifdef INCLUDE_MAC @@ -72,7 +59,9 @@ all-local:: global.json global.json: $(TOP)/dotnet.config Makefile $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index $(Q_GEN) \ printf "{\n" > $@; \ - printf " \"sdk\": {\n \"version\": \"$(DOTNET_VERSION)\"\n }\n" >> $@; \ + printf " \"sdk\": {\n \"version\": \"$(DOTNET_VERSION)\"\n },\n" >> $@; \ + printf " \"tools\": {\n \"dotnet\": \"$(DOTNET_VERSION)\"\n },\n" >> $@; \ + printf " \"msbuild-sdks\": {\n \"Microsoft.DotNet.Arcade.Sdk\": \"$(ARCADE_VERSION)\"\n }\n" >> $@; \ printf "}\n" >> $@ install-hook:: @@ -110,6 +99,7 @@ else @echo endif endif + $(Q) $(MAKE) -C dotnet shutdown-build-server .PHONY: package release package release: @@ -186,16 +176,12 @@ git-clean-all: @git submodule foreach -q --recursive 'git clean -xffdq && git reset --hard -q' @for dir in $(DEPENDENCY_DIRECTORIES); do if test -d $(CURDIR)/$$dir; then echo "Cleaning $$dir" && cd $(CURDIR)/$$dir && git clean -xffdq && git reset --hard -q && git submodule foreach -q --recursive 'git clean -xffdq'; else echo "Skipped $$dir (does not exist)"; fi; done - @if [ -n "$(ENABLE_XAMARIN)" ] || [ -n "$(ENABLE_DOTNET)" ]; then \ + @if [ -n "$(ENABLE_XAMARIN)" ]; then \ CONFIGURE_FLAGS=""; \ if [ -n "$(ENABLE_XAMARIN)" ]; then \ echo "Xamarin-specific build has been re-enabled"; \ CONFIGURE_FLAGS="$$CONFIGURE_FLAGS --enable-xamarin"; \ fi; \ - if [ -n "$(ENABLE_DOTNET)" ]; then \ - echo "Dotnet-specific build has been re-enabled"; \ - CONFIGURE_FLAGS="$$CONFIGURE_FLAGS --enable-dotnet"; \ - fi; \ ./configure "$$CONFIGURE_FLAGS"; \ $(MAKE) reset; \ echo "Done"; \ diff --git a/NuGet.config b/NuGet.config index 7426ab7ecfd7..7148c058f2d1 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,6 +10,7 @@ + diff --git a/Versions-ios.plist.in b/Versions-ios.plist.in deleted file mode 100644 index ffc7208a4316..000000000000 --- a/Versions-ios.plist.in +++ /dev/null @@ -1,262 +0,0 @@ - - - - - MonoVersion - @MONO_VERSION@ - KnownVersions - - iOS - - 11.0 - 11.1 - 11.2 - 11.3 - 11.4 - 12.0 - 12.1 - 12.2 - 12.3 - 12.4 - 13.0 - 13.1 - 13.2 - 13.3 - 13.4 - 13.5 - 13.6 - 14.0 - 14.1 - 14.2 - 14.3 - 14.4 - 14.5 - 15.0 - 15.2 - 15.4 - 16.0 - 16.1 - 16.2 - 16.4 - 17.0 - 17.2 - 17.4 - 17.5 - 18.0 - - tvOS - - 11.0 - 11.1 - 11.2 - 11.3 - 11.4 - 12.0 - 12.1 - 12.2 - 12.3 - 12.4 - 13.0 - 13.2 - 13.3 - 13.4 - 14.0 - 14.2 - 14.3 - 14.4 - 14.5 - 15.0 - 15.2 - 15.4 - 16.0 - 16.1 - 16.4 - 17.0 - 17.2 - 17.4 - 17.5 - 18.0 - - watchOS - - 4.0 - 4.1 - 4.2 - 4.3 - 5.0 - 5.1 - 5.2 - 5.3 - 6.0 - 6.1 - 6.2 - 7.0 - 7.1 - 7.2 - 7.3 - 7.4 - 8.0 - 8.3 - 8.5 - 9.0 - 9.4 - 10.0 - 10.2 - 10.4 - 10.5 - 11.0 - - MacCatalyst - - 15.0 - 15.2 - 15.4 - 16.1 - 16.2 - 16.4 - 17.0 - 17.2 - 17.4 - 17.5 - 18.0 - - - MacCatalystVersionMap - - 13.1 - 10.15 - 13.2 - 10.15.1 - 13.3 - 10.15.2 - 13.4 - 10.15.4 - 13.5 - 10.15.5 - 14.2 - 11.0 - 14.3 - 11.1 - 14.4 - 11.1 - 14.5 - 11.3 - 15.0 - 12.0 - 15.2 - 12.1 - 15.4 - 12.3 - 16.1 - 13.0 - 16.2 - 13.1 - 16.4 - 13.3 - 17.0 - 14.0 - 17.2 - 14.2 - 17.4 - 14.4 - 17.5 - 14.5 - 18.0 - 15.0 - - RecommendedXcodeVersion - @XCODE_VERSION@ - MinExtensionVersion - - iOS - - com.apple.ui-services - 8.0 - com.apple.services - 8.0 - com.apple.keyboard-service - 8.0 - com.apple.fileprovider-ui - 8.0 - com.apple.fileprovider-nonui - 8.0 - com.apple.photo-editing - 8.0 - com.apple.share-services - 8.0 - com.apple.widget-extension - 8.0 - com.apple.watchkit - 8.2 - com.apple.AudioUnit-UI - 8.2 - com.apple.AudioUnit - 8.0 - com.apple.Safari.content-blocker - 9.0 - com.apple.Safari.sharedlinks-service - 9.0 - com.apple.spotlight.index - 9.0 - com.apple.networkextension.packet-tunnel - 9.0 - com.apple.callkit.call-directory - 10.0 - com.apple.intents-service - 10.0 - com.apple.intents-ui-service - 10.0 - com.apple.message-payload-provider - 10.0 - com.apple.usernotifications.content-extension - 10.0 - com.apple.usernotifications.service - 10.0 - com.apple.authentication-services-credential-provider-ui - 12.0 - - tvOS - - com.apple.broadcast-services - 10.0 - com.apple.tv-services - 9.0 - - watchOS - - com.apple.watchkit - 2.0 - com.apple.intents-service - 3.2 - - - Features - - mlaunch-launchdevbundleid - mlaunch-observe-extension - mlaunch-launch-simulator - mlaunch-install-progress - mlaunch-watchos-complications - mlaunch-wireless-devices - http-client-handlers - mono-symbol-archive - sgen-concurrent-gc - sgen-concurrent - arm64_32 - altool - maccatalyst - - Optimizations - - - inline-intptr-size - Inline IntPtr.Size - inline-runtime-arch - Inline NSObject.IsDirectBinding - dead-code-elimination - Dead code elimination - remove-uithread-checks - Remove UI thread checks - - - diff --git a/Versions-mac.plist.in b/Versions-mac.plist.in deleted file mode 100644 index 8a512b592349..000000000000 --- a/Versions-mac.plist.in +++ /dev/null @@ -1,68 +0,0 @@ - - - - - MonoVersion - @MONO_VERSION@ - MinimumSystemMono - @MIN_XM_MONO_VERSION@ - KnownVersions - - macOS - - 12.0 - 12.1 - 12.3 - 13.0 - 13.1 - 13.3 - 14.0 - 14.2 - 14.4 - 14.5 - 15.0 - - - RecommendedXcodeVersion - @XCODE_VERSION@ - MinExtensionVersion - - macOS - - com.apple.FinderSync - 10.10 - com.apple.share-services - 10.10 - com.apple.widget-extension - 10.10 - com.apple.networkextension.packet-tunnel - 10.11 - - - Features - - http-client-handlers - mono-symbol-archive - sgen-concurrent-gc - sgen-concurrent - link-platform - hybrid-aot - 64-bit-only - altool - - Optimizations - - - inline-intptr-size - Inline IntPtr.Size - inline-runtime-arch - Inline Runtime.Arch - inline-isdirectbinding - Inline NSObject.IsDirectBinding - dead-code-elimination - Dead code elimination - remove-uithread-checks - Remove UI thread checks - - - diff --git a/Xamarin.Mac.sln b/Xamarin.Mac.sln deleted file mode 100644 index 9ab2de679a54..000000000000 --- a/Xamarin.Mac.sln +++ /dev/null @@ -1,392 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xammac", "src\xammac.csproj", "{87042AD2-CDC9-4A53-9193-56226B668B88}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mmp", "tools\mmp\mmp.csproj", "{F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libxammac", "runtime\libxammac.csproj", "{8A5B637C-E4FF-4145-B887-9347020100F4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "opentk", "opentk\opentk.csproj", "{4DA3620B-D1BC-4B51-90BB-9789EF94C73C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{542D4426-F287-4126-9889-E17628DAECEA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuiUnit_NET_4_5", "external\guiunit\src\framework\GuiUnit_NET_4_5.csproj", "{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "introspection-mac", "tests\introspection\Mac\introspection-mac.csproj", "{EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator", "src\generator.csproj", "{D2EE02C0-9BFD-477D-AC92-4DE2D8490790}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator-tests", "tests\generator\generator-tests.csproj", "{10790816-D00E-40A0-8653-2A8AB4DD33A9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link sdk-mac", "tests\linker\mac\link sdk\link sdk-mac.csproj", "{F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link all-mac", "tests\linker\mac\link all\link all-mac.csproj", "{4C943B12-C5AF-4CD4-B583-B4011D13CAAB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dont link-mac", "tests\linker\mac\dont link\dont link-mac.csproj", "{78831857-A261-8EE0-A5F6-33D2628DE5D0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - net_2_0_Debug|Any CPU = net_2_0_Debug|Any CPU - net_2_0_Release|Any CPU = net_2_0_Release|Any CPU - net_3_5_Debug|Any CPU = net_3_5_Debug|Any CPU - net_3_5_Release|Any CPU = net_3_5_Release|Any CPU - net_4_0_Debug|Any CPU = net_4_0_Debug|Any CPU - net_4_0_Release|Any CPU = net_4_0_Release|Any CPU - silverlight_Debug|Any CPU = silverlight_Debug|Any CPU - silverlight_Release|Any CPU = silverlight_Release|Any CPU - winphone_Debug|Any CPU = winphone_Debug|Any CPU - winphone_Release|Any CPU = winphone_Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Debug|x86.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Debug|x86.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Release|Any CPU.Build.0 = Release|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Release|x86.ActiveCfg = Release|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.Release|x86.Build.0 = Release|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {4DA3620B-D1BC-4B51-90BB-9789EF94C73C}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Debug|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Debug|x86.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Debug|x86.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Release|Any CPU.ActiveCfg = Release|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Release|Any CPU.Build.0 = Release|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Release|x86.ActiveCfg = Release|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.Release|x86.Build.0 = Release|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {87042AD2-CDC9-4A53-9193-56226B668B88}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|x86.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|x86.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|Any CPU.Build.0 = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|x86.ActiveCfg = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|x86.Build.0 = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Debug|x86.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Debug|x86.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_2_0_Debug|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_2_0_Release|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_2_0_Release|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_3_5_Debug|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_3_5_Release|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_3_5_Release|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_4_0_Release|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.net_4_0_Release|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Release|Any CPU.Build.0 = Release|Any CPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Release|x86.ActiveCfg = Release|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.Release|x86.Build.0 = Release|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.silverlight_Debug|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.silverlight_Debug|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.silverlight_Release|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.silverlight_Release|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.winphone_Debug|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.winphone_Debug|Any CPU.Build.0 = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.winphone_Release|Any CPU.ActiveCfg = Debug|x86 - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D}.winphone_Release|Any CPU.Build.0 = Debug|x86 - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|Any CPU.Build.0 = Release|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|x86.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Debug|x86.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|x86.ActiveCfg = Release|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.Release|x86.Build.0 = Release|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Debug|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Debug|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Release|Any CPU.ActiveCfg = Release|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Release|Any CPU.Build.0 = Release|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Debug|x86.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Debug|x86.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Release|x86.ActiveCfg = Release|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.Release|x86.Build.0 = Release|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_2_0_Debug|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_2_0_Release|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_2_0_Release|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_3_5_Debug|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_3_5_Release|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_3_5_Release|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_4_0_Debug|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_4_0_Release|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.net_4_0_Release|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.silverlight_Debug|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.silverlight_Debug|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.silverlight_Release|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.silverlight_Release|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.winphone_Debug|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.winphone_Debug|Any CPU.Build.0 = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.winphone_Release|Any CPU.ActiveCfg = Debug|x86 - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA}.winphone_Release|Any CPU.Build.0 = Debug|x86 - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|Any CPU.Build.0 = Release|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|x86.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|x86.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|x86.ActiveCfg = Release|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|x86.Build.0 = Release|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.Build.0 = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|x86.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|x86.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|x86.ActiveCfg = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|x86.Build.0 = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|Any CPU.ActiveCfg = Release|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|Any CPU.Build.0 = Release|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|x86.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|x86.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|x86.ActiveCfg = Release|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|x86.Build.0 = Release|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_2_0_Debug|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_2_0_Release|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_2_0_Release|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_3_5_Debug|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_3_5_Release|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_3_5_Release|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_4_0_Debug|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_4_0_Release|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.net_4_0_Release|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.silverlight_Debug|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.silverlight_Debug|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.silverlight_Release|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.silverlight_Release|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.winphone_Debug|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.winphone_Debug|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.winphone_Release|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.winphone_Release|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|Any CPU.ActiveCfg = Release|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|Any CPU.Build.0 = Release|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|x86.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|x86.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|x86.ActiveCfg = Release|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|x86.Build.0 = Release|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_2_0_Debug|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_2_0_Release|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_2_0_Release|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_3_5_Debug|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_3_5_Release|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_3_5_Release|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_4_0_Debug|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_4_0_Release|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.net_4_0_Release|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.silverlight_Debug|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.silverlight_Debug|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.silverlight_Release|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.silverlight_Release|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.winphone_Debug|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.winphone_Debug|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.winphone_Release|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.winphone_Release|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|Any CPU.ActiveCfg = Release|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|Any CPU.Build.0 = Release|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|x86.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|x86.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|x86.ActiveCfg = Release|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|x86.Build.0 = Release|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_2_0_Debug|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_2_0_Release|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_2_0_Release|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_3_5_Debug|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_3_5_Release|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_3_5_Release|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_4_0_Debug|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_4_0_Release|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.net_4_0_Release|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.silverlight_Debug|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.silverlight_Debug|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.silverlight_Release|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.silverlight_Release|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.winphone_Debug|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.winphone_Debug|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.winphone_Release|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.winphone_Release|Any CPU.Build.0 = Debug|x86 - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = tools\mmp\mmp.csproj - Policies = $0 - $0.TextStylePolicy = $1 - $1.FileWidth = 180 - $1.TabWidth = 8 - $1.IndentWidth = 8 - $1.scope = text/x-csharp - $0.CSharpFormattingPolicy = $2 - $2.IndentSwitchSection = False - $2.NewLinesForBracesInProperties = False - $2.NewLinesForBracesInAccessors = False - $2.NewLinesForBracesInAnonymousMethods = False - $2.NewLinesForBracesInControlBlocks = False - $2.NewLinesForBracesInAnonymousTypes = False - $2.NewLinesForBracesInObjectCollectionArrayInitializers = False - $2.NewLinesForBracesInLambdaExpressionBody = False - $2.NewLineForElse = False - $2.NewLineForCatch = False - $2.NewLineForFinally = False - $2.NewLineForMembersInObjectInit = False - $2.NewLineForMembersInAnonymousTypes = False - $2.NewLineForClausesInQuery = False - $2.SpacingAfterMethodDeclarationName = True - $2.SpaceAfterMethodCallName = True - $2.SpaceBeforeOpenSquareBracket = True - $2.scope = text/x-csharp - $2.SpaceAfterCast = True - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {D12F0F7B-8DE3-43EC-BA49-41052D065A9B} = {542D4426-F287-4126-9889-E17628DAECEA} - {EA3E6B50-AE2B-4A63-BBFC-9888B93331CA} = {542D4426-F287-4126-9889-E17628DAECEA} - {10790816-D00E-40A0-8653-2A8AB4DD33A9} = {542D4426-F287-4126-9889-E17628DAECEA} - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579} = {542D4426-F287-4126-9889-E17628DAECEA} - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB} = {542D4426-F287-4126-9889-E17628DAECEA} - {78831857-A261-8EE0-A5F6-33D2628DE5D0} = {542D4426-F287-4126-9889-E17628DAECEA} - EndGlobalSection -EndGlobal diff --git a/Xamarin.iOS.sln b/Xamarin.iOS.sln deleted file mode 100644 index 76eda30575ca..000000000000 --- a/Xamarin.iOS.sln +++ /dev/null @@ -1,529 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mtouch", "tools\mtouch\mtouch.csproj", "{A737EFCC-4348-4EB1-9C14-4FDC0975388D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2BFA13F8-B568-48BF-9A70-9D43F718C523}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "introspection-ios", "tests\introspection\iOS\introspection-ios.csproj", "{208744BD-504E-47D7-9A98-1CF02454A6DA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link all", "tests\linker\ios\link all\link all.csproj", "{370CC763-EDC3-41DA-A21A-D4C82CABEFE4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-test", "tests\bindings-test\bindings-test.csproj", "{D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link sdk", "tests\linker\ios\link sdk\link sdk.csproj", "{C47F8F72-A7CA-4149-AA7D-BC4814803EF3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dont link", "tests\linker\ios\dont link\dont link.csproj", "{839212D5-C25B-4284-AA96-59C3872B8184}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mtouchtests", "tests\mtouch\mtouchtests.csproj", "{9A1177F5-16E6-45DE-AA69-DC9924EC39B8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libmonotouch", "runtime\libmonotouch.csproj", "{8A5B637C-E4FF-4145-B887-9347020100F4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xamios", "src\xamios.csproj", "{E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-generator", "runtime\bindings-generator.csproj", "{6B616492-49F0-43EF-8390-F9D1B4CCC632}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator", "src\generator.csproj", "{D2EE02C0-9BFD-477D-AC92-4DE2D8490790}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator-tests", "tests\generator\generator-tests.csproj", "{10790816-D00E-40A0-8653-2A8AB4DD33A9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cecil-tests", "tests\cecil-tests\cecil-tests.csproj", "{0C979851-15E9-4BB6-AD79-5F0C7DF69456}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - net_2_0_Debug|Any CPU = net_2_0_Debug|Any CPU - net_2_0_Release|Any CPU = net_2_0_Release|Any CPU - net_3_5_Debug|Any CPU = net_3_5_Debug|Any CPU - net_3_5_Release|Any CPU = net_3_5_Release|Any CPU - net_4_0_Debug|Any CPU = net_4_0_Debug|Any CPU - net_4_0_Release|Any CPU = net_4_0_Release|Any CPU - silverlight_Debug|Any CPU = silverlight_Debug|Any CPU - silverlight_Release|Any CPU = silverlight_Release|Any CPU - winphone_Debug|Any CPU = winphone_Debug|Any CPU - winphone_Release|Any CPU = winphone_Release|Any CPU - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|Any CPU.Build.0 = Release|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|iPhone.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|iPhone.ActiveCfg = Release|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|iPhone.Build.0 = Release|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|x86.ActiveCfg = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Debug|x86.Build.0 = Debug|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|x86.ActiveCfg = Release|Any CPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D}.Release|x86.Build.0 = Release|Any CPU - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|Any CPU.Build.0 = Release|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_2_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_2_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_2_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_3_5_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_3_5_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_3_5_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_4_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_4_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.net_4_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.silverlight_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.silverlight_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.silverlight_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.silverlight_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.winphone_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.winphone_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.winphone_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.winphone_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhone.ActiveCfg = Debug|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhone.Build.0 = Debug|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhone.ActiveCfg = Release|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhone.Build.0 = Release|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|x86.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|x86.ActiveCfg = Release|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|x86.Build.0 = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|Any CPU.Build.0 = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_2_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_2_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_2_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_3_5_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_3_5_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_3_5_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_4_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_4_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.net_4_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.silverlight_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.silverlight_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.silverlight_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.silverlight_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.winphone_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.winphone_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.winphone_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.winphone_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhone.ActiveCfg = Debug|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhone.Build.0 = Debug|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhone.ActiveCfg = Release|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhone.Build.0 = Release|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|x86.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|x86.ActiveCfg = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|x86.Build.0 = Release|iPhoneSimulator - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|Any CPU.Build.0 = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhone.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhone.ActiveCfg = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhone.Build.0 = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|x86.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|x86.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|x86.ActiveCfg = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|x86.Build.0 = Release|Any CPU - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|Any CPU.Build.0 = Release|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_2_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_2_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_2_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_3_5_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_3_5_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_3_5_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_4_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_4_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.net_4_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.silverlight_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.silverlight_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.silverlight_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.silverlight_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.winphone_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.winphone_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.winphone_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.winphone_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhone.ActiveCfg = Debug|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhone.Build.0 = Debug|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhone.ActiveCfg = Release|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhone.Build.0 = Release|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|x86.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|x86.ActiveCfg = Release|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|x86.Build.0 = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|Any CPU.Build.0 = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_2_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_2_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_2_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_3_5_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_3_5_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_3_5_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_4_0_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_4_0_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.net_4_0_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.silverlight_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.silverlight_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.silverlight_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.silverlight_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.winphone_Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.winphone_Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.winphone_Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.winphone_Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhone.ActiveCfg = Debug|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhone.Build.0 = Debug|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhone.ActiveCfg = Release|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhone.Build.0 = Release|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|x86.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|x86.ActiveCfg = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|x86.Build.0 = Release|iPhoneSimulator - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|Any CPU.Build.0 = Release|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhoneSimulator.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhone.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhone.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhone.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|x86.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|x86.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|x86.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|x86.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|Any CPU.Build.0 = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|iPhone.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|iPhone.ActiveCfg = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|iPhone.Build.0 = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|x86.ActiveCfg = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Debug|x86.Build.0 = Debug|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|x86.ActiveCfg = Release|Any CPU - {8A5B637C-E4FF-4145-B887-9347020100F4}.Release|x86.Build.0 = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|Any CPU.Build.0 = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|iPhone.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|iPhone.ActiveCfg = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|iPhone.Build.0 = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|x86.ActiveCfg = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Debug|x86.Build.0 = Debug|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|x86.ActiveCfg = Release|Any CPU - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5}.Release|x86.Build.0 = Release|Any CPU - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|Any CPU.ActiveCfg = Release|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|Any CPU.Build.0 = Release|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_2_0_Debug|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_2_0_Release|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_2_0_Release|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_3_5_Debug|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_3_5_Release|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_3_5_Release|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_4_0_Debug|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_4_0_Release|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.net_4_0_Release|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.silverlight_Debug|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.silverlight_Debug|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.silverlight_Release|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.silverlight_Release|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.winphone_Debug|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.winphone_Debug|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.winphone_Release|Any CPU.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.winphone_Release|Any CPU.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|iPhoneSimulator.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|iPhoneSimulator.ActiveCfg = Release|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|iPhoneSimulator.Build.0 = Release|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|iPhone.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|iPhone.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|iPhone.ActiveCfg = Release|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|iPhone.Build.0 = Release|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|x86.ActiveCfg = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Debug|x86.Build.0 = Debug|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|x86.ActiveCfg = Release|x86 - {6B616492-49F0-43EF-8390-F9D1B4CCC632}.Release|x86.Build.0 = Release|x86 - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|Any CPU.Build.0 = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.Build.0 = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|iPhone.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|iPhone.ActiveCfg = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|iPhone.Build.0 = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|x86.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|x86.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|x86.ActiveCfg = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|x86.Build.0 = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|Any CPU.Build.0 = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_2_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_2_0_Release|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_3_5_Release|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_3_5_Release|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_4_0_Release|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.net_4_0_Release|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.silverlight_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.silverlight_Debug|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.silverlight_Release|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.silverlight_Release|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.winphone_Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.winphone_Debug|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.winphone_Release|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.winphone_Release|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhone.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhone.ActiveCfg = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhone.Build.0 = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|x86.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|x86.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|x86.ActiveCfg = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {208744BD-504E-47D7-9A98-1CF02454A6DA} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - {839212D5-C25B-4284-AA96-59C3872B8184} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - {10790816-D00E-40A0-8653-2A8AB4DD33A9} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - {0C979851-15E9-4BB6-AD79-5F0C7DF69456} = {2BFA13F8-B568-48BF-9A70-9D43F718C523} - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - Policies = $0 - $0.TextStylePolicy = $1 - $1.FileWidth = 180 - $1.TabWidth = 8 - $1.IndentWidth = 8 - $1.scope = text/x-csharp - $0.CSharpFormattingPolicy = $2 - $2.IndentSwitchSection = False - $2.NewLinesForBracesInProperties = False - $2.NewLinesForBracesInAccessors = False - $2.NewLinesForBracesInAnonymousMethods = False - $2.NewLinesForBracesInControlBlocks = False - $2.NewLinesForBracesInAnonymousTypes = False - $2.NewLinesForBracesInObjectCollectionArrayInitializers = False - $2.NewLinesForBracesInLambdaExpressionBody = False - $2.NewLineForElse = False - $2.NewLineForCatch = False - $2.NewLineForFinally = False - $2.NewLineForMembersInObjectInit = False - $2.NewLineForMembersInAnonymousTypes = False - $2.NewLineForClausesInQuery = False - $2.SpacingAfterMethodDeclarationName = True - $2.SpaceAfterMethodCallName = True - $2.SpaceBeforeOpenSquareBracket = True - $2.scope = text/x-csharp - $2.SpaceAfterCast = True - EndGlobalSection -EndGlobal diff --git a/builds/.gitignore b/builds/.gitignore index dad605eee05e..e258969d6dcd 100644 --- a/builds/.gitignore +++ b/builds/.gitignore @@ -3,31 +3,3 @@ dotnet-install.sh BundledNETCorePlatformsPackageVersion.txt downloads .stamp* -.deps.*.mk -*.config.cache -install -mac32 -mac64 -llvm -llvm64 -simulator86 -simulator64 -watchsimulator -tvsimulator -tools64 -cross -cross64 -crosstv -cross-watch -target7 -target7s -target64 -targettv -targetwatch -watchbcl -mono-ios-sdk-destdir -*.dylib -*.o -x86-64-slice* -*.pkg - diff --git a/builds/Makefile b/builds/Makefile index 4f212c317289..6e3316c4eadd 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -12,68 +12,22 @@ else DOTNET_ARCH=x64 endif -## -## Mono download vs. build -## - -download: download-mono -download-mono: \ - downloads/$(basename $(MONO_IOS_FILENAME)) \ - -downloads/$(basename $(MONO_IOS_FILENAME)): MONO_URL=$(MONO_IOS_URL) - include $(TOP)/mk/colors.mk -DOWNLOADS = \ - downloads/$(MONO_IOS_FILENAME) \ - -# This target downloads the mono archives, there's one for Xamarin.iOS and one for Xamarin.Mac. -# If doing many clean builds, it's possible to copy the downloaded zip file to ~/Library/Caches/xamarin-macios -# to avoid having to download it every time. The zip files have to be copied manually, otherwise -# we'd end up filling up a lot of hard drives around the world. -$(DOWNLOADS): - $(Q) mkdir -p downloads - $(Q) echo "Downloading $(MONO_URL)..." - $(Q) if test -f ~/Library/Caches/xamarin-macios/$(notdir $@); then \ - echo "Found a cached version of $(MONO_URL) in ~/Library/Caches/xamarin-macios/$(notdir $@)."; \ - $(CP) ~/Library/Caches/xamarin-macios/$(notdir $@) $@.tmp; \ - else \ - EC=0; \ - $(CURL_RETRY) $(MONO_URL) --output $@.tmp || EC=$$?; \ - if [[ x$$EC == x22 ]]; then \ - MSG="Could not download the archive %s because the URL doesn't exist. This can happen if bumping mono very soon after the corresponding commit was pushed to mono (i.e. the archive hasn't been built yet). If so, please wait a bit and try again."; \ - printf "$(COLOR_RED)*** $$MSG$(COLOR_CLEAR)\n" "$(notdir $@)"; \ - if test -n "$$FAILURE_REASON_PATH"; then printf "$$MSG\n" "[$(notdir $@)]($(MONO_URL))" >> "$$FAILURE_REASON_PATH"; fi; \ - fi; \ - if [[ x$$EC != x0 ]]; then exit $$EC; fi; \ - if [[ "x$$MACIOS_CACHE_DOWNLOADS" != "x" ]]; then \ - mkdir -p ~/Library/Caches/xamarin-macios/; \ - $(CP) $@.tmp ~/Library/Caches/xamarin-macios/"$(notdir $@)"; \ - echo "Cached the download of $(notdir $@) in ~/Library/Caches/xamarin-macios"; \ - fi; \ - fi - $(Q) mv $@.tmp $@ - $(Q) echo "Downloaded $(MONO_URL)" - -downloads/%: downloads/%.7z - $(Q) echo "Unzipping $*..." - $(Q) rm -Rf $@.tmp - $(Q) 7z x $< -o$@.tmp - $(Q) find $@.tmp -exec touch {} + - $(Q) mv $@.tmp $@ - $(Q) echo "Unzipped $*." - -downloads/%: downloads/%.nupkg - $(Q) echo "Unzipping $*..." - $(Q) rm -Rf $@.tmp - $(Q) unzip -d $@.tmp $< - $(Q) find $@.tmp -exec touch {} + - $(Q) mv $@.tmp $@ - $(Q) echo "Unzipped $*." +DOTNET_FILENAME=$(DOTNET_VERSION).tar.gz +DOTNET_CACHE_FILENAME=$(HOME)/Library/Caches/xamarin-macios/$(DOTNET_FILENAME) downloads/$(DOTNET_INSTALL_NAME): dotnet-install.sh $(Q) echo "Downloading and installing .NET $(DOTNET_VERSION) ($(DOTNET_ARCH)) into $@..." - $(Q) ./dotnet-install.sh --install-dir "$@.tmp" --version "$(DOTNET_VERSION)" --architecture $(DOTNET_ARCH) --no-path $$DOTNET_INSTALL_EXTRA_ARGS + $(Q) if test -f $(DOTNET_CACHE_FILENAME); then \ + echo "Found a cached version of .NET $(DOTNET_VERSION) in $(DOTNET_CACHE_FILENAME)."; \ + mkdir -p "$@.tmp"; \ + tar -xzf $(DOTNET_CACHE_FILENAME) -C "$@.tmp"; \ + else \ + ./dotnet-install.sh --install-dir "$@.tmp" --version "$(DOTNET_VERSION)" --architecture $(DOTNET_ARCH) --no-path --keep-zip --zip-path "downloads/$(DOTNET_FILENAME)" $$DOTNET_INSTALL_EXTRA_ARGS; \ + cp -c downloads/$(DOTNET_FILENAME) $(DOTNET_CACHE_FILENAME); \ + echo "Cached the download of $(DOTNET_FILENAME) in ~/Library/Caches/xamarin-macios"; \ + fi $(Q) rm -Rf "$@" $(Q) mv "$@.tmp" "$@" $(Q) echo "Downloaded and installed .NET $(DOTNET_VERSION) into $@." @@ -108,10 +62,6 @@ dotnet-install.sh: Makefile $(Q) chmod +x $@.tmp $(Q) mv $@.tmp $@ -.stamp-download-mono: $(TOP)/Make.config $(TOP)/mk/mono.mk - $(MAKE) download-mono - $(Q) touch $@ - ifdef CUSTOM_DOTNET DOWNLOAD_DOTNET_VERSION=$(CUSTOM_DOTNET_VERSION) else @@ -170,17 +120,7 @@ dotnet:: $(DOTNET_DOWNLOADS) all-local:: $(DOTNET_DOWNLOADS) clean-local:: - $(Q) rm -Rf downloads .stamp-download-mono - -all-local:: .stamp-mono-ios-sdk-destdir - -.stamp-mono-ios-sdk-destdir: .stamp-$(MONO_BUILD_MODE) - ln -sf $(MONO_IOS_SDK_DESTDIR) mono-ios-sdk-destdir - $(Q) touch $@ - -# -# .NET -# + $(Q) rm -Rf downloads DOTNET_COMMON_DIRECTORIES += \ $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(DOTNET_DESTDIR)/$($(platform)_NUGET_SDK_NAME)) \ @@ -190,10 +130,12 @@ DOTNET_COMMON_TARGETS = \ $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(DOTNET_DESTDIR)/$($(platform)_NUGET_SDK_NAME)/Versions.plist) \ $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(DOTNET_DESTDIR)/$($(platform)_NUGET_SDK_NAME)/tools/buildinfo) \ +include $(TOP)/scripts/versions-check/fragment.mk +$(VERSIONS_CHECK): downloads/$(DOTNET_INSTALL_NAME) define VersionInfo -$(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME)/Versions.plist: $(TOP)/builds/Versions-$(1).plist.in Makefile $(TOP)/Make.config $(TOP)/versions-check.csharp | $(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME) - $$(Q) $(TOP)/versions-check.csharp $$< "$(DOTNET_MIN_IOS_SDK_VERSION)" "$(MAX_IOS_DEPLOYMENT_TARGET)" "$(DOTNET_MIN_TVOS_SDK_VERSION)" "$(MAX_TVOS_DEPLOYMENT_TARGET)" "$(MIN_WATCH_OS_VERSION)" "$(MAX_WATCH_DEPLOYMENT_TARGET)" "$(DOTNET_MIN_MACOS_SDK_VERSION)" "$(MACOS_SDK_VERSION)" "$(DOTNET_MIN_MACCATALYST_SDK_VERSION)" "$(MACCATALYST_SDK_VERSION)" - $$(Q_GEN) sed -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' -e "s/@MONO_VERSION@/$(DOTNET_VERSION)/g" $$< > $$@.tmp +$(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME)/Versions.plist: $(TOP)/builds/Versions-$(1).plist.in Makefile $(TOP)/Make.config $(VERSIONS_CHECK) | $(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME) + $$(Q) $(VERSIONS_CHECK_EXEC) $$< "$(DOTNET_MIN_IOS_SDK_VERSION)" "$(MAX_IOS_DEPLOYMENT_TARGET)" "$(DOTNET_MIN_TVOS_SDK_VERSION)" "$(MAX_TVOS_DEPLOYMENT_TARGET)" "$(DOTNET_MIN_MACOS_SDK_VERSION)" "$(MACOS_SDK_VERSION)" "$(DOTNET_MIN_MACCATALYST_SDK_VERSION)" "$(MACCATALYST_SDK_VERSION)" + $$(QF_GEN) sed -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' -e "s/@MONO_VERSION@/$(DOTNET_VERSION)/g" $$< > $$@.tmp $$(Q) mv $$@.tmp $$@ endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call VersionInfo,$(platform)))) @@ -213,5 +155,4 @@ $(DOTNET_COMMON_DIRECTORIES): install-dotnet: $(DOTNET_COMMON_TARGETS) install-local:: install-dotnet -all-local:: install-dotnet - +all-local:: install-dotnet \ No newline at end of file diff --git a/builds/Mono.framework-Info.plist b/builds/Mono.framework-Info.plist deleted file mode 100644 index 216a744ca55b..000000000000 --- a/builds/Mono.framework-Info.plist +++ /dev/null @@ -1,58 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.ios.mono-framework - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Mono - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - Mono - - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - iPhoneOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - iphoneos - DTPlatformVersion - 8.2 - DTSDKBuild - 12D508 - DTSDKName - iphoneos8.2 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 12.2 - UIDeviceFamily - - 1 - 2 - - - diff --git a/builds/Mono.framework-tvos.Info.plist b/builds/Mono.framework-tvos.Info.plist deleted file mode 100644 index c0db855ee5ab..000000000000 --- a/builds/Mono.framework-tvos.Info.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.tvos.mono-framework - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Mono - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - Mono - BuildMachineOSBuild - 13F34 - CFBundleDevelopmentRegion - en - CFBundleSupportedPlatforms - - AppleTVOS - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12D508 - DTPlatformName - appletvos - DTPlatformVersion - 9.0 - DTSDKBuild - 12D508 - DTSDKName - appletvos9.0 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 12.2 - UIDeviceFamily - - 3 - - - diff --git a/builds/Mono.framework-watchos.Info.plist b/builds/Mono.framework-watchos.Info.plist deleted file mode 100644 index d49a2c154e7f..000000000000 --- a/builds/Mono.framework-watchos.Info.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleIdentifier - xamarin.watchos.mono-framework - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Mono - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 3.12 - NSPrincipalClass - - CFBundleExecutable - Mono - 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.2 - DTXcode - 0620 - DTXcodeBuild - 6C131e - MinimumOSVersion - 4.0 - UIDeviceFamily - - 4 - - - diff --git a/builds/Versions-MacCatalyst.plist.in b/builds/Versions-MacCatalyst.plist.in index 0e66d8d26b29..473439e89adf 100644 --- a/builds/Versions-MacCatalyst.plist.in +++ b/builds/Versions-MacCatalyst.plist.in @@ -19,6 +19,7 @@ 17.4 17.5 18.0 + 18.1 SupportedTargetPlatformVersions @@ -48,6 +49,7 @@ 17.4 17.5 18.0 + 18.1 MacCatalystVersionMap @@ -92,6 +94,8 @@ 14.5 18.0 15.0 + 18.1 + 15.1 RecommendedXcodeVersion @XCODE_VERSION@ diff --git a/builds/Versions-iOS.plist.in b/builds/Versions-iOS.plist.in index dd2571895d1b..84fee70abc84 100644 --- a/builds/Versions-iOS.plist.in +++ b/builds/Versions-iOS.plist.in @@ -36,6 +36,7 @@ 17.4 17.5 18.0 + 18.1 SupportedTargetPlatformVersions @@ -84,6 +85,7 @@ 17.4 17.5 18.0 + 18.1 RecommendedXcodeVersion diff --git a/builds/Versions-macOS.plist.in b/builds/Versions-macOS.plist.in index b6e2035c2bd0..1b4f7506193f 100644 --- a/builds/Versions-macOS.plist.in +++ b/builds/Versions-macOS.plist.in @@ -21,6 +21,7 @@ 14.4 14.5 15.0 + 15.1 SupportedTargetPlatformVersions @@ -48,6 +49,7 @@ 14.4 14.5 15.0 + 15.1 RecommendedXcodeVersion diff --git a/builds/Versions-tvOS.plist.in b/builds/Versions-tvOS.plist.in index 7d9610d8d9c1..48b8ba92d30c 100644 --- a/builds/Versions-tvOS.plist.in +++ b/builds/Versions-tvOS.plist.in @@ -31,6 +31,7 @@ 17.4 17.5 18.0 + 18.1 SupportedTargetPlatformVersions @@ -74,6 +75,7 @@ 17.4 17.5 18.0 + 18.1 RecommendedXcodeVersion diff --git a/builds/mac-System.config b/builds/mac-System.config deleted file mode 100644 index ebb9b2987fd1..000000000000 --- a/builds/mac-System.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/BaseStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/BaseStep.cs new file mode 100644 index 000000000000..39210adc9eeb --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/BaseStep.cs @@ -0,0 +1,83 @@ +// +// BaseStep.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public abstract class BaseStep : IStep { + + private LinkContext _context; + + public LinkContext Context { + get { return _context; } + } + + public AnnotationStore Annotations { + get { return _context.Annotations; } + } + + public Tracer Tracer { + get { return _context.Tracer; } + } + + public MarkingHelpers MarkingHelpers => _context.MarkingHelpers; + + public void Process (LinkContext context) + { + _context = context; + + if (!ConditionToProcess ()) + return; + + Process (); + + foreach (AssemblyDefinition assembly in context.GetAssemblies ()) + ProcessAssembly (assembly); + + EndProcess (); + } + + protected virtual bool ConditionToProcess () + { + return true; + } + + protected virtual void Process () + { + } + + protected virtual void EndProcess () + { + } + + protected virtual void ProcessAssembly (AssemblyDefinition assembly) + { + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/BlacklistStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/BlacklistStep.cs new file mode 100644 index 000000000000..6448374c6f06 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/BlacklistStep.cs @@ -0,0 +1,146 @@ +// +// Blacklist.cs +// +// Author: +// Jb Evain (jb@nurv.fr) +// +// (C) 2007 Novell Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Linq; +using System.IO; +using System.Reflection; +using System.Xml; +using System.Xml.XPath; + +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class BlacklistStep : BaseStep { + + protected override void Process () + { + foreach (string name in Assembly.GetExecutingAssembly ().GetManifestResourceNames ()) { + if (!name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase) || !ShouldProcessAssemblyResource (GetAssemblyName (name))) + continue; + + try { + Context.LogMessage ($"Processing resource linker descriptor: {name}"); + AddToPipeline (GetResolveStep (name)); + } catch (XmlException ex) { + /* This could happen if some broken XML file is included. */ + Context.LogMessage ($"Error processing {name}: {ex}"); + } + } + + foreach (var asm in Context.GetAssemblies ()) { + foreach (var rsc in asm.Modules + .SelectMany (mod => mod.Resources) + .Where (res => res.ResourceType == ResourceType.Embedded) + .Where (res => res.Name.EndsWith (".xml", StringComparison.OrdinalIgnoreCase)) + .Where (res => ShouldProcessAssemblyResource (GetAssemblyName (res.Name))) + .Cast ()) { + try { + Context.LogMessage ($"Processing embedded resource linker descriptor: {rsc.Name}"); + + AddToPipeline (GetExternalResolveStep (rsc, asm)); + } catch (XmlException ex) { + /* This could happen if some broken XML file is embedded. */ + Context.LogMessage ($"Error processing {rsc.Name}: {ex}"); + } + } + } + } + + static string GetAssemblyName (string descriptor) + { + int pos = descriptor.LastIndexOf ('.'); + if (pos == -1) + return descriptor; + + return descriptor.Substring (0, pos); + } + + bool ShouldProcessAssemblyResource (string name) + { + AssemblyDefinition assembly = GetAssemblyIfReferenced (name); + + if (assembly is null) + return false; + + switch (Annotations.GetAction (assembly)) { + case AssemblyAction.Link: + case AssemblyAction.AddBypassNGen: + case AssemblyAction.AddBypassNGenUsed: + case AssemblyAction.Copy: + return true; + default: + return false; + } + } + + AssemblyDefinition GetAssemblyIfReferenced (string name) + { + foreach (AssemblyDefinition assembly in Context.GetAssemblies ()) + if (assembly.Name.Name == name) + return assembly; + + return null; + } + + protected virtual void AddToPipeline (IStep resolveStep) + { + Context.Pipeline.AddStepAfter (typeof (BlacklistStep), resolveStep); + } + + protected virtual IStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly) + { + return new ResolveFromXmlStep (GetExternalDescriptor (resource), resource.Name, assembly, "resource " + resource.Name + " in " + assembly.FullName); + } + + static ResolveFromXmlStep GetResolveStep (string descriptor) + { + return new ResolveFromXmlStep (GetDescriptor (descriptor), "descriptor " + descriptor + " from " + Assembly.GetExecutingAssembly ().FullName); + } + + protected static XPathDocument GetExternalDescriptor (EmbeddedResource resource) + { + using (var sr = new StreamReader (resource.GetResourceStream ())) { + return new XPathDocument (sr); + } + } + + static XPathDocument GetDescriptor (string descriptor) + { + using (StreamReader sr = new StreamReader (GetResource (descriptor))) { + return new XPathDocument (sr); + } + } + + static Stream GetResource (string descriptor) + { + return Assembly.GetExecutingAssembly ().GetManifestResourceStream (descriptor); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/CleanStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/CleanStep.cs new file mode 100644 index 000000000000..fd6c1063046d --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/CleanStep.cs @@ -0,0 +1,106 @@ +// +// CleanStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class CleanStep : BaseStep { + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + if (Annotations.GetAction (assembly) == AssemblyAction.Link) + CleanAssembly (assembly); + } + + static void CleanAssembly (AssemblyDefinition asm) + { + foreach (TypeDefinition type in asm.MainModule.Types) + CleanType (type); + } + + static void CleanType (TypeDefinition type) + { + if (type.HasProperties) + CleanProperties (type); + if (type.HasEvents) + CleanEvents (type); + + if (type.HasNestedTypes) + foreach (var nested in type.NestedTypes) + CleanType (nested); + } + + static MethodDefinition CheckMethod (TypeDefinition type, MethodDefinition method) + { + if (method is null) + return null; + + return type.Methods.Contains (method) ? method : null; + } + + static void CleanEvents (TypeDefinition type) + { + var events = type.Events; + + for (int i = 0; i < events.Count; i++) { + var evt = events [i]; + evt.AddMethod = CheckMethod (type, evt.AddMethod); + evt.InvokeMethod = CheckMethod (type, evt.InvokeMethod); + evt.RemoveMethod = CheckMethod (type, evt.RemoveMethod); + + if (!IsEventUsed (evt)) + events.RemoveAt (i--); + } + } + + static bool IsEventUsed (EventDefinition evt) + { + return evt.AddMethod is not null || evt.InvokeMethod is not null || evt.RemoveMethod is not null; + } + + static void CleanProperties (TypeDefinition type) + { + var properties = type.Properties; + + for (int i = 0; i < properties.Count; i++) { + var prop = properties [i]; + prop.GetMethod = CheckMethod (type, prop.GetMethod); + prop.SetMethod = CheckMethod (type, prop.SetMethod); + + if (!IsPropertyUsed (prop)) + properties.RemoveAt (i--); + } + } + + static bool IsPropertyUsed (PropertyDefinition prop) + { + return prop.GetMethod is not null || prop.SetMethod is not null; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/IStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/IStep.cs new file mode 100644 index 000000000000..c01ef1e6b3fa --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/IStep.cs @@ -0,0 +1,34 @@ +// +// IStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace Mono.Linker.Steps { + + public interface IStep { + void Process (LinkContext context); + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadI18nAssemblies.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadI18nAssemblies.cs new file mode 100644 index 000000000000..da8bb3921746 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadI18nAssemblies.cs @@ -0,0 +1,103 @@ +// +// LoadI18nAssemblies.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Linq; +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class LoadI18nAssemblies : BaseStep { + + static readonly byte [] _pktoken = new byte [] { 0x07, 0x38, 0xeb, 0x9f, 0x13, 0x2e, 0xd7, 0x56 }; + + I18nAssemblies _assemblies; + + public LoadI18nAssemblies (I18nAssemblies assemblies) + { + _assemblies = assemblies; + } + + protected override bool ConditionToProcess () + { + return _assemblies != I18nAssemblies.None && + Context.GetAssemblies ().FirstOrDefault (a => a.Name.Name == "mscorlib")?.MainModule.GetType ("System.MonoType") is not null; + } + + protected override void Process () + { + LoadAssembly (GetAssemblyName (I18nAssemblies.Base)); + + LoadI18nAssembly (I18nAssemblies.CJK); + LoadI18nAssembly (I18nAssemblies.MidEast); + LoadI18nAssembly (I18nAssemblies.Other); + LoadI18nAssembly (I18nAssemblies.Rare); + LoadI18nAssembly (I18nAssemblies.West); + } + + bool ShouldCopyAssembly (I18nAssemblies current) + { + return (current & _assemblies) != 0; + } + + void LoadI18nAssembly (I18nAssemblies asm) + { + if (!ShouldCopyAssembly (asm)) + return; + + AssemblyNameReference name = GetAssemblyName (asm); + LoadAssembly (name); + } + + void LoadAssembly (AssemblyNameReference name) + { + AssemblyDefinition assembly = Context.Resolve (name); + Context.Annotations.SetAction (assembly, AssemblyAction.Copy); + ResolveFromAssemblyStep.ProcessLibrary (Context, assembly, ResolveFromAssemblyStep.RootVisibility.Any); + } + + AssemblyNameReference GetAssemblyName (I18nAssemblies assembly) + { + AssemblyNameReference name = new AssemblyNameReference ("I18N", GetCorlibVersion ()); + if (assembly != I18nAssemblies.Base) + name.Name += "." + assembly; + + name.PublicKeyToken = _pktoken; + return name; + } + + Version GetCorlibVersion () + { + foreach (AssemblyDefinition assembly in Context.GetAssemblies ()) + if (assembly.Name.Name == "mscorlib") + return assembly.Name.Version; + + return new Version (); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs new file mode 100644 index 000000000000..06684edb61cb --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs @@ -0,0 +1,61 @@ +// +// LoadReferencesStep.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; + +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class LoadReferencesStep : BaseStep { + + readonly HashSet references = new HashSet (); + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + ProcessReferences (assembly); + } + + protected void ProcessReferences (AssemblyDefinition assembly) + { + if (!references.Add (assembly.Name)) + return; + + Context.RegisterAssembly (assembly); + + foreach (AssemblyDefinition referenceDefinition in Context.ResolveReferences (assembly)) { + try { + ProcessReferences (referenceDefinition); + } catch (Exception ex) { + throw new LoadException (string.Format ("Error while processing references of '{0}'", assembly.FullName), ex); + } + } + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/MarkStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/MarkStep.cs new file mode 100644 index 000000000000..ff46157cbaeb --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/MarkStep.cs @@ -0,0 +1,3350 @@ +// +// MarkStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; + +using Mono.Cecil; +using Mono.Cecil.Cil; +using Mono.Collections.Generic; + +namespace Mono.Linker.Steps { + + public partial class MarkStep : IStep { + + protected LinkContext _context; + protected Queue _methods; + protected List _virtual_methods; + protected Queue _assemblyLevelAttributes; + protected Queue _lateMarkedAttributes; + protected List _typesWithInterfaces; + protected List _unreachableBodies; + + public MarkStep () + { + _methods = new Queue (); + _virtual_methods = new List (); + _assemblyLevelAttributes = new Queue (); + _lateMarkedAttributes = new Queue (); + _typesWithInterfaces = new List (); + _unreachableBodies = new List (); + } + + public AnnotationStore Annotations => _context.Annotations; + public Tracer Tracer => _context.Tracer; + + public virtual void Process (LinkContext context) + { + _context = context; + + Initialize (); + Process (); + Complete (); + } + + void Initialize () + { + foreach (AssemblyDefinition assembly in _context.GetAssemblies ()) + InitializeAssembly (assembly); + } + + protected virtual void InitializeAssembly (AssemblyDefinition assembly) + { + Tracer.Push (assembly); + try { + switch (_context.Annotations.GetAction (assembly)) { + case AssemblyAction.Copy: + case AssemblyAction.Save: + MarkEntireAssembly (assembly); + break; + case AssemblyAction.Link: + case AssemblyAction.AddBypassNGen: + case AssemblyAction.AddBypassNGenUsed: + MarkAssembly (assembly); + + foreach (TypeDefinition type in assembly.MainModule.Types) + InitializeType (type); + + break; + } + } finally { + Tracer.Pop (); + } + } + + void Complete () + { + foreach (var body in _unreachableBodies) { + Annotations.SetAction (body.Method, MethodAction.ConvertToThrow); + } + } + + void InitializeType (TypeDefinition type) + { + if (type.HasNestedTypes) { + foreach (var nested in type.NestedTypes) + InitializeType (nested); + } + + if (!Annotations.IsMarked (type)) + return; + + MarkType (type); + + if (type.HasFields) + InitializeFields (type); + if (type.HasMethods) + InitializeMethods (type.Methods); + } + + protected bool IsFullyPreserved (TypeDefinition type) + { + if (Annotations.TryGetPreserve (type, out TypePreserve preserve) && preserve == TypePreserve.All) + return true; + + switch (Annotations.GetAction (type.Module.Assembly)) { + case AssemblyAction.Save: + case AssemblyAction.Copy: + case AssemblyAction.CopyUsed: + case AssemblyAction.AddBypassNGen: + case AssemblyAction.AddBypassNGenUsed: + return true; + } + + return false; + } + + void InitializeFields (TypeDefinition type) + { + foreach (FieldDefinition field in type.Fields) + if (Annotations.IsMarked (field)) + MarkField (field); + } + + void InitializeMethods (Collection methods) + { + foreach (MethodDefinition method in methods) + if (Annotations.IsMarked (method)) + EnqueueMethod (method); + } + + void MarkEntireType (TypeDefinition type) + { + if (type.HasNestedTypes) { + foreach (TypeDefinition nested in type.NestedTypes) + MarkEntireType (nested); + } + + Annotations.Mark (type); + MarkCustomAttributes (type); + MarkTypeSpecialCustomAttributes (type); + + if (type.HasInterfaces) { + foreach (InterfaceImplementation iface in type.Interfaces) { + MarkInterfaceImplementation (iface); + } + } + + MarkGenericParameterProvider (type); + + if (type.HasFields) { + foreach (FieldDefinition field in type.Fields) { + MarkField (field); + } + } + + if (type.HasMethods) { + foreach (MethodDefinition method in type.Methods) { + Annotations.Mark (method); + Annotations.SetAction (method, MethodAction.ForceParse); + EnqueueMethod (method); + } + } + + if (type.HasProperties) { + foreach (var property in type.Properties) { + MarkProperty (property); + } + } + + if (type.HasEvents) { + foreach (var ev in type.Events) { + MarkEvent (ev); + } + } + } + + void Process () + { + while (ProcessPrimaryQueue () || ProcessLazyAttributes () || ProcessLateMarkedAttributes ()) + + // deal with [TypeForwardedTo] pseudo-attributes + foreach (AssemblyDefinition assembly in _context.GetAssemblies ()) { + if (!assembly.MainModule.HasExportedTypes) + continue; + + foreach (var exported in assembly.MainModule.ExportedTypes) { + bool isForwarder = exported.IsForwarder; + var declaringType = exported.DeclaringType; + while (!isForwarder && (declaringType is not null)) { + isForwarder = declaringType.IsForwarder; + declaringType = declaringType.DeclaringType; + } + + if (!isForwarder) + continue; + TypeDefinition type = exported.Resolve (); + if (type is null) + continue; + if (!Annotations.IsMarked (type)) + continue; + Tracer.Push (type); + try { + _context.MarkingHelpers.MarkExportedType (exported, assembly.MainModule); + } finally { + Tracer.Pop (); + } + } + } + } + + bool ProcessPrimaryQueue () + { + if (QueueIsEmpty ()) + return false; + + while (!QueueIsEmpty ()) { + ProcessQueue (); + ProcessVirtualMethods (); + ProcessMarkedTypesWithInterfaces (); + ProcessPendingBodies (); + DoAdditionalProcessing (); + } + + return true; + } + + void ProcessQueue () + { + while (!QueueIsEmpty ()) { + MethodDefinition method = _methods.Dequeue (); + Tracer.Push (method); + try { + ProcessMethod (method); + } catch (Exception e) { + throw new MarkException (string.Format ("Error processing method: '{0}' in assembly: '{1}'", method.FullName, method.Module.Name), e, method); + } finally { + Tracer.Pop (); + } + } + } + + bool QueueIsEmpty () + { + return _methods.Count == 0; + } + + protected virtual void EnqueueMethod (MethodDefinition method) + { + _methods.Enqueue (method); + } + + void ProcessVirtualMethods () + { + foreach (MethodDefinition method in _virtual_methods) { + Tracer.Push (method); + ProcessVirtualMethod (method); + Tracer.Pop (); + } + } + + void ProcessMarkedTypesWithInterfaces () + { + // We may mark an interface type later on. Which means we need to reprocess any time with one or more interface implementations that have not been marked + // and if an interface type is found to be marked and implementation is not marked, then we need to mark that implementation + + // copy the data to avoid modified while enumerating error potential, which can happen under certain conditions. + var typesWithInterfaces = _typesWithInterfaces.ToArray (); + + foreach (var type in typesWithInterfaces) { + // Exception, types that have not been flagged as instantiated yet. These types may not need their interfaces even if the + // interface type is marked + if (!Annotations.IsInstantiated (type)) + continue; + + MarkInterfaceImplementations (type); + } + } + + void ProcessPendingBodies () + { + for (int i = 0; i < _unreachableBodies.Count; i++) { + var body = _unreachableBodies [i]; + if (Annotations.IsInstantiated (body.Method.DeclaringType)) { + MarkMethodBody (body); + _unreachableBodies.RemoveAt (i--); + } + } + } + + void ProcessVirtualMethod (MethodDefinition method) + { + var overrides = Annotations.GetOverrides (method); + if (overrides is null) + return; + + foreach (OverrideInformation @override in overrides) + ProcessOverride (@override); + } + + void ProcessOverride (OverrideInformation overrideInformation) + { + var method = overrideInformation.Override; + var @base = overrideInformation.Base; + if (!Annotations.IsMarked (method.DeclaringType)) + return; + + if (Annotations.IsProcessed (method)) + return; + + if (Annotations.IsMarked (method)) + return; + + var isInstantiated = Annotations.IsInstantiated (method.DeclaringType); + + // We don't need to mark overrides until it is possible that the type could be instantiated + // Note : The base type is interface check should be removed once we have base type sweeping + if (IsInterfaceOverrideThatDoesNotNeedMarked (overrideInformation, isInstantiated)) + return; + + if (!isInstantiated && !@base.IsAbstract && _context.IsOptimizationEnabled (CodeOptimizations.OverrideRemoval)) + return; + + MarkMethod (method); + ProcessVirtualMethod (method); + } + + bool IsInterfaceOverrideThatDoesNotNeedMarked (OverrideInformation overrideInformation, bool isInstantiated) + { + if (!overrideInformation.IsOverrideOfInterfaceMember || isInstantiated) + return false; + + if (overrideInformation.MatchingInterfaceImplementation is not null) + return !Annotations.IsMarked (overrideInformation.MatchingInterfaceImplementation); + + var interfaceType = overrideInformation.InterfaceType; + var overrideDeclaringType = overrideInformation.Override.DeclaringType; + + if (!IsInterfaceImplementationMarked (overrideDeclaringType, interfaceType)) { + var derivedInterfaceTypes = Annotations.GetDerivedInterfacesForInterface (interfaceType); + + // There are no derived interface types that could be marked, it's safe to skip marking this override + if (derivedInterfaceTypes is null) + return true; + + // If none of the other interfaces on the type that implement the interface from the @base type are marked, then it's safe to skip + // marking this override + if (!derivedInterfaceTypes.Any (d => IsInterfaceImplementationMarked (overrideDeclaringType, d))) + return true; + } + + return false; + } + + bool IsInterfaceImplementationMarked (TypeDefinition type, TypeDefinition interfaceType) + { + return type.HasInterface (@interfaceType, out InterfaceImplementation implementation) && Annotations.IsMarked (implementation); + } + + void MarkMarshalSpec (IMarshalInfoProvider spec) + { + if (!spec.HasMarshalInfo) + return; + + if (spec.MarshalInfo is CustomMarshalInfo marshaler) + MarkType (marshaler.ManagedType); + } + + void MarkCustomAttributes (ICustomAttributeProvider provider) + { + if (!provider.HasCustomAttributes) + return; + + bool markOnUse = _context.KeepUsedAttributeTypesOnly && Annotations.GetAction (GetAssemblyFromCustomAttributeProvider (provider)) == AssemblyAction.Link; + + Tracer.Push (provider); + try { + foreach (CustomAttribute ca in provider.CustomAttributes) { + if (IsUserDependencyMarker (ca.AttributeType) && provider is MemberReference mr) { + MarkUserDependency (mr, ca); + + if (_context.KeepDependencyAttributes) { + MarkCustomAttribute (ca); + continue; + } + + if (Annotations.GetAction (mr.Module.Assembly) == AssemblyAction.Link) + continue; + } + + if (markOnUse) { + _lateMarkedAttributes.Enqueue (new AttributeProviderPair (ca, provider)); + continue; + } + + MarkCustomAttribute (ca); + MarkSpecialCustomAttributeDependencies (ca); + } + } finally { + Tracer.Pop (); + } + } + + static AssemblyDefinition GetAssemblyFromCustomAttributeProvider (ICustomAttributeProvider provider) + { + return provider switch { + MemberReference mr => mr.Module.Assembly, + AssemblyDefinition ad => ad, + ModuleDefinition md => md.Assembly, + InterfaceImplementation ii => ii.InterfaceType.Module.Assembly, + GenericParameterConstraint gpc => gpc.ConstraintType.Module.Assembly, + ParameterDefinition pd => pd.ParameterType.Module.Assembly, + MethodReturnType mrt => mrt.ReturnType.Module.Assembly, + _ => throw new NotImplementedException (provider.GetType ().ToString ()), + }; + } + + protected virtual bool IsUserDependencyMarker (TypeReference type) + { + return PreserveDependencyLookupStep.IsPreserveDependencyAttribute (type); + } + + protected virtual void MarkUserDependency (MemberReference context, CustomAttribute ca) + { + if (ca.HasProperties && ca.Properties [0].Name == "Condition") { + var condition = ca.Properties [0].Argument.Value as string; + switch (condition) { + case "": + case null: + break; + case "DEBUG": + if (!_context.KeepMembersForDebugger) + return; + + break; + default: + // Don't have yet a way to match the general condition so everything is excluded + return; + } + } + + AssemblyDefinition assembly; + var args = ca.ConstructorArguments; + if (args.Count >= 3 && args [2].Value is string assemblyName) { + if (!_context.Resolver.AssemblyCache.TryGetValue (assemblyName, out assembly)) { + _context.LogMessage (MessageImportance.Low, $"Could not resolve '{assemblyName}' assembly dependency"); + return; + } + } else { + assembly = null; + } + + TypeDefinition td; + if (args.Count >= 2 && args [1].Value is string typeName) { + td = FindType (assembly ?? context.Module.Assembly, typeName); + + if (td is null) { + _context.LogMessage (MessageImportance.Low, $"Could not resolve '{typeName}' type dependency"); + return; + } + } else { + td = context.DeclaringType.Resolve (); + } + + string member = null; + string [] signature = null; + if (args.Count >= 1 && args [0].Value is string memberSignature) { + memberSignature = memberSignature.Replace (" ", ""); + var sign_start = memberSignature.IndexOf ('('); + var sign_end = memberSignature.LastIndexOf (')'); + if (sign_start > 0 && sign_end > sign_start) { + var parameters = memberSignature.Substring (sign_start + 1, sign_end - sign_start - 1); + signature = string.IsNullOrEmpty (parameters) ? Array.Empty () : parameters.Split (','); + member = memberSignature.Substring (0, sign_start); + } else { + member = memberSignature; + } + } + + if (member == "*") { + MarkEntireType (td); + return; + } + + if (MarkDependencyMethod (td, member, signature)) + return; + + if (MarkDependencyField (td, member)) + return; + + _context.LogMessage (MessageImportance.High, $"Could not resolve dependency member '{member}' declared in type '{td.FullName}'"); + } + + static TypeDefinition FindType (AssemblyDefinition assembly, string fullName) + { + fullName = fullName.ToCecilName (); + + var type = assembly.MainModule.GetType (fullName); + return type?.Resolve (); + } + + bool MarkDependencyMethod (TypeDefinition type, string name, string [] signature) + { + bool marked = false; + + int arity_marker = name.IndexOf ('`'); + if (arity_marker < 1 || !int.TryParse (name.Substring (arity_marker + 1), out int arity)) { + arity = 0; + } else { + name = name.Substring (0, arity_marker); + } + + foreach (var m in type.Methods) { + if (m.Name != name) + continue; + + if (m.GenericParameters.Count != arity) + continue; + + if (signature is null) { + MarkIndirectlyCalledMethod (m); + marked = true; + continue; + } + + var mp = m.Parameters; + if (mp.Count != signature.Length) + continue; + + int i = 0; + for (; i < signature.Length; ++i) { + if (mp [i].ParameterType.FullName != signature [i].Trim ().ToCecilName ()) { + i = -1; + break; + } + } + + if (i < 0) + continue; + + MarkIndirectlyCalledMethod (m); + marked = true; + } + + return marked; + } + + bool MarkDependencyField (TypeDefinition type, string name) + { + foreach (var f in type.Fields) { + if (f.Name == name) { + MarkField (f); + return true; + } + } + + return false; + } + + void LazyMarkCustomAttributes (ICustomAttributeProvider provider, AssemblyDefinition assembly) + { + if (!provider.HasCustomAttributes) + return; + + foreach (CustomAttribute ca in provider.CustomAttributes) + _assemblyLevelAttributes.Enqueue (new AttributeProviderPair (ca, assembly)); + } + + protected virtual void MarkCustomAttribute (CustomAttribute ca) + { + Tracer.Push ((object) ca.AttributeType ?? (object) ca); + try { + Annotations.Mark (ca); + MarkMethod (ca.Constructor); + + MarkCustomAttributeArguments (ca); + + TypeReference constructor_type = ca.Constructor.DeclaringType; + TypeDefinition type = constructor_type.Resolve (); + + if (type is null) { + HandleUnresolvedType (constructor_type); + return; + } + + MarkCustomAttributeProperties (ca, type); + MarkCustomAttributeFields (ca, type); + } finally { + Tracer.Pop (); + } + } + + protected virtual bool ShouldMarkCustomAttribute (CustomAttribute ca, ICustomAttributeProvider provider) + { + var attr_type = ca.AttributeType; + + if (_context.KeepUsedAttributeTypesOnly) { + switch (attr_type.FullName) { + // These are required by the runtime + case "System.ThreadStaticAttribute": + case "System.ContextStaticAttribute": + case "System.Runtime.CompilerServices.IsByRefLikeAttribute": + return true; + // Attributes related to `fixed` keyword used to declare fixed length arrays + case "System.Runtime.CompilerServices.FixedBufferAttribute": + return true; + case "System.Runtime.InteropServices.InterfaceTypeAttribute": + case "System.Runtime.InteropServices.GuidAttribute": + case "System.Runtime.CompilerServices.InternalsVisibleToAttribute": + return true; + } + + if (!Annotations.IsMarked (attr_type.Resolve ())) + return false; + } + + return true; + } + + protected virtual bool ShouldMarkTypeStaticConstructor (TypeDefinition type) + { + if (Annotations.HasPreservedStaticCtor (type)) + return false; + + if (type.IsBeforeFieldInit && _context.IsOptimizationEnabled (CodeOptimizations.BeforeFieldInit)) + return false; + + return true; + } + + protected void MarkStaticConstructor (TypeDefinition type) + { + if (MarkMethodIf (type.Methods, IsNonEmptyStaticConstructor) is not null) + Annotations.SetPreservedStaticCtor (type); + } + + protected virtual bool ShouldMarkTopLevelCustomAttribute (AttributeProviderPair app, MethodDefinition resolvedConstructor) + { + var ca = app.Attribute; + + if (!ShouldMarkCustomAttribute (app.Attribute, app.Provider)) + return false; + + // If an attribute's module has not been marked after processing all types in all assemblies and the attribute itself has not been marked, + // then surely nothing is using this attribute and there is no need to mark it + if (!Annotations.IsMarked (resolvedConstructor.Module) && + !Annotations.IsMarked (ca.AttributeType) && + Annotations.GetAction (resolvedConstructor.Module.Assembly) == AssemblyAction.Link) + return false; + + if (ca.Constructor.DeclaringType.Namespace == "System.Diagnostics") { + string attributeName = ca.Constructor.DeclaringType.Name; + if (attributeName == "DebuggerDisplayAttribute" || attributeName == "DebuggerTypeProxyAttribute") { + var displayTargetType = GetDebuggerAttributeTargetType (app.Attribute, (AssemblyDefinition) app.Provider); + if (displayTargetType is null || !Annotations.IsMarked (displayTargetType)) + return false; + } + } + + return true; + } + + protected void MarkSecurityDeclarations (ISecurityDeclarationProvider provider) + { + // most security declarations are removed (if linked) but user code might still have some + // and if the attributes references types then they need to be marked too + if ((provider is null) || !provider.HasSecurityDeclarations) + return; + + foreach (var sd in provider.SecurityDeclarations) + MarkSecurityDeclaration (sd); + } + + protected virtual void MarkSecurityDeclaration (SecurityDeclaration sd) + { + if (!sd.HasSecurityAttributes) + return; + + foreach (var sa in sd.SecurityAttributes) + MarkSecurityAttribute (sa); + } + + protected virtual void MarkSecurityAttribute (SecurityAttribute sa) + { + TypeReference security_type = sa.AttributeType; + TypeDefinition type = security_type.Resolve (); + if (type is null) { + HandleUnresolvedType (security_type); + return; + } + + MarkType (security_type); + MarkSecurityAttributeProperties (sa, type); + MarkSecurityAttributeFields (sa, type); + } + + protected void MarkSecurityAttributeProperties (SecurityAttribute sa, TypeDefinition attribute) + { + if (!sa.HasProperties) + return; + + foreach (var named_argument in sa.Properties) + MarkCustomAttributeProperty (named_argument, attribute); + } + + protected void MarkSecurityAttributeFields (SecurityAttribute sa, TypeDefinition attribute) + { + if (!sa.HasFields) + return; + + foreach (var named_argument in sa.Fields) + MarkCustomAttributeField (named_argument, attribute); + } + + protected void MarkCustomAttributeProperties (CustomAttribute ca, TypeDefinition attribute) + { + if (!ca.HasProperties) + return; + + foreach (var named_argument in ca.Properties) + MarkCustomAttributeProperty (named_argument, attribute); + } + + protected void MarkCustomAttributeProperty (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute) + { + PropertyDefinition property = GetProperty (attribute, namedArgument.Name); + Tracer.Push (property); + if (property is not null) + MarkMethod (property.SetMethod); + + MarkCustomAttributeArgument (namedArgument.Argument); + Tracer.Pop (); + } + + PropertyDefinition GetProperty (TypeDefinition type, string propertyname) + { + while (type is not null) { + PropertyDefinition property = type.Properties.FirstOrDefault (p => p.Name == propertyname); + if (property is not null) + return property; + + type = type.BaseType?.Resolve (); + } + + return null; + } + + protected void MarkCustomAttributeFields (CustomAttribute ca, TypeDefinition attribute) + { + if (!ca.HasFields) + return; + + foreach (var named_argument in ca.Fields) + MarkCustomAttributeField (named_argument, attribute); + } + + protected void MarkCustomAttributeField (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute) + { + FieldDefinition field = GetField (attribute, namedArgument.Name); + if (field is not null) + MarkField (field); + + MarkCustomAttributeArgument (namedArgument.Argument); + } + + FieldDefinition GetField (TypeDefinition type, string fieldname) + { + while (type is not null) { + FieldDefinition field = type.Fields.FirstOrDefault (f => f.Name == fieldname); + if (field is not null) + return field; + + type = type.BaseType?.Resolve (); + } + + return null; + } + + MethodDefinition GetMethodWithNoParameters (TypeDefinition type, string methodname) + { + while (type is not null) { + MethodDefinition method = type.Methods.FirstOrDefault (m => m.Name == methodname && !m.HasParameters); + if (method is not null) + return method; + + type = type.BaseType.Resolve (); + } + + return null; + } + + void MarkCustomAttributeArguments (CustomAttribute ca) + { + if (!ca.HasConstructorArguments) + return; + + foreach (var argument in ca.ConstructorArguments) + MarkCustomAttributeArgument (argument); + } + + void MarkCustomAttributeArgument (CustomAttributeArgument argument) + { + var at = argument.Type; + + if (at.IsArray) { + var et = at.GetElementType (); + + MarkType (et); + if (argument.Value is null) + return; + + foreach (var caa in (CustomAttributeArgument []) argument.Value) + MarkCustomAttributeArgument (caa); + + return; + } + + if (at.Namespace == "System") { + switch (at.Name) { + case "Type": + MarkType (argument.Type); + MarkType ((TypeReference) argument.Value); + return; + + case "Object": + var boxed_value = (CustomAttributeArgument) argument.Value; + MarkType (boxed_value.Type); + MarkCustomAttributeArgument (boxed_value); + return; + } + } + } + + protected bool CheckProcessed (IMetadataTokenProvider provider) + { + if (Annotations.IsProcessed (provider)) + return true; + + Annotations.Processed (provider); + return false; + } + + protected void MarkAssembly (AssemblyDefinition assembly) + { + if (CheckProcessed (assembly)) + return; + + ProcessModule (assembly); + + MarkAssemblyCustomAttributes (assembly); + + MarkSecurityDeclarations (assembly); + + foreach (ModuleDefinition module in assembly.Modules) + LazyMarkCustomAttributes (module, assembly); + } + + void MarkEntireAssembly (AssemblyDefinition assembly) + { + MarkCustomAttributes (assembly); + MarkCustomAttributes (assembly.MainModule); + + if (assembly.MainModule.HasExportedTypes) { + // TODO: This needs more work accross all steps + } + + foreach (TypeDefinition type in assembly.MainModule.Types) + MarkEntireType (type); + } + + void ProcessModule (AssemblyDefinition assembly) + { + // Pre-mark if there is any methods as they need to be executed + // at assembly load time + foreach (TypeDefinition type in assembly.MainModule.Types) { + if (type.Name == "" && type.HasMethods) { + MarkType (type); + break; + } + } + } + + bool ProcessLazyAttributes () + { + if (Annotations.HasMarkedAnyIndirectlyCalledMethods () && MarkDisablePrivateReflectionAttribute ()) + return true; + + var startingQueueCount = _assemblyLevelAttributes.Count; + if (startingQueueCount == 0) + return false; + + var skippedItems = new List (); + var markOccurred = false; + + while (_assemblyLevelAttributes.Count != 0) { + var assemblyLevelAttribute = _assemblyLevelAttributes.Dequeue (); + var customAttribute = assemblyLevelAttribute.Attribute; + + var resolved = customAttribute.Constructor.Resolve (); + if (resolved is null) { + HandleUnresolvedMethod (customAttribute.Constructor); + continue; + } + + if (!ShouldMarkTopLevelCustomAttribute (assemblyLevelAttribute, resolved)) { + skippedItems.Add (assemblyLevelAttribute); + continue; + } + + string attributeFullName = customAttribute.Constructor.DeclaringType.FullName; + switch (attributeFullName) { + case "System.Diagnostics.DebuggerDisplayAttribute": + MarkTypeWithDebuggerDisplayAttribute (GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider), customAttribute); + break; + case "System.Diagnostics.DebuggerTypeProxyAttribute": + MarkTypeWithDebuggerTypeProxyAttribute (GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider), customAttribute); + break; + } + + markOccurred = true; + MarkCustomAttribute (customAttribute); + } + + // requeue the items we skipped in case we need to make another pass + foreach (var item in skippedItems) + _assemblyLevelAttributes.Enqueue (item); + + return markOccurred; + } + + bool ProcessLateMarkedAttributes () + { + var startingQueueCount = _lateMarkedAttributes.Count; + if (startingQueueCount == 0) + return false; + + var skippedItems = new List (); + var markOccurred = false; + + while (_lateMarkedAttributes.Count != 0) { + var attributeProviderPair = _lateMarkedAttributes.Dequeue (); + var customAttribute = attributeProviderPair.Attribute; + + var resolved = customAttribute.Constructor.Resolve (); + if (resolved is null) { + HandleUnresolvedMethod (customAttribute.Constructor); + continue; + } + + if (!ShouldMarkCustomAttribute (customAttribute, attributeProviderPair.Provider)) { + skippedItems.Add (attributeProviderPair); + continue; + } + + markOccurred = true; + MarkCustomAttribute (customAttribute); + MarkSpecialCustomAttributeDependencies (customAttribute); + } + + // requeue the items we skipped in case we need to make another pass + foreach (var item in skippedItems) + _lateMarkedAttributes.Enqueue (item); + + return markOccurred; + } + + protected void MarkField (FieldReference reference) + { + if (reference.DeclaringType is GenericInstanceType) + MarkType (reference.DeclaringType); + + FieldDefinition field = reference.Resolve (); + + if (field is null) { + HandleUnresolvedField (reference); + return; + } + + MarkField (field); + } + + void MarkField (FieldDefinition field) + { + if (CheckProcessed (field)) + return; + + MarkType (field.DeclaringType); + MarkType (field.FieldType); + MarkCustomAttributes (field); + MarkMarshalSpec (field); + DoAdditionalFieldProcessing (field); + + var parent = field.DeclaringType; + if (!Annotations.HasPreservedStaticCtor (parent)) + MarkStaticConstructor (parent); + + if (Annotations.HasSubstitutedInit (field)) { + Annotations.SetPreservedStaticCtor (parent); + Annotations.SetSubstitutedInit (parent); + } + + Annotations.Mark (field); + } + + protected virtual bool IgnoreScope (IMetadataScope scope) + { + AssemblyDefinition assembly = ResolveAssembly (scope); + return Annotations.GetAction (assembly) != AssemblyAction.Link; + } + + void MarkScope (IMetadataScope scope) + { + if (scope is IMetadataTokenProvider provider) + Annotations.Mark (provider); + } + + protected virtual void MarkSerializable (TypeDefinition type) + { + MarkDefaultConstructor (type); + MarkMethodsIf (type.Methods, IsSpecialSerializationConstructor); + } + + protected virtual TypeDefinition MarkType (TypeReference reference) + { + if (reference is null) + return null; + + reference = GetOriginalType (reference); + + if (reference is FunctionPointerType) + return null; + + if (reference is GenericParameter) + return null; + + // if (IgnoreScope (reference.Scope)) + // return null; + + TypeDefinition type = reference.Resolve (); + + if (type is null) { + HandleUnresolvedType (reference); + return null; + } + + if (CheckProcessed (type)) + return null; + + Tracer.Push (type); + + MarkScope (type.Scope); + MarkType (type.BaseType); + MarkType (type.DeclaringType); + MarkCustomAttributes (type); + MarkSecurityDeclarations (type); + + if (type.IsMulticastDelegate ()) { + MarkMulticastDelegate (type); + } + + if (type.IsSerializable ()) + MarkSerializable (type); + + if (!_context.IsFeatureExcluded ("etw") && BCL.EventTracingForWindows.IsEventSourceImplementation (type, _context)) { + MarkEventSourceProviders (type); + } + + MarkTypeSpecialCustomAttributes (type); + + MarkGenericParameterProvider (type); + + // keep fields for value-types and for classes with LayoutKind.Sequential or Explicit + if (type.IsValueType || !type.IsAutoLayout) + MarkFields (type, type.IsEnum); + + // There are a number of markings we can defer until later when we know it's possible a reference type could be instantiated + // For example, if no instance of a type exist, then we don't need to mark the interfaces on that type + // However, for some other types there is no benefit to deferring + if (type.IsInterface) { + // There's no benefit to deferring processing of an interface type until we know a type implementing that interface is marked + MarkRequirementsForInstantiatedTypes (type); + } else if (type.IsValueType) { + // Note : Technically interfaces could be removed from value types in some of the same cases as reference types, however, it's harder to know when + // a value type instance could exist. You'd have to track initobj and maybe locals types. Going to punt for now. + MarkRequirementsForInstantiatedTypes (type); + } else if (IsFullyPreserved (type)) { + // Here for a couple reasons: + // * Edge case to cover a scenario where a type has preserve all, implements interfaces, but does not have any instance ctors. + // Normally TypePreserve.All would cause an instance ctor to be marked and that would in turn lead to MarkInterfaceImplementations being called + // Without an instance ctor, MarkInterfaceImplementations is not called and then TypePreserve.All isn't truly respected. + // * If an assembly has the action Copy and had ResolveFromAssemblyStep ran for the assembly, then InitializeType will have led us here + // When the entire assembly is preserved, then all interfaces, base, etc will be preserved on the type, so we need to make sure + // all of these types are marked. For example, if an interface implementation is of a type in another assembly that is linked, + // and there are no other usages of that interface type, then we need to make sure the interface type is still marked because + // this type is going to retain the interface implementation + MarkRequirementsForInstantiatedTypes (type); + } else if (AlwaysMarkTypeAsInstantiated (type)) { + MarkRequirementsForInstantiatedTypes (type); + } + + if (type.HasInterfaces) + _typesWithInterfaces.Add (type); + + if (type.HasMethods) { + MarkMethodsIf (type.Methods, IsVirtualNeededByTypeDueToPreservedScope); + if (ShouldMarkTypeStaticConstructor (type)) + MarkStaticConstructor (type); + + MarkMethodsIf (type.Methods, HasSerializationAttribute); + } + + DoAdditionalTypeProcessing (type); + + Tracer.Pop (); + + Annotations.Mark (type); + + ApplyPreserveInfo (type); + + return type; + } + + // Allow subclassers to mark additional things in the main processing loop + protected virtual void DoAdditionalProcessing () + { + } + + // Allow subclassers to mark additional things + protected virtual void DoAdditionalTypeProcessing (TypeDefinition type) + { + } + + // Allow subclassers to mark additional things + protected virtual void DoAdditionalFieldProcessing (FieldDefinition field) + { + } + + // Allow subclassers to mark additional things + protected virtual void DoAdditionalPropertyProcessing (PropertyDefinition property) + { + } + + // Allow subclassers to mark additional things + protected virtual void DoAdditionalEventProcessing (EventDefinition evt) + { + } + + // Allow subclassers to mark additional things + protected virtual void DoAdditionalInstantiatedTypeProcessing (TypeDefinition type) + { + } + + void MarkAssemblyCustomAttributes (AssemblyDefinition assembly) + { + if (!assembly.HasCustomAttributes) + return; + + foreach (CustomAttribute attribute in assembly.CustomAttributes) + _assemblyLevelAttributes.Enqueue (new AttributeProviderPair (attribute, assembly)); + } + + TypeDefinition GetDebuggerAttributeTargetType (CustomAttribute ca, AssemblyDefinition asm) + { + TypeReference targetTypeReference = null; + foreach (var property in ca.Properties) { + if (property.Name == "Target") { + targetTypeReference = (TypeReference) property.Argument.Value; + break; + } + + if (property.Name == "TargetTypeName") { + if (TypeNameParser.TryParseTypeAssemblyQualifiedName ((string) property.Argument.Value, out string typeName, out string assemblyName)) { + if (string.IsNullOrEmpty (assemblyName)) + targetTypeReference = asm.MainModule.GetType (typeName); + else + targetTypeReference = _context.GetAssemblies ().FirstOrDefault (a => a.Name.Name == assemblyName)?.MainModule.GetType (typeName); + } + break; + } + } + + return targetTypeReference?.Resolve (); + } + + void MarkTypeSpecialCustomAttributes (TypeDefinition type) + { + if (!type.HasCustomAttributes) + return; + + foreach (CustomAttribute attribute in type.CustomAttributes) { + var attrType = attribute.Constructor.DeclaringType; + switch (attrType.Name) { + case "XmlSchemaProviderAttribute" when attrType.Namespace == "System.Xml.Serialization": + MarkXmlSchemaProvider (type, attribute); + break; + case "DebuggerDisplayAttribute" when attrType.Namespace == "System.Diagnostics": + MarkTypeWithDebuggerDisplayAttribute (type, attribute); + break; + case "DebuggerTypeProxyAttribute" when attrType.Namespace == "System.Diagnostics": + MarkTypeWithDebuggerTypeProxyAttribute (type, attribute); + break; + case "EventDataAttribute" when attrType.Namespace == "System.Diagnostics.Tracing": + MarkMethodsIf (type.Methods, MethodDefinitionExtensions.IsPublicInstancePropertyMethod); + break; + case "TypeDescriptionProviderAttribute" when attrType.Namespace == "System.ComponentModel": + MarkTypeConverterLikeDependency (attribute, l => l.IsDefaultConstructor ()); + break; + } + } + } + + // + // Used for known framework attributes which can be applied to any element + // + bool MarkSpecialCustomAttributeDependencies (CustomAttribute ca) + { + var dt = ca.Constructor.DeclaringType; + if (dt.Name == "TypeConverterAttribute" && dt.Namespace == "System.ComponentModel") { + MarkTypeConverterLikeDependency (ca, l => + l.IsDefaultConstructor () || + l.Parameters.Count == 1 && l.Parameters [0].ParameterType.IsTypeOf ("System", "Type")); + return true; + } + + return false; + } + + void MarkMethodSpecialCustomAttributes (MethodDefinition method) + { + if (!method.HasCustomAttributes) + return; + + foreach (CustomAttribute attribute in method.CustomAttributes) { + switch (attribute.Constructor.DeclaringType.FullName) { + case "System.Web.Services.Protocols.SoapHeaderAttribute": + MarkSoapHeader (method, attribute); + break; + } + } + } + + void MarkXmlSchemaProvider (TypeDefinition type, CustomAttribute attribute) + { + if (TryGetStringArgument (attribute, out string name)) + MarkNamedMethod (type, name); + } + + protected virtual void MarkTypeConverterLikeDependency (CustomAttribute attribute, Func predicate) + { + var args = attribute.ConstructorArguments; + if (args.Count < 1) + return; + + TypeDefinition tdef = null; + switch (attribute.ConstructorArguments [0].Value) { + case string s: + tdef = ResolveFullyQualifiedTypeName (s); + break; + case TypeReference type: + tdef = type.Resolve (); + break; + } + + if (tdef is null) + return; + + MarkMethodsIf (tdef.Methods, predicate); + } + + void MarkTypeWithDebuggerDisplayAttribute (TypeDefinition type, CustomAttribute attribute) + { + if (_context.KeepMembersForDebugger) { + + string displayString = (string) attribute.ConstructorArguments [0].Value; + + Regex regex = new Regex ("{[^{}]+}", RegexOptions.Compiled); + + foreach (Match match in regex.Matches (displayString)) { + // Remove '{' and '}' + string realMatch = match.Value.Substring (1, match.Value.Length - 2); + + // Remove ",nq" suffix if present + // (it asks the expression evaluator to remove the quotes when displaying the final value) + if (Regex.IsMatch (realMatch, @".+,\s*nq")) { + realMatch = realMatch.Substring (0, realMatch.LastIndexOf (',')); + } + + if (realMatch.EndsWith ("()")) { + string methodName = realMatch.Substring (0, realMatch.Length - 2); + MethodDefinition method = GetMethodWithNoParameters (type, methodName); + if (method is not null) { + MarkMethod (method); + continue; + } + } else { + FieldDefinition field = GetField (type, realMatch); + if (field is not null) { + MarkField (field); + continue; + } + + PropertyDefinition property = GetProperty (type, realMatch); + if (property is not null) { + if (property.GetMethod is not null) { + MarkMethod (property.GetMethod); + } + if (property.SetMethod is not null) { + MarkMethod (property.SetMethod); + } + continue; + } + } + + while (type is not null) { + MarkMethods (type); + MarkFields (type, includeStatic: true); + type = type.BaseType?.Resolve (); + } + return; + } + } + } + + void MarkTypeWithDebuggerTypeProxyAttribute (TypeDefinition type, CustomAttribute attribute) + { + if (_context.KeepMembersForDebugger) { + object constructorArgument = attribute.ConstructorArguments [0].Value; + TypeReference proxyTypeReference = constructorArgument as TypeReference; + if (proxyTypeReference is null) { + if (constructorArgument is string proxyTypeReferenceString) { + proxyTypeReference = type.Module.GetType (proxyTypeReferenceString, runtimeName: true); + } + } + + if (proxyTypeReference is null) { + return; + } + + MarkType (proxyTypeReference); + + TypeDefinition proxyType = proxyTypeReference.Resolve (); + if (proxyType is not null) { + MarkMethods (proxyType); + MarkFields (proxyType, includeStatic: true); + } + } + } + + static bool TryGetStringArgument (CustomAttribute attribute, out string argument) + { + argument = null; + + if (attribute.ConstructorArguments.Count < 1) + return false; + + argument = attribute.ConstructorArguments [0].Value as string; + + return argument is not null; + } + + protected int MarkNamedMethod (TypeDefinition type, string method_name) + { + if (!type.HasMethods) + return 0; + + int count = 0; + foreach (MethodDefinition method in type.Methods) { + if (method.Name != method_name) + continue; + + MarkMethod (method); + count++; + } + + return count; + } + + void MarkSoapHeader (MethodDefinition method, CustomAttribute attribute) + { + if (!TryGetStringArgument (attribute, out string member_name)) + return; + + MarkNamedField (method.DeclaringType, member_name); + MarkNamedProperty (method.DeclaringType, member_name); + } + + void MarkNamedField (TypeDefinition type, string field_name) + { + if (!type.HasFields) + return; + + foreach (FieldDefinition field in type.Fields) { + if (field.Name != field_name) + continue; + + MarkField (field); + } + } + + void MarkNamedProperty (TypeDefinition type, string property_name) + { + if (!type.HasProperties) + return; + + foreach (PropertyDefinition property in type.Properties) { + if (property.Name != property_name) + continue; + + Tracer.Push (property); + MarkMethod (property.GetMethod); + MarkMethod (property.SetMethod); + Tracer.Pop (); + } + } + + void MarkInterfaceImplementations (TypeDefinition type) + { + if (!type.HasInterfaces) + return; + + foreach (var iface in type.Interfaces) { + // Only mark interface implementations of interface types that have been marked. + // This enables stripping of interfaces that are never used + var resolvedInterfaceType = iface.InterfaceType.Resolve (); + if (resolvedInterfaceType is null) { + HandleUnresolvedType (iface.InterfaceType); + continue; + } + + if (ShouldMarkInterfaceImplementation (type, iface, resolvedInterfaceType)) + MarkInterfaceImplementation (iface); + } + } + + void MarkGenericParameterProvider (IGenericParameterProvider provider) + { + if (!provider.HasGenericParameters) + return; + + foreach (GenericParameter parameter in provider.GenericParameters) + MarkGenericParameter (parameter); + } + + void MarkGenericParameter (GenericParameter parameter) + { + MarkCustomAttributes (parameter); + if (!parameter.HasConstraints) + return; + + foreach (var constraint in parameter.Constraints) { + MarkCustomAttributes (constraint); + MarkType (constraint.ConstraintType); + } + } + + bool IsVirtualNeededByTypeDueToPreservedScope (MethodDefinition method) + { + if (!method.IsVirtual) + return false; + + var base_list = Annotations.GetBaseMethods (method); + if (base_list is null) + return false; + + foreach (MethodDefinition @base in base_list) { + // Just because the type is marked does not mean we need interface methods. + // if the type is never instantiated, interfaces will be removed + if (@base.DeclaringType.IsInterface) + continue; + + // If the type is marked, we need to keep overrides of abstract members defined in assemblies + // that are copied. However, if the base method is virtual, then we don't need to keep the override + // until the type could be instantiated + if (!@base.IsAbstract) + continue; + + if (IgnoreScope (@base.DeclaringType.Scope)) + return true; + + if (IsVirtualNeededByTypeDueToPreservedScope (@base)) + return true; + } + + return false; + } + + bool IsVirtualNeededByInstantiatedTypeDueToPreservedScope (MethodDefinition method) + { + if (!method.IsVirtual) + return false; + + var base_list = Annotations.GetBaseMethods (method); + if (base_list is null) + return false; + + foreach (MethodDefinition @base in base_list) { + if (IgnoreScope (@base.DeclaringType.Scope)) + return true; + + if (IsVirtualNeededByTypeDueToPreservedScope (@base)) + return true; + } + + return false; + } + + static bool IsSpecialSerializationConstructor (MethodDefinition method) + { + if (!method.IsInstanceConstructor ()) + return false; + + var parameters = method.Parameters; + if (parameters.Count != 2) + return false; + + return parameters [0].ParameterType.Name == "SerializationInfo" && + parameters [1].ParameterType.Name == "StreamingContext"; + } + + protected void MarkMethodsIf (Collection methods, Func predicate) + { + foreach (MethodDefinition method in methods) + if (predicate (method)) + MarkMethod (method); + } + + protected MethodDefinition MarkMethodIf (Collection methods, Func predicate) + { + foreach (MethodDefinition method in methods) { + if (predicate (method)) { + return MarkMethod (method); + } + } + + return null; + } + + protected bool MarkDefaultConstructor (TypeDefinition type) + { + if (type?.HasMethods != true) + return false; + + return MarkMethodIf (type.Methods, MethodDefinitionExtensions.IsDefaultConstructor) is not null; + } + + static bool IsNonEmptyStaticConstructor (MethodDefinition method) + { + if (!method.IsStaticConstructor ()) + return false; + + if (!method.HasBody || !method.IsIL) + return true; + + if (method.Body.CodeSize != 1) + return true; + + return method.Body.Instructions [0].OpCode.Code != Code.Ret; + } + + static bool HasSerializationAttribute (MethodDefinition method) + { + if (!method.HasCustomAttributes) + return false; + foreach (var ca in method.CustomAttributes) { + var cat = ca.AttributeType; + if (cat.Namespace != "System.Runtime.Serialization") + continue; + switch (cat.Name) { + case "OnDeserializedAttribute": + case "OnDeserializingAttribute": + case "OnSerializedAttribute": + case "OnSerializingAttribute": + return true; + } + } + return false; + } + + protected virtual bool AlwaysMarkTypeAsInstantiated (TypeDefinition td) + { + switch (td.Name) { + // These types are created from native code which means we are unable to track when they are instantiated + // Since these are such foundational types, let's take the easy route and just always assume an instance of one of these + // could exist + case "Delegate": + case "MulticastDelegate": + case "ValueType": + case "Enum": + return td.Namespace == "System"; + } + + return false; + } + + void MarkEventSourceProviders (TypeDefinition td) + { + foreach (var nestedType in td.NestedTypes) { + if (BCL.EventTracingForWindows.IsProviderName (nestedType.Name)) + MarkStaticFields (nestedType); + } + } + + protected virtual void MarkMulticastDelegate (TypeDefinition type) + { + MarkMethodCollection (type.Methods); + } + + TypeDefinition ResolveFullyQualifiedTypeName (string name) + { + if (!TypeNameParser.TryParseTypeAssemblyQualifiedName (name, out string typeName, out string assemblyName)) + return null; + + foreach (var assemblyDefinition in _context.GetAssemblies ()) { + if (assemblyName is not null && assemblyDefinition.Name.Name != assemblyName) + continue; + + var foundType = assemblyDefinition.MainModule.GetType (typeName); + if (foundType is null) + continue; + + return foundType; + } + + return null; + } + + protected TypeReference GetOriginalType (TypeReference type) + { + while (type is TypeSpecification) { + if (type is GenericInstanceType git) + MarkGenericArguments (git); + + if (type is IModifierType mod) + MarkModifierType (mod); + + if (type is FunctionPointerType fnptr) { + MarkParameters (fnptr); + MarkType (fnptr.ReturnType); + break; // FunctionPointerType is the original type + } + + type = ((TypeSpecification) type).ElementType; + } + + return type; + } + + void MarkParameters (FunctionPointerType fnptr) + { + if (!fnptr.HasParameters) + return; + + for (int i = 0; i < fnptr.Parameters.Count; i++) { + MarkType (fnptr.Parameters [i].ParameterType); + } + } + + void MarkModifierType (IModifierType mod) + { + MarkType (mod.ModifierType); + } + + void MarkGenericArguments (IGenericInstance instance) + { + foreach (TypeReference argument in instance.GenericArguments) + MarkType (argument); + + MarkGenericArgumentConstructors (instance); + } + + void MarkGenericArgumentConstructors (IGenericInstance instance) + { + var arguments = instance.GenericArguments; + + var generic_element = GetGenericProviderFromInstance (instance); + if (generic_element is null) + return; + + var parameters = generic_element.GenericParameters; + + if (arguments.Count != parameters.Count) + return; + + for (int i = 0; i < arguments.Count; i++) { + var argument = arguments [i]; + var parameter = parameters [i]; + + if (!parameter.HasDefaultConstructorConstraint) + continue; + + var argument_definition = argument.Resolve (); + MarkDefaultConstructor (argument_definition); + } + } + + static IGenericParameterProvider GetGenericProviderFromInstance (IGenericInstance instance) + { + if (instance is GenericInstanceMethod method) + return method.ElementMethod.Resolve (); + + if (instance is GenericInstanceType type) + return type.ElementType.Resolve (); + + return null; + } + + void ApplyPreserveInfo (TypeDefinition type) + { + ApplyPreserveMethods (type); + + if (!Annotations.TryGetPreserve (type, out TypePreserve preserve)) + return; + + switch (preserve) { + case TypePreserve.All: + MarkFields (type, true); + MarkMethods (type); + break; + case TypePreserve.Fields: + if (!MarkFields (type, true, true)) + _context.LogMessage ($"Type {type.FullName} has no fields to preserve"); + break; + case TypePreserve.Methods: + if (!MarkMethods (type)) + _context.LogMessage ($"Type {type.FullName} has no methods to preserve"); + break; + } + } + + void ApplyPreserveMethods (TypeDefinition type) + { + var list = Annotations.GetPreservedMethods (type); + if (list is null) + return; + + MarkMethodCollection (list); + } + + void ApplyPreserveMethods (MethodDefinition method) + { + var list = Annotations.GetPreservedMethods (method); + if (list is null) + return; + + MarkMethodCollection (list); + } + + protected bool MarkFields (TypeDefinition type, bool includeStatic, bool markBackingFieldsOnlyIfPropertyMarked = false) + { + if (!type.HasFields) + return false; + + foreach (FieldDefinition field in type.Fields) { + if (!includeStatic && field.IsStatic) + continue; + + if (markBackingFieldsOnlyIfPropertyMarked && field.Name.EndsWith (">k__BackingField", StringComparison.Ordinal)) { + // We can't reliably construct the expected property name from the backing field name for all compilers + // because csc shortens the name of the backing field in some cases + // For example: + // Field Name = .Bar>k__BackingField + // Property Name = IFoo.Bar + // + // instead we will search the properties and find the one that makes use of the current backing field + var propertyDefinition = SearchPropertiesForMatchingFieldDefinition (field); + if (propertyDefinition is not null && !Annotations.IsMarked (propertyDefinition)) + continue; + } + MarkField (field); + } + + return true; + } + + static PropertyDefinition SearchPropertiesForMatchingFieldDefinition (FieldDefinition field) + { + foreach (var property in field.DeclaringType.Properties) { + var instr = property.GetMethod?.Body?.Instructions; + if (instr is null) + continue; + + foreach (var ins in instr) { + if (ins?.Operand == field) + return property; + } + } + + return null; + } + + protected void MarkStaticFields (TypeDefinition type) + { + if (!type.HasFields) + return; + + foreach (FieldDefinition field in type.Fields) { + if (field.IsStatic) + MarkField (field); + } + } + + protected virtual bool MarkMethods (TypeDefinition type) + { + if (!type.HasMethods) + return false; + + MarkMethodCollection (type.Methods); + return true; + } + + void MarkMethodCollection (IList methods) + { + foreach (MethodDefinition method in methods) + MarkMethod (method); + } + + protected void MarkIndirectlyCalledMethod (MethodDefinition method) + { + MarkMethod (method); + Annotations.MarkIndirectlyCalledMethod (method); + } + + protected virtual MethodDefinition MarkMethod (MethodReference reference) + { + reference = GetOriginalMethod (reference); + + if (reference.DeclaringType is ArrayType) + return null; + + Tracer.Push (reference); + if (reference.DeclaringType is GenericInstanceType) + MarkType (reference.DeclaringType); + + // if (IgnoreScope (reference.DeclaringType.Scope)) + // return; + + MethodDefinition method = reference.Resolve (); + + try { + if (method is null) { + HandleUnresolvedMethod (reference); + return null; + } + + if (Annotations.GetAction (method) == MethodAction.Nothing) + Annotations.SetAction (method, MethodAction.Parse); + + EnqueueMethod (method); + } finally { + Tracer.Pop (); + } + Tracer.AddDependency (method); + + return method; + } + + AssemblyDefinition ResolveAssembly (IMetadataScope scope) + { + AssemblyDefinition assembly = _context.Resolve (scope); + MarkAssembly (assembly); + return assembly; + } + + protected MethodReference GetOriginalMethod (MethodReference method) + { + while (method is MethodSpecification) { + if (method is GenericInstanceMethod gim) + MarkGenericArguments (gim); + + method = ((MethodSpecification) method).ElementMethod; + } + + return method; + } + + protected virtual void ProcessMethod (MethodDefinition method) + { + if (CheckProcessed (method)) + return; + + Tracer.Push (method); + MarkType (method.DeclaringType); + MarkCustomAttributes (method); + MarkSecurityDeclarations (method); + + MarkGenericParameterProvider (method); + + if (ShouldMarkAsInstancePossible (method)) + MarkRequirementsForInstantiatedTypes (method.DeclaringType); + + if (method.IsConstructor) { + if (!Annotations.ProcessSatelliteAssemblies && KnownMembers.IsSatelliteAssemblyMarker (method)) + Annotations.ProcessSatelliteAssemblies = true; + } else if (method.IsPropertyMethod ()) + MarkProperty (method.GetProperty ()); + else if (method.IsEventMethod ()) + MarkEvent (method.GetEvent ()); + + if (method.HasParameters) { + foreach (ParameterDefinition pd in method.Parameters) { + MarkType (pd.ParameterType); + MarkCustomAttributes (pd); + MarkMarshalSpec (pd); + } + } + + if (method.HasOverrides) { + foreach (MethodReference ov in method.Overrides) { + MarkMethod (ov); + MarkExplicitInterfaceImplementation (method, ov); + } + } + + MarkMethodSpecialCustomAttributes (method); + + if (method.IsVirtual) + _virtual_methods.Add (method); + + MarkNewCodeDependencies (method); + + MarkBaseMethods (method); + + MarkType (method.ReturnType); + MarkCustomAttributes (method.MethodReturnType); + MarkMarshalSpec (method.MethodReturnType); + + if (method.IsPInvokeImpl || method.IsInternalCall) { + ProcessInteropMethod (method); + } + + if (ShouldParseMethodBody (method)) + MarkMethodBody (method.Body); + + DoAdditionalMethodProcessing (method); + + Annotations.Mark (method); + + ApplyPreserveMethods (method); + Tracer.Pop (); + } + + // Allow subclassers to mark additional things when marking a method + protected virtual void DoAdditionalMethodProcessing (MethodDefinition method) + { + } + + protected virtual bool ShouldMarkAsInstancePossible (MethodDefinition method) + { + // We don't need to mark it multiple times + if (Annotations.IsInstantiated (method.DeclaringType)) + return false; + + if (method.IsInstanceConstructor ()) + return true; + + if (method.DeclaringType.IsInterface) + return true; + + return false; + } + + protected virtual void MarkRequirementsForInstantiatedTypes (TypeDefinition type) + { + if (Annotations.IsInstantiated (type)) + return; + + Annotations.MarkInstantiated (type); + + MarkInterfaceImplementations (type); + + foreach (var method in GetRequiredMethodsForInstantiatedType (type)) + MarkMethod (method); + + DoAdditionalInstantiatedTypeProcessing (type); + } + + /// + /// Collect methods that must be marked once a type is determined to be instantiated. + /// + /// This method is virtual in order to give derived mark steps an opportunity to modify the collection of methods that are needed + /// + /// + /// + protected virtual IEnumerable GetRequiredMethodsForInstantiatedType (TypeDefinition type) + { + foreach (var method in type.Methods) { + if (method.IsFinalizer () || IsVirtualNeededByInstantiatedTypeDueToPreservedScope (method)) + yield return method; + } + } + + void MarkExplicitInterfaceImplementation (MethodDefinition method, MethodReference ov) + { + var resolvedOverride = ov.Resolve (); + + if (resolvedOverride is null) { + HandleUnresolvedMethod (ov); + return; + } + + if (resolvedOverride.DeclaringType.IsInterface) { + foreach (var ifaceImpl in method.DeclaringType.Interfaces) { + var resolvedInterfaceType = ifaceImpl.InterfaceType.Resolve (); + if (resolvedInterfaceType is null) { + HandleUnresolvedType (ifaceImpl.InterfaceType); + continue; + } + + if (resolvedInterfaceType == resolvedOverride.DeclaringType) { + MarkInterfaceImplementation (ifaceImpl); + return; + } + } + } + } + + void MarkNewCodeDependencies (MethodDefinition method) + { + switch (Annotations.GetAction (method)) { + case MethodAction.ConvertToStub: + if (!method.IsInstanceConstructor ()) + return; + + var baseType = method.DeclaringType.BaseType.Resolve (); + if (!MarkDefaultConstructor (baseType)) + throw new NotSupportedException ($"Cannot stub constructor on '{method.DeclaringType}' when base type does not have default constructor"); + + break; + + case MethodAction.ConvertToThrow: + MarkAndCacheConvertToThrowExceptionCtor (); + break; + } + } + + protected virtual void MarkAndCacheConvertToThrowExceptionCtor () + { + if (_context.MarkedKnownMembers.NotSupportedExceptionCtorString is not null) + return; + + var nse = BCL.FindPredefinedType ("System", "NotSupportedException", _context); + if (nse is null) + throw new NotSupportedException ("Missing predefined 'System.NotSupportedException' type"); + + MarkType (nse); + + var nseCtor = MarkMethodIf (nse.Methods, KnownMembers.IsNotSupportedExceptionCtorString); + if (nseCtor is null) + throw new MarkException ($"Could not find constructor on '{nse.FullName}'"); + + _context.MarkedKnownMembers.NotSupportedExceptionCtorString = nseCtor; + + var objectType = BCL.FindPredefinedType ("System", "Object", _context); + if (objectType is null) + throw new NotSupportedException ("Missing predefined 'System.Object' type"); + + MarkType (objectType); + + var objectCtor = MarkMethodIf (objectType.Methods, MethodDefinitionExtensions.IsDefaultConstructor); + if (objectCtor is null) + throw new MarkException ($"Could not find constructor on '{objectType.FullName}'"); + + _context.MarkedKnownMembers.ObjectCtor = objectCtor; + } + + bool MarkDisablePrivateReflectionAttribute () + { + if (_context.MarkedKnownMembers.DisablePrivateReflectionAttributeCtor is not null) + return false; + + var nse = BCL.FindPredefinedType ("System.Runtime.CompilerServices", "DisablePrivateReflectionAttribute", _context); + if (nse is null) + throw new NotSupportedException ("Missing predefined 'System.Runtime.CompilerServices.DisablePrivateReflectionAttribute' type"); + + MarkType (nse); + + var ctor = MarkMethodIf (nse.Methods, MethodDefinitionExtensions.IsDefaultConstructor); + if (ctor is null) + throw new MarkException ($"Could not find constructor on '{nse.FullName}'"); + + _context.MarkedKnownMembers.DisablePrivateReflectionAttributeCtor = ctor; + return true; + } + + void MarkBaseMethods (MethodDefinition method) + { + var base_methods = Annotations.GetBaseMethods (method); + if (base_methods is null) + return; + + foreach (MethodDefinition base_method in base_methods) { + if (base_method.DeclaringType.IsInterface && !method.DeclaringType.IsInterface) + continue; + + MarkMethod (base_method); + MarkBaseMethods (base_method); + } + } + + void ProcessInteropMethod (MethodDefinition method) + { + TypeDefinition returnTypeDefinition = method.ReturnType.Resolve (); + + const bool includeStaticFields = false; + if (returnTypeDefinition is not null && !returnTypeDefinition.IsImport) { + MarkDefaultConstructor (returnTypeDefinition); + MarkFields (returnTypeDefinition, includeStaticFields); + } + + if (method.HasThis && !method.DeclaringType.IsImport) { + MarkFields (method.DeclaringType, includeStaticFields); + } + + foreach (ParameterDefinition pd in method.Parameters) { + TypeReference paramTypeReference = pd.ParameterType; + if (paramTypeReference is TypeSpecification) { + paramTypeReference = (paramTypeReference as TypeSpecification).ElementType; + } + TypeDefinition paramTypeDefinition = paramTypeReference.Resolve (); + if (paramTypeDefinition is not null && !paramTypeDefinition.IsImport) { + MarkFields (paramTypeDefinition, includeStaticFields); + if (pd.ParameterType.IsByReference) { + MarkDefaultConstructor (paramTypeDefinition); + } + } + } + } + + protected virtual bool ShouldParseMethodBody (MethodDefinition method) + { + if (!method.HasBody) + return false; + + switch (Annotations.GetAction (method)) { + case MethodAction.ForceParse: + return true; + case MethodAction.Parse: + AssemblyDefinition assembly = ResolveAssembly (method.DeclaringType.Scope); + switch (Annotations.GetAction (assembly)) { + case AssemblyAction.Link: + case AssemblyAction.Copy: + case AssemblyAction.CopyUsed: + case AssemblyAction.AddBypassNGen: + case AssemblyAction.AddBypassNGenUsed: + return true; + default: + return false; + } + default: + return false; + } + } + + protected void MarkProperty (PropertyDefinition prop) + { + MarkCustomAttributes (prop); + DoAdditionalPropertyProcessing (prop); + } + + protected virtual void MarkEvent (EventDefinition evt) + { + MarkCustomAttributes (evt); + MarkMethodIfNotNull (evt.AddMethod); + MarkMethodIfNotNull (evt.InvokeMethod); + MarkMethodIfNotNull (evt.RemoveMethod); + DoAdditionalEventProcessing (evt); + } + + void MarkMethodIfNotNull (MethodReference method) + { + if (method is null) + return; + + MarkMethod (method); + } + + protected virtual void MarkMethodBody (MethodBody body) + { + if (_context.IsOptimizationEnabled (CodeOptimizations.UnreachableBodies) && IsUnreachableBody (body)) { + MarkAndCacheConvertToThrowExceptionCtor (); + _unreachableBodies.Add (body); + return; + } + + foreach (VariableDefinition var in body.Variables) + MarkType (var.VariableType); + + foreach (ExceptionHandler eh in body.ExceptionHandlers) + if (eh.HandlerType == ExceptionHandlerType.Catch) + MarkType (eh.CatchType); + + foreach (Instruction instruction in body.Instructions) + MarkInstruction (instruction); + + MarkInterfacesNeededByBodyStack (body); + + MarkReflectionLikeDependencies (body); + + PostMarkMethodBody (body); + } + + bool IsUnreachableBody (MethodBody body) + { + return !body.Method.IsStatic + && !Annotations.IsInstantiated (body.Method.DeclaringType) + && MethodBodyScanner.IsWorthConvertingToThrow (body); + } + + + partial void PostMarkMethodBody (MethodBody body); + + void MarkInterfacesNeededByBodyStack (MethodBody body) + { + // If a type could be on the stack in the body and an interface it implements could be on the stack on the body + // then we need to mark that interface implementation. When this occurs it is not safe to remove the interface implementation from the type + // even if the type is never instantiated + var implementations = MethodBodyScanner.GetReferencedInterfaces (_context.Annotations, body); + if (implementations is null) + return; + + foreach (var implementation in implementations) + MarkInterfaceImplementation (implementation); + } + + protected virtual void MarkInstruction (Instruction instruction) + { + switch (instruction.OpCode.OperandType) { + case OperandType.InlineField: + MarkField ((FieldReference) instruction.Operand); + break; + case OperandType.InlineMethod: + MarkMethod ((MethodReference) instruction.Operand); + break; + case OperandType.InlineTok: + object token = instruction.Operand; + if (token is TypeReference) + MarkType ((TypeReference) token); + else if (token is MethodReference) + MarkMethod ((MethodReference) token); + else + MarkField ((FieldReference) token); + break; + case OperandType.InlineType: + MarkType ((TypeReference) instruction.Operand); + break; + default: + break; + } + } + + protected virtual void HandleUnresolvedType (TypeReference reference) + { + if (!_context.IgnoreUnresolved) { + throw new ResolutionException (reference); + } + } + + protected virtual void HandleUnresolvedMethod (MethodReference reference) + { + if (!_context.IgnoreUnresolved) { + throw new ResolutionException (reference); + } + } + + protected virtual void HandleUnresolvedField (FieldReference reference) + { + if (!_context.IgnoreUnresolved) { + throw new ResolutionException (reference); + } + } + + protected virtual bool ShouldMarkInterfaceImplementation (TypeDefinition type, InterfaceImplementation iface, TypeDefinition resolvedInterfaceType) + { + if (Annotations.IsMarked (iface)) + return false; + + if (Annotations.IsMarked (resolvedInterfaceType)) + return true; + + if (!_context.IsOptimizationEnabled (CodeOptimizations.UnusedInterfaces)) + return true; + + // It's hard to know if a com or windows runtime interface will be needed from managed code alone, + // so as a precaution we will mark these interfaces once the type is instantiated + if (resolvedInterfaceType.IsImport || resolvedInterfaceType.IsWindowsRuntime) + return true; + + return IsFullyPreserved (type); + } + + protected virtual void MarkInterfaceImplementation (InterfaceImplementation iface) + { + MarkCustomAttributes (iface); + MarkType (iface.InterfaceType); + Annotations.Mark (iface); + } + + bool HasManuallyTrackedDependency (MethodBody methodBody) + { + return PreserveDependencyLookupStep.HasPreserveDependencyAttribute (methodBody.Method); + } + + // + // Extension point for reflection logic handling customization + // + protected virtual bool ProcessReflectionDependency (MethodBody body, Instruction instruction) + { + return false; + } + + // + // Tries to mark additional dependencies used in reflection like calls (e.g. typeof (MyClass).GetField ("fname")) + // + protected virtual void MarkReflectionLikeDependencies (MethodBody body) + { + if (HasManuallyTrackedDependency (body)) + return; + + var instructions = body.Instructions; + ReflectionPatternDetector detector = new ReflectionPatternDetector (this, body.Method); + + // + // Starting at 1 because all patterns require at least 1 instruction backward lookup + // + for (var i = 1; i < instructions.Count; i++) { + var instruction = instructions [i]; + + if (instruction.OpCode != OpCodes.Call && instruction.OpCode != OpCodes.Callvirt) + continue; + + if (ProcessReflectionDependency (body, instruction)) + continue; + + if (!(instruction.Operand is MethodReference methodCalled)) + continue; + + var methodCalledDefinition = methodCalled.Resolve (); + if (methodCalledDefinition is null) + continue; + + ReflectionPatternContext reflectionContext = new ReflectionPatternContext (_context, body.Method, methodCalledDefinition, i); + try { + detector.Process (ref reflectionContext); + } finally { + reflectionContext.Dispose (); + } + } + } + + /// + /// Helper struct to pass around context information about reflection pattern + /// as a single parameter (and have a way to extend this in the future if we need to easily). + /// Also implements a simple validation mechanism to check that the code does report patter recognition + /// results for all methods it works on. + /// The promise of the pattern recorder is that for a given reflection method, it will either not talk + /// about it ever, or it will always report recognized/unrecognized. + /// + struct ReflectionPatternContext : IDisposable { + readonly LinkContext _context; +#if DEBUG + bool _patternAnalysisAttempted; + bool _patternReported; +#endif + + public MethodDefinition MethodCalling { get; private set; } + public MethodDefinition MethodCalled { get; private set; } + public int InstructionIndex { get; private set; } + + public ReflectionPatternContext (LinkContext context, MethodDefinition methodCalling, MethodDefinition methodCalled, int instructionIndex) + { + _context = context; + MethodCalling = methodCalling; + MethodCalled = methodCalled; + InstructionIndex = instructionIndex; + +#if DEBUG + _patternAnalysisAttempted = false; + _patternReported = false; +#endif + } + + [Conditional ("DEBUG")] + public void AnalyzingPattern () + { +#if DEBUG + _patternAnalysisAttempted = true; +#endif + } + + public void RecordRecognizedPattern (T accessedItem, Action mark) + where T : IMemberDefinition + { +#if DEBUG + Debug.Assert (_patternAnalysisAttempted, "To correctly report all patterns, when starting to analyze a pattern the AnalyzingPattern must be called first."); + _patternReported = true; +#endif + + _context.Tracer.Push ($"Reflection-{accessedItem}"); + try { + mark (); + _context.ReflectionPatternRecorder.RecognizedReflectionAccessPattern (MethodCalling, MethodCalled, accessedItem); + } finally { + _context.Tracer.Pop (); + } + } + + public void RecordUnrecognizedPattern (string message) + { +#if DEBUG + Debug.Assert (_patternAnalysisAttempted, "To correctly report all patterns, when starting to analyze a pattern the AnalyzingPattern must be called first."); + _patternReported = true; +#endif + + _context.ReflectionPatternRecorder.UnrecognizedReflectionAccessPattern (MethodCalling, MethodCalled, message); + } + + public void Dispose () + { +#if DEBUG + Debug.Assert (!_patternAnalysisAttempted || _patternReported, "A reflection pattern was analyzed, but no result was reported."); +#endif + } + } + + class ReflectionPatternDetector { + readonly MarkStep _markStep; + readonly MethodDefinition _methodCalling; + readonly Collection _instructions; + + public ReflectionPatternDetector (MarkStep markStep, MethodDefinition callingMethod) + { + _markStep = markStep; + _methodCalling = callingMethod; + _instructions = _methodCalling.Body.Instructions; + } + + public void Process (ref ReflectionPatternContext reflectionContext) + { + var methodCalled = reflectionContext.MethodCalled; + var instructionIndex = reflectionContext.InstructionIndex; + var methodCalledType = methodCalled.DeclaringType; + + switch (methodCalledType.Name) { + // + // System.Type + // + case "Type" when methodCalledType.Namespace == "System": + + // Some of the overloads are implemented by calling another overload of the same name. + // These "internal" calls are not interesting to analyze, the outermost call is the one + // which needs to be analyzed. The assumption is that all overloads have the same semantics. + // (for example that all overload of GetConstructor if used require the specified type to have a .ctor). + if (_methodCalling.DeclaringType == methodCalled.DeclaringType && _methodCalling.Name == methodCalled.Name) + break; + + switch (methodCalled.Name) { + // + // GetConstructor (Type []) + // GetConstructor (BindingFlags, Binder, Type [], ParameterModifier []) + // GetConstructor (BindingFlags, Binder, CallingConventions, Type [], ParameterModifier []) + // + case "GetConstructor": + if (!methodCalled.IsStatic) + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Constructor, instructionIndex - 1); + + break; + + // + // GetMethod (string) + // GetMethod (string, BindingFlags) + // GetMethod (string, Type[]) + // GetMethod (string, Type[], ParameterModifier[]) + // GetMethod (string, BindingFlags, Binder, Type[], ParameterModifier[]) + // GetMethod (string, BindingFlags, Binder, CallingConventions, Type[], ParameterModifier[]) + // + // TODO: .NET Core extensions + // GetMethod (string, int, Type[]) + // GetMethod (string, int, Type[], ParameterModifier[]?) + // GetMethod (string, int, BindingFlags, Binder?, Type[], ParameterModifier[]?) + // GetMethod (string, int, BindingFlags, Binder?, CallingConventions, Type[], ParameterModifier[]?) + // + case "GetMethod": + if (!methodCalled.IsStatic) + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Method, instructionIndex - 1); + + break; + + // + // GetField (string) + // GetField (string, BindingFlags) + // + case "GetField": + if (!methodCalled.IsStatic) + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Field, instructionIndex - 1); + + break; + + // + // GetEvent (string) + // GetEvent (string, BindingFlags) + // + case "GetEvent": + if (!methodCalled.IsStatic) + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Event, instructionIndex - 1); + + break; + + // + // GetProperty (string) + // GetProperty (string, BindingFlags) + // GetProperty (string, Type) + // GetProperty (string, Type[]) + // GetProperty (string, Type, Type[]) + // GetProperty (string, Type, Type[], ParameterModifier[]) + // GetProperty (string, BindingFlags, Binder, Type, Type[], ParameterModifier[]) + // + case "GetProperty": + if (!methodCalled.IsStatic) + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Property, instructionIndex - 1); + + break; + + // + // GetType (string) + // GetType (string, Boolean) + // GetType (string, Boolean, Boolean) + // GetType (string, Func, Func) + // GetType (string, Func, Func, Boolean) + // GetType (string, Func, Func, Boolean, Boolean) + // + case "GetType": + if (!methodCalled.IsStatic) { + break; + } else { + reflectionContext.AnalyzingPattern (); + + var first_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, methodCalled.Parameters.Count); + if (first_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + break; + } + + // + // The next value must be string constant (we don't handle anything else) + // + var first_arg = _instructions [first_arg_instr]; + if (first_arg.OpCode != OpCodes.Ldstr) { + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with argument which cannot be analyzed"); + break; + } + + string typeName = (string) first_arg.Operand; + TypeDefinition foundType = _markStep.ResolveFullyQualifiedTypeName (typeName); + if (foundType is null) { + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with type name `{typeName}` which can't be resolved."); + break; + } + + reflectionContext.RecordRecognizedPattern (foundType, () => _markStep.MarkType (foundType)); + } + break; + } + + break; + + // + // System.Linq.Expressions.Expression + // + case "Expression" when methodCalledType.Namespace == "System.Linq.Expressions": + Instruction second_argument; + TypeDefinition declaringType; + + if (!methodCalled.IsStatic) + break; + + switch (methodCalled.Name) { + + // + // static Call (Type, String, Type[], Expression[]) + // + case "Call": { + reflectionContext.AnalyzingPattern (); + + var first_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, 4); + if (first_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + break; + } + + var first_arg = _instructions [first_arg_instr]; + if (first_arg.OpCode == OpCodes.Ldtoken) + first_arg_instr++; + + declaringType = FindReflectionTypeForLookup (_instructions, first_arg_instr); + if (declaringType is null) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with 1st argument which cannot be analyzed"); + break; + } + + var second_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, 3); + second_argument = _instructions [second_arg_instr]; + if (second_argument.OpCode != OpCodes.Ldstr) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with 2nd argument which cannot be analyzed"); + break; + } + + var name = (string) second_argument.Operand; + + MarkMethodsFromReflectionCall (ref reflectionContext, declaringType, name, null, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); + } + + break; + + // + // static Property(Expression, Type, String) + // static Field (Expression, Type, String) + // + case "Property": + case "Field": { + reflectionContext.AnalyzingPattern (); + + var second_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, 2); + if (second_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + break; + } + + var second_arg = _instructions [second_arg_instr]; + if (second_arg.OpCode == OpCodes.Ldtoken) + second_arg_instr++; + + declaringType = FindReflectionTypeForLookup (_instructions, second_arg_instr); + if (declaringType is null) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with 2nd argument which cannot be analyzed"); + break; + } + + var third_arg_inst = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, 1); + var third_argument = _instructions [third_arg_inst]; + if (third_argument.OpCode != OpCodes.Ldstr) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with the 3rd argument which cannot be analyzed"); + break; + } + + var name = (string) third_argument.Operand; + + // + // The first argument can be any expression but we are looking only for simple null + // which we can convert to static only field lookup + // + var first_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, 3); + bool staticOnly = false; + + if (first_arg_instr >= 0) { + var first_arg = _instructions [first_arg_instr]; + if (first_arg.OpCode == OpCodes.Ldnull) + staticOnly = true; + } + + if (methodCalled.Name [0] == 'P') + MarkPropertiesFromReflectionCall (ref reflectionContext, declaringType, name, staticOnly); + else + MarkFieldsFromReflectionCall (ref reflectionContext, declaringType, name, staticOnly); + } + + break; + + // + // static New (Type) + // + case "New": { + reflectionContext.AnalyzingPattern (); + + var first_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, 1); + if (first_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + break; + } + + var first_arg = _instructions [first_arg_instr]; + if (first_arg.OpCode == OpCodes.Ldtoken) + first_arg_instr++; + + declaringType = FindReflectionTypeForLookup (_instructions, first_arg_instr); + if (declaringType is null) { + reflectionContext.RecordUnrecognizedPattern ($"Expression call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with 1st argument which cannot be analyzed"); + break; + } + + MarkMethodsFromReflectionCall (ref reflectionContext, declaringType, ".ctor", 0, BindingFlags.Instance, parametersCount: 0); + } + break; + } + + break; + + // + // System.Reflection.RuntimeReflectionExtensions + // + case "RuntimeReflectionExtensions" when methodCalledType.Namespace == "System.Reflection": + switch (methodCalled.Name) { + // + // static GetRuntimeField (this Type type, string name) + // + case "GetRuntimeField": + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Field, instructionIndex - 1, thisExtension: true); + break; + + // + // static GetRuntimeMethod (this Type type, string name, Type[] parameters) + // + case "GetRuntimeMethod": + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Method, instructionIndex - 1, thisExtension: true); + break; + + // + // static GetRuntimeProperty (this Type type, string name) + // + case "GetRuntimeProperty": + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Property, instructionIndex - 1, thisExtension: true); + break; + + // + // static GetRuntimeEvent (this Type type, string name) + // + case "GetRuntimeEvent": + ProcessSystemTypeGetMemberLikeCall (ref reflectionContext, System.Reflection.MemberTypes.Event, instructionIndex - 1, thisExtension: true); + break; + } + + break; + + // + // System.AppDomain + // + case "AppDomain" when methodCalledType.Namespace == "System": + // + // CreateInstance (string assemblyName, string typeName) + // CreateInstance (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstance (string assemblyName, string typeName, object? []? activationAttributes) + // + // CreateInstanceAndUnwrap (string assemblyName, string typeName) + // CreateInstanceAndUnwrap (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstanceAndUnwrap (string assemblyName, string typeName, object? []? activationAttributes) + // + // CreateInstanceFrom (string assemblyFile, string typeName) + // CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstanceFrom (string assemblyFile, string typeName, object? []? activationAttributes) + // + // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName) + // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // CreateInstanceFromAndUnwrap (string assemblyFile, string typeName, object? []? activationAttributes) + // + switch (methodCalled.Name) { + case "CreateInstance": + case "CreateInstanceAndUnwrap": + case "CreateInstanceFrom": + case "CreateInstanceFromAndUnwrap": + ProcessActivatorCallWithStrings (ref reflectionContext, instructionIndex - 1, methodCalled.Parameters.Count < 4); + break; + } + + break; + + // + // System.Reflection.Assembly + // + case "Assembly" when methodCalledType.Namespace == "System.Reflection": + // + // CreateInstance (string typeName) + // CreateInstance (string typeName, bool ignoreCase) + // CreateInstance (string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder? binder, object []? args, CultureInfo? culture, object []? activationAttributes) + // + if (methodCalled.Name == "CreateInstance") { + // + // TODO: This could be supported for `this` only calls + // + reflectionContext.AnalyzingPattern (); + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' is not yet supported"); + break; + } + + break; + + // + // System.Activator + // + case "Activator" when methodCalledType.Namespace == "System": + if (!methodCalled.IsStatic) + break; + + switch (methodCalled.Name) { + // + // static T CreateInstance () + // + case "CreateInstance" when methodCalled.ContainsGenericParameter: + // Not sure it's worth implementing as we cannot expant T and simple cases can be rewritten + reflectionContext.AnalyzingPattern (); + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' is not supported"); + break; + + // + // static CreateInstance (string assemblyName, string typeName) + // static CreateInstance (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) + // static CreateInstance (string assemblyName, string typeName, object?[]? activationAttributes) + // + // static CreateInstance (System.Type type) + // static CreateInstance (System.Type type, bool nonPublic) + // static CreateInstance (System.Type type, params object?[]? args) + // static CreateInstance (System.Type type, object?[]? args, object?[]? activationAttributes) + // static CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture) + // static CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; } + // + case "CreateInstance": { + reflectionContext.AnalyzingPattern (); + + var parameters = methodCalled.Parameters; + if (parameters.Count < 1) + break; + + if (parameters [0].ParameterType.MetadataType == MetadataType.String) { + ProcessActivatorCallWithStrings (ref reflectionContext, instructionIndex - 1, parameters.Count < 4); + break; + } + + var first_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, methodCalled.Parameters.Count); + if (first_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + break; + } + + if (parameters [0].ParameterType.IsTypeOf ("System", "Type")) { + declaringType = FindReflectionTypeForLookup (_instructions, first_arg_instr + 1); + if (declaringType is null) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{methodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with 1st argument expression which cannot be analyzed"); + break; + } + + BindingFlags bindingFlags = BindingFlags.Instance; + int? parametersCount = null; + + if (methodCalled.Parameters.Count == 1) { + parametersCount = 0; + } else { + var second_arg_instr = GetInstructionAtStackDepth (_instructions, instructionIndex - 1, methodCalled.Parameters.Count - 1); + second_argument = _instructions [second_arg_instr]; + switch (second_argument.OpCode.Code) { + case Code.Ldc_I4_0 when parameters [1].ParameterType.MetadataType == MetadataType.Boolean: + parametersCount = 0; + bindingFlags |= BindingFlags.Public; + break; + case Code.Ldc_I4_1 when parameters [1].ParameterType.MetadataType == MetadataType.Boolean: + parametersCount = 0; + break; + case Code.Ldc_I4_S when parameters [1].ParameterType.IsTypeOf ("System.Reflection", "BindingFlags"): + bindingFlags = (BindingFlags) (sbyte) second_argument.Operand; + break; + } + } + + MarkMethodsFromReflectionCall (ref reflectionContext, declaringType, ".ctor", 0, bindingFlags, parametersCount); + break; + } + } + + break; + + // + // static CreateInstanceFrom (string assemblyFile, string typeName) + // static CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object? []? args, System.Globalization.CultureInfo? culture, object? []? activationAttributes) + // static CreateInstanceFrom (string assemblyFile, string typeName, object? []? activationAttributes) + // + case "CreateInstanceFrom": + ProcessActivatorCallWithStrings (ref reflectionContext, instructionIndex - 1, methodCalled.Parameters.Count < 4); + break; + } + + break; + } + + } + + // + // Handles static method calls in form of Create (string assemblyFile, string typeName, ......) + // + void ProcessActivatorCallWithStrings (ref ReflectionPatternContext reflectionContext, int startIndex, bool defaultCtorOnly) + { + reflectionContext.AnalyzingPattern (); + + var parameters = reflectionContext.MethodCalled.Parameters; + if (parameters.Count < 2) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' is not supported"); + return; + } + + if (parameters [0].ParameterType.MetadataType != MetadataType.String && parameters [1].ParameterType.MetadataType != MetadataType.String) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' is not supported"); + return; + } + + var first_arg_instr = GetInstructionAtStackDepth (_instructions, startIndex, reflectionContext.MethodCalled.Parameters.Count); + if (first_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + return; + } + + var first_arg = _instructions [first_arg_instr]; + if (first_arg.OpCode != OpCodes.Ldstr) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with the 1st argument which cannot be analyzed"); + return; + } + + var second_arg_instr = GetInstructionAtStackDepth (_instructions, startIndex, reflectionContext.MethodCalled.Parameters.Count - 1); + if (second_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + return; + } + + var second_arg = _instructions [second_arg_instr]; + if (second_arg.OpCode != OpCodes.Ldstr) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with the 2nd argument which cannot be analyzed"); + return; + } + + string assembly_name = (string) first_arg.Operand; + if (!_markStep._context.Resolver.AssemblyCache.TryGetValue (assembly_name, out var assembly)) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' references assembly '{assembly_name}' which could not be found"); + return; + } + + string type_name = (string) second_arg.Operand; + var declaringType = FindType (assembly, type_name); + + if (declaringType is null) { + reflectionContext.RecordUnrecognizedPattern ($"Activator call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' references type '{type_name}' which could not be found"); + return; + } + + MarkMethodsFromReflectionCall (ref reflectionContext, declaringType, ".ctor", 0, null, defaultCtorOnly ? 0 : (int?) null); + } + + // + // Handles instance methods called over typeof (Foo) with string name as the first argument + // + void ProcessSystemTypeGetMemberLikeCall (ref ReflectionPatternContext reflectionContext, System.Reflection.MemberTypes memberTypes, int startIndex, bool thisExtension = false) + { + reflectionContext.AnalyzingPattern (); + + int first_instance_arg = reflectionContext.MethodCalled.Parameters.Count; + if (thisExtension) + --first_instance_arg; + + var first_arg_instr = GetInstructionAtStackDepth (_instructions, startIndex, first_instance_arg); + if (first_arg_instr < 0) { + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' couldn't be decomposed"); + return; + } + + var first_arg = _instructions [first_arg_instr]; + BindingFlags? bindingFlags = default; + string name = default; + + if (memberTypes == System.Reflection.MemberTypes.Constructor) { + if (first_arg.OpCode == OpCodes.Ldc_I4_S && reflectionContext.MethodCalled.Parameters.Count > 0 && reflectionContext.MethodCalled.Parameters [0].ParameterType.IsTypeOf ("System.Reflection", "BindingFlags")) { + bindingFlags = (BindingFlags) (sbyte) first_arg.Operand; + } + } else { + // + // The next value must be string constant (we don't handle anything else) + // + if (first_arg.OpCode != OpCodes.Ldstr) { + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' was detected with argument which cannot be analyzed"); + return; + } + + name = (string) first_arg.Operand; + + var pos_arg = _instructions [first_arg_instr + 1]; + if (pos_arg.OpCode == OpCodes.Ldc_I4_S && reflectionContext.MethodCalled.Parameters.Count > 1 && reflectionContext.MethodCalled.Parameters [1].ParameterType.IsTypeOf ("System.Reflection", "BindingFlags")) { + bindingFlags = (BindingFlags) (sbyte) pos_arg.Operand; + } + } + + var declaringType = FindReflectionTypeForLookup (_instructions, first_arg_instr - 1); + if (declaringType is null) { + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' does not use detectable instance type extraction"); + return; + } + + switch (memberTypes) { + case System.Reflection.MemberTypes.Constructor: + MarkMethodsFromReflectionCall (ref reflectionContext, declaringType, ".ctor", 0, bindingFlags); + break; + case System.Reflection.MemberTypes.Method: + MarkMethodsFromReflectionCall (ref reflectionContext, declaringType, name, 0, bindingFlags); + break; + case System.Reflection.MemberTypes.Field: + MarkFieldsFromReflectionCall (ref reflectionContext, declaringType, name); + break; + case System.Reflection.MemberTypes.Property: + MarkPropertiesFromReflectionCall (ref reflectionContext, declaringType, name); + break; + case System.Reflection.MemberTypes.Event: + MarkEventsFromReflectionCall (ref reflectionContext, declaringType, name); + break; + default: + Debug.Fail ("Unsupported member type"); + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{_methodCalling.FullName}' is of unexpected member type."); + break; + } + } + + // + // arity is null for name match regardless of arity + // + void MarkMethodsFromReflectionCall (ref ReflectionPatternContext reflectionContext, TypeDefinition declaringType, string name, int? arity, BindingFlags? bindingFlags, int? parametersCount = null) + { + bool foundMatch = false; + foreach (var method in declaringType.Methods) { + var mname = method.Name; + + // Either exact match or generic method with any arity when unspecified + if (mname != name && !(arity is null && mname.StartsWith (name, StringComparison.Ordinal) && mname.Length > name.Length + 2 && mname [name.Length + 1] == '`')) { + continue; + } + + if ((bindingFlags & (BindingFlags.Instance | BindingFlags.Static)) == BindingFlags.Static && !method.IsStatic) + continue; + + if ((bindingFlags & (BindingFlags.Instance | BindingFlags.Static)) == BindingFlags.Instance && method.IsStatic) + continue; + + if ((bindingFlags & (BindingFlags.Public | BindingFlags.NonPublic)) == BindingFlags.Public && !method.IsPublic) + continue; + + if ((bindingFlags & (BindingFlags.Public | BindingFlags.NonPublic)) == BindingFlags.NonPublic && method.IsPublic) + continue; + + if (parametersCount is not null && parametersCount != method.Parameters.Count) + continue; + + foundMatch = true; + reflectionContext.RecordRecognizedPattern (method, () => _markStep.MarkIndirectlyCalledMethod (method)); + } + + if (!foundMatch) + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' could not resolve method `{name}` on type `{declaringType.FullName}`."); + } + + void MarkPropertiesFromReflectionCall (ref ReflectionPatternContext reflectionContext, TypeDefinition declaringType, string name, bool staticOnly = false) + { + bool foundMatch = false; + foreach (var property in declaringType.Properties) { + if (property.Name != name) + continue; + + bool markedAny = false; + + // It is not easy to reliably detect in the IL code whether the getter or setter (or both) are used. + // Be conservative and mark everything for the property. + var getter = property.GetMethod; + if (getter is not null && (!staticOnly || staticOnly && getter.IsStatic)) { + reflectionContext.RecordRecognizedPattern (getter, () => _markStep.MarkIndirectlyCalledMethod (getter)); + markedAny = true; + } + + var setter = property.SetMethod; + if (setter is not null && (!staticOnly || staticOnly && setter.IsStatic)) { + reflectionContext.RecordRecognizedPattern (setter, () => _markStep.MarkIndirectlyCalledMethod (setter)); + markedAny = true; + } + + if (markedAny) { + foundMatch = true; + reflectionContext.RecordRecognizedPattern (property, () => _markStep.MarkProperty (property)); + } + } + + if (!foundMatch) + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' could not resolve property `{name}` on type `{declaringType.FullName}`."); + } + + void MarkFieldsFromReflectionCall (ref ReflectionPatternContext reflectionContext, TypeDefinition declaringType, string name, bool staticOnly = false) + { + bool foundMatch = false; + foreach (var field in declaringType.Fields) { + if (field.Name != name) + continue; + + if (staticOnly && !field.IsStatic) + continue; + + foundMatch = true; + reflectionContext.RecordRecognizedPattern (field, () => _markStep.MarkField (field)); + break; + } + + if (!foundMatch) + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' could not resolve field `{name}` on type `{declaringType.FullName}`."); + } + + void MarkEventsFromReflectionCall (ref ReflectionPatternContext reflectionContext, TypeDefinition declaringType, string name) + { + bool foundMatch = false; + foreach (var eventInfo in declaringType.Events) { + if (eventInfo.Name != name) + continue; + + foundMatch = true; + reflectionContext.RecordRecognizedPattern (eventInfo, () => _markStep.MarkEvent (eventInfo)); + } + + if (!foundMatch) + reflectionContext.RecordUnrecognizedPattern ($"Reflection call '{reflectionContext.MethodCalled.FullName}' inside '{reflectionContext.MethodCalling.FullName}' could not resolve event `{name}` on type `{declaringType.FullName}`."); + } + } + + static int GetInstructionAtStackDepth (Collection instructions, int startIndex, int stackSizeToBacktrace) + { + for (int i = startIndex; i >= 0; --i) { + var instruction = instructions [i]; + + switch (instruction.OpCode.StackBehaviourPop) { + case StackBehaviour.Pop0: + break; + case StackBehaviour.Pop1: + case StackBehaviour.Popi: + case StackBehaviour.Popref: + stackSizeToBacktrace++; + break; + case StackBehaviour.Pop1_pop1: + case StackBehaviour.Popi_pop1: + case StackBehaviour.Popi_popi: + case StackBehaviour.Popi_popi8: + case StackBehaviour.Popi_popr4: + case StackBehaviour.Popi_popr8: + case StackBehaviour.Popref_pop1: + case StackBehaviour.Popref_popi: + stackSizeToBacktrace += 2; + break; + case StackBehaviour.Popref_popi_popi: + case StackBehaviour.Popref_popi_popi8: + case StackBehaviour.Popref_popi_popr4: + case StackBehaviour.Popref_popi_popr8: + case StackBehaviour.Popref_popi_popref: + stackSizeToBacktrace += 3; + break; + case StackBehaviour.Varpop: + switch (instruction.OpCode.Code) { + case Code.Call: + case Code.Calli: + case Code.Callvirt: + if (instruction.Operand is MethodReference mr) { + stackSizeToBacktrace += mr.Parameters.Count; + if (mr.Resolve ()?.IsStatic == false) + stackSizeToBacktrace++; + } + + break; + case Code.Newobj: + if (instruction.Operand is MethodReference ctor) { + stackSizeToBacktrace += ctor.Parameters.Count; + } + break; + case Code.Ret: + // TODO: Need method return type for correct stack size but this path should not be hit yet + break; + default: + return -3; + } + break; + } + + switch (instruction.OpCode.StackBehaviourPush) { + case StackBehaviour.Push0: + break; + case StackBehaviour.Push1: + case StackBehaviour.Pushi: + case StackBehaviour.Pushi8: + case StackBehaviour.Pushr4: + case StackBehaviour.Pushr8: + case StackBehaviour.Pushref: + stackSizeToBacktrace--; + break; + case StackBehaviour.Push1_push1: + stackSizeToBacktrace -= 2; + break; + case StackBehaviour.Varpush: + // + // Only call, calli, callvirt will hit this + // + if (instruction.Operand is MethodReference mr && mr.ReturnType.MetadataType != MetadataType.Void) { + stackSizeToBacktrace--; + } + break; + } + + if (stackSizeToBacktrace == 0) + return i; + + if (stackSizeToBacktrace < 0) + return -1; + } + + return -2; + } + + static TypeDefinition FindReflectionTypeForLookup (Collection instructions, int startIndex) + { + while (startIndex >= 1) { + int storeIndex = -1; + var instruction = instructions [startIndex]; + switch (instruction.OpCode.Code) { + // + // Pattern #1 + // + // typeof (Foo).ReflectionCall () + // + case Code.Call: + if (!(instruction.Operand is MethodReference mr) || mr.Name != "GetTypeFromHandle") + return null; + + var ldtoken = instructions [startIndex - 1]; + + if (ldtoken.OpCode != OpCodes.Ldtoken) + return null; + + return (ldtoken.Operand as TypeReference).Resolve (); + + // + // Patern #2 + // + // var temp = typeof (Foo); + // temp.ReflectionCall () + // + case Code.Ldloc_0: + storeIndex = GetIndexOfInstruction (instructions, OpCodes.Stloc_0, startIndex - 1); + startIndex = storeIndex - 1; + break; + case Code.Ldloc_1: + storeIndex = GetIndexOfInstruction (instructions, OpCodes.Stloc_1, startIndex - 1); + startIndex = storeIndex - 1; + break; + case Code.Ldloc_2: + storeIndex = GetIndexOfInstruction (instructions, OpCodes.Stloc_2, startIndex - 1); + startIndex = storeIndex - 1; + break; + case Code.Ldloc_3: + storeIndex = GetIndexOfInstruction (instructions, OpCodes.Stloc_3, startIndex - 1); + startIndex = storeIndex - 1; + break; + case Code.Ldloc_S: + storeIndex = GetIndexOfInstruction (instructions, OpCodes.Stloc_S, startIndex - 1, l => (VariableReference) l.Operand == (VariableReference) instruction.Operand); + startIndex = storeIndex - 1; + break; + case Code.Ldloc: + storeIndex = GetIndexOfInstruction (instructions, OpCodes.Stloc, startIndex - 1, l => (VariableReference) l.Operand == (VariableReference) instruction.Operand); + startIndex = storeIndex - 1; + break; + + case Code.Nop: + startIndex--; + break; + + default: + return null; + } + } + + return null; + } + + static int GetIndexOfInstruction (Collection instructions, OpCode opcode, int startIndex, Predicate comparer = null) + { + while (startIndex >= 0) { + var instr = instructions [startIndex]; + if (instr.OpCode == opcode && (comparer is null || comparer (instr))) + return startIndex; + + startIndex--; + } + + return -1; + } + + protected class AttributeProviderPair { + public AttributeProviderPair (CustomAttribute attribute, ICustomAttributeProvider provider) + { + Attribute = attribute; + Provider = provider; + } + + public CustomAttribute Attribute { get; private set; } + public ICustomAttributeProvider Provider { get; private set; } + } + } + + // Make our own copy of the BindingFlags enum, so that we don't depend on System.Reflection. + [Flags] + enum BindingFlags { + Default = 0, + IgnoreCase = 1, + DeclaredOnly = 2, + Instance = 4, + Static = 8, + Public = 16, + NonPublic = 32, + FlattenHierarchy = 64, + InvokeMethod = 256, + CreateInstance = 512, + GetField = 1024, + SetField = 2048, + GetProperty = 4096, + SetProperty = 8192, + PutDispProperty = 16384, + PutRefDispProperty = 32768, + ExactBinding = 65536, + SuppressChangeType = 131072, + OptionalParamBinding = 262144, + IgnoreReturn = 16777216 + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/OutputStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/OutputStep.cs new file mode 100644 index 000000000000..d4e52806c53d --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/OutputStep.cs @@ -0,0 +1,301 @@ +// +// OutputStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +using Mono.Cecil; +using Mono.Cecil.Cil; +using Mono.Cecil.PE; + +namespace Mono.Linker.Steps { + + public class OutputStep : BaseStep { + private static Dictionary architectureMap; + + private enum NativeOSOverride { + Apple = 0x4644, + FreeBSD = 0xadc4, + Linux = 0x7b79, + NetBSD = 0x1993, + Default = 0 + } + + List assembliesWritten; + + public OutputStep () + { + assembliesWritten = new List (); + } + + static TargetArchitecture CalculateArchitecture (TargetArchitecture readyToRunArch) + { + if (architectureMap is null) { + architectureMap = new Dictionary (); + foreach (var os in Enum.GetValues (typeof (NativeOSOverride))) { + ushort osVal = (ushort) (NativeOSOverride) os; + foreach (var arch in Enum.GetValues (typeof (TargetArchitecture))) { + ushort archVal = (ushort) (TargetArchitecture) arch; + architectureMap.Add ((ushort) (archVal ^ osVal), (TargetArchitecture) arch); + } + } + } + + TargetArchitecture pureILArch; + if (architectureMap.TryGetValue ((ushort) readyToRunArch, out pureILArch)) { + return pureILArch; + } + throw new BadImageFormatException ("unrecognized module attributes"); + } + + protected override void Process () + { + CheckOutputDirectory (); + Tracer.Finish (); + } + + protected override void EndProcess () + { + if (Context.AssemblyListFile is not null) { + using (var w = File.CreateText (Context.AssemblyListFile)) { + w.WriteLine ("[" + String.Join (", ", assembliesWritten.Select (a => "\"" + a + "\"").ToArray ()) + "]"); + } + } + } + + void CheckOutputDirectory () + { + if (Directory.Exists (Context.OutputDirectory)) + return; + + Directory.CreateDirectory (Context.OutputDirectory); + } + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + OutputAssembly (assembly); + } + + protected void WriteAssembly (AssemblyDefinition assembly, string directory) + { + WriteAssembly (assembly, directory, SaveSymbols (assembly)); + } + + protected virtual void WriteAssembly (AssemblyDefinition assembly, string directory, WriterParameters writerParameters) + { + foreach (var module in assembly.Modules) { + // Write back pure IL even for crossgen-ed assemblies + if (module.IsCrossgened ()) { + module.Attributes |= ModuleAttributes.ILOnly; + module.Attributes ^= ModuleAttributes.ILLibrary; + module.Architecture = CalculateArchitecture (module.Architecture); + } + } + + string outputName = GetAssemblyFileName (assembly, directory); + try { + assembly.Write (outputName, writerParameters); + } catch (Exception e) { + throw new OutputException ($"Failed to write '{outputName}", e); + } + } + + void OutputAssembly (AssemblyDefinition assembly) + { + string directory = Context.OutputDirectory; + + CopyConfigFileIfNeeded (assembly, directory); + + var action = Annotations.GetAction (assembly); + Context.LogMessage (MessageImportance.Low, $"Output action: {action,8} assembly: {assembly}"); + + switch (action) { + case AssemblyAction.Save: + case AssemblyAction.Link: + case AssemblyAction.AddBypassNGen: + Context.Tracer.AddDependency (assembly); + WriteAssembly (assembly, directory); + CopySatelliteAssembliesIfNeeded (assembly, directory); + assembliesWritten.Add (GetOriginalAssemblyFileInfo (assembly).Name); + break; + case AssemblyAction.Copy: + Context.Tracer.AddDependency (assembly); + CloseSymbols (assembly); + CopyAssembly (assembly, directory); + CopySatelliteAssembliesIfNeeded (assembly, directory); + assembliesWritten.Add (GetOriginalAssemblyFileInfo (assembly).Name); + break; + case AssemblyAction.Delete: + CloseSymbols (assembly); + DeleteAssembly (assembly, directory); + break; + default: + CloseSymbols (assembly); + break; + } + } + + protected virtual void DeleteAssembly (AssemblyDefinition assembly, string directory) + { + var target = GetAssemblyFileName (assembly, directory); + if (File.Exists (target)) { + File.Delete (target); + File.Delete (target + ".mdb"); + File.Delete (Path.ChangeExtension (target, "pdb")); + File.Delete (GetConfigFile (target)); + } + } + + void CloseSymbols (AssemblyDefinition assembly) + { + Annotations.CloseSymbolReader (assembly); + } + + WriterParameters SaveSymbols (AssemblyDefinition assembly) + { + var parameters = new WriterParameters { + DeterministicMvid = Context.DeterministicOutput + }; + + if (!Context.LinkSymbols) + return parameters; + + if (!assembly.MainModule.HasSymbols) + return parameters; + + // Use a string check to avoid a hard dependency on Mono.Cecil.Pdb + if (Environment.OSVersion.Platform != PlatformID.Win32NT && assembly.MainModule.SymbolReader.GetType ().FullName == "Mono.Cecil.Pdb.NativePdbReader") + return parameters; + + if (Context.SymbolWriterProvider is not null) + parameters.SymbolWriterProvider = Context.SymbolWriterProvider; + else + parameters.WriteSymbols = true; + return parameters; + } + + + void CopySatelliteAssembliesIfNeeded (AssemblyDefinition assembly, string directory) + { + if (!Annotations.ProcessSatelliteAssemblies) + return; + + FileInfo original = GetOriginalAssemblyFileInfo (assembly); + string resourceFile = GetAssemblyResourceFileName (original.FullName); + + foreach (var subDirectory in Directory.EnumerateDirectories (original.DirectoryName)) { + var satelliteAssembly = Path.Combine (subDirectory, resourceFile); + if (!File.Exists (satelliteAssembly)) + continue; + + string cultureName = subDirectory.Substring (subDirectory.LastIndexOf (Path.DirectorySeparatorChar) + 1); + string culturePath = Path.Combine (directory, cultureName); + + Directory.CreateDirectory (culturePath); + File.Copy (satelliteAssembly, Path.Combine (culturePath, resourceFile), true); + } + } + + void CopyConfigFileIfNeeded (AssemblyDefinition assembly, string directory) + { + string config = GetConfigFile (GetOriginalAssemblyFileInfo (assembly).FullName); + if (!File.Exists (config)) + return; + + string target = Path.GetFullPath (GetConfigFile (GetAssemblyFileName (assembly, directory))); + + if (config == target) + return; + + File.Copy (config, GetConfigFile (GetAssemblyFileName (assembly, directory)), true); + } + + static string GetAssemblyResourceFileName (string assembly) + { + return Path.GetFileNameWithoutExtension (assembly) + ".resources.dll"; + } + + static string GetConfigFile (string assembly) + { + return assembly + ".config"; + } + + static FileInfo GetOriginalAssemblyFileInfo (AssemblyDefinition assembly) + { + return new FileInfo (assembly.MainModule.FileName); + } + + protected virtual void CopyAssembly (AssemblyDefinition assembly, string directory) + { + // Special case. When an assembly has embedded pdbs, link symbols is not enabled, and the assembly's action is copy, + // we want to match the behavior of assemblies with the other symbol types and end up with an assembly that does not have symbols. + // In order to do that, we can't simply copy files. We need to write the assembly without symbols + if (assembly.MainModule.HasSymbols && !Context.LinkSymbols && assembly.MainModule.SymbolReader is EmbeddedPortablePdbReader) { + WriteAssembly (assembly, directory, new WriterParameters ()); + return; + } + + FileInfo fi = GetOriginalAssemblyFileInfo (assembly); + string target = Path.GetFullPath (Path.Combine (directory, fi.Name)); + string source = fi.FullName; + if (source == target) + return; + + CopyFileAndRemoveReadOnly (source, target); + + if (!Context.LinkSymbols) + return; + + var mdb = source + ".mdb"; + if (File.Exists (mdb)) + CopyFileAndRemoveReadOnly (mdb, target + ".mdb"); + + var pdb = Path.ChangeExtension (source, "pdb"); + if (File.Exists (pdb)) + CopyFileAndRemoveReadOnly (pdb, Path.ChangeExtension (target, "pdb")); + } + + static void CopyFileAndRemoveReadOnly (string src, string dest) + { + File.Copy (src, dest, true); + + System.IO.FileAttributes attrs = File.GetAttributes (dest); + + if ((attrs & System.IO.FileAttributes.ReadOnly) == System.IO.FileAttributes.ReadOnly) + File.SetAttributes (dest, attrs & ~System.IO.FileAttributes.ReadOnly); + } + + protected virtual string GetAssemblyFileName (AssemblyDefinition assembly, string directory) + { + string file = GetOriginalAssemblyFileInfo (assembly).Name; + return Path.Combine (directory, file); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/PreserveDependencyLookupStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/PreserveDependencyLookupStep.cs new file mode 100644 index 000000000000..0ff917d71666 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/PreserveDependencyLookupStep.cs @@ -0,0 +1,99 @@ +// +// PreserveDependencyLookupStep.cs +// +// Author: +// Marek Safar (marek.safar@gmail.com) +// +// Copyright (C) 2018 Microsoft Corporation +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using Mono.Cecil; +using Mono.Collections.Generic; + +namespace Mono.Linker.Steps { + public class PreserveDependencyLookupStep : LoadReferencesStep { + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + var module = assembly.MainModule; + + foreach (var type in module.Types) { + if (type.HasMethods) { + foreach (var method in type.GetMethods ()) { + var md = method.Resolve (); + if (md?.HasCustomAttributes != true) + continue; + + ProcessPreserveDependencyAttribute (md.CustomAttributes); + } + } + + if (type.HasFields) { + foreach (var field in type.Fields) { + var md = field.Resolve (); + if (md?.HasCustomAttributes != true) + continue; + + ProcessPreserveDependencyAttribute (md.CustomAttributes); + } + } + } + } + + public static bool IsPreserveDependencyAttribute (TypeReference tr) + { + return tr.Name == "PreserveDependencyAttribute" && tr.Namespace == "System.Runtime.CompilerServices"; + } + + public static bool HasPreserveDependencyAttribute (MethodDefinition method) + { + if (!method.HasCustomAttributes) + return false; + + foreach (var ca in method.CustomAttributes) { + if (IsPreserveDependencyAttribute (ca.AttributeType)) + return true; + } + + return false; + } + + void ProcessPreserveDependencyAttribute (Collection attributes) + { + foreach (var ca in attributes) { + if (!IsPreserveDependencyAttribute (ca.AttributeType)) + continue; + + if (ca.ConstructorArguments.Count != 3) + continue; + + var assemblyName = ca.ConstructorArguments [2].Value as string; + if (assemblyName is null) + continue; + + var newDependency = Context.Resolve (new AssemblyNameReference (assemblyName, new Version ())); + if (newDependency is not null) + ProcessReferences (newDependency); + } + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/RegenerateGuidStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/RegenerateGuidStep.cs new file mode 100644 index 000000000000..6b2558e8352d --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/RegenerateGuidStep.cs @@ -0,0 +1,48 @@ +// +// CleanStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2008 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; + +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class RegenerateGuidStep : BaseStep { + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + if (Annotations.GetAction (assembly) == AssemblyAction.Link) + RegenerateGuid (assembly); + } + + static void RegenerateGuid (AssemblyDefinition asm) + { + asm.MainModule.Mvid = Guid.NewGuid (); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs new file mode 100644 index 000000000000..94d317e9f153 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromAssemblyStep.cs @@ -0,0 +1,249 @@ +// +// ResolveFromAssemblyStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using Mono.Cecil; +using Mono.Collections.Generic; + +namespace Mono.Linker.Steps { + + public class ResolveFromAssemblyStep : ResolveStep { + + AssemblyDefinition _assembly; + string _file; + RootVisibility _rootVisibility; + + public enum RootVisibility { + Any = 0, + PublicAndFamily = 1, + PublicAndFamilyAndAssembly = 2 + } + + + public ResolveFromAssemblyStep (string assembly, RootVisibility rootVisibility = RootVisibility.Any) + { + _file = assembly; + _rootVisibility = rootVisibility; + } + + public ResolveFromAssemblyStep (AssemblyDefinition assembly) + { + _assembly = assembly; + } + + protected override void Process () + { + if (_assembly is not null) + Context.Resolver.CacheAssembly (_assembly); + + var ignoreUnresolved = Context.Resolver.IgnoreUnresolved; + if (_rootVisibility == RootVisibility.PublicAndFamily) { + Context.Resolver.IgnoreUnresolved = false; + } + + AssemblyDefinition assembly = _assembly ?? Context.Resolve (_file); + Context.Resolver.IgnoreUnresolved = ignoreUnresolved; + if (_rootVisibility != RootVisibility.Any && HasInternalsVisibleTo (assembly)) { + _rootVisibility = RootVisibility.PublicAndFamilyAndAssembly; + } + + switch (assembly.MainModule.Kind) { + case ModuleKind.Dll: + ProcessLibrary (assembly); + break; + default: + ProcessExecutable (assembly); + break; + } + } + + protected virtual void ProcessLibrary (AssemblyDefinition assembly) + { + ProcessLibrary (Context, assembly, _rootVisibility); + } + + public static void ProcessLibrary (LinkContext context, AssemblyDefinition assembly, RootVisibility rootVisibility = RootVisibility.Any) + { + var action = rootVisibility == RootVisibility.Any ? AssemblyAction.Copy : AssemblyAction.Link; + context.SetAction (assembly, action); + + context.Tracer.Push (assembly); + + foreach (TypeDefinition type in assembly.MainModule.Types) + MarkType (context, type, rootVisibility); + + if (assembly.MainModule.HasExportedTypes) { + foreach (var exported in assembly.MainModule.ExportedTypes) { + bool isForwarder = exported.IsForwarder; + var declaringType = exported.DeclaringType; + while (!isForwarder && (declaringType is not null)) { + isForwarder = declaringType.IsForwarder; + declaringType = declaringType.DeclaringType; + } + + if (!isForwarder) + continue; + TypeDefinition resolvedExportedType = exported.Resolve (); + + if (resolvedExportedType is null) { + // + // It's quite common for assemblies to have broken exported types + // + // One source of them is from native csc which added all nested types of + // type-forwarded types automatically including private ones. + // + // Next source of broken type-forwarders is from custom metadata writers which + // simply write bogus information. + // + // Both cases are bugs not on our end but we still want to link all assemblies + // especially when such types cannot be used anyway + // + context.LogMessage ($"Cannot find declaration of exported type '{exported}' from the assembly '{assembly}'"); + + continue; + } + + context.Resolve (resolvedExportedType.Scope); + MarkType (context, resolvedExportedType, rootVisibility); + context.MarkingHelpers.MarkExportedType (exported, assembly.MainModule); + } + } + + context.Tracer.Pop (); + } + + static void MarkType (LinkContext context, TypeDefinition type, RootVisibility rootVisibility) + { + bool markType; + switch (rootVisibility) { + default: + markType = true; + break; + + case RootVisibility.PublicAndFamilyAndAssembly: + markType = !type.IsNestedPrivate; + break; + + case RootVisibility.PublicAndFamily: + markType = type.IsPublic || type.IsNestedPublic || type.IsNestedFamily || type.IsNestedFamilyOrAssembly; + break; + } + + if (!markType) { + return; + } + + context.Annotations.MarkAndPush (type); + + if (type.HasFields) + MarkFields (context, type.Fields, rootVisibility); + if (type.HasMethods) + MarkMethods (context, type.Methods, rootVisibility); + if (type.HasNestedTypes) + foreach (var nested in type.NestedTypes) + MarkType (context, nested, rootVisibility); + + context.Tracer.Pop (); + } + + void ProcessExecutable (AssemblyDefinition assembly) + { + Context.SetAction (assembly, AssemblyAction.Link); + + Tracer.Push (assembly); + + Annotations.Mark (assembly.EntryPoint.DeclaringType); + + MarkMethod (Context, assembly.EntryPoint, MethodAction.Parse, RootVisibility.Any); + + Tracer.Pop (); + } + + static void MarkFields (LinkContext context, Collection fields, RootVisibility rootVisibility) + { + foreach (FieldDefinition field in fields) { + bool markField; + switch (rootVisibility) { + default: + markField = true; + break; + + case RootVisibility.PublicAndFamily: + markField = field.IsPublic || field.IsFamily || field.IsFamilyOrAssembly; + break; + + case RootVisibility.PublicAndFamilyAndAssembly: + markField = field.IsPublic || field.IsFamily || field.IsFamilyOrAssembly || field.IsAssembly || field.IsFamilyAndAssembly; + break; + } + if (markField) { + context.Annotations.Mark (field); + } + } + } + + static void MarkMethods (LinkContext context, Collection methods, RootVisibility rootVisibility) + { + foreach (MethodDefinition method in methods) + MarkMethod (context, method, MethodAction.ForceParse, rootVisibility); + } + + static void MarkMethod (LinkContext context, MethodDefinition method, MethodAction action, RootVisibility rootVisibility) + { + bool markMethod; + switch (rootVisibility) { + default: + markMethod = true; + break; + + case RootVisibility.PublicAndFamily: + markMethod = method.IsPublic || method.IsFamily || method.IsFamilyOrAssembly; + break; + + case RootVisibility.PublicAndFamilyAndAssembly: + markMethod = method.IsPublic || method.IsFamily || method.IsFamilyOrAssembly || method.IsAssembly || method.IsFamilyAndAssembly; + break; + } + + if (markMethod) { + context.Annotations.Mark (method); + context.Annotations.SetAction (method, action); + } + } + + static bool HasInternalsVisibleTo (AssemblyDefinition assembly) + { + foreach (CustomAttribute attribute in assembly.CustomAttributes) { + if (attribute.Constructor.DeclaringType.FullName == + "System.Runtime.CompilerServices.InternalsVisibleToAttribute") + return true; + } + + return false; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromXApiStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromXApiStep.cs new file mode 100644 index 000000000000..3d4f7099cea1 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromXApiStep.cs @@ -0,0 +1,138 @@ +// +// ResolveFromXApiStep.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Xml.XPath; + +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class ResolveFromXApiStep : ResolveStep, IXApiVisitor { + + static readonly string _name = "name"; + static readonly string _ns = string.Empty; + + XPathDocument _document; + + public ResolveFromXApiStep (XPathDocument document) + { + _document = document; + } + + protected override void Process () + { + XApiReader reader = new XApiReader (_document, this); + reader.Process (Context); + } + + public void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly) + { + } + + public void OnAttribute (XPathNavigator nav) + { + string name = GetName (nav); + + TypeDefinition type = Context.GetType (name); + if (type is not null) + MarkType (type); + } + + public void OnClass (XPathNavigator nav, TypeDefinition type) + { + MarkType (type); + } + + public void OnInterface (XPathNavigator nav, TypeDefinition type) + { + MarkType (type); + } + + public void OnField (XPathNavigator nav, FieldDefinition field) + { + MarkField (field); + } + + public void OnMethod (XPathNavigator nav, MethodDefinition method) + { + MarkMethod (method); + } + + public void OnConstructor (XPathNavigator nav, MethodDefinition method) + { + MarkMethod (method); + } + + public void OnProperty (XPathNavigator nav, PropertyDefinition property) + { + } + + public void OnEvent (XPathNavigator nav, EventDefinition evt) + { + if (evt.AddMethod is not null) + MarkMethod (evt.AddMethod); + if (evt.InvokeMethod is not null) + MarkMethod (evt.InvokeMethod); + if (evt.RemoveMethod is not null) + MarkMethod (evt.RemoveMethod); + } + + static string GetName (XPathNavigator nav) + { + return GetAttribute (nav, _name); + } + + static string GetAttribute (XPathNavigator nav, string attribute) + { + return nav.GetAttribute (attribute, _ns); + } + + void MarkType (TypeDefinition type) + { + InternalMark (type); + } + + void MarkField (FieldDefinition field) + { + InternalMark (field); + } + + void InternalMark (IMetadataTokenProvider provider) + { + Annotations.Mark (provider); + Annotations.SetPublic (provider); + } + + void MarkMethod (MethodDefinition method) + { + InternalMark (method); + Annotations.MarkIndirectlyCalledMethod (method); + Annotations.SetAction (method, MethodAction.Parse); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromXmlStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromXmlStep.cs new file mode 100644 index 000000000000..8f794173b839 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveFromXmlStep.cs @@ -0,0 +1,727 @@ +// +// ResolveFromXmlStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// (C) 2007 Novell, Inc. +// Copyright 2013 Xamarin Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml.XPath; + +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class XmlResolutionException : Exception { + public XmlResolutionException (string message, Exception innerException) + : base (message, innerException) + { + } + } + + public class ResolveFromXmlStep : ResolveStep { + + static readonly string _signature = "signature"; + static readonly string _fullname = "fullname"; + static readonly string _required = "required"; + static readonly string _preserve = "preserve"; + static readonly string _accessors = "accessors"; + static readonly string _ns = string.Empty; + + static readonly string [] _accessorsAll = new string [] { "all" }; + static readonly char [] _accessorsSep = new char [] { ';' }; + + XPathDocument _document; + string _xmlDocumentLocation; + string _resourceName; + AssemblyDefinition _resourceAssembly; + + public ResolveFromXmlStep (XPathDocument document, string xmlDocumentLocation = "") + { + _document = document; + _xmlDocumentLocation = xmlDocumentLocation; + } + + public ResolveFromXmlStep (XPathDocument document, string resourceName, AssemblyDefinition resourceAssembly, string xmlDocumentLocation = "") + : this (document, xmlDocumentLocation) + { + if (string.IsNullOrEmpty (resourceName)) + throw new ArgumentNullException (nameof (resourceName)); + + if (resourceAssembly is null) + throw new ArgumentNullException (nameof (resourceAssembly)); + + _resourceName = resourceName; + _resourceAssembly = resourceAssembly; + } + + protected override void Process () + { + XPathNavigator nav = _document.CreateNavigator (); + + // This step can be created with XML files that aren't necessarily + // linker descriptor files. So bail if we don't have a element. + if (!nav.MoveToChild ("linker", _ns)) + return; + + try { + ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns)); + + if (!string.IsNullOrEmpty (_resourceName) && Context.StripResources) + Context.Annotations.AddResourceToRemove (_resourceAssembly, _resourceName); + } catch (Exception ex) when (!(ex is XmlResolutionException)) { + throw new XmlResolutionException (string.Format ("Failed to process XML description: {0}", _xmlDocumentLocation), ex); + } + } + + protected virtual void ProcessAssemblies (LinkContext context, XPathNodeIterator iterator) + { + while (iterator.MoveNext ()) { + AssemblyDefinition assembly = GetAssembly (context, GetAssemblyName (iterator.Current)); + if (assembly is not null) + ProcessAssembly (assembly, iterator); + } + } + + protected virtual void ProcessAssembly (AssemblyDefinition assembly, XPathNodeIterator iterator) + { + if (IsExcluded (iterator.Current)) + return; + + Tracer.Push (assembly); + if (GetTypePreserve (iterator.Current) == TypePreserve.All) { + foreach (var type in assembly.MainModule.Types) + MarkAndPreserveAll (type); + } else { + ProcessTypes (assembly, iterator.Current.SelectChildren ("type", _ns)); + ProcessNamespaces (assembly, iterator.Current.SelectChildren ("namespace", _ns)); + } + Tracer.Pop (); + } + + void ProcessNamespaces (AssemblyDefinition assembly, XPathNodeIterator iterator) + { + while (iterator.MoveNext ()) { + string fullname = GetFullName (iterator.Current); + foreach (TypeDefinition type in assembly.MainModule.Types) { + if (type.Namespace != fullname) + continue; + + MarkAndPreserveAll (type); + } + } + } + + void MarkAndPreserveAll (TypeDefinition type) + { + Annotations.MarkAndPush (type); + Annotations.SetPreserve (type, TypePreserve.All); + + if (!type.HasNestedTypes) { + Tracer.Pop (); + return; + } + + foreach (TypeDefinition nested in type.NestedTypes) + MarkAndPreserveAll (nested); + + Tracer.Pop (); + } + + void ProcessTypes (AssemblyDefinition assembly, XPathNodeIterator iterator) + { + while (iterator.MoveNext ()) { + XPathNavigator nav = iterator.Current; + + string fullname = GetFullName (nav); + + if (IsTypePattern (fullname)) { + ProcessTypePattern (fullname, assembly, nav); + continue; + } + + TypeDefinition type = assembly.MainModule.GetType (fullname); + + if (type is null) { + if (assembly.MainModule.HasExportedTypes) { + foreach (var exported in assembly.MainModule.ExportedTypes) { + if (fullname == exported.FullName) { + Tracer.Push (exported); + MarkingHelpers.MarkExportedType (exported, assembly.MainModule); + var resolvedExternal = exported.Resolve (); + Tracer.Pop (); + if (resolvedExternal is not null) { + type = resolvedExternal; + break; + } + } + } + } + } + + if (type is null) + continue; + + ProcessType (type, nav); + } + } + + static bool IsTypePattern (string fullname) + { + return fullname.IndexOf ("*") != -1; + } + + static Regex CreateRegexFromPattern (string pattern) + { + return new Regex (pattern.Replace (".", @"\.").Replace ("*", "(.*)")); + } + + void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav) + { + if (regex.Match (type.FullName).Success) + ProcessType (type, nav); + + if (!type.HasNestedTypes) + return; + + foreach (var nt in type.NestedTypes) + MatchType (nt, regex, nav); + } + + void MatchExportedType (ExportedType exportedType, ModuleDefinition module, Regex regex, XPathNavigator nav) + { + if (regex.Match (exportedType.FullName).Success) { + MarkingHelpers.MarkExportedType (exportedType, module); + TypeDefinition type = exportedType.Resolve (); + if (type is not null) { + ProcessType (type, nav); + } + } + } + + + void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav) + { + Regex regex = CreateRegexFromPattern (fullname); + + foreach (TypeDefinition type in assembly.MainModule.Types) { + MatchType (type, regex, nav); + } + + if (assembly.MainModule.HasExportedTypes) { + foreach (var exported in assembly.MainModule.ExportedTypes) { + MatchExportedType (exported, assembly.MainModule, regex, nav); + } + } + } + + protected virtual void ProcessType (TypeDefinition type, XPathNavigator nav) + { + if (IsExcluded (nav)) + return; + + TypePreserve preserve = GetTypePreserve (nav); + + if (!IsRequired (nav)) { + Annotations.SetPreserve (type, preserve); + return; + } + + if (Annotations.IsMarked (type)) { + var existingLevel = Annotations.TryGetPreserve (type, out TypePreserve existingPreserve) ? existingPreserve : TypePreserve.Nothing; + var duplicateLevel = preserve != TypePreserve.Nothing ? preserve : nav.HasChildren ? TypePreserve.Nothing : TypePreserve.All; + Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {type.FullName} ({existingLevel}). Duplicate uses ({duplicateLevel})"); + } + + Annotations.MarkAndPush (type); + Tracer.AddDirectDependency (this, type); + + if (type.IsNested) { + var parent = type; + while (parent.IsNested) { + parent = parent.DeclaringType; + Annotations.Mark (parent); + } + } + + if (preserve != TypePreserve.Nothing) + Annotations.SetPreserve (type, preserve); + + if (nav.HasChildren) { + MarkSelectedFields (nav, type); + MarkSelectedMethods (nav, type); + MarkSelectedEvents (nav, type); + MarkSelectedProperties (nav, type); + } + Tracer.Pop (); + } + + void MarkSelectedFields (XPathNavigator nav, TypeDefinition type) + { + XPathNodeIterator fields = nav.SelectChildren ("field", _ns); + if (fields.Count == 0) + return; + + ProcessFields (type, fields); + } + + void MarkSelectedMethods (XPathNavigator nav, TypeDefinition type) + { + XPathNodeIterator methods = nav.SelectChildren ("method", _ns); + if (methods.Count == 0) + return; + + ProcessMethods (type, methods); + } + + void MarkSelectedEvents (XPathNavigator nav, TypeDefinition type) + { + XPathNodeIterator events = nav.SelectChildren ("event", _ns); + if (events.Count == 0) + return; + + ProcessEvents (type, events); + } + + void MarkSelectedProperties (XPathNavigator nav, TypeDefinition type) + { + XPathNodeIterator properties = nav.SelectChildren ("property", _ns); + if (properties.Count == 0) + return; + + ProcessProperties (type, properties); + } + + static TypePreserve GetTypePreserve (XPathNavigator nav) + { + string attribute = GetAttribute (nav, _preserve); + if (string.IsNullOrEmpty (attribute)) + return nav.HasChildren ? TypePreserve.Nothing : TypePreserve.All; + + TypePreserve result; + if (Enum.TryParse (attribute, true, out result)) + return result; + return TypePreserve.Nothing; + } + + void ProcessFields (TypeDefinition type, XPathNodeIterator iterator) + { + while (iterator.MoveNext ()) + ProcessField (type, iterator); + } + + protected virtual void ProcessField (TypeDefinition type, XPathNodeIterator iterator) + { + if (IsExcluded (iterator.Current)) + return; + + string value = GetSignature (iterator.Current); + if (!String.IsNullOrEmpty (value)) + ProcessFieldSignature (type, value); + + value = GetAttribute (iterator.Current, "name"); + if (!String.IsNullOrEmpty (value)) + ProcessFieldName (type, value); + } + + void ProcessFieldSignature (TypeDefinition type, string signature) + { + FieldDefinition field = GetField (type, signature); + MarkField (type, field, signature); + } + + void MarkField (TypeDefinition type, FieldDefinition field, string signature) + { + if (field is not null) { + if (Annotations.IsMarked (field)) + Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {field.FullName}"); + + Annotations.Mark (field); + } else { + AddUnresolveMarker (string.Format ("T: {0}; F: {1}", type, signature)); + } + } + + void ProcessFieldName (TypeDefinition type, string name) + { + if (!type.HasFields) + return; + + foreach (FieldDefinition field in type.Fields) + if (field.Name == name) + MarkField (type, field, name); + } + + protected static FieldDefinition GetField (TypeDefinition type, string signature) + { + if (!type.HasFields) + return null; + + foreach (FieldDefinition field in type.Fields) + if (signature == GetFieldSignature (field)) + return field; + + return null; + } + + static string GetFieldSignature (FieldDefinition field) + { + return field.FieldType.FullName + " " + field.Name; + } + + void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator) + { + while (iterator.MoveNext ()) + ProcessMethod (type, iterator); + } + + protected virtual void ProcessMethod (TypeDefinition type, XPathNodeIterator iterator) + { + if (IsExcluded (iterator.Current)) + return; + + string value = GetSignature (iterator.Current); + if (!String.IsNullOrEmpty (value)) + ProcessMethodSignature (type, value); + + value = GetAttribute (iterator.Current, "name"); + if (!String.IsNullOrEmpty (value)) + ProcessMethodName (type, value); + } + + void ProcessMethodSignature (TypeDefinition type, string signature) + { + MethodDefinition meth = GetMethod (type, signature); + MarkMethod (type, meth, signature); + } + + void MarkMethod (TypeDefinition type, MethodDefinition method, string signature) + { + if (method is not null) { + MarkMethod (method); + } else + AddUnresolveMarker (string.Format ("T: {0}; M: {1}", type, signature)); + } + + void MarkMethod (MethodDefinition method) + { + if (Annotations.IsMarked (method)) + Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {method.FullName}"); + + Annotations.Mark (method); + Annotations.MarkIndirectlyCalledMethod (method); + Tracer.AddDirectDependency (this, method); + Annotations.SetAction (method, MethodAction.Parse); + } + + void MarkMethodIfNotNull (MethodDefinition method) + { + if (method is null) + return; + + MarkMethod (method); + } + + void ProcessMethodName (TypeDefinition type, string name) + { + if (!type.HasMethods) + return; + + foreach (MethodDefinition method in type.Methods) + if (name == method.Name) + MarkMethod (type, method, name); + } + + protected static MethodDefinition GetMethod (TypeDefinition type, string signature) + { + if (type.HasMethods) + foreach (MethodDefinition meth in type.Methods) + if (signature == GetMethodSignature (meth, false)) + return meth; + + return null; + } + + public static string GetMethodSignature (MethodDefinition meth, bool includeGenericParameters) + { + StringBuilder sb = new StringBuilder (); + sb.Append (meth.ReturnType.FullName); + sb.Append (" "); + sb.Append (meth.Name); + if (includeGenericParameters && meth.HasGenericParameters) { + sb.Append ("`"); + sb.Append (meth.GenericParameters.Count); + } + + sb.Append ("("); + if (meth.HasParameters) { + for (int i = 0; i < meth.Parameters.Count; i++) { + if (i > 0) + sb.Append (","); + + sb.Append (meth.Parameters [i].ParameterType.FullName); + } + } + sb.Append (")"); + return sb.ToString (); + } + + void ProcessEvents (TypeDefinition type, XPathNodeIterator iterator) + { + while (iterator.MoveNext ()) + ProcessEvent (type, iterator); + } + + protected virtual void ProcessEvent (TypeDefinition type, XPathNodeIterator iterator) + { + if (IsExcluded (iterator.Current)) + return; + + string value = GetSignature (iterator.Current); + if (!String.IsNullOrEmpty (value)) + ProcessEventSignature (type, value); + + value = GetAttribute (iterator.Current, "name"); + if (!String.IsNullOrEmpty (value)) + ProcessEventName (type, value); + } + + void ProcessEventSignature (TypeDefinition type, string signature) + { + EventDefinition @event = GetEvent (type, signature); + MarkEvent (type, @event, signature); + } + + void MarkEvent (TypeDefinition type, EventDefinition @event, string signature) + { + if (@event is not null) { + if (Annotations.IsMarked (@event)) + Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {@event.FullName}"); + + Annotations.Mark (@event); + + MarkMethod (@event.AddMethod); + MarkMethod (@event.RemoveMethod); + MarkMethodIfNotNull (@event.InvokeMethod); + } else + AddUnresolveMarker (string.Format ("T: {0}; E: {1}", type, signature)); + } + + void ProcessEventName (TypeDefinition type, string name) + { + if (!type.HasEvents) + return; + + foreach (EventDefinition @event in type.Events) + if (@event.Name == name) + MarkEvent (type, @event, name); + } + + protected static EventDefinition GetEvent (TypeDefinition type, string signature) + { + if (!type.HasEvents) + return null; + + foreach (EventDefinition @event in type.Events) + if (signature == GetEventSignature (@event)) + return @event; + + return null; + } + + static string GetEventSignature (EventDefinition @event) + { + return @event.EventType.FullName + " " + @event.Name; + } + + void ProcessProperties (TypeDefinition type, XPathNodeIterator iterator) + { + while (iterator.MoveNext ()) + ProcessProperty (type, iterator); + } + + protected virtual void ProcessProperty (TypeDefinition type, XPathNodeIterator iterator) + { + if (IsExcluded (iterator.Current)) + return; + + string value = GetSignature (iterator.Current); + if (!String.IsNullOrEmpty (value)) + ProcessPropertySignature (type, value, GetAccessors (iterator.Current)); + + value = GetAttribute (iterator.Current, "name"); + if (!String.IsNullOrEmpty (value)) + ProcessPropertyName (type, value, _accessorsAll); + } + + void ProcessPropertySignature (TypeDefinition type, string signature, string [] accessors) + { + PropertyDefinition property = GetProperty (type, signature); + MarkProperty (type, property, signature, accessors); + } + + void MarkProperty (TypeDefinition type, PropertyDefinition property, string signature, string [] accessors) + { + if (property is not null) { + if (Annotations.IsMarked (property)) + Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {property.FullName}"); + + Annotations.Mark (property); + + MarkPropertyAccessors (type, property, accessors); + } else + AddUnresolveMarker (string.Format ("T: {0}; P: {1}", type, signature)); + } + + void MarkPropertyAccessors (TypeDefinition type, PropertyDefinition property, string [] accessors) + { + if (Array.IndexOf (accessors, "all") >= 0) { + MarkMethodIfNotNull (property.GetMethod); + MarkMethodIfNotNull (property.SetMethod); + + return; + } + if (property.GetMethod is not null + && Array.IndexOf (accessors, "get") >= 0) + MarkMethod (property.GetMethod); + else if (property.GetMethod is null) + AddUnresolveMarker (string.Format ("T: {0}' M: {1} get_{2}", type, property.PropertyType, property.Name)); + + if (property.SetMethod is not null + && Array.IndexOf (accessors, "set") >= 0) + MarkMethod (property.SetMethod); + else if (property.SetMethod is null) + AddUnresolveMarker (string.Format ("T: {0}' M: System.Void set_{2} ({1})", type, property.PropertyType, property.Name)); + } + + void ProcessPropertyName (TypeDefinition type, string name, string [] accessors) + { + if (!type.HasProperties) + return; + + foreach (PropertyDefinition property in type.Properties) + if (property.Name == name) + MarkProperty (type, property, name, accessors); + } + + protected static PropertyDefinition GetProperty (TypeDefinition type, string signature) + { + if (!type.HasProperties) + return null; + + foreach (PropertyDefinition property in type.Properties) + if (signature == GetPropertySignature (property)) + return property; + + return null; + } + + static string GetPropertySignature (PropertyDefinition property) + { + return property.PropertyType.FullName + " " + property.Name; + } + + protected AssemblyDefinition GetAssembly (LinkContext context, AssemblyNameReference assemblyName) + { + var assembly = context.Resolve (assemblyName); + ProcessReferences (assembly, context); + return assembly; + } + + protected virtual AssemblyNameReference GetAssemblyName (XPathNavigator nav) + { + return AssemblyNameReference.Parse (GetFullName (nav)); + } + + static void ProcessReferences (AssemblyDefinition assembly, LinkContext context) + { + context.ResolveReferences (assembly); + } + + static bool IsRequired (XPathNavigator nav) + { + string attribute = GetAttribute (nav, _required); + if (attribute is null || attribute.Length == 0) + return true; + + bool result; + if (bool.TryParse (attribute, out result)) + return result; + return false; + } + + protected static string GetSignature (XPathNavigator nav) + { + return GetAttribute (nav, _signature); + } + + static string GetFullName (XPathNavigator nav) + { + return GetAttribute (nav, _fullname); + } + + protected static string [] GetAccessors (XPathNavigator nav) + { + string accessorsValue = GetAttribute (nav, _accessors); + + if (accessorsValue is not null) { + string [] accessors = accessorsValue.Split ( + _accessorsSep, StringSplitOptions.RemoveEmptyEntries); + + if (accessors.Length > 0) { + for (int i = 0; i < accessors.Length; ++i) + accessors [i] = accessors [i].ToLower (); + + return accessors; + } + } + return _accessorsAll; + } + + protected static string GetAttribute (XPathNavigator nav, string attribute) + { + return nav.GetAttribute (attribute, _ns); + } + + protected virtual bool IsExcluded (XPathNavigator nav) + { + var value = GetAttribute (nav, "feature"); + if (string.IsNullOrEmpty (value)) + return false; + + return Context.IsFeatureExcluded (value); + } + + + public override string ToString () + { + return "ResolveFromXmlStep: " + _xmlDocumentLocation; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveStep.cs new file mode 100644 index 000000000000..604728bef247 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/ResolveStep.cs @@ -0,0 +1,56 @@ +// +// ResolveStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Collections.Generic; + +namespace Mono.Linker.Steps { + + public abstract class ResolveStep : BaseStep { + + readonly List _unResolved; + + protected ResolveStep () + { + _unResolved = new List (); + } + + public bool AllMarkerResolved { + get { return _unResolved.Count == 0; } + } + + public string [] GetUnresolvedMarkers () + { + return _unResolved.ToArray (); + } + + protected void AddUnresolveMarker (string signature) + { + _unResolved.Add (signature); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/SweepStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/SweepStep.cs new file mode 100644 index 000000000000..dd1e411be8c1 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/SweepStep.cs @@ -0,0 +1,714 @@ +// +// SweepStep.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Collections.Generic; +using System.Linq; +using Mono.Cecil; +using Mono.Collections.Generic; +using Mono.Cecil.Cil; + +namespace Mono.Linker.Steps { + + public class SweepStep : BaseStep { + AssemblyDefinition [] assemblies; + readonly bool sweepSymbols; + readonly HashSet BypassNGenToSave = new HashSet (); + + public SweepStep (bool sweepSymbols = true) + { + this.sweepSymbols = sweepSymbols; + } + + protected override void Process () + { + assemblies = Context.Annotations.GetAssemblies ().ToArray (); + + foreach (var assembly in assemblies) { + RemoveUnusedAssembly (assembly); + } + + foreach (var assembly in assemblies) { + ProcessAssemblyAction (assembly); + } + } + + void RemoveUnusedAssembly (AssemblyDefinition assembly) + { + switch (Annotations.GetAction (assembly)) { + case AssemblyAction.AddBypassNGenUsed: + case AssemblyAction.CopyUsed: + case AssemblyAction.Link: + if (!IsUsedAssembly (assembly)) + RemoveAssembly (assembly); + + break; + } + } + + protected void ProcessAssemblyAction (AssemblyDefinition assembly) + { + switch (Annotations.GetAction (assembly)) { + case AssemblyAction.AddBypassNGenUsed: + Annotations.SetAction (assembly, AssemblyAction.AddBypassNGen); + goto case AssemblyAction.AddBypassNGen; + + case AssemblyAction.AddBypassNGen: + // FIXME: AddBypassNGen is just wrong, it should not be action as we need to + // turn it to Action.Save here to e.g. correctly update debug symbols + if (!Context.KeepTypeForwarderOnlyAssemblies || BypassNGenToSave.Contains (assembly)) { + goto case AssemblyAction.Save; + } + + break; + + case AssemblyAction.CopyUsed: + Annotations.SetAction (assembly, AssemblyAction.Copy); + goto case AssemblyAction.Copy; + + case AssemblyAction.Copy: + // + // Facade assemblies can have unused forwarders pointing to + // removed type (when facades are kept) + // + // main.exe -> facade.dll -> lib.dll + // link | copy | link + // + // when main.exe has unused reference to type in lib.dll + // + if (SweepTypeForwarders (assembly)) + Annotations.SetAction (assembly, AssemblyAction.Save); + + break; + + case AssemblyAction.Link: + SweepAssembly (assembly); + break; + + case AssemblyAction.Save: + // + // Save means we need to rewrite the assembly due to removed assembly + // reference. We do any additional removed assembly reference clean up here + // + UpdateForwardedTypesScope (assembly); + UpdateCustomAttributesTypesScopes (assembly); + SweepTypeForwarders (assembly); + break; + } + } + + protected virtual void SweepAssembly (AssemblyDefinition assembly) + { + var types = new List (); + + foreach (TypeDefinition type in assembly.MainModule.Types) { + if (Annotations.IsMarked (type)) { + SweepType (type); + types.Add (type); + continue; + } + + if (type.Name == "") + types.Add (type); + else + ElementRemoved (type); + } + + assembly.MainModule.Types.Clear (); + foreach (TypeDefinition type in types) + assembly.MainModule.Types.Add (type); + + SweepResources (assembly); + SweepCustomAttributes (assembly); + + foreach (var module in assembly.Modules) + SweepCustomAttributes (module); + + SweepTypeForwarders (assembly); + + UpdateForwardedTypesScope (assembly); + } + + bool IsUsedAssembly (AssemblyDefinition assembly) + { + if (IsMarkedAssembly (assembly)) + return true; + + if (assembly.MainModule.HasExportedTypes && Context.KeepTypeForwarderOnlyAssemblies) + return true; + + return false; + } + + bool IsMarkedAssembly (AssemblyDefinition assembly) + { + return Annotations.IsMarked (assembly.MainModule); + } + + protected virtual void RemoveAssembly (AssemblyDefinition assembly) + { + Annotations.SetAction (assembly, AssemblyAction.Delete); + + foreach (var a in assemblies) { + switch (Annotations.GetAction (a)) { + case AssemblyAction.Skip: + case AssemblyAction.Delete: + continue; + } + + SweepReferences (a, assembly); + } + } + + void SweepResources (AssemblyDefinition assembly) + { + var resourcesToRemove = Annotations.GetResourcesToRemove (assembly); + if (resourcesToRemove is not null) { + var resources = assembly.MainModule.Resources; + + for (int i = 0; i < resources.Count; i++) { + var resource = resources [i] as EmbeddedResource; + if (resource is null) + continue; + + if (resourcesToRemove.Contains (resource.Name)) + resources.RemoveAt (i--); + } + } + } + + void SweepReferences (AssemblyDefinition assembly, AssemblyDefinition referenceToRemove) + { + if (assembly == referenceToRemove) + return; + + bool reference_removed = false; + + var references = assembly.MainModule.AssemblyReferences; + for (int i = 0; i < references.Count; i++) { + var reference = references [i]; + + AssemblyDefinition ad = Context.Resolver.Resolve (reference); + if (ad is null || !AreSameReference (ad.Name, referenceToRemove.Name)) + continue; + + ReferenceRemoved (assembly, reference); + references.RemoveAt (i--); + reference_removed = true; + } + + if (reference_removed) { + switch (Annotations.GetAction (assembly)) { + case AssemblyAction.CopyUsed: + if (IsUsedAssembly (assembly)) { + goto case AssemblyAction.Copy; + } + break; + + case AssemblyAction.Copy: + // + // Assembly has a reference to another assembly which has been fully removed. This can + // happen when for example the reference assembly is 'copy-used' and it's not needed. + // + // or + // + // Assembly can contain type references with + // type forwarders to deleted assembly (facade) when + // facade assemblies are not kept. For that reason we need to + // rewrite the copy to save to update the scopes not to point + // forwarding assembly (facade). + // + // foo.dll -> facade.dll -> lib.dll + // copy | copy (delete) | link + // + Annotations.SetAction (assembly, AssemblyAction.Save); + break; + + case AssemblyAction.AddBypassNGenUsed: + if (IsUsedAssembly (assembly)) { + Annotations.SetAction (assembly, AssemblyAction.AddBypassNGen); + goto case AssemblyAction.AddBypassNGen; + } + break; + + case AssemblyAction.AddBypassNGen: + BypassNGenToSave.Add (assembly); + break; + } + } + } + + bool SweepTypeForwarders (AssemblyDefinition assembly) + { + if (assembly.MainModule.HasExportedTypes) { + return SweepCollectionMetadata (assembly.MainModule.ExportedTypes); + } + + return false; + } + + void UpdateForwardedTypesScope (AssemblyDefinition assembly) + { + var changed_types = new Dictionary (); + + foreach (TypeReference tr in assembly.MainModule.GetTypeReferences ()) { + if (tr.IsWindowsRuntimeProjection) + continue; + + TypeDefinition td; + try { + td = tr.Resolve (); + } catch (AssemblyResolutionException) { + // Don't crash on unresolved assembly + continue; + } + + // at this stage reference might include things that can't be resolved + // and if it is (resolved) it needs to be kept only if marked (#16213) + if (td is null || !Annotations.IsMarked (td)) + continue; + + IMetadataScope scope = assembly.MainModule.ImportReference (td).Scope; + if (tr.Scope != scope) + changed_types.Add (tr, scope); + } + + // + // Resolved everything first before updating scopes. + // If we set the scope to null, then calling Resolve() on any of its + // nested types would crash. + // + foreach (var e in changed_types) { + e.Key.Scope = e.Value; + } + + if (assembly.MainModule.HasExportedTypes) { + foreach (var et in assembly.MainModule.ExportedTypes) { + var td = et.Resolve (); + if (td is null) + continue; + + et.Scope = assembly.MainModule.ImportReference (td).Scope; + } + } + } + + static void UpdateCustomAttributesTypesScopes (AssemblyDefinition assembly) + { + UpdateCustomAttributesTypesScopes ((ICustomAttributeProvider) assembly); + + foreach (var module in assembly.Modules) + UpdateCustomAttributesTypesScopes (module); + + foreach (var type in assembly.MainModule.Types) + UpdateCustomAttributesTypesScopes (type); + } + + static void UpdateCustomAttributesTypesScopes (TypeDefinition typeDefinition) + { + UpdateCustomAttributesTypesScopes ((ICustomAttributeProvider) typeDefinition); + + if (typeDefinition.HasEvents) + UpdateCustomAttributesTypesScopes (typeDefinition.Events); + + if (typeDefinition.HasFields) + UpdateCustomAttributesTypesScopes (typeDefinition.Fields); + + if (typeDefinition.HasMethods) + UpdateCustomAttributesTypesScopes (typeDefinition.Methods); + + if (typeDefinition.HasProperties) + UpdateCustomAttributesTypesScopes (typeDefinition.Properties); + + if (typeDefinition.HasGenericParameters) + UpdateCustomAttributesTypesScopes (typeDefinition.GenericParameters); + + if (typeDefinition.HasNestedTypes) { + foreach (var nestedType in typeDefinition.NestedTypes) { + UpdateCustomAttributesTypesScopes (nestedType); + } + } + } + + static void UpdateCustomAttributesTypesScopes (Collection providers) where T : ICustomAttributeProvider + { + foreach (var provider in providers) + UpdateCustomAttributesTypesScopes (provider); + } + + static void UpdateCustomAttributesTypesScopes (Collection genericParameters) + { + foreach (var gp in genericParameters) { + UpdateCustomAttributesTypesScopes (gp); + + if (gp.HasConstraints) + UpdateCustomAttributesTypesScopes (gp.Constraints); + } + } + + static void UpdateCustomAttributesTypesScopes (ICustomAttributeProvider customAttributeProvider) + { + if (!customAttributeProvider.HasCustomAttributes) + return; + + foreach (var ca in customAttributeProvider.CustomAttributes) + UpdateForwardedTypesScope (ca); + } + + static void UpdateForwardedTypesScope (CustomAttribute attribute) + { + AssemblyDefinition assembly = attribute.Constructor.Module.Assembly; + + if (attribute.HasConstructorArguments) { + foreach (var ca in attribute.ConstructorArguments) + UpdateForwardedTypesScope (ca, assembly); + } + + if (attribute.HasFields) { + foreach (var field in attribute.Fields) + UpdateForwardedTypesScope (field.Argument, assembly); + } + + if (attribute.HasProperties) { + foreach (var property in attribute.Properties) + UpdateForwardedTypesScope (property.Argument, assembly); + } + } + + static void UpdateForwardedTypesScope (CustomAttributeArgument attributeArgument, AssemblyDefinition assembly) + { + UpdateTypeScope (attributeArgument.Type, assembly); + + switch (attributeArgument.Value) { + case TypeReference tr: + UpdateTypeScope (tr, assembly); + break; + case CustomAttributeArgument caa: + UpdateForwardedTypesScope (caa, assembly); + break; + case CustomAttributeArgument [] array: + foreach (var item in array) + UpdateForwardedTypesScope (item, assembly); + break; + } + } + + static void UpdateTypeScope (TypeReference type, AssemblyDefinition assembly) + { + // Can't update the scope of windows runtime projections + if (type.IsWindowsRuntimeProjection) + return; + + if (type is GenericInstanceType git && git.HasGenericArguments) { + UpdateTypeScope (git.ElementType, assembly); + foreach (var ga in git.GenericArguments) + UpdateTypeScope (ga, assembly); + return; + } + + if (type is ArrayType at) { + UpdateTypeScope (at.ElementType, assembly); + return; + } + + TypeDefinition td = type.Resolve (); + if (td is null) + return; + + IMetadataScope scope = assembly.MainModule.ImportReference (td).Scope; + if (type.Scope != scope) + type.Scope = td.Scope; + } + + protected virtual void SweepType (TypeDefinition type) + { + if (type.HasFields) + SweepCollectionWithCustomAttributes (type.Fields); + + if (type.HasMethods) + SweepMethods (type.Methods); + + if (type.HasNestedTypes) + SweepNestedTypes (type); + + if (type.HasInterfaces) + SweepInterfaces (type); + + if (type.HasCustomAttributes) + SweepCustomAttributes (type); + + if (type.HasGenericParameters) + SweepGenericParameters (type.GenericParameters); + + if (type.HasProperties) + SweepCustomAttributeCollection (type.Properties); + + if (type.HasEvents) + SweepCustomAttributeCollection (type.Events); + + if (type.HasFields && !type.IsBeforeFieldInit && !Annotations.HasPreservedStaticCtor (type) && !type.IsEnum) + type.IsBeforeFieldInit = true; + } + + protected void SweepNestedTypes (TypeDefinition type) + { + for (int i = 0; i < type.NestedTypes.Count; i++) { + var nested = type.NestedTypes [i]; + if (Annotations.IsMarked (nested)) { + SweepType (nested); + } else { + ElementRemoved (type.NestedTypes [i]); + type.NestedTypes.RemoveAt (i--); + } + } + } + + protected void SweepInterfaces (TypeDefinition type) + { + for (int i = type.Interfaces.Count - 1; i >= 0; i--) { + var iface = type.Interfaces [i]; + if (Annotations.IsMarked (iface)) { + SweepCustomAttributes (iface); + continue; + } + InterfaceRemoved (type, iface); + type.Interfaces.RemoveAt (i); + } + } + + protected void SweepGenericParameters (Collection genericParameters) + { + foreach (var gp in genericParameters) { + SweepCustomAttributes (gp); + + if (gp.HasConstraints) + SweepCustomAttributeCollection (gp.Constraints); + } + } + + protected void SweepCustomAttributes (TypeDefinition type) + { + var removed = SweepCustomAttributes (type as ICustomAttributeProvider); + + if (ShouldSetHasSecurityToFalse (type, type, type.HasSecurity, removed)) + type.HasSecurity = false; + } + + protected void SweepCustomAttributes (MethodDefinition method) + { + var removed = SweepCustomAttributes (method as ICustomAttributeProvider); + + if (ShouldSetHasSecurityToFalse (method, method, method.HasSecurity, removed)) + method.HasSecurity = false; + } + + bool ShouldSetHasSecurityToFalse (ISecurityDeclarationProvider providerAsSecurity, ICustomAttributeProvider provider, bool existingHasSecurity, IList removedAttributes) + { + if (existingHasSecurity && removedAttributes.Count > 0 && !providerAsSecurity.HasSecurityDeclarations) { + // If the method or type had security before and all attributes were removed, or no remaining attributes are security attributes, + // then we need to set HasSecurity to false + if (provider.CustomAttributes.Count == 0 || provider.CustomAttributes.All (attr => !IsSecurityAttributeType (attr.AttributeType.Resolve ()))) + return true; + } + + return false; + } + + static bool IsSecurityAttributeType (TypeDefinition definition) + { + if (definition is null) + return false; + + if (definition.Namespace == "System.Security") { + switch (definition.FullName) { + // This seems to be one attribute in the System.Security namespace that doesn't count + // as an attribute that requires HasSecurity to be true + case "System.Security.SecurityCriticalAttribute": + return false; + } + + return true; + } + + if (definition.BaseType is null) + return false; + + return IsSecurityAttributeType (definition.BaseType.Resolve ()); + } + + protected IList SweepCustomAttributes (ICustomAttributeProvider provider) + { + var removed = new List (); + + for (int i = provider.CustomAttributes.Count - 1; i >= 0; i--) { + var attribute = provider.CustomAttributes [i]; + if (Annotations.IsMarked (attribute)) { + UpdateForwardedTypesScope (attribute); + } else { + CustomAttributeUsageRemoved (provider, attribute); + removed.Add (provider.CustomAttributes [i]); + provider.CustomAttributes.RemoveAt (i); + } + } + + return removed; + } + + protected void SweepCustomAttributeCollection (Collection providers) where T : ICustomAttributeProvider + { + foreach (var provider in providers) + SweepCustomAttributes (provider); + } + + protected virtual void SweepMethods (Collection methods) + { + SweepCollectionWithCustomAttributes (methods); + if (sweepSymbols) + SweepDebugInfo (methods); + + foreach (var method in methods) { + if (method.HasGenericParameters) + SweepGenericParameters (method.GenericParameters); + + SweepCustomAttributes (method.MethodReturnType); + + if (!method.HasParameters) + continue; + + foreach (var parameter in method.Parameters) + SweepCustomAttributes (parameter); + } + } + + void SweepDebugInfo (Collection methods) + { + List sweptScopes = null; + foreach (var m in methods) { + if (m.DebugInformation is null) + continue; + + var scope = m.DebugInformation.Scope; + if (scope is null) + continue; + + if (sweptScopes is null) { + sweptScopes = new List (); + } else if (sweptScopes.Contains (scope)) { + continue; + } + + sweptScopes.Add (scope); + + if (scope.HasConstants) { + var constants = scope.Constants; + for (int i = 0; i < constants.Count; ++i) { + if (!Annotations.IsMarked (constants [i].ConstantType)) + constants.RemoveAt (i--); + } + } + + var import = scope.Import; + while (import is not null) { + if (import.HasTargets) { + var targets = import.Targets; + for (int i = 0; i < targets.Count; ++i) { + var ttype = targets [i].Type; + if (ttype is not null && !Annotations.IsMarked (ttype)) + targets.RemoveAt (i--); + + // TODO: Clear also AssemblyReference and Namespace when not marked + } + } + + import = import.Parent; + } + } + } + + protected void SweepCollectionWithCustomAttributes (IList list) where T : ICustomAttributeProvider + { + for (int i = 0; i < list.Count; i++) + if (ShouldRemove (list [i])) { + ElementRemoved (list [i]); + list.RemoveAt (i--); + } else { + SweepCustomAttributes (list [i]); + } + } + + protected bool SweepCollectionMetadata (IList list) where T : IMetadataTokenProvider + { + bool removed = false; + + for (int i = 0; i < list.Count; i++) { + if (ShouldRemove (list [i])) { + ElementRemoved (list [i]); + list.RemoveAt (i--); + removed = true; + } + } + + return removed; + } + + protected virtual bool ShouldRemove (T element) where T : IMetadataTokenProvider + { + return !Annotations.IsMarked (element); + } + + static bool AreSameReference (AssemblyNameReference a, AssemblyNameReference b) + { + if (a == b) + return true; + + if (a.Name != b.Name) + return false; + + if (a.Version > b.Version) + return false; + + return true; + } + + protected virtual void ElementRemoved (IMetadataTokenProvider element) + { + } + + protected virtual void ReferenceRemoved (AssemblyDefinition assembly, AssemblyNameReference reference) + { + } + + protected virtual void InterfaceRemoved (TypeDefinition type, InterfaceImplementation iface) + { + } + + protected virtual void CustomAttributeUsageRemoved (ICustomAttributeProvider provider, CustomAttribute attribute) + { + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/TypeMapStep.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/TypeMapStep.cs new file mode 100644 index 000000000000..053ad77373d9 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/TypeMapStep.cs @@ -0,0 +1,371 @@ +// +// TypeMapStep.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2009 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Collections.Generic; +using Mono.Cecil; + +namespace Mono.Linker.Steps { + + public class TypeMapStep : BaseStep { + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + foreach (TypeDefinition type in assembly.MainModule.Types) + MapType (type); + } + + protected virtual void MapType (TypeDefinition type) + { + MapVirtualMethods (type); + MapInterfaceMethodsInTypeHierarchy (type); + MapInterfaceHierarchy (type); + MapBaseTypeHierarchy (type); + + if (!type.HasNestedTypes) + return; + + foreach (var nested in type.NestedTypes) + MapType (nested); + } + + void MapInterfaceHierarchy (TypeDefinition type) + { + if (!type.IsInterface || !type.HasInterfaces) + return; + + foreach (var iface in type.Interfaces) { + var resolved = iface.InterfaceType.Resolve (); + if (resolved is null) + continue; + + Annotations.AddDerivedInterfaceForInterface (resolved, type); + } + } + + void MapInterfaceMethodsInTypeHierarchy (TypeDefinition type) + { + if (!type.HasInterfaces) + return; + + foreach (var @interface in type.Interfaces) { + var interfaceType = @interface.InterfaceType; + var iface = interfaceType.Resolve (); + if (iface is null || !iface.HasMethods) + continue; + + foreach (MethodDefinition interfaceMethod in iface.Methods) { + if (TryMatchMethod (type, interfaceMethod) is not null) + continue; + + var @base = GetBaseMethodInTypeHierarchy (type, interfaceMethod); + if (@base is not null) + AnnotateMethods (interfaceMethod, @base, @interface); + + if (interfaceType is GenericInstanceType genericInterfaceInstance) { + var genericContext = new Inflater.GenericContext (genericInterfaceInstance, null); + var baseInflated = GetBaseInflatedInterfaceMethodInTypeHierarchy (genericContext, type, interfaceMethod); + if (baseInflated is not null) + Annotations.AddOverride (interfaceMethod, baseInflated, @interface); + } + } + } + } + + static MethodReference CreateGenericInstanceCandidate (Inflater.GenericContext context, TypeDefinition candidateType, MethodDefinition interfaceMethod) + { + var methodReference = new MethodReference (interfaceMethod.Name, interfaceMethod.ReturnType, candidateType) { HasThis = interfaceMethod.HasThis }; + + foreach (var genericMethodParameter in interfaceMethod.GenericParameters) + methodReference.GenericParameters.Add (new GenericParameter (genericMethodParameter.Name, methodReference)); + + if (interfaceMethod.ReturnType.IsGenericParameter || interfaceMethod.ReturnType.IsGenericInstance) + methodReference.ReturnType = Inflater.InflateType (context, interfaceMethod.ReturnType); + + foreach (var p in interfaceMethod.Parameters) { + var parameterType = p.ParameterType; + if (parameterType.IsGenericParameter || parameterType.IsGenericInstance) + parameterType = Inflater.InflateType (context, parameterType); + + methodReference.Parameters.Add (new ParameterDefinition (p.Name, p.Attributes, parameterType)); + } + + return methodReference; + } + + void MapVirtualMethods (TypeDefinition type) + { + if (!type.HasMethods) + return; + + foreach (MethodDefinition method in type.Methods) { + if (!method.IsVirtual) + continue; + + MapVirtualMethod (method); + + if (method.HasOverrides) + MapOverrides (method); + } + } + + void MapVirtualMethod (MethodDefinition method) + { + MapVirtualBaseMethod (method); + MapVirtualInterfaceMethod (method); + } + + void MapVirtualBaseMethod (MethodDefinition method) + { + MethodDefinition @base = GetBaseMethodInTypeHierarchy (method); + if (@base is null) + return; + + AnnotateMethods (@base, method); + } + + void MapVirtualInterfaceMethod (MethodDefinition method) + { + foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (method)) + AnnotateMethods (@base, method); + } + + void MapOverrides (MethodDefinition method) + { + foreach (MethodReference override_ref in method.Overrides) { + MethodDefinition @override = override_ref.Resolve (); + if (@override is null) + continue; + + AnnotateMethods (@override, method); + } + } + + void MapBaseTypeHierarchy (TypeDefinition type) + { + if (!type.IsClass) + return; + + var bases = new List (); + var current = type.BaseType; + + while (current is not null) { + var resolved = current.Resolve (); + if (resolved is null) + break; + + // Exclude Object. That's implied and adding it to the list will just lead to lots of extra unnecessary processing + if (resolved.BaseType is null) + break; + + bases.Add (resolved); + current = resolved.BaseType; + } + + Annotations.SetClassHierarchy (type, bases); + } + + void AnnotateMethods (MethodDefinition @base, MethodDefinition @override, InterfaceImplementation matchingInterfaceImplementation = null) + { + Annotations.AddBaseMethod (@override, @base); + Annotations.AddOverride (@base, @override, matchingInterfaceImplementation); + } + + static MethodDefinition GetBaseMethodInTypeHierarchy (MethodDefinition method) + { + return GetBaseMethodInTypeHierarchy (method.DeclaringType, method); + } + + static MethodDefinition GetBaseMethodInTypeHierarchy (TypeDefinition type, MethodDefinition method) + { + TypeReference @base = type.GetInflatedBaseType (); + while (@base is not null) { + MethodDefinition base_method = TryMatchMethod (@base, method); + if (base_method is not null) + return base_method; + + @base = @base.GetInflatedBaseType (); + } + + return null; + } + + static MethodDefinition GetBaseInflatedInterfaceMethodInTypeHierarchy (Inflater.GenericContext context, TypeDefinition type, MethodDefinition interfaceMethod) + { + TypeReference @base = type.GetInflatedBaseType (); + while (@base is not null) { + var candidate = CreateGenericInstanceCandidate (context, @base.Resolve (), interfaceMethod); + + MethodDefinition base_method = TryMatchMethod (@base, candidate); + if (base_method is not null) + return base_method; + + @base = @base.GetInflatedBaseType (); + } + + return null; + } + + static IEnumerable GetBaseMethodsInInterfaceHierarchy (MethodDefinition method) + { + return GetBaseMethodsInInterfaceHierarchy (method.DeclaringType, method); + } + + static IEnumerable GetBaseMethodsInInterfaceHierarchy (TypeReference type, MethodDefinition method) + { + foreach (TypeReference @interface in type.GetInflatedInterfaces ()) { + MethodDefinition base_method = TryMatchMethod (@interface, method); + if (base_method is not null) + yield return base_method; + + foreach (MethodDefinition @base in GetBaseMethodsInInterfaceHierarchy (@interface, method)) + yield return @base; + } + } + + static MethodDefinition TryMatchMethod (TypeReference type, MethodReference method) + { + foreach (var candidate in type.GetMethods ()) { + if (MethodMatch (candidate, method)) + return candidate.Resolve (); + } + + return null; + } + + static bool MethodMatch (MethodReference candidate, MethodReference method) + { + var candidateDef = candidate.Resolve (); + + if (!candidateDef.IsVirtual) + return false; + + if (candidate.HasParameters != method.HasParameters) + return false; + + if (candidate.Name != method.Name) + return false; + + if (candidate.HasGenericParameters != method.HasGenericParameters) + return false; + + // we need to track what the generic parameter represent - as we cannot allow it to + // differ between the return type or any parameter + if (!TypeMatch (candidate.GetReturnType (), method.GetReturnType ())) + return false; + + if (!candidate.HasParameters) + return true; + + var cp = candidate.Parameters; + var mp = method.Parameters; + if (cp.Count != mp.Count) + return false; + + if (candidate.GenericParameters.Count != method.GenericParameters.Count) + return false; + + for (int i = 0; i < cp.Count; i++) { + if (!TypeMatch (candidate.GetParameterType (i), method.GetParameterType (i))) + return false; + } + + return true; + } + + static bool TypeMatch (IModifierType a, IModifierType b) + { + if (!TypeMatch (a.ModifierType, b.ModifierType)) + return false; + + return TypeMatch (a.ElementType, b.ElementType); + } + + static bool TypeMatch (TypeSpecification a, TypeSpecification b) + { + var gita = a as GenericInstanceType; + if (gita is not null) + return TypeMatch (gita, (GenericInstanceType) b); + + var mta = a as IModifierType; + if (mta is not null) + return TypeMatch (mta, (IModifierType) b); + + return TypeMatch (a.ElementType, b.ElementType); + } + + static bool TypeMatch (GenericInstanceType a, GenericInstanceType b) + { + if (!TypeMatch (a.ElementType, b.ElementType)) + return false; + + if (a.HasGenericArguments != b.HasGenericArguments) + return false; + + if (!a.HasGenericArguments) + return true; + + var gaa = a.GenericArguments; + var gab = b.GenericArguments; + if (gaa.Count != gab.Count) + return false; + + for (int i = 0; i < gaa.Count; i++) { + if (!TypeMatch (gaa [i], gab [i])) + return false; + } + + return true; + } + + static bool TypeMatch (GenericParameter a, GenericParameter b) + { + if (a.Position != b.Position) + return false; + + if (a.Type != b.Type) + return false; + + return true; + } + + static bool TypeMatch (TypeReference a, TypeReference b) + { + if (a is TypeSpecification || b is TypeSpecification) { + if (a.GetType () != b.GetType ()) + return false; + + return TypeMatch ((TypeSpecification) a, (TypeSpecification) b); + } + + if (a is GenericParameter && b is GenericParameter) + return TypeMatch ((GenericParameter) a, (GenericParameter) b); + + return a.FullName == b.FullName; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Annotations.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Annotations.cs new file mode 100644 index 000000000000..c060892ba545 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Annotations.cs @@ -0,0 +1,464 @@ +// +// Annotations.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace Mono.Linker { + + public partial class AnnotationStore { + + protected readonly LinkContext context; + + protected readonly Dictionary assembly_actions = new Dictionary (); + protected readonly Dictionary method_actions = new Dictionary (); + protected readonly Dictionary method_stub_values = new Dictionary (); + protected readonly Dictionary field_values = new Dictionary (); + protected readonly HashSet field_init = new HashSet (); + protected readonly HashSet fieldType_init = new HashSet (); + protected readonly HashSet marked = new HashSet (); + protected readonly HashSet processed = new HashSet (); + protected readonly Dictionary preserved_types = new Dictionary (); + protected readonly Dictionary> preserved_methods = new Dictionary> (); + protected readonly HashSet public_api = new HashSet (); + protected readonly Dictionary> override_methods = new Dictionary> (); + protected readonly Dictionary> base_methods = new Dictionary> (); + protected readonly Dictionary symbol_readers = new Dictionary (); + protected readonly Dictionary> class_type_base_hierarchy = new Dictionary> (); + protected readonly Dictionary> derived_interfaces = new Dictionary> (); + + protected readonly Dictionary> custom_annotations = new Dictionary> (); + protected readonly Dictionary> resources_to_remove = new Dictionary> (); + protected readonly HashSet marked_attributes = new HashSet (); + readonly HashSet marked_types_with_cctor = new HashSet (); + protected readonly HashSet marked_instantiated = new HashSet (); + protected readonly HashSet indirectly_called = new HashSet (); + + + public AnnotationStore (LinkContext context) => this.context = context; + + public bool ProcessSatelliteAssemblies { get; set; } + + protected Tracer Tracer { + get { + return context.Tracer; + } + } + + [Obsolete ("Use Tracer in LinkContext directly")] + public void PrepareDependenciesDump () + { + Tracer.AddRecorder (new XmlDependencyRecorder (context)); + } + + [Obsolete ("Use Tracer in LinkContext directly")] + public void PrepareDependenciesDump (string filename) + { + Tracer.AddRecorder (new XmlDependencyRecorder (context, filename)); + } + + public ICollection GetAssemblies () + { + return assembly_actions.Keys; + } + + public AssemblyAction GetAction (AssemblyDefinition assembly) + { + AssemblyAction action; + if (assembly_actions.TryGetValue (assembly, out action)) + return action; + + throw new InvalidOperationException ($"No action for the assembly {assembly.Name} defined"); + } + + public MethodAction GetAction (MethodDefinition method) + { + MethodAction action; + if (method_actions.TryGetValue (method, out action)) + return action; + + return MethodAction.Nothing; + } + + public void SetAction (AssemblyDefinition assembly, AssemblyAction action) + { + assembly_actions [assembly] = action; + } + + public bool HasAction (AssemblyDefinition assembly) + { + return assembly_actions.ContainsKey (assembly); + } + + public void SetAction (MethodDefinition method, MethodAction action) + { + method_actions [method] = action; + } + + public void SetMethodStubValue (MethodDefinition method, object value) + { + method_stub_values [method] = value; + } + + public void SetFieldValue (FieldDefinition field, object value) + { + field_values [field] = value; + } + + public void SetSubstitutedInit (FieldDefinition field) + { + field_init.Add (field); + } + + public bool HasSubstitutedInit (FieldDefinition field) + { + return field_init.Contains (field); + } + + public void SetSubstitutedInit (TypeDefinition type) + { + fieldType_init.Add (type); + } + + public bool HasSubstitutedInit (TypeDefinition type) + { + return fieldType_init.Contains (type); + } + + public void Mark (IMetadataTokenProvider provider) + { + marked.Add (provider); + Tracer.AddDependency (provider, true); + } + + public void Mark (CustomAttribute attribute) + { + marked_attributes.Add (attribute); + } + + public void MarkAndPush (IMetadataTokenProvider provider) + { + Mark (provider); + Tracer.Push (provider, false); + } + + public bool IsMarked (IMetadataTokenProvider provider) + { + return marked.Contains (provider); + } + + public bool IsMarked (CustomAttribute attribute) + { + return marked_attributes.Contains (attribute); + } + + public void MarkIndirectlyCalledMethod (MethodDefinition method) + { + if (!context.AddReflectionAnnotations) + return; + + indirectly_called.Add (method); + } + + public bool HasMarkedAnyIndirectlyCalledMethods () + { + return indirectly_called.Count != 0; + } + + public bool IsIndirectlyCalled (MethodDefinition method) + { + return indirectly_called.Contains (method); + } + + public void MarkInstantiated (TypeDefinition type) + { + marked_instantiated.Add (type); + } + + public bool IsInstantiated (TypeDefinition type) + { + return marked_instantiated.Contains (type); + } + + public void Processed (IMetadataTokenProvider provider) + { + processed.Add (provider); + } + + public bool IsProcessed (IMetadataTokenProvider provider) + { + return processed.Contains (provider); + } + + public bool IsPreserved (TypeDefinition type) + { + return preserved_types.ContainsKey (type); + } + + public void SetPreserve (TypeDefinition type, TypePreserve preserve) + { + TypePreserve existing; + if (preserved_types.TryGetValue (type, out existing)) + preserved_types [type] = ChoosePreserveActionWhichPreservesTheMost (existing, preserve); + else + preserved_types.Add (type, preserve); + } + + public static TypePreserve ChoosePreserveActionWhichPreservesTheMost (TypePreserve leftPreserveAction, TypePreserve rightPreserveAction) + { + if (leftPreserveAction == rightPreserveAction) + return leftPreserveAction; + + if (leftPreserveAction == TypePreserve.All || rightPreserveAction == TypePreserve.All) + return TypePreserve.All; + + if (leftPreserveAction == TypePreserve.Nothing) + return rightPreserveAction; + + if (rightPreserveAction == TypePreserve.Nothing) + return leftPreserveAction; + + if ((leftPreserveAction == TypePreserve.Methods && rightPreserveAction == TypePreserve.Fields) || + (leftPreserveAction == TypePreserve.Fields && rightPreserveAction == TypePreserve.Methods)) + return TypePreserve.All; + + return rightPreserveAction; + } + + public TypePreserve GetPreserve (TypeDefinition type) + { + TypePreserve preserve; + if (preserved_types.TryGetValue (type, out preserve)) + return preserve; + + throw new NotSupportedException ($"No type preserve information for `{type}`"); + } + + public bool TryGetPreserve (TypeDefinition type, out TypePreserve preserve) + { + return preserved_types.TryGetValue (type, out preserve); + } + + public bool TryGetMethodStubValue (MethodDefinition method, out object value) + { + return method_stub_values.TryGetValue (method, out value); + } + + public bool TryGetFieldUserValue (FieldDefinition field, out object value) + { + return field_values.TryGetValue (field, out value); + } + + public HashSet GetResourcesToRemove (AssemblyDefinition assembly) + { + HashSet resources; + if (resources_to_remove.TryGetValue (assembly, out resources)) + return resources; + + return null; + } + + public void AddResourceToRemove (AssemblyDefinition assembly, string name) + { + HashSet resources; + if (!resources_to_remove.TryGetValue (assembly, out resources)) { + resources = resources_to_remove [assembly] = new HashSet (); + } + + resources.Add (name); + } + + public void SetPublic (IMetadataTokenProvider provider) + { + public_api.Add (provider); + } + + public bool IsPublic (IMetadataTokenProvider provider) + { + return public_api.Contains (provider); + } + + public void AddOverride (MethodDefinition @base, MethodDefinition @override, InterfaceImplementation matchingInterfaceImplementation = null) + { + var methods = GetOverrides (@base); + if (methods is null) { + methods = new List (); + override_methods [@base] = methods; + } + + methods.Add (new OverrideInformation (@base, @override, matchingInterfaceImplementation)); + } + + public List GetOverrides (MethodDefinition method) + { + List overrides; + if (override_methods.TryGetValue (method, out overrides)) + return overrides; + + return null; + } + + public void AddBaseMethod (MethodDefinition method, MethodDefinition @base) + { + var methods = GetBaseMethods (method); + if (methods is null) { + methods = new List (); + base_methods [method] = methods; + } + + methods.Add (@base); + } + + public List GetBaseMethods (MethodDefinition method) + { + List bases; + if (base_methods.TryGetValue (method, out bases)) + return bases; + + return null; + } + + public List GetPreservedMethods (TypeDefinition type) + { + return GetPreservedMethods (type as IMemberDefinition); + } + + public void AddPreservedMethod (TypeDefinition type, MethodDefinition method) + { + AddPreservedMethod (type as IMemberDefinition, method); + } + + public List GetPreservedMethods (MethodDefinition method) + { + return GetPreservedMethods (method as IMemberDefinition); + } + + public void AddPreservedMethod (MethodDefinition key, MethodDefinition method) + { + AddPreservedMethod (key as IMemberDefinition, method); + } + + List GetPreservedMethods (IMemberDefinition definition) + { + List preserved; + if (preserved_methods.TryGetValue (definition, out preserved)) + return preserved; + + return null; + } + + void AddPreservedMethod (IMemberDefinition definition, MethodDefinition method) + { + var methods = GetPreservedMethods (definition); + if (methods is null) { + methods = new List (); + preserved_methods [definition] = methods; + } + + methods.Add (method); + } + + public void AddSymbolReader (AssemblyDefinition assembly, ISymbolReader symbolReader) + { + symbol_readers [assembly] = symbolReader; + } + + public void CloseSymbolReader (AssemblyDefinition assembly) + { + ISymbolReader symbolReader; + if (!symbol_readers.TryGetValue (assembly, out symbolReader)) + return; + + symbol_readers.Remove (assembly); + symbolReader.Dispose (); + } + + public Dictionary GetCustomAnnotations (object key) + { + Dictionary slots; + if (custom_annotations.TryGetValue (key, out slots)) + return slots; + + slots = new Dictionary (); + custom_annotations.Add (key, slots); + return slots; + } + + public bool HasPreservedStaticCtor (TypeDefinition type) + { + return marked_types_with_cctor.Contains (type); + } + + public bool SetPreservedStaticCtor (TypeDefinition type) + { + return marked_types_with_cctor.Add (type); + } + + public void SetClassHierarchy (TypeDefinition type, List bases) + { + class_type_base_hierarchy [type] = bases; + } + + public List GetClassHierarchy (TypeDefinition type) + { + if (class_type_base_hierarchy.TryGetValue (type, out List bases)) + return bases; + + return null; + } + + public void AddDerivedInterfaceForInterface (TypeDefinition @base, TypeDefinition derived) + { + if (!@base.IsInterface) + throw new ArgumentException ($"{nameof (@base)} must be an interface"); + + if (!derived.IsInterface) + throw new ArgumentException ($"{nameof (derived)} must be an interface"); + + List derivedInterfaces; + if (!derived_interfaces.TryGetValue (@base, out derivedInterfaces)) + derived_interfaces [@base] = derivedInterfaces = new List (); + + derivedInterfaces.Add (derived); + } + + public List GetDerivedInterfacesForInterface (TypeDefinition @interface) + { + if (!@interface.IsInterface) + throw new ArgumentException ($"{nameof (@interface)} must be an interface"); + + List derivedInterfaces; + if (derived_interfaces.TryGetValue (@interface, out derivedInterfaces)) + return derivedInterfaces; + + return null; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyAction.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyAction.cs new file mode 100644 index 000000000000..341339cd1597 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyAction.cs @@ -0,0 +1,55 @@ +// +// AssemblyAction.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace Mono.Linker { + + public enum AssemblyAction { + // Ignore the assembly + Skip, + // Copy the existing files, assembly and symbols, into the output destination. E.g. .dll and .mdb + // The linker still analyzes the assemblies (to know what they require) but does not modify them. + Copy, + // Copy the existing files, assembly and symbols, into the output destination if and only if + // anything from the assembly is used. + // The linker still analyzes the assemblies (to know what they require) but does not modify them. + CopyUsed, + // Link the assembly + Link, + // Remove the assembly from the output + Delete, + // Save the assembly/symbols in memory without linking it. + // E.g. useful to remove unneeded assembly references (as done in SweepStep), + // resolving [TypeForwardedTo] attributes (like PCL) to their final location + Save, + // Keep all types, methods, and fields but add System.Runtime.BypassNGenAttribute to unmarked methods. + AddBypassNGen, + // Keep all types, methods, and fields in marked assemblies but add System.Runtime.BypassNGenAttribute to unmarked methods. + // Delete unmarked assemblies. + AddBypassNGenUsed + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyResolver.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyResolver.cs new file mode 100644 index 000000000000..0b7367539c00 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyResolver.cs @@ -0,0 +1,157 @@ +// +// AssemblyResolver.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.IO; +using Mono.Cecil; +using Mono.Collections.Generic; + +namespace Mono.Linker { + +#if FEATURE_ILLINK + public class AssemblyResolver : DirectoryAssemblyResolver { +#else + public class AssemblyResolver : BaseAssemblyResolver { +#endif + + readonly Dictionary _assemblies; + HashSet _unresolvedAssemblies; + bool _ignoreUnresolved; + LinkContext _context; + readonly Collection _references; + + + public IDictionary AssemblyCache { + get { return _assemblies; } + } + + public AssemblyResolver () + : this (new Dictionary (StringComparer.OrdinalIgnoreCase)) + { + } + + public AssemblyResolver (Dictionary assembly_cache) + { + _assemblies = assembly_cache; + _references = new Collection () { }; + } + + public bool IgnoreUnresolved { + get { return _ignoreUnresolved; } + set { _ignoreUnresolved = value; } + } + + public LinkContext Context { + get { return _context; } + set { _context = value; } + } + +#if !FEATURE_ILLINK + // The base class's definition of GetAssembly is visible when using DirectoryAssemblyResolver. + AssemblyDefinition GetAssembly (string file, ReaderParameters parameters) + { + if (parameters.AssemblyResolver is null) + parameters.AssemblyResolver = this; + + return ModuleDefinition.ReadModule (file, parameters).Assembly; + } +#endif + + AssemblyDefinition ResolveFromReferences (AssemblyNameReference name, Collection references, ReaderParameters parameters) + { + var fileName = name.Name + ".dll"; + foreach (var reference in references) { + if (Path.GetFileName (reference) != fileName) + continue; + try { + return GetAssembly (reference, parameters); + } catch (BadImageFormatException) { + continue; + } + } + + return null; + } + + public override AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters) + { + // Validate arguments, similarly to how the base class does it. + if (name is null) + throw new ArgumentNullException ("name"); + if (parameters is null) + throw new ArgumentNullException ("parameters"); + + AssemblyDefinition asm = null; + if (!_assemblies.TryGetValue (name.Name, out asm) && (_unresolvedAssemblies is null || !_unresolvedAssemblies.Contains (name.Name))) { + try { + // Any full path explicit reference takes precedence over other look up logic + asm = ResolveFromReferences (name, _references, parameters); + + // Fall back to the base class resolution logic + if (asm is null) + asm = base.Resolve (name, parameters); + + _assemblies [name.Name] = asm; + } catch (AssemblyResolutionException) { + if (!_ignoreUnresolved) + throw; + _context.LogMessage ($"warning: Ignoring unresolved assembly '{name.Name}'."); + if (_unresolvedAssemblies is null) + _unresolvedAssemblies = new HashSet (); + _unresolvedAssemblies.Add (name.Name); + } + } + + return asm; + } + + public virtual AssemblyDefinition CacheAssembly (AssemblyDefinition assembly) + { + _assemblies [assembly.Name.Name] = assembly; + base.AddSearchDirectory (Path.GetDirectoryName (assembly.MainModule.FileName)); + return assembly; + } + + public void AddReferenceAssembly (string referencePath) + { + _references.Add (referencePath); + } + + protected override void Dispose (bool disposing) + { + foreach (var asm in _assemblies.Values) { + asm.Dispose (); + } + + _assemblies.Clear (); + if (_unresolvedAssemblies is not null) + _unresolvedAssemblies.Clear (); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyUtilities.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyUtilities.cs new file mode 100644 index 000000000000..a0da2a92fb7a --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/AssemblyUtilities.cs @@ -0,0 +1,16 @@ +using System; +using Mono.Cecil; + +namespace Mono.Linker { + + public static class AssemblyUtilities { + + public static bool IsCrossgened (this ModuleDefinition module) + { + return (module.Attributes & ModuleAttributes.ILOnly) == 0 && + (module.Attributes & ModuleAttributes.ILLibrary) != 0; + } + + } + +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/BCL.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/BCL.cs new file mode 100644 index 000000000000..c0f504e587dc --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/BCL.cs @@ -0,0 +1,84 @@ +using Mono.Cecil; + +namespace Mono.Linker { + public static class BCL { + public static class EventTracingForWindows { + public static bool IsEventSourceImplementation (TypeDefinition type, LinkContext context = null) + { + if (!type.IsClass) + return false; + + while (type.BaseType is not null) { + var bt = type.BaseType.Resolve (); + + if (bt is null) { + if (context is not null && !context.IgnoreUnresolved) + throw new ResolutionException (type.BaseType); + + break; + } + + if (IsEventSourceType (bt)) + return true; + + type = bt; + } + + return false; + } + + public static bool IsEventSourceType (TypeReference type) + { + return type.Namespace == "System.Diagnostics.Tracing" && type.Name == "EventSource"; + } + + public static bool IsNonEventAtribute (TypeReference type) + { + return type.Namespace == "System.Diagnostics.Tracing" && type.Name == "NonEventAttribute"; + } + + public static bool IsProviderName (string name) + { + return name == "Keywords" || name == "Tasks" || name == "Opcodes"; + } + } + + public static bool IsIDisposableImplementation (MethodDefinition method) + { + if (method.Name != "Dispose" || method.ReturnType.MetadataType != MetadataType.Void) + return false; + + if (method.HasParameters || method.HasGenericParameters || method.IsStatic) + return false; + + if (!method.IsFinal) + return false; + + return true; + } + + static readonly string [] corlibNames = new [] { + "mscorlib", + "System.Runtime", + "System.Private.CoreLib", + "netstandard" + }; + + public static TypeDefinition FindPredefinedType (string ns, string name, LinkContext context) + { + var cache = context.Resolver.AssemblyCache; + + foreach (var corlibName in corlibNames) { + if (!cache.TryGetValue (corlibName, out AssemblyDefinition corlib)) + continue; + + TypeDefinition type = corlib.MainModule.GetType (ns, name); + // The assembly could be a facade with type forwarders, in which case we don't find the type in this assembly. + if (type is not null) + return type; + } + + return null; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/ConsoleLogger.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/ConsoleLogger.cs new file mode 100644 index 000000000000..49305240d619 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/ConsoleLogger.cs @@ -0,0 +1,9 @@ +using System; +namespace Mono.Linker { + public class ConsoleLogger : ILogger { + public void LogMessage (MessageImportance importance, string message, params object [] values) + { + Console.WriteLine (message, values); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/I18nAssemblies.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/I18nAssemblies.cs new file mode 100644 index 000000000000..a14c58fe2aed --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/I18nAssemblies.cs @@ -0,0 +1,47 @@ +// +// I18nAssemblies.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; + +namespace Mono.Linker { + + [Flags] + public enum I18nAssemblies { + + None = 0, + + CJK = 1, + MidEast = 2, + Other = 4, + Rare = 8, + West = 16, + + All = CJK | MidEast | Other | Rare | West, + Base + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IDependencyRecorder.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IDependencyRecorder.cs new file mode 100644 index 000000000000..7ad5b6b8c553 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IDependencyRecorder.cs @@ -0,0 +1,42 @@ +// +// IDependencyRecorder.cs +// +// Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace Mono.Linker { + /// + /// Abstraction exposed by the linker (mostly MarkStep, but not only) - it will call this interface + /// every time it finds a dependency between two parts of the dependency graph. + /// + public interface IDependencyRecorder { + /// + /// Reports a dependency detected by the linker. + /// + /// The source of the dependency (for example the caller method). + /// The target of the dependency (for example the callee method). + /// true if the target is also marked by the MarkStep. + /// The source and target are typically Cecil metadata objects (MethodDefinition, TypeDefinition, ...) + /// but they can also be the linker steps or really any other object. + void RecordDependency (object source, object target, bool marked); + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/ILogger.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/ILogger.cs new file mode 100644 index 000000000000..6aa49124b883 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/ILogger.cs @@ -0,0 +1,12 @@ +using System; +namespace Mono.Linker { + public enum MessageImportance { + High, + Low, + Normal, + } + + public interface ILogger { + void LogMessage (MessageImportance importance, string message, params object [] values); + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IReflectionPatternRecorder.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IReflectionPatternRecorder.cs new file mode 100644 index 000000000000..a3b236a86dea --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IReflectionPatternRecorder.cs @@ -0,0 +1,60 @@ +// +// IReflectionPatternRecorder.cs +// +// Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using Mono.Cecil; + +namespace Mono.Linker { + /// + /// Interface which is called every time the linker inspects a pattern of code involving reflection to determine a more complex + /// dependency. + /// + /// + /// The rules are such that if a given callsite of a "reflectionMethod" gets examined + /// linker will always report it one way or another: + /// - it will either call RecognizedReflectionAccessPattern method when it can figure out exactly the dependency. + /// - or it will call UnrecognizedReflectionAccessPattern with an optional message describing why it could not recognize + /// the pattern. + /// + public interface IReflectionPatternRecorder { + /// + /// Called when the linker recognized a reflection access pattern (and thus was able to correctly apply marking to the accessed item). + /// + /// The method which contains the reflection access pattern. + /// The reflection method which is at the heart of the access pattern. + /// The item accessed through reflection. This can be one of: + /// TypeDefinition, MethodDefinition, PropertyDefinition, FieldDefinition, EventDefinition. + void RecognizedReflectionAccessPattern (MethodDefinition sourceMethod, MethodDefinition reflectionMethod, IMemberDefinition accessedItem); + + /// + /// Called when the linker detected a reflection access but was not able to recognize the entire pattern. + /// + /// The method which contains the reflection access code. + /// The reflection method which is at the heart of the access code. + /// Humanly readable message describing what failed during the pattern recognition. + /// This effectively means that there's a potential hole in the linker marking - some items which are accessed only through + /// reflection may not be marked correctly and thus may fail at runtime. + void UnrecognizedReflectionAccessPattern (MethodDefinition sourceMethod, MethodDefinition reflectionMethod, string message); + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IXApiVisitor.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IXApiVisitor.cs new file mode 100644 index 000000000000..204d699ee14e --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/IXApiVisitor.cs @@ -0,0 +1,47 @@ +// +// XApiVisitor.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Xml.XPath; + +using Mono.Cecil; + +namespace Mono.Linker { + + public interface IXApiVisitor { + + void OnAssembly (XPathNavigator nav, AssemblyDefinition assembly); + void OnAttribute (XPathNavigator nav); + void OnClass (XPathNavigator nav, TypeDefinition type); + void OnInterface (XPathNavigator nav, TypeDefinition type); + void OnField (XPathNavigator nav, FieldDefinition field); + void OnMethod (XPathNavigator nav, MethodDefinition method); + void OnConstructor (XPathNavigator nav, MethodDefinition method); + void OnProperty (XPathNavigator nav, PropertyDefinition property); + void OnEvent (XPathNavigator nav, EventDefinition evt); + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Inflater.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Inflater.cs new file mode 100644 index 000000000000..54c710cf93a4 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Inflater.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Mono.Cecil; + +namespace Mono.Linker { + class Inflater { + public static TypeReference InflateType (GenericContext context, TypeReference typeReference) + { + var typeDefinition = InflateTypeWithoutException (context, typeReference); + if (typeDefinition is null) + throw new InvalidOperationException ($"Unable to resolve a reference to the type '{typeReference.FullName}' in the assembly '{typeReference.Module.Assembly.FullName}'. Does this type exist in a different assembly in the project?"); + + return typeDefinition; + } + + public static GenericInstanceType InflateType (GenericContext context, TypeDefinition typeDefinition) + { + return ConstructGenericType (context, typeDefinition, typeDefinition.GenericParameters); + } + + public static GenericInstanceType InflateType (GenericContext context, GenericInstanceType genericInstanceType) + { + var inflatedType = ConstructGenericType (context, genericInstanceType.Resolve (), genericInstanceType.GenericArguments); + inflatedType.MetadataToken = genericInstanceType.MetadataToken; + return inflatedType; + } + + public static TypeReference InflateTypeWithoutException (GenericContext context, TypeReference typeReference) + { + var genericParameter = typeReference as GenericParameter; + if (genericParameter is not null) { + if (context.Method is null && genericParameter.Type != GenericParameterType.Type) { + // If no method is specified assume only partial inflation is desired. + return typeReference; + } + + var genericArgumentType = genericParameter.Type == GenericParameterType.Type + ? context.Type.GenericArguments [genericParameter.Position] + : context.Method.GenericArguments [genericParameter.Position]; + + var inflatedType = genericArgumentType; + return inflatedType; + } + var genericInstanceType = typeReference as GenericInstanceType; + if (genericInstanceType is not null) + return InflateType (context, genericInstanceType); + + var arrayType = typeReference as ArrayType; + if (arrayType is not null) + return new ArrayType (InflateType (context, arrayType.ElementType), arrayType.Rank); + + var byReferenceType = typeReference as ByReferenceType; + if (byReferenceType is not null) + return new ByReferenceType (InflateType (context, byReferenceType.ElementType)); + + var pointerType = typeReference as PointerType; + if (pointerType is not null) + return new PointerType (InflateType (context, pointerType.ElementType)); + + var reqModType = typeReference as RequiredModifierType; + if (reqModType is not null) + return InflateTypeWithoutException (context, reqModType.ElementType); + + var optModType = typeReference as OptionalModifierType; + if (optModType is not null) + return InflateTypeWithoutException (context, optModType.ElementType); + + return typeReference.Resolve (); + } + + static GenericInstanceType ConstructGenericType (GenericContext context, TypeDefinition typeDefinition, IEnumerable genericArguments) + { + var inflatedType = new GenericInstanceType (typeDefinition); + + foreach (var genericArgument in genericArguments) + inflatedType.GenericArguments.Add (InflateType (context, genericArgument)); + + return inflatedType; + } + + public class GenericContext { + private readonly GenericInstanceType _type; + private readonly GenericInstanceMethod _method; + + public GenericContext (GenericInstanceType type, GenericInstanceMethod method) + { + _type = type; + _method = method; + } + + public GenericInstanceType Type { + get { return _type; } + } + + public GenericInstanceMethod Method { + get { return _method; } + } + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/KnownMembers.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/KnownMembers.cs new file mode 100644 index 000000000000..7fc1023de6c2 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/KnownMembers.cs @@ -0,0 +1,29 @@ +using Mono.Cecil; + +namespace Mono.Linker { + public class KnownMembers { + public MethodDefinition NotSupportedExceptionCtorString { get; set; } + public MethodDefinition DisablePrivateReflectionAttributeCtor { get; set; } + public MethodDefinition ObjectCtor { get; set; } + + public static bool IsNotSupportedExceptionCtorString (MethodDefinition method) + { + if (!method.IsConstructor || method.IsStatic || !method.HasParameters) + return false; + + if (method.Parameters.Count != 1 || method.Parameters [0].ParameterType.MetadataType != MetadataType.String) + return false; + + return true; + } + + public static bool IsSatelliteAssemblyMarker (MethodDefinition method) + { + if (!method.IsConstructor || method.IsStatic) + return false; + + var declaringType = method.DeclaringType; + return declaringType.Name == "ResourceManager" && declaringType.Namespace == "System.Resources"; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs new file mode 100644 index 000000000000..d03dacb8aa25 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LinkContext.cs @@ -0,0 +1,461 @@ +// +// LinkContext.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.IO; +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace Mono.Linker { + + public class UnintializedContextFactory { + virtual public AnnotationStore CreateAnnotationStore (LinkContext context) => new AnnotationStore (context); + virtual public MarkingHelpers CreateMarkingHelpers (LinkContext context) => new MarkingHelpers (context); + virtual public Tracer CreateTracer (LinkContext context) => new Tracer (context); + } + + public class LinkContext : IDisposable { + + Pipeline _pipeline; + AssemblyAction _coreAction; + AssemblyAction _userAction; + Dictionary _actions; + string _outputDirectory; + readonly Dictionary _parameters; + bool _linkSymbols; + bool _keepTypeForwarderOnlyAssemblies; + bool _keepMembersForDebugger; + bool _ignoreUnresolved; + + AssemblyResolver _resolver; + + ReaderParameters _readerParameters; + ISymbolReaderProvider _symbolReaderProvider; + ISymbolWriterProvider _symbolWriterProvider; + + AnnotationStore _annotations; + + public Pipeline Pipeline { + get { return _pipeline; } + } + + public AnnotationStore Annotations { + get { return _annotations; } + } + + public bool DeterministicOutput { get; set; } + + public string OutputDirectory { + get { return _outputDirectory; } + set { _outputDirectory = value; } + } + + public AssemblyAction CoreAction { + get { return _coreAction; } + set { _coreAction = value; } + } + + public AssemblyAction UserAction { + get { return _userAction; } + set { _userAction = value; } + } + + public bool LinkSymbols { + get { return _linkSymbols; } + set { _linkSymbols = value; } + } + + public bool KeepTypeForwarderOnlyAssemblies { + get { return _keepTypeForwarderOnlyAssemblies; } + set { _keepTypeForwarderOnlyAssemblies = value; } + } + + public bool KeepMembersForDebugger { + get { return _keepMembersForDebugger; } + set { _keepMembersForDebugger = value; } + } + + public bool IgnoreUnresolved { + get { return _ignoreUnresolved; } + set { _ignoreUnresolved = value; } + } + + public bool EnableReducedTracing { get; set; } + + public bool KeepUsedAttributeTypesOnly { get; set; } + + public bool KeepDependencyAttributes { get; set; } + + public bool StripResources { get; set; } + + public List Substitutions { get; private set; } + + public System.Collections.IDictionary Actions { + get { return _actions; } + } + + public AssemblyResolver Resolver { + get { return _resolver; } + } + + public ReaderParameters ReaderParameters { + get { return _readerParameters; } + } + + public ISymbolReaderProvider SymbolReaderProvider { + get { return _symbolReaderProvider; } + set { _symbolReaderProvider = value; } + } + + public ISymbolWriterProvider SymbolWriterProvider { + get { return _symbolWriterProvider; } + set { _symbolWriterProvider = value; } + } + + public bool LogMessages { get; set; } + + public ILogger Logger { private get; set; } = new ConsoleLogger (); + + public MarkingHelpers MarkingHelpers { get; private set; } + + public KnownMembers MarkedKnownMembers { get; private set; } + + public Tracer Tracer { get; private set; } + + public IReflectionPatternRecorder ReflectionPatternRecorder { get; set; } + + public string [] ExcludedFeatures { get; set; } + + public CodeOptimizations DisabledOptimizations { get; set; } + + public bool AddReflectionAnnotations { get; set; } + + public string AssemblyListFile { get; set; } + + public LinkContext (Pipeline pipeline) + : this (pipeline, new AssemblyResolver ()) + { + } + + public LinkContext (Pipeline pipeline, AssemblyResolver resolver) + : this (pipeline, resolver, new ReaderParameters { + AssemblyResolver = resolver + }, new UnintializedContextFactory ()) + { + } + + public LinkContext (Pipeline pipeline, AssemblyResolver resolver, ReaderParameters readerParameters, UnintializedContextFactory factory) + { + _pipeline = pipeline; + _resolver = resolver; + _resolver.Context = this; + _actions = new Dictionary (); + _parameters = new Dictionary (); + _readerParameters = readerParameters; + + SymbolReaderProvider = new DefaultSymbolReaderProvider (false); + + if (factory is null) + throw new ArgumentNullException (nameof (factory)); + + _annotations = factory.CreateAnnotationStore (this); + MarkingHelpers = factory.CreateMarkingHelpers (this); + Tracer = factory.CreateTracer (this); + ReflectionPatternRecorder = new LoggingReflectionPatternRecorder (this); + MarkedKnownMembers = new KnownMembers (); + StripResources = true; + + // See https://github.com/mono/linker/issues/612 + DisabledOptimizations |= CodeOptimizations.UnreachableBodies; + DisabledOptimizations |= CodeOptimizations.ClearInitLocals; + DisabledOptimizations |= CodeOptimizations.IPConstantPropagation; + } + + public void AddSubstitutionFile (string file) + { + if (Substitutions is null) { + Substitutions = new List (); + Substitutions.Add (file); + return; + } + + if (Substitutions.Contains (file)) + return; + + Substitutions.Add (file); + } + + public TypeDefinition GetType (string fullName) + { + int pos = fullName.IndexOf (","); + fullName = TypeReferenceExtensions.ToCecilName (fullName); + if (pos == -1) { + foreach (AssemblyDefinition asm in GetAssemblies ()) { + var type = asm.MainModule.GetType (fullName); + if (type is not null) + return type; + } + + return null; + } + + string asmname = fullName.Substring (pos + 1); + fullName = fullName.Substring (0, pos); + AssemblyDefinition assembly = Resolve (AssemblyNameReference.Parse (asmname)); + return assembly.MainModule.GetType (fullName); + } + + public AssemblyDefinition Resolve (string name) + { + if (File.Exists (name)) { + try { + AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (name, _readerParameters); + return _resolver.CacheAssembly (assembly); + } catch (Exception e) { + throw new AssemblyResolutionException (new AssemblyNameReference (name, new Version ()), e); + } + } + + return Resolve (new AssemblyNameReference (name, new Version ())); + } + + public AssemblyDefinition Resolve (IMetadataScope scope) + { + AssemblyNameReference reference = GetReference (scope); + try { + AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters); + + if (assembly is not null) + RegisterAssembly (assembly); + + return assembly; + } catch (Exception e) { + throw new AssemblyResolutionException (reference, e); + } + } + + public void RegisterAssembly (AssemblyDefinition assembly) + { + if (SeenFirstTime (assembly)) { + SafeReadSymbols (assembly); + SetDefaultAction (assembly); + } + } + + protected bool SeenFirstTime (AssemblyDefinition assembly) + { + return !_annotations.HasAction (assembly); + } + + public virtual void SafeReadSymbols (AssemblyDefinition assembly) + { + if (assembly.MainModule.HasSymbols) + return; + + if (_symbolReaderProvider is null) + throw new ArgumentNullException (nameof (_symbolReaderProvider)); + + try { + var symbolReader = _symbolReaderProvider.GetSymbolReader ( + assembly.MainModule, + assembly.MainModule.FileName); + + if (symbolReader is null) + return; + + try { + assembly.MainModule.ReadSymbols (symbolReader); + } catch { + symbolReader.Dispose (); + return; + } + + // Add symbol reader to annotations only if we have successfully read it + _annotations.AddSymbolReader (assembly, symbolReader); + } catch { } + } + + public virtual ICollection ResolveReferences (AssemblyDefinition assembly) + { + List references = new List (); + if (assembly is null) + return references; + foreach (AssemblyNameReference reference in assembly.MainModule.AssemblyReferences) { + AssemblyDefinition definition = Resolve (reference); + if (definition is not null) + references.Add (definition); + } + return references; + } + + static AssemblyNameReference GetReference (IMetadataScope scope) + { + AssemblyNameReference reference; + if (scope is ModuleDefinition) { + AssemblyDefinition asm = ((ModuleDefinition) scope).Assembly; + reference = asm.Name; + } else + reference = (AssemblyNameReference) scope; + + return reference; + } + + public void SetAction (AssemblyDefinition assembly, AssemblyAction defaultAction) + { + RegisterAssembly (assembly); + + if (!_actions.TryGetValue (assembly.Name.Name, out AssemblyAction action)) + action = defaultAction; + + Annotations.SetAction (assembly, action); + } + + protected void SetDefaultAction (AssemblyDefinition assembly) + { + AssemblyAction action; + + AssemblyNameDefinition name = assembly.Name; + + if (_actions.TryGetValue (name.Name, out action)) { + } else if (IsCore (name)) { + action = _coreAction; + } else { + action = _userAction; + } + + _annotations.SetAction (assembly, action); + } + + public static bool IsCore (AssemblyNameReference name) + { + switch (name.Name) { + case "mscorlib": + case "Accessibility": + case "Mono.Security": + // WPF + case "PresentationFramework": + case "PresentationCore": + case "WindowsBase": + case "UIAutomationProvider": + case "UIAutomationTypes": + case "PresentationUI": + case "ReachFramework": + case "netstandard": + return true; + default: + return name.Name.StartsWith ("System") + || name.Name.StartsWith ("Microsoft"); + } + } + + public virtual AssemblyDefinition [] GetAssemblies () + { + var cache = _resolver.AssemblyCache; + AssemblyDefinition [] asms = new AssemblyDefinition [cache.Count]; + cache.Values.CopyTo (asms, 0); + return asms; + } + + public void SetParameter (string key, string value) + { + _parameters [key] = value; + } + + public bool HasParameter (string key) + { + return _parameters.ContainsKey (key); + } + + public string GetParameter (string key) + { + string val = null; + _parameters.TryGetValue (key, out val); + return val; + } + + public void Dispose () + { + _resolver.Dispose (); + } + + public bool IsFeatureExcluded (string featureName) + { + return ExcludedFeatures is not null && Array.IndexOf (ExcludedFeatures, featureName) >= 0; + } + + public bool IsOptimizationEnabled (CodeOptimizations optimization) + { + return (DisabledOptimizations & optimization) == 0; + } + + public void LogMessage (string message) + { + LogMessage (MessageImportance.Normal, message); + } + + public void LogMessage (MessageImportance importance, string message) + { + if (LogMessages && Logger is not null) + Logger.LogMessage (importance, "{0}", message); + } + } + + [Flags] + public enum CodeOptimizations { + BeforeFieldInit = 1 << 0, + + /// + /// Option to disable removal of overrides of virtual methods when a type is never instantiated + /// + /// Being able to disable this optimization is helpful when trying to troubleshoot problems caused by types created via reflection or from native + /// that do not get an instance constructor marked. + /// + OverrideRemoval = 1 << 1, + + /// + /// Option to disable delaying marking of instance methods until an instance of that type could exist + /// + UnreachableBodies = 1 << 2, + + /// + /// Option to clear the initlocals flag on methods + /// + ClearInitLocals = 1 << 3, + + /// + /// Option to remove .interfaceimpl for interface types that are not used + /// + UnusedInterfaces = 1 << 4, + + /// + /// Option to do interprocedural constant propagation on return values + /// + IPConstantPropagation = 1 << 5 + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LoadException.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LoadException.cs new file mode 100644 index 000000000000..2b11298d3a21 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LoadException.cs @@ -0,0 +1,15 @@ +using System; + +namespace Mono.Linker { + public class LoadException : Exception { + public LoadException (string message) + : base (message) + { + } + + public LoadException (string message, Exception innerException) + : base (message, innerException) + { + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LoggingReflectionPatternRecorder.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LoggingReflectionPatternRecorder.cs new file mode 100644 index 000000000000..b64b1a792089 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/LoggingReflectionPatternRecorder.cs @@ -0,0 +1,47 @@ +// +// LoggingReflectionPatternRecorder.cs +// +// Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using Mono.Cecil; + +namespace Mono.Linker { + class LoggingReflectionPatternRecorder : IReflectionPatternRecorder { + private readonly LinkContext _context; + + public LoggingReflectionPatternRecorder (LinkContext context) + { + _context = context; + } + + public void RecognizedReflectionAccessPattern (MethodDefinition sourceMethod, MethodDefinition reflectionMethod, IMemberDefinition accessedItem) + { + // Do nothing - there's no logging for successfully recognized patterns + } + + public void UnrecognizedReflectionAccessPattern (MethodDefinition sourceMethod, MethodDefinition reflectionMethod, string message) + { + _context.LogMessage (MessageImportance.Low, message); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MarkException.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MarkException.cs new file mode 100644 index 000000000000..7c84e5646386 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MarkException.cs @@ -0,0 +1,25 @@ +using System; + +using Mono.Cecil; + +namespace Mono.Linker { + public class MarkException : Exception { + public MethodDefinition Method { get; private set; } + + public MarkException (string message) + : base (message) + { + } + + public MarkException (string message, Exception innerException) + : base (message, innerException) + { + } + + public MarkException (string message, Exception innerException, MethodDefinition method) + : base (message, innerException) + { + Method = method; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MarkingHelpers.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MarkingHelpers.cs new file mode 100644 index 000000000000..4fa7ac0325a7 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MarkingHelpers.cs @@ -0,0 +1,20 @@ +using System; +using Mono.Cecil; + +namespace Mono.Linker { + public class MarkingHelpers { + protected readonly LinkContext _context; + + public MarkingHelpers (LinkContext context) + { + _context = context; + } + + public void MarkExportedType (ExportedType type, ModuleDefinition module) + { + _context.Annotations.Mark (type); + if (_context.KeepTypeForwarderOnlyAssemblies) + _context.Annotations.Mark (module); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodAction.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodAction.cs new file mode 100644 index 000000000000..a3550e78396b --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodAction.cs @@ -0,0 +1,38 @@ +// +// MethodAction.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace Mono.Linker { + + public enum MethodAction { + Nothing, + Parse, + ForceParse, + ConvertToStub, + ConvertToThrow, + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodBodyScanner.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodBodyScanner.cs new file mode 100644 index 000000000000..ca726c63260f --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodBodyScanner.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace Mono.Linker { + public static class MethodBodyScanner { + public static bool IsWorthConvertingToThrow (MethodBody body) + { + // Some bodies are cheaper size wise to leave alone than to convert to a throw + Instruction previousMeaningful = null; + int meaningfulCount = 0; + foreach (var ins in body.Instructions) { + // Handle ignoring noops because because (1) it's a valid case to ignore + // and (2) When running the tests on .net core roslyn tosses in no ops + // and that leads to a difference in test results between mcs and .net framework csc. + if (ins.OpCode.Code == Code.Nop) + continue; + + meaningfulCount++; + + if (meaningfulCount == 1 && ins.OpCode.Code == Code.Ret) + return false; + + if (meaningfulCount == 2 && ins.OpCode.Code == Code.Ret && previousMeaningful is not null) { + if (previousMeaningful.OpCode.StackBehaviourPop == StackBehaviour.Pop0) { + switch (previousMeaningful.OpCode.StackBehaviourPush) { + case StackBehaviour.Pushi: + case StackBehaviour.Pushi8: + case StackBehaviour.Pushr4: + case StackBehaviour.Pushr8: + return false; + } + + switch (previousMeaningful.OpCode.Code) { + case Code.Ldnull: + return false; + } + } + } + + if (meaningfulCount >= 2) + return true; + + previousMeaningful = ins; + } + + return true; + } + + public static IEnumerable GetReferencedInterfaces (AnnotationStore annotations, MethodBody body) + { + var possibleStackTypes = AllPossibleStackTypes (body.Method); + if (possibleStackTypes.Count == 0) + return null; + + var interfaceTypes = possibleStackTypes.Where (t => t.IsInterface).ToArray (); + if (interfaceTypes.Length == 0) + return null; + + var interfaceImplementations = new HashSet (); + + // If a type could be on the stack in the body and an interface it implements could be on the stack on the body + // then we need to mark that interface implementation. When this occurs it is not safe to remove the interface implementation from the type + // even if the type is never instantiated + foreach (var type in possibleStackTypes) { + // We only sweep interfaces on classes so that's why we only care about classes + if (!type.IsClass) + continue; + + AddMatchingInterfaces (interfaceImplementations, type, interfaceTypes); + var bases = annotations.GetClassHierarchy (type); + foreach (var @base in bases) { + AddMatchingInterfaces (interfaceImplementations, @base, interfaceTypes); + } + } + + return interfaceImplementations; + } + + static HashSet AllPossibleStackTypes (MethodDefinition method) + { + if (!method.HasBody) + throw new ArgumentException (); + + var body = method.Body; + var types = new HashSet (); + + foreach (VariableDefinition var in body.Variables) + AddIfResolved (types, var.VariableType); + + foreach (var parameter in body.Method.Parameters) + AddIfResolved (types, parameter.ParameterType); + + foreach (ExceptionHandler eh in body.ExceptionHandlers) { + if (eh.HandlerType == ExceptionHandlerType.Catch) { + AddIfResolved (types, eh.CatchType); + } + } + + foreach (Instruction instruction in body.Instructions) { + if (instruction.Operand is FieldReference fieldReference) { + AddIfResolved (types, fieldReference.Resolve ()?.FieldType); + } else if (instruction.Operand is MethodReference methodReference) { + if (methodReference is GenericInstanceMethod genericInstanceMethod) + AddFromGenericInstance (types, genericInstanceMethod); + + if (methodReference.DeclaringType is GenericInstanceType genericInstanceType) + AddFromGenericInstance (types, genericInstanceType); + + var resolvedMethod = methodReference.Resolve (); + if (resolvedMethod is not null) { + if (resolvedMethod.HasParameters) { + foreach (var param in resolvedMethod.Parameters) + AddIfResolved (types, param.ParameterType); + } + + AddFromGenericParameterProvider (types, resolvedMethod); + AddFromGenericParameterProvider (types, resolvedMethod.DeclaringType); + AddIfResolved (types, resolvedMethod.ReturnType); + } + } + } + + return types; + } + + static void AddMatchingInterfaces (HashSet results, TypeDefinition type, TypeDefinition [] interfaceTypes) + { + foreach (var interfaceType in interfaceTypes) { + if (type.HasInterface (interfaceType, out InterfaceImplementation implementation)) + results.Add (implementation); + } + } + + static void AddFromGenericInstance (HashSet set, IGenericInstance instance) + { + if (!instance.HasGenericArguments) + return; + + foreach (var genericArgument in instance.GenericArguments) + AddIfResolved (set, genericArgument); + } + + static void AddFromGenericParameterProvider (HashSet set, IGenericParameterProvider provider) + { + if (!provider.HasGenericParameters) + return; + + foreach (var genericParameter in provider.GenericParameters) { + foreach (var constraint in genericParameter.Constraints) + AddIfResolved (set, constraint.ConstraintType); + } + } + + static void AddIfResolved (HashSet set, TypeReference item) + { + var resolved = item?.Resolve (); + if (resolved is null) + return; + set.Add (resolved); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodDefinitionExtensions.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodDefinitionExtensions.cs new file mode 100644 index 000000000000..cc1d5b6896ee --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodDefinitionExtensions.cs @@ -0,0 +1,95 @@ +using Mono.Cecil; + +namespace Mono.Linker { + public static class MethodDefinitionExtensions { + public static bool IsDefaultConstructor (this MethodDefinition method) + { + return IsInstanceConstructor (method) && !method.HasParameters; + } + + public static bool IsInstanceConstructor (this MethodDefinition method) + { + return method.IsConstructor && !method.IsStatic; + } + + public static bool IsIntrinsic (this MethodDefinition method) + { + if (!method.HasCustomAttributes) + return false; + + foreach (var ca in method.CustomAttributes) { + var caType = ca.AttributeType; + if (caType.Name == "IntrinsicAttribute" && caType.Namespace == "System.Runtime.CompilerServices") + return true; + } + + return false; + } + + public static bool IsPropertyMethod (this MethodDefinition md) + { + return (md.SemanticsAttributes & MethodSemanticsAttributes.Getter) != 0 || + (md.SemanticsAttributes & MethodSemanticsAttributes.Setter) != 0; + } + + public static bool IsPublicInstancePropertyMethod (this MethodDefinition md) + { + return md.IsPublic && !md.IsStatic && IsPropertyMethod (md); + } + + public static bool IsEventMethod (this MethodDefinition md) + { + return (md.SemanticsAttributes & MethodSemanticsAttributes.AddOn) != 0 || + (md.SemanticsAttributes & MethodSemanticsAttributes.Fire) != 0 || + (md.SemanticsAttributes & MethodSemanticsAttributes.RemoveOn) != 0; + } + + public static PropertyDefinition GetProperty (this MethodDefinition md) + { + TypeDefinition declaringType = md.DeclaringType; + foreach (PropertyDefinition prop in declaringType.Properties) + if (prop.GetMethod == md || prop.SetMethod == md) + return prop; + + return null; + } + + public static EventDefinition GetEvent (this MethodDefinition md) + { + TypeDefinition declaringType = md.DeclaringType; + foreach (EventDefinition evt in declaringType.Events) + if (evt.AddMethod == md || evt.InvokeMethod == md || evt.RemoveMethod == md) + return evt; + + return null; + } + + public static bool IsStaticConstructor (this MethodDefinition method) + { + return method.IsConstructor && method.IsStatic; + } + + public static bool IsFinalizer (this MethodDefinition method) + { + if (method.Name != "Finalize" || method.ReturnType.MetadataType != MetadataType.Void) + return false; + + if (method.HasParameters || method.HasGenericParameters || method.IsStatic) + return false; + + return true; + } + + public static void ClearDebugInformation (this MethodDefinition method) + { + // TODO: This always allocates, update when Cecil catches up + var di = method.DebugInformation; + di.SequencePoints.Clear (); + if (di.Scope is not null) { + di.Scope.Variables.Clear (); + di.Scope.Constants.Clear (); + di.Scope = null; + } + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodReferenceExtensions.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodReferenceExtensions.cs new file mode 100644 index 000000000000..4b9c599fc3d4 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/MethodReferenceExtensions.cs @@ -0,0 +1,26 @@ +using System; +using Mono.Cecil; + +namespace Mono.Linker { + public static class MethodReferenceExtensions { + public static TypeReference GetReturnType (this MethodReference method) + { + var genericInstance = method.DeclaringType as GenericInstanceType; + + if (genericInstance is not null) + return TypeReferenceExtensions.InflateGenericType (genericInstance, method.ReturnType); + + return method.ReturnType; + } + + public static TypeReference GetParameterType (this MethodReference method, int parameterIndex) + { + var genericInstance = method.DeclaringType as GenericInstanceType; + + if (genericInstance is not null) + return TypeReferenceExtensions.InflateGenericType (genericInstance, method.Parameters [parameterIndex].ParameterType); + + return method.Parameters [parameterIndex].ParameterType; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/OutputException.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/OutputException.cs new file mode 100644 index 000000000000..d6c25ff3f7ef --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/OutputException.cs @@ -0,0 +1,15 @@ +using System; + +namespace Mono.Linker { + public class OutputException : Exception { + public OutputException (string message) + : base (message) + { + } + + public OutputException (string message, Exception innerException) + : base (message, innerException) + { + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/OverrideInformation.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/OverrideInformation.cs new file mode 100644 index 000000000000..b9a5448b37c5 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/OverrideInformation.cs @@ -0,0 +1,39 @@ +using System.Diagnostics; +using Mono.Cecil; + +namespace Mono.Linker { + [DebuggerDisplay ("{Override}")] + public class OverrideInformation { + public readonly MethodDefinition Base; + public readonly MethodDefinition Override; + public readonly InterfaceImplementation MatchingInterfaceImplementation; + + public OverrideInformation (MethodDefinition @base, MethodDefinition @override, InterfaceImplementation matchingInterfaceImplementation = null) + { + Base = @base; + Override = @override; + MatchingInterfaceImplementation = matchingInterfaceImplementation; + } + + public bool IsOverrideOfInterfaceMember { + get { + if (MatchingInterfaceImplementation is not null) + return true; + + return Base.DeclaringType.IsInterface; + } + } + + public TypeDefinition InterfaceType { + get { + if (!IsOverrideOfInterfaceMember) + return null; + + if (MatchingInterfaceImplementation is not null) + return MatchingInterfaceImplementation.InterfaceType.Resolve (); + + return Base.DeclaringType; + } + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Pipeline.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Pipeline.cs new file mode 100644 index 000000000000..e9334be89fbb --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Pipeline.cs @@ -0,0 +1,152 @@ +// +// Pipeline.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// (C) 2006 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; + +using Mono.Linker.Steps; + +namespace Mono.Linker { + + public class Pipeline { + + readonly List _steps; + + public Pipeline () + { + _steps = new List (); + } + + public void PrependStep (IStep step) + { + _steps.Insert (0, step); + } + + public void AppendStep (IStep step) + { + _steps.Add (step); + } + + public void AddStepBefore (Type target, IStep step) + { + for (int i = 0; i < _steps.Count; i++) { + if (target.IsInstanceOfType (_steps [i])) { + _steps.Insert (i, step); + return; + } + } + string msg = String.Format ("Step {0} could not be inserted before (not found) {1}", step, target); + throw new InvalidOperationException (msg); + } + + public void AddStepBefore (IStep target, IStep step) + { + for (int i = 0; i < _steps.Count; i++) { + if (_steps [i] == target) { + _steps.Insert (i, step); + return; + } + } + } + + public void ReplaceStep (Type target, IStep step) + { + AddStepBefore (target, step); + RemoveStep (target); + } + + public void AddStepAfter (Type target, IStep step) + { + for (int i = 0; i < _steps.Count; i++) { + if (target.IsInstanceOfType (_steps [i])) { + if (i == _steps.Count - 1) + _steps.Add (step); + else + _steps.Insert (i + 1, step); + return; + } + } + string msg = String.Format ("Step {0} could not be inserted after (not found) {1}", step, target); + throw new InvalidOperationException (msg); + } + + public void AddStepAfter (IStep target, IStep step) + { + for (int i = 0; i < _steps.Count; i++) { + if (_steps [i] == target) { + if (i == _steps.Count - 1) + _steps.Add (step); + else + _steps.Insert (i + 1, step); + return; + } + } + } + + public void RemoveStep (Type target) + { + for (int i = 0; i < _steps.Count; i++) { + if (_steps [i].GetType () != target) + continue; + + _steps.RemoveAt (i); + break; + } + } + + public void Process (LinkContext context) + { + while (_steps.Count > 0) { + IStep step = _steps [0]; + ProcessStep (context, step); + _steps.Remove (step); + } + } + + protected virtual void ProcessStep (LinkContext context, IStep step) + { + context.Tracer.Push (step); + step.Process (context); + context.Tracer.Pop (); + } + + public IStep [] GetSteps () + { + return _steps.ToArray (); + } + + public bool ContainsStep (Type type) + { + foreach (IStep step in _steps) + if (step.GetType () == type) + return true; + + return false; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Tracer.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Tracer.cs new file mode 100644 index 000000000000..cadbc27aaeae --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/Tracer.cs @@ -0,0 +1,113 @@ +// +// Tracer.cs +// +// Author: +// Radek Doulik +// +// Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; + +namespace Mono.Linker { + public class Tracer { + protected readonly LinkContext context; + + Stack dependency_stack; + List recorders; + + public Tracer (LinkContext context) + { + this.context = context; + dependency_stack = new Stack (); + } + + public void Finish () + { + dependency_stack = null; + if (recorders is not null) { + foreach (var recorder in recorders) { + if (recorder is IDisposable disposableRecorder) + disposableRecorder.Dispose (); + } + } + + recorders = null; + } + + public void AddRecorder (IDependencyRecorder recorder) + { + if (recorders is null) { + recorders = new List (); + } + + recorders.Add (recorder); + } + + public void Push (object o, bool addDependency = true) + { + if (!IsRecordingEnabled ()) + return; + + if (addDependency && dependency_stack.Count > 0) + AddDependency (o); + + dependency_stack.Push (o); + } + + public void Pop () + { + if (!IsRecordingEnabled ()) + return; + + dependency_stack.Pop (); + } + + bool IsRecordingEnabled () + { + return recorders is not null; + } + + public void AddDirectDependency (object b, object e) + { + ReportDependency (b, e, false); + } + + public void AddDependency (object o, bool marked = false) + { + if (!IsRecordingEnabled ()) + return; + + ReportDependency (dependency_stack.Count > 0 ? dependency_stack.Peek () : null, o, marked); + } + + private void ReportDependency (object source, object target, bool marked) + { + if (IsRecordingEnabled ()) { + foreach (IDependencyRecorder recorder in recorders) { + recorder.RecordDependency (source, target, marked); + } + } + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeDefinitionExtensions.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeDefinitionExtensions.cs new file mode 100644 index 000000000000..40c94f88a7de --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeDefinitionExtensions.cs @@ -0,0 +1,44 @@ + +using System; +using Mono.Cecil; + +namespace Mono.Linker { + public static class TypeDefinitionExtensions { + public static bool HasInterface (this TypeDefinition type, TypeDefinition interfaceType, out InterfaceImplementation implementation) + { + implementation = null; + if (!type.HasInterfaces) + return false; + + foreach (var iface in type.Interfaces) { + if (iface.InterfaceType.Resolve () == interfaceType) { + implementation = iface; + return true; + } + } + + return false; + } + + public static TypeReference GetEnumUnderlyingType (this TypeDefinition enumType) + { + foreach (var field in enumType.Fields) { + if (!field.IsStatic && field.Name == "value__") { + return field.FieldType; + } + } + + throw new MissingFieldException ($"Enum type '{enumType.FullName}' is missing 'value__' field"); + } + + public static bool IsMulticastDelegate (this TypeDefinition td) + { + return td.BaseType?.Name == "MulticastDelegate" && td.BaseType.Namespace == "System"; + } + + public static bool IsSerializable (this TypeDefinition td) + { + return (td.Attributes & TypeAttributes.Serializable) != 0; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeNameParser.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeNameParser.cs new file mode 100644 index 000000000000..1a86b9b4144e --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeNameParser.cs @@ -0,0 +1,49 @@ +using System; + +namespace Mono.Linker { + public static class TypeNameParser { + public static bool TryParseTypeAssemblyQualifiedName (string value, out string typeName, out string assemblyName) + { + if (string.IsNullOrEmpty (value)) { + typeName = null; + assemblyName = null; + return false; + } + + //Filter the assembly qualified name down to the basic type by removing pointer, reference, and array markers on the type + //We must also convert nested types from + to / to match cecil's formatting + value = value + .Replace ('+', '/') + .Replace ("*", string.Empty) + .Replace ("&", string.Empty); + + while (value.IndexOf ('[') > 0) { + var openidx = value.IndexOf ('['); + var closeidx = value.IndexOf (']'); + + // No matching close ] or out of order + if (closeidx < 0 || closeidx < openidx) { + typeName = null; + assemblyName = null; + return false; + } + + value = value.Remove (openidx, closeidx + 1 - openidx); + } + + var tokens = value.Split (','); + typeName = tokens [0].Trim (); + assemblyName = null; + if (tokens.Length > 1) + assemblyName = tokens [1].Trim (); + + if (string.IsNullOrWhiteSpace (typeName)) { + typeName = null; + assemblyName = null; + return false; + } + + return true; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypePreserve.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypePreserve.cs new file mode 100644 index 000000000000..83c0635fc6e7 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypePreserve.cs @@ -0,0 +1,37 @@ +// +// TypePreserve.cs +// +// Author: +// Jb Evain (jb@nurv.fr) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace Mono.Linker { + + public enum TypePreserve { + Nothing, // This is actually Declaration + All, + Fields, + Methods + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeReferenceExtensions.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeReferenceExtensions.cs new file mode 100644 index 000000000000..262faa106421 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/TypeReferenceExtensions.cs @@ -0,0 +1,239 @@ +using System; +using Mono.Cecil; +using System.Collections.Generic; +using System.Linq; + +namespace Mono.Linker { + public static class TypeReferenceExtensions { + public static TypeReference GetInflatedBaseType (this TypeReference type) + { + if (type is null) + return null; + + if (type.IsGenericParameter || type.IsByReference || type.IsPointer) + return null; + + var sentinelType = type as SentinelType; + if (sentinelType is not null) + return sentinelType.ElementType.GetInflatedBaseType (); + + var pinnedType = type as PinnedType; + if (pinnedType is not null) + return pinnedType.ElementType.GetInflatedBaseType (); + + var requiredModifierType = type as RequiredModifierType; + if (requiredModifierType is not null) + return requiredModifierType.ElementType.GetInflatedBaseType (); + + var genericInstance = type as GenericInstanceType; + if (genericInstance is not null) { + var baseType = type.Resolve ()?.BaseType; + var baseTypeGenericInstance = baseType as GenericInstanceType; + + if (baseTypeGenericInstance is not null) + return InflateGenericType (genericInstance, baseType); + + return baseType; + } + + return type.Resolve ()?.BaseType; + } + + public static IEnumerable GetInflatedInterfaces (this TypeReference typeRef) + { + var typeDef = typeRef.Resolve (); + + if (typeDef?.HasInterfaces != true) + yield break; + + var genericInstance = typeRef as GenericInstanceType; + if (genericInstance is not null) { + foreach (var interfaceImpl in typeDef.Interfaces) + yield return InflateGenericType (genericInstance, interfaceImpl.InterfaceType); + } else { + foreach (var interfaceImpl in typeDef.Interfaces) + yield return interfaceImpl.InterfaceType; + } + } + + public static TypeReference InflateGenericType (GenericInstanceType genericInstanceProvider, TypeReference typeToInflate) + { + var arrayType = typeToInflate as ArrayType; + if (arrayType is not null) { + var inflatedElementType = InflateGenericType (genericInstanceProvider, arrayType.ElementType); + + if (inflatedElementType != arrayType.ElementType) + return new ArrayType (inflatedElementType, arrayType.Rank); + + return arrayType; + } + + var genericInst = typeToInflate as GenericInstanceType; + if (genericInst is not null) + return MakeGenericType (genericInstanceProvider, genericInst); + + var genericParameter = typeToInflate as GenericParameter; + if (genericParameter is not null) { + if (genericParameter.Owner is MethodReference) + return genericParameter; + + var elementType = genericInstanceProvider.ElementType.Resolve (); + var parameter = elementType.GenericParameters.Single (p => p == genericParameter); + return genericInstanceProvider.GenericArguments [parameter.Position]; + } + + var functionPointerType = typeToInflate as FunctionPointerType; + if (functionPointerType is not null) { + var result = new FunctionPointerType (); + result.ReturnType = InflateGenericType (genericInstanceProvider, functionPointerType.ReturnType); + + for (int i = 0; i < functionPointerType.Parameters.Count; i++) { + var inflatedParameterType = InflateGenericType (genericInstanceProvider, functionPointerType.Parameters [i].ParameterType); + result.Parameters.Add (new ParameterDefinition (inflatedParameterType)); + } + + return result; + } + + var modifierType = typeToInflate as IModifierType; + if (modifierType is not null) { + var modifier = InflateGenericType (genericInstanceProvider, modifierType.ModifierType); + var elementType = InflateGenericType (genericInstanceProvider, modifierType.ElementType); + + if (modifierType is OptionalModifierType) { + return new OptionalModifierType (modifier, elementType); + } + + return new RequiredModifierType (modifier, elementType); + } + + var pinnedType = typeToInflate as PinnedType; + if (pinnedType is not null) { + var elementType = InflateGenericType (genericInstanceProvider, pinnedType.ElementType); + + if (elementType != pinnedType.ElementType) + return new PinnedType (elementType); + + return pinnedType; + } + + var pointerType = typeToInflate as PointerType; + if (pointerType is not null) { + var elementType = InflateGenericType (genericInstanceProvider, pointerType.ElementType); + + if (elementType != pointerType.ElementType) + return new PointerType (elementType); + + return pointerType; + } + + var byReferenceType = typeToInflate as ByReferenceType; + if (byReferenceType is not null) { + var elementType = InflateGenericType (genericInstanceProvider, byReferenceType.ElementType); + + if (elementType != byReferenceType.ElementType) + return new ByReferenceType (elementType); + + return byReferenceType; + } + + var sentinelType = typeToInflate as SentinelType; + if (sentinelType is not null) { + var elementType = InflateGenericType (genericInstanceProvider, sentinelType.ElementType); + + if (elementType != sentinelType.ElementType) + return new SentinelType (elementType); + + return sentinelType; + } + + return typeToInflate; + } + + private static GenericInstanceType MakeGenericType (GenericInstanceType genericInstanceProvider, GenericInstanceType type) + { + var result = new GenericInstanceType (type.ElementType); + + for (var i = 0; i < type.GenericArguments.Count; ++i) { + result.GenericArguments.Add (InflateGenericType (genericInstanceProvider, type.GenericArguments [i])); + } + + return result; + } + + public static IEnumerable GetMethods (this TypeReference type) + { + var typeDef = type.Resolve (); + + if (typeDef?.HasMethods != true) + yield break; + + var genericInstanceType = type as GenericInstanceType; + if (genericInstanceType is not null) { + foreach (var methodDef in typeDef.Methods) + yield return MakeMethodReferenceForGenericInstanceType (genericInstanceType, methodDef); + } else { + foreach (var method in typeDef.Methods) + yield return method; + } + } + + private static MethodReference MakeMethodReferenceForGenericInstanceType (GenericInstanceType genericInstanceType, MethodDefinition methodDef) + { + var method = new MethodReference (methodDef.Name, methodDef.ReturnType, genericInstanceType) { + HasThis = methodDef.HasThis, + ExplicitThis = methodDef.ExplicitThis, + CallingConvention = methodDef.CallingConvention + }; + + foreach (var parameter in methodDef.Parameters) + method.Parameters.Add (new ParameterDefinition (parameter.Name, parameter.Attributes, parameter.ParameterType)); + + foreach (var gp in methodDef.GenericParameters) + method.GenericParameters.Add (new GenericParameter (gp.Name, method)); + + return method; + } + + public static string ToCecilName (this string fullTypeName) + { + return fullTypeName.Replace ('+', '/'); + } + + public static bool HasDefaultConstructor (this TypeReference type) + { + foreach (var m in type.GetMethods ()) { + if (m.HasParameters) + continue; + + var definition = m.Resolve (); + if (definition?.IsDefaultConstructor () == true) + return true; + } + + return false; + } + + public static MethodReference GetDefaultInstanceConstructor (this TypeReference type) + { + foreach (var m in type.GetMethods ()) { + if (m.HasParameters) + continue; + + var definition = m.Resolve (); + if (!definition.IsDefaultConstructor ()) + continue; + + return m; + } + + throw new NotImplementedException (); + } + + public static bool IsTypeOf (this TypeReference type, string ns, string name) + { + return type.Name == name + && type.Namespace == ns; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/XApiReader.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/XApiReader.cs new file mode 100644 index 000000000000..95a076389429 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/XApiReader.cs @@ -0,0 +1,384 @@ +// +// XApiReader.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.XPath; + +using Mono.Cecil; +using Mono.Collections.Generic; + +namespace Mono.Linker { + + public class XApiReader { + + static readonly string _name = "name"; + static readonly string _ns = string.Empty; + + LinkContext _context; + XPathDocument _document; + IXApiVisitor _visitor; + + AssemblyDefinition _assembly; + string _namespace; + Stack _types = new Stack (); + StringBuilder _signature; + + public XApiReader (XPathDocument document, IXApiVisitor visitor) + { + _document = document; + _visitor = visitor; + } + + public void Process (LinkContext context) + { + _context = context; + ProcessAssemblies (_document.CreateNavigator ()); + } + + void OnAssembly (XPathNavigator nav) + { + _assembly = GetAssembly (nav); + + _visitor.OnAssembly (nav, _assembly); + + ProcessAttributes (nav); + ProcessNamespaces (nav); + } + + AssemblyDefinition GetAssembly (XPathNavigator nav) + { + AssemblyNameReference name = new AssemblyNameReference ( + GetName (nav), + new Version (GetAttribute (nav, "version"))); + + AssemblyDefinition assembly = _context.Resolve (name); + ProcessReferences (assembly); + return assembly; + } + + void ProcessReferences (AssemblyDefinition assembly) + { + foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences) + _context.Resolve (name); + } + + void OnAttribute (XPathNavigator nav) + { + _visitor.OnAttribute (nav); + } + + void PushType (TypeDefinition type) + { + _types.Push (type); + } + + TypeDefinition PeekType () + { + return _types.Peek (); + } + + TypeDefinition PopType () + { + return _types.Pop (); + } + + void OnNamespace (XPathNavigator nav) + { + _namespace = GetName (nav); + + ProcessClasses (nav); + } + + void OnClass (XPathNavigator nav) + { + string name = GetClassName (nav); + + TypeDefinition type = _assembly.MainModule.GetType (name); + if (type is null) + return; + + _visitor.OnClass (nav, type); + + PushType (type); + + ProcessAttributes (nav); + ProcessInterfaces (nav); + ProcessFields (nav); + ProcessMethods (nav); + ProcessConstructors (nav); + ProcessProperties (nav); + ProcessEvents (nav); + ProcessClasses (nav); + + PopType (); + } + + string GetClassName (XPathNavigator nav) + { + if (IsNestedClass ()) + return PeekType ().FullName + "/" + GetName (nav); + + return _namespace + "." + GetName (nav); + } + + bool IsNestedClass () + { + return _types.Count > 0; + } + + void OnField (XPathNavigator nav) + { + TypeDefinition declaring = PeekType (); + + FieldDefinition field = declaring.Fields.FirstOrDefault (f => f.Name == GetName (nav)); + if (field is not null) + _visitor.OnField (nav, field); + + ProcessAttributes (nav); + } + + void OnInterface (XPathNavigator nav) + { + string name = GetName (nav); + + TypeDefinition type = _context.GetType (GetTypeName (name)); + if (type is not null) + _visitor.OnInterface (nav, type); + } + + void OnMethod (XPathNavigator nav) + { + InitMethodSignature (nav); + + ProcessParameters (nav); + + string signature = GetMethodSignature (); + + MethodDefinition method = GetMethod (signature); + if (method is not null) + _visitor.OnMethod (nav, method); + + ProcessAttributes (nav); + } + + MethodDefinition GetMethod (string signature) + { + return GetMethod (PeekType ().Methods, signature); + } + + static MethodDefinition GetMethod (Collection methods, string signature) + { + foreach (MethodDefinition method in methods) + if (signature == GetSignature (method)) + return method; + + return null; + } + + static string GetSignature (MethodDefinition method) + { + return method.ToString ().Replace ("<", "[").Replace (">", "]"); + } + + string GetMethodSignature () + { + _signature.Append (")"); + return _signature.ToString (); + } + + void InitMethodSignature (XPathNavigator nav) + { + _signature = new StringBuilder (); + + string returntype = GetAttribute (nav, "returntype"); + if (returntype is null || returntype.Length == 0) + returntype = "System.Void"; + + _signature.Append (NormalizeTypeName (returntype)); + _signature.Append (" "); + _signature.Append (PeekType ().FullName); + _signature.Append ("::"); + + string name = GetName (nav); + _signature.Append (GetMethodName (name)); + + _signature.Append ("("); + } + + static string GetMethodName (string name) + { + return GetStringBefore (name, "("); + } + + static string NormalizeTypeName (string name) + { + return name.Replace ("+", "/").Replace ("<", "[").Replace (">", "]"); + } + + static string GetTypeName (string name) + { + return GetStringBefore (NormalizeTypeName (name), "["); + } + + static string GetStringBefore (string str, string marker) + { + int pos = str.IndexOf (marker); + if (pos == -1) + return str; + + return str.Substring (0, pos); + } + + void OnParameter (XPathNavigator nav) + { + string type = GetAttribute (nav, "type"); + int pos = int.Parse (GetAttribute (nav, "position")); + + if (pos > 0) + _signature.Append (","); + _signature.Append (NormalizeTypeName (type)); + } + + void OnConstructor (XPathNavigator nav) + { + InitMethodSignature (nav); + + ProcessParameters (nav); + + string signature = GetMethodSignature (); + + MethodDefinition ctor = GetMethod (signature); + if (ctor is not null) + _visitor.OnConstructor (nav, ctor); + + ProcessAttributes (nav); + } + + void OnProperty (XPathNavigator nav) + { + string name = GetName (nav); + TypeDefinition type = PeekType (); + + var property = type.Properties.FirstOrDefault (p => p.Name == name); + if (property is not null) + _visitor.OnProperty (nav, property); + + ProcessAttributes (nav); + ProcessMethods (nav); + } + + void OnEvent (XPathNavigator nav) + { + string name = GetName (nav); + TypeDefinition type = PeekType (); + + EventDefinition evt = type.Events.FirstOrDefault (e => e.Name == name); + if (evt is not null) + _visitor.OnEvent (nav, evt); + + ProcessAttributes (nav); + } + + void ProcessAssemblies (XPathNavigator nav) + { + ProcessChildren (nav, "assemblies//assembly", new OnChildren (OnAssembly)); + } + + void ProcessAttributes (XPathNavigator nav) + { + ProcessChildren (nav, "attributes//attribute", new OnChildren (OnAttribute)); + } + + void ProcessNamespaces (XPathNavigator nav) + { + ProcessChildren (nav, "namespaces//namespace", new OnChildren (OnNamespace)); + } + + void ProcessClasses (XPathNavigator nav) + { + ProcessChildren (nav, "classes//class", new OnChildren (OnClass)); + } + + void ProcessInterfaces (XPathNavigator nav) + { + ProcessChildren (nav, "interfaces//interface", new OnChildren (OnInterface)); + } + + void ProcessFields (XPathNavigator nav) + { + ProcessChildren (nav, "fields//field", new OnChildren (OnField)); + } + + void ProcessMethods (XPathNavigator nav) + { + ProcessChildren (nav, "methods//method", new OnChildren (OnMethod)); + } + + void ProcessConstructors (XPathNavigator nav) + { + ProcessChildren (nav, "constructors//constructor", new OnChildren (OnConstructor)); + } + + void ProcessParameters (XPathNavigator nav) + { + ProcessChildren (nav, "parameters//parameter", new OnChildren (OnParameter)); + } + + void ProcessProperties (XPathNavigator nav) + { + ProcessChildren (nav, "properties//property", new OnChildren (OnProperty)); + } + + void ProcessEvents (XPathNavigator nav) + { + ProcessChildren (nav, "events//event", new OnChildren (OnEvent)); + } + + static void ProcessChildren (XPathNavigator nav, string children, OnChildren action) + { + XPathNodeIterator iterator = nav.Select (children); + while (iterator.MoveNext ()) + action (iterator.Current); + } + + delegate void OnChildren (XPathNavigator nav); + + static string GetName (XPathNavigator nav) + { + return GetAttribute (nav, _name); + } + + static string GetAttribute (XPathNavigator nav, string attribute) + { + return nav.GetAttribute (attribute, _ns); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/XmlDependencyRecorder.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/XmlDependencyRecorder.cs new file mode 100644 index 000000000000..87d32b8d8bda --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker/XmlDependencyRecorder.cs @@ -0,0 +1,213 @@ +// +// Tracer.cs +// +// Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using Mono.Cecil; +using Mono.Linker.Steps; +using System; +using System.IO; +using System.IO.Compression; +using System.Xml; + +namespace Mono.Linker { + /// + /// Class which implements IDependencyRecorder and writes the dependencies into an XML file. + /// + public class XmlDependencyRecorder : IDependencyRecorder, IDisposable { + public const string DefaultDependenciesFileName = "linker-dependencies.xml.gz"; + + private readonly LinkContext context; + private XmlWriter writer; + private Stream stream; + + public XmlDependencyRecorder (LinkContext context, string fileName = null) + { + this.context = context; + + XmlWriterSettings settings = new XmlWriterSettings { + Indent = true, + IndentChars = "\t" + }; + + if (fileName is null) + fileName = DefaultDependenciesFileName; + + if (string.IsNullOrEmpty (Path.GetDirectoryName (fileName)) && !string.IsNullOrEmpty (context.OutputDirectory)) { + fileName = Path.Combine (context.OutputDirectory, fileName); + Directory.CreateDirectory (context.OutputDirectory); + } + + var depsFile = File.OpenWrite (fileName); + + if (Path.GetExtension (fileName) == ".xml") + stream = depsFile; + else + stream = new GZipStream (depsFile, CompressionMode.Compress); + + writer = XmlWriter.Create (stream, settings); + writer.WriteStartDocument (); + writer.WriteStartElement ("dependencies"); + writer.WriteStartAttribute ("version"); + writer.WriteString ("1.2"); + writer.WriteEndAttribute (); + } + + public void Dispose () + { + if (writer is null) + return; + + writer.WriteEndElement (); + writer.WriteEndDocument (); + writer.Flush (); + writer.Dispose (); + stream.Dispose (); + writer = null; + stream = null; + } + + public void RecordDependency (object source, object target, bool marked) + { + if (!ShouldRecord (source) && !ShouldRecord (target)) + return; + + // This is a hack to work around a quirk of MarkStep that results in outputting ~6k edges even with the above ShouldRecord checks. + // What happens is that due to the method queueing in MarkStep, the dependency chain is broken in many cases. And in these cases + // we end up adding an edge for MarkStep -> + // This isn't particularly useful information since it's incomplete, but it's especially not useful in ReducedTracing mode when there is one of these for + // every class library method that was queued. + if (context.EnableReducedTracing && source is MarkStep && !ShouldRecord (target)) + return; + + // This is another hack to prevent useless information from being logged. With the introduction of interface sweeping there are a lot of edges such as + // `e="InterfaceImpl:Mono.Cecil.InterfaceImplementation"` which are useless information. Ideally we would format the interface implementation into a meaningful format + // however I don't think that is worth the effort at the moment. + if (target is InterfaceImplementation) + return; + + if (source != target) { + writer.WriteStartElement ("edge"); + if (marked) + writer.WriteAttributeString ("mark", "1"); + writer.WriteAttributeString ("b", TokenString (source)); + writer.WriteAttributeString ("e", TokenString (target)); + writer.WriteEndElement (); + } + } + + static bool IsAssemblyBound (TypeDefinition td) + { + do { + if (td.IsNestedPrivate || td.IsNestedAssembly || td.IsNestedFamilyAndAssembly) + return true; + + td = td.DeclaringType; + } while (td is not null); + + return false; + } + + string TokenString (object o) + { + if (o is null) + return "N:null"; + + if (o is TypeReference t) { + bool addAssembly = true; + var td = t as TypeDefinition ?? t.Resolve (); + + if (td is not null) { + addAssembly = td.IsNotPublic || IsAssemblyBound (td); + t = td; + } + + var addition = addAssembly ? $":{t.Module}" : ""; + + return $"{(o as IMetadataTokenProvider).MetadataToken.TokenType}:{o}{addition}"; + } + + if (o is IMetadataTokenProvider) + return (o as IMetadataTokenProvider).MetadataToken.TokenType + ":" + o; + + return "Other:" + o; + } + + bool WillAssemblyBeModified (AssemblyDefinition assembly) + { + switch (context.Annotations.GetAction (assembly)) { + case AssemblyAction.Link: + case AssemblyAction.AddBypassNGen: + case AssemblyAction.AddBypassNGenUsed: + return true; + default: + return false; + } + } + + bool ShouldRecord (object o) + { + if (!context.EnableReducedTracing) + return true; + + if (o is TypeDefinition t) + return WillAssemblyBeModified (t.Module.Assembly); + + if (o is IMemberDefinition m) + return WillAssemblyBeModified (m.DeclaringType.Module.Assembly); + + if (o is TypeReference typeRef) { + var resolved = typeRef.Resolve (); + + // Err on the side of caution if we can't resolve + if (resolved is null) + return true; + + return WillAssemblyBeModified (resolved.Module.Assembly); + } + + if (o is MemberReference mRef) { + var resolved = mRef.Resolve (); + + // Err on the side of caution if we can't resolve + if (resolved is null) + return true; + + return WillAssemblyBeModified (resolved.DeclaringType.Module.Assembly); + } + + if (o is ModuleDefinition module) + return WillAssemblyBeModified (module.Assembly); + + if (o is AssemblyDefinition assembly) + return WillAssemblyBeModified (assembly); + + if (o is ParameterDefinition parameter) { + if (parameter.Method is MethodDefinition parameterMethodDefinition) + return WillAssemblyBeModified (parameterMethodDefinition.DeclaringType.Module.Assembly); + } + + return true; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs new file mode 100644 index 000000000000..942907d00fde --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/ApplyPreserveAttributeBase.cs @@ -0,0 +1,164 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Cecil; + +namespace Mono.Tuner { + + public abstract class ApplyPreserveAttributeBase : BaseSubStep { + + // set 'removeAttribute' to true if you want the preserved attribute to be removed from the final assembly + protected abstract bool IsPreservedAttribute (ICustomAttributeProvider provider, CustomAttribute attribute, out bool removeAttribute); + + public override SubStepTargets Targets { + get { + return SubStepTargets.Type + | SubStepTargets.Field + | SubStepTargets.Method + | SubStepTargets.Property + | SubStepTargets.Event; + } + } + + public override bool IsActiveFor (AssemblyDefinition assembly) + { + return !Profile.IsSdkAssembly (assembly) && Annotations.GetAction (assembly) == AssemblyAction.Link; + } + + public override void ProcessType (TypeDefinition type) + { + TryApplyPreserveAttribute (type); + } + + public override void ProcessField (FieldDefinition field) + { + foreach (var attribute in GetPreserveAttributes (field)) + Mark (field, attribute); + } + + public override void ProcessMethod (MethodDefinition method) + { + MarkMethodIfPreserved (method); + } + + public override void ProcessProperty (PropertyDefinition property) + { + foreach (var attribute in GetPreserveAttributes (property)) { + MarkMethod (property.GetMethod, attribute); + MarkMethod (property.SetMethod, attribute); + } + } + + public override void ProcessEvent (EventDefinition @event) + { + foreach (var attribute in GetPreserveAttributes (@event)) { + MarkMethod (@event.AddMethod, attribute); + MarkMethod (@event.InvokeMethod, attribute); + MarkMethod (@event.RemoveMethod, attribute); + } + } + + void MarkMethodIfPreserved (MethodDefinition method) + { + foreach (var attribute in GetPreserveAttributes (method)) + MarkMethod (method, attribute); + } + + void MarkMethod (MethodDefinition method, CustomAttribute preserve_attribute) + { + if (method is null) + return; + + Mark (method, preserve_attribute); + Annotations.SetAction (method, MethodAction.Parse); + } + + void Mark (IMetadataTokenProvider provider, CustomAttribute preserve_attribute) + { + if (IsConditionalAttribute (preserve_attribute)) { + PreserveConditional (provider); + return; + } + + PreserveUnconditional (provider); + } + + void PreserveConditional (IMetadataTokenProvider provider) + { + var method = provider as MethodDefinition; + if (method is null) { + // workaround to support (uncommon but valid) conditional fields form [Preserve] + PreserveUnconditional (provider); + return; + } + + Annotations.AddPreservedMethod (method.DeclaringType, method); + } + + static bool IsConditionalAttribute (CustomAttribute attribute) + { + if (attribute is null) + return false; + + foreach (var named_argument in attribute.Fields) + if (named_argument.Name == "Conditional") + return (bool) named_argument.Argument.Value; + + return false; + } + + void PreserveUnconditional (IMetadataTokenProvider provider) + { + Annotations.Mark (provider); + + var member = provider as IMemberDefinition; + if (member is null || member.DeclaringType is null) + return; + + Mark (member.DeclaringType, null); + } + + void TryApplyPreserveAttribute (TypeDefinition type) + { + foreach (var attribute in GetPreserveAttributes (type)) { + Annotations.Mark (type); + + if (!attribute.HasFields) + continue; + + foreach (var named_argument in attribute.Fields) + if (named_argument.Name == "AllMembers" && (bool) named_argument.Argument.Value) + Annotations.SetPreserve (type, TypePreserve.All); + } + } + + List GetPreserveAttributes (ICustomAttributeProvider provider) + { + List attrs = new List (); + + if (!provider.HasCustomAttributes) + return attrs; + + var attributes = provider.CustomAttributes; + + for (int i = attributes.Count - 1; i >= 0; i--) { + var attribute = attributes [i]; + + bool remote_attribute; + if (!IsPreservedAttribute (provider, attribute, out remote_attribute)) + continue; + + attrs.Add (attribute); + if (remote_attribute) + attributes.RemoveAt (i); + } + + return attrs; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/CecilRocks.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/CecilRocks.cs new file mode 100644 index 000000000000..6d2abeef6e04 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/CecilRocks.cs @@ -0,0 +1,519 @@ +// +// MethodBodyRocks.cs +// +// Author: +// Jb Evain (jbevain@gmail.com) +// +// Copyright (c) 2008 - 2011 Jb Evain +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Linq; + +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace Mono.Tuner { + + public static class MethodBodyRocks { + + public static IEnumerable GetAllTypes (this ModuleDefinition self) + { + return self.Types.SelectMany (t => t.GetAllTypes ()); + } + + static IEnumerable GetAllTypes (this TypeDefinition self) + { + yield return self; + + if (!self.HasNestedTypes) + yield break; + + foreach (var type in self.NestedTypes.SelectMany (t => t.GetAllTypes ())) + yield return type; + } + + public static IEnumerable GetMethods (this TypeDefinition self) + { + return self.Methods.Where (m => !m.IsConstructor); + } + + public static IEnumerable GetConstructors (this TypeDefinition self) + { + return self.Methods.Where (m => m.IsConstructor); + } + + public static MethodDefinition GetTypeConstructor (this TypeDefinition self) + { + return self.GetConstructors ().FirstOrDefault (c => c.IsStatic); + } + + public static void SimplifyMacros (this MethodBody self) + { + if (self is null) + throw new ArgumentNullException ("self"); + + foreach (var instruction in self.Instructions) { + if (instruction.OpCode.OpCodeType != OpCodeType.Macro) + continue; + + switch (instruction.OpCode.Code) { + case Code.Ldarg_0: + ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (0)); + break; + case Code.Ldarg_1: + ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (1)); + break; + case Code.Ldarg_2: + ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (2)); + break; + case Code.Ldarg_3: + ExpandMacro (instruction, OpCodes.Ldarg, self.GetParameter (3)); + break; + case Code.Ldloc_0: + ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [0]); + break; + case Code.Ldloc_1: + ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [1]); + break; + case Code.Ldloc_2: + ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [2]); + break; + case Code.Ldloc_3: + ExpandMacro (instruction, OpCodes.Ldloc, self.Variables [3]); + break; + case Code.Stloc_0: + ExpandMacro (instruction, OpCodes.Stloc, self.Variables [0]); + break; + case Code.Stloc_1: + ExpandMacro (instruction, OpCodes.Stloc, self.Variables [1]); + break; + case Code.Stloc_2: + ExpandMacro (instruction, OpCodes.Stloc, self.Variables [2]); + break; + case Code.Stloc_3: + ExpandMacro (instruction, OpCodes.Stloc, self.Variables [3]); + break; + case Code.Ldarg_S: + instruction.OpCode = OpCodes.Ldarg; + break; + case Code.Ldarga_S: + instruction.OpCode = OpCodes.Ldarga; + break; + case Code.Starg_S: + instruction.OpCode = OpCodes.Starg; + break; + case Code.Ldloc_S: + instruction.OpCode = OpCodes.Ldloc; + break; + case Code.Ldloca_S: + instruction.OpCode = OpCodes.Ldloca; + break; + case Code.Stloc_S: + instruction.OpCode = OpCodes.Stloc; + break; + case Code.Ldc_I4_M1: + ExpandMacro (instruction, OpCodes.Ldc_I4, -1); + break; + case Code.Ldc_I4_0: + ExpandMacro (instruction, OpCodes.Ldc_I4, 0); + break; + case Code.Ldc_I4_1: + ExpandMacro (instruction, OpCodes.Ldc_I4, 1); + break; + case Code.Ldc_I4_2: + ExpandMacro (instruction, OpCodes.Ldc_I4, 2); + break; + case Code.Ldc_I4_3: + ExpandMacro (instruction, OpCodes.Ldc_I4, 3); + break; + case Code.Ldc_I4_4: + ExpandMacro (instruction, OpCodes.Ldc_I4, 4); + break; + case Code.Ldc_I4_5: + ExpandMacro (instruction, OpCodes.Ldc_I4, 5); + break; + case Code.Ldc_I4_6: + ExpandMacro (instruction, OpCodes.Ldc_I4, 6); + break; + case Code.Ldc_I4_7: + ExpandMacro (instruction, OpCodes.Ldc_I4, 7); + break; + case Code.Ldc_I4_8: + ExpandMacro (instruction, OpCodes.Ldc_I4, 8); + break; + case Code.Ldc_I4_S: + ExpandMacro (instruction, OpCodes.Ldc_I4, (int) (sbyte) instruction.Operand); + break; + case Code.Br_S: + instruction.OpCode = OpCodes.Br; + break; + case Code.Brfalse_S: + instruction.OpCode = OpCodes.Brfalse; + break; + case Code.Brtrue_S: + instruction.OpCode = OpCodes.Brtrue; + break; + case Code.Beq_S: + instruction.OpCode = OpCodes.Beq; + break; + case Code.Bge_S: + instruction.OpCode = OpCodes.Bge; + break; + case Code.Bgt_S: + instruction.OpCode = OpCodes.Bgt; + break; + case Code.Ble_S: + instruction.OpCode = OpCodes.Ble; + break; + case Code.Blt_S: + instruction.OpCode = OpCodes.Blt; + break; + case Code.Bne_Un_S: + instruction.OpCode = OpCodes.Bne_Un; + break; + case Code.Bge_Un_S: + instruction.OpCode = OpCodes.Bge_Un; + break; + case Code.Bgt_Un_S: + instruction.OpCode = OpCodes.Bgt_Un; + break; + case Code.Ble_Un_S: + instruction.OpCode = OpCodes.Ble_Un; + break; + case Code.Blt_Un_S: + instruction.OpCode = OpCodes.Blt_Un; + break; + case Code.Leave_S: + instruction.OpCode = OpCodes.Leave; + break; + } + } + } + + static void ExpandMacro (Instruction instruction, OpCode opcode, object operand) + { + instruction.OpCode = opcode; + instruction.Operand = operand; + } + + static void MakeMacro (Instruction instruction, OpCode opcode) + { + instruction.OpCode = opcode; + instruction.Operand = null; + } + + public static void OptimizeMacros (this MethodBody self) + { + if (self is null) + throw new ArgumentNullException ("self"); + + var method = self.Method; + + foreach (var instruction in self.Instructions) { + int index; + switch (instruction.OpCode.Code) { + case Code.Ldarg: + index = ((ParameterDefinition) instruction.Operand).Index; + if (index == -1 && instruction.Operand == self.ThisParameter) + index = 0; + else if (method.HasThis) + index++; + + switch (index) { + case 0: + MakeMacro (instruction, OpCodes.Ldarg_0); + break; + case 1: + MakeMacro (instruction, OpCodes.Ldarg_1); + break; + case 2: + MakeMacro (instruction, OpCodes.Ldarg_2); + break; + case 3: + MakeMacro (instruction, OpCodes.Ldarg_3); + break; + default: + if (index < 256) + ExpandMacro (instruction, OpCodes.Ldarg_S, instruction.Operand); + break; + } + break; + case Code.Ldloc: + index = ((VariableDefinition) instruction.Operand).Index; + switch (index) { + case 0: + MakeMacro (instruction, OpCodes.Ldloc_0); + break; + case 1: + MakeMacro (instruction, OpCodes.Ldloc_1); + break; + case 2: + MakeMacro (instruction, OpCodes.Ldloc_2); + break; + case 3: + MakeMacro (instruction, OpCodes.Ldloc_3); + break; + default: + if (index < 256) + ExpandMacro (instruction, OpCodes.Ldloc_S, instruction.Operand); + break; + } + break; + case Code.Stloc: + index = ((VariableDefinition) instruction.Operand).Index; + switch (index) { + case 0: + MakeMacro (instruction, OpCodes.Stloc_0); + break; + case 1: + MakeMacro (instruction, OpCodes.Stloc_1); + break; + case 2: + MakeMacro (instruction, OpCodes.Stloc_2); + break; + case 3: + MakeMacro (instruction, OpCodes.Stloc_3); + break; + default: + if (index < 256) + ExpandMacro (instruction, OpCodes.Stloc_S, instruction.Operand); + break; + } + break; + case Code.Ldarga: + index = ((ParameterDefinition) instruction.Operand).Index; + if (index == -1 && instruction.Operand == self.ThisParameter) + index = 0; + else if (method.HasThis) + index++; + if (index < 256) + ExpandMacro (instruction, OpCodes.Ldarga_S, instruction.Operand); + break; + case Code.Ldloca: + if (((VariableDefinition) instruction.Operand).Index < 256) + ExpandMacro (instruction, OpCodes.Ldloca_S, instruction.Operand); + break; + case Code.Ldc_I4: + int i = (int) instruction.Operand; + switch (i) { + case -1: + MakeMacro (instruction, OpCodes.Ldc_I4_M1); + break; + case 0: + MakeMacro (instruction, OpCodes.Ldc_I4_0); + break; + case 1: + MakeMacro (instruction, OpCodes.Ldc_I4_1); + break; + case 2: + MakeMacro (instruction, OpCodes.Ldc_I4_2); + break; + case 3: + MakeMacro (instruction, OpCodes.Ldc_I4_3); + break; + case 4: + MakeMacro (instruction, OpCodes.Ldc_I4_4); + break; + case 5: + MakeMacro (instruction, OpCodes.Ldc_I4_5); + break; + case 6: + MakeMacro (instruction, OpCodes.Ldc_I4_6); + break; + case 7: + MakeMacro (instruction, OpCodes.Ldc_I4_7); + break; + case 8: + MakeMacro (instruction, OpCodes.Ldc_I4_8); + break; + default: + if (i >= -128 && i < 128) + ExpandMacro (instruction, OpCodes.Ldc_I4_S, (sbyte) i); + break; + } + break; + } + } + + OptimizeBranches (self); + } + + static void OptimizeBranches (MethodBody body) + { + ComputeOffsets (body); + + foreach (var instruction in body.Instructions) { + if (instruction.OpCode.OperandType != OperandType.InlineBrTarget) + continue; + + if (OptimizeBranch (instruction)) + ComputeOffsets (body); + } + } + + static bool OptimizeBranch (Instruction instruction) + { + var offset = ((Instruction) instruction.Operand).Offset - (instruction.Offset + instruction.OpCode.Size + 4); + if (!(offset >= -128 && offset <= 127)) + return false; + + switch (instruction.OpCode.Code) { + case Code.Br: + instruction.OpCode = OpCodes.Br_S; + break; + case Code.Brfalse: + instruction.OpCode = OpCodes.Brfalse_S; + break; + case Code.Brtrue: + instruction.OpCode = OpCodes.Brtrue_S; + break; + case Code.Beq: + instruction.OpCode = OpCodes.Beq_S; + break; + case Code.Bge: + instruction.OpCode = OpCodes.Bge_S; + break; + case Code.Bgt: + instruction.OpCode = OpCodes.Bgt_S; + break; + case Code.Ble: + instruction.OpCode = OpCodes.Ble_S; + break; + case Code.Blt: + instruction.OpCode = OpCodes.Blt_S; + break; + case Code.Bne_Un: + instruction.OpCode = OpCodes.Bne_Un_S; + break; + case Code.Bge_Un: + instruction.OpCode = OpCodes.Bge_Un_S; + break; + case Code.Bgt_Un: + instruction.OpCode = OpCodes.Bgt_Un_S; + break; + case Code.Ble_Un: + instruction.OpCode = OpCodes.Ble_Un_S; + break; + case Code.Blt_Un: + instruction.OpCode = OpCodes.Blt_Un_S; + break; + case Code.Leave: + instruction.OpCode = OpCodes.Leave_S; + break; + } + + return true; + } + + static void ComputeOffsets (MethodBody body) + { + var offset = 0; + foreach (var instruction in body.Instructions) { + instruction.Offset = offset; + offset += instruction.GetSize (); + } + } + + public static ParameterDefinition GetParameter (this MethodBody self, int index) + { + var method = self.Method; + + if (method.HasThis) { + if (index == 0) + return self.ThisParameter; + + index--; + } + + var parameters = method.Parameters; + + if (index < 0 || index >= parameters.Count) + return null; + + return parameters [index]; + } + + public static bool Implements (this TypeReference self, string interfaceName) + { + if (interfaceName is null) + throw new ArgumentNullException ("interfaceName"); + if (self is null) + return false; + + TypeDefinition type = self.Resolve (); + if (type is null) + return false; // not enough information available + + // special case, check if we implement ourselves + if (type.IsInterface && (type.FullName == interfaceName)) + return true; + + return Implements (type, interfaceName, (interfaceName.IndexOf ('`') >= 0)); + } + + public static bool Implements (TypeDefinition type, string interfaceName, bool generic) + { + while (type is not null) { + // does the type implements it itself + if (type.HasInterfaces) { + foreach (var iface in type.Interfaces) { + string fullname = (generic) ? iface.InterfaceType.GetElementType ().FullName : iface.InterfaceType.FullName; + if (fullname == interfaceName) + return true; + //if not, then maybe one of its parent interfaces does + if (Implements (iface.InterfaceType.Resolve (), interfaceName, generic)) + return true; + } + } + + type = type.BaseType is not null ? type.BaseType.Resolve () : null; + } + return false; + } + + public static bool Inherits (this TypeReference self, string @namespace, string name) + { + if (@namespace is null) + throw new ArgumentNullException ("namespace"); + if (name is null) + throw new ArgumentNullException ("name"); + if (self is null) + return false; + + TypeReference current = self.Resolve (); + while (current is not null) { + if (current.Is (@namespace, name)) + return true; + if (current.Is ("System", "Object")) + return false; + + TypeDefinition td = current.Resolve (); + if (td is null) + return false; // could not resolve type + current = td.BaseType; + } + return false; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/CustomizeActions.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/CustomizeActions.cs new file mode 100644 index 000000000000..38e2ad97fbf4 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/CustomizeActions.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace Mono.Tuner { + + public class CustomizeActions : BaseStep { + + readonly bool link_sdk_only; + readonly HashSet skipped_assemblies; + + public CustomizeActions (bool link_sdk_only, IEnumerable skipped_assemblies) + { + this.link_sdk_only = link_sdk_only; + this.skipped_assemblies = new HashSet (skipped_assemblies); + } + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + if (!IsSkipped (assembly) && IsLinked (assembly)) { + if (!Annotations.HasAction (assembly)) // stray assembly not picked up when resolving references + Annotations.SetAction (assembly, AssemblyAction.Link); + return; + } + ProcessUserAssembly (assembly); + } + + protected virtual bool IsPreservedAttribute (CustomAttribute attribute) + { + // [assembly: Preserve (type)] does not preserve all the code in the assembly, in fact it might + // not preserve anything in _this_ assembly, but something in a separate assembly (reference) + if (attribute.HasConstructorArguments) + return false; + return (attribute.AttributeType.Name == "PreserveAttribute"); + } + + protected virtual bool IsLinkerSafeAttribute (CustomAttribute attribute) + { + return (attribute.AttributeType.Name == "LinkerSafeAttribute"); + } + + const ModuleAttributes Supported = ModuleAttributes.ILOnly | ModuleAttributes.Required32Bit | + ModuleAttributes.Preferred32Bit | ModuleAttributes.StrongNameSigned; + + protected virtual bool IsSkipped (AssemblyDefinition assembly) + { + // Cecil can't save back mixed-mode assemblies - so we can't link them + if ((assembly.MainModule.Attributes & ~Supported) != 0) + return true; + + if (assembly.HasCustomAttributes) { + foreach (var ca in assembly.CustomAttributes) { + if (IsPreservedAttribute (ca)) + return true; + } + } + return skipped_assemblies.Contains (assembly.Name.Name); + } + + protected virtual bool IsLinked (AssemblyDefinition assembly) + { + // LinkAll + if (!link_sdk_only) + return true; + // Link SDK : applies to BCL/SDK and product assembly (e.g. monotouch.dll) + if (Profile.IsSdkAssembly (assembly)) + return true; + if (Profile.IsProductAssembly (assembly)) + return true; + // the assembly can be marked with [LinkAssembly] + if (assembly.HasCustomAttributes) { + foreach (var ca in assembly.CustomAttributes) { + if (IsLinkerSafeAttribute (ca)) + return true; + } + } + return false; + } + + protected void ProcessUserAssembly (AssemblyDefinition assembly) + { + ResolveFromAssemblyStep.ProcessLibrary (Context, assembly); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Dispatcher.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Dispatcher.cs new file mode 100644 index 000000000000..e10c7b6c6f91 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Dispatcher.cs @@ -0,0 +1,310 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Cecil; + +namespace Mono.Tuner { + + [Flags] + public enum SubStepTargets { + None = 0, + + Assembly = 1, + Type = 2, + Field = 4, + Method = 8, + Property = 16, + Event = 32, + } + + public interface ISubStep { + + SubStepTargets Targets { get; } + + void Initialize (LinkContext context); + bool IsActiveFor (AssemblyDefinition assembly); + + void ProcessAssembly (AssemblyDefinition assembly); + void ProcessType (TypeDefinition type); + void ProcessField (FieldDefinition field); + void ProcessMethod (MethodDefinition method); + void ProcessProperty (PropertyDefinition property); + void ProcessEvent (EventDefinition @event); + } + + public abstract class BaseSubStep : ISubStep { + + protected LinkContext context; + + public AnnotationStore Annotations { + get { return context.Annotations; } + } + + public abstract SubStepTargets Targets { get; } + + public virtual void Initialize (LinkContext context) + { + this.context = context; + } + + public virtual bool IsActiveFor (AssemblyDefinition assembly) + { + return true; + } + + public virtual void ProcessAssembly (AssemblyDefinition assembly) + { + } + + public virtual void ProcessType (TypeDefinition type) + { + } + + public virtual void ProcessField (FieldDefinition field) + { + } + + public virtual void ProcessMethod (MethodDefinition method) + { + } + + public virtual void ProcessProperty (PropertyDefinition property) + { + } + + public virtual void ProcessEvent (EventDefinition @event) + { + } + } + + public class SubStepDispatcher : IStep, IEnumerable { + + List substeps = new List (); + + List on_assemblies; + List on_types; + List on_fields; + List on_methods; + List on_properties; + List on_events; + + Tracer tracer; + + public void Add (ISubStep substep) + { + substeps.Add (substep); + } + + public void Process (LinkContext context) + { + tracer = context.Tracer; + + InitializeSubSteps (context); + + BrowseAssemblies (context.GetAssemblies ()); + } + + void Push (ISubStep subStep) + { + if (tracer is not null) + tracer.Push (subStep); + } + + void Pop () + { + if (tracer is not null) + tracer.Pop (); + } + + static bool HasSubSteps (List substeps) + { + return substeps is not null && substeps.Count > 0; + } + + void BrowseAssemblies (IEnumerable assemblies) + { + foreach (var assembly in assemblies) { + CategorizeSubSteps (assembly); + + if (HasSubSteps (on_assemblies)) + DispatchAssembly (assembly); + + if (!ShouldDispatchTypes ()) + continue; + + BrowseTypes (assembly.MainModule.Types); + } + } + + bool ShouldDispatchTypes () + { + return HasSubSteps (on_types) + || HasSubSteps (on_fields) + || HasSubSteps (on_methods) + || HasSubSteps (on_properties) + || HasSubSteps (on_events); + } + + void BrowseTypes (ICollection types) + { + foreach (TypeDefinition type in types) { + DispatchType (type); + + if (type.HasFields && HasSubSteps (on_fields)) + BrowseFields (type.Fields); + + if (type.HasMethods && HasSubSteps (on_methods)) + BrowseMethods (type.Methods); + + if (type.HasProperties && HasSubSteps (on_properties)) + BrowseProperties (type.Properties); + + if (type.HasEvents && HasSubSteps (on_events)) + BrowseEvents (type.Events); + + if (type.HasNestedTypes) + BrowseTypes (type.NestedTypes); + } + } + + void BrowseFields (ICollection fields) + { + foreach (FieldDefinition field in fields) + DispatchField (field); + } + + void BrowseMethods (ICollection methods) + { + foreach (MethodDefinition method in methods) + DispatchMethod (method); + } + + void BrowseProperties (ICollection properties) + { + foreach (PropertyDefinition property in properties) + DispatchProperty (property); + } + + void BrowseEvents (ICollection events) + { + foreach (EventDefinition @event in events) + DispatchEvent (@event); + } + + void DispatchAssembly (AssemblyDefinition assembly) + { + foreach (var substep in on_assemblies) { + Push (substep); + substep.ProcessAssembly (assembly); + Pop (); + } + } + + void DispatchType (TypeDefinition type) + { + foreach (var substep in on_types) { + Push (substep); + substep.ProcessType (type); + Pop (); + } + } + + void DispatchField (FieldDefinition field) + { + foreach (var substep in on_fields) { + Push (substep); + substep.ProcessField (field); + Pop (); + } + } + + void DispatchMethod (MethodDefinition method) + { + foreach (var substep in on_methods) { + Push (substep); + substep.ProcessMethod (method); + Pop (); + } + } + + void DispatchProperty (PropertyDefinition property) + { + foreach (var substep in on_properties) { + Push (substep); + substep.ProcessProperty (property); + Pop (); + } + } + + void DispatchEvent (EventDefinition @event) + { + foreach (var substep in on_events) { + Push (substep); + substep.ProcessEvent (@event); + Pop (); + } + } + + void InitializeSubSteps (LinkContext context) + { + foreach (var substep in substeps) + substep.Initialize (context); + } + + void CategorizeSubSteps (AssemblyDefinition assembly) + { + on_assemblies = null; + on_types = null; + on_fields = null; + on_methods = null; + on_properties = null; + on_events = null; + + foreach (var substep in substeps) + CategorizeSubStep (substep, assembly); + } + + void CategorizeSubStep (ISubStep substep, AssemblyDefinition assembly) + { + if (!substep.IsActiveFor (assembly)) + return; + + CategorizeTarget (substep, SubStepTargets.Assembly, ref on_assemblies); + CategorizeTarget (substep, SubStepTargets.Type, ref on_types); + CategorizeTarget (substep, SubStepTargets.Field, ref on_fields); + CategorizeTarget (substep, SubStepTargets.Method, ref on_methods); + CategorizeTarget (substep, SubStepTargets.Property, ref on_properties); + CategorizeTarget (substep, SubStepTargets.Event, ref on_events); + } + + static void CategorizeTarget (ISubStep substep, SubStepTargets target, ref List list) + { + if (!Targets (substep, target)) + return; + + if (list is null) + list = new List (); + + list.Add (substep); + } + + static bool Targets (ISubStep substep, SubStepTargets target) + { + return (substep.Targets & target) == target; + } + + IEnumerator IEnumerable.GetEnumerator () + { + return GetEnumerator (); + } + + public IEnumerator GetEnumerator () + { + return substeps.GetEnumerator (); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Extensions.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Extensions.cs new file mode 100644 index 000000000000..23ba6dc0ac87 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Extensions.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; + +using Mono.Cecil; + +using Mono.Linker; + +namespace Mono.Tuner { + + public static partial class Extensions { + + public static bool TryGetLinkedAssembly (this LinkContext context, string name, out AssemblyDefinition assembly) + { + assembly = GetAssembly (context, name); + if (assembly is null) + return false; + + return context.Annotations.GetAction (assembly) == AssemblyAction.Link; + } + + public static AssemblyDefinition GetAssembly (this LinkContext context, string assembly_name) + { + foreach (var assembly in context.GetAssemblies ()) + if (assembly.Name.Name == assembly_name) + return assembly; + + return null; + } + + // note: direct check, no inheritance + public static bool Is (this TypeReference type, string @namespace, string name) + { + return ((type is not null) && (type.Name == name) && (type.Namespace == @namespace)); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/FixModuleFlags.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/FixModuleFlags.cs new file mode 100644 index 000000000000..2bb01ab9bc50 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/FixModuleFlags.cs @@ -0,0 +1,20 @@ +using System; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Cecil; + +namespace Mono.Tuner { + + public class FixModuleFlags : BaseStep { + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + if (Annotations.GetAction (assembly) != AssemblyAction.Link) + return; + + assembly.MainModule.Attributes = ModuleAttributes.ILOnly; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/PreserveCrypto.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/PreserveCrypto.cs new file mode 100644 index 000000000000..5e9d3ee0726b --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/PreserveCrypto.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Cecil; +using Mono.Cecil.Cil; + +namespace Mono.Tuner { + + public class PreserveCrypto : IStep { + + AnnotationStore annotations; + + public void Process (LinkContext context) + { + annotations = context.Annotations; + + ProcessCorlib (context); + ProcessSystemCore (context); + } + + void ProcessCorlib (LinkContext context) + { + AssemblyDefinition corlib; + if (!context.TryGetLinkedAssembly ("mscorlib", out corlib)) + return; + + AddPreserveInfo (corlib, "DES", "DESCryptoServiceProvider"); + AddPreserveInfo (corlib, "DSA", "DSACryptoServiceProvider"); + AddPreserveInfo (corlib, "RandomNumberGenerator", "RNGCryptoServiceProvider"); + AddPreserveInfo (corlib, "SHA1", "SHA1CryptoServiceProvider"); + AddPreserveInfo (corlib, "SHA1", "SHA1Managed"); + AddPreserveInfo (corlib, "MD5", "MD5CryptoServiceProvider"); + AddPreserveInfo (corlib, "RC2", "RC2CryptoServiceProvider"); + AddPreserveInfo (corlib, "TripleDES", "TripleDESCryptoServiceProvider"); + + AddPreserveInfo (corlib, "Rijndael", "RijndaelManaged"); + AddPreserveInfo (corlib, "RIPEMD160", "RIPEMD160Managed"); + AddPreserveInfo (corlib, "SHA256", "SHA256Managed"); + AddPreserveInfo (corlib, "SHA384", "SHA384Managed"); + AddPreserveInfo (corlib, "SHA512", "SHA512Managed"); + + AddPreserveInfo (corlib, "HMAC", "HMACMD5"); + AddPreserveInfo (corlib, "HMAC", "HMACRIPEMD160"); + AddPreserveInfo (corlib, "HMAC", "HMACSHA1"); + AddPreserveInfo (corlib, "HMAC", "HMACSHA256"); + AddPreserveInfo (corlib, "HMAC", "HMACSHA384"); + AddPreserveInfo (corlib, "HMAC", "HMACSHA512"); + + AddPreserveInfo (corlib, "HMACMD5", "MD5CryptoServiceProvider"); + AddPreserveInfo (corlib, "HMACRIPEMD160", "RIPEMD160Managed"); + AddPreserveInfo (corlib, "HMACSHA1", "SHA1CryptoServiceProvider"); + AddPreserveInfo (corlib, "HMACSHA1", "SHA1Managed"); + AddPreserveInfo (corlib, "HMACSHA256", "SHA256Managed"); + AddPreserveInfo (corlib, "HMACSHA384", "SHA384Managed"); + AddPreserveInfo (corlib, "HMACSHA512", "SHA512Managed"); + + TryAddPreserveInfo (corlib, "Aes", "AesManaged"); + + var corlibAes = GetCryptoType (corlib, "Aes"); + Preserve (corlibAes, GetCryptoType (corlib, "AesManaged")); + + AssemblyDefinition syscore; + if (context.TryGetLinkedAssembly ("System.Core", out syscore)) + Preserve (corlibAes, GetCryptoType (syscore, "AesCryptoServiceProvider")); + } + + void ProcessSystemCore (LinkContext context) + { + AssemblyDefinition syscore; + if (!context.TryGetLinkedAssembly ("System.Core", out syscore)) + return; + + // AddPreserveInfo (syscore, "Aes", "AesCryptoServiceProvider"); + TryAddPreserveInfo (syscore, "Aes", "AesManaged"); + } + + bool TryAddPreserveInfo (AssemblyDefinition assembly, string name, string type) + { + var marker = GetCryptoType (assembly, name); + if (marker is null) + return false; + + var implementation = GetCryptoType (assembly, type); + if (implementation is null) + return false; + + Preserve (marker, implementation); + return true; + } + + void AddPreserveInfo (AssemblyDefinition assembly, string name, string type) + { + var marker = GetCryptoType (assembly, name); + if (marker is null) + throw new ArgumentException (name); + + var implementation = GetCryptoType (assembly, type); + if (implementation is null) + throw new ArgumentException (type); + + Preserve (marker, implementation); + } + + void Preserve (TypeDefinition marker, TypeDefinition implementation) + { + if (marker is null || implementation is null) + return; + foreach (var constructor in implementation.GetConstructors ()) + annotations.AddPreservedMethod (marker, constructor); + } + + TypeDefinition GetCryptoType (AssemblyDefinition assembly, string name) + { + return assembly.MainModule.GetType ("System.Security.Cryptography." + name); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/PreserveSoapHttpClients.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/PreserveSoapHttpClients.cs new file mode 100644 index 000000000000..ee486cae93d8 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/PreserveSoapHttpClients.cs @@ -0,0 +1,90 @@ +using System; + +using Mono.Linker; + +using Mono.Cecil; + +namespace Mono.Tuner { + + public class PreserveSoapHttpClients : BaseSubStep { + + public override SubStepTargets Targets { + get { return SubStepTargets.Type; } + } + + public override bool IsActiveFor (AssemblyDefinition assembly) + { + return Annotations.GetAction (assembly) == AssemblyAction.Link && !Profile.IsSdkAssembly (assembly); + } + + public override void ProcessType (TypeDefinition type) + { + if (IsWebServiceClient (type)) + PreserveClient (type); + } + + void PreserveClient (TypeDefinition type) + { + if (!type.HasMethods) + return; + + foreach (MethodDefinition method in type.Methods) { + string sync_method; + if (!TryExtractSyncMethod (method, out sync_method)) + continue; + + AddPreservedMethod (method, sync_method); + } + } + + void AddPreservedMethod (MethodDefinition target, string methodName) + { + foreach (MethodDefinition method in target.DeclaringType.Methods) + if (method.Name == methodName) + Annotations.AddPreservedMethod (target, method); + } + + static bool TryExtractSyncMethod (MethodDefinition method, out string sync_method) + { + if (TryExtractPrefixedMethodName ("Begin", method.Name, out sync_method)) + return true; + + if (TryExtractPrefixedMethodName ("End", method.Name, out sync_method)) + return true; + + if (TryExtractSuffixedMethodName ("Async", method.Name, out sync_method)) + return true; + + return false; + } + + static bool TryExtractPrefixedMethodName (string prefix, string fullName, out string methodName) + { + methodName = null; + + int pos = fullName.IndexOf (prefix, StringComparison.Ordinal); + if (pos == -1) + return false; + + methodName = fullName.Substring (prefix.Length); + return true; + } + + static bool TryExtractSuffixedMethodName (string suffix, string fullName, out string methodName) + { + methodName = null; + + int pos = fullName.LastIndexOf (suffix, StringComparison.Ordinal); + if (pos == -1) + return false; + + methodName = fullName.Substring (0, pos); + return true; + } + + static bool IsWebServiceClient (TypeDefinition type) + { + return type.Inherits ("System.Web.Services.Protocols", "SoapHttpClientProtocol"); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Profile.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Profile.cs new file mode 100644 index 000000000000..9cfbf9f0942c --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/Profile.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; + +using Mono.Cecil; + +namespace Mono.Tuner { + + public abstract class Profile { + + static Profile current; + + public static Profile Current { + get { + if (current is not null) + return current; + + current = CreateProfile ("MonoTouch"); + if (current is not null) + return current; + + current = CreateProfile ("MonoDroid"); + if (current is not null) + return current; + + current = CreateProfile ("MonoMac"); + if (current is not null) + return current; + + throw new NotSupportedException ("No active profile"); + } + set { + current = value; + } + } + + static Profile CreateProfile (string name) + { + var type = Type.GetType (string.Format ("{0}.Tuner.{0}Profile", name)); + if (type is null) + return null; + + return (Profile) Activator.CreateInstance (type); + } + + public static bool IsSdkAssembly (AssemblyDefinition assembly) + { + return Current.IsSdk (assembly); + } + + public static bool IsSdkAssembly (string assemblyName) + { + return Current.IsSdk (assemblyName); + } + + public static bool IsProductAssembly (AssemblyDefinition assembly) + { + return Current.IsProduct (assembly); + } + + public static bool IsProductAssembly (string assemblyName) + { + return Current.IsProduct (assemblyName); + } + + protected virtual bool IsSdk (AssemblyDefinition assembly) + { + return IsSdk (assembly.Name.Name); + } + + protected virtual bool IsProduct (AssemblyDefinition assembly) + { + return IsProduct (assembly.Name.Name); + } + + protected abstract bool IsSdk (string assemblyName); + protected abstract bool IsProduct (string assemblyName); + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveAttributesBase.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveAttributesBase.cs new file mode 100644 index 000000000000..61101809fd47 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveAttributesBase.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Tuner; + +using Mono.Cecil; + +namespace Mono.Tuner { + + public abstract class RemoveAttributesBase : BaseSubStep { + + public override SubStepTargets Targets { + get { + return SubStepTargets.Assembly + | SubStepTargets.Type + | SubStepTargets.Field + | SubStepTargets.Method + | SubStepTargets.Property + | SubStepTargets.Event; + } + } + + public override bool IsActiveFor (AssemblyDefinition assembly) + { + return Annotations.GetAction (assembly) == AssemblyAction.Link; + } + + public override void ProcessAssembly (AssemblyDefinition assembly) + { + ProcessAttributeProvider (assembly); + ProcessAttributeProvider (assembly.MainModule); + } + + public override void ProcessType (TypeDefinition type) + { + ProcessAttributeProvider (type); + + if (type.HasGenericParameters) + ProcessAttributeProviderCollection (type.GenericParameters); + } + + void ProcessAttributeProviderCollection (IList list) + { + for (int i = 0; i < list.Count; i++) + ProcessAttributeProvider ((ICustomAttributeProvider) list [i]); + } + + public override void ProcessField (FieldDefinition field) + { + ProcessAttributeProvider (field); + } + + public override void ProcessMethod (MethodDefinition method) + { + ProcessMethodAttributeProvider (method); + } + + void ProcessMethodAttributeProvider (MethodDefinition method) + { + ProcessAttributeProvider (method); + ProcessAttributeProvider (method.MethodReturnType); + + if (method.HasParameters) + ProcessAttributeProviderCollection (method.Parameters); + + if (method.HasGenericParameters) + ProcessAttributeProviderCollection (method.GenericParameters); + } + + public override void ProcessProperty (PropertyDefinition property) + { + ProcessAttributeProvider (property); + } + + public override void ProcessEvent (EventDefinition @event) + { + ProcessAttributeProvider (@event); + } + + void ProcessAttributeProvider (ICustomAttributeProvider provider) + { + if (!provider.HasCustomAttributes) + return; + + for (int i = 0; i < provider.CustomAttributes.Count; i++) { + var attrib = provider.CustomAttributes [i]; + if (!IsRemovedAttribute (attrib)) + continue; + + WillRemoveAttribute (provider, attrib); + provider.CustomAttributes.RemoveAt (i--); + } + } + + protected abstract bool IsRemovedAttribute (CustomAttribute attribute); + protected virtual void WillRemoveAttribute (ICustomAttributeProvider provider, CustomAttribute attribute) { } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveResources.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveResources.cs new file mode 100644 index 000000000000..803b1e76bf1a --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveResources.cs @@ -0,0 +1,63 @@ +using System; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Cecil; + +namespace Mono.Tuner { + + public class RemoveResources : IStep { + + readonly I18nAssemblies assemblies; + + public RemoveResources (I18nAssemblies assemblies) + { + this.assemblies = assemblies; + } + + public virtual void Process (LinkContext context) + { + AssemblyDefinition assembly; + if (!context.TryGetLinkedAssembly ("mscorlib", out assembly)) + return; + + // skip this if we're not linking mscorlib, e.g. --linkskip=mscorlib + if (context.Annotations.GetAction (assembly) != AssemblyAction.Link) + return; + + var resources = assembly.MainModule.Resources; + + for (int i = 0; i < resources.Count; i++) { + var resource = resources [i] as EmbeddedResource; + if (resource is null) + continue; + + if (RemoveResource (resource.Name)) + resources.RemoveAt (i--); + } + } + + bool RemoveResource (string name) + { + switch (name) { + case "mscorlib.xml": + return true; + case "collation.core.bin": + case "collation.tailoring.bin": + return false; + default: + if (!name.Contains ("cjk")) + return false; + if (IncludeCJK ()) + return false; + return true; + } + } + + bool IncludeCJK () + { + return (assemblies & I18nAssemblies.CJK) != 0; + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveSecurity.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveSecurity.cs new file mode 100644 index 000000000000..2704564a65e1 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/RemoveSecurity.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Mono.Linker; +using Mono.Linker.Steps; + +using Mono.Cecil; + +namespace Mono.Tuner { + + public class RemoveSecurity : BaseSubStep { + + public override SubStepTargets Targets { + get { + return SubStepTargets.Assembly + | SubStepTargets.Type + | SubStepTargets.Method; + } + } + + public override bool IsActiveFor (AssemblyDefinition assembly) + { + return Annotations.GetAction (assembly) == AssemblyAction.Link; + } + + public override void ProcessAssembly (AssemblyDefinition assembly) + { + ProcessSecurityProvider (assembly); + } + + public override void ProcessType (TypeDefinition type) + { + ProcessSecurityProvider (type); + } + + public override void ProcessMethod (MethodDefinition method) + { + ProcessSecurityProvider (method); + } + + static void ProcessSecurityProvider (ISecurityDeclarationProvider provider) + { + if (!provider.HasSecurityDeclarations) + return; + + provider.SecurityDeclarations.Clear (); + } + } +} diff --git a/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/TunerAnnotations.cs b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/TunerAnnotations.cs new file mode 100644 index 000000000000..2107ac4a0f59 --- /dev/null +++ b/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/tuner/Mono.Tuner/TunerAnnotations.cs @@ -0,0 +1,55 @@ +// +// TunerAnnotations.cs +// +// Author: +// Jb Evain (jbevain@novell.com) +// +// (C) 2007 Novell, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using Mono.Cecil; +using Mono.Linker; + +namespace Mono.Tuner { + + public class TunerAnnotations { + + static readonly object _internalizedKey = new object (); + + public static void Internalized (LinkContext context, IMetadataTokenProvider provider) + { + var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey); + annotations [provider] = _internalizedKey; + } + + public static bool IsInternalized (LinkContext context, IMetadataTokenProvider provider) + { + var annotations = context.Annotations.GetCustomAnnotations (_internalizedKey); + + return annotations.ContainsKey (provider); + } + + private TunerAnnotations () + { + } + } +} diff --git a/builds/mono-wrapper.in b/builds/mono-wrapper.in deleted file mode 100644 index d57106b82ccf..000000000000 --- a/builds/mono-wrapper.in +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -export PATH="@FRAMEWORK_ROOT@/bin:$PATH" -export MONO_CFG_DIR="@FRAMEWORK_ROOT@/etc" -export MONO_PATH="@FRAMEWORK_ROOT@/lib/@ARCH@:@FRAMEWORK_ROOT@/lib/mono/Xamarin.Mac" - -"@MONO@" "$@" diff --git a/configure b/configure index 4fa03300a985..95d735a7409d 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" @@ -167,12 +156,12 @@ while test "x$1" != x; do shift ;; --enable-dotnet) - echo "ENABLE_DOTNET=1" >> "$CONFIGURED_FILE" + # This is the default, and there's no way do enable it, so ignore this argument shift ;; --disable-dotnet) - echo "ENABLE_DOTNET=" >> "$CONFIGURED_FILE" - shift + echo "It's not possible to disable .NET anymore." + exit 1 ;; --enable-dotnet-windows) echo "$1 is ignored. Use --enable-dotnet instead" @@ -183,11 +172,11 @@ while test "x$1" != x; do shift ;; --enable-legacy-xamarin) - echo "INCLUDE_XAMARIN_LEGACY=1" >> "$CONFIGURED_FILE" - shift + echo "It's not possible to enable legacy Xamarin anymore." + exit 1 ;; --disable-legacy-xamarin) - echo "INCLUDE_XAMARIN_LEGACY=" >> "$CONFIGURED_FILE" + # This is the default, and there's no way do enable it, so ignore this argument shift ;; --custom-dotnet=*) diff --git a/docs/CORECLR.md b/docs/CORECLR.md index d71709b164b7..adae8b4353fe 100644 --- a/docs/CORECLR.md +++ b/docs/CORECLR.md @@ -15,7 +15,7 @@ ```shell cd ~/work/xamarin-macios make git-clean-all # Must start from a clean state when switching between downloaded and custom built dotnet/runtime. - ./configure --custom-dotnet=$HOME/work/runtime --enable-dotnet + ./configure --custom-dotnet=$HOME/work/runtime ``` 3. Build dotnet/runtime using our script that builds everything we need: diff --git a/docs/build-apps/build-items.md b/docs/build-apps/build-items.md index 608836c94d40..ca29996cd0a2 100644 --- a/docs/build-apps/build-items.md +++ b/docs/build-apps/build-items.md @@ -9,6 +9,63 @@ ms.date: 09/19/2024 Build items control how .NET for iOS, Mac Catalyst, macOS, and tvOS application or library projects are built. +## AlternateAppIcon + +The `AlternateAppIcon` item group can be used to specify alternate app icons. + +The `Include` metadata must point to the filename of an `.appiconset` (for +iOS, macOS and Mac Catalyst) or `.imagestack` (for tvOS) image resource +inside an asset catalog. + +Example: + +```xml + + + + +``` + +See also: +* The [AppIcon](build-properties.md#AppIcon) property. +* The [IncludeAllAppIcons](build-properties.md#IncludeAllAppIcons) property. + +## PartialAppManifest + +`PartialAppManifest` can be used to add additional partial app manifests that +will be merged with the main app manifest (Info.plist). + +Any values in the partial app manifests will override values in the main app +manifest unless the `Overwrite` metadata is set to `false`. + +If the same value is specified in multiple partial app manifests, it's +undetermined which one will be the one used. + +```xml + + + +``` + +If the developer needs to execute a target to compute what to add to the +`PartialAppManifest` item group, it's possible to make sure this target is +executed before the `PartialAppManifest` items are procesed by adding it to +the `CollectAppManifestsDependsOn` property: + +```xml + + + AddPartialAppManifests; + $(CollectAppManifestsDependsOn); + + + + + + + +``` + ## XcodeProject `` can be used to build and consume the outputs diff --git a/docs/build-apps/build-properties.md b/docs/build-apps/build-properties.md index 5a478bbcbe6d..b405f6b4833b 100644 --- a/docs/build-apps/build-properties.md +++ b/docs/build-apps/build-properties.md @@ -11,6 +11,52 @@ MSBuild properties control the behavior of the They're specified within the project file, for example **MyApp.csproj**, within an MSBuild PropertyGroup. +## AppIcon + +The `AppIcon` item group can be used to specify an app icon for the app. + +The value of the property must point to the filename of an `.appiconset` (for +iOS, macOS and Mac Catalyst) or `.brandassets` (for tvOS) image resource +inside an asset catalog. + +Example: + +```xml + + + MyAppIcon + +``` + +See also: + +* The [AlternateAppIcon](build-items.md#AlternateAppIcon) item group. +* The [IncludeAllAppIcons](#IncludeAllAppIcons) property. + +## DittoPath + +The full path to the `ditto` executable. + +The default behavior is to use `/usr/bin/ditto`. + +## IncludeAllAppIcons + +Set the `IncludeAllAppIcons` property to true to automatically include all app +icons from all asset catalogs in the app. + +Example: + +```xml + + true + +``` + +See also: + +* The [AlternateAppIcon](build-items.md#AlternateAppIcon) item group. +* The [AppIcon](#AppIcon) property. + ## MaciOSPrepareForBuildDependsOn A semi-colon delimited property that can be used to extend the build process. @@ -30,3 +76,21 @@ 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`. + +## StripPath + +The full path to the `strip` command-line tool. + +The default behavior is to use `xcrun strip`. 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/BundleContents.md b/dotnet/BundleContents.md index e9ebbc552a2e..935a7ef12247 100644 --- a/dotnet/BundleContents.md +++ b/dotnet/BundleContents.md @@ -29,6 +29,9 @@ For this purpose, we support the `PublishFolderType` metadata on items in the Below is a list of known/valid `PublishFolderType` values and the corresponding action taken for each. +> [!IMPORTANT] +See [`PublishFolderType` doesn't work from a referenced library project](#transitiveProject) for using `PublishFolderType` in library projects. + In all cases the relative directory is preserved (i.e. we don't follow the behavior in [dotnet/sdk#9643](https://github.com/dotnet/sdk/issues/9643). @@ -276,6 +279,29 @@ The easiest way is to set `PublishFolderType` to `None`: ``` + + +### `PublishFolderType` doesn't work from a referenced library project. + +The `PublishFolderType` metadata does not work in transitive / referenced +projects that aren't platform-specific. For example: if an executable project +references a `net9.0` library project, adding the `PublishFolderType` metadata +on items in the `net9.0` library project doesn't have any effect, and you'll get a warning like this: + +> Xamarin.Shared.Sdk.targets(1836,3): Warning : The file '/myresource/file.psd' does not specify a 'PublishFolderType' metadata, and a default value could not be calculated. The file will not be copied to the app bundle. + +The workaround is to set +`MSBuildDisableGetCopyToPublishDirectoryItemsOptimization=true` in the +library project: + +```xml + + true + +``` + +See https://github.com/xamarin/xamarin-macios/issues/20947 for more information. + ## References * [.NET: What to do about files in ResolvedFileToPublish](https://github.com/xamarin/xamarin-macios/issues/12572) diff --git a/dotnet/Makefile b/dotnet/Makefile index 6e54ef326dcf..a0a4479efce5 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -119,7 +119,8 @@ targets/Microsoft.$(1).Sdk.Versions.props: targets/Microsoft.Sdk.Versions.templa -e "s/@PLATFORM@/$(1)/g" \ -e "s/@NUGET_VERSION_NO_METADATA@/$$($(2)_NUGET_VERSION_NO_METADATA)/g" \ -e "s/@NUGET_VERSION_FULL@/$$($(2)_NUGET_VERSION_FULL)/g" \ - -e "s/@TARGET_PLATFORM_VERSION@/$$($(2)_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_EXE@/$$($(2)_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_LIBRARY@/$$($(2)_TARGET_PLATFORM_VERSION_LIBRARY)/g" \ -e "s/@CURRENT_BRANCH@/$$(CURRENT_BRANCH_SED_ESCAPED)/g" \ -e "s/@CURRENT_HASH_LONG@/$$(CURRENT_HASH_LONG)/g" \ -e 's*@VALID_RUNTIME_IDENTIFIERS@*$(foreach rid,$(3),\n\t\t<_XamarinValidRuntimeIdentifier Include="$(rid)" Platform="$(1)" />)*' \ @@ -171,23 +172,26 @@ Microsoft.$1.Sdk/targets/Microsoft.$1.Sdk.ImplicitNamespaceImports.props: target endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call ImplicitNamespaceImports,$(platform),$(foreach using,$(DOTNET_$(platform)_GLOBAL_USINGS),\n\t\t)))) +include $(TOP)/scripts/generate-target-platforms/fragment.mk define SupportedTargetPlatforms -Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.SupportedTargetPlatforms.props: $(TOP)/builds/Versions-$(1).plist.in Makefile ./generate-target-platforms.csharp Makefile +Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.SupportedTargetPlatforms.props: $(TOP)/builds/Versions-$(1).plist.in Makefile $(GENERATE_TARGET_PLATFORMS) Makefile $(Q) rm -f $$@.tmp - $(Q) ./generate-target-platforms.csharp $(1) "$(DOTNET_TFM)" "$$(SUPPORTED_API_VERSIONS_$(2))" $$@.tmp + $(Q) $(GENERATE_TARGET_PLATFORMS_EXEC) $(1) "$(DOTNET_TFM)" "$$(SUPPORTED_API_VERSIONS_$(2))" $$@.tmp $(Q) mv $$@.tmp $$@ endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call SupportedTargetPlatforms,$(platform),$(shell echo $(platform) | tr a-z A-Z)))) +include $(TOP)/scripts/generate-workloadmanifest-json/fragment.mk +include $(TOP)/scripts/generate-workloadmanifest-targets/fragment.mk define WorkloadTargets -Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json: Makefile $(TOP)/Make.config.inc $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index Makefile generate-workloadmanifest-json.csharp | Workloads/Microsoft.NET.Sdk.$(1) +Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json: Makefile $(TOP)/Make.config.inc $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index Makefile $(GENERATE_WORKLOADMANIFEST_JSON) | Workloads/Microsoft.NET.Sdk.$(1) $$(Q) rm -f $$@.tmp - $$(Q_GEN) ./generate-workloadmanifest-json.csharp "$(1)" "$(3)" "$(5)" "$$(DOTNET_$(4)_RUNTIME_IDENTIFIERS)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)" "$(SUPPORTED_API_VERSIONS_$(4))" $(TOP)/eng/Versions.props + $$(Q_GEN) $(GENERATE_WORKLOADMANIFEST_JSON_EXEC) "$(1)" "$(3)" "$(5)" "$$(DOTNET_$(4)_RUNTIME_IDENTIFIERS)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)" "$(SUPPORTED_API_VERSIONS_$(4))" $(TOP)/eng/Versions.props $$(Q) mv $$@.tmp $$@ -Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.targets: Makefile $(TOP)/Make.config.inc $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index Makefile generate-workloadmanifest-targets.csharp | Workloads/Microsoft.NET.Sdk.$(1) +Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.targets: Makefile $(TOP)/Make.config.inc $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index Makefile $(GENERATE_WORKLOADMANIFEST_TARGETS) | Workloads/Microsoft.NET.Sdk.$(1) $$(Q) rm -f $$@.tmp - $$(Q_GEN) ./generate-workloadmanifest-targets.csharp "$(1)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)" "$(SUPPORTED_API_VERSIONS_$(4))" + $$(Q_GEN) $(GENERATE_WORKLOADMANIFEST_TARGETS_EXEC) "$(1)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)" "$(SUPPORTED_API_VERSIONS_$(4))" $$(Q) mv $$@.tmp $$@ Workloads/Microsoft.NET.Sdk.$(1)/LICENSE: $(TOP)/LICENSE | Workloads/Microsoft.NET.Sdk.$(1) @@ -206,9 +210,10 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call WorkloadTargets,$(platform) # Always use the commit distance as the third number in the VS component version, as it should always increase across all branches. $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(platform)_MSI_VERSION:=$($(shell echo $(platform) | tr '[:lower:]' '[:upper:]')_NUGET_OS_VERSION).$($(shell echo $(platform) | tr a-z A-Z)_NUGET_COMMIT_DISTANCE).0)) -$(DOTNET_NUPKG_DIR)/vs-workload.props: Makefile generate-vs-workload.csharp +include $(TOP)/scripts/generate-vs-workload/fragment.mk +$(DOTNET_NUPKG_DIR)/vs-workload.props: Makefile $(GENERATE_VS_WORKLOAD) $(Q) rm -f $@.tmp - $(Q_GEN) ./generate-vs-workload.csharp \ + $(Q_GEN) $(GENERATE_VS_WORKLOAD_EXEC) \ $(foreach platform,$(DOTNET_PLATFORMS),--platform $(platform) $($(platform)_MSI_VERSION)) \ $(foreach platform,$(DOTNET_WINDOWS_PLATFORMS),--windows-platform $(platform)) \ $(foreach platform,$(DOTNET_PLATFORMS),--shorten $($(shell echo $(platform) | tr '[:lower:]' '[:upper:]')_NUGET_VERSION_NO_METADATA)=$($(platform)_MSI_VERSION)) \ @@ -436,17 +441,6 @@ WINDOWS_PACKAGE_TARGETS += $(DOTNET_PKG_DIR)/Microsoft.$1.Windows.Bundle.$2.zip endef $(foreach platform,$(DOTNET_WINDOWS_PLATFORMS),$(eval $(call CreateWindowsBundle,$(platform),$($(platform)_NUGET_VERSION_NO_METADATA),$(shell echo $(platform) | tr A-Z a-z),$(shell echo $(platform) | tr a-z A-Z)))) -define CreateMsi -$(TMP_PKG_DIR)/Microsoft.NET.Workload.$1.$2.wsx: ./generate-wix.csharp Makefile $(TMP_PKG_DIR)/Microsoft.$1.Windows.Bundle.$2.zip - $$(Q_GEN) ./generate-wix.csharp "$1" "$$@" "$(TMP_PKG_DIR)/Microsoft.$1.Windows.Bundle.$2.zip.tmpdir/dotnet" "$2" - -$(TMP_PKG_DIR)/Microsoft.NET.Workload.$1.$2.msi: $(TMP_PKG_DIR)/Microsoft.NET.Workload.$1.$2.wsx .stamp-check-wixl - $$(Q_GEN) wixl -o "$$@" "$$<" -a x64 - -MSI_TARGETS += $(DOTNET_PKG_DIR)/Microsoft.NET.Workload.$1.$2.msi -endef -$(foreach platform,$(DOTNET_WINDOWS_PLATFORMS),$(eval $(call CreateMsi,$(platform),$($(platform)_NUGET_VERSION_NO_METADATA)))) - NUGET_SOURCES:=$(shell grep https://pkgs.dev.azure.com $(TOP)/NuGet.config | sed -e 's/.*value="//' -e 's/".*//') .stamp-install-workloads: Makefile $(WORKLOAD_TARGETS) $(RUNTIME_PACKS) $(REF_PACKS) $(SDK_PACKS) $(TEMPLATE_PACKS) $(WORKLOAD_PACKS) $(Q) $(DOTNET) workload install --skip-manifest-update \ @@ -457,23 +451,9 @@ NUGET_SOURCES:=$(shell grep https://pkgs.dev.azure.com $(TOP)/NuGet.config | sed TARGETS += .stamp-install-workloads -.stamp-check-wixl: - $(Q) if ! type wixl; then \ - echo "Installing msitools to get wixl..."; \ - if ! brew install msitools; then \ - if ! type wixl; then \ - echo "Failed to install wixl"; \ - exit 1; \ - fi; \ - fi; \ - echo "Installed msitools"; \ - fi - $(Q) touch $@ - TARGETS += $(WORKLOAD_TARGETS) $(WINDOWS_PACKAGE_TARGETS) -msi: $(MSI_TARGETS) -package: $(PACKAGE_TARGETS) $(MSI_TARGETS) $(WINDOWS_PACKAGE_TARGETS) +package: $(PACKAGE_TARGETS) $(WINDOWS_PACKAGE_TARGETS) # Helper targets for templates # @@ -520,9 +500,7 @@ install-system: $(Q) cd $(HOME) && sudo dotnet workload remove $(DOTNET_PLATFORMS_LOWERCASE) $(Q) cd $(HOME) && sudo dotnet workload install --from-rollback-file $(abspath $(TOP)/../WorkloadRollback.json) --source $(abspath $(TOP)/_build/nupkgs) --source https://api.nuget.org/v3/index.json $(DOTNET_PLATFORMS_LOWERCASE) -v diag -ifdef ENABLE_DOTNET all-local:: $(TARGETS) -endif clean-local:: $(Q) rm -Rf $(DOTNET_NUPKG_DIR) @@ -550,4 +528,9 @@ all-hook:: $(Q) $(MAKE) shutdown-build-server shutdown-build-server: - $(Q) $(DOTNET) build-server shutdown + $(Q) echo "Shutting down build servers:" + $(Q) $(DOTNET) build-server shutdown | sed 's/^/ /' || true + $(Q) echo "Listing .NET processes still alive:" + $(Q) pgrep -lf "^$(DOTNET)" | sed 's/^/ /' || true + $(Q) echo "Killing the above mentioned processes." + $(Q) pkill -9 -f "^$(DOTNET)" | sed 's/^/ /' || true diff --git a/dotnet/generate-target-platforms.csharp b/dotnet/generate-target-platforms.csharp deleted file mode 100755 index bff196cab8f9..000000000000 --- a/dotnet/generate-target-platforms.csharp +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -// arguments are: - -using System.IO; -using System.Xml; - -var args = Args; -var expectedArgumentCount = 4; -if (args.Length != expectedArgumentCount) { - Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}"); - Environment.Exit (1); - return; -} - -var idx = 0; -var platform = args [idx++]; -var dotnetTfm = args [idx++]; -var supportedApiVersions = args [idx++].Split (' ').Select (v => v.Replace (dotnetTfm + "-", "")).ToArray (); -var outputPath = args [idx++]; -var plistPath = $"../builds/Versions-{platform}.plist.in" - -var doc = new XmlDocument (); -doc.Load (plistPath); -var supportedTargetPlatformVersions = doc.SelectNodes ($"/plist/dict/key[text()='SupportedTargetPlatformVersions']/following-sibling::dict[1]/key[text()='{platform}']/following-sibling::array[1]/string").Cast ().Select (v => v.InnerText).ToArray (); - -var currentSupportedTPVs = supportedTargetPlatformVersions.Where (v => v.StartsWith (dotnetTfm + "-", StringComparison.Ordinal)).Select (v => v.Substring (dotnetTfm.Length + 1)); -var minSdkVersionName = $"DOTNET_MIN_{platform.ToUpper ()}_SDK_VERSION"; -var minSdkVersionString = File.ReadAllLines ("../Make.config").Single (v => v.StartsWith (minSdkVersionName + "=", StringComparison.Ordinal)).Substring (minSdkVersionName.Length + 1); -var minSdkVersion = Version.Parse (minSdkVersionString); - -Console.WriteLine (string.Join (";", supportedApiVersions)); - -using (TextWriter writer = new StreamWriter (outputPath)) { - writer.WriteLine ($""); - writer.WriteLine ($""); - writer.WriteLine (""); - writer.WriteLine ("\t"); - - foreach (var version in supportedTargetPlatformVersions) { - writer.Write ($"\t\t<{platform}SdkSupportedTargetPlatformVersion Include=\"{version}\" "); - if (!supportedApiVersions.Contains (version)) - writer.Write ($"DefineConstantsOnly=\"true\" "); - writer.WriteLine ("/>"); - } - - writer.WriteLine ("\t"); - writer.WriteLine ("\t"); - writer.WriteLine ($"\t\t"); - writer.WriteLine ("\t"); - writer.WriteLine ("\t"); - writer.WriteLine ($"\t\t<{platform}MinSupportedOSPlatformVersion>{minSdkVersionString}"); - writer.WriteLine ($"\t\t$({platform}MinSupportedOSPlatformVersion)"); - writer.WriteLine ("\t"); - writer.WriteLine (""); -} - -Environment.Exit (0); diff --git a/dotnet/generate-vs-workload.csharp b/dotnet/generate-vs-workload.csharp deleted file mode 100755 index 2e5044df482b..000000000000 --- a/dotnet/generate-vs-workload.csharp +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -// arguments are: -// --shorten long=short -// --platform -// --windows-platform - -using System.IO; -using System.Security.Cryptography; -using System.Text; -using System.Xml; - -var shorten = new Dictionary (); -var platforms = new List<(string, string)> (); -var windowsPlatforms = new List (); -var tfm = string.Empty; -var outputPath = string.Empty; - -var args = new Queue (Args); - -while (args.Any ()) { - var arg = args.Dequeue (); - switch (arg) { - case "--shorten": - var values = args.Dequeue ().Split ('='); - shorten [values [0]] = values [1]; - break; - case "--platform": - var platform = args.Dequeue (); - var version = args.Dequeue (); - platforms.Add ((platform, version)); - break; - case "--windows-platform": - windowsPlatforms.Add (args.Dequeue ()); - break; - case "--output": - outputPath = args.Dequeue (); - break; - case "--tfm": - tfm = args.Dequeue (); - break; - default: - Console.Error.WriteLine ($"Unknown argument: {arg}"); - Environment.Exit (1); - break; - } -} - -using (TextWriter writer = new StreamWriter (outputPath)) { - writer.WriteLine ($""); - writer.WriteLine ($""); - writer.WriteLine ($" "); - var allPlatforms = string.Join (".", platforms.Select (v => v.Item1).OrderBy (v => v)); - writer.WriteLine ($" Microsoft.NET.Sdk.{allPlatforms}.Workload.{tfm}"); - // Find the iOS version, otherwise use the version of the first platform listed. - var iOSPlatform = platforms.Where (v => v.Item1 == "iOS"); - var manifestBuildVersion = iOSPlatform.Any () ? iOSPlatform.First ().Item2 : platforms.First ().Item2; - writer.WriteLine ($" {manifestBuildVersion}"); - writer.WriteLine ($" true"); - writer.WriteLine ($" false"); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - foreach (var entry in shorten) { - var longName = entry.Key; - var shortName = entry.Value; - writer.WriteLine ($" "); - writer.WriteLine ($" {shortName}"); - writer.WriteLine ($" "); - } - foreach (var entry in platforms) { - var platform = entry.Item1; - var version = entry.Item2; - var longPlatform = platform; - var description = $".NET SDK Workload for building {platform} applications."; - if (platform == "MacCatalyst") { - longPlatform = "Mac Catalyst"; - description = ".NET SDK Workload for building macOS applications with Mac Catalyst."; - } - writer.WriteLine ($" "); - } - foreach (var entry in platforms) { - var platform = entry.Item1; - var version = entry.Item2; - writer.WriteLine ($" "); - } - writer.WriteLine (" "); - writer.WriteLine (""); -} - -Environment.Exit (0); diff --git a/dotnet/generate-wix.csharp b/dotnet/generate-wix.csharp deleted file mode 100755 index d1d8dd032e29..000000000000 --- a/dotnet/generate-wix.csharp +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -// arguments are: - -using System.IO; -using System.Security.Cryptography; -using System.Text; -using System.Xml; - -var args = Args; -var expectedArgumentCount = 4; -if (args.Length != expectedArgumentCount) { - Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}"); - Environment.Exit (1); - return; -} - -var idx = 0; -var platform = args [idx++]; -var outputPath = args [idx++]; -var inputDirectory = args [idx++]; -var version = args [idx++]; - -string upgradeGuid; - -switch (platform) { - case "iOS": - upgradeGuid = "e17c20f4-e9a6-445a-915a-dac336097012"; - break; - case "tvOS": - upgradeGuid = "951a188f-e59a-4db1-bc42-b3ca47edb4c6"; - break; - case "watchOS": - upgradeGuid = "b365f5c9-6bbf-4c66-957a-8868576b4ddc"; - break; - case "macOS": - upgradeGuid = "b64a436b-db46-4467-953c-bdcfc592d4da"; - break; - default: - Console.Error.WriteLine ($"Need to generate an upgradeGuid for {platform}"); - break; -} - -List components = new List (); - -Func GetHash = (string inputString) => -{ - using (var algorithm = SHA256.Create ()) - return algorithm.ComputeHash (Encoding.UTF8.GetBytes (inputString)); -}; - -Func GetHashString = (string inputString) => -{ - var sb = new StringBuilder ("S", 65); - foreach (byte b in GetHash (inputString)) - sb.Append (b.ToString ("X2")); - Console.WriteLine ($"{inputString} => {sb.ToString ()}"); - return sb.ToString (); -}; - -Func GetId = (string path) => -{ - var top_dir = inputDirectory; - if (string.IsNullOrEmpty (path)) - return path; - if (path.Length > top_dir.Length + 1) { - path = path.Substring (top_dir.Length + 1); - } - return GetHashString (path); -}; - -Action process = new Action ((TextWriter writer, string indent, string directory) => -{ - var entries = Directory.GetFileSystemEntries (directory); - foreach (var entry in entries) { - var name = Path.GetFileName (entry); - var id = GetId (entry); - if (Directory.Exists (entry)) { - writer.WriteLine ($"{indent} "); - process (writer, indent + " ", entry); - writer.WriteLine ($"{indent} "); - } else { - components.Add (id); - writer.WriteLine ($"{indent} "); - writer.WriteLine ($"{indent} "); - writer.WriteLine ($"{indent} "); - } - } -}); - -using (TextWriter writer = new StreamWriter (outputPath)) { - - writer.WriteLine ($""); - writer.WriteLine ($""); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - process (writer, " ", inputDirectory); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - foreach (var component in components) - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($""); - -} - -Environment.Exit (0); diff --git a/dotnet/generate-workloadmanifest-json.csharp b/dotnet/generate-workloadmanifest-json.csharp deleted file mode 100755 index 141d8dc4f8bc..000000000000 --- a/dotnet/generate-workloadmanifest-json.csharp +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -// arguments are: - -using System.IO; -using System.Xml; - -var args = Args; -var expectedArgumentCount = 9; -if (args.Length != expectedArgumentCount) { - Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}"); - Environment.Exit (1); - return; -} - -var argumentIndex = 0; -var platform = args [argumentIndex++]; -var version = args [argumentIndex++]; -var net8Version = args [argumentIndex++]; -var runtimeIdentifiers = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); -var outputPath = args [argumentIndex++]; -var windowsPlatforms = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); -var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0; -var currentApiVersion = args [argumentIndex++]; -var supportedApiVersions = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); -var versionsPropsPath = args [argumentIndex++]; - -var platformLowerCase = platform.ToLowerInvariant (); - -var allApiVersions = new List (supportedApiVersions); -allApiVersions = allApiVersions.Select (v => v.Replace ('-', '_')).ToList (); - -var versionsPropsTable = File.ReadAllLines (versionsPropsPath). - Where (v => v.Count (f => f == '>') > 1). - Select (v => { - var split = v.Trim ().Split (new char [] { '<', '>', '/'}, StringSplitOptions.RemoveEmptyEntries); - var name = split [0]; - var value = split [1]; - return new Tuple (name, value); - }). - ToDictionary (v => v.Item1, v => v.Item2, StringComparer.OrdinalIgnoreCase); - -var failed = false; -using (TextWriter writer = new StreamWriter (outputPath)) { - writer.WriteLine ($"{{"); - writer.WriteLine ($" \"version\": \"{version}\","); - writer.WriteLine ($" \"workloads\": {{"); - writer.WriteLine ($" \"{platformLowerCase}\": {{"); - writer.WriteLine ($" \"description\": \".NET SDK Workload for building {platform} applications.\","); - writer.WriteLine ($" \"packs\": ["); - foreach (var tfm in allApiVersions) { - writer.WriteLine ($" \"Microsoft.{platform}.Sdk.{(tfm == "net8.0" ? "net8" : tfm)}\","); - } - if (hasWindows) { - foreach (var tfm in allApiVersions) { - writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.{(tfm == "net8.0" ? "net8" : tfm)}\","); - } - } - writer.WriteLine ($" \"Microsoft.{platform}.Ref.{currentApiVersion}\","); - foreach (var rid in runtimeIdentifiers) { - writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{currentApiVersion}\","); - } - writer.WriteLine ($" \"Microsoft.{platform}.Templates.net9\""); - writer.WriteLine ($" ],"); - writer.WriteLine ($" \"extends\": ["); - if (platform == "macOS") { - writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling\","); - writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling-net8\","); - } else { - writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}\","); - writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}-net8\","); - } - writer.WriteLine ($" ]"); - writer.WriteLine ($" }},"); - writer.WriteLine ($" }},"); - writer.WriteLine ($" \"packs\": {{"); - foreach (var tfmVersion in allApiVersions) { - string apiVersion; - var tfm = tfmVersion; - if (tfm == currentApiVersion) { - apiVersion = version; - } else if (tfm == "net8.0") { - apiVersion = net8Version; - } else { - var propsPackageName = $"Microsoft{platform}Sdk" + tfm.Replace ("-", "").Replace (".", "") + "PackageVersion"; - if (!versionsPropsTable.TryGetValue (propsPackageName, out apiVersion)) { - Console.Error.WriteLine ($"❌ Unable to find a package version for {platform}/{tfm} in {versionsPropsPath}. Package name: {propsPackageName}"); - apiVersion = "?"; - failed = true; - } - } - writer.WriteLine ($" \"Microsoft.{platform}.Sdk.{(tfm == "net8.0" ? "net8" : tfm)}\": {{"); - writer.WriteLine ($" \"kind\": \"sdk\","); - writer.WriteLine ($" \"version\": \"{apiVersion}\","); - if (tfm == "net8.0") { - writer.WriteLine ($" \"alias-to\": {{"); - writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Sdk\""); - writer.WriteLine ($" }}"); - } - writer.WriteLine ($" }},"); - if (hasWindows) { - writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.{(tfm == "net8.0" ? "net8" : tfm)}\": {{"); - writer.WriteLine ($" \"kind\": \"sdk\","); - writer.WriteLine ($" \"version\": \"{apiVersion}\","); - writer.WriteLine ($" \"alias-to\": {{"); - if (tfm == "net8.0") { - writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk\","); - writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk\","); - writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk\","); - } else { - writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk.{tfm}\","); - writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk.{tfm}\","); - writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk.{tfm}\","); - } - writer.WriteLine ($" }}"); - writer.WriteLine ($" }},"); - } - } - writer.WriteLine ($" \"Microsoft.{platform}.Ref.{currentApiVersion}\": {{"); - writer.WriteLine ($" \"kind\": \"framework\","); - writer.WriteLine ($" \"version\": \"{version}\""); - writer.WriteLine ($" }},"); - foreach (var rid in runtimeIdentifiers) { - writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{currentApiVersion}\": {{"); - writer.WriteLine ($" \"kind\": \"framework\","); - writer.WriteLine ($" \"version\": \"{version}\""); - writer.WriteLine ($" }},"); - } - writer.WriteLine ($" \"Microsoft.{platform}.Templates.net9\": {{"); - writer.WriteLine ($" \"kind\": \"template\","); - writer.WriteLine ($" \"version\": \"{version}\","); - writer.WriteLine ($" \"alias-to\": {{"); - writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Templates\","); - writer.WriteLine ($" }}"); - writer.WriteLine ($" }}"); - writer.WriteLine ($" }}"); - writer.WriteLine ($"}}"); -} - -if (failed) - Environment.Exit (1); -Environment.Exit (0); diff --git a/dotnet/generate-workloadmanifest-targets.csharp b/dotnet/generate-workloadmanifest-targets.csharp deleted file mode 100755 index 84b18d310db6..000000000000 --- a/dotnet/generate-workloadmanifest-targets.csharp +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -// arguments are: - -using System.IO; -using System.Xml; - -var args = Args; -var expectedArgumentCount = 5; -if (args.Length != expectedArgumentCount) { - Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}"); - Environment.Exit (1); - return; -} - -var argumentIndex = 0; -var platform = args [argumentIndex++]; -var outputPath = args [argumentIndex++]; -var windowsPlatforms = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); -var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0; -var currentApiVersion = args [argumentIndex++]; -var supportedApiVersions = args [argumentIndex++]; - -var platformLowerCase = platform.ToLowerInvariant (); -var tfm = currentApiVersion; - -var supportedTFMs = new List (); -supportedTFMs.AddRange (supportedApiVersions.Split (' ').Select (v => v.Replace ('-', '_'))); -supportedTFMs.Sort (); - -var supportedTFVs = new List (); - -var tfmToTpvAndTfv = new Func (tfm => { - var tfv = tfm.Replace ("net", ""); - var sep = tfv.IndexOfAny (new char [] { '-', '_' }); - var tpv = ""; - if (sep >= 0) { - tpv = tfv.Substring (sep + 1); - tfv = tfv.Substring (0, sep); - } - return (tfv, tpv); -}) - -// Find the latest TFM for each major .NET version. -// We import the workload for this TFM if there's no TPV specified in the TargetFramework. -var groupedByMajorDotNetVersion = supportedTFMs. - Where (v => v.IndexOfAny (new char [] { '-', '_' }) >= 0). - GroupBy (v => v.Split (new char [] { '-', '_' }) [0]); -var highestTpvPerMajorDotNet = groupedByMajorDotNetVersion. - Select (gr => { - var max = gr.OrderByDescending (el => { - var rv = tfmToTpvAndTfv (el); - return float.Parse (rv.Tpv, System.Globalization.CultureInfo.InvariantCulture); - }).First (); - return max; - }). - ToHashSet (); - -using (var writer = new StreamWriter (outputPath)) { - writer.WriteLine ($""); - foreach (var tfm in supportedTFMs) { - var parsed = tfmToTpvAndTfv (tfm); - var tfv = parsed.Tfv; - var tpv = parsed.Tpv; - supportedTFVs.Add (tfv); - var workloadVersion = tfm; - if (tfv [0] == '7') - workloadVersion = tfm.Replace (".0", ""); - if (highestTpvPerMajorDotNet.Contains (tfm)) { - writer.WriteLine ($" "); - writer.WriteLine ($" "); - } else if (tpv.Length > 0) { - writer.WriteLine ($" "); - writer.WriteLine ($" "); - } else { - writer.WriteLine ($" "); - writer.WriteLine ($" "); - } - - if (hasWindows) { - writer.WriteLine ($" "); - } - - writer.WriteLine ($" "); - writer.WriteLine (); - } - - var earliestSupportedTFV = supportedTFVs.Select (v => Version.Parse (v)).OrderBy (v => v).First (); - var latestSupportedTFV = supportedTFVs.Select (v => Version.Parse (v)).OrderBy (v => v).Last (); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine (); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - writer.WriteLine ($" "); - - writer.WriteLine ($""); - writer.WriteLine (); -} - -Environment.Exit (0); diff --git a/dotnet/targets/Microsoft.Sdk.Versions.template.props b/dotnet/targets/Microsoft.Sdk.Versions.template.props index d77b1f8d68c0..500353a521ae 100644 --- a/dotnet/targets/Microsoft.Sdk.Versions.template.props +++ b/dotnet/targets/Microsoft.Sdk.Versions.template.props @@ -6,7 +6,8 @@ <_ShortPackageVersion>@NUGET_VERSION_NO_METADATA@ <_PackageVersion>@NUGET_VERSION_FULL@ - <_XamarinTargetPlatformVersion>@TARGET_PLATFORM_VERSION@ + <_XamarinTargetPlatformVersionExecutable>@TARGET_PLATFORM_VERSION_EXE@ + <_XamarinTargetPlatformVersionLibrary>@TARGET_PLATFORM_VERSION_LIBRARY@ <_XamarinIsPreviewRelease>@XCODE_IS_PREVIEW@ <_XamarinDotNetVersion>@DOTNET_TFM@ <_XamarinPackSuffix>@DOTNET_TFM@_@NUGET_OS_VERSION@ diff --git a/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props b/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props index 0f585a4db207..3e082daf79fc 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props +++ b/dotnet/targets/Xamarin.Shared.Sdk.TargetFrameworkInference.props @@ -12,6 +12,7 @@ - $(_XamarinTargetPlatformVersion) + $(_XamarinTargetPlatformVersionExecutable) + $(_XamarinTargetPlatformVersionLibrary) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 218b3a283a01..f7329f9b6ba1 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -424,6 +424,9 @@ <_AssemblyPublishInputs Include="@(_AssemblyPublishDirectories -> '%(Identity)/**')" /> + + + <_NativeExecutableFrameworks Remove="BrowserEngineKit" Condition="'$(LinkWithBrowserEngineKit)' != 'true'" /> - + <_MainLinkerFlags Include="-lz" /> <_MainLinkerFlags Include="-liconv" /> <_MainLinkerFlags Include="-lcompression" /> diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3b5b9efd6679..fd000efd5b67 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -68,19 +68,41 @@ https://github.com/dotnet/runtime 9bff9c5017d8444fdf76959c112dd9fed2da9317 + + + https://github.com/xamarin/xamarin-macios + 797d30720e5e629d23eb146935da94cb1b61047e + + + https://github.com/xamarin/xamarin-macios + 797d30720e5e629d23eb146935da94cb1b61047e + + + https://github.com/xamarin/xamarin-macios + 797d30720e5e629d23eb146935da94cb1b61047e + + + https://github.com/xamarin/xamarin-macios + 797d30720e5e629d23eb146935da94cb1b61047e + - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d https://github.com/dotnet/templating - + https://github.com/dotnet/xharness - edae8a9491f747ba2a36023075aa3ac57be4d32e + dad280573945a8a849b3b655d78706088320766f + + + https://github.com/dotnet/arcade + 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + diff --git a/eng/Versions.props b/eng/Versions.props index c2c581ba6df7..588abd8aa7d0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -5,14 +5,15 @@ 9.0.100-rtm.24527.3 9.0.0 9.0.0-alpha.1.23556.4 - 9.0.0-beta.24408.2 + 9.0.0-beta.24516.2 8.0.0-beta.24413.2 9.0.0 8.0.0-rtm.23511.3 9.0.0-rc.2.24462.10 7.0.100-alpha.1.21601.1 0.11.5-alpha.24480.1 - 10.0.0-prerelease.24467.4 + 10.0.0-prerelease.24529.1 + 9.0.0-beta.24516.2 $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) @@ -27,5 +28,10 @@ 14.0.8523 17.0.8523 17.0.8523 + + 18.0.9617 + 15.0.9617 + 18.0.9617 + 18.0.9617 diff --git a/eng/common/BuildConfiguration/build-configuration.json b/eng/common/BuildConfiguration/build-configuration.json new file mode 100644 index 000000000000..3d1cc89894c9 --- /dev/null +++ b/eng/common/BuildConfiguration/build-configuration.json @@ -0,0 +1,4 @@ +{ + "RetryCountLimit": 1, + "RetryByAnyError": false +} diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd new file mode 100644 index 000000000000..56c2f25ac22f --- /dev/null +++ b/eng/common/CIBuild.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" \ No newline at end of file diff --git a/eng/common/PSScriptAnalyzerSettings.psd1 b/eng/common/PSScriptAnalyzerSettings.psd1 new file mode 100644 index 000000000000..4c1ea7c98ea4 --- /dev/null +++ b/eng/common/PSScriptAnalyzerSettings.psd1 @@ -0,0 +1,11 @@ +@{ + IncludeRules=@('PSAvoidUsingCmdletAliases', + 'PSAvoidUsingWMICmdlet', + 'PSAvoidUsingPositionalParameters', + 'PSAvoidUsingInvokeExpression', + 'PSUseDeclaredVarsMoreThanAssignments', + 'PSUseCmdletCorrectly', + 'PSStandardDSCFunctionsInResource', + 'PSUseIdenticalMandatoryParametersForDSC', + 'PSUseIdenticalParametersForDSC') +} \ No newline at end of file diff --git a/eng/common/README.md b/eng/common/README.md new file mode 100644 index 000000000000..ff49c371527a --- /dev/null +++ b/eng/common/README.md @@ -0,0 +1,28 @@ +# Don't touch this folder + + uuuuuuuuuuuuuuuuuuuu + u" uuuuuuuuuuuuuuuuuu "u + u" u$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$" ... "$... ...$" ... "$$$ ... "$$$ $ + $ $$$u `"$$$$$$$ $$$ $$$$$ $$ $$$ $$$ $ + $ $$$$$$uu "$$$$ $$$ $$$$$ $$ """ u$$$ $ + $ $$$""$$$ $$$$ $$$u "$$$" u$$ $$$$$$$$ $ + $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$" u" + "u """""""""""""""""" u" + """""""""""""""""""" + +!!! Changes made in this directory are subject to being overwritten by automation !!! + +The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first. diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 5f3105f21114..5db4ad71ee2f 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -1,17 +1,10 @@ -# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds. -# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080 +# This script adds internal feeds required to build commits that depend on internal package sources. For instance, +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. # -# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry -# under for each Maestro managed private feed. Two additional credential -# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport. +# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. # -# This script needs to be called in every job that will restore packages and which the base repo has -# private AzDO feeds in the NuGet.config. -# -# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` -# from the AzureDevOps-Artifact-Feeds-Pats variable group. -# -# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing +# See example call for this script below. # # - task: PowerShell@2 # displayName: Setup Private Feeds Credentials @@ -21,11 +14,18 @@ # arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token # env: # Token: $(dn-bot-dnceng-artifact-feeds-rw) +# +# Note that the NuGetAuthenticate task should be called after SetupNugetSources. +# This ensures that: +# - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt) +# - The credential provider is installed. +# +# This logic is also abstracted into enable-internal-sources.yml. [CmdletBinding()] param ( [Parameter(Mandatory = $true)][string]$ConfigFile, - [Parameter(Mandatory = $true)][string]$Password + $Password ) $ErrorActionPreference = "Stop" @@ -35,7 +35,7 @@ Set-StrictMode -Version 2.0 . $PSScriptRoot\tools.ps1 # Add source entry to PackageSources -function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) { +function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) { $packageSource = $sources.SelectSingleNode("add[@key='$SourceName']") if ($packageSource -eq $null) @@ -48,12 +48,17 @@ function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Usern else { Write-Host "Package source $SourceName already present." } - - AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password + + AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd } # Add a credential node for the specified source -function AddCredential($creds, $source, $username, $password) { +function AddCredential($creds, $source, $username, $pwd) { + # If no cred supplied, don't do anything. + if (!$pwd) { + return; + } + # Looks for credential configuration for the given SourceName. Create it if none is found. $sourceElement = $creds.SelectSingleNode($Source) if ($sourceElement -eq $null) @@ -82,17 +87,18 @@ function AddCredential($creds, $source, $username, $password) { $passwordElement.SetAttribute("key", "ClearTextPassword") $sourceElement.AppendChild($passwordElement) | Out-Null } - $passwordElement.SetAttribute("value", $Password) + + $passwordElement.SetAttribute("value", $pwd) } -function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Password) { +function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $pwd) { $maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]") Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds." ForEach ($PackageSource in $maestroPrivateSources) { Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key - AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password + AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -pwd $pwd } } @@ -110,11 +116,6 @@ if (!(Test-Path $ConfigFile -PathType Leaf)) { ExitWithExitCode 1 } -if (!$Password) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT' - ExitWithExitCode 1 -} - # Load NuGet.config $doc = New-Object System.Xml.XmlDocument $filename = (Get-Item $ConfigFile).FullName @@ -127,11 +128,14 @@ if ($sources -eq $null) { $doc.DocumentElement.AppendChild($sources) | Out-Null } -# Looks for a node. Create it if none is found. -$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") -if ($creds -eq $null) { - $creds = $doc.CreateElement("packageSourceCredentials") - $doc.DocumentElement.AppendChild($creds) | Out-Null +$creds = $null +if ($Password) { + # Looks for a node. Create it if none is found. + $creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") + if ($creds -eq $null) { + $creds = $doc.CreateElement("packageSourceCredentials") + $doc.DocumentElement.AppendChild($creds) | Out-Null + } } # Check for disabledPackageSources; we'll enable any darc-int ones we find there @@ -144,24 +148,24 @@ if ($disabledSources -ne $null) { $userName = "dn-bot" # Insert credential nodes for Maestro's private feeds -InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password +InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -pwd $Password +# 3.1 uses a different feed url format so it's handled differently here $dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") if ($dotnet31Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } -$dotnet5Source = $sources.SelectSingleNode("add[@key='dotnet5']") -if ($dotnet5Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet5-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password -} +$dotnetVersions = @('5','6','7','8','9') -$dotnet6Source = $sources.SelectSingleNode("add[@key='dotnet6']") -if ($dotnet6Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet6-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet6-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password +foreach ($dotnetVersion in $dotnetVersions) { + $feedPrefix = "dotnet" + $dotnetVersion; + $dotnetSource = $sources.SelectSingleNode("add[@key='$feedPrefix']") + if ($dotnetSource -ne $null) { + AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password + AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password + } } -$doc.Save($filename) \ No newline at end of file +$doc.Save($filename) diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index 30964e5b9500..4604b61b0323 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -1,28 +1,27 @@ #!/usr/bin/env bash -# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds. -# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080 +# This script adds internal feeds required to build commits that depend on internal package sources. For instance, +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. +# +# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. # -# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry -# under for each Maestro's managed private feed. Two additional credential -# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport. -# -# This script needs to be called in every job that will restore packages and which the base repo has -# private AzDO feeds in the NuGet.config. -# -# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` -# from the AzureDevOps-Artifact-Feeds-Pats variable group. -# -# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing. +# See example call for this script below. # # - task: Bash@3 -# displayName: Setup Private Feeds Credentials +# displayName: Setup Internal Feeds # inputs: # filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh -# arguments: $(Build.SourcesDirectory)/NuGet.config $Token +# arguments: $(Build.SourcesDirectory)/NuGet.config # condition: ne(variables['Agent.OS'], 'Windows_NT') -# env: -# Token: $(dn-bot-dnceng-artifact-feeds-rw) +# - task: NuGetAuthenticate@1 +# +# Note that the NuGetAuthenticate task should be called after SetupNugetSources. +# This ensures that: +# - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt) +# - The credential provider is installed. +# +# This logic is also abstracted into enable-internal-sources.yml. ConfigFile=$1 CredToken=$2 @@ -48,11 +47,6 @@ if [ ! -f "$ConfigFile" ]; then ExitWithExitCode 1 fi -if [ -z "$CredToken" ]; then - Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT" - ExitWithExitCode 1 -fi - if [[ `uname -s` == "Darwin" ]]; then NL=$'\\\n' TB='' @@ -105,53 +99,33 @@ if [ "$?" == "0" ]; then PackageSources+=('dotnet3.1-internal-transport') fi -# Ensure dotnet5-internal and dotnet5-internal-transport are in the packageSources if the public dotnet5 feeds are present -grep -i "" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet5-internal') - - grep -i "" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding dotnet5-internal-transport to the packageSources." - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" - - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet5-internal-transport') -fi +DotNetVersions=('5' '6' '7' '8' '9') -# Ensure dotnet6-internal and dotnet6-internal-transport are in the packageSources if the public dotnet6 feeds are present -grep -i "" +for DotNetVersion in ${DotNetVersions[@]} ; do + FeedPrefix="dotnet${DotNetVersion}"; + grep -i "" - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile - fi - PackageSources+=('dotnet6-internal') + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=("$FeedPrefix-internal") - grep -i "" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding dotnet6-internal-transport to the packageSources." - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" + grep -i "" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding $FeedPrefix-internal-transport to the packageSources." + PackageSourcesNodeFooter="" + PackageSourceTemplate="${TB}" - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=("$FeedPrefix-internal-transport") fi - PackageSources+=('dotnet6-internal-transport') -fi +done # I want things split line by line PrevIFS=$IFS @@ -160,18 +134,20 @@ PackageSources+="$IFS" PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') IFS=$PrevIFS -for FeedName in ${PackageSources[@]} ; do - # Check if there is no existing credential for this FeedName - grep -i "<$FeedName>" $ConfigFile - if [ "$?" != "0" ]; then - echo "Adding credentials for $FeedName." +if [ "$CredToken" ]; then + for FeedName in ${PackageSources[@]} ; do + # Check if there is no existing credential for this FeedName + grep -i "<$FeedName>" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding credentials for $FeedName." - PackageSourceCredentialsNodeFooter="" - NewCredential="${TB}${TB}<$FeedName>${NL}${NL}${NL}" + PackageSourceCredentialsNodeFooter="" + NewCredential="${TB}${TB}<$FeedName>${NL}${NL}${NL}" - sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile - fi -done + sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile + fi + done +fi # Re-enable any entries in disabledPackageSources where the feed name contains darc-int grep -i "" $ConfigFile @@ -188,4 +164,4 @@ if [ "$?" == "0" ]; then echo "Neutralized disablePackageSources entry for '$DisabledSourceName'" fi done -fi \ No newline at end of file +fi diff --git a/eng/common/build.cmd b/eng/common/build.cmd new file mode 100644 index 000000000000..99daf368abae --- /dev/null +++ b/eng/common/build.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" %*" +exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 new file mode 100644 index 000000000000..438f9920c43e --- /dev/null +++ b/eng/common/build.ps1 @@ -0,0 +1,169 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string][Alias('c')]$configuration = "Debug", + [string]$platform = $null, + [string] $projects, + [string][Alias('v')]$verbosity = "minimal", + [string] $msbuildEngine = $null, + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, + [switch][Alias('r')]$restore, + [switch] $deployDeps, + [switch][Alias('b')]$build, + [switch] $rebuild, + [switch] $deploy, + [switch][Alias('t')]$test, + [switch] $integrationTest, + [switch] $performanceTest, + [switch] $sign, + [switch] $pack, + [switch] $publish, + [switch] $clean, + [switch][Alias('pb')]$productBuild, + [switch][Alias('bl')]$binaryLog, + [switch][Alias('nobl')]$excludeCIBinarylog, + [switch] $ci, + [switch] $prepareMachine, + [string] $runtimeSourceFeed = '', + [string] $runtimeSourceFeedKey = '', + [switch] $excludePrereleaseVS, + [switch] $nativeToolsOnMachine, + [switch] $help, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +# Unset 'Platform' environment variable to avoid unwanted collision in InstallDotNetCore.targets file +# some computer has this env var defined (e.g. Some HP) +if($env:Platform) { + $env:Platform="" +} +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -configuration Build configuration: 'Debug' or 'Release' (short: -c)" + Write-Host " -platform Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild" + Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + Write-Host " -binaryLog Output binary log (short: -bl)" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Actions:" + Write-Host " -restore Restore dependencies (short: -r)" + Write-Host " -build Build solution (short: -b)" + Write-Host " -rebuild Rebuild solution" + Write-Host " -deploy Deploy built VSIXes" + Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)" + Write-Host " -test Run all unit tests in the solution (short: -t)" + Write-Host " -integrationTest Run all integration tests in the solution" + Write-Host " -performanceTest Run all performance tests in the solution" + Write-Host " -pack Package build outputs into NuGet packages and Willow components" + Write-Host " -sign Sign build outputs" + Write-Host " -publish Publish artifacts (e.g. symbols)" + Write-Host " -clean Clean the solution" + Write-Host " -productBuild Build the solution in the way it will be built in the full .NET product (VMR) build (short: -pb)" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" + Write-Host " -ci Set when running on CI server" + Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" + Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" + Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" + Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)" + Write-Host "" + + Write-Host "Command line arguments not listed above are passed thru to msbuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." +} + +. $PSScriptRoot\tools.ps1 + +function InitializeCustomToolset { + if (-not $restore) { + return + } + + $script = Join-Path $EngRoot 'restore-toolset.ps1' + + if (Test-Path $script) { + . $script + } +} + +function Build { + $toolsetBuildProj = InitializeToolset + InitializeCustomToolset + + $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'Build.binlog') } else { '' } + $platformArg = if ($platform) { "/p:Platform=$platform" } else { '' } + + if ($projects) { + # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. + # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty. + [string[]] $msbuildArgs = $properties + + # Resolve relative project paths into full paths + $projects = ($projects.Split(';').ForEach({Resolve-Path $_}) -join ';') + + $msbuildArgs += "/p:Projects=$projects" + $properties = $msbuildArgs + } + + MSBuild $toolsetBuildProj ` + $bl ` + $platformArg ` + /p:Configuration=$configuration ` + /p:RepoRoot=$RepoRoot ` + /p:Restore=$restore ` + /p:DeployDeps=$deployDeps ` + /p:Build=$build ` + /p:Rebuild=$rebuild ` + /p:Deploy=$deploy ` + /p:Test=$test ` + /p:Pack=$pack ` + /p:DotNetBuildRepo=$productBuild ` + /p:IntegrationTest=$integrationTest ` + /p:PerformanceTest=$performanceTest ` + /p:Sign=$sign ` + /p:Publish=$publish ` + @properties +} + +try { + if ($clean) { + if (Test-Path $ArtifactsDir) { + Remove-Item -Recurse -Force $ArtifactsDir + Write-Host 'Artifacts directory deleted.' + } + exit 0 + } + + if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { + Print-Usage + exit 0 + } + + if ($ci) { + if (-not $excludeCIBinarylog) { + $binaryLog = $true + } + $nodeReuse = $false + } + + if ($nativeToolsOnMachine) { + $env:NativeToolsOnMachine = $true + } + if ($restore) { + InitializeNativeTools + } + + Build +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/build.sh b/eng/common/build.sh new file mode 100644 index 000000000000..ac1ee8620cd2 --- /dev/null +++ b/eng/common/build.sh @@ -0,0 +1,260 @@ +#!/usr/bin/env bash + +# Stop script if unbound variable found (use ${var:-} if intentional) +set -u + +# Stop script if command returns non-zero exit code. +# Prevents hidden errors caused by missing error code propagation. +set -e + +usage() +{ + echo "Common settings:" + echo " --configuration Build configuration: 'Debug' or 'Release' (short: -c)" + echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + echo " --binaryLog Create MSBuild binary log (short: -bl)" + echo " --help Print help and exit (short: -h)" + echo "" + + echo "Actions:" + echo " --restore Restore dependencies (short: -r)" + echo " --build Build solution (short: -b)" + echo " --sourceBuild Source-build the solution (short: -sb)" + echo " Will additionally trigger the following actions: --restore, --build, --pack" + echo " If --configuration is not set explicitly, will also set it to 'Release'" + echo " --productBuild Build the solution in the way it will be built in the full .NET product (VMR) build (short: -pb)" + echo " Will additionally trigger the following actions: --restore, --build, --pack" + echo " If --configuration is not set explicitly, will also set it to 'Release'" + echo " --rebuild Rebuild solution" + echo " --test Run all unit tests in the solution (short: -t)" + echo " --integrationTest Run all integration tests in the solution" + echo " --performanceTest Run all performance tests in the solution" + echo " --pack Package build outputs into NuGet packages and Willow components" + echo " --sign Sign build outputs" + echo " --publish Publish artifacts (e.g. symbols)" + echo " --clean Clean the solution" + echo "" + + echo "Advanced settings:" + echo " --projects Project or solution file(s) to build" + echo " --ci Set when running on CI server" + echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" + echo " --prepareMachine Prepare machine for CI run, clean up processes after build" + echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" + echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + echo "" + echo "Command line arguments not listed above are passed thru to msbuild." + echo "Arguments can also be passed in with a single hyphen." +} + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +restore=false +build=false +source_build=false +product_build=false +rebuild=false +test=false +integration_test=false +performance_test=false +pack=false +publish=false +sign=false +public=false +ci=false +clean=false + +warn_as_error=true +node_reuse=true +binary_log=false +exclude_ci_binary_log=false +pipelines_log=false + +projects='' +configuration='' +prepare_machine=false +verbosity='minimal' +runtime_source_feed='' +runtime_source_feed_key='' + +properties='' +while [[ $# > 0 ]]; do + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -help|-h) + usage + exit 0 + ;; + -clean) + clean=true + ;; + -configuration|-c) + configuration=$2 + shift + ;; + -verbosity|-v) + verbosity=$2 + shift + ;; + -binarylog|-bl) + binary_log=true + ;; + -excludecibinarylog|-nobl) + exclude_ci_binary_log=true + ;; + -pipelineslog|-pl) + pipelines_log=true + ;; + -restore|-r) + restore=true + ;; + -build|-b) + build=true + ;; + -rebuild) + rebuild=true + ;; + -pack) + pack=true + ;; + -sourcebuild|-sb) + build=true + source_build=true + product_build=true + restore=true + pack=true + ;; + -productBuild|-pb) + build=true + product_build=true + restore=true + pack=true + ;; + -test|-t) + test=true + ;; + -integrationtest) + integration_test=true + ;; + -performancetest) + performance_test=true + ;; + -sign) + sign=true + ;; + -publish) + publish=true + ;; + -preparemachine) + prepare_machine=true + ;; + -projects) + projects=$2 + shift + ;; + -ci) + ci=true + ;; + -warnaserror) + warn_as_error=$2 + shift + ;; + -nodereuse) + node_reuse=$2 + shift + ;; + -runtimesourcefeed) + runtime_source_feed=$2 + shift + ;; + -runtimesourcefeedkey) + runtime_source_feed_key=$2 + shift + ;; + *) + properties="$properties $1" + ;; + esac + + shift +done + +if [[ -z "$configuration" ]]; then + if [[ "$source_build" = true ]]; then configuration="Release"; else configuration="Debug"; fi +fi + +if [[ "$ci" == true ]]; then + pipelines_log=true + node_reuse=false + if [[ "$exclude_ci_binary_log" == false ]]; then + binary_log=true + fi +fi + +. "$scriptroot/tools.sh" + +function InitializeCustomToolset { + local script="$eng_root/restore-toolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +function Build { + InitializeToolset + InitializeCustomToolset + + if [[ ! -z "$projects" ]]; then + properties="$properties /p:Projects=$projects" + fi + + local bl="" + if [[ "$binary_log" == true ]]; then + bl="/bl:\"$log_dir/Build.binlog\"" + fi + + MSBuild $_InitializeToolset \ + $bl \ + /p:Configuration=$configuration \ + /p:RepoRoot="$repo_root" \ + /p:Restore=$restore \ + /p:Build=$build \ + /p:DotNetBuildRepo=$product_build \ + /p:ArcadeBuildFromSource=$source_build \ + /p:DotNetBuildSourceOnly=$source_build \ + /p:Rebuild=$rebuild \ + /p:Test=$test \ + /p:Pack=$pack \ + /p:IntegrationTest=$integration_test \ + /p:PerformanceTest=$performance_test \ + /p:Sign=$sign \ + /p:Publish=$publish \ + $properties + + ExitWithExitCode 0 +} + +if [[ "$clean" == true ]]; then + if [ -d "$artifacts_dir" ]; then + rm -rf $artifacts_dir + echo "Artifacts directory deleted." + fi + exit 0 +fi + +if [[ "$restore" == true ]]; then + InitializeNativeTools +fi + +Build diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh new file mode 100644 index 000000000000..1a02c0dec8fd --- /dev/null +++ b/eng/common/cibuild.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where + # the symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ \ No newline at end of file diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml new file mode 100644 index 000000000000..ba53ebfbd513 --- /dev/null +++ b/eng/common/core-templates/job/job.yml @@ -0,0 +1,247 @@ +parameters: +# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + cancelTimeoutInMinutes: '' + condition: '' + container: '' + continueOnError: false + dependsOn: '' + displayName: '' + pool: '' + steps: [] + strategy: '' + timeoutInMinutes: '' + variables: [] + workspace: '' + templateContext: {} + +# Job base template specific parameters + # See schema documentation - https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/TemplateSchema.md + # publishing defaults + artifacts: '' + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishBuildAssets: false + enablePublishTestResults: false + enablePublishUsingPipelines: false + enableBuildRetry: false + mergeTestResults: false + testRunTitle: '' + testResultsFormat: '' + name: '' + componentGovernanceSteps: [] + preSteps: [] + artifactPublishSteps: [] + runAsPublic: false + +# 1es specific parameters + is1ESPipeline: '' + +jobs: +- job: ${{ parameters.name }} + + ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: + cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.container, '') }}: + container: ${{ parameters.container }} + + ${{ if ne(parameters.continueOnError, '') }}: + continueOnError: ${{ parameters.continueOnError }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + ${{ if ne(parameters.strategy, '') }}: + strategy: ${{ parameters.strategy }} + + ${{ if ne(parameters.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + ${{ if ne(parameters.templateContext, '') }}: + templateContext: ${{ parameters.templateContext }} + + variables: + - ${{ if ne(parameters.enableTelemetry, 'false') }}: + - name: DOTNET_CLI_TELEMETRY_PROFILE + value: '$(Build.Repository.Uri)' + - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: + - name: EnableRichCodeNavigation + value: 'true' + # Retry signature validation up to three times, waiting 2 seconds between attempts. + # See https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu3028#retry-untrusted-root-failures + - name: NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY + value: 3,2000 + - ${{ each variable in parameters.variables }}: + # handle name-value variable syntax + # example: + # - name: [key] + # value: [value] + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + + # handle variable groups + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + # handle template variable syntax + # example: + # - template: path/to/template.yml + # parameters: + # [key]: [value] + - ${{ if ne(variable.template, '') }}: + - template: ${{ variable.template }} + ${{ if ne(variable.parameters, '') }}: + parameters: ${{ variable.parameters }} + + # handle key-value variable syntax. + # example: + # - [key]: [value] + - ${{ if and(eq(variable.name, ''), eq(variable.group, ''), eq(variable.template, '')) }}: + - ${{ each pair in variable }}: + - name: ${{ pair.key }} + value: ${{ pair.value }} + + # DotNet-HelixApi-Access provides 'HelixApiAccessToken' for internal builds + - ${{ if and(eq(parameters.enableTelemetry, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: DotNet-HelixApi-Access + + ${{ if ne(parameters.workspace, '') }}: + workspace: ${{ parameters.workspace }} + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if ne(parameters.preSteps, '') }}: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - task: MicroBuildSigningPlugin@4 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + env: + TeamName: $(_TeamName) + MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + - ${{ if and(eq(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'internal')) }}: + - task: NuGetAuthenticate@1 + + - ${{ if and(ne(parameters.artifacts.download, 'false'), ne(parameters.artifacts.download, '')) }}: + - task: DownloadPipelineArtifact@2 + inputs: + buildType: current + artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} + targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} + itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} + + - ${{ each step in parameters.steps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableRichCodeNavigation, true) }}: + - task: RichCodeNavIndexer@0 + displayName: RichCodeNav Upload + inputs: + languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} + environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'internal') }} + richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin + uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }} + continueOnError: true + + - ${{ each step in parameters.componentGovernanceSteps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + env: + TeamName: $(_TeamName) + + # Publish test results + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: + - task: PublishTestResults@2 + displayName: Publish XUnit Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: + - task: PublishTestResults@2 + displayName: Publish TRX Test Results + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '*.trx' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() + + # gather artifacts + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - task: CopyFiles@2 + displayName: Gather binaries for publish to artifacts + inputs: + SourceFolder: 'artifacts/bin' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' + - task: CopyFiles@2 + displayName: Gather packages for publish to artifacts + inputs: + SourceFolder: 'artifacts/packages' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - task: CopyFiles@2 + displayName: Gather logs for publish to artifacts + inputs: + SourceFolder: 'artifacts/log' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log' + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - task: CopyFiles@2 + displayName: Gather logs for publish to artifacts + inputs: + SourceFolder: 'artifacts/log/$(_BuildConfig)' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + continueOnError: true + condition: always() + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - task: CopyFiles@2 + displayName: Gather buildconfiguration for build retry + inputs: + SourceFolder: '$(Build.SourcesDirectory)/eng/common/BuildConfiguration' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/eng/common/BuildConfiguration' + continueOnError: true + condition: always() + - ${{ each step in parameters.artifactPublishSteps }}: + - ${{ step }} diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml new file mode 100644 index 000000000000..00feec8ebbc3 --- /dev/null +++ b/eng/common/core-templates/job/onelocbuild.yml @@ -0,0 +1,121 @@ +parameters: + # Optional: dependencies of the job + dependsOn: '' + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: '' + + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex + GithubPat: $(BotAccount-dotnet-bot-repo-PAT) + + SourcesDirectory: $(Build.SourcesDirectory) + CreatePr: true + AutoCompletePr: false + ReusePr: true + UseLfLineEndings: true + UseCheckedInLocProjectJson: false + SkipLocProjectJsonGeneration: false + LanguageSet: VS_Main_Languages + LclSource: lclFilesInRepo + LclPackageId: '' + RepoType: gitHub + GitHubOrg: dotnet + MirrorRepo: '' + MirrorBranch: main + condition: '' + JobNameSuffix: '' + is1ESPipeline: '' +jobs: +- job: OneLocBuild${{ parameters.JobNameSuffix }} + + dependsOn: ${{ parameters.dependsOn }} + + displayName: OneLocBuild${{ parameters.JobNameSuffix }} + + variables: + - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat + - name: _GenerateLocProjectArguments + value: -SourcesDirectory ${{ parameters.SourcesDirectory }} + -LanguageSet "${{ parameters.LanguageSet }}" + -CreateNeutralXlfs + - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: + - name: _GenerateLocProjectArguments + value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if ne(parameters.SkipLocProjectJsonGeneration, 'true') }}: + - task: Powershell@2 + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 + arguments: $(_GenerateLocProjectArguments) + displayName: Generate LocProject.json + condition: ${{ parameters.condition }} + + - task: OneLocBuild@2 + displayName: OneLocBuild + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + locProj: eng/Localize/LocProject.json + outDir: $(Build.ArtifactStagingDirectory) + lclSource: ${{ parameters.LclSource }} + lclPackageId: ${{ parameters.LclPackageId }} + isCreatePrSelected: ${{ parameters.CreatePr }} + isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} + ${{ if eq(parameters.CreatePr, true) }}: + isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + isShouldReusePrSelected: ${{ parameters.ReusePr }} + packageSourceAuth: patAuth + patVariable: ${{ parameters.CeapexPat }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + repoType: ${{ parameters.RepoType }} + gitHubPatVariable: "${{ parameters.GithubPat }}" + ${{ if ne(parameters.MirrorRepo, '') }}: + isMirrorRepoSelected: true + gitHubOrganization: ${{ parameters.GitHubOrg }} + mirrorRepo: ${{ parameters.MirrorRepo }} + mirrorBranch: ${{ parameters.MirrorBranch }} + condition: ${{ parameters.condition }} + + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish Localization Files + pathToPublish: '$(Build.ArtifactStagingDirectory)/loc' + publishLocation: Container + artifactName: Loc + condition: ${{ parameters.condition }} + + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish LocProject.json + pathToPublish: '$(Build.SourcesDirectory)/eng/Localize/' + publishLocation: Container + artifactName: Loc + condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml new file mode 100644 index 000000000000..3d3356e31967 --- /dev/null +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -0,0 +1,158 @@ +parameters: + configuration: 'Debug' + + # Optional: condition for the job to run + condition: '' + + # Optional: 'true' if future jobs should run even if this job fails + continueOnError: false + + # Optional: dependencies of the job + dependsOn: '' + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishUsingPipelines: false + + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishAssetsImmediately: false + + artifactsPublishingAdditionalParameters: '' + + signingValidationAdditionalParameters: '' + + is1ESPipeline: '' + +jobs: +- job: Asset_Registry_Publish + + dependsOn: ${{ parameters.dependsOn }} + timeoutInMinutes: 150 + + ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + displayName: Publish Assets + ${{ else }}: + displayName: Publish to Build Asset Registry + + variables: + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - name: runCodesignValidationInjection + value: false + # unconditional - needed for logs publishing (redactor tool version) + - template: /eng/common/core-templates/post-build/common-variables.yml + + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ if ne(variables['System.TeamProject'], 'DevDiv') }}: + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 + os: windows + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - checkout: self + fetchDepth: 3 + clean: true + + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + checkDownloadedFiles: true + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: NuGetAuthenticate@1 + + - task: AzureCLI@2 + displayName: Publish Build Assets + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/sdk-task.ps1 + arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:MaestroApiEndpoint=https://maestro.dot.net + /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} + /p:OfficialBuildId=$(Build.BuildNumber) + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + + - task: powershell@2 + displayName: Create ReleaseConfigs Artifact + inputs: + targetType: inline + script: | + New-Item -Path "$(Build.StagingDirectory)/ReleaseConfigs" -ItemType Directory -Force + $filePath = "$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt" + Add-Content -Path $filePath -Value $(BARBuildId) + Add-Content -Path $filePath -Value "$(DefaultChannels)" + Add-Content -Path $filePath -Value $(IsStableBuild) + + $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" + if (Test-Path -Path $symbolExclusionfile) + { + Write-Host "SymbolExclusionFile exists" + Copy-Item -Path $symbolExclusionfile -Destination "$(Build.StagingDirectory)/ReleaseConfigs" + } + + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish ReleaseConfigs Artifact + pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' + publishLocation: Container + artifactName: ReleaseConfigs + + - ${{ if eq(parameters.publishAssetsImmediately, 'true') }}: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: AzureCLI@2 + displayName: Publish Using Darc + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: > + -BuildId $(BARBuildId) + -PublishingInfraVersion 3 + -AzdoToken '$(System.AccessToken)' + -WaitPublishingFinish true + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + JobLabel: 'Publish_Artifacts_Logs' diff --git a/eng/common/core-templates/job/source-build.yml b/eng/common/core-templates/job/source-build.yml new file mode 100644 index 000000000000..c4713c8b6ede --- /dev/null +++ b/eng/common/core-templates/job/source-build.yml @@ -0,0 +1,93 @@ +parameters: + # This template adds arcade-powered source-build to CI. The template produces a server job with a + # default ID 'Source_Build_Complete' to put in a dependency list if necessary. + + # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. + jobNamePrefix: 'Source_Build' + + # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for + # managed-only repositories. This is an object with these properties: + # + # name: '' + # The name of the job. This is included in the job ID. + # targetRID: '' + # The name of the target RID to use, instead of the one auto-detected by Arcade. + # nonPortable: false + # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than + # linux-x64), and compiling against distro-provided packages rather than portable ones. + # skipPublishValidation: false + # Disables publishing validation. By default, a check is performed to ensure no packages are + # published by source-build. + # container: '' + # A container to use. Runs in docker. + # pool: {} + # A pool to use. Runs directly on an agent. + # buildScript: '' + # Specifies the build script to invoke to perform the build in the repo. The default + # './build.sh' should work for typical Arcade repositories, but this is customizable for + # difficult situations. + # jobProperties: {} + # A list of job properties to inject at the top level, for potential extensibility beyond + # container and pool. + platform: {} + + is1ESPipeline: '' + + # If set to true and running on a non-public project, + # Internal nuget and blob storage locations will be enabled. + # This is not enabled by default because many repositories do not need internal sources + # and do not need to have the required service connections approved in the pipeline. + enableInternalSources: false + +jobs: +- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} + displayName: Source-Build (${{ parameters.platform.name }}) + + ${{ each property in parameters.platform.jobProperties }}: + ${{ property.key }}: ${{ property.value }} + + ${{ if ne(parameters.platform.container, '') }}: + container: ${{ parameters.platform.container }} + + ${{ if eq(parameters.platform.pool, '') }}: + # The default VM host AzDO pool. This should be capable of running Docker containers: almost all + # source-build builds run in Docker, including the default managed platform. + # /eng/common/core-templates/variables/pool-providers.yml can't be used here (some customers declare variables already), so duplicate its logic + ${{ if eq(parameters.is1ESPipeline, 'true') }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] + demands: ImageOverride -equals build.ubuntu.2004.amd64 + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] + image: 1es-mariner-2 + os: linux + ${{ else }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore-Svc-Public' ), False, 'NetCore-Public')] + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64.Open + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $[replace(replace(eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), True, 'NetCore1ESPool-Svc-Internal'), False, 'NetCore1ESPool-Internal')] + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64 + ${{ if ne(parameters.platform.pool, '') }}: + pool: ${{ parameters.platform.pool }} + + workspace: + clean: all + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if eq(parameters.enableInternalSources, true) }}: + - template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + platform: ${{ parameters.platform }} diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml new file mode 100644 index 000000000000..205fb5b3a395 --- /dev/null +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -0,0 +1,81 @@ +parameters: + runAsPublic: false + sourceIndexUploadPackageVersion: 2.0.0-20240522.1 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20240522.1 + sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" + preSteps: [] + binlogPath: artifacts/log/Debug/Build.binlog + condition: '' + dependsOn: '' + pool: '' + is1ESPipeline: '' + +jobs: +- job: SourceIndexStage1 + dependsOn: ${{ parameters.dependsOn }} + condition: ${{ parameters.condition }} + variables: + - name: SourceIndexUploadPackageVersion + value: ${{ parameters.sourceIndexUploadPackageVersion }} + - name: SourceIndexProcessBinlogPackageVersion + value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} + - name: SourceIndexPackageSource + value: ${{ parameters.sourceIndexPackageSource }} + - name: BinlogPath + value: ${{ parameters.binlogPath }} + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + ${{ if eq(parameters.pool, '') }}: + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $(DncEngPublicBuildPool) + image: 1es-windows-2022-open + os: windows + ${{ if eq(variables['System.TeamProject'], 'internal') }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + + steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + + - task: UseDotNet@2 + displayName: Use .NET 8 SDK + inputs: + packageType: sdk + version: 8.0.x + installationPath: $(Agent.TempDirectory)/dotnet + workingDirectory: $(Agent.TempDirectory) + + - script: | + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + displayName: Download Tools + # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. + workingDirectory: $(Agent.TempDirectory) + + - script: ${{ parameters.sourceIndexBuildCommand }} + displayName: Build Repository + + - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + displayName: Process Binlog into indexable sln + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: AzureCLI@2 + displayName: Log in to Azure and upload stage1 artifacts to source index + inputs: + azureSubscription: 'SourceDotNet Stage1 Publish' + addSpnToEnvironment: true + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: | + $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 diff --git a/eng/common/core-templates/jobs/codeql-build.yml b/eng/common/core-templates/jobs/codeql-build.yml new file mode 100644 index 000000000000..f2144252cc65 --- /dev/null +++ b/eng/common/core-templates/jobs/codeql-build.yml @@ -0,0 +1,33 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + # Optional: if specified, restore and use this version of Guardian instead of the default. + overrideGuardianVersion: '' + is1ESPipeline: '' + +jobs: +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishTestResults: false + enablePublishBuildAssets: false + enablePublishUsingPipelines: false + enableTelemetry: true + + variables: + - group: Publish-Build-Assets + # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in + # sync with the packages.config file. + - name: DefaultGuardianVersion + value: 0.109.0 + - name: GuardianPackagesConfigFile + value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config + - name: GuardianVersion + value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} + + jobs: ${{ parameters.jobs }} + diff --git a/eng/common/core-templates/jobs/jobs.yml b/eng/common/core-templates/jobs/jobs.yml new file mode 100644 index 000000000000..ea69be4341c6 --- /dev/null +++ b/eng/common/core-templates/jobs/jobs.yml @@ -0,0 +1,119 @@ +parameters: + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + continueOnError: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing using release pipelines + enablePublishUsingPipelines: false + + # Optional: Enable running the source-build jobs to build repo from source + enableSourceBuild: false + + # Optional: Parameters for source-build template. + # See /eng/common/core-templates/jobs/source-build.yml for options + sourceBuildParameters: [] + + graphFileGeneration: + # Optional: Enable generating the graph files at the end of the build + enabled: false + # Optional: Include toolset dependencies in the generated graph files + includeToolset: false + + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + + # Optional: Override automatically derived dependsOn value for "publish build assets" job + publishBuildAssetsDependsOn: '' + + # Optional: Publish the assets as soon as the publish to BAR stage is complete, rather doing so in a separate stage. + publishAssetsImmediately: false + + # Optional: If using publishAssetsImmediately and additional parameters are needed, can be used to send along additional parameters (normally sent to post-build.yml) + artifactsPublishingAdditionalParameters: '' + signingValidationAdditionalParameters: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + + enableSourceIndex: false + sourceIndexParams: {} + + artifacts: {} + is1ESPipeline: '' + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- ${{ each job in parameters.jobs }}: + - ${{ if eq(parameters.is1ESPipeline, 'true') }}: + - template: /eng/common/templates-official/job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + + - ${{ else }}: + - template: /eng/common/templates/job/job.yml + parameters: + # pass along parameters + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} + + # pass along job properties + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} + + name: ${{ job.job }} + +- ${{ if eq(parameters.enableSourceBuild, true) }}: + - template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + allCompletedJobId: Source_Build_Complete + ${{ each parameter in parameters.sourceBuildParameters }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if eq(parameters.enableSourceIndex, 'true') }}: + - template: ../job/source-index-stage1.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + runAsPublic: ${{ parameters.runAsPublic }} + ${{ each parameter in parameters.sourceIndexParams }}: + ${{ parameter.key }}: ${{ parameter.value }} + +- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - template: ../job/publish-build-assets.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + - ${{ if eq(parameters.enableSourceBuild, true) }}: + - Source_Build_Complete + + runAsPublic: ${{ parameters.runAsPublic }} + publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} + publishAssetsImmediately: ${{ parameters.publishAssetsImmediately }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + signingValidationAdditionalParameters: ${{ parameters.signingValidationAdditionalParameters }} diff --git a/eng/common/core-templates/jobs/source-build.yml b/eng/common/core-templates/jobs/source-build.yml new file mode 100644 index 000000000000..a10ccfbee6de --- /dev/null +++ b/eng/common/core-templates/jobs/source-build.yml @@ -0,0 +1,58 @@ +parameters: + # This template adds arcade-powered source-build to CI. A job is created for each platform, as + # well as an optional server job that completes when all platform jobs complete. + + # The name of the "join" job for all source-build platforms. If set to empty string, the job is + # not included. Existing repo pipelines can use this job depend on all source-build jobs + # completing without maintaining a separate list of every single job ID: just depend on this one + # server job. By default, not included. Recommended name if used: 'Source_Build_Complete'. + allCompletedJobId: '' + + # See /eng/common/core-templates/job/source-build.yml + jobNamePrefix: 'Source_Build' + + # This is the default platform provided by Arcade, intended for use by a managed-only repo. + defaultManagedPlatform: + name: 'Managed' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9' + + # Defines the platforms on which to run build jobs. One job is created for each platform, and the + # object in this array is sent to the job template as 'platform'. If no platforms are specified, + # one job runs on 'defaultManagedPlatform'. + platforms: [] + + is1ESPipeline: '' + + # If set to true and running on a non-public project, + # Internal nuget and blob storage locations will be enabled. + # This is not enabled by default because many repositories do not need internal sources + # and do not need to have the required service connections approved in the pipeline. + enableInternalSources: false + +jobs: + +- ${{ if ne(parameters.allCompletedJobId, '') }}: + - job: ${{ parameters.allCompletedJobId }} + displayName: Source-Build Complete + pool: server + dependsOn: + - ${{ each platform in parameters.platforms }}: + - ${{ parameters.jobNamePrefix }}_${{ platform.name }} + - ${{ if eq(length(parameters.platforms), 0) }}: + - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} + +- ${{ each platform in parameters.platforms }}: + - template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ platform }} + enableInternalSources: ${{ parameters.enableInternalSources }} + +- ${{ if eq(length(parameters.platforms), 0) }}: + - template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ parameters.defaultManagedPlatform }} + enableInternalSources: ${{ parameters.enableInternalSources }} diff --git a/eng/common/core-templates/post-build/common-variables.yml b/eng/common/core-templates/post-build/common-variables.yml new file mode 100644 index 000000000000..d5627a994ae5 --- /dev/null +++ b/eng/common/core-templates/post-build/common-variables.yml @@ -0,0 +1,22 @@ +variables: + - group: Publish-Build-Assets + + # Whether the build is internal or not + - name: IsInternalBuild + value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + + # Default Maestro++ API Endpoint and API Version + - name: MaestroApiEndPoint + value: "https://maestro.dot.net" + - name: MaestroApiVersion + value: "2020-02-20" + + - name: SourceLinkCLIVersion + value: 3.0.0 + - name: SymbolToolVersion + value: 1.0.1 + - name: BinlogToolVersion + value: 1.0.11 + + - name: runCodesignValidationInjection + value: false diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml new file mode 100644 index 000000000000..454fd75c7aff --- /dev/null +++ b/eng/common/core-templates/post-build/post-build.yml @@ -0,0 +1,316 @@ +parameters: + # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. + # Publishing V1 is no longer supported + # Publishing V2 is no longer supported + # Publishing V3 is the default + - name: publishingInfraVersion + displayName: Which version of publishing should be used to promote the build definition? + type: number + default: 3 + values: + - 3 + + - name: BARBuildId + displayName: BAR Build Id + type: number + default: 0 + + - name: PromoteToChannelIds + displayName: Channel to promote BARBuildId to + type: string + default: '' + + - name: enableSourceLinkValidation + displayName: Enable SourceLink validation + type: boolean + default: false + + - name: enableSigningValidation + displayName: Enable signing validation + type: boolean + default: true + + - name: enableSymbolValidation + displayName: Enable symbol validation + type: boolean + default: false + + - name: enableNugetValidation + displayName: Enable NuGet validation + type: boolean + default: true + + - name: publishInstallersAndChecksums + displayName: Publish installers and checksums + type: boolean + default: true + + - name: SDLValidationParameters + type: object + default: + enable: false + publishGdn: false + continueOnError: false + params: '' + artifactNames: '' + downloadArtifacts: true + + # These parameters let the user customize the call to sdk-task.ps1 for publishing + # symbols & general artifacts as well as for signing validation + - name: symbolPublishingAdditionalParameters + displayName: Symbol publishing additional parameters + type: string + default: '' + + - name: artifactsPublishingAdditionalParameters + displayName: Artifact publishing additional parameters + type: string + default: '' + + - name: signingValidationAdditionalParameters + displayName: Signing validation additional parameters + type: string + default: '' + + # Which stages should finish execution before post-build stages start + - name: validateDependsOn + type: object + default: + - build + + - name: publishDependsOn + type: object + default: + - Validate + + # Optional: Call asset publishing rather than running in a separate stage + - name: publishAssetsImmediately + type: boolean + default: false + + - name: is1ESPipeline + type: boolean + default: false + +stages: +- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + - stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Validate Build Assets + variables: + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobs: + - job: + displayName: NuGet Validation + condition: and(succeededOrFailed(), eq( ${{ parameters.enableNugetValidation }}, 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: windows.vs2022.amd64 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2022.amd64 + + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + + - job: + displayName: Signing Validation + condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2022.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + itemPattern: | + ** + !**/Microsoft.SourceBuild.Intermediate.*.nupkg + + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@1 + displayName: 'Authenticate to AzDO Feeds' + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine vs + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + StageLabel: 'Validation' + JobLabel: 'Signing' + BinlogToolVersion: $(BinlogToolVersion) + + - job: + displayName: SourceLink Validation + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: $(DncEngInternalBuildPool) + image: 1es-windows-2022 + os: windows + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2022.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + checkDownloadedFiles: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true + +- ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: + - stage: publish_using_darc + ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + dependsOn: ${{ parameters.publishDependsOn }} + ${{ else }}: + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Publish using Darc + variables: + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + jobs: + - job: + displayName: Publish Using Darc + timeoutInMinutes: 120 + pool: + # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + demands: Cmd + os: windows + # If it's not devdiv, it's dnceng + ${{ else }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: + name: NetCore1ESPool-Publishing-Internal + image: windows.vs2019.amd64 + os: windows + ${{ else }}: + name: NetCore1ESPool-Publishing-Internal + demands: ImageOverride -equals windows.vs2019.amd64 + steps: + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - task: NuGetAuthenticate@1 + + - task: AzureCLI@2 + displayName: Publish Using Darc + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: > + -BuildId $(BARBuildId) + -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} + -AzdoToken '$(System.AccessToken)' + -WaitPublishingFinish true + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/post-build/setup-maestro-vars.yml b/eng/common/core-templates/post-build/setup-maestro-vars.yml new file mode 100644 index 000000000000..f7602980dbe7 --- /dev/null +++ b/eng/common/core-templates/post-build/setup-maestro-vars.yml @@ -0,0 +1,74 @@ +parameters: + BARBuildId: '' + PromoteToChannelIds: '' + is1ESPipeline: '' + +steps: + - ${{ if eq(parameters.is1ESPipeline, '') }}: + - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error + + - ${{ if eq(coalesce(parameters.PromoteToChannelIds, 0), 0) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs + inputs: + buildType: current + artifactName: ReleaseConfigs + checkDownloadedFiles: true + + - task: AzureCLI@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + try { + if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { + $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt + + $BarId = $Content | Select -Index 0 + $Channels = $Content | Select -Index 1 + $IsStableBuild = $Content | Select -Index 2 + + $AzureDevOpsProject = $Env:System_TeamProject + $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId + $AzureDevOpsBuildId = $Env:Build_BuildId + } + else { + . $(Build.SourcesDirectory)\eng\common\tools.ps1 + $darc = Get-Darc + $buildInfo = & $darc get-build ` + --id ${{ parameters.BARBuildId }} ` + --extended ` + --output-format json ` + --ci ` + | convertFrom-Json + + $BarId = ${{ parameters.BARBuildId }} + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels]" + + $IsStableBuild = $buildInfo.stable + $AzureDevOpsProject = $buildInfo.azureDevOpsProject + $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId + $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId + } + + Write-Host "##vso[task.setvariable variable=BARBuildId]$BarId" + Write-Host "##vso[task.setvariable variable=TargetChannels]$Channels" + Write-Host "##vso[task.setvariable variable=IsStableBuild]$IsStableBuild" + + Write-Host "##vso[task.setvariable variable=AzDOProjectName]$AzureDevOpsProject" + Write-Host "##vso[task.setvariable variable=AzDOPipelineId]$AzureDevOpsBuildDefinitionId" + Write-Host "##vso[task.setvariable variable=AzDOBuildId]$AzureDevOpsBuildId" + } + catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 + } + env: + PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/core-templates/steps/component-governance.yml b/eng/common/core-templates/steps/component-governance.yml new file mode 100644 index 000000000000..cf0649aa9565 --- /dev/null +++ b/eng/common/core-templates/steps/component-governance.yml @@ -0,0 +1,16 @@ +parameters: + disableComponentGovernance: false + componentGovernanceIgnoreDirectories: '' + is1ESPipeline: false + displayName: 'Component Detection' + +steps: +- ${{ if eq(parameters.disableComponentGovernance, 'true') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable +- ${{ if ne(parameters.disableComponentGovernance, 'true') }}: + - task: ComponentGovernanceComponentDetection@0 + continueOnError: true + displayName: ${{ parameters.displayName }} + inputs: + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/core-templates/steps/enable-internal-runtimes.yml b/eng/common/core-templates/steps/enable-internal-runtimes.yml new file mode 100644 index 000000000000..6bdbf62ac500 --- /dev/null +++ b/eng/common/core-templates/steps/enable-internal-runtimes.yml @@ -0,0 +1,32 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default + +parameters: +- name: federatedServiceConnection + type: string + default: 'dotnetbuilds-internal-read' +- name: outputVariableName + type: string + default: 'dotnetbuilds-internal-container-read-token-base64' +- name: expiryInHours + type: number + default: 1 +- name: base64Encode + type: boolean + default: true +- name: is1ESPipeline + type: boolean + default: false + +steps: +- ${{ if ne(variables['System.TeamProject'], 'public') }}: + - template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + federatedServiceConnection: ${{ parameters.federatedServiceConnection }} + outputVariableName: ${{ parameters.outputVariableName }} + expiryInHours: ${{ parameters.expiryInHours }} + base64Encode: ${{ parameters.base64Encode }} + storageAccount: dotnetbuilds + container: internal + permissions: rl + is1ESPipeline: ${{ parameters.is1ESPipeline }} \ No newline at end of file diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml new file mode 100644 index 000000000000..64f881bffc3c --- /dev/null +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -0,0 +1,47 @@ +parameters: +# This is the Azure federated service connection that we log into to get an access token. +- name: nugetFederatedServiceConnection + type: string + default: 'dnceng-artifacts-feeds-read' +- name: is1ESPipeline + type: boolean + default: false +# Legacy parameters to allow for PAT usage +- name: legacyCredential + type: string + default: '' + +steps: +- ${{ if ne(variables['System.TeamProject'], 'public') }}: + - ${{ if ne(parameters.legacyCredential, '') }}: + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token + env: + Token: ${{ parameters.legacyCredential }} + # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. + # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that + # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. + - ${{ else }}: + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config + - ${{ else }}: + - template: /eng/common/templates/steps/get-federated-access-token.yml + parameters: + federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} + outputVariableName: 'dnceng-artifacts-feeds-read-access-token' + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) + # This is required in certain scenarios to install the ADO credential provider. + # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others + # (e.g. dotnet msbuild). + - task: NuGetAuthenticate@1 diff --git a/eng/common/core-templates/steps/generate-sbom.yml b/eng/common/core-templates/steps/generate-sbom.yml new file mode 100644 index 000000000000..d938b60e1bb5 --- /dev/null +++ b/eng/common/core-templates/steps/generate-sbom.yml @@ -0,0 +1,54 @@ +# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated. +# PackageName - The name of the package this SBOM represents. +# PackageVersion - The version of the package this SBOM represents. +# ManifestDirPath - The path of the directory where the generated manifest files will be placed +# IgnoreDirectories - Directories to ignore for SBOM generation. This will be passed through to the CG component detector. + +parameters: + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + PackageName: '.NET' + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom + IgnoreDirectories: '' + sbomContinueOnError: true + is1ESPipeline: false + # disable publishArtifacts if some other step is publishing the artifacts (like job.yml). + publishArtifacts: true + +steps: +- task: PowerShell@2 + displayName: Prep for SBOM generation in (Non-linux) + condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin')) + inputs: + filePath: ./eng/common/generate-sbom-prep.ps1 + arguments: ${{parameters.manifestDirPath}} + +# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461 +- script: | + chmod +x ./eng/common/generate-sbom-prep.sh + ./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}} + displayName: Prep for SBOM generation in (Linux) + condition: eq(variables['Agent.Os'], 'Linux') + continueOnError: ${{ parameters.sbomContinueOnError }} + +- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: 'Generate SBOM manifest' + continueOnError: ${{ parameters.sbomContinueOnError }} + inputs: + PackageName: ${{ parameters.packageName }} + BuildDropPath: ${{ parameters.buildDropPath }} + PackageVersion: ${{ parameters.packageVersion }} + ManifestDirPath: ${{ parameters.manifestDirPath }} + ${{ if ne(parameters.IgnoreDirectories, '') }}: + AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' + +- ${{ if eq(parameters.publishArtifacts, 'true')}}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish SBOM manifest + continueOnError: ${{parameters.sbomContinueOnError}} + targetPath: '${{ parameters.manifestDirPath }}' + artifactName: $(ARTIFACT_NAME) + diff --git a/eng/common/core-templates/steps/get-delegation-sas.yml b/eng/common/core-templates/steps/get-delegation-sas.yml new file mode 100644 index 000000000000..9db5617ea7de --- /dev/null +++ b/eng/common/core-templates/steps/get-delegation-sas.yml @@ -0,0 +1,55 @@ +parameters: +- name: federatedServiceConnection + type: string +- name: outputVariableName + type: string +- name: expiryInHours + type: number + default: 1 +- name: base64Encode + type: boolean + default: false +- name: storageAccount + type: string +- name: container + type: string +- name: permissions + type: string + default: 'rl' +- name: is1ESPipeline + type: boolean + default: false + +steps: +- task: AzureCLI@2 + displayName: 'Generate delegation SAS Token for ${{ parameters.storageAccount }}/${{ parameters.container }}' + inputs: + azureSubscription: ${{ parameters.federatedServiceConnection }} + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + # Calculate the expiration of the SAS token and convert to UTC + $expiry = (Get-Date).AddHours(${{ parameters.expiryInHours }}).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") + + # Temporarily work around a helix issue where SAS tokens with / in them will cause incorrect downloads + # of correlation payloads. https://github.com/dotnet/dnceng/issues/3484 + $sas = "" + do { + $sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to generate SAS token." + exit 1 + } + } while($sas.IndexOf('/') -ne -1) + + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to generate SAS token." + exit 1 + } + + if ('${{ parameters.base64Encode }}' -eq 'true') { + $sas = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($sas)) + } + + Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$sas" diff --git a/eng/common/core-templates/steps/get-federated-access-token.yml b/eng/common/core-templates/steps/get-federated-access-token.yml new file mode 100644 index 000000000000..3a4d4410c482 --- /dev/null +++ b/eng/common/core-templates/steps/get-federated-access-token.yml @@ -0,0 +1,42 @@ +parameters: +- name: federatedServiceConnection + type: string +- name: outputVariableName + type: string +- name: is1ESPipeline + type: boolean +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' +# Resource to get a token for. Common values include: +# - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps +# - 'https://storage.azure.com/' for storage +# Defaults to Azure DevOps +- name: resource + type: string + default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false + +steps: +- task: AzureCLI@2 + displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + inputs: + azureSubscription: ${{ parameters.federatedServiceConnection }} + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + $accessToken = az account get-access-token --query accessToken --resource ${{ parameters.resource }} --output tsv + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to get access token for resource '${{ parameters.resource }}'" + exit 1 + } + Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/eng/common/core-templates/steps/publish-build-artifacts.yml b/eng/common/core-templates/steps/publish-build-artifacts.yml new file mode 100644 index 000000000000..f24ce346684e --- /dev/null +++ b/eng/common/core-templates/steps/publish-build-artifacts.yml @@ -0,0 +1,20 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false +- name: args + type: object + default: {} +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - template: /eng/common/templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + ${{ each parameter in parameters.args }}: + ${{ parameter.key }}: ${{ parameter.value }} +- ${{ else }}: + - template: /eng/common/templates-official/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + ${{ each parameter in parameters.args }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/core-templates/steps/publish-logs.yml b/eng/common/core-templates/steps/publish-logs.yml new file mode 100644 index 000000000000..80788c523191 --- /dev/null +++ b/eng/common/core-templates/steps/publish-logs.yml @@ -0,0 +1,58 @@ +parameters: + StageLabel: '' + JobLabel: '' + CustomSensitiveDataList: '' + # A default - in case value from eng/common/core-templates/post-build/common-variables.yml is not passed + BinlogToolVersion: '1.0.11' + is1ESPipeline: false + +steps: +- task: Powershell@2 + displayName: Prepare Binlogs to Upload + inputs: + targetType: inline + script: | + New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/ + continueOnError: true + condition: always() + +- task: PowerShell@2 + displayName: Redact Logs + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/redact-logs.ps1 + # For now this needs to have explicit list of all sensitive data. Taken from eng/publishing/v3/publish.yml + # Sensitive data can as well be added to $(Build.SourcesDirectory)/eng/BinlogSecretsRedactionFile.txt' + # If the file exists - sensitive data for redaction will be sourced from it + # (single entry per line, lines starting with '# ' are considered comments and skipped) + arguments: -InputPath '$(Build.SourcesDirectory)/PostBuildLogs' + -BinlogToolVersion ${{parameters.BinlogToolVersion}} + -TokensFilePath '$(Build.SourcesDirectory)/eng/BinlogSecretsRedactionFile.txt' + '$(publishing-dnceng-devdiv-code-r-build-re)' + '$(MaestroAccessToken)' + '$(dn-bot-all-orgs-artifact-feeds-rw)' + '$(akams-client-id)' + '$(microsoft-symbol-server-pat)' + '$(symweb-symbol-server-pat)' + '$(dn-bot-all-orgs-build-rw-code-rw)' + ${{parameters.CustomSensitiveDataList}} + continueOnError: true + condition: always() + +- task: CopyFiles@2 + displayName: Gather post build logs + inputs: + SourceFolder: '$(Build.SourcesDirectory)/PostBuildLogs' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' + +- template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/PostBuildLogs' + publishLocation: Container + artifactName: PostBuildLogs + continueOnError: true + condition: always() diff --git a/eng/common/core-templates/steps/publish-pipeline-artifacts.yml b/eng/common/core-templates/steps/publish-pipeline-artifacts.yml new file mode 100644 index 000000000000..2efec04dc2c1 --- /dev/null +++ b/eng/common/core-templates/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,20 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: args + type: object + default: {} + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - template: /eng/common/templates/steps/publish-pipeline-artifacts.yml + parameters: + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} +- ${{ else }}: + - template: /eng/common/templates-official/steps/publish-pipeline-artifacts.yml + parameters: + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/core-templates/steps/retain-build.yml b/eng/common/core-templates/steps/retain-build.yml new file mode 100644 index 000000000000..83d97a26a01f --- /dev/null +++ b/eng/common/core-templates/steps/retain-build.yml @@ -0,0 +1,28 @@ +parameters: + # Optional azure devops PAT with build execute permissions for the build's organization, + # only needed if the build that should be retained ran on a different organization than + # the pipeline where this template is executing from + Token: '' + # Optional BuildId to retain, defaults to the current running build + BuildId: '' + # Azure devops Organization URI for the build in the https://dev.azure.com/ format. + # Defaults to the organization the current pipeline is running on + AzdoOrgUri: '$(System.CollectionUri)' + # Azure devops project for the build. Defaults to the project the current pipeline is running on + AzdoProject: '$(System.TeamProject)' + +steps: + - task: powershell@2 + inputs: + targetType: 'filePath' + filePath: eng/common/retain-build.ps1 + pwsh: true + arguments: > + -AzdoOrgUri: ${{parameters.AzdoOrgUri}} + -AzdoProject ${{parameters.AzdoProject}} + -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} + -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} + displayName: Enable permanent build retention + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + BUILD_ID: $(Build.BuildId) \ No newline at end of file diff --git a/eng/common/core-templates/steps/send-to-helix.yml b/eng/common/core-templates/steps/send-to-helix.yml new file mode 100644 index 000000000000..68fa739c4ab2 --- /dev/null +++ b/eng/common/core-templates/steps/send-to-helix.yml @@ -0,0 +1,93 @@ +# Please remember to update the documentation if you make changes to these parameters! +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixProjectPath: 'eng/common/helixpublish.proj' # optional -- path to the project file to build relative to BUILD_SOURCESDIRECTORY + HelixProjectArguments: '' # optional -- arguments passed to the build command + HelixConfiguration: '' # optional -- additional property attached to a job + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon-delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net ) + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + HelixBaseUri: ${{ parameters.HelixBaseUri }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml new file mode 100644 index 000000000000..2915d29bb7f6 --- /dev/null +++ b/eng/common/core-templates/steps/source-build.yml @@ -0,0 +1,129 @@ +parameters: + # This template adds arcade-powered source-build to CI. + + # This is a 'steps' template, and is intended for advanced scenarios where the existing build + # infra has a careful build methodology that must be followed. For example, a repo + # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline + # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to + # GitHub. Using this steps template leaves room for that infra to be included. + + # Defines the platform on which to run the steps. See 'eng/common/core-templates/job/source-build.yml' + # for details. The entire object is described in the 'job' template for simplicity, even though + # the usage of the properties on this object is split between the 'job' and 'steps' templates. + platform: {} + is1ESPipeline: false + +steps: +# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) +- script: | + set -x + df -h + + # If file changes are detected, set CopyWipIntoInnerSourceBuildRepo to copy the WIP changes into the inner source build repo. + internalRestoreArgs= + if ! git diff --quiet; then + internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true' + # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo. + # This only works if there is a username/email configured, which won't be the case in most CI runs. + git config --get user.email + if [ $? -ne 0 ]; then + git config user.email dn-bot@microsoft.com + git config user.name dn-bot + fi + fi + + # If building on the internal project, the internal storage variable may be available (usually only if needed) + # In that case, add variables to allow the download of internal runtimes if the specified versions are not found + # in the default public locations. + internalRuntimeDownloadArgs= + if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' + fi + + buildConfig=Release + # Check if AzDO substitutes in a build config from a variable, and use it if so. + if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then + buildConfig='$(_BuildConfig)' + fi + + officialBuildArgs= + if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then + officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)' + fi + + targetRidArgs= + if [ '${{ parameters.platform.targetRID }}' != '' ]; then + targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' + fi + + runtimeOsArgs= + if [ '${{ parameters.platform.runtimeOS }}' != '' ]; then + runtimeOsArgs='/p:RuntimeOS=${{ parameters.platform.runtimeOS }}' + fi + + baseOsArgs= + if [ '${{ parameters.platform.baseOS }}' != '' ]; then + baseOsArgs='/p:BaseOS=${{ parameters.platform.baseOS }}' + fi + + publishArgs= + if [ '${{ parameters.platform.skipPublishValidation }}' != 'true' ]; then + publishArgs='--publish' + fi + + assetManifestFileName=SourceBuild_RidSpecific.xml + if [ '${{ parameters.platform.name }}' != '' ]; then + assetManifestFileName=SourceBuild_${{ parameters.platform.name }}.xml + fi + + ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ + --configuration $buildConfig \ + --restore --build --pack $publishArgs -bl \ + $officialBuildArgs \ + $internalRuntimeDownloadArgs \ + $internalRestoreArgs \ + $targetRidArgs \ + $runtimeOsArgs \ + $baseOsArgs \ + /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ + /p:ArcadeBuildFromSource=true \ + /p:DotNetBuildSourceOnly=true \ + /p:DotNetBuildRepo=true \ + /p:AssetManifestFileName=$assetManifestFileName + displayName: Build + +# Upload build logs for diagnosis. +- task: CopyFiles@2 + displayName: Prepare BuildLogs staging directory + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + artifacts/sb/prebuilt-report/** + TargetFolder: '$(Build.StagingDirectory)/BuildLogs' + CleanTargetFolder: true + continueOnError: true + condition: succeededOrFailed() + +- template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + args: + displayName: Publish BuildLogs + targetPath: '$(Build.StagingDirectory)/BuildLogs' + artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) + continueOnError: true + condition: succeededOrFailed() + sbomEnabled: false # we don't need SBOM for logs + +# Manually inject component detection so that we can ignore the source build upstream cache, which contains +# a nupkg cache of input packages (a local feed). +# This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir' +# in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + displayName: Component Detection (Exclude upstream cache) + is1ESPipeline: ${{ parameters.is1ESPipeline }} + componentGovernanceIgnoreDirectories: '$(Build.SourcesDirectory)/artifacts/sb/src/artifacts/obj/source-built-upstream-cache' + disableComponentGovernance: ${{ eq(variables['System.TeamProject'], 'public') }} diff --git a/eng/common/core-templates/variables/pool-providers.yml b/eng/common/core-templates/variables/pool-providers.yml new file mode 100644 index 000000000000..41053d382a2e --- /dev/null +++ b/eng/common/core-templates/variables/pool-providers.yml @@ -0,0 +1,8 @@ +parameters: + is1ESPipeline: false + +variables: + - ${{ if eq(parameters.is1ESPipeline, 'true') }}: + - template: /eng/common/templates-official/variables/pool-providers.yml + - ${{ else }}: + - template: /eng/common/templates/variables/pool-providers.yml \ No newline at end of file diff --git a/eng/common/cross/arm/tizen/tizen.patch b/eng/common/cross/arm/tizen/tizen.patch new file mode 100644 index 000000000000..fb12ade7250a --- /dev/null +++ b/eng/common/cross/arm/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-armhf.so.3 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-armhf.so.3 ) ) diff --git a/eng/common/cross/arm64/tizen/tizen.patch b/eng/common/cross/arm64/tizen/tizen.patch new file mode 100644 index 000000000000..af7c8be05906 --- /dev/null +++ b/eng/common/cross/arm64/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf64-littleaarch64) +-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-aarch64.so.1 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-aarch64.so.1 ) ) diff --git a/eng/common/cross/armel/armel.jessie.patch b/eng/common/cross/armel/armel.jessie.patch new file mode 100644 index 000000000000..2d2615619351 --- /dev/null +++ b/eng/common/cross/armel/armel.jessie.patch @@ -0,0 +1,43 @@ +diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h +--- a/usr/include/urcu/uatomic/generic.h 2014-10-22 15:00:58.000000000 -0700 ++++ b/usr/include/urcu/uatomic/generic.h 2020-10-30 21:38:28.550000000 -0700 +@@ -69,10 +69,10 @@ + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- return __sync_val_compare_and_swap_2(addr, old, _new); ++ return __sync_val_compare_and_swap_2((uint16_t*) addr, old, _new); + #endif + case 4: +- return __sync_val_compare_and_swap_4(addr, old, _new); ++ return __sync_val_compare_and_swap_4((uint32_t*) addr, old, _new); + #if (CAA_BITS_PER_LONG == 64) + case 8: + return __sync_val_compare_and_swap_8(addr, old, _new); +@@ -109,7 +109,7 @@ + return; + #endif + case 4: +- __sync_and_and_fetch_4(addr, val); ++ __sync_and_and_fetch_4((uint32_t*) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +@@ -148,7 +148,7 @@ + return; + #endif + case 4: +- __sync_or_and_fetch_4(addr, val); ++ __sync_or_and_fetch_4((uint32_t*) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +@@ -187,7 +187,7 @@ + return __sync_add_and_fetch_2(addr, val); + #endif + case 4: +- return __sync_add_and_fetch_4(addr, val); ++ return __sync_add_and_fetch_4((uint32_t*) addr, val); + #if (CAA_BITS_PER_LONG == 64) + case 8: + return __sync_add_and_fetch_8(addr, val); diff --git a/eng/common/cross/armel/tizen/tizen.patch b/eng/common/cross/armel/tizen/tizen.patch new file mode 100644 index 000000000000..ca7c7c1ff751 --- /dev/null +++ b/eng/common/cross/armel/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.3 ) ) diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh new file mode 100644 index 000000000000..7e9ba2b75ed3 --- /dev/null +++ b/eng/common/cross/build-android-rootfs.sh @@ -0,0 +1,131 @@ +#!/usr/bin/env bash +set -e +__NDK_Version=r21 + +usage() +{ + echo "Creates a toolchain and sysroot used for cross-compiling for Android." + echo + echo "Usage: $0 [BuildArch] [ApiLevel]" + echo + echo "BuildArch is the target architecture of Android. Currently only arm64 is supported." + echo "ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html" + echo + echo "By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior" + echo "by setting the TOOLCHAIN_DIR environment variable" + echo + echo "By default, the NDK will be downloaded into the cross/android-rootfs/android-ndk-$__NDK_Version directory. If you already have an NDK installation," + echo "you can set the NDK_DIR environment variable to have this script use that installation of the NDK." + echo "By default, this script will generate a file, android_platform, in the root of the ROOTFS_DIR directory that contains the RID for the supported and tested Android build: android.28-arm64. This file is to replace '/etc/os-release', which is not available for Android." + exit 1 +} + +__ApiLevel=28 # The minimum platform for arm64 is API level 21 but the minimum version that support glob(3) is 28. See $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/glob.h +__BuildArch=arm64 +__AndroidArch=aarch64 +__AndroidToolchain=aarch64-linux-android + +for i in "$@" + do + lowerI="$(echo $i | tr "[:upper:]" "[:lower:]")" + case $lowerI in + -?|-h|--help) + usage + exit 1 + ;; + arm64) + __BuildArch=arm64 + __AndroidArch=aarch64 + __AndroidToolchain=aarch64-linux-android + ;; + arm) + __BuildArch=arm + __AndroidArch=arm + __AndroidToolchain=arm-linux-androideabi + ;; + *[0-9]) + __ApiLevel=$i + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" + ;; + esac +done + +# Obtain the location of the bash script to figure out where the root of the repo is. +__ScriptBaseDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +__CrossDir="$__ScriptBaseDir/../../../.tools/android-rootfs" + +if [[ ! -f "$__CrossDir" ]]; then + mkdir -p "$__CrossDir" +fi + +# Resolve absolute path to avoid `../` in build logs +__CrossDir="$( cd "$__CrossDir" && pwd )" + +__NDK_Dir="$__CrossDir/android-ndk-$__NDK_Version" +__lldb_Dir="$__CrossDir/lldb" +__ToolchainDir="$__CrossDir/android-ndk-$__NDK_Version" + +if [[ -n "$TOOLCHAIN_DIR" ]]; then + __ToolchainDir=$TOOLCHAIN_DIR +fi + +if [[ -n "$NDK_DIR" ]]; then + __NDK_Dir=$NDK_DIR +fi + +echo "Target API level: $__ApiLevel" +echo "Target architecture: $__BuildArch" +echo "NDK location: $__NDK_Dir" +echo "Target Toolchain location: $__ToolchainDir" + +# Download the NDK if required +if [ ! -d $__NDK_Dir ]; then + echo Downloading the NDK into $__NDK_Dir + mkdir -p $__NDK_Dir + wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/android-ndk-$__NDK_Version-linux-x86_64.zip -O $__CrossDir/android-ndk-$__NDK_Version-linux-x86_64.zip + unzip -q $__CrossDir/android-ndk-$__NDK_Version-linux-x86_64.zip -d $__CrossDir +fi + +if [ ! -d $__lldb_Dir ]; then + mkdir -p $__lldb_Dir + echo Downloading LLDB into $__lldb_Dir + wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/lldb-2.3.3614996-linux-x86_64.zip -O $__CrossDir/lldb-2.3.3614996-linux-x86_64.zip + unzip -q $__CrossDir/lldb-2.3.3614996-linux-x86_64.zip -d $__lldb_Dir +fi + +echo "Download dependencies..." +__TmpDir=$__CrossDir/tmp/$__BuildArch/ +mkdir -p "$__TmpDir" + +# combined dependencies for coreclr, installer and libraries +__AndroidPackages="libicu" +__AndroidPackages+=" libandroid-glob" +__AndroidPackages+=" liblzma" +__AndroidPackages+=" krb5" +__AndroidPackages+=" openssl" + +for path in $(wget -qO- https://packages.termux.dev/termux-main-21/dists/stable/main/binary-$__AndroidArch/Packages |\ + grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do + + if [[ "$path" != "Filename:" ]]; then + echo "Working on: $path" + wget -qO- https://packages.termux.dev/termux-main-21/$path | dpkg -x - "$__TmpDir" + fi +done + +cp -R "$__TmpDir/data/data/com.termux/files/usr/"* "$__ToolchainDir/sysroot/usr/" + +# Generate platform file for build.sh script to assign to __DistroRid +echo "Generating platform file..." +echo "RID=android.${__ApiLevel}-${__BuildArch}" > $__ToolchainDir/sysroot/android_platform + +echo "Now to build coreclr, libraries and installers; run:" +echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ + --subsetCategory coreclr +echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ + --subsetCategory libraries +echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ + --subsetCategory installer diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh new file mode 100644 index 000000000000..4b5e8d7166bd --- /dev/null +++ b/eng/common/cross/build-rootfs.sh @@ -0,0 +1,786 @@ +#!/usr/bin/env bash + +set -e + +usage() +{ + echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir ]" + echo "BuildArch can be: arm(default), arm64, armel, armv6, ppc64le, riscv64, s390x, x64, x86" + echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine" + echo " for alpine can be specified with version: alpineX.YY or alpineedge" + echo " for FreeBSD can be: freebsd13, freebsd14" + echo " for illumos can be: illumos" + echo " for Haiku can be: haiku." + echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD" + echo "llvmx[.y] - optional, LLVM version for LLVM related packages." + echo "--skipunmount - optional, will skip the unmount of rootfs folder." + echo "--skipsigcheck - optional, will skip package signature checks (allowing untrusted packages)." + echo "--use-mirror - optional, use mirror URL to fetch resources, when available." + echo "--jobs N - optional, restrict to N jobs." + exit 1 +} + +__CodeName=xenial +__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__BuildArch=arm +__AlpineArch=armv7 +__FreeBSDArch=arm +__FreeBSDMachineArch=armv7 +__IllumosArch=arm7 +__HaikuArch=arm +__QEMUArch=arm +__UbuntuArch=armhf +__UbuntuRepo= +__UbuntuSuites="updates security backports" +__LLDB_Package="liblldb-3.9-dev" +__SkipUnmount=0 + +# base development support +__UbuntuPackages="build-essential" + +__AlpinePackages="alpine-base" +__AlpinePackages+=" build-base" +__AlpinePackages+=" linux-headers" +__AlpinePackages+=" lldb-dev" +__AlpinePackages+=" python3" +__AlpinePackages+=" libedit" + +# symlinks fixer +__UbuntuPackages+=" symlinks" + +# runtime dependencies +__UbuntuPackages+=" libicu-dev" +__UbuntuPackages+=" liblttng-ust-dev" +__UbuntuPackages+=" libunwind8-dev" +__UbuntuPackages+=" libnuma-dev" + +__AlpinePackages+=" gettext-dev" +__AlpinePackages+=" icu-dev" +__AlpinePackages+=" libunwind-dev" +__AlpinePackages+=" lttng-ust-dev" +__AlpinePackages+=" compiler-rt" +__AlpinePackages+=" numactl-dev" + +# runtime libraries' dependencies +__UbuntuPackages+=" libcurl4-openssl-dev" +__UbuntuPackages+=" libkrb5-dev" +__UbuntuPackages+=" libssl-dev" +__UbuntuPackages+=" zlib1g-dev" + +__AlpinePackages+=" curl-dev" +__AlpinePackages+=" krb5-dev" +__AlpinePackages+=" openssl-dev" +__AlpinePackages+=" zlib-dev" + +__FreeBSDBase="13.3-RELEASE" +__FreeBSDPkg="1.17.0" +__FreeBSDABI="13" +__FreeBSDPackages="libunwind" +__FreeBSDPackages+=" icu" +__FreeBSDPackages+=" libinotify" +__FreeBSDPackages+=" openssl" +__FreeBSDPackages+=" krb5" +__FreeBSDPackages+=" terminfo-db" + +__IllumosPackages="icu" +__IllumosPackages+=" mit-krb5" +__IllumosPackages+=" openssl" +__IllumosPackages+=" zlib" + +__HaikuPackages="gcc_syslibs" +__HaikuPackages+=" gcc_syslibs_devel" +__HaikuPackages+=" gmp" +__HaikuPackages+=" gmp_devel" +__HaikuPackages+=" icu66" +__HaikuPackages+=" icu66_devel" +__HaikuPackages+=" krb5" +__HaikuPackages+=" krb5_devel" +__HaikuPackages+=" libiconv" +__HaikuPackages+=" libiconv_devel" +__HaikuPackages+=" llvm12_libunwind" +__HaikuPackages+=" llvm12_libunwind_devel" +__HaikuPackages+=" mpfr" +__HaikuPackages+=" mpfr_devel" +__HaikuPackages+=" openssl" +__HaikuPackages+=" openssl_devel" +__HaikuPackages+=" zlib" +__HaikuPackages+=" zlib_devel" + +# ML.NET dependencies +__UbuntuPackages+=" libomp5" +__UbuntuPackages+=" libomp-dev" + +# Taken from https://github.com/alpinelinux/alpine-chroot-install/blob/6d08f12a8a70dd9b9dc7d997c88aa7789cc03c42/alpine-chroot-install#L85-L133 +__AlpineKeys=' +4a6a0840:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1yHJxQgsHQREclQu4Ohe\nqxTxd1tHcNnvnQTu/UrTky8wWvgXT+jpveroeWWnzmsYlDI93eLI2ORakxb3gA2O\nQ0Ry4ws8vhaxLQGC74uQR5+/yYrLuTKydFzuPaS1dK19qJPXB8GMdmFOijnXX4SA\njixuHLe1WW7kZVtjL7nufvpXkWBGjsfrvskdNA/5MfxAeBbqPgaq0QMEfxMAn6/R\nL5kNepi/Vr4S39Xvf2DzWkTLEK8pcnjNkt9/aafhWqFVW7m3HCAII6h/qlQNQKSo\nGuH34Q8GsFG30izUENV9avY7hSLq7nggsvknlNBZtFUcmGoQrtx3FmyYsIC8/R+B\nywIDAQAB +5243ef4b:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvNijDxJ8kloskKQpJdx+\nmTMVFFUGDoDCbulnhZMJoKNkSuZOzBoFC94omYPtxnIcBdWBGnrm6ncbKRlR+6oy\nDO0W7c44uHKCFGFqBhDasdI4RCYP+fcIX/lyMh6MLbOxqS22TwSLhCVjTyJeeH7K\naA7vqk+QSsF4TGbYzQDDpg7+6aAcNzg6InNePaywA6hbT0JXbxnDWsB+2/LLSF2G\nmnhJlJrWB1WGjkz23ONIWk85W4S0XB/ewDefd4Ly/zyIciastA7Zqnh7p3Ody6Q0\nsS2MJzo7p3os1smGjUF158s6m/JbVh4DN6YIsxwl2OjDOz9R0OycfJSDaBVIGZzg\ncQIDAQAB +524d27bb:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr8s1q88XpuJWLCZALdKj\nlN8wg2ePB2T9aIcaxryYE/Jkmtu+ZQ5zKq6BT3y/udt5jAsMrhHTwroOjIsF9DeG\ne8Y3vjz+Hh4L8a7hZDaw8jy3CPag47L7nsZFwQOIo2Cl1SnzUc6/owoyjRU7ab0p\niWG5HK8IfiybRbZxnEbNAfT4R53hyI6z5FhyXGS2Ld8zCoU/R4E1P0CUuXKEN4p0\n64dyeUoOLXEWHjgKiU1mElIQj3k/IF02W89gDj285YgwqA49deLUM7QOd53QLnx+\nxrIrPv3A+eyXMFgexNwCKQU9ZdmWa00MjjHlegSGK8Y2NPnRoXhzqSP9T9i2HiXL\nVQIDAQAB +5261cecb:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwlzMkl7b5PBdfMzGdCT0\ncGloRr5xGgVmsdq5EtJvFkFAiN8Ac9MCFy/vAFmS8/7ZaGOXoCDWbYVLTLOO2qtX\nyHRl+7fJVh2N6qrDDFPmdgCi8NaE+3rITWXGrrQ1spJ0B6HIzTDNEjRKnD4xyg4j\ng01FMcJTU6E+V2JBY45CKN9dWr1JDM/nei/Pf0byBJlMp/mSSfjodykmz4Oe13xB\nCa1WTwgFykKYthoLGYrmo+LKIGpMoeEbY1kuUe04UiDe47l6Oggwnl+8XD1MeRWY\nsWgj8sF4dTcSfCMavK4zHRFFQbGp/YFJ/Ww6U9lA3Vq0wyEI6MCMQnoSMFwrbgZw\nwwIDAQAB +58199dcc:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3v8/ye/V/t5xf4JiXLXa\nhWFRozsnmn3hobON20GdmkrzKzO/eUqPOKTpg2GtvBhK30fu5oY5uN2ORiv2Y2ht\neLiZ9HVz3XP8Fm9frha60B7KNu66FO5P2o3i+E+DWTPqqPcCG6t4Znk2BypILcit\nwiPKTsgbBQR2qo/cO01eLLdt6oOzAaF94NH0656kvRewdo6HG4urbO46tCAizvCR\nCA7KGFMyad8WdKkTjxh8YLDLoOCtoZmXmQAiwfRe9pKXRH/XXGop8SYptLqyVVQ+\ntegOD9wRs2tOlgcLx4F/uMzHN7uoho6okBPiifRX+Pf38Vx+ozXh056tjmdZkCaV\naQIDAQAB +58cbb476:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoSPnuAGKtRIS5fEgYPXD\n8pSGvKAmIv3A08LBViDUe+YwhilSHbYXUEAcSH1KZvOo1WT1x2FNEPBEFEFU1Eyc\n+qGzbA03UFgBNvArurHQ5Z/GngGqE7IarSQFSoqewYRtFSfp+TL9CUNBvM0rT7vz\n2eMu3/wWG+CBmb92lkmyWwC1WSWFKO3x8w+Br2IFWvAZqHRt8oiG5QtYvcZL6jym\nY8T6sgdDlj+Y+wWaLHs9Fc+7vBuyK9C4O1ORdMPW15qVSl4Lc2Wu1QVwRiKnmA+c\nDsH/m7kDNRHM7TjWnuj+nrBOKAHzYquiu5iB3Qmx+0gwnrSVf27Arc3ozUmmJbLj\nzQIDAQAB +58e4f17d:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvBxJN9ErBgdRcPr5g4hV\nqyUSGZEKuvQliq2Z9SRHLh2J43+EdB6A+yzVvLnzcHVpBJ+BZ9RV30EM9guck9sh\nr+bryZcRHyjG2wiIEoduxF2a8KeWeQH7QlpwGhuobo1+gA8L0AGImiA6UP3LOirl\nI0G2+iaKZowME8/tydww4jx5vG132JCOScMjTalRsYZYJcjFbebQQolpqRaGB4iG\nWqhytWQGWuKiB1A22wjmIYf3t96l1Mp+FmM2URPxD1gk/BIBnX7ew+2gWppXOK9j\n1BJpo0/HaX5XoZ/uMqISAAtgHZAqq+g3IUPouxTphgYQRTRYpz2COw3NF43VYQrR\nbQIDAQAB +60ac2099:MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwR4uJVtJOnOFGchnMW5Y\nj5/waBdG1u5BTMlH+iQMcV5+VgWhmpZHJCBz3ocD+0IGk2I68S5TDOHec/GSC0lv\n6R9o6F7h429GmgPgVKQsc8mPTPtbjJMuLLs4xKc+viCplXc0Nc0ZoHmCH4da6fCV\ntdpHQjVe6F9zjdquZ4RjV6R6JTiN9v924dGMAkbW/xXmamtz51FzondKC52Gh8Mo\n/oA0/T0KsCMCi7tb4QNQUYrf+Xcha9uus4ww1kWNZyfXJB87a2kORLiWMfs2IBBJ\nTmZ2Fnk0JnHDb8Oknxd9PvJPT0mvyT8DA+KIAPqNvOjUXP4bnjEHJcoCP9S5HkGC\nIQIDAQAB +6165ee59:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAutQkua2CAig4VFSJ7v54\nALyu/J1WB3oni7qwCZD3veURw7HxpNAj9hR+S5N/pNeZgubQvJWyaPuQDm7PTs1+\ntFGiYNfAsiibX6Rv0wci3M+z2XEVAeR9Vzg6v4qoofDyoTbovn2LztaNEjTkB+oK\ntlvpNhg1zhou0jDVYFniEXvzjckxswHVb8cT0OMTKHALyLPrPOJzVtM9C1ew2Nnc\n3848xLiApMu3NBk0JqfcS3Bo5Y2b1FRVBvdt+2gFoKZix1MnZdAEZ8xQzL/a0YS5\nHd0wj5+EEKHfOd3A75uPa/WQmA+o0cBFfrzm69QDcSJSwGpzWrD1ScH3AK8nWvoj\nv7e9gukK/9yl1b4fQQ00vttwJPSgm9EnfPHLAtgXkRloI27H6/PuLoNvSAMQwuCD\nhQRlyGLPBETKkHeodfLoULjhDi1K2gKJTMhtbnUcAA7nEphkMhPWkBpgFdrH+5z4\nLxy+3ek0cqcI7K68EtrffU8jtUj9LFTUC8dERaIBs7NgQ/LfDbDfGh9g6qVj1hZl\nk9aaIPTm/xsi8v3u+0qaq7KzIBc9s59JOoA8TlpOaYdVgSQhHHLBaahOuAigH+VI\nisbC9vmqsThF2QdDtQt37keuqoda2E6sL7PUvIyVXDRfwX7uMDjlzTxHTymvq2Ck\nhtBqojBnThmjJQFgZXocHG8CAwEAAQ== +61666e3f:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlEyxkHggKCXC2Wf5Mzx4\nnZLFZvU2bgcA3exfNPO/g1YunKfQY+Jg4fr6tJUUTZ3XZUrhmLNWvpvSwDS19ZmC\nIXOu0+V94aNgnhMsk9rr59I8qcbsQGIBoHzuAl8NzZCgdbEXkiY90w1skUw8J57z\nqCsMBydAueMXuWqF5nGtYbi5vHwK42PffpiZ7G5Kjwn8nYMW5IZdL6ZnMEVJUWC9\nI4waeKg0yskczYDmZUEAtrn3laX9677ToCpiKrvmZYjlGl0BaGp3cxggP2xaDbUq\nqfFxWNgvUAb3pXD09JM6Mt6HSIJaFc9vQbrKB9KT515y763j5CC2KUsilszKi3mB\nHYe5PoebdjS7D1Oh+tRqfegU2IImzSwW3iwA7PJvefFuc/kNIijfS/gH/cAqAK6z\nbhdOtE/zc7TtqW2Wn5Y03jIZdtm12CxSxwgtCF1NPyEWyIxAQUX9ACb3M0FAZ61n\nfpPrvwTaIIxxZ01L3IzPLpbc44x/DhJIEU+iDt6IMTrHOphD9MCG4631eIdB0H1b\n6zbNX1CXTsafqHRFV9XmYYIeOMggmd90s3xIbEujA6HKNP/gwzO6CDJ+nHFDEqoF\nSkxRdTkEqjTjVKieURW7Swv7zpfu5PrsrrkyGnsRrBJJzXlm2FOOxnbI2iSL1B5F\nrO5kbUxFeZUIDq+7Yv4kLWcCAwEAAQ== +616a9724:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnC+bR4bHf/L6QdU4puhQ\ngl1MHePszRC38bzvVFDUJsmCaMCL2suCs2A2yxAgGb9pu9AJYLAmxQC4mM3jNqhg\n/E7yuaBbek3O02zN/ctvflJ250wZCy+z0ZGIp1ak6pu1j14IwHokl9j36zNfGtfv\nADVOcdpWITFFlPqwq1qt/H3UsKVmtiF3BNWWTeUEQwKvlU8ymxgS99yn0+4OPyNT\nL3EUeS+NQJtDS01unau0t7LnjUXn+XIneWny8bIYOQCuVR6s/gpIGuhBaUqwaJOw\n7jkJZYF2Ij7uPb4b5/R3vX2FfxxqEHqssFSg8FFUNTZz3qNZs0CRVyfA972g9WkJ\nhPfn31pQYil4QGRibCMIeU27YAEjXoqfJKEPh4UWMQsQLrEfdGfb8VgwrPbniGfU\nL3jKJR3VAafL9330iawzVQDlIlwGl6u77gEXMl9K0pfazunYhAp+BMP+9ot5ckK+\nosmrqj11qMESsAj083GeFdfV3pXEIwUytaB0AKEht9DbqUfiE/oeZ/LAXgySMtVC\nsbC4ESmgVeY2xSBIJdDyUap7FR49GGrw0W49NUv9gRgQtGGaNVQQO9oGL2PBC41P\niWF9GLoX30HIz1P8PF/cZvicSSPkQf2Z6TV+t0ebdGNS5DjapdnCrq8m9Z0pyKsQ\nuxAL2a7zX8l5i1CZh1ycUGsCAwEAAQ== +616abc23:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0MfCDrhODRCIxR9Dep1s\neXafh5CE5BrF4WbCgCsevyPIdvTeyIaW4vmO3bbG4VzhogDZju+R3IQYFuhoXP5v\nY+zYJGnwrgz3r5wYAvPnLEs1+dtDKYOgJXQj+wLJBW1mzRDL8FoRXOe5iRmn1EFS\nwZ1DoUvyu7/J5r0itKicZp3QKED6YoilXed+1vnS4Sk0mzN4smuMR9eO1mMCqNp9\n9KTfRDHTbakIHwasECCXCp50uXdoW6ig/xUAFanpm9LtK6jctNDbXDhQmgvAaLXZ\nLvFqoaYJ/CvWkyYCgL6qxvMvVmPoRv7OPcyni4xR/WgWa0MSaEWjgPx3+yj9fiMA\n1S02pFWFDOr5OUF/O4YhFJvUCOtVsUPPfA/Lj6faL0h5QI9mQhy5Zb9TTaS9jB6p\nLw7u0dJlrjFedk8KTJdFCcaGYHP6kNPnOxMylcB/5WcztXZVQD5WpCicGNBxCGMm\nW64SgrV7M07gQfL/32QLsdqPUf0i8hoVD8wfQ3EpbQzv6Fk1Cn90bZqZafg8XWGY\nwddhkXk7egrr23Djv37V2okjzdqoyLBYBxMz63qQzFoAVv5VoY2NDTbXYUYytOvG\nGJ1afYDRVWrExCech1mX5ZVUB1br6WM+psFLJFoBFl6mDmiYt0vMYBddKISsvwLl\nIJQkzDwtXzT2cSjoj3T5QekCAwEAAQ== +616ac3bc:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvaaoSLab+IluixwKV5Od\n0gib2YurjPatGIbn5Ov2DLUFYiebj2oJINXJSwUOO+4WcuHFEqiL/1rya+k5hLZt\nhnPL1tn6QD4rESznvGSasRCQNT2vS/oyZbTYJRyAtFkEYLlq0t3S3xBxxHWuvIf0\nqVxVNYpQWyM3N9RIeYBR/euXKJXileSHk/uq1I5wTC0XBIHWcthczGN0m9wBEiWS\n0m3cnPk4q0Ea8mUJ91Rqob19qETz6VbSPYYpZk3qOycjKosuwcuzoMpwU8KRiMFd\n5LHtX0Hx85ghGsWDVtS0c0+aJa4lOMGvJCAOvDfqvODv7gKlCXUpgumGpLdTmaZ8\n1RwqspAe3IqBcdKTqRD4m2mSg23nVx2FAY3cjFvZQtfooT7q1ItRV5RgH6FhQSl7\n+6YIMJ1Bf8AAlLdRLpg+doOUGcEn+pkDiHFgI8ylH1LKyFKw+eXaAml/7DaWZk1d\ndqggwhXOhc/UUZFQuQQ8A8zpA13PcbC05XxN2hyP93tCEtyynMLVPtrRwDnHxFKa\nqKzs3rMDXPSXRn3ZZTdKH3069ApkEjQdpcwUh+EmJ1Ve/5cdtzT6kKWCjKBFZP/s\n91MlRrX2BTRdHaU5QJkUheUtakwxuHrdah2F94lRmsnQlpPr2YseJu6sIE+Dnx4M\nCfhdVbQL2w54R645nlnohu8CAwEAAQ== +616adfeb:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq0BFD1D4lIxQcsqEpQzU\npNCYM3aP1V/fxxVdT4DWvSI53JHTwHQamKdMWtEXetWVbP5zSROniYKFXd/xrD9X\n0jiGHey3lEtylXRIPxe5s+wXoCmNLcJVnvTcDtwx/ne2NLHxp76lyc25At+6RgE6\nADjLVuoD7M4IFDkAsd8UQ8zM0Dww9SylIk/wgV3ZkifecvgUQRagrNUdUjR56EBZ\nraQrev4hhzOgwelT0kXCu3snbUuNY/lU53CoTzfBJ5UfEJ5pMw1ij6X0r5S9IVsy\nKLWH1hiO0NzU2c8ViUYCly4Fe9xMTFc6u2dy/dxf6FwERfGzETQxqZvSfrRX+GLj\n/QZAXiPg5178hT/m0Y3z5IGenIC/80Z9NCi+byF1WuJlzKjDcF/TU72zk0+PNM/H\nKuppf3JT4DyjiVzNC5YoWJT2QRMS9KLP5iKCSThwVceEEg5HfhQBRT9M6KIcFLSs\nmFjx9kNEEmc1E8hl5IR3+3Ry8G5/bTIIruz14jgeY9u5jhL8Vyyvo41jgt9sLHR1\n/J1TxKfkgksYev7PoX6/ZzJ1ksWKZY5NFoDXTNYUgzFUTOoEaOg3BAQKadb3Qbbq\nXIrxmPBdgrn9QI7NCgfnAY3Tb4EEjs3ON/BNyEhUENcXOH6I1NbcuBQ7g9P73kE4\nVORdoc8MdJ5eoKBpO8Ww8HECAwEAAQ== +616ae350:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyduVzi1mWm+lYo2Tqt/0\nXkCIWrDNP1QBMVPrE0/ZlU2bCGSoo2Z9FHQKz/mTyMRlhNqTfhJ5qU3U9XlyGOPJ\npiM+b91g26pnpXJ2Q2kOypSgOMOPA4cQ42PkHBEqhuzssfj9t7x47ppS94bboh46\nxLSDRff/NAbtwTpvhStV3URYkxFG++cKGGa5MPXBrxIp+iZf9GnuxVdST5PGiVGP\nODL/b69sPJQNbJHVquqUTOh5Ry8uuD2WZuXfKf7/C0jC/ie9m2+0CttNu9tMciGM\nEyKG1/Xhk5iIWO43m4SrrT2WkFlcZ1z2JSf9Pjm4C2+HovYpihwwdM/OdP8Xmsnr\nDzVB4YvQiW+IHBjStHVuyiZWc+JsgEPJzisNY0Wyc/kNyNtqVKpX6dRhMLanLmy+\nf53cCSI05KPQAcGj6tdL+D60uKDkt+FsDa0BTAobZ31OsFVid0vCXtsbplNhW1IF\nHwsGXBTVcfXg44RLyL8Lk/2dQxDHNHzAUslJXzPxaHBLmt++2COa2EI1iWlvtznk\nOk9WP8SOAIj+xdqoiHcC4j72BOVVgiITIJNHrbppZCq6qPR+fgXmXa+sDcGh30m6\n9Wpbr28kLMSHiENCWTdsFij+NQTd5S47H7XTROHnalYDuF1RpS+DpQidT5tUimaT\nJZDr++FjKrnnijbyNF8b98UCAwEAAQ== +616db30d:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnpUpyWDWjlUk3smlWeA0\nlIMW+oJ38t92CRLHH3IqRhyECBRW0d0aRGtq7TY8PmxjjvBZrxTNDpJT6KUk4LRm\na6A6IuAI7QnNK8SJqM0DLzlpygd7GJf8ZL9SoHSH+gFsYF67Cpooz/YDqWrlN7Vw\ntO00s0B+eXy+PCXYU7VSfuWFGK8TGEv6HfGMALLjhqMManyvfp8hz3ubN1rK3c8C\nUS/ilRh1qckdbtPvoDPhSbTDmfU1g/EfRSIEXBrIMLg9ka/XB9PvWRrekrppnQzP\nhP9YE3x/wbFc5QqQWiRCYyQl/rgIMOXvIxhkfe8H5n1Et4VAorkpEAXdsfN8KSVv\nLSMazVlLp9GYq5SUpqYX3KnxdWBgN7BJoZ4sltsTpHQ/34SXWfu3UmyUveWj7wp0\nx9hwsPirVI00EEea9AbP7NM2rAyu6ukcm4m6ATd2DZJIViq2es6m60AE6SMCmrQF\nwmk4H/kdQgeAELVfGOm2VyJ3z69fQuywz7xu27S6zTKi05Qlnohxol4wVb6OB7qG\nLPRtK9ObgzRo/OPumyXqlzAi/Yvyd1ZQk8labZps3e16bQp8+pVPiumWioMFJDWV\nGZjCmyMSU8V6MB6njbgLHoyg2LCukCAeSjbPGGGYhnKLm1AKSoJh3IpZuqcKCk5C\n8CM1S15HxV78s9dFntEqIokCAwEAAQ== +' +__Keyring= +__KeyringFile="/usr/share/keyrings/ubuntu-archive-keyring.gpg" +__SkipSigCheck=0 +__UseMirror=0 + +__UnprocessedBuildArgs= +while :; do + if [[ "$#" -le 0 ]]; then + break + fi + + lowerI="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case $lowerI in + -\?|-h|--help) + usage + ;; + arm) + __BuildArch=arm + __UbuntuArch=armhf + __AlpineArch=armv7 + __QEMUArch=arm + ;; + arm64) + __BuildArch=arm64 + __UbuntuArch=arm64 + __AlpineArch=aarch64 + __QEMUArch=aarch64 + __FreeBSDArch=arm64 + __FreeBSDMachineArch=aarch64 + ;; + armel) + __BuildArch=armel + __UbuntuArch=armel + __UbuntuRepo="http://ftp.debian.org/debian/" + __CodeName=jessie + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + ;; + armv6) + __BuildArch=armv6 + __UbuntuArch=armhf + __QEMUArch=arm + __UbuntuRepo="http://raspbian.raspberrypi.org/raspbian/" + __CodeName=buster + __KeyringFile="/usr/share/keyrings/raspbian-archive-keyring.gpg" + __LLDB_Package="liblldb-6.0-dev" + __UbuntuSuites= + + if [[ -e "$__KeyringFile" ]]; then + __Keyring="--keyring $__KeyringFile" + fi + ;; + riscv64) + __BuildArch=riscv64 + __AlpineArch=riscv64 + __AlpinePackages="${__AlpinePackages// lldb-dev/}" + __QEMUArch=riscv64 + __UbuntuArch=riscv64 + __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" + unset __LLDB_Package + ;; + ppc64le) + __BuildArch=ppc64le + __AlpineArch=ppc64le + __QEMUArch=ppc64le + __UbuntuArch=ppc64el + __UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/" + __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp5/}" + unset __LLDB_Package + ;; + s390x) + __BuildArch=s390x + __AlpineArch=s390x + __QEMUArch=s390x + __UbuntuArch=s390x + __UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/" + __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp-dev/}" + __UbuntuPackages="${__UbuntuPackages// libomp5/}" + unset __LLDB_Package + ;; + x64) + __BuildArch=x64 + __AlpineArch=x86_64 + __UbuntuArch=amd64 + __FreeBSDArch=amd64 + __FreeBSDMachineArch=amd64 + __illumosArch=x86_64 + __HaikuArch=x86_64 + __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" + ;; + x86) + __BuildArch=x86 + __UbuntuArch=i386 + __AlpineArch=x86 + __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" + ;; + lldb*) + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + majorVersion="${version%%.*}" + + [ -z "${version##*.*}" ] && minorVersion="${version#*.}" + if [ -z "$minorVersion" ]; then + minorVersion=0 + fi + + # for versions > 6.0, lldb has dropped the minor version + if [ "$majorVersion" -le 6 ]; then + version="$majorVersion.$minorVersion" + else + version="$majorVersion" + fi + + __LLDB_Package="liblldb-${version}-dev" + ;; + no-lldb) + unset __LLDB_Package + ;; + llvm*) + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + __LLVM_MajorVersion="${version%%.*}" + + [ -z "${version##*.*}" ] && __LLVM_MinorVersion="${version#*.}" + if [ -z "$__LLVM_MinorVersion" ]; then + __LLVM_MinorVersion=0 + fi + + # for versions > 6.0, lldb has dropped the minor version + if [ "$__LLVM_MajorVersion" -gt 6 ]; then + __LLVM_MinorVersion= + fi + + ;; + xenial) # Ubuntu 16.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=xenial + fi + ;; + zesty) # Ubuntu 17.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=zesty + fi + ;; + bionic) # Ubuntu 18.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=bionic + fi + ;; + focal) # Ubuntu 20.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=focal + fi + ;; + jammy) # Ubuntu 22.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=jammy + fi + ;; + noble) # Ubuntu 24.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=noble + fi + if [[ -n "$__LLDB_Package" ]]; then + __LLDB_Package="liblldb-18-dev" + fi + ;; + jessie) # Debian 8 + __CodeName=jessie + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + stretch) # Debian 9 + __CodeName=stretch + __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + buster) # Debian 10 + __CodeName=buster + __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + bullseye) # Debian 11 + __CodeName=bullseye + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + bookworm) # Debian 12 + __CodeName=bookworm + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + sid) # Debian sid + __CodeName=sid + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + tizen) + __CodeName= + __UbuntuRepo= + __Tizen=tizen + ;; + alpine*) + __CodeName=alpine + __UbuntuRepo= + + if [[ "$lowerI" == "alpineedge" ]]; then + __AlpineVersion=edge + else + version="$(echo "$lowerI" | tr -d '[:alpha:]-=')" + __AlpineMajorVersion="${version%%.*}" + __AlpineMinorVersion="${version#*.}" + __AlpineVersion="$__AlpineMajorVersion.$__AlpineMinorVersion" + fi + ;; + freebsd13) + __CodeName=freebsd + __SkipUnmount=1 + ;; + freebsd14) + __CodeName=freebsd + __FreeBSDBase="14.0-RELEASE" + __FreeBSDABI="14" + __SkipUnmount=1 + ;; + illumos) + __CodeName=illumos + __SkipUnmount=1 + ;; + haiku) + __CodeName=haiku + __SkipUnmount=1 + ;; + --skipunmount) + __SkipUnmount=1 + ;; + --skipsigcheck) + __SkipSigCheck=1 + ;; + --rootfsdir|-rootfsdir) + shift + __RootfsDir="$1" + ;; + --use-mirror) + __UseMirror=1 + ;; + --use-jobs) + shift + MAXJOBS=$1 + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" + ;; + esac + + shift +done + +case "$__AlpineVersion" in + 3.14) __AlpinePackages+=" llvm11-libs" ;; + 3.15) __AlpinePackages+=" llvm12-libs" ;; + 3.16) __AlpinePackages+=" llvm13-libs" ;; + 3.17) __AlpinePackages+=" llvm15-libs" ;; + edge) __AlpineLlvmLibsLookup=1 ;; + *) + if [[ "$__AlpineArch" =~ s390x|ppc64le ]]; then + __AlpineVersion=3.15 # minimum version that supports lldb-dev + __AlpinePackages+=" llvm12-libs" + elif [[ "$__AlpineArch" == "x86" ]]; then + __AlpineVersion=3.17 # minimum version that supports lldb-dev + __AlpinePackages+=" llvm15-libs" + elif [[ "$__AlpineArch" == "riscv64" ]]; then + __AlpineLlvmLibsLookup=1 + __AlpineVersion=edge # minimum version with APKINDEX.tar.gz (packages archive) + else + __AlpineVersion=3.13 # 3.13 to maximize compatibility + __AlpinePackages+=" llvm10-libs" + + if [[ "$__AlpineArch" == "armv7" ]]; then + __AlpinePackages="${__AlpinePackages//numactl-dev/}" + fi + fi +esac + +if [[ "$__AlpineVersion" =~ 3\.1[345] ]]; then + # compiler-rt--static was merged in compiler-rt package in alpine 3.16 + # for older versions, we need compiler-rt--static, so replace the name + __AlpinePackages="${__AlpinePackages/compiler-rt/compiler-rt-static}" +fi + +if [[ "$__BuildArch" == "armel" ]]; then + __LLDB_Package="lldb-3.5-dev" +fi + +if [[ "$__CodeName" == "xenial" && "$__UbuntuArch" == "armhf" ]]; then + # libnuma-dev is not available on armhf for xenial + __UbuntuPackages="${__UbuntuPackages//libnuma-dev/}" +fi + +__UbuntuPackages+=" ${__LLDB_Package:-}" + +if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ports.ubuntu.com/" +fi + +if [[ -n "$__LLVM_MajorVersion" ]]; then + __UbuntuPackages+=" libclang-common-${__LLVM_MajorVersion}${__LLVM_MinorVersion:+.$__LLVM_MinorVersion}-dev" +fi + +if [[ -z "$__RootfsDir" && -n "$ROOTFS_DIR" ]]; then + __RootfsDir="$ROOTFS_DIR" +fi + +if [[ -z "$__RootfsDir" ]]; then + __RootfsDir="$__CrossDir/../../../.tools/rootfs/$__BuildArch" +fi + +if [[ -d "$__RootfsDir" ]]; then + if [[ "$__SkipUnmount" == "0" ]]; then + umount "$__RootfsDir"/* || true + fi + rm -rf "$__RootfsDir" +fi + +mkdir -p "$__RootfsDir" +__RootfsDir="$( cd "$__RootfsDir" && pwd )" + +__hasWget= +ensureDownloadTool() +{ + if command -v wget &> /dev/null; then + __hasWget=1 + elif command -v curl &> /dev/null; then + __hasWget=0 + else + >&2 echo "ERROR: either wget or curl is required by this script." + exit 1 + fi +} + +if [[ "$__CodeName" == "alpine" ]]; then + __ApkToolsVersion=2.12.11 + __ApkToolsDir="$(mktemp -d)" + __ApkKeysDir="$(mktemp -d)" + arch="$(uname -m)" + + ensureDownloadTool + + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__ApkToolsDir" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v$__ApkToolsVersion/$arch/apk.static" + else + curl -SLO --create-dirs --output-dir "$__ApkToolsDir" "https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v$__ApkToolsVersion/$arch/apk.static" + fi + if [[ "$arch" == "x86_64" ]]; then + __ApkToolsSHA512SUM="53e57b49230da07ef44ee0765b9592580308c407a8d4da7125550957bb72cb59638e04f8892a18b584451c8d841d1c7cb0f0ab680cc323a3015776affaa3be33" + elif [[ "$arch" == "aarch64" ]]; then + __ApkToolsSHA512SUM="9e2b37ecb2b56c05dad23d379be84fd494c14bd730b620d0d576bda760588e1f2f59a7fcb2f2080577e0085f23a0ca8eadd993b4e61c2ab29549fdb71969afd0" + else + echo "WARNING: add missing hash for your host architecture. To find the value, use: 'find /tmp -name apk.static -exec sha512sum {} \;'" + fi + echo "$__ApkToolsSHA512SUM $__ApkToolsDir/apk.static" | sha512sum -c + chmod +x "$__ApkToolsDir/apk.static" + + if [[ -f "/usr/bin/qemu-$__QEMUArch-static" ]]; then + mkdir -p "$__RootfsDir"/usr/bin + cp -v "/usr/bin/qemu-$__QEMUArch-static" "$__RootfsDir/usr/bin" + fi + + if [[ "$__AlpineVersion" == "edge" ]]; then + version=edge + else + version="v$__AlpineVersion" + fi + + for line in $__AlpineKeys; do + id="${line%%:*}" + content="${line#*:}" + + echo -e "-----BEGIN PUBLIC KEY-----\n$content\n-----END PUBLIC KEY-----" > "$__ApkKeysDir/alpine-devel@lists.alpinelinux.org-$id.rsa.pub" + done + + if [[ "$__SkipSigCheck" == "1" ]]; then + __ApkSignatureArg="--allow-untrusted" + else + __ApkSignatureArg="--keys-dir $__ApkKeysDir" + fi + + # initialize DB + # shellcheck disable=SC2086 + "$__ApkToolsDir/apk.static" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ + -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" --initdb add + + if [[ "$__AlpineLlvmLibsLookup" == 1 ]]; then + # shellcheck disable=SC2086 + __AlpinePackages+=" $("$__ApkToolsDir/apk.static" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ + -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \ + search 'llvm*-libs' | grep -E '^llvm' | sort | tail -1 | sed 's/-[^-]*//2g')" + fi + + # install all packages in one go + # shellcheck disable=SC2086 + "$__ApkToolsDir/apk.static" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ + -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ + -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \ + add $__AlpinePackages + + rm -r "$__ApkToolsDir" +elif [[ "$__CodeName" == "freebsd" ]]; then + mkdir -p "$__RootfsDir"/usr/local/etc + JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} + + ensureDownloadTool + + if [[ "$__hasWget" == 1 ]]; then + wget -O- "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + else + curl -SL "https://download.freebsd.org/ftp/releases/${__FreeBSDArch}/${__FreeBSDMachineArch}/${__FreeBSDBase}/base.txz" | tar -C "$__RootfsDir" -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version + fi + echo "ABI = \"FreeBSD:${__FreeBSDABI}:${__FreeBSDMachineArch}\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > "${__RootfsDir}"/usr/local/etc/pkg.conf + echo "FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"${__RootfsDir}/usr/share/keys/pkg\", enabled: yes }" > "${__RootfsDir}"/etc/pkg/FreeBSD.conf + mkdir -p "$__RootfsDir"/tmp + # get and build package manager + if [[ "$__hasWget" == 1 ]]; then + wget -O- "https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz" | tar -C "$__RootfsDir"/tmp -zxf - + else + curl -SL "https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz" | tar -C "$__RootfsDir"/tmp -zxf - + fi + cd "$__RootfsDir/tmp/pkg-${__FreeBSDPkg}" + # needed for install to succeed + mkdir -p "$__RootfsDir"/host/etc + ./autogen.sh && ./configure --prefix="$__RootfsDir"/host && make -j "$JOBS" && make install + rm -rf "$__RootfsDir/tmp/pkg-${__FreeBSDPkg}" + # install packages we need. + INSTALL_AS_USER=$(whoami) "$__RootfsDir"/host/sbin/pkg -r "$__RootfsDir" -C "$__RootfsDir"/usr/local/etc/pkg.conf update + # shellcheck disable=SC2086 + INSTALL_AS_USER=$(whoami) "$__RootfsDir"/host/sbin/pkg -r "$__RootfsDir" -C "$__RootfsDir"/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages +elif [[ "$__CodeName" == "illumos" ]]; then + mkdir "$__RootfsDir/tmp" + pushd "$__RootfsDir/tmp" + JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} + + ensureDownloadTool + + echo "Downloading sysroot." + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C "$__RootfsDir" -xzf - + else + curl -SL https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C "$__RootfsDir" -xzf - + fi + echo "Building binutils. Please wait.." + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - + else + curl -SL https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - + fi + mkdir build-binutils && cd build-binutils + ../binutils-2.42/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" + make -j "$JOBS" && make install && cd .. + echo "Building gcc. Please wait.." + if [[ "$__hasWget" == 1 ]]; then + wget -O- https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - + else + curl -SL https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - + fi + CFLAGS="-fPIC" + CXXFLAGS="-fPIC" + CXXFLAGS_FOR_TARGET="-fPIC" + CFLAGS_FOR_TARGET="-fPIC" + export CFLAGS CXXFLAGS CXXFLAGS_FOR_TARGET CFLAGS_FOR_TARGET + mkdir build-gcc && cd build-gcc + ../gcc-13.3.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ + --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ + --disable-libquadmath-support --disable-shared --enable-tls + make -j "$JOBS" && make install && cd .. + BaseUrl=https://pkgsrc.smartos.org + if [[ "$__UseMirror" == 1 ]]; then + BaseUrl=https://pkgsrc.smartos.skylime.net + fi + BaseUrl="$BaseUrl/packages/SmartOS/2019Q4/${__illumosArch}/All" + echo "Downloading manifest" + if [[ "$__hasWget" == 1 ]]; then + wget "$BaseUrl" + else + curl -SLO "$BaseUrl" + fi + echo "Downloading dependencies." + read -ra array <<<"$__IllumosPackages" + for package in "${array[@]}"; do + echo "Installing '$package'" + # find last occurrence of package in listing and extract its name + package="$(sed -En '/.*href="('"$package"'-[0-9].*).tgz".*/h;$!d;g;s//\1/p' All)" + echo "Resolved name '$package'" + if [[ "$__hasWget" == 1 ]]; then + wget "$BaseUrl"/"$package".tgz + else + curl -SLO "$BaseUrl"/"$package".tgz + fi + ar -x "$package".tgz + tar --skip-old-files -xzf "$package".tmp.tg* -C "$__RootfsDir" 2>/dev/null + done + echo "Cleaning up temporary files." + popd + rm -rf "$__RootfsDir"/{tmp,+*} + mkdir -p "$__RootfsDir"/usr/include/net + mkdir -p "$__RootfsDir"/usr/include/netpacket + if [[ "$__hasWget" == 1 ]]; then + wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h + wget -P "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h + wget -P "$__RootfsDir"/usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h + wget -P "$__RootfsDir"/usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h + else + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h + curl -SLO --create-dirs --output-dir "$__RootfsDir"/usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h + fi +elif [[ "$__CodeName" == "haiku" ]]; then + JOBS=${MAXJOBS:="$(getconf _NPROCESSORS_ONLN)"} + + echo "Building Haiku sysroot for $__HaikuArch" + mkdir -p "$__RootfsDir/tmp" + pushd "$__RootfsDir/tmp" + + mkdir "$__RootfsDir/tmp/download" + + ensureDownloadTool + + echo "Downloading Haiku package tool" + git clone https://github.com/haiku/haiku-toolchains-ubuntu --depth 1 "$__RootfsDir/tmp/script" + if [[ "$__hasWget" == 1 ]]; then + wget -O "$__RootfsDir/tmp/download/hosttools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --hosttools)" + else + curl -SLo "$__RootfsDir/tmp/download/hosttools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --hosttools)" + fi + + unzip -o "$__RootfsDir/tmp/download/hosttools.zip" -d "$__RootfsDir/tmp/bin" + + DepotBaseUrl="https://depot.haiku-os.org/__api/v2/pkg/get-pkg" + HpkgBaseUrl="https://eu.hpkg.haiku-os.org/haiku/master/$__HaikuArch/current" + + # Download Haiku packages + echo "Downloading Haiku packages" + read -ra array <<<"$__HaikuPackages" + for package in "${array[@]}"; do + echo "Downloading $package..." + # API documented here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L60 + # The schema here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L598 + if [[ "$__hasWget" == 1 ]]; then + hpkgDownloadUrl="$(wget -qO- --post-data '{"name":"'"$package"'","repositorySourceCode":"haikuports_'$__HaikuArch'","versionType":"LATEST","naturalLanguageCode":"en"}' \ + --header 'Content-Type:application/json' "$DepotBaseUrl" | jq -r '.result.versions[].hpkgDownloadURL')" + wget -P "$__RootfsDir/tmp/download" "$hpkgDownloadUrl" + else + hpkgDownloadUrl="$(curl -sSL -XPOST --data '{"name":"'"$package"'","repositorySourceCode":"haikuports_'$__HaikuArch'","versionType":"LATEST","naturalLanguageCode":"en"}' \ + --header 'Content-Type:application/json' "$DepotBaseUrl" | jq -r '.result.versions[].hpkgDownloadURL')" + curl -SLO --create-dirs --output-dir "$__RootfsDir/tmp/download" "$hpkgDownloadUrl" + fi + done + for package in haiku haiku_devel; do + echo "Downloading $package..." + if [[ "$__hasWget" == 1 ]]; then + hpkgVersion="$(wget -qO- "$HpkgBaseUrl" | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')" + wget -P "$__RootfsDir/tmp/download" "$HpkgBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg" + else + hpkgVersion="$(curl -sSL "$HpkgBaseUrl" | sed -n 's/^.*version: "\([^"]*\)".*$/\1/p')" + curl -SLO --create-dirs --output-dir "$__RootfsDir/tmp/download" "$HpkgBaseUrl/packages/$package-$hpkgVersion-1-$__HaikuArch.hpkg" + fi + done + + # Set up the sysroot + echo "Setting up sysroot and extracting required packages" + mkdir -p "$__RootfsDir/boot/system" + for file in "$__RootfsDir/tmp/download/"*.hpkg; do + echo "Extracting $file..." + LD_LIBRARY_PATH="$__RootfsDir/tmp/bin" "$__RootfsDir/tmp/bin/package" extract -C "$__RootfsDir/boot/system" "$file" + done + + # Download buildtools + echo "Downloading Haiku buildtools" + if [[ "$__hasWget" == 1 ]]; then + wget -O "$__RootfsDir/tmp/download/buildtools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --buildtools --arch=$__HaikuArch)" + else + curl -SLo "$__RootfsDir/tmp/download/buildtools.zip" "$("$__RootfsDir/tmp/script/fetch.sh" --buildtools --arch=$__HaikuArch)" + fi + unzip -o "$__RootfsDir/tmp/download/buildtools.zip" -d "$__RootfsDir" + + # Cleaning up temporary files + echo "Cleaning up temporary files" + popd + rm -rf "$__RootfsDir/tmp" +elif [[ -n "$__CodeName" ]]; then + + if [[ "$__SkipSigCheck" == "0" ]]; then + __Keyring="$__Keyring --force-check-gpg" + fi + + # shellcheck disable=SC2086 + echo running debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" + debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" + + mkdir -p "$__RootfsDir/etc/apt/sources.list.d/" + cat > "$__RootfsDir/etc/apt/sources.list.d/$__CodeName.sources" <>Start downloading files" +VERBOSE=1 $__CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR $TIZEN_ARCH +echo "<>Start constructing Tizen rootfs" +TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm` +cd $ROOTFS_DIR +for f in $TIZEN_RPM_FILES; do + rpm2cpio $f | cpio -idm --quiet +done +echo "<>Start configuring Tizen rootfs" +ln -sfn asm-${LINK_ARCH} ./usr/include/asm +patch -p1 < $__TIZEN_CROSSDIR/tizen.patch +if [[ "$TIZEN_ARCH" == "riscv64" ]]; then + echo "Fixing broken symlinks in $PWD" + rm ./usr/lib64/libresolv.so + ln -s ../../lib64/libresolv.so.2 ./usr/lib64/libresolv.so + rm ./usr/lib64/libpthread.so + ln -s ../../lib64/libpthread.so.0 ./usr/lib64/libpthread.so + rm ./usr/lib64/libdl.so + ln -s ../../lib64/libdl.so.2 ./usr/lib64/libdl.so + rm ./usr/lib64/libutil.so + ln -s ../../lib64/libutil.so.1 ./usr/lib64/libutil.so + rm ./usr/lib64/libm.so + ln -s ../../lib64/libm.so.6 ./usr/lib64/libm.so + rm ./usr/lib64/librt.so + ln -s ../../lib64/librt.so.1 ./usr/lib64/librt.so + rm ./lib/ld-linux-riscv64-lp64d.so.1 + ln -s ../lib64/ld-linux-riscv64-lp64d.so.1 ./lib/ld-linux-riscv64-lp64d.so.1 +fi +echo "</dev/null; then + VERBOSE=0 +fi + +Log() +{ + if [ $VERBOSE -ge 1 ]; then + echo ${@:2} + fi +} + +Inform() +{ + Log 1 -e "\x1B[0;34m$@\x1B[m" +} + +Debug() +{ + Log 2 -e "\x1B[0;32m$@\x1B[m" +} + +Error() +{ + >&2 Log 0 -e "\x1B[0;31m$@\x1B[m" +} + +Fetch() +{ + URL=$1 + FILE=$2 + PROGRESS=$3 + if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then + CURL_OPT="--progress-bar" + else + CURL_OPT="--silent" + fi + curl $CURL_OPT $URL > $FILE +} + +hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; } +hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; } +hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; } + +TMPDIR=$1 +if [ ! -d $TMPDIR ]; then + TMPDIR=./tizen_tmp + Debug "Create temporary directory : $TMPDIR" + mkdir -p $TMPDIR +fi + +TIZEN_ARCH=$2 + +TIZEN_URL=http://download.tizen.org/snapshots/TIZEN/Tizen +BUILD_XML=build.xml +REPOMD_XML=repomd.xml +PRIMARY_XML=primary.xml +TARGET_URL="http://__not_initialized" + +Xpath_get() +{ + XPATH_RESULT='' + XPATH=$1 + XML_FILE=$2 + RESULT=$(xmllint --xpath $XPATH $XML_FILE) + if [[ -z ${RESULT// } ]]; then + Error "Can not find target from $XML_FILE" + Debug "Xpath = $XPATH" + exit 1 + fi + XPATH_RESULT=$RESULT +} + +fetch_tizen_pkgs_init() +{ + TARGET=$1 + PROFILE=$2 + Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE" + + TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs + if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi + mkdir -p $TMP_PKG_DIR + + PKG_URL=$TIZEN_URL/$PROFILE/latest + + BUILD_XML_URL=$PKG_URL/$BUILD_XML + TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML + TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML + TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML + TMP_PRIMARYGZ=${TMP_PRIMARY}.gz + + Fetch $BUILD_XML_URL $TMP_BUILD + + Debug "fetch $BUILD_XML_URL to $TMP_BUILD" + + TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()" + Xpath_get $TARGET_XPATH $TMP_BUILD + TARGET_PATH=$XPATH_RESULT + TARGET_URL=$PKG_URL/$TARGET_PATH + + REPOMD_URL=$TARGET_URL/repodata/repomd.xml + PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)' + + Fetch $REPOMD_URL $TMP_REPOMD + + Debug "fetch $REPOMD_URL to $TMP_REPOMD" + + Xpath_get $PRIMARY_XPATH $TMP_REPOMD + PRIMARY_XML_PATH=$XPATH_RESULT + PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH + + Fetch $PRIMARY_URL $TMP_PRIMARYGZ + + Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ" + + gunzip $TMP_PRIMARYGZ + + Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY" +} + +fetch_tizen_pkgs() +{ + ARCH=$1 + PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)' + + PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())' + + for pkg in ${@:2} + do + Inform "Fetching... $pkg" + XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + PKG_PATH=$XPATH_RESULT + + XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + CHECKSUM=$XPATH_RESULT + + PKG_URL=$TARGET_URL/$PKG_PATH + PKG_FILE=$(basename $PKG_PATH) + PKG_PATH=$TMPDIR/$PKG_FILE + + Debug "Download $PKG_URL to $PKG_PATH" + Fetch $PKG_URL $PKG_PATH true + + echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null + if [ $? -ne 0 ]; then + Error "Fail to fetch $PKG_URL to $PKG_PATH" + Debug "Checksum = $CHECKSUM" + exit 1 + fi + done +} + +if [ "$TIZEN_ARCH" == "riscv64" ]; then + BASE="Tizen-Base-RISCV" + UNIFIED="Tizen-Unified-RISCV" +else + BASE="Tizen-Base" + UNIFIED="Tizen-Unified" +fi + +Inform "Initialize ${TIZEN_ARCH} base" +fetch_tizen_pkgs_init standard $BASE +Inform "fetch common packages" +fetch_tizen_pkgs ${TIZEN_ARCH} gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils +Inform "fetch coreclr packages" +fetch_tizen_pkgs ${TIZEN_ARCH} libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu +if [ "$TIZEN_ARCH" != "riscv64" ]; then + fetch_tizen_pkgs ${TIZEN_ARCH} lldb lldb-devel +fi +Inform "fetch corefx packages" +fetch_tizen_pkgs ${TIZEN_ARCH} libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel + +Inform "Initialize standard unified" +fetch_tizen_pkgs_init standard $UNIFIED +Inform "fetch corefx packages" +fetch_tizen_pkgs ${TIZEN_ARCH} gssdp gssdp-devel tizen-release + diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake new file mode 100644 index 000000000000..9a4e285a5ae3 --- /dev/null +++ b/eng/common/cross/toolchain.cmake @@ -0,0 +1,408 @@ +set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) + +# reset platform variables (e.g. cmake 3.25 sets LINUX=1) +unset(LINUX) +unset(FREEBSD) +unset(ILLUMOS) +unset(ANDROID) +unset(TIZEN) +unset(HAIKU) + +set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) +if(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) + set(CMAKE_SYSTEM_NAME FreeBSD) + set(FREEBSD 1) +elseif(EXISTS ${CROSS_ROOTFS}/usr/platform/i86pc) + set(CMAKE_SYSTEM_NAME SunOS) + set(ILLUMOS 1) +elseif(EXISTS ${CROSS_ROOTFS}/boot/system/develop/headers/config/HaikuConfig.h) + set(CMAKE_SYSTEM_NAME Haiku) + set(HAIKU 1) +else() + set(CMAKE_SYSTEM_NAME Linux) + set(LINUX 1) +endif() +set(CMAKE_SYSTEM_VERSION 1) + +if(EXISTS ${CROSS_ROOTFS}/etc/tizen-release) + set(TIZEN 1) +elseif(EXISTS ${CROSS_ROOTFS}/android_platform) + set(ANDROID 1) +endif() + +if(TARGET_ARCH_NAME STREQUAL "arm") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf) + set(TOOLCHAIN "armv7-alpine-linux-musleabihf") + elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf) + set(TOOLCHAIN "armv6-alpine-linux-musleabihf") + else() + set(TOOLCHAIN "arm-linux-gnueabihf") + endif() + if(TIZEN) + set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf/9.2.0") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "arm64") + set(CMAKE_SYSTEM_PROCESSOR aarch64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl) + set(TOOLCHAIN "aarch64-alpine-linux-musl") + elseif(LINUX) + set(TOOLCHAIN "aarch64-linux-gnu") + if(TIZEN) + set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu/9.2.0") + endif() + elseif(FREEBSD) + set(triple "aarch64-unknown-freebsd12") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "armel") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + set(TOOLCHAIN "arm-linux-gnueabi") + if(TIZEN) + set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/9.2.0") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "armv6") + set(CMAKE_SYSTEM_PROCESSOR armv6l) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf) + set(TOOLCHAIN "armv6-alpine-linux-musleabihf") + else() + set(TOOLCHAIN "arm-linux-gnueabihf") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "ppc64le") + set(CMAKE_SYSTEM_PROCESSOR ppc64le) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/powerpc64le-alpine-linux-musl) + set(TOOLCHAIN "powerpc64le-alpine-linux-musl") + else() + set(TOOLCHAIN "powerpc64le-linux-gnu") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "riscv64") + set(CMAKE_SYSTEM_PROCESSOR riscv64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl) + set(TOOLCHAIN "riscv64-alpine-linux-musl") + else() + set(TOOLCHAIN "riscv64-linux-gnu") + if(TIZEN) + set(TIZEN_TOOLCHAIN "riscv64-tizen-linux-gnu/13.1.0") + endif() + endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + set(CMAKE_SYSTEM_PROCESSOR s390x) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/s390x-alpine-linux-musl) + set(TOOLCHAIN "s390x-alpine-linux-musl") + else() + set(TOOLCHAIN "s390x-linux-gnu") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x64") + set(CMAKE_SYSTEM_PROCESSOR x86_64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/x86_64-alpine-linux-musl) + set(TOOLCHAIN "x86_64-alpine-linux-musl") + elseif(LINUX) + set(TOOLCHAIN "x86_64-linux-gnu") + if(TIZEN) + set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu/9.2.0") + endif() + elseif(FREEBSD) + set(triple "x86_64-unknown-freebsd12") + elseif(ILLUMOS) + set(TOOLCHAIN "x86_64-illumos") + elseif(HAIKU) + set(TOOLCHAIN "x86_64-unknown-haiku") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + set(CMAKE_SYSTEM_PROCESSOR i686) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) + set(TOOLCHAIN "i586-alpine-linux-musl") + else() + set(TOOLCHAIN "i686-linux-gnu") + endif() + if(TIZEN) + set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu/9.2.0") + endif() +else() + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, ppc64le, riscv64, s390x, x64 and x86 are supported!") +endif() + +if(DEFINED ENV{TOOLCHAIN}) + set(TOOLCHAIN $ENV{TOOLCHAIN}) +endif() + +# Specify include paths +if(TIZEN) + if(TARGET_ARCH_NAME STREQUAL "arm") + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7hl-tizen-linux-gnueabihf) + endif() + if(TARGET_ARCH_NAME STREQUAL "armel") + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi) + endif() + if(TARGET_ARCH_NAME STREQUAL "arm64") + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/aarch64-tizen-linux-gnu) + endif() + if(TARGET_ARCH_NAME STREQUAL "x86") + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/i586-tizen-linux-gnu) + endif() + if(TARGET_ARCH_NAME STREQUAL "x64") + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/x86_64-tizen-linux-gnu) + endif() + if(TARGET_ARCH_NAME STREQUAL "riscv64") + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/riscv64-tizen-linux-gnu) + endif() +endif() + +if(ANDROID) + if(TARGET_ARCH_NAME STREQUAL "arm") + set(ANDROID_ABI armeabi-v7a) + elseif(TARGET_ARCH_NAME STREQUAL "arm64") + set(ANDROID_ABI arm64-v8a) + endif() + + # extract platform number required by the NDK's toolchain + file(READ "${CROSS_ROOTFS}/android_platform" RID_FILE_CONTENTS) + string(REPLACE "RID=" "" ANDROID_RID "${RID_FILE_CONTENTS}") + string(REGEX REPLACE ".*\\.([0-9]+)-.*" "\\1" ANDROID_PLATFORM "${ANDROID_RID}") + + set(ANDROID_TOOLCHAIN clang) + set(FEATURE_EVENT_TRACE 0) # disable event trace as there is no lttng-ust package in termux repository + set(CMAKE_SYSTEM_LIBRARY_PATH "${CROSS_ROOTFS}/usr/lib") + set(CMAKE_SYSTEM_INCLUDE_PATH "${CROSS_ROOTFS}/usr/include") + + # include official NDK toolchain script + include(${CROSS_ROOTFS}/../build/cmake/android.toolchain.cmake) +elseif(FREEBSD) + # we cross-compile by instructing clang + set(CMAKE_C_COMPILER_TARGET ${triple}) + set(CMAKE_CXX_COMPILER_TARGET ${triple}) + set(CMAKE_ASM_COMPILER_TARGET ${triple}) + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld") +elseif(ILLUMOS) + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + + include_directories(SYSTEM ${CROSS_ROOTFS}/include) + + set(TOOLSET_PREFIX ${TOOLCHAIN}-) + function(locate_toolchain_exec exec var) + string(TOUPPER ${exec} EXEC_UPPERCASE) + if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "") + set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE) + return() + endif() + + find_program(EXEC_LOCATION_${exec} + NAMES + "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}" + "${TOOLSET_PREFIX}${exec}") + + if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND") + message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.") + endif() + set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE) + endfunction() + + set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") + + locate_toolchain_exec(gcc CMAKE_C_COMPILER) + locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) + + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") +elseif(HAIKU) + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin") + + set(TOOLSET_PREFIX ${TOOLCHAIN}-) + function(locate_toolchain_exec exec var) + string(TOUPPER ${exec} EXEC_UPPERCASE) + if(NOT "$ENV{CLR_${EXEC_UPPERCASE}}" STREQUAL "") + set(${var} "$ENV{CLR_${EXEC_UPPERCASE}}" PARENT_SCOPE) + return() + endif() + + find_program(EXEC_LOCATION_${exec} + NAMES + "${TOOLSET_PREFIX}${exec}${CLR_CMAKE_COMPILER_FILE_NAME_VERSION}" + "${TOOLSET_PREFIX}${exec}") + + if (EXEC_LOCATION_${exec} STREQUAL "EXEC_LOCATION_${exec}-NOTFOUND") + message(FATAL_ERROR "Unable to find toolchain executable. Name: ${exec}, Prefix: ${TOOLSET_PREFIX}.") + endif() + set(${var} ${EXEC_LOCATION_${exec}} PARENT_SCOPE) + endfunction() + + set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") + + locate_toolchain_exec(gcc CMAKE_C_COMPILER) + locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) + + set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") + set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") + + # let CMake set up the correct search paths + include(Platform/Haiku) +else() + set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + + set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") + set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") + set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr") +endif() + +# Specify link flags + +function(add_toolchain_linker_flag Flag) + set(Config "${ARGV1}") + set(CONFIG_SUFFIX "") + if (NOT Config STREQUAL "") + set(CONFIG_SUFFIX "_${Config}") + endif() + set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) + set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) +endfunction() + +if(LINUX) + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib/${TOOLCHAIN}") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}") +endif() + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + if(TIZEN) + add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + endif() +elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64|riscv64)$") + if(TIZEN) + add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib64") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + add_toolchain_linker_flag("--target=${TOOLCHAIN}") +elseif(TARGET_ARCH_NAME STREQUAL "x86") + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) + add_toolchain_linker_flag("--target=${TOOLCHAIN}") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") + endif() + add_toolchain_linker_flag(-m32) + if(TIZEN) + add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + endif() +elseif(ILLUMOS) + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") + add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/amd64/lib") +elseif(HAIKU) + add_toolchain_linker_flag("-lnetwork") + add_toolchain_linker_flag("-lroot") +endif() + +# Specify compile options + +if((TARGET_ARCH_NAME MATCHES "^(arm|arm64|armel|armv6|ppc64le|riscv64|s390x|x64|x86)$" AND NOT ANDROID AND NOT FREEBSD) OR ILLUMOS OR HAIKU) + set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) +endif() + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + add_compile_options(-mthumb) + if (NOT DEFINED CLR_ARM_FPU_TYPE) + set (CLR_ARM_FPU_TYPE vfpv3) + endif (NOT DEFINED CLR_ARM_FPU_TYPE) + + add_compile_options (-mfpu=${CLR_ARM_FPU_TYPE}) + if (NOT DEFINED CLR_ARM_FPU_CAPABILITY) + set (CLR_ARM_FPU_CAPABILITY 0x7) + endif (NOT DEFINED CLR_ARM_FPU_CAPABILITY) + + add_definitions (-DCLR_ARM_FPU_CAPABILITY=${CLR_ARM_FPU_CAPABILITY}) + + # persist variables across multiple try_compile passes + list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CLR_ARM_FPU_TYPE CLR_ARM_FPU_CAPABILITY) + + if(TARGET_ARCH_NAME STREQUAL "armel") + add_compile_options(-mfloat-abi=softfp) + endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + add_compile_options("--target=${TOOLCHAIN}") +elseif(TARGET_ARCH_NAME STREQUAL "x86") + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl) + add_compile_options(--target=${TOOLCHAIN}) + endif() + add_compile_options(-m32) + add_compile_options(-Wno-error=unused-command-line-argument) +endif() + +if(TIZEN) + if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64|x86)$") + add_compile_options(-Wno-deprecated-declarations) # compile-time option + add_compile_options(-D__extern_always_inline=inline) # compile-time option + endif() +endif() + +# Set LLDB include and library paths for builds that need lldb. +if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + if(TARGET_ARCH_NAME STREQUAL "x86") + set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") + else() # arm/armel case + set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") + endif() + if(LLVM_CROSS_DIR) + set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "") + set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "") + set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "") + else() + if(TARGET_ARCH_NAME STREQUAL "x86") + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "") + set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include") + if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}") + set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}") + else() + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include") + endif() + else() # arm/armel case + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") + endif() + endif() +endif() + +# Set C++ standard library options if specified +set(CLR_CMAKE_CXX_STANDARD_LIBRARY "" CACHE STRING "Standard library flavor to link against. Only supported with the Clang compiler.") +if (CLR_CMAKE_CXX_STANDARD_LIBRARY) + add_compile_options($<$:--stdlib=${CLR_CMAKE_CXX_STANDARD_LIBRARY}>) + add_link_options($<$:--stdlib=${CLR_CMAKE_CXX_STANDARD_LIBRARY}>) +endif() + +option(CLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC "Statically link against the C++ standard library" OFF) +if(CLR_CMAKE_CXX_STANDARD_LIBRARY_STATIC) + add_link_options($<$:-static-libstdc++>) +endif() + +set(CLR_CMAKE_CXX_ABI_LIBRARY "" CACHE STRING "C++ ABI implementation library to link against. Only supported with the Clang compiler.") +if (CLR_CMAKE_CXX_ABI_LIBRARY) + # The user may specify the ABI library with the 'lib' prefix, like 'libstdc++'. Strip the prefix here so the linker finds the right library. + string(REGEX REPLACE "^lib(.+)" "\\1" CLR_CMAKE_CXX_ABI_LIBRARY ${CLR_CMAKE_CXX_ABI_LIBRARY}) + # We need to specify this as a linker-backend option as Clang will filter this option out when linking to libc++. + add_link_options("LINKER:-l${CLR_CMAKE_CXX_ABI_LIBRARY}") +endif() + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/x64/tizen/tizen.patch b/eng/common/cross/x64/tizen/tizen.patch new file mode 100644 index 000000000000..56fbc881095b --- /dev/null +++ b/eng/common/cross/x64/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib64/libc.so b/usr/lib64/libc.so +--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf64-x86-64) +-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-x86-64.so.2 ) ) diff --git a/eng/common/cross/x86/tizen/tizen.patch b/eng/common/cross/x86/tizen/tizen.patch new file mode 100644 index 000000000000..f4fe8838ad66 --- /dev/null +++ b/eng/common/cross/x86/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-i386) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.2 ) ) diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 new file mode 100644 index 000000000000..e33743105635 --- /dev/null +++ b/eng/common/darc-init.ps1 @@ -0,0 +1,47 @@ +param ( + $darcVersion = $null, + $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20', + $verbosity = 'minimal', + $toolpath = $null +) + +. $PSScriptRoot\tools.ps1 + +function InstallDarcCli ($darcVersion, $toolpath) { + $darcCliPackageName = 'microsoft.dotnet.darc' + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list -g + + if ($toolList -like "*$darcCliPackageName*") { + & "$dotnet" tool uninstall $darcCliPackageName -g + } + + # If the user didn't explicitly specify the darc version, + # query the Maestro API for the correct version of darc to install. + if (-not $darcVersion) { + $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content + } + + $arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + + Write-Host "Installing Darc CLI version $darcVersion..." + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + if (-not $toolpath) { + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g + }else { + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" + } +} + +try { + InstallDarcCli $darcVersion $toolpath +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Darc' -Message $_ + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh new file mode 100644 index 000000000000..36dbd45e1ce8 --- /dev/null +++ b/eng/common/darc-init.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +darcVersion='' +versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20' +verbosity='minimal' + +while [[ $# > 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + --darcversion) + darcVersion=$2 + shift + ;; + --versionendpoint) + versionEndpoint=$2 + shift + ;; + --verbosity) + verbosity=$2 + shift + ;; + --toolpath) + toolpath=$2 + shift + ;; + *) + echo "Invalid argument: $1" + usage + exit 1 + ;; + esac + + shift +done + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +if [ -z "$darcVersion" ]; then + darcVersion=$(curl -X GET "$versionEndpoint" -H "accept: text/plain") +fi + +function InstallDarcCli { + local darc_cli_package_name="microsoft.dotnet.darc" + + InitializeDotNetCli true + local dotnet_root=$_InitializeDotNetCli + + if [ -z "$toolpath" ]; then + local tool_list=$($dotnet_root/dotnet tool list -g) + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g) + fi + else + local tool_list=$($dotnet_root/dotnet tool list --tool-path "$toolpath") + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name --tool-path "$toolpath") + fi + fi + + local arcadeServicesSource="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" + + echo "Installing Darc CLI version $darcVersion..." + echo "You may need to restart your command shell if this is the first dotnet tool you have installed." + if [ -z "$toolpath" ]; then + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g) + else + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath") + fi +} + +InstallDarcCli diff --git a/eng/common/dotnet-install.cmd b/eng/common/dotnet-install.cmd new file mode 100644 index 000000000000..b1c2642e76f7 --- /dev/null +++ b/eng/common/dotnet-install.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0dotnet-install.ps1""" %*" \ No newline at end of file diff --git a/eng/common/dotnet-install.ps1 b/eng/common/dotnet-install.ps1 new file mode 100644 index 000000000000..811f0f717f73 --- /dev/null +++ b/eng/common/dotnet-install.ps1 @@ -0,0 +1,28 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $verbosity = 'minimal', + [string] $architecture = '', + [string] $version = 'Latest', + [string] $runtime = 'dotnet', + [string] $RuntimeSourceFeed = '', + [string] $RuntimeSourceFeedKey = '' +) + +. $PSScriptRoot\tools.ps1 + +$dotnetRoot = Join-Path $RepoRoot '.dotnet' + +$installdir = $dotnetRoot +try { + if ($architecture -and $architecture.Trim() -eq 'x86') { + $installdir = Join-Path $installdir 'x86' + } + InstallDotNet $installdir $version $architecture $runtime $true -RuntimeSourceFeed $RuntimeSourceFeed -RuntimeSourceFeedKey $RuntimeSourceFeedKey +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh new file mode 100644 index 000000000000..7b9d97e3bd4d --- /dev/null +++ b/eng/common/dotnet-install.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +version='Latest' +architecture='' +runtime='dotnet' +runtimeSourceFeed='' +runtimeSourceFeedKey='' +while [[ $# > 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + -version|-v) + shift + version="$1" + ;; + -architecture|-a) + shift + architecture="$1" + ;; + -runtime|-r) + shift + runtime="$1" + ;; + -runtimesourcefeed) + shift + runtimeSourceFeed="$1" + ;; + -runtimesourcefeedkey) + shift + runtimeSourceFeedKey="$1" + ;; + *) + Write-PipelineTelemetryError -Category 'Build' -Message "Invalid argument: $1" + exit 1 + ;; + esac + shift +done + +# Use uname to determine what the CPU is, see https://en.wikipedia.org/wiki/Uname#Examples +cpuname=$(uname -m) +case $cpuname in + arm64|aarch64) + buildarch=arm64 + if [ "$(getconf LONG_BIT)" -lt 64 ]; then + # This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS) + buildarch=arm + fi + ;; + loongarch64) + buildarch=loongarch64 + ;; + amd64|x86_64) + buildarch=x64 + ;; + armv*l) + buildarch=arm + ;; + i[3-6]86) + buildarch=x86 + ;; + riscv64) + buildarch=riscv64 + ;; + *) + echo "Unknown CPU $cpuname detected, treating it as x64" + buildarch=x64 + ;; +esac + +dotnetRoot="${repo_root}.dotnet" +if [[ $architecture != "" ]] && [[ $architecture != $buildarch ]]; then + dotnetRoot="$dotnetRoot/$architecture" +fi + +InstallDotNet "$dotnetRoot" $version "$architecture" $runtime true $runtimeSourceFeed $runtimeSourceFeedKey || { + local exit_code=$? + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "dotnet-install.sh failed (exit code '$exit_code')." >&2 + ExitWithExitCode $exit_code +} + +ExitWithExitCode 0 diff --git a/eng/common/enable-cross-org-publishing.ps1 b/eng/common/enable-cross-org-publishing.ps1 new file mode 100644 index 000000000000..da09da4f1fc4 --- /dev/null +++ b/eng/common/enable-cross-org-publishing.ps1 @@ -0,0 +1,13 @@ +param( + [string] $token +) + + +. $PSScriptRoot\pipeline-logging-functions.ps1 + +# Write-PipelineSetVariable will no-op if a variable named $ci is not defined +# Since this script is only ever called in AzDO builds, just universally set it +$ci = $true + +Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' -IsMultiJobVariable $false diff --git a/eng/common/generate-locproject.ps1 b/eng/common/generate-locproject.ps1 new file mode 100644 index 000000000000..524aaa57f2b7 --- /dev/null +++ b/eng/common/generate-locproject.ps1 @@ -0,0 +1,189 @@ +Param( + [Parameter(Mandatory=$true)][string] $SourcesDirectory, # Directory where source files live; if using a Localize directory it should live in here + [string] $LanguageSet = 'VS_Main_Languages', # Language set to be used in the LocProject.json + [switch] $UseCheckedInLocProjectJson, # When set, generates a LocProject.json and compares it to one that already exists in the repo; otherwise just generates one + [switch] $CreateNeutralXlfs # Creates neutral xlf files. Only set to false when running locally +) + +# Generates LocProject.json files for the OneLocBuild task. OneLocBuildTask is described here: +# https://ceapex.visualstudio.com/CEINTL/_wiki/wikis/CEINTL.wiki/107/Localization-with-OneLocBuild-Task + +Set-StrictMode -Version 2.0 +$ErrorActionPreference = "Stop" +. $PSScriptRoot\pipeline-logging-functions.ps1 + +$exclusionsFilePath = "$SourcesDirectory\eng\Localize\LocExclusions.json" +$exclusions = @{ Exclusions = @() } +if (Test-Path -Path $exclusionsFilePath) +{ + $exclusions = Get-Content "$exclusionsFilePath" | ConvertFrom-Json +} + +Push-Location "$SourcesDirectory" # push location for Resolve-Path -Relative to work + +# Template files +$jsonFiles = @() +$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern +$jsonTemplateFiles | ForEach-Object { + $null = $_.Name -Match "(.+)\.[\w-]+\.json" # matches '[filename].[langcode].json + + $destinationFile = "$($_.Directory.FullName)\$($Matches.1).json" + $jsonFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru +} + +$jsonWinformsTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern + +$wxlFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\.+\.wxl" -And -Not( $_.Directory.Name -Match "\d{4}" ) } # localized files live in four digit lang ID directories; this excludes them +if (-not $wxlFiles) { + $wxlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\1033\\.+\.wxl" } # pick up en files (1033 = en) specifically so we can copy them to use as the neutral xlf files + if ($wxlEnFiles) { + $wxlFiles = @() + $wxlEnFiles | ForEach-Object { + $destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)" + $wxlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru + } + } +} + +$macosHtmlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\.lproj\\.+\.html$" } # add installer HTML files +$macosHtmlFiles = @() +if ($macosHtmlEnFiles) { + $macosHtmlEnFiles | ForEach-Object { + $destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)" + $macosHtmlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru + } +} + +$xlfFiles = @() + +$allXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.xlf" +$langXlfFiles = @() +if ($allXlfFiles) { + $null = $allXlfFiles[0].FullName -Match "\.([\w-]+)\.xlf" # matches '[langcode].xlf' + $firstLangCode = $Matches.1 + $langXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.$firstLangCode.xlf" +} +$langXlfFiles | ForEach-Object { + $null = $_.Name -Match "(.+)\.[\w-]+\.xlf" # matches '[filename].[langcode].xlf + + $destinationFile = "$($_.Directory.FullName)\$($Matches.1).xlf" + $xlfFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru +} + +$locFiles = $jsonFiles + $jsonWinformsTemplateFiles + $xlfFiles + +$locJson = @{ + Projects = @( + @{ + LanguageSet = $LanguageSet + LocItems = @( + $locFiles | ForEach-Object { + $outputPath = "$(($_.DirectoryName | Resolve-Path -Relative) + "\")" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) + { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + if (!$CreateNeutralXlfs -and $_.Extension -eq '.xlf') { + Remove-Item -Path $sourceFile + } + if ($continue) + { + if ($_.Directory.Name -eq 'en' -and $_.Extension -eq '.json') { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = "$($_.Directory.Parent.FullName | Resolve-Path -Relative)\" + } + } else { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnName" + OutputPath = $outputPath + } + } + } + } + ) + }, + @{ + LanguageSet = $LanguageSet + CloneLanguageSet = "WiX_CloneLanguages" + LssFiles = @( "wxl_loc.lss" ) + LocItems = @( + $wxlFiles | ForEach-Object { + $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + if ($continue) + { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = $outputPath + } + } + } + ) + }, + @{ + LanguageSet = $LanguageSet + CloneLanguageSet = "VS_macOS_CloneLanguages" + LssFiles = @( ".\eng\common\loc\P22DotNetHtmlLocalization.lss" ) + LocItems = @( + $macosHtmlFiles | ForEach-Object { + $outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($_.FullName.Contains($exclusion)) { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + $lciFile = $sourceFile + ".lci" + if ($continue) { + $result = @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = $outputPath + } + if (Test-Path $lciFile -PathType Leaf) { + $result["LciFile"] = $lciFile + } + return $result + } + } + ) + } + ) +} + +$json = ConvertTo-Json $locJson -Depth 5 +Write-Host "LocProject.json generated:`n`n$json`n`n" +Pop-Location + +if (!$UseCheckedInLocProjectJson) { + New-Item "$SourcesDirectory\eng\Localize\LocProject.json" -Force # Need this to make sure the Localize directory is created + Set-Content "$SourcesDirectory\eng\Localize\LocProject.json" $json +} +else { + New-Item "$SourcesDirectory\eng\Localize\LocProject-generated.json" -Force # Need this to make sure the Localize directory is created + Set-Content "$SourcesDirectory\eng\Localize\LocProject-generated.json" $json + + if ((Get-FileHash "$SourcesDirectory\eng\Localize\LocProject-generated.json").Hash -ne (Get-FileHash "$SourcesDirectory\eng\Localize\LocProject.json").Hash) { + Write-PipelineTelemetryError -Category "OneLocBuild" -Message "Existing LocProject.json differs from generated LocProject.json. Download LocProject-generated.json and compare them." + + exit 1 + } + else { + Write-Host "Generated LocProject.json and current LocProject.json are identical." + } +} diff --git a/eng/common/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 new file mode 100644 index 000000000000..3e5c1c74a1c5 --- /dev/null +++ b/eng/common/generate-sbom-prep.ps1 @@ -0,0 +1,21 @@ +Param( + [Parameter(Mandatory=$true)][string] $ManifestDirPath # Manifest directory where sbom will be placed +) + +. $PSScriptRoot\pipeline-logging-functions.ps1 + +Write-Host "Creating dir $ManifestDirPath" +# create directory for sbom manifest to be placed +if (!(Test-Path -path $ManifestDirPath)) +{ + New-Item -ItemType Directory -path $ManifestDirPath + Write-Host "Successfully created directory $ManifestDirPath" +} +else{ + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +} + +Write-Host "Updating artifact name" +$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_' +Write-Host "Artifact name $artifact_name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh new file mode 100644 index 000000000000..d5c76dc827b4 --- /dev/null +++ b/eng/common/generate-sbom-prep.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +. $scriptroot/pipeline-logging-functions.sh + +manifest_dir=$1 + +if [ ! -d "$manifest_dir" ] ; then + mkdir -p "$manifest_dir" + echo "Sbom directory created." $manifest_dir +else + Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." +fi + +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +echo "Artifact name before : "$artifact_name +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" +echo "Artifact name after : "$safe_artifact_name +export ARTIFACT_NAME=$safe_artifact_name +echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" + +exit 0 diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj new file mode 100644 index 000000000000..c1323bf41210 --- /dev/null +++ b/eng/common/helixpublish.proj @@ -0,0 +1,27 @@ + + + + + msbuild + + + + + %(Identity) + + + + + + $(WorkItemDirectory) + $(WorkItemCommand) + $(WorkItemTimeout) + + + + + + + + + diff --git a/eng/common/init-tools-native.cmd b/eng/common/init-tools-native.cmd new file mode 100644 index 000000000000..438cd548c452 --- /dev/null +++ b/eng/common/init-tools-native.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" +exit /b %ErrorLevel% \ No newline at end of file diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 new file mode 100644 index 000000000000..27ccdb9ecc95 --- /dev/null +++ b/eng/common/init-tools-native.ps1 @@ -0,0 +1,203 @@ +<# +.SYNOPSIS +Entry point script for installing native tools + +.DESCRIPTION +Reads $RepoRoot\global.json file to determine native assets to install +and executes installers for those tools + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER InstallDirectory +Directory to install native toolset. This is a command-line override for the default +Install directory precedence order: +- InstallDirectory command-line override +- NETCOREENG_INSTALL_DIRECTORY environment variable +- (default) %USERPROFILE%/.netcoreeng/native + +.PARAMETER Clean +Switch specifying to not install anything, but cleanup native asset folders + +.PARAMETER Force +Clean and then install tools + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.PARAMETER GlobalJsonFile +File path to global.json file + +.PARAMETER PathPromotion +Optional switch to enable either promote native tools specified in the global.json to the path (in Azure Pipelines) +or break the build if a native tool is not found on the path (on a local dev machine) + +.NOTES +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [string] $BaseUri = 'https://netcorenativeassets.blob.core.windows.net/resource-packages/external', + [string] $InstallDirectory, + [switch] $Clean = $False, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [string] $GlobalJsonFile, + [switch] $PathPromotion +) + +if (!$GlobalJsonFile) { + $GlobalJsonFile = Join-Path (Get-Item $PSScriptRoot).Parent.Parent.FullName 'global.json' +} + +Set-StrictMode -version 2.0 +$ErrorActionPreference='Stop' + +. $PSScriptRoot\pipeline-logging-functions.ps1 +Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1') + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq 'Continue' + + $EngCommonBaseDir = Join-Path $PSScriptRoot 'native\' + $NativeBaseDir = $InstallDirectory + if (!$NativeBaseDir) { + $NativeBaseDir = CommonLibrary\Get-NativeInstallDirectory + } + $Env:CommonLibrary_NativeInstallDir = $NativeBaseDir + $InstallBin = Join-Path $NativeBaseDir 'bin' + $InstallerPath = Join-Path $EngCommonBaseDir 'install-tool.ps1' + + # Process tools list + Write-Host "Processing $GlobalJsonFile" + If (-Not (Test-Path $GlobalJsonFile)) { + Write-Host "Unable to find '$GlobalJsonFile'" + exit 0 + } + $NativeTools = Get-Content($GlobalJsonFile) -Raw | + ConvertFrom-Json | + Select-Object -Expand 'native-tools' -ErrorAction SilentlyContinue + if ($NativeTools) { + if ($PathPromotion -eq $True) { + $ArcadeToolsDirectory = "$env:SYSTEMDRIVE\arcade-tools" + if (Test-Path $ArcadeToolsDirectory) { # if this directory exists, we should use native tools on machine + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $InstalledTools = @{} + + if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) { + if ($ToolVersion -eq "latest") { + $ToolVersion = "" + } + $ToolDirectories = (Get-ChildItem -Path "$ArcadeToolsDirectory" -Filter "$ToolName-$ToolVersion*" | Sort-Object -Descending) + if ($ToolDirectories -eq $null) { + Write-Error "Unable to find directory for $ToolName $ToolVersion; please make sure the tool is installed on this image." + exit 1 + } + $ToolDirectory = $ToolDirectories[0] + $BinPathFile = "$($ToolDirectory.FullName)\binpath.txt" + if (-not (Test-Path -Path "$BinPathFile")) { + Write-Error "Unable to find binpath.txt in '$($ToolDirectory.FullName)' ($ToolName $ToolVersion); artifact is either installed incorrectly or is not a bootstrappable tool." + exit 1 + } + $BinPath = Get-Content "$BinPathFile" + $ToolPath = Convert-Path -Path $BinPath + Write-Host "Adding $ToolName to the path ($ToolPath)..." + Write-Host "##vso[task.prependpath]$ToolPath" + $env:PATH = "$ToolPath;$env:PATH" + $InstalledTools += @{ $ToolName = $ToolDirectory.FullName } + } + } + return $InstalledTools + } else { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + + if ((Get-Command "$ToolName" -ErrorAction SilentlyContinue) -eq $null) { + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "$ToolName not found on path. Please install $ToolName $ToolVersion before proceeding." + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message "If this is running on a build machine, the arcade-tools directory was not found, which means there's an error with the image." + } + } + exit 0 + } + } else { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $LocalInstallerArguments = @{ ToolName = "$ToolName" } + $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } + $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } + $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } + $LocalInstallerArguments += @{ Version = "$ToolVersion" } + + if ($Verbose) { + $LocalInstallerArguments += @{ Verbose = $True } + } + if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { + if($Force) { + $LocalInstallerArguments += @{ Force = $True } + } + } + if ($Clean) { + $LocalInstallerArguments += @{ Clean = $True } + } + + Write-Verbose "Installing $ToolName version $ToolVersion" + Write-Verbose "Executing '$InstallerPath $($LocalInstallerArguments.Keys.ForEach({"-$_ '$($LocalInstallerArguments.$_)'"}) -join ' ')'" + & $InstallerPath @LocalInstallerArguments + if ($LASTEXITCODE -Ne "0") { + $errMsg = "$ToolName installation failed" + if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { + $showNativeToolsWarning = $true + if ((Get-Variable 'DoNotDisplayNativeToolsInstallationWarnings' -ErrorAction 'SilentlyContinue') -and $DoNotDisplayNativeToolsInstallationWarnings) { + $showNativeToolsWarning = $false + } + if ($showNativeToolsWarning) { + Write-Warning $errMsg + } + $toolInstallationFailure = $true + } else { + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host $errMsg + exit 1 + } + } + } + + if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) { + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host 'Native tools bootstrap failed' + exit 1 + } + } + } + else { + Write-Host 'No native tools defined in global.json' + exit 0 + } + + if ($Clean) { + exit 0 + } + if (Test-Path $InstallBin) { + Write-Host 'Native tools are available from ' (Convert-Path -Path $InstallBin) + Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" + return $InstallBin + } + elseif (-not ($PathPromotion)) { + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools install directory does not exist, installation failed' + exit 1 + } + exit 0 +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh new file mode 100644 index 000000000000..3e6a8d6acf2f --- /dev/null +++ b/eng/common/init-tools-native.sh @@ -0,0 +1,238 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +base_uri='https://netcorenativeassets.blob.core.windows.net/resource-packages/external' +install_directory='' +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 +global_json_file="$(dirname "$(dirname "${scriptroot}")")/global.json" +declare -a native_assets + +. $scriptroot/pipeline-logging-functions.sh +. $scriptroot/native/common-library.sh + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installdirectory) + install_directory=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --donotabortonfailure) + donotabortonfailure=true + shift 1 + ;; + --donotdisplaywarnings) + donotdisplaywarnings=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --installdirectory Directory to install native toolset." + echo " This is a command-line override for the default" + echo " Install directory precedence order:" + echo " - InstallDirectory command-line override" + echo " - NETCOREENG_INSTALL_DIRECTORY environment variable" + echo " - (default) %USERPROFILE%/.netcoreeng/native" + echo "" + echo " --clean Switch specifying not to install anything, but cleanup native asset folders" + echo " --donotabortonfailure Switch specifiying whether to abort native tools installation on failure" + echo " --donotdisplaywarnings Switch specifiying whether to display warnings during native tools installation on failure" + echo " --force Clean and then install tools" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --baseuri Base URI for where to download native tools from" + echo " --downloadretries Number of times a download should be attempted" + echo " --retrywaittimeseconds Wait time between download attempts" + echo "" + exit 0 + ;; + esac +done + +function ReadGlobalJsonNativeTools { + # happy path: we have a proper JSON parsing tool `jq(1)` in PATH! + if command -v jq &> /dev/null; then + + # jq: read each key/value pair under "native-tools" entry and emit: + # KEY="" VALUE="" + # followed by a null byte. + # + # bash: read line with null byte delimeter and push to array (for later `eval`uation). + + while IFS= read -rd '' line; do + native_assets+=("$line") + done < <(jq -r '. | + select(has("native-tools")) | + ."native-tools" | + keys[] as $k | + @sh "KEY=\($k) VALUE=\(.[$k])\u0000"' "$global_json_file") + + return + fi + + # Warning: falling back to manually parsing JSON, which is not recommended. + + # Following routine matches the output and escaping logic of jq(1)'s @sh formatter used above. + # It has been tested with several weird strings with escaped characters in entries (key and value) + # and results were compared with the output of jq(1) in binary representation using xxd(1); + # just before the assignment to 'native_assets' array (above and below). + + # try to capture the section under "native-tools". + if [[ ! "$(cat "$global_json_file")" =~ \"native-tools\"[[:space:]\:\{]*([^\}]+) ]]; then + return + fi + + section="${BASH_REMATCH[1]}" + + parseStarted=0 + possibleEnd=0 + escaping=0 + escaped=0 + isKey=1 + + for (( i=0; i<${#section}; i++ )); do + char="${section:$i:1}" + if ! ((parseStarted)) && [[ "$char" =~ [[:space:],:] ]]; then continue; fi + + if ! ((escaping)) && [[ "$char" == "\\" ]]; then + escaping=1 + elif ((escaping)) && ! ((escaped)); then + escaped=1 + fi + + if ! ((parseStarted)) && [[ "$char" == "\"" ]]; then + parseStarted=1 + possibleEnd=0 + elif [[ "$char" == "'" ]]; then + token="$token'\\\''" + possibleEnd=0 + elif ((escaping)) || [[ "$char" != "\"" ]]; then + token="$token$char" + possibleEnd=1 + fi + + if ((possibleEnd)) && ! ((escaping)) && [[ "$char" == "\"" ]]; then + # Use printf to unescape token to match jq(1)'s @sh formatting rules. + # do not use 'token="$(printf "$token")"' syntax, as $() eats the trailing linefeed. + printf -v token "'$token'" + + if ((isKey)); then + KEY="$token" + isKey=0 + else + line="KEY=$KEY VALUE=$token" + native_assets+=("$line") + isKey=1 + fi + + # reset for next token + parseStarted=0 + token= + elif ((escaping)) && ((escaped)); then + escaping=0 + escaped=0 + fi + done +} + +native_base_dir=$install_directory +if [[ -z $install_directory ]]; then + native_base_dir=$(GetNativeInstallDirectory) +fi + +install_bin="${native_base_dir}/bin" +installed_any=false + +ReadGlobalJsonNativeTools + +if [[ ${#native_assets[@]} -eq 0 ]]; then + echo "No native tools defined in global.json" + exit 0; +else + native_installer_dir="$scriptroot/native" + for index in "${!native_assets[@]}"; do + eval "${native_assets["$index"]}" + + installer_path="$native_installer_dir/install-$KEY.sh" + installer_command="$installer_path" + installer_command+=" --baseuri $base_uri" + installer_command+=" --installpath $install_bin" + installer_command+=" --version $VALUE" + echo $installer_command + + if [[ $force = true ]]; then + installer_command+=" --force" + fi + + if [[ $clean = true ]]; then + installer_command+=" --clean" + fi + + if [[ -a $installer_path ]]; then + $installer_command + if [[ $? != 0 ]]; then + if [[ $donotabortonfailure = true ]]; then + if [[ $donotdisplaywarnings != true ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed" + fi + else + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed" + exit 1 + fi + else + $installed_any = true + fi + else + if [[ $donotabortonfailure == true ]]; then + if [[ $donotdisplaywarnings != true ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script" + fi + else + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script" + exit 1 + fi + fi + done +fi + +if [[ $clean = true ]]; then + exit 0 +fi + +if [[ -d $install_bin ]]; then + echo "Native tools are available from $install_bin" + echo "##vso[task.prependpath]$install_bin" +else + if [[ $installed_any = true ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Native tools install directory does not exist, installation failed" + exit 1 + fi +fi + +exit 0 diff --git a/eng/common/internal-feed-operations.ps1 b/eng/common/internal-feed-operations.ps1 new file mode 100644 index 000000000000..92b77347d990 --- /dev/null +++ b/eng/common/internal-feed-operations.ps1 @@ -0,0 +1,132 @@ +param( + [Parameter(Mandatory=$true)][string] $Operation, + [string] $AuthToken, + [string] $CommitSha, + [string] $RepoName, + [switch] $IsFeedPrivate +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +. $PSScriptRoot\tools.ps1 + +# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed +# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in +# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. This should ONLY be called from identified +# internal builds +function SetupCredProvider { + param( + [string] $AuthToken + ) + + # Install the Cred Provider NuGet plugin + Write-Host 'Setting up Cred Provider NuGet plugin in the agent...' + Write-Host "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." + + $url = 'https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1' + + Write-Host "Writing the contents of 'installcredprovider.ps1' locally..." + Invoke-WebRequest $url -OutFile installcredprovider.ps1 + + Write-Host 'Installing plugin...' + .\installcredprovider.ps1 -Force + + Write-Host "Deleting local copy of 'installcredprovider.ps1'..." + Remove-Item .\installcredprovider.ps1 + + if (-Not("$env:USERPROFILE\.nuget\plugins\netcore")) { + Write-PipelineTelemetryError -Category 'Arcade' -Message 'CredProvider plugin was not installed correctly!' + ExitWithExitCode 1 + } + else { + Write-Host 'CredProvider plugin was installed correctly!' + } + + # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable + # feeds successfully + + $nugetConfigPath = Join-Path $RepoRoot "NuGet.config" + + if (-Not (Test-Path -Path $nugetConfigPath)) { + Write-PipelineTelemetryError -Category 'Build' -Message 'NuGet.config file not found in repo root!' + ExitWithExitCode 1 + } + + $endpoints = New-Object System.Collections.ArrayList + $nugetConfigPackageSources = Select-Xml -Path $nugetConfigPath -XPath "//packageSources/add[contains(@key, 'darc-int-')]/@value" | foreach{$_.Node.Value} + + if (($nugetConfigPackageSources | Measure-Object).Count -gt 0 ) { + foreach ($stableRestoreResource in $nugetConfigPackageSources) { + $trimmedResource = ([string]$stableRestoreResource).Trim() + [void]$endpoints.Add(@{endpoint="$trimmedResource"; password="$AuthToken"}) + } + } + + if (($endpoints | Measure-Object).Count -gt 0) { + $endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress + + # Create the environment variables the AzDo way + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $endpointCredentials -Properties @{ + 'variable' = 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' + 'issecret' = 'false' + } + + # We don't want sessions cached since we will be updating the endpoints quite frequently + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data 'False' -Properties @{ + 'variable' = 'NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED' + 'issecret' = 'false' + } + } + else + { + Write-Host 'No internal endpoints found in NuGet.config' + } +} + +#Workaround for https://github.com/microsoft/msbuild/issues/4430 +function InstallDotNetSdkAndRestoreArcade { + $dotnetTempDir = Join-Path $RepoRoot "dotnet" + $dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) + $dotnet = "$dotnetTempDir\dotnet.exe" + $restoreProjPath = "$PSScriptRoot\restore.proj" + + Write-Host "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." + InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" + + '' | Out-File "$restoreProjPath" + + & $dotnet restore $restoreProjPath + + Write-Host 'Arcade SDK restored!' + + if (Test-Path -Path $restoreProjPath) { + Remove-Item $restoreProjPath + } + + if (Test-Path -Path $dotnetTempDir) { + Remove-Item $dotnetTempDir -Recurse + } +} + +try { + Push-Location $PSScriptRoot + + if ($Operation -like 'setup') { + SetupCredProvider $AuthToken + } + elseif ($Operation -like 'install-restore') { + InstallDotNetSdkAndRestoreArcade + } + else { + Write-PipelineTelemetryError -Category 'Arcade' -Message "Unknown operation '$Operation'!" + ExitWithExitCode 1 + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Arcade' -Message $_ + ExitWithExitCode 1 +} +finally { + Pop-Location +} diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh new file mode 100644 index 000000000000..9378223ba095 --- /dev/null +++ b/eng/common/internal-feed-operations.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash + +set -e + +# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed +# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in +# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. +# This should ONLY be called from identified internal builds +function SetupCredProvider { + local authToken=$1 + + # Install the Cred Provider NuGet plugin + echo "Setting up Cred Provider NuGet plugin in the agent..."... + echo "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." + + local url="https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh" + + echo "Writing the contents of 'installcredprovider.ps1' locally..." + local installcredproviderPath="installcredprovider.sh" + if command -v curl > /dev/null; then + curl $url > "$installcredproviderPath" + else + wget -q -O "$installcredproviderPath" "$url" + fi + + echo "Installing plugin..." + . "$installcredproviderPath" + + echo "Deleting local copy of 'installcredprovider.sh'..." + rm installcredprovider.sh + + if [ ! -d "$HOME/.nuget/plugins" ]; then + Write-PipelineTelemetryError -category 'Build' 'CredProvider plugin was not installed correctly!' + ExitWithExitCode 1 + else + echo "CredProvider plugin was installed correctly!" + fi + + # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable + # feeds successfully + + local nugetConfigPath="{$repo_root}NuGet.config" + + if [ ! "$nugetConfigPath" ]; then + Write-PipelineTelemetryError -category 'Build' "NuGet.config file not found in repo's root!" + ExitWithExitCode 1 + fi + + local endpoints='[' + local nugetConfigPackageValues=`cat "$nugetConfigPath" | grep "key=\"darc-int-"` + local pattern="value=\"(.*)\"" + + for value in $nugetConfigPackageValues + do + if [[ $value =~ $pattern ]]; then + local endpoint="${BASH_REMATCH[1]}" + endpoints+="{\"endpoint\": \"$endpoint\", \"password\": \"$authToken\"}," + fi + done + + endpoints=${endpoints%?} + endpoints+=']' + + if [ ${#endpoints} -gt 2 ]; then + local endpointCredentials="{\"endpointCredentials\": "$endpoints"}" + + echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]$endpointCredentials" + echo "##vso[task.setvariable variable=NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED]False" + else + echo "No internal endpoints found in NuGet.config" + fi +} + +# Workaround for https://github.com/microsoft/msbuild/issues/4430 +function InstallDotNetSdkAndRestoreArcade { + local dotnetTempDir="$repo_root/dotnet" + local dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) + local restoreProjPath="$repo_root/eng/common/restore.proj" + + echo "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." + echo "" > "$restoreProjPath" + + InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" + + local res=`$dotnetTempDir/dotnet restore $restoreProjPath` + echo "Arcade SDK restored!" + + # Cleanup + if [ "$restoreProjPath" ]; then + rm "$restoreProjPath" + fi + + if [ "$dotnetTempDir" ]; then + rm -r $dotnetTempDir + fi +} + +source="${BASH_SOURCE[0]}" +operation='' +authToken='' +repoName='' + +while [[ $# > 0 ]]; do + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" + case "$opt" in + --operation) + operation=$2 + shift + ;; + --authtoken) + authToken=$2 + shift + ;; + *) + echo "Invalid argument: $1" + usage + exit 1 + ;; + esac + + shift +done + +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +if [ "$operation" = "setup" ]; then + SetupCredProvider $authToken +elif [ "$operation" = "install-restore" ]; then + InstallDotNetSdkAndRestoreArcade +else + echo "Unknown operation '$operation'!" +fi diff --git a/eng/common/internal/Directory.Build.props b/eng/common/internal/Directory.Build.props new file mode 100644 index 000000000000..f1d041c33da5 --- /dev/null +++ b/eng/common/internal/Directory.Build.props @@ -0,0 +1,11 @@ + + + + + false + false + + + + + diff --git a/eng/common/internal/NuGet.config b/eng/common/internal/NuGet.config new file mode 100644 index 000000000000..19d3d311b166 --- /dev/null +++ b/eng/common/internal/NuGet.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj new file mode 100644 index 000000000000..32f79dfb3402 --- /dev/null +++ b/eng/common/internal/Tools.csproj @@ -0,0 +1,32 @@ + + + + + net472 + false + false + + + + + + + + + + + + + + https://devdiv.pkgs.visualstudio.com/_packaging/dotnet-core-internal-tooling/nuget/v3/index.json; + + + $(RestoreSources); + https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json; + + + + + + + diff --git a/eng/common/loc/P22DotNetHtmlLocalization.lss b/eng/common/loc/P22DotNetHtmlLocalization.lss new file mode 100644 index 000000000000..5d892d619398 --- /dev/null +++ b/eng/common/loc/P22DotNetHtmlLocalization.lss @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 new file mode 100644 index 000000000000..f041e5ddd958 --- /dev/null +++ b/eng/common/msbuild.ps1 @@ -0,0 +1,28 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $verbosity = 'minimal', + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, + [switch] $ci, + [switch] $prepareMachine, + [switch] $excludePrereleaseVS, + [string] $msbuildEngine = $null, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs +) + +. $PSScriptRoot\tools.ps1 + +try { + if ($ci) { + $nodeReuse = $false + } + + MSBuild @extraArgs +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Build' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 \ No newline at end of file diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh new file mode 100644 index 000000000000..20d3dad54352 --- /dev/null +++ b/eng/common/msbuild.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +verbosity='minimal' +warn_as_error=true +node_reuse=true +prepare_machine=false +extra_args='' + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --verbosity) + verbosity=$2 + shift 2 + ;; + --warnaserror) + warn_as_error=$2 + shift 2 + ;; + --nodereuse) + node_reuse=$2 + shift 2 + ;; + --ci) + ci=true + shift 1 + ;; + --preparemachine) + prepare_machine=true + shift 1 + ;; + *) + extra_args="$extra_args $1" + shift 1 + ;; + esac +done + +. "$scriptroot/tools.sh" + +if [[ "$ci" == true ]]; then + node_reuse=false +fi + +MSBuild $extra_args +ExitWithExitCode 0 diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 new file mode 100644 index 000000000000..f71f6af6cdbc --- /dev/null +++ b/eng/common/native/CommonLibrary.psm1 @@ -0,0 +1,401 @@ +<# +.SYNOPSIS +Helper module to install an archive to a directory + +.DESCRIPTION +Helper module to download and extract an archive to a specified directory + +.PARAMETER Uri +Uri of artifact to download + +.PARAMETER InstallDirectory +Directory to extract artifact contents to + +.PARAMETER Force +Force download / extraction if file or contents already exist. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds. Default = 30 + +.NOTES +Returns False if download or extraction fail, True otherwise +#> +function DownloadAndExtract { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $InstallDirectory, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 + ) + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $TempToolPath = CommonLibrary\Get-TempPathFilename -Path $Uri + + # Download native tool + $DownloadStatus = CommonLibrary\Get-File -Uri $Uri ` + -Path $TempToolPath ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Force:$Force ` + -Verbose:$Verbose + + if ($DownloadStatus -Eq $False) { + Write-Error "Download failed from $Uri" + return $False + } + + # Extract native tool + $UnzipStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` + -OutputDirectory $InstallDirectory ` + -Force:$Force ` + -Verbose:$Verbose + + if ($UnzipStatus -Eq $False) { + # Retry Download one more time with Force=true + $DownloadRetryStatus = CommonLibrary\Get-File -Uri $Uri ` + -Path $TempToolPath ` + -DownloadRetries 1 ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Force:$True ` + -Verbose:$Verbose + + if ($DownloadRetryStatus -Eq $False) { + Write-Error "Last attempt of download failed as well" + return $False + } + + # Retry unzip again one more time with Force=true + $UnzipRetryStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` + -OutputDirectory $InstallDirectory ` + -Force:$True ` + -Verbose:$Verbose + if ($UnzipRetryStatus -Eq $False) + { + Write-Error "Last attempt of unzip failed as well" + # Clean up partial zips and extracts + if (Test-Path $TempToolPath) { + Remove-Item $TempToolPath -Force + } + if (Test-Path $InstallDirectory) { + Remove-Item $InstallDirectory -Force -Recurse + } + return $False + } + } + + return $True +} + +<# +.SYNOPSIS +Download a file, retry on failure + +.DESCRIPTION +Download specified file and retry if attempt fails + +.PARAMETER Uri +Uri of file to download. If Uri is a local path, the file will be copied instead of downloaded + +.PARAMETER Path +Path to download or copy uri file to + +.PARAMETER Force +Overwrite existing file if present. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds Default = 30 + +#> +function Get-File { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $Path, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [switch] $Force = $False + ) + $Attempt = 0 + + if ($Force) { + if (Test-Path $Path) { + Remove-Item $Path -Force + } + } + if (Test-Path $Path) { + Write-Host "File '$Path' already exists, skipping download" + return $True + } + + $DownloadDirectory = Split-Path -ErrorAction Ignore -Path "$Path" -Parent + if (-Not (Test-Path $DownloadDirectory)) { + New-Item -path $DownloadDirectory -force -itemType "Directory" | Out-Null + } + + $TempPath = "$Path.tmp" + if (Test-Path -IsValid -Path $Uri) { + Write-Verbose "'$Uri' is a file path, copying temporarily to '$TempPath'" + Copy-Item -Path $Uri -Destination $TempPath + Write-Verbose "Moving temporary file to '$Path'" + Move-Item -Path $TempPath -Destination $Path + return $? + } + else { + Write-Verbose "Downloading $Uri" + # Don't display the console progress UI - it's a huge perf hit + $ProgressPreference = 'SilentlyContinue' + while($Attempt -Lt $DownloadRetries) + { + try { + Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $TempPath + Write-Verbose "Downloaded to temporary location '$TempPath'" + Move-Item -Path $TempPath -Destination $Path + Write-Verbose "Moved temporary file to '$Path'" + return $True + } + catch { + $Attempt++ + if ($Attempt -Lt $DownloadRetries) { + $AttemptsLeft = $DownloadRetries - $Attempt + Write-Warning "Download failed, $AttemptsLeft attempts remaining, will retry in $RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $RetryWaitTimeInSeconds + } + else { + Write-Error $_ + Write-Error $_.Exception + } + } + } + } + + return $False +} + +<# +.SYNOPSIS +Generate a shim for a native tool + +.DESCRIPTION +Creates a wrapper script (shim) that passes arguments forward to native tool assembly + +.PARAMETER ShimName +The name of the shim + +.PARAMETER ShimDirectory +The directory where shims are stored + +.PARAMETER ToolFilePath +Path to file that shim forwards to + +.PARAMETER Force +Replace shim if already present. Default = False + +.NOTES +Returns $True if generating shim succeeds, $False otherwise +#> +function New-ScriptShim { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ShimName, + [Parameter(Mandatory=$True)] + [string] $ShimDirectory, + [Parameter(Mandatory=$True)] + [string] $ToolFilePath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [switch] $Force + ) + try { + Write-Verbose "Generating '$ShimName' shim" + + if (-Not (Test-Path $ToolFilePath)){ + Write-Error "Specified tool file path '$ToolFilePath' does not exist" + return $False + } + + # WinShimmer is a small .NET Framework program that creates .exe shims to bootstrapped programs + # Many of the checks for installed programs expect a .exe extension for Windows tools, rather + # than a .bat or .cmd file. + # Source: https://github.com/dotnet/arcade/tree/master/src/WinShimmer + if (-Not (Test-Path "$ShimDirectory\WinShimmer\winshimmer.exe")) { + $InstallStatus = DownloadAndExtract -Uri "$BaseUri/windows/winshimmer/WinShimmer.zip" ` + -InstallDirectory $ShimDirectory\WinShimmer ` + -Force:$Force ` + -DownloadRetries 2 ` + -RetryWaitTimeInSeconds 5 ` + -Verbose:$Verbose + } + + if ((Test-Path (Join-Path $ShimDirectory "$ShimName.exe"))) { + Write-Host "$ShimName.exe already exists; replacing..." + Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") + } + + & "$ShimDirectory\WinShimmer\winshimmer.exe" $ShimName $ToolFilePath $ShimDirectory + return $True + } + catch { + Write-Host $_ + Write-Host $_.Exception + return $False + } +} + +<# +.SYNOPSIS +Returns the machine architecture of the host machine + +.NOTES +Returns 'x64' on 64 bit machines + Returns 'x86' on 32 bit machines +#> +function Get-MachineArchitecture { + $ProcessorArchitecture = $Env:PROCESSOR_ARCHITECTURE + $ProcessorArchitectureW6432 = $Env:PROCESSOR_ARCHITEW6432 + if($ProcessorArchitecture -Eq "X86") + { + if(($ProcessorArchitectureW6432 -Eq "") -Or + ($ProcessorArchitectureW6432 -Eq "X86")) { + return "x86" + } + $ProcessorArchitecture = $ProcessorArchitectureW6432 + } + if (($ProcessorArchitecture -Eq "AMD64") -Or + ($ProcessorArchitecture -Eq "IA64") -Or + ($ProcessorArchitecture -Eq "ARM64") -Or + ($ProcessorArchitecture -Eq "LOONGARCH64") -Or + ($ProcessorArchitecture -Eq "RISCV64")) { + return "x64" + } + return "x86" +} + +<# +.SYNOPSIS +Get the name of a temporary folder under the native install directory +#> +function Get-TempDirectory { + return Join-Path (Get-NativeInstallDirectory) "temp/" +} + +function Get-TempPathFilename { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Path + ) + $TempDir = CommonLibrary\Get-TempDirectory + $TempFilename = Split-Path $Path -leaf + $TempPath = Join-Path $TempDir $TempFilename + return $TempPath +} + +<# +.SYNOPSIS +Returns the base directory to use for native tool installation + +.NOTES +Returns the value of the NETCOREENG_INSTALL_DIRECTORY if that environment variable +is set, or otherwise returns an install directory under the %USERPROFILE% +#> +function Get-NativeInstallDirectory { + $InstallDir = $Env:NETCOREENG_INSTALL_DIRECTORY + if (!$InstallDir) { + $InstallDir = Join-Path $Env:USERPROFILE ".netcoreeng/native/" + } + return $InstallDir +} + +<# +.SYNOPSIS +Unzip an archive + +.DESCRIPTION +Powershell module to unzip an archive to a specified directory + +.PARAMETER ZipPath (Required) +Path to archive to unzip + +.PARAMETER OutputDirectory (Required) +Output directory for archive contents + +.PARAMETER Force +Overwrite output directory contents if they already exist + +.NOTES +- Returns True and does not perform an extraction if output directory already exists but Overwrite is not True. +- Returns True if unzip operation is successful +- Returns False if Overwrite is True and it is unable to remove contents of OutputDirectory +- Returns False if unable to extract zip archive +#> +function Expand-Zip { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ZipPath, + [Parameter(Mandatory=$True)] + [string] $OutputDirectory, + [switch] $Force + ) + + Write-Verbose "Extracting '$ZipPath' to '$OutputDirectory'" + try { + if ((Test-Path $OutputDirectory) -And (-Not $Force)) { + Write-Host "Directory '$OutputDirectory' already exists, skipping extract" + return $True + } + if (Test-Path $OutputDirectory) { + Write-Verbose "'Force' is 'True', but '$OutputDirectory' exists, removing directory" + Remove-Item $OutputDirectory -Force -Recurse + if ($? -Eq $False) { + Write-Error "Unable to remove '$OutputDirectory'" + return $False + } + } + + $TempOutputDirectory = Join-Path "$(Split-Path -Parent $OutputDirectory)" "$(Split-Path -Leaf $OutputDirectory).tmp" + if (Test-Path $TempOutputDirectory) { + Remove-Item $TempOutputDirectory -Force -Recurse + } + New-Item -Path $TempOutputDirectory -Force -ItemType "Directory" | Out-Null + + Add-Type -assembly "system.io.compression.filesystem" + [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$TempOutputDirectory") + if ($? -Eq $False) { + Write-Error "Unable to extract '$ZipPath'" + return $False + } + + Move-Item -Path $TempOutputDirectory -Destination $OutputDirectory + } + catch { + Write-Host $_ + Write-Host $_.Exception + + return $False + } + return $True +} + +export-modulemember -function DownloadAndExtract +export-modulemember -function Expand-Zip +export-modulemember -function Get-File +export-modulemember -function Get-MachineArchitecture +export-modulemember -function Get-NativeInstallDirectory +export-modulemember -function Get-TempDirectory +export-modulemember -function Get-TempPathFilename +export-modulemember -function New-ScriptShim diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh new file mode 100644 index 000000000000..080c2c283ae4 --- /dev/null +++ b/eng/common/native/common-library.sh @@ -0,0 +1,172 @@ +#!/usr/bin/env bash + +function GetNativeInstallDirectory { + local install_dir + + if [[ -z $NETCOREENG_INSTALL_DIRECTORY ]]; then + install_dir=$HOME/.netcoreeng/native/ + else + install_dir=$NETCOREENG_INSTALL_DIRECTORY + fi + + echo $install_dir + return 0 +} + +function GetTempDirectory { + + echo $(GetNativeInstallDirectory)temp/ + return 0 +} + +function ExpandZip { + local zip_path=$1 + local output_directory=$2 + local force=${3:-false} + + echo "Extracting $zip_path to $output_directory" + if [[ -d $output_directory ]] && [[ $force = false ]]; then + echo "Directory '$output_directory' already exists, skipping extract" + return 0 + fi + + if [[ -d $output_directory ]]; then + echo "'Force flag enabled, but '$output_directory' exists. Removing directory" + rm -rf $output_directory + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Unable to remove '$output_directory'" + return 1 + fi + fi + + echo "Creating directory: '$output_directory'" + mkdir -p $output_directory + + echo "Extracting archive" + tar -xf $zip_path -C $output_directory + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Unable to extract '$zip_path'" + return 1 + fi + + return 0 +} + +function GetCurrentOS { + local unameOut="$(uname -s)" + case $unameOut in + Linux*) echo "Linux";; + Darwin*) echo "MacOS";; + esac + return 0 +} + +function GetFile { + local uri=$1 + local path=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + if [[ -f $path ]]; then + if [[ $force = false ]]; then + echo "File '$path' already exists. Skipping download" + return 0 + else + rm -rf $path + fi + fi + + if [[ -f $uri ]]; then + echo "'$uri' is a file path, copying file to '$path'" + cp $uri $path + return $? + fi + + echo "Downloading $uri" + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail + else + wget -q -O "$path" "$uri" --tries="$download_retries" + fi + + return $? +} + +function GetTempPathFileName { + local path=$1 + + local temp_dir=$(GetTempDirectory) + local temp_file_name=$(basename $path) + echo $temp_dir$temp_file_name + return 0 +} + +function DownloadAndExtract { + local uri=$1 + local installDir=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + local temp_tool_path=$(GetTempPathFileName $uri) + + echo "downloading to: $temp_tool_path" + + # Download file + GetFile "$uri" "$temp_tool_path" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Failed to download '$uri' to '$temp_tool_path'." + return 1 + fi + + # Extract File + echo "extracting from $temp_tool_path to $installDir" + ExpandZip "$temp_tool_path" "$installDir" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Failed to extract '$temp_tool_path' to '$installDir'." + return 1 + fi + + return 0 +} + +function NewScriptShim { + local shimpath=$1 + local tool_file_path=$2 + local force=${3:-false} + + echo "Generating '$shimpath' shim" + if [[ -f $shimpath ]]; then + if [[ $force = false ]]; then + echo "File '$shimpath' already exists." >&2 + return 1 + else + rm -rf $shimpath + fi + fi + + if [[ ! -f $tool_file_path ]]; then + # try to see if the path is lower cased + tool_file_path="$(echo $tool_file_path | tr "[:upper:]" "[:lower:]")" + if [[ ! -f $tool_file_path ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Specified tool file path:'$tool_file_path' does not exist" + return 1 + fi + fi + + local shim_contents=$'#!/usr/bin/env bash\n' + shim_contents+="SHIMARGS="$'$1\n' + shim_contents+="$tool_file_path"$' $SHIMARGS\n' + + # Write shim file + echo "$shim_contents" > $shimpath + + chmod +x $shimpath + + echo "Finished generating shim '$shimpath'" + + return $? +} + diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh new file mode 100644 index 000000000000..9a0e1f2b4567 --- /dev/null +++ b/eng/common/native/init-compiler.sh @@ -0,0 +1,146 @@ +#!/bin/sh +# +# This file detects the C/C++ compiler and exports it to the CC/CXX environment variables +# +# NOTE: some scripts source this file and rely on stdout being empty, make sure +# to not output *anything* here, unless it is an error message that fails the +# build. + +if [ -z "$build_arch" ] || [ -z "$compiler" ]; then + echo "Usage..." + echo "build_arch= compiler= init-compiler.sh" + echo "Specify the target architecture." + echo "Specify the name of compiler (clang or gcc)." + exit 1 +fi + +case "$compiler" in + clang*|-clang*|--clang*) + # clangx.y or clang-x.y + version="$(echo "$compiler" | tr -d '[:alpha:]-=')" + majorVersion="${version%%.*}" + + # LLVM based on v18 released in early 2024, with two releases per year + maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 6)))" + compiler=clang + ;; + + gcc*|-gcc*|--gcc*) + # gccx.y or gcc-x.y + version="$(echo "$compiler" | tr -d '[:alpha:]-=')" + majorVersion="${version%%.*}" + + # GCC based on v14 released in early 2024, with one release per year + maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 12)))" + compiler=gcc + ;; +esac + +cxxCompiler="$compiler++" + +# clear the existing CC and CXX from environment +CC= +CXX= +LDFLAGS= + +if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi + +check_version_exists() { + desired_version=-1 + + # Set up the environment to be used for building with the desired compiler. + if command -v "$compiler-$1" > /dev/null; then + desired_version="-$1" + elif command -v "$compiler$1" > /dev/null; then + desired_version="$1" + fi + + echo "$desired_version" +} + +__baseOS="$(uname)" +set_compiler_version_from_CC() { + if [ "$__baseOS" = "Darwin" ]; then + # On Darwin, the versions from -version/-dumpversion refer to Xcode + # versions, not llvm versions, so we can't rely on them. + return + fi + + version="$("$CC" -dumpversion)" + if [ -z "$version" ]; then + echo "Error: $CC -dumpversion didn't provide a version" + exit 1 + fi + + # gcc and clang often display 3 part versions. However, gcc can show only 1 part in some environments. + IFS=. read -r majorVersion _ < /dev/null; then + echo "Error: No compatible version of $compiler was found within the range of $minVersion to $maxVersion. Please upgrade your toolchain or specify the compiler explicitly using CLR_CC and CLR_CXX environment variables." + exit 1 + fi + + CC="$(command -v "$compiler" 2> /dev/null)" + CXX="$(command -v "$cxxCompiler" 2> /dev/null)" + set_compiler_version_from_CC + fi + else + desired_version="$(check_version_exists "$majorVersion")" + if [ "$desired_version" = "-1" ]; then + echo "Error: Could not find specific version of $compiler: $majorVersion." + exit 1 + fi + fi + + if [ -z "$CC" ]; then + CC="$(command -v "$compiler$desired_version" 2> /dev/null)" + CXX="$(command -v "$cxxCompiler$desired_version" 2> /dev/null)" + if [ -z "$CXX" ]; then CXX="$(command -v "$cxxCompiler" 2> /dev/null)"; fi + set_compiler_version_from_CC + fi +else + if [ ! -f "$CLR_CC" ]; then + echo "Error: CLR_CC is set but path '$CLR_CC' does not exist" + exit 1 + fi + CC="$CLR_CC" + CXX="$CLR_CXX" + set_compiler_version_from_CC +fi + +if [ -z "$CC" ]; then + echo "Error: Unable to find $compiler." + exit 1 +fi + +if [ "$__baseOS" != "Darwin" ]; then + # On Darwin, we always want to use the Apple linker. + + # Only lld version >= 9 can be considered stable. lld supports s390x starting from 18.0. + if [ "$compiler" = "clang" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -ge 9 ] && { [ "$build_arch" != "s390x" ] || [ "$majorVersion" -ge 18 ]; }; then + if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then + LDFLAGS="-fuse-ld=lld" + fi + fi +fi + +SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version" 2> /dev/null)" + +export CC CXX LDFLAGS SCAN_BUILD_COMMAND diff --git a/eng/common/native/init-distro-rid.sh b/eng/common/native/init-distro-rid.sh new file mode 100644 index 000000000000..83ea7aab0e08 --- /dev/null +++ b/eng/common/native/init-distro-rid.sh @@ -0,0 +1,110 @@ +#!/bin/sh + +# getNonPortableDistroRid +# +# Input: +# targetOs: (str) +# targetArch: (str) +# rootfsDir: (str) +# +# Return: +# non-portable rid +getNonPortableDistroRid() +{ + targetOs="$1" + targetArch="$2" + rootfsDir="$3" + nonPortableRid="" + + if [ "$targetOs" = "linux" ]; then + # shellcheck disable=SC1091 + if [ -e "${rootfsDir}/etc/os-release" ]; then + . "${rootfsDir}/etc/os-release" + if echo "${VERSION_ID:-}" | grep -qE '^([[:digit:]]|\.)+$'; then + nonPortableRid="${ID}.${VERSION_ID}-${targetArch}" + else + # Rolling release distros either do not set VERSION_ID, set it as blank or + # set it to non-version looking string (such as TEMPLATE_VERSION_ID on ArchLinux); + # so omit it here to be consistent with everything else. + nonPortableRid="${ID}-${targetArch}" + fi + elif [ -e "${rootfsDir}/android_platform" ]; then + # shellcheck disable=SC1091 + . "${rootfsDir}/android_platform" + nonPortableRid="$RID" + fi + fi + + if [ "$targetOs" = "freebsd" ]; then + # $rootfsDir can be empty. freebsd-version is a shell script and should always work. + __freebsd_major_version=$("$rootfsDir"/bin/freebsd-version | cut -d'.' -f1) + nonPortableRid="freebsd.$__freebsd_major_version-${targetArch}" + elif command -v getprop >/dev/null && getprop ro.product.system.model | grep -qi android; then + __android_sdk_version=$(getprop ro.build.version.sdk) + nonPortableRid="android.$__android_sdk_version-${targetArch}" + elif [ "$targetOs" = "illumos" ]; then + __uname_version=$(uname -v) + nonPortableRid="illumos-${targetArch}" + elif [ "$targetOs" = "solaris" ]; then + __uname_version=$(uname -v) + __solaris_major_version=$(echo "$__uname_version" | cut -d'.' -f1) + nonPortableRid="solaris.$__solaris_major_version-${targetArch}" + elif [ "$targetOs" = "haiku" ]; then + __uname_release="$(uname -r)" + nonPortableRid=haiku.r"$__uname_release"-"$targetArch" + fi + + echo "$nonPortableRid" | tr '[:upper:]' '[:lower:]' +} + +# initDistroRidGlobal +# +# Input: +# os: (str) +# arch: (str) +# rootfsDir?: (nullable:string) +# +# Return: +# None +# +# Notes: +# It is important to note that the function does not return anything, but it +# exports the following variables on success: +# __DistroRid : Non-portable rid of the target platform. +# __PortableTargetOS : OS-part of the portable rid that corresponds to the target platform. +initDistroRidGlobal() +{ + targetOs="$1" + targetArch="$2" + rootfsDir="" + if [ $# -ge 3 ]; then + rootfsDir="$3" + fi + + if [ -n "${rootfsDir}" ]; then + # We may have a cross build. Check for the existence of the rootfsDir + if [ ! -e "${rootfsDir}" ]; then + echo "Error: rootfsDir has been passed, but the location is not valid." + exit 1 + fi + fi + + __DistroRid=$(getNonPortableDistroRid "${targetOs}" "${targetArch}" "${rootfsDir}") + + if [ -z "${__PortableTargetOS:-}" ]; then + __PortableTargetOS="$targetOs" + + STRINGS="$(command -v strings || true)" + if [ -z "$STRINGS" ]; then + STRINGS="$(command -v llvm-strings || true)" + fi + + # Check for musl-based distros (e.g. Alpine Linux, Void Linux). + if "${rootfsDir}/usr/bin/ldd" --version 2>&1 | grep -q musl || + ( [ -n "$STRINGS" ] && "$STRINGS" "${rootfsDir}/usr/bin/ldd" 2>&1 | grep -q musl ); then + __PortableTargetOS="linux-musl" + fi + fi + + export __DistroRid __PortableTargetOS +} diff --git a/eng/common/native/init-os-and-arch.sh b/eng/common/native/init-os-and-arch.sh new file mode 100644 index 000000000000..38921d4338f7 --- /dev/null +++ b/eng/common/native/init-os-and-arch.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +# Use uname to determine what the OS is. +OSName=$(uname -s | tr '[:upper:]' '[:lower:]') + +if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then + OSName="android" +fi + +case "$OSName" in +freebsd|linux|netbsd|openbsd|sunos|android|haiku) + os="$OSName" ;; +darwin) + os=osx ;; +*) + echo "Unsupported OS $OSName detected!" + exit 1 ;; +esac + +# On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html +# and `uname -p` returns processor type (e.g. i386 on amd64). +# The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html. +if [ "$os" = "sunos" ]; then + if uname -o 2>&1 | grep -q illumos; then + os="illumos" + else + os="solaris" + fi + CPUName=$(isainfo -n) +else + # For the rest of the operating systems, use uname(1) to determine what the CPU is. + CPUName=$(uname -m) +fi + +case "$CPUName" in + arm64|aarch64) + arch=arm64 + if [ "$(getconf LONG_BIT)" -lt 64 ]; then + # This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS) + arch=arm + fi + ;; + + loongarch64) + arch=loongarch64 + ;; + + riscv64) + arch=riscv64 + ;; + + amd64|x86_64) + arch=x64 + ;; + + armv7l|armv8l) + # shellcheck disable=SC1091 + if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then + arch=armel + else + arch=arm + fi + ;; + + armv6l) + arch=armv6 + ;; + + i[3-6]86) + echo "Unsupported CPU $CPUName detected, build might not succeed!" + arch=x86 + ;; + + s390x) + arch=s390x + ;; + + ppc64le) + arch=ppc64le + ;; + *) + echo "Unknown CPU $CPUName detected!" + exit 1 + ;; +esac diff --git a/eng/common/native/install-cmake-test.sh b/eng/common/native/install-cmake-test.sh new file mode 100644 index 000000000000..8a5e7cf0db5a --- /dev/null +++ b/eng/common/native/install-cmake-test.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. $scriptroot/common-library.sh + +base_uri= +install_path= +version= +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installpath) + install_path=$2 + shift 2 + ;; + --version) + version=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --baseuri Base file directory or Url wrom which to acquire tool archives" + echo " --installpath Base directory to install native tool to" + echo " --clean Don't install the tool, just clean up the current install of the tool" + echo " --force Force install of tools even if they previously exist" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --downloadretries Total number of retry attempts" + echo " --retrywaittimeseconds Wait time between retry attempts in seconds" + echo "" + exit 0 + ;; + esac +done + +tool_name="cmake-test" +tool_os=$(GetCurrentOS) +tool_folder="$(echo $tool_os | tr "[:upper:]" "[:lower:]")" +tool_arch="x86_64" +tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" +tool_install_directory="$install_path/$tool_name/$version" +tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" +shim_path="$install_path/$tool_name.sh" +uri="${base_uri}/$tool_folder/$tool_name/$tool_name_moniker.tar.gz" + +# Clean up tool and installers +if [[ $clean = true ]]; then + echo "Cleaning $tool_install_directory" + if [[ -d $tool_install_directory ]]; then + rm -rf $tool_install_directory + fi + + echo "Cleaning $shim_path" + if [[ -f $shim_path ]]; then + rm -rf $shim_path + fi + + tool_temp_path=$(GetTempPathFileName $uri) + echo "Cleaning $tool_temp_path" + if [[ -f $tool_temp_path ]]; then + rm -rf $tool_temp_path + fi + + exit 0 +fi + +# Install tool +if [[ -f $tool_file_path ]] && [[ $force = false ]]; then + echo "$tool_name ($version) already exists, skipping install" + exit 0 +fi + +DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Installation failed' + exit 1 +fi + +# Generate Shim +# Always rewrite shims so that we are referencing the expected version +NewScriptShim $shim_path $tool_file_path true + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Shim generation failed' + exit 1 +fi + +exit 0 diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh new file mode 100644 index 000000000000..de496beebc5a --- /dev/null +++ b/eng/common/native/install-cmake.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. $scriptroot/common-library.sh + +base_uri= +install_path= +version= +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 + +while (($# > 0)); do + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installpath) + install_path=$2 + shift 2 + ;; + --version) + version=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --baseuri Base file directory or Url wrom which to acquire tool archives" + echo " --installpath Base directory to install native tool to" + echo " --clean Don't install the tool, just clean up the current install of the tool" + echo " --force Force install of tools even if they previously exist" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --downloadretries Total number of retry attempts" + echo " --retrywaittimeseconds Wait time between retry attempts in seconds" + echo "" + exit 0 + ;; + esac +done + +tool_name="cmake" +tool_os=$(GetCurrentOS) +tool_folder="$(echo $tool_os | tr "[:upper:]" "[:lower:]")" +tool_arch="x86_64" +tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" +tool_install_directory="$install_path/$tool_name/$version" +tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" +shim_path="$install_path/$tool_name.sh" +uri="${base_uri}/$tool_folder/$tool_name/$tool_name_moniker.tar.gz" + +# Clean up tool and installers +if [[ $clean = true ]]; then + echo "Cleaning $tool_install_directory" + if [[ -d $tool_install_directory ]]; then + rm -rf $tool_install_directory + fi + + echo "Cleaning $shim_path" + if [[ -f $shim_path ]]; then + rm -rf $shim_path + fi + + tool_temp_path=$(GetTempPathFileName $uri) + echo "Cleaning $tool_temp_path" + if [[ -f $tool_temp_path ]]; then + rm -rf $tool_temp_path + fi + + exit 0 +fi + +# Install tool +if [[ -f $tool_file_path ]] && [[ $force = false ]]; then + echo "$tool_name ($version) already exists, skipping install" + exit 0 +fi + +DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Installation failed' + exit 1 +fi + +# Generate Shim +# Always rewrite shims so that we are referencing the expected version +NewScriptShim $shim_path $tool_file_path true + +if [[ $? != 0 ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' 'Shim generation failed' + exit 1 +fi + +exit 0 diff --git a/eng/common/native/install-tool.ps1 b/eng/common/native/install-tool.ps1 new file mode 100644 index 000000000000..78f2d84a4e4b --- /dev/null +++ b/eng/common/native/install-tool.ps1 @@ -0,0 +1,132 @@ +<# +.SYNOPSIS +Install native tool + +.DESCRIPTION +Install cmake native tool from Azure blob storage + +.PARAMETER InstallPath +Base directory to install native tool to + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER CommonLibraryDirectory +Path to folder containing common library modules + +.PARAMETER Force +Force install of tools even if they previously exist + +.PARAMETER Clean +Don't install the tool, just clean up the current install of the tool + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.NOTES +Returns 0 if install succeeds, 1 otherwise +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [Parameter(Mandatory=$True)] + [string] $ToolName, + [Parameter(Mandatory=$True)] + [string] $InstallPath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [Parameter(Mandatory=$True)] + [string] $Version, + [string] $CommonLibraryDirectory = $PSScriptRoot, + [switch] $Force = $False, + [switch] $Clean = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 +) + +. $PSScriptRoot\..\pipeline-logging-functions.ps1 + +# Import common library modules +Import-Module -Name (Join-Path $CommonLibraryDirectory "CommonLibrary.psm1") + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $Arch = CommonLibrary\Get-MachineArchitecture + $ToolOs = "win64" + if($Arch -Eq "x32") { + $ToolOs = "win32" + } + $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" + $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" + $Uri = "$BaseUri/windows/$ToolName/$ToolNameMoniker.zip" + $ShimPath = Join-Path $InstallPath "$ToolName.exe" + + if ($Clean) { + Write-Host "Cleaning $ToolInstallDirectory" + if (Test-Path $ToolInstallDirectory) { + Remove-Item $ToolInstallDirectory -Force -Recurse + } + Write-Host "Cleaning $ShimPath" + if (Test-Path $ShimPath) { + Remove-Item $ShimPath -Force + } + $ToolTempPath = CommonLibrary\Get-TempPathFilename -Path $Uri + Write-Host "Cleaning $ToolTempPath" + if (Test-Path $ToolTempPath) { + Remove-Item $ToolTempPath -Force + } + exit 0 + } + + # Install tool + if ((Test-Path $ToolInstallDirectory) -And (-Not $Force)) { + Write-Verbose "$ToolName ($Version) already exists, skipping install" + } + else { + $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri ` + -InstallDirectory $ToolInstallDirectory ` + -Force:$Force ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Verbose:$Verbose + + if ($InstallStatus -Eq $False) { + Write-PipelineTelemetryError "Installation failed" -Category "NativeToolsetBootstrapping" + exit 1 + } + } + + $ToolFilePath = Get-ChildItem $ToolInstallDirectory -Recurse -Filter "$ToolName.exe" | % { $_.FullName } + if (@($ToolFilePath).Length -Gt 1) { + Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))" + exit 1 + } elseif (@($ToolFilePath).Length -Lt 1) { + Write-Host "$ToolName was not found in $ToolInstallDirectory." + exit 1 + } + + # Generate shim + # Always rewrite shims so that we are referencing the expected version + $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimName $ToolName ` + -ShimDirectory $InstallPath ` + -ToolFilePath "$ToolFilePath" ` + -BaseUri $BaseUri ` + -Force:$Force ` + -Verbose:$Verbose + + if ($GenerateShimStatus -Eq $False) { + Write-PipelineTelemetryError "Generate shim failed" -Category "NativeToolsetBootstrapping" + return 1 + } + + exit 0 +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category "NativeToolsetBootstrapping" -Message $_ + exit 1 +} diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 index 28d7823299eb..8e422c561e4b 100644 --- a/eng/common/pipeline-logging-functions.ps1 +++ b/eng/common/pipeline-logging-functions.ps1 @@ -257,4 +257,4 @@ function Write-LogIssue { } Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} \ No newline at end of file +} diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh index 2eaafa8f323b..6a0b2255e911 100644 --- a/eng/common/pipeline-logging-functions.sh +++ b/eng/common/pipeline-logging-functions.sh @@ -203,4 +203,4 @@ function Write-PipelineSetResult { if [[ "$ci" == true ]]; then echo "##vso[task.complete result=$result;]$message" fi -} \ No newline at end of file +} diff --git a/eng/common/post-build/check-channel-consistency.ps1 b/eng/common/post-build/check-channel-consistency.ps1 new file mode 100644 index 000000000000..61208d2d1351 --- /dev/null +++ b/eng/common/post-build/check-channel-consistency.ps1 @@ -0,0 +1,48 @@ +param( + [Parameter(Mandatory=$true)][string] $PromoteToChannels, # List of channels that the build should be promoted to + [Parameter(Mandatory=$true)][array] $AvailableChannelIds # List of channel IDs available in the YAML implementation +) + +try { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 + + if ($PromoteToChannels -eq "") { + Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info." + ExitWithExitCode 0 + } + + # Check that every channel that Maestro told to promote the build to + # is available in YAML + $PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ } + + $hasErrors = $false + + foreach ($id in $PromoteToChannelsIds) { + if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) { + Write-PipelineTaskError -Message "Channel $id is not present in the post-build YAML configuration! This is an error scenario. Please contact @dnceng." + $hasErrors = $true + } + } + + # The `Write-PipelineTaskError` doesn't error the script and we might report several errors + # in the previous lines. The check below makes sure that we return an error state from the + # script if we reported any validation error + if ($hasErrors) { + ExitWithExitCode 1 + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'CheckChannelConsistency' -Message "There was an error while trying to check consistency of Maestro default channels for the build and post-build YAML configuration." + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/nuget-validation.ps1 b/eng/common/post-build/nuget-validation.ps1 new file mode 100644 index 000000000000..e5de00c89836 --- /dev/null +++ b/eng/common/post-build/nuget-validation.ps1 @@ -0,0 +1,22 @@ +# This script validates NuGet package metadata information using this +# tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage + +param( + [Parameter(Mandatory=$true)][string] $PackagesPath # Path to where the packages to be validated are +) + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +$disableConfigureToolsetImport = $true +. $PSScriptRoot\..\tools.ps1 + +try { + & $PSScriptRoot\nuget-verification.ps1 ${PackagesPath}\*.nupkg +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'NuGetValidation' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/nuget-verification.ps1 b/eng/common/post-build/nuget-verification.ps1 new file mode 100644 index 000000000000..a365194a9389 --- /dev/null +++ b/eng/common/post-build/nuget-verification.ps1 @@ -0,0 +1,121 @@ +<# +.SYNOPSIS + Verifies that Microsoft NuGet packages have proper metadata. +.DESCRIPTION + Downloads a verification tool and runs metadata validation on the provided NuGet packages. This script writes an + error if any of the provided packages fail validation. All arguments provided to this PowerShell script that do not + match PowerShell parameters are passed on to the verification tool downloaded during the execution of this script. +.PARAMETER NuGetExePath + The path to the nuget.exe binary to use. If not provided, nuget.exe will be downloaded into the -DownloadPath + directory. +.PARAMETER PackageSource + The package source to use to download the verification tool. If not provided, nuget.org will be used. +.PARAMETER DownloadPath + The directory path to download the verification tool and nuget.exe to. If not provided, + %TEMP%\NuGet.VerifyNuGetPackage will be used. +.PARAMETER args + Arguments that will be passed to the verification tool. +.EXAMPLE + PS> .\verify.ps1 *.nupkg + Verifies the metadata of all .nupkg files in the currect working directory. +.EXAMPLE + PS> .\verify.ps1 --help + Displays the help text of the downloaded verifiction tool. +.LINK + https://github.com/NuGet/NuGetGallery/blob/master/src/VerifyMicrosoftPackage/README.md +#> + +# This script was copied from https://github.com/NuGet/NuGetGallery/blob/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1 + +[CmdletBinding(PositionalBinding = $false)] +param( + [string]$NuGetExePath, + [string]$PackageSource = "https://api.nuget.org/v3/index.json", + [string]$DownloadPath, + [Parameter(ValueFromRemainingArguments = $true)] + [string[]]$args +) + +# The URL to download nuget.exe. +$nugetExeUrl = "https://dist.nuget.org/win-x86-commandline/v4.9.4/nuget.exe" + +# The package ID of the verification tool. +$packageId = "NuGet.VerifyMicrosoftPackage" + +# The location that nuget.exe and the verification tool will be downloaded to. +if (!$DownloadPath) { + $DownloadPath = (Join-Path $env:TEMP "NuGet.VerifyMicrosoftPackage") +} + +$fence = New-Object -TypeName string -ArgumentList '=', 80 + +# Create the download directory, if it doesn't already exist. +if (!(Test-Path $DownloadPath)) { + New-Item -ItemType Directory $DownloadPath | Out-Null +} +Write-Host "Using download path: $DownloadPath" + +if ($NuGetExePath) { + $nuget = $NuGetExePath +} else { + $downloadedNuGetExe = Join-Path $DownloadPath "nuget.exe" + + # Download nuget.exe, if it doesn't already exist. + if (!(Test-Path $downloadedNuGetExe)) { + Write-Host "Downloading nuget.exe from $nugetExeUrl..." + $ProgressPreference = 'SilentlyContinue' + try { + Invoke-WebRequest $nugetExeUrl -OutFile $downloadedNuGetExe + $ProgressPreference = 'Continue' + } catch { + $ProgressPreference = 'Continue' + Write-Error $_ + Write-Error "nuget.exe failed to download." + exit + } + } + + $nuget = $downloadedNuGetExe +} + +Write-Host "Using nuget.exe path: $nuget" +Write-Host " " + +# Download the latest version of the verification tool. +Write-Host "Downloading the latest version of $packageId from $packageSource..." +Write-Host $fence +& $nuget install $packageId ` + -Prerelease ` + -OutputDirectory $DownloadPath ` + -Source $PackageSource +Write-Host $fence +Write-Host " " + +if ($LASTEXITCODE -ne 0) { + Write-Error "nuget.exe failed to fetch the verify tool." + exit +} + +# Find the most recently downloaded tool +Write-Host "Finding the most recently downloaded verification tool." +$verifyProbePath = Join-Path $DownloadPath "$packageId.*" +$verifyPath = Get-ChildItem -Path $verifyProbePath -Directory ` + | Sort-Object -Property LastWriteTime -Descending ` + | Select-Object -First 1 +$verify = Join-Path $verifyPath "tools\NuGet.VerifyMicrosoftPackage.exe" +Write-Host "Using verification tool: $verify" +Write-Host " " + +# Execute the verification tool. +Write-Host "Executing the verify tool..." +Write-Host $fence +& $verify $args +Write-Host $fence +Write-Host " " + +# Respond to the exit code. +if ($LASTEXITCODE -ne 0) { + Write-Error "The verify tool found some problems." +} else { + Write-Output "The verify tool succeeded." +} diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 new file mode 100644 index 000000000000..90b58e32a87b --- /dev/null +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -0,0 +1,59 @@ +param( + [Parameter(Mandatory=$true)][int] $BuildId, + [Parameter(Mandatory=$true)][int] $PublishingInfraVersion, + [Parameter(Mandatory=$true)][string] $AzdoToken, + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', + [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, + [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, + [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters +) + +try { + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 + + $darc = Get-Darc + + $optionalParams = [System.Collections.ArrayList]::new() + + if ("" -ne $ArtifactsPublishingAdditionalParameters) { + $optionalParams.Add("--artifact-publishing-parameters") | Out-Null + $optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null + } + + if ("" -ne $SymbolPublishingAdditionalParameters) { + $optionalParams.Add("--symbol-publishing-parameters") | Out-Null + $optionalParams.Add($SymbolPublishingAdditionalParameters) | Out-Null + } + + if ("false" -eq $WaitPublishingFinish) { + $optionalParams.Add("--no-wait") | Out-Null + } + + & $darc add-build-to-channel ` + --id $buildId ` + --publishing-infra-version $PublishingInfraVersion ` + --default-channels ` + --source-branch main ` + --azdev-pat "$AzdoToken" ` + --bar-uri "$MaestroApiEndPoint" ` + --ci ` + --verbose ` + @optionalParams + + if ($LastExitCode -ne 0) { + Write-Host "Problems using Darc to promote build ${buildId} to default channels. Stopping execution..." + exit 1 + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to publish build '$BuildId' to default channels." + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/redact-logs.ps1 b/eng/common/post-build/redact-logs.ps1 new file mode 100644 index 000000000000..b7fc19591507 --- /dev/null +++ b/eng/common/post-build/redact-logs.ps1 @@ -0,0 +1,89 @@ +[CmdletBinding(PositionalBinding=$False)] +param( + [Parameter(Mandatory=$true, Position=0)][string] $InputPath, + [Parameter(Mandatory=$true)][string] $BinlogToolVersion, + [Parameter(Mandatory=$false)][string] $DotnetPath, + [Parameter(Mandatory=$false)][string] $PackageFeed = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json', + # File with strings to redact - separated by newlines. + # For comments start the line with '# ' - such lines are ignored + [Parameter(Mandatory=$false)][string] $TokensFilePath, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$TokensToRedact +) + +try { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + + # `tools.ps1` checks $ci to perform some actions. Since the post-build + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + $disableConfigureToolsetImport = $true + . $PSScriptRoot\..\tools.ps1 + + $packageName = 'binlogtool' + + $dotnet = $DotnetPath + + if (!$dotnet) { + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + } + + $toolList = & "$dotnet" tool list -g + + if ($toolList -like "*$packageName*") { + & "$dotnet" tool uninstall $packageName -g + } + + $toolPath = "$PSScriptRoot\..\..\..\.tools" + $verbosity = 'minimal' + + New-Item -ItemType Directory -Force -Path $toolPath + + Push-Location -Path $toolPath + + try { + Write-Host "Installing Binlog redactor CLI..." + Write-Host "'$dotnet' new tool-manifest" + & "$dotnet" new tool-manifest + Write-Host "'$dotnet' tool install $packageName --local --add-source '$PackageFeed' -v $verbosity --version $BinlogToolVersion" + & "$dotnet" tool install $packageName --local --add-source "$PackageFeed" -v $verbosity --version $BinlogToolVersion + + if (Test-Path $TokensFilePath) { + Write-Host "Adding additional sensitive data for redaction from file: " $TokensFilePath + $TokensToRedact += Get-Content -Path $TokensFilePath | Foreach {$_.Trim()} | Where { $_ -notmatch "^# " } + } + + $optionalParams = [System.Collections.ArrayList]::new() + + Foreach ($p in $TokensToRedact) + { + if($p -match '^\$\(.*\)$') + { + Write-Host ("Ignoring token {0} as it is probably unexpanded AzDO variable" -f $p) + } + elseif($p) + { + $optionalParams.Add("-p:" + $p) | Out-Null + } + } + + & $dotnet binlogtool redact --input:$InputPath --recurse --in-place ` + @optionalParams + + if ($LastExitCode -ne 0) { + Write-PipelineTelemetryError -Category 'Redactor' -Type 'warning' -Message "Problems using Redactor tool (exit code: $LastExitCode). But ignoring them now." + } + } + finally { + Pop-Location + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'Redactor' -Message "There was an error while trying to redact logs. Error: $_" + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 new file mode 100644 index 000000000000..1976ef70fb85 --- /dev/null +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -0,0 +1,327 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored + [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory=$false)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade + [Parameter(Mandatory=$false)][string] $GHCommit, # GitHub commit SHA used to build the packages + [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +$disableConfigureToolsetImport = $true +. $PSScriptRoot\..\tools.ps1 + +# Cache/HashMap (File -> Exist flag) used to consult whether a file exist +# in the repository at a specific commit point. This is populated by inserting +# all files present in the repo at a specific commit point. +$global:RepoFiles = @{} + +# Maximum number of jobs to run in parallel +$MaxParallelJobs = 16 + +$MaxRetries = 5 +$RetryWaitTimeInSeconds = 30 + +# Wait time between check for system load +$SecondsBetweenLoadChecks = 10 + +if (!$InputPath -or !(Test-Path $InputPath)){ + Write-Host "No files to validate." + ExitWithExitCode 0 +} + +$ValidatePackage = { + param( + [string] $PackagePath # Full path to a Symbols.NuGet package + ) + + . $using:PSScriptRoot\..\tools.ps1 + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + Write-Host "Input file does not exist: $PackagePath" + return [pscustomobject]@{ + result = 1 + packagePath = $PackagePath + } + } + + # Extensions for which we'll look for SourceLink information + # For now we'll only care about Portable & Embedded PDBs + $RelevantExtensions = @('.dll', '.exe', '.pdb') + + Write-Host -NoNewLine 'Validating ' ([System.IO.Path]::GetFileName($PackagePath)) '...' + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId + $FailedFiles = 0 + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + [System.IO.Directory]::CreateDirectory($ExtractPath) | Out-Null + + try { + $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) + + $zip.Entries | + Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | + ForEach-Object { + $FileName = $_.FullName + $Extension = [System.IO.Path]::GetExtension($_.Name) + $FakeName = -Join((New-Guid), $Extension) + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName + + # We ignore resource DLLs + if ($FileName.EndsWith('.resources.dll')) { + return [pscustomobject]@{ + result = 0 + packagePath = $PackagePath + } + } + + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) + + $ValidateFile = { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $RealPath, + [ref] $FailedFiles + ) + + $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" + $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" + $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String + + if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { + $NumFailedLinks = 0 + + # We only care about Http addresses + $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches + + if ($Matches.Count -ne 0) { + $Matches.Value | + ForEach-Object { + $Link = $_ + $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" + + $FilePath = $Link.Replace($CommitUrl, "") + $Status = 200 + $Cache = $using:RepoFiles + + $attempts = 0 + + while ($attempts -lt $using:MaxRetries) { + if ( !($Cache.ContainsKey($FilePath)) ) { + try { + $Uri = $Link -as [System.URI] + + if ($Link -match "submodules") { + # Skip submodule links until sourcelink properly handles submodules + $Status = 200 + } + elseif ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { + # Only GitHub links are valid + $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode + } + else { + # If it's not a github link, we want to break out of the loop and not retry. + $Status = 0 + $attempts = $using:MaxRetries + } + } + catch { + Write-Host $_ + $Status = 0 + } + } + + if ($Status -ne 200) { + $attempts++ + + if ($attempts -lt $using:MaxRetries) + { + $attemptsLeft = $using:MaxRetries - $attempts + Write-Warning "Download failed, $attemptsLeft attempts remaining, will retry in $using:RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $using:RetryWaitTimeInSeconds + } + else { + if ($NumFailedLinks -eq 0) { + if ($FailedFiles.Value -eq 0) { + Write-Host + } + + Write-Host "`tFile $RealPath has broken links:" + } + + Write-Host "`t`tFailed to retrieve $Link" + + $NumFailedLinks++ + } + } + else { + break + } + } + } + } + + if ($NumFailedLinks -ne 0) { + $FailedFiles.value++ + $global:LASTEXITCODE = 1 + } + } + } + + &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) + } + } + catch { + Write-Host $_ + } + finally { + $zip.Dispose() + } + + if ($FailedFiles -eq 0) { + Write-Host 'Passed.' + return [pscustomobject]@{ + result = 0 + packagePath = $PackagePath + } + } + else { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$PackagePath has broken SourceLink links." + return [pscustomobject]@{ + result = 1 + packagePath = $PackagePath + } + } +} + +function CheckJobResult( + $result, + $packagePath, + [ref]$ValidationFailures, + [switch]$logErrors) { + if ($result -ne '0') { + if ($logErrors) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." + } + $ValidationFailures.Value++ + } +} + +function ValidateSourceLinkLinks { + if ($GHRepoName -ne '' -and !($GHRepoName -Match '^[^\s\/]+/[^\s\/]+$')) { + if (!($GHRepoName -Match '^[^\s-]+-[^\s]+$')) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHRepoName should be in the format / or -. '$GHRepoName'" + ExitWithExitCode 1 + } + else { + $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; + } + } + + if ($GHCommit -ne '' -and !($GHCommit -Match '^[0-9a-fA-F]{40}$')) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHCommit should be a 40 chars hexadecimal string. '$GHCommit'" + ExitWithExitCode 1 + } + + if ($GHRepoName -ne '' -and $GHCommit -ne '') { + $RepoTreeURL = -Join('http://api.github.com/repos/', $GHRepoName, '/git/trees/', $GHCommit, '?recursive=1') + $CodeExtensions = @('.cs', '.vb', '.fs', '.fsi', '.fsx', '.fsscript') + + try { + # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash + $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree + + foreach ($file in $Data) { + $Extension = [System.IO.Path]::GetExtension($file.path) + + if ($CodeExtensions.Contains($Extension)) { + $RepoFiles[$file.path] = 1 + } + } + } + catch { + Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL . Execution will proceed without caching." + } + } + elseif ($GHRepoName -ne '' -or $GHCommit -ne '') { + Write-Host 'For using the http caching mechanism both GHRepoName and GHCommit should be informed.' + } + + if (Test-Path $ExtractPath) { + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue + } + + $ValidationFailures = 0 + + # Process each NuGet package in parallel + Get-ChildItem "$InputPath\*.symbols.nupkg" | + ForEach-Object { + Write-Host "Starting $($_.FullName)" + Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null + $NumJobs = @(Get-Job -State 'Running').Count + + while ($NumJobs -ge $MaxParallelJobs) { + Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." + sleep $SecondsBetweenLoadChecks + $NumJobs = @(Get-Job -State 'Running').Count + } + + foreach ($Job in @(Get-Job -State 'Completed')) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) -LogErrors + Remove-Job -Id $Job.Id + } + } + + foreach ($Job in @(Get-Job)) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) + Remove-Job -Id $Job.Id + } + if ($ValidationFailures -gt 0) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$ValidationFailures package(s) failed validation." + ExitWithExitCode 1 + } +} + +function InstallSourcelinkCli { + $sourcelinkCliPackageName = 'sourcelink' + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { + Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." + } + else { + Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global + } +} + +try { + InstallSourcelinkCli + + foreach ($Job in @(Get-Job)) { + Remove-Job -Id $Job.Id + } + + ValidateSourceLinkLinks +} +catch { + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'SourceLink' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 new file mode 100644 index 000000000000..7146e593ffae --- /dev/null +++ b/eng/common/post-build/symbols-validation.ps1 @@ -0,0 +1,337 @@ +param( + [Parameter(Mandatory = $true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored + [Parameter(Mandatory = $true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory = $true)][string] $DotnetSymbolVersion, # Version of dotnet symbol to use + [Parameter(Mandatory = $false)][switch] $CheckForWindowsPdbs, # If we should check for the existence of windows pdbs in addition to portable PDBs + [Parameter(Mandatory = $false)][switch] $ContinueOnError, # If we should keep checking symbols after an error + [Parameter(Mandatory = $false)][switch] $Clean, # Clean extracted symbols directory after checking symbols + [Parameter(Mandatory = $false)][string] $SymbolExclusionFile # Exclude the symbols in the file from publishing to symbol server +) + +. $PSScriptRoot\..\tools.ps1 +# Maximum number of jobs to run in parallel +$MaxParallelJobs = 16 + +# Max number of retries +$MaxRetry = 5 + +# Wait time between check for system load +$SecondsBetweenLoadChecks = 10 + +# Set error codes +Set-Variable -Name "ERROR_BADEXTRACT" -Option Constant -Value -1 +Set-Variable -Name "ERROR_FILEDOESNOTEXIST" -Option Constant -Value -2 + +$WindowsPdbVerificationParam = "" +if ($CheckForWindowsPdbs) { + $WindowsPdbVerificationParam = "--windows-pdbs" +} + +$ExclusionSet = New-Object System.Collections.Generic.HashSet[string]; + +if (!$InputPath -or !(Test-Path $InputPath)){ + Write-Host "No symbols to validate." + ExitWithExitCode 0 +} + +#Check if the path exists +if ($SymbolExclusionFile -and (Test-Path $SymbolExclusionFile)){ + [string[]]$Exclusions = Get-Content "$SymbolExclusionFile" + $Exclusions | foreach { if($_ -and $_.Trim()){$ExclusionSet.Add($_)} } +} +else{ + Write-Host "Symbol Exclusion file does not exists. No symbols to exclude." +} + +$CountMissingSymbols = { + param( + [string] $PackagePath, # Path to a NuGet package + [string] $WindowsPdbVerificationParam # If we should check for the existence of windows pdbs in addition to portable PDBs + ) + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + Write-Host "Validating $PackagePath " + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + Write-PipelineTaskError "Input file does not exist: $PackagePath" + return [pscustomobject]@{ + result = $using:ERROR_FILEDOESNOTEXIST + packagePath = $PackagePath + } + } + + # Extensions for which we'll look for symbols + $RelevantExtensions = @('.dll', '.exe', '.so', '.dylib') + + # How many files are missing symbol information + $MissingSymbols = 0 + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $PackageGuid = New-Guid + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageGuid + $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath 'Symbols' + + try { + [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) + } + catch { + Write-Host "Something went wrong extracting $PackagePath" + Write-Host $_ + return [pscustomobject]@{ + result = $using:ERROR_BADEXTRACT + packagePath = $PackagePath + } + } + + Get-ChildItem -Recurse $ExtractPath | + Where-Object { $RelevantExtensions -contains $_.Extension } | + ForEach-Object { + $FileName = $_.FullName + if ($FileName -Match '\\ref\\') { + Write-Host "`t Ignoring reference assembly file " $FileName + return + } + + $FirstMatchingSymbolDescriptionOrDefault = { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $WindowsPdbVerificationParam, # Parameter to pass to potential check for windows-pdbs. + [string] $SymbolsPath + ) + + $FileName = [System.IO.Path]::GetFileName($FullPath) + $Extension = [System.IO.Path]::GetExtension($FullPath) + + # Those below are potential symbol files that the `dotnet symbol` might + # return. Which one will be returned depend on the type of file we are + # checking and which type of file was uploaded. + + # The file itself is returned + $SymbolPath = $SymbolsPath + '\' + $FileName + + # PDB file for the module + $PdbPath = $SymbolPath.Replace($Extension, '.pdb') + + # PDB file for R2R module (created by crossgen) + $NGenPdb = $SymbolPath.Replace($Extension, '.ni.pdb') + + # DBG file for a .so library + $SODbg = $SymbolPath.Replace($Extension, '.so.dbg') + + # DWARF file for a .dylib + $DylibDwarf = $SymbolPath.Replace($Extension, '.dylib.dwarf') + + $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" + $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" + + $totalRetries = 0 + + while ($totalRetries -lt $using:MaxRetry) { + + # Save the output and get diagnostic output + $output = & $dotnetSymbolExe --symbols --modules $WindowsPdbVerificationParam $TargetServerParam $FullPath -o $SymbolsPath --diagnostics | Out-String + + if ((Test-Path $PdbPath) -and (Test-path $SymbolPath)) { + return 'Module and PDB for Module' + } + elseif ((Test-Path $NGenPdb) -and (Test-Path $PdbPath) -and (Test-Path $SymbolPath)) { + return 'Dll, PDB and NGen PDB' + } + elseif ((Test-Path $SODbg) -and (Test-Path $SymbolPath)) { + return 'So and DBG for SO' + } + elseif ((Test-Path $DylibDwarf) -and (Test-Path $SymbolPath)) { + return 'Dylib and Dwarf for Dylib' + } + elseif (Test-Path $SymbolPath) { + return 'Module' + } + else + { + $totalRetries++ + } + } + + return $null + } + + $FileRelativePath = $FileName.Replace("$ExtractPath\", "") + if (($($using:ExclusionSet) -ne $null) -and ($($using:ExclusionSet).Contains($FileRelativePath) -or ($($using:ExclusionSet).Contains($FileRelativePath.Replace("\", "/"))))){ + Write-Host "Skipping $FileName from symbol validation" + } + + else { + $FileGuid = New-Guid + $ExpandedSymbolsPath = Join-Path -Path $SymbolsPath -ChildPath $FileGuid + + $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault ` + -FullPath $FileName ` + -TargetServerParam '--microsoft-symbol-server' ` + -SymbolsPath "$ExpandedSymbolsPath-msdl" ` + -WindowsPdbVerificationParam $WindowsPdbVerificationParam + $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault ` + -FullPath $FileName ` + -TargetServerParam '--internal-server' ` + -SymbolsPath "$ExpandedSymbolsPath-symweb" ` + -WindowsPdbVerificationParam $WindowsPdbVerificationParam + + Write-Host -NoNewLine "`t Checking file " $FileName "... " + + if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { + Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)" + } + else { + $MissingSymbols++ + + if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { + Write-Host 'No symbols found on MSDL or SymWeb!' + } + else { + if ($SymbolsOnMSDL -eq $null) { + Write-Host 'No symbols found on MSDL!' + } + else { + Write-Host 'No symbols found on SymWeb!' + } + } + } + } + } + + if ($using:Clean) { + Remove-Item $ExtractPath -Recurse -Force + } + + Pop-Location + + return [pscustomobject]@{ + result = $MissingSymbols + packagePath = $PackagePath + } +} + +function CheckJobResult( + $result, + $packagePath, + [ref]$DupedSymbols, + [ref]$TotalFailures) { + if ($result -eq $ERROR_BADEXTRACT) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath has duplicated symbol files" + $DupedSymbols.Value++ + } + elseif ($result -eq $ERROR_FILEDOESNOTEXIST) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath does not exist" + $TotalFailures.Value++ + } + elseif ($result -gt '0') { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $result modules in the package $packagePath" + $TotalFailures.Value++ + } + else { + Write-Host "All symbols verified for package $packagePath" + } +} + +function CheckSymbolsAvailable { + if (Test-Path $ExtractPath) { + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue + } + + $TotalPackages = 0 + $TotalFailures = 0 + $DupedSymbols = 0 + + Get-ChildItem "$InputPath\*.nupkg" | + ForEach-Object { + $FileName = $_.Name + $FullName = $_.FullName + + # These packages from Arcade-Services include some native libraries that + # our current symbol uploader can't handle. Below is a workaround until + # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted. + if ($FileName -Match 'Microsoft\.DotNet\.Darc\.') { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + elseif ($FileName -Match 'Microsoft\.DotNet\.Maestro\.Tasks\.') { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + + $TotalPackages++ + + Start-Job -ScriptBlock $CountMissingSymbols -ArgumentList @($FullName,$WindowsPdbVerificationParam) | Out-Null + + $NumJobs = @(Get-Job -State 'Running').Count + + while ($NumJobs -ge $MaxParallelJobs) { + Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." + sleep $SecondsBetweenLoadChecks + $NumJobs = @(Get-Job -State 'Running').Count + } + + foreach ($Job in @(Get-Job -State 'Completed')) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$DupedSymbols) ([ref]$TotalFailures) + Remove-Job -Id $Job.Id + } + Write-Host + } + + foreach ($Job in @(Get-Job)) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$DupedSymbols) ([ref]$TotalFailures) + } + + if ($TotalFailures -gt 0 -or $DupedSymbols -gt 0) { + if ($TotalFailures -gt 0) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Symbols missing for $TotalFailures/$TotalPackages packages" + } + + if ($DupedSymbols -gt 0) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$DupedSymbols/$TotalPackages packages had duplicated symbol files and could not be extracted" + } + + ExitWithExitCode 1 + } + else { + Write-Host "All symbols validated!" + } +} + +function InstallDotnetSymbol { + $dotnetSymbolPackageName = 'dotnet-symbol' + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$dotnetSymbolPackageName*") -and ($toolList -like "*$dotnetSymbolVersion*")) { + Write-Host "dotnet-symbol version $dotnetSymbolVersion is already installed." + } + else { + Write-Host "Installing dotnet-symbol version $dotnetSymbolVersion..." + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + & "$dotnet" tool install $dotnetSymbolPackageName --version $dotnetSymbolVersion --verbosity "minimal" --global + } +} + +try { + InstallDotnetSymbol + + foreach ($Job in @(Get-Job)) { + Remove-Job -Id $Job.Id + } + + CheckSymbolsAvailable +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/retain-build.ps1 b/eng/common/retain-build.ps1 new file mode 100644 index 000000000000..e7ba975adeb6 --- /dev/null +++ b/eng/common/retain-build.ps1 @@ -0,0 +1,45 @@ + +Param( +[Parameter(Mandatory=$true)][int] $buildId, +[Parameter(Mandatory=$true)][string] $azdoOrgUri, +[Parameter(Mandatory=$true)][string] $azdoProject, +[Parameter(Mandatory=$true)][string] $token +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +function Get-AzDOHeaders( + [string] $token) +{ + $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":${token}")) + $headers = @{"Authorization"="Basic $base64AuthInfo"} + return $headers +} + +function Update-BuildRetention( + [string] $azdoOrgUri, + [string] $azdoProject, + [int] $buildId, + [string] $token) +{ + $headers = Get-AzDOHeaders -token $token + $requestBody = "{ + `"keepForever`": `"true`" + }" + + $requestUri = "${azdoOrgUri}/${azdoProject}/_apis/build/builds/${buildId}?api-version=6.0" + write-Host "Attempting to retain build using the following URI: ${requestUri} ..." + + try { + Invoke-RestMethod -Uri $requestUri -Method Patch -Body $requestBody -Header $headers -contentType "application/json" + Write-Host "Updated retention settings for build ${buildId}." + } + catch { + Write-Error "Failed to update retention settings for build: $_.Exception.Response.StatusDescription" + exit 1 + } +} + +Update-BuildRetention -azdoOrgUri $azdoOrgUri -azdoProject $azdoProject -buildId $buildId -token $token +exit 0 diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 new file mode 100644 index 000000000000..aab40de3fd9a --- /dev/null +++ b/eng/common/sdk-task.ps1 @@ -0,0 +1,97 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $configuration = 'Debug', + [string] $task, + [string] $verbosity = 'minimal', + [string] $msbuildEngine = $null, + [switch] $restore, + [switch] $prepareMachine, + [switch] $help, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +$ci = $true +$binaryLog = $true +$warnAsError = $true + +. $PSScriptRoot\tools.ps1 + +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -task Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)" + Write-Host " -restore Restore dependencies" + Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host "" + Write-Host "Command line arguments not listed above are passed thru to msbuild." +} + +function Build([string]$target) { + $logSuffix = if ($target -eq 'Execute') { '' } else { ".$target" } + $log = Join-Path $LogDir "$task$logSuffix.binlog" + $outputPath = Join-Path $ToolsetDir "$task\" + + MSBuild $taskProject ` + /bl:$log ` + /t:$target ` + /p:Configuration=$configuration ` + /p:RepoRoot=$RepoRoot ` + /p:BaseIntermediateOutputPath=$outputPath ` + /v:$verbosity ` + @properties +} + +try { + if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { + Print-Usage + exit 0 + } + + if ($task -eq "") { + Write-PipelineTelemetryError -Category 'Build' -Message "Missing required parameter '-task '" + Print-Usage + ExitWithExitCode 1 + } + + if( $msbuildEngine -eq "vs") { + # Ensure desktop MSBuild is available for sdk tasks. + if( -not ($GlobalJson.tools.PSObject.Properties.Name -contains "vs" )) { + $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty + } + if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.10.0-pre.4.0" -MemberType NoteProperty + } + if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { + $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true + } + if ($xcopyMSBuildToolsFolder -eq $null) { + throw 'Unable to get xcopy downloadable version of msbuild' + } + + $global:_MSBuildExe = "$($xcopyMSBuildToolsFolder)\MSBuild\Current\Bin\MSBuild.exe" + } + + $taskProject = GetSdkTaskProject $task + if (!(Test-Path $taskProject)) { + Write-PipelineTelemetryError -Category 'Build' -Message "Unknown task: $task" + ExitWithExitCode 1 + } + + if ($restore) { + Build 'Restore' + } + + Build 'Execute' +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Build' -Message $_ + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config new file mode 100644 index 000000000000..3849bdb3cf51 --- /dev/null +++ b/eng/common/sdl/NuGet.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/eng/common/sdl/configure-sdl-tool.ps1 b/eng/common/sdl/configure-sdl-tool.ps1 new file mode 100644 index 000000000000..27f5a4115fc7 --- /dev/null +++ b/eng/common/sdl/configure-sdl-tool.ps1 @@ -0,0 +1,130 @@ +Param( + [string] $GuardianCliLocation, + [string] $WorkingDirectory, + [string] $TargetDirectory, + [string] $GdnFolder, + # The list of Guardian tools to configure. For each object in the array: + # - If the item is a [hashtable], it must contain these entries: + # - Name = The tool name as Guardian knows it. + # - Scenario = (Optional) Scenario-specific name for this configuration entry. It must be unique + # among all tool entries with the same Name. + # - Args = (Optional) Array of Guardian tool configuration args, like '@("Target > C:\temp")' + # - If the item is a [string] $v, it is treated as '@{ Name="$v" }' + [object[]] $ToolsList, + [string] $GuardianLoggerLevel='Standard', + # Optional: Additional params to add to any tool using CredScan. + [string[]] $CrScanAdditionalRunConfigParams, + # Optional: Additional params to add to any tool using PoliCheck. + [string[]] $PoliCheckAdditionalRunConfigParams, + # Optional: Additional params to add to any tool using CodeQL/Semmle. + [string[]] $CodeQLAdditionalRunConfigParams, + # Optional: Additional params to add to any tool using Binskim. + [string[]] $BinskimAdditionalRunConfigParams +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + # Normalize tools list: all in [hashtable] form with defined values for each key. + $ToolsList = $ToolsList | + ForEach-Object { + if ($_ -is [string]) { + $_ = @{ Name = $_ } + } + + if (-not ($_['Scenario'])) { $_.Scenario = "" } + if (-not ($_['Args'])) { $_.Args = @() } + $_ + } + + Write-Host "List of tools to configure:" + $ToolsList | ForEach-Object { $_ | Out-String | Write-Host } + + # We store config files in the r directory of .gdn + $gdnConfigPath = Join-Path $GdnFolder 'r' + $ValidPath = Test-Path $GuardianCliLocation + + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." + ExitWithExitCode 1 + } + + foreach ($tool in $ToolsList) { + # Put together the name and scenario to make a unique key. + $toolConfigName = $tool.Name + if ($tool.Scenario) { + $toolConfigName += "_" + $tool.Scenario + } + + Write-Host "=== Configuring $toolConfigName..." + + $gdnConfigFile = Join-Path $gdnConfigPath "$toolConfigName-configure.gdnconfig" + + # For some tools, add default and automatic args. + switch -Exact ($tool.Name) { + 'credscan' { + if ($targetDirectory) { + $tool.Args += "`"TargetDirectory < $TargetDirectory`"" + } + $tool.Args += "`"OutputType < pre`"" + $tool.Args += $CrScanAdditionalRunConfigParams + } + 'policheck' { + if ($targetDirectory) { + $tool.Args += "`"Target < $TargetDirectory`"" + } + $tool.Args += $PoliCheckAdditionalRunConfigParams + } + {$_ -in 'semmle', 'codeql'} { + if ($targetDirectory) { + $tool.Args += "`"SourceCodeDirectory < $TargetDirectory`"" + } + $tool.Args += $CodeQLAdditionalRunConfigParams + } + 'binskim' { + if ($targetDirectory) { + # Binskim crashes due to specific PDBs. GitHub issue: https://github.com/microsoft/binskim/issues/924. + # We are excluding all `_.pdb` files from the scan. + $tool.Args += "`"Target < $TargetDirectory\**;-:file|$TargetDirectory\**\_.pdb`"" + } + $tool.Args += $BinskimAdditionalRunConfigParams + } + } + + # Create variable pointing to the args array directly so we can use splat syntax later. + $toolArgs = $tool.Args + + # Configure the tool. If args array is provided or the current tool has some default arguments + # defined, add "--args" and splat each element on the end. Arg format is "{Arg id} < {Value}", + # one per parameter. Doc page for "guardian configure": + # https://dev.azure.com/securitytools/SecurityIntegration/_wiki/wikis/Guardian/1395/configure + Exec-BlockVerbosely { + & $GuardianCliLocation configure ` + --working-directory $WorkingDirectory ` + --tool $tool.Name ` + --output-path $gdnConfigFile ` + --logger-level $GuardianLoggerLevel ` + --noninteractive ` + --force ` + $(if ($toolArgs) { "--args" }) @toolArgs + Exit-IfNZEC "Sdl" + } + + Write-Host "Created '$toolConfigName' configuration file: $gdnConfigFile" + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 new file mode 100644 index 000000000000..4715d75e974d --- /dev/null +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -0,0 +1,167 @@ +Param( + [string] $GuardianPackageName, # Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified) + [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) + [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified + [string] $Repository=$env:BUILD_REPOSITORY_NAME, # Required: the name of the repository (e.g. dotnet/arcade) + [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master + [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located + [string] $ArtifactsDirectory = (Join-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY ('artifacts')), # Required: the directory where build artifacts are located + [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault + + # Optional: list of SDL tools to run on source code. See 'configure-sdl-tool.ps1' for tools list + # format. + [object[]] $SourceToolsList, + # Optional: list of SDL tools to run on built artifacts. See 'configure-sdl-tool.ps1' for tools + # list format. + [object[]] $ArtifactToolsList, + # Optional: list of SDL tools to run without automatically specifying a target directory. See + # 'configure-sdl-tool.ps1' for tools list format. + [object[]] $CustomToolsList, + + [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaBranchName=$env:BUILD_SOURCEBRANCH, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. + [string] $TsaRepositoryName=$env:BUILD_REPOSITORY_NAME, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. + [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) + [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed + [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. + [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. + [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $GuardianLoggerLevel='Standard', # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error + [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") + [string[]] $PoliCheckAdditionalRunConfigParams, # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") + [string[]] $CodeQLAdditionalRunConfigParams, # Optional: Additional Params to custom build a Semmle/CodeQL run config in the format @("xyz < abc","sdf < 1") + [string[]] $BinskimAdditionalRunConfigParams, # Optional: Additional Params to custom build a Binskim run config in the format @("xyz < abc","sdf < 1") + [bool] $BreakOnFailure=$False # Optional: Fail the build if there were errors during the run +) + +try { + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + $disableConfigureToolsetImport = $true + $global:LASTEXITCODE = 0 + + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + #Replace repo names to the format of org/repo + if (!($Repository.contains('/'))) { + $RepoName = $Repository -replace '(.*?)-(.*)', '$1/$2'; + } + else{ + $RepoName = $Repository; + } + + if ($GuardianPackageName) { + $guardianCliLocation = Join-Path $NugetPackageDirectory (Join-Path $GuardianPackageName (Join-Path 'tools' 'guardian.cmd')) + } else { + $guardianCliLocation = $GuardianCliLocation + } + + $workingDirectory = (Split-Path $SourceDirectory -Parent) + $ValidPath = Test-Path $guardianCliLocation + + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Invalid Guardian CLI Location.' + ExitWithExitCode 1 + } + + Exec-BlockVerbosely { + & $(Join-Path $PSScriptRoot 'init-sdl.ps1') -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel + } + $gdnFolder = Join-Path $workingDirectory '.gdn' + + if ($TsaOnboard) { + if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) { + Exec-BlockVerbosely { + & $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel + } + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian tsa-onboard failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + } else { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Could not onboard to TSA -- not all required values ($TsaCodebaseName, $TsaNotificationEmail, $TsaCodebaseAdmin, $TsaBugAreaPath) were specified.' + ExitWithExitCode 1 + } + } + + # Configure a list of tools with a default target directory. Populates the ".gdn/r" directory. + function Configure-ToolsList([object[]] $tools, [string] $targetDirectory) { + if ($tools -and $tools.Count -gt 0) { + Exec-BlockVerbosely { + & $(Join-Path $PSScriptRoot 'configure-sdl-tool.ps1') ` + -GuardianCliLocation $guardianCliLocation ` + -WorkingDirectory $workingDirectory ` + -TargetDirectory $targetDirectory ` + -GdnFolder $gdnFolder ` + -ToolsList $tools ` + -AzureDevOpsAccessToken $AzureDevOpsAccessToken ` + -GuardianLoggerLevel $GuardianLoggerLevel ` + -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams ` + -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams ` + -CodeQLAdditionalRunConfigParams $CodeQLAdditionalRunConfigParams ` + -BinskimAdditionalRunConfigParams $BinskimAdditionalRunConfigParams + if ($BreakOnFailure) { + Exit-IfNZEC "Sdl" + } + } + } + } + + # Configure Artifact and Source tools with default Target directories. + Configure-ToolsList $ArtifactToolsList $ArtifactsDirectory + Configure-ToolsList $SourceToolsList $SourceDirectory + # Configure custom tools with no default Target directory. + Configure-ToolsList $CustomToolsList $null + + # At this point, all tools are configured in the ".gdn" directory. Run them all in a single call. + # (If we used "run" multiple times, each run would overwrite data from earlier runs.) + Exec-BlockVerbosely { + & $(Join-Path $PSScriptRoot 'run-sdl.ps1') ` + -GuardianCliLocation $guardianCliLocation ` + -WorkingDirectory $SourceDirectory ` + -UpdateBaseline $UpdateBaseline ` + -GdnFolder $gdnFolder + } + + if ($TsaPublish) { + if ($TsaBranchName -and $BuildNumber) { + if (-not $TsaRepositoryName) { + $TsaRepositoryName = "$($Repository)-$($BranchName)" + } + Exec-BlockVerbosely { + & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --onboard $True --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel + } + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian tsa-publish failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + } else { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message 'Could not publish to TSA -- not all required values ($TsaBranchName, $BuildNumber) were specified.' + ExitWithExitCode 1 + } + } + + if ($BreakOnFailure) { + Write-Host "Failing the build in case of breaking results..." + Exec-BlockVerbosely { + & $guardianCliLocation break --working-directory $workingDirectory --logger-level $GuardianLoggerLevel + } + } else { + Write-Host "Letting the build pass even if there were breaking results..." + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + exit 1 +} diff --git a/eng/common/sdl/extract-artifact-archives.ps1 b/eng/common/sdl/extract-artifact-archives.ps1 new file mode 100644 index 000000000000..68da4fbf2571 --- /dev/null +++ b/eng/common/sdl/extract-artifact-archives.ps1 @@ -0,0 +1,63 @@ +# This script looks for each archive file in a directory and extracts it into the target directory. +# For example, the file "$InputPath/bin.tar.gz" extracts to "$ExtractPath/bin.tar.gz.extracted/**". +# Uses the "tar" utility added to Windows 10 / Windows 2019 that supports tar.gz and zip. +param( + # Full path to directory where archives are stored. + [Parameter(Mandatory=$true)][string] $InputPath, + # Full path to directory to extract archives into. May be the same as $InputPath. + [Parameter(Mandatory=$true)][string] $ExtractPath +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +$disableConfigureToolsetImport = $true + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + Measure-Command { + $jobs = @() + + # Find archive files for non-Windows and Windows builds. + $archiveFiles = @( + Get-ChildItem (Join-Path $InputPath "*.tar.gz") + Get-ChildItem (Join-Path $InputPath "*.zip") + ) + + foreach ($targzFile in $archiveFiles) { + $jobs += Start-Job -ScriptBlock { + $file = $using:targzFile + $fileName = [System.IO.Path]::GetFileName($file) + $extractDir = Join-Path $using:ExtractPath "$fileName.extracted" + + New-Item $extractDir -ItemType Directory -Force | Out-Null + + Write-Host "Extracting '$file' to '$extractDir'..." + + # Pipe errors to stdout to prevent PowerShell detecting them and quitting the job early. + # This type of quit skips the catch, so we wouldn't be able to tell which file triggered the + # error. Save output so it can be stored in the exception string along with context. + $output = tar -xf $file -C $extractDir 2>&1 + # Handle NZEC manually rather than using Exit-IfNZEC: we are in a background job, so we + # don't have access to the outer scope. + if ($LASTEXITCODE -ne 0) { + throw "Error extracting '$file': non-zero exit code ($LASTEXITCODE). Output: '$output'" + } + + Write-Host "Extracted to $extractDir" + } + } + + Receive-Job $jobs -Wait + } +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/extract-artifact-packages.ps1 b/eng/common/sdl/extract-artifact-packages.ps1 new file mode 100644 index 000000000000..f031ed5b25e9 --- /dev/null +++ b/eng/common/sdl/extract-artifact-packages.ps1 @@ -0,0 +1,82 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where artifact packages are stored + [Parameter(Mandatory=$true)][string] $ExtractPath # Full path to directory where the packages will be extracted +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +$disableConfigureToolsetImport = $true + +function ExtractArtifacts { + if (!(Test-Path $InputPath)) { + Write-Host "Input Path does not exist: $InputPath" + ExitWithExitCode 0 + } + $Jobs = @() + Get-ChildItem "$InputPath\*.nupkg" | + ForEach-Object { + $Jobs += Start-Job -ScriptBlock $ExtractPackage -ArgumentList $_.FullName + } + + foreach ($Job in $Jobs) { + Wait-Job -Id $Job.Id | Receive-Job + } +} + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + $ExtractPackage = { + param( + [string] $PackagePath # Full path to a NuGet package + ) + + if (!(Test-Path $PackagePath)) { + Write-PipelineTelemetryError -Category 'Build' -Message "Input file does not exist: $PackagePath" + ExitWithExitCode 1 + } + + $RelevantExtensions = @('.dll', '.exe', '.pdb') + Write-Host -NoNewLine 'Extracting ' ([System.IO.Path]::GetFileName($PackagePath)) '...' + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + [System.IO.Directory]::CreateDirectory($ExtractPath); + + try { + $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) + + $zip.Entries | + Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | + ForEach-Object { + $TargetPath = Join-Path -Path $ExtractPath -ChildPath (Split-Path -Path $_.FullName) + [System.IO.Directory]::CreateDirectory($TargetPath); + + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.FullName + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile) + } + } + catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 + } + finally { + $zip.Dispose() + } + } + Measure-Command { ExtractArtifacts } +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 new file mode 100644 index 000000000000..3ac1d92b3700 --- /dev/null +++ b/eng/common/sdl/init-sdl.ps1 @@ -0,0 +1,55 @@ +Param( + [string] $GuardianCliLocation, + [string] $Repository, + [string] $BranchName='master', + [string] $WorkingDirectory, + [string] $AzureDevOpsAccessToken, + [string] $GuardianLoggerLevel='Standard' +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +# `tools.ps1` checks $ci to perform some actions. Since the SDL +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +. $PSScriptRoot\..\tools.ps1 + +# Don't display the console progress UI - it's a huge perf hit +$ProgressPreference = 'SilentlyContinue' + +# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file +$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) +$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") +$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0" +$zipFile = "$WorkingDirectory/gdn.zip" + +Add-Type -AssemblyName System.IO.Compression.FileSystem +$gdnFolder = (Join-Path $WorkingDirectory '.gdn') + +try { + # if the folder does not exist, we'll do a guardian init and push it to the remote repository + Write-Host 'Initializing Guardian...' + Write-Host "$GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel" + & $GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Build' -Message "Guardian init failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + # We create the mainbaseline so it can be edited later + Write-Host "$GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline" + & $GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Build' -Message "Guardian baseline failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + ExitWithExitCode 0 +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config new file mode 100644 index 000000000000..4585cfd6bba1 --- /dev/null +++ b/eng/common/sdl/packages.config @@ -0,0 +1,4 @@ + + + + diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 new file mode 100644 index 000000000000..2eac8c78f103 --- /dev/null +++ b/eng/common/sdl/run-sdl.ps1 @@ -0,0 +1,49 @@ +Param( + [string] $GuardianCliLocation, + [string] $WorkingDirectory, + [string] $GdnFolder, + [string] $UpdateBaseline, + [string] $GuardianLoggerLevel='Standard' +) + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +try { + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + # We store config files in the r directory of .gdn + $gdnConfigPath = Join-Path $GdnFolder 'r' + $ValidPath = Test-Path $GuardianCliLocation + + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." + ExitWithExitCode 1 + } + + $gdnConfigFiles = Get-ChildItem $gdnConfigPath -Recurse -Include '*.gdnconfig' + Write-Host "Discovered Guardian config files:" + $gdnConfigFiles | Out-String | Write-Host + + Exec-BlockVerbosely { + & $GuardianCliLocation run ` + --working-directory $WorkingDirectory ` + --baseline mainbaseline ` + --update-baseline $UpdateBaseline ` + --logger-level $GuardianLoggerLevel ` + --config @gdnConfigFiles + Exit-IfNZEC "Sdl" + } +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/sdl.ps1 b/eng/common/sdl/sdl.ps1 new file mode 100644 index 000000000000..648c5068d7d6 --- /dev/null +++ b/eng/common/sdl/sdl.ps1 @@ -0,0 +1,38 @@ + +function Install-Gdn { + param( + [Parameter(Mandatory=$true)] + [string]$Path, + + # If omitted, install the latest version of Guardian, otherwise install that specific version. + [string]$Version + ) + + $ErrorActionPreference = 'Stop' + Set-StrictMode -Version 2.0 + $disableConfigureToolsetImport = $true + $global:LASTEXITCODE = 0 + + # `tools.ps1` checks $ci to perform some actions. Since the SDL + # scripts don't necessarily execute in the same agent that run the + # build.ps1/sh script this variable isn't automatically set. + $ci = $true + . $PSScriptRoot\..\tools.ps1 + + $argumentList = @("install", "Microsoft.Guardian.Cli", "-Source https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") + + if ($Version) { + $argumentList += "-Version $Version" + } + + Start-Process nuget -Verbose -ArgumentList $argumentList -NoNewWindow -Wait + + $gdnCliPath = Get-ChildItem -Filter guardian.cmd -Recurse -Path $Path + + if (!$gdnCliPath) + { + Write-PipelineTelemetryError -Category 'Sdl' -Message 'Failure installing Guardian' + } + + return $gdnCliPath.FullName +} \ No newline at end of file diff --git a/eng/common/sdl/trim-assets-version.ps1 b/eng/common/sdl/trim-assets-version.ps1 new file mode 100644 index 000000000000..0daa2a9e9462 --- /dev/null +++ b/eng/common/sdl/trim-assets-version.ps1 @@ -0,0 +1,75 @@ +<# +.SYNOPSIS +Install and run the 'Microsoft.DotNet.VersionTools.Cli' tool with the 'trim-artifacts-version' command to trim the version from the NuGet assets file name. + +.PARAMETER InputPath +Full path to directory where artifact packages are stored + +.PARAMETER Recursive +Search for NuGet packages recursively + +#> + +Param( + [string] $InputPath, + [bool] $Recursive = $true +) + +$CliToolName = "Microsoft.DotNet.VersionTools.Cli" + +function Install-VersionTools-Cli { + param( + [Parameter(Mandatory=$true)][string]$Version + ) + + Write-Host "Installing the package '$CliToolName' with a version of '$version' ..." + $feed = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" + + $argumentList = @("tool", "install", "--local", "$CliToolName", "--add-source $feed", "--no-cache", "--version $Version", "--create-manifest-if-needed") + Start-Process "$dotnet" -Verbose -ArgumentList $argumentList -NoNewWindow -Wait +} + +# ------------------------------------------------------------------- + +if (!(Test-Path $InputPath)) { + Write-Host "Input Path '$InputPath' does not exist" + ExitWithExitCode 1 +} + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 2.0 + +$disableConfigureToolsetImport = $true +$global:LASTEXITCODE = 0 + +# `tools.ps1` checks $ci to perform some actions. Since the SDL +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +. $PSScriptRoot\..\tools.ps1 + +try { + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + + $toolsetVersion = Read-ArcadeSdkVersion + Install-VersionTools-Cli -Version $toolsetVersion + + $cliToolFound = (& "$dotnet" tool list --local | Where-Object {$_.Split(' ')[0] -eq $CliToolName}) + if ($null -eq $cliToolFound) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "The '$CliToolName' tool is not installed." + ExitWithExitCode 1 + } + + Exec-BlockVerbosely { + & "$dotnet" $CliToolName trim-assets-version ` + --assets-path $InputPath ` + --recursive $Recursive + Exit-IfNZEC "Sdl" + } +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} diff --git a/eng/common/template-guidance.md b/eng/common/template-guidance.md new file mode 100644 index 000000000000..5ef6c30ba924 --- /dev/null +++ b/eng/common/template-guidance.md @@ -0,0 +1,133 @@ +# Overview + +Arcade provides templates for public (`/templates`) and 1ES pipeline templates (`/templates-official`) scenarios. Pipelines which are required to be managed by 1ES pipeline templates should reference `/templates-offical`, all other pipelines may reference `/templates`. + +## How to use + +Basic guidance is: + +- 1ES Pipeline Template or 1ES Microbuild template runs should reference `eng/common/templates-official`. Any internal production-graded pipeline should use these templates. + +- All other runs should reference `eng/common/templates`. + +See [azure-pipelines.yml](../../azure-pipelines.yml) (templates-official example) or [azure-pipelines-pr.yml](../../azure-pipelines-pr.yml) (templates example) for examples. + +#### The `templateIs1ESManaged` parameter + +The `templateIs1ESManaged` is available on most templates and affects which of the variants is used for nested templates. See [Development Notes](#development-notes) below for more information on the `templateIs1ESManaged1 parameter. + +- For templates under `job/`, `jobs/`, `steps`, or `post-build/`, this parameter must be explicitly set. + +## Multiple outputs + +1ES pipeline templates impose a policy where every publish artifact execution results in additional security scans being injected into your pipeline. When using `templates-official/jobs/jobs.yml`, Arcade reduces the number of additional security injections by gathering all publishing outputs into the [Build.ArtifactStagingDirectory](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services), and utilizing the [outputParentDirectory](https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/outputs#multiple-outputs) feature of 1ES pipeline templates. When implementing your pipeline, if you ensure publish artifacts are located in the `$(Build.ArtifactStagingDirectory)`, and utilize the 1ES provided template context, then you can reduce the number of security scans for your pipeline. + +Example: +``` yaml +# azure-pipelines.yml +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate + parameters: + stages: + - stage: build + jobs: + - template: /eng/common/templates-official/jobs/jobs.yml@self + parameters: + # 1ES makes use of outputs to reduce security task injection overhead + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Publish logs from source' + continueOnError: true + condition: always() + targetPath: $(Build.ArtifactStagingDirectory)/artifacts/log + artifactName: Logs + jobs: + - job: Windows + steps: + - script: echo "friendly neighborhood" > artifacts/marvel/spiderman.txt + # copy build outputs to artifact staging directory for publishing + - task: CopyFiles@2 + displayName: Gather build output + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/marvel' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/marvel' +``` + +Note: Multiple outputs are ONLY applicable to 1ES PT publishing (only usable when referencing `templates-official`). + +# Development notes + +**Folder / file structure** + +``` text +eng\common\ + [templates || templates-official]\ + job\ + job.yml (shim + artifact publishing logic) + onelocbuild.yml (shim) + publish-build-assets.yml (shim) + source-build.yml (shim) + source-index-stage1.yml (shim) + jobs\ + codeql-build.yml (shim) + jobs.yml (shim) + source-build.yml (shim) + post-build\ + post-build.yml (shim) + common-variabls.yml (shim) + setup-maestro-vars.yml (shim) + steps\ + publish-build-artifacts.yml (logic) + publish-pipeline-artifacts.yml (logic) + component-governance.yml (shim) + generate-sbom.yml (shim) + publish-logs.yml (shim) + retain-build.yml (shim) + send-to-helix.yml (shim) + source-build.yml (shim) + variables\ + pool-providers.yml (logic + redirect) # templates/variables/pool-providers.yml will redirect to templates-official/variables/pool-providers.yml if you are running in the internal project + sdl-variables.yml (logic) + core-templates\ + job\ + job.yml (logic) + onelocbuild.yml (logic) + publish-build-assets.yml (logic) + source-build.yml (logic) + source-index-stage1.yml (logic) + jobs\ + codeql-build.yml (logic) + jobs.yml (logic) + source-build.yml (logic) + post-build\ + common-variabls.yml (logic) + post-build.yml (logic) + setup-maestro-vars.yml (logic) + steps\ + component-governance.yml (logic) + generate-sbom.yml (logic) + publish-build-artifacts.yml (redirect) + publish-logs.yml (logic) + publish-pipeline-artifacts.yml (redirect) + retain-build.yml (logic) + send-to-helix.yml (logic) + source-build.yml (logic) + variables\ + pool-providers.yml (redirect) +``` + +In the table above, a file is designated as "shim", "logic", or "redirect". + +- shim - represents a yaml file which is an intermediate step between pipeline logic and .Net Core Engineering's templates (`core-templates`) and defines the `is1ESPipeline` parameter value. + +- logic - represents actual base template logic. + +- redirect- represents a file in `core-templates` which redirects to the "logic" file in either `templates` or `templates-official`. + +Logic for Arcade's templates live **primarily** in the `core-templates` folder. The exceptions to the location of the logic files are around artifact publishing, which is handled differently between 1es pipeline templates and standard templates. `templates` and `templates-official` provide shim entry points which redirect to `core-templates` while also defining the `is1ESPipeline` parameter. If a shim is referenced in `templates`, then `is1ESPipeline` is set to `false`. If a shim is referenced in `templates-official`, then `is1ESPipeline` is set to `true`. + +Within `templates` and `templates-official`, the templates at the "stages", and "jobs" / "job" level have been replaced with shims. Templates at the "steps" and "variables" level are typically too granular to be replaced with shims and instead persist logic which is directly applicable to either scenario. + +Within `core-templates`, there are a handful of places where logic is dependent on which shim entry point was used. In those places, we redirect back to the respective logic file in `templates` or `templates-official`. diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml new file mode 100644 index 000000000000..605692d2fb77 --- /dev/null +++ b/eng/common/templates-official/job/job.yml @@ -0,0 +1,80 @@ +parameters: +# Sbom related params + enableSbom: true + runAsPublic: false + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + +jobs: +- template: /eng/common/core-templates/job/job.yml + parameters: + is1ESPipeline: true + + componentGovernanceSteps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion }} + BuildDropPath: ${{ parameters.buildDropPath }} + publishArtifacts: false + + # publish artifacts + # for 1ES managed templates, use the templateContext.output to handle multiple outputs. + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - output: buildArtifacts + displayName: Publish pipeline artifacts + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + condition: always() + continueOnError: true + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - output: pipelineArtifact + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)_Attempt$(System.JobAttempt)') }} + displayName: 'Publish logs' + continueOnError: true + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if eq(parameters.enablePublishBuildArtifacts, true) }}: + - output: buildArtifacts + displayName: Publish Logs + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - output: pipelineArtifact + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/eng/common/BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - output: pipelineArtifact + displayName: Publish SBOM manifest + continueOnError: true + targetPath: $(Build.ArtifactStagingDirectory)/sbom + artifactName: $(ARTIFACT_NAME) + + # add any outputs provided via root yaml + - ${{ if ne(parameters.templateContext.outputs, '') }}: + - ${{ each output in parameters.templateContext.outputs }}: + - ${{ output }} + + # add any remaining templateContext properties + ${{ each context in parameters.templateContext }}: + ${{ if and(ne(context.key, 'outputParentDirectory'), ne(context.key, 'outputs')) }}: + ${{ context.key }}: ${{ context.value }} + + ${{ each parameter in parameters }}: + ${{ if and(ne(parameter.key, 'templateContext'), ne(parameter.key, 'is1ESPipeline')) }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/onelocbuild.yml b/eng/common/templates-official/job/onelocbuild.yml new file mode 100644 index 000000000000..0f0c514b912d --- /dev/null +++ b/eng/common/templates-official/job/onelocbuild.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/onelocbuild.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml new file mode 100644 index 000000000000..d667a70e8de7 --- /dev/null +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/publish-build-assets.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/source-build.yml b/eng/common/templates-official/job/source-build.yml new file mode 100644 index 000000000000..1a480034b678 --- /dev/null +++ b/eng/common/templates-official/job/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml new file mode 100644 index 000000000000..6d5ead316f92 --- /dev/null +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-index-stage1.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/codeql-build.yml b/eng/common/templates-official/jobs/codeql-build.yml new file mode 100644 index 000000000000..a726322ecfe0 --- /dev/null +++ b/eng/common/templates-official/jobs/codeql-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/codeql-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/jobs.yml b/eng/common/templates-official/jobs/jobs.yml new file mode 100644 index 000000000000..007deddaea0f --- /dev/null +++ b/eng/common/templates-official/jobs/jobs.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/jobs/source-build.yml b/eng/common/templates-official/jobs/source-build.yml new file mode 100644 index 000000000000..483e7b611f34 --- /dev/null +++ b/eng/common/templates-official/jobs/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/post-build/common-variables.yml b/eng/common/templates-official/post-build/common-variables.yml new file mode 100644 index 000000000000..c32fc49233f8 --- /dev/null +++ b/eng/common/templates-official/post-build/common-variables.yml @@ -0,0 +1,8 @@ +variables: +- template: /eng/common/core-templates/post-build/common-variables.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml new file mode 100644 index 000000000000..2364c0fd4a52 --- /dev/null +++ b/eng/common/templates-official/post-build/post-build.yml @@ -0,0 +1,8 @@ +stages: +- template: /eng/common/core-templates/post-build/post-build.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/post-build/setup-maestro-vars.yml b/eng/common/templates-official/post-build/setup-maestro-vars.yml new file mode 100644 index 000000000000..024397d87864 --- /dev/null +++ b/eng/common/templates-official/post-build/setup-maestro-vars.yml @@ -0,0 +1,8 @@ +steps: +- template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/component-governance.yml b/eng/common/templates-official/steps/component-governance.yml new file mode 100644 index 000000000000..30bb3985ca2b --- /dev/null +++ b/eng/common/templates-official/steps/component-governance.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/enable-internal-runtimes.yml b/eng/common/templates-official/steps/enable-internal-runtimes.yml new file mode 100644 index 000000000000..f9dd238c6cd5 --- /dev/null +++ b/eng/common/templates-official/steps/enable-internal-runtimes.yml @@ -0,0 +1,9 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default +steps: +- template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/enable-internal-sources.yml b/eng/common/templates-official/steps/enable-internal-sources.yml new file mode 100644 index 000000000000..e6d57182284d --- /dev/null +++ b/eng/common/templates-official/steps/enable-internal-sources.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/generate-sbom.yml b/eng/common/templates-official/steps/generate-sbom.yml new file mode 100644 index 000000000000..9a89a4706d94 --- /dev/null +++ b/eng/common/templates-official/steps/generate-sbom.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/generate-sbom.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/get-delegation-sas.yml b/eng/common/templates-official/steps/get-delegation-sas.yml new file mode 100644 index 000000000000..c5a9c1f8275c --- /dev/null +++ b/eng/common/templates-official/steps/get-delegation-sas.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/get-federated-access-token.yml b/eng/common/templates-official/steps/get-federated-access-token.yml new file mode 100644 index 000000000000..c8dcf6b81392 --- /dev/null +++ b/eng/common/templates-official/steps/get-federated-access-token.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-federated-access-token.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates-official/steps/publish-build-artifacts.yml b/eng/common/templates-official/steps/publish-build-artifacts.yml new file mode 100644 index 000000000000..100a3fc98493 --- /dev/null +++ b/eng/common/templates-official/steps/publish-build-artifacts.yml @@ -0,0 +1,41 @@ +parameters: +- name: displayName + type: string + default: 'Publish to Build Artifact' + +- name: condition + type: string + default: succeeded() + +- name: artifactName + type: string + +- name: pathToPublish + type: string + +- name: continueOnError + type: boolean + default: false + +- name: publishLocation + type: string + default: 'Container' + +- name: is1ESPipeline + type: boolean + default: true + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error +- task: 1ES.PublishBuildArtifacts@1 + displayName: ${{ parameters.displayName }} + condition: ${{ parameters.condition }} + ${{ if parameters.continueOnError }}: + continueOnError: ${{ parameters.continueOnError }} + inputs: + PublishLocation: ${{ parameters.publishLocation }} + PathtoPublish: ${{ parameters.pathToPublish }} + ${{ if parameters.artifactName }}: + ArtifactName: ${{ parameters.artifactName }} + diff --git a/eng/common/templates-official/steps/publish-logs.yml b/eng/common/templates-official/steps/publish-logs.yml new file mode 100644 index 000000000000..579fd531e94c --- /dev/null +++ b/eng/common/templates-official/steps/publish-logs.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/publish-pipeline-artifacts.yml b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml new file mode 100644 index 000000000000..172f9f0fdc97 --- /dev/null +++ b/eng/common/templates-official/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,28 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: true + +- name: args + type: object + default: {} + +steps: +- ${{ if ne(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error +- task: 1ES.PublishPipelineArtifact@1 + displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} + ${{ if parameters.args.condition }}: + condition: ${{ parameters.args.condition }} + ${{ else }}: + condition: succeeded() + ${{ if parameters.args.continueOnError }}: + continueOnError: ${{ parameters.args.continueOnError }} + inputs: + targetPath: ${{ parameters.args.targetPath }} + ${{ if parameters.args.artifactName }}: + artifactName: ${{ parameters.args.artifactName }} + ${{ if parameters.args.properties }}: + properties: ${{ parameters.args.properties }} + ${{ if parameters.args.sbomEnabled }}: + sbomEnabled: ${{ parameters.args.sbomEnabled }} diff --git a/eng/common/templates-official/steps/retain-build.yml b/eng/common/templates-official/steps/retain-build.yml new file mode 100644 index 000000000000..5594551508a3 --- /dev/null +++ b/eng/common/templates-official/steps/retain-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/retain-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/send-to-helix.yml b/eng/common/templates-official/steps/send-to-helix.yml new file mode 100644 index 000000000000..6500f21bf845 --- /dev/null +++ b/eng/common/templates-official/steps/send-to-helix.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/send-to-helix.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/steps/source-build.yml b/eng/common/templates-official/steps/source-build.yml new file mode 100644 index 000000000000..8f92c49e7b06 --- /dev/null +++ b/eng/common/templates-official/steps/source-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: true + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates-official/variables/pool-providers.yml b/eng/common/templates-official/variables/pool-providers.yml new file mode 100644 index 000000000000..1f308b24efc4 --- /dev/null +++ b/eng/common/templates-official/variables/pool-providers.yml @@ -0,0 +1,45 @@ +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. + +# Motivation: +# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS +# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing +# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. +# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services +# team needs to move resources around and create new and potentially differently-named pools. Using this template +# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. + +# How to use: +# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). +# If we find alternate naming conventions in broad usage it can be added to the condition below. +# +# First, import the template in an arcade-ified repo to pick up the variables, e.g.: +# +# variables: +# - template: /eng/common/templates-official/variables/pool-providers.yml +# +# ... then anywhere specifying the pool provider use the runtime variables, +# $(DncEngInternalBuildPool) +# +# pool: +# name: $(DncEngInternalBuildPool) +# image: 1es-windows-2022 + +variables: + # Coalesce the target and source branches so we know when a PR targets a release branch + # If these variables are somehow missing, fall back to main (tends to have more capacity) + + # Any new -Svc alternative pools should have variables added here to allow for splitting work + + - name: DncEngInternalBuildPool + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore1ESPool-Svc-Internal' + ), + False, + 'NetCore1ESPool-Internal' + ) + ] \ No newline at end of file diff --git a/eng/common/templates-official/variables/sdl-variables.yml b/eng/common/templates-official/variables/sdl-variables.yml new file mode 100644 index 000000000000..dbdd66d4a4b3 --- /dev/null +++ b/eng/common/templates-official/variables/sdl-variables.yml @@ -0,0 +1,7 @@ +variables: +# The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in +# sync with the packages.config file. +- name: DefaultGuardianVersion + value: 0.109.0 +- name: GuardianPackagesConfigFile + value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config \ No newline at end of file diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml new file mode 100644 index 000000000000..d1aeb92fcea5 --- /dev/null +++ b/eng/common/templates/job/job.yml @@ -0,0 +1,82 @@ +parameters: + enablePublishBuildArtifacts: false + disableComponentGovernance: '' + componentGovernanceIgnoreDirectories: '' +# Sbom related params + enableSbom: true + runAsPublic: false + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + +jobs: +- template: /eng/common/core-templates/job/job.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ if and(ne(parameter.key, 'steps'), ne(parameter.key, 'is1ESPipeline')) }}: + ${{ parameter.key }}: ${{ parameter.value }} + + steps: + - ${{ each step in parameters.steps }}: + - ${{ step }} + + componentGovernanceSteps: + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false + ${{ else }}: + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} + + artifactPublishSteps: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish pipeline artifacts + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + publishLocation: Container + artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + continueOnError: true + condition: always() + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' + continueOnError: true + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml new file mode 100644 index 000000000000..ff829dc4c700 --- /dev/null +++ b/eng/common/templates/job/onelocbuild.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/onelocbuild.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml new file mode 100644 index 000000000000..ab2edec2adb5 --- /dev/null +++ b/eng/common/templates/job/publish-build-assets.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/publish-build-assets.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml new file mode 100644 index 000000000000..e44d47b1d760 --- /dev/null +++ b/eng/common/templates/job/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml new file mode 100644 index 000000000000..89f3291593cb --- /dev/null +++ b/eng/common/templates/job/source-index-stage1.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/job/source-index-stage1.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/codeql-build.yml b/eng/common/templates/jobs/codeql-build.yml new file mode 100644 index 000000000000..517f24d6a52c --- /dev/null +++ b/eng/common/templates/jobs/codeql-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/codeql-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml new file mode 100644 index 000000000000..388e9037b3e6 --- /dev/null +++ b/eng/common/templates/jobs/jobs.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/jobs.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml new file mode 100644 index 000000000000..818d4c326dbb --- /dev/null +++ b/eng/common/templates/jobs/source-build.yml @@ -0,0 +1,7 @@ +jobs: +- template: /eng/common/core-templates/jobs/source-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml new file mode 100644 index 000000000000..7fa105875592 --- /dev/null +++ b/eng/common/templates/post-build/common-variables.yml @@ -0,0 +1,8 @@ +variables: +- template: /eng/common/core-templates/post-build/common-variables.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml new file mode 100644 index 000000000000..53ede714bdd2 --- /dev/null +++ b/eng/common/templates/post-build/post-build.yml @@ -0,0 +1,8 @@ +stages: +- template: /eng/common/core-templates/post-build/post-build.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml new file mode 100644 index 000000000000..a79fab5b441e --- /dev/null +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -0,0 +1,8 @@ +steps: +- template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + # Specifies whether to use 1ES + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/component-governance.yml b/eng/common/templates/steps/component-governance.yml new file mode 100644 index 000000000000..c12a5f8d21d7 --- /dev/null +++ b/eng/common/templates/steps/component-governance.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/enable-internal-runtimes.yml b/eng/common/templates/steps/enable-internal-runtimes.yml new file mode 100644 index 000000000000..b21a8038cc1c --- /dev/null +++ b/eng/common/templates/steps/enable-internal-runtimes.yml @@ -0,0 +1,10 @@ +# Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' +# variable with the base64-encoded SAS token, by default + +steps: +- template: /eng/common/core-templates/steps/enable-internal-runtimes.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/enable-internal-sources.yml b/eng/common/templates/steps/enable-internal-sources.yml new file mode 100644 index 000000000000..5f87e9abb8aa --- /dev/null +++ b/eng/common/templates/steps/enable-internal-sources.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/enable-internal-sources.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/generate-sbom.yml b/eng/common/templates/steps/generate-sbom.yml new file mode 100644 index 000000000000..26dc00a2e0f3 --- /dev/null +++ b/eng/common/templates/steps/generate-sbom.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/generate-sbom.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/get-delegation-sas.yml b/eng/common/templates/steps/get-delegation-sas.yml new file mode 100644 index 000000000000..83760c9798e3 --- /dev/null +++ b/eng/common/templates/steps/get-delegation-sas.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-delegation-sas.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/get-federated-access-token.yml b/eng/common/templates/steps/get-federated-access-token.yml new file mode 100644 index 000000000000..31e151d9d9e7 --- /dev/null +++ b/eng/common/templates/steps/get-federated-access-token.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/get-federated-access-token.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} \ No newline at end of file diff --git a/eng/common/templates/steps/publish-build-artifacts.yml b/eng/common/templates/steps/publish-build-artifacts.yml new file mode 100644 index 000000000000..6428a98dfef6 --- /dev/null +++ b/eng/common/templates/steps/publish-build-artifacts.yml @@ -0,0 +1,40 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: displayName + type: string + default: 'Publish to Build Artifact' + +- name: condition + type: string + default: succeeded() + +- name: artifactName + type: string + +- name: pathToPublish + type: string + +- name: continueOnError + type: boolean + default: false + +- name: publishLocation + type: string + default: 'Container' + +steps: +- ${{ if eq(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates cannot be referenced from a 1ES managed template': error +- task: PublishBuildArtifacts@1 + displayName: ${{ parameters.displayName }} + condition: ${{ parameters.condition }} + ${{ if parameters.continueOnError }}: + continueOnError: ${{ parameters.continueOnError }} + inputs: + PublishLocation: ${{ parameters.publishLocation }} + PathtoPublish: ${{ parameters.pathToPublish }} + ${{ if parameters.artifactName }}: + ArtifactName: ${{ parameters.artifactName }} \ No newline at end of file diff --git a/eng/common/templates/steps/publish-logs.yml b/eng/common/templates/steps/publish-logs.yml new file mode 100644 index 000000000000..4ea86bd88235 --- /dev/null +++ b/eng/common/templates/steps/publish-logs.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/publish-pipeline-artifacts.yml b/eng/common/templates/steps/publish-pipeline-artifacts.yml new file mode 100644 index 000000000000..5dd698b212fc --- /dev/null +++ b/eng/common/templates/steps/publish-pipeline-artifacts.yml @@ -0,0 +1,34 @@ +parameters: +- name: is1ESPipeline + type: boolean + default: false + +- name: args + type: object + default: {} + +steps: +- ${{ if eq(parameters.is1ESPipeline, true) }}: + - 'eng/common/templates cannot be referenced from a 1ES managed template': error +- task: PublishPipelineArtifact@1 + displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} + ${{ if parameters.args.condition }}: + condition: ${{ parameters.args.condition }} + ${{ else }}: + condition: succeeded() + ${{ if parameters.args.continueOnError }}: + continueOnError: ${{ parameters.args.continueOnError }} + inputs: + targetPath: ${{ parameters.args.targetPath }} + ${{ if parameters.args.artifactName }}: + artifactName: ${{ parameters.args.artifactName }} + ${{ if parameters.args.publishLocation }}: + publishLocation: ${{ parameters.args.publishLocation }} + ${{ if parameters.args.fileSharePath }}: + fileSharePath: ${{ parameters.args.fileSharePath }} + ${{ if parameters.args.Parallel }}: + parallel: ${{ parameters.args.Parallel }} + ${{ if parameters.args.parallelCount }}: + parallelCount: ${{ parameters.args.parallelCount }} + ${{ if parameters.args.properties }}: + properties: ${{ parameters.args.properties }} \ No newline at end of file diff --git a/eng/common/templates/steps/retain-build.yml b/eng/common/templates/steps/retain-build.yml new file mode 100644 index 000000000000..8e841ace3d29 --- /dev/null +++ b/eng/common/templates/steps/retain-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/retain-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml new file mode 100644 index 000000000000..39f99fc2762d --- /dev/null +++ b/eng/common/templates/steps/send-to-helix.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/send-to-helix.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml new file mode 100644 index 000000000000..23c1d6f4e9f8 --- /dev/null +++ b/eng/common/templates/steps/source-build.yml @@ -0,0 +1,7 @@ +steps: +- template: /eng/common/core-templates/steps/source-build.yml + parameters: + is1ESPipeline: false + + ${{ each parameter in parameters }}: + ${{ parameter.key }}: ${{ parameter.value }} diff --git a/eng/common/templates/variables/pool-providers.yml b/eng/common/templates/variables/pool-providers.yml new file mode 100644 index 000000000000..e0b19c14a073 --- /dev/null +++ b/eng/common/templates/variables/pool-providers.yml @@ -0,0 +1,59 @@ +# Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool, +# otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches. + +# Motivation: +# Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS +# (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing +# (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS. +# Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services +# team needs to move resources around and create new and potentially differently-named pools. Using this template +# file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming. + +# How to use: +# This yaml assumes your shipped product branches use the naming convention "release/..." (which many do). +# If we find alternate naming conventions in broad usage it can be added to the condition below. +# +# First, import the template in an arcade-ified repo to pick up the variables, e.g.: +# +# variables: +# - template: /eng/common/templates/variables/pool-providers.yml +# +# ... then anywhere specifying the pool provider use the runtime variables, +# $(DncEngInternalBuildPool) and $ (DncEngPublicBuildPool), e.g.: +# +# pool: +# name: $(DncEngInternalBuildPool) +# demands: ImageOverride -equals windows.vs2019.amd64 +variables: + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - template: /eng/common/templates-official/variables/pool-providers.yml + - ${{ else }}: + # Coalesce the target and source branches so we know when a PR targets a release branch + # If these variables are somehow missing, fall back to main (tends to have more capacity) + + # Any new -Svc alternative pools should have variables added here to allow for splitting work + - name: DncEngPublicBuildPool + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore-Svc-Public' + ), + False, + 'NetCore-Public' + ) + ] + + - name: DncEngInternalBuildPool + value: $[ + replace( + replace( + eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'), + True, + 'NetCore1ESPool-Svc-Internal' + ), + False, + 'NetCore1ESPool-Internal' + ) + ] diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index a4745b344456..22954477a574 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -65,6 +65,11 @@ $ErrorActionPreference = 'Stop' # Base-64 encoded SAS token that has permission to storage container described by $runtimeSourceFeed [string]$runtimeSourceFeedKey = if (Test-Path variable:runtimeSourceFeedKey) { $runtimeSourceFeedKey } else { $null } +# True if the build is a product build +[bool]$productBuild = if (Test-Path variable:productBuild) { $productBuild } else { $false } + +[String[]]$properties = if (Test-Path variable:properties) { $properties } else { @() } + function Create-Directory ([string[]] $path) { New-Item -Path $path -Force -ItemType 'Directory' | Out-Null } @@ -158,19 +163,11 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { $env:DOTNET_MULTILEVEL_LOOKUP=0 # Disable first run since we do not need all ASP.NET packages restored. - $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + $env:DOTNET_NOLOGO=1 # Disable telemetry on CI. if ($ci) { $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 - - # In case of network error, try to log the current IP for reference - Try-LogClientIpAddress - } - - # Source Build uses DotNetCoreSdkDir variable - if ($env:DotNetCoreSdkDir -ne $null) { - $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir } # Find the first path on %PATH% that contains the dotnet.exe @@ -231,7 +228,7 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { Write-PipelinePrependPath -Path $dotnetRoot Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' - Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' + Write-PipelineSetVariable -Name 'DOTNET_NOLOGO' -Value '1' return $global:_DotNetInstallDir = $dotnetRoot } @@ -257,7 +254,6 @@ function Retry($downloadBlock, $maxRetries = 5) { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to download file in $maxRetries attempts." break } - } } @@ -290,6 +286,25 @@ function InstallDotNet([string] $dotnetRoot, [string] $runtimeSourceFeedKey = '', [switch] $noPath) { + $dotnetVersionLabel = "'sdk v$version'" + + if ($runtime -ne '' -and $runtime -ne 'sdk') { + $runtimePath = $dotnetRoot + $runtimePath = $runtimePath + "\shared" + if ($runtime -eq "dotnet") { $runtimePath = $runtimePath + "\Microsoft.NETCore.App" } + if ($runtime -eq "aspnetcore") { $runtimePath = $runtimePath + "\Microsoft.AspNetCore.App" } + if ($runtime -eq "windowsdesktop") { $runtimePath = $runtimePath + "\Microsoft.WindowsDesktop.App" } + $runtimePath = $runtimePath + "\" + $version + + $dotnetVersionLabel = "runtime toolset '$runtime/$architecture v$version'" + + if (Test-Path $runtimePath) { + Write-Host " Runtime toolset '$runtime/$architecture v$version' already installed." + $installSuccess = $true + Exit + } + } + $installScript = GetDotNetInstallScript $dotnetRoot $installParameters = @{ Version = $version @@ -301,32 +316,45 @@ function InstallDotNet([string] $dotnetRoot, if ($skipNonVersionedFiles) { $installParameters.SkipNonVersionedFiles = $skipNonVersionedFiles } if ($noPath) { $installParameters.NoPath = $True } - try { - & $installScript @installParameters - } - catch { - if ($runtimeSourceFeed -or $runtimeSourceFeedKey) { - Write-Host "Failed to install dotnet from public location. Trying from '$runtimeSourceFeed'" - if ($runtimeSourceFeed) { $installParameters.AzureFeed = $runtimeSourceFeed } + $variations = @() + $variations += @($installParameters) - if ($runtimeSourceFeedKey) { - $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) - $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) - $installParameters.FeedCredential = $decodedString - } + $dotnetBuilds = $installParameters.Clone() + $dotnetbuilds.AzureFeed = "https://dotnetbuilds.azureedge.net/public" + $variations += @($dotnetBuilds) - try { - & $installScript @installParameters - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from custom location '$runtimeSourceFeed'." - ExitWithExitCode 1 - } + if ($runtimeSourceFeed) { + $runtimeSource = $installParameters.Clone() + $runtimeSource.AzureFeed = $runtimeSourceFeed + if ($runtimeSourceFeedKey) { + $decodedBytes = [System.Convert]::FromBase64String($runtimeSourceFeedKey) + $decodedString = [System.Text.Encoding]::UTF8.GetString($decodedBytes) + $runtimeSource.FeedCredential = $decodedString + } + $variations += @($runtimeSource) + } + + $installSuccess = $false + foreach ($variation in $variations) { + if ($variation | Get-Member AzureFeed) { + $location = $variation.AzureFeed } else { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet from public location." - ExitWithExitCode 1 + $location = "public location"; + } + Write-Host " Attempting to install $dotnetVersionLabel from $location." + try { + & $installScript @variation + $installSuccess = $true + break + } + catch { + Write-Host " Failed to install $dotnetVersionLabel from $location." } } + if (-not $installSuccess) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install $dotnetVersionLabel from any of the specified locations." + ExitWithExitCode 1 + } } # @@ -350,15 +378,22 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = } # Minimum VS version to require. - $vsMinVersionReqdStr = '16.8' + $vsMinVersionReqdStr = '17.7' $vsMinVersionReqd = [Version]::new($vsMinVersionReqdStr) # If the version of msbuild is going to be xcopied, # use this version. Version matches a package here: - # https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=16.10.0-preview2&view=overview - $defaultXCopyMSBuildVersion = '16.10.0-preview2' + # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/17.10.0-pre.4.0 + $defaultXCopyMSBuildVersion = '17.10.0-pre.4.0' - if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } + if (!$vsRequirements) { + if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { + $vsRequirements = $GlobalJson.tools.vs + } + else { + $vsRequirements = New-Object PSObject -Property @{ version = $vsMinVersionReqdStr } + } + } $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { $vsMinVersionReqdStr } $vsMinVersion = [Version]::new($vsMinVersionStr) @@ -382,12 +417,12 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # Locate Visual Studio installation or download x-copy msbuild. $vsInfo = LocateVisualStudio $vsRequirements if ($vsInfo -ne $null) { - $vsInstallDir = $vsInfo.installationPath + # Ensure vsInstallDir has a trailing slash + $vsInstallDir = Join-Path $vsInfo.installationPath "\" $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion } else { - if (Get-Member -InputObject $GlobalJson.tools -Name 'xcopy-msbuild') { $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] @@ -396,6 +431,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if($vsMinVersion -lt $vsMinVersionReqd){ Write-Host "Using xcopy-msbuild version of $defaultXCopyMSBuildVersion since VS version $vsMinVersionStr provided in global.json is not compatible" $xcopyMSBuildVersion = $defaultXCopyMSBuildVersion + $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] } else{ # If the VS version IS compatible, look for an xcopy msbuild package @@ -412,7 +448,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if ($xcopyMSBuildVersion.Trim() -ine "none") { $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install if ($vsInstallDir -eq $null) { - throw "Could not xcopy msbuild. Please check that package 'RoslynTools.MSBuild @ $xcopyMSBuildVersion' exists on feed 'dotnet-eng'." + throw "Could not xcopy msbuild. Please check that package 'Microsoft.DotNet.Arcade.MSBuild.Xcopy @ $xcopyMSBuildVersion' exists on feed 'dotnet-eng'." } } if ($vsInstallDir -eq $null) { @@ -449,7 +485,7 @@ function InstallXCopyMSBuild([string]$packageVersion) { } function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { - $packageName = 'RoslynTools.MSBuild' + $packageName = 'Microsoft.DotNet.Arcade.MSBuild.Xcopy' $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" @@ -466,6 +502,10 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { Invoke-WebRequest "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/flat2/$packageName/$packageVersion/$packageName.$packageVersion.nupkg" -OutFile $packagePath }) + if (!(Test-Path $packagePath)) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "See https://dev.azure.com/dnceng/internal/_wiki/wikis/DNCEng%20Services%20Wiki/1074/Updating-Microsoft.DotNet.Arcade.MSBuild.Xcopy-WAS-RoslynTools.MSBuild-(xcopy-msbuild)-generation?anchor=troubleshooting for help troubleshooting issues with XCopy MSBuild" + throw + } Unzip $packagePath $packageDir } @@ -563,7 +603,15 @@ function InitializeBuildTool() { ExitWithExitCode 1 } $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') - $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp3.1' } + + # Use override if it exists - commonly set by source-build + if ($null -eq $env:_OverrideArcadeInitializeBuildToolFramework) { + $initializeBuildToolFramework="net9.0" + } else { + $initializeBuildToolFramework=$env:_OverrideArcadeInitializeBuildToolFramework + } + + $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = $initializeBuildToolFramework } } elseif ($msbuildEngine -eq "vs") { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore @@ -605,7 +653,7 @@ function GetNuGetPackageCachePath() { $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\' } else { $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\' - $env:RESTORENOCACHE = $true + $env:RESTORENOHTTPCACHE = $true } } @@ -625,24 +673,38 @@ function InitializeNativeTools() { InstallDirectory = "$ToolsDir" } } + if ($env:NativeToolsOnMachine) { + Write-Host "Variable NativeToolsOnMachine detected, enabling native tool path promotion..." + $nativeArgs += @{ PathPromotion = $true } + } & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs } } +function Read-ArcadeSdkVersion() { + return $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' +} + function InitializeToolset() { - if (Test-Path variable:global:_ToolsetBuildProj) { - return $global:_ToolsetBuildProj + # For Unified Build/Source-build support, check whether the environment variable is + # set. If it is, then use this as the toolset build project. + if ($env:_InitializeToolset -ne $null) { + return $global:_InitializeToolset = $env:_InitializeToolset + } + + if (Test-Path variable:global:_InitializeToolset) { + return $global:_InitializeToolset } $nugetCache = GetNuGetPackageCachePath - $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' + $toolsetVersion = Read-ArcadeSdkVersion $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" if (Test-Path $toolsetLocationFile) { $path = Get-Content $toolsetLocationFile -TotalCount 1 if (Test-Path $path) { - return $global:_ToolsetBuildProj = $path + return $global:_InitializeToolset = $path } } @@ -665,7 +727,7 @@ function InitializeToolset() { throw "Invalid toolset path: $path" } - return $global:_ToolsetBuildProj = $path + return $global:_InitializeToolset = $path } function ExitWithExitCode([int] $exitCode) { @@ -717,10 +779,10 @@ function MSBuild() { # new scripts need to work with old packages, so we need to look for the old names/versions (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll')), (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll')), - (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.ArcadeLogging.dll')), - (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll')) - (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')), - (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll')) + (Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.ArcadeLogging.dll')), + (Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.Arcade.Sdk.dll')), + (Join-Path $basePath (Join-Path net8.0 'Microsoft.DotNet.ArcadeLogging.dll')), + (Join-Path $basePath (Join-Path net8.0 'Microsoft.DotNet.Arcade.Sdk.dll')) ) $selectedPath = $null foreach ($path in $possiblePaths) { @@ -779,7 +841,8 @@ function MSBuild-Core() { } } - $env:ARCADE_BUILD_TOOL_COMMAND = "$($buildTool.Path) $cmdArgs" + # Be sure quote the path in case there are spaces in the dotnet installation location. + $env:ARCADE_BUILD_TOOL_COMMAND = "`"$($buildTool.Path)`" $cmdArgs" $exitCode = Exec-Process $buildTool.Path $cmdArgs @@ -793,7 +856,9 @@ function MSBuild-Core() { Write-Host "See log: $buildLog" -ForegroundColor DarkGray } - if ($ci) { + # When running on Azure Pipelines, override the returned exit code to avoid double logging. + # Skip this when the build is a child of the VMR orchestrator build. + if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$productBuild -and -not($properties -like "*DotNetBuildRepo=true*")) { Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error @@ -835,7 +900,7 @@ function IsWindowsPlatform() { } function Get-Darc($version) { - $darcPath = "$TempDir\darc\$(New-Guid)" + $darcPath = "$TempDir\darc\$([guid]::NewGuid())" if ($version -ne $null) { & $PSScriptRoot\darc-init.ps1 -toolpath $darcPath -darcVersion $version | Out-Host } else { @@ -882,35 +947,19 @@ if (!$disableConfigureToolsetImport) { } } -function Try-LogClientIpAddress() -{ - Write-Host "Attempting to log this client's IP for Azure Package feed telemetry purposes" - try - { - $result = Invoke-WebRequest -Uri "http://co1.msedge.net/fdv2/diagnostics.aspx" -UseBasicParsing - $lines = $result.Content.Split([Environment]::NewLine) - $socketIp = $lines | Select-String -Pattern "^Socket IP:.*" - Write-Host $socketIp - $clientIp = $lines | Select-String -Pattern "^Client IP:.*" - Write-Host $clientIp - } - catch - { - Write-Host "Unable to get this machine's effective IP address for logging: $_" - } -} - # # If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic. # function Enable-Nuget-EnhancedRetry() { if ($ci) { Write-Host "Setting NUGET enhanced retry environment variables" - $env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true' - $env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6 - $env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 - Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true' - Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6' - Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' - } -} \ No newline at end of file + $env:NUGET_ENABLE_ENHANCED_HTTP_RETRY = 'true' + $env:NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT = 6 + $env:NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 + $env:NUGET_RETRY_HTTP_429 = 'true' + Write-PipelineSetVariable -Name 'NUGET_ENABLE_ENHANCED_HTTP_RETRY' -Value 'true' + Write-PipelineSetVariable -Name 'NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT' -Value '6' + Write-PipelineSetVariable -Name 'NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' + Write-PipelineSetVariable -Name 'NUGET_RETRY_HTTP_429' -Value 'true' + } +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh index bd89e2a2c952..00473c9f918d 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -68,6 +68,9 @@ fi runtime_source_feed=${runtime_source_feed:-''} runtime_source_feed_key=${runtime_source_feed_key:-''} +# True if the build is a product build +product_build=${product_build:-false} + # Resolve any symlinks in the given path. function ResolvePath { local path=$1 @@ -112,7 +115,7 @@ function InitializeDotNetCli { export DOTNET_MULTILEVEL_LOOKUP=0 # Disable first run since we want to control all package sources - export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + export DOTNET_NOLOGO=1 # Disable telemetry on CI if [[ $ci == true ]]; then @@ -123,11 +126,6 @@ function InitializeDotNetCli { # so it doesn't output warnings to the console. export LTTNG_HOME="$HOME" - # Source Build uses DotNetCoreSdkDir variable - if [[ -n "${DotNetCoreSdkDir:-}" ]]; then - export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" - fi - # Find the first path on $PATH that contains the dotnet.exe if [[ "$use_installed_dotnet_cli" == true && $global_json_has_runtimes == false && -z "${DOTNET_INSTALL_DIR:-}" ]]; then local dotnet_path=`command -v dotnet` @@ -146,7 +144,7 @@ function InitializeDotNetCli { if [[ $global_json_has_runtimes == false && -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then dotnet_root="$DOTNET_INSTALL_DIR" else - dotnet_root="$repo_root/.dotnet" + dotnet_root="${repo_root}.dotnet" export DOTNET_INSTALL_DIR="$dotnet_root" @@ -165,7 +163,7 @@ function InitializeDotNetCli { Write-PipelinePrependPath -path "$dotnet_root" Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0" - Write-PipelineSetVariable -name "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value "1" + Write-PipelineSetVariable -name "DOTNET_NOLOGO" -value "1" # return value _InitializeDotNetCli="$dotnet_root" @@ -178,38 +176,68 @@ function InstallDotNetSdk { if [[ $# -ge 3 ]]; then architecture=$3 fi - InstallDotNet "$root" "$version" $architecture 'sdk' 'false' $runtime_source_feed $runtime_source_feed_key + InstallDotNet "$root" "$version" $architecture 'sdk' 'true' $runtime_source_feed $runtime_source_feed_key } function InstallDotNet { local root=$1 local version=$2 + local runtime=$4 + + local dotnetVersionLabel="'$runtime v$version'" + if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then + runtimePath="$root" + runtimePath="$runtimePath/shared" + case "$runtime" in + dotnet) + runtimePath="$runtimePath/Microsoft.NETCore.App" + ;; + aspnetcore) + runtimePath="$runtimePath/Microsoft.AspNetCore.App" + ;; + windowsdesktop) + runtimePath="$runtimePath/Microsoft.WindowsDesktop.App" + ;; + *) + ;; + esac + runtimePath="$runtimePath/$version" + + dotnetVersionLabel="runtime toolset '$runtime/$architecture v$version'" + + if [ -d "$runtimePath" ]; then + echo " Runtime toolset '$runtime/$architecture v$version' already installed." + local installSuccess=1 + return + fi + fi GetDotNetInstallScript "$root" local install_script=$_GetDotNetInstallScript - local archArg='' + local installParameters=(--version $version --install-dir "$root") + if [[ -n "${3:-}" ]] && [ "$3" != 'unset' ]; then - archArg="--architecture $3" + installParameters+=(--architecture $3) fi - local runtimeArg='' if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then - runtimeArg="--runtime $4" + installParameters+=(--runtime $4) fi - local skipNonVersionedFilesArg="" if [[ "$#" -ge "5" ]] && [[ "$5" != 'false' ]]; then - skipNonVersionedFilesArg="--skip-non-versioned-files" + installParameters+=(--skip-non-versioned-files) fi - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { - local exit_code=$? - echo "Failed to install dotnet SDK from public location (exit code '$exit_code')." - local runtimeSourceFeed='' - if [[ -n "${6:-}" ]]; then - runtimeSourceFeed="--azure-feed $6" - fi + local variations=() # list of variable names with parameter arrays in them - local runtimeSourceFeedKey='' + local public_location=("${installParameters[@]}") + variations+=(public_location) + + local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://dotnetbuilds.azureedge.net/public") + variations+=(dotnetbuilds) + + if [[ -n "${6:-}" ]]; then + variations+=(private_feed) + local private_feed=("${installParameters[@]}" --azure-feed $6) if [[ -n "${7:-}" ]]; then # The 'base64' binary on alpine uses '-d' and doesn't support '--decode' # '-d'. To work around this, do a simple detection and switch the parameter @@ -219,22 +247,27 @@ function InstallDotNet { decodeArg="-d" fi decodedFeedKey=`echo $7 | base64 $decodeArg` - runtimeSourceFeedKey="--feed-credential $decodedFeedKey" + private_feed+=(--feed-credential $decodedFeedKey) fi + fi - if [[ -n "$runtimeSourceFeed" || -n "$runtimeSourceFeedKey" ]]; then - bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg $runtimeSourceFeed $runtimeSourceFeedKey || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - else - if [[ $exit_code != 0 ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from public location (exit code '$exit_code')." - fi - ExitWithExitCode $exit_code + local installSuccess=0 + for variationName in "${variations[@]}"; do + local name="$variationName[@]" + local variation=("${!name}") + echo " Attempting to install $dotnetVersionLabel from $variationName." + bash "$install_script" "${variation[@]}" && installSuccess=1 + if [[ "$installSuccess" -eq 1 ]]; then + break fi - } + + echo " Failed to install $dotnetVersionLabel from $variationName." + done + + if [[ "$installSuccess" -eq 0 ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install $dotnetVersionLabel from any of the specified locations." + ExitWithExitCode 1 + fi } function with_retries { @@ -275,7 +308,7 @@ function GetDotNetInstallScript { curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { if command -v openssl &> /dev/null; then echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation" - echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 + echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 || true fi echo "Will now retry the same URL with verbose logging." with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || { @@ -306,17 +339,22 @@ function InitializeBuildTool { # return values _InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildToolCommand="msbuild" - _InitializeBuildToolFramework="netcoreapp3.1" + # use override if it exists - commonly set by source-build + if [[ "${_OverrideArcadeInitializeBuildToolFramework:-x}" == "x" ]]; then + _InitializeBuildToolFramework="net9.0" + else + _InitializeBuildToolFramework="${_OverrideArcadeInitializeBuildToolFramework}" + fi } -# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116 +# Set RestoreNoHttpCache as a workaround for https://github.com/NuGet/Home/issues/3116 function GetNuGetPackageCachePath { if [[ -z ${NUGET_PACKAGES:-} ]]; then if [[ "$use_global_nuget_cache" == true ]]; then - export NUGET_PACKAGES="$HOME/.nuget/packages" + export NUGET_PACKAGES="$HOME/.nuget/packages/" else - export NUGET_PACKAGES="$repo_root/.packages" - export RESTORENOCACHE=true + export NUGET_PACKAGES="$repo_root/.packages/" + export RESTORENOHTTPCACHE=true fi fi @@ -399,15 +437,8 @@ function StopProcesses { return 0 } -function TryLogClientIpAddress () { - echo 'Attempting to log this client''s IP for Azure Package feed telemetry purposes' - if command -v curl > /dev/null; then - curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: ' || true - fi -} - function MSBuild { - local args=$@ + local args=( "$@" ) if [[ "$pipelines_log" == true ]]; then InitializeBuildTool InitializeToolset @@ -417,13 +448,6 @@ function MSBuild { export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" - - export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true - export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6 - export NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS=1000 - Write-PipelineSetVariable -name "NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY" -value "true" - Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT" -value "6" - Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS" -value "1000" fi local toolset_dir="${_InitializeToolset%/*}" @@ -432,10 +456,10 @@ function MSBuild { local possiblePaths=() possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll" ) possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.ArcadeLogging.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" ) - possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" ) + possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" ) + possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.Arcade.Sdk.dll" ) for path in "${possiblePaths[@]}"; do if [[ -f $path ]]; then selectedPath=$path @@ -449,7 +473,7 @@ function MSBuild { args+=( "-logger:$selectedPath" ) fi - MSBuild-Core ${args[@]} + MSBuild-Core "${args[@]}" } function MSBuild-Core { @@ -480,7 +504,10 @@ function MSBuild-Core { # We should not Write-PipelineTaskError here because that message shows up in the build summary # The build already logged an error, that's the reason it failed. Producing an error here only adds noise. echo "Build failed with exit code $exit_code. Check errors above." - if [[ "$ci" == "true" ]]; then + + # When running on Azure Pipelines, override the returned exit code to avoid double logging. + # Skip this when the build is a child of the VMR orchestrator build. + if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$product_build" != true && "$properties" != *"DotNetBuildRepo=true"* ]]; then Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error @@ -494,6 +521,17 @@ function MSBuild-Core { RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } +function GetDarc { + darc_path="$temp_dir/darc" + version="$1" + + if [[ -n "$version" ]]; then + version="--darcversion $version" + fi + + "$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version +} + ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` @@ -512,7 +550,7 @@ global_json_file="${repo_root}global.json" # determine if global.json contains a "runtimes" entry global_json_has_runtimes=false if command -v jq &> /dev/null; then - if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then + if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then global_json_has_runtimes=true fi elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then @@ -548,4 +586,4 @@ fi # Remove once repos are updated. if [[ -n "${useInstalledDotNetCli:-}" ]]; then use_installed_dotnet_cli="$useInstalledDotNetCli" -fi \ No newline at end of file +fi diff --git a/external/macios-binaries b/external/macios-binaries deleted file mode 160000 index 7813391e75d7..000000000000 --- a/external/macios-binaries +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7813391e75d7373ee073ef2d5716e3c607c8636a diff --git a/external/opentk b/external/opentk deleted file mode 160000 index 396bc90c7ac2..000000000000 --- a/external/opentk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 396bc90c7ac2e7ce442840a5e8bd91e5e79b381e diff --git a/fsharp/.gitignore b/fsharp/.gitignore deleted file mode 100644 index ee3d10ec8d6b..000000000000 --- a/fsharp/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -build.stamp -Makefile.inc -fsharp - diff --git a/fsharp/Makefile b/fsharp/Makefile deleted file mode 100644 index 6930e8414c92..000000000000 --- a/fsharp/Makefile +++ /dev/null @@ -1,214 +0,0 @@ -TOP=.. -include $(TOP)/Make.config - -# By default we'll get the F# binaries from the macios-binaries repository. -# It's still possible to build from source, by passing "FSHARP_BUILD_FROM_SOURCE=1" when building, -# which will automatically clone the fsharp repository, and build what's needed. -# The FSHARP_SOURCE_HASH variable below defines which fsharp hash to build. - -FSHARP_SOURCE_HASH=7171700877115e2243b4edbc4e2eb88d019e02b0 -FSHARP_SOURCE_BRANCH=master - -FSHARP_BINARIES_PATH=$(abspath $(MACIOS_BINARIES_PATH)/fsharp) -FSHARP_SOURCE_PATH=$(abspath $(CURDIR)/fsharp) - -ifeq ($(FSHARP_BUILD_FROM_SOURCE),) -FSHARP_PATH=$(FSHARP_BINARIES_PATH) -FSHARP_BUILD_PATH=$(FSHARP_BINARIES_PATH) -else -FSHARP_PATH=$(FSHARP_SOURCE_PATH) -FSHARP_BUILD_PATH=build - -# Create a list of all the source files in the fsharp repo to use as dependencies. -# But skip any files with spaces, because make + spaces is not a good combination. -Makefile.inc: $(FSHARP_SOURCE_PATH) - $(Q) printf "FSHARP_FILES := \\\\\\n" >> $@.tmp - $(Q) git --git-dir=$(FSHARP_SOURCE_PATH)/.git --work-tree=$(FSHARP_SOURCE_PATH) ls-tree --full-tree -r HEAD --name-only | grep -v ' ' | sed -e 's_^\(.*\)_ $(FSHARP_SOURCE_PATH)/\1 \\_' >> $@.tmp - $(Q) mv $@.tmp $@ --include Makefile.inc -endif - -FSHARP_TARGET_FILES = \ - FSharp.Core.dll \ - FSharp.Core.dll.mdb \ - FSharp.Core.optdata \ - FSharp.Core.sigdata \ - FSharp.Core.xml \ - -$(FSHARP_SOURCE_PATH): - $(Q) echo "Cloning the fsharp repository..." - $(Q) git clone -q https://github.com/fsharp/fsharp fsharp - $(Q) cd fsharp && git checkout $(FSHARP_SOURCE_BRANCH) && git reset --hard $(FSHARP_SOURCE_HASH) - -BIN_DIR=$(FSHARP_PATH)/lib/release -IOS_BIN_DIR = $(FSHARP_PATH)/lib/release/monotouch -WATCH_BIN_DIR = $(FSHARP_PATH)/lib/release/xamarinwatchos -TVOS_BIN_DIR = $(FSHARP_PATH)/lib/release/xamarintvos -MAC_MOBILE_BIN_DIR = $(FSHARP_PATH)/lib/release/xamarinmacmobile -MAC_45_BIN_DIR = $(FSHARP_PATH)/lib/release/xamarinmacfull - -# Xamarin.iOS - -IOS_FSHARP_TARGETS = \ - $(foreach file,$(FSHARP_TARGET_FILES),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/$(file)) \ - $(foreach file,$(FSHARP_TARGET_FILES),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/$(file)) \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/LICENSE-fsharp \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/LICENSE-fsharp \ - -IOS_FSHARP_DIRECTORIES = \ - build/monotouch \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS \ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/LICENSE-fsharp: $(FSHARP_PATH)/LICENSE | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/%.dll: $(FSHARP_BUILD_PATH)/monotouch/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/%: $(IOS_BIN_DIR)/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/LICENSE-fsharp: $(FSHARP_PATH)/LICENSE | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/%.dll: $(FSHARP_BUILD_PATH)/monotouch/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/%: $(IOS_BIN_DIR)/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS - $(Q) install -m 0644 $< $@ - -# Xamarin.WatchOS - - -WATCH_FSHARP_TARGETS = \ - $(foreach file,$(FSHARP_TARGET_FILES),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/$(file)) \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/LICENSE-fsharp \ - -WATCH_FSHARP_DIRECTORIES = \ - build/xamarinwatchos \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS \ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/LICENSE-fsharp: $(FSHARP_PATH)/LICENSE | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/%.dll: $(FSHARP_BUILD_PATH)/xamarinwatchos/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/%: $(WATCH_BIN_DIR)/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS - $(Q) install -m 0644 $< $@ - -# Xamarin.TVOS - - -TVOS_FSHARP_TARGETS = \ - $(foreach file,$(FSHARP_TARGET_FILES),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/$(file)) \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/LICENSE-fsharp \ - -TVOS_FSHARP_DIRECTORIES = \ - build/xamarintvos \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS \ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/LICENSE-fsharp: $(FSHARP_PATH)/LICENSE | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/%.dll: $(FSHARP_BUILD_PATH)/xamarintvos/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/%: $(TVOS_BIN_DIR)/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS - $(Q) install -m 0644 $< $@ - -# Xamarin.Mac - -MAC_FSHARP_TARGETS = \ - $(foreach file,$(FSHARP_TARGET_FILES),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/$(file)) \ - $(foreach file,$(FSHARP_TARGET_FILES),$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/$(file)) \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/LICENSE-fsharp \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/LICENSE-fsharp \ - -MAC_FSHARP_DIRECTORIES = \ - build/xamarinmacfull \ - build/xamarinmacmobile \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac \ - -## XM full - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/LICENSE-fsharp: $(FSHARP_PATH)/LICENSE | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/%.dll: $(FSHARP_BUILD_PATH)/xamarinmacfull/%.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/%: $(MAC_45_BIN_DIR)/% | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 - $(Q) install -m 0644 $< $@ - -## XM mobile - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/LICENSE-fsharp: $(FSHARP_PATH)/LICENSE | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/%.dll: $(FSHARP_BUILD_PATH)/xamarinmacmobile/%.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/%: $(MAC_MOBILE_BIN_DIR)/% | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac - $(Q) install -m 0644 $< $@ - -# Common - -ifdef INCLUDE_IOS -FSHARP_TARGETS += $(IOS_FSHARP_TARGETS) -FSHARP_DIRECTORIES += $(IOS_FSHARP_DIRECTORIES) -FSHARP_BUILD_TARGETS += only-monotouch -ifdef INCLUDE_WATCH -FSHARP_TARGETS += $(WATCH_FSHARP_TARGETS) -FSHARP_DIRECTORIES += $(WATCH_FSHARP_DIRECTORIES) -FSHARP_BUILD_TARGETS += only-xamarinwatchos -endif -ifdef INCLUDE_TVOS -FSHARP_TARGETS += $(TVOS_FSHARP_TARGETS) -FSHARP_DIRECTORIES += $(TVOS_FSHARP_DIRECTORIES) -FSHARP_BUILD_TARGETS += only-xamarintvos -endif -endif - -ifdef INCLUDE_MAC -FSHARP_TARGETS += $(MAC_FSHARP_TARGETS) -FSHARP_DIRECTORIES += $(MAC_FSHARP_DIRECTORIES) -FSHARP_BUILD_TARGETS += only-xamarinmac -endif - -$(FSHARP_DIRECTORIES): - $(Q) mkdir -p $@ - -### Sign the assemblies. This is done in a temporary directory so that we don't have to re-sign on every install. -build/%.dll: $(BIN_DIR)/%.dll | build/monotouch build/xamarinmacmobile build/xamarinmacfull build/xamarinwatchos build/xamarintvos - $(Q) $(CP) $< $@ - $(Q_SN) MONO_CFG_DIR="$(TOP)" $(SYSTEM_SN) -q -R "$@" "$(PRODUCT_KEY_PATH)" - -build.stamp: export TargetFrameworkFallbackSearchPaths=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -build.stamp: export MSBuildExtensionsPathFallbackPathsOverride=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild -build.stamp: $(FSHARP_FILES) $(FSHARP_PATH)/Makefile - $(MAKE) -C $(FSHARP_PATH)/src/fsharp build-proto - $(MAKE) -C $(FSHARP_PATH)/src/fsharp $(FSHARP_BUILD_TARGETS) - $(Q) touch $@ - -ifneq ($(FSHARP_BUILD_FROM_SOURCE),) -$(FSHARP_TARGETS): build.stamp -endif - -all-local:: $(FSHARP_TARGETS) -install-local:: $(FSHARP_TARGETS) - -$(FSHARP_PATH)/autogen.sh: $(FSHARP_SOURCE_PATH) - -$(FSHARP_PATH)/Makefile: $(FSHARP_PATH)/autogen.sh $(FSHARP_FILES) /Library/Frameworks/Mono.framework/Versions/Current/updateinfo - @echo "Executing autogen for fsharp..." - $(Q) cd $(FSHARP_PATH) && ./autogen.sh --prefix=/Library/Frameworks/Mono.framework/Versions/Current - @echo "Executed autogen for fsharp" - -clean-local:: - git clean -xfd - cd $(FSHARP_PATH) && git clean -xfd - -include $(TOP)/mk/rules.mk diff --git a/global.json b/global.json index 05423157f8e1..8cf0308600ff 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,11 @@ { "sdk": { "version": "9.0.100-rtm.24527.3" + }, + "tools": { + "dotnet": "9.0.100-rtm.24527.3" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24516.2" } } diff --git a/jenkins/add-commit-comment.sh b/jenkins/add-commit-comment.sh deleted file mode 100755 index d3e1471c4fc1..000000000000 --- a/jenkins/add-commit-comment.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -eu - -# Script to add a comment to a commit on GitHub. -# -# Arguments (all required): -# --token=: The GitHub Personal Access Token used to authenticate with GitHub. -# --file=: The file to add as the comment. -# --hash=: The hash to add the comment to. -# - -TOKEN= -FILE= -HASH= -VERBOSE= - -while ! test -z "${1:-}"; do - case "$1" in - --token=*) - TOKEN="${1:8}" - shift - ;; - --token) - TOKEN="$2" - shift 2 - ;; - --file=*) - FILE="${1:7}" - shift - ;; - --file) - FILE="$2" - shift 2 - ;; - --hash=*) - HASH="${1:7}" - shift - ;; - --hash) - HASH="$2" - shift 2 - ;; - -v | --verbose) - VERBOSE=1 - shift - ;; - *) - echo "Unknown argument: $1" - exit 1 - ;; - esac -done - -if test -z "$TOKEN"; then - echo "The GitHub token is required (--token=)" - exit 1 -fi - -if test -z "$FILE"; then - echo "The file to add as a comment is required (--file=)" - exit 1 -elif ! test -f "$FILE"; then - echo "The file $FILE does not exist" - exit 1 -fi - - -if test -z "$HASH"; then - echo "The commit hash is required (--hash=)" - exit 1 -fi - -JSONFILE=$(mktemp) -LOGFILE=$(mktemp) -TMPFILE=$(mktemp) -cleanup () -{ - rm -f "$JSONFILE" "$LOGFILE" "$TMPFILE" -} -trap cleanup ERR -trap cleanup EXIT - -# Cap comment at 32768 characters, to avoid running into GitHub limits. -head -c 32768 "$FILE" > "$TMPFILE" - -printf '{\n"body": ' > "$JSONFILE" -python -c 'import json,sys; print(json.dumps(sys.stdin.read()))' < "$TMPFILE" >> "$JSONFILE" -printf '}\n' >> "$JSONFILE" - -if test -n "$VERBOSE"; then - echo "JSON file:" - sed 's/^/ /' "$JSONFILE"; -fi - -if ! curl -f -v -H "Authorization: token $TOKEN" -H "User-Agent: command line tool" -d "@$JSONFILE" "https://api.github.com/repos/xamarin/xamarin-macios/commits/$HASH/comments" > "$LOGFILE" 2>&1; then - echo "Failed to add commit message." - echo "curl output:" - sed 's/^/ /' "$LOGFILE" - echo "Json body:" - sed 's/^/ /' "$JSONFILE" - exit 1 -else - if test -n "$VERBOSE"; then sed 's/^/ /' "$LOGFILE"; fi - echo "Successfully added commit message to https://github.com/xamarin/xamarin-macios/commit/$HASH" -fi diff --git a/jenkins/add-commit-status.sh b/jenkins/add-commit-status.sh deleted file mode 100755 index a5291b7198cf..000000000000 --- a/jenkins/add-commit-status.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -eu - -# Script to add a status to a commit on GitHub. -# -# Arguments (all required): -# --token=: The GitHub Personal Access Token used to authenticate with GitHub. -# --hash=: The hash to add the comment to. -# --state=: The status state. -# --target-url=: The status url. -# --description=: The status description. -# --context=: The status context. -# - -TOKEN= -HASH= -STATE= -TARGET_URL= -DESCRIPTION= -CONTEXT= -VERBOSE= - -while ! test -z "${1:-}"; do - case "$1" in - --token=*) - TOKEN="${1:8}" - shift - ;; - --token) - TOKEN="$2" - shift 2 - ;; - --hash=*) - HASH="${1:7}" - shift - ;; - --hash) - HASH="$2" - shift 2 - ;; - --state=*) - STATE="${1:8}" - shift - ;; - --state) - STATE="$2" - shift 2 - ;; - --target-url=*) - TARGET_URL="${1:13}" - shift - ;; - --target-url) - TARGET_URL="$2" - shift 2 - ;; - --description=*) - DESCRIPTION="${1:14}" - shift - ;; - --description) - DESCRIPTION="$2" - shift 2 - ;; - --context=*) - CONTEXT="${1:10}" - shift - ;; - --context) - CONTEXT="$2" - shift 2 - ;; - -v | --verbose) - VERBOSE=1 - shift - ;; - *) - echo "Unknown argument: $1" - exit 1 - ;; - esac -done - -if test -z "$TOKEN"; then - echo "The GitHub token is required (--token=)" - exit 1 -fi - -if test -z "$HASH"; then - echo "The commit hash is required (--hash=)" - exit 1 -fi - -if test -z "$STATE"; then - echo "The state of the status is required (--state=)" - exit 1 -fi - -if test -z "$TARGET_URL"; then - echo "The target url of the status is required (--target-url=)" - exit 1 -fi - -if test -z "$DESCRIPTION"; then - echo "The description of the status is required (--description=)" - exit 1 -fi - -if test -z "$CONTEXT"; then - echo "The context of the status is required (--context=)" - exit 1 -fi - -JSONFILE=$(mktemp) -LOGFILE=$(mktemp) -cleanup () -{ - rm -f "$JSONFILE" "$LOGFILE" -} -trap cleanup ERR -trap cleanup EXIT - -( - printf '{\n' - printf "\t\"state\": \"%s\",\n" "$STATE" - printf "\t\"target_url\": \"%s\",\n" "$TARGET_URL" - printf "\t\"description\": %s,\n" "$(echo -n "$DESCRIPTION" | python -c 'import json,sys; print(json.dumps(sys.stdin.read()))')" - printf "\t\"context\": \"%s\"\n" "$CONTEXT" - printf "}\n" -) > "$JSONFILE" - -if test -n "$VERBOSE"; then - echo "JSON file:" - sed 's/^/ /' "$JSONFILE"; -fi - -if ! curl -f -v -H "Authorization: token $TOKEN" -H "User-Agent: command line tool" -d "@$JSONFILE" "https://api.github.com/repos/xamarin/xamarin-macios/statuses/$HASH" > "$LOGFILE" 2>&1; then - echo "Failed to add status." - echo "curl output:" - sed 's/^/ /' "$LOGFILE" - echo "Json body:" - sed 's/^/ /' "$JSONFILE" - exit 1 -else - if test -n "$VERBOSE"; then sed 's/^/ /' "$LOGFILE"; fi - echo "Successfully added status to https://github.com/xamarin/xamarin-macios/commit/$HASH" -fi diff --git a/mac-entitlements.plist b/mac-entitlements.plist deleted file mode 100644 index d46335fd0ddb..000000000000 --- a/mac-entitlements.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - com.apple.security.cs.allow-jit - - com.apple.security.cs.allow-unsigned-executable-memory - - com.apple.security.cs.allow-dyld-environment-variables - - com.apple.security.cs.disable-library-validation - - - diff --git a/mk/quiet.mk b/mk/quiet.mk index 33becd20356b..52062f906ede 100644 --- a/mk/quiet.mk +++ b/mk/quiet.mk @@ -104,4 +104,3 @@ ZIP_VERBOSITY=--verbose endif MSBUILD_VERBOSITY=$(XBUILD_VERBOSITY) MSBUILD_VERBOSITY_QUIET=$(XBUILD_VERBOSITY_QUIET) -XIBUILD_VERBOSITY=$(XBUILD_VERBOSITY) diff --git a/mk/rules.mk b/mk/rules.mk index 2d8fd7c512d3..0dbb9a5c2070 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,82 +167,15 @@ 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 .libs/maccatalyst/%$(1).arm64.framework: | .libs/maccatalyst $$(call Q_2,LD, [maccatalyst]) $(XCODE_CC) $(MACCATALYST_ARM64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/Frameworks -fapplication-extension -## watch simulator - -.libs/watchsimulator/%$(1).x86.o: %.m $(EXTRA_DEPENDENCIES) | .libs/watchsimulator - $$(call Q_2,OBJC, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH_OBJC_CFLAGS) $$(EXTRA_DEFINES) $(SIMW_I) -g $(2) -c $$< -o $$@ - -.libs/watchsimulator/%$(1).x86.o: %.c $(EXTRA_DEPENDENCIES) | .libs/watchsimulator - $$(call Q_2,CC, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH_CFLAGS) $$(EXTRA_DEFINES) $(SIMW_I) -g $(2) -c $$< -o $$@ - -.libs/watchsimulator/%$(1).x86.o: %.s $(EXTRA_DEPENDENCIES) | .libs/watchsimulator - $$(call Q_2,ASM, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH_CFLAGS) $$(EXTRA_DEFINES) $(SIMW_I) -g $(2) -c $$< -o $$@ - -.libs/watchsimulator/%$(1).x86.dylib: %.swift | .libs/watchsimulator - $$(call Q_2,SWIFT, [watchsimulator]) $(SWIFTC) $(WATCHOS_SIMULATOR_X86_SWIFTFLAGS) $$< -o $$@ - -.libs/watchsimulator/%$(1).x86.dylib: | .libs/watchsimulator - $$(call Q_2,LD, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib -fapplication-extension - -.libs/watchsimulator/%$(1).x86.framework: | .libs/watchsimulator - $$(call Q_2,LD, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks -fapplication-extension - -.libs/watchsimulator/%$(1).x86_64.o: %.m $(EXTRA_DEPENDENCIES) | .libs/watchsimulator - $$(call Q_2,OBJC, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH64_OBJC_CFLAGS) $$(EXTRA_DEFINES) $(SIMW64_I) -g $(2) -c $$< -o $$@ - -.libs/watchsimulator/%$(1).x86_64.o: %.c $(EXTRA_DEPENDENCIES) | .libs/watchsimulator - $$(call Q_2,CC, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH64_CFLAGS) $$(EXTRA_DEFINES) $(SIMW64_I) -g $(2) -c $$< -o $$@ - -.libs/watchsimulator/%$(1).x86_64.o: %.s $(EXTRA_DEPENDENCIES) | .libs/watchsimulator - $$(call Q_2,ASM, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH64_CFLAGS) $$(EXTRA_DEFINES) $(SIMW64_I) -g $(2) -c $$< -o $$@ - -.libs/watchsimulator/%$(1).x86_64.dylib: %.swift | .libs/watchsimulator - $$(call Q_2,SWIFT, [watchsimulator]) $(SWIFTC) $(WATCHOS_SIMULATOR_X64_SWIFTFLAGS) $$< -o $$@ - -.libs/watchsimulator/%$(1).x86_64.dylib: | .libs/watchsimulator - $$(call Q_2,LD, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib -fapplication-extension - -.libs/watchsimulator/%$(1).x86_64.framework: | .libs/watchsimulator - $$(call Q_2,LD, [watchsimulator]) $(SIMULATOR_CC) $(SIMULATORWATCH64_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/Frameworks -fapplication-extension - -## watch device - -.libs/watchos/%$(1).armv7k.o: %.m $(EXTRA_DEPENDENCIES) | .libs/watchos - $$(call Q_2,OBJC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH_OBJC_CFLAGS) $$(EXTRA_DEFINES) $(DEVW_I) -g $(2) -c $$< -o $$@ - -.libs/watchos/%$(1).armv7k.o: %.c $(EXTRA_DEPENDENCIES) | .libs/watchos - $$(call Q_2,CC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH_CFLAGS) $$(EXTRA_DEFINES) $(DEVW_I) -g $(2) -c $$< -o $$@ - -.libs/watchos/%$(1).armv7k.dylib: %.swift | .libs/watchsimulator - $$(call Q_2,SWIFT, [watchos]) $(SWIFTC) $(WATCHOS_DEVICE_ARMV7K_SWIFTFLAGS) $$< -o $$@ - -.libs/watchos/%$(1).armv7k.dylib: | .libs/watchos - $$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib -fapplication-extension - -.libs/watchos/%$(1).armv7k.framework: | .libs/watchos - $$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks -fapplication-extension - -.libs/watchos/%$(1).arm64_32.o: %.m $(EXTRA_DEPENDENCIES) | .libs/watchos - $$(call Q_2,OBJC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_OBJC_CFLAGS) $$(EXTRA_DEFINES) $(DEVW64_32_I) -g $(2) -c $$< -o $$@ - -.libs/watchos/%$(1).arm64_32.o: %.c $(EXTRA_DEPENDENCIES) | .libs/watchos - $$(call Q_2,CC, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_DEFINES) $(DEVW64_32_I) -g $(2) -c $$< -o $$@ - -.libs/watchos/%$(1).arm64_32.dylib: %.swift | .libs/watchsimulator - $$(call Q_2,SWIFT, [watchos]) $(SWIFTC) $(WATCHOS_DEVICE_ARM64_32_SWIFTFLAGS) $$< -o $$@ - -.libs/watchos/%$(1).arm64_32.dylib: | .libs/watchos - $$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -L$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib -fapplication-extension - -.libs/watchos/%$(1).arm64_32.framework: | .libs/watchos - $$(call Q_2,LD, [watchos]) $(DEVICE_CC) $(DEVICEWATCH64_32_CFLAGS) $$(EXTRA_FLAGS) -dynamiclib -o $$@ $$^ -F$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/Frameworks -fapplication-extension - ## tv simulator ### X64 @@ -247,6 +192,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 +215,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 +238,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 +261,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 +291,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 @@ -351,7 +320,7 @@ $(eval $(call NativeCompilationTemplate,-dotnet-coreclr-debug,$(DEBUG_FLAGS) -DC $(eval $(call NativeCompilationTemplate,-dotnet-nativeaot,$(RELEASE_FLAGS) -DCORECLR_RUNTIME -DDOTNET -DNATIVEAOT)) $(eval $(call NativeCompilationTemplate,-dotnet-nativeaot-debug,$(DEBUG_FLAGS) -DCORECLR_RUNTIME -DDOTNET -DNATIVEAOT)) -.libs/iphoneos .libs/iphonesimulator .libs/watchos .libs/watchsimulator .libs/tvos .libs/tvsimulator .libs/maccatalyst .libs/mac: +.libs/iphoneos .libs/iphonesimulator .libs/tvos .libs/tvsimulator .libs/maccatalyst .libs/mac: $(Q) mkdir -p $@ %.csproj.inc: %.csproj $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/tools/common/create-makefile-fragment.sh diff --git a/mk/versions.mk b/mk/versions.mk index e1ff5444d13f..377710e926ce 100644 --- a/mk/versions.mk +++ b/mk/versions.mk @@ -65,9 +65,7 @@ endef $(shell rm -f .check-versions-failure) $(eval $(call CheckSubmoduleTemplate,Touch.Unit,TOUCH_UNIT)) -$(eval $(call CheckSubmoduleTemplate,opentk,OPENTK)) $(eval $(call CheckSubmoduleTemplate,Xamarin.MacDev,XAMARIN_MACDEV)) -$(eval $(call CheckSubmoduleTemplate,macios-binaries,MACIOS_BINARIES)) $(eval $(call CheckSubmoduleTemplate,MonoTouch.Dialog,MONOTOUCH_DIALOG)) $(eval $(call CheckSubmoduleTemplate,api-tools,API_TOOLS)) diff --git a/mono/4.5/machine.config b/mono/4.5/machine.config deleted file mode 100644 index e1438984d066..000000000000 --- a/mono/4.5/machine.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mono/config b/mono/config deleted file mode 100644 index b30597e74031..000000000000 --- a/mono/config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/msbuild/Directory.Build.props b/msbuild/Directory.Build.props index 5a4cafd66a49..328f0b3a5edd 100644 --- a/msbuild/Directory.Build.props +++ b/msbuild/Directory.Build.props @@ -10,6 +10,10 @@ interesting ways. So in order to get the exact version, they're enclosed in brackets. + Lists of versions can be found here: + + https://dev.azure.com/azure-public/vside/_artifacts/feed/xamarin-impl/NuGet/Xamarin.Messaging.Client/ + --> [2.2.10] [1.1.7] diff --git a/msbuild/ILMerge.targets b/msbuild/ILMerge.targets index 6f8f1548033d..47b66b86d1f6 100644 --- a/msbuild/ILMerge.targets +++ b/msbuild/ILMerge.targets @@ -78,7 +78,7 @@ $([System.IO.Path]::GetFullPath($([System.IO.Path]::Combine('$(MSBuildProjectDirectory)','$(AssemblyOriginatorKeyFile)')))) - /keyfile:"$(AbsoluteAssemblyOriginatorKeyFile)" /delaysign + /keyfile:"$(AbsoluteAssemblyOriginatorKeyFile)" $(ILRepackArgs) /union $(ILRepackArgs) @(LibDir -> '/lib:"%(Identity)."', ' ') $(ILRepackArgs) /out:"@(IntermediateAssembly -> '%(FullPath)')" @@ -93,8 +93,6 @@ - - diff --git a/msbuild/Makefile b/msbuild/Makefile index 373a0c5642dc..37ed2199d9c1 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 ## @@ -251,7 +210,6 @@ MAC_SYMLINKS = MAC_PRODUCTS = \ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/FrameworkList.xml \ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/RedistList/FrameworkList.xml \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/4.5/machine.config \ $(foreach target,$(MAC_TARGETS) ,$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/$(notdir $(target))) \ $(foreach target,$(MAC_BINDING_TARGETS) ,$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/$(notdir $(target))) \ $(foreach dll,$(MAC_TASK_ASSEMBLIES) ,$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/$(dll).dll) \ @@ -333,25 +291,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 ## @@ -397,9 +336,6 @@ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/RedistList/Frame $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/RedistList/FrameworkList.xml: Xamarin.Shared/Xamarin.Mac-Full-FrameworkList.xml.in Makefile | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/RedistList $(Q) sed 's@%TargetFrameworkDirectory%@$(MAC_TARGETDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/4.5@' $< > $@ -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/4.5/machine.config: $(TOP)/tools/mmp/machine.4_5.config | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/etc/mono/4.5 - $(Q) $(CP) $(TOP)/tools/mmp/machine.4_5.config $@ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild/%: Xamarin.Mac.Tasks/% | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/msbuild $(Q) install -m 644 $< $@ @@ -415,11 +351,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 @@ -482,7 +417,6 @@ $(DOTNET_DESTDIR)/$(MACCATALYST_NUGET_SDK_NAME)/tools/msbuild/MacCatalyst/%: $(I MSBUILD_DIRECTORIES += $(DOTNET_DIRECTORIES) -ifdef ENABLE_DOTNET MSBUILD_PRODUCTS += $(DOTNET_TARGETS) DOTNET_IOS_WINDOWS_OUTPUT_FILES = \ @@ -509,7 +443,6 @@ DOTNET_IOS_WINDOWS_MOBILEDEVICE_TOOLS_X64 = $(foreach file,$(IOS_WINDOWS_MOBILED all-local:: .dotnet-windows dotnet:: .dotnet-windows -endif ## ## Common targets ## @@ -546,13 +479,8 @@ install-local:: $(MSBUILD_PRODUCTS) @echo Targets files are valid XML @touch $@ -test run-test: run-test-ios run-test-mac - -run-test-ios: - $(MAKE) -C $(TOP)/tests test-ios-tasks - -run-test-mac: - $(MAKE) -C $(TOP)/tests run-mac-msbuild +test run-test run-tests tests run-tests-msbuild: + $(Q) $(MAKE) -C $(TOP)/tests run-tests-msbuild clean-local:: git clean -xfdq diff --git a/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj b/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj index 8a3428ab3070..b46d9a83e98f 100644 --- a/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj +++ b/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj @@ -6,7 +6,6 @@ $(NoWarn);NU1603 $(NoWarn);MSB3277 true - /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin enable latest Nullable @@ -29,18 +28,10 @@ - - $(MonoMSBuildBinPath)/Microsoft.Build.dll - - - $(MonoMSBuildBinPath)/Microsoft.Build.Framework.dll - - - $(MonoMSBuildBinPath)/Microsoft.Build.Tasks.Core.dll - - - $(MonoMSBuildBinPath)/Microsoft.Build.Utilities.Core.dll - + + + + Versions.g.cs diff --git a/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx b/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx index b68ef191e2a9..a9312353018d 100644 --- a/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx +++ b/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx @@ -1576,6 +1576,53 @@ SupportedOSPlatformVersion: don't translate (it's the name of an MSBuild property) + + Can't find the AlternateAppIcon '{0}' among the image resources. There are {1} app icons in the image resources: {2}. + + * AlternateAppIcon: don't translate (it's the name of an MSBuild property) + * {1}: count of image resources + * {2}: comma separated list of resources. + + + + + The image resource '{0}' is specified as both 'AppIcon' and 'AlternateAppIcon'. + + * AppIcon: don't translate (it's the name of an MSBuild property) + * AlternateAppIcon: don't translate (it's the name of an MSBuild property) + + + + + Can't specify both 'XSAppIconAssets' in the Info.plist and 'AppIcon' in the project file. Please select one or the other. + + * XSAppIconAssets: don't translate (it's the name of an MSBuild property) + * AppIcon: don't translate (it's the name of an MSBuild property) + + + + + Can't find the AppIcon '{0}' among the image resources. There are {1} app icons in the image resources: {2}. + + * AppIcon: don't translate (it's the name of an MSBuild property) + * {1}: count of image resources + * {2}: comma separated list of resources. + + + + + The source '{0}' does not exist. + {0}: path to a file or a directory + + + + Unable to parse the 'AdditionalArguments' value: {0} + + AdditionalArguments: don't translate (it's the name of an MSBuild property) + {0}: additional arguments passed to the task + + + Adding reference to Xcode project output: '{0}'. The '%(CreateNativeReference)' metadata can be set to 'false' to opt out of this behavior. @@ -1592,4 +1639,4 @@ - + \ No newline at end of file diff --git a/msbuild/Xamarin.Mac.Tasks/Properties/AssemblyInfo.cs b/msbuild/Xamarin.Mac.Tasks/Properties/AssemblyInfo.cs index 90fec8c96c9e..552667a2136e 100644 --- a/msbuild/Xamarin.Mac.Tasks/Properties/AssemblyInfo.cs +++ b/msbuild/Xamarin.Mac.Tasks/Properties/AssemblyInfo.cs @@ -8,6 +8,3 @@ [assembly: AssemblyProductAttribute ("Xamarin.Mac.Tasks")] [assembly: AssemblyTitleAttribute ("Xamarin.Mac.Tasks")] [assembly: AssemblyVersionAttribute (VersionConstants.XamarinMacVersion)] - -[assembly: InternalsVisibleTo ("Xamarin.MacDev.Tasks.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("Xamarin.MacDev.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] diff --git a/msbuild/Xamarin.MacDev.Tasks/Decompress.cs b/msbuild/Xamarin.MacDev.Tasks/Decompress.cs index ed47c46bf98d..4f2f8d5c0636 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Decompress.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Decompress.cs @@ -4,6 +4,7 @@ using System.IO; using System.IO.Compression; using System.Reflection; +using System.Threading; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -81,9 +82,10 @@ public static bool IsCompressed (string path) /// The zip to search in /// The relative path inside the zip to extract (may be a file or a directory). /// The location on disk to store the extracted results + /// The cancellation token (if any= /// The location on disk to the extracted resource /// - public static bool TryDecompress (TaskLoggingHelper log, string zip, string resource, string decompressionDir, List createdFiles, [NotNullWhen (true)] out string? decompressedResource) + public static bool TryDecompress (TaskLoggingHelper log, string zip, string resource, string decompressionDir, List createdFiles, CancellationToken? cancellationToken, [NotNullWhen (true)] out string? decompressedResource) { decompressedResource = Path.Combine (decompressionDir, resource); @@ -101,11 +103,11 @@ public static bool TryDecompress (TaskLoggingHelper log, string zip, string reso bool rv; if (Environment.OSVersion.Platform == PlatformID.Win32NT) { - rv = TryDecompressUsingSystemIOCompression (log, zip, resource, decompressionDir); + rv = TryDecompressUsingSystemIOCompression (log, zip, resource, decompressionDir, cancellationToken); } else if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("XAMARIN_USE_SYSTEM_IO_COMPRESSION"))) { - rv = TryDecompressUsingSystemIOCompression (log, zip, resource, decompressionDir); + rv = TryDecompressUsingSystemIOCompression (log, zip, resource, decompressionDir, cancellationToken); } else { - rv = TryDecompressUsingUnzip (log, zip, resource, decompressionDir); + rv = TryDecompressUsingUnzip (log, zip, resource, decompressionDir, cancellationToken); } if (rv) { @@ -128,7 +130,7 @@ public static bool TryDecompress (TaskLoggingHelper log, string zip, string reso // The dir separator character in zip files is always "/", even on Windows const char zipDirectorySeparator = '/'; - static bool TryDecompressUsingUnzip (TaskLoggingHelper log, string zip, string resource, string decompressionDir) + static bool TryDecompressUsingUnzip (TaskLoggingHelper log, string zip, string resource, string decompressionDir, CancellationToken? cancellationToken) { Directory.CreateDirectory (decompressionDir); var args = new List { @@ -157,11 +159,11 @@ static bool TryDecompressUsingUnzip (TaskLoggingHelper log, string zip, string r args.Add (zipPattern); } - var rv = XamarinTask.ExecuteAsync (log, "unzip", args).Result; + var rv = XamarinTask.ExecuteAsync (log, "unzip", args, cancellationToken: cancellationToken).Result; return rv.ExitCode == 0; } - static bool TryDecompressUsingSystemIOCompression (TaskLoggingHelper log, string zip, string resource, string decompressionDir) + static bool TryDecompressUsingSystemIOCompression (TaskLoggingHelper log, string zip, string resource, string decompressionDir, CancellationToken? cancellationToken) { var rv = true; @@ -172,6 +174,7 @@ static bool TryDecompressUsingSystemIOCompression (TaskLoggingHelper log, string using var archive = ZipFile.OpenRead (zip); foreach (var entry in archive.Entries) { + cancellationToken?.ThrowIfCancellationRequested (); var entryPath = entry.FullName; if (entryPath.Length == 0) continue; @@ -207,7 +210,11 @@ static bool TryDecompressUsingSystemIOCompression (TaskLoggingHelper log, string Directory.CreateDirectory (Path.GetDirectoryName (targetPath)); using var streamWrite = File.OpenWrite (targetPath); using var streamRead = entry.Open (); - streamRead.CopyTo (streamWrite); +#if NET + streamRead.CopyToAsync (streamWrite, cancellationToken ?? CancellationToken.None).Wait (); +#else + streamRead.CopyToAsync (streamWrite, 81920 /* default buffer size according to docs */, cancellationToken ?? CancellationToken.None).Wait (); +#endif log.LogMessage (MessageImportance.Low, "Extracted {0} into {1}", entryPath, targetPath); } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs index 959bade4fed7..b28989bb725b 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs @@ -13,13 +13,18 @@ namespace Xamarin.MacDev.Tasks { public class ACTool : XcodeCompilerToolTask, ICancelableTask { - ITaskItem? partialAppManifest; string? outputSpecs; + string? partialAppManifestPath; #region Inputs public string AccentColor { get; set; } = string.Empty; + public ITaskItem [] AlternateAppIcons { get; set; } = Array.Empty (); + + // The name of an app icon + public string AppIcon { get; set; } = string.Empty; + public string DeviceModel { get; set; } = string.Empty; public string DeviceOSVersion { get; set; } = string.Empty; @@ -29,6 +34,8 @@ public class ACTool : XcodeCompilerToolTask, ICancelableTask { [Required] public ITaskItem [] ImageAssets { get; set; } = Array.Empty (); + public bool IncludeAllAppIcons { get; set; } + public bool IsWatchApp { get; set; } [Required] @@ -46,6 +53,11 @@ public class ACTool : XcodeCompilerToolTask, ICancelableTask { #endregion + // All the icons among the 'ImageAssets'. + HashSet appIconsInAssets = new (); // iOS, macOS and Mac Catalyst + HashSet brandAssetsInAssets = new (); // tvOS + HashSet imageStacksInAssets = new (); // tvOS + protected override string DefaultBinDir { get { return DeveloperRootBinDir; } } @@ -64,6 +76,11 @@ protected override void AppendCommandLineArguments (IDictionary { var assetDirs = new HashSet (items.Select (x => BundleResource.GetVirtualProjectPath (ProjectDir, x, !string.IsNullOrEmpty (SessionId)))); + if (!string.IsNullOrEmpty (XSAppIconAssets) && !string.IsNullOrEmpty (AppIcon)) { + Log.LogError (MSBStrings.E7129 /* Can't specify both 'XSAppIconAssets' in the Info.plist and 'AppIcon' in the project file. Please select one or the other. */); + return; + } + if (!string.IsNullOrEmpty (XSAppIconAssets)) { int index = XSAppIconAssets.IndexOf (".xcassets" + Path.DirectorySeparatorChar, StringComparison.Ordinal); string? assetDir = null; @@ -75,13 +92,6 @@ protected override void AppendCommandLineArguments (IDictionary if (assetDirs is not null && assetDir is not null && assetDirs.Contains (assetDir)) { var assetName = Path.GetFileNameWithoutExtension (rpath); - if (PartialAppManifest is null && partialAppManifest is not null) { - args.Add ("--output-partial-info-plist"); - args.AddQuoted (partialAppManifest.GetMetadata ("FullPath")); - - PartialAppManifest = partialAppManifest; - } - args.Add ("--app-icon"); args.AddQuoted (assetName); @@ -104,14 +114,6 @@ protected override void AppendCommandLineArguments (IDictionary if (assetDirs is not null && assetDir is not null && assetDirs.Contains (assetDir)) { var assetName = Path.GetFileNameWithoutExtension (rpath); - - if (PartialAppManifest is null && partialAppManifest is not null) { - args.Add ("--output-partial-info-plist"); - args.AddQuoted (partialAppManifest.GetMetadata ("FullPath")); - - PartialAppManifest = partialAppManifest; - } - args.Add ("--launch-image"); args.AddQuoted (assetName); } @@ -147,12 +149,57 @@ protected override void AppendCommandLineArguments (IDictionary foreach (var targetDevice in GetTargetDevices ()) args.Add ("--target-device", targetDevice); - args.Add ("--minimum-deployment-target", MinimumOSVersion); + if (!string.IsNullOrEmpty (MinimumOSVersion)) + args.Add ("--minimum-deployment-target", MinimumOSVersion); var platform = PlatformUtils.GetTargetPlatform (SdkPlatform, IsWatchApp); if (platform is not null) args.Add ("--platform", platform); + + if (!string.IsNullOrEmpty (AppIcon)) { + if (Platform == ApplePlatform.TVOS) { + if (!brandAssetsInAssets.Contains (AppIcon)) { + Log.LogError (MSBStrings.E7130 /* Can't find the AppIcon '{0}' among the image resources. There are {1} app icons in the image resources: {2} */, AppIcon, brandAssetsInAssets.Count, string.Join (", ", brandAssetsInAssets.OrderBy (v => v))); + return; + } + } else { + if (!appIconsInAssets.Contains (AppIcon)) { + Log.LogError (MSBStrings.E7130 /* Can't find the AppIcon '{0}' among the image resources. There are {1} app icons in the image resources: {2} */, AppIcon, appIconsInAssets.Count, string.Join (", ", appIconsInAssets.OrderBy (v => v))); + return; + } + } + args.Add ("--app-icon"); + args.AddQuoted (AppIcon); + } + + foreach (var alternate in AlternateAppIcons) { + var alternateAppIcon = alternate.ItemSpec!; + if (Platform == ApplePlatform.TVOS) { + if (!imageStacksInAssets.Contains (alternateAppIcon)) { + Log.LogError (MSBStrings.E7127 /* Can't find the AlternateAppIcon '{0}' among the image resources. There are {1} app icons in the image resources: {2}. */, alternateAppIcon, imageStacksInAssets.Count, string.Join (", ", imageStacksInAssets.OrderBy (v => v))); + return; + } + } else { + if (!appIconsInAssets.Contains (alternateAppIcon)) { + Log.LogError (MSBStrings.E7127 /* Can't find the AlternateAppIcon '{0}' among the image resources. There are {1} app icons in the image resources: {2}. */, alternateAppIcon, appIconsInAssets.Count, string.Join (", ", appIconsInAssets.OrderBy (v => v))); + return; + } + } + if (string.Equals (alternateAppIcon, AppIcon, StringComparison.OrdinalIgnoreCase)) { + Log.LogError (MSBStrings.E7128 /* The image resource '{0}' is specified as both 'AppIcon' and 'AlternateAppIcon'. */, AppIcon); + return; + } + // This doesn't seem to be necessary/applicable for tvOS (it also triggers a warning from actool) + args.Add ("--alternate-app-icon"); + args.AddQuoted (alternateAppIcon); + } + + if (IncludeAllAppIcons) + args.Add ("--include-all-app-icons"); + + args.Add ("--output-partial-info-plist"); + args.AddQuoted (Path.GetFullPath (partialAppManifestPath)); } IEnumerable GetCompiledBundleResources (PDictionary output, string intermediateBundleDir) @@ -309,6 +356,17 @@ public override bool Execute () var catalog = Path.GetDirectoryName (vpath); path = Path.GetDirectoryName (path); + if (Platform == ApplePlatform.TVOS) { + if (path.EndsWith (".imagestack", StringComparison.OrdinalIgnoreCase)) { + imageStacksInAssets.Add (Path.GetFileNameWithoutExtension (path)); + } else if (path.EndsWith (".brandassets", StringComparison.OrdinalIgnoreCase)) { + brandAssetsInAssets.Add (Path.GetFileNameWithoutExtension (path)); + } + } else { + if (path.EndsWith (".appiconset", StringComparison.OrdinalIgnoreCase)) + appIconsInAssets.Add (Path.GetFileNameWithoutExtension (path)); + } + // keep walking up the directory structure until we get to the .xcassets directory while (!string.IsNullOrEmpty (catalog) && Path.GetExtension (catalog) != ".xcassets") { catalog = Path.GetDirectoryName (catalog); @@ -391,7 +449,8 @@ public override bool Execute () return !Log.HasLoggedErrors; } - partialAppManifest = new TaskItem (Path.Combine (intermediate, "partial-info.plist")); + partialAppManifestPath = Path.Combine (intermediate, "partial-info.plist"); + PartialAppManifest = new TaskItem (partialAppManifestPath); if (specs.Count > 0) { outputSpecs = Path.Combine (intermediate, "output-specifications.plist"); @@ -400,12 +459,14 @@ public override bool Execute () Directory.CreateDirectory (intermediateBundleDir); - // Note: Compile() will set the PartialAppManifest property if it is used... if ((Compile (catalogs.ToArray (), intermediateBundleDir, manifest)) != 0) return false; - if (PartialAppManifest is not null && !File.Exists (PartialAppManifest.GetMetadata ("FullPath"))) - Log.LogError (MSBStrings.E0093, PartialAppManifest.GetMetadata ("FullPath")); + if (Log.HasLoggedErrors) + return false; + + if (!File.Exists (Path.GetFullPath (partialAppManifestPath))) + Log.LogError (MSBStrings.E0093, Path.GetFullPath (partialAppManifestPath)); try { var manifestOutput = PDictionary.FromFile (manifest.ItemSpec)!; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs index 7901c1f9f72d..8f54d817cbd0 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs @@ -393,15 +393,17 @@ protected void SetValue (PDictionary dict, string key, string value) dict [key] = value; } - public static void MergePartialPlistDictionary (PDictionary plist, PDictionary partial) + public static void MergePartialPlistDictionary (PDictionary plist, PDictionary partial, bool overwrite) { foreach (var property in partial) { var key = property.Key!; if (plist.ContainsKey (key)) { + if (!overwrite) + continue; var value = plist [key]; if (value is PDictionary && property.Value is PDictionary) { - MergePartialPlistDictionary ((PDictionary) value, (PDictionary) property.Value); + MergePartialPlistDictionary ((PDictionary) value, (PDictionary) property.Value, overwrite); } else { plist [key] = property.Value.Clone (); } @@ -418,6 +420,7 @@ public static void MergePartialPLists (Task task, PDictionary plist, IEnumerable foreach (var template in partialLists) { PDictionary partial; + var overwrite = !string.Equals (template.GetMetadata ("Overwrite"), "false", StringComparison.OrdinalIgnoreCase); try { partial = PDictionary.FromFile (template.ItemSpec)!; @@ -426,7 +429,7 @@ public static void MergePartialPLists (Task task, PDictionary plist, IEnumerable continue; } - MergePartialPlistDictionary (plist, partial); + MergePartialPlistDictionary (plist, partial, overwrite); } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlements.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlements.cs index 97b957bc65c1..d0e08651c7b0 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlements.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlements.cs @@ -54,6 +54,7 @@ public class CompileEntitlements : XamarinTask, ITaskCallback, ICancelableTask { public string BundleIdentifier { get; set; } = string.Empty; [Required] + [Output] // this is required to create an output file on Windows. Note: this is a relative path. public ITaskItem? CompiledEntitlements { get; set; } public ITaskItem [] CustomEntitlements { get; set; } = Array.Empty (); @@ -521,14 +522,19 @@ public override bool Execute () SaveArchivedExpandedEntitlements (archived); + /* The path to the entitlements must be resolved to the full path, because we might want to reference it from a containing project that just references this project, + * and in that case it becomes a bit complicated to resolve to a full path on disk when building remotely from Windows. Instead just resolve to a full path here, + * and use that from now on. This has to be done from a task, so that we get the full path on the mac when executed remotely from Windows. */ + var compiledEntitlementsFullPath = new TaskItem (Path.GetFullPath (CompiledEntitlements!.ItemSpec)); + if (Platform == Utils.ApplePlatform.MacCatalyst) { - EntitlementsInSignature = CompiledEntitlements; + EntitlementsInSignature = compiledEntitlementsFullPath; } else if (SdkIsSimulator) { if (compiled.Count > 0) { - EntitlementsInExecutable = CompiledEntitlements; + EntitlementsInExecutable = compiledEntitlementsFullPath; } } else { - EntitlementsInSignature = CompiledEntitlements; + EntitlementsInSignature = compiledEntitlementsFullPath; } return !Log.HasLoggedErrors; @@ -564,7 +570,13 @@ bool SaveArchivedExpandedEntitlements (PDictionary archived) public bool ShouldCopyToBuildServer (ITaskItem item) => true; - public bool ShouldCreateOutputFile (ITaskItem item) => true; + public bool ShouldCreateOutputFile (ITaskItem item) + { + // EntitlementsInExecutable and EntitlementsInSignature are full paths on macOS, + // which doesn't work correctly when trying to create such output files on Windows. + var isFullPath = item == EntitlementsInExecutable || item == EntitlementsInSignature; + return !isFullPath; + } public IEnumerable GetAdditionalItemsToBeCopied () { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs index 085e9f067b25..c001208bcb51 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs @@ -161,7 +161,7 @@ public override bool Execute () for (var i = 1; i < all.Length; i++) { var nextMetadata = all [i].CloneCustomMetadataToDictionary (); if (nextMetadata.Count != firstMetadata.Count) { - Log.LogWarning (MSBStrings.W7095, /* Code signing has been requested multiple times for '{0}', with different metadata. The metadata for one are: '{1}', while the metadata for the other are: '{2}' */ group.Key, string.Join (", ", firstMetadata.Keys), string.Join (", ", nextMetadata.Keys)); + Log.LogWarning (MSBStrings.W7095, /* Code signing has been requested multiple times for '{0}', with different metadata. The metadata for one are: '{1}', while the metadata for the other are: '{2}' */ group.Key, string.Join (", ", firstMetadata.Keys.OrderBy (v => v)), string.Join (", ", nextMetadata.Keys.OrderBy (v => v))); } else { foreach (var kvp in firstMetadata) { if (!nextMetadata.TryGetValue (kvp.Key, out var nextValue)) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs index 2a17ff59e898..e550c47af9b4 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs @@ -17,22 +17,6 @@ public class CreateEmbeddedResources : XamarinTask { [Output] public ITaskItem [] EmbeddedResources { get; set; } = Array.Empty (); - static string EscapeMangledResource (string name) - { - var mangled = new StringBuilder (); - - for (int i = 0; i < name.Length; i++) { - switch (name [i]) { - case '\\': mangled.Append ("_b"); break; - case '/': mangled.Append ("_f"); break; - case '_': mangled.Append ("__"); break; - default: mangled.Append (name [i]); break; - } - } - - return mangled.ToString (); - } - public override bool Execute () { if (ShouldExecuteRemotely ()) { @@ -56,7 +40,7 @@ public override bool Execute () bundleResource.CopyMetadataTo (embeddedResource); // mangle the resource name - var logicalName = "__" + Prefix + "_content_" + EscapeMangledResource (bundleResource.GetMetadata ("LogicalName")); + var logicalName = "__" + Prefix + "_content_" + PackLibraryResources.EscapeMangledResource (bundleResource.GetMetadata ("LogicalName")); embeddedResource.SetMetadata ("LogicalName", logicalName); // add it to the output connection diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs index a4a849dfd7df..1eece8514f84 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs @@ -4,14 +4,19 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; +using Xamarin.Localization.MSBuild; using Xamarin.Messaging.Build.Client; +using Xamarin.Utils; namespace Xamarin.MacDev.Tasks { - public class Ditto : XamarinToolTask, ITaskCallback { + public class Ditto : XamarinTask, ITaskCallback, ICancelableTask { + CancellationTokenSource? cancellationTokenSource; + #region Inputs public string? AdditionalArguments { get; set; } @@ -26,6 +31,8 @@ public class Ditto : XamarinToolTask, ITaskCallback { // the mode. public bool CopyFromWindows { get; set; } + public string? DittoPath { get; set; } + [Required] public ITaskItem? Source { get; set; } @@ -40,32 +47,6 @@ public class Ditto : XamarinToolTask, ITaskCallback { #endregion - protected override string ToolName { - get { return "ditto"; } - } - - protected override string GenerateFullPathToTool () - { - if (!string.IsNullOrEmpty (ToolPath)) - return Path.Combine (ToolPath, ToolExe); - - var path = Path.Combine ("/usr/bin", ToolExe); - - return File.Exists (path) ? path : ToolExe; - } - - protected override string GenerateCommandLineCommands () - { - var args = new CommandLineArgumentBuilder (); - - args.AddQuoted (Path.GetFullPath (Source!.ItemSpec)); - args.AddQuoted (Path.GetFullPath (Destination!.ItemSpec)); - if (!string.IsNullOrEmpty (AdditionalArguments)) - args.Add (AdditionalArguments); - - return args.ToString (); - } - public override bool Execute () { if (ShouldExecuteRemotely ()) { @@ -76,8 +57,31 @@ public override bool Execute () return taskRunner.RunAsync (this).Result; } - if (!base.Execute ()) + var src = Source!.ItemSpec; + if (!File.Exists (src) && !Directory.Exists (src)) { + Log.LogError (MSBStrings.E7131 /* The source '{0}' does not exist. */, src); return false; + } + + var executable = string.IsNullOrEmpty (DittoPath) ? "/usr/bin/ditto" : DittoPath!; + var args = new List (); + args.Add (Path.GetFullPath (Source!.ItemSpec)); + args.Add (Path.GetFullPath (Destination!.ItemSpec)); +#if NET + if (!string.IsNullOrEmpty (AdditionalArguments)) { +#else + if (AdditionalArguments is not null && !string.IsNullOrEmpty (AdditionalArguments)) { +#endif + if (StringUtils.TryParseArguments (AdditionalArguments, out var additionalArgs, out var ex)) { + args.AddRange (additionalArgs); + } else { + Log.LogError (MSBStrings.E7132 /* Unable to parse the 'AdditionalArguments' value: {0} */, AdditionalArguments); + return false; + } + } + + cancellationTokenSource = new CancellationTokenSource (); + ExecuteAsync (Log, executable, args, cancellationToken: cancellationTokenSource.Token).Wait (); // Create a list of all the files we've copied var copiedFiles = new List (); @@ -96,18 +100,13 @@ public override bool Execute () return !Log.HasLoggedErrors; } - protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance) + public void Cancel () { - // TODO: do proper parsing of error messages and such - Log.LogMessage (messageImportance, "{0}", singleLine); - } - - public override void Cancel () - { - base.Cancel (); - - if (ShouldExecuteRemotely ()) + if (ShouldExecuteRemotely ()) { BuildConnection.CancelAsync (BuildEngine4).Wait (); + } else { + cancellationTokenSource?.Cancel (); + } } public IEnumerable GetAdditionalItemsToBeCopied () 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/PackLibraryResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResources.cs index fad793f7a11a..163a08b432cd 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResources.cs @@ -26,14 +26,15 @@ public class PackLibraryResources : XamarinTask, ITaskCallback, ICancelableTask #endregion - static string EscapeMangledResource (string name) + // The opposite function is UnpackLibraryResources.UnmangleResource + public static string EscapeMangledResource (string name) { var mangled = new StringBuilder (); for (int i = 0; i < name.Length; i++) { switch (name [i]) { - case '\\': mangled.Append ("_b"); break; - case '/': mangled.Append ("_f"); break; + case '\\': + case '/': mangled.Append ("_s"); break; case '_': mangled.Append ("__"); break; default: mangled.Append (name [i]); break; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferences.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferences.cs index 0d39e8e91a00..2992aaf79595 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferences.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferences.cs @@ -5,6 +5,7 @@ using System.IO.Compression; using System.Linq; using System.Reflection; +using System.Threading; using System.Xml; using Microsoft.Build.Framework; @@ -40,6 +41,8 @@ namespace Xamarin.MacDev.Tasks { // with a framework for macOS will likely have symlinks, but that shouldn't prevent the xcframework from being // consumed in a build for iOS. public class ResolveNativeReferences : XamarinTask, ITaskCallback { + CancellationTokenSource? cancellationTokenSource; + #region Inputs [Required] @@ -112,9 +115,11 @@ bool ExecuteLocally () var native_frameworks = new List (); var createdFiles = new List (); + cancellationTokenSource = new CancellationTokenSource (); + // there can be direct native references inside a project foreach (var nr in NativeReferences) { - ProcessNativeReference (nr, native_frameworks, createdFiles); + ProcessNativeReference (nr, native_frameworks, createdFiles, cancellationTokenSource.Token); } // or (managed) reference to an assembly that bind a framework @@ -122,11 +127,11 @@ bool ExecuteLocally () // look for sidecar's manifest var resources = Path.ChangeExtension (r.ItemSpec, ".resources"); if (Directory.Exists (resources)) { - ProcessNativeReference (r, resources, native_frameworks, createdFiles); + ProcessNativeReference (r, resources, native_frameworks, createdFiles, cancellationTokenSource.Token); } else { resources = resources + ".zip"; if (File.Exists (resources)) - ProcessNativeReference (r, resources, native_frameworks, createdFiles); + ProcessNativeReference (r, resources, native_frameworks, createdFiles, cancellationTokenSource.Token); } } @@ -136,12 +141,12 @@ bool ExecuteLocally () return !Log.HasLoggedErrors; } - void ProcessNativeReference (ITaskItem item, List native_frameworks, List createdFiles) + void ProcessNativeReference (ITaskItem item, List native_frameworks, List createdFiles, CancellationToken? cancellationTokenSource) { - ProcessNativeReference (item, item.ItemSpec, native_frameworks, createdFiles); + ProcessNativeReference (item, item.ItemSpec, native_frameworks, createdFiles, cancellationTokenSource); } - void ProcessNativeReference (ITaskItem item, string name, List native_frameworks, List createdFiles) + void ProcessNativeReference (ITaskItem item, string name, List native_frameworks, List createdFiles, CancellationToken? cancellationToken) { // '.' can be used to represent a file (instead of the directory) if (Path.GetFileName (name) == ".") @@ -190,7 +195,7 @@ void ProcessNativeReference (ITaskItem item, string name, List native // (compressed) xcframework if (name.EndsWith (".xcframework", StringComparison.OrdinalIgnoreCase) || name.EndsWith (".xcframework.zip", StringComparison.OrdinalIgnoreCase)) { - if (!TryResolveXCFramework (Log, TargetFrameworkMoniker, SdkIsSimulator, Architectures, name, GetIntermediateDecompressionDir (item), createdFiles, out var nativeLibraryPath)) + if (!TryResolveXCFramework (Log, TargetFrameworkMoniker, SdkIsSimulator, Architectures, name, GetIntermediateDecompressionDir (item), createdFiles, cancellationToken, out var nativeLibraryPath)) return; var nr = new TaskItem (item); SetMetadataNativeLibrary (nr, nativeLibraryPath); @@ -200,7 +205,7 @@ void ProcessNativeReference (ITaskItem item, string name, List native // compressed framework if (name.EndsWith (".framework.zip", StringComparison.OrdinalIgnoreCase)) { - if (!CompressionHelper.TryDecompress (Log, name, Path.GetFileNameWithoutExtension (name), GetIntermediateDecompressionDir (item), createdFiles, out var frameworkPath)) + if (!CompressionHelper.TryDecompress (Log, name, Path.GetFileNameWithoutExtension (name), GetIntermediateDecompressionDir (item), createdFiles, cancellationToken, out var frameworkPath)) return; var nr = new TaskItem (item); nr.ItemSpec = GetActualLibrary (frameworkPath); @@ -213,13 +218,13 @@ void ProcessNativeReference (ITaskItem item, string name, List native // sidecar / binding resource package if (name.EndsWith (".resources", StringComparison.OrdinalIgnoreCase)) { - ProcessSidecar (item, name, native_frameworks, createdFiles); + ProcessSidecar (item, name, native_frameworks, createdFiles, cancellationToken); return; } // compressed sidecar / binding resource package if (name.EndsWith (".resources.zip", StringComparison.OrdinalIgnoreCase)) { - ProcessSidecar (item, name, native_frameworks, createdFiles); + ProcessSidecar (item, name, native_frameworks, createdFiles, cancellationToken); return; } @@ -257,8 +262,10 @@ static bool TryGetSidecarManifest (TaskLoggingHelper log, string resources, [Not /// True if the Info.plist was found and successfully parsed. static bool TryGetInfoPlist (TaskLoggingHelper log, string resourcePath, string xcframework, [NotNullWhen (true)] out PDictionary? plist) { - var manifestPath = Path.Combine (xcframework, "Info.plist"); - using var stream = CompressionHelper.TryGetPotentiallyCompressedFile (log, resourcePath, manifestPath); + var isCompressedXcframework = CompressionHelper.IsCompressed (xcframework); + var potentiallyCompressedFile = isCompressedXcframework ? Path.Combine (resourcePath, xcframework) : resourcePath; + var manifestPath = Path.Combine (isCompressedXcframework ? Path.GetFileNameWithoutExtension (xcframework) : xcframework, "Info.plist"); + using var stream = CompressionHelper.TryGetPotentiallyCompressedFile (log, potentiallyCompressedFile, manifestPath); if (stream is null) { plist = null; return false; @@ -289,7 +296,7 @@ void SetMetadataNativeLibrary (ITaskItem item, string nativeLibraryPath) item.SetMetadata ("RelativePath", Path.Combine (FrameworksDirectory, Path.GetFileName (Path.GetDirectoryName (item.ItemSpec)))); } - void ProcessSidecar (ITaskItem r, string resources, List native_frameworks, List createdFiles) + void ProcessSidecar (ITaskItem r, string resources, List native_frameworks, List createdFiles, CancellationToken? cancellationToken) { if (!TryGetSidecarManifest (Log, resources, out var manifestContents)) return; @@ -300,52 +307,46 @@ void ProcessSidecar (ITaskItem r, string resources, List native_frame foreach (XmlNode referenceNode in document.GetElementsByTagName ("NativeReference")) { ITaskItem t = new TaskItem (r); var name = referenceNode.Attributes ["Name"].Value.Trim ('\\', '/'); - switch (Path.GetExtension (name)) { - case ".xcframework": { - if (!TryResolveXCFramework (Log, TargetFrameworkMoniker, SdkIsSimulator, Architectures, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, out var nativeLibraryPath)) + if (name.EndsWith (".xcframework", StringComparison.Ordinal) || name.EndsWith (".xcframework.zip", StringComparison.Ordinal)) { + if (!TryResolveXCFramework (Log, TargetFrameworkMoniker, SdkIsSimulator, Architectures, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, cancellationToken, out var nativeLibraryPath)) continue; SetMetadataNativeLibrary (t, nativeLibraryPath); - break; - } - case ".framework": { + } else if (name.EndsWith (".framework", StringComparison.Ordinal)) { string? frameworkPath; if (!isCompressed) { frameworkPath = Path.Combine (resources, name); - } else if (!CompressionHelper.TryDecompress (Log, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, out frameworkPath)) { + } else if (!CompressionHelper.TryDecompress (Log, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, cancellationToken, out frameworkPath)) { continue; } t.ItemSpec = GetActualLibrary (frameworkPath); t.SetMetadata ("Kind", "Framework"); t.SetMetadata ("PublishFolderType", "AppleFramework"); t.SetMetadata ("RelativePath", Path.Combine (FrameworksDirectory, Path.GetFileName (Path.GetDirectoryName (t.ItemSpec)))); - break; - } - case ".dylib": // macOS + } else if (name.EndsWith (".dylib", StringComparison.Ordinal)) { + // macOS string? dylibPath; if (!isCompressed) { dylibPath = Path.Combine (resources, name); - } else if (!CompressionHelper.TryDecompress (Log, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, out dylibPath)) { + } else if (!CompressionHelper.TryDecompress (Log, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, cancellationToken, out dylibPath)) { continue; } t.ItemSpec = dylibPath; t.SetMetadata ("Kind", "Dynamic"); t.SetMetadata ("PublishFolderType", "DynamicLibrary"); - break; - case ".a": // static library + } else if (name.EndsWith (".a", StringComparison.Ordinal)) { + // static library string? aPath; if (!isCompressed) { aPath = Path.Combine (resources, name); - } else if (!CompressionHelper.TryDecompress (Log, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, out aPath)) { + } else if (!CompressionHelper.TryDecompress (Log, resources, name, GetIntermediateDecompressionDir (resources), createdFiles, cancellationToken, out aPath)) { continue; } t.ItemSpec = aPath; t.SetMetadata ("Kind", "Static"); t.SetMetadata ("PublishFolderType", "StaticLibrary"); - break; - default: + } else { Log.LogWarning (MSBStrings.W7105 /* Unexpected extension '{0}' for native reference '{1}' in binding resource package '{2}'. */, Path.GetExtension (name), name, r.ItemSpec); t = r; - break; } // defaults @@ -374,7 +375,7 @@ void ProcessSidecar (ITaskItem r, string resources, List native_frame /// A full path to the resolved native library within the xcframework. If 'resourcePath' is compressed, this will point to where the native library is decompressed on disk. /// /// True if a native library was successfully found. Otherwise false, and an error will have been printed to the log. - public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFrameworkMoniker, bool isSimulator, string? architectures, string path, string intermediateDecompressionDir, List createdFiles, [NotNullWhen (true)] out string? nativeLibraryPath) + public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFrameworkMoniker, bool isSimulator, string? architectures, string path, string intermediateDecompressionDir, List createdFiles, CancellationToken? cancellationToken, [NotNullWhen (true)] out string? nativeLibraryPath) { string resourcePath; string xcframework; @@ -386,7 +387,7 @@ public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFr resourcePath = Path.GetDirectoryName (path); xcframework = Path.GetFileName (path); } - return TryResolveXCFramework (log, targetFrameworkMoniker, isSimulator, architectures, resourcePath, xcframework, intermediateDecompressionDir, createdFiles, out nativeLibraryPath); + return TryResolveXCFramework (log, targetFrameworkMoniker, isSimulator, architectures, resourcePath, xcframework, intermediateDecompressionDir, createdFiles, cancellationToken, out nativeLibraryPath); } /// @@ -401,7 +402,7 @@ public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFr /// A full path to the resolved native library within the xcframework. If 'resourcePath' is compressed, this will point to where the native library is decompressed on disk. /// /// True if a native library was successfully found. Otherwise false, and an error will have been printed to the log. - public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFrameworkMoniker, bool isSimulator, string? architectures, string resourcePath, string xcframework, string intermediateDecompressionDir, List createdFiles, [NotNullWhen (true)] out string? nativeLibraryPath) + public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFrameworkMoniker, bool isSimulator, string? architectures, string resourcePath, string xcframework, string intermediateDecompressionDir, List createdFiles, CancellationToken? cancellationToken, [NotNullWhen (true)] out string? nativeLibraryPath) { nativeLibraryPath = null; @@ -411,16 +412,26 @@ public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFr var isCompressed = CompressionHelper.IsCompressed (resourcePath); var xcframeworkPath = isCompressed ? resourcePath : Path.Combine (resourcePath, xcframework); - if (!TryResolveXCFramework (log, plist, xcframeworkPath, targetFrameworkMoniker, isSimulator, architectures!, out var nativeLibraryRelativePath)) + if (!TryResolveXCFramework (log, plist, xcframeworkPath, targetFrameworkMoniker, isSimulator, architectures!, cancellationToken, out var nativeLibraryRelativePath)) return false; + if (!isCompressed && CompressionHelper.IsCompressed (xcframework)) { + var zipPath = Path.Combine (resourcePath, xcframework); + var xcframeworkName = Path.GetFileNameWithoutExtension (xcframework); + if (!CompressionHelper.TryDecompress (log, zipPath, xcframeworkName, intermediateDecompressionDir, createdFiles, cancellationToken, out var decompressedXcframeworkPath)) + return false; + + nativeLibraryPath = Path.Combine (intermediateDecompressionDir, xcframeworkName, nativeLibraryRelativePath); + return true; + } + if (!isCompressed) { nativeLibraryPath = Path.Combine (resourcePath, xcframework, nativeLibraryRelativePath); return true; } var zipResource = Path.Combine (xcframework, Path.GetDirectoryName (nativeLibraryRelativePath)); - if (!CompressionHelper.TryDecompress (log, resourcePath, zipResource, intermediateDecompressionDir, createdFiles, out var decompressedPath)) + if (!CompressionHelper.TryDecompress (log, resourcePath, zipResource, intermediateDecompressionDir, createdFiles, cancellationToken, out var decompressedPath)) return false; nativeLibraryPath = Path.Combine (intermediateDecompressionDir, xcframework, nativeLibraryRelativePath); @@ -444,7 +455,7 @@ public static bool TryResolveXCFramework (TaskLoggingHelper log, string targetFr /// The target architectures /// A relative path to the resolved native library within the xcframework. /// True if a native library was successfully found. Otherwise false, and an error will have been printed to the log. - internal static bool TryResolveXCFramework (TaskLoggingHelper log, PDictionary plist, string xcframeworkPath, string targetFrameworkMoniker, bool isSimulator, string architectures, [NotNullWhen (true)] out string? nativeLibraryPath) + public static bool TryResolveXCFramework (TaskLoggingHelper log, PDictionary plist, string xcframeworkPath, string targetFrameworkMoniker, bool isSimulator, string architectures, CancellationToken? cancellationToken, [NotNullWhen (true)] out string? nativeLibraryPath) { nativeLibraryPath = null; var platform = PlatformFrameworkHelper.GetFramework (targetFrameworkMoniker); @@ -519,8 +530,11 @@ internal static bool TryResolveXCFramework (TaskLoggingHelper log, PDictionary p public void Cancel () { - if (ShouldExecuteRemotely ()) + if (ShouldExecuteRemotely ()) { BuildConnection.CancelAsync (BuildEngine4).Wait (); + } else { + cancellationTokenSource?.Cancel (); + } } public bool ShouldCopyToBuildServer (ITaskItem item) => true; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs index d61a4d296d92..e994659270ab 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs @@ -18,6 +18,8 @@ public class SymbolStrip : XamarinParallelTask, ITaskCallback { [Required] public ITaskItem [] Executable { get; set; } = Array.Empty (); + public string StripPath { get; set; } = string.Empty; + // This can also be specified as metadata on the Executable item (as 'SymbolFile') public string SymbolFile { get; set; } = string.Empty; @@ -31,11 +33,19 @@ bool GetIsFramework (ITaskItem item) return string.Equals (value, "Framework", StringComparison.OrdinalIgnoreCase); } + static string GetExecutable (List arguments, string toolName, string toolPathOverride) + { + if (string.IsNullOrEmpty (toolPathOverride)) { + arguments.Insert (0, toolName); + return "xcrun"; + } + return toolPathOverride; + } + void ExecuteStrip (ITaskItem item) { var args = new List (); - - args.Add ("strip"); + var executable = GetExecutable (args, "strip", StripPath); var symbolFile = GetNonEmptyStringOrFallback (item, "SymbolFile", SymbolFile); if (!string.IsNullOrEmpty (symbolFile)) { @@ -52,7 +62,7 @@ void ExecuteStrip (ITaskItem item) args.Add (Path.GetFullPath (item.ItemSpec)); - ExecuteAsync ("xcrun", args).Wait (); + ExecuteAsync (executable, args).Wait (); } public override bool Execute () diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs index 52c9b5357cd7..558c27d52b3c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs @@ -2,6 +2,8 @@ using System.IO; using System.Linq; using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.PortableExecutable; using System.Text; using System.Collections.Generic; @@ -15,7 +17,6 @@ namespace Xamarin.MacDev.Tasks { public class UnpackLibraryResources : XamarinTask, ITaskCallback, ICancelableTask { - MetadataLoadContext? universe; List unpackedResources = new List (); #region Inputs @@ -26,9 +27,6 @@ public class UnpackLibraryResources : XamarinTask, ITaskCallback, ICancelableTas [Required] public string IntermediateOutputPath { get; set; } = string.Empty; - [Required] - public ITaskItem [] ReferenceAssemblies { get; set; } = Array.Empty (); - [Required] public ITaskItem [] ReferencedLibraries { get; set; } = Array.Empty (); @@ -52,15 +50,6 @@ public class UnpackLibraryResources : XamarinTask, ITaskCallback, ICancelableTas #endregion public override bool Execute () - { - try { - return ExecuteImpl (); - } finally { - universe?.Dispose (); - } - } - - bool ExecuteImpl () { if (ShouldExecuteRemotely ()) { var result = new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; @@ -87,7 +76,7 @@ bool ExecuteImpl () Log.LogMessage (MessageImportance.Low, MSBStrings.M0168, asm.ItemSpec); } else { var perAssemblyOutputPath = Path.Combine (IntermediateOutputPath, "unpack", asm.GetMetadata ("Filename")); - var extracted = ExtractContentAssembly (asm.ItemSpec, perAssemblyOutputPath).ToArray (); + var extracted = ExtractContentAssembly (asm.ItemSpec, perAssemblyOutputPath); results.AddRange (extracted); @@ -113,60 +102,91 @@ bool IsFrameworkAssembly (ITaskItem asm) return false; } - IEnumerable ExtractContentAssembly (string assembly, string intermediatePath) + List ExtractContentAssembly (string assembly, string intermediatePath) { + var rv = new List (); + if (!File.Exists (assembly)) { Log.LogMessage (MessageImportance.Low, $"Not inspecting assembly because it doesn't exist: {assembly}"); - yield break; + return rv; } - var asmWriteTime = File.GetLastWriteTimeUtc (assembly); - var manifestResources = GetAssemblyManifestResources (assembly).ToArray (); - if (!manifestResources.Any ()) - yield break; - - Log.LogMessage (MessageImportance.Low, $"Inspecting assembly with {manifestResources.Length} resources: {assembly}"); - foreach (var embedded in manifestResources) { - string rpath; - - if (embedded.Name.StartsWith ("__" + Prefix + "_content_", StringComparison.Ordinal)) { - var mangled = embedded.Name.Substring (("__" + Prefix + "_content_").Length); - rpath = UnmangleResource (mangled); - } else if (embedded.Name.StartsWith ("__" + Prefix + "_page_", StringComparison.Ordinal)) { - var mangled = embedded.Name.Substring (("__" + Prefix + "_page_").Length); - rpath = UnmangleResource (mangled); - } else { - continue; - } - - var path = Path.Combine (intermediatePath, rpath); - var file = new FileInfo (path); - - var item = new TaskItem (path); - item.SetMetadata ("LogicalName", rpath); - item.SetMetadata ("Optimize", "false"); - - if (file.Exists && file.LastWriteTimeUtc >= asmWriteTime) { - Log.LogMessage (" Up to date: {0}", rpath); - } else { - Log.LogMessage (" Unpacking: {0}", rpath); - - Directory.CreateDirectory (Path.GetDirectoryName (path)); + try { + var asmWriteTime = File.GetLastWriteTimeUtc (assembly); + using var peStream = File.OpenRead (assembly); + using var peReader = new PEReader (peStream); + var metadataReader = PEReaderExtensions.GetMetadataReader (peReader); + Log.LogMessage (MessageImportance.Low, $"Inspecting resources in assembly {assembly}"); + foreach (var manifestResourceHandle in metadataReader.ManifestResources) { + var manifestResource = metadataReader.GetManifestResource (manifestResourceHandle); + if (!manifestResource.Implementation.IsNil) + continue; // embedded resources have Implementation.IsNil = true, and those are the ones we care about + + var name = metadataReader.GetString (manifestResource.Name); + if (string.IsNullOrEmpty (name)) + continue; + + string rpath; + + if (name.StartsWith ("__" + Prefix + "_content_", StringComparison.Ordinal)) { + var mangled = name.Substring (("__" + Prefix + "_content_").Length); + rpath = UnmangleResource (mangled); + } else if (name.StartsWith ("__" + Prefix + "_page_", StringComparison.Ordinal)) { + var mangled = name.Substring (("__" + Prefix + "_page_").Length); + rpath = UnmangleResource (mangled); + } else { + continue; + } - using (var stream = File.Open (path, FileMode.Create)) { - using (var resource = embedded.Open ()) - resource.CopyTo (stream); + var path = Path.Combine (intermediatePath, rpath); + var file = new FileInfo (path); + + var item = new TaskItem (path); + item.SetMetadata ("LogicalName", rpath); + item.SetMetadata ("Optimize", "false"); + + if (file.Exists && file.LastWriteTimeUtc >= asmWriteTime) { + Log.LogMessage (" Up to date: {0}", rpath); + } else { + Log.LogMessage (" Unpacking: {0}", rpath); + + Directory.CreateDirectory (Path.GetDirectoryName (path)); + + var resourceDirectory = peReader.GetSectionData (peReader.PEHeaders.CorHeader!.ResourcesDirectory.RelativeVirtualAddress); + var reader = resourceDirectory.GetReader ((int) manifestResource.Offset, resourceDirectory.Length - (int) manifestResource.Offset); + var length = reader.ReadUInt32 (); + if (length > reader.RemainingBytes) + throw new BadImageFormatException (); +#if NET + using var fs = new FileStream (path, FileMode.Create, FileAccess.Write, FileShare.Read); + unsafe { + var span = new ReadOnlySpan (reader.CurrentPointer, (int) length); + fs.Write (span); + } +#else + var buffer = new byte [4096]; + using var fs = new FileStream (path, FileMode.Create, FileAccess.Write, FileShare.Read, buffer.Length); + var left = (int) length; + while (left > 0) { + var read = Math.Min (left, buffer.Length); + reader.ReadBytes (read, buffer, 0); + fs.Write (buffer, 0, read); + left -= read; + } +#endif + unpackedResources.Add (item); } - unpackedResources.Add (item); + rv.Add (item); } - - yield return item; + } catch (Exception e) { + Log.LogMessage (MessageImportance.Low, $"Unable to load the resources from the assembly '{assembly}': {e}"); + return new List (); } - - yield break; + return rv; } + // The opposite function is PackLibraryResources.EscapeMangledResource static string UnmangleResource (string mangled) { var unmangled = new StringBuilder (mangled.Length); @@ -182,6 +202,7 @@ static string UnmangleResource (string mangled) if (escaped) { switch (c) { + case 's': c = Path.DirectorySeparatorChar; break; case 'b': c = '\\'; break; case 'f': c = '/'; break; case '_': c = '_'; break; @@ -237,27 +258,5 @@ public bool ShouldCopyToBuildServer (ITaskItem item) public IEnumerable GetAdditionalItemsToBeCopied () => ItemsFiles; - IEnumerable GetAssemblyManifestResources (string fileName) - { - if (universe is null) - universe = new MetadataLoadContext (new PathAssemblyResolver (ReferenceAssemblies.Select (v => v.ItemSpec))); - - Assembly assembly; - try { - assembly = universe.LoadFromAssemblyPath (fileName); - } catch (Exception e) { - Log.LogMessage (MessageImportance.Low, $"Unable to load the assembly '{fileName}: {e}"); - yield break; - } - - foreach (var resourceName in assembly.GetManifestResourceNames ()) { - if (string.IsNullOrEmpty (resourceName)) - continue; - var info = assembly.GetManifestResourceInfo (resourceName); - if (!info.ResourceLocation.HasFlag (ResourceLocation.Embedded)) - continue; - yield return new ManifestResource (resourceName, () => assembly.GetManifestResourceStream (resourceName)); - } - } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Unzip.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Unzip.cs index 6dc4ced90781..7d68b37df7e4 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Unzip.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Unzip.cs @@ -5,6 +5,7 @@ using System.IO.Compression; using System.Linq; using System.Reflection; +using System.Threading; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -22,6 +23,8 @@ namespace Xamarin.MacDev.Tasks { /// This task works on Windows too, but if the task encounters a symlink while extracting, an error will be shown. /// public class Unzip : XamarinTask, ITaskCallback { + CancellationTokenSource? cancellationTokenSource; + // If we should copy the extracted files to Windows (as opposed to just creating an empty output file). public bool CopyToWindows { get; set; } @@ -55,8 +58,11 @@ public override bool Execute () public void Cancel () { - if (ShouldExecuteRemotely ()) + if (ShouldExecuteRemotely ()) { BuildConnection.CancelAsync (BuildEngine4).Wait (); + } else { + cancellationTokenSource?.Cancel (); + } } public bool ShouldCopyToBuildServer (ITaskItem item) => true; @@ -73,7 +79,8 @@ public bool ShouldCreateOutputFile (ITaskItem item) bool ExecuteLocally () { var createdFiles = new List (); - if (!CompressionHelper.TryDecompress (Log, ZipFilePath!.ItemSpec, Resource, ExtractionPath, createdFiles, out var _)) + cancellationTokenSource = new CancellationTokenSource (); + if (!CompressionHelper.TryDecompress (Log, ZipFilePath!.ItemSpec, Resource, ExtractionPath, createdFiles, cancellationTokenSource.Token, out var _)) return false; TouchedFiles = createdFiles.Select (v => new TaskItem (v)).ToArray (); 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.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs index bf7ad3bbfff3..4d7e3f67c256 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs @@ -232,6 +232,11 @@ protected int Compile (ITaskItem [] items, string output, ITaskItem manifest) args.AddQuoted (item.GetMetadata ("FullPath")); var arguments = args.ToList (); + + // don't bother executing the tool if we've already looged errors. + if (Log.HasLoggedErrors) + return 1; + var rv = ExecuteAsync (tool, arguments, sdkDevPath, environment: environment, mergeOutput: false).Result; var exitCode = rv.ExitCode; var messages = rv.StandardOutput!.ToString (); diff --git a/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj b/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj index 608e795242bd..1e4b3dba3a65 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj +++ b/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj @@ -20,10 +20,10 @@ - - - - + + + + diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.targets index b1c2747aa339..25fc2af375c8 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.targets @@ -146,9 +146,9 @@ Copyright (C) 2018 Microsoft. All rights reserved. --> - <_XCFrameworkNativeReference Include="@(NativeReference -> '%(Identity)/.')" Condition="'%(Extension)' == '.xcframework'" /> + <_XCFrameworkNativeReference Include="@(NativeReference -> '%(Identity)/.')" Condition="'%(Extension)' == '.xcframework' Or $([MSBuild]::ValueOrDefault('%(FileName)%(Extension)', '').EndsWith('.xcframework.zip'))" /> <_FrameworkNativeReference Include="@(NativeReference -> '%(Identity)/%(Filename)')" Condition="'%(Extension)' == '.framework'" /> - <_FileNativeReference Include="@(NativeReference)" Condition="'%(Extension)' != '.framework' And '%(Extension)' != '.xcframework'" /> + <_FileNativeReference Include="@(NativeReference)" Condition="'%(Extension)' != '.framework' And '%(Extension)' != '.xcframework' And '%(Extension)' != '.zip'" /> + + + + + + + @@ -696,15 +703,13 @@ Copyright (C) 2018 Microsoft. All rights reserved. - - - - - - - + + + + + + + @@ -723,6 +728,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. _BeforeCoreCompileInterfaceDefinitions; _ReadCoreCompileInterfaceDefinitions; _CoreCompileInterfaceDefinitions; + _PostCompileInterfaceDefinitions; @@ -809,11 +815,17 @@ Copyright (C) 2018 Microsoft. All rights reserved. - - + + + + + + + + @@ -831,6 +843,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. _BeforeCoreCompileImageAssets; _ReadCompileImageAssets; _CoreCompileImageAssets; + _PostCompileImageAssets; @@ -897,12 +910,15 @@ Copyright (C) 2018 Microsoft. All rights reserved. ToolExe="$(ACToolExe)" ToolPath="$(ACToolPath)" AccentColor="$(AccentColor)" + AlternateAppIcons="@(AlternateAppIcon)" + AppIcon="$(AppIcon)" BundleIdentifier="$(_BundleIdentifier)" CLKComplicationGroup="$(_CLKComplicationGroup)" DeviceModel="$(TargetDeviceModel)" DeviceOSVersion="$(TargetDeviceOSVersion)" EnableOnDemandResources="$(EnableOnDemandResources)" ImageAssets="@(ImageAsset)" + IncludeAllAppIcons="$(IncludeAllAppIcons)" MinimumOSVersion="$(_MinimumOSVersion)" NSExtensionPointIdentifier="$(_NSExtensionPointIdentifier)" OptimizePNGs="$(OptimizePNGs)" @@ -933,10 +949,16 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + + + + + + - @@ -953,6 +975,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. _BeforeCoreCompileSceneKitAssets; _ReadCoreCompileSceneKitAssets; _CoreCompileSceneKitAssets; + _PostCompileSceneKitAssets; @@ -1019,10 +1042,16 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + + + + + + - @@ -1036,6 +1065,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. _BeforeCoreCompileColladaAssets; _ReadCoreCompileColladaAssets; _CoreCompileColladaAssets; + _PostCompileColladaAssets; @@ -1102,10 +1132,16 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + + + + + + - @@ -1176,6 +1212,18 @@ Copyright (C) 2018 Microsoft. All rights reserved. <_CompiledEntitlementsPath Condition="'$(_CompiledEntitlementsPath)' == ''">$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent <_SaveProcessedItems Condition="'$(RuntimeIdentifiers)' != '' And '$(UsingAppleNETSdk)' == 'true'">true + + + + <_ProcessedPaths Include="$(_ProcessedBundleResourcesPath)" /> + <_ProcessedPaths Include="$(_ProcessedContentPath)" /> + <_ProcessedPaths Include="$(_ProcessedImageAssetsPath)" /> + <_ProcessedPaths Include="$(_ProcessedInterfaceDefinitionsPath)" /> + <_ProcessedPaths Include="$(_ProcessedSceneKitAssetsPath)" /> + <_ProcessedPaths Include="$(_ProcessedColladaAssetsPath)" /> + <_ProcessedPaths Include="$(_ProcessedTextureAtlasesPath)" /> + <_ProcessedPaths Include="$(_ProcessedCoreMLModelsPath)" /> + @@ -1228,6 +1276,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. _BeforeCompileTextureAtlases; _ReadCoreCompileTextureAtlases; _CoreCompileTextureAtlases; + _PostCompileTextureAtlases; @@ -1291,10 +1340,16 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + + + + + + - @@ -1386,10 +1441,16 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + + + + + + - @@ -1407,6 +1468,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)" @@ -1426,6 +1488,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"> @@ -1934,7 +1997,9 @@ Copyright (C) 2018 Microsoft. All rights reserved. <_StampDirectory>$(DeviceSpecificIntermediateOutputPath)resourcestamps\ - <_UnpackLibraryResourceItems Include="@(ReferencePath);@(ReferenceDependencyPaths)"> + <_UnpackLibraryResourceItems Include="@(ReferencePath)" Condition="'%(ReferencePath.FrameworkReferenceName)' != 'Microsoft.NETCore.App' And '%(ReferencePath.FrameworkReferenceName)' != 'Microsoft.$(_PlatformName)'" /> + <_UnpackLibraryResourceItems Include="@(ReferenceDependencyPaths)" Condition="'%(ReferenceDependencyPaths.FrameworkReferenceName)' != 'Microsoft.NETCore.App' And '%(ReferenceDependencyPaths.FrameworkReferenceName)' != 'Microsoft.$(_PlatformName)'" /> + <_UnpackLibraryResourceItems> $(_StampDirectory)%(FileName).stamp $(_StampDirectory)%(FileName).items @@ -1983,14 +2048,12 @@ Copyright (C) 2018 Microsoft. All rights reserved. - @@ -2512,8 +2575,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. diff --git a/msbuild/Xamarin.Shared/Xamarin.WatchOS.App.Common.targets b/msbuild/Xamarin.Shared/Xamarin.WatchOS.App.Common.targets index e0bbf9e98e19..baeb6674997b 100644 --- a/msbuild/Xamarin.Shared/Xamarin.WatchOS.App.Common.targets +++ b/msbuild/Xamarin.Shared/Xamarin.WatchOS.App.Common.targets @@ -81,8 +81,7 @@ Copyright (C) 2015-2016 Xamarin. All rights reserved. SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)'" AdditionalArguments="$(WKDittoArchitectures)" - ToolExe="$(DittoExe)" - ToolPath="$(DittoPath)" + DittoPath="$(DittoPath)" Source="$(_NativeWatchApp)" Destination="$(_AppBundlePath)$(AssemblyName)" /> @@ -93,8 +92,7 @@ Copyright (C) 2015-2016 Xamarin. All rights reserved. SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)'" AdditionalArguments="$(WKDittoArchitectures)" - ToolExe="$(DittoExe)" - ToolPath="$(DittoPath)" + DittoPath="$(DittoPath)" Source="$(_NativeWatchApp)" Destination="$(_AppBundlePath)_WatchKitStub\WK" /> diff --git a/msbuild/Xamarin.Shared/Xamarin.iOS.Common.targets b/msbuild/Xamarin.Shared/Xamarin.iOS.Common.targets index ffefb06341a4..fbc38f7352f6 100644 --- a/msbuild/Xamarin.Shared/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.Shared/Xamarin.iOS.Common.targets @@ -371,8 +371,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. @@ -391,8 +390,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. @@ -481,8 +479,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. 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/msbuild/Xamarin.iOS.Tasks/Properties/AssemblyInfo.cs b/msbuild/Xamarin.iOS.Tasks/Properties/AssemblyInfo.cs index 7295e77dcd44..f4fbada51c3e 100644 --- a/msbuild/Xamarin.iOS.Tasks/Properties/AssemblyInfo.cs +++ b/msbuild/Xamarin.iOS.Tasks/Properties/AssemblyInfo.cs @@ -8,6 +8,3 @@ [assembly: AssemblyProductAttribute ("Xamarin.iOS.Tasks")] [assembly: AssemblyTitleAttribute ("Xamarin.iOS.Tasks")] [assembly: AssemblyVersionAttribute (VersionConstants.XamarinIOSVersion)] - -[assembly: InternalsVisibleTo ("Xamarin.MacDev.Tasks.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("Xamarin.MacDev.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] diff --git a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj index ab13417e13ef..ddebf2c99e63 100644 --- a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj +++ b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj @@ -20,10 +20,10 @@ - - - - + + + + diff --git a/release/Distribution.ios.in b/release/Distribution.ios.in deleted file mode 100644 index 3df3fdacfb69..000000000000 --- a/release/Distribution.ios.in +++ /dev/null @@ -1,31 +0,0 @@ - - - Xamarin.iOS - - - - - - - - - - - - - - - - #monotouch.pkg - #delete-xma-build-host.pkg - diff --git a/release/Distribution.mac.in b/release/Distribution.mac.in deleted file mode 100644 index 63996e580e0b..000000000000 --- a/release/Distribution.mac.in +++ /dev/null @@ -1,38 +0,0 @@ - - - Xamarin.Mac - - - - - - - - - - - - - - - - #xamarin.mac-@PACKAGE_VERSION@.pkg - #xamarin.mac-uninstall-@PACKAGE_VERSION@.pkg - diff --git a/release/Distribution.xma.in b/release/Distribution.xma.in deleted file mode 100644 index 61f5ad4992f4..000000000000 --- a/release/Distribution.xma.in +++ /dev/null @@ -1,13 +0,0 @@ - - - Xamarin.iOS Build Host - - - - - - - - - #delete-xma-build-host.pkg - diff --git a/release/PackageInfo.ios.in b/release/PackageInfo.ios.in deleted file mode 100644 index ce6902b21b41..000000000000 --- a/release/PackageInfo.ios.in +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/release/PackageInfo.mac.in b/release/PackageInfo.mac.in deleted file mode 100644 index 75fac02bbd1e..000000000000 --- a/release/PackageInfo.mac.in +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/release/PackageInfo.xma.in b/release/PackageInfo.xma.in deleted file mode 100644 index 54a1fb18826b..000000000000 --- a/release/PackageInfo.xma.in +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/release/UninstallPackageInfo.mac.in b/release/UninstallPackageInfo.mac.in deleted file mode 100644 index 428de02fc13a..000000000000 --- a/release/UninstallPackageInfo.mac.in +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/release/mono-check.sh b/release/mono-check.sh deleted file mode 100755 index e868b44f8f92..000000000000 --- a/release/mono-check.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -e - -# if you edit these version numbers, remember to edit the error message -# in Distrubution.in too to refer to the new version. -MONO_MIN_REQUIRED_VERSION=3.2.0 - -VERSION_FILE=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/mono.pc - -if test -f $VERSION_FILE; then - # Grab the version from the pkgconfig file - installed_version=`grep Version $VERSION_FILE | cut -d ' ' -f 2` - - # If the installed version exactly matches the minimum, success! - if `test "$installed_version" = "$MONO_MIN_REQUIRED_VERSION"`; then - exit 2 # the .pkg installer really wants 2 to mean "OK" - fi - - # Use 'sort', splitting on the '.' character, to compare the installed version and our minimum acceptable version - # The newest version will be sorted to the end, so use tail to select the last item - newest_version=`echo -e $MONO_MIN_REQUIRED_VERSION'\n'$installed_version | sort -t'.' -g | tail -n 1` - - if `test "$newest_version" = "$installed_version"`; then - exit 2 # the .pkg installer really wants 2 to mean "OK" - fi -fi - -exit 1 diff --git a/release/postflight-ios b/release/postflight-ios deleted file mode 100755 index 917e7b1ea41a..000000000000 --- a/release/postflight-ios +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e - -# Touch all files to make sure projects are rebuilt correctly -find /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/ -type f -print0 | xargs -0 touch || true diff --git a/release/postflight-mac b/release/postflight-mac deleted file mode 100755 index 669acb8c7a3b..000000000000 --- a/release/postflight-mac +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -e - -# Touch all files to make sure projects are rebuilt correctly -find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/ -type f -print0 | xargs -0 touch || true diff --git a/release/preinstall.xma.in b/release/preinstall.xma.in deleted file mode 100755 index 277f0ec6ef5a..000000000000 --- a/release/preinstall.xma.in +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# -# Remove MTVS build server from the system LaunchAgents -# According to launchd.plist(5): -# FILES -# ~/Library/LaunchAgents Per-user agents provided by the user. -# /Library/LaunchAgents Per-user agents provided by the administrator. -# - -# If the plist had been loaded from a previous session, forcefully remove it and potential running mtbserver -(sudo -u $USER launchctl unload -w /Library/LaunchAgents/com.xamarin.mtvs.buildserver.plist &> /dev/null) || true -(sudo -u $USER launchctl remove com.xamarin.mtvs.buildserver &> /dev/null) || true -(killall -KILL mtbserver &> /dev/null) || true - -rm -rf /Library/LaunchAgents/com.xamarin.mtvs.buildserver.plist || true - -# Remove the plist file for launching the Build Server UI, we decided against this -rm -rf /Library/LaunchAgents/com.xamarin.mtvs.buildservergui.plist || true - -exit 0 diff --git a/release/uninstall.in b/release/uninstall.in deleted file mode 100755 index 1b2c2793069b..000000000000 --- a/release/uninstall.in +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -e - -# delete every directory in /Library/Frameworks/Xamarin.Mac.framework/Versions -# except Current and what Current symlinks to. - -if ! test -d /Library/Frameworks/Xamarin.Mac.framework/Versions; then - exit 0; -fi - -cd /Library/Frameworks/Xamarin.Mac.framework/Versions - -if ! test -d Current; then - exit 0 -fi - -# Delete -for d in `ls -1`; do - if [[ "x$d" != "xCurrent" && "x$d" != "x@PACKAGE_VERSION@" ]]; then - rm -R /Library/Frameworks/Xamarin.Mac.framework/Versions/$d 2>&1 >> /tmp/log - fi -done diff --git a/runtime/Makefile b/runtime/Makefile index 7b6582786a34..02adcd54732d 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -22,20 +22,15 @@ 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_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_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_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 SHARED_HEADERS += shared.h product.h delegates.h runtime-internal.h $(SHARED_INC) $(SHIPPED_HEADERS) trampolines-internal.h slinked-list.h -SHARED_FILES = $(SHARED_SOURCES) $(SHARED_HEADERS) $(SHARED_I386_SOURCES) $(SHARED_X86_64_SOURCES) $(SHARED_ARM64_SOURCES) +SHARED_FILES = $(SHARED_SOURCES) $(SHARED_HEADERS) $(SHARED_X86_64_SOURCES) $(SHARED_ARM64_SOURCES) EXTRA_DEPENDENCIES = $(SHARED_HEADERS) $(TOP)/Make.config $(TOP)/mk/mono.mk -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -IOS_SIMULATOR_ARCHITECTURES=x86 -IOS_DEVICE_ARCHITECTURES=armv7 armv7s -endif IOS_SIMULATOR_ARCHITECTURES+=x86_64 IOS_DEVICE_ARCHITECTURES+=arm64 @@ -69,14 +64,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 = \ @@ -86,509 +81,10 @@ MONOTOUCH_SOURCES = \ MONOTOUCH_HEADERS = \ monotouch-debug.h \ -MONOTOUCH_LIBS = \ - libextension.a \ - libtvextension.a \ - libapp.a \ - libxamarin.a \ - libxamarin-debug.a \ - libxamarin.dylib \ - libxamarin-debug.dylib \ - -MONOTOUCH_FRAMEWORKS = \ - Xamarin \ - Xamarin-debug \ - -MONOTOUCH_SOURCE_STEMS = $(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_SOURCES) $(MONOTOUCH_SOURCES))) -MONOTOUCH_I386_SOURCE_STEMS = $(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_I386_SOURCES))) +MONOTOUCH_SOURCE_STEMS = $(patsubst %.swift,%,$(patsubst %.s,%,$(patsubst %.m,%,$(SHARED_SOURCES) $(MONOTOUCH_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))) -MONOTOUCH_X86_SOURCE_STEMS = $(MONOTOUCH_I386_SOURCE_STEMS) - -# -# FrameworkTemplate contains the install targets and sets up some variables for frameworks -# - -define FrameworkTemplate - -$(2)_ARCHITECTURES = $(3) -$(2)_FRAMEWORKS = $(MONOTOUCH_FRAMEWORKS) - -RUNTIME_$(2)_TARGETS_DIRS += \ - $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin.framework \ - $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin-debug.framework \ - -RUNTIME_$(2)_TARGETS += \ - $$(foreach file,$$($(2)_FRAMEWORKS),$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/$$(file).framework/$$(file)) \ - $$(foreach file,$$($(2)_FRAMEWORKS),$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/$$(file).framework/Info.plist) \ - $$(foreach file,$$($(2)_FRAMEWORKS),$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/$$(file).framework.dSYM/Contents/Info.plist) \ - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin.framework/Xamarin: .libs/$(1)/Xamarin.framework | $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin.framework - $(Q) $(CP) $$< $$@ - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin-debug.framework/Xamarin-debug: .libs/$(1)/Xamarin-debug.framework | $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin-debug.framework - $(Q) $(CP) $$< $$@ - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/%.framework/Info.plist: Xamarin.framework-$(1).Info.plist | $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/%.framework - $(Q) sed 's/@BUNDLE_EXECUTABLE@/$$*/' $$< > $$@ - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin.framework.dSYM/Contents/Info.plist: $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin.framework/Xamarin $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin.framework/Info.plist - $$(Q_GEN) dsymutil -j 4 $$< -o $$(abspath $$(dir $$<)/..)/Xamarin.framework.dSYM - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin-debug.framework.dSYM/Contents/Info.plist: $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin-debug.framework/Xamarin-debug $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/Frameworks/Xamarin-debug.framework/Info.plist - $$(Q_GEN) dsymutil -j 4 $$< -o $$(abspath $$(dir $$<)/..)/Xamarin-debug.framework.dSYM - -.libs/$(1)/Xamarin.framework: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/Xamarin.$$(arch).framework) - $(Q) rm -f $$@ -ifeq (1,$$(words $$($(2)_ARCHITECTURES))) - $(Q) $(CP) $$^ $$@ -else - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ -endif - -.libs/$(1)/Xamarin-debug.framework: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/Xamarin-debug.$$(arch).framework) - $(Q) rm -f $$@ -ifeq (1,$$(words $$($(2)_ARCHITECTURES))) - $(Q) $(CP) $$^ $$@ -else - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ -endif -endef - -# 1: platform -# 2: variable prefix -# 3: architectures -ifdef INCLUDE_IOS -ifdef INCLUDE_DEVICE -$(eval $(call FrameworkTemplate,iphoneos,IPHONEOS,$(IOS_DEVICE_ARCHITECTURES))) -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)) -endif -$(eval $(call FrameworkTemplate,tvsimulator,TVSIMULATOR,x86_64)) -endif - -# -# PlatformTemplate contains the install targets and sets up some variables -# - -define PlatformTemplate - -$(2)_SOURCES = $(MONOTOUCH_SOURCES) -$(2)_HEADERS = $(MONOTOUCH_HEADERS) -$(2)_SOURCE_STEMS = $(MONOTOUCH_SOURCE_STEMS) -$(2)_X86_64_SOURCE_STEMS = $(MONOTOUCH_X86_64_SOURCE_STEMS) -$(2)_I386_SOURCE_STEMS = $(MONOTOUCH_I386_SOURCE_STEMS) -$(2)_ARM64_SOURCE_STEMS = $(MONOTOUCH_ARM64_SOURCE_STEMS) -$(2)_LIBRARIES = $(MONOTOUCH_LIBS) -$(2)_ARCHITECTURES = $(3) - -RUNTIME_$(2)_TARGETS_DIRS += \ - $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/lib \ - $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/include/xamarin \ - -RUNTIME_$(2)_TARGETS += \ - $$(foreach file,$$($(2)_LIBRARIES),$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/lib/$$(file)) \ - $(foreach file,$(SHIPPED_HEADERS),$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/include/$(file)) \ - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/lib/%.a: .libs/$(1)/%.a | $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/lib - $(Q) install -m 0644 $$< $$@ - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/lib/%.dylib: .libs/$(1)/%.dylib | $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/lib - $$(Q_STRIP) $(DEVICE_BIN_PATH)/bitcode_strip $$< -m -o $$@ - -$(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/include/%.h: %.h | $(IOS_DESTDIR)$$(XAMARIN_$(2)_SDK)/include/xamarin - $(Q) install -m 0644 $$< $$@ - -$$(RUNTIME_$(2)_TARGETS_DIRS): - $(Q) mkdir -p $$@ - -all-$(2):: $$(RUNTIME_$(2)_TARGETS) - -ifdef INCLUDE_XAMARIN_LEGACY -all-local:: $$(RUNTIME_$(2)_TARGETS) -install-local:: $$(RUNTIME_$(2)_TARGETS) -endif - -endef - -# 1: platform -# 2: variable prefix -# 3: architectures -ifdef INCLUDE_IOS -ifdef INCLUDE_DEVICE -$(eval $(call PlatformTemplate,iphoneos,IPHONEOS,$(IOS_DEVICE_ARCHITECTURES))) -endif -$(eval $(call PlatformTemplate,iphonesimulator,IOSSIMULATOR,$(IOS_SIMULATOR_ARCHITECTURES))) -endif -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)) -endif -$(eval $(call PlatformTemplate,tvsimulator,TVSIMULATOR,x86_64)) -endif - -# -# LibTemplate we build two different libraries from the same source code, -# libapp.a and libextension.a -# -# They're all built from the same soure file (extension-main.m), but with different defines: -# libextension.a has EXTENSION defined. -# - -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 - $(Q) rm -f $$@ - $$(call Q_2,AR, [$1]) $(DEVICE_BIN_PATH)/ar cru $$@ $$^ - -.libs/$(1)/libapp.%.a: .libs/$(1)/app-main.%.o - $(Q) rm -f $$@ - $$(call Q_2,AR, [$1]) $(DEVICE_BIN_PATH)/ar cru $$@ $$^ - -.libs/$(1)/libextension.a: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/libextension.$$(arch).a) - $(Q) rm -f $$@ - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ - -.libs/$(1)/libapp.a: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/libapp.$$(arch).a) - $(Q) rm -f $$@ - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ - -.libs/$(1)/libtvextension.%.a: .libs/$(1)/tvextension-main.%.o - $(Q) rm -f $$@ - $$(call Q_2,AR, [$1]) $(DEVICE_BIN_PATH)/ar cru $$@ $$^ - -.libs/$(1)/libtvextension.a: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/libtvextension.$$(arch).a) - $(Q) rm -f $$@ - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ - -.libs/$(1)/libxamarin.dylib: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/libxamarin.$$(arch).dylib) - $(Q) rm -f $$@ -ifeq (1,$$(words $$($(2)_ARCHITECTURES))) - $(Q) $(CP) $$^ $$@ -else - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ -endif - $(Q) install_name_tool -id @rpath/libxamarin.dylib $$@ - $(Q) install_name_tool -change @rpath/ @rpath/libmonosgen-2.0.dylib $$@ - -.libs/$(1)/libxamarin-debug.dylib: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/libxamarin-debug.$$(arch).dylib) - $(Q) rm -f $$@ -ifeq (1,$$(words $$($(2)_ARCHITECTURES))) - $(Q) $(CP) $$^ $$@ -else - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ -endif - $(Q) install_name_tool -id @rpath/libxamarin-debug.dylib $$@ - $(Q) install_name_tool -change @rpath/ @rpath/libmonosgen-2.0.dylib $$@ - -.SECONDARY: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/app-main.$$(arch).o) -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)) - -# -# LibXamarinTemplate (and LibXamarinArchTemplate) builds libxamarin.a -# - -define LibXamarinArchTemplate -.libs/$(1)/libxamarin$(4).$(5).a: $$($(5)_$(1)$(3)_OBJECTS) - $$(Q) rm -f $$@ - $$(call Q_2,AR, [$1]) $(DEVICE_BIN_PATH)/ar Scru $$@ $$^ - $$(call Q_2,RANLIB,[$1]) $(DEVICE_BIN_PATH)/ranlib -no_warning_for_no_symbols -q $$@ -endef - -define LibXamarinTemplate - -$(1)$(3)_COMMON_DYLIB_FLAGS = -lmonosgen-2.0 -Wl,-install_name,libxamarin$(4).dylib -framework Foundation -framework CFNetwork -framework UIKit -lz -$(1)$(3)_COMMON_FRAMEWORK_FLAGS = -framework Mono -Wl,-install_name,@rpath/Xamarin$(4).framework/Xamarin$(4) -framework Foundation -framework CFNetwork -framework UIKit -lz - -x86_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).x86.o,$$($(2)_SOURCE_STEMS)) $$(patsubst %,.libs/$(1)/%$(4).x86.o,$$($(2)_I386_SOURCE_STEMS)) -x86_64_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).x86_64.o,$$($(2)_SOURCE_STEMS)) $$(patsubst %,.libs/$(1)/%$(4).x86_64.o,$$($(2)_X86_64_SOURCE_STEMS)) -armv7_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).armv7.o,$$($(2)_SOURCE_STEMS)) -armv7s_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).armv7s.o,$$($(2)_SOURCE_STEMS)) -armv7k_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).armv7k.o,$$($(2)_SOURCE_STEMS)) -arm64_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).arm64.o,$$($(2)_SOURCE_STEMS)) $$(patsubst %,.libs/$(1)/%$(4).arm64.o,$$($(2)_ARM64_SOURCE_STEMS)) -arm64_32_$(1)$(3)_OBJECTS = $$(patsubst %,.libs/$(1)/%$(4).arm64_32.o,$$($(2)_SOURCE_STEMS)) - -$$(foreach arch,$$($(2)_ARCHITECTURES),$$(eval $$(call LibXamarinArchTemplate,$(1),$(2),$(3),$(4),$$(arch)))) - -.libs/$(1)/libxamarin$(4).a: $$(foreach arch,$$($(2)_ARCHITECTURES),.libs/$(1)/libxamarin$(4).$$(arch).a) - $(Q) rm -f $$@ - $$(call Q_2,LIPO, [$1]) $(DEVICE_BIN_PATH)/lipo $$^ -create -output $$@ - -.libs/$(1)/libxamarin$(4).x86.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) -.libs/$(1)/libxamarin$(4).x86.dylib: $$(x86_$(1)$(3)_OBJECTS) - -.libs/$(1)/libxamarin$(4).x86_64.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) -.libs/$(1)/libxamarin$(4).x86_64.dylib: $$(x86_64_$(1)$(3)_OBJECTS) - -.libs/$(1)/libxamarin$(4).armv7.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -.libs/$(1)/libxamarin$(4).armv7.dylib: $$(armv7_$(1)$(3)_OBJECTS) - -.libs/$(1)/libxamarin$(4).armv7s.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -.libs/$(1)/libxamarin$(4).armv7s.dylib: $$(armv7s_$(1)$(3)_OBJECTS) - -.libs/$(1)/libxamarin$(4).arm64.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) -.libs/$(1)/libxamarin$(4).arm64.dylib: $$(arm64_$(1)$(3)_OBJECTS) - -.libs/$(1)/libxamarin$(4).armv7k.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) -.libs/$(1)/libxamarin$(4).armv7k.dylib: $$(armv7k_$(1)$(3)_OBJECTS) - -.libs/$(1)/libxamarin$(4).arm64_32.dylib: EXTRA_FLAGS=$$($(1)$(3)_COMMON_DYLIB_FLAGS) -.libs/$(1)/libxamarin$(4).arm64_32.dylib: $$(arm64_32_$(1)$(3)_OBJECTS) - -.libs/$(1)/Xamarin$(4).x86.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) -.libs/$(1)/Xamarin$(4).x86.framework: $$(x86_$(1)$(3)_OBJECTS) - -.libs/$(1)/Xamarin$(4).x86_64.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) -.libs/$(1)/Xamarin$(4).x86_64.framework: $$(x86_64_$(1)$(3)_OBJECTS) - -.libs/$(1)/Xamarin$(4).armv7.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -.libs/$(1)/Xamarin$(4).armv7.framework: $$(armv7_$(1)$(3)_OBJECTS) - -.libs/$(1)/Xamarin$(4).armv7s.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) -miphoneos-version-min=$(MIN_IOS_SDK_VERSION) -.libs/$(1)/Xamarin$(4).armv7s.framework: $$(armv7s_$(1)$(3)_OBJECTS) - -.libs/$(1)/Xamarin$(4).arm64.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) -.libs/$(1)/Xamarin$(4).arm64.framework: $$(arm64_$(1)$(3)_OBJECTS) - -.libs/$(1)/Xamarin$(4).armv7k.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) -.libs/$(1)/Xamarin$(4).armv7k.framework: $$(armv7k_$(1)$(3)_OBJECTS) - -.libs/$(1)/Xamarin$(4).arm64_32.framework: EXTRA_FLAGS=$$($(1)$(3)_COMMON_FRAMEWORK_FLAGS) -.libs/$(1)/Xamarin$(4).arm64_32.framework: $$(arm64_32_$(1)$(3)_OBJECTS) -endef - -$(eval $(call LibXamarinTemplate,iphoneos,IPHONEOS)) -$(eval $(call LibXamarinTemplate,iphoneos,IPHONEOS,_DEBUG,-debug)) -$(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)) -$(eval $(call LibXamarinTemplate,tvsimulator,TVSIMULATOR,_DEBUG,-debug)) - -# -# Xamarin.Mac -# - -MAC_ARCHITECTURES = x86_64 arm64 - -CLANG_ARCH = $(addprefix -arch ,$(MAC_ARCHITECTURES)) -MAC_CLANG = DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) $(MAC_CC) -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) - -MAC_SHIPPED_HEADERS = xamarin/launch.h - -MAC_STATIC_CFLAGS = $(MAC_CFLAGS) - -MAC_SOURCES = $(SHARED_SOURCES) $(SHARED_X86_64_SOURCES) $(SHARED_ARM64_SOURCES) launcher.m - -ALLOWED_UNDEFINED_SYMBOLS = _xamarin_enable_debug _xammac_setup - -MAC_LIBS = \ - libextension.a \ - libxammac.a \ - libxammac-debug.a \ - libxammac-classic.a \ - libxammac-classic-debug.a\ - libxammac.dylib \ - libxammac-debug.dylib \ - libxammac-system.a \ - libxammac-system-debug.a \ - libxammac-system-classic.a \ - libxammac-system-classic-debug.a \ - -# -# libxammac[-debug].a: (no defines) -# This is linked into the native executable when embedding the Mono runtime. -# -# libxammac[-debug].dylib: -DDYNAMIC_MONO_RUNTIME -DDYLIB -# This is not officially supported. It's used when not wanting to use mmp for -# whatever reason (usually to make build processes easier). There is no good -# reason to keep using it, since mmp now supports creating empty 'shell' apps -# with no assemblies, which the user can fill in as they want. -# -# libxammac-system[-debug].a: -DDYNAMIC_MONO_RUNTIME -# This is used linked into the native executable when using the system Mono (i.e. not) -# embedding the Mono runtime). -# -# libxamarin-coreclr.a: -# This is used when using the CoreCLR runtime instead of Mono. -# CORECLR_RUNTIME is defined for these versions of libxamarin. -# -# libxamarin-nativeaot.a: -# This is used when using NativeAOT. -# CORECLR_RUNTIME is defined for these versions of libxamarin (because the nativeaot bridge shares *a lot* of code with the coreclr bridge) -# NATIVEAOT is defined for these versions of libxamarin -# - -ifdef INCLUDE_XAMARIN_LEGACY -all-local:: $(TARGETS) -endif - -define ObjTemplate -DYNAMIC_DYLIB$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basename $$(src))$(3).dylib.$(1).o) -STATIC_LAUNCHER$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basename $$(src))$(3).static.$(1).o) -SYSTEM_LAUNCHER$(2)_OBJECTS = $$(foreach src,$$(MAC_SOURCES),.libs/mac/$$(basename $$(src))$(3).system.$(1).o) - -.libs/mac/%$(3).dylib.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_OBJC_CFLAGS) $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$< - -.libs/mac/%$(3).dylib.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -DDYLIB -o $$@ $$< - -.libs/mac/%$(3).static.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$< - -.libs/mac/%$(3).static.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_STATIC_CFLAGS) -o $$@ $$< - -.libs/mac/%$(3).system.$(1).o: %.m $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,OBJC, [mac]) $(MAC_CLANG) -arch $(1) $(4) $$(MAC_OBJC_CFLAGS) -c $$(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$< - -.libs/mac/%$(3).system.$(1).o: %.s $$(SHARED_HEADERS) | .libs/mac - $$(call Q_2,ASM, [mac]) $(MAC_CLANG) -arch $(1) $(4) -c $(MAC_CFLAGS) -DDYNAMIC_MONO_RUNTIME -o $$@ $$< - -.libs/mac/libxammac$(3).$(1).dylib: $$(DYNAMIC_DYLIB$(2)_OBJECTS) - $$(call Q_2,LD, [mac]) $(MAC_CLANG) -arch $(1) -dynamiclib $$(MAC_LDFLAGS) -Wl,-install_name,libxammac$(3).dylib -o $$@ $$^ $$(addprefix -Xlinker -U -Xlinker ,$$(ALLOWED_UNDEFINED_SYMBOLS)) - -.libs/mac/libxammac$(3).$(1).a: $$(STATIC_LAUNCHER$(2)_OBJECTS) - $$(call Q_2,LIB, [mac]) xcrun libtool -no_warning_for_no_symbols -static -o $$@ $$^ - -.libs/mac/libxammac-system$(3).$(1).a: $$(SYSTEM_LAUNCHER$(2)_OBJECTS) - $$(call Q_2,LIB, [mac]) xcrun libtool -no_warning_for_no_symbols -static -o $$@ $$^ - -endef - -$(eval $(call ObjTemplate,x86_64,64,,,64)) -$(eval $(call ObjTemplate,x86_64,DEBUG64,-debug,-DDEBUG,64)) -$(eval $(call ObjTemplate,arm64,64,,,64)) -$(eval $(call ObjTemplate,arm64,DEBUG64,-debug,-DDEBUG,64)) - -$(foreach arch,$(MAC_ARCHITECTURES),.libs/mac/extension-main.$(arch).o): EXTRA_DEFINES=-DEXTENSION - -.libs/mac/extension-main.%.o: | .libs/mac - $(Q) rm -f $@ - $(call Q_2,CC, [mac]) $(MAC_CLANG) -c -DEXTENSION extension-main.m -arch $* -o $@ - -.libs/mac/libextension.%.a: .libs/mac/extension-main.%.o - $(Q) rm -f $@ - $(call Q_2,AR, [mac]) $(DEVICE_BIN_PATH)/ar cru $@ $^ - -.libs/mac/libextension.a: $(foreach arch,$(MAC_ARCHITECTURES),.libs/mac/libextension.$(arch).a) - $(Q) rm -f $@ - $(call Q_2,LIPO, [mac]) $(DEVICE_BIN_PATH)/lipo $^ -create -output $@ - -.libs/mac/libxammac-debug.dylib: .libs/mac/libxammac-debug.x86_64.dylib .libs/mac/libxammac-debug.arm64.dylib - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -.libs/mac/libxammac.dylib: .libs/mac/libxammac.x86_64.dylib .libs/mac/libxammac.arm64.dylib - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -.libs/mac/libxammac-debug.a: .libs/mac/libxammac-debug.x86_64.a .libs/mac/libxammac-debug.arm64.a - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -.libs/mac/libxammac.a: .libs/mac/libxammac.x86_64.a .libs/mac/libxammac.arm64.a - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -.libs/mac/libxammac-system-debug.a: .libs/mac/libxammac-system-debug.x86_64.a .libs/mac/libxammac-system-debug.arm64.a - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -.libs/mac/libxammac-system.a: .libs/mac/libxammac-system.x86_64.a .libs/mac/libxammac-system.arm64.a - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -.libs/mac/libxammac-%.a: $(MACIOS_BINARIES_PATH)/libxammac-%.a | .libs/mac - $(Q) $(CP) $< $@ - -.libs/mac/libxamarin%.a: .libs/mac/libxamarin%.x86_64.a - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -.libs/mac/libxamarin%.dylib: .libs/mac/libxamarin%.x86_64.dylib - $(call Q_2,LIPO, [mac]) xcrun lipo -create $^ -o $@ - -RUNTIME_MAC_TARGETS_DIRS += \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono \ - $(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/lib \ - $(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/include/xamarin \ - -RUNTIME_MAC_TARGETS += \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/XamMacLauncher \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/XamMacLauncher \ - $(foreach file,$(SHIPPED_HEADERS),$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/include/$(file)) \ - $(foreach file,$(MAC_SHIPPED_HEADERS),$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/include/$(file)) \ - $(foreach file,$(MAC_LIBS),$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/lib/$(file)) \ - -# The XamMacLauncher file must exist for VSfM to be able to open XM/Classic projects (so that people can use the migration wizard) -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/XamMacLauncher: | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib - $(Q) touch $@ - -$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/lib/%: .libs/mac/% | $(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/lib - $(Q) $(CP) $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/XamMacLauncher: | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono - $(Q) ln -sF ../XamMacLauncher $@ - -$(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/include/%.h: %.h | $(MAC_DESTDIR)$(XAMARIN_MACOS_SDK)/include/xamarin - $(Q) install -m 0644 $< $@ - -$(RUNTIME_MAC_TARGETS_DIRS): - $(Q) mkdir -p $@ - -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_MAC -all-local:: $(RUNTIME_MAC_TARGETS) -install-local:: $(RUNTIME_MAC_TARGETS) -endif -endif - # # .NET # @@ -770,10 +266,8 @@ dotnet: $(DOTNET_TARGETS) $(DOTNET_TARGET_DIRS): $(Q) mkdir -p $@ -ifdef ENABLE_DOTNET all-local:: $(DOTNET_TARGETS) install-local:: $(DOTNET_TARGETS) -endif # # Common diff --git a/runtime/swift-functions.swift b/runtime/swift-functions.swift new file mode 100644 index 000000000000..5b3ba250f508 --- /dev/null +++ b/runtime/swift-functions.swift @@ -0,0 +1,29 @@ +#if canImport(AppKit) +import AppKit +#endif +import Foundation +import StoreKit +#if canImport(UIKit) +import UIKit +#endif + +#if os(macOS) +public typealias PlatformScene = NSViewController +#elseif !os(tvOS) +@available(iOS 13, macCatalyst 13.1, *) +public typealias PlatformScene = UIWindowScene +#endif + + +@objc(XamarinSwiftFunctions) +public class XamarinSwiftFunctions : NSObject { +#if !os(tvOS) + @MainActor + @objc(requestReview:) + @available(iOS 16, macCatalyst 16, macOS 13, *) + public static func StoreKit_RequestReview(scene: PlatformScene) + { + AppStore.requestReview(in: scene) + } +#endif +} diff --git a/scripts/Directory.Build.props b/scripts/Directory.Build.props new file mode 100644 index 000000000000..a68c92a6c121 --- /dev/null +++ b/scripts/Directory.Build.props @@ -0,0 +1,9 @@ + + + + Exe + enable + enable + false + + diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 000000000000..7dd1ea2646e9 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,45 @@ +# Scripts + +This directory contains numerous short C# scripts, each in their own directory +with its own project file. + +To create a new script, the easy way is to run the `new-script.sh` script. + +The harder way is to copy an existing script directory, and: + +* Rename the csproj file to match the directory name. +* Add your C# code, and document what it's supposed to do in a README.md file. +* Edit the arguments to the `TemplateScript` template in the `fragment.mk` + file according to how you named your script (directory). The first argument + will be used in other makefiles that use the script, the second is the name + of the script (directory). Say your script is `my-script`, then that would be: + + ```make + $(eval $(call TemplateScript,MY_SCRIPT,my-script)) + +To use the new script: + +1. In the consuming `Makefile`, import the `fragment.mk` file from the script directory: + + ```make + include $(TOP)/scripts/my-script/fragment.mk + ``` + +2. In the target where you want to execute the script, depend on the script executable, which is named `MY_SCRIPT` (from the call to the `TemplateScript` template): + + ```make + dostuff: $(MY_SCRIPT) + echo "Doing stuff" + ``` + + This makes sure the script is actually built before you want to execute it. + +3. The actual invocation to call the script, is the same variable, but with `_EXEC` appended: + + ```make + dostuff: $(MY_SCRIPT) + $(MY_SCRIPT_EXEC) --arguments to/my/script + ``` + +Sidenote: if https://github.com/dotnet/designs/pull/296 were ever implemented, +we could dispense with the project file, making these C# files actual scripts. \ No newline at end of file diff --git a/scripts/generate-defines/README.md b/scripts/generate-defines/README.md new file mode 100644 index 000000000000..e1844fe637ba --- /dev/null +++ b/scripts/generate-defines/README.md @@ -0,0 +1,17 @@ +# generate-defines + +This script takes the list of frameworks that are supported for a given +platform, and generates a response file for the C# compiler with a +`HAS_` define for each framework. + +Example output file for iOS: + +``` +-d:HAS_ACCELERATE +-d:HAS_ACCESSIBILITY +-d:HAS_ACCESSORYSETUPKIT +-d:HAS_ACCOUNTS +[...] +-d:HAS_WEBKIT +-d:HAS_XKIT +``` diff --git a/scripts/generate-defines/fragment.mk b/scripts/generate-defines/fragment.mk new file mode 100644 index 000000000000..9e4f50881f51 --- /dev/null +++ b/scripts/generate-defines/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_DEFINES,generate-defines)) diff --git a/scripts/generate-defines/generate-defines.cs b/scripts/generate-defines/generate-defines.cs new file mode 100755 index 000000000000..3397290cfd2f --- /dev/null +++ b/scripts/generate-defines/generate-defines.cs @@ -0,0 +1,23 @@ +using System.IO; +using System.Text; + +try { + var expectedArgumentCount = 2; + if (args.Length != expectedArgumentCount) { + Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length} arguments"); + return 1; + } + + var output = args [0]; + var frameworks = args [1].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + + var sb = new StringBuilder (); + foreach (var fw in frameworks.OrderBy (v => v)) + sb.AppendLine ($"-d:HAS_{fw.ToUpperInvariant ()}"); + File.WriteAllText (output, sb.ToString ()); + + return 0; +} catch (Exception e) { + Console.WriteLine ("Failed: {0}", e); + return 1; +} diff --git a/scripts/generate-defines/generate-defines.csproj b/scripts/generate-defines/generate-defines.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-defines/generate-defines.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/generate-errors/README.md b/scripts/generate-errors/README.md new file mode 100644 index 000000000000..357d99fbbdd8 --- /dev/null +++ b/scripts/generate-errors/README.md @@ -0,0 +1,29 @@ +# generate-errors + +This script takes a resource resx as input, and generates a C# file with constants for each resource string (which won't be localizable, because they're constant strings). + +Example input: + +```xml + + + + Unexpected error - Please fill a bug report at https://github.com/xamarin/xamarin-macios/issues/new + + +``` + +Example output: + +```cs +//------------------------------------------------------------------------------ +// +// This code was generated by a tool: generate-errors.csharp +// +//------------------------------------------------------------------------------ +namespace Xamarin.Bundler { + internal class Errors { + internal const string MT0000 = "Unexpected error - Please fill a bug report at https://github.com/xamarin/xamarin-macios/issues/new"; + } +} +``` diff --git a/scripts/generate-errors/fragment.mk b/scripts/generate-errors/fragment.mk new file mode 100644 index 000000000000..9f5adaa9c898 --- /dev/null +++ b/scripts/generate-errors/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_ERRORS,generate-errors)) diff --git a/scripts/generate-errors/generate-errors.cs b/scripts/generate-errors/generate-errors.cs new file mode 100755 index 000000000000..744ed7120263 --- /dev/null +++ b/scripts/generate-errors/generate-errors.cs @@ -0,0 +1,35 @@ +using System.IO; +using System.Text; +using System.Xml; + +var file = args [0]; +var output = args [1]; +var doc = new XmlDocument (); +doc.Load (file); + +var sb = new StringBuilder (); +sb.Append ( +@"//------------------------------------------------------------------------------ +// +// This code was generated by a tool: generate-errors.csharp +// +//------------------------------------------------------------------------------ + +namespace Xamarin.Bundler { + internal class Errors { +"); + +foreach (XmlNode node in doc.SelectNodes ("/root/data")!) { + var name = node.Attributes! ["name"]!.InnerText; + if (name == "default") { + name = "@" + name; + } + var value = node.ChildNodes [1]!.InnerText + .Trim () + .Replace ("\\", "\\\\") + .Replace ("\"", "\\\""); + sb.AppendLine ($"\t\tinternal const string {name} = \"{value}\";"); +} + +sb.AppendLine ("\t}\n}"); +File.WriteAllText (output, sb.ToString ()); diff --git a/scripts/generate-errors/generate-errors.csproj b/scripts/generate-errors/generate-errors.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-errors/generate-errors.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/generate-frameworks/README.md b/scripts/generate-frameworks/README.md new file mode 100644 index 000000000000..b5ee55a9db4e --- /dev/null +++ b/scripts/generate-frameworks/README.md @@ -0,0 +1,29 @@ +# generate-frameworks + +This script takes the list of frameworks that are supported for all platforms, +and generates a C# file with a hashtable of all the frameworks for each +platform. + +Example output file for iOS: + +```cs +using System.Collections.Generic; + +partial class Frameworks { + internal readonly HashSet iosframeworks = new HashSet { + "Accelerate", + "Accessibility", + "AccessorySetupKit", + /// ... + "WebKit", + "XKit", + }; + internal readonly HashSet macosframeworks = new HashSet { + "Accelerate", + "Accessibility", + /// ... + "WebKit", + "XKit", + }; +} +``` diff --git a/scripts/generate-frameworks/fragment.mk b/scripts/generate-frameworks/fragment.mk new file mode 100644 index 000000000000..b83a7fc24a30 --- /dev/null +++ b/scripts/generate-frameworks/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_FRAMEWORKS,generate-frameworks)) diff --git a/scripts/generate-frameworks/generate-frameworks.cs b/scripts/generate-frameworks/generate-frameworks.cs new file mode 100755 index 000000000000..e3d23815bb42 --- /dev/null +++ b/scripts/generate-frameworks/generate-frameworks.cs @@ -0,0 +1,70 @@ +using System.IO; +using System.Text; + +try { + var actualArgumentCount = 6; + if (args.Length != actualArgumentCount) { + Console.WriteLine ($"Need {actualArgumentCount} arguments, got {args.Length} arguments"); + return 1; + } + + var csharpOutput = args [0]; + + args = args.Skip (1).ToArray (); + + var iosframeworks = args [0].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var macosframeworks = args [1].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var watchosframeworks = args [2].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var tvosframeworks = args [3].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var maccatalystframeworks = args [4].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var allframeworks = new string [] [] { + iosframeworks, + macosframeworks, + watchosframeworks, + tvosframeworks, + maccatalystframeworks, + }; + var names = new string [] { + "iosframeworks", + "macosframeworks", + "watchosframeworks", + "tvosframeworks", + "maccatalystframeworks", + }; + + var all = new HashSet (); + foreach (var fws in allframeworks) + foreach (var fw in fws) + all.Add (fw); + + var sb = new StringBuilder (); + sb.AppendLine ("using System.Collections.Generic;"); + sb.AppendLine (); + sb.AppendLine ("partial class Frameworks {"); + + for (int i = 0; i < names.Length; i++) { + var name = names [i]; + var frameworks = allframeworks [i]; + sb.AppendLine ($"\t// GENERATED FILE - DO NOT EDIT"); + sb.AppendLine ($"\tinternal readonly HashSet {name} = new HashSet {{"); + foreach (var fw in frameworks.OrderBy (v => v)) { + sb.AppendLine ($"\t\t\"{fw}\","); + } + sb.AppendLine ("\t};"); + } + + var allArray = all.ToArray (); + Array.Sort (allArray); + foreach (var fw in allArray) + sb.AppendLine ($"\tbool? _{fw.Replace (".", "")};"); + foreach (var fw in allArray) + sb.AppendLine ($"\tpublic bool Have{fw} {{ get {{ if (!_{fw}.HasValue) _{fw} = GetValue (\"{fw}\"); return _{fw}.Value; }} }}"); + sb.AppendLine ("}"); + + File.WriteAllText (csharpOutput, sb.ToString ()); + + return 0; +} catch (Exception e) { + Console.WriteLine ("Failed: {0}", e); + return 1; +} diff --git a/scripts/generate-frameworks/generate-frameworks.csproj b/scripts/generate-frameworks/generate-frameworks.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-frameworks/generate-frameworks.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/generate-sourcelink-json/README.md b/scripts/generate-sourcelink-json/README.md new file mode 100644 index 000000000000..c4157a401600 --- /dev/null +++ b/scripts/generate-sourcelink-json/README.md @@ -0,0 +1,18 @@ +# generate-sourcelink-json + +This script generates a SourceLink.json file that maps paths of local source +code into links to GitHub source code. + +This SourceLink.json file is then passed to the C# compiler, which embeds it +in the pdb file, and which is then consumed by debuggers or IDEs to find the +source code online for any given source file the pdb refers to. + +Example output file: + +```json +{ + "documents": { + "/local/path/to/xamarin-macios/src*": "https://raw.githubusercontent.com/xamarin/xamarin-macios/c2c617bf000c4ff864cbba9d65421f915941136b/src*" + } +} +``` diff --git a/scripts/generate-sourcelink-json/fragment.mk b/scripts/generate-sourcelink-json/fragment.mk new file mode 100644 index 000000000000..da84737c3cbe --- /dev/null +++ b/scripts/generate-sourcelink-json/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_SOURCELINK_JSON,generate-sourcelink-json)) diff --git a/scripts/generate-sourcelink-json/generate-sourcelink-json.cs b/scripts/generate-sourcelink-json/generate-sourcelink-json.cs new file mode 100755 index 000000000000..6597a9b912ef --- /dev/null +++ b/scripts/generate-sourcelink-json/generate-sourcelink-json.cs @@ -0,0 +1,15 @@ +using System.IO; +using System.Text; + +var idx = 0; +var latestCommit = args [idx++]; +var src = args [idx++]; +var outputPath = args [idx++]; + +using (var writer = new StreamWriter (outputPath)) { + writer.WriteLine ("{"); + writer.WriteLine (" \"documents\": {"); + writer.WriteLine ($" \"{src}*\": \"https://raw.githubusercontent.com/xamarin/xamarin-macios/{latestCommit}/src*\""); + writer.WriteLine (" }"); + writer.WriteLine ("}"); +} diff --git a/scripts/generate-sourcelink-json/generate-sourcelink-json.csproj b/scripts/generate-sourcelink-json/generate-sourcelink-json.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-sourcelink-json/generate-sourcelink-json.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/generate-target-platforms/README.md b/scripts/generate-target-platforms/README.md new file mode 100644 index 000000000000..cae313f9e925 --- /dev/null +++ b/scripts/generate-target-platforms/README.md @@ -0,0 +1,6 @@ +# generate-target-platforms + +This script takes the $(TOP)/builds/Versions-.plist document as input, and generates the `Microsoft..Sdk.SupportedTargetPlatforms.props` file as output, where we: + +* List all the supported OS versions for a given platform (`SdkSupportedTargetPlatformVersion`). +* State the minimum OS version we support (`MinSupportedOSPlatformVersion`). diff --git a/scripts/generate-target-platforms/fragment.mk b/scripts/generate-target-platforms/fragment.mk new file mode 100644 index 000000000000..905fa1992674 --- /dev/null +++ b/scripts/generate-target-platforms/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_TARGET_PLATFORMS,generate-target-platforms)) diff --git a/scripts/generate-target-platforms/generate-target-platforms.cs b/scripts/generate-target-platforms/generate-target-platforms.cs new file mode 100755 index 000000000000..0bc9ddb6acd6 --- /dev/null +++ b/scripts/generate-target-platforms/generate-target-platforms.cs @@ -0,0 +1,54 @@ +// arguments are: + +using System.IO; +using System.Xml; + +var expectedArgumentCount = 4; +if (args.Length != expectedArgumentCount) { + Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}"); + return 1; +} + +var idx = 0; +var platform = args [idx++]; +var dotnetTfm = args [idx++]; +var supportedApiVersions = args [idx++].Split (' ').Select (v => v.Replace (dotnetTfm + "-", "")).ToArray (); +var outputPath = args [idx++]; +var plistPath = $"../builds/Versions-{platform}.plist.in"; + +var doc = new XmlDocument (); +doc.Load (plistPath); +var supportedTargetPlatformVersions = doc.SelectNodes ($"/plist/dict/key[text()='SupportedTargetPlatformVersions']/following-sibling::dict[1]/key[text()='{platform}']/following-sibling::array[1]/string")!.Cast ().Select (v => v.InnerText).ToArray (); + +var currentSupportedTPVs = supportedTargetPlatformVersions.Where (v => v.StartsWith (dotnetTfm + "-", StringComparison.Ordinal)).Select (v => v.Substring (dotnetTfm.Length + 1)); +var minSdkVersionName = $"DOTNET_MIN_{platform.ToUpper ()}_SDK_VERSION"; +var minSdkVersionString = File.ReadAllLines ("../Make.config").Single (v => v.StartsWith (minSdkVersionName + "=", StringComparison.Ordinal)).Substring (minSdkVersionName.Length + 1); +var minSdkVersion = Version.Parse (minSdkVersionString); + +Console.WriteLine (string.Join (";", supportedApiVersions)); + +using (TextWriter writer = new StreamWriter (outputPath)) { + writer.WriteLine ($""); + writer.WriteLine ($""); + writer.WriteLine (""); + writer.WriteLine ("\t"); + + foreach (var version in supportedTargetPlatformVersions) { + writer.Write ($"\t\t<{platform}SdkSupportedTargetPlatformVersion Include=\"{version}\" "); + if (!supportedApiVersions.Contains (version)) + writer.Write ($"DefineConstantsOnly=\"true\" "); + writer.WriteLine ("/>"); + } + + writer.WriteLine ("\t"); + writer.WriteLine ("\t"); + writer.WriteLine ($"\t\t"); + writer.WriteLine ("\t"); + writer.WriteLine ("\t"); + writer.WriteLine ($"\t\t<{platform}MinSupportedOSPlatformVersion>{minSdkVersionString}"); + writer.WriteLine ($"\t\t$({platform}MinSupportedOSPlatformVersion)"); + writer.WriteLine ("\t"); + writer.WriteLine (""); +} + +return 0; diff --git a/scripts/generate-target-platforms/generate-target-platforms.csproj b/scripts/generate-target-platforms/generate-target-platforms.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-target-platforms/generate-target-platforms.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/generate-vs-workload/README.md b/scripts/generate-vs-workload/README.md new file mode 100644 index 000000000000..0a20f1872459 --- /dev/null +++ b/scripts/generate-vs-workload/README.md @@ -0,0 +1,4 @@ +# generate-vs-workload + +This script generates a file named `vs-workload.props`, which is a file used +by our publishing workflow to insert our workload into Visual Studio. diff --git a/scripts/generate-vs-workload/fragment.mk b/scripts/generate-vs-workload/fragment.mk new file mode 100644 index 000000000000..83deb491a67c --- /dev/null +++ b/scripts/generate-vs-workload/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_VS_WORKLOAD,generate-vs-workload)) diff --git a/scripts/generate-vs-workload/generate-vs-workload.cs b/scripts/generate-vs-workload/generate-vs-workload.cs new file mode 100755 index 000000000000..17095ee52603 --- /dev/null +++ b/scripts/generate-vs-workload/generate-vs-workload.cs @@ -0,0 +1,88 @@ +// arguments are: +// --shorten long=short +// --platform +// --windows-platform + +using System.IO; +using System.Security.Cryptography; +using System.Text; +using System.Xml; + +var shorten = new Dictionary (); +var platforms = new List<(string, string)> (); +var windowsPlatforms = new List (); +var tfm = string.Empty; +var outputPath = string.Empty; + +var queue = new Queue (args); + +while (queue.Any ()) { + var arg = queue.Dequeue (); + switch (arg) { + case "--shorten": + var values = queue.Dequeue ().Split ('='); + shorten [values [0]] = values [1]; + break; + case "--platform": + var platform = queue.Dequeue (); + var version = queue.Dequeue (); + platforms.Add ((platform, version)); + break; + case "--windows-platform": + windowsPlatforms.Add (queue.Dequeue ()); + break; + case "--output": + outputPath = queue.Dequeue (); + break; + case "--tfm": + tfm = queue.Dequeue (); + break; + default: + Console.Error.WriteLine ($"Unknown argument: {arg}"); + return 1; + } +} + +using (TextWriter writer = new StreamWriter (outputPath)) { + writer.WriteLine ($""); + writer.WriteLine ($""); + writer.WriteLine ($" "); + var allPlatforms = string.Join (".", platforms.Select (v => v.Item1).OrderBy (v => v)); + writer.WriteLine ($" Microsoft.NET.Sdk.{allPlatforms}.Workload.{tfm}"); + // Find the iOS version, otherwise use the version of the first platform listed. + var iOSPlatform = platforms.Where (v => v.Item1 == "iOS"); + var manifestBuildVersion = iOSPlatform.Any () ? iOSPlatform.First ().Item2 : platforms.First ().Item2; + writer.WriteLine ($" {manifestBuildVersion}"); + writer.WriteLine ($" true"); + writer.WriteLine ($" false"); + writer.WriteLine ($" "); + writer.WriteLine ($" "); + writer.WriteLine ($" "); + foreach (var entry in shorten) { + var longName = entry.Key; + var shortName = entry.Value; + writer.WriteLine ($" "); + writer.WriteLine ($" {shortName}"); + writer.WriteLine ($" "); + } + foreach (var entry in platforms) { + var platform = entry.Item1; + var version = entry.Item2; + var longPlatform = platform; + var description = $".NET SDK Workload for building {platform} applications."; + if (platform == "MacCatalyst") { + longPlatform = "Mac Catalyst"; + description = ".NET SDK Workload for building macOS applications with Mac Catalyst."; + } + writer.WriteLine ($" "); + } + foreach (var entry in platforms) { + var platform = entry.Item1; + var version = entry.Item2; + writer.WriteLine ($" "); + } + writer.WriteLine (" "); + writer.WriteLine (""); +} + +return 0; diff --git a/scripts/generate-vs-workload/generate-vs-workload.csproj b/scripts/generate-vs-workload/generate-vs-workload.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-vs-workload/generate-vs-workload.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/generate-workloadmanifest-json/README.md b/scripts/generate-workloadmanifest-json/README.md new file mode 100644 index 000000000000..f9c2fe87fe67 --- /dev/null +++ b/scripts/generate-workloadmanifest-json/README.md @@ -0,0 +1,6 @@ +# generate-workloadmanifest-json + +This script generates the `WorkloadManifest.json` file, which is a file that describes what's in a workload. + +More information about workload manifests can be found here: +https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-manifest.md diff --git a/scripts/generate-workloadmanifest-json/fragment.mk b/scripts/generate-workloadmanifest-json/fragment.mk new file mode 100644 index 000000000000..8c7d389b7780 --- /dev/null +++ b/scripts/generate-workloadmanifest-json/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_WORKLOADMANIFEST_JSON,generate-workloadmanifest-json)) diff --git a/scripts/generate-workloadmanifest-json/generate-workloadmanifest-json.cs b/scripts/generate-workloadmanifest-json/generate-workloadmanifest-json.cs new file mode 100755 index 000000000000..6b94c9b37fed --- /dev/null +++ b/scripts/generate-workloadmanifest-json/generate-workloadmanifest-json.cs @@ -0,0 +1,136 @@ +// arguments are: + +using System.IO; +using System.Xml; + +var expectedArgumentCount = 9; +if (args.Length != expectedArgumentCount) { + Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}"); + return 1; +} + +var argumentIndex = 0; +var platform = args [argumentIndex++]; +var version = args [argumentIndex++]; +var net8Version = args [argumentIndex++]; +var runtimeIdentifiers = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); +var outputPath = args [argumentIndex++]; +var windowsPlatforms = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); +var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0; +var currentApiVersion = args [argumentIndex++]; +var supportedApiVersions = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); +var versionsPropsPath = args [argumentIndex++]; + +var platformLowerCase = platform.ToLowerInvariant (); + +var allApiVersions = new List (supportedApiVersions); +allApiVersions = allApiVersions.Select (v => v.Replace ('-', '_')).ToList (); + +var versionsPropsTable = File.ReadAllLines (versionsPropsPath). + Where (v => v.Count (f => f == '>') > 1). + Select (v => { + var split = v.Trim ().Split (new char [] { '<', '>', '/' }, StringSplitOptions.RemoveEmptyEntries); + var name = split [0]; + var value = split [1]; + return new Tuple (name, value); + }). + ToDictionary (v => v.Item1, v => v.Item2, StringComparer.OrdinalIgnoreCase); + +var failed = false; +using (TextWriter writer = new StreamWriter (outputPath)) { + writer.WriteLine ($"{{"); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"workloads\": {{"); + writer.WriteLine ($" \"{platformLowerCase}\": {{"); + writer.WriteLine ($" \"description\": \".NET SDK Workload for building {platform} applications.\","); + writer.WriteLine ($" \"packs\": ["); + foreach (var tfm in allApiVersions) { + writer.WriteLine ($" \"Microsoft.{platform}.Sdk.{(tfm == "net8.0" ? "net8" : tfm)}\","); + } + if (hasWindows) { + foreach (var tfm in allApiVersions) { + writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.{(tfm == "net8.0" ? "net8" : tfm)}\","); + } + } + writer.WriteLine ($" \"Microsoft.{platform}.Ref.{currentApiVersion}\","); + foreach (var rid in runtimeIdentifiers) { + writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{currentApiVersion}\","); + } + writer.WriteLine ($" \"Microsoft.{platform}.Templates.net9\""); + writer.WriteLine ($" ],"); + writer.WriteLine ($" \"extends\": ["); + if (platform == "macOS") { + writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling\","); + writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling-net8\","); + } else { + writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}\","); + writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}-net8\","); + } + writer.WriteLine ($" ]"); + writer.WriteLine ($" }},"); + writer.WriteLine ($" }},"); + writer.WriteLine ($" \"packs\": {{"); + foreach (var tfmVersion in allApiVersions) { + string? apiVersion = null; + var tfm = tfmVersion; + if (tfm == currentApiVersion) { + apiVersion = version; + } else if (tfm == "net8.0") { + apiVersion = net8Version; + } else { + var propsPackageName = $"Microsoft{platform}Sdk" + tfm.Replace ("-", "").Replace (".", "") + "PackageVersion"; + if (!versionsPropsTable.TryGetValue (propsPackageName, out apiVersion)) { + Console.Error.WriteLine ($"❌ Unable to find a package version for {platform}/{tfm} in {versionsPropsPath}. Package name: {propsPackageName}"); + apiVersion = "?"; + failed = true; + } + } + writer.WriteLine ($" \"Microsoft.{platform}.Sdk.{(tfm == "net8.0" ? "net8" : tfm)}\": {{"); + writer.WriteLine ($" \"kind\": \"sdk\","); + writer.WriteLine ($" \"version\": \"{apiVersion}\","); + if (tfm == "net8.0") { + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Sdk\""); + writer.WriteLine ($" }}"); + } + writer.WriteLine ($" }},"); + if (hasWindows) { + writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.{(tfm == "net8.0" ? "net8" : tfm)}\": {{"); + writer.WriteLine ($" \"kind\": \"sdk\","); + writer.WriteLine ($" \"version\": \"{apiVersion}\","); + writer.WriteLine ($" \"alias-to\": {{"); + if (tfm == "net8.0") { + writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk\","); + } else { + writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk.{tfm}\","); + writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk.{tfm}\","); + writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk.{tfm}\","); + } + writer.WriteLine ($" }}"); + writer.WriteLine ($" }},"); + } + } + writer.WriteLine ($" \"Microsoft.{platform}.Ref.{currentApiVersion}\": {{"); + writer.WriteLine ($" \"kind\": \"framework\","); + writer.WriteLine ($" \"version\": \"{version}\""); + writer.WriteLine ($" }},"); + foreach (var rid in runtimeIdentifiers) { + writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{currentApiVersion}\": {{"); + writer.WriteLine ($" \"kind\": \"framework\","); + writer.WriteLine ($" \"version\": \"{version}\""); + writer.WriteLine ($" }},"); + } + writer.WriteLine ($" \"Microsoft.{platform}.Templates.net9\": {{"); + writer.WriteLine ($" \"kind\": \"template\","); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Templates\","); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }}"); + writer.WriteLine ($"}}"); +} + +return failed ? 1 : 0; diff --git a/scripts/generate-workloadmanifest-json/generate-workloadmanifest-json.csproj b/scripts/generate-workloadmanifest-json/generate-workloadmanifest-json.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-workloadmanifest-json/generate-workloadmanifest-json.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/generate-workloadmanifest-targets/README.md b/scripts/generate-workloadmanifest-targets/README.md new file mode 100644 index 000000000000..486d018b71ac --- /dev/null +++ b/scripts/generate-workloadmanifest-targets/README.md @@ -0,0 +1,6 @@ +# generate-workloadmanifest-targets + +This script generates the `WorkloadManifest.targets` file, which is a file with MSBuild logic to load our workload. + +More information about workload manifests can be found here: +https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-manifest.md diff --git a/scripts/generate-workloadmanifest-targets/fragment.mk b/scripts/generate-workloadmanifest-targets/fragment.mk new file mode 100644 index 000000000000..50785ef63680 --- /dev/null +++ b/scripts/generate-workloadmanifest-targets/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,GENERATE_WORKLOADMANIFEST_TARGETS,generate-workloadmanifest-targets)) diff --git a/scripts/generate-workloadmanifest-targets/generate-workloadmanifest-targets.cs b/scripts/generate-workloadmanifest-targets/generate-workloadmanifest-targets.cs new file mode 100755 index 000000000000..6f5b7fc0e333 --- /dev/null +++ b/scripts/generate-workloadmanifest-targets/generate-workloadmanifest-targets.cs @@ -0,0 +1,98 @@ +// arguments are: + +using System.IO; +using System.Xml; + +var expectedArgumentCount = 5; +if (args.Length != expectedArgumentCount) { + Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}"); + return 1; +} + +var argumentIndex = 0; +var platform = args [argumentIndex++]; +var outputPath = args [argumentIndex++]; +var windowsPlatforms = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); +var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0; +var currentApiVersion = args [argumentIndex++]; +var supportedApiVersions = args [argumentIndex++]; + +var platformLowerCase = platform.ToLowerInvariant (); + +var supportedTFMs = new List (); +supportedTFMs.AddRange (supportedApiVersions.Split (' ').Select (v => v.Replace ('-', '_'))); +supportedTFMs.Sort (); + +var supportedTFVs = new List (); + +var tfmToTpvAndTfv = new Func (tfm => { + var tfv = tfm.Replace ("net", ""); + var sep = tfv.IndexOfAny (new char [] { '-', '_' }); + var tpv = ""; + if (sep >= 0) { + tpv = tfv.Substring (sep + 1); + tfv = tfv.Substring (0, sep); + } + return (tfv, tpv); +}); + +// Find the latest TFM for each major .NET version. +// We import the workload for this TFM if there's no TPV specified in the TargetFramework. +var groupedByMajorDotNetVersion = supportedTFMs. + Where (v => v.IndexOfAny (new char [] { '-', '_' }) >= 0). + GroupBy (v => v.Split (new char [] { '-', '_' }) [0]); +var highestTpvPerMajorDotNet = groupedByMajorDotNetVersion. + Select (gr => { + var max = gr.OrderByDescending (el => { + var rv = tfmToTpvAndTfv (el); + return float.Parse (rv.Tpv, System.Globalization.CultureInfo.InvariantCulture); + }).First (); + return max; + }). + ToHashSet (); + +using (var writer = new StreamWriter (outputPath)) { + writer.WriteLine ($""); + foreach (var tfm in supportedTFMs) { + var parsed = tfmToTpvAndTfv (tfm); + var tfv = parsed.Tfv; + var tpv = parsed.Tpv; + supportedTFVs.Add (tfv); + var workloadVersion = tfm; + if (tfv [0] == '7') + workloadVersion = tfm.Replace (".0", ""); + if (highestTpvPerMajorDotNet.Contains (tfm)) { + writer.WriteLine ($" "); + writer.WriteLine ($" "); + } else if (tpv.Length > 0) { + writer.WriteLine ($" "); + writer.WriteLine ($" "); + } else { + writer.WriteLine ($" "); + writer.WriteLine ($" "); + } + + if (hasWindows) { + writer.WriteLine ($" "); + } + + writer.WriteLine ($" "); + writer.WriteLine (); + } + + var earliestSupportedTFV = supportedTFVs.Select (v => Version.Parse (v)).OrderBy (v => v).First (); + var latestSupportedTFV = supportedTFVs.Select (v => Version.Parse (v)).OrderBy (v => v).Last (); + writer.WriteLine ($" "); + writer.WriteLine ($" "); + writer.WriteLine ($" "); + writer.WriteLine ($" "); + writer.WriteLine (); + writer.WriteLine ($" "); + writer.WriteLine ($" "); + writer.WriteLine ($" "); + + writer.WriteLine ($""); + writer.WriteLine (); +} + +return 0; diff --git a/scripts/generate-workloadmanifest-targets/generate-workloadmanifest-targets.csproj b/scripts/generate-workloadmanifest-targets/generate-workloadmanifest-targets.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/generate-workloadmanifest-targets/generate-workloadmanifest-targets.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/new-script.sh b/scripts/new-script.sh new file mode 100755 index 000000000000..1bc20ef313e2 --- /dev/null +++ b/scripts/new-script.sh @@ -0,0 +1,34 @@ +#!/bin/bash -e + +echo 'Run this script to create a new script!' + +echo "" +if test -z "$SCRIPT_NAME"; then + read -p "What's the name of your new script? " SCRIPT_NAME + if test -z "$SCRIPT_NAME"; then + echo "Exiting, no script name provided" + exit 0 + fi +fi + +echo "Name of the new script: $SCRIPT_NAME" + +UPPER_NAME=$(echo "$SCRIPT_NAME" | tr 'a-z' "A-Z" | tr '-' '_') +echo "Variable name: $UPPER_NAME" + +mkdir -p "$SCRIPT_NAME" + +printf 'include $(TOP)/scripts/template.mk\n' > "$SCRIPT_NAME/fragment.mk" +printf "\$(eval \$(call TemplateScript,$UPPER_NAME,$SCRIPT_NAME))\n" >> "$SCRIPT_NAME/fragment.mk" + +printf '\n' > "$SCRIPT_NAME/$SCRIPT_NAME.csproj" +printf ' \n' >> "$SCRIPT_NAME/$SCRIPT_NAME.csproj" +printf ' net$(BundledNETCoreAppTargetFrameworkVersion)\n' >> "$SCRIPT_NAME/$SCRIPT_NAME.csproj" +printf ' \n' >> "$SCRIPT_NAME/$SCRIPT_NAME.csproj" +printf '\n' >> "$SCRIPT_NAME/$SCRIPT_NAME.csproj" + +printf "Console.WriteLine (\"Hello $SCRIPT_NAME\");\n" > "$SCRIPT_NAME/$SCRIPT_NAME.cs" + +printf "# $SCRIPT_NAME\n" > "$SCRIPT_NAME/README.md" + +echo "Your new script is located in ./$SCRIPT_NAME. Read the README.md in this directory for how to use it." diff --git a/scripts/run-with-timeout/README.md b/scripts/run-with-timeout/README.md new file mode 100644 index 000000000000..842d7a738878 --- /dev/null +++ b/scripts/run-with-timeout/README.md @@ -0,0 +1,20 @@ +# run-with-timeout + +This script runs an external process with a few extra features: + +* The process will be killed if it takes longer than the specified timeout. +* The process will be killed if it doesn't launch within 10 seconds. This is + implemented by passing the environment variable `LAUNCH_SENTINEL_FILE` (with + a path to a file) to the process, which has 10 seconds to create said file. +* If the launch timed out, the process will be relaunched, up to a maximum of + 10 attempts. + +The intented use case for this tool is to run tests, but with a timeout if the +tests hang. Also re-launch automatically if the test run doesn't successfully +start (this seems to happen randomly for Mac Catalyst sometimes). + +Syntax: + +```shell +run-with-timeout timeoutInSeconds command cmdarg1 cmdarg2 ... +``` diff --git a/scripts/run-with-timeout/fragment.mk b/scripts/run-with-timeout/fragment.mk new file mode 100644 index 000000000000..cc292fc5d2f3 --- /dev/null +++ b/scripts/run-with-timeout/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,RUN_WITH_TIMEOUT,run-with-timeout)) diff --git a/scripts/run-with-timeout/run-with-timeout.cs b/scripts/run-with-timeout/run-with-timeout.cs new file mode 100755 index 000000000000..0c6739b7a092 --- /dev/null +++ b/scripts/run-with-timeout/run-with-timeout.cs @@ -0,0 +1,108 @@ +// arguments are: + +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Threading; +using System.Xml; + +if (args.Length <= 1) { + Console.WriteLine ($"Need two arguments (the timeout + the command to launch), got {args.Length} argument(s)"); + return 1; +} + +var launchTimeout = TimeSpan.FromSeconds (10); // must launch within a few seconds. +var argIndex = 0; +var executionTimeout = TimeSpan.FromSeconds (int.Parse (args [argIndex++])); +var commands = args.Skip (argIndex).ToArray (); + +var pid = Process.GetCurrentProcess ().Id; +var maxLaunchAttempts = 10; +var exitCode = -1; +for (var attempt = 0; attempt < maxLaunchAttempts; attempt++) { + var launchTimeoutFile = Path.GetFullPath ($"launch-timeout-sentinel-{pid}-{attempt}.txt"); + var launchTimedOut = new ManualResetEvent (false); + var p = new Process (); + + var launchTimer = new Thread (() => { + if (p.WaitForExit ((int) launchTimeout.TotalMilliseconds)) { + Console.WriteLine ($"App finished before launch timeout triggered."); + } else if (!File.Exists (launchTimeoutFile)) { + Console.WriteLine ($"Launch timed out after {launchTimeout.TotalSeconds} seconds."); + launchTimedOut.Set (); + p.Abort (); + } + }) { + IsBackground = true, + }; + + try { + p.StartInfo.FileName = commands [0]; + p.StartInfo.Arguments = string.Join (" ", commands.Skip (1)); + p.StartInfo.UseShellExecute = false; + p.StartInfo.EnvironmentVariables ["LAUNCH_SENTINEL_FILE"] = launchTimeoutFile; + + Console.WriteLine ($"Launching (attempt #{attempt + 1}):"); + Console.WriteLine ($" {p.StartInfo.FileName} {p.StartInfo.Arguments}"); + + p.Start (); + + launchTimer.Start (); + + if (!p.WaitForExit ((int) executionTimeout.TotalMilliseconds)) { + Console.WriteLine ($"Execution timed out after {executionTimeout.TotalSeconds} seconds."); + p.Abort (); + p.WaitForExit (); + } + + launchTimer.Join (); + + exitCode = p.ExitCode; + + if (launchTimedOut.WaitOne (0)) { + Console.WriteLine ($"Launching again since the launch timeout triggered."); + continue; + } + Console.WriteLine ($"Execution completed with exit code {exitCode}"); + } finally { + File.Delete (launchTimeoutFile); + p.Dispose (); + } + break; +} + +return exitCode; + +static class NativeMethods { + [DllImport ("__Internal", SetLastError = true)] + static extern int kill (int pid, int signal); + + public static void Abort (this Process process) + { + var exitTimeout = TimeSpan.FromSeconds (60); + var pid = process.Id; + Console.WriteLine ($"kill ({pid}, 6);"); + var rv = kill (pid, 6 /* SIGABRT - this triggers a crash report */); + if (rv != 0) { + // This might randomly happen, because there's a race condition here: we waited for the process to exit, + // the timeout occurred so we decided to kill the process, and *then* the process exited, before we got + // around to kill it. In that case, the kill call would fail. + Console.WriteLine ($"Failed to execute 'kill -6 {pid}'. errno = {Marshal.GetLastWin32Error ()} - process already exited?"); + return; + } + var watch = Stopwatch.StartNew (); + while (watch.Elapsed < exitTimeout) { + Console.WriteLine ($"kill ({pid}, 0);"); + rv = kill (pid, 0); // check if pid is still alive (valid) + if (rv != 0) { + // Nope it's not, so it must have terminated. + return; + } + Thread.Sleep (50); + } + + // Send SIGKILL - time to finish it off. + Console.WriteLine ($"kill ({pid}, 9);"); + kill (pid, 9); + } +} diff --git a/scripts/run-with-timeout/run-with-timeout.csproj b/scripts/run-with-timeout/run-with-timeout.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/run-with-timeout/run-with-timeout.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/scripts/template.mk b/scripts/template.mk new file mode 100644 index 000000000000..3b7dc96f7398 --- /dev/null +++ b/scripts/template.mk @@ -0,0 +1,7 @@ +define TemplateScript +$(1)=$(TOP)/scripts/$(2)/bin/Debug/$(2).dll +$(1)_EXEC=$(DOTNET) exec $$($(1)) + +$$($(1)): $$(wildcard $$(TOP)/scripts/$(2)/*.cs) $$(wildcard $$(TOP)/scripts/$(2)/*.csproj) + $$(Q) $$(DOTNET) build $(TOP)/scripts/$(2)/*.csproj /bl:$$(TOP)/scripts/$(2)/msbuild.binlog $$(DOTNET_BUILD_VERBOSITY) +endef diff --git a/scripts/versions-check/README.md b/scripts/versions-check/README.md new file mode 100644 index 000000000000..14b2b09c633e --- /dev/null +++ b/scripts/versions-check/README.md @@ -0,0 +1,9 @@ +# versions-check + +This script verifies the OS versions listed in `xamarin-macios/builds/Versions-.list.in`: + +* No versions below the minimum deployment target. +* Both minimum deployment target and current deployment target must be listed. +* That the `SupportedTargetPlatformVersions` list is coherent with the + `KnownVersions` list (all versions in `KnownVersions` must also be in + `SupportedTargetPlatformVersions`). \ No newline at end of file diff --git a/scripts/versions-check/fragment.mk b/scripts/versions-check/fragment.mk new file mode 100644 index 000000000000..74127bb2d38d --- /dev/null +++ b/scripts/versions-check/fragment.mk @@ -0,0 +1,2 @@ +include $(TOP)/scripts/template.mk +$(eval $(call TemplateScript,VERSIONS_CHECK,versions-check)) diff --git a/scripts/versions-check/versions-check.cs b/scripts/versions-check/versions-check.cs new file mode 100755 index 000000000000..e4250b12da2c --- /dev/null +++ b/scripts/versions-check/versions-check.cs @@ -0,0 +1,91 @@ +// this script is to make sure our versions.plist files are not out of date with our min/max supported OS versions. + +// arguments are: plistPath iOSMinVersion iOSMaxVersion tvOSMinVersion tvOSMaxVersion macOSMinVersion macOSMaxVersion MacCatalystOSMinVersion MacCatalystOSMaxVersion + +using System.IO; +using System.Xml; + +try { + var expectedArgumentCount = 9; + if (args.Length != expectedArgumentCount) { + Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {0}", args.Length); + return 1; + } + + var idx = 0; + var plistPath = args [idx++]; + var iOSMin = args [idx++]; + var iOSMax = args [idx++]; + var tvOSMin = args [idx++]; + var tvOSMax = args [idx++]; + var macOSMin = args [idx++]; + var macOSMax = args [idx++]; + var MacCatalystMin = args [idx++]; + var MacCatalystMax = args [idx++]; + + var doc = new System.Xml.XmlDocument (); + doc.Load (plistPath); + + var failed = false; + + var check = new Action ((product, min, max) => { + var minVersion = Version.Parse (min); + var maxVersion = Version.Parse (max); + var foundMax = false; + var foundMin = false; + var versions = doc.SelectNodes ($"/plist/dict/key[text()='KnownVersions']/following-sibling::dict[1]/key[text()='{product}']/following-sibling::array[1]/string")!; + if (versions.Count == 0) { + // Skip this (iOS/tvOS versions for macOS, or vice versa) + return; + } + var versionsHashSet = new HashSet (versions.Cast ().Select (v => v.InnerText)); + foreach (XmlNode node in versions) { + // Console.WriteLine ($"{product}: checking: {node.InnerText}"); + var v = node.InnerText; + var version = Version.Parse (v); + if (version < minVersion) { + Console.Error.WriteLine ($"Found the {product} version {v} in {Path.GetFileName (plistPath)}, but it's smaller than the supported min {product} version we support ({min})."); + failed = true; + } else if (version > maxVersion) { + Console.Error.WriteLine ($"Found the {product} version {v} in {Path.GetFileName (plistPath)}, but it's higher than the supported max {product} version we support ({max})."); + failed = true; + } + if (version == maxVersion) + foundMax = true; + if (version == minVersion) + foundMin = true; + } + if (!foundMax) { + Console.Error.WriteLine ($"Could not find the max {product} version {max} in {Path.GetFileName (plistPath)}."); + failed = true; + } + if (!foundMin) { + Console.Error.WriteLine ($"Could not find the min {product} version {min} in {Path.GetFileName (plistPath)}."); + failed = true; + } + + var supportedTPVNodes = doc.SelectNodes ($"/plist/dict/key[text()='SupportedTargetPlatformVersions']/following-sibling::dict[1]/key[text()='{product}']/following-sibling::array[1]/string")!.Cast ().ToArray (); + var supportedTPVs = supportedTPVNodes.Select (v => v.InnerText).ToArray (); + if (supportedTPVs?.Any () == true) { + var supportedTPVSet = new HashSet (supportedTPVs); + var missingTPVs = versionsHashSet.Except (supportedTPVSet); + if (missingTPVs.Any ()) { + Console.Error.WriteLine ($"The array SupportedTargetPlatformVersions are missing the following entries (they're in the KnownVersions array): {string.Join (", ", missingTPVs)}"); + failed = true; + } + } else if (plistPath.Contains ("/builds/")) { + Console.Error.WriteLine ($"No SupportedTargetPlatformVersions array found in the plist: {plistPath}"); + failed = true; + } + }); + + check ("iOS", iOSMin, iOSMax); + check ("tvOS", tvOSMin, tvOSMax); + check ("macOS", macOSMin, macOSMax); + check ("MacCatalyst", MacCatalystMin, MacCatalystMax); + + return failed ? 1 : 0; +} catch (Exception e) { + Console.WriteLine (e); + return 1; +} diff --git a/scripts/versions-check/versions-check.csproj b/scripts/versions-check/versions-check.csproj new file mode 100644 index 000000000000..3e1d041e4d59 --- /dev/null +++ b/scripts/versions-check/versions-check.csproj @@ -0,0 +1,5 @@ + + + net$(BundledNETCoreAppTargetFrameworkVersion) + + diff --git a/src/.gitignore b/src/.gitignore index 7bac7c02b964..0fe08a7f6e4a 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,15 +1,5 @@ build -MonoTouch.NUnitLite.csproj -MonoTouch.NUnitLite.tvos.csproj -MonoTouch.NUnitLite.unified.csproj -MonoTouch.NUnitLite.watchos.csproj -MonoTouch.NUnitLite.maccatalyst.csproj -xamios.csproj -xammac.csproj -xamtvos.csproj -xamwatch.csproj -xammaccatalyst.csproj -generator.csproj.inc +bgen.csproj.inc *~ *.rsp MinimumVersions.cs diff --git a/src/AVFoundation/AVAudioSessionPortDescription.cs b/src/AVFoundation/AVAudioSessionPortDescription.cs index d0d21b5429a7..0ca3fdbbe916 100644 --- a/src/AVFoundation/AVAudioSessionPortDescription.cs +++ b/src/AVFoundation/AVAudioSessionPortDescription.cs @@ -18,14 +18,6 @@ #if !MONOMAC namespace AVFoundation { public partial class AVAudioSessionPortDescription { -#if !XAMCORE_3_0 - [Obsolete ("Use 'DataSourceDescriptions' instead.")] - public virtual AVAudioSessionChannelDescription [] DataSources { - get { - throw new InvalidOperationException ("Call DataSourceDescriptions instead."); - } - } -#endif } } #endif diff --git a/src/AVFoundation/AVCaptureReactionType.rgen.cs b/src/AVFoundation/AVCaptureReactionType.rgen.cs new file mode 100644 index 000000000000..bec948caf11e --- /dev/null +++ b/src/AVFoundation/AVCaptureReactionType.rgen.cs @@ -0,0 +1,43 @@ +#pragma warning disable APL0003 +using System; +using System.Runtime.Versioning; + +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/AVFoundation/AVCompat.cs b/src/AVFoundation/AVCompat.cs index 8702909c8a36..6a4d9d0e3c67 100644 --- a/src/AVFoundation/AVCompat.cs +++ b/src/AVFoundation/AVCompat.cs @@ -114,52 +114,6 @@ protected internal AVCaptureDataOutputSynchronizerDelegate (NativeHandle handle) } #endif // MONOMAC -#if !XAMCORE_3_0 - partial class AVAsset { - - [Obsolete ("Use 'GetChapterMetadataGroups'.")] - public virtual AVMetadataItem []? ChapterMetadataGroups (NSLocale forLocale, AVMetadataItem [] commonKeys) - { - return null; - } - } - - partial class AVAssetTrack { - - [Obsolete ("Use 'GetAssociatedTracks'.")] - public virtual NSString? GetAssociatedTracksOfType (NSString avAssetTrackTrackAssociationType) - { - return null; - } - } - - partial class AVMutableCompositionTrack { - - [Obsolete ("Use 'InsertTimeRanges' overload accepting an 'NSValue' array.")] - public virtual bool InsertTimeRanges (NSValue cmTimeRanges, AVAssetTrack [] tracks, CMTime startTime, out NSError error) - { - return InsertTimeRanges (new NSValue [] { cmTimeRanges }, tracks, startTime, out error); - } - } - - - partial class AVCaptureAudioDataOutputSampleBufferDelegate { - - [Obsolete ("This member only exists for 'AVCaptureVideoDataOutputSampleBufferDelegate'.")] - public virtual void DidDropSampleBuffer (AVCaptureOutput captureOutput, CMSampleBuffer sampleBuffer, AVCaptureConnection connection) - { - } - } - - static partial class AVCaptureAudioDataOutputSampleBufferDelegate_Extensions { - - [Obsolete ("This member only exists for 'AVCaptureVideoDataOutputSampleBufferDelegate'.")] - public static void DidDropSampleBuffer (IAVCaptureAudioDataOutputSampleBufferDelegate This, AVCaptureOutput captureOutput, CMSampleBuffer sampleBuffer, AVCaptureConnection connection) - { - } - } -#endif - partial class AVCaptureInputPort { [Obsolete ("Valid instance of this type cannot be directly created.")] diff --git a/src/AVFoundation/AVFragmentedAsset.cs b/src/AVFoundation/AVFragmentedAsset.cs deleted file mode 100644 index c2668aaca1b3..000000000000 --- a/src/AVFoundation/AVFragmentedAsset.cs +++ /dev/null @@ -1,19 +0,0 @@ -// -// Copyright 2015 Xamarin Inc -// - -using System; -using Foundation; - -#nullable enable - -namespace AVFoundation { -#if MONOMAC && !XAMCORE_3_0 - public partial class AVFragmentedAsset { - [Obsolete ("Default constructor should not be used")] - public AVFragmentedAsset () : base (NSObjectFlag.Empty) - { - } - } -#endif -} diff --git a/src/AVFoundation/AVFragmentedAssetTrack.cs b/src/AVFoundation/AVFragmentedAssetTrack.cs deleted file mode 100644 index 2d7bfe397cd9..000000000000 --- a/src/AVFoundation/AVFragmentedAssetTrack.cs +++ /dev/null @@ -1,19 +0,0 @@ -// -// Copyright 2015 Xamarin Inc -// - -using System; -using Foundation; - -#nullable enable - -namespace AVFoundation { -#if MONOMAC && !XAMCORE_3_0 - public partial class AVFragmentedAssetTrack { - [Obsolete ("Default constructor should not be used")] - public AVFragmentedAssetTrack () : base (NSObjectFlag.Empty) - { - } - } -#endif -} diff --git a/src/AVFoundation/AVTextStyleRule.cs b/src/AVFoundation/AVTextStyleRule.cs index 91f694c854d9..7e432b4415c3 100644 --- a/src/AVFoundation/AVTextStyleRule.cs +++ b/src/AVFoundation/AVTextStyleRule.cs @@ -5,11 +5,5 @@ namespace AVFoundation { public partial class AVTextStyleRule { -#if !XAMCORE_3_0 - [Obsolete ("iOS9 does not allow creating an empty instance")] - public AVTextStyleRule () - { - } -#endif } } diff --git a/src/AVFoundation/Enums.cs b/src/AVFoundation/Enums.cs index 5a82d23db4f2..36f3a5ee05df 100644 --- a/src/AVFoundation/Enums.cs +++ b/src/AVFoundation/Enums.cs @@ -317,10 +317,8 @@ public enum AVAssetImageGeneratorResult : long { } /// An enumeration whose values specify whether a is playing or not. -#if XAMCORE_3_0 [NoiOS] [NoWatch] -#endif [Unavailable (PlatformName.MacCatalyst)] [NoTV] [Native] @@ -332,9 +330,7 @@ public enum AVCaptureDeviceTransportControlsPlaybackMode : long { /// An enumeration whose values specify how interlaced fields should be dealt with. /// /// -#if XAMCORE_3_0 [NoiOS] -#endif [Unavailable (PlatformName.MacCatalyst)] [NoTV] [NoWatch] diff --git a/src/AVKit/Enums.cs b/src/AVKit/Enums.cs index b4b182765c04..d8ba0c052201 100644 --- a/src/AVKit/Enums.cs +++ b/src/AVKit/Enums.cs @@ -5,7 +5,7 @@ namespace AVKit { -#if !XAMCORE_3_0 || MONOMAC +#if MONOMAC // this enum only exists for OSX (not iOS) /// Determines which user interface elements are visible in the AVPlayerView [Native] diff --git a/src/Accounts/Enums.cs b/src/Accounts/Enums.cs index 7b782cb9f84c..1f3a59da84ee 100644 --- a/src/Accounts/Enums.cs +++ b/src/Accounts/Enums.cs @@ -31,15 +31,7 @@ public enum ACErrorCode { CoreDataSaveFailed, FailedSerializingAccountInfo, InvalidCommand, -#if XAMCORE_3_0 MissingTransportMessageId, -#else - [Obsolete ("Use 'MissingTransportMessageId'.")] - MissingMessageID, -#pragma warning disable 618 // MissingMessageID is obsolete - MissingTransportMessageId = MissingMessageID, -#pragma warning restore 618 -#endif CredentialItemNotFound, CredentialItemNotExpired, } diff --git a/src/AddressBook/ABPerson.cs b/src/AddressBook/ABPerson.cs index 05d8eaf4f4dc..6d665b24ccbf 100644 --- a/src/AddressBook/ABPerson.cs +++ b/src/AddressBook/ABPerson.cs @@ -1021,11 +1021,7 @@ public void SetRelatedNames (ABMultiValue? value) public NSData? GetImage (ABPersonImageFormat format) { -#if ARCH_32 - return Runtime.GetNSObject (ABPersonCopyImageDataWithFormat (Handle, (nint)(int)format)); -#else return Runtime.GetNSObject (ABPersonCopyImageDataWithFormat (Handle, (nint) (long) format)); -#endif } [DllImport (Constants.AddressBookLibrary)] diff --git a/src/AppKit/Enums.cs b/src/AppKit/Enums.cs index 89ccd86e4e59..8489dd41abb4 100644 --- a/src/AppKit/Enums.cs +++ b/src/AppKit/Enums.cs @@ -219,15 +219,6 @@ public enum NSColorSpaceModel : long { #endregion #region NSFileWrapper -#if !XAMCORE_3_0 - [NoMacCatalyst] - [Flags] - [Native] - [Obsolete ("Use NSFileWrapperReadingOptions in Foundation instead.")] - public enum NSFileWrapperReadingOptions : ulong { - Immediate = 1, WithoutMapping = 2 - } -#endif #endregion #region NSParagraphStyle diff --git a/src/AppKit/NSPathControlItem.cs b/src/AppKit/NSPathControlItem.cs index 9846f0fb3bc8..9317ba60e3b2 100644 --- a/src/AppKit/NSPathControlItem.cs +++ b/src/AppKit/NSPathControlItem.cs @@ -5,20 +5,7 @@ #nullable enable namespace AppKit { - public partial class NSPathControlItem -#if !XAMCORE_3_0 - : INSCoding -#endif - { -#if !XAMCORE_3_0 - public NSPathControlItem (NSCoder coder) : this () - { - } - - public virtual void EncodeTo (NSCoder coder) - { - } -#endif + public partial class NSPathControlItem { } } #endif // !__MACCATALYST__ diff --git a/src/AssemblyInfo.cs.in b/src/AssemblyInfo.cs.in index 01573ff30652..76cae03392a2 100644 --- a/src/AssemblyInfo.cs.in +++ b/src/AssemblyInfo.cs.in @@ -10,26 +10,15 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.CompilerServices; -#if NET [assembly: AssemblyInformationalVersion ("@NUGET_VERSION_NO_METADATA@; git-rev-head:@PACKAGE_HEAD_REV@; git-branch:@PACKAGE_HEAD_BRANCH@")] [assembly: AssemblyTitle ("Microsoft.@DOTNET_PLATFORM@")] [assembly: AssemblyProduct ("Microsoft.@DOTNET_PLATFORM@")] -#else -[assembly: AssemblyInformationalVersion ("@PACKAGE_VERSION_MAJOR@.@PACKAGE_VERSION_MINOR@.@PACKAGE_VERSION_REV@.@PACKAGE_VERSION_BUILD@; git-rev-head:@PACKAGE_HEAD_REV@; git-branch:@PACKAGE_HEAD_BRANCH@")] -[assembly: AssemblyTitle ("@PRODUCT_NAME@")] -[assembly: AssemblyProduct ("@PRODUCT_NAME@")] -#endif // FIXME: Probably need to add Copyright 2009-2011 Novell Inc. // [assembly: AssemblyCopyright ("Copyright 2011-2014 Xamarin Inc.")] [assembly: AssemblyCompany ("Microsoft Corp.")] [assembly: AssemblyMetadata ("IsTrimmable", "True")] -#if !NET -[assembly: InternalsVisibleTo ("System.Net.Http,PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] -#endif - -#if NET // Use a two-part version, because there shouldn't be any API changes when the third or fourth digit changes (according to Semver 2.0 rules). // In other words: the following scenario is safe: // - Assembly A builds against Microsoft.*.dll v1.0.1 @@ -38,8 +27,7 @@ using System.Runtime.CompilerServices; // To avoid scenarios where everybody would have to update to the latest patch version of Microsoft.*.dll // in order to compile stuff, we erase the third and fourth number and only use 0 for both. [assembly: AssemblyVersion ("@NUGET_VERSION_MAJOR@.@NUGET_VERSION_MINOR@.0.0")] -#endif -#if NET && !XCODE_IS_STABLE && !COREBUILD +#if !XCODE_IS_STABLE && !COREBUILD [assembly: Experimental("XCODE_@XCODE_VERSION@_PREVIEW", UrlFormat = "https://github.com/xamarin/xamarin-macios/blob/main/docs/preview-apis.md")] #endif diff --git a/src/AudioToolbox/AudioQueue.cs b/src/AudioToolbox/AudioQueue.cs index c387ec547b4f..861adfb17a66 100644 --- a/src/AudioToolbox/AudioQueue.cs +++ b/src/AudioToolbox/AudioQueue.cs @@ -1185,15 +1185,6 @@ public int DecodeBufferSizeFrames { } } -#if !XAMCORE_3_0 - [Obsolete ("Use 'AudioStreamDescription' instead.")] - public AudioStreamBasicDescription AudioStreamPacketDescription { - get { - return AudioStreamDescription; - } - } -#endif - public AudioStreamBasicDescription AudioStreamDescription { get { #if !MONOMAC diff --git a/src/AudioToolbox/AudioSession.cs b/src/AudioToolbox/AudioSession.cs deleted file mode 100644 index 1fb243bb330a..000000000000 --- a/src/AudioToolbox/AudioSession.cs +++ /dev/null @@ -1,953 +0,0 @@ -// -// AudioSession.cs: AudioSession bindings -// -// Authors: -// Miguel de Icaza (miguel@novell.com) -// Marek Safar (marek.safar@gmail.com) -// -// Copyright 2009 Novell, Inc -// Copyright 2011-2013 Xamarin Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#nullable enable - -using System; -using System.IO; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using CoreFoundation; -using ObjCRuntime; -using Foundation; -using System.Threading; - -using OSStatus = System.Int32; - -namespace AudioToolbox { - // This API has been deprecated in iOS 7 and everyone should be using AVAudioSession now - // also AudioSession has been removed from TVOS already and AVAudioSession has been around since iOS 3.0 -#if !XAMCORE_3_0 -#if !TVOS -#if !MONOMAC // AudioSession isn't an OS X API, but can't remove from compat - public class AudioSessionException : Exception { - static string Lookup (int k) - { - switch ((AudioSessionErrors) k) { - case AudioSessionErrors.NotInitialized: - return "AudioSession.Initialize has not been called"; - - case AudioSessionErrors.AlreadyInitialized: - return "You called AudioSession.Initialize more than once"; - - case AudioSessionErrors.InitializationError: - return "There was an error during the AudioSession.initialization"; - - case AudioSessionErrors.UnsupportedPropertyError: - return "The audio session property is not supported"; - - case AudioSessionErrors.BadPropertySizeError: - return "The size of the audio property was not correct"; - - case AudioSessionErrors.NotActiveError: - return "Application Audio Session is not active"; - - case AudioSessionErrors.NoHardwareError: - return "The device has no Audio Input capability"; - - case AudioSessionErrors.IncompatibleCategory: - return "The specified AudioSession.Category can not be used with this audio operation"; - - case AudioSessionErrors.NoCategorySet: - return "This operation requries AudioSession.Category to be explicitly set"; - - } - return String.Format ("Unknown error code: {0}", k); - } - - internal AudioSessionException (int k) : base (Lookup (k)) - { - ErrorCode = (AudioSessionErrors) k; - } - - public AudioSessionErrors ErrorCode { get; private set; } - } - - public class AccessoryInfo { - internal AccessoryInfo (int id, string? description) - { - ID = id; - Description = description; - } - - public int ID { get; private set; } - public string? Description { get; private set; } - } - - public class InputSourceInfo { - public int ID { get; private set; } - public string? Description { get; private set; } - } - - public class AudioSessionPropertyEventArgs : EventArgs { - public AudioSessionPropertyEventArgs (AudioSessionProperty prop, int size, IntPtr data) - { - this.Property = prop; - this.Size = size; - this.Data = data; - } - public AudioSessionProperty Property { get; set; } - public int Size { get; set; } - public IntPtr Data { get; set; } - } - - public class AudioSessionRouteChangeEventArgs : EventArgs { - static IntPtr route_change_key, previous_route_key, current_route_key; - - static AudioSessionRouteChangeEventArgs () - { - var lib = Libraries.AudioToolbox.Handle; - route_change_key = Dlfcn.GetIntPtr (lib, "kAudioSession_RouteChangeKey_Reason"); - previous_route_key = Dlfcn.GetIntPtr (lib, "kAudioSession_AudioRouteChangeKey_PreviousRouteDescription"); - current_route_key = Dlfcn.GetIntPtr (lib, "kAudioSession_AudioRouteChangeKey_CurrentRouteDescription"); - } - - public NSDictionary Dictionary { get; private set; } - - public AudioSessionRouteChangeEventArgs (IntPtr dictHandle) - { - Dictionary = new NSDictionary (dictHandle); - } - -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios7.0")] - [ObsoletedOSPlatform ("ios7.0")] -#else - [Deprecated (PlatformName.iOS, 7, 0)] -#endif - public AudioSessionRouteChangeReason Reason { - get { - using (var num = new NSNumber (Dictionary.LowlevelObjectForKey (route_change_key))) { - return (AudioSessionRouteChangeReason) num.Int32Value; - } - } - } - - NSArray? Extract (IntPtr key, NSString secondKey) - { - var dictH = Dictionary.LowlevelObjectForKey (key); - if (dictH == IntPtr.Zero) - return null; - - // Console.WriteLine ("Extracting from {2} {0} and getting {1}", new NSString (key), new NSDictionary (dictH).Description, Dictionary.Description); - // Description dictionary, indexed by the second key, the result is an array - using (var descDict = new NSDictionary (dictH)) { - var sdict = descDict.LowlevelObjectForKey (secondKey.Handle); - if (sdict == IntPtr.Zero) - return null; - - return new NSArray (sdict); - } - } - -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios7.0")] - [ObsoletedOSPlatform ("ios7.0")] -#else - [Deprecated (PlatformName.iOS, 7, 0)] -#endif - public AudioSessionInputRouteKind PreviousInputRoute { - get { - using (var array = Extract (previous_route_key, AudioSession.AudioRouteKey_Inputs!)) - return AudioSession.GetInputRoute (array); - } - } - -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios7.0")] - [ObsoletedOSPlatform ("ios7.0")] -#else - [Deprecated (PlatformName.iOS, 7, 0)] -#endif - public AudioSessionOutputRouteKind []? PreviousOutputRoutes { - get { - using (var array = Extract (previous_route_key, AudioSession.AudioRouteKey_Outputs!)) - return AudioSession.GetOutputRoutes (array); - } - } - -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios7.0")] - [ObsoletedOSPlatform ("ios7.0")] -#else - [Deprecated (PlatformName.iOS, 7, 0)] -#endif - public AudioSessionInputRouteKind CurrentInputRoute { - get { - using (var array = Extract (current_route_key, AudioSession.AudioRouteKey_Inputs!)) - return AudioSession.GetInputRoute (array); - } - } - -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios7.0")] - [ObsoletedOSPlatform ("ios7.0")] -#else - [Deprecated (PlatformName.iOS, 7, 0)] -#endif - public AudioSessionOutputRouteKind []? CurrentOutputRoutes { - get { - using (var array = Extract (current_route_key, AudioSession.AudioRouteKey_Outputs!)) - return AudioSession.GetOutputRoutes (array); - } - } - } - -#if NET - [UnsupportedOSPlatform ("ios7.0")] - [ObsoletedOSPlatform ("ios7.0", "Use 'AVAudioSession' instead.")] -#else - [Deprecated (PlatformName.iOS, 7, 0, message: "Use 'AVAudioSession' instead.")] -#endif - public static class AudioSession { - static bool initialized; - public static event EventHandler? Interrupted; - public static event EventHandler? Resumed; - - internal static NSString? AudioRouteKey_Type; - internal static NSString? AudioRouteKey_Inputs; - internal static NSString? AudioRouteKey_Outputs; - - static NSString? InputRoute_LineIn; - static NSString? InputRoute_BuiltInMic; - static NSString? InputRoute_HeadsetMic; - static NSString? InputRoute_BluetoothHFP; - static NSString? InputRoute_USBAudio; - - static NSString? OutputRoute_LineOut; - static NSString? OutputRoute_Headphones; - static NSString? OutputRoute_BluetoothHFP; - static NSString? OutputRoute_BluetoothA2DP; - static NSString? OutputRoute_BuiltInReceiver; - static NSString? OutputRoute_BuiltInSpeaker; - static NSString? OutputRoute_USBAudio; - static NSString? OutputRoute_HDMI; - static NSString? OutputRoute_AirPlay; - static NSString? InputSourceKey_ID; - static NSString? InputSourceKey_Description; - static NSString? OutputDestinationKey_ID; - static NSString? OutputDestinationKey_Description; - - [DllImport (Constants.AudioToolboxLibrary)] -#if NET - unsafe extern static OSStatus AudioSessionInitialize(IntPtr cfRunLoop, IntPtr cfstr_runMode, delegate* unmanaged listener, IntPtr userData); -#else - extern static OSStatus AudioSessionInitialize (IntPtr cfRunLoop, IntPtr cfstr_runMode, InterruptionListener listener, IntPtr userData); -#endif - - public static void Initialize () - { - Initialize (null, null); - } - - public static void Initialize (CFRunLoop? runLoop, string? runMode) - { - CFString? s = runMode is null ? null : new CFString (runMode); -#if NET - int k; - unsafe { - k = AudioSessionInitialize (runLoop.GetHandle (), s.GetHandle (), &Interruption, IntPtr.Zero); - } -#else - int k = AudioSessionInitialize (runLoop.GetHandle (), s.GetHandle (), Interruption, IntPtr.Zero); -#endif - if (k != 0 && k != (int) AudioSessionErrors.AlreadyInitialized) - throw new AudioSessionException (k); - - if (initialized) - return; - - IntPtr lib = Libraries.AudioToolbox.Handle; - - AudioRouteKey_Inputs = Dlfcn.GetStringConstant (lib, "kAudioSession_AudioRouteKey_Inputs"); - AudioRouteKey_Outputs = Dlfcn.GetStringConstant (lib, "kAudioSession_AudioRouteKey_Outputs"); - AudioRouteKey_Type = Dlfcn.GetStringConstant (lib, "kAudioSession_AudioRouteKey_Type"); - - InputRoute_LineIn = Dlfcn.GetStringConstant (lib, "kAudioSessionInputRoute_LineIn"); - InputRoute_BuiltInMic = Dlfcn.GetStringConstant (lib, "kAudioSessionInputRoute_BuiltInMic"); - InputRoute_HeadsetMic = Dlfcn.GetStringConstant (lib, "kAudioSessionInputRoute_HeadsetMic"); - InputRoute_BluetoothHFP = Dlfcn.GetStringConstant (lib, "kAudioSessionInputRoute_BluetoothHFP"); - InputRoute_USBAudio = Dlfcn.GetStringConstant (lib, "kAudioSessionInputRoute_USBAudio"); - - OutputRoute_LineOut = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_LineOut"); - OutputRoute_Headphones = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_Headphones"); - OutputRoute_BluetoothHFP = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_BluetoothHFP"); - OutputRoute_BluetoothA2DP = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_BluetoothA2DP"); - OutputRoute_BuiltInReceiver = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_BuiltInReceiver"); - OutputRoute_BuiltInSpeaker = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_BuiltInSpeaker"); - OutputRoute_USBAudio = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_USBAudio"); - OutputRoute_HDMI = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_HDMI"); - OutputRoute_AirPlay = Dlfcn.GetStringConstant (lib, "kAudioSessionOutputRoute_AirPlay"); - - InputSourceKey_ID = Dlfcn.GetStringConstant (lib, "kAudioSession_InputSourceKey_ID"); - InputSourceKey_Description = Dlfcn.GetStringConstant (lib, "kAudioSession_InputSourceKey_Description"); - - OutputDestinationKey_ID = Dlfcn.GetStringConstant (lib, "kAudioSession_OutputDestinationKey_ID"); - OutputDestinationKey_Description = Dlfcn.GetStringConstant (lib, "kAudioSession_OutputDestinationKey_Description"); - - initialized = true; - } - -#if !NET - delegate void InterruptionListener (IntPtr userData, uint state); -#endif - -#if NET - [UnmanagedCallersOnly] -#else - [MonoPInvokeCallback (typeof (InterruptionListener))] -#endif - static void Interruption (IntPtr userData, uint state) - { - EventHandler h; - - h = (state == 1) ? Interrupted! : Resumed!; - if (h is not null) - h (null, EventArgs.Empty); - } - - [DllImport (Constants.AudioToolboxLibrary)] - extern static OSStatus AudioSessionSetActive (byte active); - - public static void SetActive (bool active) - { - int k = AudioSessionSetActive (active ? (byte) 1 : (byte) 0); - if (k != 0) - throw new AudioSessionException (k); - } - - [DllImport (Constants.AudioToolboxLibrary)] - extern static AudioSessionErrors AudioSessionSetActiveWithFlags (byte active, AudioSessionActiveFlags inFlags); - - public static AudioSessionErrors SetActive (bool active, AudioSessionActiveFlags flags) - { - return AudioSessionSetActiveWithFlags (active ? (byte) 1 : (byte) 0, flags); - } - - [DllImport (Constants.AudioToolboxLibrary)] - unsafe extern static OSStatus AudioSessionGetProperty (AudioSessionProperty id, int* size, IntPtr data); - - [DllImport (Constants.AudioToolboxLibrary)] - extern static OSStatus AudioSessionSetProperty (AudioSessionProperty id, int size, IntPtr data); - - [DllImport (Constants.AudioToolboxLibrary)] - // deprecated in iOS7 but not exposed / used anywhere - unsafe extern static OSStatus AudioSessionGetPropertySize (AudioSessionProperty id, int* size); - - static double GetDouble (AudioSessionProperty property) - { - unsafe { - double val = 0; - int size = 8; - int k = AudioSessionGetProperty (property, &size, (IntPtr) (&val)); - if (k != 0) - throw new AudioSessionException (k); - - return val; - } - } - - static float GetFloat (AudioSessionProperty property) - { - unsafe { - float val = 0; - int size = 4; - int k = AudioSessionGetProperty (property, &size, (IntPtr) (&val)); - if (k != 0) - throw new AudioSessionException (k); - return val; - } - } - - static int GetInt (AudioSessionProperty property) - { - unsafe { - int val = 0; - int size = 4; - int k = AudioSessionGetProperty (property, &size, (IntPtr) (&val)); - if (k != 0) - throw new AudioSessionException (k); - - return val; - } - } - - static IntPtr GetIntPtr (AudioSessionProperty property) - { - unsafe { - IntPtr val; - int size = IntPtr.Size; - int k = AudioSessionGetProperty (property, &size, (IntPtr) (&val)); - if (k != 0) - throw new AudioSessionException (k); - - return val; - } - } - - static void SetDouble (AudioSessionProperty property, double val) - { - unsafe { - int k = AudioSessionSetProperty (property, 8, (IntPtr) (&val)); - if (k != 0) - throw new AudioSessionException (k); - } - } - - static void SetInt (AudioSessionProperty property, int val) - { - unsafe { - int k = AudioSessionSetProperty (property, sizeof (int), (IntPtr) (&val)); - if (k != 0) - throw new AudioSessionException (k); - } - } - - static void SetFloat (AudioSessionProperty property, float val) - { - unsafe { - int k = AudioSessionSetProperty (property, 4, (IntPtr) (&val)); - if (k != 0) - throw new AudioSessionException (k); - } - } - - static public double PreferredHardwareSampleRate { - get { - return GetDouble (AudioSessionProperty.PreferredHardwareSampleRate); - } - set { - SetDouble (AudioSessionProperty.PreferredHardwareSampleRate, value); - } - } - - static public float PreferredHardwareIOBufferDuration { - get { - return GetFloat (AudioSessionProperty.PreferredHardwareIOBufferDuration); - } - set { - SetFloat (AudioSessionProperty.PreferredHardwareIOBufferDuration, value); - } - } - - static public AudioSessionCategory Category { - get { - return (AudioSessionCategory) GetInt (AudioSessionProperty.AudioCategory); - } - set { - SetInt (AudioSessionProperty.AudioCategory, (int) value); - } - } - - public static AudioSessionInterruptionType InterruptionType { - get { - return (AudioSessionInterruptionType) GetInt (AudioSessionProperty.InterruptionType); - } - } - -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] - [SupportedOSPlatform ("macos")] - [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'InputRoute' or 'OutputRoute' instead.")] - [ObsoletedOSPlatform ("macos10.7", "Use 'InputRoute' or 'OutputRoute' instead.")] - [ObsoletedOSPlatform ("ios5.0", "Use 'InputRoute' or 'OutputRoute' instead.")] - [ObsoletedOSPlatform ("tvos9.0", "Use 'InputRoute' or 'OutputRoute' instead.")] -#else - [Deprecated (PlatformName.iOS, 5, 0, message: "Use 'InputRoute' or 'OutputRoute' instead.")] -#endif - static public string? AudioRoute { - get { - return CFString.FromHandle (GetIntPtr (AudioSessionProperty.AudioRoute)); - } - } - - static public AccessoryInfo [] InputSources { - get { - return ExtractAccessoryInfo (GetIntPtr (AudioSessionProperty.InputSources), InputSourceKey_ID!, InputSourceKey_Description!); - } - } - - static public AccessoryInfo [] OutputDestinations { - get { - return ExtractAccessoryInfo (GetIntPtr (AudioSessionProperty.OutputDestinations), OutputDestinationKey_ID!, OutputDestinationKey_Description!); - } - } - - static AccessoryInfo [] ExtractAccessoryInfo (IntPtr ptr, NSString id, NSString description) - { - using (var array = new CFArray (ptr, false)) { - var res = new AccessoryInfo [array.Count]; - for (int i = 0; i < res.Length; ++i) { - var dict = array.GetValue (i); - var n = new NSNumber (CFDictionary.GetValue (dict, id.Handle)); - var desc = CFString.FromHandle (CFDictionary.GetValue (dict, description.Handle)); - - res [i] = new AccessoryInfo ((int) n, desc); - id.Dispose (); - } - return res; - } - } - - /* Could not test what sort of unique CFNumberRef value it's - - static public int InputSource { - get { - return GetInt (AudioSessionProperty.InputSource); - } - set { - SetInt (AudioSessionProperty.InputSource, value); - } - } - - static public int OutputDestination { - get { - return GetInt (AudioSessionProperty.OutputDestination); - } - set { - SetInt (AudioSessionProperty.OutputDestination, value); - } - } - - */ - - static internal AudioSessionInputRouteKind GetInputRoute (NSArray? arr) - { - if (arr is null || arr.Count == 0) - return AudioSessionInputRouteKind.None; - - var dict = new NSDictionary (arr.ValueAt (0)); - - if (dict is null || dict.Count == 0) - return AudioSessionInputRouteKind.None; - - var val = (NSString) dict [AudioRouteKey_Type]; - - if (val is null) - return AudioSessionInputRouteKind.None; - - if (val == InputRoute_LineIn) { - return AudioSessionInputRouteKind.LineIn; - } else if (val == InputRoute_BuiltInMic) { - return AudioSessionInputRouteKind.BuiltInMic; - } else if (val == InputRoute_HeadsetMic) { - return AudioSessionInputRouteKind.HeadsetMic; - } else if (val == InputRoute_BluetoothHFP) { - return AudioSessionInputRouteKind.BluetoothHFP; - } else if (val == InputRoute_USBAudio) { - return AudioSessionInputRouteKind.USBAudio; - } else { - return (AudioSessionInputRouteKind) (int) (IntPtr) val.Handle; - } - } - - static internal AudioSessionOutputRouteKind []? GetOutputRoutes (NSArray? arr) - { - if (arr is null || arr.Count == 0) - return null; - - var result = new AudioSessionOutputRouteKind [arr.Count]; - for (uint i = 0; i < arr.Count; i++) { - var dict = new NSDictionary ((IntPtr) arr.ValueAt (i)); - - result [i] = AudioSessionOutputRouteKind.None; - - if (dict is null || dict.Count == 0) - continue; - - var val = (NSString) dict [AudioRouteKey_Type]; - - if (val is null) - continue; - - if (val == OutputRoute_LineOut) { - result [i] = AudioSessionOutputRouteKind.LineOut; - } else if (val == OutputRoute_Headphones) { - result [i] = AudioSessionOutputRouteKind.Headphones; - } else if (val == OutputRoute_BluetoothHFP) { - result [i] = AudioSessionOutputRouteKind.BluetoothHFP; - } else if (val == OutputRoute_BluetoothA2DP) { - result [i] = AudioSessionOutputRouteKind.BluetoothA2DP; - } else if (val == OutputRoute_BuiltInReceiver) { - result [i] = AudioSessionOutputRouteKind.BuiltInReceiver; - } else if (val == OutputRoute_BuiltInSpeaker) { - result [i] = AudioSessionOutputRouteKind.BuiltInSpeaker; - } else if (val == OutputRoute_USBAudio) { - result [i] = AudioSessionOutputRouteKind.USBAudio; - } else if (val == OutputRoute_HDMI) { - result [i] = AudioSessionOutputRouteKind.HDMI; - } else if (val == OutputRoute_AirPlay) { - result [i] = AudioSessionOutputRouteKind.AirPlay; - } else - result [i] = (AudioSessionOutputRouteKind) (int) (IntPtr) val.Handle; - } - return result; - } - - static public AudioSessionInputRouteKind InputRoute { - get { - return GetInputRoute ((NSArray) AudioRouteDescription [AudioRouteKey_Inputs]); - } - } - - static public AudioSessionOutputRouteKind []? OutputRoutes { - get { - return GetOutputRoutes ((NSArray) AudioRouteDescription [AudioRouteKey_Outputs]); - } - } - - static NSDictionary AudioRouteDescription { - get { - NSDictionary dict = new NSDictionary (GetIntPtr (AudioSessionProperty.AudioRouteDescription)); - dict.DangerousRelease (); - return dict; - } - } - - static public double CurrentHardwareSampleRate { - get { - return GetDouble (AudioSessionProperty.CurrentHardwareSampleRate); - } - } - - static public int CurrentHardwareInputNumberChannels { - get { - return GetInt (AudioSessionProperty.CurrentHardwareInputNumberChannels); - } - } - - static public int CurrentHardwareOutputNumberChannels { - get { - return GetInt (AudioSessionProperty.CurrentHardwareOutputNumberChannels); - } - } - - static public float CurrentHardwareOutputVolume { - get { - return GetFloat (AudioSessionProperty.CurrentHardwareOutputVolume); - } - } - - static public float CurrentHardwareInputLatency { - get { - return GetFloat (AudioSessionProperty.CurrentHardwareInputLatency); - } - } - - static public float CurrentHardwareOutputLatency { - get { - return GetFloat (AudioSessionProperty.CurrentHardwareOutputLatency); - } - } - - static public float CurrentHardwareIOBufferDuration { - get { - return GetFloat (AudioSessionProperty.CurrentHardwareIOBufferDuration); - } - } - - static public bool OtherAudioIsPlaying { - get { - return GetInt (AudioSessionProperty.OtherAudioIsPlaying) != 0; - } - } - - static public AudioSessionRoutingOverride RoutingOverride { - set { - SetInt (AudioSessionProperty.OverrideAudioRoute, (int) value); - } - } - - static public bool AudioInputAvailable { - get { - return GetInt (AudioSessionProperty.AudioInputAvailable) != 0; - } - } - - static public bool AudioShouldDuck { - get { - return GetInt (AudioSessionProperty.OtherMixableAudioShouldDuck) != 0; - } - set { - SetInt (AudioSessionProperty.OtherMixableAudioShouldDuck, value ? 1 : 0); - } - } - - static public bool OverrideCategoryMixWithOthers { - get { - return GetInt (AudioSessionProperty.OverrideCategoryMixWithOthers) != 0; - } - set { - SetInt (AudioSessionProperty.OverrideCategoryMixWithOthers, value ? 1 : 0); - } - } - - static public bool OverrideCategoryDefaultToSpeaker { - get { - return GetInt (AudioSessionProperty.OverrideCategoryDefaultToSpeaker) != 0; - } - set { - SetInt (AudioSessionProperty.OverrideCategoryDefaultToSpeaker, value ? 1 : 0); - } - } - - static public bool OverrideCategoryEnableBluetoothInput { - get { - return GetInt (AudioSessionProperty.OverrideCategoryEnableBluetoothInput) != 0; - } - set { - SetInt (AudioSessionProperty.OverrideCategoryEnableBluetoothInput, value ? 1 : 0); - } - } - - static public AudioSessionMode Mode { - get { - return (AudioSessionMode) GetInt (AudioSessionProperty.Mode); - } - set { - SetInt (AudioSessionProperty.Mode, (int) value); - } - } - - static public bool InputGainAvailable { - get { - return GetInt (AudioSessionProperty.InputGainAvailable) != 0; - } - } - - static public float InputGainScalar { - get { - return GetFloat (AudioSessionProperty.InputGainScalar); - } - set { - SetFloat (AudioSessionProperty.InputGainScalar, value); - } - } - -#if !NET - delegate void _PropertyListener (IntPtr userData, AudioSessionProperty prop, int size, IntPtr data); -#endif - public delegate void PropertyListener (AudioSessionProperty prop, int size, IntPtr data); - -#if NET - [UnmanagedCallersOnly] -#else - [MonoPInvokeCallback (typeof (_PropertyListener))] -#endif - static void Listener (IntPtr userData, AudioSessionProperty prop, int size, IntPtr data) - { - ArrayList a = (ArrayList) listeners! [prop]; - if (a is null) { - // Should never happen - return; - } - - foreach (PropertyListener pl in a) { - pl (prop, size, data); - } - } - - [DllImport (Constants.AudioToolboxLibrary)] -#if NET - unsafe extern static AudioSessionErrors AudioSessionAddPropertyListener(AudioSessionProperty id, delegate* unmanaged inProc, IntPtr userData); -#else - extern static AudioSessionErrors AudioSessionAddPropertyListener (AudioSessionProperty id, _PropertyListener inProc, IntPtr userData); -#endif - - static Hashtable? listeners; - - public static AudioSessionErrors AddListener (AudioSessionProperty property, PropertyListener listener) - { - if (listener is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (listener)); - - if (listeners is null) - listeners = new Hashtable (); - - ArrayList a = (ArrayList) listeners [property]; - if (a is null) - listeners [property] = a = new ArrayList (); - - a.Add (listener); - - if (a.Count == 1) { -#if NET - unsafe { - return AudioSessionAddPropertyListener (property, &Listener, IntPtr.Zero); - } -#else - return AudioSessionAddPropertyListener (property, Listener, IntPtr.Zero); -#endif - } - - return AudioSessionErrors.None; - } - - public static void RemoveListener (AudioSessionProperty property, PropertyListener listener) - { - if (listener is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (listener)); - - ArrayList a = (ArrayList) listeners! [property]; - if (a is null) - return; - a.Remove (listener); - if (a.Count == 0) - listeners [property] = null; - } - - static Hashtable? strongListenerHash; - - static void AddListenerEvent (AudioSessionProperty property, object handler, PropertyListener listener) - { - if (strongListenerHash is null) - Interlocked.CompareExchange (ref strongListenerHash, new Hashtable (), null); - - lock (strongListenerHash) { - strongListenerHash [handler] = listener; - } - - AddListener (property, listener); - } - - static void RemoveListenerEvent (AudioSessionProperty property, object handler) - { - if (strongListenerHash is null) - return; - - PropertyListener listener; - lock (strongListenerHash) { - listener = (PropertyListener) strongListenerHash [handler]; - if (listener is null) - return; - - strongListenerHash.Remove (handler); - } - - RemoveListener (AudioSessionProperty.CurrentHardwareOutputVolume, listener); - } - - public static event EventHandler AudioRouteChanged { - add { - AddListenerEvent (AudioSessionProperty.AudioRouteChange, value, - (prop, size, data) => value (null, new AudioSessionRouteChangeEventArgs (data))); - } - remove { - RemoveListenerEvent (AudioSessionProperty.AudioRouteChange, value); - } - } - - public static event Action CurrentHardwareOutputVolumeChanged { - add { - AddListenerEvent (AudioSessionProperty.CurrentHardwareOutputVolume, value, - (prop, size, data) => value ((float) data)); - } - remove { - RemoveListenerEvent (AudioSessionProperty.CurrentHardwareOutputVolume, value); - } - } - - public static event Action AudioInputBecameAvailable { - add { - AddListenerEvent (AudioSessionProperty.AudioInputAvailable, value, - (prop, size, data) => value (data != IntPtr.Zero)); - } - remove { - RemoveListenerEvent (AudioSessionProperty.AudioInputAvailable, value); - } - } - - public static event Action ServerDied { - add { - AddListenerEvent (AudioSessionProperty.ServerDied, value, - (prop, size, data) => value (data != IntPtr.Zero)); - } - remove { - RemoveListenerEvent (AudioSessionProperty.ServerDied, value); - } - } - - public static event Action InputGainBecameAvailable { - add { - AddListenerEvent (AudioSessionProperty.InputGainAvailable, value, - (prop, size, data) => value (data != IntPtr.Zero)); - } - remove { - RemoveListenerEvent (AudioSessionProperty.InputGainAvailable, value); - } - } - - public static event Action InputGainScalarChanged { - add { - AddListenerEvent (AudioSessionProperty.InputGainScalar, value, - (prop, size, data) => value ((float) data)); - } - remove { - RemoveListenerEvent (AudioSessionProperty.InputGainScalar, value); - } - } - - public static event Action InputSourcesChanged { - add { - AddListenerEvent (AudioSessionProperty.InputSources, value, - (prop, size, data) => value (ExtractAccessoryInfo (data, InputSourceKey_ID!, InputSourceKey_Description!))); - } - remove { - RemoveListenerEvent (AudioSessionProperty.InputSources, value); - } - } - - public static event Action OutputDestinationsChanged { - add { - AddListenerEvent (AudioSessionProperty.OutputDestinations, value, - (prop, size, data) => value (ExtractAccessoryInfo (data, OutputDestinationKey_ID!, OutputDestinationKey_Description!))); - } - remove { - RemoveListenerEvent (AudioSessionProperty.OutputDestinations, value); - } - } - } -#endif // !MONOMAC -#endif // !TVOS -#endif // !XAMCORE_3_0 -} diff --git a/src/AudioUnit/AUEnums.cs b/src/AudioUnit/AUEnums.cs index acc8e5ccdcf9..78e04b45d24e 100644 --- a/src/AudioUnit/AUEnums.cs +++ b/src/AudioUnit/AUEnums.cs @@ -260,12 +260,8 @@ public enum AudioObjectPropertyElement : uint { Main = 0, // 0 } -#if XAMCORE_3_0 /// An enumeration whose values specify a kind of . [Internal] -#else - [Obsolete ("Please use the strongly typed properties instead.")] -#endif enum AudioUnitPropertyIDType { // UInt32 AudioUnitPropertyID // Audio Unit Properties ClassInfo = 0, diff --git a/src/AudioUnit/AudioUnit.cs b/src/AudioUnit/AudioUnit.cs index 4b390ed3abf5..332c6302aa1f 100644 --- a/src/AudioUnit/AudioUnit.cs +++ b/src/AudioUnit/AudioUnit.cs @@ -30,11 +30,6 @@ #nullable enable -// Adding this warning disable since AudioUnitPropertyIDType is removed from public API but used internally -#if !XAMCORE_3_0 -#pragma warning disable CS0618 -#endif - using System; using System.Collections; using System.Collections.Generic; @@ -396,22 +391,6 @@ public AudioComponent Component { public bool IsPlaying { get { return _isPlaying; } } - -#if !XAMCORE_3_0 - [Obsolete ("Use 'SetFormat' instead as it has the ability of returning a status code.")] - public unsafe void SetAudioFormat (AudioToolbox.AudioStreamBasicDescription audioFormat, AudioUnitScopeType scope, uint audioUnitElement = 0) - { - var err = AudioUnitSetProperty (Handle, - AudioUnitPropertyIDType.StreamFormat, - scope, - audioUnitElement, - &audioFormat, - (uint) Marshal.SizeOf ()); - if (err != 0) - throw new AudioUnitException (err); - } -#endif - public unsafe AudioUnitStatus SetFormat (AudioToolbox.AudioStreamBasicDescription audioFormat, AudioUnitScopeType scope, uint audioUnitElement = 0) { return (AudioUnitStatus) AudioUnitSetProperty (Handle, @@ -440,7 +419,7 @@ public uint GetCurrentDevice (AudioUnitScopeType scope, uint audioUnitElement = return device; } -#if !XAMCORE_3_0 || MONOMAC || __MACCATALYST__ +#if MONOMAC || __MACCATALYST__ #if !MONOMAC && !__MACCATALYST__ [Obsolete ("This API is not available on iOS.")] #endif @@ -477,8 +456,6 @@ public static uint GetCurrentInputDevice () if (err != 0) throw new AudioUnitException ((int) err); return inputDevice; -#elif !XAMCORE_3_0 - return 0; #endif } #endif @@ -1163,7 +1140,7 @@ public unsafe AudioUnitStatus SetScheduledFiles (AudioFile [] audioFiles) #endif // !COREBUILD } -#if !XAMCORE_3_0 || MONOMAC || __MACCATALYST__ +#if MONOMAC || __MACCATALYST__ [StructLayout (LayoutKind.Sequential)] struct AudioObjectPropertyAddress { #if !COREBUILD @@ -1186,7 +1163,7 @@ public AudioObjectPropertyAddress (AudioObjectPropertySelector selector, AudioOb } #endif // !COREBUILD } -#endif // !XAMCORE_3_0 || MONOMAC || __MACCATALYST__ +#endif // MONOMAC || __MACCATALYST__ #if NET [SupportedOSPlatform ("ios")] diff --git a/src/CloudKit/CKRecordID.cs b/src/CloudKit/CKRecordID.cs index 88a4cbcc7314..48bc5c66149c 100644 --- a/src/CloudKit/CKRecordID.cs +++ b/src/CloudKit/CKRecordID.cs @@ -5,11 +5,5 @@ namespace CloudKit { public partial class CKRecordID { -#if !XAMCORE_3_0 - [Obsolete ("iOS9 does not allow creating an empty instance")] - public CKRecordID () - { - } -#endif } } diff --git a/src/CloudKit/CKRecordZoneID.cs b/src/CloudKit/CKRecordZoneID.cs index c35b563cb3eb..fbe85e875a8a 100644 --- a/src/CloudKit/CKRecordZoneID.cs +++ b/src/CloudKit/CKRecordZoneID.cs @@ -5,11 +5,5 @@ namespace CloudKit { public partial class CKRecordZoneID { -#if !XAMCORE_3_0 - [Obsolete ("iOS9 does not allow creating an empty instance")] - public CKRecordZoneID () - { - } -#endif } } diff --git a/src/Constants.watch.cs.in b/src/Constants.watch.cs.in deleted file mode 100644 index d23a3524bf56..000000000000 --- a/src/Constants.watch.cs.in +++ /dev/null @@ -1,20 +0,0 @@ -namespace ObjCRuntime { - public static partial class Constants { - public const string Version = "@VERSION@"; - internal const string Revision = "@REVISION@"; - public const string SdkVersion = "@WATCH_SDK_VERSION@"; - - // WatchOS 2.0 - public const string CFNetworkLibrary = "/System/Library/Frameworks/CFNetwork.framework/CFNetwork"; - internal const string CoreServicesLibrary = "/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices"; - public const string libcompressionLibrary = "/usr/lib/libcompression.dylib"; - - // WatchOS 3.2 - public const string AccelerateImageLibrary = "/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage"; - - // WatchOS 4.0 -#if !NET - public const string VisionLibrary = "/System/Library/Frameworks/Vision.framework/Vision"; -#endif - } -} diff --git a/src/Contacts/CNObsolete.cs b/src/Contacts/CNObsolete.cs deleted file mode 100644 index a67238558478..000000000000 --- a/src/Contacts/CNObsolete.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 Xamarin Inc. All rights reserved. - -// note: Contacts is not part of classic as several API requires generics - -#nullable enable - -#if !XAMCORE_3_0 - -using System; -using Foundation; -using ObjCRuntime; - -namespace Contacts { - - public static partial class CNGroup_PredicatesExtension { - -#if !MONOMAC - [Obsolete ("This API is only available on macOS 10.11+.")] - public static Foundation.NSPredicate? GetPredicateForSubgroupsInGroup (CNGroup This, string parentGroupIdentifier) - { - return null; - } -#endif - } -} - -#endif diff --git a/src/CoreBluetooth/CoreBluetooth.cs b/src/CoreBluetooth/CoreBluetooth.cs index c51d7bb31c89..738dec0c38a9 100644 --- a/src/CoreBluetooth/CoreBluetooth.cs +++ b/src/CoreBluetooth/CoreBluetooth.cs @@ -21,15 +21,6 @@ public CBCentralManager (DispatchQueue dispatchQueue) : this (new _CBCentralMana } } -#if !MONOMAC && !XAMCORE_3_0 && !NET - public partial class CBPeer { - - [Obsolete ("This type is not meant to be created by user code.", true)] - public CBPeer () - { - } - } -#endif #if !WATCH && !NET public partial class CBCentralManager { diff --git a/src/CoreData/Obsolete.cs b/src/CoreData/Obsolete.cs index e91d1e1ca697..8135abc137f0 100644 --- a/src/CoreData/Obsolete.cs +++ b/src/CoreData/Obsolete.cs @@ -5,31 +5,6 @@ #nullable enable namespace CoreData { -#if !XAMCORE_3_0 - public partial class NSMergeConflict { - - [Obsolete ("Default constructor is not available")] - public NSMergeConflict () - { - } - } - - public partial class NSMergePolicy { - - [Obsolete ("Default constructor is not available")] - public NSMergePolicy () - { - } - } - - public partial class NSPersistentStore { - - [Obsolete ("Default constructor is not available")] - public NSPersistentStore () - { - } - } -#endif #if !NET public partial class NSCoreDataCoreSpotlightDelegate { diff --git a/src/CoreGraphics/CGColorSpace.cs b/src/CoreGraphics/CGColorSpace.cs index 864a758d1abc..ec5bcaa1a88a 100644 --- a/src/CoreGraphics/CGColorSpace.cs +++ b/src/CoreGraphics/CGColorSpace.cs @@ -72,15 +72,6 @@ public enum CGColorSpaceModel { #endif public class CGColorSpace : NativeObject { #if !COREBUILD -#if !XAMCORE_3_0 -#if !NET - [Obsolete ("Use a real 'null' value instead of this managed wrapper over a null native instance.")] -#else - [Obsolete ("Use a real 'null' value instead of this managed wrapper over a null native instance.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#endif - public readonly static CGColorSpace Null = CreateNull (); -#endif - #if !NET public CGColorSpace (NativeHandle handle) : base (handle, false) @@ -88,19 +79,6 @@ public CGColorSpace (NativeHandle handle) } #endif -#if !XAMCORE_3_0 - static CGColorSpace CreateNull () - { - var throwOnInitFailure = Class.ThrowOnInitFailure; - Class.ThrowOnInitFailure = false; - try { - return new CGColorSpace (IntPtr.Zero, true); - } finally { - Class.ThrowOnInitFailure = throwOnInitFailure; - } - } -#endif - static IntPtr Create (CFPropertyList propertyList) { if (propertyList is null) @@ -166,19 +144,6 @@ public static CGColorSpace CreateDeviceRGB () return new CGColorSpace (CGColorSpaceCreateDeviceCMYK (), true); } -#if !XAMCORE_3_0 -#if !NET - [Obsolete ("This method has been renamed 'CreateDeviceCmyk'.")] -#else - [Obsolete ("This method has been renamed 'CreateDeviceCmyk'.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#endif - [EditorBrowsable (EditorBrowsableState.Never)] - public static /* CGColorSpaceRef */ CGColorSpace CreateDeviceCMYK () - { - return new CGColorSpace (CGColorSpaceCreateDeviceCMYK (), true); - } -#endif - [DllImport (Constants.CoreGraphicsLibrary)] extern unsafe static /* CGColorSpaceRef */ IntPtr CGColorSpaceCreateCalibratedGray (/* const CGFloat[3] */ nfloat* whitepoint, /* const CGFloat[3] */ nfloat* blackpoint, /* CGFloat */ nfloat gamma); diff --git a/src/CoreGraphics/CGSize.cs b/src/CoreGraphics/CGSize.cs index 2558c5412f06..407e97acdaba 100644 --- a/src/CoreGraphics/CGSize.cs +++ b/src/CoreGraphics/CGSize.cs @@ -180,20 +180,6 @@ public CGSize ToRoundedCGSize () return new CGSize ((nfloat) Math.Round (width), (nfloat) Math.Round (height)); } -#if !XAMCORE_3_0 - [Obsolete ("Use 'ToRoundedCGSize' instead.")] - public CGSize ToSize () - { - return ToRoundedCGSize (); - } - - [Obsolete ("Use 'ToCGPoint' instead.")] - public CGPoint ToPointF () - { - return (CGPoint) this; - } -#endif - public CGPoint ToCGPoint () { return (CGPoint) this; diff --git a/src/CoreImage/CIFilter.cs b/src/CoreImage/CIFilter.cs index d6660f9ad3e0..9dcfdd3872fc 100644 --- a/src/CoreImage/CIFilter.cs +++ b/src/CoreImage/CIFilter.cs @@ -752,12 +752,4 @@ bool SupportsInputImage { } #endif } - -#if MONOMAC && !XAMCORE_3_0 && !NET - [Obsolete ("This type has been renamed to CICmykHalftone.")] - public class CICMYKHalftone : CICmykHalftone { - public CICMYKHalftone () {} - public CICMYKHalftone (IntPtr handle) : base (handle) {} - } -#endif } diff --git a/src/CoreImage/CIImage.cs b/src/CoreImage/CIImage.cs index 9171b1e9a4ce..8a81191e6a76 100644 --- a/src/CoreImage/CIImage.cs +++ b/src/CoreImage/CIImage.cs @@ -179,9 +179,6 @@ internal static int CIFormatToInt (CIFormat format) #if MONOMAC case CIFormat.RGBA16: return FormatRGBA16; case CIFormat.RGBAf: return FormatRGBAf; -#elif !XAMCORE_3_0 - case CIFormat.BGRA8: return FormatBGRA8; - case CIFormat.RGBA8: return FormatRGBA8; #endif case CIFormat.kRGBAf: return FormatRGBAf; case CIFormat.kBGRA8: return FormatBGRA8; diff --git a/src/CoreImage/CISampler.cs b/src/CoreImage/CISampler.cs index 554b71963048..bc62262306ec 100644 --- a/src/CoreImage/CISampler.cs +++ b/src/CoreImage/CISampler.cs @@ -89,10 +89,6 @@ internal NSDictionary ToDictionary () } public partial class CISampler { -#if !XAMCORE_3_0 && MONOMAC - [Obsolete ("This default constructor does not provide a valid instance")] - public CISampler () {} -#endif public CISampler FromImage (CIImage sourceImage, CISamplerOptions? options) { if (options is null) diff --git a/src/CoreImage/Enums.cs b/src/CoreImage/Enums.cs index 6fc7438d5323..60941bb22369 100644 --- a/src/CoreImage/Enums.cs +++ b/src/CoreImage/Enums.cs @@ -55,12 +55,6 @@ public enum CIFormat { [Obsolete ("This value can not be shared across Mac/iOS binaries, future proof with kRGBAf instead.")] RGBAf = 3, - // Please, do not add values into MonoMac/iOS without adding an explicit value -#elif !XAMCORE_3_0 - [Obsolete ("This value can not be shared across Mac/iOS binaries, future proof with kBGRA8 instead.")] - BGRA8 = 2, - [Obsolete ("This value can not be shared across Mac/iOS binaries, future proof with kRGBA8 instead.")] - RGBA8 = 3, // Please, do not add values into MonoMac/iOS without adding an explicit value #endif kRGBAf = 4, diff --git a/src/CoreMedia/CoreMedia.cs b/src/CoreMedia/CoreMedia.cs index a33dd821e4f6..868c3b058437 100644 --- a/src/CoreMedia/CoreMedia.cs +++ b/src/CoreMedia/CoreMedia.cs @@ -49,13 +49,6 @@ public struct CMTimeRange { public CMTime Duration; #if !COREBUILD public static readonly CMTimeRange Zero; - -#if !XAMCORE_3_0 -#if !WATCH - [Obsolete ("Use 'InvalidRange'.")] - public static readonly CMTimeRange Invalid; -#endif // !WATCH -#endif // !XAMCORE_3_0 public static readonly CMTimeRange InvalidRange; #if NET @@ -89,11 +82,6 @@ static CMTimeRange () Zero = Marshal.PtrToStructure (retZero)!; var retInvalid = Dlfcn.dlsym (lib, "kCMTimeRangeInvalid"); -#if !XAMCORE_3_0 -#pragma warning disable CS0618 // Type or member is obsolete - Invalid = Marshal.PtrToStructure (retInvalid)!; -#pragma warning restore CS0618 // Type or member is obsolete -#endif InvalidRange = Marshal.PtrToStructure (retInvalid)!; var retMappingInvalid = Dlfcn.dlsym (lib, "kCMTimeMappingInvalid"); diff --git a/src/CoreMotion/CMCompat.cs b/src/CoreMotion/CMCompat.cs deleted file mode 100644 index 951913cf8353..000000000000 --- a/src/CoreMotion/CMCompat.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 Xamarin Inc. All rights reserved. - -#nullable enable - -#if !XAMCORE_3_0 && !MONOMAC - -using System; -using System.Runtime.InteropServices; - -namespace CoreMotion { - - public partial class CMSensorRecorder { - - [Obsolete ("Apple removed this API in iOS 9.3.")] - public virtual CMSensorDataList? GetAccelerometerDataSince (ulong identifier) - { - return null; - } - } -} - -#endif diff --git a/src/CoreText/CTFontManager.cs b/src/CoreText/CTFontManager.cs index 2dd5c5e0e300..ae613d675c15 100644 --- a/src/CoreText/CTFontManager.cs +++ b/src/CoreText/CTFontManager.cs @@ -115,21 +115,6 @@ public static bool IsFontSupported (NSUrl url) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url)); return CTFontManagerIsSupportedFont (url.Handle) != 0; } -#elif !XAMCORE_3_0 -#if NET - [ObsoletedOSPlatform ("macos10.6")] - [UnsupportedOSPlatform ("ios")] -#else - [Deprecated (PlatformName.MacOSX, 10, 6)] - [Unavailable (PlatformName.iOS)] -#endif - [Obsolete ("API not available on iOS, it will always return false.")] - public static bool IsFontSupported (NSUrl url) - { - if (url is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url)); - return false; - } #endif [DllImport (Constants.CoreTextLibrary)] @@ -558,9 +543,6 @@ public static bool UnregisterGraphicsFont (CGFont font, out NSError? error) static CTFontManager () { var handle = Libraries.CoreText.Handle; -#if !XAMCORE_3_0 - ErrorDomain = Dlfcn.GetStringConstant (handle, "kCTFontManagerErrorDomain"); -#endif #pragma warning disable CS0618 // Type or member is obsolete ErrorFontUrlsKey = Dlfcn.GetStringConstant (handle, "kCTFontManagerErrorFontURLsKey"); #pragma warning restore CS0618 // Type or member is obsolete @@ -583,9 +565,6 @@ static NSString? RegisteredFontsChangedNotification { } } -#if !XAMCORE_3_0 - public readonly static NSString? ErrorDomain; -#endif #if !NET [Obsolete ("Use the 'CTFontManagerErrorKeys.FontUrlsKey' property instead.")] public readonly static NSString? ErrorFontUrlsKey; diff --git a/src/CoreVideo/CVImageBuffer.cs b/src/CoreVideo/CVImageBuffer.cs index 7f9dad56822e..063924e77237 100644 --- a/src/CoreVideo/CVImageBuffer.cs +++ b/src/CoreVideo/CVImageBuffer.cs @@ -112,17 +112,6 @@ public CGColorSpace? ColorSpace { return h == IntPtr.Zero ? null : new CGColorSpace (h, false); } } -#elif !XAMCORE_3_0 - [Deprecated (PlatformName.MacOSX, 10, 4)] - [Unavailable (PlatformName.iOS)] -#if IOS - [Obsolete ("This API is not available on this platform.")] -#endif - public CGColorSpace? ColorSpace { - get { - return null; - } - } #endif #if MONOMAC diff --git a/src/CoreVideo/CVPixelBuffer.cs b/src/CoreVideo/CVPixelBuffer.cs index abf3611f71bf..b8c35e02de61 100644 --- a/src/CoreVideo/CVPixelBuffer.cs +++ b/src/CoreVideo/CVPixelBuffer.cs @@ -499,14 +499,6 @@ public nint GetWidthOfPlane (nint planeIndex) extern static CVReturn CVPixelBufferLockBaseAddress ( /* CVPixelBufferRef __nonnull */ IntPtr pixelBuffer, CVPixelBufferLock lockFlags); -#if !XAMCORE_3_0 - [Obsolete ("Use 'Lock (CVPixelBufferLock)' instead.")] - public CVReturn Lock (CVOptionFlags lockFlags) - { - return CVPixelBufferLockBaseAddress (Handle, (CVPixelBufferLock) lockFlags); - } -#endif - public CVReturn Lock (CVPixelBufferLock lockFlags) { return CVPixelBufferLockBaseAddress (Handle, lockFlags); @@ -516,14 +508,6 @@ public CVReturn Lock (CVPixelBufferLock lockFlags) extern static CVReturn CVPixelBufferUnlockBaseAddress ( /* CVPixelBufferRef __nonnull */ IntPtr pixelBuffer, CVPixelBufferLock unlockFlags); -#if !XAMCORE_3_0 - [Obsolete ("Use 'Unlock (CVPixelBufferLock)'.")] - public CVReturn Unlock (CVOptionFlags unlockFlags) - { - return CVPixelBufferUnlockBaseAddress (Handle, (CVPixelBufferLock) unlockFlags); - } -#endif - public CVReturn Unlock (CVPixelBufferLock unlockFlags) { return CVPixelBufferUnlockBaseAddress (Handle, unlockFlags); diff --git a/src/CoreVideo/CVPixelFormatDescription.cs b/src/CoreVideo/CVPixelFormatDescription.cs index 1a77965fd366..968c6540558d 100644 --- a/src/CoreVideo/CVPixelFormatDescription.cs +++ b/src/CoreVideo/CVPixelFormatDescription.cs @@ -250,13 +250,6 @@ public static CVPixelFormatType [] AllPixelFormatTypes { extern static /* CFDictionaryRef __nullable */ IntPtr CVPixelFormatDescriptionCreateWithPixelFormatType ( /* CFAllocatorRef __nullable */ IntPtr allocator, int /* OSType = int32_t */ pixelFormat); -#if !XAMCORE_3_0 - public static NSDictionary? Create (int pixelFormat) - { - return Runtime.GetNSObject (CVPixelFormatDescriptionCreateWithPixelFormatType (IntPtr.Zero, pixelFormat)); - } -#endif - /// Create a description of the specified pixel format. /// The pixel format to create a description of. public static NSDictionary? Create (CVPixelFormatType pixelFormat) @@ -278,16 +271,6 @@ public static CVPixelFormatType [] AllPixelFormatTypes { extern static void CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType ( /* CFDictionaryRef __nonnull */ IntPtr description, int /* OSType = int32_t */ pixelFormat); -#if !XAMCORE_3_0 - public static void Register (NSDictionary description, int pixelFormat) - { - if (description is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (description)); - - CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType (description.Handle, pixelFormat); - } -#endif - /// Register a new pixel format with CoreVideo. /// The pixel format description for the pixel format to register. /// The pixel format to register. diff --git a/src/Foundation/Compat.cs b/src/Foundation/Compat.cs index 8f9d82469b15..ea35e074f5ed 100644 --- a/src/Foundation/Compat.cs +++ b/src/Foundation/Compat.cs @@ -26,25 +26,6 @@ public static NSError GetFileProviderErrorForOutOfDateItem (FileProvider.INSFile } #endif -#if !XAMCORE_3_0 - public partial class NSOperation { - - [Obsolete ("Use 'WaitUntilFinished' method.")] - public virtual void WaitUntilFinishedNS () - { - WaitUntilFinished (); - } - } - - public partial class NSNetService { - - [Obsolete ("This constructor does not create a valid instance of the type")] - public NSNetService () - { - } - } -#endif - #if !WATCH public partial class NSUserActivity { diff --git a/src/Foundation/Enum.cs b/src/Foundation/Enum.cs index 29b9ff476f93..d28d5b430907 100644 --- a/src/Foundation/Enum.cs +++ b/src/Foundation/Enum.cs @@ -75,7 +75,7 @@ public enum NSUrlCredentialPersistence : ulong { Synchronizable } -#if MONOMAC || !XAMCORE_3_0 +#if MONOMAC #if !NET [Native] @@ -89,9 +89,6 @@ public enum NSBundleExecutableArchitecture { PPC = 0x00000012, X86_64 = 0x01000007, PPC64 = 0x01000012, -#if !XAMCORE_3_0 - [Watch (7, 0), TV (14, 0), iOS (14, 0)] -#endif ARM64 = 0x0100000c, } #endif @@ -1026,16 +1023,6 @@ public enum NSDataBase64EncodingOptions : ulong { EndLineWithLineFeed = 1 << 5 } -#if !XAMCORE_3_0 - [Deprecated (PlatformName.iOS, 9, 0, message: "Use 'NSWritingDirectionFormatType'.")] - [Deprecated (PlatformName.MacCatalyst, 13, 1, message: "Use 'NSWritingDirectionFormatType'.")] - [Flags] - [Native] - public enum NSTextWritingDirection : long { - Embedding = 0, Override = 2 - } -#endif - [Native] public enum NSUrlSessionAuthChallengeDisposition : long { UseCredential = 0, diff --git a/src/Foundation/NSAttributedString.cs b/src/Foundation/NSAttributedString.cs index 474c85497cf7..f57ce4070159 100644 --- a/src/Foundation/NSAttributedString.cs +++ b/src/Foundation/NSAttributedString.cs @@ -212,18 +212,6 @@ public NSAttributedString (string str, strokeWidth, strikethroughStyle)) { } - -#if !XAMCORE_3_0 - // This is a [Category] -> C# extension method (see uikit.cs) but it targets on static selector - // the resulting syntax does not look good in user code so we provide a better looking API - // https://bugzilla.xamarin.com/show_bug.cgi?id=15268 - // https://trello.com/c/iQpXOxCd/227-category-and-static-methods-selectors - // note: we cannot reuse the same method name - as it would break compilation of existing apps - public static NSAttributedString CreateFrom (NSTextAttachment attachment) - { - return (null as NSAttributedString)!.FromTextAttachment (attachment); - } -#endif #endif } } diff --git a/src/Foundation/NSDistributedNotificationCenter.cs b/src/Foundation/NSDistributedNotificationCenter.cs deleted file mode 100644 index f690fb8a10d0..000000000000 --- a/src/Foundation/NSDistributedNotificationCenter.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// Helper methods for NSDistributedNotificationCenter -// -// Author: -// Miguel de Icaza -// -// Copyright 2011 Xamarin Inc -// -#if !MONOMAC && !XAMCORE_3_0 - -using System; - -using ObjCRuntime; - -namespace Foundation { - - [Obsolete ("This is not available in iOS.")] - public partial class NSDistributedNotificationCenter { - - [Obsolete ("This is not available in iOS.")] - public void AddObserver (NSObject observer, Selector aSelector, string aName, string anObject) - { - } - - [Obsolete ("This is not available in iOS.")] - public void RemoveObserver (NSObject observer, string aName, string anObject) - { - } - } -} - -#endif diff --git a/src/Foundation/NSFileManagerDelegate.cs b/src/Foundation/NSFileManagerDelegate.cs index a140361337a2..926be3d70e93 100644 --- a/src/Foundation/NSFileManagerDelegate.cs +++ b/src/Foundation/NSFileManagerDelegate.cs @@ -16,14 +16,6 @@ public virtual bool ShouldCopyItemAtPath (NSFileManager fileManager, string srcP { return ShouldCopyItemAtPath (fileManager, (NSString) srcPath, (NSString) dstPath); } - -#if !XAMCORE_3_0 - [Obsolete ("API removed after iOS 2.0 / macOS 10.5. It will never be called by the OS.")] - public virtual bool ShouldProceedAfterError (NSFileManager fm, NSDictionary errorInfo) - { - return false; - } -#endif } public static partial class NSFileManagerDelegate_Extensions { // This was a duplicate [Export] so in order to avoid breaking the API we expose it this way. @@ -32,13 +24,5 @@ public static bool ShouldCopyItemAtPath (this INSFileManagerDelegate This, NSFil { return This.ShouldCopyItemAtPath (fileManager, (NSString) srcPath, (NSString) dstPath); } - -#if !XAMCORE_3_0 - [Obsolete ("API removed after iOS 2.0 / macOS 10.5. It will never be called by the OS.")] - public static bool ShouldProceedAfterError (INSFileManagerDelegate This, NSFileManager fm, NSDictionary errorInfo) - { - return false; - } -#endif } } diff --git a/src/Foundation/NSIndexPath.cs b/src/Foundation/NSIndexPath.cs index 9b7b2486e1b0..c3cd5dd2a59c 100644 --- a/src/Foundation/NSIndexPath.cs +++ b/src/Foundation/NSIndexPath.cs @@ -40,12 +40,7 @@ public unsafe static NSIndexPath Create (params int [] indexes) if (indexes is null) throw new ArgumentNullException ("indexes"); -#if ARCH_32 - fixed (int* ptr = indexes) -#else fixed (nint* ptr = Array.ConvertAll (indexes, (v) => v)) -#endif - return _FromIndex ((IntPtr) ptr, indexes.Length); } @@ -54,12 +49,7 @@ public unsafe static NSIndexPath Create (params uint [] indexes) if (indexes is null) throw new ArgumentNullException ("indexes"); -#if ARCH_32 - fixed (uint* ptr = indexes) -#else fixed (nuint* ptr = Array.ConvertAll (indexes, (v) => v)) -#endif - return _FromIndex ((IntPtr) ptr, indexes.Length); } diff --git a/src/Foundation/NSNumber2.cs b/src/Foundation/NSNumber2.cs index 7def06d4e0f9..87e90f53a5fd 100644 --- a/src/Foundation/NSNumber2.cs +++ b/src/Foundation/NSNumber2.cs @@ -131,31 +131,19 @@ public static explicit operator bool (NSNumber source) } public NSNumber (nfloat value) : -#if ARCH_64 - this ((double)value) -#else - this ((float) value) -#endif + this ((double) value) { } public nfloat NFloatValue { get { -#if ARCH_64 - return (nfloat)DoubleValue; -#else - return (nfloat) FloatValue; -#endif + return (nfloat) DoubleValue; } } public static NSNumber FromNFloat (nfloat value) { -#if ARCH_64 - return (FromDouble ((double)value)); -#else - return (FromFloat ((float) value)); -#endif + return (FromDouble ((double) value)); } public override string ToString () diff --git a/src/Foundation/NSObject2.cs b/src/Foundation/NSObject2.cs index 33aa5ecfdc16..16dd2dd38dda 100644 --- a/src/Foundation/NSObject2.cs +++ b/src/Foundation/NSObject2.cs @@ -344,14 +344,6 @@ static void RegisterToggleReference (NSObject obj, IntPtr handle, bool isCustomT #endif } -#if !XAMCORE_3_0 - [EditorBrowsable (EditorBrowsableState.Never)] - public static bool IsNewRefcountEnabled () - { - return true; - } -#endif - /* Register the current object with the toggleref machinery if the following conditions are met: -The new refcounting is enabled; and @@ -706,47 +698,6 @@ private bool AllocIfNeeded () return false; } -#if !XAMCORE_3_0 - private IntPtr GetObjCIvar (string name) - { - IntPtr native; - - object_getInstanceVariable (handle, name, out native); - - return native; - } - - [Obsolete ("Do not use; this API does not properly retain/release existing/new values, so leaks and/or crashes may occur.")] - public NSObject GetNativeField (string name) - { - IntPtr field = GetObjCIvar (name); - - if (field == IntPtr.Zero) - return null; - return Runtime.GetNSObject (field); - } - - private void SetObjCIvar (string name, IntPtr value) - { - object_setInstanceVariable (handle, name, value); - } - - [Obsolete ("Do not use; this API does not properly retain/release existing/new values, so leaks and/or crashes may occur.")] - public void SetNativeField (string name, NSObject value) - { - if (value is null) - SetObjCIvar (name, IntPtr.Zero); - else - SetObjCIvar (name, value.Handle); - } - - [DllImport (Messaging.LIBOBJC_DYLIB)] - extern static void object_getInstanceVariable (IntPtr obj, string name, out IntPtr val); - - [DllImport (Messaging.LIBOBJC_DYLIB)] - extern static void object_setInstanceVariable (IntPtr obj, string name, IntPtr val); -#endif // !XAMCORE_3_0 - private void InvokeOnMainThread (Selector sel, NSObject obj, bool wait) { #if NET diff --git a/src/Foundation/NSUrl.cs b/src/Foundation/NSUrl.cs index 3a3ed771487c..46cf9d5ff8d0 100644 --- a/src/Foundation/NSUrl.cs +++ b/src/Foundation/NSUrl.cs @@ -129,15 +129,4 @@ public int Port { return !(x == y); } } - -#if !XAMCORE_3_0 - public static partial class NSUrl_PromisedItems { - - [Obsolete ("Use overload with an 'out NSObject value' parameter.")] - public static bool GetPromisedItemResourceValue (NSUrl This, NSObject value, NSString key, out NSError error) - { - return This.GetPromisedItemResourceValue (out value, key, out error); - } - } -#endif } diff --git a/src/GameController/GCController.cs b/src/GameController/GCController.cs index 2b4e6f188305..c89488c589f1 100644 --- a/src/GameController/GCController.cs +++ b/src/GameController/GCController.cs @@ -19,7 +19,6 @@ public partial class GCController { #if !NET // In an undefined enum (GCController.h). - // the API will use the new enum in XAMCORE_3_0 so the constant is not helpful anymore public const int PlayerIndexUnset = -1; #endif } diff --git a/src/GameKit/GKCompat.cs b/src/GameKit/GKCompat.cs index 0fbcdc06c136..d6ff49a42b02 100644 --- a/src/GameKit/GKCompat.cs +++ b/src/GameKit/GKCompat.cs @@ -12,31 +12,6 @@ #endif namespace GameKit { - -#if !XAMCORE_3_0 - public partial class GKMatchRequest { - -#if !NET - [Obsolete ("Use 'RecipientResponseHandler' property.")] -#else - [Obsolete ("Use 'RecipientResponseHandler' property.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] -#endif - public virtual void SetRecipientResponseHandler (Action handler) - { - RecipientResponseHandler = handler; - } - } - - public partial class GKMatchmaker { - - [Obsolete ("Use 'InviteHandler' property.")] - public virtual void SetInviteHandler (GKInviteHandler handler) - { - InviteHandler = handler; - } - } -#endif // !XAMCORE_3_0 - #if WATCH && !NET [Unavailable (PlatformName.WatchOS)] [Obsolete ("This API is not available on this platform.")] diff --git a/src/GameKit/GameKit2.cs b/src/GameKit/GameKit2.cs index 5e6398eabe3b..71ce8ea0d5ea 100644 --- a/src/GameKit/GameKit2.cs +++ b/src/GameKit/GameKit2.cs @@ -196,17 +196,6 @@ public GKPeerConnectionEventArgs (GKSession session, string? peerID, NSError? er #endif public partial class GKVoiceChat { - -#if !XAMCORE_3_0 - [Obsolete ("Use 'SetMute (bool, string)' method.")] - public virtual void SetMute (bool isMuted, GKPlayer player) - { - if (player is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (player)); - - SetMute (isMuted, player.PlayerID); - } -#endif } public partial class GKTurnBasedExchange { @@ -234,12 +223,5 @@ public override string ToString () } public partial class GKMatch { -#if !XAMCORE_3_0 - // Compatbility with the broken API, it is deprecated, so that is good. - public virtual bool SendData (NSData data, string [] players, GKMatchSendDataMode mode, NSError error) - { - return SendData (data, players, mode, out error); - } -#endif } } diff --git a/src/HealthKit/HKObsolete.cs b/src/HealthKit/HKObsolete.cs deleted file mode 100644 index c59a7ac6e7df..000000000000 --- a/src/HealthKit/HKObsolete.cs +++ /dev/null @@ -1,37 +0,0 @@ -#nullable enable - -using System; - -namespace HealthKit { - -#if !XAMCORE_3_0 - public partial class HKStatisticsCollectionQuery { - - [Obsolete ("Use 'InitialResultsHandler'.")] - public virtual void SetInitialResultsHandler (HKStatisticsCollectionQueryInitialResultsHandler handler) - { - InitialResultsHandler = handler; - } - - [Obsolete ("Use 'StatisticsUpdated', this handler uses an incorrect type and does nothing to avoid a crash.")] - public virtual void SetStatisticsUpdateHandler (HKStatisticsCollectionQueryInitialResultsHandler handler) - { - } - - [Obsolete ("Use 'StatisticsUpdated', this handler uses an incorrect type and does nothing to avoid a crash.")] - public virtual HKStatisticsCollectionQueryInitialResultsHandler? StatisticsUpdateHandler { - get; set; - } - } - - public partial class HKObjectType { - - [Obsolete ("Use 'GetWorkoutType', it will return a valid HKWorkoutType instance.")] - static public HKWorkout? WorkoutType () - { - // would throw an InvalidCastException since the old selector returned a HKWorkoutType - return null; - } - } -#endif -} diff --git a/src/HomeKit/HMService.cs b/src/HomeKit/HMService.cs index 461a6d8c08fd..9b1ffc371506 100644 --- a/src/HomeKit/HMService.cs +++ b/src/HomeKit/HMService.cs @@ -20,14 +20,6 @@ public Task UpdateAssociatedServiceTypeAsync (HMServiceType serviceType) { return UpdateAssociatedServiceTypeAsync (serviceType.GetConstant ()); } - -#if !XAMCORE_3_0 - [Obsolete] - public Task UpdateNameAsync (HMServiceType serviceType) - { - return UpdateNameAsync (serviceType.GetConstant ()); - } -#endif #endif } } diff --git a/src/ImageIO/CGImageAnimation.cs b/src/ImageIO/CGImageAnimation.cs index a8bd2e48f96a..c9158e71847c 100644 --- a/src/ImageIO/CGImageAnimation.cs +++ b/src/ImageIO/CGImageAnimation.cs @@ -67,9 +67,6 @@ public static class CGImageAnimation { [BindingImpl (BindingImplOptions.Optimizable)] public static CGImageAnimationStatus AnimateImage (NSUrl url, CGImageAnimationOptions options, CGImageSourceAnimationHandler handler) { -#if IOS && ARCH_32 - throw new PlatformNotSupportedException ("This API is not supported on this version of iOS"); -#else if (url is null) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (url)); if (handler is null) @@ -85,7 +82,6 @@ public static CGImageAnimationStatus AnimateImage (NSUrl url, CGImageAnimationOp #endif return CGAnimateImageAtURLWithBlock (url.Handle, options.GetHandle (), &block); } -#endif } #if NET @@ -101,9 +97,6 @@ public static CGImageAnimationStatus AnimateImage (NSUrl url, CGImageAnimationOp [BindingImpl (BindingImplOptions.Optimizable)] public static CGImageAnimationStatus AnimateImage (NSData data, CGImageAnimationOptions options, CGImageSourceAnimationHandler handler) { -#if IOS && ARCH_32 - throw new PlatformNotSupportedException ("This API is not supported on this version of iOS"); -#else if (data is null) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (data)); if (handler is null) @@ -119,7 +112,6 @@ public static CGImageAnimationStatus AnimateImage (NSData data, CGImageAnimation #endif return CGAnimateImageDataWithBlock (data.Handle, options.GetHandle (), &block); } -#endif } // diff --git a/src/Makefile b/src/Makefile index 19c2027a39d3..7546f94903c5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,17 +9,6 @@ PROJECT_DIR=. include $(TOP)/src/frameworks.sources include $(TOP)/mk/rules.mk -include $(TOP)/src/touch-unit.sources - -export MD_MTOUCH_SDK_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) -export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current - -MACOS_BUILD_DIR=$(BUILD_DIR)/mac -IOS_BUILD_DIR=$(BUILD_DIR)/ios -WATCH_BUILD_DIR=$(BUILD_DIR)/watch -TVOS_BUILD_DIR=$(BUILD_DIR)/tvos -MACCATALYST_BUILD_DIR=$(BUILD_DIR)/maccatalyst - MACOS_DOTNET_BUILD_DIR=$(DOTNET_BUILD_DIR)/macos IOS_DOTNET_BUILD_DIR=$(DOTNET_BUILD_DIR)/ios TVOS_DOTNET_BUILD_DIR=$(DOTNET_BUILD_DIR)/tvos @@ -29,23 +18,6 @@ GENERATOR_FLAGS=-process-enums -core -nologo -nostdlib -noconfig -native-excepti GENERATOR_TF_VERSION=$(subst net,,$(DOTNET_TFM)) -# This is a workaround to create assemblies with a higher version than the -# stable versions we released for Xcode 13.3. The stable versions we released -# for Xcode 13.3 has a ..300 version number, but that -# version scheme has been changed, where the third digit from now on will -# always be 0 in the assembly version. However, this means that until Apple -# releases new OS versions (and we bind those versions), the assembly version -# will be lower than the stable version wherever we've implemented the new -# versioning scheme. This complicates testing, so just bump the third digit to -# 600 until we're using a new Xcode (and thus presumably new OS versions as -# well). This workaround can be removed at that point, but implement it so -# that it will just be skipped/ignored if it isn't removed. -ifeq ($(XCODE_VERSION),13.3) -NUGET_VERSION_THIRD_DIGIT_WORKAROUND=600 -else -NUGET_VERSION_THIRD_DIGIT_WORKAROUND=0 -endif - DOTNET_REFERENCES = \ /r:$(DOTNET_BCL_DIR)/System.Buffers.dll \ /r:$(DOTNET_BCL_DIR)/System.Collections.Concurrent.dll \ @@ -84,7 +56,7 @@ DOTNET_REFERENCES = \ /r:$(DOTNET_BCL_DIR)/System.Xml.ReaderWriter.dll \ DOTNET_OR_GREATER_DEFINES:=$(foreach version,$(shell seq 6 $(firstword $(subst ., ,$(subst net,,$(DOTNET_TFM))))),/define:NET$(version)_0_OR_GREATER) -DOTNET_FLAGS=/warnaserror+ /noconfig /nostdlib+ /deterministic /features:strict /nologo /target:library /debug /unsafe /define:NET /define:NET_TODO /define:XAMCORE_3_0 $(DOTNET_OR_GREATER_DEFINES) $(DOTNET_REFERENCES) +DOTNET_FLAGS=/warnaserror+ /noconfig /nostdlib+ /deterministic /features:strict /nologo /target:library /debug /unsafe /define:NET /define:NET_TODO $(DOTNET_OR_GREATER_DEFINES) $(DOTNET_REFERENCES) ifeq ($(XCODE_IS_STABLE),true) DOTNET_FLAGS+=/define:XCODE_IS_STABLE @@ -104,7 +76,6 @@ DOTNET_BINDING_ATTRIBUTES=$(DOTNET_BUILD_DIR)/Xamarin.Apple.BindingAttributes.dl NULLABILITY_WARNINGS=nullable GENERATOR_WARNASERROR=-warnaserror: IOS_GENERATOR_WARNASERROR=$(GENERATOR_WARNASERROR) -WATCH_GENERATOR_WARNASERROR=$(GENERATOR_WARNASERROR) TVOS_GENERATOR_WARNASERROR=$(GENERATOR_WARNASERROR) MACOS_GENERATOR_WARNASERROR=$(GENERATOR_WARNASERROR) MACCATALYST_GENERATOR_WARNASERROR=$(GENERATOR_WARNASERROR) @@ -131,88 +102,59 @@ 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 ./opentk.mk - +include ./Makefile.rgenerator include ./generator-diff.mk -COMMON_TARGET_DIRS = \ - $(BUILD_DIR) \ - $(BUILD_DIR)/common \ - $(BUILD_DIR)/common/NativeTypes \ - -ARGS_32 = -define:ARCH_32 -ARGS_64 = -define:ARCH_64 - -SHARED_SYSTEM_DRAWING_SOURCES = System.Drawing/PointSizeRectangleTypeForwarders.cs SHARED_RESX = $(TOP)/tools/mtouch/Errors.resx -SHARED_DESIGNER_CS = $(BUILD_DIR)/common/Errors.Designer.cs +SHARED_DESIGNER_CS = $(DOTNET_BUILD_DIR)/common/Errors.Designer.cs -$(SHARED_DESIGNER_CS): $(SHARED_RESX) - $(Q_GEN) ./generate-errors.csharp > $(SHARED_DESIGNER_CS) +include $(TOP)/scripts/generate-errors/fragment.mk +$(SHARED_DESIGNER_CS): $(SHARED_RESX) $(GENERATE_ERRORS) | $(DOTNET_BUILD_DIR)/common + $(Q_GEN) $(GENERATE_ERRORS_EXEC) $(SHARED_RESX) $(SHARED_DESIGNER_CS) + +DOTNET_TARGETS_DIRS += $(DOTNET_BUILD_DIR)/common # -# Xamarin.iOS +# iOS # # Add new bindings + source files in frameworks.sources, not here. IOS_DOTNET_EXTRA_SOURCES = \ - $(IOS_BUILD_DIR)/Constants.cs \ - $(DOTNET_BUILD_DIR)/Constants.ios.generated.cs \ - $(IOS_BUILD_DIR)/AssemblyInfo.cs \ - $(SHARED_DESIGNER_CS) \ - -IOS_EXTRA_SOURCES = \ - $(IOS_OPENTK_1_0_CORE_SOURCES) \ - $(IOS_BUILD_DIR)/Constants.cs \ - $(BUILD_DIR)/Constants.ios.generated.cs \ - $(IOS_BUILD_DIR)/AssemblyInfo.cs \ + $(IOS_DOTNET_BUILD_DIR)/Constants.cs \ + $(IOS_DOTNET_BUILD_DIR)/Constants.generated.cs \ + $(IOS_DOTNET_BUILD_DIR)/AssemblyInfo.cs \ $(SHARED_DESIGNER_CS) \ - $(SHARED_SYSTEM_DRAWING_SOURCES) \ IOS_DOTNET_HTTP_SOURCES = \ Foundation/NSUrlSessionHandler.cs \ System.Net.Http/CFContentStream.cs \ System.Net.Http/CFNetworkHandler.cs \ -IOS_HTTP_SOURCES = \ - Foundation/NSUrlSessionHandler.cs \ - System.Net.Http/CFContentStream.cs \ - System.Net.Http/CFNetworkHandler.cs \ - IOS_DOTNET_CORE_SOURCES += $(IOS_DOTNET_EXTRA_SOURCES) -IOS_CORE_SOURCES += $(IOS_EXTRA_SOURCES) IOS_DOTNET_SOURCES += $(IOS_DOTNET_EXTRA_SOURCES) $(IOS_DOTNET_HTTP_SOURCES) -IOS_SOURCES += $(IOS_EXTRA_SOURCES) $(IOS_HTTP_SOURCES) IOS_GENERATOR_FLAGS = -inline-selectors -d:IOS -process-enums $(IOS_GENERATOR_WARNASERROR) IOS_DEFINES = -define:IPHONE -define:IOS -define:MONOTOUCH -d:__IOS__ -d:SYSTEM_NET_HTTP -IOS_GENERATOR=$(BUILD_DIR)/common/bgen.exe -IOS_GENERATE=$(SYSTEM_MONO) --debug $(IOS_GENERATOR) IOS_CORE_DEFINES=-define:COREBUILD $(IOS_DEFINES) -$(IOS_BUILD_DIR)/Constants.cs: Constants.iOS.cs.in Makefile $(TOP)/Make.config.inc | $(IOS_BUILD_DIR) +$(IOS_DOTNET_BUILD_DIR)/Constants.cs: Constants.iOS.cs.in Makefile $(TOP)/Make.config.inc | $(IOS_DOTNET_BUILD_DIR) $(call Q_PROF_GEN,ios) sed \ - -e "s/@VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ + -e "s/@VERSION@/$(IOS_NUGET_VERSION_MAJOR).$(IOS_NUGET_VERSION_MINOR).$(IOS_NUGET_VERSION_PATCH)/g" \ -e 's/@REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(shell git log -1 --pretty=%h))/g' \ -e "s/@IOS_SDK_VERSION@/$(IOS_SDK_VERSION)/g" \ $< > $@ -$(IOS_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in | $(IOS_BUILD_DIR) +$(IOS_DOTNET_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in | $(IOS_DOTNET_BUILD_DIR) $(call Q_PROF_GEN,ios) sed \ -e 's|@PRODUCT_NAME@|$(IOS_PRODUCT)|g' \ -e 's|@PACKAGE_HEAD_REV@|$(PACKAGE_HEAD_REV)|g' \ -e 's|@PACKAGE_HEAD_BRANCH@|$(CURRENT_BRANCH_SED_ESCAPED)|g' \ - -e 's|@PACKAGE_VERSION_MAJOR@|$(IOS_PACKAGE_VERSION_MAJOR)|g' \ - -e 's|@PACKAGE_VERSION_MINOR@|$(IOS_PACKAGE_VERSION_MINOR)|g' \ - -e 's|@PACKAGE_VERSION_REV@|$(IOS_PACKAGE_VERSION_REV)|g' \ - -e 's|@PACKAGE_VERSION_BUILD@|$(IOS_PACKAGE_VERSION_BUILD)|g' \ -e 's|@NUGET_VERSION_NO_METADATA@|$(IOS_NUGET_VERSION_NO_METADATA)|g' \ -e 's|@NUGET_VERSION_MAJOR@|$(IOS_NUGET_VERSION_MAJOR)|g' \ -e 's|@NUGET_VERSION_MINOR@|$(IOS_NUGET_VERSION_MINOR)|g' \ - -e 's|@NUGET_VERSION_THIRD_DIGIT_WORKAROUND@|$(NUGET_VERSION_THIRD_DIGIT_WORKAROUND)|g' \ -e 's|@NUGET_VERSION_REV@|$(IOS_NUGET_VERSION_PATCH)|g' \ -e 's|@NUGET_VERSION_BUILD@|$(IOS_NUGET_COMMIT_DISTANCE)|g' \ -e 's|@DOTNET_PLATFORM@|iOS|g' \ @@ -222,250 +164,31 @@ $(IOS_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in | $(IOS_BUILD_DI $(Q) rm -f $@.tmp $(Q) touch $@ -# core.dll -$(IOS_BUILD_DIR)/native/core.dll: $(IOS_CORE_SOURCES) frameworks.sources $(RSP_DIR)/ios-defines.rsp - $(Q) mkdir -p $(IOS_BUILD_DIR)native - $(call Q_PROF_CSC,ios) $(IOS_CSC) -nologo -out:$@ -target:library -debug -unsafe \ - $(CORE_WARNINGS_TO_FIX) \ - @$(RSP_DIR)/ios-defines.rsp \ - $(IOS_CORE_DEFINES) \ - $(IOS_CORE_SOURCES) - -# generated_sources -$(IOS_BUILD_DIR)/native/generated_sources: $(IOS_GENERATOR) $(IOS_APIS) $(IOS_BUILD_DIR)/native/core.dll $(IOS_BUILD_DIR)/native/Xamarin.iOS.BindingAttributes.dll $(BUILD_DIR)/ios.rsp - $(call Q_PROF_GEN,ios) $(IOS_GENERATE) @$(BUILD_DIR)/ios.rsp - -$(BUILD_DIR)/ios.rsp: Makefile Makefile.generator frameworks.sources - $(Q_GEN) echo \ - $(IOS_GENERATOR_FLAGS) \ - -core \ - -sourceonly=$(IOS_BUILD_DIR)/native/generated_sources \ - -compiler=$(IOS_CSC) \ - -nologo -nostdlib -noconfig \ - -tmpdir=$(IOS_BUILD_DIR)/native \ - -baselib=$(IOS_BUILD_DIR)/native/core.dll \ - -attributelib=$(IOS_BUILD_DIR)/native/Xamarin.iOS.BindingAttributes.dll \ - -native-exception-marshalling \ - --ns=ObjCRuntime \ - --target-framework=Xamarin.iOS,v1.0 \ - $(IOS_APIS) \ - @$(RSP_DIR)/ios-defines.rsp \ - > $@ - -define IOS_TARGETS_template -# Xamarin.iOS.dll -$(IOS_BUILD_DIR)/native-$(1)%Xamarin.iOS.dll $(IOS_BUILD_DIR)/native-$(1)%Xamarin.iOS.pdb $(4): $$(IOS_SOURCES) $(IOS_BUILD_DIR)/native/generated_sources $(PRODUCT_KEY_PATH) | $(IOS_BUILD_DIR)/reference - @mkdir -p $(IOS_BUILD_DIR)/native-$(1) - $$(call Q_PROF_CSC,ios/$(1) bit) $$(IOS_CSC) -nologo -out:$(IOS_BUILD_DIR)/native-$(1)/Xamarin.iOS.dll -target:library -debug -unsafe -optimize \ - -deterministic \ - $$(ARGS_$(1)) \ - -publicsign -keyfile:$(PRODUCT_KEY_PATH) $$(IOS_DEFINES) \ - $(5) \ - $(WARNINGS_TO_FIX) \ - -warnaserror:$(NULLABILITY_WARNINGS) \ - $$(IOS_CSC_FLAGS_XI) \ - @$(RSP_DIR)/ios-defines.rsp \ - $$(IOS_SOURCES) @$(IOS_BUILD_DIR)/native/generated_sources -endef - -$(IOS_BUILD_DIR)/compat/%: $(MACIOS_BINARIES_PATH)/% | $(IOS_BUILD_DIR)/compat - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/%: $(IOS_BUILD_DIR)/compat/% - $(Q) $(CP) $< $@ - -$(eval $(call IOS_TARGETS_template,32)) -$(eval $(call IOS_TARGETS_template,64,,,$(IOS_BUILD_DIR)/reference%Xamarin.iOS.dll,-refout:$(IOS_BUILD_DIR)/reference/Xamarin.iOS.dll)) - -# MonoTouch.Dialog-1 -$(IOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll: $(MACIOS_BINARIES_PATH)/MonoTouch.Dialog-Unified/ios/MonoTouch.Dialog-1.dll | $(IOS_BUILD_DIR)/reference - $(Q) $(CP) $< $@ - -$(IOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.pdb: $(MACIOS_BINARIES_PATH)/MonoTouch.Dialog-Unified/ios/MonoTouch.Dialog-1.pdb | $(IOS_BUILD_DIR)/reference - $(Q) $(CP) $< $@ - -# MonoTouch.NUnitLite -$(IOS_BUILD_DIR)/reference%MonoTouch.NUnitLite.dll $(IOS_BUILD_DIR)/reference%MonoTouch.NUnitLite.pdb: $(IOS_TOUCHUNIT_SOURCES) $(IOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll $(PRODUCT_KEY_PATH) $(IOS_BUILD_DIR)/reference/Xamarin.iOS.dll - $(call Q_PROF_CSC,ios) $(IOS_CSC) -nologo -out:$(basename $@).dll -target:library -debug:portable -optimize -publicsign \ - -deterministic \ - -keyfile:$(PRODUCT_KEY_PATH) -r:$(IOS_BUILD_DIR)/reference/Xamarin.iOS.dll -define:MONO -r:$(IOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll -r:$(MONOTOUCH_MONO_PATH)/System.dll -r:$(MONOTOUCH_MONO_PATH)/System.Xml.dll \ - -r:$(MONOTOUCH_MONO_PATH)/System.Core.dll \ - -nowarn:3006,612,649,414,1635,659 \ - -define:NUNITLITE,CLR_4_0,NET_4_5,__MOBILE__,MONO $(IOS_DEFINES) \ - -define:XAMCORE_2_0,__UNIFIED__ \ - $(IOS_TOUCHUNIT_SOURCES) - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/% : $(MACIOS_BINARIES_PATH)/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/Facades/% : $(MACIOS_BINARIES_PATH)/Facades/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/Facades - $(Q) $(CP) $< $@ - -$(IOS_BUILD_DIR)/compat/%: $(MACIOS_BINARIES_PATH)/% | $(IOS_BUILD_DIR)/compat - $(Q) $(CP) $< $@ - -clean-local:: - rm -rf build - rm -f $(IOS_TARGETS) generated_sources *.mdb *.pdb - -ifdef INCLUDE_IOS -IOS_TARGETS_DIRS += \ - $(IOS_BUILD_DIR) \ - $(IOS_BUILD_DIR)/compat \ - $(IOS_BUILD_DIR)/compat/Facades \ - $(IOS_BUILD_DIR)/reference \ - $(IOS_BUILD_DIR)/reference/Facades \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/share/doc/MonoTouch \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/iOS \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/iOS \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/Facades \ - -IOS_TARGETS += \ - $(PROJECT_DIR)/xamios.csproj \ - $(PROJECT_DIR)/MonoTouch.NUnitLite.csproj \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/monotouch.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/monotouch.dll.mdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/OpenTK.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/OpenTK.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/OpenTK-1.0.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/OpenTK-1.0.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/OpenTK-1.0.dll.config \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/MonoTouch.Dialog-1.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/MonoTouch.Dialog-1.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/MonoTouch.NUnitLite.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/MonoTouch.NUnitLite.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/Facades/System.Drawing.Primitives.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/Facades/netstandard.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/MonoTouch.Dialog-1.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/MonoTouch.Dialog-1.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/MonoTouch.NUnitLite.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/MonoTouch.NUnitLite.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/OpenTK-1.0.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/OpenTK-1.0.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/OpenTK-1.0.dll.config \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/iOS/Xamarin.iOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/iOS/Xamarin.iOS.pdb \ - -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -IOS_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/iOS/Xamarin.iOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/iOS/Xamarin.iOS.pdb \ - -endif - -endif - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/%.dll: $(IOS_BUILD_DIR)/compat/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/Facades - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/%.pdb: $(IOS_BUILD_DIR)/compat/%.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/%.mdb: $(IOS_BUILD_DIR)/compat/%.mdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1/%.config: $(IOS_BUILD_DIR)/compat/%.config | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/2.1 - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/share/doc/MonoTouch/%: api-diffs/% | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/share/doc/MonoTouch - $(Q) install -m 0644 $< $@ - -# reference assemblies, this is just for compilation with XS -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/%.dll: $(IOS_BUILD_DIR)/reference/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Facades - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/%.pdb: $(IOS_BUILD_DIR)/reference/%.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/%.config: $(IOS_BUILD_DIR)/reference/%.config | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS - $(Q) install -m 0644 $< $@ - -# the actual architecture-specific versions -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/iOS/Xamarin.iOS.dll: $(IOS_BUILD_DIR)/native-32/Xamarin.iOS.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/iOS - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/iOS/Xamarin.iOS.pdb: $(IOS_BUILD_DIR)/native-32/Xamarin.iOS.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/iOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/iOS/Xamarin.iOS.dll: $(IOS_BUILD_DIR)/native-64/Xamarin.iOS.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/iOS - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/iOS/Xamarin.iOS.pdb: $(IOS_BUILD_DIR)/native-64/Xamarin.iOS.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/iOS - $(Q) install -m 0644 $< $@ - -$(IOS_TARGETS_DIRS): - $(Q) mkdir -p $@ - -$(PROJECT_DIR)/xamios.csproj: xamios.tmpl.csproj Makefile $(wildcard $(TOP)/src/*.sources) - @sed -e 's**$(foreach file,$(IOS_SOURCES),)*' -e 's**$(foreach file,$(IOS_APIS),)*' $< | xmllint --format - > $@ - -$(PROJECT_DIR)/MonoTouch.NUnitLite.csproj: MonoTouch.NUnitLite.templ.csproj Makefile touch-unit.sources $(TOP)/Make.config $(TOP)/mk/mono.mk - $(Q) sed -e 's**$(foreach file,$(IOS_TOUCHUNIT_SOURCES),)*' $< | xmllint --format - > $@ - -PROJECT_FILES += $(PROJECT_DIR)/xamios.csproj $(PROJECT_DIR)/MonoTouch.NUnitLite.csproj - -ifdef INCLUDE_IOS -all-ios: $(IOS_TARGETS) -install-ios: $(IOS_TARGETS) -endif - -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_IOS -INSTALL_TARGETS+=install-ios -ALL_TARGETS+=all-ios -endif -endif - # -# Xamarin.Mac +# macOS # MAC_COMMON_DEFINES = -define:MONOMAC -d:__MACOS__ -MAC_full_ARGS = -define:NO_SYSTEM_DRAWING -define:XAMMAC_SYSTEM_MONO -MAC_mobile_ARGS = MACOS_GENERATOR_FLAGS = -d:MONOMAC -d:__MACOS__ MACOS_CORE_DEFINES = $(MAC_COMMON_DEFINES),COREBUILD MACOS_DEFINES = $(MAC_COMMON_DEFINES) -D:XAMARIN_MODERN -$(MACOS_BUILD_DIR)/$(1)/$(3).pdb: $(MACOS_BUILD_DIR)/$(1)/$(3).dll - SN_KEY = $(PRODUCT_KEY_PATH) MAC_DOTNET_EXTRA_CORE_SOURCES += \ - $(MACOS_BUILD_DIR)/Constants.cs \ - $(DOTNET_BUILD_DIR)/Constants.macos.generated.cs \ - -MAC_EXTRA_CORE_SOURCES += \ - $(MACOS_BUILD_DIR)/Constants.cs \ - $(BUILD_DIR)/Constants.macos.generated.cs \ + $(MACOS_DOTNET_BUILD_DIR)/Constants.cs \ + $(MACOS_DOTNET_BUILD_DIR)/Constants.generated.cs \ # Add new bindings + source files in frameworks.sources, not here. MACOS_DOTNET_CORE_SOURCES += \ $(MAC_DOTNET_EXTRA_CORE_SOURCES) \ -MACOS_CORE_SOURCES += \ - $(MAC_EXTRA_CORE_SOURCES) \ - MACOS_DOTNET_SOURCES += \ $(MAC_DOTNET_EXTRA_CORE_SOURCES) \ - $(MACOS_BUILD_DIR)/AssemblyInfo.cs \ + $(MACOS_DOTNET_BUILD_DIR)/AssemblyInfo.cs \ $(SHARED_DESIGNER_CS) \ -MACOS_SOURCES += \ - $(MAC_EXTRA_CORE_SOURCES) \ - $(MACOS_BUILD_DIR)/AssemblyInfo.cs \ - $(SHARED_DESIGNER_CS) \ - -# CFNetwork is shipped: -# * In a separate library (XamMac.CFNetwork.dll) for Classic. -# * Inside the other platform assemblies (Xamarin.Mac.dll) for all the other profiles. -# This means we can't use the standard framework logic for these sources. - MAC_CFNETWORK_SOURCES = \ CFNetwork/Content.cs \ CFNetwork/MessageHandler.cs \ @@ -482,32 +205,21 @@ MACOS_DOTNET_SOURCES += \ $(MAC_CFNETWORK_SOURCES) \ $(MAC_HTTP_SOURCES) \ -$(MACOS_BUILD_DIR)/Constants.cs: Constants.mac.cs.in Makefile $(TOP)/Make.config.inc | $(MACOS_BUILD_DIR) +$(MACOS_DOTNET_BUILD_DIR)/Constants.cs: Constants.mac.cs.in Makefile $(TOP)/Make.config.inc | $(MACOS_DOTNET_BUILD_DIR) $(Q) sed \ - -e "s/@VERSION@/$(MAC_PACKAGE_VERSION_MAJOR).$(MAC_PACKAGE_VERSION_MINOR).$(MAC_PACKAGE_VERSION_REV)/g" \ + -e "s/@VERSION@/$(MACOS_NUGET_VERSION_MAJOR).$(MACOS_NUGET_VERSION_MINOR).$(MACOS_NUGET_VERSION_PATCH)/g" \ -e 's/@REVISION@/$(MAC_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(shell git log -1 --pretty=%h))/g' \ -e "s/@MACOS_SDK_VERSION@/$(MACOS_SDK_VERSION)/g" \ -e "s/@MIN_XM_MONO_VERSION@/$(MIN_XM_MONO_VERSION)/g" \ $< > $@ -$(PROJECT_DIR)/xammac.csproj: xammac.tmpl.csproj Makefile $(wildcard $(TOP)/src/*.sources) - @sed -e 's**$(foreach file,$(MACOS_SOURCES) $(SHARED_SYSTEM_DRAWING_SOURCES),)*' -e 's**$(foreach file,$(MACOS_APIS),)*' $< | xmllint --format - > $@ - -PROJECT_FILES += $(PROJECT_DIR)/xammac.csproj - -$(MACOS_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in | $(MACOS_BUILD_DIR) +$(MACOS_DOTNET_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in | $(MACOS_DOTNET_BUILD_DIR) $(call Q_PROF_GEN,mac) sed \ -e 's|@PRODUCT_NAME@|$(MAC_PRODUCT)|g' \ -e 's|@PACKAGE_HEAD_REV@|$(PACKAGE_HEAD_REV)|g' \ - -e 's|@PACKAGE_HEAD_BRANCH@|$(CURRENT_BRANCH_SED_ESCAPED)|g' \ - -e 's|@PACKAGE_VERSION_MAJOR@|$(MAC_PACKAGE_VERSION_MAJOR)|g' \ - -e 's|@PACKAGE_VERSION_MINOR@|$(MAC_PACKAGE_VERSION_MINOR)|g' \ - -e 's|@PACKAGE_VERSION_REV@|$(MAC_PACKAGE_VERSION_REV)|g' \ - -e 's|@PACKAGE_VERSION_BUILD@|$(MAC_PACKAGE_VERSION_BUILD)|g' \ -e 's|@NUGET_VERSION_NO_METADATA@|$(MACOS_NUGET_VERSION_NO_METADATA)|g' \ -e 's|@NUGET_VERSION_MAJOR@|$(MACOS_NUGET_VERSION_MAJOR)|g' \ -e 's|@NUGET_VERSION_MINOR@|$(MACOS_NUGET_VERSION_MINOR)|g' \ - -e 's|@NUGET_VERSION_THIRD_DIGIT_WORKAROUND@|$(NUGET_VERSION_THIRD_DIGIT_WORKAROUND)|g' \ -e 's|@NUGET_VERSION_REV@|$(MACOS_NUGET_VERSION_PATCH)|g' \ -e 's|@NUGET_VERSION_BUILD@|$(MACOS_NUGET_COMMIT_DISTANCE)|g' \ -e 's|@DOTNET_PLATFORM@|macOS|g' \ @@ -517,394 +229,23 @@ $(MACOS_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in | $(MACOS_BUIL $(Q) rm -f $@.tmp $(Q) touch $@ -# We can't pass the --target-framework values as parameters to the templates, because the commas interfere with Make's parameter parsing. -xm_full_profile=--target-framework=Xamarin.Mac,Version=v4.5,Profile=Full -xm_mobile_profile=--target-framework=Xamarin.Mac,Version=v2.0,Profile=Mobile - -MAC_GENERATOR=$(BUILD_DIR)/common/bgen.exe -MAC_GENERATE=$(SYSTEM_MONO) --debug $(MAC_GENERATOR) - -define MAC_GENERATOR_template -$(MACOS_BUILD_DIR)/$(1)/core.dll: $(MACOS_CORE_SOURCES) frameworks.sources $(RSP_DIR)/macos-defines.rsp - @mkdir -p $(MACOS_BUILD_DIR)/$(1) - $$(call Q_PROF_CSC,mac/$(1)) \ - $$(MAC_$(1)_CSC) -nologo -out:$$@ -target:library -debug -unsafe $(CORE_WARNINGS_TO_FIX) \ - @$(RSP_DIR)/macos-defines.rsp \ - $$(MACOS_CORE_DEFINES) \ - $(2) \ - $$(MACOS_CORE_SOURCES) - -$(MACOS_BUILD_DIR)/$(1)/generated-sources: $$(MAC_GENERATOR) $(MACOS_APIS) $(MACOS_BUILD_DIR)/$(1)/core.dll $(MACOS_BUILD_DIR)/Xamarin.Mac-$(1).BindingAttributes.dll $(BUILD_DIR)/mac-$(1).rsp - $$(call Q_PROF_GEN,mac/$(1)) $$(MAC_GENERATE) @$(BUILD_DIR)/mac-$(1).rsp - -$(BUILD_DIR)/mac-$(1).rsp: Makefile Makefile.generator frameworks.sources - $$(Q_GEN) echo \ - $(MACOS_GENERATOR_FLAGS) \ - -compiler:$$(MAC_$(1)_CSC) \ - -nologo \ - -process-enums \ - $(MACOS_GENERATOR_WARNASERROR) \ - -native-exception-marshalling \ - -core \ - -sourceonly:$(MACOS_BUILD_DIR)/$(1)/generated-sources \ - -tmpdir:$(MACOS_BUILD_DIR)/$(1) \ - -baselib:$(MACOS_BUILD_DIR)/$(1)/core.dll \ - -attributelib:$(MACOS_BUILD_DIR)/Xamarin.Mac-$(1).BindingAttributes.dll \ - -d:NO_SYSTEM_DRAWING \ - --ns=ObjCRuntime \ - $(2) \ - $(xm_$(1)_profile) \ - $(MACOS_APIS) \ - @$(RSP_DIR)/macos-defines.rsp \ - > $$@ -endef - -$(eval $(call MAC_GENERATOR_template,full,-d:NO_SYSTEM_DRAWING)) -$(eval $(call MAC_GENERATOR_template,mobile,$(SHARED_SYSTEM_DRAWING_SOURCES))) - -define MACOS_TARGETS_template -$(MACOS_BUILD_DIR)/$(1)-64/Xamarin.Mac%dll $(MACOS_BUILD_DIR)/$(1)-64/Xamarin.Mac%pdb: $(MACOS_BUILD_DIR)/$(1)/generated-sources $(MACOS_SOURCES) $(MAC_CFNETWORK_SOURCES) $(MAC_CLASSIC_SOURCES) $(SN_KEY) - @mkdir -p $(MACOS_BUILD_DIR)/$(1)-64 - $$(call Q_PROF_CSC,mac/$(1)-64) \ - $$(MAC_$(1)_CSC) -nologo -out:$$(basename $$@).dll -target:library -debug -unsafe \ - -deterministic \ - $$(MAC_COMMON_DEFINES) \ - $$(MAC_$(1)_ARGS) \ - $$(ARGS_64) \ - -publicsign -keyfile:$(SN_KEY) \ - $(WARNINGS_TO_FIX) \ - -warnaserror:$(NULLABILITY_WARNINGS) \ - $$(MAC_CSC_FLAGS_XM) \ - $(MAC_CFNETWORK_SOURCES) $(MAC_HTTP_SOURCES) \ - $(2) \ - $$(MACOS_SOURCES) \ - @$(RSP_DIR)/macos-defines.rsp \ - @$$< - -endef - -$(eval $(call MACOS_TARGETS_template,mobile,$(SHARED_SYSTEM_DRAWING_SOURCES))) -$(eval $(call MACOS_TARGETS_template,full,)) - -$(MACOS_BUILD_DIR)/%-reference/Xamarin.Mac.dll: $(MACOS_BUILD_DIR)/%-64/Xamarin.Mac.dll - @mkdir -p $(@D) - $(Q) $(CP) $^ $@ - -$(MACOS_BUILD_DIR)/%-reference/Xamarin.Mac.pdb: $(MACOS_BUILD_DIR)/%-64/Xamarin.Mac.pdb - @mkdir -p $(@D) - $(Q) $(CP) $^ $@ - -MAC_VARIANTS_TARGETS = \ - $(MACOS_BUILD_DIR)/mobile-64/Xamarin.Mac.dll \ - $(MACOS_BUILD_DIR)/full-64/Xamarin.Mac.dll \ - $(MACOS_BUILD_DIR)/mobile-reference/Xamarin.Mac.dll \ - $(MACOS_BUILD_DIR)/full-reference/Xamarin.Mac.dll \ - -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_MAC -INSTALL_TARGETS+=install-mac -ALL_TARGETS+=all-mac -endif -endif - -MACOS_TARGETS_DIRS += \ - $(MACOS_BUILD_DIR) \ - $(MACOS_BUILD_DIR)/mobile \ - $(MACOS_BUILD_DIR)/mobile/Facades \ - $(MACOS_BUILD_DIR)/full \ - $(MACOS_BUILD_DIR)/compat \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/net_4_5 \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig \ - -MACOS_TARGETS += \ - $(PROJECT_DIR)/xammac.csproj \ - $(MAC_VARIANTS_TARGETS) \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/XamMac.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile/Xamarin.Mac.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile/Xamarin.Mac.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full/Xamarin.Mac.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full/Xamarin.Mac.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile/Xamarin.Mac.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile/Xamarin.Mac.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full/Xamarin.Mac.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full/Xamarin.Mac.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Xamarin.Mac.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Xamarin.Mac.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/Xamarin.Mac.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/Xamarin.Mac.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig/xammac.pc - -# The XamMac.dll file must exist for VSfM to be able to open XM/Classic projects (so that people can use the migration wizard) -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/XamMac.dll: $(MACIOS_BINARIES_PATH)/XamMac.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono - $(Q) install -m 0755 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile/Xamarin.Mac.dll: $(MACOS_BUILD_DIR)/mobile-reference/Xamarin.Mac.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile - $(Q) install -m 0755 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile/Xamarin.Mac.pdb: $(MACOS_BUILD_DIR)/mobile-reference/Xamarin.Mac.pdb | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile/Xamarin.Mac.dll: $(MACOS_BUILD_DIR)/mobile-64/Xamarin.Mac.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile - $(Q) install -m 0755 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile/Xamarin.Mac.pdb: $(MACOS_BUILD_DIR)/mobile-64/Xamarin.Mac.pdb | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full/Xamarin.Mac.dll: $(MACOS_BUILD_DIR)/full-reference/Xamarin.Mac.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full - $(Q) install -m 0755 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full/Xamarin.Mac.pdb : $(MACOS_BUILD_DIR)/full-reference/Xamarin.Mac.pdb | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full/Xamarin.Mac.dll: $(MACOS_BUILD_DIR)/full-64/Xamarin.Mac.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full - $(Q) install -m 0755 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full/Xamarin.Mac.pdb: $(MACOS_BUILD_DIR)/full-64/Xamarin.Mac.pdb | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Xamarin.Mac.dll $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/Xamarin.Mac.pdb: | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac - $(Q) ln -sF ../../reference/mobile/$(@F) $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/Xamarin.Mac.dll $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/Xamarin.Mac.pdb: | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5 - $(Q) ln -sF ../../reference/full/$(@F) $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig/xammac.pc: $(TOP)/Make.config | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig - $(Q) sed -e "s/@PACKAGE_VERSION@/$(MAC_PACKAGE_VERSION)/g" xammac.pc.in > $@ - $(Q) chmod 0644 $@ - -$(MACOS_TARGETS_DIRS): - $(Q) mkdir -p $@ - -ifdef INCLUDE_MAC -install-mac: $(MACOS_TARGETS) -all-mac: $(MACOS_TARGETS) -endif - # -# Xamarin.WatchOS +# tvOS # -WATCH_DEFINES = -define:IPHONE -define:MONOTOUCH -d:WATCH -d:XAMCORE_3_0 -d:__WATCHOS__ -d:SYSTEM_NET_HTTP -WATCH_GENERATOR=$(BUILD_DIR)/common/bgen.exe -WATCH_GENERATE=$(SYSTEM_MONO) --debug $(WATCH_GENERATOR) -WATCH_GENERATED_DEFINES= -d:WATCH -d:XAMCORE_3_0 - -WATCHOS_CORE_DEFINES = $(WATCH_DEFINES) -define:COREBUILD - -WATCHOS_EXTRA_CORE_SOURCES = \ - $(WATCH_BUILD_DIR)/Constants.cs \ - $(BUILD_DIR)/Constants.watchos.generated.cs \ - $(WATCH_BUILD_DIR)/AssemblyInfo.cs \ - $(IOS_OPENTK_1_0_CORE_SOURCES) \ - AudioToolbox/AudioBuffers.cs \ - AudioToolbox/AudioType.cs \ - AudioToolbox/AudioFormat.cs \ - $(SHARED_SYSTEM_DRAWING_SOURCES) \ - System.Drawing/ColorKnownColorTypeForwarders.cs \ - -WATCHOS_HTTP_SOURCES = \ - Foundation/NSUrlSessionHandler.cs \ - -WATCHOS_CORE_SOURCES += \ - $(WATCHOS_EXTRA_CORE_SOURCES) \ - -WATCHOS_SOURCES += \ - $(WATCHOS_EXTRA_CORE_SOURCES) \ - $(WATCHOS_HTTP_SOURCES) \ - $(SHARED_DESIGNER_CS) \ - -$(WATCH_BUILD_DIR)/Constants.cs: $(TOP)/src/Constants.watch.cs.in Makefile $(TOP)/Make.config.inc | $(WATCH_BUILD_DIR) - $(call Q_PROF_GEN,watch) sed \ - -e "s/@VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ - -e 's/@REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(shell git log -1 --pretty=%h))/g' \ - -e "s/@WATCH_SDK_VERSION@/$(WATCH_SDK_VERSION)/g" \ - $< > $@ - -$(WATCH_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/Make.config $(GIT_DIRECTORY)/HEAD | $(WATCH_BUILD_DIR) - $(call Q_PROF_GEN,watch) sed \ - -e 's|@PRODUCT_NAME@|Xamarin.WatchOS|g' \ - -e 's|@PACKAGE_HEAD_REV@|$(PACKAGE_HEAD_REV)|g' \ - -e 's|@PACKAGE_HEAD_BRANCH@|$(CURRENT_BRANCH_SED_ESCAPED)|g' \ - -e 's|@PACKAGE_VERSION_MAJOR@|$(IOS_PACKAGE_VERSION_MAJOR)|g' \ - -e 's|@PACKAGE_VERSION_MINOR@|$(IOS_PACKAGE_VERSION_MINOR)|g' \ - -e 's|@PACKAGE_VERSION_REV@|$(IOS_PACKAGE_VERSION_REV)|g' \ - -e 's|@PACKAGE_VERSION_BUILD@|$(IOS_PACKAGE_VERSION_BUILD)|g' \ - -e 's|@XCODE_VERSION@|$(subst .,_,$(XCODE_VERSION))|g' \ - $< > $@.tmp - $(Q) diff $@ $@.tmp >/dev/null 2>&1 || mv -f $@.tmp $@ - $(Q) rm -f $@.tmp - $(Q) touch $@ - -$(WATCH_BUILD_DIR)/watch/core.dll: $(WATCHOS_CORE_SOURCES) frameworks.sources $(RSP_DIR)/watchos-defines.rsp | $(WATCH_BUILD_DIR)/watch - @mkdir -p $(WATCH_BUILD_DIR)/watch - $(call Q_PROF_CSC,watch) $(WATCH_CSC) -nologo -out:$@ -target:library -debug -unsafe \ - $(CORE_WARNINGS_TO_FIX) \ - @$(RSP_DIR)/watchos-defines.rsp \ - $(WATCHOS_CORE_DEFINES) \ - $(WATCHOS_CORE_SOURCES) - -# generated_sources -$(WATCH_BUILD_DIR)/watch/generated_sources: $(WATCH_GENERATOR) $(WATCHOS_APIS) $(WATCH_BUILD_DIR)/watch/core.dll $(WATCH_BUILD_DIR)/Xamarin.WatchOS.BindingAttributes.dll $(BUILD_DIR)/watchos.rsp - $(call Q_PROF_GEN,watch) $(WATCH_GENERATE) @$(BUILD_DIR)/watchos.rsp - -$(BUILD_DIR)/watchos.rsp: Makefile Makefile.generator frameworks.sources - $(Q_GEN) echo \ - -inline-selectors \ - -process-enums \ - $(WATCH_GENERATOR_WARNASERROR) \ - -core \ - -sourceonly=$(WATCH_BUILD_DIR)/watch/generated_sources \ - -compiler=$(WATCH_CSC) \ - -nologo -nostdlib -noconfig \ - -tmpdir=$(WATCH_BUILD_DIR)/watch \ - -baselib=$(WATCH_BUILD_DIR)/watch/core.dll \ - -attributelib=$(WATCH_BUILD_DIR)/Xamarin.WatchOS.BindingAttributes.dll \ - -native-exception-marshalling \ - $(WATCH_GENERATED_DEFINES) \ - --ns:ObjCRuntime \ - $(WATCHOS_APIS) \ - --target-framework=Xamarin.WatchOS,v1.0 \ - @$(RSP_DIR)/watchos-defines.rsp \ - > $@ - -$(WATCH_BUILD_DIR)/watch-32/Xamarin.WatchOS%dll $(WATCH_BUILD_DIR)/watch-32/Xamarin.WatchOS%pdb: $(WATCHOS_SOURCES) $(WATCH_BUILD_DIR)/watch/generated_sources $(PRODUCT_KEY_PATH) | $(WATCH_BUILD_DIR)/watch-32 - $(call Q_PROF_CSC,watch) $(WATCH_CSC) -nologo -out:$(basename $@).dll -target:library -debug -unsafe -optimize \ - -publicsign -keyfile:$(PRODUCT_KEY_PATH) $(WATCH_DEFINES) \ - -deterministic \ - $(ARGS_32) \ - $(WARNINGS_TO_FIX) \ - @$(RSP_DIR)/watchos-defines.rsp \ - $(WATCHOS_SOURCES) @$(WATCH_BUILD_DIR)/watch/generated_sources - -$(WATCH_BUILD_DIR)/watch-64/Xamarin.WatchOS%dll $(WATCH_BUILD_DIR)/watch-64/Xamarin.WatchOS%pdb $(WATCH_BUILD_DIR)/reference/Xamarin.WatchOS%dll: $(WATCHOS_SOURCES) $(WATCH_BUILD_DIR)/watch/generated_sources $(PRODUCT_KEY_PATH) | $(WATCH_BUILD_DIR)/watch-64 $(WATCH_BUILD_DIR)/reference - $(call Q_PROF_CSC,watch) $(WATCH_CSC) -nologo -out:$(WATCH_BUILD_DIR)/watch-64/Xamarin.WatchOS.dll -target:library -debug -unsafe -optimize \ - -publicsign -keyfile:$(PRODUCT_KEY_PATH) $(WATCH_DEFINES) \ - -deterministic \ - $(ARGS_64) \ - $(WARNINGS_TO_FIX) \ - @$(RSP_DIR)/watchos-defines.rsp \ - -refout:$(WATCH_BUILD_DIR)/reference/Xamarin.WatchOS.dll \ - $(WATCHOS_SOURCES) @$(WATCH_BUILD_DIR)/watch/generated_sources - -# MonoTouch.NUnitLite -$(WATCH_BUILD_DIR)/reference/MonoTouch.NUnitLite%dll $(WATCH_BUILD_DIR)/reference/MonoTouch.NUnitLite%pdb: $(WATCHOS_TOUCHUNIT_SOURCES) $(PRODUCT_KEY_PATH) $(WATCH_BUILD_DIR)/reference/Xamarin.WatchOS.dll - $(call Q_PROF_CSC,watch) $(SYSTEM_CSC) -features:strict -nologo -out:$(basename $@).dll -target:library -debug:portable -optimize -publicsign -noconfig -nostdlib \ - -keyfile:$(PRODUCT_KEY_PATH) -r:$(WATCH_BUILD_DIR)/reference/Xamarin.WatchOS.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/mscorlib.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.dll -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Xml.dll \ - -r:$(MONOTOUCH_WATCH_MONO_PATH)/System.Core.dll \ - -nowarn:3006,612,649,414,1635,659 \ - -define:NUNITLITE,CLR_4_0,NET_4_5,__MOBILE__,MONO $(WATCH_DEFINES) \ - -define:XAMCORE_2_0,__UNIFIED__ \ - -deterministic \ - $(WATCHOS_TOUCHUNIT_SOURCES) - -$(PROJECT_DIR)/xamwatch.csproj: xamwatch.tmpl.csproj Makefile $(wildcard $(TOP)/*.sources) - @sed -e 's**$(foreach file,$(WATCHOS_SOURCES),)*' -e 's**$(foreach file,$(WATCHOS_APIS),)*' $< | xmllint --format - > $@ - -$(PROJECT_DIR)/MonoTouch.NUnitLite.watchos.csproj: MonoTouch.NUnitLite.watchos.templ.csproj Makefile touch-unit.sources $(TOP)/Make.config $(TOP)/mk/mono.mk - $(Q) sed -e 's**$(foreach file,$(WATCHOS_TOUCHUNIT_SOURCES),)*' $< | xmllint --format - > $@ - -PROJECT_FILES += $(PROJECT_DIR)/xamwatch.csproj $(PROJECT_DIR)/MonoTouch.NUnitLite.watchos.csproj - -clean-watch: - $(Q) rm -rf $(WATCH_BUILD_DIR) - $(Q) rm -f $(WATCH_TARGETS) - -WATCH_TARGETS_DIRS += \ - $(WATCH_BUILD_DIR) \ - $(WATCH_BUILD_DIR)/watch \ - $(WATCH_BUILD_DIR)/watch-32 \ - $(WATCH_BUILD_DIR)/watch-64 \ - $(WATCH_BUILD_DIR)/reference \ - $(WATCH_BUILD_DIR)/reference/Facades \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/share/doc/Xamarin.WatchOS\ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/watchOS \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/watchOS \ - -WATCH_TARGETS += \ - $(PROJECT_DIR)/xamwatch.csproj \ - $(PROJECT_DIR)/MonoTouch.NUnitLite.watchos.csproj \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/Xamarin.WatchOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/watchOS/Xamarin.WatchOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/watchOS/Xamarin.WatchOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/watchOS/Xamarin.WatchOS.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/watchOS/Xamarin.WatchOS.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/MonoTouch.NUnitLite.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/MonoTouch.NUnitLite.pdb - -# reference assemblies, this is just for compilation with XS -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/%.dll: $(WATCH_BUILD_DIR)/reference/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/Facades - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/%.pdb: $(WATCH_BUILD_DIR)/reference/%.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS/%.config: $(WATCH_BUILD_DIR)/reference/%.config | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.WatchOS - $(Q) install -m 0644 $< $@ - -# the actual architecture-specific versions -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/watchOS/Xamarin.WatchOS.dll: $(WATCH_BUILD_DIR)/watch-32/Xamarin.WatchOS.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/watchOS - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/watchOS/Xamarin.WatchOS.dll: $(WATCH_BUILD_DIR)/watch-64/Xamarin.WatchOS.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/watchOS - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/watchOS/Xamarin.WatchOS.pdb: $(WATCH_BUILD_DIR)/watch-32/Xamarin.WatchOS.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/32bits/watchOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/watchOS/Xamarin.WatchOS.pdb: $(WATCH_BUILD_DIR)/watch-64/Xamarin.WatchOS.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/watchOS - $(Q) install -m 0644 $< $@ - -$(WATCH_TARGETS_DIRS): - $(Q) mkdir -p $@ - -all-watch: $(WATCH_TARGETS) -install-watch: $(WATCH_TARGETS) - -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_WATCH -ALL_TARGETS += all-watch -INSTALL_TARGETS += install-watch -endif -endif - -# -# Xamarin.TVOS -# - -TVOS_DEFINES = -define:IPHONE -define:MONOTOUCH -d:TVOS -d:XAMCORE_3_0 -d:__TVOS__ -d:SYSTEM_NET_HTTP -TVOS_GENERATOR=$(BUILD_DIR)/common/bgen.exe -TVOS_GENERATE=$(SYSTEM_MONO) --debug $(TVOS_GENERATOR) +TVOS_DEFINES = -define:IPHONE -define:MONOTOUCH -d:TVOS -d:__TVOS__ -d:SYSTEM_NET_HTTP TVOS_CORE_DEFINES=$(TVOS_DEFINES) -d:COREBUILD -TVOS_GENERATOR_FLAGS = -d:TVOS -d:XAMCORE_3_0 -inline-selectors +TVOS_GENERATOR_FLAGS = -d:TVOS -inline-selectors TVOS_DOTNET_EXTRA_CORE_SOURCES = \ - $(TVOS_BUILD_DIR)/Constants.cs \ - $(DOTNET_BUILD_DIR)/Constants.tvos.generated.cs \ - $(TVOS_BUILD_DIR)/AssemblyInfo.cs \ - -TVOS_EXTRA_CORE_SOURCES = \ - $(TVOS_BUILD_DIR)/Constants.cs \ - $(BUILD_DIR)/Constants.tvos.generated.cs \ - $(TVOS_BUILD_DIR)/AssemblyInfo.cs \ - $(IOS_OPENTK_1_0_CORE_SOURCES) \ - $(SHARED_SYSTEM_DRAWING_SOURCES) \ + $(TVOS_DOTNET_BUILD_DIR)/Constants.cs \ + $(TVOS_DOTNET_BUILD_DIR)/Constants.generated.cs \ + $(TVOS_DOTNET_BUILD_DIR)/AssemblyInfo.cs \ TVOS_DOTNET_CORE_SOURCES += \ $(TVOS_DOTNET_EXTRA_CORE_SOURCES) \ -TVOS_CORE_SOURCES += \ - $(TVOS_EXTRA_CORE_SOURCES) \ - TVOS_DOTNET_HTTP_SOURCES = \ Foundation/NSUrlSessionHandler.cs \ System.Net.Http/CFContentStream.cs \ @@ -921,30 +262,21 @@ TVOS_DOTNET_SOURCES += \ $(TVOS_DOTNET_EXTRA_CORE_SOURCES) \ $(TVOS_HTTP_SOURCES) \ -TVOS_SOURCES += \ - $(TVOS_EXTRA_CORE_SOURCES) \ - $(TVOS_HTTP_SOURCES) \ - -$(TVOS_BUILD_DIR)/Constants.cs: $(TOP)/src/Constants.tvos.cs.in Makefile $(TOP)/Make.config.inc | $(TVOS_BUILD_DIR) +$(TVOS_DOTNET_BUILD_DIR)/Constants.cs: $(TOP)/src/Constants.tvos.cs.in Makefile $(TOP)/Make.config.inc | $(TVOS_DOTNET_BUILD_DIR) $(call Q_PROF_GEN,tvos) sed \ - -e "s/@VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ + -e "s/@VERSION@/$(TVOS_NUGET_VERSION_MAJOR).$(TVOS_NUGET_VERSION_MINOR).$(TVOS_NUGET_VERSION_PATCH)/g" \ -e 's/@REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(shell git log -1 --pretty=%h))/g' \ -e "s/@TVOS_SDK_VERSION@/$(TVOS_SDK_VERSION)/g" \ $< > $@ -$(TVOS_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/Make.config $(GIT_DIRECTORY)/HEAD | $(TVOS_BUILD_DIR) +$(TVOS_DOTNET_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/Make.config $(GIT_DIRECTORY)/HEAD | $(TVOS_DOTNET_BUILD_DIR) $(call Q_PROF_GEN,tvos) sed \ -e 's|@PRODUCT_NAME@|Xamarin.TVOS|g' \ -e 's|@PACKAGE_HEAD_REV@|$(PACKAGE_HEAD_REV)|g' \ -e 's|@PACKAGE_HEAD_BRANCH@|$(CURRENT_BRANCH_SED_ESCAPED)|g' \ - -e 's|@PACKAGE_VERSION_MAJOR@|$(IOS_PACKAGE_VERSION_MAJOR)|g' \ - -e 's|@PACKAGE_VERSION_MINOR@|$(IOS_PACKAGE_VERSION_MINOR)|g' \ - -e 's|@PACKAGE_VERSION_REV@|$(IOS_PACKAGE_VERSION_REV)|g' \ - -e 's|@PACKAGE_VERSION_BUILD@|$(IOS_PACKAGE_VERSION_BUILD)|g' \ -e 's|@NUGET_VERSION_NO_METADATA@|$(TVOS_NUGET_VERSION_NO_METADATA)|g' \ -e 's|@NUGET_VERSION_MAJOR@|$(TVOS_NUGET_VERSION_MAJOR)|g' \ -e 's|@NUGET_VERSION_MINOR@|$(TVOS_NUGET_VERSION_MINOR)|g' \ - -e 's|@NUGET_VERSION_THIRD_DIGIT_WORKAROUND@|$(NUGET_VERSION_THIRD_DIGIT_WORKAROUND)|g' \ -e 's|@NUGET_VERSION_REV@|$(TVOS_NUGET_VERSION_PATCH)|g' \ -e 's|@NUGET_VERSION_BUILD@|$(TVOS_NUGET_COMMIT_DISTANCE)|g' \ -e 's|@DOTNET_PLATFORM@|tvOS|g' \ @@ -954,120 +286,20 @@ $(TVOS_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/Make.con $(Q) rm -f $@.tmp $(Q) touch $@ -$(TVOS_BUILD_DIR)/tvos/core.dll: $(TVOS_CORE_SOURCES) frameworks.sources Makefile $(RSP_DIR)/tvos-defines.rsp | $(TVOS_BUILD_DIR)/tvos - @mkdir -p $(TVOS_BUILD_DIR)/tvos - $(call Q_PROF_CSC,tvos) $(TV_CSC) -nologo -out:$@ -target:library -debug -unsafe \ - $(CORE_WARNINGS_TO_FIX) \ - @$(RSP_DIR)/tvos-defines.rsp \ - $(TVOS_CORE_DEFINES) \ - $(TVOS_CORE_SOURCES) - -# generated_sources -$(TVOS_BUILD_DIR)/tvos/generated_sources: $(TVOS_GENERATOR) $(TVOS_APIS) $(TVOS_BUILD_DIR)/tvos/core.dll $(TVOS_BUILD_DIR)/Xamarin.TVOS.BindingAttributes.dll $(BUILD_DIR)/tvos.rsp - $(call Q_PROF_GEN,tvos) $(TVOS_GENERATE) @$(BUILD_DIR)/tvos.rsp - -$(BUILD_DIR)/tvos.rsp: Makefile Makefile.generator frameworks.sources - $(Q_GEN) echo \ - -inline-selectors \ - -process-enums \ - $(TVOS_GENERATOR_WARNASERROR) \ - -core \ - -sourceonly=$(TVOS_BUILD_DIR)/tvos/generated_sources \ - -compiler=$(TV_CSC) \ - -nologo -nostdlib -noconfig \ - -tmpdir=$(TVOS_BUILD_DIR)/tvos \ - -baselib=$(TVOS_BUILD_DIR)/tvos/core.dll \ - -attributelib=$(TVOS_BUILD_DIR)/Xamarin.TVOS.BindingAttributes.dll \ - $(TVOS_GENERATOR_FLAGS) \ - -native-exception-marshalling \ - --ns:ObjCRuntime \ - $(TVOS_APIS) \ - --target-framework=Xamarin.TVOS,v1.0 \ - @$(RSP_DIR)/tvos-defines.rsp \ - > $@ - -$(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS%dll $(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS%pdb $(TVOS_BUILD_DIR)/reference/Xamarin.TVOS%dll: $(TVOS_SOURCES) $(TVOS_BUILD_DIR)/tvos/generated_sources $(PRODUCT_KEY_PATH) | $(TVOS_BUILD_DIR)/tvos-64 $(TVOS_BUILD_DIR)/reference - $(call Q_PROF_CSC,tvos) $(TV_CSC) -nologo -out:$(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS.dll -target:library -debug -unsafe -optimize \ - -publicsign -keyfile:$(PRODUCT_KEY_PATH) $(TVOS_DEFINES) \ - -deterministic \ - $(ARGS_64) \ - $(WARNINGS_TO_FIX) \ - @$(RSP_DIR)/tvos-defines.rsp \ - -refout:$(TVOS_BUILD_DIR)/reference/Xamarin.TVOS.dll \ - $(TVOS_SOURCES) @$(TVOS_BUILD_DIR)/tvos/generated_sources - -# MonoTouch.NUnitLite -$(TVOS_BUILD_DIR)/reference/MonoTouch.NUnitLite%dll $(TVOS_BUILD_DIR)/reference/MonoTouch.NUnitLite%pdb: $(TVOS_TOUCHUNIT_SOURCES) $(PRODUCT_KEY_PATH) $(TVOS_BUILD_DIR)/reference/Xamarin.TVOS.dll $(TVOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll - $(call Q_PROF_CSC,tvos) $(SYSTEM_CSC) -features:strict -nologo -r:$(MONOTOUCH_TV_MONO_PATH)/mscorlib.dll -out:$(basename $@).dll -target:library -debug:portable -optimize -noconfig -nostdlib -publicsign \ - -keyfile:$(PRODUCT_KEY_PATH) -r:$(TVOS_BUILD_DIR)/reference/Xamarin.TVOS.dll -r:$(TVOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.dll -r:$(MONOTOUCH_TV_MONO_PATH)/System.Xml.dll \ - -r:$(MONOTOUCH_TV_MONO_PATH)/System.Core.dll \ - -nowarn:3006,612,649,414,1635,659 \ - -define:NUNITLITE,CLR_4_0,NET_4_5,__MOBILE__,MONO $(TVOS_DEFINES) \ - -define:XAMCORE_2_0,__UNIFIED__ \ - -deterministic \ - $(TVOS_TOUCHUNIT_SOURCES) - -# MonoTouch.Dialog-1 -$(TVOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.dll: $(MACIOS_BINARIES_PATH)/MonoTouch.Dialog-Unified/tvos/MonoTouch.Dialog-1.dll | $(TVOS_BUILD_DIR)/reference - $(Q) $(CP) $< $@ - -$(TVOS_BUILD_DIR)/reference/MonoTouch.Dialog-1.pdb: $(MACIOS_BINARIES_PATH)/MonoTouch.Dialog-Unified/tvos/MonoTouch.Dialog-1.pdb | $(TVOS_BUILD_DIR)/reference - $(Q) $(CP) $< $@ - -$(PROJECT_DIR)/xamtvos.csproj: xamtvos.tmpl.csproj Makefile $(wildcard $(TOP)/*.sources) - @sed -e 's**$(foreach file,$(TVOS_SOURCES),)*' -e 's**$(foreach file,$(TVOS_APIS),)*' $< | xmllint --format - > $@ - -$(PROJECT_DIR)/MonoTouch.NUnitLite.tvos.csproj: MonoTouch.NUnitLite.tvos.templ.csproj Makefile touch-unit.sources $(TOP)/Make.config $(TOP)/mk/mono.mk - $(Q) sed -e 's**$(foreach file,$(TVOS_TOUCHUNIT_SOURCES),)*' $< | xmllint --format - > $@ - -PROJECT_FILES += $(PROJECT_DIR)/xamtvos.csproj $(PROJECT_DIR)/MonoTouch.NUnitLite.tvos.csproj - -clean-tvos: - $(Q) rm -rf $(TVOS_BUILD_DIR) - $(Q) rm -f $(TVOS_TARGETS) - -TVOS_TARGETS_DIRS += \ - $(TVOS_BUILD_DIR) \ - $(TVOS_BUILD_DIR)/tvos \ - $(TVOS_BUILD_DIR)/tvos-64 \ - $(TVOS_BUILD_DIR)/reference \ - $(TVOS_BUILD_DIR)/reference/Facades \ - $(TVOS_BUILD_DIR)/NativeTypes \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/Facades \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/share/doc/Xamarin.TVOS \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/tvOS \ - -TVOS_TARGETS += \ - $(PROJECT_DIR)/xamtvos.csproj \ - $(PROJECT_DIR)/MonoTouch.NUnitLite.tvos.csproj \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/Xamarin.TVOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/tvOS/Xamarin.TVOS.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/tvOS/Xamarin.TVOS.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/OpenTK-1.0.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/OpenTK-1.0.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/OpenTK-1.0.dll.config \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.Dialog-1.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.Dialog-1.pdb \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.NUnitLite.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.NUnitLite.pdb - # -# Xamarin.MacCatalyst +# Mac Catalyst # # MacCatalyst is a variant of iOS, so it defines the iOS variables as well. MACCATALYST_DEFINES = -define:IPHONE -define:IOS -define:MONOTOUCH -d:__IOS__ -d:__MACCATALYST__ -d:SYSTEM_NET_HTTP -MACCATALYST_GENERATOR=$(BUILD_DIR)/common/bgen.exe -MACCATALYST_GENERATE=$(SYSTEM_MONO) --debug $(MACCATALYST_GENERATOR) MACCATALYST_CORE_DEFINES=$(MACCATALYST_DEFINES) -d:COREBUILD MACCATALYST_GENERATOR_FLAGS = -d:__MACCATALYST__ -d:IOS -inline-selectors MACCATALYST_DOTNET_EXTRA_CORE_SOURCES = \ - $(MACCATALYST_BUILD_DIR)/Constants.cs \ - $(DOTNET_BUILD_DIR)/Constants.maccatalyst.generated.cs \ - $(MACCATALYST_BUILD_DIR)/AssemblyInfo.cs \ + $(MACCATALYST_DOTNET_BUILD_DIR)/Constants.cs \ + $(MACCATALYST_DOTNET_BUILD_DIR)/Constants.generated.cs \ + $(MACCATALYST_DOTNET_BUILD_DIR)/AssemblyInfo.cs \ MACCATALYST_DOTNET_CORE_SOURCES += \ $(MACCATALYST_DOTNET_EXTRA_CORE_SOURCES) \ @@ -1078,40 +310,25 @@ MACCATALYST_DOTNET_HTTP_SOURCES = \ System.Net.Http/CFNetworkHandler.cs \ $(SHARED_DESIGNER_CS) \ -MACCATALYST_HTTP_SOURCES = \ - Foundation/NSUrlSessionHandler.cs \ - System.Net.Http/CFContentStream.cs \ - System.Net.Http/CFNetworkHandler.cs \ - $(SHARED_DESIGNER_CS) \ - MACCATALYST_DOTNET_SOURCES += \ $(MACCATALYST_DOTNET_EXTRA_CORE_SOURCES) \ $(MACCATALYST_DOTNET_HTTP_SOURCES) \ -MACCATALYST_SOURCES += \ - $(MACCATALYST_EXTRA_CORE_SOURCES) \ - $(MACCATALYST_HTTP_SOURCES) \ - -$(MACCATALYST_BUILD_DIR)/Constants.cs: $(TOP)/src/Constants.maccatalyst.cs.in Makefile $(TOP)/Make.config.inc | $(MACCATALYST_BUILD_DIR) +$(MACCATALYST_DOTNET_BUILD_DIR)/Constants.cs: $(TOP)/src/Constants.maccatalyst.cs.in Makefile $(TOP)/Make.config.inc | $(MACCATALYST_DOTNET_BUILD_DIR) $(call Q_PROF_GEN,maccatalyst) sed \ - -e "s/@VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ + -e "s/@VERSION@/$(MACCATALYST_NUGET_VERSION_MAJOR).$(MACCATALYST_NUGET_VERSION_MINOR).$(MACCATALYST_NUGET_VERSION_PATCH)/g" \ -e 's/@REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(shell git log -1 --pretty=%h))/g' \ -e "s/@MACCATALYST_SDK_VERSION@/$(MACCATALYST_SDK_VERSION)/g" \ $< > $@ -$(MACCATALYST_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/Make.config $(GIT_DIRECTORY)/HEAD | $(MACCATALYST_BUILD_DIR) +$(MACCATALYST_DOTNET_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/Make.config $(GIT_DIRECTORY)/HEAD | $(MACCATALYST_DOTNET_BUILD_DIR) $(call Q_PROF_GEN,maccatalyst) sed \ -e 's|@PRODUCT_NAME@|Xamarin.MacCatalyst|g' \ -e 's|@PACKAGE_HEAD_REV@|$(PACKAGE_HEAD_REV)|g' \ -e 's|@PACKAGE_HEAD_BRANCH@|$(CURRENT_BRANCH_SED_ESCAPED)|g' \ - -e 's|@PACKAGE_VERSION_MAJOR@|$(IOS_PACKAGE_VERSION_MAJOR)|g' \ - -e 's|@PACKAGE_VERSION_MINOR@|$(IOS_PACKAGE_VERSION_MINOR)|g' \ - -e 's|@PACKAGE_VERSION_REV@|$(IOS_PACKAGE_VERSION_REV)|g' \ - -e 's|@PACKAGE_VERSION_BUILD@|$(IOS_PACKAGE_VERSION_BUILD)|g' \ -e 's|@NUGET_VERSION_NO_METADATA@|$(MACCATALYST_NUGET_VERSION_NO_METADATA)|g' \ -e 's|@NUGET_VERSION_MAJOR@|$(MACCATALYST_NUGET_VERSION_MAJOR)|g' \ -e 's|@NUGET_VERSION_MINOR@|$(MACCATALYST_NUGET_VERSION_MINOR)|g' \ - -e 's|@NUGET_VERSION_THIRD_DIGIT_WORKAROUND@|$(NUGET_VERSION_THIRD_DIGIT_WORKAROUND)|g' \ -e 's|@NUGET_VERSION_REV@|$(MACCATALYST_NUGET_VERSION_PATCH)|g' \ -e 's|@NUGET_VERSION_BUILD@|$(MACCATALYST_NUGET_COMMIT_DISTANCE)|g' \ -e 's|@DOTNET_PLATFORM@|MacCatalyst|g' \ @@ -1121,51 +338,10 @@ $(MACCATALYST_BUILD_DIR)/AssemblyInfo.cs: $(TOP)/src/AssemblyInfo.cs.in $(TOP)/M $(Q) rm -f $@.tmp $(Q) touch $@ -$(PROJECT_DIR)/xammaccatalyst.csproj: xammaccatalyst.tmpl.csproj Makefile $(wildcard $(TOP)/*.sources) - @sed -e 's**$(foreach file,$(MACCATALYST_SOURCES),)*' -e 's**$(foreach file,$(MACCATALYST_APIS),)*' $< | xmllint --format - > $@ - -$(PROJECT_DIR)/MonoTouch.NUnitLite.maccatalyst.csproj: MonoTouch.NUnitLite.maccatalyst.templ.csproj Makefile touch-unit.sources $(TOP)/Make.config $(TOP)/mk/mono.mk - $(Q) sed -e 's**$(foreach file,$(MACCATALYST_TOUCHUNIT_SOURCES),)*' $< | xmllint --format - > $@ - -MACCATALYST_TARGETS_DIRS += \ - $(MACCATALYST_BUILD_DIR) \ - -# reference assemblies, this is just for compilation with XS -$(MACCATALYST_TARGETS_DIRS): - $(Q) mkdir -p $@ - -# reference assemblies, this is just for compilation with XS -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/%.dll: $(TVOS_BUILD_DIR)/reference/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/Facades - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/%.pdb: $(TVOS_BUILD_DIR)/reference/%.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS - $(Q) install -m 0644 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/%.config: $(TVOS_BUILD_DIR)/reference/%.config | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS - $(Q) install -m 0644 $< $@ - -# the actual architecture-specific versions -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/tvOS/Xamarin.TVOS.dll: $(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/tvOS - $(Q) install -m 0755 $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/tvOS/Xamarin.TVOS.pdb: $(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS.pdb | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/64bits/tvOS - $(Q) install -m 0644 $< $@ - -$(TVOS_TARGETS_DIRS): - $(Q) mkdir -p $@ - -all-tvos: $(TVOS_TARGETS) -install-tvos: $(TVOS_TARGETS) - -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_TVOS -ALL_TARGETS += all-tvos -INSTALL_TARGETS += install-tvos -endif -endif - ### .NET ### +include $(TOP)/scripts/generate-sourcelink-json/fragment.mk + define BuildDotNetIntermediateAssembly $($(2)_DOTNET_BUILD_DIR)/core-$(3).dll: $($(2)_DOTNET_CORE_SOURCES) frameworks.sources $(RSP_DIR)/dotnet/$(3)-defines-dotnet.rsp | $($(2)_DOTNET_BUILD_DIR) $$(Q_DOTNET_GEN) \ @@ -1182,7 +358,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) \ @@ -1214,8 +390,8 @@ dotnet-gen:: dotnet-gen-$(3) $($(2)_DOTNET_BUILD_DIR)/ILLink.LinkAttributes.xml: $(TOP)/src/ILLink.LinkAttributes.xml.in | $($(2)_DOTNET_BUILD_DIR) $$(call Q_PROF_GEN,$(3)) sed < $$< > $$@ 's|@PRODUCT_NAME@|Microsoft.$(1)|g;' -$($(2)_DOTNET_BUILD_DIR)/SourceLink.json: $($(2)_DOTNET_BUILD_DIR) - $$(Q) $(TOP)/src/generate-sourcelink-json.csharp "$(PACKAGE_HEAD_REV)" "$(abspath $(TOP)/src)" "$$@" +$($(2)_DOTNET_BUILD_DIR)/SourceLink.json: $($(2)_DOTNET_BUILD_DIR) $(GENERATE_SOURCELINK_JSON) + $$(Q) $(GENERATE_SOURCELINK_JSON_EXEC) "$(PACKAGE_HEAD_REV)" "$(abspath $(TOP)/src)" "$$@" $($(2)_DOTNET_BUILD_DIR)/embed-files.rsp: $($(2)_DOTNET_BUILD_DIR)/$(3)-generated-sources $($(2)_DOTNET_SOURCES) $(TOP)/src/generate-embed-files.sh $$(Q) $(TOP)/src/generate-embed-files.sh $($(2)_DOTNET_BUILD_DIR)/$(3)-generated-sources "$($(2)_DOTNET_SOURCES)" > $$@.tmp @@ -1277,10 +453,12 @@ $(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_COMMON) \ + /analyzer:$(ROSLYN_GENERATOR) \ -unsafe \ -optimize \ $$(ARGS_$(1)) \ @@ -1345,9 +523,6 @@ SHARED_PATH := ../runtime $(SHARED_PATH)/Delegates.generated.cs: $(SHARED_PATH)/Delegates.cs.t4 $(SHARED_PATH)/delegates.t4 $(Q) $(MAKE) -C $(SHARED_PATH) Delegates.generated.cs -$(BUILD_DIR)/common/NativeTypes/%.cs: $(TOP)/src/NativeTypes/%.tt | $(BUILD_DIR)/common/NativeTypes - $(Q_GEN) $(TT) $(abspath $<) -o $(abspath $@) 1>/dev/null - $(COMMON_TARGET_DIRS): $(Q) mkdir -p $@ @@ -1356,24 +531,14 @@ $(DOTNET_COMPILER): Makefile $(TOP)/Make.config | $(DOTNET_BUILD_DIR) $(Q) echo "exec $(DOTNET_CSC) $(DOTNET_FLAGS) \"\$$@\"" >> $@ $(Q) chmod +x $@ -GENERATE_FRAMEWORKS_CONSTANTS=generate-frameworks-constants/legacy/bin/Debug/generate-frameworks-constants.exe DOTNET_GENERATE_FRAMEWORKS_CONSTANTS=generate-frameworks-constants/dotnet/bin/Debug/$(DOTNET_TFM)/generate-frameworks-constants.dll -$(GENERATE_FRAMEWORKS_CONSTANTS): $(wildcard generate-frameworks-constants/*.cs*) $(TOP)/tools/common/Frameworks.cs Makefile - $(Q) $(SYSTEM_MSBUILD) "/bl:$@.binlog" /r generate-frameworks-constants/legacy/generate-frameworks-constants.csproj $(MSBUILD_VERBOSITY) - $(Q) touch $@ # Running MSBuild doesn't always touch the target, so make sure we do here, otherwise make can end up confused. - $(DOTNET_GENERATE_FRAMEWORKS_CONSTANTS): $(wildcard generate-frameworks-constants/*.cs*) $(TOP)/tools/common/Frameworks.cs Makefile $(Q) $(DOTNET) build "/bl:$@.binlog" /r generate-frameworks-constants/dotnet/generate-frameworks-constants.csproj $(MSBUILD_VERBOSITY) $(Q) touch $@ # Running 'dotnet build' doesn't always touch the target, so make sure we do here, otherwise make can end up confused. # This rule means: generate a Constants..generated.cs for the frameworks in the variable _FRAMEWORKS -$(BUILD_DIR)/Constants.%.generated.cs: Makefile $(GENERATE_FRAMEWORKS_CONSTANTS) | $(BUILD_DIR) - $(Q) mono --debug $(GENERATE_FRAMEWORKS_CONSTANTS) "$*" "$@.tmp" - $(Q) mv "$@.tmp" "$@" - -# This rule means: generate a Constants..generated.cs for the frameworks in the variable _FRAMEWORKS -$(DOTNET_BUILD_DIR)/Constants.%.generated.cs: Makefile $(DOTNET_GENERATE_FRAMEWORKS_CONSTANTS) | $(DOTNET_BUILD_DIR) +$(DOTNET_BUILD_DIR)/%/Constants.generated.cs: Makefile $(DOTNET_GENERATE_FRAMEWORKS_CONSTANTS) | $(DOTNET_BUILD_DIR) $(Q) $(DOTNET) $(DOTNET_GENERATE_FRAMEWORKS_CONSTANTS) "$*" "$@.tmp" $(Q) mv "$@.tmp" "$@" @@ -1383,7 +548,6 @@ all-local:: $(ALL_TARGETS) $(DOTNET_TARGETS_DIRS): $(Q) mkdir -p $@ -ifdef ENABLE_DOTNET define DotNetProjectFiles $(DOTNET_BUILD_DIR)/projects/$(1)/$(1).csproj: dotnet.tmpl.csproj Makefile $$(wildcard $(CURDIR)/*.sources) @mkdir -p $$(dir $$@) @@ -1396,12 +560,9 @@ $(DOTNET_BUILD_DIR)/projects/$(1)/$(1).csproj: dotnet.tmpl.csproj Makefile $$(wi PROJECT_FILES += $(DOTNET_BUILD_DIR)/projects/$(1)/$(1).csproj endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call DotNetProjectFiles,$(platform),$(shell echo $(platform) | tr '[:lower:]' '[:upper:]')))) -endif dotnet: $(DOTNET_TARGETS) -ifdef ENABLE_DOTNET all-local:: $(DOTNET_TARGETS) -endif project-files: $(PROJECT_FILES) @@ -1418,7 +579,6 @@ MinimumVersions.cs: MinimumVersions.cs.in Makefile $(TOP)/Make.config \ -e 's/@MIN_IOS_SDK_VERSION@/$(subst .,$(COMMA) ,$(MIN_IOS_SDK_VERSION))/g' \ -e 's/@MIN_MACOS_SDK_VERSION@/$(subst .,$(COMMA) ,$(MIN_MACOS_SDK_VERSION))/g' \ - -e 's/@MIN_WATCHOS_SDK_VERSION@/$(subst .,$(COMMA) ,$(MIN_WATCHOS_SDK_VERSION))/g' \ -e 's/@MIN_TVOS_SDK_VERSION@/$(subst .,$(COMMA) ,$(MIN_TVOS_SDK_VERSION))/g' \ -e 's/@MIN_MACCATALYST_SDK_VERSION@/$(subst .,$(COMMA) ,$(MIN_MACCATALYST_SDK_VERSION))/g' \ $< > $@ diff --git a/src/Makefile.generator b/src/Makefile.generator index 7a7eb098880a..3c144c8567a5 100644 --- a/src/Makefile.generator +++ b/src/Makefile.generator @@ -2,41 +2,21 @@ # Generator # -# copy generator.csproj to the build dir so that we can use our shared .csproj.inc target from rules.mk to create generator.csproj.inc -# we need any generated files in this directory to go into the build directory, and the shared target will output the csproj.inc into the same directory as the csproj -$(BUILD_DIR)/generator.csproj: generator.csproj | $(BUILD_DIR) - $(Q) $(CP) $< $@ - -# generator.csproj.inc contains the generator_dependencies variable used to determine if the generator needs to be rebuilt or not. -$(BUILD_DIR)/generator.csproj.inc: export BUILD_VERBOSITY=$(MSBUILD_VERBOSITY) --include $(BUILD_DIR)/generator.csproj.inc +bgen.csproj.inc: export BUILD_EXECUTABLE=$(DOTNET) build +bgen.csproj.inc: export BUILD_VERBOSITY=$(MSBUILD_VERBOSITY) -$(BUILD_DIR)/common/bgen.exe: $(generator_dependencies) Makefile.generator $(BUILD_DIR)/generator-frameworks.g.cs - $(Q_GEN) $(SYSTEM_MSBUILD) "/bl:$@.binlog" $(XBUILD_VERBOSITY) /p:Configuration=Debug generator.csproj /p:IntermediateOutputPath=$(BUILD_DIR)/IDE/obj/common/ /p:OutputPath=$(BUILD_DIR)/common /restore - -# copy generator.csproj to the build dir so that we can use our shared .csproj.inc target from rules.mk to create generator.csproj.inc -# we need any generated files in this directory to go into the build directory, and the shared target will output the csproj.inc into the same directory as the csproj -$(DOTNET_BUILD_DIR)/bgen.csproj: $(BUILD_DIR)/generator.csproj | $(BUILD_DIR) +# bgen.csproj.inc contains the generator_dependencies variable used to determine if the generator needs to be rebuilt or not. +$(DOTNET_BUILD_DIR)/bgen.csproj.inc: bgen/bgen.csproj.inc $(Q) $(CP) $< $@ -# bgen.csproj.inc contains the generator_dependencies variable used to determine if the generator needs to be rebuilt or not. -$(DOTNET_BUILD_DIR)/bgen.csproj.inc: export BUILD_VERBOSITY=$(MSBUILD_VERBOSITY) -include $(DOTNET_BUILD_DIR)/bgen.csproj.inc -$(DOTNET_BUILD_DIR)/bgen/bgen: $(bgen_dependencies) Makefile.generator $(BUILD_DIR)/generator-frameworks.g.cs | $(DOTNET_BUILD_DIR)/bgen +$(DOTNET_BUILD_DIR)/bgen/bgen: $(bgen_dependencies) Makefile.generator $(DOTNET_BUILD_DIR)/generator-frameworks.g.cs | $(DOTNET_BUILD_DIR)/bgen $(Q_DOTNET_BUILD) $(DOTNET) publish bgen/bgen.csproj $(DOTNET_BUILD_VERBOSITY) /p:Configuration=Debug /p:IntermediateOutputPath=$(abspath $(DOTNET_BUILD_DIR)/IDE/obj/common/bgen)/ /p:OutputPath=$(abspath $(DOTNET_BUILD_DIR)/IDE/bin/common/bgen/)/ $(Q) $(CP) $(DOTNET_BUILD_DIR)/IDE/bin/common/bgen/publish/* $(dir $@) $(Q) printf 'exec $(DOTNET) "$$(dirname "$$0")"/bgen.dll $$@\n' > $@ $(Q) chmod +x $@ -# Serialize the building of the legacy bgen and the .NET version, because they can both try to restore the same NuGet package at the same time, and that runs into race conditions -# This is done by adding a dependency from the legacy bgen to the .NET bgen, so the legacy bgen doesn't start building until the .NET one is done. -ifdef INCLUDE_XAMARIN_LEGACY -ifdef ENABLE_DOTNET -$(BUILD_DIR)/common/bgen.exe: $(DOTNET_BUILD_DIR)/bgen/bgen -endif -endif - define BGenTargets $(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME)/tools/lib/bgen/bgen: $(DOTNET_BUILD_DIR)/bgen/bgen | $(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME)/tools/lib/bgen $$(Q) rm -Rf "$$(dir $$@)" @@ -72,190 +52,26 @@ DOTNET_TARGETS_DIRS += \ # Common # -$(BUILD_DIR)/generator-frameworks.g.cs: frameworks.sources Makefile.generator generate-frameworks.csharp +include $(TOP)/scripts/generate-frameworks/fragment.mk +$(DOTNET_BUILD_DIR)/generator-frameworks.g.cs: frameworks.sources Makefile.generator $(GENERATE_FRAMEWORKS) @mkdir -p $(dir $@) - $(Q) ./generate-frameworks.csharp $@.tmp '$(IOS_FRAMEWORKS)' '$(MACOS_FRAMEWORKS)' '$(WATCHOS_FRAMEWORKS)' '$(TVOS_FRAMEWORKS)' '$(MACCATALYST_FRAMEWORKS)' + $(Q) $(GENERATE_FRAMEWORKS_EXEC) $@.tmp '$(IOS_FRAMEWORKS)' '$(MACOS_FRAMEWORKS)' '$(WATCHOS_FRAMEWORKS)' '$(TVOS_FRAMEWORKS)' '$(MACCATALYST_FRAMEWORKS)' $(Q) if ! diff $@ $@.tmp >/dev/null; then $(CP) $@.tmp $@; git diff "$@"; echo "The file $@ has been automatically re-generated; please commit the changes."; exit 1; fi $(Q) mv $@.tmp $@ # This rule means: generate a -defines.rsp for the frameworks in the variable _FRAMEWORKS -$(RSP_DIR)/%-defines.rsp: frameworks.sources Makefile.generator generate-defines.csharp +include $(TOP)/scripts/generate-defines/fragment.mk +$(RSP_DIR)/%-defines.rsp: frameworks.sources Makefile.generator $(GENERATE_DEFINES) @mkdir -p $(dir $@) - $(Q) ./generate-defines.csharp $@.tmp '$($(shell echo $* | tr a-z A-Z)_FRAMEWORKS)' + $(Q) $(GENERATE_DEFINES_EXEC) $@.tmp '$($(shell echo $* | tr a-z A-Z)_FRAMEWORKS)' $(Q) mv $@.tmp $@ # This rule means: generate a -defines.rsp for the frameworks in the variable _FRAMEWORKS -$(RSP_DIR)/dotnet/%-defines-dotnet.rsp: frameworks.sources Makefile.generator generate-defines.csharp +$(RSP_DIR)/dotnet/%-defines-dotnet.rsp: frameworks.sources Makefile.generator $(GENERATE_DEFINES) @mkdir -p $(dir $@) - $(Q) ./generate-defines.csharp $@.tmp '$(filter-out $(DOTNET_REMOVED_$(shell echo $* | tr a-z A-Z)_FRAMEWORKS),$($(shell echo $* | tr a-z A-Z)_FRAMEWORKS))' + $(Q) $(GENERATE_DEFINES_EXEC) $@.tmp '$(filter-out $(DOTNET_REMOVED_$(shell echo $* | tr a-z A-Z)_FRAMEWORKS),$($(shell echo $* | tr a-z A-Z)_FRAMEWORKS))' $(Q) mv $@.tmp $@ -$(DOTNET_BUILD_DIR)/Xamarin.Apple.BindingAttributes.dll: bgen/Attributes.cs Makefile.generator | $(DOTNET_BUILD_DIR) - $(Q_DOTNET_BUILD) $(SYSTEM_CSC) $(DOTNET_FLAGS) -out:$@ $< - -# -# Xamarin.iOS (btouch) -# - -IOS_TARGETS_DIRS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/btouch \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen \ - -IOS_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.iOS.BindingAttributes.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/bgen.exe \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bgen \ - -IOS_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/btouch \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/btouch-native \ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bgen: bgen/bgen | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/btouch: Makefile.generator | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin - $(Q_GEN) printf "#!/bin/sh -e\n\necho \"error BI0088: btouch: MonoTouch binding projects are not supported anymore. Please upgrade the binding project to a Xamarin.iOS (Unified) binding project.\"\nexit 1\n" > $@ - $(Q) chmod +x $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/btouch-native: btouch-native | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/%.dll: $(IOS_BUILD_DIR)/native/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen - $(Q) install -m 0755 $< $@ - $(Q) install -m 0644 $(<:.dll=.pdb) $(@:.dll=.pdb) - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/bgen.exe: $(BUILD_DIR)/common/bgen.exe | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen - $(Q) install -m 0755 $< $@ - $(Q) install -m 0644 $< $(@:.exe=.pdb) - $(Q) install -m 0755 "$(dir $<)"/*.dll "$(dir $@)" - -$(IOS_BUILD_DIR)/native/Xamarin.iOS.BindingAttributes.dll: bgen/Attributes.cs Makefile.generator - $(Q) mkdir -p $(dir $@) - $(Q_GEN) $(IOS_CSC) -features:strict -nologo -out:$@ -debug bgen/Attributes.cs -target:library -deterministic - -# -# Xamarin.Watch (bwatch) -# - -WATCH_TARGETS_DIRS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bwatch \ - -WATCH_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.WatchOS.BindingAttributes.dll \ - -WATCH_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bwatch \ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bwatch: bwatch | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/%.dll: $(WATCH_BUILD_DIR)/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen - $(Q) install -m 0755 $< $@ - $(Q) install -m 0644 $(<:.dll=.pdb) $(@:.dll=.pdb) - -$(WATCH_BUILD_DIR)/Xamarin.WatchOS.BindingAttributes.dll: bgen/Attributes.cs Makefile.generator - $(Q) mkdir -p $(dir $@) - $(Q_GEN) $(WATCH_CSC) -features:strict -nologo -debug -out:$@ -debug bgen/Attributes.cs -target:library -deterministic - -# # -# # Xamarin.TVOS (btv) -# # - -TVOS_TARGETS_DIRS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/btv \ - -TVOS_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.TVOS.BindingAttributes.dll \ - -TVOS_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/btv \ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/btv: btv | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/%.dll: $(TVOS_BUILD_DIR)/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen - $(Q) install -m 0755 $< $@ - $(Q) install -m 0644 $(<:.dll=.pdb) $(@:.dll=.pdb) - -$(TVOS_BUILD_DIR)/Xamarin.TVOS.BindingAttributes.dll: bgen/Attributes.cs Makefile.generator - $(Q) mkdir -p $(dir $@) - $(Q_GEN) $(TV_CSC) -features:strict -nologo -debug -out:$@ -debug bgen/Attributes.cs -target:library -deterministic - -# -# Xamarin.MacCatalyst -# - -MACCATALYST_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.MacCatalyst.BindingAttributes.dll \ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/%.dll: $(MACCATALYST_BUILD_DIR)/%.dll | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen - $(Q) install -m 0755 $< $@ - $(Q) install -m 0644 $(<:.dll=.pdb) $(@:.dll=.pdb) - -$(MACCATALYST_BUILD_DIR)/Xamarin.MacCatalyst.BindingAttributes.dll: bgen/Attributes.cs Makefile.generator - $(Q) mkdir -p $(dir $@) - $(Q_GEN) $(MACCATALYST_CSC) -features:strict -nologo -debug -out:$@ -debug bgen/Attributes.cs -target:library -deterministic - -# -# Xamarin.Mac (bmac) -# - -MACOS_TARGETS_DIRS += \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bmac \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen \ - -MACOS_TARGETS += \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bgen \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bgen-classic \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/bgen.exe \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-full.BindingAttributes.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-mobile.BindingAttributes.dll \ - -MACOS_TARGETS += \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bmac \ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bgen: bgen/bgen | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin - $(Q) $(CP) $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bgen-classic: Makefile.generator | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin - $(Q_GEN) printf "#!/bin/sh -e\n\necho \"error BI0087: bgen-classic: Xamarin.Mac Classic binding projects are not supported anymore. Please upgrade the binding project to a Xamarin.Mac Unified binding project.\"\nexit 1\n" > $@ - $(Q) chmod +x $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bmac: bmac.ikvm | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin - $(Q) install -m 0755 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/%.dll: $(MACOS_BUILD_DIR)/%.dll | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen - $(Q) install -m 0755 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/%.pdb: $(MACOS_BUILD_DIR)/%.pdb | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/%.mdb: $(MACOS_BUILD_DIR)/%.mdb | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen - $(Q) install -m 0644 $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/%.exe: $(BUILD_DIR)/common/bgen.exe | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen - $(Q) install -m 0755 $< $@ - $(Q) install -m 0644 $< $(@:.exe=.pdb) - $(Q) install -m 0755 "$(dir $<)"/*.dll "$(dir $@)" - -define MAC_BINDINGATTRIBUTES_template -$$(MACOS_BUILD_DIR)/Xamarin.Mac-$(1).BindingAttributes.dll: bgen/Attributes.cs Makefile.generator - $$(Q) mkdir -p $$(dir $$@) - $$(Q_GEN) $$(MAC_$(1)_CSC) -features:strict -nologo -debug -out:$$@ -debug bgen/Attributes.cs -target:library -deterministic -endef - -$(eval $(call MAC_BINDINGATTRIBUTES_template,full)) -$(eval $(call MAC_BINDINGATTRIBUTES_template,mobile)) - -install-bgen: \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/bgen \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/bgen.exe \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-full.BindingAttributes.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-mobile.BindingAttributes.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.iOS.BindingAttributes.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.TVOS.BindingAttributes.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.WatchOS.BindingAttributes.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.MacCatalyst.BindingAttributes.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/bgen.exe \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bgen \ +$(DOTNET_BUILD_DIR)/Xamarin.Apple.BindingAttributes.dll: bgen/Attributes.cs bgen/PlatformName.cs Makefile.generator | $(DOTNET_BUILD_DIR) + $(Q_DOTNET_BUILD) $(DOTNET_CSC) $(DOTNET_FLAGS) -out:$@ bgen/Attributes.cs bgen/PlatformName.cs diff --git a/src/Makefile.rgenerator b/src/Makefile.rgenerator new file mode 100644 index 000000000000..1c29cd07ba8d --- /dev/null +++ b/src/Makefile.rgenerator @@ -0,0 +1,12 @@ +# Roslyn code generator +ROSLYN_GENERATOR=$(DOTNET_BUILD_DIR)/common/rgen/Microsoft.Macios.Generator.dll +ROSLYN_GENERATOR_COMMON=$(DOTNET_BUILD_DIR)/common/rgen/Microsoft.Macios.Binding.Common.dll +ROSLYN_GENERATOR_FILES := $(wildcard rgen/Microsoft.Macios.Generator/*.cs) +ROSLYN_GENERATOR_FILES += $(wildcard rgen/Microsoft.Macios.Generator/*/*.cs) +ROSLYN_GENERATOR_FILES += $(wildcard rgen/Microsoft.Macios.Binding.Common/*.cs) +ROSLYN_GENERATOR_FILES += $(wildcard rgen/Microsoft.Macios.Binding.Common/*/*.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/MapKit/MKDirections.cs b/src/MapKit/MKDirections.cs deleted file mode 100644 index 4f09cb6d73a2..000000000000 --- a/src/MapKit/MKDirections.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -#nullable enable - -namespace MapKit { - - public partial class MKDirections { - [Obsolete ("iOS9 does not allow creating an empty instance")] - public MKDirections () - { - } - } -} - -#endif diff --git a/src/MediaPlayer/MPMediaItemArtwork.cs b/src/MediaPlayer/MPMediaItemArtwork.cs index 18f3c040f8c5..324eba891d18 100644 --- a/src/MediaPlayer/MPMediaItemArtwork.cs +++ b/src/MediaPlayer/MPMediaItemArtwork.cs @@ -19,13 +19,6 @@ namespace MediaPlayer { public partial class MPMediaItemArtwork { -#if !XAMCORE_3_0 && !NET - [Obsolete ("Use the (UIImage) constructor instead, iOS9 does not allow creating an empty instance.")] - public MPMediaItemArtwork () - { - - } -#endif } } diff --git a/src/MediaPlayer/MPPlayableContentDelegate.cs b/src/MediaPlayer/MPPlayableContentDelegate.cs deleted file mode 100644 index bc1ae414a1f1..000000000000 --- a/src/MediaPlayer/MPPlayableContentDelegate.cs +++ /dev/null @@ -1,44 +0,0 @@ -#if !XAMCORE_3_0 && !MONOMAC && !NET - -using System; -using System.Threading.Tasks; -using Foundation; -using ObjCRuntime; - -#nullable enable - -namespace MediaPlayer { - public partial class MPPlayableContentDelegate { - [Obsolete ("Use 'InitiatePlaybackOfContentItem' instead.")] - public virtual void PlayableContentManager (MPPlayableContentManager contentManager, NSIndexPath indexPath, Action completionHandler) - { - InitiatePlaybackOfContentItem (contentManager, indexPath, completionHandler); - } - - } - - public static partial class MPPlayableContentDelegate_Extensions { - [Obsolete ("Use 'InitiatePlaybackOfContentItem' instead.")] - public static void PlayableContentManager (this IMPPlayableContentDelegate This, MPPlayableContentManager contentManager, NSIndexPath indexPath, Action completionHandler) - { - This.InitiatePlaybackOfContentItem (contentManager, indexPath, completionHandler); - } - - } - - public partial class MPPlayableContentDataSource : NSObject { -#if NET - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("macos")] - [UnsupportedOSPlatform ("tvos")] -#endif - [Obsolete ("Use 'MPPlayableContentDataSource_Extensions.GetContentItemAsync' instead.")] - public unsafe virtual Task GetContentItemAsync (string identifier) - { - return MPPlayableContentDataSource_Extensions.GetContentItemAsync (this, identifier); - } - } -} - -#endif diff --git a/src/MetalPerformanceShaders/MPSDefs.cs b/src/MetalPerformanceShaders/MPSDefs.cs index 913747b86cbc..13b39da667a5 100644 --- a/src/MetalPerformanceShaders/MPSDefs.cs +++ b/src/MetalPerformanceShaders/MPSDefs.cs @@ -130,11 +130,7 @@ public struct MPSImageRegion { public struct MPSImageHistogramInfo { [FieldOffset (0)] public nuint NumberOfHistogramEntries; -#if ARCH_64 [FieldOffset (8)] -#else - [FieldOffset (4)] -#endif public bool HistogramForAlpha; [FieldOffset (16)] public Vector4 MinPixelValue; diff --git a/src/MinimumVersions.cs.in b/src/MinimumVersions.cs.in index 35b43afa3897..0d34ea143a2b 100644 --- a/src/MinimumVersions.cs.in +++ b/src/MinimumVersions.cs.in @@ -1,7 +1,6 @@ using System.Runtime.Versioning; using ObjCRuntime; -#if NET #if __IOS__ && !__MACCATALYST__ [assembly: TargetPlatform ("ios")] #elif __TVOS__ @@ -10,9 +9,6 @@ using ObjCRuntime; [assembly: TargetPlatform ("maccatalyst")] #elif MONOMAC [assembly: TargetPlatform ("macos")] -#elif __WATCHOS__ -// unsupported on dotnet but we're still building it right now -[assembly: TargetPlatform ("watchos")] #else #error Unsupported Platform #endif @@ -22,14 +18,3 @@ using ObjCRuntime; [assembly: SupportedOSPlatform ("tvos@DOTNET_MIN_TVOS_SDK_VERSION@")] [assembly: SupportedOSPlatform ("macos@DOTNET_MIN_MACOS_SDK_VERSION@")] [assembly: SupportedOSPlatform ("maccatalyst@DOTNET_MIN_MACCATALYST_SDK_VERSION@")] -[assembly: UnsupportedOSPlatform ("watchos")] - -#else - -[assembly: Introduced (PlatformName.iOS, @MIN_IOS_SDK_VERSION@)] -[assembly: Introduced (PlatformName.TvOS, @MIN_TVOS_SDK_VERSION@)] -[assembly: Introduced (PlatformName.WatchOS, @MIN_WATCHOS_SDK_VERSION@)] -[assembly: Introduced (PlatformName.MacCatalyst, @MIN_MACCATALYST_SDK_VERSION@)] -[assembly: Introduced (PlatformName.MacOSX, @MIN_MACOS_SDK_VERSION@)] - -#endif // NET diff --git a/src/MonoTouch.NUnitLite.maccatalyst.templ.csproj b/src/MonoTouch.NUnitLite.maccatalyst.templ.csproj deleted file mode 100644 index 955ca3dff852..000000000000 --- a/src/MonoTouch.NUnitLite.maccatalyst.templ.csproj +++ /dev/null @@ -1,46 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - MonoTouch.NUnitLite - True - NUNITLITE;CLR_4_0;NET_4_5;XAMCORE_2_0;MONOTOUCH;MONO - build\maccatalyst\reference - $(OutputPath) - true - ..\product.snk - false - - - true - full - false - prompt - 4 - true - True - - - none - false - prompt - 4 - true - - - - - - - - - - - diff --git a/src/MonoTouch.NUnitLite.templ.csproj b/src/MonoTouch.NUnitLite.templ.csproj deleted file mode 100644 index 61eefd2debf1..000000000000 --- a/src/MonoTouch.NUnitLite.templ.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - MonoTouch.NUnitLite - True - NUNITLITE;CLR_4_0;NET_4_5;XAMCORE_2_0;MONOTOUCH;MONO - build\ios\reference - $(OutputPath) - true - ..\product.snk - false - - - true - full - false - prompt - 4 - true - True - - - none - false - prompt - 4 - true - - - - - - - - - - - - diff --git a/src/MonoTouch.NUnitLite.tvos.templ.csproj b/src/MonoTouch.NUnitLite.tvos.templ.csproj deleted file mode 100644 index 2ab13b9dc27f..000000000000 --- a/src/MonoTouch.NUnitLite.tvos.templ.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {072C1DD1-7566-4387-B9EC-466891558ACC} - {06FA79CB-D6CD-4721-BB4B-1BD202089C55};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - MonoTouch.NUnitLite - True - NUNITLITE;CLR_4_0;NET_4_5;XAMCORE_2_0;XAMCORE_3_0;MONOTOUCH;MONO - build\tvos\reference - $(OutputPath) - true - ..\product.snk - false - - - true - full - false - prompt - 4 - true - True - - - none - false - prompt - 4 - true - - - - - - - - - - - - diff --git a/src/MonoTouch.NUnitLite.watchos.templ.csproj b/src/MonoTouch.NUnitLite.watchos.templ.csproj deleted file mode 100644 index a38f936b4fee..000000000000 --- a/src/MonoTouch.NUnitLite.watchos.templ.csproj +++ /dev/null @@ -1,46 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {B84C539D-971D-4703-8ABC-E1077FDA651C} - {FC940695-DFE0-4552-9F25-99AF4A5619A1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - MonoTouch.NUnitLite - True - NUNITLITE;CLR_4_0;NET_4_5;XAMCORE_2_0;XAMCORE_3_0;MONOTOUCH;MONO - build\watch\reference - $(OutputPath) - true - ..\product.snk - false - - - true - full - false - prompt - 4 - true - True - - - none - false - prompt - 4 - true - - - - - - - - - - - diff --git a/src/MultipeerConnectivity/Compat.cs b/src/MultipeerConnectivity/Compat.cs deleted file mode 100644 index 3f81fcba237d..000000000000 --- a/src/MultipeerConnectivity/Compat.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Compatibility Helpers -// -// Authors: -// Sebastien Pouliot -// -// Copyright 2015 Xamarin Inc. -// - -#nullable enable - -using System; - -namespace MultipeerConnectivity { - -#if !XAMCORE_3_0 - public partial class MCPeerID { - - [Obsolete ("This constructor does not create a valid instance")] - public MCPeerID () - { - } - } - - public partial class MCAdvertiserAssistant { - - [Obsolete ("This constructor does not create a valid instance")] - public MCAdvertiserAssistant () - { - } - } -#endif -} diff --git a/src/NativeTypes/Makefile b/src/NativeTypes/Makefile deleted file mode 100644 index 154598184c4b..000000000000 --- a/src/NativeTypes/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -.PHONY: all test clean - -all: test.exe - -test.exe: ../build/common/NativeTypes/Primitives.cs ../build/common/NativeTypes/Drawing.cs test.cs - mcs -unsafe -debug -out:$@ $+ -r:System.Drawing - -test: test.exe - mono --debug $< - -clean: - rm -f test.exe{,.mdb} diff --git a/src/NativeTypes/Primitives.tt b/src/NativeTypes/Primitives.tt deleted file mode 100644 index e78013356d2f..000000000000 --- a/src/NativeTypes/Primitives.tt +++ /dev/null @@ -1,455 +0,0 @@ -// !!! WARNING - GENERATED CODE - DO NOT EDIT !!! -// -// Generated by Primitives.tt, a T4 template. -// -// Primitives.cs: basic types with 32 or 64 bit sizes: -// -// - nint -// - nuint -// - nfloat -// -// The primitive n* types are optimized by the Mono JIT to perform -// at native int/long/float/double speeds. When NINT_JIT_OPTIMIZED -// is defined, all operators will throw NotImplementedException to -// ensure the JIT works as expected. Otherwise operations are -// carried out slowly using managed code. -// -// If ARCH_32 is defined, the underlying types for n* types will be -// 32 bit (int, uint, float). If not defined, the underlying types -// will be 64 bit (long, ulong, double). -// -// Authors: -// Aaron Bockover -// -// Copyright 2013 Xamarin, Inc. All rights reserved. -// - -#if NET -#define OBJCRUNTIME_nfloat -#endif - -<#@ template language="C#v3.5" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Collections.Generic" #> - -#if !NET - -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.Globalization; -using System.Runtime.InteropServices; - -using ObjCRuntime; - -<# - foreach (var type in new [] { - new { NSName = "nint", CilName32 = "Int32", CilName64 = "Int64", IsIntegerType = true }, - new { NSName = "nuint", CilName32 = "UInt32", CilName64 = "UInt64", IsIntegerType = true }, - new { NSName = "nfloat", CilName32 = "Single", CilName64 = "Double", IsIntegerType = false } - }) { - var unops = new List { "+" }; - if (type.NSName != "nuint") { - unops.Add ("-"); - } - - if (type.IsIntegerType) { - unops.Add ("~"); - } - - var binops = new List { "+", "-", "*", "/", "%" }; - if (type.IsIntegerType) { - binops.Add ("&"); - binops.Add ("|"); - binops.Add ("^"); - } -#> -#if OBJCRUNTIME_<#= type.NSName #> -namespace ObjCRuntime -#else -namespace System -#endif -{ -#if !SKIP_<#= type.NSName #> - [Serializable] - [DebuggerDisplay ("{v,nq}")] - public unsafe struct <#= type.NSName #> : IFormattable, IConvertible, IComparable, IComparable<<#= type.NSName #>>, IEquatable <<#= type.NSName #>> - { - internal <#= type.NSName #> (<#= type.NSName #> v) { this.v = v.v; } - public <#= type.NSName #> (<#= type.CilName32 #> v) { this.v = v; } - -#if ARCH_32 - public static readonly int Size = 4; - - public static readonly <#= type.NSName #> MaxValue = <#= type.CilName32 #>.MaxValue; - public static readonly <#= type.NSName #> MinValue = <#= type.CilName32 #>.MinValue; -<# if (type.NSName == "nfloat") { #> - public static readonly nfloat Epsilon = (nfloat)<#= type.CilName32 #>.Epsilon; - public static readonly nfloat NaN = (nfloat)<#= type.CilName32 #>.NaN; - public static readonly nfloat NegativeInfinity = (nfloat)<#= type.CilName32 #>.NegativeInfinity; - public static readonly nfloat PositiveInfinity = (nfloat)<#= type.CilName32 #>.PositiveInfinity; -<# } #> - - [DebuggerBrowsable (DebuggerBrowsableState.Never)] - internal <#= type.CilName32 #> v; - - public <#= type.NSName #> (<#= type.CilName64 #> v) { this.v = (<#= type.CilName32 #>)v; } -#else - public static readonly int Size = 8; - - public static readonly <#= type.NSName #> MaxValue = (<#= type.NSName #>) <#= type.CilName64 #>.MaxValue; // 64-bit only codepath - public static readonly <#= type.NSName #> MinValue = (<#= type.NSName #>) <#= type.CilName64 #>.MinValue; // 64-bit only codepath -<# if (type.NSName == "nfloat") { #> - public static readonly nfloat Epsilon = (nfloat)<#= type.CilName64 #>.Epsilon; - public static readonly nfloat NaN = (nfloat)<#= type.CilName64 #>.NaN; - public static readonly nfloat NegativeInfinity = (nfloat)<#= type.CilName64 #>.NegativeInfinity; - public static readonly nfloat PositiveInfinity = (nfloat)<#= type.CilName64 #>.PositiveInfinity; -<# } #> - - [DebuggerBrowsable (DebuggerBrowsableState.Never)] - internal <#= type.CilName64 #> v; - - public <#= type.NSName #> (<#= type.CilName64 #> v) { this.v = v; } -#endif - -<# - Action Conversion = (conversionKind, fromType, toType) => { - // Console.Error.WriteLine ("{0}\t{1}\t{2}", conversionKind, fromType, toType); - - WriteLine ("\t\tpublic static {0} operator {1} ({2} v)\n\t\t{{", conversionKind, toType, fromType); - - Func Cast = arch => { - switch (toType) { - case "nint": - return arch == 32 ? "int" : "long"; - case "nuint": - return arch == 32 ? "uint" : "ulong"; - case "nfloat": - return arch == 32 ? "float" : "double"; - default: - return toType; - } - }; - - WriteLine ("#if NINT_JIT_OPTIMIZED"); - WriteLine ("\t\t\tthrow new NotImplementedException ();"); - WriteLine ("#elif ARCH_32"); - - foreach (var arch in new [] { 32, 64 }) { - Write ("\t\t\treturn "); - - var closeParen = false; - switch (toType) { - case "nint": - case "nuint": - case "nfloat": - closeParen = true; - Write ("new {0} (", toType); - break; - } - - if (fromType == "IntPtr" || fromType == "UIntPtr") { - Write ("*(({0} *)&v)", Cast (arch)); - } else if (toType == "IntPtr" || toType == "UIntPtr") { - Write ("*(({0} *)&v.v)", toType); - } else { - Write ("({0})", Cast (arch)); - - switch (fromType) { - case "nint": - case "nuint": - case "nfloat": - Write ("v.v"); - break; - default: - Write ("v"); - break; - } - } - - if (closeParen) - Write (")"); - - WriteLine (";"); - - if (arch == 32) - WriteLine ("#else"); - } - - WriteLine ("#endif"); - WriteLine ("\t\t}\n"); - }; - - Action Exp = (from, to) => Conversion ("explicit", from, to); - Action Imp = (from, to) => Conversion ("implicit", from, to); - - switch (type.NSName) { - case "nint": - Exp ("nuint", "nint"); - Exp ("nint", "nuint"); - Exp ("nfloat", "nint"); - Imp ("nint", "nfloat"); - Exp ("IntPtr", "nint"); - Exp ("nint", "IntPtr"); - Imp ("sbyte", "nint"); - Exp ("nint", "sbyte"); - Imp ("byte", "nint"); - Exp ("nint", "byte"); - Imp ("char", "nint"); - Exp ("nint", "char"); - Imp ("short", "nint"); - Exp ("nint", "short"); - Exp ("ushort", "nint"); - Exp ("nint", "ushort"); - Imp ("int", "nint"); - Exp ("nint", "int"); - Exp ("uint", "nint"); - Exp ("nint", "uint"); - Exp ("long", "nint"); - Imp ("nint", "long"); - Exp ("ulong", "nint"); - Exp ("nint", "ulong"); - Exp ("float", "nint"); - Imp ("nint", "float"); - Exp ("double", "nint"); - Imp ("nint", "double"); - Exp ("decimal", "nint"); - Imp ("nint", "decimal"); - break; - case "nuint": - Exp ("nfloat", "nuint"); - Imp ("nuint", "nfloat"); - Exp ("IntPtr", "nuint"); - Exp ("nuint", "IntPtr"); - Exp ("UIntPtr", "nuint"); - Exp ("nuint", "UIntPtr"); - Exp ("sbyte", "nuint"); - Exp ("nuint", "sbyte"); - Imp ("byte", "nuint"); - Exp ("nuint", "byte"); - Imp ("char", "nuint"); - Exp ("nuint", "char"); - Exp ("short", "nuint"); - Exp ("nuint", "short"); - Imp ("ushort", "nuint"); - Exp ("nuint", "ushort"); - Exp ("int", "nuint"); - Exp ("nuint", "int"); - Imp ("uint", "nuint"); - Exp ("nuint", "uint"); - Exp ("long", "nuint"); - Exp ("nuint", "long"); - Exp ("ulong", "nuint"); - Imp ("nuint", "ulong"); - Exp ("float", "nuint"); - Imp ("nuint", "float"); - Exp ("double", "nuint"); - Imp ("nuint", "double"); - Exp ("decimal", "nuint"); - Imp ("nuint", "decimal"); - break; - case "nfloat": - Exp ("IntPtr", "nfloat"); - Exp ("nfloat", "IntPtr"); - Imp ("sbyte", "nfloat"); - Exp ("nfloat", "sbyte"); - Imp ("byte", "nfloat"); - Exp ("nfloat", "byte"); - Imp ("char", "nfloat"); - Exp ("nfloat", "char"); - Imp ("short", "nfloat"); - Exp ("nfloat", "short"); - Imp ("ushort", "nfloat"); - Exp ("nfloat", "ushort"); - Imp ("int", "nfloat"); - Exp ("nfloat", "int"); - Imp ("uint", "nfloat"); - Exp ("nfloat", "uint"); - Imp ("long", "nfloat"); - Exp ("nfloat", "long"); - Imp ("ulong", "nfloat"); - Exp ("nfloat", "ulong"); - Imp ("float", "nfloat"); - Exp ("nfloat", "float"); - Exp ("double", "nfloat"); - Imp ("nfloat", "double"); - Exp ("decimal", "nfloat"); - Exp ("nfloat", "decimal"); - break; - } -#> -#if NINT_JIT_OPTIMIZED -<# foreach (var op in unops) { #> - public static <#= type.NSName #> operator <#= op #> (<#= type.NSName #> v) { throw new NotImplementedException (); } -<# } #> -#else -<# foreach (var op in unops) { #> - public static <#= type.NSName #> operator <#= op #> (<#= type.NSName #> v) { return new <#= type.NSName #> (<#= op #>v.v); } -<# } #> -#endif - -#if NINT_JIT_OPTIMIZED -<# foreach (var op in new [] { '+', '-' }) { #> - public static <#= type.NSName #> operator <#= op #><#= op #> (<#= type.NSName #> v) { throw new NotImplementedException (); } -<# } #> -#else -<# foreach (var op in new [] { '+', '-' }) { #> - public static <#= type.NSName #> operator <#= op #><#= op #> (<#= type.NSName #> v) { return new <#= type.NSName #> (v.v <#= op #> 1); } -<# } #> -#endif - -#if NINT_JIT_OPTIMIZED -<# foreach (var op in binops) { #> - public static <#= type.NSName #> operator <#= op #> (<#= type.NSName #> l, <#= type.NSName #> r) { throw new NotImplementedException (); } -<# } #> -<# if (type.IsIntegerType) { #> - -<# foreach (var op in new [] { "<<", ">>" }) { #> - public static <#= type.NSName #> operator <#= op #> (<#= type.NSName #> l, int r) { throw new NotImplementedException (); } -<# } } #> -#else -<# foreach (var op in binops) { #> - public static <#= type.NSName #> operator <#= op #> (<#= type.NSName #> l, <#= type.NSName #> r) { return new <#= type.NSName #> (l.v <#= op #> r.v); } -<# } #> -<# if (type.IsIntegerType) { #> - -<# foreach (var op in new [] { "<<", ">>" }) { #> - public static <#= type.NSName #> operator <#= op #> (<#= type.NSName #> l, int r) { return new <#= type.NSName #> (l.v <#= op #> r); } -<# } } #> -#endif - -#if NINT_JIT_OPTIMIZED -<# foreach (var op in new [] { "==", "!=", "<", ">", "<=", ">=" }) { #> - public static bool operator <#= op.PadRight (2) #> (<#= type.NSName #> l, <#= type.NSName #> r) { throw new NotImplementedException (); } -<# } #> -#else -<# foreach (var op in new [] { "==", "!=", "<", ">", "<=", ">=" }) { #> - public static bool operator <#= op.PadRight (2) #> (<#= type.NSName #> l, <#= type.NSName #> r) { return l.v <#= op #> r.v; } -<# } #> -#endif - - public int CompareTo (<#= type.NSName #> value) { return v.CompareTo (value.v); } - public int CompareTo (object value) - { - if (value is <#= type.NSName #>) - return v.CompareTo (((<#= type.NSName #>) value).v); - return v.CompareTo (value); - } - public bool Equals (<#= type.NSName #> obj) { return v.Equals (obj.v); } - public override bool Equals (object obj) - { - if (obj is <#= type.NSName #>) - return v.Equals (((<#= type.NSName #>) obj).v); - return v.Equals (obj); - } - public override int GetHashCode () { return v.GetHashCode (); } - -#if ARCH_32 -<# foreach (var cilName in new [] { type.CilName32, type.CilName64 }) { #> -<# if (type.NSName == "nfloat") { #> - public static bool IsNaN (nfloat f) { return <#= cilName #>.IsNaN ((<#= cilName #>)f); } - public static bool IsInfinity (nfloat f) { return <#= cilName #>.IsInfinity ((<#= cilName #>)f); } - public static bool IsPositiveInfinity (nfloat f) { return <#= cilName #>.IsPositiveInfinity ((<#= cilName #>)f); } - public static bool IsNegativeInfinity (nfloat f) { return <#= cilName #>.IsNegativeInfinity ((<#= cilName #>)f); } - -<# } #> - public static <#= type.NSName #> Parse (string s, IFormatProvider provider) { return (<#= type.NSName #>)<#= cilName #>.Parse (s, provider); } - public static <#= type.NSName #> Parse (string s, NumberStyles style) { return (<#= type.NSName #>)<#= cilName #>.Parse (s, style); } - public static <#= type.NSName #> Parse (string s) { return (<#= type.NSName #>)<#= cilName #>.Parse (s); } - public static <#= type.NSName #> Parse (string s, NumberStyles style, IFormatProvider provider) { - return (<#= type.NSName #>)<#= cilName #>.Parse (s, style, provider); - } - - public static bool TryParse (string s, out <#= type.NSName #> result) - { - <#= cilName #> v; - var r = <#= cilName #>.TryParse (s, out v); - result = (<#= type.NSName #>)v; - return r; - } - - public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out <#= type.NSName #> result) - { - <#= cilName #> v; - var r = <#= cilName #>.TryParse (s, style, provider, out v); - result = (<#= type.NSName #>)v; - return r; - } -<# if (cilName == type.CilName32) { #> -#else -<# } } #> -#endif - - public override string ToString () { return v.ToString (); } - public string ToString (IFormatProvider provider) { return v.ToString (provider); } - public string ToString (string format) { return v.ToString (format); } - public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); } - - public TypeCode GetTypeCode () { return v.GetTypeCode (); } - - bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); } - byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); } - char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); } - DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); } - decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); } - double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); } - short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); } - int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); } - long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); } - sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); } - float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); } - ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); } - uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); } - ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); } - - object IConvertible.ToType (Type targetType, IFormatProvider provider) { - return ((IConvertible)v).ToType (targetType, provider); - } - - [Obsolete ("This API is not available in .NET, use Buffer.MemoryCopy instead.")] - [EditorBrowsable (EditorBrowsableState.Never)] - public static void CopyArray (IntPtr source, <#= type.NSName #> [] destination, int startIndex, int length) - { - if (source == IntPtr.Zero) - throw new ArgumentNullException ("source"); - if (destination is null) - throw new ArgumentNullException ("destination"); - if (destination.Rank != 1) - throw new ArgumentException ("destination", "array is multi-dimensional"); - if (startIndex < 0) - throw new ArgumentException ("startIndex", "must be >= 0"); - if (length < 0) - throw new ArgumentException ("length", "must be >= 0"); - if (startIndex + length > destination.Length) - throw new ArgumentException ("length", "startIndex + length > destination.Length"); - - for (int i = 0; i < length; i++) - destination [i + startIndex] = (<#= type.NSName #>)Marshal.ReadIntPtr (source, i * <#= type.NSName #>.Size); - } - - [Obsolete ("This API is not available in .NET, use Buffer.MemoryCopy instead.")] - [EditorBrowsable (EditorBrowsableState.Never)] - public static void CopyArray (<#= type.NSName #> [] source, int startIndex, IntPtr destination, int length) - { - if (source is null) - throw new ArgumentNullException ("source"); - if (destination == IntPtr.Zero) - throw new ArgumentNullException ("destination"); - if (source.Rank != 1) - throw new ArgumentException ("source", "array is multi-dimensional"); - if (startIndex < 0) - throw new ArgumentException ("startIndex", "must be >= 0"); - if (length < 0) - throw new ArgumentException ("length", "must be >= 0"); - if (startIndex + length > source.Length) - throw new ArgumentException ("length", "startIndex + length > source.Length"); - - for (int i = 0; i < length; i++) - Marshal.WriteIntPtr (destination, i * <#= type.NSName #>.Size, (IntPtr)source [i + startIndex]); - } - } -#endif // !SKIP_<#= type.NSName #> -} -<# } #> - -#endif // !NET diff --git a/src/NativeTypes/TODO b/src/NativeTypes/TODO deleted file mode 100644 index ea63abc9b0b8..000000000000 --- a/src/NativeTypes/TODO +++ /dev/null @@ -1,31 +0,0 @@ -- Determine namespace - + No namespace - + System - + MonoTouch/MonoMac.Foundation - -- Implement extra interfaces? - + Currently: - struct NSInteger : IComparable, IEquatable - + Should we also add? - : IComparable, IEquatable ... on 32 - : IComparable, IEquatable ... on 64 - -- Verify constructors - -- Verify explicit/implicit - -- Add explicit/implicit? - + explicit: CGPoint -> PointF - + implicit: PointF -> CGPoint - ... - This will take a dep on System.Drawing though - -- Remove implicit Rectangle->CGRect? - -- Drop some methods? - + CGSize.ToRoundedCGSize - + CGSize.ToSize (obsoleted for ToRoundedSize) - + CGSize.ToCGPoint - + CGSize.ToPointF (obsoleted for ToCGPoint) - -- Write tests diff --git a/src/NativeTypes/test.cs b/src/NativeTypes/test.cs deleted file mode 100644 index c2c3ab33ef70..000000000000 --- a/src/NativeTypes/test.cs +++ /dev/null @@ -1,33 +0,0 @@ -#nullable enable - -using System; -using System.Drawing; -using CoreGraphics; -namespace Foundation { - public class NSDictionary { } -} - -unsafe static class Test { - static void Main () - { - nint a = 55; - a *= 3; - Console.WriteLine (a + 32); - Console.WriteLine (a.GetType ()); - - short s = 100; - nint b = s; - Console.WriteLine (b); - - Console.WriteLine (sizeof (nint)); - - - var fr = new RectangleF (1.5f, 2.5f, 3.5f, 4.5f); - var dr = fr; - Console.WriteLine (fr); - Console.WriteLine (dr); - fr = (RectangleF) dr; - Console.WriteLine (fr); - - } -} diff --git a/src/NetworkExtension/NEEnums.cs b/src/NetworkExtension/NEEnums.cs index 5f4ffffce95f..dc6090928706 100644 --- a/src/NetworkExtension/NEEnums.cs +++ b/src/NetworkExtension/NEEnums.cs @@ -208,7 +208,9 @@ public enum NEProviderStopReason : long { Sleep = 15, [iOS (13, 0)] [MacCatalyst (13, 1)] - AppUpdate, + AppUpdate = 16, + [iOS (18, 1), MacCatalyst (18, 1), TV (18, 1), Mac (15, 1)] + InternalError = 17, } [Deprecated (PlatformName.iOS, 18, 0, message: "Use 'Network.NWPathStatus' instead.")] 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/ObjCBindings/FieldAttribute.cs b/src/ObjCBindings/FieldAttribute.cs new file mode 100644 index 000000000000..2d2dbedd2b97 --- /dev/null +++ b/src/ObjCBindings/FieldAttribute.cs @@ -0,0 +1,46 @@ +using System; +using System.Diagnostics.CodeAnalysis; + +#nullable enable + +namespace ObjCBindings { + + /// + /// Generic attribute that is used to mark code to be backed by a field in ObjC. + /// + [Experimental ("APL0003")] + [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field)] + public sealed class FieldAttribute : Attribute where T : FieldTag { + + /// + /// Create a new FieldAttribute for the given symbol and using the namespace as its containing library. + /// The name of the symbol. + /// + public FieldAttribute (string symbolName) + { + SymbolName = symbolName; + } + + /// + /// Create a new FieldAttribute for the given symbol in the provided library. + /// The name of the symbol. + /// The name of the library that contains the symbol. + /// + public FieldAttribute (string symbolName, string libraryName) + { + SymbolName = symbolName; + LibraryName = libraryName; + } + + + /// + /// Get/Set the symbol represented by the attribute. + /// + public string SymbolName { get; set; } + + /// + /// Get/Set the library that contains the symbol.. + /// + public string? LibraryName { get; set; } + } +} diff --git a/src/ObjCBindings/FieldTag.cs b/src/ObjCBindings/FieldTag.cs new file mode 100644 index 000000000000..515e1eabda5a --- /dev/null +++ b/src/ObjCBindings/FieldTag.cs @@ -0,0 +1,20 @@ +using System; +using System.Diagnostics.CodeAnalysis; + +#nullable enable + +namespace ObjCBindings { + + /// + /// Base class use to flag a FieldAttribute usage. Each FieldAttribute must have a flag attached to it so that the + /// binding generator analyzer can verify the binding definition. + /// + [Experimental ("APL0003")] + public abstract class FieldTag { } + + /// + /// Field flag that states that the field is used as a Enum value. + /// + [Experimental ("APL0003")] + public sealed class EnumValue : FieldTag { } +} diff --git a/src/ObjCRuntime/Blocks.cs b/src/ObjCRuntime/Blocks.cs index 332f58b95919..cb3b4091fbe3 100644 --- a/src/ObjCRuntime/Blocks.cs +++ b/src/ObjCRuntime/Blocks.cs @@ -693,12 +693,7 @@ public void Add (IntPtr block) #endif [Flags] -#if XAMCORE_3_0 - internal -#else - public -#endif - enum BlockFlags : int { + internal enum BlockFlags : int { BLOCK_REFCOUNT_MASK = (0xffff), BLOCK_NEEDS_FREE = (1 << 24), BLOCK_HAS_COPY_DISPOSE = (1 << 25), diff --git a/src/ObjCRuntime/PlatformAvailability.cs b/src/ObjCRuntime/PlatformAvailability.cs index f7b5bda19bde..3322154bdb39 100644 --- a/src/ObjCRuntime/PlatformAvailability.cs +++ b/src/ObjCRuntime/PlatformAvailability.cs @@ -12,7 +12,7 @@ // // Copyright 2013-2014 Xamarin Inc. -#if COREBUILD || (!XAMCORE_3_0 && !NET) +#if COREBUILD using System; using System.Globalization; diff --git a/src/ObjCRuntime/PlatformAvailability2.cs b/src/ObjCRuntime/PlatformAvailability2.cs index 0496f9f99567..a021b458aea5 100644 --- a/src/ObjCRuntime/PlatformAvailability2.cs +++ b/src/ObjCRuntime/PlatformAvailability2.cs @@ -16,7 +16,7 @@ // // Copyright 2015 Xamarin Inc. All rights reserved. -#if !NET +#if !NET || LEGACY_TOOLS using System; using System.Text; diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index 2286d7909f90..5db823dfa3e1 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -2722,22 +2722,12 @@ public static void ThrowException (IntPtr gchandle) [EditorBrowsable (EditorBrowsableState.Advanced)] public static ulong ConvertNativeEnumValueToManaged (nuint value, bool targetTypeHasMaxValue) { -#if ARCH_32 - // Check if we got UInt32.MaxValue, which should probably be UInt64.MaxValue - if (targetTypeHasMaxValue && value == nuint.MaxValue) - return ulong.MaxValue; -#endif return (ulong) value; } [EditorBrowsable (EditorBrowsableState.Advanced)] public static long ConvertNativeEnumValueToManaged (nint value, bool targetTypeHasMaxValue) { -#if ARCH_32 - // Check if we got Int32.MaxValue, which should probably be Int64.MaxValue - if (targetTypeHasMaxValue && value == nint.MaxValue) - return long.MaxValue; -#endif return (long) value; } diff --git a/src/ObjCRuntime/RuntimeOptions.cs b/src/ObjCRuntime/RuntimeOptions.cs index 0b2ffc2d1a36..a010735a77c7 100644 --- a/src/ObjCRuntime/RuntimeOptions.cs +++ b/src/ObjCRuntime/RuntimeOptions.cs @@ -19,7 +19,7 @@ namespace Xamarin.Bundler { namespace ObjCRuntime { #endif class RuntimeOptions { -#if NET +#if NET && !LEGACY_TOOLS const string SocketsHandlerValue = "SocketsHttpHandler"; #else const string HttpClientHandlerValue = "HttpClientHandler"; @@ -45,13 +45,13 @@ static string ParseHttpMessageHandler (Application app, string? value) switch (value) { // default case null: -#if NET +#if NET && !LEGACY_TOOLS return NSUrlSessionHandlerValue; #else return (app.Platform == Utils.ApplePlatform.WatchOS) ? NSUrlSessionHandlerValue : HttpClientHandlerValue; #endif case CFNetworkHandlerValue: -#if NET +#if NET && !LEGACY_TOOLS case SocketsHandlerValue: #else case HttpClientHandlerValue: @@ -100,7 +100,7 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp } else if (app.Platform == Utils.ApplePlatform.WatchOS) { handler = NSUrlSessionHandlerValue; } else { -#if NET +#if NET && !LEGACY_TOOLS handler = NSUrlSessionHandlerValue; #else handler = HttpClientHandlerValue; @@ -119,7 +119,7 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp type = platformModule!.GetType ("Foundation", "NSUrlSessionHandler"); break; #else -#if NET +#if NET && !LEGACY_TOOLS case SocketsHandlerValue: type = httpModule.GetType ("System.Net.Http", "SocketsHttpHandler"); break; @@ -180,7 +180,7 @@ internal static HttpMessageHandler GetHttpMessageHandler () var options = RuntimeOptions.Read (); // all types will be present as this is executed only when the linker is not enabled var handler_name = options?.http_message_handler; -#if NET +#if NET && !LEGACY_TOOLS // Note: no need to handle SocketsHandlerValue here because System.Net.Http handles // creating a SocketsHttpHandler when configured to do so. switch (handler_name) { diff --git a/src/ObjCRuntime/SelectorMarshaler.cs b/src/ObjCRuntime/SelectorMarshaler.cs deleted file mode 100644 index 693591721047..000000000000 --- a/src/ObjCRuntime/SelectorMarshaler.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright 2010, Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if MONOMAC && !XAMCORE_3_0 - -using System; -using System.Runtime.InteropServices; - -using Foundation; - -namespace ObjCRuntime { - public class SelectorMarshaler : ICustomMarshaler { - static SelectorMarshaler marshaler; - - public object MarshalNativeToManaged (IntPtr handle) { - return new Selector (handle); - } - - public IntPtr MarshalManagedToNative (object obj) { - if (obj is null) - return IntPtr.Zero; - if (!(obj is Selector)) - throw new MarshalDirectiveException ("This custom marshaler must be used on a Selector derived type."); - - return (obj as Selector).Handle; - } - - public void CleanUpNativeData (IntPtr handle) { - } - - public void CleanUpManagedData (object obj) { - } - - public int GetNativeDataSize () { - return -1; - } - - public static ICustomMarshaler GetInstance(string cookie) { - if(marshaler is null) - return marshaler = new SelectorMarshaler (); - - return marshaler; - } - } -} - -#endif // MONOMAC && !XAMCORE_3_0 diff --git a/src/OpenGLES/EAGLContext.cs b/src/OpenGLES/EAGLContext.cs index 9a511b000e6a..0630f8c7cb81 100644 --- a/src/OpenGLES/EAGLContext.cs +++ b/src/OpenGLES/EAGLContext.cs @@ -20,13 +20,6 @@ public unsafe static void EAGLGetVersion (out nuint major, out nuint minor) EAGLGetVersion ((nuint*) Unsafe.AsPointer (ref major), (nuint*) Unsafe.AsPointer (ref minor)); } -#if !XAMCORE_3_0 - [Obsolete ("iOS9 does not allow creating an empty instance")] - public EAGLContext () - { - } -#endif - #if NET [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("tvos")] diff --git a/src/OpenTK.dll.sources b/src/OpenTK.dll.sources deleted file mode 100644 index 5f7d803b3133..000000000000 --- a/src/OpenTK.dll.sources +++ /dev/null @@ -1,56 +0,0 @@ -System.Drawing/ColorKnownColorTypeForwarders.cs -OpenGLES/OpenTK/Audio/AudioContext.cs -OpenGLES/OpenTK/Audio/AudioContextException.cs -OpenGLES/OpenTK/Audio/AudioDeviceEnumerator.cs -OpenGLES/OpenTK/Audio/AudioDeviceErrorChecker.cs -OpenGLES/OpenTK/Audio/AudioDeviceException.cs -OpenGLES/OpenTK/Audio/AudioException.cs -OpenGLES/OpenTK/Audio/AudioValueException.cs -OpenGLES/OpenTK/Audio/OpenAL/AL/AL.cs -OpenGLES/OpenTK/Audio/OpenAL/AL/ALEnums.cs -OpenGLES/OpenTK/Audio/OpenAL/AL/EffectsExtension.cs -OpenGLES/OpenTK/Audio/OpenAL/AL/EffectsExtensionEnums.cs -OpenGLES/OpenTK/Audio/OpenAL/AL/EffectsExtensionPresets.cs -OpenGLES/OpenTK/Audio/OpenAL/AL/XRamExtension.cs -OpenGLES/OpenTK/Audio/OpenAL/Alc/Alc.cs -OpenGLES/OpenTK/Audio/OpenAL/Alc/AlcEnums.cs -OpenGLES/OpenTK/AutoGeneratedAttribute.cs -OpenGLES/OpenTK/BlittableValueType.cs -OpenGLES/OpenTK/Configuration.cs -OpenGLES/OpenTK/ContextHandle.cs -OpenGLES/OpenTK/ContextHandleEqualityComparer.cs -OpenGLES/OpenTK/DisplayResolution.cs -OpenGLES/OpenTK/FrameEventArgs.cs -OpenGLES/OpenTK/Graphics/ColorFormat.cs -OpenGLES/OpenTK/Graphics/ES11.iPhone/Enums.cs -OpenGLES/OpenTK/Graphics/ES11.iPhone/GL.Core.cs -OpenGLES/OpenTK/Graphics/ES11.iPhone/GL.cs -OpenGLES/OpenTK/Graphics/ES11.iPhone/GL.Delegates.cs -OpenGLES/OpenTK/Graphics/ES11.iPhone/Helper.cs -OpenGLES/OpenTK/Graphics/ES20.iPhone/Enums.cs -OpenGLES/OpenTK/Graphics/ES20.iPhone/GL.Core.cs -OpenGLES/OpenTK/Graphics/ES20.iPhone/GL.cs -OpenGLES/OpenTK/Graphics/ES20.iPhone/GL.Delegates.cs -OpenGLES/OpenTK/Graphics/ES20.iPhone/Helper.cs -OpenGLES/OpenTK/Graphics/GraphicsContext.cs -OpenGLES/OpenTK/Graphics/GraphicsContextException.cs -OpenGLES/OpenTK/Graphics/GraphicsContextFlags.cs -OpenGLES/OpenTK/Graphics/GraphicsContextMissingException.cs -OpenGLES/OpenTK/Graphics/GraphicsMode.cs -OpenGLES/OpenTK/Graphics/GraphicsModeException.cs -OpenGLES/OpenTK/Graphics/IGraphicsContext.cs -OpenGLES/OpenTK/Graphics/IGraphicsMode.cs -OpenGLES/OpenTK/IGameWindow.cs -OpenGLES/OpenTK/INativeWindow.cs -OpenGLES/OpenTK/KeyPressEventArgs.cs -OpenGLES/OpenTK/Minimal.cs -OpenGLES/OpenTK/Platform/Factory.iPhone.cs -OpenGLES/OpenTK/Platform/iPhoneOS/iPhoneOSGameView.cs -OpenGLES/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsContext.cs -OpenGLES/OpenTK/Platform/iPhoneOS/iPhoneOSGraphicsMode.cs -OpenGLES/OpenTK/Platform/IWindowInfo.cs -OpenGLES/OpenTK/Platform/Utilities.iPhone.cs -OpenGLES/OpenTK/WindowBorder.cs -OpenGLES/OpenTK/WindowState.cs -CoreVideo/CVOpenGLESTexture.cs -CoreVideo/CVOpenGLESTextureCache.cs diff --git a/src/PassKit/PKPayLaterView.cs b/src/PassKit/PKPayLaterView.cs index 49c26d19733e..15457dc99641 100644 --- a/src/PassKit/PKPayLaterView.cs +++ b/src/PassKit/PKPayLaterView.cs @@ -1,72 +1,79 @@ -// Can be uncommented when this issue is resolved: # https://github.com/xamarin/xamarin-macios/issues/19271 +#nullable enable -// #nullable enable +#if IOS && !__MACCATALYST__ -// #if IOS && !__MACCATALYST__ +using System; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; -// using System; -// using System.Runtime.InteropServices; -// using System.Runtime.CompilerServices; -// using ObjCRuntime; -// using Foundation; -// using PassKit; +using Foundation; +using ObjCRuntime; +using PassKit; -// #if !NET -// using NativeHandle = System.IntPtr; -// #endif +namespace PassKit { -// namespace PassKit { + /// The delegate that is called when has determined whether the Pay Later Merchandising information is valid. + /// True if the Pay Later Merchandising information is valid, false otherwise. + public delegate void PKPayLaterViewValidateAmountCallback (bool eligible); -// public partial class PKPayLaterView { + public partial class PKPayLaterView { + [UnmanagedCallersOnly] + static void TrampolineValidateAmount (IntPtr block, byte eligible) + { + var del = BlockLiteral.GetTarget (block); + if (del is not null) { + del (eligible != 0); + } + } -// #if !NET -// delegate void PKPayLaterValidateAmountCompletionHandler (IntPtr block, byte eligible); -// static PKPayLaterValidateAmountCompletionHandler static_ValidateAmount = TrampolineValidateAmount; + /// Checks whether the Pay Later Merchandising information is valid for the specified amount and currency. + /// The amount to check for. + /// The ISO 4217 currency code to use. + /// The delegate that will be called with the result. + [SupportedOSPlatform ("ios17.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos")] + [UnsupportedOSPlatform ("tvos")] + [BindingImpl (BindingImplOptions.Optimizable)] + public static void ValidateAmount (NSDecimalNumber amount, string currencyCode, PKPayLaterViewValidateAmountCallback callback) + { + if (callback is null) + ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback)); -// [MonoPInvokeCallback (typeof (PKPayLaterValidateAmountCompletionHandler))] -// #else -// [UnmanagedCallersOnly] -// #endif -// static void TrampolineValidateAmount (IntPtr block, byte eligible) -// { -// var del = BlockLiteral.GetTarget> (block); -// if (del is not null) { -// del (eligible != 0); -// } -// } + unsafe { + delegate* unmanaged trampoline = &TrampolineValidateAmount; + using var block = new BlockLiteral (trampoline, callback, typeof (PKPayLaterView), nameof (TrampolineValidateAmount)); + var nsCurrencyCodePtr = NSString.CreateNative (currencyCode); + try { + PKPayLaterValidateAmount (amount.Handle, nsCurrencyCodePtr, &block); + } finally { + NSString.ReleaseNative (nsCurrencyCodePtr); + } + } + } -// #if NET -// [SupportedOSPlatform ("ios17.0")] -// [UnsupportedOSPlatform ("maccatalyst")] -// [UnsupportedOSPlatform ("macos")] -// [UnsupportedOSPlatform ("tvos")] -// #endif -// [BindingImpl (BindingImplOptions.Optimizable)] -// public static void ValidateAmount (NSDecimalNumber amount, string currencyCode, Action callback) -// { -// if (callback is null) -// ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback)); + /// Checks whether the Pay Later Merchandising information is valid for the specified amount and currency. + /// The amount to check for. + /// The ISO 4217 currency code to use. + /// The delegate that will be called with the result. + [SupportedOSPlatform ("ios17.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos")] + [UnsupportedOSPlatform ("tvos")] + [BindingImpl (BindingImplOptions.Optimizable)] + public static void ValidateAmount (decimal amount, string currencyCode, PKPayLaterViewValidateAmountCallback callback) + { + using var decimalAmount = new NSDecimalNumber ((NSDecimal) amount); + ValidateAmount (decimalAmount, currencyCode, callback); + } -// unsafe { -// #if NET -// delegate* unmanaged trampoline = &TrampolineValidateAmount; -// using var block = new BlockLiteral (trampoline, callback, typeof (PKPayLaterView), nameof (TrampolineValidateAmount)); -// #else -// using var block = new BlockLiteral (); -// block.SetupBlockUnsafe (static_ValidateAmount, callback); -// #endif -// var nsCurrencyCodePtr = NSString.CreateNative (currencyCode); -// try { -// PKPayLaterValidateAmount (amount.Handle, nsCurrencyCodePtr, &block); -// } finally { -// NSString.ReleaseNative (nsCurrencyCodePtr); -// } -// } -// } + [SupportedOSPlatform ("ios17.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos")] + [UnsupportedOSPlatform ("tvos")] + [DllImport (Constants.PassKitLibrary)] + unsafe static extern void PKPayLaterValidateAmount (IntPtr /* NSDecimalNumber */ amount, IntPtr /* NSString */ currencyCode, BlockLiteral* callback); + } +} -// [DllImport (Constants.PassKitLibrary)] -// unsafe static extern void PKPayLaterValidateAmount (IntPtr /* NSDecimalNumber */ amount, IntPtr /* NSString */ currencyCode, BlockLiteral* callback); -// } -// } - -// #endif +#endif diff --git a/src/Photos/Enums.cs b/src/Photos/Enums.cs index 08554d3c0c96..6a90ee0e4492 100644 --- a/src/Photos/Enums.cs +++ b/src/Photos/Enums.cs @@ -98,13 +98,6 @@ public enum PHCollectionListSubtype : long { SmartFolderEvents = 200, SmartFolderFaces = 201, -#if !XAMCORE_3_0 - // this was added in the wrong enum type (ref bug #40019) - [Obsolete ("Incorrect value (exists in 'PHAssetCollectionSubtype').")] - SmartAlbumSelfPortraits = 210, - [Obsolete ("Incorrect value (exists in 'PHAssetCollectionSubtype').")] - SmartAlbumScreenshots = 211, -#endif Any = Int64.MaxValue, } diff --git a/src/Photos/PHAssetChangeRequest.cs b/src/Photos/PHAssetChangeRequest.cs index b14b95be8727..76abd2942077 100644 --- a/src/Photos/PHAssetChangeRequest.cs +++ b/src/Photos/PHAssetChangeRequest.cs @@ -7,13 +7,6 @@ namespace Photos { public partial class PHAssetChangeRequest { - -#if !XAMCORE_3_0 - [Obsolete ("iOS9 does not allow creating an empty instance")] - public PHAssetChangeRequest () - { - } -#endif } } diff --git a/src/Photos/PHChangeRequest.cs b/src/Photos/PHChangeRequest.cs index 3cac53d7ef1c..eb16763ec340 100644 --- a/src/Photos/PHChangeRequest.cs +++ b/src/Photos/PHChangeRequest.cs @@ -5,11 +5,5 @@ namespace Photos { public partial class PHChangeRequest { -#if !XAMCORE_3_0 - // This constructor is required for the default constructor in PHAssetChangeRequest to compile. - internal PHChangeRequest () - { - } -#endif } } diff --git a/src/Photos/PHCompat.cs b/src/Photos/PHCompat.cs index 7b2d58b333af..fc8fe04bdc0b 100644 --- a/src/Photos/PHCompat.cs +++ b/src/Photos/PHCompat.cs @@ -11,23 +11,6 @@ namespace Photos { -#if !XAMCORE_3_0 && !MONOMAC - public partial class PHContentEditingInputRequestOptions { - - [Obsolete ("Use 'CanHandleAdjustmentData' property.")] - public virtual void SetCanHandleAdjustmentDataHandler (Func canHandleAdjustmentDataPredicate) - { - CanHandleAdjustmentData = canHandleAdjustmentDataPredicate; - } - - [Obsolete ("Use 'ProgressHandler' property.")] - public virtual void SetProgressHandler (PHProgressHandler progressHandler) - { - ProgressHandler = progressHandler; - } - } -#endif - #if !NET // incorrect signature, should have been `ref NSError` [Obsolete ("Use 'PHLivePhotoFrameProcessingBlock2' instead.")] diff --git a/src/README.md b/src/README.md index e0bab7d651f1..2512ad73a987 100644 --- a/src/README.md +++ b/src/README.md @@ -48,8 +48,8 @@ These are the symbols defined for each platform assembly: | ------------------ | ----------- | | Xamarin.iOS.dll | IPHONE MONOTOUCH IOS | | Xamarin.Mac.dll | MONOMAC | -| Xamarin.WatchOS.dll | IPHONE MONOTOUCH WATCH XAMCORE_3_0 | -| Xamarin.TVOS.dll | IPHONE MONOTOUCH TVOS XAMCORE_3_0 | +| Xamarin.WatchOS.dll | IPHONE MONOTOUCH WATCH | +| Xamarin.TVOS.dll | IPHONE MONOTOUCH TVOS | To build core for only one platform, use the platform unique variables `IOS`, `MONOMAC`, `WATCH` or `TVOS`. @@ -178,19 +178,8 @@ conditional compilation: | Variable | Description | | --------- | ------------| | `MONOMAC` | defined for Xamarin.Mac builds; not defined for Xamarin.iOS | -| `ARCH_32` | defined when the target architecture is 32-bit; this will be defined for Classic and the Unified 32-bit assemblies | -| `ARCH_64` | defined when the target architecture is 64-bit; this will be defined only for the Unified 64-bit assembly | | `COREBUILD` | defined when building the intermediate `core.dll` assembly against which the code generator will produce bindings | -For example, to build an API for all of iOS but only 64-bit OS X (Xamarin.Mac): - -```csharp -#if !MONOMAC || (MONOMAC && ARCH_64) -... -#endif -``` - - ## Source Localization ## Coming soon! diff --git a/src/SceneKit/SCNCompat.cs b/src/SceneKit/SCNCompat.cs index 0b9e5343376d..03d5077ce579 100644 --- a/src/SceneKit/SCNCompat.cs +++ b/src/SceneKit/SCNCompat.cs @@ -42,13 +42,6 @@ public virtual Action? TimingFunction { } #endif // !NET -#if !XAMCORE_3_0 - [Obsolete ("Use 'TimingFunction2' property.")] - public virtual void SetTimingFunction (Action timingFunction) - { - TimingFunction = timingFunction; - } -#endif // !XAMCORE_3_0 } #if TVOS && !NET partial class SCNMaterialProperty { diff --git a/src/SceneKit/SCNGeometry.cs b/src/SceneKit/SCNGeometry.cs deleted file mode 100644 index bbfa1a825434..000000000000 --- a/src/SceneKit/SCNGeometry.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// SCNGeometry.cs: extensions to SCNGeometry -// -// Authors: -// MIguel de Icaza (miguel@xamarin.com) -// -// Copyright Xamarin Inc -// -using System; - -using CoreGraphics; -using Foundation; - -#nullable enable - -namespace SceneKit { - public partial class SCNGeometry { -#if !XAMCORE_3_0 - [Obsolete ("Use the 'Create (SCNGeometrySource[], SCNGeometryElement[])' method instead, as it has a strongly typed return.")] - public static NSObject FromSources (SCNGeometrySource [] sources, SCNGeometryElement [] elements) - { - return Create (sources, elements); - } -#endif - } -} diff --git a/src/SceneKit/SCNSceneRenderer.cs b/src/SceneKit/SCNSceneRenderer.cs deleted file mode 100644 index fc1954c5b594..000000000000 --- a/src/SceneKit/SCNSceneRenderer.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -// SCNSceneRenderer.cs -// -// Authors: -// Rolf Bjarne Kvinge -// -// Copyright 2015 Xamarin Inc. All rights reserved. -// - -using System; -using System.Runtime.InteropServices; - -using ObjCRuntime; -using Foundation; -using CoreGraphics; - -#nullable enable - -namespace SceneKit { - -#if !XAMCORE_3_0 - public static partial class SCNSceneRenderer_Extensions { - public static SCNHitTestResult [] HitTest (ISCNSceneRenderer This, CGPoint thePoint, SCNHitTestOptions? options) - { - return This.HitTest (thePoint, options?.Dictionary); - } - } -#endif -} diff --git a/src/Social/SLCompat.cs b/src/Social/SLCompat.cs deleted file mode 100644 index 169c66139d6b..000000000000 --- a/src/Social/SLCompat.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 Xamarin Inc. All rights reserved. - -#nullable enable - -#if !XAMCORE_3_0 && !MONOMAC - -using System; - -namespace Social { - - partial class SLComposeSheetConfigurationItem { - - [Obsolete ("Use the 'TapHandler' property.")] - public virtual void SetTapHandler (Action tapHandler) - { - TapHandler = tapHandler; - } - } -} - -#endif diff --git a/src/SpriteKit/ObsoleteCompat.cs b/src/SpriteKit/ObsoleteCompat.cs deleted file mode 100644 index fcaa638d3f52..000000000000 --- a/src/SpriteKit/ObsoleteCompat.cs +++ /dev/null @@ -1,33 +0,0 @@ -// -// Compat.cs: Compatibility functions -// -// Authors: -// Miguel de Icaza (miguel@xamarin.com) -// -// Copyright 2013-2014, 2016 Xamarin Inc - -using System; -using ObjCRuntime; -using CoreGraphics; - -#nullable enable - -namespace SpriteKit { - -#if !XAMCORE_3_0 && !MONOMAC - public partial class SKAction { - - [Obsolete ("Use the 'FalloffBy' method.")] - public static SKAction Falloff (float /* float, not CGFloat */ to, double duration) - { - return FalloffBy (to, duration); - } - - [Obsolete ("Use the 'TimingFunction2' property.")] - public virtual void SetTimingFunction (SKActionTimingFunction? timingFunction) - { - TimingFunction = timingFunction; - } - } -#endif -} diff --git a/src/SpriteKit/SKFieldNode.cs b/src/SpriteKit/SKFieldNode.cs deleted file mode 100644 index 3f5f1be32929..000000000000 --- a/src/SpriteKit/SKFieldNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -// SKFieldNode.cs: SKFieldNode class -// -// Authors: -// Alex Soto (alex.soto@xamarin.com) -// -// Copyright 2015 Xamarin Inc. -// - -using System; -using Foundation; -using ObjCRuntime; - -#nullable enable - -namespace SpriteKit { -#if !XAMCORE_3_0 && !MONOMAC - public partial class SKFieldNode { - - [Obsolete ("Use the method 'CreateVortexField' instead.")] - public static SKFieldNode CraeteVortexField () - { - return CreateVortexField (); - } - } -#endif -} diff --git a/src/StoreKit/SKPayment.cs b/src/StoreKit/SKPayment.cs index b4d0dfc51216..7c15d1974a0d 100644 --- a/src/StoreKit/SKPayment.cs +++ b/src/StoreKit/SKPayment.cs @@ -9,24 +9,5 @@ namespace StoreKit { public partial class SKPayment { - -#if !XAMCORE_3_0 - - [Obsolete ("Use CreateFrom (SKProduct) instead.")] - public static SKPayment PaymentWithProduct (SKProduct product) - { - return CreateFrom (product); - } - -#if !MONOMAC - - [Obsolete ("Use CreateFrom (string) instead.")] - public static SKPayment PaymentWithProduct (string identifier) - { - return CreateFrom (identifier); - } -#endif - -#endif } } diff --git a/src/StoreKit/SKPaymentTransactionObserver.cs b/src/StoreKit/SKPaymentTransactionObserver.cs deleted file mode 100644 index b272967a1120..000000000000 --- a/src/StoreKit/SKPaymentTransactionObserver.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015-2016 Xamarin Inc. - -#nullable enable - -#if !XAMCORE_3_0 - -using System; - -using StoreKit; - -namespace StoreKit { - - public partial class SKPaymentTransactionObserver { - - [Obsolete ("Use RestoreCompletedTransactionsFinished (SKPaymentQueue) instead.")] - public virtual void PaymentQueueRestoreCompletedTransactionsFinished (SKPaymentQueue queue) - { - RestoreCompletedTransactionsFinished (queue); - } - } - - public static partial class SKPaymentTransactionObserver_Extensions { - - [Obsolete ("Use RestoreCompletedTransactionsFinished (SKPaymentQueue) instead.")] - public static void PaymentQueueRestoreCompletedTransactionsFinished (ISKPaymentTransactionObserver This, SKPaymentQueue queue) - { - RestoreCompletedTransactionsFinished (This, queue); - } - } -} - -#endif 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/System.Drawing/PointSizeRectangleTypeForwarders.cs b/src/System.Drawing/PointSizeRectangleTypeForwarders.cs deleted file mode 100644 index 858b1015f841..000000000000 --- a/src/System.Drawing/PointSizeRectangleTypeForwarders.cs +++ /dev/null @@ -1,8 +0,0 @@ -#if !NET -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (System.Drawing.Point))] -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (System.Drawing.PointF))] -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (System.Drawing.Rectangle))] -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (System.Drawing.RectangleF))] -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (System.Drawing.Size))] -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (System.Drawing.SizeF))] -#endif diff --git a/src/Twitter/TWCompat.cs b/src/Twitter/TWCompat.cs deleted file mode 100644 index e175a6f7cf11..000000000000 --- a/src/Twitter/TWCompat.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 Xamarin Inc. All rights reserved. - -#nullable enable - -#if !XAMCORE_3_0 - -using System; - -namespace Twitter { - - public partial class TWTweetComposeViewController { - - [Obsolete ("Use the 'CompletionHandler' property.")] - public virtual void SetCompletionHandler (Action handler) - { - CompletionHandler = handler; - } - } -} - -#endif diff --git a/src/UIKit/Compat.cs b/src/UIKit/Compat.cs index ab408f61ea22..743db952b1f7 100644 --- a/src/UIKit/Compat.cs +++ b/src/UIKit/Compat.cs @@ -16,36 +16,6 @@ using ObjCRuntime; namespace UIKit { - -#if !XAMCORE_3_0 - public partial class UIAdaptivePresentationControllerDelegate { - - [Obsolete ("Incorrect signature. Use the overload with a UITraitCollection parameter.")] - public virtual UIViewController GetAdaptivePresentationStyle (UIPresentationController controller, UIModalPresentationStyle style) - { - return null; - } - } - - public partial class UIAdaptivePresentationControllerDelegate_Extensions { - - [Obsolete ("Incorrect signature. Use the overload with a UITraitCollection parameter.")] - public static UIViewController GetAdaptivePresentationStyle (IUIAdaptivePresentationControllerDelegate This, UIPresentationController controller, UIModalPresentationStyle style) - { - return null; - } - } - - public static partial class NSIdentifier { - - [Obsolete ("Use 'GetIdentifier' method.")] - public static string Identifier (this NSLayoutConstraint This) - { - return This.GetIdentifier (); - } - } -#endif - #if !NET && !WATCH public partial class UIPresentationController { diff --git a/src/UIKit/NSLayoutManager.cs b/src/UIKit/NSLayoutManager.cs index 87c53b998421..ad558cc45887 100644 --- a/src/UIKit/NSLayoutManager.cs +++ b/src/UIKit/NSLayoutManager.cs @@ -51,15 +51,8 @@ public unsafe nuint GetGlyphs ( fixed (short* glyphs = glyphBuffer) { nuint rv; -#if ARCH_32 - // Unified/32: the output array is not the correct size, it needs to be int[], and it's an array of NSGlyphProperty (which is long) - nint[] tmpArray = null; - if (props is not null) - tmpArray = new nint [props.Length]; -#else // Unified/64 + Classic: the input array is the correct size var tmpArray = props; -#endif fixed (void* properties = tmpArray) { fixed (nuint* charIBuffer = charIndexBuffer) { fixed (byte* bidi = bidiLevelBuffer) { @@ -67,13 +60,6 @@ public unsafe nuint GetGlyphs ( } } } -#if ARCH_32 - // Marshal back from the tmpArray. - if (tmpArray is not null) { - for (int i = 0; i < props.Length; i++) - props [i] = (NSGlyphProperty) (long) tmpArray [i]; - } -#endif return rv; } diff --git a/src/UIKit/UIAccessibilityCustomAction.cs b/src/UIKit/UIAccessibilityCustomAction.cs index eedc1034cc4a..fb3e348b3e62 100644 --- a/src/UIKit/UIAccessibilityCustomAction.cs +++ b/src/UIKit/UIAccessibilityCustomAction.cs @@ -22,13 +22,6 @@ namespace UIKit { public partial class UIAccessibilityCustomAction { object action; -#if !XAMCORE_3_0 - [Obsolete ("iOS9 does not allow creating an empty instance")] - public UIAccessibilityCustomAction () - { - } -#endif - public UIAccessibilityCustomAction (string name, Func probe) : this (name, FuncBoolDispatcher.Selector, new FuncBoolDispatcher (probe)) { diff --git a/src/UIKit/UIActivityItemProvider.cs b/src/UIKit/UIActivityItemProvider.cs deleted file mode 100644 index 2c566034b774..000000000000 --- a/src/UIKit/UIActivityItemProvider.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -namespace UIKit { - - public partial class UIActivityItemProvider { - [Obsolete ("iOS9 does not allow creating an empty instance")] - public UIActivityItemProvider () - { - } - } -} - -#endif diff --git a/src/UIKit/UIActivityViewController.cs b/src/UIKit/UIActivityViewController.cs deleted file mode 100644 index 10b731dfb936..000000000000 --- a/src/UIKit/UIActivityViewController.cs +++ /dev/null @@ -1,21 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -namespace UIKit { - - public partial class UIActivityViewController { - [Obsolete ("iOS 9 does not allow creating an empty instance.")] - public UIActivityViewController () - { - } - - [Obsolete ("Use 'CompletionWithItemsHandler' property.")] - public virtual void SetCompletionHandler (UIActivityViewControllerCompletion completionHandler) - { - CompletionWithItemsHandler = completionHandler; - } - } -} - -#endif diff --git a/src/UIKit/UIBarItem.cs b/src/UIKit/UIBarItem.cs index 30651d80afd7..b510afcab7e4 100644 --- a/src/UIKit/UIBarItem.cs +++ b/src/UIKit/UIBarItem.cs @@ -13,22 +13,14 @@ using ObjCRuntime; using Foundation; -#if XAMCORE_3_0 using TextAttributes = UIKit.UIStringAttributes; -#else -using TextAttributes = UIKit.UITextAttributes; -#endif namespace UIKit { public partial class UIBarItem { public void SetTitleTextAttributes (TextAttributes attributes, UIControlState state) { -#if XAMCORE_3_0 var dict = attributes?.Dictionary; -#else - using var dict = attributes?.ToDictionary (); -#endif _SetTitleTextAttributes (dict, state); } @@ -44,11 +36,7 @@ public virtual void SetTitleTextAttributes (TextAttributes attributes, UIControl { if (attributes is null) throw new ArgumentNullException ("attributes"); -#if XAMCORE_3_0 var dict = attributes.Dictionary; -#else - using var dict = attributes.ToDictionary (); -#endif _SetTitleTextAttributes (dict, state); } diff --git a/src/UIKit/UICollectionViewTransitionLayout.cs b/src/UIKit/UICollectionViewTransitionLayout.cs deleted file mode 100644 index a23a7c3bb6dd..000000000000 --- a/src/UIKit/UICollectionViewTransitionLayout.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -namespace UIKit { - - public partial class UICollectionViewTransitionLayout { - [Obsolete ("iOS9 does not allow creating an empty instance")] - public UICollectionViewTransitionLayout () - { - } - } -} - -#endif diff --git a/src/UIKit/UIDocumentMenuViewController.cs b/src/UIKit/UIDocumentMenuViewController.cs deleted file mode 100644 index a58d03d8f643..000000000000 --- a/src/UIKit/UIDocumentMenuViewController.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -namespace UIKit { - - public partial class UIDocumentMenuViewController { - [Obsolete ("iOS9 does not allow creating an empty instance")] - public UIDocumentMenuViewController () - { - } - } -} - -#endif diff --git a/src/UIKit/UIDocumentPickerViewController.cs b/src/UIKit/UIDocumentPickerViewController.cs deleted file mode 100644 index e14ea6212f45..000000000000 --- a/src/UIKit/UIDocumentPickerViewController.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -namespace UIKit { - - public partial class UIDocumentPickerViewController { - [Obsolete ("iOS9 does not allow creating an empty instance")] - public UIDocumentPickerViewController () - { - } - } -} - -#endif diff --git a/src/UIKit/UIEnums.cs b/src/UIKit/UIEnums.cs index 1d98f61689c9..2267f8c047fa 100644 --- a/src/UIKit/UIEnums.cs +++ b/src/UIKit/UIEnums.cs @@ -2146,6 +2146,10 @@ public enum UIPressType : long { [NoiOS] [NoMacCatalyst] PageDown = 31, + [TV (18, 1), NoiOS, NoMacCatalyst] + TVRemoteOneTwoThree = 32, + [TV (18, 1), NoiOS, NoMacCatalyst] + TVRemoteFourColors = 33, } [NoWatch] @@ -2833,7 +2837,9 @@ public enum UIMenuIdentifier { [TV (17, 0), iOS (17, 0), MacCatalyst (17, 0)] [Field ("UIMenuAutoFill")] AutoFill, - + [TV (18, 1), iOS (18, 1), MacCatalyst (18, 1)] + [Field ("UIMenuOpen")] + Open, } [iOS (13, 0), TV (13, 0), Watch (6, 0)] diff --git a/src/UIKit/UIPopoverPresentationController.cs b/src/UIKit/UIPopoverPresentationController.cs index 33c7d95788b5..61eb25a88b38 100644 --- a/src/UIKit/UIPopoverPresentationController.cs +++ b/src/UIKit/UIPopoverPresentationController.cs @@ -27,22 +27,6 @@ public virtual Type PopoverBackgroundViewType { } } } - -#if !XAMCORE_3_0 - public partial class UIPopoverPresentationControllerDelegate { - [Obsolete ("Use the overload with 'ref' parameters for 'targetRect' and 'inView'.")] - public virtual void WillRepositionPopover (UIPopoverPresentationController popoverPresentationController, CGRect targetRect, UIView inView) - { - } - } - - public static partial class UIPopoverPresentationControllerDelegate_Extensions { - [Obsolete ("Use the overload with 'ref' parameters for 'targetRect' and 'inView'.")] - public static void WillRepositionPopover (IUIPopoverPresentationControllerDelegate This, UIPopoverPresentationController popoverPresentationController, CGRect targetRect, UIView inView) - { - } - } -#endif } #endif // IOS diff --git a/src/UIKit/UIPrint.cs b/src/UIKit/UIPrint.cs deleted file mode 100644 index 910c97631804..000000000000 --- a/src/UIKit/UIPrint.cs +++ /dev/null @@ -1,24 +0,0 @@ -#if !XAMCORE_3_0 - -using System; -using System.Runtime.InteropServices; - -using Foundation; -using ObjCRuntime; - -namespace UIKit { - public static class UIPrint { - - static NSString _ErrorDomain; - public static NSString ErrorDomain { - get { - if (_ErrorDomain is null) - _ErrorDomain = Dlfcn.GetStringConstant (Libraries.UIKit.Handle, "UIPrintErrorDomain"); - return _ErrorDomain; - } - } - - } -} - -#endif diff --git a/src/UIKit/UIPrintInteractionController.cs b/src/UIKit/UIPrintInteractionController.cs deleted file mode 100644 index d397286d71bf..000000000000 --- a/src/UIKit/UIPrintInteractionController.cs +++ /dev/null @@ -1,10 +0,0 @@ -#if !XAMCORE_3_0 - -using Foundation; - -namespace UIKit { - public partial class UIPrintInteractionController : NSObject { - } -} - -#endif diff --git a/src/UIKit/UISearchBar.cs b/src/UIKit/UISearchBar.cs index 127880e23d3f..22e457e16fd8 100644 --- a/src/UIKit/UISearchBar.cs +++ b/src/UIKit/UISearchBar.cs @@ -11,11 +11,7 @@ using System; -#if XAMCORE_3_0 using TextAttributes = UIKit.UIStringAttributes; -#else -using TextAttributes = UIKit.UITextAttributes; -#endif namespace UIKit { public partial class UISearchBar { @@ -24,11 +20,7 @@ public void SetScopeBarButtonTitle (TextAttributes attributes, UIControlState st if (attributes is null) throw new ArgumentNullException ("attributes"); -#if XAMCORE_3_0 var dict = attributes.Dictionary; -#else - using var dict = attributes.ToDictionary (); -#endif _SetScopeBarButtonTitle (dict, state); } @@ -45,11 +37,7 @@ public void SetScopeBarButtonTitle (TextAttributes attributes, UIControlState st if (attributes is null) throw new ArgumentNullException ("attributes"); -#if XAMCORE_3_0 var dict = attributes.Dictionary; -#else - using var dict = attributes.ToDictionary (); -#endif _SetScopeBarButtonTitle (dict, state); } diff --git a/src/UIKit/UISimpleTextPrintFormatter.cs b/src/UIKit/UISimpleTextPrintFormatter.cs deleted file mode 100644 index e1641098f6bd..000000000000 --- a/src/UIKit/UISimpleTextPrintFormatter.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -// UISimpleTextPrintFormatter helpers -// -// Authors: -// Sebastien Pouliot -// -// Copyright 2013, 2015 Xamarin Inc. All rights reserved. -// - -#if IOS && !XAMCORE_3_0 - -namespace UIKit { - - public partial class UISimpleTextPrintFormatter : UIPrintFormatter { - - // since 7.0 GM calling `init` returns an instance where we can't call properties - // without an Objective-C exception. We work around this since it will accept a null string - public UISimpleTextPrintFormatter () : this ((string) null) - { - } - } -} - -#endif diff --git a/src/UIKit/UIStoryboardPopoverSegue.cs b/src/UIKit/UIStoryboardPopoverSegue.cs deleted file mode 100644 index 27610d0177d5..000000000000 --- a/src/UIKit/UIStoryboardPopoverSegue.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -namespace UIKit { - - public partial class UIStoryboardPopoverSegue { - [Obsolete ("iOS9 does not allow creating an empty instance")] - public UIStoryboardPopoverSegue () - { - } - } -} - -#endif diff --git a/src/UIKit/UIStoryboardSegue.cs b/src/UIKit/UIStoryboardSegue.cs deleted file mode 100644 index f0fb361e0f9c..000000000000 --- a/src/UIKit/UIStoryboardSegue.cs +++ /dev/null @@ -1,15 +0,0 @@ -#if !XAMCORE_3_0 - -using System; - -namespace UIKit { - - public partial class UIStoryboardSegue { - [Obsolete ("iOS9 does not allow creating an empty instance")] - public UIStoryboardSegue () - { - } - } -} - -#endif diff --git a/src/UIKit/UITraitCollection.cs b/src/UIKit/UITraitCollection.cs index 9dc58421e8ff..fa93b7330118 100644 --- a/src/UIKit/UITraitCollection.cs +++ b/src/UIKit/UITraitCollection.cs @@ -8,6 +8,8 @@ // using System; +using System.ComponentModel; + using ObjCRuntime; using Foundation; @@ -15,17 +17,22 @@ #nullable disable namespace UIKit { -#if !WATCH public partial class UITraitCollection { - -#if !NET - [Obsolete ("Please use the static 'Create' method instead.")] - public UITraitCollection FromPreferredContentSizeCategory (UIContentSizeCategory category) - => Create (category); -#endif - public static UITraitCollection Create (UIContentSizeCategory category) => FromPreferredContentSizeCategory (category.GetConstant ()); - } + +#if !XAMCORE_5_0 + [Obsolete ("Use the overload that takes a 'UITraitMutations' parameter instead.", false)] + [EditorBrowsable (EditorBrowsableState.Never)] + [SupportedOSPlatform ("tvos17.0")] + [SupportedOSPlatform ("ios17.0")] + [SupportedOSPlatform ("maccatalyst17.0")] + [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] + public virtual UITraitCollection GetTraitCollectionByModifyingTraits (Func mutations) + { + // there's nothing useful this method can do. + throw new NotSupportedException ($"Use the overload that takes a 'UITraitMutations' parameter instead."); + } #endif + } } diff --git a/src/Version.in b/src/Version.in deleted file mode 100644 index d78bda93422e..000000000000 --- a/src/Version.in +++ /dev/null @@ -1 +0,0 @@ -@VERSION@ diff --git a/src/accounts.cs b/src/accounts.cs index 736dd0eb9041..d9026e98ead5 100644 --- a/src/accounts.cs +++ b/src/accounts.cs @@ -41,12 +41,6 @@ interface ACAccount : NSSecureCoding { [Export ("initWithAccountType:")] NativeHandle Constructor (ACAccountType type); -#if !XAMCORE_3_0 - // now exposed with the corresponding EABluetoothAccessoryPickerError enum - [Field ("ACErrorDomain")] - NSString ErrorDomain { get; } -#endif - [NoMac] [MacCatalyst (13, 1)] [Export ("userFullName")] diff --git a/src/addressbookui.cs b/src/addressbookui.cs index efee55724a6a..9de7fe206f57 100644 --- a/src/addressbookui.cs +++ b/src/addressbookui.cs @@ -108,11 +108,7 @@ interface ABPeoplePickerNavigationController : UIAppearance { /// /// Apple documentation for ABPeoplePickerNavigationControllerDelegate [Deprecated (PlatformName.iOS, 9, 0, message: "Use the 'Contacts' API instead.")] -#if XAMCORE_3_0 [BaseType (typeof (NSObject))] -#else - [BaseType (typeof (UINavigationControllerDelegate))] -#endif [Model] [Protocol] interface ABPeoplePickerNavigationControllerDelegate { diff --git a/src/appkit.cs b/src/appkit.cs index 7d9e27e3bca0..4cfa7ff7548b 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -9288,10 +9288,13 @@ interface NSOpenPanel { [ForcedType] // different type used inside a sandbox NSOpenPanel OpenPanel { get; } +#if !XAMCORE_5_0 + [EditorBrowsable (EditorBrowsableState.Never)] [Advice ("You must use 'OpenPanel' method if the application is sandboxed.")] [Deprecated (PlatformName.MacOSX, 10, 15, message: "All open panels now run out-of-process, use 'OpenPanel' method instead")] [Export ("init")] NativeHandle Constructor (); +#endif [Export ("URLs")] NSUrl [] Urls { get; } @@ -13627,10 +13630,13 @@ interface NSSavePanel { [ForcedType] // different type used inside a sandbox NSSavePanel SavePanel { get; } +#if !XAMCORE_5_0 [Advice ("You must use 'SavePanel' method if the application is sandboxed.")] [Deprecated (PlatformName.MacOSX, 10, 15, message: "All save panels now run out-of-process, use 'SavePanel' method instead")] + [EditorBrowsable (EditorBrowsableState.Never)] [Export ("init")] NativeHandle Constructor (); +#endif [Export ("URL")] NSUrl Url { get; } @@ -20450,8 +20456,23 @@ interface NSToolbarItem : NSCopying, NSMenuItemValidation, NSValidatedUserInterf [Export ("maxSize")] CGSize MaxSize { get; set; } +#if XAMCORE_5_0 + [Export ("visibilityPriority")] + NSToolbarItemVisibilityPriority VisibilityPriority { get; set; } +#else + /// Indicate which toolbar items should be kept when the toolbar space is limited. + /// + /// The valid values come from the enum, and they can be referenced as follows: + /// + /// + /// + /// [Export ("visibilityPriority")] nint VisibilityPriority { get; set; } +#endif [Export ("autovalidates")] bool Autovalidates { get; set; } @@ -28736,7 +28757,15 @@ interface NSSharingCollaborationModeRestriction : NSSecureCoding, NSCopying { string AlertRecoverySuggestionButtonTitle { get; } [Export ("alertRecoverySuggestionButtonLaunchURL", ArgumentSemantic.Copy), NullAllowed] - NSUrl AlertRecoverySuggestionButtonLaunchUrl { get; set; } +#if XAMCORE_5_0 + NSUrl AlertRecoverySuggestionButtonLaunchUrl { get; } +#else + NSUrl AlertRecoverySuggestionButtonLaunchUrl { + get; + [Obsolete ("Do not use, the native class doesn't have this setter.")] + set; + } +#endif [Export ("initWithDisabledMode:")] NativeHandle Constructor (NSSharingCollaborationMode disabledMode); @@ -28757,4 +28786,12 @@ interface NSViewContentSelectionInfo { [Export ("selectionAnchorRect")] CGRect /* NSRect */ SelectionAnchorRect { get; } } + + [Native] + enum NSToolbarItemVisibilityPriority : long { + Standard = 0, + Low = -1000, + High = 1000, + User = 2000, + } } diff --git a/src/bgen/Attributes.cs b/src/bgen/Attributes.cs index 0096d35b1d5f..9c5d819f7270 100644 --- a/src/bgen/Attributes.cs +++ b/src/bgen/Attributes.cs @@ -65,7 +65,6 @@ public ForcedTypeAttribute (bool owns = false) // // Valid on return values and parameters // -// To protocolize newer versions, use [Protocolize (3)] for XAMCORE_3_0, [Protocolize (4)] for NET, etc // [Obsolete ("This attribute no longer has any effect; do not use")] public class ProtocolizeAttribute : Attribute { @@ -883,15 +882,6 @@ public class NoMethodAttribute : Attribute { } #if NET -public enum PlatformName : byte { - None, - MacOSX, - iOS, - WatchOS, - TvOS, - MacCatalyst, -} - public enum AvailabilityKind { Introduced, Deprecated, diff --git a/src/bgen/Extensions/PlatformNameExtensions.cs b/src/bgen/Extensions/PlatformNameExtensions.cs index 982e5eb1bd8f..ea0b3914cac9 100644 --- a/src/bgen/Extensions/PlatformNameExtensions.cs +++ b/src/bgen/Extensions/PlatformNameExtensions.cs @@ -1,132 +1,74 @@ -using System; -using System.IO; -using ObjCRuntime; -using Xamarin.Utils; +using System.Diagnostics.CodeAnalysis; public static class PlatformNameExtensions { - public static string GetApplicationClassName (this PlatformName currentPlatform) + public static bool TryGetApplicationClassName (this PlatformName currentPlatform, [NotNullWhen (true)] out string? className) { switch (currentPlatform) { case PlatformName.iOS: case PlatformName.WatchOS: case PlatformName.TvOS: case PlatformName.MacCatalyst: - return "UIApplication"; + className = "UIApplication"; + return true; case PlatformName.MacOSX: - return "NSApplication"; + className = "NSApplication"; + return true; default: - throw new BindingException (1047, currentPlatform); + className = null; + return false; } } - public static int GetXamcoreVersion (this PlatformName currentPlatform) - { -#if NET - return 4; -#else - switch (currentPlatform) { - case PlatformName.MacOSX: - case PlatformName.iOS: - return 2; - case PlatformName.TvOS: - case PlatformName.WatchOS: - return 3; - default: - return 4; - } -#endif - } - - public static string GetCoreImageMap (this PlatformName currentPlatform) + public static bool TryGetCoreImageMap (this PlatformName currentPlatform, [NotNullWhen (true)] out string? coreImageMap) { switch (currentPlatform) { case PlatformName.iOS: case PlatformName.WatchOS: case PlatformName.TvOS: case PlatformName.MacCatalyst: - return "CoreImage"; + coreImageMap = "CoreImage"; + return true; case PlatformName.MacOSX: - return "Quartz"; + coreImageMap = "Quartz"; + return true; default: - throw new BindingException (1047, currentPlatform); + coreImageMap = null; + return false; } } - public static string GetCoreServicesMap (this PlatformName currentPlatform) + public static bool TryGetCoreServicesMap (this PlatformName currentPlatform, [NotNullWhen (true)] out string? coreServicesMap) { switch (currentPlatform) { case PlatformName.iOS: case PlatformName.WatchOS: case PlatformName.TvOS: case PlatformName.MacCatalyst: - return "MobileCoreServices"; - case PlatformName.MacOSX: - return "CoreServices"; - default: - throw new BindingException (1047, currentPlatform); - } - } - - public static string GetPDFKitMap (this PlatformName currentPlatform) - { - switch (currentPlatform) { - case PlatformName.iOS: - case PlatformName.MacCatalyst: - return "PDFKit"; - case PlatformName.MacOSX: - return "Quartz"; - default: - throw new BindingException (1047, currentPlatform); - } - } - - public static ApplePlatform AsApplePlatform (this PlatformName platform) - { - switch (platform) { - case PlatformName.iOS: - return ApplePlatform.iOS; - case PlatformName.TvOS: - return ApplePlatform.TVOS; - case PlatformName.MacCatalyst: - return ApplePlatform.MacCatalyst; + coreServicesMap = "MobileCoreServices"; + return true; case PlatformName.MacOSX: - return ApplePlatform.MacOSX; - case PlatformName.WatchOS: - return ApplePlatform.WatchOS; - case PlatformName.None: - return ApplePlatform.None; + coreServicesMap = "CoreServices"; + return true; default: - throw new ArgumentOutOfRangeException (nameof (platform), platform, $"Unknown platform: {platform}"); + coreServicesMap = null; + return false; } } - static string GetSdkRoot (this PlatformName currentPlatform) + public static bool TryGetPDFKitMap (this PlatformName currentPlatform, [NotNullWhen (true)] out string? pdfKitMap) { switch (currentPlatform) { case PlatformName.iOS: - case PlatformName.WatchOS: - case PlatformName.TvOS: case PlatformName.MacCatalyst: - var sdkRoot = Environment.GetEnvironmentVariable ("MD_MTOUCH_SDK_ROOT"); - if (string.IsNullOrEmpty (sdkRoot)) - sdkRoot = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current"; - return sdkRoot; + pdfKitMap = "PDFKit"; + return true; case PlatformName.MacOSX: - var macSdkRoot = Environment.GetEnvironmentVariable ("XamarinMacFrameworkRoot"); - if (string.IsNullOrEmpty (macSdkRoot)) - macSdkRoot = "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current"; - return macSdkRoot; + pdfKitMap = "Quartz"; + return true; default: - throw new BindingException (1047, currentPlatform); + pdfKitMap = null; + return false; } } - - public static string GetPath (this PlatformName currentPlatform, params string [] paths) - { - var fullPaths = new string [paths.Length + 1]; - fullPaths [0] = currentPlatform.GetSdkRoot (); - Array.Copy (paths, 0, fullPaths, 1, paths.Length); - return Path.Combine (fullPaths); - } } diff --git a/src/bgen/Extensions/PlatformNameExtensionsBgen.cs b/src/bgen/Extensions/PlatformNameExtensionsBgen.cs new file mode 100644 index 000000000000..45e1a29ba443 --- /dev/null +++ b/src/bgen/Extensions/PlatformNameExtensionsBgen.cs @@ -0,0 +1,102 @@ +using System; +using System.IO; +using Xamarin.Utils; + +public static class PlatformNameExtensionsBgen { + + // wrapper that allows us to use the same code for rgen and bgen + public static string GetApplicationClassName (this PlatformName currentPlatform) + { + if (currentPlatform.TryGetApplicationClassName (out var applicationClassName)) + return applicationClassName; + throw new BindingException (1047, currentPlatform); + } + + public static string GetCoreImageMap (this PlatformName currentPlatform) + { + if (currentPlatform.TryGetCoreImageMap (out var coreImageMap)) + return coreImageMap; + throw new BindingException (1047, currentPlatform); + } + + public static string GetCoreServicesMap (this PlatformName currentPlatform) + { + if (currentPlatform.TryGetCoreServicesMap (out var coreServicesMap)) + return coreServicesMap; + throw new BindingException (1047, currentPlatform); + } + + public static string GetPDFKitMap (this PlatformName currentPlatform) + { + if (currentPlatform.TryGetPDFKitMap (out var pdfKitMap)) + return pdfKitMap; + throw new BindingException (1047, currentPlatform); + } + + public static int GetXamcoreVersion (this PlatformName currentPlatform) + { +#if NET + return 4; +#else + switch (currentPlatform) { + case PlatformName.MacOSX: + case PlatformName.iOS: + return 2; + case PlatformName.TvOS: + case PlatformName.WatchOS: + return 3; + default: + return 4; + } +#endif + } + + public static ApplePlatform AsApplePlatform (this PlatformName platform) + { + switch (platform) { + case PlatformName.iOS: + return ApplePlatform.iOS; + case PlatformName.TvOS: + return ApplePlatform.TVOS; + case PlatformName.MacCatalyst: + return ApplePlatform.MacCatalyst; + case PlatformName.MacOSX: + return ApplePlatform.MacOSX; + case PlatformName.WatchOS: + return ApplePlatform.WatchOS; + case PlatformName.None: + return ApplePlatform.None; + default: + throw new ArgumentOutOfRangeException (nameof (platform), platform, $"Unknown platform: {platform}"); + } + } + + static string GetSdkRoot (this PlatformName currentPlatform) + { + switch (currentPlatform) { + case PlatformName.iOS: + case PlatformName.WatchOS: + case PlatformName.TvOS: + case PlatformName.MacCatalyst: + var sdkRoot = Environment.GetEnvironmentVariable ("MD_MTOUCH_SDK_ROOT"); + if (string.IsNullOrEmpty (sdkRoot)) + sdkRoot = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current"; + return sdkRoot; + case PlatformName.MacOSX: + var macSdkRoot = Environment.GetEnvironmentVariable ("XamarinMacFrameworkRoot"); + if (string.IsNullOrEmpty (macSdkRoot)) + macSdkRoot = "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current"; + return macSdkRoot; + default: + throw new BindingException (1047, currentPlatform); + } + } + + public static string GetPath (this PlatformName currentPlatform, params string [] paths) + { + var fullPaths = new string [paths.Length + 1]; + fullPaths [0] = currentPlatform.GetSdkRoot (); + Array.Copy (paths, 0, fullPaths, 1, paths.Length); + return Path.Combine (fullPaths); + } +} diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 6752ee0530a7..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; @@ -1144,24 +1145,6 @@ bool GetNativeEnumToManagedExpression (Type enumType, out string preExpression, postExpression = string.Empty; } - // Check if we got UInt32.MaxValue, which should probably be UInt64.MaxValue (if the enum - // in question actually has that value at least). Same goes for Int32.MinValue/Int64.MinValue. - // var isDefined = enumType.IsEnumDefined (maxValue); - var definedMaxField = enumType.GetFields ().Where (v => v.IsLiteral).FirstOrDefault (isMaxDefinedFunc); - if (definedMaxField is not null && postproc is not null) { - postproc.AppendLine ("#if ARCH_32"); - postproc.AppendFormat ("if (({0}) ret == ({0}) {1}.MaxValue)\n", underlyingTypeName, itype); - postproc.AppendFormat ("\tret = {0}.{1}; // = {2}.MaxValue\n", renderedEnumType, definedMaxField.Name, underlyingTypeName); - if (underlyingEnumType == TypeCache.System_Int64) { - var definedMinField = enumType.GetFields ().Where (v => v.IsLiteral).FirstOrDefault (isMinDefinedFunc); - if (definedMinField is not null) { - postproc.AppendFormat ("else if (({0}) ret == ({0}) {1}.MinValue)\n", underlyingTypeName, itype); - postproc.AppendFormat ("\tret = {0}.{1}; // = {2}.MinValue\n", renderedEnumType, definedMinField.Name, underlyingTypeName); - } - } - postproc.AppendLine ("#endif"); - } - return true; } @@ -2918,7 +2901,7 @@ void GetReturnsWrappers (MethodInfo mi, MemberInformation minfo, Type declaringT // protocol support means we can return interfaces and, as far as .NET knows, they might not be NSObject if (IsProtocolInterface (mi.ReturnType)) { cast_a = " Runtime.GetINativeObject<" + TypeManager.FormatType (minfo?.type ?? mi.DeclaringType, mi.ReturnType) + "> ("; - cast_b = ", false)!"; + cast_b = $", {(minfo?.is_return_release == true ? "true" : "false")})!"; } else if (minfo is not null && minfo.is_forced) { cast_a = " Runtime.GetINativeObject<" + TypeManager.FormatType (minfo.type, mi.ReturnType) + "> ("; cast_b = $", true, {minfo.is_forced_owns})!"; @@ -3253,22 +3236,6 @@ AvailabilityBaseAttribute GetIntroduced (MethodInfo mi, PropertyInfo pi) return mi.GetAvailability (AvailabilityKind.Introduced, this) ?? pi.GetAvailability (AvailabilityKind.Introduced, this); } - bool Is64BitiOSOnly (ICustomAttributeProvider provider) - { - if (BindThirdPartyLibrary) - return false; - if (BindingTouch.CurrentPlatform != PlatformName.iOS) - return false; - var attrib = provider.GetAvailability (AvailabilityKind.Introduced, this); - if (attrib is null) { - var minfo = provider as MemberInfo; - if (minfo is not null && minfo.DeclaringType is not null) - return Is64BitiOSOnly (minfo.DeclaringType); - return false; - } - return attrib.Version?.Major >= 11; - } - // // Generates the code necessary to lower the MonoTouch-APIs to something suitable // to be passed to Objective-C. @@ -3686,7 +3653,7 @@ public void GenerateMethodBody (MemberInformation minfo, MethodInfo mi, string s if (shouldMarshalNativeExceptions) print ("Runtime.ThrowException (exception_gchandle);"); - if (minfo.is_return_release) { + if (minfo.is_return_release && !IsProtocolInterface (mi.ReturnType)) { // Make sure we generate the required signature in Messaging only if needed // bool_objc_msgSendSuper_IntPtr: for respondsToSelector: @@ -4205,12 +4172,6 @@ void GenerateProperty (Type type, PropertyInfo pi, List instance_fields_ #endif } else { print ("get {"); - var is32BitNotSupported = Is64BitiOSOnly (pi); - if (is32BitNotSupported) { - print ("#if ARCH_32"); - print ("\tthrow new PlatformNotSupportedException (\"This API is not supported on this version of iOS\");"); - print ("#else"); - } if (debug) print ("Console.WriteLine (\"In {0}\");", pi.GetGetMethod ()); if (is_model) @@ -4237,8 +4198,6 @@ void GenerateProperty (Type type, PropertyInfo pi, List instance_fields_ indent--; } } - if (is32BitNotSupported) - print ("#endif"); print ("}\n"); } } @@ -4279,12 +4238,6 @@ void GenerateProperty (Type type, PropertyInfo pi, List instance_fields_ #endif } else { print ("set {"); - var is32BitNotSupported = Is64BitiOSOnly (pi); - if (is32BitNotSupported) { - print ("#if ARCH_32"); - print ("\tthrow new PlatformNotSupportedException (\"This API is not supported on this version of iOS\");"); - print ("#else"); - } if (debug) print ("Console.WriteLine (\"In {0}\");", pi.GetSetMethod ()); @@ -4312,8 +4265,6 @@ void GenerateProperty (Type type, PropertyInfo pi, List instance_fields_ } } } - if (is32BitNotSupported) - print ("#endif"); print ("}"); } } @@ -4655,12 +4606,6 @@ void GenerateMethod (MemberInformation minfo) print ("{"); - var is32BitNotSupported = Is64BitiOSOnly ((ICustomAttributeProvider) minfo.Method ?? minfo.Property); - if (is32BitNotSupported) { - print ("#if ARCH_32"); - print ("\tthrow new PlatformNotSupportedException (\"This API is not supported on this version of iOS\");"); - print ("#else"); - } if (debug) print ("\tConsole.WriteLine (\"In {0}\");", mi); @@ -4703,8 +4648,6 @@ void GenerateMethod (MemberInformation minfo) indent--; } } - if (is32BitNotSupported) - print ("#endif"); print ("}\n"); } @@ -5688,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; @@ -5957,18 +5907,7 @@ public void Generate (Type type) if (!is_model) { print_generated_code (); - var is32BitNotSupported = Is64BitiOSOnly (type); - if (is32BitNotSupported) { - // potentially avoid a .cctor and extra, unusable code - print ("#if ARCH_32"); - print ("#pragma warning disable {0}", is_static_class ? "169" : "649"); - print ("static readonly {0} class_ptr;", NativeHandleType); - print ("#pragma warning restore {0}", is_static_class ? "169" : "649"); - print ("#else"); - } print ("static readonly {1} class_ptr = Class.GetHandle (\"{0}\");", objc_type_name, NativeHandleType); - if (is32BitNotSupported) - print ("#endif"); print (""); } } @@ -6016,7 +5955,6 @@ public void Generate (Type type) var initSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"init\")" : "Selector.Init"; var initWithCoderSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"initWithCoder:\")" : "Selector.InitWithCoder"; string v = (class_mod == "abstract " && default_ctor_visibility is null) ? "protected" : ctor_visibility; - var is32BitNotSupported = Is64BitiOSOnly (type); if (external) { if (!disable_default_ctor) { if (BindingTouch.SupportsXmlDocumentation) { @@ -6029,19 +5967,12 @@ public void Generate (Type type) sw.WriteLine ("\t\t[Export (\"init\")]"); sw.WriteLine ("\t\t{0} {1} () : base (NSObjectFlag.Empty)", v, TypeName); sw.WriteLine ("\t\t{"); - if (is32BitNotSupported) { - sw.WriteLine ("\t\t#if ARCH_32"); - sw.WriteLine ("\tthrow new PlatformNotSupportedException (\"This API is not supported on this version of iOS\");"); - sw.WriteLine ("\t\t#else"); - } if (is_direct_binding_value is not null) sw.WriteLine ("\t\t\tIsDirectBinding = {0};", is_direct_binding_value); if (debug) sw.WriteLine ("\t\t\tConsole.WriteLine (\"{0}.ctor ()\");", TypeName); sw.WriteLine ("\t\t\tInitializeHandle (global::{1}.IntPtr_objc_msgSend (this.Handle, global::ObjCRuntime.{0}), \"init\");", initSelector, NamespaceCache.Messaging); sw.WriteLine ("\t\t\t"); - if (is32BitNotSupported) - sw.WriteLine ("\t\t#endif"); sw.WriteLine ("\t\t}"); } } else { @@ -6056,11 +5987,6 @@ public void Generate (Type type) sw.WriteLine ("\t\t[Export (\"init\")]"); sw.WriteLine ("\t\t{0} {1} () : base (NSObjectFlag.Empty)", v, TypeName); sw.WriteLine ("\t\t{"); - if (is32BitNotSupported) { - sw.WriteLine ("\t\t#if ARCH_32"); - sw.WriteLine ("\tthrow new PlatformNotSupportedException (\"This API is not supported on this version of iOS\");"); - sw.WriteLine ("\t\t#else"); - } if (type_needs_thread_checks) { sw.Write ("\t\t\t"); GenerateThreadCheck (sw); @@ -6071,8 +5997,6 @@ public void Generate (Type type) () => string.Format ("InitializeHandle (global::{1}.IntPtr_objc_msgSendSuper (this.SuperHandle, global::ObjCRuntime.{0}), \"init\");", initSelector, NamespaceCache.Messaging)); WriteMarkDirtyIfDerived (sw, type); - if (is32BitNotSupported) - sw.WriteLine ("\t\t#endif"); sw.WriteLine ("\t\t}"); sw.WriteLine (); } @@ -6093,11 +6017,6 @@ public void Generate (Type type) sw.WriteLine ("\t\t[Export (\"initWithCoder:\")]"); sw.WriteLine ("\t\t{0} {1} (NSCoder coder) : base (NSObjectFlag.Empty)", v, TypeName); sw.WriteLine ("\t\t{"); - if (is32BitNotSupported) { - sw.WriteLine ("\t\t#if ARCH_32"); - sw.WriteLine ("\tthrow new PlatformNotSupportedException (\"This API is not supported on this version of iOS\");"); - sw.WriteLine ("\t\t#else"); - } if (nscoding) { if (debug) sw.WriteLine ("\t\t\tConsole.WriteLine (\"{0}.ctor (NSCoder)\");", TypeName); @@ -6113,8 +6032,6 @@ public void Generate (Type type) } else { sw.WriteLine ("\t\t\tthrow new InvalidOperationException (\"Type does not conform to NSCoding\");"); } - if (is32BitNotSupported) - sw.WriteLine ("\t\t#endif"); sw.WriteLine ("\t\t}"); sw.WriteLine (); } diff --git a/src/bgen/PlatformName.cs b/src/bgen/PlatformName.cs new file mode 100644 index 000000000000..c17caa5d6bf4 --- /dev/null +++ b/src/bgen/PlatformName.cs @@ -0,0 +1,8 @@ +public enum PlatformName : byte { + None, + MacOSX, + iOS, + WatchOS, + TvOS, + MacCatalyst, +} diff --git a/src/bgen/bgen.csproj b/src/bgen/bgen.csproj index db14ea38600f..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 @@ -34,7 +38,7 @@ - + diff --git a/src/bmac.ikvm b/src/bmac.ikvm deleted file mode 100755 index d7b17b1f3b94..000000000000 --- a/src/bmac.ikvm +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -sdk= -new_style= -refs= -full_profile= -mobile_profile= - -BIN_DIR=`dirname $0` -if [ `basename $BIN_DIR` == "Commands" ]; then -BIN_DIR="`dirname $BIN_DIR`/Versions/Current/bin" -fi - -ROOT_DIR=$BIN_DIR/.. - -bgen_path=$BIN_DIR/bgen - -btouch_arguments=() -for arg in "$@"; do - if [[ $sdk == next-arg ]]; then - sdk=$arg - elif [[ $arg =~ ^(/|-{1,2})sdk ]]; then - sdk=${arg#*=}; sdk=${sdk#*:} - if [[ $sdk == $arg ]]; then - sdk=next-arg - fi - elif [[ $arg =~ ^(/|-{1,2})new-style$ ]]; then - new_style=1 - mobile_profile=1 - continue - elif [[ $arg =~ ^(/|-{1,2})unified-full-profile$ ]]; then - full_profile=1 - new_style=1 - elif [[ $arg =~ ^(/|-{1,2})unified-mobile-profile$ ]]; then - mobile_profile=1 - new_style=1 - fi - btouch_arguments+=("${arg}") -done - -sdk=$(echo $sdk | tr '[:upper:]' '[:lower:]') - -case $sdk in -xammac) - echo "error BI0087: bgen-classic: Xamarin.Mac Classic binding projects are not supported anymore. Please upgrade the binding project to a Xamarin.Mac Unified binding project." - exit 1 - ;; -mobile|xamarin.mac) - refs="--target-framework=Xamarin.Mac,Version=v2.0,Profile=Mobile" - ;; -*) - if [[ -z "$new_style" ]]; then - echo "error BI0087: bgen-classic: Xamarin.Mac Classic binding projects are not supported anymore. Please upgrade the binding project to a Xamarin.Mac Unified binding project." - exit 1 - else - if [[ "$full_profile" -eq 1 ]]; then - refs="--target-framework=Xamarin.Mac,Version=v4.5,Profile=Full" - elif [[ "$mobile_profile" -eq 1 ]]; then - refs="--target-framework=Xamarin.Mac,Version=v2.0,Profile=Mobile" - else - refs="--target-framework=Xamarin.Mac,Version=v4.5,Profile=System" - fi - fi - ;; -esac - -exec $bgen_path $refs "${btouch_arguments[@]}" diff --git a/src/btouch-native b/src/btouch-native deleted file mode 100755 index 20078f9d54b5..000000000000 --- a/src/btouch-native +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -e - -pushd "$(dirname "$0")/.." > /dev/null -MONOTOUCH_PREFIX=$(pwd -P) -popd > /dev/null - -exec /Library/Frameworks/Mono.framework/Commands/mono64 --debug "$MONOTOUCH_PREFIX/lib/bgen/bgen.exe" --target-framework=Xamarin.iOS,v1.0 "$@" diff --git a/src/btouch-native.in b/src/btouch-native.in deleted file mode 100644 index da7fddb2805a..000000000000 --- a/src/btouch-native.in +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -MONO_PATH=@MONOTOUCH_PREFIX@/lib/mono/Xamarin.iOS @MONOTOUCH_PREFIX@/bin/btouch-mono --debug @MONOTOUCH_PREFIX@/lib/btouch/btouch-native.exe --target-framework=Xamarin.iOS,v1.0 "$@" diff --git a/src/btv b/src/btv deleted file mode 100755 index a39374179b10..000000000000 --- a/src/btv +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -e - -pushd "$(dirname "$0")/.." > /dev/null -MONOTOUCH_PREFIX=$(pwd -P) -popd > /dev/null - -exec /Library/Frameworks/Mono.framework/Commands/mono64 --debug "$MONOTOUCH_PREFIX/lib/bgen/bgen.exe" --target-framework=Xamarin.TVOS,v1.0 "$@" diff --git a/src/build/generator-frameworks.g.cs b/src/build/dotnet/generator-frameworks.g.cs similarity index 100% rename from src/build/generator-frameworks.g.cs rename to src/build/dotnet/generator-frameworks.g.cs diff --git a/src/bwatch b/src/bwatch deleted file mode 100755 index f5cefb38821c..000000000000 --- a/src/bwatch +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -e - -pushd "$(dirname "$0")/.." > /dev/null -MONOTOUCH_PREFIX=$(pwd -P) -popd > /dev/null - -exec /Library/Frameworks/Mono.framework/Commands/mono64 --debug "$MONOTOUCH_PREFIX/lib/bgen/bgen.exe" --target-framework=Xamarin.WatchOS,v1.0 "$@" diff --git a/src/bwatch.in b/src/bwatch.in deleted file mode 100644 index dc8a288442aa..000000000000 --- a/src/bwatch.in +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -MONO_PATH=@MONOTOUCH_PREFIX@/lib/mono/Xamarin.WatchOS @MONOTOUCH_PREFIX@/bin/bwatch-mono --debug @MONOTOUCH_PREFIX@/lib/bwatch/bwatch.exe "$@" - diff --git a/src/cloudkit.cs b/src/cloudkit.cs index 1006e2274762..0488be7e6acd 100644 --- a/src/cloudkit.cs +++ b/src/cloudkit.cs @@ -508,12 +508,6 @@ interface CKDiscoveredUserInfo : NSCoding, NSCopying, NSSecureCoding { [MacCatalyst (13, 1)] [Static] interface CKErrorFields { -#if !XAMCORE_3_0 - // now exposed with the corresponding CKErrorCode enum - [Field ("CKErrorDomain")] - NSString ErrorDomain { get; } -#endif - [Field ("CKPartialErrorsByItemIDKey")] NSString PartialErrorsByItemIdKey { get; } diff --git a/src/contacts.cs b/src/contacts.cs index 956bbc178b92..c87a195a7f36 100644 --- a/src/contacts.cs +++ b/src/contacts.cs @@ -161,12 +161,6 @@ interface CNContact : NSCopying, NSMutableCopying, NSSecureCoding, NSItemProvide [Field ("CNContactPropertyNotFetchedExceptionName")] NSString PropertyNotFetchedExceptionName { get; } -#if !XAMCORE_3_0 - // now exposed with the corresponding CNErrorCode enum - [Field ("CNErrorDomain")] - NSString ErrorDomain { get; } -#endif - // CNContact_PredicatesExtension - they should be in a [Category] but it makes // [Static] API hard (and ugly) to use since they become extension methods (and // do not look static anymore. diff --git a/src/corebluetooth.cs b/src/corebluetooth.cs index ef2f88aeb79a..7bade79a4a39 100644 --- a/src/corebluetooth.cs +++ b/src/corebluetooth.cs @@ -825,18 +825,6 @@ interface CBUUID : NSCopying { [Export ("UUIDWithNSUUID:")] CBUUID FromNSUuid (NSUuid theUUID); -#if !XAMCORE_3_0 && !NET - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDGenericAccessProfileString")] - NSString GenericAccessProfileString { get; } - - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDGenericAttributeProfileString")] - NSString GenericAttributeProfileString { get; } -#endif // !XAMCORE_3_0 && !NET - [Field ("CBUUIDCharacteristicExtendedPropertiesString")] NSString CharacteristicExtendedPropertiesString { get; } @@ -883,38 +871,6 @@ interface CBUUID : NSCopying { [Field ("CBUUIDL2CAPPSMCharacteristicString")] NSString L2CapPsmCharacteristicString { get; } -#if !XAMCORE_3_0 && !NET - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDDeviceNameString")] - NSString DeviceNameString { get; } - - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDAppearanceString")] - NSString AppearanceString { get; } - - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDPeripheralPrivacyFlagString")] - NSString PeripheralPrivacyFlagString { get; } - - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDReconnectionAddressString")] - NSString ReconnectionAddressString { get; } - - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDPeripheralPreferredConnectionParametersString")] - NSString PeripheralPreferredConnectionParametersString { get; } - - [Deprecated (PlatformName.iOS, 7, 0)] - [Obsoleted (PlatformName.iOS, 9, 0)] - [Field ("CBUUIDServiceChangedString")] - NSString ServiceChangedString { get; } -#endif // !XAMCORE_3_0 && !NET - [MacCatalyst (13, 1)] [Export ("UUIDString")] string Uuid { get; } diff --git a/src/coreimage.cs b/src/coreimage.cs index a2c5dec598fe..798d35cc86f5 100644 --- a/src/coreimage.cs +++ b/src/coreimage.cs @@ -5597,12 +5597,6 @@ interface CISunbeamsGenerator : CISunbeamsGeneratorProtocol { [CoreImageFilterProperty ("inputCenter")] CIVector Center { get; set; } #endif - -#if !XAMCORE_3_0 - // binding mistake - it should never been added - [CoreImageFilterProperty ("inputCropAmount")] - float CropAmount { get; set; } -#endif } /// The CIFaceBalance CoreImage filter @@ -10274,6 +10268,18 @@ interface CIAreaBoundsRed : CIAreaBoundsRedProtocol { [Protocol (Name = "CIAreaBoundsRed")] interface CIAreaBoundsRedProtocol : CIAreaReductionFilterProtocol { } + + [CoreImageFilter] + [TV (18, 1), Mac (15, 1), iOS (18, 1), MacCatalyst (18, 1)] + [BaseType (typeof (CIFilter))] + interface CIDistanceGradientFromRedMask : CIFilterProtocol { + + [CoreImageFilterProperty ("inputImage")] + CIImage InputImage { get; set; } + + [CoreImageFilterProperty ("inputMaximumDistance")] + int MaximumDistance { get; set; } + } #endregion } diff --git a/src/corevideo.cs b/src/corevideo.cs index 91deb76a3b95..fa439996ba14 100644 --- a/src/corevideo.cs +++ b/src/corevideo.cs @@ -519,11 +519,7 @@ interface CVPixelBuffer { /// A reusable set of s. [Partial] -#if XAMCORE_3_0 interface CVPixelBufferPool { -#else - interface CVPixelBufferPool : CVImageBuffer { -#endif [Field ("kCVPixelBufferPoolMinimumBufferCountKey")] NSString MinimumBufferCountKey { get; } diff --git a/src/cryptotokenkit.cs b/src/cryptotokenkit.cs index 3f09ea6932c4..301d9358c5ab 100644 --- a/src/cryptotokenkit.cs +++ b/src/cryptotokenkit.cs @@ -2,7 +2,7 @@ // Let's hope that by .NET 10 we've ironed out all the bugs in the API. // This can of course be adjusted as needed (until we've released as stable). -#if NET100_0_OR_GREATER +#if NET10_0_OR_GREATER #define STABLE_CRYPTOTOKENKIT #endif diff --git a/src/custom-make.sh b/src/custom-make.sh deleted file mode 100755 index 4a258c3834a3..000000000000 --- a/src/custom-make.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -ex - -# -# This is a hack to make monotouch.csproj compile in XS. A big hack. -# - -make -j20 \ No newline at end of file diff --git a/src/dotnet.tmpl.csproj b/src/dotnet.tmpl.csproj index d72b0bc5f096..f6ac0a948d8f 100644 --- a/src/dotnet.tmpl.csproj +++ b/src/dotnet.tmpl.csproj @@ -21,7 +21,7 @@ ..\..\..\..\rsp\ios-defines.rsp - $(DefineConstants);__TVOS__;TVOS;MONOTOUCH;IPHONE;XAMCORE_3_0;SYSTEM_NET_HTTP + $(DefineConstants);__TVOS__;TVOS;MONOTOUCH;IPHONE;SYSTEM_NET_HTTP ..\..\..\..\rsp\tvos-defines.rsp diff --git a/src/eventkit.cs b/src/eventkit.cs index 85cfeaf1fb0b..3ab42cd1ba56 100644 --- a/src/eventkit.cs +++ b/src/eventkit.cs @@ -398,9 +398,7 @@ interface EKEvent { /// /// Apple documentation for EKParticipant [BaseType (typeof (EKObject))] -#if XAMCORE_3_0 [DisableDefaultCtor] -#endif interface EKParticipant : NSCopying { [Export ("URL")] NSUrl Url { get; } diff --git a/src/eventkitui.cs b/src/eventkitui.cs index 281677304fce..8c0a03acbd18 100644 --- a/src/eventkitui.cs +++ b/src/eventkitui.cs @@ -139,10 +139,6 @@ interface EKCalendarChooser { [Export ("selectionStyle")] EKCalendarChooserSelectionStyle SelectionStyle { get; -#if !XAMCORE_3_0 - [NotImplemented] - set; -#endif } [Export ("delegate", ArgumentSemantic.Weak), NullAllowed] diff --git a/src/externalaccessory.cs b/src/externalaccessory.cs index 8f68fe1a7efc..82bac4fbb29d 100644 --- a/src/externalaccessory.cs +++ b/src/externalaccessory.cs @@ -113,12 +113,6 @@ interface EAAccessoryManager { [Notification (typeof (EAAccessoryEventArgs))] NSString DidDisconnectNotification { get; } -#if !XAMCORE_3_0 && !MONOMAC - // now exposed with the corresponding EABluetoothAccessoryPickerError enum - [Field ("EABluetoothAccessoryPickerErrorDomain")] - NSString BluetoothAccessoryPickerErrorDomain { get; } -#endif - // [Introduced (PlatformName.MacCatalyst, 14, 0)] [NoMacCatalyst] // selector does not respond [NoMac] diff --git a/src/foundation.cs b/src/foundation.cs index e0966fa0714d..c74a77d22a0e 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -4622,28 +4622,6 @@ interface NSError : NSSecureCoding, NSCopying { [Field ("CarPlayErrorDomain", "CarPlay")] NSString CarPlayErrorDomain { get; } -#if !XAMCORE_3_0 - // now exposed with the corresponding EABluetoothAccessoryPickerError enum - [NoMac, NoTV, NoWatch] - [MacCatalyst (13, 1)] - [Field ("EABluetoothAccessoryPickerErrorDomain", "ExternalAccessory")] - NSString EABluetoothAccessoryPickerErrorDomain { get; } - - // now exposed with the corresponding MKErrorCode enum - [NoMac] - [NoWatch] - [MacCatalyst (13, 1)] - [Field ("MKErrorDomain", "MapKit")] - NSString MapKitErrorDomain { get; } - - // now exposed with the corresponding WKErrorCode enum - [NoMac, NoTV] - [Unavailable (PlatformName.iOS)] - [MacCatalyst (13, 1)] - [Field ("WatchKitErrorDomain", "WatchKit")] - NSString WatchKitErrorDomain { get; } -#endif - [Field ("NSUnderlyingErrorKey")] NSString UnderlyingErrorKey { get; } @@ -7718,14 +7696,7 @@ interface NSUrlCredentialStorage { } -#if NET - delegate void NSUrlSessionPendingTasks (NSUrlSessionTask [] dataTasks, NSUrlSessionTask [] uploadTasks, NSUrlSessionTask[] downloadTasks); -#elif XAMCORE_3_0 - delegate void NSUrlSessionPendingTasks2 (NSUrlSessionTask [] dataTasks, NSUrlSessionTask [] uploadTasks, NSUrlSessionTask[] downloadTasks); -#else - delegate void NSUrlSessionPendingTasks (NSUrlSessionDataTask [] dataTasks, NSUrlSessionUploadTask [] uploadTasks, NSUrlSessionDownloadTask [] downloadTasks); - delegate void NSUrlSessionPendingTasks2 (NSUrlSessionTask [] dataTasks, NSUrlSessionTask [] uploadTasks, NSUrlSessionTask [] downloadTasks); -#endif + delegate void NSUrlSessionPendingTasks (NSUrlSessionTask [] dataTasks, NSUrlSessionTask [] uploadTasks, NSUrlSessionTask [] downloadTasks); delegate void NSUrlSessionAllPendingTasks (NSUrlSessionTask [] tasks); delegate void NSUrlSessionResponse (NSData data, NSUrlResponse response, NSError error); delegate void NSUrlSessionDownloadResponse (NSUrl data, NSUrlResponse response, NSError error); @@ -7798,19 +7769,10 @@ partial interface NSUrlSession { [Async] void Flush (Action completionHandler); -#if !XAMCORE_3_0 - // broken version that we must keep for XAMCORE_3_0 binary compatibility - // but that we do not have to expose on tvOS and watchOS, forcing people to use the correct API - [Obsolete ("Use GetTasks2 instead. This method may throw spurious InvalidCastExceptions, in particular for backgrounded tasks.")] - [Export ("getTasksWithCompletionHandler:")] - [Async (ResultTypeName = "NSUrlSessionActiveTasks")] - void GetTasks (NSUrlSessionPendingTasks completionHandler); -#elif NET // Fixed version (breaking change) only for NET [Export ("getTasksWithCompletionHandler:")] - [Async (ResultTypeName="NSUrlSessionActiveTasks")] + [Async (ResultTypeName = "NSUrlSessionActiveTasks")] void GetTasks (NSUrlSessionPendingTasks completionHandler); -#endif #if !NET // Workaround, not needed for NET+ @@ -15607,16 +15569,6 @@ interface NSAppleEventDescriptor : NSSecureCoding, NSCopying { [Export ("initRecordDescriptor")] IntPtr _InitRecordDescriptor (); -#if !XAMCORE_3_0 - [Obsolete ("Use the constructor instead.")] - [Export ("initListDescriptor")] - NSObject InitListDescriptor (); - - [Obsolete ("Use the constructor instead.")] - [Export ("initRecordDescriptor")] - NSObject InitRecordDescriptor (); -#endif - /*[Export ("aeDesc")] const AEDesc AeDesc (); diff --git a/src/frameworks.sources b/src/frameworks.sources index 4de299e162b0..159d78088a97 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -203,7 +203,6 @@ AUDIOTOOLBOX_SOURCES = \ AudioToolbox/AudioFormatAvailability.cs \ AudioToolbox/AudioQueue.cs \ AudioToolbox/AudioServices.cs \ - AudioToolbox/AudioSession.cs \ AudioToolbox/AudioToolbox.cs \ AudioToolbox/SystemSound.cs \ AudioToolbox/MusicPlayer.cs \ @@ -277,8 +276,6 @@ AVFOUNDATION_SOURCES = \ AVFoundation/AVCompat.cs \ AVFoundation/AVContentKeyResponse.cs \ AVFoundation/AVDepthData.cs \ - AVFoundation/AVFragmentedAsset.cs \ - AVFoundation/AVFragmentedAssetTrack.cs \ AVFoundation/AVLayerVideoGravity.cs \ AVFoundation/AVMetadataItemFilter.cs \ AVFoundation/AVMetadataMachineReadableCodeObject.cs \ @@ -296,6 +293,7 @@ AVFOUNDATION_SOURCES = \ AVFoundation/Events.cs \ AVFoundation/AVPlayerLooper.cs \ AVFoundation/AudioRendererWasFlushedAutomaticallyEventArgs.cs \ + AVFoundation/AVCaptureReactionType.rgen.cs \ # AVKit @@ -418,7 +416,6 @@ CONTACTS_SOURCES = \ Contacts/CNContactFetchRequest.cs \ Contacts/CNContactStore.cs \ Contacts/CNInstantMessageAddress.cs \ - Contacts/CNObsolete.cs \ Contacts/CNSocialProfile.cs \ # CoreAnimation (this is really Quartz.framework) @@ -647,7 +644,6 @@ COREMOTION_CORE_SOURCES = \ CoreMotion/Defs.cs \ COREMOTION_SOURCES = \ - CoreMotion/CMCompat.cs \ CoreMotion/Extras.cs \ CoreMotion/CMSensorDataList.cs \ @@ -860,7 +856,6 @@ FOUNDATION_SOURCES = \ Foundation/NSDictionary.cs \ Foundation/NSDictionary_2.cs \ Foundation/NSDirectoryEnumerator.cs \ - Foundation/NSDistributedNotificationCenter.cs \ Foundation/NSEnumerator_1.cs \ Foundation/NSErrorException.cs \ Foundation/NSExceptionError.cs \ @@ -1017,7 +1012,6 @@ HEALTHKIT_SOURCES = \ HealthKit/HKAnchoredObjectQuery.cs \ HealthKit/HKCategoryValueSleepAnalysisAsleep.cs \ HealthKit/HKObjectType.cs \ - HealthKit/HKObsolete.cs \ HealthKit/HKSampleQuery.cs \ HealthKit/HKSupportFunctions.cs \ HealthKit/HKUnit.cs \ @@ -1163,7 +1157,6 @@ MAPKIT_CORE_SOURCES = \ MAPKIT_SOURCES = \ MapKit/MKAddressFilter.cs \ MapKit/MKCompat.cs \ - MapKit/MKDirections.cs \ MapKit/MKFeatureDisplayPriority.cs \ MapKit/MKGeodesicPolyline.cs \ MapKit/MKLocalSearch.cs \ @@ -1206,7 +1199,6 @@ MEDIAPLAYER_SOURCES = \ MediaPlayer/MPMediaQuery.cs \ MediaPlayer/MPMoviePlayerController.cs \ MediaPlayer/MPNowPlayingInfoCenter.cs \ - MediaPlayer/MPPlayableContentDelegate.cs \ MediaPlayer/MPRemoteCommandCenter.cs \ MediaPlayer/MPSkipIntervalCommand.cs \ MediaPlayer/MPVolumeSettings.cs \ @@ -1353,7 +1345,6 @@ MULTIPEERCONNECTIVITY_API_SOURCES = \ MultipeerConnectivity/Enums.cs \ MULTIPEERCONNECTIVITY_SOURCES = \ - MultipeerConnectivity/Compat.cs \ MultipeerConnectivity/MCSession.cs \ # Natural Language @@ -1632,7 +1623,6 @@ SCENEKIT_SOURCES = \ SceneKit/Constructors.cs \ SceneKit/SCNAnimatable.cs \ SceneKit/SCNCompat.cs \ - SceneKit/SCNGeometry.cs \ SceneKit/SCNGeometrySource.cs \ SceneKit/SCNJavaScript.cs \ SceneKit/SCNNode.cs \ @@ -1642,7 +1632,6 @@ SCENEKIT_SOURCES = \ SceneKit/SCNRenderingOptions.cs \ SceneKit/SCNScene.cs \ SceneKit/SCNSceneLoadingOptions.cs \ - SceneKit/SCNSceneRenderer.cs \ SceneKit/SCNSceneSource.cs \ SceneKit/SCNSkinner.cs \ SceneKit/SCNTechnique.cs \ @@ -1718,7 +1707,6 @@ SOCIAL_API_SOURCES = \ Social/Enums.cs \ SOCIAL_SOURCES = \ - Social/SLCompat.cs \ Social/SLComposeViewController.cs \ Social/SLRequest.cs \ @@ -1733,11 +1721,9 @@ SPRITEKIT_API_SOURCES = \ SpriteKit/Enums.cs \ SPRITEKIT_SOURCES = \ - SpriteKit/ObsoleteCompat.cs \ SpriteKit/SKAction.cs \ SpriteKit/SKKeyframeSequence.cs \ SpriteKit/SKNode.cs \ - SpriteKit/SKFieldNode.cs \ SpriteKit/SKShapeNode.cs \ SpriteKit/SKUniform.cs \ SpriteKit/SKVideoNode.cs \ @@ -1759,7 +1745,7 @@ STOREKIT_SOURCES = \ StoreKit/SKAdNetworkCompat.cs \ StoreKit/SKCloudServiceSetupOptions.cs \ StoreKit/SKPayment.cs \ - StoreKit/SKPaymentTransactionObserver.cs \ + StoreKit/SwiftAPI.cs \ # SystemConfiguration @@ -1790,9 +1776,6 @@ TVSERVICES_CORE_SOURCES = \ TWITTER_CORE_SOURCES = \ Twitter/Enums.cs \ -TWITTER_SOURCES = \ - Twitter/TWCompat.cs \ - # UIKit UIKIT_API_SOURCES = \ @@ -1802,7 +1785,6 @@ UIKIT_CORE_SOURCES = \ UIKit/UIFontDescriptor.cs \ UIKit/UIGuidedAccessRestriction.cs \ UIKit/UIOffset.cs \ - UIKit/UIPrintInteractionController.cs \ UIKit/UIStringAttributes.cs \ UIKit/UITypes.cs \ XKit/Types.cs \ @@ -1816,8 +1798,6 @@ UIKIT_SOURCES = \ UIKit/UIAccessibility.cs \ UIKit/UIAccessibilityCustomAction.cs \ UIKit/UIActionSheet.cs \ - UIKit/UIActivityItemProvider.cs \ - UIKit/UIActivityViewController.cs \ UIKit/UIAlertView.cs \ UIKit/UIAppearance.cs \ UIKit/UIApplication.cs \ @@ -1829,15 +1809,12 @@ UIKIT_SOURCES = \ UIKit/UICollectionView.cs \ UIKit/UICollectionViewLayout.cs \ UIKit/UICollectionViewLayoutAttributes.cs \ - UIKit/UICollectionViewTransitionLayout.cs \ UIKit/UIColor.cs \ UIKit/UIConfigurationColorTransformer.cs \ UIKit/UIContentSizeCategory.cs \ UIKit/UIControl.cs \ UIKit/UIDevice.cs \ UIKit/UIDocumentBrowserViewController.cs \ - UIKit/UIDocumentMenuViewController.cs \ - UIKit/UIDocumentPickerViewController.cs \ UIKit/UIDragDropSessionExtensions.cs \ UIKit/UIDynamicAnimator.cs \ UIKit/UIEnumsExtensions.cs \ @@ -1860,7 +1837,6 @@ UIKIT_SOURCES = \ UIKit/UIPickerView.cs \ UIKit/UIPopoverController.cs \ UIKit/UIPopoverPresentationController.cs \ - UIKit/UIPrint.cs \ UIKit/UIPushBehavior.cs \ UIKit/UIScreen.cs \ UIKit/UIScrollView.cs \ @@ -1868,9 +1844,6 @@ UIKIT_SOURCES = \ UIKit/UISearchController.cs \ UIKit/UISearchDisplayController.cs \ UIKit/UISegmentedControl.cs \ - UIKit/UISimpleTextPrintFormatter.cs \ - UIKit/UIStoryboardPopoverSegue.cs \ - UIKit/UIStoryboardSegue.cs \ UIKit/UIStringDrawing.cs \ UIKit/UITableView.cs \ UIKit/UITableViewCell.cs \ @@ -2012,7 +1985,9 @@ SHARED_CORE_SOURCES = \ DotNetGlobals.cs \ MinimumVersions.cs \ MonoPInvokeCallbackAttribute.cs \ - $(BUILD_DIR)/common/NativeTypes/Primitives.cs \ + ObjCBindings/BindingTypeAttribute.cs \ + ObjCBindings/FieldAttribute.cs \ + ObjCBindings/FieldTag.cs \ ObjCRuntime/ArgumentSemantic.cs \ ObjCRuntime/BindAsAttribute.cs \ ObjCRuntime/Blocks.cs \ @@ -2090,7 +2065,6 @@ SHARED_SOURCES = \ ObjCRuntime/RuntimeException.cs \ ObjCRuntime/RuntimeOptions.cs \ ObjCRuntime/Selector.mac.cs \ - ObjCRuntime/SelectorMarshaler.cs \ ObjCRuntime/Stret.cs \ ObjCRuntime/ThreadSafeAttribute.cs \ ObjCRuntime/TrampolineBlockBase.cs \ diff --git a/src/generate-defines.csharp b/src/generate-defines.csharp deleted file mode 100755 index b5431f765ac0..000000000000 --- a/src/generate-defines.csharp +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -using System.IO; -using System.Text; - -try { - var args = Args; - var expectedArgumentCount = 2; - if (args.Length != expectedArgumentCount) { - Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length} arguments"); - Environment.Exit (1); - return; - } - - var output = args [0]; - var frameworks = args [1].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - - var sb = new StringBuilder (); - foreach (var fw in frameworks.OrderBy (v => v)) - sb.AppendLine ($"-d:HAS_{fw.ToUpperInvariant ()}"); - File.WriteAllText (output, sb.ToString ()); - - Environment.Exit (0); -} catch (Exception e) { - Console.WriteLine ("Failed: {0}", e); - Environment.Exit (1); -} diff --git a/src/generate-errors.csharp b/src/generate-errors.csharp deleted file mode 100755 index 6a27fab4801c..000000000000 --- a/src/generate-errors.csharp +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -using System.IO; -using System.Xml; - -var args = Environment.GetCommandLineArgs (); -var dir = Path.GetDirectoryName (args [1]); -var file = Path.Combine (dir, "..", "tools", "mtouch", "Errors.resx"); -var doc = new XmlDocument (); -doc.Load (file); - -Console.Write ( -@"//------------------------------------------------------------------------------ -// -// This code was generated by a tool: generate-errors.csharp -// -//------------------------------------------------------------------------------ - -namespace Xamarin.Bundler { - internal class Errors { -"); - -foreach (XmlNode node in doc.SelectNodes ("/root/data")) { - var name = node.Attributes ["name"].InnerText; - if (name == "default") { - name = "@" + name; - } - var value = node.ChildNodes [1].InnerText - .Trim () - .Replace ("\\", "\\\\") - .Replace ("\"", "\\\""); - Console.WriteLine ($"\t\tinternal const string {name} = \"{value}\";"); -} - -Console.WriteLine ("\t}\n}"); - -Environment.Exit (0); diff --git a/src/generate-frameworks.csharp b/src/generate-frameworks.csharp deleted file mode 100755 index 78a106e67b18..000000000000 --- a/src/generate-frameworks.csharp +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -using System.IO; -using System.Text; - -try { - var args = Args; - var actualArgumentCount = 6; - if (args.Length != actualArgumentCount) { - Console.WriteLine ($"Need {actualArgumentCount} arguments, got {args.Length} arguments"); - Environment.Exit (1); - return; - } - - var csharpOutput = args [0]; - - args = args.Skip (1).ToArray (); - - var iosframeworks = args [0].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var macosframeworks = args [1].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var watchosframeworks = args [2].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var tvosframeworks = args [3].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var maccatalystframeworks = args [4].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); - var allframeworks = new string [] [] { - iosframeworks, - macosframeworks, - watchosframeworks, - tvosframeworks, - maccatalystframeworks, - }; - var names = new string [] { - "iosframeworks", - "macosframeworks", - "watchosframeworks", - "tvosframeworks", - "maccatalystframeworks", - }; - - var all = new HashSet (); - foreach (var fws in allframeworks) - foreach (var fw in fws) - all.Add (fw); - - var sb = new StringBuilder (); - sb.AppendLine ("using System.Collections.Generic;"); - sb.AppendLine (); - sb.AppendLine ("partial class Frameworks {"); - - for (int i = 0; i < names.Length; i++) { - var name = names [i]; - var frameworks = allframeworks [i]; - sb.AppendLine ($"\t// GENERATED FILE - DO NOT EDIT"); - sb.AppendLine ($"\tinternal readonly HashSet {name} = new HashSet {{"); - foreach (var fw in frameworks.OrderBy (v => v)) { - sb.AppendLine ($"\t\t\"{fw}\","); - } - sb.AppendLine ("\t};"); - } - - var allArray = all.ToArray (); - Array.Sort (allArray); - foreach (var fw in allArray) - sb.AppendLine ($"\tbool? _{fw.Replace (".", "")};"); - foreach (var fw in allArray) - sb.AppendLine ($"\tpublic bool Have{fw} {{ get {{ if (!_{fw}.HasValue) _{fw} = GetValue (\"{fw}\"); return _{fw}.Value; }} }}"); - sb.AppendLine ("}"); - - File.WriteAllText (csharpOutput, sb.ToString ()); - - Environment.Exit (0); -} catch (Exception e) { - Console.WriteLine ("Failed: {0}", e); - Environment.Exit (1); -} diff --git a/src/generate-sourcelink-json.csharp b/src/generate-sourcelink-json.csharp deleted file mode 100755 index 965628a5278d..000000000000 --- a/src/generate-sourcelink-json.csharp +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -using System.IO; -using System.Text; - -var args = Args; -var idx = 0; -var latestCommit = args [idx++]; -var src = args [idx++]; -var outputPath = args [idx++]; - -using (var writer = new StreamWriter (outputPath)) { - writer.WriteLine ("{"); - writer.WriteLine (" \"documents\": {"); - writer.WriteLine ($" \"{src}*\": \"https://raw.githubusercontent.com/xamarin/xamarin-macios/{latestCommit}/src*\""); - writer.WriteLine (" }"); - writer.WriteLine ("}"); -} - -Environment.Exit(0) diff --git a/src/generator.csproj b/src/generator.csproj deleted file mode 100644 index 04b1bb76380d..000000000000 --- a/src/generator.csproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - - Debug - AnyCPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790} - Exe - bgen - bgen - v4.6.1 - $(BUILD_DIR)\ - build\ - latest - 8601,8618 - Nullable - enable - - - True - full - False - build\common - build\IDE\obj\common\ - DEBUG;BGENERATOR;NET_4_0;NO_AUTHENTICODE;STATIC;NO_SYMBOL_WRITER - prompt - 4 - True - - - - - - - - - - - Project - - $(ProjectDir) - - - - - - - Project - @build/$(RunConfiguration).rsp - $(ProjectDir) - - - - - - Project - @build/$(RunConfiguration).rsp - $(ProjectDir) - - - - - - Project - @build/$(RunConfiguration).rsp - $(ProjectDir) - - - - - - Project - @build/$(RunConfiguration).rsp - $(ProjectDir) - - - - - - Project - @build/$(RunConfiguration).rsp - $(ProjectDir) - - - - - - Project - @build/$(RunConfiguration).rsp - $(ProjectDir) - - - - - - - generator-errors.md - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Execution.cs - - - NullableAttributes.cs - - - - - - - - - - - - - - - - - - - - - - - - Resources.resx - - - - Driver.execution.cs - - - SdkVersions.cs - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - diff --git a/src/generator.sln b/src/generator.sln deleted file mode 100644 index b46f33d7e410..000000000000 --- a/src/generator.sln +++ /dev/null @@ -1,51 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator", "generator.csproj", "{D2EE02C0-9BFD-477D-AC92-4DE2D8490790}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "generator-tests", "..\tests\generator\generator-tests.csproj", "{10790816-D00E-40A0-8653-2A8AB4DD33A9}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2EE02C0-9BFD-477D-AC92-4DE2D8490790}.Release|Any CPU.Build.0 = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10790816-D00E-40A0-8653-2A8AB4DD33A9}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - Policies = $0 - $0.TextStylePolicy = $1 - $1.FileWidth = 180 - $1.TabWidth = 8 - $1.IndentWidth = 8 - $1.scope = text/x-csharp - $0.CSharpFormattingPolicy = $2 - $2.IndentSwitchSection = False - $2.NewLinesForBracesInProperties = False - $2.NewLinesForBracesInAccessors = False - $2.NewLinesForBracesInAnonymousMethods = False - $2.NewLinesForBracesInControlBlocks = False - $2.NewLinesForBracesInAnonymousTypes = False - $2.NewLinesForBracesInObjectCollectionArrayInitializers = False - $2.NewLinesForBracesInLambdaExpressionBody = False - $2.NewLineForElse = False - $2.NewLineForCatch = False - $2.NewLineForFinally = False - $2.NewLineForMembersInObjectInit = False - $2.NewLineForMembersInAnonymousTypes = False - $2.NewLineForClausesInQuery = False - $2.SpacingAfterMethodDeclarationName = True - $2.SpaceAfterMethodCallName = True - $2.SpaceBeforeOpenSquareBracket = True - $2.scope = text/x-csharp - $2.SpaceAfterCast = True - EndGlobalSection -EndGlobal diff --git a/src/healthkit.cs b/src/healthkit.cs index 9ed4196da20d..8f17dea2e02b 100644 --- a/src/healthkit.cs +++ b/src/healthkit.cs @@ -206,6 +206,19 @@ public enum HKGad7AssessmentAnswer : long { NearlyEveryDay, } + [Watch (11, 1), MacCatalyst (18, 1), Mac (15, 1), iOS (18, 1)] + [Native] + public enum HKAudiogramConductionType : long { + Air = 0, + } + + [Watch (11, 1), MacCatalyst (18, 1), Mac (15, 1), iOS (18, 1)] + [Native] + public enum HKAudiogramSensitivityTestSide : long { + Left = 0, + Right = 1, + } + #if NET /// The completion handler for . /// Completion handler for anchored object queries. @@ -4540,16 +4553,38 @@ interface HKAudiogramSensitivityPoint : NSSecureCoding { [Export ("frequency", ArgumentSemantic.Copy)] HKQuantity Frequency { get; } + [Deprecated (PlatformName.iOS, 18, 1)] + [Deprecated (PlatformName.MacCatalyst, 18, 1)] + [Deprecated (PlatformName.MacOSX, 15, 1)] + [Deprecated (PlatformName.WatchOS, 11, 1)] [NullAllowed, Export ("leftEarSensitivity", ArgumentSemantic.Copy)] HKQuantity LeftEarSensitivity { get; } + [Deprecated (PlatformName.iOS, 18, 1)] + [Deprecated (PlatformName.MacCatalyst, 18, 1)] + [Deprecated (PlatformName.MacOSX, 15, 1)] + [Deprecated (PlatformName.WatchOS, 11, 1)] [NullAllowed, Export ("rightEarSensitivity", ArgumentSemantic.Copy)] HKQuantity RightEarSensitivity { get; } + [Deprecated (PlatformName.iOS, 18, 1, message: "Use the 'HKAudiogramSensitivityTest' overload instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use the 'HKAudiogramSensitivityTest' overload instead.")] + [Deprecated (PlatformName.MacOSX, 15, 1, message: "Use the 'HKAudiogramSensitivityTest' overload instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use the 'HKAudiogramSensitivityTest' overload instead.")] [Static] [Export ("sensitivityPointWithFrequency:leftEarSensitivity:rightEarSensitivity:error:")] [return: NullAllowed] HKAudiogramSensitivityPoint GetSensitivityPoint (HKQuantity frequency, [NullAllowed] HKQuantity leftEarSensitivity, [NullAllowed] HKQuantity rightEarSensitivity, [NullAllowed] out NSError error); + + [Watch (11, 1), MacCatalyst (18, 1), Mac (15, 1), iOS (18, 1)] + [Static] + [Export ("sensitivityPointWithFrequency:tests:error:")] + [return: NullAllowed] + HKAudiogramSensitivityPoint GetSensitivityPoint (HKQuantity frequency, HKAudiogramSensitivityTest [] tests, [NullAllowed] out NSError error); + + [Watch (11, 1), MacCatalyst (18, 1), Mac (15, 1), iOS (18, 1)] + [Export ("tests", ArgumentSemantic.Copy)] + HKAudiogramSensitivityTest [] Tests { get; } } [Watch (6, 0), iOS (13, 0), Mac (13, 0)] @@ -4560,9 +4595,18 @@ interface HKAudiogramSample { [Export ("sensitivityPoints", ArgumentSemantic.Copy)] HKAudiogramSensitivityPoint [] SensitivityPoints { get; } + [Deprecated (PlatformName.iOS, 18, 1, message: "Use the 'HKDevice' overload instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use the 'HKDevice' overload instead.")] + [Deprecated (PlatformName.MacOSX, 15, 1, message: "Use the 'HKDevice' overload instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use the 'HKDevice' overload instead.")] [Static] [Export ("audiogramSampleWithSensitivityPoints:startDate:endDate:metadata:")] HKAudiogramSample GetAudiogramSample (HKAudiogramSensitivityPoint [] sensitivityPoints, NSDate startDate, NSDate endDate, [NullAllowed] NSDictionary metadata); + + [Watch (11, 1), MacCatalyst (18, 1), Mac (15, 1), iOS (18, 1)] + [Static] + [Export ("audiogramSampleWithSensitivityPoints:startDate:endDate:device:metadata:")] + HKAudiogramSample GetAudiogramSample (HKAudiogramSensitivityPoint [] sensitivityPoints, NSDate startDate, NSDate endDate, [NullAllowed] HKDevice device, [NullAllowed] NSDictionary metadata); } [Watch (6, 0), iOS (13, 0), Mac (13, 0)] @@ -5326,4 +5370,45 @@ public enum HKAppleSleepingBreathingDisturbancesClassification : long { Elevated, } + [Watch (11, 1), MacCatalyst (18, 1), Mac (15, 1), iOS (18, 1)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface HKAudiogramSensitivityPointClampingRange : NSSecureCoding, NSCopying { + + [NullAllowed, Export ("lowerBound", ArgumentSemantic.Copy)] + HKQuantity LowerBound { get; } + + [NullAllowed, Export ("upperBound", ArgumentSemantic.Copy)] + HKQuantity UpperBound { get; } + + [Static] + [Export ("clampingRangeWithLowerBound:upperBound:error:")] + [return: NullAllowed] + HKAudiogramSensitivityPointClampingRange Create ([NullAllowed][BindAs (typeof (double?))] NSNumber lowerBound, [NullAllowed][BindAs (typeof (double?))] NSNumber upperBound, [NullAllowed] out NSError error); + } + + [Watch (11, 1), MacCatalyst (18, 1), Mac (15, 1), iOS (18, 1)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface HKAudiogramSensitivityTest : NSSecureCoding, NSCopying { + + [Export ("sensitivity", ArgumentSemantic.Copy)] + HKQuantity Sensitivity { get; } + + [Export ("type", ArgumentSemantic.Assign)] + HKAudiogramConductionType Type { get; } + + [Export ("masked")] + bool Masked { get; } + + [Export ("side", ArgumentSemantic.Assign)] + HKAudiogramSensitivityTestSide Side { get; } + + [NullAllowed, Export ("clampingRange", ArgumentSemantic.Copy)] + HKAudiogramSensitivityPointClampingRange ClampingRange { get; } + + [Export ("initWithSensitivity:type:masked:side:clampingRange:error:")] + NativeHandle Constructor (HKQuantity sensitivity, HKAudiogramConductionType type, bool masked, HKAudiogramSensitivityTestSide side, [NullAllowed] HKAudiogramSensitivityPointClampingRange clampingRange, [NullAllowed] out NSError error); + } + } diff --git a/src/homekit.cs b/src/homekit.cs index 30c78b1e9f8f..b3b85b21511e 100644 --- a/src/homekit.cs +++ b/src/homekit.cs @@ -580,32 +580,20 @@ partial interface HMCharacteristicWriteAction { [NoWatch] [MacCatalyst (13, 1)] [Export ("initWithCharacteristic:targetValue:")] -#if XAMCORE_3_0 NativeHandle Constructor (HMCharacteristic characteristic, INSCopying targetValue); -#else - NativeHandle Constructor (HMCharacteristic characteristic, NSObject targetValue); -#endif [Export ("characteristic", ArgumentSemantic.Retain)] HMCharacteristic Characteristic { get; } [Export ("targetValue", ArgumentSemantic.Copy)] -#if XAMCORE_3_0 INSCopying TargetValue { get; } -#else - NSObject TargetValue { get; } -#endif [NoTV] [NoWatch] [MacCatalyst (13, 1)] [Async] [Export ("updateTargetValue:completionHandler:")] -#if XAMCORE_3_0 void UpdateTargetValue (INSCopying targetValue, Action completion); -#else - void UpdateTargetValue (NSObject targetValue, Action completion); -#endif } [MacCatalyst (14, 0)] diff --git a/src/intents.cs b/src/intents.cs index 8fec14e7a42c..f4fed7017ce6 100644 --- a/src/intents.cs +++ b/src/intents.cs @@ -1459,11 +1459,29 @@ public enum INMessageType : long { DigitalTouch, Handwriting, Sticker, + [Deprecated (PlatformName.iOS, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use 'INMessageReaction' instead.")] TapbackLiked, + [Deprecated (PlatformName.iOS, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use 'INMessageReaction' instead.")] TapbackDisliked, + [Deprecated (PlatformName.iOS, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use 'INMessageReaction' instead.")] TapbackEmphasized, + [Deprecated (PlatformName.iOS, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use 'INMessageReaction' instead.")] TapbackLoved, + [Deprecated (PlatformName.iOS, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use 'INMessageReaction' instead.")] TapbackQuestioned, + [Deprecated (PlatformName.iOS, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.MacCatalyst, 18, 1, message: "Use 'INMessageReaction' instead.")] + [Deprecated (PlatformName.WatchOS, 11, 1, message: "Use 'INMessageReaction' instead.")] TapbackLaughed, MediaCalendar, MediaLocation, diff --git a/src/javascriptcore.cs b/src/javascriptcore.cs index 3494bcfded19..526bccf2b2b3 100644 --- a/src/javascriptcore.cs +++ b/src/javascriptcore.cs @@ -391,9 +391,7 @@ partial interface JSValue { /// Apple documentation for JSManagedValue [MacCatalyst (13, 1)] [BaseType (typeof (NSObject))] -#if XAMCORE_3_0 [DisableDefaultCtor] -#endif partial interface JSManagedValue { [Static, Export ("managedValueWithValue:")] JSManagedValue Get (JSValue value); diff --git a/src/mapkit.cs b/src/mapkit.cs index f644b66d60ab..e1c79774b803 100644 --- a/src/mapkit.cs +++ b/src/mapkit.cs @@ -2166,9 +2166,7 @@ interface MKLocalSearchCompleterDelegate { [NoWatch] [MacCatalyst (13, 1)] [BaseType (typeof (NSObject))] -#if MONOMAC || XAMCORE_3_0 // "You do not create instances of this class directly" [DisableDefaultCtor] -#endif interface MKLocalSearchCompletion { [Export ("title", ArgumentSemantic.Strong)] string Title { get; } diff --git a/src/mediaextension.cs b/src/mediaextension.cs index 2929a3a370c6..5ce016e11799 100644 --- a/src/mediaextension.cs +++ b/src/mediaextension.cs @@ -513,6 +513,7 @@ interface IMEVideoDecoder {} [NoWatch, NoTV, NoiOS, Mac (15,0), NoMacCatalyst] [Static] interface MEVideoDecoderFields { + [Notification] [Field ("MEVideoDecoderReadyForMoreMediaDataDidChangeNotification")] NSString ReadyForMoreMediaDataDidChangeNotification { get; } } @@ -759,9 +760,11 @@ interface MERawProcessor [Static] interface MERawProcessorFields { + [Notification] [Field ("MERAWProcessorValuesDidChangeNotification")] NSString ValuesDidChangeNotification { get; } + [Notification] [Field ("MERAWProcessorReadyForMoreMediaDataDidChangeNotification")] NSString ReadyForMoreMediaDataDidChangeNotification { get; } } diff --git a/src/mediaplayer.cs b/src/mediaplayer.cs index bd69f9dd38d7..9f6a79f5c05b 100644 --- a/src/mediaplayer.cs +++ b/src/mediaplayer.cs @@ -324,12 +324,7 @@ interface MPMediaItemArtwork { #else [BaseType (typeof (NSObject))] #endif -#if XAMCORE_3_0 || !IOS || NET interface MPMediaItemCollection : NSSecureCoding { -#else - // part of the bug is that we inlined MPMediaEntity needlessly - interface MPMediaItemCollection : MPMediaEntity, NSSecureCoding { -#endif [Static] [Export ("collectionWithItems:")] MPMediaItemCollection FromItems (MPMediaItem [] items); diff --git a/src/messageui.cs b/src/messageui.cs index b8aee9721eae..b511886b1a03 100644 --- a/src/messageui.cs +++ b/src/messageui.cs @@ -71,14 +71,7 @@ interface MFMailComposeViewController : UIAppearance { /// interface IMFMailComposeViewControllerDelegate { } -#if XAMCORE_3_0 [BaseType (typeof (NSObject))] -#else - /// Used to receive notifications from the MFMailComposeViewController class. - /// - /// Apple documentation for MFMailComposeViewControllerDelegate - [BaseType (typeof (UINavigationControllerDelegate))] -#endif [Model] [Protocol] interface MFMailComposeViewControllerDelegate { diff --git a/src/opentk.csproj b/src/opentk.csproj deleted file mode 100644 index 0be562e39c3c..000000000000 --- a/src/opentk.csproj +++ /dev/null @@ -1,246 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {D7E171B6-4B94-49FB-87CC-006B906FBECC} - {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - opentk - opentk - - - true - full - false - bin\Debug - IPHONE;MINIMAL;MONOTOUCH - prompt - 4 - false - true - True - 3021,3014,3003 - - - none - false - bin\Release - prompt - 4 - false - true - - - - - - - - - - OpenGLES\OpenTK\Audio\AudioContext.cs - - - OpenGLES\OpenTK\Audio\AudioContextException.cs - - - OpenGLES\OpenTK\Audio\AudioDeviceEnumerator.cs - - - OpenGLES\OpenTK\Audio\AudioDeviceErrorChecker.cs - - - OpenGLES\OpenTK\Audio\AudioDeviceException.cs - - - OpenGLES\OpenTK\Audio\AudioException.cs - - - OpenGLES\OpenTK\Audio\AudioValueException.cs - - - OpenGLES\OpenTK\Audio\OpenAL\AL\AL.cs - - - OpenGLES\OpenTK\Audio\OpenAL\AL\ALEnums.cs - - - OpenGLES\OpenTK\Audio\OpenAL\AL\EffectsExtension.cs - - - OpenGLES\OpenTK\Audio\OpenAL\AL\EffectsExtensionEnums.cs - - - OpenGLES\OpenTK\Audio\OpenAL\AL\EffectsExtensionPresets.cs - - - OpenGLES\OpenTK\Audio\OpenAL\AL\XRamExtension.cs - - - OpenGLES\OpenTK\Audio\OpenAL\Alc\Alc.cs - - - OpenGLES\OpenTK\Audio\OpenAL\Alc\AlcEnums.cs - - - OpenGLES\OpenTK\AutoGeneratedAttribute.cs - - - OpenGLES\OpenTK\BlittableValueType.cs - - - OpenGLES\OpenTK\Configuration.cs - - - OpenGLES\OpenTK\ContextHandle.cs - - - OpenGLES\OpenTK\DisplayResolution.cs - - - OpenGLES\OpenTK\FrameEventArgs.cs - - - OpenGLES\OpenTK\IGameWindow.cs - - - OpenGLES\OpenTK\INativeWindow.cs - - - OpenGLES\OpenTK\KeyPressEventArgs.cs - - - OpenGLES\OpenTK\Minimal.cs - - - OpenGLES\OpenTK\WindowBorder.cs - - - OpenGLES\OpenTK\WindowState.cs - - - OpenGLES\OpenTK\Graphics\Color4.cs - - - OpenGLES\OpenTK\Graphics\ColorFormat.cs - - - OpenGLES\OpenTK\Graphics\GraphicsContext.cs - - - OpenGLES\OpenTK\Graphics\GraphicsContextException.cs - - - OpenGLES\OpenTK\Graphics\GraphicsContextFlags.cs - - - OpenGLES\OpenTK\Graphics\GraphicsContextMissingException.cs - - - OpenGLES\OpenTK\Graphics\GraphicsMode.cs - - - OpenGLES\OpenTK\Graphics\GraphicsModeException.cs - - - OpenGLES\OpenTK\Graphics\IGraphicsContext.cs - - - OpenGLES\OpenTK\Graphics\IGraphicsMode.cs - - - OpenGLES\OpenTK\Platform\IWindowInfo.cs - - - OpenGLES\OpenTK\Toolkit.cs - - - OpenGLES\OpenTK\Graphics\ES11.iPhone\Helper.cs - - - - - OpenGLES\OpenTK\Platform\iPhoneOS\BindingsBase.iPhone.cs - - - OpenGLES\OpenTK\Platform\iPhoneOS\Factory.iPhone.cs - - - OpenGLES\OpenTK\Platform\iPhoneOS\GraphicsBindingsBase.iPhone.cs - - - OpenGLES\OpenTK\Platform\iPhoneOS\Utilities.iPhone.cs - - - OpenGLES\OpenTK\Platform\iPhoneOS\iPhoneOSGameView.cs - - - OpenGLES\OpenTK\Platform\iPhoneOS\iPhoneOSGraphicsContext.cs - - - OpenGLES\OpenTK\Platform\iPhoneOS\iPhoneOSGraphicsMode.cs - - - OpenGLES\OpenTK\Graphics\ES11.iPhone\Core.cs - - - OpenGLES\OpenTK\Graphics\ES11.iPhone\Delegates.cs - - - OpenGLES\OpenTK\Graphics\ES11.iPhone\ES.Obsolete.cs - - - OpenGLES\OpenTK\Graphics\ES11.iPhone\ES.cs - - - OpenGLES\OpenTK\Graphics\ES11.iPhone\Enums.cs - - - OpenGLES\OpenTK\Graphics\ES20.iPhone\Core.cs - - - OpenGLES\OpenTK\Graphics\ES20.iPhone\Delegates.cs - - - OpenGLES\OpenTK\Graphics\ES20.iPhone\ES.Obsolete.cs - - - OpenGLES\OpenTK\Graphics\ES20.iPhone\ES.cs - - - OpenGLES\OpenTK\Graphics\ES20.iPhone\Enums.cs - - - OpenGLES\OpenTK\Graphics\ES20.iPhone\Helper.cs - - - OpenGLES\OpenTK\Graphics\ES30.iPhone\Core.cs - - - OpenGLES\OpenTK\Graphics\ES30.iPhone\Delegates.cs - - - OpenGLES\OpenTK\Graphics\ES30.iPhone\ES.Obsolete.cs - - - OpenGLES\OpenTK\Graphics\ES30.iPhone\ES.cs - - - OpenGLES\OpenTK\Graphics\ES30.iPhone\Enums.cs - - - OpenGLES\OpenTK\Graphics\ES30.iPhone\Helper.cs - - - System.Drawing\ColorKnownColorTypeForwarders.cs - - - - - - - - diff --git a/src/opentk.mk b/src/opentk.mk deleted file mode 100644 index 293fa73ab85d..000000000000 --- a/src/opentk.mk +++ /dev/null @@ -1,63 +0,0 @@ - -# -# OpenTK[-1.0] -# -IOS_OPENTK_1_0_CORE_SOURCES = \ - $(OPENTK_PATH)/Source/OpenTK/Math/BezierCurve.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/BezierCurveCubic.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/BezierCurveQuadric.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Box2.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Functions.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Half.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/MathHelper.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Matrix2.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Matrix3.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Matrix3d.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Matrix4.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Matrix4d.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Quaternion.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Quaterniond.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector2.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector2d.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector2h.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector3.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector3d.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector3h.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector4.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector4d.cs \ - $(OPENTK_PATH)/Source/OpenTK/Math/Vector4h.cs \ - OpenGLES/OpenTK/Math/Vector2i.cs \ - OpenGLES/OpenTK/Math/Vector3i.cs \ - OpenGLES/OpenTK/Math/Vector4i.cs \ - -# Xamarin.iOS - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/OpenTK-1.0%: $(MACIOS_BINARIES_PATH)/OpenTK/ios/OpenTK-1.0% - $(Q) $(CP) $< $@ - -# Xamarin.TVOS - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/OpenTK-1.0%: $(MACIOS_BINARIES_PATH)/OpenTK/tvos/OpenTK-1.0% - $(Q) $(CP) $< $@ - -# Xamarin.Mac - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/%: $(MACIOS_BINARIES_PATH)/OpenTK/macos/lib/% - $(Q) mkdir -p $(dir $@) - $(Q) $(CP) $^ $@ - -MACOS_TARGETS += \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile/OpenTK.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/mobile/OpenTK.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile/OpenTK.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/mobile/OpenTK.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full/OpenTK.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/full/OpenTK.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full/OpenTK.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/64bits/full/OpenTK.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/OpenTK.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/Xamarin.Mac/OpenTK.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/net_4_5/OpenTK.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/reference/net_4_5/OpenTK.pdb \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/OpenTK.dll \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mono/4.5/OpenTK.pdb \ diff --git a/src/packages.config b/src/packages.config deleted file mode 100644 index 59a196a90eb2..000000000000 --- a/src/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/pencilkit.cs b/src/pencilkit.cs index f0a5f3f81dce..37c9a4b6e4f8 100644 --- a/src/pencilkit.cs +++ b/src/pencilkit.cs @@ -120,6 +120,10 @@ interface PKCanvasViewDelegate : UIScrollViewDelegate { [Export ("canvasViewDidEndUsingTool:")] void EndUsingTool (PKCanvasView canvasView); + + [iOS (18, 1), NoMacCatalyst] + [Export ("canvasView:didRefineStrokes:withNewStrokes:")] + void DidRefineStrokes (PKCanvasView canvasView, PKStroke [] strokes, PKStroke [] newStrokes); } interface IPKCanvasViewDelegate { } diff --git a/src/rgen/Microsoft.Macios.Binding.Common/Microsoft.Macios.Binding.Common.csproj b/src/rgen/Microsoft.Macios.Binding.Common/Microsoft.Macios.Binding.Common.csproj new file mode 100644 index 000000000000..9bae1ff3ca16 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Binding.Common/Microsoft.Macios.Binding.Common.csproj @@ -0,0 +1,27 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + enable + + + + + external\ApplePlatform.cs + + + external\SdkVersions.cs + + + external\TargetFramework.cs + + + external\Frameworks.cs + + + external\PlatformName.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..16717f554311 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Examples.cs @@ -0,0 +1,14 @@ +using ObjCBindings; + +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..2628fe234a05 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer.Sample/Microsoft.Macios.Bindings.Analyzer.Sample.csproj @@ -0,0 +1,25 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + APL0003 + true + + + + + + + + + + + external\BindginTypeAttribute.cs + + + 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..b11c83ed9b0c --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Shipped.md @@ -0,0 +1,3 @@ +## Release 1.0 + +### New Rules 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..91ac58aa2ed2 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/AnalyzerReleases.Unshipped.md @@ -0,0 +1,6 @@ +## Release 0.1.0 + +### New Rules +| Rule ID | Category | Severity | Notes | +|---------|----------|----------|------------------------------------------------------| +| RBI0001 | Usage | Error | Binding types should be declared as partial classes. | 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..ebf64f5e1f39 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Microsoft.Macios.Bindings.Analyzer.csproj @@ -0,0 +1,56 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + false + enable + latest + + true + true + true + + Microsoft.Macios.Bindings.Analyzer + Microsoft.Macios.Bindings.Analyzer + 0.1.0 + + RS2007 + + + + + 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..ae104c14c5ef --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator.Sample/Microsoft.Macios.Generator.Sample.csproj @@ -0,0 +1,25 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + Microsoft.Macios.Generator.Sample + APL0003 + true + + + + + + + + + + external\BindingTypeAttribute.cs + + + 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..7c2427c1473e --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator.Sample/SampleBinding.cs @@ -0,0 +1,11 @@ +using ObjCBindings; + +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/AnalyzerReleases.Shipped.md b/src/rgen/Microsoft.Macios.Generator/AnalyzerReleases.Shipped.md new file mode 100644 index 000000000000..b11c83ed9b0c --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/AnalyzerReleases.Shipped.md @@ -0,0 +1,3 @@ +## Release 1.0 + +### New Rules diff --git a/src/rgen/Microsoft.Macios.Generator/AnalyzerReleases.Unshipped.md b/src/rgen/Microsoft.Macios.Generator/AnalyzerReleases.Unshipped.md new file mode 100644 index 000000000000..0b35e20b5e1a --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/AnalyzerReleases.Unshipped.md @@ -0,0 +1,7 @@ +## Release 0.1.0 + +### New Rules + +| Rule ID | Category | Severity | Notes | +|---------|----------|----------|------------------------------------------------------| +| RBI0001 | Usage | Error | Binding types should be declared as partial classes. | diff --git a/src/rgen/Microsoft.Macios.Generator/Attributes/FieldData.cs b/src/rgen/Microsoft.Macios.Generator/Attributes/FieldData.cs new file mode 100644 index 000000000000..d69ab21e986c --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Attributes/FieldData.cs @@ -0,0 +1,51 @@ +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis; + +namespace Microsoft.Macios.Generator.Attributes; + +record FieldData { + public string SymbolName { get; } + public string? LibraryName { get; private set; } + + FieldData (string symbolName, string? libraryName = null) + { + SymbolName = symbolName; + LibraryName = libraryName; + } + + public static bool TryParse (SyntaxNode attributeSyntax, AttributeData attributeData, + [NotNullWhen (true)] out FieldData? data) + { + data = default; + + var count = attributeData.ConstructorArguments.Length; + switch (count) { + case 1: + data = new ((string) attributeData.ConstructorArguments [0].Value!); + break; + case 2: + data = new ((string) attributeData.ConstructorArguments [0].Value!, + (string) attributeData.ConstructorArguments [1].Value!); + break; + default: + // 0 should not be an option.. + return false; + } + + if (attributeData.NamedArguments.Length == 0) + return true; + + // LibraryName can be a param value + foreach (var (name, value) in attributeData.NamedArguments) { + switch (name) { + case "LibraryName": + data.LibraryName = (string?) value.Value!; + break; + default: + data = null; + return false; + } + } + return true; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/AttributesNames.cs b/src/rgen/Microsoft.Macios.Generator/AttributesNames.cs new file mode 100644 index 000000000000..f4f3bd620346 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/AttributesNames.cs @@ -0,0 +1,10 @@ +namespace Microsoft.Macios.Generator; + +/// +/// Contains all the names of the attributes that are used by the binding generator. +/// +public static class AttributesNames { + + public const string BindingAttribute = "ObjCBindings.BindingTypeAttribute"; + public const string FieldAttribute = "ObjCBindings.FieldAttribute"; +} diff --git a/src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs b/src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs new file mode 100644 index 000000000000..3fffcff09dd8 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs @@ -0,0 +1,186 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Text; +using Microsoft.Macios.Generator.Context; +using Microsoft.Macios.Generator.DataModel; +using Microsoft.Macios.Generator.Emitters; +using Microsoft.Macios.Generator.Extensions; + +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 { + internal static readonly DiagnosticDescriptor RBI0000 = new ( + "RBI0000", + new LocalizableResourceString (nameof (Resources.RBI0000Title), Resources.ResourceManager, typeof (Resources)), + new LocalizableResourceString (nameof (Resources.RBI0000MessageFormat), Resources.ResourceManager, typeof (Resources)), + "Usage", + DiagnosticSeverity.Error, + isEnabledByDefault: true, + description: new LocalizableResourceString (nameof (Resources.RBI0000Description), Resources.ResourceManager, typeof (Resources)) + ); + + static readonly CodeChangesComparer comparer = new (); + /// + 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))); + } + + // binding can use different 'types'. To be able to generate the code we are going to add a different + // function for each of the 'types' we are interested in generating that will be added to the compiler + // pipeline + AddPipeline (context); + AddPipeline (context); + AddPipeline (context); + } + + /// + /// Generic method that adds a provider and a code generator to the pipeline. + /// + /// The compilation context + /// The base type declaration that we are going to generate. + static void AddPipeline (IncrementalGeneratorInitializationContext context) where T : BaseTypeDeclarationSyntax + { + var provider = context.SyntaxProvider + .CreateSyntaxProvider ( + static (s, _) => s is T, + (ctx, _) => GetDeclarationForSourceGen (ctx)) + .Where (t => t.BindingAttributeFound) // get the types with the binding attr + .Select ((t, _) => t.Changes) + .WithComparer (comparer); + + context.RegisterSourceOutput (context.CompilationProvider.Combine (provider.Collect ()), + ((ctx, t) => GenerateCode (ctx, t.Left, t.Right))); + } + + /// + /// Generic method that can be used to filter/match a BaseTypeDeclarationSyntax with the BindingTypeAttribute. + /// Because our generator is focused only on Enum, Interface and Class declarations we can use a generic method + /// that will match the type + the presence of the attribute. + /// + /// Context used by the generator. + /// The BaseTypeDeclarationSyntax we are interested in. + /// A tuple that contains the BaseTypeDeclaration that was processed and a boolean that states if it should be processed or not. + static (CodeChanges Changes, bool BindingAttributeFound) GetDeclarationForSourceGen (GeneratorSyntaxContext context) + where T : BaseTypeDeclarationSyntax + { + // we do know that the context node has to be one of the base type declarations + var declarationSyntax = Unsafe.As (context.Node); + + // check if we do have the binding attr, else there nothing to retrieve + bool isBindingType = declarationSyntax.HasAttribute (context.SemanticModel, AttributesNames.BindingAttribute); + + if (!isBindingType) { + // return an empty data + false + return (default, false); + } + + var codeChanges = CodeChanges.FromDeclaration (context.SemanticModel, declarationSyntax); + // if code changes are null, return the default value and a false to later ignore the change + return codeChanges is not null ? + (codeChanges.Value, isBindingType) : (default, false); + } + + /// + /// Collect the using statements from the class declaration root syntaxt tree and add them to the string builder + /// that will be used to generate the code. This way we ensure that we have all the namespaces needed by the + /// generated code. + /// + /// Root syntax tree of the base type declaration. + /// String builder that will be used for the generated code. + /// The emitter that will generate the code. Provides any extra needed namespace. + static void CollectUsingStatements (SyntaxTree tree, TabbedStringBuilder sb, ICodeEmitter emitter) + { + // collect all using from the syntax tree, add them to a hash to make sure that we don't have duplicates + // and add those usings that we do know we need for bindings. + var usingDirectives = tree.GetRoot () + .DescendantNodes () + .OfType () + .Select (d => d.Name!.ToString ()).ToArray (); + var usingDirectivesToKeep = new HashSet (usingDirectives) { + // add the using statements that we know we need and print them to the sb + }; + + // add those using statements needed by the emitter + foreach (var ns in emitter.UsingStatements) { + usingDirectivesToKeep.Add (ns); + } + + // add them sorted so that we have testeable generated code + foreach (var ns in usingDirectivesToKeep.OrderBy (s => s)) { + if (string.IsNullOrEmpty (ns)) + continue; + sb.AppendLine ($"using {ns};"); + } + } + + /// + /// Generic method that allows to call a emitter for ta type that will emit the binding code. All code generation + /// is very similar. Get create a tabbed string builder to write the code with the needed using statemens from + /// the original syntax tree and we pass it to the emitter that will generate the code. + /// + /// The generator context. + /// The compilation unit. + /// The base type declarations marked by the BindingTypeAttribute. + /// The type of type declaration. + static void GenerateCode (SourceProductionContext context, Compilation compilation, + ImmutableArray changesList) where T : BaseTypeDeclarationSyntax + { + var rootContext = new RootBindingContext (compilation); + foreach (var change in changesList) { + var declaration = Unsafe.As (change.SymbolDeclaration); + var semanticModel = compilation.GetSemanticModel (declaration.SyntaxTree); + // This is a bug in the roslyn analyzer for roslyn generator https://github.com/dotnet/roslyn-analyzers/issues/7436 +#pragma warning disable RS1039 + if (semanticModel.GetDeclaredSymbol (declaration) is not INamedTypeSymbol namedTypeSymbol) +#pragma warning restore RS1039 + continue; + + // init sb and add all the using statements from the base type declaration + var sb = new TabbedStringBuilder (new ()); + sb.WriteHeader (); + + // delegate semantic model and syntax tree analysis to the emitter who will generate the code and knows + // best + if (ContextFactory.TryCreate (rootContext, semanticModel, namedTypeSymbol, declaration, + out var symbolBindingContext) + && EmitterFactory.TryCreate (symbolBindingContext, sb, out var emitter)) { + CollectUsingStatements (change.SymbolDeclaration.SyntaxTree, sb, emitter); + + if (emitter.TryEmit (out var diagnostics)) { + // only add file when we do generate code + var code = sb.ToString (); + context.AddSource ($"{symbolBindingContext.Namespace}/{emitter.SymbolName}.g.cs", + SourceText.From (code, Encoding.UTF8)); + } else { + // add to the diagnostics and continue to the next possible candidate + foreach (Diagnostic diagnostic in diagnostics) { + context.ReportDiagnostic (diagnostic); + } + } + } else { + // we don't have a emitter for this type, so we can't generate the code, add a diagnostic letting the + // user we do not support what he is trying to do + context.ReportDiagnostic (Diagnostic.Create (RBI0000, + declaration.GetLocation (), + namedTypeSymbol.ToDisplayString ().Trim ())); + } + } + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Context/ClassBindingContext.cs b/src/rgen/Microsoft.Macios.Generator/Context/ClassBindingContext.cs new file mode 100644 index 000000000000..8278c6437e6f --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Context/ClassBindingContext.cs @@ -0,0 +1,16 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace Microsoft.Macios.Generator.Context; + +class ClassBindingContext : SymbolBindingContext { + public string RegisterName { get; init; } + + public ClassBindingContext (RootBindingContext context, SemanticModel semanticModel, + INamedTypeSymbol symbol, ClassDeclarationSyntax declarationSyntax) + : base (context, semanticModel, symbol, declarationSyntax) + { + RegisterName = + symbol.Name; //TODO: placeholder -> should this be extracted from the BindingTypeAttribute + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Context/ContextFactory.cs b/src/rgen/Microsoft.Macios.Generator/Context/ContextFactory.cs new file mode 100644 index 000000000000..0805f661df89 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Context/ContextFactory.cs @@ -0,0 +1,21 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace Microsoft.Macios.Generator.Context; + +static class ContextFactory { + public static bool TryCreate (RootBindingContext context, SemanticModel semanticModel, + INamedTypeSymbol symbol, T declarationSyntax, [NotNullWhen (true)] out ISymbolBindingContext? bindingContext) where T : BaseTypeDeclarationSyntax + { + bindingContext = declarationSyntax switch { + ClassDeclarationSyntax c => Unsafe.As> ( + new ClassBindingContext (context, semanticModel, symbol, c)), + EnumDeclarationSyntax => new SymbolBindingContext (context, semanticModel, symbol, declarationSyntax), + _ => null + }; + return bindingContext is not null; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Context/ISymbolBindingContext.cs b/src/rgen/Microsoft.Macios.Generator/Context/ISymbolBindingContext.cs new file mode 100644 index 000000000000..a9bc1f3c242f --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Context/ISymbolBindingContext.cs @@ -0,0 +1,19 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace Microsoft.Macios.Generator.Context; + +/// +/// Interface that represents a symbol binding context. We use an interface to allow the usage of a coveriance type, +/// because it removes the need to a cast. +/// +/// The base type declaration whose context we have +interface ISymbolBindingContext where T : BaseTypeDeclarationSyntax { + T DeclarationSyntax { get; } + string Namespace { get; } + string SymbolName { get; } + RootBindingContext RootBindingContext { get; init; } + SemanticModel SemanticModel { get; init; } + INamedTypeSymbol Symbol { get; init; } + bool IsStatic { get; } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Context/RootBindingContext.cs b/src/rgen/Microsoft.Macios.Generator/Context/RootBindingContext.cs new file mode 100644 index 000000000000..3d2925462243 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Context/RootBindingContext.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using Microsoft.CodeAnalysis; +using Microsoft.Macios.Generator.Extensions; + +namespace Microsoft.Macios.Generator.Context; + +/// +/// Shared context through the entire code generation. This context allows to collect data that will be +/// later use to generate the Trampoline.g.cs file. once all classed are processed. +/// +/// The class also provides a number or properties that will allow to determine the platform we are binding and access +/// to the current compilation. +/// +class RootBindingContext { + readonly Dictionary _libraries = new (); + + public PlatformName CurrentPlatform { get; set; } + public Compilation Compilation { get; set; } + public bool BindThirdPartyLibrary { get; set; } + + public RootBindingContext (Compilation compilation) + { + Compilation = compilation; + CurrentPlatform = compilation.GetCurrentPlatform (); + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Context/SymbolBindingContext.cs b/src/rgen/Microsoft.Macios.Generator/Context/SymbolBindingContext.cs new file mode 100644 index 000000000000..b3d0c24cfbb8 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Context/SymbolBindingContext.cs @@ -0,0 +1,36 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace Microsoft.Macios.Generator.Context; + +class SymbolBindingContext { + + public RootBindingContext RootBindingContext { get; init; } + public SemanticModel SemanticModel { get; init; } + public INamedTypeSymbol Symbol { get; init; } + + public bool IsStatic => Symbol.IsStatic; + + public SymbolBindingContext (RootBindingContext rootBindingContext, + SemanticModel semanticModel, INamedTypeSymbol symbol) + { + RootBindingContext = rootBindingContext; + SemanticModel = semanticModel; + Symbol = symbol; + } + +} + +class SymbolBindingContext : SymbolBindingContext, ISymbolBindingContext where T : BaseTypeDeclarationSyntax { + + public T DeclarationSyntax { get; } + public string Namespace => Symbol.ContainingNamespace.ToDisplayString (); + public string SymbolName => Symbol.Name; + + public SymbolBindingContext (RootBindingContext rootBindingContext, + SemanticModel semanticModel, INamedTypeSymbol symbol, T declarationSyntax) + : base (rootBindingContext, semanticModel, symbol) + { + DeclarationSyntax = declarationSyntax; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/AttributeCodeChange.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/AttributeCodeChange.cs new file mode 100644 index 000000000000..8fc42b882f37 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/AttributeCodeChange.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Immutable; + +namespace Microsoft.Macios.Generator.DataModel; + +/// +/// Structure that represents a change that was made by the user on a members attribute list that has to be +/// reflected in the generated code. +/// +readonly struct AttributeCodeChange : IEquatable { + + /// + /// Get the name of the attribute that was added. + /// + public string Name { get; } + + /// + /// Get the arguments used to create the attribute. + /// + public ImmutableArray Arguments { get; } + + /// + /// Create a new change that happened on an attribute. + /// + /// The name of the attribute that was added. + /// The arguments used to create the attribute. + public AttributeCodeChange (string name, ImmutableArray arguments) + { + Name = name; + Arguments = arguments; + } + + /// + /// Create a new change that happened on an attribute with no parameters. + /// + /// The name of the attribute that was added. + public AttributeCodeChange (string name) : this (name, []) { } + + /// + public bool Equals (AttributeCodeChange other) + { + if (Name != other.Name || Arguments.Length != other.Arguments.Length) + return false; + // arguments CANNOT be sorted, since the order of the arguments is important + for (var index = 0; index < Arguments.Length; index++) { + if (Arguments [index] != other.Arguments [index]) + return false; + } + + return true; + } + + /// + public override bool Equals (object? obj) + { + return obj is AttributeCodeChange other && Equals (other); + } + + /// + public override int GetHashCode () + { + return HashCode.Combine (Name, Arguments); + } + + /// + /// Compare two instances for equality. + /// + /// Code change to compare. + /// Code change to compare. + /// True if the code changes are equal. + public static bool operator == (AttributeCodeChange x, AttributeCodeChange y) + { + return x.Equals (y); + } + + /// + /// Compare two instances for inequality. + /// + /// Code change to compare. + /// Code change to compare. + /// True if the objects are not equal. + public static bool operator != (AttributeCodeChange x, AttributeCodeChange y) + { + return !(x == y); + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/AttributesComparer.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/AttributesComparer.cs new file mode 100644 index 000000000000..69e016bd813f --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/AttributesComparer.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; + +namespace Microsoft.Macios.Generator.DataModel; + +class AttributeComparer : IComparer { + public int Compare (AttributeCodeChange x, AttributeCodeChange y) + { + // return the order based on the following + // 1. Attribute name + // 2. Attribute param count + // 3. Attribute values + var nameComparison = String.Compare (x.Name, y.Name, StringComparison.Ordinal); + if (nameComparison != 0) + return nameComparison; + var lengthComparison = x.Arguments.Length.CompareTo (y.Arguments.Length); + if (lengthComparison != 0) + return lengthComparison; + // argument order is important, we do know that we already have the same length, loop and return if diff + for (int index = 0; index < x.Arguments.Length; index++) { + var xArgument = x.Arguments [index]; + var yArgument = y.Arguments [index]; + var compare = String.Compare (xArgument, yArgument, StringComparison.Ordinal); + if (compare != 0) + return compare; + } + + return 0; + } +} +class AttributesComparer : IEqualityComparer> { + + public bool Equals (ImmutableArray x, ImmutableArray y) + { + if (x.Length != y.Length) + return false; + var comparer = new AttributeComparer (); + var xOrdered = x.Sort (comparer).ToArray (); + var yOrdered = y.Sort (comparer).ToArray (); + for (var i = 0; i < x.Length; i++) { + if (xOrdered [i] != yOrdered [i]) + return false; + } + return true; + } + + public int GetHashCode (ImmutableArray obj) + { + var hash = new HashCode (); + foreach (var change in obj) { + hash.Add (change.GetHashCode ()); + } + return hash.ToHashCode (); + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/BindingType.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/BindingType.cs new file mode 100644 index 000000000000..812e479650a5 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/BindingType.cs @@ -0,0 +1,16 @@ +namespace Microsoft.Macios.Generator.DataModel; + +/// +/// Enum that represents the binding type needed for an class/interface/enum. This allows the code generator +/// differentiate between a code changes that has the exact same qualified name but different type. +/// +enum BindingType { + /// + /// Unknown binding type. + /// + Unknown = 0, + /// + /// Binding type for a enum with backing fields. + /// + SmartEnum, +} diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/CodeChanges.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/CodeChanges.cs new file mode 100644 index 000000000000..2ddf6dda2dd8 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/CodeChanges.cs @@ -0,0 +1,129 @@ +using System.Collections.Immutable; +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.Extensions; + +namespace Microsoft.Macios.Generator.DataModel; + +/// +/// Structure that represents a set of changes that were made by the user that need to be applied to the +/// generated code. +/// +readonly struct CodeChanges { + /// + /// Represents the type of binding that the code changes are for. + /// + public BindingType BindingType { get; } = BindingType.Unknown; + + /// + /// Fully qualified name of the symbol that the code changes are for. + /// + public string FullyQualifiedSymbol { get; } + + /// + /// Base symbol declaration that triggered the code changes. + /// + public BaseTypeDeclarationSyntax SymbolDeclaration { get; } + + /// + /// Changes to the attributes of the symbol. + /// + public ImmutableArray Attributes { get; } + + /// + /// Changes to the members of the symbol. + /// + public ImmutableArray Members { get; } + + /// + /// Internal constructor added for testing purposes. + /// + /// The type of binding for the given code changes. + /// The fully qualified name of the symbol. + /// The symbol declaration syntax. + /// The list of attributes changed. + /// The list of members changed. + internal CodeChanges (BindingType bindingType, string fullyQualifiedSymbol, BaseTypeDeclarationSyntax declaration, + ImmutableArray attributes, + ImmutableArray members) + { + BindingType = bindingType; + FullyQualifiedSymbol = fullyQualifiedSymbol; + SymbolDeclaration = declaration; + Attributes = attributes; + Members = members; + } + + /// + /// Creates a new instance of the struct for a given enum declaration. + /// + /// The semantic model of the compilation. + /// The enum declaration that triggered the change. + CodeChanges (SemanticModel semanticModel, EnumDeclarationSyntax enumDeclaration) + { + BindingType = BindingType.SmartEnum; + FullyQualifiedSymbol = enumDeclaration.GetFullyQualifiedIdentifier (); + SymbolDeclaration = enumDeclaration; + Attributes = enumDeclaration.GetAttributeCodeChanges (semanticModel); + var bucket = ImmutableArray.CreateBuilder (); + // get all the attributes of the enum, changes in them might trigger a re-generation + var enumAttributes = enumDeclaration.GetAttributeCodeChanges (semanticModel); + // loop over the fields and add those that contain a FieldAttribute + var enumValueDeclaration = enumDeclaration.Members.OfType (); + foreach (var val in enumValueDeclaration) { + if (!val.HasAttribute (semanticModel, AttributesNames.FieldAttribute)) + // for smart enums, we are only interested in the field that have a Field attribute + continue; + var memberName = val.Identifier.ToFullString ().Trim (); + var attributes = val.GetAttributeCodeChanges (semanticModel); + bucket.Add (new (memberName, attributes)); + } + Members = bucket.ToImmutable (); + } + + /// + /// Creates a new instance of the struct for a given class declaration. + /// + /// The semantic model of the compilation. + /// The class declaration that triggered the change. + CodeChanges (SemanticModel semanticModel, ClassDeclarationSyntax classDeclaration) + { + FullyQualifiedSymbol = classDeclaration.GetFullyQualifiedIdentifier (); + SymbolDeclaration = classDeclaration; + // TODO: to be implemented once we add class support + Members = []; + Attributes = []; + } + + /// + /// Creates a new instance of the struct for a given interface declaration. + /// + /// The semantic model of the compilation. + /// The interface declaration that triggered the change. + CodeChanges (SemanticModel semanticModel, InterfaceDeclarationSyntax interfaceDeclaration) + { + FullyQualifiedSymbol = interfaceDeclaration.GetFullyQualifiedIdentifier (); + SymbolDeclaration = interfaceDeclaration; + // TODO: to be implemented once we add protocol support + Members = []; + Attributes = []; + } + + /// + /// Create a CodeChange from the provide base type declaration syntax. If the syntax is not supported, + /// it will return null. + /// + /// The semantic model related to the syntax tree that contains the node. + /// The declaration syntax whose change we want to calculate. + /// A code change or null if it could not be calculated. + public static CodeChanges? FromDeclaration (SemanticModel semanticModel, + BaseTypeDeclarationSyntax baseTypeDeclarationSyntax) + => baseTypeDeclarationSyntax switch { + EnumDeclarationSyntax enumDeclarationSyntax => new CodeChanges (semanticModel, enumDeclarationSyntax), + InterfaceDeclarationSyntax interfaceDeclarationSyntax => new CodeChanges (semanticModel, + interfaceDeclarationSyntax), + ClassDeclarationSyntax classDeclarationSyntax => new CodeChanges (semanticModel, classDeclarationSyntax), + _ => null + }; +} diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/CodeChangesComparer.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/CodeChangesComparer.cs new file mode 100644 index 000000000000..e76b14b7cfa3 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/CodeChangesComparer.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Macios.Generator.DataModel; + +/// +/// Custom code changes comparer used for the Roslyn code generation to invalidate caching. +/// +class CodeChangesComparer : IEqualityComparer { + + /// + public bool Equals (CodeChanges x, CodeChanges y) + { + // things that mean a code change is the same: + // - the fully qualified symbol is the same + // - the binding type is the same + // - the syntax node type is the same + // - the members are the same + // - the attributes are the same + + // this could be a massive or but that makes it less readable + if (x.FullyQualifiedSymbol != y.FullyQualifiedSymbol) + return false; + if (x.BindingType != y.BindingType) + return false; + if (x.SymbolDeclaration.GetType () != y.SymbolDeclaration.GetType ()) + return false; + if (x.Attributes.Length != y.Attributes.Length) + return false; + if (x.Members.Length != y.Members.Length) + return false; + + // compare the attrs, we need to sort them since attribute order does not matter + var attrComparer = new AttributesComparer (); + if (!attrComparer.Equals (x.Attributes, y.Attributes)) + return false; + + // compare the members, we need to sort them since member order does not matter + var memberComparer = new MemberComparer (); + return memberComparer.Equals (x.Members, y.Members); + } + + /// + public int GetHashCode (CodeChanges obj) + { + return HashCode.Combine (obj.FullyQualifiedSymbol, obj.Members); + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/MemberCodeChange.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/MemberCodeChange.cs new file mode 100644 index 000000000000..ae923fbab61d --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/MemberCodeChange.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Immutable; +using System.Linq; + +namespace Microsoft.Macios.Generator.DataModel; + +/// +/// Structure that represents a change that was made by the user on a members that has to be +/// reflected in the generated code. +/// +readonly struct MemberCodeChange : IEquatable { + + /// + /// Get the name of the member. + /// + public string Name { get; } + + /// + /// Get the attributes added to the member. + /// + public ImmutableArray Attributes { get; } + + /// + /// Create a new change that happened on a member. + /// + /// The name of the changed member. + /// The list of attribute changes in the member. + public MemberCodeChange (string name, ImmutableArray attributes) + { + Name = name; + Attributes = attributes; + } + + /// + /// Create a new change that happened on a member. + /// + /// The name of the changed member. + public MemberCodeChange (string name) : this (name, []) { } + + /// + public bool Equals (MemberCodeChange other) + { + if (Name != other.Name) + return false; + var attrComparer = new AttributesComparer (); + return attrComparer.Equals (Attributes, other.Attributes); + } + + /// + public override bool Equals (object? obj) + { + return obj is MemberCodeChange other && Equals (other); + } + + /// + public override int GetHashCode () + { + return HashCode.Combine (Name, Attributes); + } + + public static bool operator == (MemberCodeChange x, MemberCodeChange y) + { + return x.Equals (y); + } + + public static bool operator != (MemberCodeChange x, MemberCodeChange y) + { + return !(x == y); + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/DataModel/MemberComparer.cs b/src/rgen/Microsoft.Macios.Generator/DataModel/MemberComparer.cs new file mode 100644 index 000000000000..53453221e64d --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/DataModel/MemberComparer.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; + +namespace Microsoft.Macios.Generator.DataModel; + +class MemberComparer : IEqualityComparer> { + + public bool Equals (ImmutableArray x, ImmutableArray y) + { + if (x.Length != y.Length) + return false; + var xOrdered = x.OrderBy (x => x.Name).ToArray (); + var yOrdered = y.OrderBy (x => x.Name).ToArray (); + for (int i = 0; i < x.Length; i++) { + if (xOrdered [i] != yOrdered [i]) + return false; + } + return true; + } + + public int GetHashCode (ImmutableArray obj) + { + var hash = new HashCode (); + foreach (var change in obj) { + hash.Add (change.GetHashCode ()); + } + return hash.ToHashCode (); + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Emitters/ClassEmitter.cs b/src/rgen/Microsoft.Macios.Generator/Emitters/ClassEmitter.cs new file mode 100644 index 000000000000..bef0cc6e4a5f --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Emitters/ClassEmitter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis; +using Microsoft.Macios.Generator.Context; + +namespace Microsoft.Macios.Generator.Emitters; + +class ClassEmitter (ClassBindingContext context, TabbedStringBuilder builder) : ICodeEmitter { + public string SymbolName => context.SymbolName; + + public IEnumerable UsingStatements => []; + + public bool TryEmit ([NotNullWhen (false)] out ImmutableArray? diagnostics) + { + + builder.AppendLine (); + diagnostics = null; + // add the namespace and the class declaration + using (var namespaceBlock = builder.CreateBlock ($"namespace {context.Namespace}", true)) { + using (var classBlock = namespaceBlock.CreateBlock ($"public partial class {SymbolName}", true)) { + classBlock.AppendLine ("// TODO: add binding code here"); + } + } + return true; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Emitters/EmitterFactory.cs b/src/rgen/Microsoft.Macios.Generator/Emitters/EmitterFactory.cs new file mode 100644 index 000000000000..7d9237ce35b5 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Emitters/EmitterFactory.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.Context; + +namespace Microsoft.Macios.Generator.Emitters; + +/// +/// Returns the emitter that is related to the provided declaration type. +/// +static class EmitterFactory { + public static bool TryCreate (ISymbolBindingContext context, TabbedStringBuilder builder, + [NotNullWhen (true)] out ICodeEmitter? emitter) + where T : BaseTypeDeclarationSyntax + { + emitter = context switch { + ClassBindingContext classContext => new ClassEmitter (classContext, builder), + ISymbolBindingContext enumContext => new EnumEmitter (enumContext, builder), + ISymbolBindingContext interfaceContext => new InterfaceEmitter (interfaceContext, builder), + _ => null + }; + return emitter is not null; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Emitters/EnumEmitter.cs b/src/rgen/Microsoft.Macios.Generator/Emitters/EnumEmitter.cs new file mode 100644 index 000000000000..f3c7d81f1ed6 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Emitters/EnumEmitter.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.Context; + +namespace Microsoft.Macios.Generator.Emitters; + +#pragma warning disable CS9113 // Parameter is unread. This class is work in progress +class EnumEmitter (ISymbolBindingContext context, TabbedStringBuilder builder) +#pragma warning restore CS9113 // Parameter is unread. + : ICodeEmitter { + + public string SymbolName => $"{context.SymbolName}Extensions"; + + public IEnumerable UsingStatements => []; + + public bool TryEmit ([NotNullWhen (false)] out ImmutableArray? diagnostics) + { + diagnostics = null; + return true; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Emitters/ICodeEmitter.cs b/src/rgen/Microsoft.Macios.Generator/Emitters/ICodeEmitter.cs new file mode 100644 index 000000000000..6ae7b9b10f04 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Emitters/ICodeEmitter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis; + +namespace Microsoft.Macios.Generator.Emitters; + +/// +/// Interface to be implemented by all those classes that know how to emit code for a binding. +/// +interface ICodeEmitter { + public string SymbolName { get; } + bool TryEmit ([NotNullWhen (false)] out ImmutableArray? diagnostics); + IEnumerable UsingStatements { get; } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Emitters/InterfaceEmitter.cs b/src/rgen/Microsoft.Macios.Generator/Emitters/InterfaceEmitter.cs new file mode 100644 index 000000000000..4acf0689f7cf --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Emitters/InterfaceEmitter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.Context; + +namespace Microsoft.Macios.Generator.Emitters; + +#pragma warning disable CS9113 // Parameter is unread, this class is work in progress +class InterfaceEmitter (ISymbolBindingContext context, TabbedStringBuilder builder) : ICodeEmitter { +#pragma warning restore CS9113 // Parameter is unread. + public string SymbolName { get; } = string.Empty; + public IEnumerable UsingStatements => []; + public bool TryEmit ([NotNullWhen (false)] out ImmutableArray? diagnostics) + { + diagnostics = null; + return true; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/BaseTypeDeclarationSyntaxExtensions.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/BaseTypeDeclarationSyntaxExtensions.cs new file mode 100644 index 000000000000..76806b09be1c --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/BaseTypeDeclarationSyntaxExtensions.cs @@ -0,0 +1,48 @@ +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +namespace Microsoft.Macios.Generator.Extensions; + +public static class BaseTypeDeclarationSyntaxExtensions { + /// + /// Return the fully qualified identifier for a given by + /// navigating the syntax tree and getting the namespace and class names. + /// + /// The declaration whose fully qualified name we want to retrieve. + /// A fully qualified identifier with all namespaces and classes found in the syntax tree. + public static string GetFullyQualifiedIdentifier (this BaseTypeDeclarationSyntax self) + { + var root = self.SyntaxTree.GetRoot (); + // check if the namespace is a file scoped one "namespace Foo;" + var fileScoped = root.DescendantNodes () + .OfType () + .FirstOrDefault (); + + var namespaces = self.Ancestors () + .OfType () + .Reverse () + .Select (ns => ns.Name.ToString ().Trim ()) + .ToArray (); + + // get all the classes + var parents = self.Ancestors () + .OfType () + .Reverse () + .Select (c => c.Identifier.ToFullString ().Trim ()) + .ToArray (); + + var sb = new StringBuilder (); + if (fileScoped is not null) + sb.Append ($"{fileScoped.Name}"); + // not need to add a '.' before the namespaces, you cannot have both field scope and namespace + sb.AppendJoin (".", namespaces); + if (parents.Length > 0) { + sb.Append ('.'); + sb.AppendJoin (".", parents); + } + + sb.Append ($".{self.Identifier.ToFullString ()}"); + return sb.ToString ().Trim (); + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/CompilationExtensions.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/CompilationExtensions.cs new file mode 100644 index 000000000000..839e44b21ab2 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/CompilationExtensions.cs @@ -0,0 +1,30 @@ +using Microsoft.CodeAnalysis; + +namespace Microsoft.Macios.Generator.Extensions; + +static class CompilationExtensions { + + /// + /// Return the current platform that the compilation is targeting. + /// + /// The current compilation. + /// The target platform of the current compilation. + public static PlatformName GetCurrentPlatform (this Compilation self) + { + // use the reference assembly to determine what platform we are binding + foreach (var referenceAssembly in self.ReferencedAssemblyNames) { + switch (referenceAssembly.Name) { + case "Microsoft.iOS": + return PlatformName.iOS; + case "Microsoft.MacCatalyst": + return PlatformName.MacCatalyst; + case "Microsoft.macOS": + return PlatformName.MacOSX; + case "Microsoft.tvOS": + return PlatformName.TvOS; + } + } + + return PlatformName.None; + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/MemberDeclarationSyntaxExtensions.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/MemberDeclarationSyntaxExtensions.cs new file mode 100644 index 000000000000..0cdf170759af --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/MemberDeclarationSyntaxExtensions.cs @@ -0,0 +1,83 @@ +using System.Collections.Immutable; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.DataModel; + +namespace Microsoft.Macios.Generator.Extensions; + +static class MemberDeclarationSyntaxExtensions { + /// + /// Get all the attribute changes that were made to the member. + /// + /// The member declaration syntax that triggered the changes. + /// The current semantic model. + /// All attributes that got changed. + public static ImmutableArray GetAttributeCodeChanges (this MemberDeclarationSyntax self, + SemanticModel semanticModel) + { + var bucket = ImmutableArray.CreateBuilder (); + foreach (AttributeListSyntax attributeListSyntax in self.AttributeLists) { + foreach (AttributeSyntax attributeSyntax in attributeListSyntax.Attributes) { + if (semanticModel.GetSymbolInfo (attributeSyntax).Symbol is not IMethodSymbol attributeSymbol) + continue; // if we can't get the symbol, ignore it + var name = attributeSymbol.ContainingType.ToDisplayString (); + var arguments = ImmutableArray.CreateBuilder (); + var argumentList = attributeSyntax.ArgumentList?.Arguments; + if (argumentList is not null) { + foreach (var argSyntax in argumentList) { + // there are two types of argument nodes, those that are literal and those that + // are a literal expression + if (argSyntax.Expression is LiteralExpressionSyntax literalExpressionSyntax) { + arguments.Add (literalExpressionSyntax.ToFullString ().Trim () + .Replace ("\"", string.Empty)); + } + if (argSyntax.Expression is MemberAccessExpressionSyntax memberAccessExpressionSyntax) { + var eumExpr = memberAccessExpressionSyntax.ToFullString ().Trim (); + if (semanticModel.GetSymbolInfo (memberAccessExpressionSyntax).Symbol is IFieldSymbol + enumSymbol) { + arguments.Add (enumSymbol.ToDisplayString ().Trim ()); + } else { + // could not get the symbol, add the full expre + arguments.Add (eumExpr); + } + } + if (argSyntax.Expression is TypeOfExpressionSyntax typeOfExpressionSyntax) { + if (semanticModel.GetSymbolInfo (typeOfExpressionSyntax.Type).Symbol is INamedTypeSymbol typeSymbol) { + arguments.Add (typeSymbol.ToDisplayString ().Trim ()); + } + } + } + } + + bucket.Add (new (name, arguments.ToImmutable ())); + } + } + + return bucket.ToImmutable (); + } + + /// + /// Return if the member has a specific attribute. + /// + /// The member declaration whose attributes we want to check. + /// The semantic model of the compilation. + /// The attribute name we want to find. + /// True if the attribute is present in the given member declaration. + public static bool HasAttribute (this MemberDeclarationSyntax self, SemanticModel semanticModel, + string attribute) + { + foreach (AttributeListSyntax attributeListSyntax in self.AttributeLists) + foreach (AttributeSyntax attributeSyntax in attributeListSyntax.Attributes) { + if (semanticModel.GetSymbolInfo (attributeSyntax).Symbol is not IMethodSymbol attributeSymbol) + continue; // if we can't get the symbol, ignore it + + var currentName = attributeSymbol.ContainingType.ToDisplayString (); + + // Check the full name of the [Binding] attribute. + if (currentName == attribute) + return true; + } + + return false; + } +} 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..ab4e924be7ff --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Microsoft.Macios.Generator.csproj @@ -0,0 +1,56 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + false + enable + latest + + true + true + true + + Microsoft.Macios.Generator + Microsoft.Macios.Generator + 0.1.0 + + RS2007;RS1041 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + <_Parameter1>Microsoft.Macios.Generator.Tests + + + + + external\PlatformNameExtensions.cs + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources1.Designer.cs + + + + + + + + + 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/Microsoft.Macios.Generator/Resources.Designer.cs b/src/rgen/Microsoft.Macios.Generator/Resources.Designer.cs new file mode 100644 index 000000000000..f95e5360418d --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Resources.Designer.cs @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// 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.Generator { + 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.Generator.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 RBI0000Description { + get { + return ResourceManager.GetString("RBI0000Description", resourceCulture); + } + } + + internal static string RBI0000MessageFormat { + get { + return ResourceManager.GetString("RBI0000MessageFormat", resourceCulture); + } + } + + internal static string RBI0000Title { + get { + return ResourceManager.GetString("RBI0000Title", resourceCulture); + } + } + } +} diff --git a/src/rgen/Microsoft.Macios.Generator/Resources.resx b/src/rgen/Microsoft.Macios.Generator/Resources.resx new file mode 100644 index 000000000000..1d6fccd8bd27 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/Resources.resx @@ -0,0 +1,34 @@ + + + + + + + + + + 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 + + + + An unexpected error happened while generating the code. No code will be added to the compilation. + An optional longer localizable description of the diagnostic. + + + An unexpected error ocurred while processing '{0}'. Please fill a bug report at https://github.com/xamarin/xamarin-macios/issues/new. + The format-able message the diagnostic displays. + + + Unexpected error + The title of the diagnostic. + + \ No newline at end of file diff --git a/src/rgen/Microsoft.Macios.Generator/TabbedStringBuilder.cs b/src/rgen/Microsoft.Macios.Generator/TabbedStringBuilder.cs new file mode 100644 index 000000000000..1494228cff57 --- /dev/null +++ b/src/rgen/Microsoft.Macios.Generator/TabbedStringBuilder.cs @@ -0,0 +1,242 @@ +using System; +using System.Runtime.CompilerServices; +using System.Text; + +namespace Microsoft.Macios.Generator; + + +/// +/// String builder wrapper that keeps track of the current indentation level by abusing the IDisposable pattern. Rather +/// than dispose data, what the IDisposable pattern allows is to create a new block with an increased indentation, that +/// way we do not need to keep track of the current indentation level. +/// +/// var classBlock = new TabbedStringBuilder (sb); +/// classBlock.AppendLine ("public static NSString? GetConstant (this {enumSymbol.Name} self)"); +/// // open a new {} block, no need to keep track of the indentation, the new block has it +/// using (var getConstantBlock = classBlock.CreateBlock (isBlock: true)) { +/// // write the contents of the method here. +/// } +/// +/// +class TabbedStringBuilder : IDisposable { + readonly StringBuilder sb; + readonly uint tabCount; + readonly bool isBlock; + bool disposed; + + /// + /// Created a new tabbed string builder that will use the given sb to write code. + /// + /// The string builder to be used to write code. + /// The original tab size. + /// States if we are creating a {} block. + public TabbedStringBuilder (StringBuilder builder, uint currentCount = 0, bool block = false) + { + sb = builder; + isBlock = block; + if (isBlock) { + // increase by 1 because we are in a block + tabCount = currentCount; + WriteTabs ().Append ('{').AppendLine (); + tabCount++; + } else { + tabCount = currentCount; + } + } + + StringBuilder WriteTabs () => sb.Append ('\t', (int) tabCount); + + /// + /// Append a new empty line to the string builder using the correct tab size. + /// + /// The current tabbed string builder. + public TabbedStringBuilder AppendLine () + { + sb.AppendLine (); + return this; + } + + /// + /// Append conteng, but do not add a \n + /// + /// The content to append. + /// The current builder. + public TabbedStringBuilder Append (string line) + { + if (string.IsNullOrWhiteSpace (line)) { + sb.Append (line); + } else { + WriteTabs ().Append (line); + } + return this; + } + + /// + /// Append conteng, but do not add a \n + /// + /// The content to append. + /// The current builder. + public TabbedStringBuilder Append (ReadOnlySpan span) + { + if (span.IsWhiteSpace ()) { + sb.Append (span); + } else { + WriteTabs ().Append (span); + } + + return this; + } + + /// + /// Append a new tabbed line. + /// + /// The line to append. + /// The current builder. + public TabbedStringBuilder AppendLine (string line) + { + if (string.IsNullOrWhiteSpace (line)) { + sb.AppendLine (line); + } else { + WriteTabs ().AppendLine (line); + } + return this; + } + + /// + /// Append a new tabbed lien from the span. + /// + /// The line to append. + /// The current builder. + public TabbedStringBuilder AppendLine (ReadOnlySpan span) + { + if (span.IsWhiteSpace ()) { + sb.Append (span).AppendLine (); + } else { + WriteTabs ().Append (span).AppendLine (); + } + + return this; + } + + public TabbedStringBuilder Append (ref DefaultInterpolatedStringHandler handler) + { + WriteTabs ().Append (handler.ToStringAndClear ()); + return this; + } + + public TabbedStringBuilder AppendLine (ref DefaultInterpolatedStringHandler handler) + { + WriteTabs ().Append (handler.ToStringAndClear ()).AppendLine (); + return this; + } + + /// + /// Append a new raw literal by prepending the correct indentation. + /// + /// The raw string to append. + /// The current builder. + public TabbedStringBuilder AppendRaw (string rawString) + { + // we will split the raw string in lines and then append them so that the + // tabbing is correct + var lines = rawString.AsSpan ().Split ('\n'); + var count = 0; + foreach (var range in lines) { + if (count > 0) + AppendLine (); + var line = rawString.AsSpan (range); + Append (line); + count++; + } + return this; + } + + /// + /// Append the generated code attribute to the current string builder. Added for convenience. + /// + /// If the binding is Optimizable or not. + /// The current builder. + public TabbedStringBuilder AppendGeneratedCodeAttribute (bool optimizable = true) + { + if (optimizable) { + const string attr = "[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]"; + AppendLine (attr); + } else { + const string attr = "[BindingImpl (BindingImplOptions.GeneratedCode)]"; + AppendLine (attr); + } + + return this; + } + + /// + /// Append a EditorBrowsable attribute. Added for convenience. + /// + /// The current builder. + public TabbedStringBuilder AppendEditorBrowsableAttribute () + { + const string attr = "[EditorBrowsable (EditorBrowsableState.Never)]"; + AppendLine (attr); + return this; + } + + /// + /// Writes the autogenerated header and other pragmas. + /// + /// The current builder. + public TabbedStringBuilder WriteHeader () + { + // let people know this is generated code + AppendLine ("// "); + + // enable nullable! + AppendLine (); + AppendLine ("#nullable enable"); + AppendLine (); + return this; + } + + /// + /// Create a bew empty block. + /// + /// If it is a block that uses {} or not. + /// The new bloc. + public TabbedStringBuilder CreateBlock (bool block) => CreateBlock (string.Empty, block); + + /// + /// Create a new block with the given line. This method can be used to write if/else statements. + /// + /// The new line to append + /// If the new line should considered a block. + /// The current builder. + public TabbedStringBuilder CreateBlock (string line, bool block) + { + if (!string.IsNullOrEmpty (line)) { + WriteTabs ().AppendLine (line); + } + + return new TabbedStringBuilder (sb, tabCount, block); + } + + /// + /// Return the string builder as a string. + /// + /// + public override string ToString () + { + Dispose (); + return sb.ToString (); + } + + /// + /// Does not really dispose anything, it just closes the current block. + /// + public void Dispose () + { + if (disposed || !isBlock) return; + + disposed = true; + sb.Append ('\t', (int) tabCount - 1); + sb.Append ('}').AppendLine (); + } +} diff --git a/src/rgen/rgen.sln b/src/rgen/rgen.sln new file mode 100644 index 000000000000..948cf66ece11 --- /dev/null +++ b/src/rgen/rgen.sln @@ -0,0 +1,52 @@ + +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 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Macios.Binding.Common", "Microsoft.Macios.Binding.Common\Microsoft.Macios.Binding.Common.csproj", "{536758BC-2A88-4B79-ABB1-6B39494A5FE6}" +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 + {536758BC-2A88-4B79-ABB1-6B39494A5FE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {536758BC-2A88-4B79-ABB1-6B39494A5FE6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {536758BC-2A88-4B79-ABB1-6B39494A5FE6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {536758BC-2A88-4B79-ABB1-6B39494A5FE6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/rosetta.pl b/src/rosetta.pl deleted file mode 100644 index 4feeec8db8fd..000000000000 --- a/src/rosetta.pl +++ /dev/null @@ -1,21 +0,0 @@ -print "MonoTouch Rosetta Stone"; - -while (<>){ - print "

Namespace $1

\n" if $_ =~ /namespace(.*){/; - print "

Class $1

\n" if $_ =~ /interface (.*){/; - - if (/Export/){ - ($sel) = $_ =~ /"(.*)"/; - chop; - $a = <>; - chop $a; - $a =~ s/^[ \t]*//; - if ($a =~ /get;|set;/){ - $t = "Property:"; - } else { - $t = "Method:"; - } - print "\t
Selector: $sel\t
\n\t$t $a
\n"; - } -} -print ""; diff --git a/src/scenekit.cs b/src/scenekit.cs index 0822a5ed6f84..722d23ba0d5a 100644 --- a/src/scenekit.cs +++ b/src/scenekit.cs @@ -1369,11 +1369,7 @@ interface SCNLight : SCNAnimatable, SCNTechniqueSupport, NSCopying, NSSecureCodi [Static, Export ("light")] SCNLight Create (); -#if XAMCORE_3_0 [NoiOS] -#elif !MONOMAC - [Obsolete ("Do not use; this method only exist in macOS, not in iOS.")] -#endif [NoTV] [Deprecated (PlatformName.MacOSX, 10, 10)] [NoMacCatalyst] @@ -1381,11 +1377,7 @@ interface SCNLight : SCNAnimatable, SCNTechniqueSupport, NSCopying, NSSecureCodi [return: NullAllowed] NSObject GetAttribute (NSString lightAttribute); -#if XAMCORE_3_0 [NoiOS] -#elif !MONOMAC - [Obsolete ("Do not use; this method only exist in macOS, not in iOS.")] -#endif [NoTV] [Deprecated (PlatformName.MacOSX, 10, 10)] [NoMacCatalyst] @@ -1967,7 +1959,7 @@ interface SCNSceneLoadingOptions { [MacCatalyst (13, 1)] [BaseType (typeof (NSObject))] interface SCNNode : SCNAnimatable, SCNBoundingVolume, SCNActionable, NSCopying, NSSecureCoding -#if IOS || TVOS +#if (IOS || TVOS) && !XAMCORE_5_0 // Conformance Removed in Xcode 16.1 , UIFocusItem #endif { diff --git a/src/spritekit.cs b/src/spritekit.cs index c45535c821c9..d56fc61c83d5 100644 --- a/src/spritekit.cs +++ b/src/spritekit.cs @@ -1205,16 +1205,14 @@ partial interface SKShapeNode { [Static, Export ("shapeNodeWithEllipseOfSize:")] SKShapeNode FromEllipse (CGSize size); -#if XAMCORE_3_0 // Hide this ugly api fixes https://bugzilla.xamarin.com/show_bug.cgi?id=39706 + // Hide this ugly api fixes https://bugzilla.xamarin.com/show_bug.cgi?id=39706 [Internal] -#endif [MacCatalyst (13, 1)] [Static, Export ("shapeNodeWithPoints:count:")] SKShapeNode FromPoints (ref CGPoint points, nuint numPoints); -#if XAMCORE_3_0 // Hide this ugly api fixes https://bugzilla.xamarin.com/show_bug.cgi?id=39706 + // Hide this ugly api fixes https://bugzilla.xamarin.com/show_bug.cgi?id=39706 [Internal] -#endif [MacCatalyst (13, 1)] [Static, Export ("shapeNodeWithSplinePoints:count:")] SKShapeNode FromSplinePoints (ref CGPoint points, nuint numPoints); @@ -1533,9 +1531,7 @@ partial interface SKCropNode { [NoWatch] [MacCatalyst (13, 1)] [BaseType (typeof (UIView))] -#if XAMCORE_3_0 [DisableDefaultCtor] -#endif #if MONOMAC partial interface SKView : NSSecureCoding { #else 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/src/touch-unit.sources b/src/touch-unit.sources deleted file mode 100644 index e6fbbbb5c5f8..000000000000 --- a/src/touch-unit.sources +++ /dev/null @@ -1,299 +0,0 @@ -NUNITLITE_SOURCES = \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/AssemblyInfo.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Assert.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/AssertionHelper.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Assume.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Contains.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Env.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/GlobalSettings.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Guard.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Has.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/IExpectException.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Is.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Iz.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/ListMapper.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/MessageMatch.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/ObjectList.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/SpecialValue.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/TestCaseData.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/TestContext.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Throws.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ExpectedExceptionData.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/IParameterDataSource.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/IPropertyBag.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITest.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestAssemblyBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestAssemblyRunner.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestCaseData.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestCaseSource.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestCaseSourceProvider.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestListener.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ITestResult.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/IXmlNodeBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/PropertyEntry.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/ResultState.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/RunState.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/TestOutput.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/TestStatus.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Api/XmlNode.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/CategoryAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/CombinatorialAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/CultureAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/DataAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/DatapointAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/DatapointSourceAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/DatapointsAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/DescriptionAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/ExpectedExceptionAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/ExplicitAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/IgnoreAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/IncludeExcludeAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/MaxTimeAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/NUnitAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/PairwiseAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/PlatformAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/PropertyAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/RandomAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/RangeAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/RepeatAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/SequentialAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/SetCultureAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/SetUICultureAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/SetUpAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TearDownAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TestAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TestCaseAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TestCaseSourceAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TestFixtureAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TestFixtureSetUpAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TestFixtureTearDownAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TheoryAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/TimeoutAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/ValueSourceAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Attributes/ValuesAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/AllItemsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/AndConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/AssignableFromConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/AssignableToConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/AttributeConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/AttributeExistsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/BasicConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/BinaryConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/BinarySerializableConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/CollectionConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/CollectionContainsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/CollectionEquivalentConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/CollectionItemsEqualConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/CollectionOrderedConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/CollectionSubsetConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/CollectionTally.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ComparisonAdapter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ComparisonConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Constraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ConstraintBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ConstraintExpression.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ConstraintExpressionBase.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ConstraintFactory.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ContainsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/DelayedConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/EmptyCollectionConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/EmptyConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/EmptyDirectoryConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/EmptyStringConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/EndsWithConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/EqualConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/EqualityAdapter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ExactCountConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ExactTypeConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ExceptionTypeConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/FalseConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/FloatingPointNumerics.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/GreaterThanConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/GreaterThanOrEqualConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/IResolveConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/InstanceOfTypeConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/LessThanConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/LessThanOrEqualConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/MessageWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/MsgUtils.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/NUnitComparer.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/NUnitEqualityComparer.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/NaNConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/NoItemConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/NotConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/NullConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/NullOrEmptyStringConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Numerics.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/OrConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/PathConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/PredicateConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/PrefixConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/PropertyConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/PropertyExistsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/RangeConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/RegexConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ResolvableConstraintExpression.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ReusableConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/SameAsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/SamePathConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/SamePathOrUnderConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/SomeItemsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/StartsWithConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/StringConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/SubstringConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ThrowsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ThrowsNothingConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Tolerance.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/ToleranceMode.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/TrueConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/TypeConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/UniqueItemsConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/XmlSerializableConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/AndOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/AttributeOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/BinaryOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/CollectionOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/ConstraintOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/ExactCountOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/NotOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/OrOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/PrefixOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/PropOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/SelfResolvingOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/ThrowsOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/WithOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Exceptions/AssertionException.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Exceptions/IgnoreException.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Exceptions/InconclusiveException.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Exceptions/SuccessException.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Extensibility/IParameterDataProvider.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Extensibility/ISuiteBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Extensibility/ITestCaseBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Extensibility/ITestCaseProvider.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/FinallyDelegate.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/AssemblyHelper.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/CultureDetector.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/ExceptionHelper.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/IApplyToContext.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/IApplyToTest.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/InvalidTestFixtureException.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/MethodHelper.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/NUnitException.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/NUnitLiteTestAssemblyBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/NUnitLiteTestAssemblyRunner.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/OSPlatform.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/ParameterSet.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/PlatformHelper.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/PropertyBag.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/PropertyNames.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Randomizer.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Reflect.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/RuntimeFramework.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/StackFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/TestExecutionContext.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/TestFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/TestFixtureBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/TestListener.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/TextMessageWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/ThreadUtility.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/TypeHelper.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/CombinatorialStrategy.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/CombinatorialTestCaseProvider.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/CombiningStrategy.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/DataAttributeTestCaseProvider.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/DatapointProvider.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/NUnitTestCaseBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/NUnitTestFixtureBuilder.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/PairwiseStrategy.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/ParameterDataProvider.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/ProviderCache.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Builders/SequentialStrategy.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/ApplyChangesToContextCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/CommandDecoratorList.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/CommandStage.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/DelegatingTestCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/ExpectedExceptionCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/ICommandDecorator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/MaxTimeCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/RepeatedTestCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/SetUpTearDownCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/SkipCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/TestCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/TestMethodCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Extensibility/ParameterDataProviders.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Extensibility/TestCaseProviders.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Filters/AndFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Filters/CategoryExpression.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Filters/CategoryFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Filters/NotFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Filters/OrFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Filters/SimpleNameFilter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Results/TestCaseResult.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Results/TestResult.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Results/TestSuiteResult.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Tests/ParameterizedFixtureSuite.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Tests/ParameterizedMethodSuite.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Tests/Test.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Tests/TestAssembly.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Tests/TestFixture.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Tests/TestMethod.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Tests/TestSuite.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/WorkItems/CompositeWorkItem.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/WorkItems/CountdownEvent.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/WorkItems/SimpleWorkItem.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/WorkItems/WorkItem.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/WorkItems/WorkItemState.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/CommandLineOptions.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/ConsoleWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/DebugWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/ResultSummary.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/TcpWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/OutputWriters/NUnit2XmlOutputWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/OutputWriters/NUnit3XmlOutputWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/OutputWriters/OutputWriter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/AllOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/NoneOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/Operators/SomeOperator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/FailurePoint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Constraints/SubPathConstraint.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Compatibility/SerializableAttribute.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Runner/ResultReporter.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/AsyncInvocationRegion.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/AsyncSynchronizationContext.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/RandomGenerator.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/StringUtil.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/FlakyTestRetriesCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/OneTimeSetUpCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/OneTimeTearDownCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/TheoryResultCommand.cs \ - $(MONO_IOS_SDK_DESTDIR)/ios-sources/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Filters/SimpleCategoryExpression.cs \ - -IOS_TOUCHUNIT_SOURCES = \ - $(NUNITLITE_SOURCES) \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/HttpTextWriter.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/Options.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/NUnitOutputTextWriter.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TestCaseElement.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TestElement.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TestSuiteElement.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TouchRunner.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TouchViewController.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TcpTextWriter.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TouchOptions.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TestRocks.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TestResultElement.cs \ - -TVOS_TOUCHUNIT_SOURCES = \ - $(IOS_TOUCHUNIT_SOURCES) \ - - -WATCHOS_TOUCHUNIT_SOURCES = \ - $(NUNITLITE_SOURCES) \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/HttpTextWriter.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/Options.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/NUnitOutputTextWriter.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TouchRunner.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TcpTextWriter.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TouchOptions.cs \ - $(TOUCH_UNIT_PATH)/NUnitLite/TouchRunner/TestRocks.cs \ diff --git a/src/tvservices.cs b/src/tvservices.cs index 39facc15825b..c8debacb13f7 100644 --- a/src/tvservices.cs +++ b/src/tvservices.cs @@ -390,5 +390,9 @@ interface TVUserActivityType { [Field ("TVUserActivityTypeBrowsingChannelGuide")] NSString BrowsingChannelGuide { get; } + + [TV (18, 1)] + [Field ("TVUserActivityTypeBrowsingEntertainmentContent")] + NSString BrowsingEntertainmentContent { get; } } } diff --git a/src/uikit.cs b/src/uikit.cs index a8c8a1bb48fc..c032b522ba74 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -312,20 +312,6 @@ public enum UISearchControllerScopeBarActivation : long { // In the hopes that the parameter is self document: this array can contain either UIDocuments or UIResponders delegate void UIApplicationRestorationHandler (NSObject [] uidocumentOrResponderObjects); -#if !XAMCORE_3_0 - [NoWatch] - [MacCatalyst (13, 1)] -#pragma warning disable 0618 // warning CS0618: 'CategoryAttribute.CategoryAttribute(bool)' is obsolete: 'Inline the static members in this category in the category's class (and remove this obsolete once fixed)' - [Category (allowStaticMembers: true)] // Classic isn't internal so we need this -#pragma warning restore - [BaseType (typeof (NSAttributedString))] - interface NSAttributedStringAttachmentConveniences { - [Internal] - [Static, Export ("attributedStringWithAttachment:")] - NSAttributedString FromTextAttachment (NSTextAttachment attachment); - } -#endif - /// Abstract base class for classes that generate feedback hints, such as haptics. [NoWatch, NoTV] [MacCatalyst (13, 1)] @@ -2294,10 +2280,6 @@ interface UIViewControllerPreviewing { [Export ("delegate", ArgumentSemantic.Assign), NullAllowed] NSObject WeakDelegate { get; // readonly -#if !XAMCORE_3_0 - [NotImplemented] - set; -#endif } [Wrap ("WeakDelegate")] @@ -4687,15 +4669,8 @@ interface IUICollectionViewDelegate { } [MacCatalyst (13, 1)] [Model] [Protocol] -#if XAMCORE_3_0 && !NET - // bind like UITableViewDelegate to avoid generating duplicate code - // it's an API break (binary, source should be fine) - [BaseType (typeof (UIScrollViewDelegate))] - interface UICollectionViewDelegate { -#else [BaseType (typeof (NSObject))] interface UICollectionViewDelegate : UIScrollViewDelegate { -#endif [Export ("collectionView:shouldHighlightItemAtIndexPath:")] bool ShouldHighlightItem (UICollectionView collectionView, NSIndexPath indexPath); @@ -7729,32 +7704,6 @@ interface UIKeyboard { [Notification (typeof (UIKeyboardEventArgs))] NSString DidChangeFrameNotification { get; } -#if !XAMCORE_3_0 - // - // Deprecated methods - // - - [NoTV] - [Deprecated (PlatformName.iOS, 3, 2)] - [MacCatalyst (13, 1)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Field ("UIKeyboardCenterBeginUserInfoKey")] - NSString CenterBeginUserInfoKey { get; } - - [NoTV] - [Deprecated (PlatformName.iOS, 3, 2)] - [MacCatalyst (13, 1)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Field ("UIKeyboardCenterEndUserInfoKey")] - NSString CenterEndUserInfoKey { get; } - - [NoTV] - [Deprecated (PlatformName.iOS, 3, 2)] - [MacCatalyst (13, 1)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Field ("UIKeyboardBoundsUserInfoKey")] - NSString BoundsUserInfoKey { get; } -#endif // // Keys // @@ -10199,23 +10148,6 @@ interface UIButton : UIAccessibilityContentSizeCategoryImageAdjusting [Export ("imageRectForContentRect:")] CGRect ImageRectForContentRect (CGRect rect); -#if !XAMCORE_3_0 - [Deprecated (PlatformName.iOS, 3, 0)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Export ("font", ArgumentSemantic.Retain)] - UIFont Font { get; set; } - - [Deprecated (PlatformName.iOS, 3, 0)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Export ("lineBreakMode")] - UILineBreakMode LineBreakMode { get; set; } - - [Deprecated (PlatformName.iOS, 3, 0)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Export ("titleShadowOffset")] - CGSize TitleShadowOffset { get; set; } -#endif - // // 6.0 // @@ -10858,13 +10790,6 @@ interface UIImagePickerController { [Export ("mediaTypes", ArgumentSemantic.Copy)] string [] MediaTypes { get; set; } -#if !XAMCORE_3_0 - [Export ("allowsImageEditing")] - [Deprecated (PlatformName.iOS, 3, 1)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - bool AllowsImageEditing { get; set; } -#endif - // // 3.1 APIs // @@ -10974,12 +10899,6 @@ interface UIImagePickerController { [Model] [Protocol] interface UIImagePickerControllerDelegate { -#if !XAMCORE_3_0 - [Obsoleted (PlatformName.iOS, 3, 0)] - [Export ("imagePickerController:didFinishPickingImage:editingInfo:"), EventArgs ("UIImagePickerImagePicked")] - void FinishedPickingImage (UIImagePickerController picker, UIImage image, NSDictionary editingInfo); -#endif - [Export ("imagePickerController:didFinishPickingMediaWithInfo:"), EventArgs ("UIImagePickerMediaPicked")] void FinishedPickingMedia (UIImagePickerController picker, NSDictionary info); @@ -15297,13 +15216,6 @@ interface UITableViewSource { [Export ("tableView:viewForFooterInSection:")] UIView GetViewForFooter (UITableView tableView, nint section); -#if !XAMCORE_3_0 - [Deprecated (PlatformName.iOS, 3, 0)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Export ("tableView:accessoryTypeForRowWithIndexPath:")] - UITableViewCellAccessory AccessoryForRow (UITableView tableView, NSIndexPath indexPath); -#endif - [Export ("tableView:accessoryButtonTappedForRowWithIndexPath:")] void AccessoryButtonTapped (UITableView tableView, NSIndexPath indexPath); @@ -15786,13 +15698,6 @@ interface UITableViewDelegate { [Export ("tableView:viewForFooterInSection:")] UIView GetViewForFooter (UITableView tableView, nint section); -#if !XAMCORE_3_0 - [Deprecated (PlatformName.iOS, 3, 0)] - [Deprecated (PlatformName.MacCatalyst, 13, 1)] - [Export ("tableView:accessoryTypeForRowWithIndexPath:")] - UITableViewCellAccessory AccessoryForRow (UITableView tableView, NSIndexPath indexPath); -#endif - [Export ("tableView:accessoryButtonTappedForRowWithIndexPath:")] void AccessoryButtonTapped (UITableView tableView, NSIndexPath indexPath); @@ -18635,6 +18540,8 @@ partial interface UITraitEnvironment { void TraitCollectionDidChange ([NullAllowed] UITraitCollection previousTraitCollection); } + delegate void UITraitMutations (IUIMutableTraits mutableTraits); + [NoWatch] [MacCatalyst (13, 1)] [BaseType (typeof (NSObject))] @@ -18664,6 +18571,9 @@ partial interface UITraitCollection : NSCopying, NSSecureCoding { [Export ("containsTraitsInCollection:")] bool Contains (UITraitCollection trait); + [Deprecated (PlatformName.iOS, 17, 0, message: "Use 'GetTraitCollectionWithTraits(UITraitMutations)' and 'GetTraitCollectionByModifyingTraits(UITraitMutations)' instead.")] + [Deprecated (PlatformName.MacCatalyst, 17, 0, message: "Use 'GetTraitCollectionWithTraits(UITraitMutations)' and 'GetTraitCollectionByModifyingTraits(UITraitMutations)' instead.")] + [Deprecated (PlatformName.TvOS, 17, 0, message: "Use 'GetTraitCollectionWithTraits(UITraitMutations)' and 'GetTraitCollectionByModifyingTraits(UITraitMutations)' instead.")] [Static, Export ("traitCollectionWithTraitsFromCollections:")] UITraitCollection FromTraitsFromCollections (UITraitCollection [] traitCollections); @@ -18812,14 +18722,23 @@ partial interface UITraitCollection : NSCopying, NSSecureCoding { [Export ("toolbarItemPresentationSize")] UINSToolbarItemPresentationSize ToolbarItemPresentationSize { get; } +#if !XAMCORE_5_0 + [Obsolete ("Use the overload that takes a 'UITraitMutations' parameter instead.")] + [EditorBrowsable (EditorBrowsableState.Never)] [Watch (10, 0), TV (17, 0), iOS (17, 0), MacCatalyst (17, 0)] [Static] [Export ("traitCollectionWithTraits:")] UITraitCollection GetTraitCollectionWithTraits (Func mutations); +#endif + + [Watch (10, 0), TV (17, 0), iOS (17, 0), MacCatalyst (17, 0)] + [Static] + [Export ("traitCollectionWithTraits:")] + UITraitCollection GetTraitCollectionWithTraits (UITraitMutations mutations); [Watch (10, 0), TV (17, 0), iOS (17, 0), MacCatalyst (17, 0)] [Export ("traitCollectionByModifyingTraits:")] - UITraitCollection GetTraitCollectionByModifyingTraits (Func mutations); + UITraitCollection GetTraitCollectionByModifyingTraits (UITraitMutations mutations); [Watch (10, 0), TV (17, 0), iOS (17, 0), MacCatalyst (17, 0)] [Static] @@ -30987,4 +30906,27 @@ interface NSUIViewToolbarItem { UIView UIView { get; [Bind ("setUIView:")] set; } } + [NoMac, NoWatch, NoTV, iOS (18, 1), MacCatalyst (18, 1)] + delegate IUITextInput UITextInputReturnHandler (); + + [NoMac, NoWatch, NoTV, iOS (18, 1), MacCatalyst (18, 1)] + [Category] + [BaseType (typeof (NSObject))] + interface NSObject_UIAccessibilityTextOperations { + + [return: NullAllowed] + [Export ("accessibilityTextInputResponder")] + IUITextInput GetAccessibilityTextInputResponder (); + + [Export ("setAccessibilityTextInputResponder:")] + void SetAccessibilityTextInputResponder ([NullAllowed] IUITextInput textInput); + + [return: NullAllowed] + [Export ("accessibilityTextInputResponderBlock")] + UITextInputReturnHandler GetAccessibilityTextInputResponderHandler (); + + [Export ("setAccessibilityTextInputResponderBlock:")] + void SetAccessibilityTextInputResponderHandler ([NullAllowed] UITextInputReturnHandler handler); + } + } diff --git a/src/vision.cs b/src/vision.cs index 47408698ca42..fa98a0daeb15 100644 --- a/src/vision.cs +++ b/src/vision.cs @@ -38,6 +38,12 @@ namespace Vision { + [Partial] + interface VNUtils { + [Field ("VNVisionVersionNumber")] + double VisionVersionNumber { get; } + } + /// Enumerates errors associated with Vision requests. [ErrorDomain ("VNErrorDomain")] [MacCatalyst (13, 1)] diff --git a/src/watchkit.cs b/src/watchkit.cs index 5de9374b825a..a71267ef0be1 100644 --- a/src/watchkit.cs +++ b/src/watchkit.cs @@ -182,12 +182,6 @@ interface WKInterfaceController { [Export ("reloadRootPageControllersWithNames:contexts:orientation:pageIndex:")] void ReloadRootPageControllers (string [] names, [NullAllowed] NSObject [] contexts, WKPageOrientation orientation, nint pageIndex); -#if !XAMCORE_3_0 && !NET - // now exposed with the corresponding WKErrorCode enum - [Field ("WatchKitErrorDomain")] - NSString ErrorDomain { get; } -#endif - [Export ("dismissMediaPlayerController")] void DismissMediaPlayerController (); diff --git a/src/webkit.cs b/src/webkit.cs index 807674a82b7b..a48951edf953 100644 --- a/src/webkit.cs +++ b/src/webkit.cs @@ -1216,15 +1216,6 @@ partial interface DomEvent { [Export ("preventDefault")] void PreventDefault (); -#if !XAMCORE_3_0 - [Obsolete ("Use the constructor instead.")] - [Export ("initEvent:canBubbleArg:cancelableArg:")] - void InitEvent (string eventTypeArg, bool canBubbleArg, bool cancelableArg); -#endif - -#if !XAMCORE_3_0 - [Sealed] // Just to avoid the duplicate selector error -#endif [Export ("initEvent:canBubbleArg:cancelableArg:")] NativeHandle Constructor (string eventTypeArg, bool canBubbleArg, bool cancelableArg); } @@ -1237,14 +1228,6 @@ partial interface DomEvent { [BaseType (typeof (DomEvent), Name = "DOMOverflowEvent")] [DisableDefaultCtor] partial interface DomOverflowEvent { -#if !XAMCORE_3_0 - [Obsolete ("Use the constructor instead.")] - [Export ("initOverflowEvent:horizontalOverflow:verticalOverflow:")] - void InitEvent (ushort orient, bool hasHorizontalOverflow, bool hasVerticalOverflow); -#endif -#if !XAMCORE_3_0 - [Sealed] // Just to avoid the duplicate selector error -#endif [Export ("initOverflowEvent:horizontalOverflow:verticalOverflow:")] NativeHandle Constructor (ushort orient, bool hasHorizontalOverflow, bool hasVerticalOverflow); @@ -1278,14 +1261,6 @@ partial interface DomProgressEvent { [BaseType (typeof (DomEvent), Name = "DOMUIEvent")] [DisableDefaultCtor] partial interface DomUIEvent { -#if !XAMCORE_3_0 - [Obsolete ("Use the constructor instead.")] - [Export ("initUIEvent:canBubble:cancelable:view:detail:")] - void InitEvent (string eventType, bool canBubble, bool cancelable, DomAbstractView view, int /* int, not NSInteger */ detail); -#endif -#if !XAMCORE_3_0 - [Sealed] // Just to avoid the duplicate selector error -#endif [Export ("initUIEvent:canBubble:cancelable:view:detail:")] NativeHandle Constructor (string eventType, bool canBubble, bool cancelable, DomAbstractView view, int /* int, not NSInteger */ detail); @@ -1319,25 +1294,9 @@ partial interface DomUIEvent { [BaseType (typeof (DomUIEvent), Name = "DOMKeyboardEvent")] [DisableDefaultCtor] partial interface DomKeyboardEvent { -#if !XAMCORE_3_0 - [Obsolete ("Use the constructor instead.")] - [Export ("initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:")] - void InitEvent (string eventType, bool canBubble, bool cancelable, DomAbstractView view, string keyIdentifier, DomKeyLocation keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey); - - [Obsolete ("Use the constructor instead.")] - [Export ("initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:")] - void InitEvent (string eventType, bool canBubble, bool cancelable, DomAbstractView view, string keyIdentifier, DomKeyLocation keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); -#endif - -#if !XAMCORE_3_0 - [Sealed] // Just to avoid the duplicate selector error -#endif [Export ("initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:")] NativeHandle Constructor (string eventType, bool canBubble, bool cancelable, DomAbstractView view, string keyIdentifier, DomKeyLocation keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey); -#if !XAMCORE_3_0 - [Sealed] // Just to avoid the duplicate selector error -#endif [Export ("initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:")] NativeHandle Constructor (string eventType, bool canBubble, bool cancelable, DomAbstractView view, string keyIdentifier, DomKeyLocation keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); @@ -1377,14 +1336,6 @@ partial interface DomKeyboardEvent { [BaseType (typeof (DomUIEvent), Name = "DOMMouseEvent")] [DisableDefaultCtor] partial interface DomMouseEvent { -#if !XAMCORE_3_0 - [Obsolete ("Use the constructor instead.")] - [Export ("initMouseEvent:canBubble:cancelable:view:detail:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:button:relatedTarget:")] - void InitEvent (string eventType, bool canBubble, bool cancelable, DomAbstractView view, int /* int, not NSInteger */ detail, int /* int, not NSInteger */ screenX, int /* int, not NSInteger */ screenY, int /* int, not NSInteger */ clientX, int /* int, not NSInteger */ clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, ushort button, IDomEventTarget relatedTarget); -#endif -#if !XAMCORE_3_0 - [Sealed] // Just to avoid the duplicate selector error -#endif [Export ("initMouseEvent:canBubble:cancelable:view:detail:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:button:relatedTarget:")] NativeHandle Constructor (string eventType, bool canBubble, bool cancelable, DomAbstractView view, int /* int, not NSInteger */ detail, int /* int, not NSInteger */ screenX, int /* int, not NSInteger */ screenY, int /* int, not NSInteger */ clientX, int /* int, not NSInteger */ clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, ushort button, IDomEventTarget relatedTarget); @@ -1442,14 +1393,6 @@ partial interface DomMouseEvent { [BaseType (typeof (DomMouseEvent), Name = "DOMWheelEvent")] [DisableDefaultCtor] partial interface DomWheelEvent { -#if !XAMCORE_3_0 - [Obsolete ("Use the constructor instead.")] - [Export ("initWheelEvent:wheelDeltaY:view:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:")] - void InitEvent (int /* int, not NSInteger */ wheelDeltaX, int /* int, not NSInteger */ wheelDeltaY, DomAbstractView view, int /* int, not NSInteger */ screenX, int /* int, not NSInteger */ screnY, int /* int, not NSInteger */ clientX, int /* int, not NSInteger */ clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); -#endif -#if !XAMCORE_3_0 - [Sealed] // Just to avoid the duplicate selector error -#endif [Export ("initWheelEvent:wheelDeltaY:view:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:")] NativeHandle Constructor (int /* int, not NSInteger */ wheelDeltaX, int /* int, not NSInteger */ wheelDeltaY, DomAbstractView view, int /* int, not NSInteger */ screenX, int /* int, not NSInteger */ screnY, int /* int, not NSInteger */ clientX, int /* int, not NSInteger */ clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); diff --git a/src/xamios.tmpl.csproj b/src/xamios.tmpl.csproj deleted file mode 100644 index 00ed0609ff1d..000000000000 --- a/src/xamios.tmpl.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - Xamarin.iOS - true - ..\product.snk - build\IDE\obj\iOS\$(Configuration) - latest - - - true - full - false - build\IDE\bin\iOS\Debug - IPHONE;IOS;MINIMAL;MONOTOUCH - prompt - 4 - false - true - True - 3021,3014,3003 - - - none - false - build\IDE\bin\iOS\Release - IPHONE;IOS;MINIMAL;MONOTOUCH - prompt - 4 - false - true - - - - - - - - - - - build\ios\native\%(RecursiveDir)%(Filename).cs - - - - - - diff --git a/src/xammac.pc.in b/src/xammac.pc.in deleted file mode 100644 index 04dfc44e23a9..000000000000 --- a/src/xammac.pc.in +++ /dev/null @@ -1,9 +0,0 @@ -prefix=${pcfiledir}/../.. -exec_prefix=${prefix} -libdir=${exec_prefix}/lib/mono -GacPackage=false - -Name: Xamarin.Mac -Description: Xamarin.Mac -Version: @PACKAGE_VERSION@ -Libs: -r:${libdir}/XamMac.dll diff --git a/src/xammac.tmpl.csproj b/src/xammac.tmpl.csproj deleted file mode 100644 index 0887b24c5441..000000000000 --- a/src/xammac.tmpl.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - - Debug - AnyCPU - {87042AD2-CDC9-4A53-9193-56226B668B88} - {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - Xamarin.Mac - v2.0 - Xamarin.Mac - true - ..\product.snk - build\IDE\obj\macOS-mobile\$(Configuration) - latest - - - true - full - false - build\IDE\bin\macOS-mobile\Debug - DEBUG;MONOMAC;NO_SYSTEM_DRAWING - prompt - 4 - false - true - - - full - true - build\IDE\bin\macOS-mobile\Release - MONOMAC;NO_SYSTEM_DRAWING - prompt - 4 - false - true - - - - - - - - - - build\mac\mobile\%(RecursiveDir)%(Filename).cs - - - - - - diff --git a/src/xammaccatalyst.tmpl.csproj b/src/xammaccatalyst.tmpl.csproj deleted file mode 100644 index a1d610867f5d..000000000000 --- a/src/xammaccatalyst.tmpl.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {E1F334C3-8F77-46C9-A28B-A8E9BAEA9FE5} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - Xamarin.MacCatalyst - true - ..\product.snk - build\IDE\obj\MacCatalyst\$(Configuration) - latest - - - true - full - false - build\IDE\bin\MacCatalyst\Debug - IPHONE;MACCATALYST;MINIMAL;MONOTOUCH - prompt - 4 - false - true - True - 3021,3014,3003 - - - none - false - build\IDE\bin\MacCatalyst\Release - IPHONE;MACCATALYST;MINIMAL;MONOTOUCH - prompt - 4 - false - true - - - - - - - - - - - build\maccatalyst\native\%(RecursiveDir)%(Filename).cs - - - - - - diff --git a/src/xamtvos.tmpl.csproj b/src/xamtvos.tmpl.csproj deleted file mode 100644 index be995872e0f3..000000000000 --- a/src/xamtvos.tmpl.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {072C1DD1-7566-4387-B9EC-466891558ACC} - {06FA79CB-D6CD-4721-BB4B-1BD202089C55};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - Xamarin.TVOS - true - ..\product.snk - build\IDE\obj\tvOS\$(Configuration) - latest - - - true - full - false - build\IDE\bin\tvOS\Debug - MONOTOUCH;IPHONE;TVOS;XAMCORE_3_0 - prompt - 4 - false - true - True - 3021,3014,3003 - - - none - false - build\IDE\bin\tvOS\Release - MONOTOUCH;TVOS - prompt - 4 - false - true - - - - - - - - - - - build\tvos\tvos\%(RecursiveDir)%(Filename).cs - - - - - - diff --git a/src/xamwatch.tmpl.csproj b/src/xamwatch.tmpl.csproj deleted file mode 100644 index 1f6b12d370f4..000000000000 --- a/src/xamwatch.tmpl.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {B84C539D-971D-4703-8ABC-E1077FDA651C} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - - Xamarin.WatchOS - true - ..\product.snk - build\IDE\obj\watchOS\$(Configuration) - latest - - - true - full - false - build\IDE\bin\watchOS\Debug - MONOTOUCH;WATCH;XAMCORE_3_0 - prompt - 4 - false - true - True - 3021,3014,3003 - - - none - false - build\IDE\bin\watchOS\Release - MONOTOUCH;WATCH;XAMCORE_3_0 - prompt - 4 - false - true - - - - - - - - - - - build\watch\watch\%(RecursiveDir)%(Filename).cs - - - - - - diff --git a/src/xkit.cs b/src/xkit.cs index ad28ed08344a..00e7a8d355c5 100644 --- a/src/xkit.cs +++ b/src/xkit.cs @@ -2665,19 +2665,11 @@ NSTextStorageEditActions EditedMask { [Export ("editedRange")] NSRange EditedRange { get; -#if !XAMCORE_3_0 && !MONOMAC && !__MACCATALYST__ - [NotImplemented] - set; -#endif } [Export ("changeInLength")] nint ChangeInLength { get; -#if !XAMCORE_3_0 && !MONOMAC && !__MACCATALYST__ - [NotImplemented] - set; -#endif } [NullAllowed] @@ -3132,10 +3124,6 @@ interface NSTextLayoutOrientationProvider { [Export ("layoutOrientation")] NSTextLayoutOrientation LayoutOrientation { get; -#if !XAMCORE_3_0 && !MONOMAC - [NotImplemented] - set; -#endif } } diff --git a/system-dependencies.sh b/system-dependencies.sh index 730279a1bcee..361d179dcc2b 100755 --- a/system-dependencies.sh +++ b/system-dependencies.sh @@ -43,11 +43,6 @@ while ! test -z $1; do unset IGNORE_MONO shift ;; - --provision-cmake) - PROVISION_CMAKE=1 - unset IGNORE_CMAKE - shift - ;; --provision-7z) PROVISION_7Z=1 unset IGNORE_7Z @@ -103,8 +98,6 @@ while ! test -z $1; do unset IGNORE_VISUAL_STUDIO PROVISION_XCODE=1 unset IGNORE_XCODE - PROVISION_CMAKE=1 - unset IGNORE_CMAKE PROVISION_7Z=1 unset IGNORE_7Z PROVISION_HOMEBREW=1 @@ -130,7 +123,6 @@ while ! test -z $1; do IGNORE_MONO=1 IGNORE_VISUAL_STUDIO=1 IGNORE_XCODE=1 - IGNORE_CMAKE=1 IGNORE_7Z=1 IGNORE_HOMEBREW=1 IGNORE_SHARPIE=1 @@ -165,10 +157,6 @@ while ! test -z $1; do IGNORE_PYTHON3=1 shift ;; - --ignore-cmake) - IGNORE_CMAKE=1 - shift - ;; --ignore-7z) IGNORE_7Z=1 shift @@ -598,10 +586,9 @@ function check_xcode () { local XCODE_DEVELOPER_ROOT=`grep ^XCODE_DEVELOPER_ROOT= Make.config | sed 's/.*=//'` IOS_SDK_VERSION=$(grep ^IOS_NUGET_OS_VERSION= Make.versions | sed -e 's/.*=//') MACOS_SDK_VERSION=$(grep ^MACOS_NUGET_OS_VERSION= Make.versions | sed -e 's/.*=//') - WATCH_SDK_VERSION=$(grep ^WATCHOS_NUGET_OS_VERSION= Make.versions | sed -e 's/.*=//') TVOS_SDK_VERSION=$(grep ^TVOS_NUGET_OS_VERSION= Make.versions | sed -e 's/.*=//') - download_xcode_platforms "$XCODE_DEVELOPER_ROOT" "$TVOS_SDK_VERSION" "$WATCH_SDK_VERSION" + download_xcode_platforms "$XCODE_DEVELOPER_ROOT" "$TVOS_SDK_VERSION" local D=$XCODE_DEVELOPER_ROOT/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk if test ! -d $D -a -z "$FAIL"; then @@ -617,11 +604,6 @@ function check_xcode () { if test ! -d $D -a -z "$FAIL"; then fail "The directory $D does not exist. If you've updated the Xcode location it means you also need to update TVOS_SDK_VERSION in Make.config." fi - - local D=$XCODE_DEVELOPER_ROOT/Platforms/WatchOS.platform/Developer/SDKs/WatchOS${WATCH_SDK_VERSION}.sdk - if test ! -d $D -a -z "$FAIL"; then - fail "The directory $D does not exist. If you've updated the Xcode location it means you also need to update WATCH_SDK_VERSION in Make.config." - fi } function check_mono () { @@ -787,40 +769,6 @@ function check_checkout_dir () { ok "Checkout location will not result in test problems." } - -function install_cmake () { - if ! brew --version >& /dev/null; then - fail "Asked to install cmake, but brew is not installed." - return - fi - - brew install cmake -} - -function check_cmake () { - if ! test -z $IGNORE_CMAKE; then return; fi - - local MIN_CMAKE_VERSION=`grep MIN_CMAKE_VERSION= Make.config | sed 's/.*=//'` - local CMAKE_URL=`grep CMAKE_URL= Make.config | sed 's/.*=//'` - - if ! cmake --version &> /dev/null; then - if ! test -z $PROVISION_CMAKE; then - install_cmake - else - fail "You must install CMake ($CMAKE_URL)" - fi - return - fi - - ACTUAL_CMAKE_VERSION=$(cmake --version | grep "cmake version" | sed 's/cmake version //') - if ! is_at_least_version $ACTUAL_CMAKE_VERSION $MIN_CMAKE_VERSION; then - fail "You must have at least CMake $MIN_CMAKE_VERSION (found $ACTUAL_CMAKE_VERSION)" - return - fi - - ok "Found CMake $ACTUAL_CMAKE_VERSION (at least $MIN_CMAKE_VERSION is required)" -} - function install_7z () { if ! brew --version >& /dev/null; then fail "Asked to install 7z, but brew is not installed." @@ -861,7 +809,7 @@ IFS=' HOMEBREW_VERSION=($(brew --version 2>/dev/null)) log "Installed Homebrew ($HOMEBREW_VERSION)" else - warn "Could not find Homebrew. Homebrew is required to auto-provision some dependencies (cmake), but not required otherwise." + warn "Could not find Homebrew. Homebrew is required to auto-provision some dependencies (p7zip), but not required otherwise." fi IFS=$IFS_tmp } @@ -1012,7 +960,6 @@ check_shellcheck check_yamllint check_python3 check_mono -check_cmake check_7z check_objective_sharpie check_old_simulators diff --git a/tests/Makefile b/tests/Makefile index 5c97c55545aa..3041ee6cfafe 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,26 +1,15 @@ TOP = .. -SUBDIRS=test-libraries +SUBDIRS=test-libraries dotnet # disabled for now: mac-test include $(TOP)/Make.config include $(TOP)/mk/rules.mk -ifdef ENABLE_DOTNET -SUBDIRS += dotnet -endif - MTOUCH=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/mtouch XHARNESS_EXECUTABLE=xharness/bin/Debug/xharness.dll -export MD_MTOUCH_SDK_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) -export MSBUILD_EXE_PATH=$(MONO_PREFIX)/lib/mono/msbuild/15.0/bin/MSBuild.dll -export TargetFrameworkFallbackSearchPaths=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPathFallbackPathsOverride=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild -export XAMMAC_FRAMEWORK_PATH=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current -export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current - ifneq ($(RELEASE),) CONFIG=Release else @@ -62,15 +51,12 @@ test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.De @echo "JENKINS_RESULTS_DIRECTORY=$(abspath $(JENKINS_RESULTS_DIRECTORY))" >> $@ @echo "INCLUDE_DEVICE=$(INCLUDE_DEVICE)" >> $@ @echo "XCODE_DEVELOPER_ROOT=$(XCODE_DEVELOPER_ROOT)" >> $@ - @echo "MONO_IOS_SDK_DESTDIR=$(MONO_IOS_SDK_DESTDIR)" >> $@ @echo "DOTNET=$(DOTNET)" >> $@ @echo "IOS_SDK_VERSION=$(IOS_SDK_VERSION)" >> $@ @echo "TVOS_SDK_VERSION=$(TVOS_SDK_VERSION)" >> $@ @echo "WATCH_SDK_VERSION=$(WATCH_SDK_VERSION)" >> $@ @echo "MACOS_SDK_VERSION=$(MACOS_SDK_VERSION)" >> $@ @echo "DOTNET_BCL_DIR=$(DOTNET_BCL_DIR)" >> $@ - @echo "ENABLE_DOTNET=$(ENABLE_DOTNET)" >> $@ - @echo "INCLUDE_XAMARIN_LEGACY=$(INCLUDE_XAMARIN_LEGACY)" >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),DOTNET_$(platform)_RUNTIME_IDENTIFIERS='$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS)'\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),DOTNET_$(rid)_ARCHITECTURES='$(DOTNET_$(rid)_ARCHITECTURES)'\\n))" | sed 's/^ //' >> $@ @echo "DOTNET_CSC_COMMAND='$(DOTNET_CSC)'" >> $@ @@ -80,7 +66,6 @@ test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.De @echo "DOTNET_DIR=$(DOTNET_DIR)" >> $@ @echo "INCLUDE_MAC=$(INCLUDE_MAC)" >> $@ @echo "INCLUDE_MACCATALYST=$(INCLUDE_MACCATALYST)" >> $@ - @echo "IOS_SUPPORTS_32BIT_ARCHITECTURES=$(IOS_SUPPORTS_32BIT_ARCHITECTURES)" >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_SDK_NAME=$($(platform)_NUGET_SDK_NAME)\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_REF_NAME=$($(platform)_NUGET_REF_NAME)\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(rid)_NUGET_RUNTIME_NAME=$($(rid)_NUGET_RUNTIME_NAME)\\n))" | sed 's/^ //' >> $@ @@ -97,7 +82,6 @@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Ver @echo "MAC_DESTDIR=/" >> $@ @echo "JENKINS_RESULTS_DIRECTORY=$(abspath $(JENKINS_RESULTS_DIRECTORY))" >> $@ @echo "INCLUDE_DEVICE=$(INCLUDE_DEVICE)" >> $@ - @echo "MONO_IOS_SDK_DESTDIR=$(MONO_IOS_SDK_DESTDIR)" >> $@ @echo "DOTNET=$(DOTNET)" >> $@ @echo "IOS_SDK_VERSION=$(IOS_SDK_VERSION)" >> $@ @echo "TVOS_SDK_VERSION=$(TVOS_SDK_VERSION)" >> $@ @@ -105,8 +89,6 @@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Ver @echo "MACOS_SDK_VERSION=$(MACOS_SDK_VERSION)" >> $@ @echo "DOTNET_TFM=$(DOTNET_TFM)" >> $@ @echo "DOTNET_BCL_DIR=$(DOTNET_BCL_DIR)" >> $@ - @echo "ENABLE_DOTNET=$(ENABLE_DOTNET)" >> $@ - @echo "INCLUDE_XAMARIN_LEGACY=$(INCLUDE_XAMARIN_LEGACY)" >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),DOTNET_$(platform)_RUNTIME_IDENTIFIERS='$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS)'\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),DOTNET_$(rid)_ARCHITECTURES='$(DOTNET_$(rid)_ARCHITECTURES)'\\n))" | sed 's/^ //' >> $@ @echo "DOTNET_CSC_COMMAND='$(DOTNET_CSC)'" >> $@ @@ -115,7 +97,6 @@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Ver @echo "DOTNET_DIR=$(DOTNET_DIR)" >> $@ @echo "INCLUDE_MAC=$(INCLUDE_MAC)" >> $@ @echo "INCLUDE_MACCATALYST=$(INCLUDE_MACCATALYST)" >> $@ - @echo "IOS_SUPPORTS_32BIT_ARCHITECTURES=$(IOS_SUPPORTS_32BIT_ARCHITECTURES)" >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_SDK_NAME=$($(platform)_NUGET_SDK_NAME)\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_REF_NAME=$($(platform)_NUGET_REF_NAME)\\n)" | sed 's/^ //' >> $@ @printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(rid)_NUGET_RUNTIME_NAME=$($(rid)_NUGET_RUNTIME_NAME)\\n))" | sed 's/^ //' >> $@ @@ -191,11 +172,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 @@ -207,8 +186,10 @@ $(TOP)/tools/common/SdkVersions.cs: $(TOP)/tools/common/SdkVersions.in.cs $(XHARNESS_EXECUTABLE): MSBUILD_EXE_PATH= $(XHARNESS_EXECUTABLE): $(xharness_dependencies) test.config test-system.config .stamp-src-project-files $(TOP)/tools/common/SdkVersions.cs $(Q_GEN) $(DOTNET) build "/bl:$@.binlog" $(MSBUILD_VERBOSITY_QUIET) xharness/xharness.csproj -xharness/xharness.csproj.inc: export BUILD_VERBOSITY=$(XBUILD_VERBOSITY) +xharness/xharness.csproj.inc: export BUILD_VERBOSITY=$(DOTNET_BUILD_VERBOSITY) xharness/xharness.csproj.inc: export ABSOLUTE_PATHS=1 +xharness/xharness.csproj.inc: export DOTNET:=$(DOTNET) +xharness/xharness.csproj.inc: export MSBUILD_EXE_PATH= -include xharness/xharness.csproj.inc killall: @@ -216,18 +197,22 @@ killall: @killall "iOS Simulator" >/dev/null 2>&1 || true @killall Touch.Server >/dev/null 2>&1 || true -NUNIT_MSBUILD_DIR=$(TOP)/packages/NUnit.Runners.2.6.4/tools/lib -test-ios-tasks: test-macdev-tests test-macdev-tasks +test-msbuild run-tests-msbuild: + $(MAKE) test-macdev-tests test-macdev-tasks +# Example TEST_FILTER: +# TEST_FILTER="--filter FullyQualifiedName~BuildMyCocoaApp" +# Docs: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#filter-option-details test-macdev-tests: export MSBUILD_EXE_PATH= test-macdev-tests: verify-system-vsmac-xcode-match - $(Q) $(DOTNET) build "/bl:$@.binlog" $(TOP)/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj /p:Configuration=Debug $(DOTNET_BUILD_VERBOSITY) - cd $(TOP)/tests/msbuild/Xamarin.MacDev.Tests && $(SYSTEM_XIBUILD) -t -- $(abspath $(TOP)/tools/nunit3-console-3.11.1) $(abspath $(TOP)/tests/msbuild/Xamarin.MacDev.Tests/bin/Debug/net472/Xamarin.MacDev.Tests.dll) "--result=$(abspath $(CURDIR)/TestResults_Xamarin.MacDev.Tests.xml);format=nunit2" -labels=After $(TEST_FIXTURE) + $(Q) $(DOTNET) test $(TOP)/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj $(TEST_FILTER) +# Example TEST_FILTER: +# TEST_FILTER="--filter FullyQualifiedName~BuildMyCocoaApp" +# Docs: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#filter-option-details test-macdev-tasks: export MSBUILD_EXE_PATH= test-macdev-tasks: verify-system-vsmac-xcode-match - $(Q) $(DOTNET) build "/bl:$@.binlog" $(TOP)/tests/msbuild/Xamarin.MacDev.Tasks.Tests/Xamarin.MacDev.Tasks.Tests.csproj /p:Configuration=Debug $(DOTNET_BUILD_VERBOSITY) - cd $(TOP)/tests/msbuild/Xamarin.MacDev.Tasks.Tests && $(SYSTEM_XIBUILD) -t -- $(abspath $(TOP)/tools/nunit3-console-3.11.1) $(abspath $(TOP)/tests/msbuild/Xamarin.MacDev.Tasks.Tests/bin/Debug/net472/Xamarin.MacDev.Tasks.Tests.dll) "--result=$(abspath $(CURDIR)/TestResults_Xamarin.MacDev.Tasks.Tests.xml)" -labels=After $(TEST_FIXTURE) + $(Q) $(DOTNET) test $(TOP)/tests/msbuild/Xamarin.MacDev.Tasks.Tests/Xamarin.MacDev.Tasks.Tests.csproj $(TEST_FILTER) mac-test-package.zip: ifdef INCLUDE_MAC @@ -238,14 +223,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: @@ -341,7 +318,7 @@ runner: $(XHARNESS_EXECUTABLE) # This makefile target will run the device tests using the Xamarin.iOS version # installed on the system. vsts-device-tests: $(XHARNESS_EXECUTABLE) - $(MAKE) -C $(TOP)/builds .stamp-mono-ios-sdk-destdir download -j + $(MAKE) -C $(TOP)/builds download -j $(Q) ulimit -n 4096 && $(DOTNET) $< $(XHARNESS_VERBOSITY) --jenkins --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT) --use-system:true --label=skip-all-tests,run-device-tests --markdown-summary=$(CURDIR)/TestSummary.md $(TESTS_EXTRA_ARGUMENTS) $(TESTS_PERIODIC_COMMAND) verify-system-vsmac-xcode-match: @@ -354,15 +331,22 @@ 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) && zip -9r --symlinks $(abspath $@).tmp ./tests/mono-native/macOS/unified ./tests/mono-native/macOS/compat - $(Q_GEN) cd $(TOP) && zip -9r --symlinks $(abspath $@).tmp ./tests/mono-native/iOS/unified ./tests/mono-native/iOS/compat - $(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 "$@" + +build-all: + $(MAKE) build -C bgen + $(MAKE) build -C cecil-tests + $(MAKE) build -C dotnet/UnitTests + $(MAKE) build -C rgen + $(MAKE) build -C xtro-sharpie + $(MAKE) build-all -C "linker/ios/dont link/dotnet" + $(MAKE) build-all -C "linker/ios/link all/dotnet" + $(MAKE) build-all -C "linker/ios/link sdk/dotnet" + $(MAKE) build-all -C "linker/ios/trimmode copy/dotnet" + $(MAKE) build-all -C "linker/ios/trimmode link/dotnet" + $(MAKE) build-all -C fsharp/dotnet + $(MAKE) build-all -C interdependent-binding-projects/dotnet + $(MAKE) build-all -C introspection/dotnet + $(MAKE) build-all -C monotouch-test/dotnet + $(MAKE) build-all -C xcframework-test/dotnet diff --git a/tests/bcl-test/templates/watchOS/Container/Container.csproj b/tests/bcl-test/templates/watchOS/Container/Container.csproj index 3d89bb2574af..c5e5d7f5b952 100644 --- a/tests/bcl-test/templates/watchOS/Container/Container.csproj +++ b/tests/bcl-test/templates/watchOS/Container/Container.csproj @@ -10,7 +10,7 @@ Resources Container obj\$(Platform)\$(Configuration)-watchos - XAMCORE_3_0; + latest
diff --git a/tests/bgen/Makefile b/tests/bgen/Makefile index a53d187b6adb..4790e7ac8fd7 100644 --- a/tests/bgen/Makefile +++ b/tests/bgen/Makefile @@ -3,3 +3,6 @@ include $(TOP)/Make.config run-tests run-unit-tests: $(Q) $(DOTNET) test $(TEST_FILTER) bgen-tests.csproj + +build: + $(Q) $(DOTNET) build bgen-tests.csproj 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/ApiTest.cs b/tests/cecil-tests/ApiTest.cs index 300c972a26e4..a415684f9881 100644 --- a/tests/cecil-tests/ApiTest.cs +++ b/tests/cecil-tests/ApiTest.cs @@ -18,7 +18,6 @@ namespace Cecil.Tests { [TestFixture] public partial class ApiTest { - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] public void ARConfiguration_GetSupportedVideoFormats (AssemblyInfo info) { diff --git a/tests/cecil-tests/AttributeTest.cs b/tests/cecil-tests/AttributeTest.cs index 38c197e05cd6..50f729610700 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 }; } } @@ -508,13 +511,13 @@ bool IgnoreCurrentPlatform (string fullName) string AssemblyToAttributeName (AssemblyDefinition assembly) { var baseName = assembly.Name.Name + ".dll"; - if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_iOS.Platform, true) == baseName) + if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_iOS.Platform) == baseName) return "ios"; - if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_tvOS.Platform, true) == baseName) + if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_tvOS.Platform) == baseName) return "tvos"; - if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_macOS.Platform, true) == baseName) + if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_macOS.Platform) == baseName) return "macos"; - if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_MacCatalyst.Platform, true) == baseName) + if (Configuration.GetBaseLibraryName (TargetFramework.DotNet_MacCatalyst.Platform) == baseName) return "maccatalyst"; throw new NotImplementedException (); } diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 5813772a96f7..75c43e82be1c 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -2869,6 +2869,10 @@ F:AppKit.NSToolbarItemGroupControlRepresentation.Expanded F:AppKit.NSToolbarItemGroupSelectionMode.Momentary F:AppKit.NSToolbarItemGroupSelectionMode.SelectAny F:AppKit.NSToolbarItemGroupSelectionMode.SelectOne +F:AppKit.NSToolbarItemVisibilityPriority.High +F:AppKit.NSToolbarItemVisibilityPriority.Low +F:AppKit.NSToolbarItemVisibilityPriority.Standard +F:AppKit.NSToolbarItemVisibilityPriority.User F:AppKit.NSToolbarSizeMode.Default F:AppKit.NSToolbarSizeMode.Regular F:AppKit.NSToolbarSizeMode.Small @@ -5307,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 @@ -10858,6 +10870,9 @@ F:HealthKit.HKAppleSleepingBreathingDisturbancesClassification.NotElevated F:HealthKit.HKAppleWalkingSteadinessClassification.Low F:HealthKit.HKAppleWalkingSteadinessClassification.Ok F:HealthKit.HKAppleWalkingSteadinessClassification.VeryLow +F:HealthKit.HKAudiogramConductionType.Air +F:HealthKit.HKAudiogramSensitivityTestSide.Left +F:HealthKit.HKAudiogramSensitivityTestSide.Right F:HealthKit.HKAuthorizationRequestStatus.ShouldRequest F:HealthKit.HKAuthorizationRequestStatus.Unknown F:HealthKit.HKAuthorizationRequestStatus.Unnecessary @@ -16163,6 +16178,7 @@ F:NetworkExtension.NEProviderStopReason.ConfigurationFailed F:NetworkExtension.NEProviderStopReason.ConfigurationRemoved F:NetworkExtension.NEProviderStopReason.ConnectionFailed F:NetworkExtension.NEProviderStopReason.IdleTimeout +F:NetworkExtension.NEProviderStopReason.InternalError F:NetworkExtension.NEProviderStopReason.None F:NetworkExtension.NEProviderStopReason.NoNetworkAvailable F:NetworkExtension.NEProviderStopReason.ProviderDisabled @@ -20315,6 +20331,7 @@ F:UIKit.UIMenuIdentifier.Lookup F:UIKit.UIMenuIdentifier.MinimizeAndZoom F:UIKit.UIMenuIdentifier.NewScene F:UIKit.UIMenuIdentifier.None +F:UIKit.UIMenuIdentifier.Open F:UIKit.UIMenuIdentifier.OpenRecent F:UIKit.UIMenuIdentifier.Preferences F:UIKit.UIMenuIdentifier.Print @@ -20466,6 +20483,8 @@ F:UIKit.UIPressType.PageUp F:UIKit.UIPressType.PlayPause F:UIKit.UIPressType.RightArrow F:UIKit.UIPressType.Select +F:UIKit.UIPressType.TVRemoteFourColors +F:UIKit.UIPressType.TVRemoteOneTwoThree F:UIKit.UIPressType.UpArrow F:UIKit.UIPreviewActionStyle.Default F:UIKit.UIPreviewActionStyle.Destructive @@ -30131,6 +30150,10 @@ M:CoreImage.CIDissolveTransition.#ctor M:CoreImage.CIDissolveTransition.#ctor(Foundation.NSCoder) M:CoreImage.CIDissolveTransition.#ctor(Foundation.NSObjectFlag) M:CoreImage.CIDissolveTransition.#ctor(ObjCRuntime.NativeHandle) +M:CoreImage.CIDistanceGradientFromRedMask.#ctor +M:CoreImage.CIDistanceGradientFromRedMask.#ctor(Foundation.NSCoder) +M:CoreImage.CIDistanceGradientFromRedMask.#ctor(Foundation.NSObjectFlag) +M:CoreImage.CIDistanceGradientFromRedMask.#ctor(ObjCRuntime.NativeHandle) M:CoreImage.CIDistortionFilter.#ctor(Foundation.NSCoder) M:CoreImage.CIDistortionFilter.#ctor(Foundation.NSObjectFlag) M:CoreImage.CIDistortionFilter.#ctor(ObjCRuntime.NativeHandle) @@ -34913,7 +34936,15 @@ M:HealthKit.HKAttachmentStore.GetAttachmentsAsync(HealthKit.HKObject) M:HealthKit.HKAttachmentStore.GetDataAsync(HealthKit.HKAttachment,Foundation.NSProgress@) M:HealthKit.HKAttachmentStore.GetDataAsync(HealthKit.HKAttachment) M:HealthKit.HKAttachmentStore.RemoveAttachmentAsync(HealthKit.HKAttachment,HealthKit.HKObject) +M:HealthKit.HKAudiogramSample.GetAudiogramSample(HealthKit.HKAudiogramSensitivityPoint[],Foundation.NSDate,Foundation.NSDate,HealthKit.HKDevice,Foundation.NSDictionary{Foundation.NSString,Foundation.NSObject}) M:HealthKit.HKAudiogramSensitivityPoint.EncodeTo(Foundation.NSCoder) +M:HealthKit.HKAudiogramSensitivityPoint.GetSensitivityPoint(HealthKit.HKQuantity,HealthKit.HKAudiogramSensitivityTest[],Foundation.NSError@) +M:HealthKit.HKAudiogramSensitivityPointClampingRange.Copy(Foundation.NSZone) +M:HealthKit.HKAudiogramSensitivityPointClampingRange.Create(System.Nullable{System.Double},System.Nullable{System.Double},Foundation.NSError@) +M:HealthKit.HKAudiogramSensitivityPointClampingRange.EncodeTo(Foundation.NSCoder) +M:HealthKit.HKAudiogramSensitivityTest.#ctor(HealthKit.HKQuantity,HealthKit.HKAudiogramConductionType,System.Boolean,HealthKit.HKAudiogramSensitivityTestSide,HealthKit.HKAudiogramSensitivityPointClampingRange,Foundation.NSError@) +M:HealthKit.HKAudiogramSensitivityTest.Copy(Foundation.NSZone) +M:HealthKit.HKAudiogramSensitivityTest.EncodeTo(Foundation.NSCoder) M:HealthKit.HKBiologicalSexObject.Copy(Foundation.NSZone) M:HealthKit.HKBiologicalSexObject.EncodeTo(Foundation.NSCoder) M:HealthKit.HKBloodTypeObject.Copy(Foundation.NSZone) @@ -41385,6 +41416,9 @@ 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:ObjCBindings.EnumValue.#ctor +M:ObjCBindings.FieldTag.#ctor M:ObjCRuntime.AdoptsAttribute.#ctor(System.String) M:ObjCRuntime.AssemblyRegistrationEventArgs.#ctor M:ObjCRuntime.BaseWrapper.#ctor(ObjCRuntime.NativeHandle,System.Boolean) @@ -42219,6 +42253,7 @@ M:PdfKit.PdfViewDelegate.WillClickOnLink(PdfKit.PdfView,Foundation.NSUrl) M:PdfKit.PdfViewUrlEventArgs.#ctor(Foundation.NSUrl) M:PencilKit.IPKCanvasViewDelegate.DidBeginUsingTool(PencilKit.PKCanvasView) M:PencilKit.IPKCanvasViewDelegate.DidFinishRendering(PencilKit.PKCanvasView) +M:PencilKit.IPKCanvasViewDelegate.DidRefineStrokes(PencilKit.PKCanvasView,PencilKit.PKStroke[],PencilKit.PKStroke[]) M:PencilKit.IPKCanvasViewDelegate.DrawingDidChange(PencilKit.PKCanvasView) M:PencilKit.IPKCanvasViewDelegate.EndUsingTool(PencilKit.PKCanvasView) M:PencilKit.IPKToolPickerObserver.FramesObscuredDidChange(PencilKit.PKToolPicker) @@ -42229,11 +42264,13 @@ M:PencilKit.IPKToolPickerObserver.VisibilityDidChange(PencilKit.PKToolPicker) M:PencilKit.PKCanvasView.PKCanvasViewAppearance.#ctor(System.IntPtr) M:PencilKit.PKCanvasViewDelegate_Extensions.DidBeginUsingTool(PencilKit.IPKCanvasViewDelegate,PencilKit.PKCanvasView) M:PencilKit.PKCanvasViewDelegate_Extensions.DidFinishRendering(PencilKit.IPKCanvasViewDelegate,PencilKit.PKCanvasView) +M:PencilKit.PKCanvasViewDelegate_Extensions.DidRefineStrokes(PencilKit.IPKCanvasViewDelegate,PencilKit.PKCanvasView,PencilKit.PKStroke[],PencilKit.PKStroke[]) M:PencilKit.PKCanvasViewDelegate_Extensions.DrawingDidChange(PencilKit.IPKCanvasViewDelegate,PencilKit.PKCanvasView) M:PencilKit.PKCanvasViewDelegate_Extensions.EndUsingTool(PencilKit.IPKCanvasViewDelegate,PencilKit.PKCanvasView) M:PencilKit.PKCanvasViewDelegate.DecelerationEnded(UIKit.UIScrollView) M:PencilKit.PKCanvasViewDelegate.DecelerationStarted(UIKit.UIScrollView) M:PencilKit.PKCanvasViewDelegate.DidChangeAdjustedContentInset(UIKit.UIScrollView) +M:PencilKit.PKCanvasViewDelegate.DidRefineStrokes(PencilKit.PKCanvasView,PencilKit.PKStroke[],PencilKit.PKStroke[]) M:PencilKit.PKCanvasViewDelegate.DidZoom(UIKit.UIScrollView) M:PencilKit.PKCanvasViewDelegate.DraggingEnded(UIKit.UIScrollView,System.Boolean) M:PencilKit.PKCanvasViewDelegate.DraggingStarted(UIKit.UIScrollView) @@ -45203,6 +45240,10 @@ M:UIKit.NSObject_UIAccessibilityTextNavigation.SetAccessibilityNextTextNavigatio M:UIKit.NSObject_UIAccessibilityTextNavigation.SetAccessibilityNextTextNavigationElementBlock(Foundation.NSObject,UIKit.AXObjectReturnBlock) M:UIKit.NSObject_UIAccessibilityTextNavigation.SetAccessibilityPreviousTextNavigationElement(Foundation.NSObject,Foundation.NSObject) M:UIKit.NSObject_UIAccessibilityTextNavigation.SetAccessibilityPreviousTextNavigationElementBlock(Foundation.NSObject,UIKit.AXObjectReturnBlock) +M:UIKit.NSObject_UIAccessibilityTextOperations.GetAccessibilityTextInputResponder(Foundation.NSObject) +M:UIKit.NSObject_UIAccessibilityTextOperations.GetAccessibilityTextInputResponderHandler(Foundation.NSObject) +M:UIKit.NSObject_UIAccessibilityTextOperations.SetAccessibilityTextInputResponder(Foundation.NSObject,UIKit.IUITextInput) +M:UIKit.NSObject_UIAccessibilityTextOperations.SetAccessibilityTextInputResponderHandler(Foundation.NSObject,UIKit.UITextInputReturnHandler) M:UIKit.NSParagraphStyle.Copy(Foundation.NSZone) M:UIKit.NSParagraphStyle.EncodeTo(Foundation.NSCoder) M:UIKit.NSParagraphStyle.MutableCopy(Foundation.NSZone) @@ -55055,6 +55096,9 @@ P:CoreImage.CIDisplacementDistortion.DisplacementImage P:CoreImage.CIDisplacementDistortion.InputImage P:CoreImage.CIDisplacementDistortion.OutputImage P:CoreImage.CIDisplacementDistortion.Scale +P:CoreImage.CIDistanceGradientFromRedMask.InputImage +P:CoreImage.CIDistanceGradientFromRedMask.MaximumDistance +P:CoreImage.CIDistanceGradientFromRedMask.OutputImage P:CoreImage.CIDistortionFilter.InputImage P:CoreImage.CIDistortionFilter.Radius P:CoreImage.CIDither.InputImage @@ -59751,6 +59795,7 @@ P:Foundation.NSUserActivity.EligibleForPublicIndexing P:Foundation.NSUserActivity.EligibleForSearch P:Foundation.NSUserActivity.IsClassKitDeepLink P:Foundation.NSUserActivity.SuggestedInvocationPhrase +P:Foundation.NSUserActivity.TargetContentIdentifier P:Foundation.NSUserActivityContinuation.Arg1 P:Foundation.NSUserActivityContinuation.Arg2 P:Foundation.NSUserActivityType.BrowsingWeb @@ -60562,6 +60607,13 @@ P:GLKit.GLKViewController.Delegate P:GLKit.GLKViewController.Paused P:GLKit.GLKViewDrawEventArgs.Rect P:HealthKit.HKActivitySummary.Paused +P:HealthKit.HKAudiogramSensitivityPoint.Tests +P:HealthKit.HKAudiogramSensitivityPointClampingRange.LowerBound +P:HealthKit.HKAudiogramSensitivityPointClampingRange.UpperBound +P:HealthKit.HKAudiogramSensitivityTest.ClampingRange +P:HealthKit.HKAudiogramSensitivityTest.Masked +P:HealthKit.HKAudiogramSensitivityTest.Sensitivity +P:HealthKit.HKAudiogramSensitivityTest.Side P:HealthKit.HKDeletedObject.Metadata P:HealthKit.HKDetailedCdaErrors.ValidationError P:HealthKit.HKDevicePropertyKey.FirmwareVersion @@ -67402,6 +67454,7 @@ P:TVServices.TVTopShelfSectionedContent.Sections P:TVServices.TVTopShelfSectionedItem.ImageShape P:TVServices.TVTopShelfSectionedItem.PlaybackProgress P:TVServices.TVUserActivityType.BrowsingChannelGuide +P:TVServices.TVUserActivityType.BrowsingEntertainmentContent P:TVServices.TVUserManager.CurrentUserIdentifier P:TVServices.TVUserManager.CurrentUserIdentifierDidChangeNotification P:TVServices.TVUserManager.ShouldStorePreferencesForCurrentUser @@ -69538,6 +69591,7 @@ P:Vision.VNTrackRectangleRequest.SupportedRevisions P:Vision.VNTrackTranslationalImageRegistrationRequest.SupportedRevisions P:Vision.VNTranslationalImageRegistrationRequest.SupportedRevisions P:Vision.VNUtils.NormalizedIdentityRect +P:Vision.VNUtils.VisionVersionNumber P:VisionKit.VNDocumentCameraViewController.Delegate P:VisionKit.VNDocumentCameraViewController.Supported P:WatchConnectivity.WCSession.ActivationState @@ -70565,6 +70619,7 @@ T:AppKit.NSToolbarImmovableItemIdentifiers T:AppKit.NSToolbarItemEventArgs T:AppKit.NSToolbarItemGroupControlRepresentation T:AppKit.NSToolbarItemGroupSelectionMode +T:AppKit.NSToolbarItemVisibilityPriority T:AppKit.NSToolbarSizeMode T:AppKit.NSToolbarWillInsert T:AppKit.NSTouch_NSTouchBar @@ -71177,6 +71232,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 @@ -71932,6 +71988,7 @@ T:CoreImage.CIDepthDisparityConverter T:CoreImage.CIDepthToDisparity T:CoreImage.CIDetectorOptions T:CoreImage.CIDisparityToDepth +T:CoreImage.CIDistanceGradientFromRedMask T:CoreImage.CIDither T:CoreImage.CIDocumentEnhancer T:CoreImage.CIEdgePreserveUpsampleFilter @@ -73372,6 +73429,10 @@ T:HealthKit.HKAppleWalkingSteadinessClassification T:HealthKit.HKAttachmentStoreCompletionHandler T:HealthKit.HKAttachmentStoreDataHandler T:HealthKit.HKAttachmentStoreGetAttachmentCompletionHandler +T:HealthKit.HKAudiogramConductionType +T:HealthKit.HKAudiogramSensitivityPointClampingRange +T:HealthKit.HKAudiogramSensitivityTest +T:HealthKit.HKAudiogramSensitivityTestSide T:HealthKit.HKCategoryValueAppetiteChanges T:HealthKit.HKCategoryValueAppleWalkingSteadinessEvent T:HealthKit.HKCategoryValueAudioExposureEvent @@ -75846,6 +75907,7 @@ T:UIKit.NSMutableAttributedStringKitAdditions T:UIKit.NSObject_UIAccessibilityCustomRotor T:UIKit.NSObject_UIAccessibilityHitTest T:UIKit.NSObject_UIAccessibilityTextNavigation +T:UIKit.NSObject_UIAccessibilityTextOperations T:UIKit.NSPreviewInteractionPreviewUpdateEventArgs T:UIKit.NSRectAlignment T:UIKit.NSStringDrawing @@ -76322,6 +76384,7 @@ T:UIKit.UITextFormattingViewControllerTextList T:UIKit.UITextGranularity T:UIKit.UITextInlinePredictionType T:UIKit.UITextInputDelegate +T:UIKit.UITextInputReturnHandler T:UIKit.UITextInputTokenizer T:UIKit.UITextInteractionDelegate T:UIKit.UITextInteractionMode @@ -76356,6 +76419,7 @@ T:UIKit.UITouchProperties T:UIKit.UITouchType T:UIKit.UITraitEnvironment T:UIKit.UITraitEnvironmentLayoutDirection +T:UIKit.UITraitMutations T:UIKit.UITransitionContext T:UIKit.UITransitionViewControllerKind T:UIKit.UIUpdateLinkCallback diff --git a/tests/cecil-tests/EnumTest.cs b/tests/cecil-tests/EnumTest.cs index 5935bac9ec42..16ee14d4768c 100644 --- a/tests/cecil-tests/EnumTest.cs +++ b/tests/cecil-tests/EnumTest.cs @@ -13,7 +13,6 @@ namespace Cecil.Tests { [TestFixture] public class EnumTest { - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] // https://github.com/xamarin/xamarin-macios/issues/9724 public void NoAvailabilityOnError (AssemblyInfo info) diff --git a/tests/cecil-tests/Helper.cs b/tests/cecil-tests/Helper.cs index e5d32d0ed35a..012f2336c297 100644 --- a/tests/cecil-tests/Helper.cs +++ b/tests/cecil-tests/Helper.cs @@ -29,7 +29,6 @@ public static AssemblyDefinition GetAssembly (string assembly, ReaderParameters? if (!cache.TryGetValue (assembly, out var ad)) { if (parameters is null) { var resolver = new DefaultAssemblyResolver (); - resolver.AddSearchDirectory (GetBCLDirectory (assembly)); parameters = new ReaderParameters () { AssemblyResolver = resolver, ReadSymbols = readSymbols, @@ -409,76 +408,6 @@ public static IEnumerable EnumerateAttributeProviders yield return item; } - public static string GetBCLDirectory (string assembly) - { - var rv = string.Empty; - var isDotNet = !assembly.Contains ("Library/Frameworks/Xamarin.iOS.framework") && !assembly.Contains ("Library/Frameworks/Xamarin.Mac.framework"); - - switch (Configuration.GetPlatform (assembly, isDotNet)) { - case ApplePlatform.iOS: - rv = Path.GetDirectoryName (Configuration.XamarinIOSDll); - break; - case ApplePlatform.WatchOS: - rv = Path.GetDirectoryName (Configuration.XamarinWatchOSDll); - break; - case ApplePlatform.TVOS: - rv = Path.GetDirectoryName (Configuration.XamarinTVOSDll); - break; - case ApplePlatform.MacOSX: - rv = Path.GetDirectoryName (assembly); - break; - case ApplePlatform.MacCatalyst: - rv = Path.GetDirectoryName (Configuration.XamarinCatalystDll); - break; - default: - throw new NotImplementedException (assembly); - } - - return rv!; - } - - static IEnumerable PlatformAssemblies { - get { - if (!Configuration.include_legacy_xamarin) - yield break; - - if (Configuration.include_ios) { - // we want to process 32/64 bits individually since their content can differ - if (Configuration.iOSSupports32BitArchitectures) - yield return Path.Combine (Configuration.MonoTouchRootDirectory, "lib", "32bits", "iOS", "Xamarin.iOS.dll"); - 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"); - } - - if (Configuration.include_mac) { - yield return Configuration.XamarinMacMobileDll; - yield return Configuration.XamarinMacFullDll; - } - } - } - - static IList? platform_assembly_definitions; - public static IEnumerable PlatformAssemblyDefinitions { - get { - if (platform_assembly_definitions is null) { - platform_assembly_definitions = PlatformAssemblies - .Select (v => new AssemblyInfo (v, GetAssembly (v, readSymbols: true), false)) - .ToArray (); - } - return platform_assembly_definitions; - } - } - - static IEnumerable NetPlatformAssemblies => Configuration.GetRefLibraries (); static IList? net_platform_assembly_definitions; @@ -486,7 +415,7 @@ public static IEnumerable NetPlatformAssemblyDefinitions { get { if (net_platform_assembly_definitions is null) { net_platform_assembly_definitions = NetPlatformAssemblies - .Select (v => new AssemblyInfo (v, GetAssembly (v, readSymbols: false), true)) + .Select (v => new AssemblyInfo (v, GetAssembly (v, readSymbols: false))) .ToArray (); } return net_platform_assembly_definitions; @@ -500,7 +429,7 @@ public static IEnumerable NetPlatformImplementationAssemblyDefinit get { if (net_platform_assembly_implemnetation_assembly_definitions is null) { net_platform_assembly_implemnetation_assembly_definitions = NetPlatformImplementationAssemblies - .Select (v => new AssemblyInfo (v, GetAssembly (v, readSymbols: true), true)) + .Select (v => new AssemblyInfo (v, GetAssembly (v, readSymbols: true))) .ToArray (); } return net_platform_assembly_implemnetation_assembly_definitions; @@ -534,22 +463,6 @@ public static Dictionary> MappedNetApi { } } - public static IEnumerable TaskAssemblies { - get { - if (Configuration.include_ios) - yield return CreateTestFixtureDataFromPath (Path.Combine (Configuration.SdkRootXI, "lib", "msbuild", "iOS", "Xamarin.iOS.Tasks.dll")); - if (Configuration.include_mac) - yield return CreateTestFixtureDataFromPath (Path.Combine (Configuration.SdkRootXM, "lib", "msbuild", "Xamarin.Mac.Tasks.dll")); - } - } - - static TestFixtureData CreateTestFixtureDataFromPath (string path) - { - var rv = new TestFixtureData (path); - rv.SetArgDisplayNames (Path.GetFileName (path)); - return rv; - } - // This method renders a string that sorts well - methods in the same // type are sorted next to eachother (the default MethodDefinition.FullName // implementation starts with the return type, so sorting the results @@ -717,11 +630,11 @@ public class AssemblyInfo { public string Path; public ApplePlatform Platform; - public AssemblyInfo (string path, AssemblyDefinition assembly, bool isDotNet) + public AssemblyInfo (string path, AssemblyDefinition assembly) { Assembly = assembly; Path = path; - Platform = Configuration.GetPlatform (path, isDotNet); + Platform = Configuration.GetPlatform (path); } public override string ToString () diff --git a/tests/cecil-tests/MarshalAsTest.cs b/tests/cecil-tests/MarshalAsTest.cs index e189451bde2c..017a98856ed1 100644 --- a/tests/cecil-tests/MarshalAsTest.cs +++ b/tests/cecil-tests/MarshalAsTest.cs @@ -18,7 +18,6 @@ public class MarshalAsTest { HashSet knownIssues = new HashSet { }; - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] public void TestAssembly (AssemblyInfo info) { diff --git a/tests/cecil-tests/Test.cs b/tests/cecil-tests/Test.cs index 3999328f85b3..753959db84f8 100644 --- a/tests/cecil-tests/Test.cs +++ b/tests/cecil-tests/Test.cs @@ -14,7 +14,6 @@ namespace Cecil.Tests { [TestFixture] public class Test { - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformImplementationAssemblyDefinitions))] // ref: https://github.com/xamarin/xamarin-macios/pull/7760 public void IdentifyBackingFieldAssignation (AssemblyInfo info) @@ -50,7 +49,6 @@ public void IdentifyBackingFieldAssignation (AssemblyInfo info) } } - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformImplementationAssemblyDefinitions))] // ref: https://github.com/xamarin/xamarin-macios/issues/8249 public void EnsureUIThreadOnInit (AssemblyInfo info) @@ -85,7 +83,6 @@ public void EnsureUIThreadOnInit (AssemblyInfo info) } } - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] public void NoSystemConsoleReference (AssemblyInfo info) { @@ -127,7 +124,6 @@ public void NoSystemConsoleReference (AssemblyInfo info) // keep up-to-date with the 'bannedCApi' list in tests/mtouch/MiscTests.cs }; - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] public void NoBannedApi (AssemblyInfo info) { @@ -153,7 +149,6 @@ public enum PlatformName : byte { MacCatalyst, } - [TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblyDefinitions))] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblyDefinitions))] // ref: https://github.com/xamarin/xamarin-macios/issues/4835 public void Unavailable (AssemblyInfo info) 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/AppDelegate.cs b/tests/common/AppDelegate.cs index bc895afcec49..3d84edb4fc6b 100644 --- a/tests/common/AppDelegate.cs +++ b/tests/common/AppDelegate.cs @@ -12,6 +12,9 @@ using NUnit.Framework; using NUnit.Framework.Internal; +// Disable until we get around to enable + fix any issues. +#nullable disable + [Register ("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate { public static TouchRunner Runner { get; set; } diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index 5fdbd955485d..88c1edb946cb 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,13 +40,8 @@ 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; - public static bool include_legacy_xamarin; - public static bool iOSSupports32BitArchitectures; public static bool EnableXamarin; public static bool XcodeIsStable; @@ -299,17 +292,12 @@ 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", "")); - include_legacy_xamarin = !string.IsNullOrEmpty (GetVariable ("INCLUDE_XAMARIN_LEGACY", "")); DotNetBclDir = GetVariable ("DOTNET_BCL_DIR", null); DotNetCscCommand = GetVariable ("DOTNET_CSC_COMMAND", null)?.Trim ('\''); DotNetExecutable = GetVariable ("DOTNET", null); DotNetTfm = GetVariable ("DOTNET_TFM", null); - iOSSupports32BitArchitectures = !string.IsNullOrEmpty (GetVariable ("IOS_SUPPORTS_32BIT_ARCHITECTURES", "")); EnableXamarin = !string.IsNullOrEmpty (GetVariable ("ENABLE_XAMARIN", "")); XcodeIsStable = string.Equals (GetVariable ("XCODE_IS_STABLE", ""), "true", StringComparison.OrdinalIgnoreCase); @@ -333,9 +321,7 @@ 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); } public static string RootPath { @@ -384,12 +370,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) @@ -398,84 +378,12 @@ public static string SourceRoot { } } - public static string XamarinIOSDll { - get { - return Path.Combine (mt_root, "lib", "mono", "Xamarin.iOS", "Xamarin.iOS.dll"); - } - } - - public static string XamarinCatalystDll { - get { - return Path.Combine (mt_root, "lib", "mono", "Xamarin.MacCatalyst", "Xamarin.MacCatalyst.dll"); - } - } - - public static string XamarinWatchOSDll { - get { - return Path.Combine (mt_root, "lib", "mono", "Xamarin.WatchOS", "Xamarin.WatchOS.dll"); - } - } - - public static string XamarinTVOSDll { - get { - return Path.Combine (mt_root, "lib", "mono", "Xamarin.TVOS", "Xamarin.TVOS.dll"); - } - } - - public static string XamarinMacMobileDll { - get { - return Path.Combine (SdkRootXM, "lib", "mono", "Xamarin.Mac", "Xamarin.Mac.dll"); - } - } - - public static string XamarinMacFullDll { - get { - return Path.Combine (SdkRootXM, "lib", "mono", "4.5", "Xamarin.Mac.dll"); - } - } - - public static string SdkBinDir { - get { -#if MONOMAC - return BinDirXM; -#else - return BinDirXI; -#endif - } - } - - public static string TargetDirectoryXI { - get { - if (UseSystem) - return "/"; - return make_config ["IOS_DESTDIR"]; - } - } - - public static string TargetDirectoryXM { - get { - if (UseSystem) - return "/"; - return make_config ["MAC_DESTDIR"]; - } - } - public static string TestProjectsDirectory { get { return Path.Combine (RootPath, "tests", "common", "TestProjects"); } } - public static string SdkRoot { - get { -#if MONOMAC - return SdkRootXM; -#else - return SdkRootXI; -#endif - } - } - static string GetRefNuGetName (TargetFramework targetFramework) => GetRefNuGetName (targetFramework.Platform); static string GetRefNuGetName (ApplePlatform platform) @@ -527,11 +435,7 @@ public static string GetRefDirectory (ApplePlatform platform) public static string GetRefDirectory (TargetFramework targetFramework) { - if (targetFramework.IsDotNet) - return GetRefDirectory (targetFramework.Platform); - - // This is only applicable for .NET - throw new InvalidOperationException (targetFramework.ToString ()); + return GetRefDirectory (targetFramework.Platform); } public static string GetNuGetVersionNoMetadata (TargetFramework framework) @@ -555,34 +459,9 @@ public static string GetRuntimeDirectory (ApplePlatform platform, string runtime return Path.Combine (rv, "runtimes", runtimeIdentifier); } - public static string GetTargetDirectory (ApplePlatform platform) - { - switch (platform) { - case ApplePlatform.iOS: - case ApplePlatform.TVOS: - case ApplePlatform.WatchOS: - return TargetDirectoryXI; - case ApplePlatform.MacOSX: - return TargetDirectoryXM; - default: - throw new InvalidOperationException (platform.ToString ()); - } - } - public static string GetSdkRoot (TargetFramework targetFramework) { - if (targetFramework.IsDotNet) - return GetSdkRoot (targetFramework.Platform); - switch (targetFramework.Platform) { - case ApplePlatform.iOS: - case ApplePlatform.TVOS: - case ApplePlatform.WatchOS: - return SdkRootXI; - case ApplePlatform.MacOSX: - return SdkRootXM; - default: - throw new InvalidOperationException (); - } + return GetSdkRoot (targetFramework.Platform); } // Only valid for .NET @@ -594,215 +473,57 @@ public static string GetSdkRoot (ApplePlatform platform) return Path.Combine (rv, "tools"); } - public static string SdkRootXI { - get { - return Path.Combine (TargetDirectoryXI, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current"); - } - } - - public static string SdkRootXM { - get { - return Path.Combine (TargetDirectoryXM, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); - } - } - - public static string BinDirXI { - get { - return Path.Combine (SdkRootXI, "bin"); - } - } - - public static string BinDirXM { - get { - return Path.Combine (SdkRootXM, "bin"); - } - } - - public static string BtouchPath { - get { - return Path.Combine (SdkBinDir, "btouch-native"); - } - } - - public static string BGenPath { - get { - return Path.Combine (SdkBinDir, "bgen"); - } - } - - public static string BGenClassicPath { - get { - return Path.Combine (BinDirXM, "bgen-classic"); - } - } - public static string GetBindingAttributePath (TargetFramework targetFramework) { - if (targetFramework.IsDotNet) - return Path.Combine (GetSdkRoot (targetFramework), "lib", "Xamarin.Apple.BindingAttributes.dll"); - - switch (targetFramework.Platform) { - case ApplePlatform.iOS: - return Path.Combine (GetSdkRoot (targetFramework), "lib", "bgen", "Xamarin.iOS.BindingAttributes.dll"); - case ApplePlatform.TVOS: - return Path.Combine (GetSdkRoot (targetFramework), "lib", "bgen", "Xamarin.TVOS.BindingAttributes.dll"); - case ApplePlatform.WatchOS: - return Path.Combine (GetSdkRoot (targetFramework), "lib", "bgen", "Xamarin.WatchOS.BindingAttributes.dll"); - case ApplePlatform.MacOSX: - if (targetFramework == TargetFramework.Xamarin_Mac_2_0_Mobile) { - return Path.Combine (GetSdkRoot (targetFramework), "lib", "bgen", "Xamarin.Mac-mobile.BindingAttributes.dll"); - } else if (targetFramework == TargetFramework.Xamarin_Mac_4_5_Full) { - return Path.Combine (GetSdkRoot (targetFramework), "lib", "bgen", "Xamarin.Mac-full.BindingAttributes.dll"); - } - goto default; - default: - throw new InvalidOperationException (); - } - } - - public static string MmpPath { - get { - return Path.Combine (BinDirXM, "mmp"); - } - } - - public static string MtouchPath { - get { - return Path.Combine (BinDirXI, "mtouch"); - } - } - - public static string MlaunchPath { - get { - var env = Environment.GetEnvironmentVariable ("MLAUNCH_PATH"); - if (!string.IsNullOrEmpty (env)) - return env; - return Path.Combine (BinDirXI, "mlaunch"); - } + return Path.Combine (GetSdkRoot (targetFramework), "lib", "Xamarin.Apple.BindingAttributes.dll"); } #if !XAMMAC_TESTS - public static void AssertRuntimeIdentifierAvailable (ApplePlatform platform, string runtimeIdentifier) + public static string GetBaseLibrary (ApplePlatform platform) { - 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) - { - switch (profile) { - case Profile.iOS: - return XamarinIOSDll; - case Profile.tvOS: - return XamarinTVOSDll; - case Profile.watchOS: - return XamarinWatchOSDll; - case Profile.macOSMobile: - return XamarinMacMobileDll; - case Profile.macOSFull: - case Profile.macOSSystem: - return XamarinMacFullDll; - default: - throw new NotImplementedException (); - } - } - - public static string GetBaseLibrary (ApplePlatform platform, bool isDotNet) - { - if (isDotNet) - return Path.Combine (GetRefDirectory (platform), GetBaseLibraryName (platform, isDotNet)); - return GetBaseLibrary (platform.AsProfile ()); + return Path.Combine (GetRefDirectory (platform), GetBaseLibraryName (platform)); } static string GetBaseLibraryName (TargetFramework targetFramework) { - return GetBaseLibraryName (targetFramework.Platform, targetFramework.IsDotNet); + return GetBaseLibraryName (targetFramework.Platform); } - public static string GetBaseLibraryName (ApplePlatform platform, bool isDotNet) + public static string GetBaseLibraryName (ApplePlatform platform) { switch (platform) { case ApplePlatform.iOS: - return isDotNet ? "Microsoft.iOS.dll" : "Xamarin.iOS.dll"; + return "Microsoft.iOS.dll"; case ApplePlatform.TVOS: - return isDotNet ? "Microsoft.tvOS.dll" : "Xamarin.TVOS.dll"; - case ApplePlatform.WatchOS: - return isDotNet ? "Microsoft.watchOS.dll" : "Xamarin.WatchOS.dll"; + return "Microsoft.tvOS.dll"; case ApplePlatform.MacOSX: - return isDotNet ? "Microsoft.macOS.dll" : "Xamarin.Mac.dll"; + return "Microsoft.macOS.dll"; case ApplePlatform.MacCatalyst: - return isDotNet ? "Microsoft.MacCatalyst.dll" : "Xamarin.MacCatalyst.dll"; + return "Microsoft.MacCatalyst.dll"; default: throw new InvalidOperationException (platform.ToString ()); } } - public static ApplePlatform GetPlatform (string assemblyName, bool isDotNet) + public static ApplePlatform GetPlatform (string assemblyName) { - if (isDotNet) { - switch (Path.GetFileNameWithoutExtension (assemblyName)) { - case "Microsoft.iOS": - return ApplePlatform.iOS; - case "Microsoft.MacCatalyst": - return ApplePlatform.MacCatalyst; - case "Microsoft.tvOS": - return ApplePlatform.TVOS; - case "Microsoft.macOS": - return ApplePlatform.MacOSX; - default: - throw new NotSupportedException ($"Unknown assembly: {assemblyName}"); - } - } else { - switch (Path.GetFileNameWithoutExtension (assemblyName)) { - case "Xamarin.iOS": - return ApplePlatform.iOS; - case "Xamarin.WatchOS": - return ApplePlatform.WatchOS; - case "Xamarin.TVOS": - return ApplePlatform.TVOS; - case "Xamarin.Mac": - return ApplePlatform.MacOSX; - default: - throw new NotSupportedException ($"Unknown assembly: {assemblyName}"); - } + switch (Path.GetFileNameWithoutExtension (assemblyName)) { + case "Microsoft.iOS": + return ApplePlatform.iOS; + case "Microsoft.MacCatalyst": + return ApplePlatform.MacCatalyst; + case "Microsoft.tvOS": + return ApplePlatform.TVOS; + case "Microsoft.macOS": + return ApplePlatform.MacOSX; + default: + throw new NotSupportedException ($"Unknown assembly: {assemblyName}"); } } public static string GetBaseLibrary (TargetFramework targetFramework) { - if (targetFramework.IsDotNet) - return Path.Combine (GetRefDirectory (targetFramework), GetBaseLibraryName (targetFramework)); - - switch (targetFramework.Platform) { - case ApplePlatform.iOS: - return XamarinIOSDll; - case ApplePlatform.TVOS: - return XamarinTVOSDll; - case ApplePlatform.WatchOS: - return XamarinWatchOSDll; - } - - if (targetFramework == TargetFramework.Xamarin_Mac_2_0_Mobile) { - return XamarinMacMobileDll; - } else if (targetFramework == TargetFramework.Xamarin_Mac_4_5_Full) { - return XamarinMacFullDll; - } - - throw new InvalidOperationException (targetFramework.ToString ()); + return Path.Combine (GetRefDirectory (targetFramework), GetBaseLibraryName (targetFramework)); } public static IList GetRuntimeIdentifiers (ApplePlatform platform) @@ -825,7 +546,7 @@ public static IList GetArchitectures (string runtimeIdentifier) public static IEnumerable GetBaseLibraryImplementations () { - foreach (var platform in GetIncludedPlatforms (true)) + foreach (var platform in GetIncludedPlatforms ()) foreach (var lib in GetBaseLibraryImplementations (platform)) yield return lib; } @@ -835,97 +556,25 @@ public static IEnumerable GetBaseLibraryImplementations (ApplePlatform p var runtimeIdentifiers = GetRuntimeIdentifiers (platform); foreach (var rid in runtimeIdentifiers) { var libdir = Path.Combine (GetRuntimeDirectory (platform, rid), "lib", DotNetTfm); - yield return Path.Combine (libdir, GetBaseLibraryName (platform, true)); + yield return Path.Combine (libdir, GetBaseLibraryName (platform)); } } public static IEnumerable GetRefLibraries () { - foreach (var platform in GetIncludedPlatforms (true)) - yield return Path.Combine (GetRefDirectory (platform), GetBaseLibraryName (platform, true)); + foreach (var platform in GetIncludedPlatforms ()) + yield return Path.Combine (GetRefDirectory (platform), GetBaseLibraryName (platform)); } public static string GetRefLibrary (ApplePlatform platform) { - return GetBaseLibrary (platform, true); - } - - public static string GetTargetFramework (Profile profile) - { - switch (profile) { - case Profile.iOS: - return "Xamarin.iOS,v1.0"; - case Profile.tvOS: - return "Xamarin.TVOS,v1.0"; - case Profile.watchOS: - return "Xamarin.WatchOS,v1.0"; - case Profile.macOSMobile: - return "Xamarin.Mac,Version=v2.0,Profile=Mobile"; - case Profile.macOSFull: - return "Xamarin.Mac,Version=v4.5,Profile=Full"; - case Profile.macOSSystem: - return "Xamarin.Mac,Version=v4.5,Profile=System"; - default: - throw new NotImplementedException (); - } - } - - public static string GetSdkVersion (Profile profile) - { - switch (profile) { - case Profile.iOS: - return Configuration.sdk_version; - case Profile.tvOS: - return Configuration.tvos_sdk_version; - case Profile.watchOS: - return Configuration.watchos_sdk_version; - case Profile.macOSFull: - case Profile.macOSMobile: - case Profile.macOSSystem: - return Configuration.macos_sdk_version; - default: - throw new NotImplementedException (); - } - } - - public static string GetSdkPath (Profile profile, bool is_device) - { - switch (profile) { - case Profile.iOS: - return Path.Combine (MonoTouchRootDirectory, "SDKs", "MonoTouch." + (is_device ? "iphoneos" : "iphonesimulator") + ".sdk"); - case Profile.tvOS: - return Path.Combine (MonoTouchRootDirectory, "SDKs", "Xamarin.AppleTV" + (is_device ? "OS" : "Simulator") + ".sdk"); - case Profile.watchOS: - return Path.Combine (MonoTouchRootDirectory, "SDKs", "Xamarin.Watch" + (is_device ? "OS" : "Simulator") + ".sdk"); - case Profile.macOSFull: - case Profile.macOSMobile: - case Profile.macOSSystem: - return Path.Combine (SdkRootXM, "lib"); - default: - throw new NotImplementedException (profile.ToString ()); - } - } - - public static string GetCompiler (Profile profile, IList args) - { - args.Add ($"-lib:{Path.GetDirectoryName (GetBaseLibrary (profile))}"); - 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."); + return GetBaseLibrary (platform); } #endif // !XAMMAC_TESTS - public static IEnumerable GetIncludedPlatforms (bool dotnet) + public static IEnumerable GetIncludedPlatforms () { - if (dotnet && !include_dotnet) - yield break; - if (include_ios) yield return ApplePlatform.iOS; if (include_tvos) @@ -934,19 +583,14 @@ 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) + public static IEnumerable GetAllPlatforms () { yield return ApplePlatform.iOS; yield return ApplePlatform.TVOS; yield return ApplePlatform.MacOSX; - if (dotnet) - yield return ApplePlatform.MacCatalyst; - if (!dotnet) - yield return ApplePlatform.WatchOS; + yield return ApplePlatform.MacCatalyst; } public static string NuGetPackagesDirectory { @@ -955,31 +599,6 @@ public static string NuGetPackagesDirectory { } } - 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. @@ -1041,14 +660,10 @@ public static Dictionary GetBuildEnvironment (ApplePlatform plat public static void SetBuildVariables (ApplePlatform platform, ref Dictionary environment) { - var rootDirectory = GetTargetDirectory (platform); - if (environment is null) environment = new Dictionary (); environment ["MD_APPLE_SDK_ROOT"] = Path.GetDirectoryName (Path.GetDirectoryName (xcode_root)); - environment ["TargetFrameworkFallbackSearchPaths"] = Path.Combine (rootDirectory, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); - environment ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine (rootDirectory, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); // This is set by `dotnet test` and can cause building legacy projects to fail to build with: // Microsoft.NET.Build.Extensions.ConflictResolution.targets(30,5): @@ -1056,116 +671,10 @@ public static void SetBuildVariables (ApplePlatform platform, ref Dictionary declaration is correct, that the assembly and all its dependencies are available, // and that the task contains a public class that implements Microsoft.Build.Framework.ITask. environment ["MSBuildExtensionsPath"] = null; - - switch (platform) { - case ApplePlatform.iOS: - case ApplePlatform.TVOS: - case ApplePlatform.WatchOS: - environment ["MD_MTOUCH_SDK_ROOT"] = Path.Combine (rootDirectory, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current"); - break; - case ApplePlatform.MacOSX: - environment ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine (rootDirectory, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); - environment ["XamarinMacFrameworkRoot"] = Path.Combine (rootDirectory, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); - break; - default: - throw new NotImplementedException (platform.ToString ()); - } - } - - // 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.WatchOS: - if (!include_watchos) - Assert.Ignore ("watchOS is not included in this build"); -#if NET - if (!include_dotnet_watchos) - Assert.Ignore ("watchOS is not included in this build"); -#endif - - 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."); + public static bool IsBuildingRemotely { + get => !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("MAC_AGENT_IP")); } public static string GetTestLibraryDirectory (ApplePlatform platform, bool? simulator = null) @@ -1278,3 +787,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..47d45bdc26a4 --- /dev/null +++ b/tests/common/ConfigurationNUnit.cs @@ -0,0 +1,156 @@ +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 () + { + 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 () + { + } + + public static void AssertLegacyXamarinAvailable () + { + 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 () + { + return AnyIgnoredPlatforms (out var _); + } + + public static bool AnyIgnoredPlatforms (out IEnumerable notIncluded) + { + var allPlatforms = GetAllPlatforms (); + var includedPlatforms = GetIncludedPlatforms (); + notIncluded = allPlatforms.Where (v => !includedPlatforms.Contains (v)).ToArray (); + return notIncluded.Any (); + } + + public static void IgnoreIfAnyIgnoredPlatforms () + { + if (AnyIgnoredPlatforms (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..3ebf8caf643e --- /dev/null +++ b/tests/common/ConfigurationXUnit.cs @@ -0,0 +1,84 @@ +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; + } + } + + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = true)] + public sealed class AllSupportedPlatformsAttribute : DataAttribute { + + readonly object [] dataValues; + + public AllSupportedPlatformsAttribute (params object [] parameters) + { + dataValues = parameters; + } + + public override IEnumerable GetData (MethodInfo testMethod) + { + return Configuration. + GetIncludedPlatforms (). + Select (platform => dataValues.Prepend (platform).ToArray ()); + } + } + + public partial class Configuration { + static string TestAssemblyDirectory { + get { + return Assembly.GetExecutingAssembly ().Location; + } + } + + public static bool IsEnabled (ApplePlatform platform) + => platform switch { + ApplePlatform.iOS => include_ios, + ApplePlatform.TVOS => include_tvos, + ApplePlatform.MacCatalyst => include_maccatalyst, + ApplePlatform.MacOSX => include_mac, + _ => false + }; + } +} 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 GetDynamicLibraryName (); - } -} diff --git a/tests/common/PListAsserts.cs b/tests/common/PListAsserts.cs new file mode 100644 index 000000000000..bd80c3b4e3da --- /dev/null +++ b/tests/common/PListAsserts.cs @@ -0,0 +1,124 @@ +using System; +using System.IO; +using System.Linq; + +using Xamarin.MacDev; +using Xamarin.Utils; + +using NUnit.Framework; + +#nullable enable + +namespace Xamarin.Tests { + public static class PListAsserts { + // Compare two plists, and assert if there are any differences. + public static void AreStringsEqual (string expectedXml, string actualXml, string? message = null) + { + if (string.Equals (expectedXml, actualXml, StringComparison.Ordinal)) + return; + + var expected = string.IsNullOrEmpty (expectedXml) ? new PDictionary () : PDictionary.FromString (expectedXml)!; + var actual = string.IsNullOrEmpty (actualXml) ? new PDictionary () : PDictionary.FromString (actualXml)!; + if (expected is not PDictionary expectedDictionary) + throw new InvalidOperationException ($"Root element for the expected plist isn't a dictionary"); + if (actual is not PDictionary actualDictionary) + throw new InvalidOperationException ($"Root element for the actual plist isn't a dictionary"); + AssertPDictionaryEqual (expectedXml, actualXml, expectedDictionary, actualDictionary, "", message); + } + + // Compare two plists, and assert if there are any differences. + public static void AreFilesEqual (string expectedXmlPath, string actualXmlPath, string? message = null) + { + Assert.That (expectedXmlPath, Does.Exist, message); + Assert.That (actualXmlPath, Does.Exist, message); + AreStringsEqual (File.ReadAllText (expectedXmlPath), File.ReadAllText (actualXmlPath), message); + } + + static void AssertPDictionaryEqual (string expectedXml, string actualXml, PDictionary expected, PDictionary actual, string key, string? message = null) + { + var expectedKeys = expected.Select (v => v.Key ?? string.Empty).OrderBy (v => v).ToArray (); + var actualKeys = actual.Select (v => v.Key ?? string.Empty).OrderBy (v => v).ToArray (); + if (expectedKeys.Length != actualKeys.Length) { + Assert.Fail ( + $"Expected {expectedKeys.Length} entries in 'dict' for key '{key}', got {actualKeys.Length} entries: {message}\n" + + $"\tExpected keys: {string.Join (", ", expectedKeys)}\n" + + $"\tActual keys: {string.Join (", ", actualKeys)}\n" + + $"\tExpected xml:\n" + + $"\t\t{expectedXml.Replace ("\n", "\n\t\t")}\n" + + $"\tActual xml:\n" + + $"\t\t{actualXml.Replace ("\n", "\n\t\t")}" + ); + return; + } + for (var i = 0; i < expectedKeys.Length; i++) { + if (expectedKeys [i] != actualKeys [i]) { + Assert.Fail ( + $"Expected key '{expectedKeys [i]}' in 'dict' for key '{key}', got key '{actualKeys [i]}': {message}\n" + + $"\tExpected xml:\n" + + $"\t\t{expectedXml.Replace ("\n", "\n\t\t")}\n" + + $"\tActual xml:\n" + + $"\t\t{actualXml.Replace ("\n", "\n\t\t")}" + ); + return; + } + var expectedValue = expected [expectedKeys [i]]!; + var actualValue = actual [actualKeys [i]]!; + AssertPObjectEqual (expectedXml, actualXml, expectedValue, actualValue, expectedKeys [i], message); + } + } + + static void AssertPArrayEqual (string expectedXml, string actualXml, PArray expected, PArray actual, string key, string? message = null) + { + if (expected.Count != actual.Count) { + Assert.Fail ( + $"Expected {expected.Count} items in 'array' for key '{key}', got {actual.Count} items: {message}\n" + + $"\tExpected xml:\n" + + $"\t\t{expectedXml.Replace ("\n", "\n\t\t")}\n" + + $"\tActual xml:\n" + + $"\t\t{actualXml.Replace ("\n", "\n\t\t")}" + ); + return; + } + for (var i = 0; i < expected.Count; i++) { + AssertPObjectEqual (expectedXml, actualXml, expected [i], actual [i], key, message); + } + } + + static void AssertPStringEqual (string expectedXml, string actualXml, PString expected, PString actual, string key, string? message = null) + { + if (expected.Value != actual.Value) { + Assert.Fail ( + $"Expected string of value '{expected.Value}' for key '{key}', got string of value '{actual.Value}': {message}\n" + + $"\tExpected xml:\n" + + $"\t\t{expectedXml.Replace ("\n", "\n\t\t")}\n" + + $"\tActual xml:\n" + + $"\t\t{actualXml.Replace ("\n", "\n\t\t")}" + ); + } + } + + static void AssertPObjectEqual (string expectedXml, string actualXml, PObject expected, PObject actual, string key, string? message = null) + { + if (expected.GetType () != actual.GetType ()) { + Assert.Fail ( + $"Expected item of type '{expected.GetType ().Name}' for key '{key}', got item of type '{actual.GetType ()}': {message}\n" + + $"\tExpected xml:\n" + + $"\t\t{expectedXml.Replace ("\n", "\n\t\t")}\n" + + $"\tActual xml:\n" + + $"\t\t{actualXml.Replace ("\n", "\n\t\t")}" + ); + return; + } + + if (expected is PDictionary expectedDictionary) { + AssertPDictionaryEqual (expectedXml, actualXml, expectedDictionary, (PDictionary) actual, key, message); + } else if (expected is PString expectedString) { + AssertPStringEqual (expectedXml, actualXml, expectedString, (PString) actual, key, message); + } else if (expected is PArray expectedArray) { + AssertPArrayEqual (expectedXml, actualXml, expectedArray, (PArray) actual, key, message); + } else { + throw new NotImplementedException ($"Comparing PList objects of type {expected.GetType ().Name}"); + } + } + } +} diff --git a/tests/common/PlatformInfo.cs b/tests/common/PlatformInfo.cs index dcf4b4e962bf..f1ea1ccdec16 100644 --- a/tests/common/PlatformInfo.cs +++ b/tests/common/PlatformInfo.cs @@ -22,6 +22,9 @@ using Xamarin.Utils; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Xamarin.Tests { public sealed class PlatformInfo { static PlatformInfo GetHostPlatformInfo () @@ -34,9 +37,6 @@ static PlatformInfo GetHostPlatformInfo () #elif __TVOS__ || __IOS__ name = UIDevice.CurrentDevice.SystemName; version = UIDevice.CurrentDevice.SystemVersion; -#elif __WATCHOS__ - name = WatchKit.WKInterfaceDevice.CurrentDevice.SystemName; - version = WatchKit.WKInterfaceDevice.CurrentDevice.SystemVersion; #elif MONOMAC || __MACOS__ using (var plist = NSDictionary.FromFile ("/System/Library/CoreServices/SystemVersion.plist")) { name = (NSString) plist ["ProductName"]; @@ -51,7 +51,6 @@ static PlatformInfo GetHostPlatformInfo () var platformInfo = new PlatformInfo (); -#if NET if (name.StartsWith ("maccatalyst", StringComparison.Ordinal)) platformInfo.Name = ApplePlatform.MacCatalyst; else if (name.StartsWith ("mac", StringComparison.Ordinal)) @@ -60,39 +59,16 @@ static PlatformInfo GetHostPlatformInfo () platformInfo.Name = ApplePlatform.iOS; else if (name.StartsWith ("tvos", StringComparison.Ordinal)) platformInfo.Name = ApplePlatform.TVOS; - else if (name.StartsWith ("watchos", StringComparison.Ordinal)) - platformInfo.Name = ApplePlatform.WatchOS; else throw new FormatException ($"Unknown product name: {name}"); -#else - if (name.StartsWith ("maccatalyst", StringComparison.Ordinal)) - platformInfo.Name = PlatformName.MacCatalyst; - else if (name.StartsWith ("mac", StringComparison.Ordinal)) - platformInfo.Name = PlatformName.MacOSX; - else if (name.StartsWith ("ios", StringComparison.Ordinal) || name.StartsWith ("iphoneos", StringComparison.Ordinal)) - platformInfo.Name = PlatformName.iOS; - else if (name.StartsWith ("tvos", StringComparison.Ordinal)) - platformInfo.Name = PlatformName.TvOS; - else if (name.StartsWith ("watchos", StringComparison.Ordinal)) - platformInfo.Name = PlatformName.WatchOS; - else - throw new FormatException ($"Unknown product name: {name}"); -#endif platformInfo.Version = Version.Parse (version); -#if !NET - if (IntPtr.Size == 4) - platformInfo.Architecture = PlatformArchitecture.Arch32; - else if (IntPtr.Size == 8) - platformInfo.Architecture = PlatformArchitecture.Arch64; -#endif - return platformInfo; } #if __MACCATALYST__ - static string? _iOSSupportVersion; + static string _iOSSupportVersion; internal static string iOSSupportVersion { get { if (_iOSSupportVersion is null) { @@ -109,23 +85,11 @@ internal static string iOSSupportVersion { public static readonly PlatformInfo Host = GetHostPlatformInfo (); -#if NET public ApplePlatform Name { get; private set; } -#else - public PlatformName Name { get; private set; } - public PlatformArchitecture Architecture { get; private set; } -#endif public Version Version { get; private set; } -#if NET public bool IsMac => Name == ApplePlatform.MacOSX; public bool IsIos => Name == ApplePlatform.iOS; -#else - public bool IsMac => Name == PlatformName.MacOSX; - public bool IsIos => Name == PlatformName.iOS; - public bool IsArch32 => Architecture.HasFlag (PlatformArchitecture.Arch32); - public bool IsArch64 => Architecture.HasFlag (PlatformArchitecture.Arch64); -#endif PlatformInfo () { @@ -138,38 +102,25 @@ public static bool IsAvailableOnHostPlatform (this ICustomAttributeProvider attr return attributeProvider.IsAvailable (PlatformInfo.Host); } -#if NET [UnconditionalSuppressMessage ("Trimming", "IL2045", Justification = "Some of the attributes this method uses may have been linked away, so things might not work. It actually works though, so unless something changes, we're going to assume it's trimmer-compatible.")] -#endif public static bool IsAvailable (this ICustomAttributeProvider attributeProvider, PlatformInfo targetPlatform) { var customAttributes = attributeProvider.GetCustomAttributes (true); -#if NET customAttributes = customAttributes.ToArray (); // don't iterate twice if (customAttributes.Any (v => v is ObsoleteAttribute)) return false; -#endif return customAttributes -#if NET .OfType () -#else - .OfType () -#endif .IsAvailable (targetPlatform); } -#if NET public static bool IsAvailableOnHostPlatform (this IEnumerable attributes) -#else - public static bool IsAvailableOnHostPlatform (this IEnumerable attributes) -#endif { return attributes.IsAvailable (PlatformInfo.Host); } -#if NET static IEnumerable<(OSPlatformAttribute Attribute, ApplePlatform Platform, Version Version)> ParseAttributes (IEnumerable attributes) { foreach (var attr in attributes) { @@ -205,9 +156,7 @@ public static bool IsAvailable (this IEnumerable attributes // return attributes.Count () == 0; } -#if NET [UnconditionalSuppressMessage ("Trimming", "IL2045", Justification = "Some of the attributes this method uses may have been linked away, so things might not work. It actually works though, so unless something changes, we're going to assume it's trimmer-compatible.")] -#endif public static bool? IsAvailable (IEnumerable<(OSPlatformAttribute Attribute, ApplePlatform Platform, Version Version)> attributes, PlatformInfo targetPlatform, ApplePlatform attributePlatform) { // First we check for any unsupported attributes, and only once we know that there aren't any unsupported @@ -240,44 +189,5 @@ public static bool IsAvailable (this IEnumerable attributes return null; } -#else - public static bool IsAvailable (this IEnumerable attributes, PlatformInfo targetPlatform) - { - // always "available" from a binding perspective if - // there are no explicit annotations saying otherwise - var available = true; - - foreach (var attr in attributes) { - if (attr.Platform != targetPlatform.Name) - continue; - - switch (attr.AvailabilityKind) { - case AvailabilityKind.Introduced: - if (attr.Version is not null) - available &= targetPlatform.Version >= attr.Version; - - if (attr.Architecture != PlatformArchitecture.None && - attr.Architecture != PlatformArchitecture.All) - available &= attr.Architecture.HasFlag (targetPlatform.Architecture); - break; - case AvailabilityKind.Deprecated: - case AvailabilityKind.Obsoleted: - if (attr.Version is not null) - available &= targetPlatform.Version < attr.Version; - // FIXME: handle architecture-level _un_availability? - // we didn't do this with the old AvailabilityAttribute... - break; - case AvailabilityKind.Unavailable: - available = false; - break; - } - - if (!available) - return false; - } - - return available; - } -#endif } } diff --git a/tests/common/TestRuntime.cs b/tests/common/TestRuntime.cs index ef55f085cc8c..572d42e51dc2 100644 --- a/tests/common/TestRuntime.cs +++ b/tests/common/TestRuntime.cs @@ -470,6 +470,18 @@ public static bool CheckXcodeVersion (int major, int minor, int build = 0) return CheckMacSystemVersion (15, 0); #else throw new NotImplementedException ($"Missing platform case for Xcode {major}.{minor}"); +#endif + case 1: +#if __WATCHOS__ + return CheckWatchOSSystemVersion (11, 1); +#elif __TVOS__ + return ChecktvOSSystemVersion (18, 1); +#elif __IOS__ + return CheckiOSSystemVersion (18, 1); +#elif MONOMAC + return CheckMacSystemVersion (15, 1); +#else + throw new NotImplementedException ($"Missing platform case for Xcode {major}.{minor}"); #endif default: throw new NotImplementedException ($"Missing version logic for checking for Xcode {major}.{minor}"); diff --git a/tests/common/Tool.cs b/tests/common/Tool.cs index d20537227fa7..0bd8879c058c 100644 --- a/tests/common/Tool.cs +++ b/tests/common/Tool.cs @@ -127,22 +127,7 @@ public int Execute (string toolPath, IList arguments) public int Execute (string toolPath, IList arguments, bool always_show_output) { - output.Clear (); - output_lines = null; - - var args = new List (); - args.Add ("-t"); - args.Add ("--"); - args.Add (toolPath); - args.AddRange (arguments); - var rv = ExecutionHelper.Execute (Configuration.XIBuildPath, args, EnvironmentVariables, output, output, workingDirectory: WorkingDirectory); - - if ((rv != 0 || always_show_output) && output.Length > 0) - Console.WriteLine ("\t" + output.ToString ().Replace ("\n", "\n\t")); - - ParseMessages (); - - return rv; + throw new NotSupportedException ("Legacy projects not supported anymore"); } static bool IndexOfAny (string line, out int start, out int end, params string [] values) diff --git a/tests/common/mac/ProjectTestHelpers.cs b/tests/common/mac/ProjectTestHelpers.cs index 1b34a84a0152..330dfcfaa489 100644 --- a/tests/common/mac/ProjectTestHelpers.cs +++ b/tests/common/mac/ProjectTestHelpers.cs @@ -193,7 +193,7 @@ public static string RunAndAssert (string exe, IList args, string stepNa // In most cases we generate projects in tmp and this is not needed. But nuget and test projects can make that hard public static void CleanUnifiedProject (string csprojTarget) { - RunAndAssert (Configuration.XIBuildPath, new [] { "--", csprojTarget, "/t:clean" }, "Clean", environment: Configuration.GetBuildEnvironment (ApplePlatform.MacOSX)); + RunAndAssert ("Legacy projects not supported anymore", new [] { "--", csprojTarget, "/t:clean" }, "Clean", environment: Configuration.GetBuildEnvironment (ApplePlatform.MacOSX)); } public static BuildResult BuildProject (string csprojTarget, bool shouldFail = false, bool release = false, Dictionary environment = null, IList extraArgs = null) @@ -227,7 +227,7 @@ public static BuildResult BuildProject (string csprojTarget, bool shouldFail = f }; buildArgs.Insert (0, "--"); - RunAndAssert (Configuration.XIBuildPath, buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment); + RunAndAssert ("Legacy projects not supported anymore", buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment); return new BuildResult (binlog); } @@ -492,11 +492,6 @@ static void Main (string[] args) s.Write (testCase); } - public static string FindRootDirectory () - { - return Configuration.TargetDirectoryXM; - } - static string GenerateOutputCommand (string tmpDir, Guid guid) { return string.Format ("System.IO.File.Create(\"{0}\").Dispose();", Path.Combine (tmpDir, guid.ToString ())); @@ -505,7 +500,7 @@ static string GenerateOutputCommand (string tmpDir, Guid guid) public static bool TryNugetRestore (string project, out StringBuilder output) { output = new StringBuilder (); - var rv = ExecutionHelper.Execute (Configuration.XIBuildPath, new [] { $"--", "/t:Restore", project }, stdout: output, stderr: output, environmentVariables: Configuration.GetBuildEnvironment (ApplePlatform.MacOSX)); + var rv = ExecutionHelper.Execute ("Legacy projects not supported anymore", new [] { $"--", "/t:Restore", project }, stdout: output, stderr: output, environmentVariables: Configuration.GetBuildEnvironment (ApplePlatform.MacOSX)); return rv == 0; } diff --git a/tests/common/mac/project_building.mk b/tests/common/mac/project_building.mk index 628abba9e3d8..da612f0741d3 100644 --- a/tests/common/mac/project_building.mk +++ b/tests/common/mac/project_building.mk @@ -1,5 +1,6 @@ SOURCES = $(TEST_SRC) \ $(TOP)/tests/common/Configuration.cs \ + $(TOP)/tests/common/ConfigurationNUnit.cs \ $(TOP)/tests/common/mac/ProjectTestHelpers.cs \ $(TOP)/tools/common/Driver.cs \ $(TOP)/tools/common/TargetFramework.cs \ diff --git a/tests/common/shared-dotnet.csproj b/tests/common/shared-dotnet.csproj index 2b46011e8e0e..f84dd0fb3c12 100644 --- a/tests/common/shared-dotnet.csproj +++ b/tests/common/shared-dotnet.csproj @@ -55,9 +55,6 @@ latest - - $(DefineConstants);XAMCORE_3_0 - CA1416;$(NoWarn) diff --git a/tests/dotnet/AppWithXCAssets/AppDelegate.cs b/tests/dotnet/AppWithXCAssets/AppDelegate.cs index db627351190b..a6edee7af51c 100644 --- a/tests/dotnet/AppWithXCAssets/AppDelegate.cs +++ b/tests/dotnet/AppWithXCAssets/AppDelegate.cs @@ -1,17 +1,97 @@ using System; using System.Runtime.InteropServices; +using System.Threading.Tasks; +using CoreGraphics; using Foundation; -namespace MySimpleApp { +#if !__MACOS__ +using UIKit; +#endif + +#nullable enable + +namespace AppWithXCAssets { +#if !(__MACCATALYST__ || __MACOS__) + public class AppDelegate : UIApplicationDelegate { + UIWindow? window; + UIButton? button; + UIColor blue = UIColor.FromRGB (31, 174, 206); + UIColor green = UIColor.FromRGB (119, 187, 65); + + public override bool FinishedLaunching (UIApplication app, NSDictionary options) + { + window = new UIWindow (UIScreen.MainScreen.Bounds); + + var dvc = new UIViewController (); + var bounds = window.Bounds; + button = new UIButton (window.Bounds); + button.SetTitleColor (blue, UIControlState.Normal); + button.SetTitle ("Switch icon!", UIControlState.Normal); + dvc.Add (button); + + window.RootViewController = dvc; + window.MakeKeyAndVisible (); + + ScheduleIconSwitching (); + + return true; + } + + void ScheduleIconSwitching () + { + NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (1), async (v) => { + Console.WriteLine ($"Starting icon switching!"); + await SwitchIcon (); + }); + } + + async Task SwitchIcon () + { + await Task.Delay (1000); // wait a bit, otherwise it doesn't work + + var supportsAlternateIcons = UIApplication.SharedApplication.SupportsAlternateIcons; + if (!supportsAlternateIcons) + Console.WriteLine ("Alternate icons aren't currently supported, but trying anyway!"); + + string? name; + UIColor color; + if (!string.IsNullOrEmpty (UIApplication.SharedApplication.AlternateIconName)) { + Console.WriteLine ($"Switching back to blue icon..."); + name = null; // switch back + color = blue; + } else { + Console.WriteLine ($"Switching to alternate green icon..."); + name = "AlternateAppIcons"; // switch + color = green; + } + + UIApplication.SharedApplication.SetAlternateIconName (name, (err) => { + if (err is null) { + Console.WriteLine ($"Switched to {(name is null ? "original icon" : $"alternate icon {name}")}"); + button!.SetTitleColor (color, UIControlState.Normal); + ScheduleIconSwitching (); + } else { + Console.WriteLine ($"Failed to switch icon : {err}"); + } + }); + } + } +#endif + public class Program { static int Main (string [] args) { +#if __MACCATALYST__ || __MACOS__ GC.KeepAlive (typeof (NSObject)); // prevent linking away the platform assembly Console.WriteLine (Environment.GetEnvironmentVariable ("MAGIC_WORD")); return args.Length; +#else + UIApplication.Main (args, null, typeof (AppDelegate)); + return 0; +#endif } } } diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..49676158376a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..1bdee23cd1ea Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..2353e257d666 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..6e63f80b06f7 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..60699df6ee74 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..290507f735d4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..d4b1df9315fb Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json new file mode 100644 index 000000000000..9b55b2086ce6 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcon-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..f24b1d62fe33 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png new file mode 100644 index 000000000000..30d5121714a0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png new file mode 100644 index 000000000000..a952d776d4e9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..dda2fc25910e --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png new file mode 100644 index 000000000000..97562c2f4b7d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png new file mode 100644 index 000000000000..388aa9f88e9d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..9174c989a9c8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..9c878460b730 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..35c074e65fce Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..7195407ab597 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..a488140938ed Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..640e594251de Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..4027b6bf9ada Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json new file mode 100644 index 000000000000..9b55b2086ce6 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcon-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..8e75d958b544 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png new file mode 100644 index 000000000000..024f0ba2fa2a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png new file mode 100644 index 000000000000..73af924f80a1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..5050c073a89d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png new file mode 100644 index 000000000000..a831d23a64e1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png new file mode 100644 index 000000000000..6a0278774e6e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..6ab7cce3ecd8 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,270 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon1242x2688.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2688x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon828x1792.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1792x828.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2388.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2388x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1125x2436.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2436x1125.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2224.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2224x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x2732.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2732x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1242x2208.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2208x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon750x1334.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "667h" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon320x480.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon768x1004.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1024x748.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1536x2008.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon2048x1496.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png new file mode 100644 index 000000000000..b997979ef875 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png new file mode 100644 index 000000000000..08d362f1392c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png new file mode 100644 index 000000000000..27d46f5c53df Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png new file mode 100644 index 000000000000..879ba7b93a0d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png new file mode 100644 index 000000000000..eb9865b186bf Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png new file mode 100644 index 000000000000..11edc7fcd9b4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png new file mode 100644 index 000000000000..347a90be0dc6 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png new file mode 100644 index 000000000000..2e97ab23c27b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png new file mode 100644 index 000000000000..7de93bf15305 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png new file mode 100644 index 000000000000..2bed0926e669 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png new file mode 100644 index 000000000000..67922976e525 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png new file mode 100644 index 000000000000..82a256faaa67 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png new file mode 100644 index 000000000000..f084a92221d0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png new file mode 100644 index 000000000000..a8dc654bfcb9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png new file mode 100644 index 000000000000..3b445ba0b717 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png new file mode 100644 index 000000000000..dea8e1205197 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png new file mode 100644 index 000000000000..cbdc8dfd4121 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png new file mode 100644 index 000000000000..07e42d25aff9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png new file mode 100644 index 000000000000..ecb57e52324c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png new file mode 100644 index 000000000000..5291f62306c9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png new file mode 100644 index 000000000000..d75740aabea8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png new file mode 100644 index 000000000000..c80b857337d8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png new file mode 100644 index 000000000000..cdbc6785ae30 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png new file mode 100644 index 000000000000..d4012e9d9b5a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png new file mode 100644 index 000000000000..1e98ebaf9aff Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png new file mode 100644 index 000000000000..4c356278d837 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..3e9d30ffa97c --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon3840x2160.png", + "idiom" : "tv", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1920x1080.png", + "idiom" : "tv", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "1x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png new file mode 100644 index 000000000000..7d4cff35f12b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png differ diff --git a/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png new file mode 100644 index 000000000000..7e19964f9c7e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/MacCatalyst/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..49676158376a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..1bdee23cd1ea Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..2353e257d666 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..6e63f80b06f7 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..60699df6ee74 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..290507f735d4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..d4b1df9315fb Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json new file mode 100644 index 000000000000..9b55b2086ce6 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcon-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..f24b1d62fe33 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png new file mode 100644 index 000000000000..30d5121714a0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png new file mode 100644 index 000000000000..a952d776d4e9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..dda2fc25910e --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png new file mode 100644 index 000000000000..97562c2f4b7d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png new file mode 100644 index 000000000000..388aa9f88e9d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..9174c989a9c8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..9c878460b730 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..35c074e65fce Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..7195407ab597 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..a488140938ed Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..640e594251de Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..4027b6bf9ada Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json new file mode 100644 index 000000000000..9b55b2086ce6 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcon-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..8e75d958b544 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png new file mode 100644 index 000000000000..024f0ba2fa2a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png new file mode 100644 index 000000000000..73af924f80a1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..5050c073a89d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png new file mode 100644 index 000000000000..a831d23a64e1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png new file mode 100644 index 000000000000..6a0278774e6e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..6ab7cce3ecd8 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,270 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon1242x2688.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2688x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon828x1792.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1792x828.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2388.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2388x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1125x2436.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2436x1125.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2224.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2224x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x2732.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2732x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1242x2208.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2208x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon750x1334.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "667h" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon320x480.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon768x1004.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1024x748.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1536x2008.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon2048x1496.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png new file mode 100644 index 000000000000..b997979ef875 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png new file mode 100644 index 000000000000..08d362f1392c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png new file mode 100644 index 000000000000..27d46f5c53df Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png new file mode 100644 index 000000000000..879ba7b93a0d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png new file mode 100644 index 000000000000..eb9865b186bf Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png new file mode 100644 index 000000000000..11edc7fcd9b4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png new file mode 100644 index 000000000000..347a90be0dc6 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png new file mode 100644 index 000000000000..2e97ab23c27b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png new file mode 100644 index 000000000000..7de93bf15305 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png new file mode 100644 index 000000000000..2bed0926e669 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png new file mode 100644 index 000000000000..67922976e525 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png new file mode 100644 index 000000000000..82a256faaa67 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png new file mode 100644 index 000000000000..f084a92221d0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png new file mode 100644 index 000000000000..a8dc654bfcb9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png new file mode 100644 index 000000000000..3b445ba0b717 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png new file mode 100644 index 000000000000..dea8e1205197 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png new file mode 100644 index 000000000000..cbdc8dfd4121 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png new file mode 100644 index 000000000000..07e42d25aff9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png new file mode 100644 index 000000000000..ecb57e52324c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png new file mode 100644 index 000000000000..5291f62306c9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png new file mode 100644 index 000000000000..d75740aabea8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png new file mode 100644 index 000000000000..c80b857337d8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png new file mode 100644 index 000000000000..cdbc6785ae30 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png new file mode 100644 index 000000000000..d4012e9d9b5a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png new file mode 100644 index 000000000000..1e98ebaf9aff Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png new file mode 100644 index 000000000000..4c356278d837 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..3e9d30ffa97c --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon3840x2160.png", + "idiom" : "tv", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1920x1080.png", + "idiom" : "tv", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "1x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png new file mode 100644 index 000000000000..7d4cff35f12b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png differ diff --git a/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png new file mode 100644 index 000000000000..7e19964f9c7e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/iOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..49676158376a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..1bdee23cd1ea Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..2353e257d666 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..6e63f80b06f7 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..60699df6ee74 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..290507f735d4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..d4b1df9315fb Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json new file mode 100644 index 000000000000..9b55b2086ce6 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcon-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..f24b1d62fe33 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png new file mode 100644 index 000000000000..30d5121714a0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png new file mode 100644 index 000000000000..a952d776d4e9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..dda2fc25910e --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png new file mode 100644 index 000000000000..97562c2f4b7d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png new file mode 100644 index 000000000000..388aa9f88e9d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..9174c989a9c8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..9c878460b730 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..35c074e65fce Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..7195407ab597 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..a488140938ed Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..640e594251de Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..4027b6bf9ada Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..4d96e08a3eb1 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon240x400.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon240x400 1.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400 1.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon240x400.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json new file mode 100644 index 000000000000..9b55b2086ce6 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcon-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..8e75d958b544 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png new file mode 100644 index 000000000000..024f0ba2fa2a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png new file mode 100644 index 000000000000..73af924f80a1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..5050c073a89d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png new file mode 100644 index 000000000000..a831d23a64e1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png new file mode 100644 index 000000000000..6a0278774e6e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/BrandAssets.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..6ab7cce3ecd8 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,270 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon1242x2688.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2688x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon828x1792.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1792x828.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2388.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2388x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1125x2436.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2436x1125.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2224.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2224x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x2732.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2732x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1242x2208.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2208x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon750x1334.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "667h" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon320x480.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon768x1004.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1024x748.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1536x2008.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon2048x1496.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png new file mode 100644 index 000000000000..b997979ef875 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png new file mode 100644 index 000000000000..08d362f1392c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png new file mode 100644 index 000000000000..27d46f5c53df Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png new file mode 100644 index 000000000000..879ba7b93a0d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png new file mode 100644 index 000000000000..eb9865b186bf Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png new file mode 100644 index 000000000000..11edc7fcd9b4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png new file mode 100644 index 000000000000..347a90be0dc6 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png new file mode 100644 index 000000000000..2e97ab23c27b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png new file mode 100644 index 000000000000..7de93bf15305 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png new file mode 100644 index 000000000000..2bed0926e669 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png new file mode 100644 index 000000000000..67922976e525 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png new file mode 100644 index 000000000000..82a256faaa67 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png new file mode 100644 index 000000000000..f084a92221d0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png new file mode 100644 index 000000000000..a8dc654bfcb9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png new file mode 100644 index 000000000000..3b445ba0b717 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png new file mode 100644 index 000000000000..dea8e1205197 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png new file mode 100644 index 000000000000..cbdc8dfd4121 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png new file mode 100644 index 000000000000..07e42d25aff9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png new file mode 100644 index 000000000000..ecb57e52324c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png new file mode 100644 index 000000000000..5291f62306c9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png new file mode 100644 index 000000000000..d75740aabea8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png new file mode 100644 index 000000000000..c80b857337d8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png new file mode 100644 index 000000000000..cdbc6785ae30 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png new file mode 100644 index 000000000000..d4012e9d9b5a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png new file mode 100644 index 000000000000..1e98ebaf9aff Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png new file mode 100644 index 000000000000..4c356278d837 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..3e9d30ffa97c --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon3840x2160.png", + "idiom" : "tv", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1920x1080.png", + "idiom" : "tv", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "1x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png new file mode 100644 index 000000000000..7d4cff35f12b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png differ diff --git a/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png new file mode 100644 index 000000000000..7e19964f9c7e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/macOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png differ diff --git a/tests/dotnet/AppWithXCAssets/shared.csproj b/tests/dotnet/AppWithXCAssets/shared.csproj index 02bb2b27bf31..f61a8ba700db 100644 --- a/tests/dotnet/AppWithXCAssets/shared.csproj +++ b/tests/dotnet/AppWithXCAssets/shared.csproj @@ -5,10 +5,16 @@ AppWithXCAssets com.xamarin.appwithxcassets + + true + + AppIcons + + @@ -27,6 +33,11 @@ + + + + + diff --git a/tests/dotnet/AppWithXCAssets/shared.mk b/tests/dotnet/AppWithXCAssets/shared.mk index f555cad4e805..521c88650b37 100644 --- a/tests/dotnet/AppWithXCAssets/shared.mk +++ b/tests/dotnet/AppWithXCAssets/shared.mk @@ -1,2 +1,3 @@ TOP=../../../.. +TESTNAME=AppWithXCAssets include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..49676158376a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..1bdee23cd1ea Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..2353e257d666 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..6e63f80b06f7 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..60699df6ee74 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..290507f735d4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..d4b1df9315fb Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..b04945daaf58 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Content.imageset/Icon-green-400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Content.imageset/Icon-green-400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Content.imageset/Icon-green-400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..b04945daaf58 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Content.imageset/Icon-green-400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Content.imageset/Icon-green-400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Content.imageset/Icon-green-400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..b04945daaf58 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Icon-green-400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Icon-green-400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Icon-green-400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateAppIcons.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..08ef43149272 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png new file mode 100644 index 000000000000..d4d309750796 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..6bd21396edd3 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png new file mode 100644 index 000000000000..f558229e8eac Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Content.imageset/Icon400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/AppIcon.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json new file mode 100644 index 000000000000..9b55b2086ce6 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcon-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcon.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..f24b1d62fe33 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png new file mode 100644 index 000000000000..30d5121714a0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png new file mode 100644 index 000000000000..a952d776d4e9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImage.imageset/Icon-green-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..dda2fc25910e --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-green-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-green-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png new file mode 100644 index 000000000000..97562c2f4b7d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png new file mode 100644 index 000000000000..388aa9f88e9d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AlternateBrandAssets.brandassets/TopShelfImageWide.imageset/Icon-green-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..53c1afb9cbae --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Contents.json @@ -0,0 +1,74 @@ +{ + "images" : [ + { + "filename" : "Icon1024.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "filename" : "Icon16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "Icon32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "Icon64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "Icon128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "Icon256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "Icon512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "Icon1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png new file mode 100644 index 000000000000..9174c989a9c8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png new file mode 100644 index 000000000000..9c878460b730 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon128.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png new file mode 100644 index 000000000000..35c074e65fce Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon16.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png new file mode 100644 index 000000000000..7195407ab597 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon256.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png new file mode 100644 index 000000000000..a488140938ed Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon32.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png new file mode 100644 index 000000000000..640e594251de Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon512.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png new file mode 100644 index 000000000000..4027b6bf9ada Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.appiconset/Icon64.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..a6e8f990e420 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1280x768.png", + "idiom" : "tv" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png new file mode 100644 index 000000000000..459f3f221296 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-1280x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons-AppStore.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..932915c0ac3f --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-400x240.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Content.imageset/Icon-blue-400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Contents.json new file mode 100644 index 000000000000..de59d885ae8d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Contents.json @@ -0,0 +1,17 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Middle.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ] +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..932915c0ac3f --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-400x240.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Content.imageset/Icon-blue-400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000000..932915c0ac3f --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-400x240.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-400x240.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-400x240.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-400x240.png new file mode 100644 index 000000000000..c13d206cbf2b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Content.imageset/Icon-blue-400x240.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Contents.json new file mode 100644 index 000000000000..73c00596a7fc --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/AppIcons.imagestack/Middle.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/Contents.json new file mode 100644 index 000000000000..75721f069e43 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "filename" : "AppIcons-AppStore.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "1280x768" + }, + { + "filename" : "AppIcons.imagestack", + "idiom" : "tv", + "role" : "primary-app-icon", + "size" : "400x240" + }, + { + "filename" : "TopShelfImage.imageset", + "idiom" : "tv", + "role" : "top-shelf-image", + "size" : "1920x720" + }, + { + "filename" : "TopShelfImageWide.imageset", + "idiom" : "tv", + "role" : "top-shelf-image-wide", + "size" : "2320x720" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Contents.json new file mode 100644 index 000000000000..8e75d958b544 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-1920x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-3840x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png new file mode 100644 index 000000000000..024f0ba2fa2a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Icon-blue-1920x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png new file mode 100644 index 000000000000..73af924f80a1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImage.imageset/Icon-blue-3840x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Contents.json new file mode 100644 index 000000000000..5050c073a89d --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "filename" : "Icon-blue-2320x720.png", + "idiom" : "tv", + "scale" : "1x" + }, + { + "filename" : "Icon-blue-4640x1440.png", + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png new file mode 100644 index 000000000000..a831d23a64e1 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Icon-blue-2320x720.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png new file mode 100644 index 000000000000..6a0278774e6e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/AppIcons.brandassets/TopShelfImageWide.imageset/Icon-blue-4640x1440.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..6ab7cce3ecd8 --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,270 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon1242x2688.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2688x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2688h" + }, + { + "extent" : "full-screen", + "filename" : "Icon828x1792.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1792x828.png", + "idiom" : "iphone", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1792h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2388.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2388x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "12.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2388h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1125x2436.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2436x1125.png", + "idiom" : "iphone", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "2436h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1668x2224.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2224x1668.png", + "idiom" : "ipad", + "minimum-system-version" : "10.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "2224h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x2732.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2732x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "2x", + "subtype" : "1366h" + }, + { + "extent" : "full-screen", + "filename" : "Icon1242x2208.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon2208x1242.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x", + "subtype" : "736h" + }, + { + "extent" : "full-screen", + "filename" : "Icon750x1334.png", + "idiom" : "iphone", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "667h" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "minimum-system-version" : "7.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon320x480.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x960.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon640x1136.png", + "idiom" : "iphone", + "orientation" : "portrait", + "scale" : "2x", + "subtype" : "retina4" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon768x1004.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon768x1024.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1024x748.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1024x768.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "1x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon1536x2008.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1536x2048.png", + "idiom" : "ipad", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "extent" : "to-status-bar", + "filename" : "Icon2048x1496.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon2048x1536.png", + "idiom" : "ipad", + "orientation" : "landscape", + "scale" : "2x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png new file mode 100644 index 000000000000..b997979ef875 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x748.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png new file mode 100644 index 000000000000..08d362f1392c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1024x768.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png new file mode 100644 index 000000000000..27d46f5c53df Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1125x2436.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png new file mode 100644 index 000000000000..879ba7b93a0d Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2208.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png new file mode 100644 index 000000000000..eb9865b186bf Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1242x2688.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png new file mode 100644 index 000000000000..11edc7fcd9b4 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2008.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png new file mode 100644 index 000000000000..347a90be0dc6 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1536x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png new file mode 100644 index 000000000000..2e97ab23c27b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2224.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png new file mode 100644 index 000000000000..7de93bf15305 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1668x2388.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png new file mode 100644 index 000000000000..2bed0926e669 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon1792x828.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png new file mode 100644 index 000000000000..67922976e525 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1496.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png new file mode 100644 index 000000000000..82a256faaa67 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x1536.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png new file mode 100644 index 000000000000..f084a92221d0 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2048x2732.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png new file mode 100644 index 000000000000..a8dc654bfcb9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2208x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png new file mode 100644 index 000000000000..3b445ba0b717 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2224x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png new file mode 100644 index 000000000000..dea8e1205197 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2388x1668.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png new file mode 100644 index 000000000000..cbdc8dfd4121 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2436x1125.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png new file mode 100644 index 000000000000..07e42d25aff9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2688x1242.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png new file mode 100644 index 000000000000..ecb57e52324c Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon2732x2048.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png new file mode 100644 index 000000000000..5291f62306c9 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon320x480.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png new file mode 100644 index 000000000000..d75740aabea8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x1136.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png new file mode 100644 index 000000000000..c80b857337d8 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon640x960.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png new file mode 100644 index 000000000000..cdbc6785ae30 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon750x1334.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png new file mode 100644 index 000000000000..d4012e9d9b5a Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1004.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png new file mode 100644 index 000000000000..1e98ebaf9aff Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon768x1024.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png new file mode 100644 index 000000000000..4c356278d837 Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/iOSLaunchImage.launchimage/Icon828x1792.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json new file mode 100644 index 000000000000..3e9d30ffa97c --- /dev/null +++ b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Contents.json @@ -0,0 +1,24 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "filename" : "Icon3840x2160.png", + "idiom" : "tv", + "minimum-system-version" : "11.0", + "orientation" : "landscape", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "filename" : "Icon1920x1080.png", + "idiom" : "tv", + "minimum-system-version" : "9.0", + "orientation" : "landscape", + "scale" : "1x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png new file mode 100644 index 000000000000..7d4cff35f12b Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon1920x1080.png differ diff --git a/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png new file mode 100644 index 000000000000..7e19964f9c7e Binary files /dev/null and b/tests/dotnet/AppWithXCAssets/tvOS/Resources/Images.xcassets/tvOSLaunchImage.launchimage/Icon3840x2160.png differ diff --git a/tests/dotnet/BindingWithCompressedXCFramework/ApiDefinition.cs b/tests/dotnet/BindingWithCompressedXCFramework/ApiDefinition.cs new file mode 100644 index 000000000000..9ed44545f5ff --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/ApiDefinition.cs @@ -0,0 +1 @@ +using Foundation; diff --git a/tests/dotnet/BindingWithCompressedXCFramework/MacCatalyst/BindingWithCompressedXCFramework.csproj b/tests/dotnet/BindingWithCompressedXCFramework/MacCatalyst/BindingWithCompressedXCFramework.csproj new file mode 100644 index 000000000000..02fabd2f8260 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/MacCatalyst/BindingWithCompressedXCFramework.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-maccatalyst + + + + diff --git a/tests/dotnet/BindingWithCompressedXCFramework/MacCatalyst/Makefile b/tests/dotnet/BindingWithCompressedXCFramework/MacCatalyst/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/MacCatalyst/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/BindingWithCompressedXCFramework/MyClass.cs b/tests/dotnet/BindingWithCompressedXCFramework/MyClass.cs new file mode 100644 index 000000000000..00cb25b9419f --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/MyClass.cs @@ -0,0 +1,8 @@ +using System; +namespace BindingWithCompressedXCFramework { + public class MyClass { + public MyClass () + { + } + } +} diff --git a/tests/dotnet/BindingWithCompressedXCFramework/StructsAndEnums.cs b/tests/dotnet/BindingWithCompressedXCFramework/StructsAndEnums.cs new file mode 100644 index 000000000000..50c541d38bae --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/StructsAndEnums.cs @@ -0,0 +1,16 @@ +using System.Runtime.InteropServices; + +namespace BindingWithCompressedXCFramework { + public static class CFunctions { + [DllImport ("XTest.framework/XTest")] + static extern int theUltimateAnswer (); + + // This comes from XStaticArTest.framework + [DllImport ("__Internal")] + static extern int ar_theUltimateAnswer (); + + // This comes from XStaticObjectTest.framework + [DllImport ("__Internal", EntryPoint = "theUltimateAnswer")] + static extern int object_theUltimateAnswer (); + } +} diff --git a/tests/dotnet/BindingWithCompressedXCFramework/iOS/BindingWithCompressedXCFramework.csproj b/tests/dotnet/BindingWithCompressedXCFramework/iOS/BindingWithCompressedXCFramework.csproj new file mode 100644 index 000000000000..bb9259517c64 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/iOS/BindingWithCompressedXCFramework.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-ios + + + + diff --git a/tests/dotnet/BindingWithCompressedXCFramework/iOS/Makefile b/tests/dotnet/BindingWithCompressedXCFramework/iOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/iOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/BindingWithCompressedXCFramework/macOS/BindingWithCompressedXCFramework.csproj b/tests/dotnet/BindingWithCompressedXCFramework/macOS/BindingWithCompressedXCFramework.csproj new file mode 100644 index 000000000000..71b28ba48c7c --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/macOS/BindingWithCompressedXCFramework.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-macos + + + + diff --git a/tests/dotnet/BindingWithCompressedXCFramework/macOS/Makefile b/tests/dotnet/BindingWithCompressedXCFramework/macOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/macOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/BindingWithCompressedXCFramework/shared.csproj b/tests/dotnet/BindingWithCompressedXCFramework/shared.csproj new file mode 100644 index 000000000000..aa779283a4b7 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/shared.csproj @@ -0,0 +1,16 @@ + + + + true + + + + + + + + + + + + diff --git a/tests/dotnet/BindingWithCompressedXCFramework/shared.mk b/tests/dotnet/BindingWithCompressedXCFramework/shared.mk new file mode 100644 index 000000000000..f555cad4e805 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/shared.mk @@ -0,0 +1,2 @@ +TOP=../../../.. +include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/dotnet/BindingWithCompressedXCFramework/tvOS/BindingWithCompressedXCFramework.csproj b/tests/dotnet/BindingWithCompressedXCFramework/tvOS/BindingWithCompressedXCFramework.csproj new file mode 100644 index 000000000000..388e767c58ed --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/tvOS/BindingWithCompressedXCFramework.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-tvos + + + + diff --git a/tests/dotnet/BindingWithCompressedXCFramework/tvOS/Makefile b/tests/dotnet/BindingWithCompressedXCFramework/tvOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/BindingWithCompressedXCFramework/tvOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/AppDelegate.cs b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/AppDelegate.cs new file mode 100644 index 000000000000..42e3d31b2d41 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/AppDelegate.cs @@ -0,0 +1,32 @@ +using System; +using System.Runtime.InteropServices; + +using Foundation; + +namespace NativeFrameworkReferencesApp { + public class Program { + [DllImport ("XTest.framework/XTest")] + static extern int theUltimateAnswer (); + + // This comes from XStaticArTest.framework + [DllImport ("__Internal")] + static extern int ar_theUltimateAnswer (); + + // This comes from XStaticObjectTest.framework + [DllImport ("__Internal", EntryPoint = "theUltimateAnswer")] + static extern int object_theUltimateAnswer (); + + static int Main (string [] args) + { + Console.WriteLine ($"XCFramework: {theUltimateAnswer ()}"); + Console.WriteLine ($"XCFramework with ar files: {ar_theUltimateAnswer ()}"); + Console.WriteLine ($"XCFramework with object files: {object_theUltimateAnswer ()}"); + + GC.KeepAlive (typeof (NSObject)); // prevent linking away the platform assembly + + Console.WriteLine (Environment.GetEnvironmentVariable ("MAGIC_WORD")); + + return 0; + } + } +} diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/MacCatalyst/CompressedNativeXCFrameworkReferencesApp.csproj b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/MacCatalyst/CompressedNativeXCFrameworkReferencesApp.csproj new file mode 100644 index 000000000000..6b0e2c773180 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/MacCatalyst/CompressedNativeXCFrameworkReferencesApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-maccatalyst + + + diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/MacCatalyst/Makefile b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/MacCatalyst/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/MacCatalyst/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/iOS/CompressedNativeXCFrameworkReferencesApp.csproj b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/iOS/CompressedNativeXCFrameworkReferencesApp.csproj new file mode 100644 index 000000000000..86d408734aa8 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/iOS/CompressedNativeXCFrameworkReferencesApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-ios + + + diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/iOS/Makefile b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/iOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/iOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/macOS/CompressedNativeXCFrameworkReferencesApp.csproj b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/macOS/CompressedNativeXCFrameworkReferencesApp.csproj new file mode 100644 index 000000000000..a77287b9ba00 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/macOS/CompressedNativeXCFrameworkReferencesApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-macos + + + diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/macOS/Makefile b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/macOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/macOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/shared.csproj b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/shared.csproj new file mode 100644 index 000000000000..cd5f59e3903f --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/shared.csproj @@ -0,0 +1,24 @@ + + + + Exe + + CompressedNativeXCFrameworkReferencesApp + com.xamarin.compressednativexcframeworkreferencesapp + 1.0 + + true + + + + + + + + + + + + + + diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/shared.mk b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/shared.mk new file mode 100644 index 000000000000..2b9c3cf2ea73 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/shared.mk @@ -0,0 +1,3 @@ +TOP=../../../.. +TESTNAME=CompressedNativeXCFrameworkReferencesApp +include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/tvOS/CompressedNativeXCFrameworkReferencesApp.csproj b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/tvOS/CompressedNativeXCFrameworkReferencesApp.csproj new file mode 100644 index 000000000000..bd487ddcd88d --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/tvOS/CompressedNativeXCFrameworkReferencesApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-tvos + + + diff --git a/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/tvOS/Makefile b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/tvOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedNativeXCFrameworkReferencesApp/tvOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/AppDelegate.cs b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/AppDelegate.cs new file mode 100644 index 000000000000..42e3d31b2d41 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/AppDelegate.cs @@ -0,0 +1,32 @@ +using System; +using System.Runtime.InteropServices; + +using Foundation; + +namespace NativeFrameworkReferencesApp { + public class Program { + [DllImport ("XTest.framework/XTest")] + static extern int theUltimateAnswer (); + + // This comes from XStaticArTest.framework + [DllImport ("__Internal")] + static extern int ar_theUltimateAnswer (); + + // This comes from XStaticObjectTest.framework + [DllImport ("__Internal", EntryPoint = "theUltimateAnswer")] + static extern int object_theUltimateAnswer (); + + static int Main (string [] args) + { + Console.WriteLine ($"XCFramework: {theUltimateAnswer ()}"); + Console.WriteLine ($"XCFramework with ar files: {ar_theUltimateAnswer ()}"); + Console.WriteLine ($"XCFramework with object files: {object_theUltimateAnswer ()}"); + + GC.KeepAlive (typeof (NSObject)); // prevent linking away the platform assembly + + Console.WriteLine (Environment.GetEnvironmentVariable ("MAGIC_WORD")); + + return 0; + } + } +} diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/MacCatalyst/CompressedXCFrameworkInBindingProjectApp.csproj b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/MacCatalyst/CompressedXCFrameworkInBindingProjectApp.csproj new file mode 100644 index 000000000000..6b0e2c773180 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/MacCatalyst/CompressedXCFrameworkInBindingProjectApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-maccatalyst + + + diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/MacCatalyst/Makefile b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/MacCatalyst/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/MacCatalyst/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/iOS/CompressedXCFrameworkInBindingProjectApp.csproj b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/iOS/CompressedXCFrameworkInBindingProjectApp.csproj new file mode 100644 index 000000000000..86d408734aa8 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/iOS/CompressedXCFrameworkInBindingProjectApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-ios + + + diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/iOS/Makefile b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/iOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/iOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/macOS/CompressedXCFrameworkInBindingProjectApp.csproj b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/macOS/CompressedXCFrameworkInBindingProjectApp.csproj new file mode 100644 index 000000000000..a77287b9ba00 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/macOS/CompressedXCFrameworkInBindingProjectApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-macos + + + diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/macOS/Makefile b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/macOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/macOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/shared.csproj b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/shared.csproj new file mode 100644 index 000000000000..b4faea2baef4 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/shared.csproj @@ -0,0 +1,20 @@ + + + + Exe + + CompressedXCFrameworkInBindingProjectApp + com.xamarin.compressedxcframeworkinbindingprojectapp + 1.0 + + + + + + + + + + + + diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/shared.mk b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/shared.mk new file mode 100644 index 000000000000..dc05794f7175 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/shared.mk @@ -0,0 +1,3 @@ +TOP=../../../.. +TESTNAME=CompressedXCFrameworkInBindingProjectApp +include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/tvOS/CompressedXCFrameworkInBindingProjectApp.csproj b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/tvOS/CompressedXCFrameworkInBindingProjectApp.csproj new file mode 100644 index 000000000000..bd487ddcd88d --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/tvOS/CompressedXCFrameworkInBindingProjectApp.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-tvos + + + diff --git a/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/tvOS/Makefile b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/tvOS/Makefile new file mode 100644 index 000000000000..110d078f4577 --- /dev/null +++ b/tests/dotnet/CompressedXCFrameworkInBindingProjectApp/tvOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/MySimpleApp/Directory.Build.props b/tests/dotnet/MySimpleApp/Directory.Build.props index f35c2a50a994..465fa5046e93 100644 --- a/tests/dotnet/MySimpleApp/Directory.Build.props +++ b/tests/dotnet/MySimpleApp/Directory.Build.props @@ -3,5 +3,5 @@ false - + diff --git a/tests/dotnet/SimpleAppWithOldReferences/dotnet45assembly/Makefile b/tests/dotnet/SimpleAppWithOldReferences/dotnet45assembly/Makefile index 9188c3e964f0..b28595becb1e 100644 --- a/tests/dotnet/SimpleAppWithOldReferences/dotnet45assembly/Makefile +++ b/tests/dotnet/SimpleAppWithOldReferences/dotnet45assembly/Makefile @@ -3,6 +3,6 @@ TOP=../../../.. include $(TOP)/Make.config dotnet45assembly.dll: Library.cs - $(SYSTEM_CSC) -target:library -out:$@ $< + $(Q) $(DOTNET) build *.csproj $(DOTNET_BUILD_VERBOSITY) all-local:: dotnet45assembly.dll diff --git a/tests/dotnet/SimpleAppWithOldReferences/dotnet45assembly/dotnet45assembly.csproj b/tests/dotnet/SimpleAppWithOldReferences/dotnet45assembly/dotnet45assembly.csproj new file mode 100644 index 000000000000..c075e690613e --- /dev/null +++ b/tests/dotnet/SimpleAppWithOldReferences/dotnet45assembly/dotnet45assembly.csproj @@ -0,0 +1,7 @@ + + + net4.7.2 + . + false + + diff --git a/tests/dotnet/UnitTests/AppIconTest.cs b/tests/dotnet/UnitTests/AppIconTest.cs new file mode 100644 index 000000000000..8b592b136075 --- /dev/null +++ b/tests/dotnet/UnitTests/AppIconTest.cs @@ -0,0 +1,642 @@ +#define EXHAUSTIVE_TESTS + +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; + +#nullable enable + +namespace Xamarin.Tests { + public class AppIconTest : TestBaseClass { + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void DefaultValues (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + break; + case ApplePlatform.MacOSX: + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + break; + case ApplePlatform.MacCatalyst: + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + + TestXCAssetsImpl (platform, runtimeIdentifiers, extraAssets: expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void IncludeAllIcons (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + break; + case ApplePlatform.MacOSX: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + case ApplePlatform.MacCatalyst: + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { { "IncludeAllAppIcons", "true" } }, + extraAssets: expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void XSAppIconAssets (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + break; + case ApplePlatform.MacOSX: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + case ApplePlatform.MacCatalyst: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "_XSAppIconAssets", "Resources/Images.xcassets/AlternateAppIcons.appiconset" } + }, + expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] +#endif + // launch images don't exist on Mac Catalyst or macOS. + public void XSLaunchImageAssets (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon1920x1080.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon3840x2160.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "_XSLaunchImageAssets", $"Resources/Images.xcassets/{platform.AsString ()}LaunchImage.launchimage" } + }, + expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void AlternateAppIcon (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + break; + case ApplePlatform.MacOSX: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + case ApplePlatform.MacCatalyst: + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "AddTheseAlternateAppIcons", "AppIcons" } + }, + expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void AlternateAppIcons (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + break; + case ApplePlatform.MacOSX: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + case ApplePlatform.MacCatalyst: + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "AddTheseAlternateAppIcons", "AppIcons;AlternateAppIcons" } + }, + expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void AlternateAppIcon_Failure (ApplePlatform platform, string runtimeIdentifiers) + { + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "AddTheseAlternateAppIcons", "InexistentAppIcon" } + }, + expectedErrorMessages: new string [] { + platform == ApplePlatform.TVOS + ? "Can't find the AlternateAppIcon 'InexistentAppIcon' among the image resources. There are 5 app icons in the image resources: AlternateAppIcons, AppIcon, AppIcon-AppStore, AppIcons, AppIcons-AppStore." + : "Can't find the AlternateAppIcon 'InexistentAppIcon' among the image resources. There are 2 app icons in the image resources: AlternateAppIcons, AppIcons." + }); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void AppIcon_1 (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-blue-1280x768.png"); + expectedAssets.Add ("Image:Icon-blue-1920x720.png"); + expectedAssets.Add ("Image:Icon-blue-2320x720.png"); + expectedAssets.Add ("Image:Icon-blue-3840x1440.png"); + expectedAssets.Add ("Image:Icon-blue-400x240.png"); + expectedAssets.Add ("Image:Icon-blue-4640x1440.png"); + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + expectedAssets.Add ("ImageStack:AppIcons"); + break; + case ApplePlatform.MacOSX: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + case ApplePlatform.MacCatalyst: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "AppIcon", "AppIcons" } + }, + expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] +#endif + // Choosing a different primary app icon on tvOS at build time doesn't seem to be possible + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void AppIcon_2 (ApplePlatform platform, string runtimeIdentifiers) + { + var expectedAssets = new HashSet (); + switch (platform) { + case ApplePlatform.iOS: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon64.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + break; + case ApplePlatform.TVOS: + expectedAssets.Add ("Image:Icon-green-1920x720.png"); + expectedAssets.Add ("Image:Icon-green-2320x720.png"); + expectedAssets.Add ("Image:Icon-green-3840x1440.png"); + expectedAssets.Add ("Image:Icon-green-400x240.png"); + expectedAssets.Add ("Image:Icon-green-4640x1440.png"); + expectedAssets.Add ("Image:Icon1280x768.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("Image:Icon400x240.png"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-1.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZFlattenedImage-2.1.0-gamut0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-1.0.0"); + expectedAssets.Add ("Image:ZZZZRadiosityImage-2.0.0"); + expectedAssets.Add ("ImageStack:AlternateAppIcons"); + expectedAssets.Add ("ImageStack:AppIcon"); + break; + case ApplePlatform.MacOSX: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + case ApplePlatform.MacCatalyst: + expectedAssets.Add ("Icon Image:Icon1024.png"); + expectedAssets.Add ("Icon Image:Icon128.png"); + expectedAssets.Add ("Icon Image:Icon16.png"); + expectedAssets.Add ("Icon Image:Icon256.png"); + expectedAssets.Add ("Icon Image:Icon32.png"); + expectedAssets.Add ("Icon Image:Icon512.png"); + expectedAssets.Add ("Icon Image:Icon64.png"); + expectedAssets.Add ("Image:Icon16.png"); + expectedAssets.Add ("Image:Icon32.png"); + expectedAssets.Add ("MultiSized Image:AlternateAppIcons"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-1.1.0-gamut0"); + expectedAssets.Add ("PackedImage:ZZZZPackedAsset-2.1.0-gamut0"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "AppIcon", platform == ApplePlatform.TVOS ? "AlternateBrandAssets" : "AlternateAppIcons" } + }, + expectedAssets.ToArray ()); + } + + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvos-arm64")] +#endif + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64")] +#endif + [TestCase (ApplePlatform.MacOSX, "osx-x64")] +#if EXHAUSTIVE_TESTS + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64")] +#endif + public void AppIcon_Failure (ApplePlatform platform, string runtimeIdentifiers) + { + TestXCAssetsImpl ( + platform, + runtimeIdentifiers, + new Dictionary () { + { "AppIcon", "InexistentAppIcon" } + }, + expectedErrorMessages: new string [] { + platform == ApplePlatform.TVOS + ? "Can't find the AppIcon 'InexistentAppIcon' among the image resources. There are 2 app icons in the image resources: AlternateBrandAssets, AppIcons." + : "Can't find the AppIcon 'InexistentAppIcon' among the image resources. There are 2 app icons in the image resources: AlternateAppIcons, AppIcons." + }); + } + + void TestXCAssetsImpl (ApplePlatform platform, string runtimeIdentifiers, Dictionary? extraProperties = null, IEnumerable? extraAssets = null, string []? expectedErrorMessages = null) + { + var projectPath = string.Empty; + var appPath = string.Empty; + + Configuration.AssertRuntimeIdentifiersAvailable (platform, runtimeIdentifiers); + var project = "AppWithXCAssets"; + Configuration.IgnoreIfIgnoredPlatform (platform); + projectPath = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out appPath); + + Clean (projectPath); + + var properties = GetDefaultProperties (runtimeIdentifiers, extraProperties); + properties ["IsRunningUnitTests"] = "true"; + if (expectedErrorMessages is not null) { + var rv = DotNet.AssertBuildFailure (projectPath, properties); + var errors = BinLog.GetBuildLogErrors (rv.BinLogPath).ToArray (); + AssertErrorMessages (errors, expectedErrorMessages); + return; // nothing else to test here + } + + DotNet.AssertBuild (projectPath, properties); + + var resourcesDirectory = GetResourcesDirectory (platform, appPath); + var assetsCar = Path.Combine (resourcesDirectory, "Assets.car"); + Assert.That (assetsCar, Does.Exist, "Assets.car"); + + try { + var doc = AssetsTest.ProcessAssets (assetsCar, AssetsTest.GetFullSdkVersion (platform, runtimeIdentifiers)); + Assert.IsNotNull (doc, "There was an issue processing the asset binary."); + + var foundAssets = AssetsTest.FindAssets (platform, doc); + + var expectedAssets = new HashSet (); + if (extraAssets is not null) { + foreach (var asset in extraAssets) + expectedAssets.Add (asset); + } + + CollectionAssert.AreEquivalent (expectedAssets, foundAssets, "Incorrect assets"); + } catch { + Console.WriteLine ($"Assets.car: {assetsCar}"); + throw; + } + } + } +} diff --git a/tests/dotnet/UnitTests/ApplePlatformExtensions.cs b/tests/dotnet/UnitTests/ApplePlatformExtensions.cs index b24e66995275..48b6a6ad9707 100644 --- a/tests/dotnet/UnitTests/ApplePlatformExtensions.cs +++ b/tests/dotnet/UnitTests/ApplePlatformExtensions.cs @@ -2,10 +2,10 @@ namespace Xamarin.Utils { public static class ApplePlatformExtensionsWithVersions { - public static string ToFrameworkWithPlatformVersion (this ApplePlatform @this) + public static string ToFrameworkWithPlatformVersion (this ApplePlatform @this, bool isExecutable /* and not library */) { var netVersion = Configuration.DotNetTfm; - var targetPlatformVersion = GetTargetPlatformVersion (@this); + var targetPlatformVersion = isExecutable ? GetDefaultTargetPlatformVersionExecutable (@this) : GetDefaultTargetPlatformVersionLibrary (@this); switch (@this) { case ApplePlatform.iOS: return netVersion + "-ios" + targetPlatformVersion; @@ -20,16 +20,53 @@ public static string ToFrameworkWithPlatformVersion (this ApplePlatform @this) } } - public static string GetTargetPlatformVersion (this ApplePlatform @this) + public static string GetDefaultTargetPlatformVersionExecutable (this ApplePlatform @this) { switch (@this) { - case ApplePlatform.iOS: return SdkVersions.TargetPlatformVersioniOS; - case ApplePlatform.TVOS: return SdkVersions.TargetPlatformVersiontvOS; - case ApplePlatform.MacOSX: return SdkVersions.TargetPlatformVersionmacOS; - case ApplePlatform.MacCatalyst: return SdkVersions.TargetPlatformVersionMacCatalyst; + case ApplePlatform.iOS: return SdkVersions.TargetPlatformVersionExecutableiOS; + case ApplePlatform.TVOS: return SdkVersions.TargetPlatformVersionExecutabletvOS; + case ApplePlatform.MacOSX: return SdkVersions.TargetPlatformVersionExecutablemacOS; + case ApplePlatform.MacCatalyst: return SdkVersions.TargetPlatformVersionExecutableMacCatalyst; default: return "Unknown"; } } + + public static string GetDefaultTargetPlatformVersionLibrary (this ApplePlatform @this) + { + switch (@this) { + case ApplePlatform.iOS: return SdkVersions.TargetPlatformVersionLibraryiOS; + case ApplePlatform.TVOS: return SdkVersions.TargetPlatformVersionLibrarytvOS; + case ApplePlatform.MacOSX: return SdkVersions.TargetPlatformVersionLibrarymacOS; + case ApplePlatform.MacCatalyst: return SdkVersions.TargetPlatformVersionLibraryMacCatalyst; + default: + return "Unknown"; + } + } + } + + [TestFixture] + public class TargetFrameworkTest { + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacOSX)] + public void DefaultLibraryTargetPlatformVersion (ApplePlatform platform) + { + // We might have to change the assert if the first minor OS version we release for a given .NET version is >0 (this happened for both .NET 7 and .NET 8). + Assert.That (platform.GetDefaultTargetPlatformVersionLibrary (), Does.EndWith (".0"), "Default TPV for a library must end with .0"); + } + + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacOSX)] + public void MajorTargetPlatformVersion (ApplePlatform platform) + { + var vLibrary = Version.Parse (platform.GetDefaultTargetPlatformVersionLibrary ()); + var vExecutable = Version.Parse (platform.GetDefaultTargetPlatformVersionExecutable ()); + // We might have to change the assert if we release support for a new major OS version within a .NET releases (this happened for .NET 8) + Assert.AreEqual (vExecutable.Major, vLibrary.Major, "The major version must be the same between the default TPV for library and executable projects."); + } } } diff --git a/tests/dotnet/UnitTests/AssetsTest.cs b/tests/dotnet/UnitTests/AssetsTest.cs index 90f0e5c69096..6ecf003f6995 100644 --- a/tests/dotnet/UnitTests/AssetsTest.cs +++ b/tests/dotnet/UnitTests/AssetsTest.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.CodeAnalysis; using System.Text.Json; #nullable enable @@ -5,57 +6,46 @@ namespace Xamarin.Tests { // Add the XCAssets before the build - [TestFixture (ApplePlatform.iOS, "iossimulator-x64", "iphonesimulator", true)] - [TestFixture (ApplePlatform.iOS, "ios-arm64;ios-arm", "iphoneos", true)] - [TestFixture (ApplePlatform.TVOS, "tvossimulator-x64", "appletvsimulator", true)] - [TestFixture (ApplePlatform.MacCatalyst, "maccatalyst-x64", "macosx", true)] - [TestFixture (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64", "macosx", true)] - [TestFixture (ApplePlatform.MacOSX, "osx-x64", "macosx", true)] - [TestFixture (ApplePlatform.MacOSX, "osx-arm64;osx-x64", "macosx", true)] // https://github.com/xamarin/xamarin-macios/issues/12410 - // Build, add the XCAssets, then build again - [TestFixture (ApplePlatform.iOS, "iossimulator-x64", "iphonesimulator", false)] - [TestFixture (ApplePlatform.iOS, "ios-arm64;ios-arm", "iphoneos", false)] - [TestFixture (ApplePlatform.TVOS, "tvossimulator-x64", "appletvsimulator", false)] - [TestFixture (ApplePlatform.MacCatalyst, "maccatalyst-x64", "macosx", false)] - [TestFixture (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64", "macosx", false)] - [TestFixture (ApplePlatform.MacOSX, "osx-x64", "macosx", false)] - [TestFixture (ApplePlatform.MacOSX, "osx-arm64;osx-x64", "macosx", false)] // https://github.com/xamarin/xamarin-macios/issues/12410 + [TestFixture] public class AssetsTest : TestBaseClass { + const string project = "AppWithXCAssets"; - readonly ApplePlatform platform; - readonly string runtimeIdentifiers; - readonly string sdkVersion; - readonly bool isStartingWithAssets; - string projectPath = string.Empty; - string appPath = string.Empty; - - public AssetsTest (ApplePlatform platform, string runtimeIdentifiers, string sdkVersion, bool isStartingWithAssets) - { - this.platform = platform; - this.runtimeIdentifiers = runtimeIdentifiers; - this.sdkVersion = sdkVersion; - this.isStartingWithAssets = isStartingWithAssets; - } - - [SetUp] - public void Init () + [Test] + [TestCase (ApplePlatform.iOS, "iossimulator-x64", true)] + [TestCase (ApplePlatform.iOS, "ios-arm64", true)] + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64", true)] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64", true)] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64", true)] + [TestCase (ApplePlatform.MacOSX, "osx-x64", true)] + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64", true)] // https://github.com/xamarin/xamarin-macios/issues/12410 + // Build, add the XCAssets, then build again + [TestCase (ApplePlatform.iOS, "iossimulator-x64", false)] + [TestCase (ApplePlatform.iOS, "ios-arm64", false)] + [TestCase (ApplePlatform.TVOS, "tvossimulator-x64", false)] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64", false)] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64", false)] + [TestCase (ApplePlatform.MacOSX, "osx-x64", false)] + [TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64", false)] // https://github.com/xamarin/xamarin-macios/issues/12410 + public void TestXCAssets (ApplePlatform platform, string runtimeIdentifiers, bool isStartingWithAssets) { Configuration.AssertRuntimeIdentifiersAvailable (platform, runtimeIdentifiers); - var project = "AppWithXCAssets"; Configuration.IgnoreIfIgnoredPlatform (platform); - projectPath = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out appPath); - ConfigureAssets (); - } - [TearDown] - public void Cleanup () - { - DeleteAssets (); + var config = "Debug"; + var projectPath = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath, configuration: config); + + try { + ConfigureAssets (projectPath, runtimeIdentifiers, config, isStartingWithAssets); + + TestXCAssetsImpl (platform, runtimeIdentifiers, isStartingWithAssets, projectPath, appPath); + } finally { + DeleteAssets (projectPath); + } } - [Test] - public void TestXCAssets () + void TestXCAssetsImpl (ApplePlatform platform, string runtimeIdentifiers, bool isStartingWithAssets, string projectPath, string appPath) { + var appExecutable = GetNativeExecutable (platform, appPath); ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable); @@ -64,45 +54,63 @@ public void TestXCAssets () var assetsCar = Path.Combine (resourcesDirectory, "Assets.car"); Assert.That (assetsCar, Does.Exist, "Assets.car"); - var doc = ProcessAssets (assetsCar, GetFullSdkVersion ()); + var doc = ProcessAssets (assetsCar, GetFullSdkVersion (platform, runtimeIdentifiers)); Assert.IsNotNull (doc, "There was an issue processing the asset binary."); - var foundAssets = FindAssets (doc); + var foundAssets = FindAssets (platform, doc); // Seems the 2 vectors are not being consumed in MacCatalyst but they still appear in the image Datasets - var expectedAssets = platform == ApplePlatform.MacCatalyst ? ExpectedAssetsMacCatalyst : ExpectedAssets; - Assert.AreEqual (expectedAssets, foundAssets, "Incorrect assets"); + HashSet expectedAssets; + switch (platform) { + case ApplePlatform.iOS: + expectedAssets = ExpectedAssetsiOS; + break; + case ApplePlatform.TVOS: + expectedAssets = ExpectedAssetstvOS; + break; + case ApplePlatform.MacOSX: + expectedAssets = ExpectedAssetsmacOS; + break; + case ApplePlatform.MacCatalyst: + expectedAssets = ExpectedAssetsMacCatalyst; + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + + CollectionAssert.AreEquivalent (expectedAssets, foundAssets, $"Incorrect assets in {assetsCar}"); var arm64txt = Path.Combine (resourcesDirectory, "arm64.txt"); - var armtxt = Path.Combine (resourcesDirectory, "arm.txt"); var x64txt = Path.Combine (resourcesDirectory, "x64.txt"); Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm64")), File.Exists (arm64txt), "arm64.txt"); - Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-arm")), File.Exists (armtxt), "arm.txt"); Assert.AreEqual (runtimeIdentifiers.Split (';').Any (v => v.EndsWith ("-x64")), File.Exists (x64txt), "x64.txt"); } - void ConfigureAssets () + void ConfigureAssets (string projectPath, string runtimeIdentifiers, string config, bool isStartingWithAssets) { Clean (projectPath); // We either want the assets added before the build, or we will be adding them after the build if (isStartingWithAssets) - CopyAssets (); + CopyAssets (projectPath); + + var properties = GetDefaultProperties (runtimeIdentifiers); + properties ["Configuration"] = config; - DotNet.AssertBuild (projectPath, GetDefaultProperties (runtimeIdentifiers)); + DotNet.AssertBuild (projectPath, properties); if (!isStartingWithAssets) { - CopyAssets (); - DotNet.AssertBuild (projectPath, GetDefaultProperties (runtimeIdentifiers)); + CopyAssets (projectPath); + DotNet.AssertBuild (projectPath, properties); } } - void DeleteAssets () + void DeleteAssets (string projectPath) { var xcassetsDir = Path.Combine (projectPath, "../Assets.xcassets"); File.Delete (xcassetsDir); } - void CopyAssets () + void CopyAssets (string projectPath) { var testingAssetsDir = new DirectoryInfo (Path.Combine (projectPath, "../../TestingAssets")); var xcassetsDir = new DirectoryInfo (Path.Combine (projectPath, "../Assets.xcassets")); @@ -124,13 +132,28 @@ void MakeSymlinks (string sourceDir, string destDir) Assert.AreEqual (0, rv.ExitCode, $"Creating Symlink Error: {rv.StandardError}. Unexpected ExitCode"); } - string GetFullSdkVersion () => sdkVersion switch { - "iphonesimulator" => sdkVersion + Configuration.sdk_version, - "iphoneos" => sdkVersion + Configuration.sdk_version, - "appletvsimulator" => sdkVersion + Configuration.tvos_sdk_version, - "macosx" => sdkVersion + Configuration.macos_sdk_version, - _ => throw new ArgumentOutOfRangeException (nameof (sdkVersion), $"Not expected sdkVersion: {sdkVersion}"), - }; + public static string GetFullSdkVersion (ApplePlatform platform, string runtimeIdentifiers) + { + switch (platform) { + case ApplePlatform.iOS: + if (runtimeIdentifiers.Contains ("simulator")) { + return $"iphonesimulator{Configuration.sdk_version}"; + } else { + return $"iphoneos{Configuration.sdk_version}"; + } + case ApplePlatform.TVOS: + if (runtimeIdentifiers.Contains ("simulator")) { + return $"appletvsimulator{Configuration.tvos_sdk_version}"; + } else { + return $"appletvos{Configuration.tvos_sdk_version}"; + } + case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: + return $"macosx{Configuration.macos_sdk_version}"; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + } // msbuild will only update the assets if they are newer than the outputs from previous build // so we will touch the first (non-DS_Store) file the symlink points to in order to give them newer modified times @@ -148,19 +171,17 @@ void ProcessUpdateSymlink (string xcassetsDir) Assert.AreEqual (0, rv.ExitCode, $"Processing Update Symlink Error: {rv.StandardError}. Unexpected ExitCode"); } - JsonDocument ProcessAssets (string assetsPath, string sdkVersion) + public static JsonDocument ProcessAssets (string assetsPath, string sdkVersion) { var output = new StringBuilder (); var stderr = new StringBuilder (); var executable = "xcrun"; - var arguments = new string [] { "--sdk", sdkVersion, "assetutil", "--info", assetsPath }; + var tmpdir = Cache.CreateTemporaryDirectory (); + var tmpfile = Path.Combine (tmpdir, "Assets.json"); + var arguments = new string [] { "--sdk", sdkVersion, "assetutil", "--info", assetsPath, "-o", tmpfile }; var rv = Execution.RunWithStringBuildersAsync (executable, arguments, standardOutput: output, standardError: stderr, timeout: TimeSpan.FromSeconds (120)).Result; Assert.AreEqual (0, rv.ExitCode, $"Processing Assets Error: {stderr}. Unexpected ExitCode"); - var s = output.ToString (); - - // This Execution call produces an output with an objc warning. We just want the json below it. - if (s.StartsWith ("objc", StringComparison.Ordinal)) - s = s.Substring (s.IndexOf (Environment.NewLine) + 1); + var s = File.ReadAllText (tmpfile); try { return JsonDocument.Parse (s); @@ -174,88 +195,154 @@ JsonDocument ProcessAssets (string assetsPath, string sdkVersion) } } - HashSet FindAssets (JsonDocument doc) + public static HashSet FindAssets (ApplePlatform platform, JsonDocument doc) { var jsonArray = doc.RootElement.EnumerateArray (); var foundElements = new HashSet (); foreach (var item in jsonArray) { - var result = GetTarget (item); + var result = GetTarget (platform, item); if (result is not null) foundElements.Add (result); } return foundElements; } - string? GetTarget (JsonElement item) + static string? GetTarget (ApplePlatform platform, JsonElement item) { - if (item.TryGetProperty ("AssetType", out var assetType)) { + if (item.TryGetProperty ("SchemaVersion", out var schemaVersion)) { + switch (platform) { + case ApplePlatform.MacOSX: + Assert.AreEqual ("5", schemaVersion.ToString (), "Verify SchemaVersion"); + break; + case ApplePlatform.MacCatalyst: + case ApplePlatform.iOS: + case ApplePlatform.TVOS: + Assert.AreEqual ("2", schemaVersion.ToString (), "Verify SchemaVersion"); + break; + default: + throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); + } + } else if (item.TryGetProperty ("AssetType", out var assetType)) { foreach (var target in XCAssetTargets) { - var result = GetTarget (item, assetType, target); - if (result is not null) + if (TryGetTarget (item, assetType, target, out var result)) return result; } + Assert.Fail ($"Unable to match asset type '{assetType}' for {item}'"); + } else { + Assert.Fail ($"Unable to get property 'AssetType' for {item}"); } return null; } - string? GetTarget (JsonElement item, JsonElement assetType, XCAssetTarget target) + static bool TryGetTarget (JsonElement item, JsonElement assetType, XCAssetTarget target, [NotNullWhen (true)] out string? result) { + result = null; if (assetType.ToString () == target.AssetType && item.TryGetProperty (target.CategoryName, out var value)) { - if (target.Values.Contains (value.ToString ())) - return string.Concat (assetType.ToString (), ".", value.ToString ()); + result = string.Concat (assetType.ToString (), ":", value.ToString ()); + return true; } - return null; + return false; } - static readonly HashSet ExpectedAssetsMacCatalyst = new HashSet () { - "Color.ColorTest", - "Contents.SpritesTest", - "Data.BmpImageDataTest", - "Data.DngImageDataTest", - "Data.EpsImageDataTest", - "Data.JsonDataTest", - "Data.TiffImageDataTest", - "Image.samplejpeg.jpeg", - "Image.samplejpg.jpg", - "Image.samplepdf.pdf", - "Image.samplepng2.png", - "Image.spritejpeg.jpeg", - "Image.xamlogo.svg", - "Texture Rendition.TextureTest", + static readonly HashSet ExpectedAssetsAllPlatforms = new HashSet () { + "Color:ColorTest", + "Contents:SpritesTest", + "Data:BmpImageDataTest", + "Data:DngImageDataTest", + "Data:EpsImageDataTest", + "Data:JsonDataTest", + "Data:TiffImageDataTest", + "Image:samplejpeg.jpeg", + "Image:samplejpg.jpg", + "Image:samplepdf.pdf", + "Image:samplepng.png", + "Image:samplepng2.png", + "Image:spritejpeg.jpeg", + "Image:xamlogo.svg", + "Image:Icon16.png", + "Image:Icon32.png", + "PackedImage:ZZZZExplicitlyPackedAsset-1.0.0-gamut0", + "Texture Rendition:TextureTest", + }; + + static HashSet ExpectedAssetsMacCatalyst => new HashSet (ExpectedAssetsAllPlatforms) { + "Icon Image:Icon1024.png", + "Icon Image:Icon128.png", + "Icon Image:Icon16.png", + "Icon Image:Icon256.png", + "Icon Image:Icon32.png", + "Icon Image:Icon512.png", + "Icon Image:Icon64.png", + "MultiSized Image:AppIcons", + "PackedImage:ZZZZPackedAsset-1.1.0-gamut0", + "PackedImage:ZZZZPackedAsset-2.1.0-gamut0", }; - static readonly HashSet ExpectedAssets = new HashSet (ExpectedAssetsMacCatalyst) { - "Vector.samplepdf.pdf", - "Vector.xamlogo.svg", + static readonly HashSet ExpectedAssetsiOS = new HashSet (ExpectedAssetsAllPlatforms) { + "Icon Image:Icon1024.png", + "Image:Icon64.png", + "MultiSized Image:AlternateAppIcons", + "MultiSized Image:AppIcons", + "Vector:samplepdf.pdf", + "Vector:xamlogo.svg", + }; + + static readonly HashSet ExpectedAssetstvOS = new HashSet (ExpectedAssetsAllPlatforms) { + "Image:Icon-blue-1280x768.png", + "Image:Icon-blue-1920x720.png", + "Image:Icon-blue-2320x720.png", + "Image:Icon-blue-3840x1440.png", + "Image:Icon-blue-400x240.png", + "Image:Icon-blue-4640x1440.png", + "Image:Icon-green-400x240.png", + "Image:ZZZZFlattenedImage-1.1.0-gamut0", + "Image:ZZZZFlattenedImage-2.1.0-gamut0", + "Image:ZZZZRadiosityImage-1.0.0", + "Image:ZZZZRadiosityImage-2.0.0", + "ImageStack:AlternateAppIcons", + "ImageStack:AppIcons", + "Vector:samplepdf.pdf", + "Vector:xamlogo.svg", + }; + + static readonly HashSet ExpectedAssetsmacOS = new HashSet (ExpectedAssetsAllPlatforms) { + "Icon Image:Icon1024.png", + "Icon Image:Icon128.png", + "Icon Image:Icon16.png", + "Icon Image:Icon256.png", + "Icon Image:Icon32.png", + "Icon Image:Icon512.png", + "Icon Image:Icon64.png", + "MultiSized Image:AlternateAppIcons", + "MultiSized Image:AppIcons", + "PackedImage:ZZZZPackedAsset-1.1.0-gamut0", + "PackedImage:ZZZZPackedAsset-2.1.0-gamut0", + "Vector:samplepdf.pdf", + "Vector:xamlogo.svg", }; class XCAssetTarget { public string AssetType { get; set; } public string CategoryName { get; set; } - public string [] Values { get; set; } - public XCAssetTarget (string assetType, string categoryName, string [] values) + public XCAssetTarget (string assetType, string categoryName) { AssetType = assetType; CategoryName = categoryName; - Values = values; } } static XCAssetTarget [] XCAssetTargets = { - new ("Image", "RenditionName", new string [] { "samplejpeg.jpeg", "samplejpg.jpg", - "samplepdf.pdf", "samplepng2.png", "spritejpeg.jpeg", "xamlogo.svg" }), - - new ("Data", "Name", new string [] { "BmpImageDataTest", "JsonDataTest", "DS_StoreDataTest", - "DngImageDataTest", "EpsImageDataTest", "TiffImageDataTest" }), - - new ("Color", "Name", new string [] { "ColorTest" }), - - new ("Contents", "Name", new string [] { "SpritesTest" }), - - new ("Texture Rendition", "Name", new string [] { "TextureTest" }), - - new ("Vector", "RenditionName", new string [] { "samplepdf.pdf", "xamlogo.svg" }), + new ("Color", "Name"), + new ("Contents", "Name"), + new ("Data", "Name"), + new ("Icon Image", "RenditionName"), + new ("Image", "RenditionName"), + new ("ImageStack", "Name"), + new ("MultiSized Image", "Name"), + new ("PackedImage", "RenditionName"), + new ("Texture Rendition", "Name"), + new ("Vector", "RenditionName"), }; } } diff --git a/tests/dotnet/UnitTests/BundleStructureTest.cs b/tests/dotnet/UnitTests/BundleStructureTest.cs index 3e366ba60772..44ba3e996f4f 100644 --- a/tests/dotnet/UnitTests/BundleStructureTest.cs +++ b/tests/dotnet/UnitTests/BundleStructureTest.cs @@ -9,9 +9,9 @@ static bool IsPlatformAssembly (string assemblyName) if (assemblyName.EndsWith (".dll", StringComparison.Ordinal) || assemblyName.EndsWith (".pdb", StringComparison.Ordinal)) assemblyName = Path.GetFileNameWithoutExtension (assemblyName); foreach (var platform in Enum.GetValues ()) { - if (platform == ApplePlatform.None) + if (platform == ApplePlatform.None || platform == ApplePlatform.WatchOS) continue; - var platformAssembly = Path.GetFileNameWithoutExtension (Configuration.GetBaseLibraryName (platform, true)); + var platformAssembly = Path.GetFileNameWithoutExtension (Configuration.GetBaseLibraryName (platform)); if (platformAssembly == assemblyName) return true; } @@ -308,7 +308,7 @@ internal static void CheckAppBundleContents (ApplePlatform platform, IEnumerable expectedFiles.Add (Path.Combine (assemblyDirectory, "nunitlite.dll")); bool forceSingleRid = (platform == ApplePlatform.MacCatalyst && !isReleaseBuild) || platform == ApplePlatform.MacOSX; AddMultiRidAssembly (platform, expectedFiles, assemblyDirectory, "Touch.Client", runtimeIdentifiers, forceSingleRid, includeDebugFiles: includeDebugFiles); - AddMultiRidAssembly (platform, expectedFiles, assemblyDirectory, Path.GetFileNameWithoutExtension (Configuration.GetBaseLibraryName (platform, true)), runtimeIdentifiers, forceSingleRid, includeDebugFiles: includeDebugFiles); + AddMultiRidAssembly (platform, expectedFiles, assemblyDirectory, Path.GetFileNameWithoutExtension (Configuration.GetBaseLibraryName (platform)), runtimeIdentifiers, forceSingleRid, includeDebugFiles: includeDebugFiles); expectedFiles.Add (Path.Combine (assemblyDirectory, "runtimeconfig.bin")); switch (platform) { diff --git a/tests/dotnet/UnitTests/DotNetUnitTests.csproj b/tests/dotnet/UnitTests/DotNetUnitTests.csproj index 6115afb46443..e56cc641adaa 100644 --- a/tests/dotnet/UnitTests/DotNetUnitTests.csproj +++ b/tests/dotnet/UnitTests/DotNetUnitTests.csproj @@ -20,6 +20,9 @@ external\Configuration.cs + + external\ConfigurationNUnit.cs + external\DotNet.cs diff --git a/tests/dotnet/UnitTests/MlaunchTest.cs b/tests/dotnet/UnitTests/MlaunchTest.cs index 76823f08da19..e4a369159473 100644 --- a/tests/dotnet/UnitTests/MlaunchTest.cs +++ b/tests/dotnet/UnitTests/MlaunchTest.cs @@ -90,7 +90,7 @@ public void GetMlaunchRunArguments (ApplePlatform platform, string runtimeIdenti expectedArguments.Append (appPath.Substring (Path.GetDirectoryName (project_path)!.Length + 1)).Append ('/'); if (isSim) { expectedArguments.Append (" --device \""); - expectedArguments.Append (device.Replace ("%TPV%", platform.GetTargetPlatformVersion ().Replace ('.', '-'))); + expectedArguments.Append (device); expectedArguments.Append ('"'); } expectedArguments.Append ($" --wait-for-exit:true"); diff --git a/tests/dotnet/UnitTests/PackTest.cs b/tests/dotnet/UnitTests/PackTest.cs index d6d02b4e69a7..aa52a321d141 100644 --- a/tests/dotnet/UnitTests/PackTest.cs +++ b/tests/dotnet/UnitTests/PackTest.cs @@ -62,6 +62,7 @@ public void BindingFrameworksProject (ApplePlatform platform, bool noBindingEmbe var archive = ZipFile.OpenRead (nupkg); var files = archive.Entries.Select (v => v.FullName).ToHashSet (); + var tfm = platform.ToFrameworkWithPlatformVersion (isExecutable: false); var hasSymlinks = noBindingEmbedding && (platform == ApplePlatform.MacCatalyst || platform == ApplePlatform.MacOSX); if (noBindingEmbedding) { Assert.That (archive.Entries.Count, Is.EqualTo (hasSymlinks ? 6 : 10), $"nupkg file count - {nupkg}"); @@ -71,17 +72,17 @@ public void BindingFrameworksProject (ApplePlatform platform, bool noBindingEmbe Assert.That (files, Does.Contain (project + ".nuspec"), "nuspec"); Assert.That (files, Does.Contain ("_rels/.rels"), ".rels"); Assert.That (files, Does.Contain ("[Content_Types].xml"), "[Content_Types].xml"); - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.dll"), $"{project}.dll"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{project}.dll"), $"{project}.dll"); Assert.That (files, Has.Some.Matches (v => v.StartsWith ("package/services/metadata/core-properties/", StringComparison.Ordinal) && v.EndsWith (".psmdcp", StringComparison.Ordinal)), "psmdcp"); if (noBindingEmbedding) { if (hasSymlinks) { - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.resources.zip"), $"{project}.resources.zip"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{project}.resources.zip"), $"{project}.resources.zip"); } else { - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.resources/XStaticArTest.framework/XStaticArTest"), $"XStaticArTest.framework/XStaticArTest"); - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.resources/XStaticObjectTest.framework/XStaticObjectTest"), $"XStaticObjectTest.framework/XStaticObjectTest"); - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.resources/XTest.framework/XTest"), $"XTest.framework/XTest"); - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.resources/XTest.framework/Info.plist"), $"XTest.framework/Info.plist"); - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.resources/manifest"), $"manifest"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{project}.resources/XStaticArTest.framework/XStaticArTest"), $"XStaticArTest.framework/XStaticArTest"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{project}.resources/XStaticObjectTest.framework/XStaticObjectTest"), $"XStaticObjectTest.framework/XStaticObjectTest"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{project}.resources/XTest.framework/XTest"), $"XTest.framework/XTest"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{project}.resources/XTest.framework/Info.plist"), $"XTest.framework/Info.plist"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{project}.resources/manifest"), $"manifest"); } } } @@ -127,17 +128,121 @@ public void BindingXcFrameworksProject (ApplePlatform platform, bool noBindingEm var archive = ZipFile.OpenRead (nupkg); var files = archive.Entries.Select (v => v.FullName).ToHashSet (); + var tfm = platform.ToFrameworkWithPlatformVersion (isExecutable: false); Assert.That (archive.Entries.Count, Is.EqualTo (noBindingEmbedding ? 6 : 5), $"nupkg file count - {nupkg}"); Assert.That (files, Does.Contain (assemblyName + ".nuspec"), "nuspec"); Assert.That (files, Does.Contain ("_rels/.rels"), ".rels"); Assert.That (files, Does.Contain ("[Content_Types].xml"), "[Content_Types].xml"); - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{assemblyName}.dll"), $"{assemblyName}.dll"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.dll"), $"{assemblyName}.dll"); Assert.That (files, Has.Some.Matches (v => v.StartsWith ("package/services/metadata/core-properties/", StringComparison.Ordinal) && v.EndsWith (".psmdcp", StringComparison.Ordinal)), "psmdcp"); if (noBindingEmbedding) { - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{assemblyName}.resources.zip"), $"{assemblyName}.resources.zip"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.resources.zip"), $"{assemblyName}.resources.zip"); } } + [Test] + [TestCase (ApplePlatform.iOS, true)] + [TestCase (ApplePlatform.iOS, false)] + [TestCase (ApplePlatform.MacCatalyst, true)] + [TestCase (ApplePlatform.MacCatalyst, false)] + [TestCase (ApplePlatform.TVOS, true)] + [TestCase (ApplePlatform.TVOS, false)] + [TestCase (ApplePlatform.MacOSX, true)] + [TestCase (ApplePlatform.MacOSX, false)] + public void BindingCompressedXcFrameworksProject (ApplePlatform platform, bool compressed) + { + var project = "BindingWithCompressedXCFramework"; + var assemblyName = project; + var configuration = "Release"; + Configuration.IgnoreIfIgnoredPlatform (platform); + var project_path = GetProjectPath (project, runtimeIdentifiers: string.Empty, platform: platform, out var appPath, configuration: configuration); + Clean (project_path); + + var tmpdir = Cache.CreateTemporaryDirectory (); + var outputPath = Path.Combine (tmpdir, "OutputPath"); + var intermediateOutputPath = Path.Combine (tmpdir, "IntermediateOutputPath"); + var properties = GetDefaultProperties (); + properties ["OutputPath"] = outputPath + Path.DirectorySeparatorChar; + properties ["IntermediateOutputPath"] = intermediateOutputPath + Path.DirectorySeparatorChar; + properties ["CompressBindingResourcePackage"] = compressed ? "true" : "false"; + + DotNet.AssertPack (project_path, properties, msbuildParallelism: false); + + var nupkg = Path.Combine (outputPath, assemblyName + ".1.0.0.nupkg"); + Assert.That (nupkg, Does.Exist, "nupkg existence"); + + var archive = ZipFile.OpenRead (nupkg); + var files = archive.Entries.Select (v => v.FullName).ToHashSet (); + var tfm = platform.ToFrameworkWithPlatformVersion (isExecutable: false); + Assert.AreEqual (compressed ? 6 : 9, archive.Entries.Count, $"nupkg file count - {nupkg}"); + Assert.That (files, Does.Contain (assemblyName + ".nuspec"), "nuspec"); + Assert.That (files, Does.Contain ("_rels/.rels"), ".rels"); + Assert.That (files, Does.Contain ("[Content_Types].xml"), "[Content_Types].xml"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.dll"), $"{assemblyName}.dll"); + Assert.That (files, Has.Some.Matches (v => v.StartsWith ("package/services/metadata/core-properties/", StringComparison.Ordinal) && v.EndsWith (".psmdcp", StringComparison.Ordinal)), "psmdcp"); + string? manifest; + if (compressed) { + var resourcesZip = $"lib/{tfm}/{assemblyName}.resources.zip"; + Assert.That (files, Does.Contain (resourcesZip), $"{assemblyName}.resources.zip"); + var innerZip = ZipHelpers.ListInnerZip (nupkg, resourcesZip); + var innerZipContents = new string [] { + "manifest", + "XTest.xcframework.zip", + "XStaticArTest.xcframework.zip", + "XStaticObjectTest.xcframework.zip", + }; + CollectionAssert.AreEqual (innerZipContents.OrderBy (v => v), innerZip.OrderBy (v => v), "Inner zip"); + manifest = ZipHelpers.GetInnerString (nupkg, resourcesZip, "manifest"); + } else { + Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.resources/manifest"), $"manifest"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.resources/XTest.xcframework.zip"), $"XTest.xcframework.zip"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.resources/XStaticArTest.xcframework.zip"), $"XStaticArTest.xcframework.zip"); + Assert.That (files, Does.Contain ($"lib/{tfm}/{assemblyName}.resources/XStaticObjectTest.xcframework.zip"), $"XStaticObjectTest.xcframework.zip"); + manifest = ZipHelpers.GetString (nupkg, $"lib/{tfm}/{assemblyName}.resources/manifest"); + } + var expectedManifest = $""" + + + + + ../../../test-libraries/.libs/XTest.xcframework.zip + + Framework + + + + + + + + + + ../../../test-libraries/.libs/XStaticArTest.xcframework.zip + + Static + + + + + + + + + + ../../../test-libraries/.libs/XStaticObjectTest.xcframework.zip + + Static + + + + + + + + """; + Assert.AreEqual (expectedManifest, manifest, "manifest contents"); + } + [Test] [TestCase (ApplePlatform.iOS)] [TestCase (ApplePlatform.MacCatalyst)] @@ -164,7 +269,7 @@ public void LibraryProject (ApplePlatform platform) Assert.That (files, Does.Contain (project + ".nuspec"), "nuspec"); Assert.That (files, Does.Contain ("_rels/.rels"), ".rels"); Assert.That (files, Does.Contain ("[Content_Types].xml"), "[Content_Types].xml"); - Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion ()}/{project}.dll"), $"{project}.dll"); + Assert.That (files, Does.Contain ($"lib/{platform.ToFrameworkWithPlatformVersion (isExecutable: false)}/{project}.dll"), $"{project}.dll"); Assert.That (files, Has.Some.Matches (v => v.StartsWith ("package/services/metadata/core-properties/", StringComparison.Ordinal) && v.EndsWith (".psmdcp", StringComparison.Ordinal)), "psmdcp"); } diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index 2bf963a3cd8c..3943699a9fbe 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -427,7 +427,7 @@ public void IsNotMacBuild (ApplePlatform platform, string runtimeIdentifiers, bo var appExecutable = Path.Combine (appPath, Path.GetFileName (project_path)); Assert.That (appPath, Does.Not.Exist, "There is an .app"); Assert.That (appExecutable, Does.Not.Empty, "There is no executable"); - Assert.That (Path.Combine (appPath, Configuration.GetBaseLibraryName (platform, true)), Does.Not.Exist, "Platform assembly is in the bundle"); + Assert.That (Path.Combine (appPath, Configuration.GetBaseLibraryName (platform)), Does.Not.Exist, "Platform assembly is in the bundle"); break; case ApplePlatform.MacCatalyst: break; @@ -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"); @@ -1687,6 +1665,30 @@ public void BuildAndExecuteAppWithXCFrameworkWithStaticLibraryInRuntimesNativeDi } } + [Test] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacOSX)] + public void CompressedXCFrameworkInBindingProjectApp (ApplePlatform platform) + { + var project = "CompressedXCFrameworkInBindingProjectApp"; + Configuration.IgnoreIfIgnoredPlatform (platform); + + var runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform); + var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath); + Clean (project_path); + var properties = GetDefaultProperties (runtimeIdentifiers); + DotNet.AssertBuild (project_path, properties); + + var appExecutable = GetNativeExecutable (platform, appPath); + Assert.That (appExecutable, Does.Exist, "There is an executable"); + + if (CanExecute (platform, properties)) { + ExecuteWithMagicWordAndAssert (appExecutable); + } + } + [Test] [TestCase (ApplePlatform.MacOSX, "osx-x64")] public void BuildAndExecuteAppWithWinExeOutputType (ApplePlatform platform, string runtimeIdentifier) diff --git a/tests/dotnet/UnitTests/RegistrarTest.cs b/tests/dotnet/UnitTests/RegistrarTest.cs index b9c87ba414c9..8cc13fb9fc40 100644 --- a/tests/dotnet/UnitTests/RegistrarTest.cs +++ b/tests/dotnet/UnitTests/RegistrarTest.cs @@ -86,7 +86,7 @@ public void ClassRewriterTest (ApplePlatform platform, bool rewriteHandles) var asmDir = Path.Combine (appDir, GetRelativeAssemblyDirectory (platform)); var appExecutable = Path.Combine (asmDir, project + ".dll"); - var platformDll = Path.Combine (asmDir, Configuration.GetBaseLibraryName (platform, true)); + var platformDll = Path.Combine (asmDir, Configuration.GetBaseLibraryName (platform)); Assert.That (File.Exists (platformDll), "No platform dll."); var module = ModuleDefinition.ReadModule (platformDll); var classHandlesMaybe = AllTypes (module).FirstOrDefault (t => t.FullName == "ObjCRuntime.Runtime/ClassHandles"); diff --git a/tests/dotnet/UnitTests/TemplateProjectTest.cs b/tests/dotnet/UnitTests/TemplateProjectTest.cs index d0f18aef7fcd..3e76a2d28540 100644 --- a/tests/dotnet/UnitTests/TemplateProjectTest.cs +++ b/tests/dotnet/UnitTests/TemplateProjectTest.cs @@ -98,7 +98,6 @@ public void VeryManyRegisteredAssemblies (ApplePlatform platform) var tmpdir = Cache.CreateTemporaryDirectory (); var assemblies = 200; - var xm = Configuration.XamarinMacMobileDll; var csc = Configuration.DotNetCscCommand; var references = new List (); diff --git a/tests/dotnet/UnitTests/TestBaseClass.cs b/tests/dotnet/UnitTests/TestBaseClass.cs index 7d58311359fd..5c741e36a126 100644 --- a/tests/dotnet/UnitTests/TestBaseClass.cs +++ b/tests/dotnet/UnitTests/TestBaseClass.cs @@ -36,9 +36,22 @@ protected static Dictionary GetDefaultProperties (string? runtim foreach (var kvp in extraProperties) rv [kvp.Key] = kvp.Value; } + + if (Configuration.IsBuildingRemotely && !rv.ContainsKey ("IsHotRestartBuild")) + AddRemoteProperties (rv); + return rv; } + protected static void AddRemoteProperties (Dictionary properties) + { + properties ["ServerAddress"] = Environment.GetEnvironmentVariable ("MAC_AGENT_IP") ?? string.Empty; + properties ["ServerUser"] = Environment.GetEnvironmentVariable ("MAC_AGENT_USER") ?? string.Empty; + properties ["ServerPassword"] = Environment.GetEnvironmentVariable ("XMA_PASSWORD") ?? string.Empty; + if (!string.IsNullOrEmpty (properties ["ServerUser"])) + properties ["EnsureRemoteConnection"] = "true"; + } + protected static void SetRuntimeIdentifiers (Dictionary properties, string runtimeIdentifiers) { var multiRid = runtimeIdentifiers.IndexOf (';') >= 0 ? "RuntimeIdentifiers" : "RuntimeIdentifier"; @@ -171,6 +184,16 @@ protected static void Clean (string project_path) } } + protected static bool CanExecute (ApplePlatform platform, Dictionary properties) + { + if (properties.TryGetValue ("RuntimeIdentifier", out var runtimeIdentifiers)) { + return CanExecute (platform, runtimeIdentifiers); + } else if (properties.TryGetValue ("RuntimeIdentifiers", out runtimeIdentifiers)) { + return CanExecute (platform, runtimeIdentifiers); + } + return false; + } + protected static bool CanExecute (ApplePlatform platform, string runtimeIdentifiers) { switch (platform) { diff --git a/tests/dotnet/UnitTests/WindowsTest.cs b/tests/dotnet/UnitTests/WindowsTest.cs index af089615c563..18355d5869bc 100644 --- a/tests/dotnet/UnitTests/WindowsTest.cs +++ b/tests/dotnet/UnitTests/WindowsTest.cs @@ -24,10 +24,9 @@ public void BundleStructureWithHotRestart (ApplePlatform platform, string runtim var project_dir = Path.GetDirectoryName (Path.GetDirectoryName (project_path))!; Clean (project_path); - var properties = GetDefaultProperties (runtimeIdentifiers); + var properties = GetDefaultProperties (runtimeIdentifiers, extraProperties: GetHotRestartProperties ()); if (!string.IsNullOrWhiteSpace (configuration)) properties ["Configuration"] = configuration; - AddHotRestartProperties (properties); // Redirect hot restart output to a place we can control from here var hotRestartOutputDir = Path.Combine (tmpdir, "out"); @@ -182,7 +181,6 @@ public void BundleStructureWithRemoteMac (ApplePlatform platform, string runtime properties ["_IsAppSigned"] = signature != BundleStructureTest.CodeSignature.None ? "true" : "false"; if (!string.IsNullOrWhiteSpace (configuration)) properties ["Configuration"] = configuration; - AddRemoteProperties (properties); // Copy the app bundle to Windows so that we can inspect the results. properties ["CopyAppBundleToWindows"] = "true"; @@ -284,7 +282,7 @@ public void BundleStructureWithRemoteMac (ApplePlatform platform, string runtime [TestCase (ApplePlatform.iOS, "ios-arm64")] public void PluralRuntimeIdentifiersWithHotRestart (ApplePlatform platform, string runtimeIdentifiers) { - var properties = AddHotRestartProperties (); + var properties = GetHotRestartProperties (); DotNetProjectTest.PluralRuntimeIdentifiersImpl (platform, runtimeIdentifiers, properties, isUsingHotRestart: true); } @@ -336,7 +334,6 @@ public void RemoteTest (ApplePlatform platform, string runtimeIdentifiers) Clean (project_path); var properties = GetDefaultProperties (runtimeIdentifiers); - AddRemoteProperties (properties); // Copy the app bundle to Windows so that we can inspect the results. properties ["CopyAppBundleToWindows"] = "true"; @@ -368,19 +365,9 @@ public void RemoteTest (ApplePlatform platform, string runtimeIdentifiers) Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString"); } - protected void AddRemoteProperties (Dictionary properties) - { - properties ["ServerAddress"] = Environment.GetEnvironmentVariable ("MAC_AGENT_IP") ?? string.Empty; - properties ["ServerUser"] = Environment.GetEnvironmentVariable ("MAC_AGENT_USER") ?? string.Empty; - properties ["ServerPassword"] = Environment.GetEnvironmentVariable ("XMA_PASSWORD") ?? string.Empty; - - if (!string.IsNullOrEmpty (properties ["ServerUser"])) - properties ["EnsureRemoteConnection"] = "true"; - } - - protected Dictionary AddHotRestartProperties (Dictionary? properties = null) + protected Dictionary GetHotRestartProperties () { - properties ??= new Dictionary (); + var properties = new Dictionary (); properties ["IsHotRestartBuild"] = "true"; properties ["IsHotRestartEnvironmentReady"] = "true"; properties ["EnableCodeSigning"] = "false"; // Skip code signing, since that would require making sure we have code signing configured on bots. diff --git a/tests/dotnet/UnitTests/XcodeProjectTests.cs b/tests/dotnet/UnitTests/XcodeProjectTests.cs index 30a7485df8d8..ecff4fbcd85c 100644 --- a/tests/dotnet/UnitTests/XcodeProjectTests.cs +++ b/tests/dotnet/UnitTests/XcodeProjectTests.cs @@ -179,9 +179,10 @@ public void PackBinding (ApplePlatform platform) Assert.That (expectedNupkgOutput, Does.Exist, $"Expected pack output '{expectedNupkgOutput}' did not exist."); List zipContent = ZipHelpers.List (expectedNupkgOutput); - var expectedFxPath = $"lib/{platform.ToFrameworkWithPlatformVersion ()}/{TestName}.resources/{xcodeProjName}{platform.AsString ()}.xcframework/Info.plist"; + var tfm = platform.ToFrameworkWithPlatformVersion (isExecutable: false); + var expectedFxPath = $"lib/{tfm}/{TestName}.resources/{xcodeProjName}{platform.AsString ()}.xcframework/Info.plist"; if (platform == ApplePlatform.MacOSX || platform == ApplePlatform.MacCatalyst) { - zipContent = ZipHelpers.ListInnerZip (expectedNupkgOutput, $"lib/{platform.ToFrameworkWithPlatformVersion ()}/{TestName}.resources.zip"); + zipContent = ZipHelpers.ListInnerZip (expectedNupkgOutput, $"lib/{tfm}/{TestName}.resources.zip"); expectedFxPath = $"{xcodeProjName}{platform.AsString ()}.xcframework/Info.plist"; } Assert.Contains (expectedFxPath, zipContent, $"Expected xcframework output was not found in '{expectedNupkgOutput}'."); @@ -305,7 +306,7 @@ public void BuildMultipleProjectsiOS () [Category ("Multiplatform")] public void BuildMultiTargeting () { - var enabledPlatforms = Configuration.GetIncludedPlatforms (dotnet: true); + var enabledPlatforms = Configuration.GetIncludedPlatforms (); var templatePlatform = enabledPlatforms.First (); var testDir = Cache.CreateTemporaryDirectory (TestName); var proj = Path.Combine (testDir, $"{TestName}.csproj"); diff --git a/tests/dotnet/UnitTests/ZipHelpers.cs b/tests/dotnet/UnitTests/ZipHelpers.cs index 5a44d6b5465d..a931eb23160d 100644 --- a/tests/dotnet/UnitTests/ZipHelpers.cs +++ b/tests/dotnet/UnitTests/ZipHelpers.cs @@ -26,6 +26,36 @@ public static List ListInnerZip (string file, string innerZipFileName) return innerZip.Entries.Select (entry => entry.FullName.TrimEnd ('/').Replace ('/', Path.DirectorySeparatorChar)).ToList (); } + public static string? GetString (string zipfile, string filename) + { + using var zip = ZipFile.OpenRead (zipfile); + var entry = zip.GetEntry (filename); + if (entry is null) + return null; + + using var entryStream = entry.Open (); + using var reader = new StreamReader (entryStream); + return reader.ReadToEnd (); + } + + public static string? GetInnerString (string zipfile, string innerZipFileName, string filename) + { + using var zip = ZipFile.OpenRead (zipfile); + var innerZipEntry = zip.GetEntry (innerZipFileName); + if (innerZipEntry is null) + return null; + + using Stream innerZipStream = innerZipEntry.Open (); + using ZipArchive innerZip = new ZipArchive (innerZipStream, ZipArchiveMode.Read); + var innerEntry = innerZip.GetEntry (filename); + if (innerEntry is null) + return null; + + using var innerStream = innerEntry.Open (); + using var reader = new StreamReader (innerStream); + return reader.ReadToEnd (); + } + public static void DumpZipFile (ZipArchive zip, string path) { #if TRACE diff --git a/tests/dotnet/Windows/.gitignore b/tests/dotnet/Windows/.gitignore new file mode 100644 index 000000000000..a169a5a99976 --- /dev/null +++ b/tests/dotnet/Windows/.gitignore @@ -0,0 +1 @@ +config.runsettings 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/framework-test/dotnet/Makefile b/tests/framework-test/dotnet/Makefile index c07acf79f160..14013316c0e3 100644 --- a/tests/framework-test/dotnet/Makefile +++ b/tests/framework-test/dotnet/Makefile @@ -1,8 +1,2 @@ TOP=../../.. include $(TOP)/Make.config - -build-all: - for platform in $(DOTNET_PLATFORMS); do \ - echo "Building in $$platform"; \ - $(MAKE) -C "$$platform" build; \ - done diff --git a/tests/fsharp/dotnet/Makefile b/tests/fsharp/dotnet/Makefile index c07acf79f160..6affa45ff122 100644 --- a/tests/fsharp/dotnet/Makefile +++ b/tests/fsharp/dotnet/Makefile @@ -1,8 +1,2 @@ TOP=../../.. -include $(TOP)/Make.config - -build-all: - for platform in $(DOTNET_PLATFORMS); do \ - echo "Building in $$platform"; \ - $(MAKE) -C "$$platform" build; \ - done +include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/generator/BGenTool.cs b/tests/generator/BGenTool.cs index 4326c98f24b0..644dc404703d 100644 --- a/tests/generator/BGenTool.cs +++ b/tests/generator/BGenTool.cs @@ -52,20 +52,13 @@ class BGenTool : Tool { public string? Out; public int Verbosity = 1; - protected override string ToolPath { get { return Profile == Profile.macOSClassic ? Configuration.BGenClassicPath : Configuration.BGenPath; } } + protected override string ToolPath { get => throw new InvalidOperationException (); } protected override string MessagePrefix { get { return "BI"; } } - protected override string MessageToolName { get { return Profile == Profile.macOSClassic ? "bgen-classic" : "bgen"; } } + protected override string MessageToolName { get { return "bgen"; } } public BGenTool () { - if (Environment.OSVersion.Platform == PlatformID.Win32NT) { - EnvironmentVariables = new Dictionary (); - } else { - EnvironmentVariables = new Dictionary { - { "MD_MTOUCH_SDK_ROOT", Configuration.SdkRootXI }, - { "XamarinMacFrameworkRoot", Configuration.SdkRootXM }, - }; - } + EnvironmentVariables = new Dictionary (); } public void AddTestApiDefinition (string filename) @@ -435,11 +428,7 @@ AssemblyDefinition LoadAssembly () if (assembly is null) { var parameters = new ReaderParameters (); var resolver = new DefaultAssemblyResolver (); -#if NET - var searchdir = Path.GetDirectoryName (Configuration.GetBaseLibrary (Profile.AsPlatform (), true)); -#else - var searchdir = Path.GetDirectoryName (Configuration.GetBaseLibrary (Profile)); -#endif + var searchdir = Path.GetDirectoryName (Configuration.GetBaseLibrary (Profile.AsPlatform ())); resolver.AddSearchDirectory (searchdir); parameters.AssemblyResolver = resolver; var tmpDirectory = EnsureTempDir (); diff --git a/tests/generator/Makefile b/tests/generator/Makefile index 64bf43e20eaa..d867bc0727aa 100644 --- a/tests/generator/Makefile +++ b/tests/generator/Makefile @@ -12,7 +12,7 @@ export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.fra all-local:: run-unit-tests build-unit-tests: - $(Q_XBUILD) $(SYSTEM_XIBUILD) -t -- /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore $(TOP)/src/generator.sln + $(Q_XBUILD) $(SYSTEM_MSBUILD) -t -- /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore $(TOP)/src/generator.sln $(SYSTEM_MSBUILD) generator-tests.csproj $(XBUILD_VERBOSITY) run-tests run-unit-tests: build-unit-tests diff --git a/tests/generator/PlatformNameExtensionsTests.cs b/tests/generator/PlatformNameExtensionsTests.cs index e955c69ab010..6daef60a5042 100644 --- a/tests/generator/PlatformNameExtensionsTests.cs +++ b/tests/generator/PlatformNameExtensionsTests.cs @@ -17,7 +17,10 @@ public class PlatformNameExtensions { [TestCase (PlatformName.MacCatalyst, "UIApplication")] [TestCase (PlatformName.MacOSX, "NSApplication")] public void GetApplicationClassNameTest (PlatformName platformName, string expected) - => Assert.AreEqual (expected, platformName.GetApplicationClassName ()); + { + Assert.True (platformName.TryGetApplicationClassName (out var applicationClassName)); + Assert.AreEqual (expected, applicationClassName); + } [TestCase (PlatformName.MacOSX, 2)] [TestCase (PlatformName.iOS, 2)] 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/interdependent-binding-projects/dotnet/Makefile b/tests/interdependent-binding-projects/dotnet/Makefile new file mode 100644 index 000000000000..6affa45ff122 --- /dev/null +++ b/tests/interdependent-binding-projects/dotnet/Makefile @@ -0,0 +1,2 @@ +TOP=../../.. +include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/introspection/ApiAvailabilityTest.cs b/tests/introspection/ApiAvailabilityTest.cs deleted file mode 100644 index b0f223a86780..000000000000 --- a/tests/introspection/ApiAvailabilityTest.cs +++ /dev/null @@ -1,575 +0,0 @@ -// -// Availability tests for introspection -// -// Authors: -// Sebastien Pouliot -// -// Copyright 2017 Microsoft Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#if !NET // this test is in cecil-tests in .NET - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.Versioning; -using System.Text; -using NUnit.Framework; -using ObjCRuntime; -using Xamarin.Tests; -using Xamarin.Utils; - -using ApplePlatform = ObjCRuntime.PlatformName; - -namespace Introspection { - - public class ApiAvailabilityTest : ApiBaseTest { - - protected Version Minimum { get; set; } - protected Version Maximum { get; set; } - protected Func Filter { get; set; } - protected PlatformName Platform { get; set; } - - public ApiAvailabilityTest () - { - Maximum = Version.Parse (Constants.SdkVersion); -#if __MACCATALYST__ - Platform = PlatformName.MacCatalyst; - Minimum = Xamarin.SdkVersions.MinMacCatalystVersion; -#elif __IOS__ - Platform = PlatformName.iOS; - Minimum = Xamarin.SdkVersions.MiniOSVersion; -#elif __TVOS__ - Platform = PlatformName.TvOS; - Minimum = Xamarin.SdkVersions.MinTVOSVersion; -#elif __WATCHOS__ - Platform = PlatformName.WatchOS; - Minimum = Xamarin.SdkVersions.MinWatchOSVersion; -#elif MONOMAC - Platform = PlatformName.MacOSX; - Minimum = Xamarin.SdkVersions.MinOSXVersion; -#else -#error No Platform Defined -#endif - - Filter = (AvailabilityBaseAttribute arg) => { - return (arg.AvailabilityKind != AvailabilityKind.Introduced) || (arg.Platform != Platform); - }; - } - - bool FoundInProtocols (MemberInfo m, Type t) - { - var method = m.ToString (); - foreach (var intf in t.GetInterfaces ()) { - var p = Assembly.GetType (intf.FullName); - if (p is not null) { - // here we want inherited members so we don't have to hunt inherited interfaces recursively - foreach (var pm in p.GetMembers ()) { - if (pm.ToString () != method) - continue; - return true; - } - foreach (var ca in p.GetCustomAttributes ()) { - // TODO check signature in [ProtocolMember] - if (ca.IsProperty) { - if (m.Name == "get_" + ca.Name) - return true; - if (m.Name == "set_" + ca.Name) - return true; - } - if (m.Name == ca.Name) - return true; - } - } - p = Assembly.GetType (intf.Namespace + "." + intf.Name.Substring (1)); - if (p is not null) { - // here we want inherited members so we don't have to hunt inherited interfaces recursively - foreach (var pm in p.GetMembers ()) { - if (pm.ToString () != method) - continue; - return true; - } - } - p = Assembly.GetType (intf.Namespace + "." + intf.Name.Substring (1) + "_Extensions"); - if (p is not null) { - // here we want inherited members so we don't have to hunt inherited interfaces recursively - foreach (var pm in p.GetMembers ()) { - // map extension method to original @optional - if (m.Name != pm.Name) - continue; - var parameters = (pm as MethodInfo).GetParameters (); - if (parameters.Length == 0) - continue; - var pattern = "(" + parameters [0].ParameterType.FullName; - if (parameters.Length > 1) - pattern += ", "; - var s = pm.ToString ().Replace (pattern, "("); - if (s != method) - continue; - return true; - } - } - } - return false; - } - - void CheckIntroduced (Type t, AvailabilityBaseAttribute ta, MemberInfo m) - { - var ma = CheckAvailability (m); - if (ta is null || ma is null) - return; - - // need to skip members that are copied to satisfy interfaces (protocol members) - if (FoundInProtocols (m, t)) - return; - - var taVersion = ta.Version; - var maVersion = ma.Version; - // Duplicate checks, e.g. same attribute on member and type (extranous metadata) - if (maVersion == taVersion) { - switch (t.FullName) { - case "AppKit.INSAccessibility": - // special case for [I]NSAccessibility type (10.9) / protocol (10.10) mix up - // https://github.com/xamarin/xamarin-macios/issues/10009 - // better some dupes than being inaccurate when protocol members are inlined - break; - default: - AddErrorLine ($"[FAIL] {maVersion} ({m}) == {taVersion} ({t})"); - break; - } - } - // Consistency checks, e.g. member lower than type - // note: that's valid in some cases, like a new base type being introduced - if (maVersion < taVersion) { - switch (t.FullName) { - case "CoreBluetooth.CBPeer": - switch (m.ToString ()) { - // type added later and existing property was moved - case "Foundation.NSUuid get_Identifier()": - case "Foundation.NSUuid Identifier": - return; - } - break; - case "MetricKit.MXUnitAveragePixelLuminance": - case "MetricKit.MXUnitSignalBars": - // design bug wrt generics leading to redefinition of some members in subclasses - if (m.ToString () == "System.String Symbol") - return; - break; - } - AddErrorLine ($"[FAIL] {maVersion} ({m}) < {taVersion} ({t})"); - } - } - - [Test] - public void Introduced () - { - //LogProgress = true; - Errors = 0; - foreach (Type t in Assembly.GetTypes ()) { - if (LogProgress) - Console.WriteLine ($"T: {t}"); - var ta = CheckAvailability (t); - - foreach (var p in t.GetProperties (BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) { - if (LogProgress) - Console.WriteLine ($"P: {p}"); - CheckIntroduced (t, ta, p); - } - - // this checks getter and setters which have copies of availability attributes (in legacy) - foreach (var m in t.GetMembers (BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) { - if (LogProgress) - Console.WriteLine ($"M: {m}"); - CheckIntroduced (t, ta, m); - } - } - AssertIfErrors ("{0} API with unneeded or incorrect version information", Errors); - } - -#if XAMCORE_4_0 - [Test] - public void Deprecated () - { - // Warn about any API deprecated before the minimum (e.g. < iOS 6). - // Those should not be exposed in future profiles. - Assert.Fail ("TODO"); - } -#endif - - string ToString (ICustomAttributeProvider cap) - { - var s = cap.ToString (); - if (cap is MemberInfo mi) { - var i = s.IndexOf (' '); - if (i != -1) { - // a method/property without the declaring type is hard to track down - s = s.Insert (i + 1, mi.DeclaringType + "::"); - } - } - return s; - } - - protected AvailabilityBaseAttribute CheckAvailability (ICustomAttributeProvider cap) - { - var attrs = cap.GetCustomAttributes (false); - foreach (var ca in attrs) { - if (!(ca is AvailabilityBaseAttribute aa)) - continue; - if (Filter (aa)) - continue; - - // FIXME should be `<=` but that another large change best done in a different PR - bool isAvailableBeforeMinimum = false; - var aaVersion = aa.Version; - if ((aa.AvailabilityKind == AvailabilityKind.Introduced) && (aaVersion < Minimum)) { - switch (aa.Architecture) { - case PlatformArchitecture.All: - case PlatformArchitecture.None: - isAvailableBeforeMinimum = true; - break; - default: - // An old API still needs the annotations when not available on all architectures - // e.g. NSMenuView is macOS 10.0 but only 32 bits - break; - } - } - if (isAvailableBeforeMinimum) - AddErrorLine ($"[FAIL] {aaVersion} <= {Minimum} (Min) on '{ToString (cap)}'."); - if (aaVersion > Maximum) - AddErrorLine ($"[FAIL] {aaVersion} > {Maximum} (Max) on '{ToString (cap)}'."); - return aa; - } - return null; - } - - bool IsUnavailable (ICustomAttributeProvider cap, out Version? version) - { - version = null; - foreach (var a in cap.GetCustomAttributes (false)) { - var ca = a; - if (ca is UnavailableAttribute ua) { - if (ua.Platform == Platform) - return true; - } - } - return false; - } - - AvailabilityBaseAttribute GetAvailable (ICustomAttributeProvider cap, out Version? version) - { - version = null; - foreach (var a in cap.GetCustomAttributes (false)) { - var ca = a; - if (ca is AvailabilityBaseAttribute aa) { - if ((aa.AvailabilityKind != AvailabilityKind.Unavailable) && (aa.Platform == Platform)) - return aa; - } - } - return null; - } - - void CheckUnavailable (Type t, bool typeUnavailable, Version? typeUnavailableVersion, MemberInfo m) - { - // Turns out Version (13, 1, 0) > Version (13, 1) since undefined fields are -1 - // However, we consider them equal, so force a 0 Build if set to -1 - if (typeUnavailableVersion is not null && typeUnavailableVersion.Build == -1) { - typeUnavailableVersion = new Version (typeUnavailableVersion.Major, typeUnavailableVersion.Minor, 0); - } - - var ma = GetAvailable (m, out var availableVersion); - if (typeUnavailable && (ma is not null)) { - if (typeUnavailableVersion is not null && availableVersion is not null) { - if (availableVersion >= typeUnavailableVersion) - AddErrorLine ($"[FAIL] {m} in {m.DeclaringType.FullName} is marked with {ma} in {availableVersion} but the type {t.FullName} is [Unavailable ({Platform})] in {typeUnavailableVersion}"); - } else { - AddErrorLine ($"[FAIL] {m} in {m.DeclaringType.FullName} is marked with {ma} but the type {t.FullName} is [Unavailable ({Platform})]"); - } - } - - var mu = IsUnavailable (m, out var unavailableVersion); - if (mu && (ma is not null)) { - if (availableVersion is not null && unavailableVersion is not null) { - // Apple is introducing and deprecating numerous APIs in the same Mac Catalyst version, - // so specifically for Mac Catalyst, we do a simple 'greater than' version check, - // instead of a 'greater than or equal' version like we do for the other platforms. - - if (Platform == ApplePlatform.MacCatalyst) { - if (availableVersion > unavailableVersion) - AddErrorLine ($"[FAIL] {m} is marked both [Unavailable ({Platform})] and {ma}, and it's available in version {availableVersion} which is > than the unavailable version {unavailableVersion}"); - } else { - if (availableVersion >= unavailableVersion) - AddErrorLine ($"[FAIL] {m} is marked both [Unavailable ({Platform})] and {ma}, and it's available in version {availableVersion} which is >= than the unavailable version {unavailableVersion}"); - } - } else { - // As documented in https://docs.microsoft.com/en-us/dotnet/standard/analyzers/platform-compat-analyzer#advanced-scenarios-for-attribute-combinations - // it is valid, and required in places to declare a type both availabile and unavailable on a given platform. - // Example: - // [SupportedOSPlatform ("macos")] - // [UnsupportedOSPlatform ("macos10.13")] - // This API was introduced on macOS but became unavailable on 10.13 - // The legacy attributes described this with Deprecated, and did not need to double declare - AddErrorLine ($"[FAIL] {m} in {m.DeclaringType.FullName} is marked both [Unavailable ({Platform})] and {ma}."); - } - } - } - - [Test] - public void Unavailable () - { - //LogProgress = true; - Errors = 0; - foreach (Type t in Assembly.GetTypes ()) { - if (SkipUnavailable (t)) - continue; - if (LogProgress) - Console.WriteLine ($"T: {t}"); - var tu = IsUnavailable (t, out var unavailableVersion); - var ta = GetAvailable (t, out var availableVersion); - if (tu && (ta is not null)) { - if (availableVersion is not null && unavailableVersion is not null) { - // Apple is introducing and deprecating numerous APIs in the same Mac Catalyst version, - // so specifically for Mac Catalyst, we do a simple 'greater than' version check, - // instead of a 'greater than or equal' version like we do for the other platforms. - if (Platform == ApplePlatform.MacCatalyst) { - if (availableVersion > unavailableVersion) - AddErrorLine ($"[FAIL] {t.FullName} is marked both [Unavailable ({Platform})] and {ta}, and it's available in version {availableVersion} which is > than the unavailable version {unavailableVersion}"); - - } else { - if (availableVersion >= unavailableVersion) - AddErrorLine ($"[FAIL] {t.FullName} is marked both [Unavailable ({Platform})] and {ta}, and it's available in version {availableVersion} which is >= than the unavailable version {unavailableVersion}"); - } - } else { - // As documented in https://docs.microsoft.com/en-us/dotnet/standard/analyzers/platform-compat-analyzer#advanced-scenarios-for-attribute-combinations - // it is valid, and required in places to declare a type both availabile and unavailable on a given platform. - // Example: - // [SupportedOSPlatform ("macos")] - // [UnsupportedOSPlatform ("macos10.13")] - // This API was introduced on macOS but became unavailable on 10.13 - // The legacy attributes described this with Deprecated, and did not need to double declare - AddErrorLine ($"[FAIL] {t.FullName} is marked both [Unavailable ({Platform})] and {ta}. Available: {availableVersion} Unavailable: {unavailableVersion}"); - } - } - - foreach (var p in t.GetProperties (BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) { - if (SkipUnavailable (t, p.Name)) - continue; - if (LogProgress) - Console.WriteLine ($"P: {p.Name}"); - CheckUnavailable (t, tu, unavailableVersion, p); - } - - foreach (var m in t.GetMembers (BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)) { - if (SkipUnavailable (t, m.Name)) - continue; - if (LogProgress) - Console.WriteLine ($"M: {m.Name}"); - CheckUnavailable (t, tu, unavailableVersion, m); - } - } - AssertIfErrors ("{0} API with mixed [Unavailable] and availability attributes", Errors); - } - - protected virtual bool SkipUnavailable (Type type) - { -#if __MACCATALYST__ - switch (type.Namespace) { - case "AddressBook": { - // The entire framework was introduced and deprecated in the same Mac Catalyst version - return true; - } - } -#endif - - switch (type.FullName) { -#if __MACCATALYST__ - case "SafariServices.SFContentBlockerErrorCode": - case "SafariServices.SFContentBlockerErrorCodeExtensions": - // introduced and deprecated in the same Mac Catalyst version - return true; -#endif - } - return false; - } - - protected virtual bool SkipUnavailable (Type type, string memberName) - { - switch (type.FullName) { -#if __MACOS__ - case "AppKit.NSDrawer": - switch (memberName) { - case "AccessibilityChildrenInNavigationOrder": - case "get_AccessibilityChildrenInNavigationOrder": - case "set_AccessibilityChildrenInNavigationOrder": - case "AccessibilityCustomActions": - case "get_AccessibilityCustomActions": - case "set_AccessibilityCustomActions": - case "AccessibilityCustomRotors": - case "get_AccessibilityCustomRotors": - case "set_AccessibilityCustomRotors": - // NSDrawer was deprecated in macOS 10.13, but implements (and inlines) NSAccessibility, which added several new members in macOS 10.13, so ignore those members here. - return true; - } - break; - case "GLKit.GLKTextureLoader": - switch (memberName) { - case "GrayscaleAsAlpha": - case "get_GrayscaleAsAlpha": - // GLKTextureLoader is deprecated, but the GLKTextureLoaderGrayscaleAsAlpha value, which we've put inside the GLKTextureLoader class, isn't. - return true; - } - break; -#endif -#if __MACCATALYST__ - case "AudioUnit.AudioComponent": - switch (memberName) { - case "LastActiveTime": - // introduced and deprecated in the same Mac Catalyst version - return true; - } - break; - // Apple itself is inconsistent in the availability of the type compared to these selectors - case "AVFoundation.AVCaptureStillImageOutput": - switch (memberName) { - case "AutomaticallyEnablesStillImageStabilizationWhenAvailable": - case "CapturingStillImage": - case "HighResolutionStillImageOutputEnabled": - case "IsStillImageStabilizationActive": - case "IsStillImageStabilizationSupported": - return true; - } - break; -#endif - case "CarPlay.CPApplicationDelegate": - switch (memberName) { - case "DidDiscardSceneSessions": - case "GetConfiguration": - case "GetHandlerForIntent": - case "ShouldAutomaticallyLocalizeKeyCommands": - case "ShouldRestoreSecureApplicationState": - case "ShouldSaveSecureApplicationState": - // CPApplicationDelegate is deprecated in macOS 10.15, but these members are pulled in from the UIApplicationDelegate protocol (which is not deprecated) - return true; - } - break; - case "CoreMedia.CMTimebase": { - switch (memberName) { - case "SetMasterTimebase": - case "SetMasterClock": - // These APIs were introduced and deprecated in the same version - return true; - } - break; - } - case "GameKit.GKScore": { - switch (memberName) { - case "ReportLeaderboardScores": - case "ReportLeaderboardScoresAsync": - // Apple introduced and deprecated this method in the same OS version. - return true; - } - break; - } - case "Intents.INNoteContentTypeResolutionResult": { - switch (memberName) { - case "GetConfirmationRequired": - case "GetUnsupported": - // These are static members that have been re-implemented from the base class - the base class isn't deprecated, while INNoteContentTypeResolutionResult is. - return true; - } - break; - } - case "MobileCoreServices.UTType": { - switch (memberName) { - case "UniversalSceneDescriptionMobile": - case "get_UniversalSceneDescriptionMobile": - // Apple added new members to a deprecated enum - return true; - } - break; - } - case "SceneKit.SCNLayer": { - switch (memberName) { - case "CurrentViewport": - case "TemporalAntialiasingEnabled": - case "get_CurrentViewport": - case "get_TemporalAntialiasingEnabled": - case "set_TemporalAntialiasingEnabled": - case "get_UsesReverseZ": - case "set_UsesReverseZ": - case "UsesReverseZ": - // SCNLayer is deprecated in macOS 10.15, but these members are pulled in from the SCNSceneRenderer protocol (which is not deprecated) - return true; - } - break; - } - } - return false; - } - - static HashSet member_level = new HashSet (); - - void CheckDupes (MemberInfo m, Type t, ISet type_level) - { - member_level.Clear (); - foreach (var a in m.GetCustomAttributes (false)) { - var s = String.Empty; - if (a is AvailabilityBaseAttribute aa) - s = aa.ToString (); - if (s.Length > 0) { - if (type_level.Contains (s)) - AddErrorLine ($"[FAIL] Both '{t}' and '{m}' are marked with `{s}`."); - if (member_level.Contains (s)) - AddErrorLine ($"[FAIL] '{m}' is decorated more than once with `{s}`."); - else - member_level.Add (s); - } - } - } - - [Test] - public void Duplicates () - { - HashSet type_level = new HashSet (); - //LogProgress = true; - Errors = 0; - foreach (Type t in Assembly.GetTypes ()) { - if (LogProgress) - Console.WriteLine ($"T: {t}"); - - type_level.Clear (); - foreach (var a in t.GetCustomAttributes (false)) { - if (a is AvailabilityBaseAttribute aa) - type_level.Add (aa.ToString ()); - } - - foreach (var p in t.GetProperties (BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { - if (LogProgress) - Console.WriteLine ($"P: {p}"); - CheckDupes (p, t, type_level); - } - - foreach (var m in t.GetMembers (BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { - if (LogProgress) - Console.WriteLine ($"M: {m}"); - CheckDupes (m, t, type_level); - } - } - AssertIfErrors ("{0} API with members duplicating type-level attributes", Errors); - } - } -} - -#endif // !NET diff --git a/tests/introspection/ApiBaseTest.cs b/tests/introspection/ApiBaseTest.cs index 2c4f6cb25a72..11ba89523d89 100644 --- a/tests/introspection/ApiBaseTest.cs +++ b/tests/introspection/ApiBaseTest.cs @@ -37,6 +37,9 @@ using UIKit; #endif +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { public abstract class ApiBaseTest { @@ -104,8 +107,6 @@ protected StringBuilder ErrorData { protected TextWriter Writer { #if MONOMAC get { return Console.Out; } -#elif __WATCHOS__ - get { return Console.Out; } #else get { return AppDelegate.Runner.Writer; } #endif @@ -210,20 +211,12 @@ protected bool SkipDueToRejectedTypes (Type type) public bool MemberHasObsolete (MemberInfo member) { -#if NET return TestRuntime.HasOSPlatformAttributeForCurrentPlatform (member); -#else - return member.GetCustomAttribute () is not null; -#endif } public bool MemberHasUnsupported (MemberInfo member) { -#if NET return TestRuntime.HasOSPlatformAttributeForCurrentPlatform (member); -#else - return member.GetCustomAttribute () is not null; -#endif } public bool MemberHasEditorBrowsableNever (MemberInfo member) diff --git a/tests/introspection/ApiCMAttachmentTest.cs b/tests/introspection/ApiCMAttachmentTest.cs index 9df50aad38f4..59c92ba185ee 100644 --- a/tests/introspection/ApiCMAttachmentTest.cs +++ b/tests/introspection/ApiCMAttachmentTest.cs @@ -1,5 +1,3 @@ -#if !__WATCHOS__ - using System; using System.Drawing; using System.IO; @@ -15,11 +13,7 @@ using CoreFoundation; using CoreGraphics; using CoreText; -#if NET using CFNetwork; -#else -using CoreServices; -#endif using CoreVideo; using Foundation; using ImageIO; @@ -31,9 +25,10 @@ using UIKit; using Network; -#if NET using GColorConversionInfoTriple = CoreGraphics.CGColorConversionInfoTriple; -#endif + +// Disable until we get around to enable + fix any issues. +#nullable disable namespace Introspection { @@ -145,12 +140,7 @@ public AttachableNativeObject (INativeObject obj) nativeObj = obj; } -#if NET - public NativeHandle Handle -#else - public IntPtr Handle -#endif - { + public NativeHandle Handle { get { return nativeObj.Handle; } } } @@ -419,11 +409,7 @@ protected INativeObject GetINativeInstance (Type t) return Runtime.GetINativeObject (array [0].LowlevelObjectForKey (SecImportExport.Identity.Handle), false); } case "SecTrust": -#if NET X509Certificate x = X509CertificateLoader.LoadCertificate (mail_google_com); -#else - X509Certificate x = new X509Certificate (mail_google_com); -#endif using (var policy = SecPolicy.CreateSslPolicy (true, "mail.google.com")) return new SecTrust (x, policy); case "SslContext": @@ -487,11 +473,7 @@ protected INativeObject GetINativeInstance (Type t) using (var cdata = NSData.FromArray (mail_google_com)) return new SecCertificate2 (new SecCertificate (cdata)); case "SecTrust2": -#if NET X509Certificate x2 = X509CertificateLoader.LoadCertificate (mail_google_com); -#else - X509Certificate x2 = new X509Certificate (mail_google_com); -#endif using (var policy = SecPolicy.CreateSslPolicy (true, "mail.google.com")) return new SecTrust2 (new SecTrust (x2, policy)); case "SecIdentity2": @@ -616,5 +598,3 @@ public void CheckFailAttachments () } } } - -#endif // !__WATCHOS__ diff --git a/tests/introspection/ApiClassPtrTest.cs b/tests/introspection/ApiClassPtrTest.cs index 3b7b2b4875c7..f1fabec05079 100644 --- a/tests/introspection/ApiClassPtrTest.cs +++ b/tests/introspection/ApiClassPtrTest.cs @@ -17,9 +17,8 @@ using Foundation; using ObjCRuntime; -#if !NET -using NativeHandle = System.IntPtr; -#endif +// Disable until we get around to enable + fix any issues. +#nullable disable namespace Introspection { diff --git a/tests/introspection/ApiCoreImageFiltersTest.cs b/tests/introspection/ApiCoreImageFiltersTest.cs index f09079b051a2..857d6d303bac 100644 --- a/tests/introspection/ApiCoreImageFiltersTest.cs +++ b/tests/introspection/ApiCoreImageFiltersTest.cs @@ -19,8 +19,6 @@ // limitations under the License. // -#if !__WATCHOS__ - using System; using System.Collections.Generic; using System.IO; @@ -36,6 +34,9 @@ using UIKit; #endif +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [TestFixture] @@ -192,24 +193,14 @@ static void GenerateBinding (NSObject filter, TextWriter writer) var key = k.ToString (); if (key.StartsWith ("CIAttribute", StringComparison.Ordinal)) continue; -#if !NET - // CIFilter defines it for all filters - if (key == "inputImage") - continue; -#endif writer.WriteLine (); var dict = attributes [k] as NSDictionary; var type = dict [(NSString) "CIAttributeClass"]; writer.WriteLine ($"\t[CoreImageFilterProperty (\"{key}\")]"); -#if NET // by default we drop the "input" prefix, but keep the "output" prefix to avoid confusion, except for 'inputImage' if (key.StartsWith ("input", StringComparison.Ordinal) && key != "inputImage") -#else - // by default we drop the "input" prefix, but keep the "output" prefix to avoid confusion - if (key.StartsWith ("input", StringComparison.Ordinal)) -#endif key = Char.ToUpperInvariant (key [5]) + key.Substring (6); writer.WriteLine ("\t/* REMOVE-ME"); @@ -590,5 +581,3 @@ public void Keys () } } } - -#endif // !__WATCHOS__ diff --git a/tests/introspection/ApiCtorInitTest.cs b/tests/introspection/ApiCtorInitTest.cs index 740047b8d186..83b372d148f6 100644 --- a/tests/introspection/ApiCtorInitTest.cs +++ b/tests/introspection/ApiCtorInitTest.cs @@ -32,6 +32,9 @@ using Foundation; using ObjCRuntime; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { public abstract class ApiCtorInitTest : ApiBaseTest { @@ -97,10 +100,6 @@ protected virtual bool Skip (Type type) case "NSUnitPressure": // -init should never be called on NSUnit! case "NSUnitSpeed": // -init should never be called on NSUnit! return true; -#if !NET // NSMenuView does not exist in .NET - case "NSMenuView": - return TestRuntime.IsVM; // skip on vms due to hadware problems -#endif // !NET case "MPSCnnNeuron": // Cannot directly initialize MPSCNNNeuron. Use one of the sub-classes of MPSCNNNeuron case "MPSCnnNeuronPReLU": case "MPSCnnNeuronHardSigmoid": @@ -132,11 +131,7 @@ protected virtual bool Skip (Type type) return TestRuntime.IsSimulator; #endif case "AVSpeechSynthesisVoice": // Calling description crashes the test -#if __WATCHOS__ - return TestRuntime.CheckXcodeVersion (12, 2); // CheckExactXcodeVersion is not implemented in watchOS yet but will be covered by iOS parrot below -#else return TestRuntime.CheckExactXcodeVersion (12, 2, beta: 3); -#endif case "SKView": // Causes a crash later. Filed as radar://18440271. // Apple said they won't fix this ('init' isn't a designated initializer) diff --git a/tests/introspection/ApiFieldTest.cs b/tests/introspection/ApiFieldTest.cs index 30fb311ef541..c20ffda42add 100644 --- a/tests/introspection/ApiFieldTest.cs +++ b/tests/introspection/ApiFieldTest.cs @@ -29,6 +29,9 @@ using Foundation; using ObjCRuntime; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [Preserve (AllMembers = true)] @@ -155,7 +158,7 @@ public void Notifications () var failed_fields = new List (); Errors = 0; - int c = 0, n = 0; + int n = 0; foreach (var p in AllProperties ()) { if (p.PropertyType.FullName != NSStringType) continue; diff --git a/tests/introspection/ApiFrameworkTest.cs b/tests/introspection/ApiFrameworkTest.cs index f95e01192736..cce1a26e547c 100644 --- a/tests/introspection/ApiFrameworkTest.cs +++ b/tests/introspection/ApiFrameworkTest.cs @@ -8,6 +8,8 @@ using Foundation; using ObjCRuntime; +// Disable until we get around to enable + fix any issues. +#nullable disable public class Application { public bool IsSimulatorBuild { @@ -43,6 +45,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; @@ -50,29 +55,7 @@ public bool Skip (string @namespace) case "System": case "System.Drawing": return true; -#if __IOS__ -#if !NET - // Some CF* types that requires CFNetwork which we always link with - // ref: tools/common/CompilerFlags.cs - case "CoreServices": -#endif -#if !NET - case "WatchKit": // Apple removed WatchKit from iOS -#endif - return true; -#elif __TVOS__ && !NET - // mistakes (can't be fixed without breaking binary compatibility) - case "CoreSpotlight": - case "WebKit": - return true; -#elif __WATCHOS__ && !NET - // helpers (largely enums) for AVFoundation API - no p/invokes or obj-C API that requires native linking - case "AudioToolbox": - return true; - // mistakes (can't be fixed without breaking binary compatibility) - case "WebKit": - return true; -#elif __MACOS__ +#if __MACOS__ // always included, ref: tools/common/CompilerFlags.cs case "CFNetwork": return true; @@ -102,8 +85,6 @@ Frameworks GetFrameworks () return Frameworks.GetiOSFrameworks (app.IsSimulatorBuild); #elif __TVOS__ return Frameworks.TVOSFrameworks; -#elif __WATCHOS__ - return Frameworks.GetwatchOSFrameworks (app.IsSimulatorBuild); #elif __MACOS__ return Frameworks.MacFrameworks; #else @@ -148,66 +129,5 @@ public void NativeFrameworks () AssertIfErrors ($"{Errors} unknown frameworks found:\n{ErrorData}"); } -#if __IOS__ && !__MACCATALYST__ && !NET - [Test] - public void Simlauncher () - { - TestRuntime.AssertSimulator ("Only needed on simulator"); - - var all = GetFrameworks (); - - var namespaces = new HashSet (StringComparer.OrdinalIgnoreCase); - foreach (Type t in Assembly.GetTypes ()) { - if (!t.IsPublic) - continue; - namespaces.Add (t.Namespace); - } - - foreach (var line in File.ReadAllLines ("simlauncher64-sgen.frameworks")) { - var c = line.IndexOf (" (compatibility"); - if (c < 0) - continue; - var path = line.Substring (1, c - 1); - if (!path.StartsWith ("/System/Library/Frameworks/", StringComparison.Ordinal)) - continue; - var fx = Path.GetFileNameWithoutExtension (path); - - // match with mtouch framework list - if (!all.TryGetValue (fx, out var framework)) { - // special cases - switch (fx) { - case "CoreAudio": // AudioToolbox, AVFoundation... - case "CoreFoundation": // implied (always linked) - case "CFNetwork": // implied (StartWWAN) and included (mostly) in CoreServices - case "OpenAL": // part of OpenTK - break; - case "CoreMIDI": - // CoreMidi (case) in the fx list - break; - default: - ReportError ($"{fx} is not part of mtouch's GetFrameworks"); - break; - } - } - - // match with Xamarin.iOS.dll namespaces - if (!namespaces.Contains (fx)) { - // special cases - switch (fx) { - case "CoreAudio": // AudioToolbox, AVFoundation... - case "CFNetwork": // implied (StartWWAN) and included (mostly) in CoreServices - case "OpenAL": // part of OpenTK - break; - default: - ReportError ($"{fx} is not part of mtouch's GetFrameworks"); - break; - } - } - - } - - AssertIfErrors ($"{Errors} unknown frameworks found:\n{ErrorData}"); - } -#endif } } diff --git a/tests/introspection/ApiPInvokeTest.cs b/tests/introspection/ApiPInvokeTest.cs index 043ef299944a..27abbfabbe72 100644 --- a/tests/introspection/ApiPInvokeTest.cs +++ b/tests/introspection/ApiPInvokeTest.cs @@ -21,6 +21,9 @@ using ObjCRuntime; using Foundation; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [Preserve (AllMembers = true)] public abstract class ApiPInvokeTest : ApiBaseTest { @@ -158,13 +161,7 @@ public void SymbolExists () case "System.Native": case "System.Security.Cryptography.Native.Apple": case "System.Net.Security.Native": - if (MonoNativeConfig.LinkMode == MonoNativeLinkMode.None) - continue; -#if __IOS__ - libname = MonoNativeConfig.GetPInvokeLibraryName (MonoNativeFlavor.Unified, MonoNativeConfig.LinkMode); -#else libname = null; -#endif break; } @@ -216,7 +213,6 @@ protected void Check (Assembly a) // load from executable path = null; break; -#if NET case "libSystem.Globalization.Native": // load from executable (like __Internal above since it's part of the static library) path = null; @@ -240,7 +236,6 @@ protected void Check (Assembly a) path += ".dylib"; } break; -#endif case "libc": // we still have some rogue/not-fully-qualified DllImport path = "/usr/lib/libSystem.dylib"; @@ -248,13 +243,7 @@ protected void Check (Assembly a) case "System.Native": case "System.Security.Cryptography.Native.Apple": case "System.Net.Security.Native": - if (MonoNativeConfig.LinkMode == MonoNativeLinkMode.None) - continue; -#if __IOS__ - path = MonoNativeConfig.GetPInvokeLibraryName (MonoNativeFlavor.Unified, MonoNativeConfig.LinkMode); -#else path = null; -#endif break; } @@ -404,15 +393,5 @@ public void SystemCore () if (!SkipAssembly (a)) Check (a); } - -#if !NET - [Test] - public void SystemData () - { - var a = typeof (System.Data.SqlClient.SqlCredential).Assembly; - if (!SkipAssembly (a)) - Check (a); - } -#endif } } diff --git a/tests/introspection/ApiProtocolTest.cs b/tests/introspection/ApiProtocolTest.cs index 80613da909a2..9134923d90d3 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": @@ -49,12 +52,6 @@ protected virtual bool Skip (Type type) // *** NSForwarding: warning: object 0x5cbd078 of class 'JSExport' does not implement doesNotRecognizeSelector: -- abort case "JSExport": return true; -#if !NET - case "MTLCounter": - case "MTLCounterSampleBuffer": - case "MTLCounterSet": - return true; // Incorrectly bound, will be fixed for .NET. -#endif case "MPSImageLaplacianPyramid": case "MPSImageLaplacianPyramidSubtract": case "MPSImageLaplacianPyramidAdd": diff --git a/tests/introspection/ApiSelectorTest.cs b/tests/introspection/ApiSelectorTest.cs index 4704c66635b1..d3e73a2615ce 100644 --- a/tests/introspection/ApiSelectorTest.cs +++ b/tests/introspection/ApiSelectorTest.cs @@ -26,9 +26,8 @@ using Foundation; using ObjCRuntime; -#if !NET -using NativeHandle = System.IntPtr; -#endif +// Disable until we get around to enable + fix any issues. +#nullable disable namespace Introspection { @@ -38,6 +37,9 @@ public abstract class ApiSelectorTest : ApiBaseTest { protected virtual bool Skip (Type type) { + if (MemberHasEditorBrowsableNever (type)) + return true; + if (type.ContainsGenericParameters) return true; @@ -174,16 +176,6 @@ protected virtual bool Skip (Type type, string selectorName) return !TestRuntime.CheckXcodeVersion (9, 0); } break; -#if !NET - case "NSUrl": - case "ARQuickLookPreviewItem": - switch (selectorName) { - case "previewItemTitle": - // 'previewItemTitle' is inlined from the QLPreviewItem protocol and should be optional (fixed in .NET) - return true; - } - break; -#endif case "MKMapItem": // Selector not available on iOS 32-bit switch (selectorName) { case "encodeWithCoder:": @@ -399,7 +391,7 @@ protected virtual bool Skip (Type type, string selectorName) return true; } break; -#if (__WATCHOS__ || __MACOS__ || __MACCATALYST__) +#if __MACOS__ || __MACCATALYST__ case "AVPlayerItem": switch (selectorName) { // comes from AVPlayerItem+MPAdditions.h case "nowPlayingInfo": @@ -1020,7 +1012,6 @@ protected virtual bool Skip (Type type, string selectorName) case "willMoveToView:": case "view": return !TestRuntime.CheckXcodeVersion (15, 4); - break; } break; case "ASAuthorizationPublicKeyCredentialLargeBlobRegistrationOutput": @@ -1060,6 +1051,14 @@ protected virtual bool Skip (Type type, string selectorName) } break; #endif // __MACCATALYST__ +#if !XAMCORE_5_0 + case "NSSharingCollaborationModeRestriction": + switch (selectorName) { + case "setAlertRecoverySuggestionButtonLaunchURL:":// binding mistake + return true; + } + break; +#endif } // old binding mistake @@ -1155,11 +1154,7 @@ protected virtual IntPtr GetClassForType (Type type) var fi = type.GetField ("class_ptr", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); if (fi is null) return IntPtr.Zero; // e.g. *Delegate -#if NET return (NativeHandle) fi.GetValue (null); -#else - return (IntPtr) fi.GetValue (null); -#endif } [Test] @@ -1226,8 +1221,13 @@ void CheckInit (Type t, MethodBase m, string name) if (!init) ReportError ("Selector {0} used on a constructor (not a method) on {1}", name, t.FullName); } else { - if (init) - ReportError ("Selector {0} used on a method (not a constructor) on {1}", name, t.FullName); + if (init) { + var isPubliclyVisible = m.IsPublic || m.IsFamily || m.IsFamilyOrAssembly; + if (isPubliclyVisible || !m.Name.StartsWith ("_Init", StringComparison.Ordinal)) { + // ignore methods that start '_Init' and aren't publicly exposed, they're probably used by manually bound ctors. + ReportError ($"Selector {name} used on the method '{m.Name}' (not a constructor) on {t.FullName}"); + } + } } } diff --git a/tests/introspection/ApiSignatureTest.cs b/tests/introspection/ApiSignatureTest.cs index 0adc43b23378..a47c2b80c6dc 100644 --- a/tests/introspection/ApiSignatureTest.cs +++ b/tests/introspection/ApiSignatureTest.cs @@ -31,18 +31,13 @@ using Foundation; using ObjCRuntime; -#if !NET -using NativeHandle = System.IntPtr; -#endif +// Disable until we get around to enable + fix any issues. +#nullable disable namespace Introspection { public abstract class ApiSignatureTest : ApiBaseTest { -#if NET const string NFloatTypeName = "System.Runtime.InteropServices.NFloat"; -#else - const string NFloatTypeName = "System.nfloat"; -#endif [DllImport ("/usr/lib/libobjc.dylib")] // note: the returned string is not ours to free static extern IntPtr objc_getClass (string name); @@ -869,10 +864,8 @@ static bool IsDiscouraged (MemberInfo mi) } } -#if NET if (TestRuntime.HasOSPlatformAttributeForCurrentPlatform (mi)) return true; -#endif return false; } diff --git a/tests/introspection/ApiTypeTest.cs b/tests/introspection/ApiTypeTest.cs index 72f45c77fea9..d5ea37347795 100644 --- a/tests/introspection/ApiTypeTest.cs +++ b/tests/introspection/ApiTypeTest.cs @@ -9,6 +9,9 @@ using Foundation; using ObjCRuntime; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [TestFixture] @@ -19,7 +22,7 @@ public class ApiTypeTest : ApiBaseTest { bool Skip (Type type) { switch (type.Namespace) { -#if __IOS__ || __WATCHOS__ +#if __IOS__ // running the .cctor on the simulator works... but makes some other CoreNFC intro tests fail later // we'll still get the results from device tests case "CoreNFC": diff --git a/tests/introspection/ApiTypoTest.cs b/tests/introspection/ApiTypoTest.cs index a01bb4a8f06e..6681a40d074c 100644 --- a/tests/introspection/ApiTypoTest.cs +++ b/tests/introspection/ApiTypoTest.cs @@ -38,6 +38,9 @@ using Xamarin.Tests; using Xamarin.Utils; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { public abstract class ApiTypoTest : ApiBaseTest { protected ApiTypoTest () @@ -729,27 +732,6 @@ public virtual bool Skip (MemberInfo methodName, string typo) "Wme", "Writeln", "Xattr", -#endif -#if !NET - "Actionfrom", - "Asal", // Typo, should be 'Basal', fixed in 'HKInsulinDeliveryReason' - "Attributefor", - "Attributest", - "Failwith", - "Imageimage", - "Libary", - "Musthold", - "Olus", // Typo, should be 'Bolus', fixed in 'HKInsulinDeliveryReason' - "Ostprandial", // Typo, should be 'Postprandial', fixed in 'HKBloodGlucoseMealTime' - "Pathpath", - "Rangefor", - "Reprandial", // Typo, should be 'Preprandial', fixed in 'HKBloodGlucoseMealTime' - "Failwith", - "Tearm", - "Theevent", - "Timestampe", // Existing binding so we can't just remove it. - "Toplevel", - "Tripple", #endif }; @@ -891,10 +873,6 @@ string GetMessage (object attribute) message = ((AdviceAttribute) attribute).Message; if (attribute is ObsoleteAttribute) message = ((ObsoleteAttribute) attribute).Message; -#if !NET - if (attribute is AvailabilityBaseAttribute) - message = ((AvailabilityBaseAttribute) attribute).Message; -#endif return message; } @@ -1038,8 +1016,6 @@ protected void AssertMatchingOSVersionAndSdkVersion () var sdk = new Version (Constants.SdkVersion); #if MONOMAC if (!NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion (new NSOperatingSystemVersion (sdk.Major, sdk.Minor, sdk.Build == -1 ? 0 : sdk.Build))) -#elif __WATCHOS__ - if (!WatchKit.WKInterfaceDevice.CurrentDevice.CheckSystemVersion (sdk.Major, sdk.Minor)) #else if (!UIDevice.CurrentDevice.CheckSystemVersion (sdk.Major, sdk.Minor)) #endif @@ -1068,15 +1044,6 @@ public void ConstantsCheck () case "AssetsLibraryLibrary": case "NewsstandKitLibrary": // Removed from iOS, but we have to keep the constant around for binary compatibility. break; -#endif -#if !NET -#if __TVOS__ - case "PassKitLibrary": // not part of tvOS - break; -#endif - case "libcompression": // bad (missing) suffix - Assert.True (CheckLibrary (s), fi.Name); - break; #endif case "ChipLibrary": // Chip is removed entirely beginning Xcode 14 if (!TestRuntime.CheckXcodeVersion (14, 0)) @@ -1131,11 +1098,6 @@ public void ConstantsCheck () // Only available in macOS 10.15.4+ if (fi.Name == "AutomaticAssessmentConfigurationLibrary" && !TestRuntime.CheckXcodeVersion (11, 4)) continue; -#endif -#if __WATCHOS__ - // added with watchOS 4 (mistake) - if (fi.Name == "VisionLibrary") - continue; #endif Assert.True (CheckLibrary (s), fi.Name); } else { diff --git a/tests/introspection/ApiWeakPropertyTest.cs b/tests/introspection/ApiWeakPropertyTest.cs index f96d70abe71f..b35cc9ff3484 100644 --- a/tests/introspection/ApiWeakPropertyTest.cs +++ b/tests/introspection/ApiWeakPropertyTest.cs @@ -8,6 +8,9 @@ using Foundation; using ObjCRuntime; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [Preserve (AllMembers = true)] public abstract class ApiWeakPropertyTest : ApiBaseTest { diff --git a/tests/introspection/Assets.xcassets/AppIcons.appiconset/Contents.json b/tests/introspection/Assets.xcassets/AppIcons.appiconset/Contents.json new file mode 100644 index 000000000000..284e15f9906c --- /dev/null +++ b/tests/introspection/Assets.xcassets/AppIcons.appiconset/Contents.json @@ -0,0 +1,208 @@ +{ + "images": [ + { + "size": "29x29", + "scale": "1x", + "idiom": "iphone" + }, + { + "size": "29x29", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "29x29", + "scale": "3x", + "idiom": "iphone" + }, + { + "size": "40x40", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "40x40", + "scale": "3x", + "idiom": "iphone" + }, + { + "filename": "icon-app-57.png", + "size": "57x57", + "scale": "1x", + "idiom": "iphone" + }, + { + "filename": "icon-app-57@2x.png", + "size": "57x57", + "scale": "2x", + "idiom": "iphone" + }, + { + "filename": "icon-app-60@2x.png", + "size": "60x60", + "scale": "2x", + "idiom": "iphone" + }, + { + "size": "29x29", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "29x29", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "40x40", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "40x40", + "scale": "2x", + "idiom": "ipad" + }, + { + "size": "50x50", + "scale": "1x", + "idiom": "ipad" + }, + { + "size": "50x50", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "icon-app-83.5@2x.png", + "size": "83.5x83.5", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "icon-app-72.png", + "size": "72x72", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "icon-app-72@2x.png", + "size": "72x72", + "scale": "2x", + "idiom": "ipad" + }, + { + "filename": "icon-app-76.png", + "size": "76x76", + "scale": "1x", + "idiom": "ipad" + }, + { + "filename": "icon-app-76@2x.png", + "size": "76x76", + "scale": "2x", + "idiom": "ipad" + }, + { + "role": "notificationCenter", + "size": "24x24", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "notificationCenter", + "size": "27.5x27.5", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "companionSettings", + "size": "29x29", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "companionSettings", + "size": "29x29", + "scale": "3x", + "idiom": "watch" + }, + { + "role": "appLauncher", + "size": "40x40", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "quickLook", + "size": "86x86", + "subtype": "38mm", + "scale": "2x", + "idiom": "watch" + }, + { + "role": "quickLook", + "size": "98x98", + "subtype": "42mm", + "scale": "2x", + "idiom": "watch" + }, + { + "size": "16x16", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "16x16", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "32x32", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "32x32", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "128x128", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "128x128", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "256x256", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "256x256", + "scale": "2x", + "idiom": "mac" + }, + { + "size": "512x512", + "scale": "1x", + "idiom": "mac" + }, + { + "size": "512x512", + "scale": "2x", + "idiom": "mac" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-57.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-57.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-57.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-57.png diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-57@2x.png diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-60@2x.png diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-72.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-72.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-72.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-72.png diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-72@2x.png diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-76.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-76.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-76.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-76.png diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-76@2x.png diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png b/tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png similarity index 100% rename from tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png rename to tests/introspection/Assets.xcassets/AppIcons.appiconset/icon-app-83.5@2x.png diff --git a/tests/introspection/CoreSelectorTest.cs b/tests/introspection/CoreSelectorTest.cs index 4bfd62aa7a99..1e2902e73e5f 100644 --- a/tests/introspection/CoreSelectorTest.cs +++ b/tests/introspection/CoreSelectorTest.cs @@ -14,6 +14,9 @@ using Foundation; using ObjCRuntime; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { public abstract class CoreSelectorTest : ApiSelectorTest { diff --git a/tests/introspection/iOS/Entitlements.plist b/tests/introspection/Entitlements.plist similarity index 100% rename from tests/introspection/iOS/Entitlements.plist rename to tests/introspection/Entitlements.plist diff --git a/tests/introspection/iOS/Info.plist b/tests/introspection/Info.plist similarity index 100% rename from tests/introspection/iOS/Info.plist rename to tests/introspection/Info.plist diff --git a/tests/introspection/iOS/LaunchScreen.storyboard b/tests/introspection/LaunchScreen.storyboard similarity index 100% rename from tests/introspection/iOS/LaunchScreen.storyboard rename to tests/introspection/LaunchScreen.storyboard diff --git a/tests/introspection/Mac/Info.plist b/tests/introspection/Mac/Info.plist deleted file mode 100644 index e8fbeb80a54d..000000000000 --- a/tests/introspection/Mac/Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDisplayName - apitest - CFBundleIdentifier - com.xamarin.introspection - CFBundleVersion - 1 - CFBundleDevelopmentRegion - en - LSMinimumSystemVersion - 12.0 - NSPrincipalClass - NSApplication - LSApplicationCategoryType - public.app-category.developer-tools - CFBundleName - introspection - LSUIElement - 1 - NSAppleMusicUsageDescription - Testing tastes - NSCameraUsageDescription - Smile! - NSContactsUsageDescription - Testing friends - NSHomeKitUsageDescription - Testing roofs - NSMicrophoneUsageDescription - Testing mike - NSPhotoLibraryUsageDescription - Testing lens - - diff --git a/tests/introspection/Mac/MacApiPInvokeTest.cs b/tests/introspection/Mac/MacApiPInvokeTest.cs deleted file mode 100644 index 3fc2317200c9..000000000000 --- a/tests/introspection/Mac/MacApiPInvokeTest.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Linq; -using System.Reflection; - -using NUnit.Framework; -using Xamarin.Tests; - -namespace Introspection { - - [TestFixture] - public class MacApiPInvokeTest : ApiPInvokeTest { - protected override bool SkipLibrary (string libraryName) - { - switch (libraryName) { - case "/System/Library/Frameworks/OpenGL.framework/OpenGL": - return true; - } - return base.SkipLibrary (libraryName); - } - - static bool IsUnified { - get { - return AppDomain.CurrentDomain.GetAssemblies ().Any (x => x.FullName.Contains ("Xamarin.Mac")); - } - } - - protected override bool Skip (Type type) - { - string typeName = type.ToString (); - bool is32Bit = IntPtr.Size == 4; - if (is32Bit && typeName.StartsWith ("MapKit", StringComparison.Ordinal)) // MapKit is 64-bit only - return true; - - switch (type.Namespace) { - case "SceneKit": - case "MonoMac.SceneKit": - if (is32Bit) - return true; - break; - } - - switch (typeName) { - case "MonoMac.GameController.GCExtendedGamepadSnapshot": // These next 4 are in the compat API, even if they don't work. - case "MonoMac.GameController.GCGamepadSnapshot": - case "MonoMac.GameController.GCExtendedGamepadSnapShotDataV100": - case "MonoMac.GameController.GCGamepadSnapShotDataV100": - return !IsUnified; - case "GameController.GCGamepadSnapShotDataV100": // These are 64-bit only - case "GameController.GCExtendedGamepadSnapShotDataV100": - return is32Bit; - case "MonoMac.AudioToolbox.AudioSession": // These are iOS APIs that were mistakenly pulled into OSX. Removed in unified but not classic - case "MonoMac.AudioUnit.AudioUnitUtils": - return !IsUnified; // If these are in unified, don't skip, we want to scream - } - - return base.Skip (type); - } - - protected override bool Skip (string symbolName) - { - switch (symbolName) { - case "SKTerminateForInvalidReceipt": // Only there for API compat - return !IsUnified; - } - return base.Skip (symbolName); - } - - protected override bool SkipAssembly (Assembly a) - { - // too many things are missing from XM 32bits bindings - // and the BCL is identical for 64 bits (no need to test it 3 times) - // return IntPtr.Size == 4; - return true; // skip everything until fixed - } - } -} diff --git a/tests/introspection/Mac/MacApiTypoTest.cs b/tests/introspection/Mac/MacApiTypoTest.cs deleted file mode 100644 index 9739b1d3ff08..000000000000 --- a/tests/introspection/Mac/MacApiTypoTest.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using NUnit.Framework; - -using Foundation; -using ObjCRuntime; -using AppKit; - -namespace Introspection { - - [TestFixture] - public class MacApiTypoTest : ApiTypoTest { - NSSpellChecker checker; - - public override void TypoTest () - { - AssertMatchingOSVersionAndSdkVersion (); - checker = new NSSpellChecker (); - - base.TypoTest (); - } - - public override string GetTypo (string txt) - { - var checkRange = new NSRange (0, txt.Length); - nint wordCount; - var typoRange = checker.CheckSpelling (txt, 0, "en_US", false, 0, out wordCount); - if (typoRange.Length == 0) - return String.Empty; - return txt.Substring ((int) typoRange.Location, (int) typoRange.Length); - } - -#if !NET - public override bool Skip (Type baseType, string typo) - { - if (baseType == typeof (NSSpellCheckerCanidates)) - return true; - - return base.Skip (baseType, typo); - } -#endif - } -} diff --git a/tests/introspection/Mac/introspection-mac.csproj b/tests/introspection/Mac/introspection-mac.csproj deleted file mode 100644 index 7119a988ade4..000000000000 --- a/tests/introspection/Mac/introspection-mac.csproj +++ /dev/null @@ -1,162 +0,0 @@ - - - - Debug - x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071} - {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - introspection - introspection - Resources - v2.0 - obj\$(Platform)\$(Configuration) - Xamarin.Mac - x86_64 - - PackageReference - latest - true - - - true - full - false - bin\x86\Debug - DEBUG;MONOMAC;$(DefineConstants) - prompt - 0 - true - Mac Developer - false - false - false - false - x86 - 3rd Party Mac Developer Installer - - - true - bin\x86\Release - MONOMAC;$(DefineConstants) - prompt - 0 - true - Developer ID Application - true - false - true - false - SdkOnly - x86 - - - - - - - - - - - - - - - - - - - - - ApiBaseTest.cs - - - ApiClassPtrTest.cs - - - ApiCoreImageFiltersTest.cs - - - ApiCtorInitTest.cs - - - ApiFieldTest.cs - - - ApiPInvokeTest.cs - - - ApiProtocolTest.cs - - - ApiSelectorTest.cs - - - ApiSignatureTest.cs - - - ApiStructTest.cs - - - ApiTypoTest.cs - - - ApiWeakPropertyTest.cs - - - CoreSelectorTest.cs - - - EnvironmentVariable.cs - - - PlatformInfo.cs - - - MacMain.cs - - - Mac.cs - - - TestRuntime.cs - - - MonoNativeConfig.cs - - - - ApiAvailabilityTest.cs - - - ApplePlatform.cs - - - Frameworks.cs - - - SdkVersions.cs - - - TestAssemblyLoader.cs - - - ApiFrameworkTest.cs - - - ApiTypeTest.cs - - - - - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06} - Touch.Client-macOS-mobile - - - - - - - - diff --git a/tests/introspection/Mac/MacApiCtorInitTest.cs b/tests/introspection/MacApiCtorInitTest.cs similarity index 99% rename from tests/introspection/Mac/MacApiCtorInitTest.cs rename to tests/introspection/MacApiCtorInitTest.cs index df2091b7d583..98cdb0fde6ac 100644 --- a/tests/introspection/Mac/MacApiCtorInitTest.cs +++ b/tests/introspection/MacApiCtorInitTest.cs @@ -36,11 +36,6 @@ protected override bool Skip (Attribute attr) protected override bool Skip (Type type) { switch (type.FullName) { -#if !NET - case "AppKit.NSDraggingInfo": - case "MonoMac.AppKit.NSDraggingInfo": // binding mistakes. - return true; -#endif // Random failures on build machine case "QuickLookUI.QLPreviewPanel": case "MonoMac.QuickLookUI.QLPreviewPanel": diff --git a/tests/introspection/Mac/MacApiFieldTest.cs b/tests/introspection/MacApiFieldTest.cs similarity index 92% rename from tests/introspection/Mac/MacApiFieldTest.cs rename to tests/introspection/MacApiFieldTest.cs index 62d57aa1503f..b39405b1e4d2 100644 --- a/tests/introspection/Mac/MacApiFieldTest.cs +++ b/tests/introspection/MacApiFieldTest.cs @@ -175,27 +175,6 @@ protected override bool Skip (string constantName, string libraryName) } } - protected override bool SkipNotification (Type declaredType, string notificationName) - { - switch (declaredType.Name) { -#if !NET - case "NSWorkspaceAccessibilityNotifications": - case "NSAccessibilityNotifications": - return true; - case "AVFragmentedMovieTrack": - switch (notificationName) { - case "AVFragmentedMovieTrackTotalSampleDataLengthDidChangeNotification": - case "AVFragmentedMovieTrackTimeRangeDidChangeNotification": - return true; - } - break; - case "NSTask": - return notificationName == "NSTaskDidTerminateNotification"; -#endif - } - return base.SkipNotification (declaredType, notificationName); - } - protected override string FindLibrary (string libraryName, bool requiresFullPath = false) { switch (libraryName) { diff --git a/tests/introspection/MacApiPInvokeTest.cs b/tests/introspection/MacApiPInvokeTest.cs new file mode 100644 index 000000000000..f98ae958fefe --- /dev/null +++ b/tests/introspection/MacApiPInvokeTest.cs @@ -0,0 +1,29 @@ +using System; +using System.Linq; +using System.Reflection; + +using NUnit.Framework; +using Xamarin.Tests; + +namespace Introspection { + + [TestFixture] + public class MacApiPInvokeTest : ApiPInvokeTest { + protected override bool SkipLibrary (string libraryName) + { + switch (libraryName) { + case "/System/Library/Frameworks/OpenGL.framework/OpenGL": + return true; + } + return base.SkipLibrary (libraryName); + } + + protected override bool SkipAssembly (Assembly a) + { + // too many things are missing from XM 32bits bindings + // and the BCL is identical for 64 bits (no need to test it 3 times) + // return IntPtr.Size == 4; + return true; // skip everything until fixed + } + } +} diff --git a/tests/introspection/Mac/MacApiProtocolTest.cs b/tests/introspection/MacApiProtocolTest.cs similarity index 94% rename from tests/introspection/Mac/MacApiProtocolTest.cs rename to tests/introspection/MacApiProtocolTest.cs index f66faae37722..271bc6f55860 100644 --- a/tests/introspection/Mac/MacApiProtocolTest.cs +++ b/tests/introspection/MacApiProtocolTest.cs @@ -23,20 +23,7 @@ public class MacApiProtocolTest : ApiProtocolTest { protected override bool Skip (Type type) { -#if !NET - switch (type.Namespace) { - case "Chip": - // The Chip framework is not stable, it's been added and removed and added and removed a few times already, so just skip verifying the entire framework. - // This is legacy Xamarin only, because we removed the framework for .NET. - return true; - } -#endif - switch (type.Name) { -#if !NET - case "NSDraggingInfo": - return true; // Incorrectly bound (BaseType on protocol), will be fixed for .NET. -#endif // special cases wrt sandboxing case "NSRemoteOpenPanel": case "NSRemoteSavePanel": @@ -45,10 +32,6 @@ protected override bool Skip (Type type) case "AVCaptureSynchronizedData": case "CXProvider": return TestRuntime.IsVM; // skip only on vms -#if !NET // NSMenuView does not exist in .NET - case "NSMenuView": // not longer supported - return true; -#endif // !NET case "ASAuthorizationProviderExtensionRegistrationHandler": return true; default: @@ -346,10 +329,6 @@ protected override bool Skip (Type type, string protocolName) if (type.Name == "NSTextView") return true; break; -#if !NET - case "NSDraggingInfo": - return true; // We have to keep the type to maintain backwards compatibility. -#endif case "NSAccessibility": case "NSAccessibilityElement": switch (type.Name) { @@ -434,14 +413,6 @@ protected override bool Skip (Type type, string protocolName) break; } - switch (type.Name) { -#if !XAMCORE_3_0 - case "NSRemoteSavePanel": - case "NSRemoteOpenPanel": - return true; // These two classes don't show up in any documentation. -#endif - } - switch (type.Namespace) { case "MonoMac.SceneKit": case "SceneKit": diff --git a/tests/introspection/Mac/MacApiSelectorTest.cs b/tests/introspection/MacApiSelectorTest.cs similarity index 93% rename from tests/introspection/Mac/MacApiSelectorTest.cs rename to tests/introspection/MacApiSelectorTest.cs index 5d0f2ff513f9..779550959ba9 100644 --- a/tests/introspection/Mac/MacApiSelectorTest.cs +++ b/tests/introspection/MacApiSelectorTest.cs @@ -117,12 +117,6 @@ protected override bool Skip (Type type) if (Mac.CheckSystemVersion (10, 15)) return true; break; -#if !NET - case "Chip": - // The Chip framework is not stable, it's been added and removed and added and removed a few times already, so just skip verifying the entire framework. - // This is legacy Xamarin only, because we removed the framework for .NET. - return true; -#endif } return base.Skip (type); @@ -154,17 +148,6 @@ protected override bool Skip (Type type, string selectorName) // The header declares this on an NSObject category but // it doesn't even respondsToSelector on NSView/NSCell... return true; -#if !NET - case "xamarinselector:removed:": - return true; -#endif -#if !XAMCORE_3_0 - case "initWithPasteboardPropertyList:ofType:": - // This is a broken binding, but it's an abstract protocol - // method, so there's no way to remove it without breaking - // compat. - return true; -#endif case "readInBackgroundAndNotifyForModes:": case "readInBackgroundAndNotify": case "readToEndOfFileInBackgroundAndNotifyForModes:": @@ -434,47 +417,6 @@ protected override bool Skip (Type type, string selectorName) return true; } break; -#if !NET // NSMenuView does not exist in .NET - case "NSMenuView": - switch (selectorName) { - case "menuBarHeight": - return TestRuntime.IsVM; // skip on vms due to hadware problems - } - break; -#endif // !NET -#if !NET // These should be not be marked [Abstract] but can't fix w/o breaking change... - case "NSScrollView": - case "NSTextView": - switch (selectorName) { - case "contentViewAtIndex:effectiveCharacterRange:": - case "didReplaceCharacters": - case "drawCharactersInRange:forContentView:": - case "rectsForCharacterRange:": - case "replaceCharactersInRange:withString:": - case "scrollRangeToVisible:": - case "shouldReplaceCharactersInRanges:withStrings:": - case "stringAtIndex:effectiveRange:endsWithSearchBoundary:": - case "stringLength": - case "allowsMultipleSelection": - case "isEditable": - case "firstSelectedRange": - case "isSelectable": - case "selectedRanges": - case "setSelectedRanges:": - case "string": - case "visibleCharacterRanges": - return true; - } - break; -#endif - case "NSMenuDelegate": - switch (selectorName) { -#if !NET - case "menu:willHighlightItem:": - return true; // bound -#endif - } - break; case "NSResponder": switch (selectorName) { case "smartMagnifyWithEvent:": @@ -640,14 +582,6 @@ protected override bool Skip (Type type, string selectorName) if (selectorName == "encodeWithCoder:" && !Mac.CheckSystemVersion (10, 8)) return true; break; - case "PdfView": - switch (selectorName) { -#if !NET - case "menu:willHighlightItem:": - return true; -#endif - } - break; } break; case "MonoMac.SceneKit": @@ -756,7 +690,6 @@ protected override bool Skip (Type type, string selectorName) return true; } break; - break; } break; case "Metal": @@ -1089,7 +1022,7 @@ protected override void Dispose (NSObject obj, Type type) protected override bool CheckResponse (bool value, Type actualType, MethodBase method, ref string name) { - var declaredType = method.DeclaringType; + var declaredType = method.DeclaringType!; switch (name) { // NSDraggingDestination protocol @@ -1322,27 +1255,6 @@ protected override bool CheckStaticResponse (bool value, Type actualType, Type d protected override bool SkipInit (string selector, MethodBase m) { switch (selector) { -#if !XAMCORE_3_0 - // DomEvent - case "initEvent:canBubbleArg:cancelableArg:": - // DomOverflowEvent - case "initOverflowEvent:horizontalOverflow:verticalOverflow:": - // DomUIEvent - case "initUIEvent:canBubble:cancelable:view:detail:": - // DomKeyboardEvent - case "initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:altGraphKey:": - case "initKeyboardEvent:canBubble:cancelable:view:keyIdentifier:keyLocation:ctrlKey:altKey:shiftKey:metaKey:": - // DomMouseEvent - case "initMouseEvent:canBubble:cancelable:view:detail:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:button:relatedTarget:": - // DomWheelEvent - case "initWheelEvent:wheelDeltaY:view:screenX:screenY:clientX:clientY:ctrlKey:altKey:shiftKey:metaKey:": - // QTMovie - case "movieWithTimeRange:error:": - case "initWithQuickTimeMedia:error:": - // NSAnimation - case "initWithDuration:animationCurve:": - return true; -#endif // Cinematic.CNDecision case "initWithTime:detectionGroupID:strong:": case "initWithTime:detectionID:strong:": diff --git a/tests/introspection/Mac/MacApiSignatureTest.cs b/tests/introspection/MacApiSignatureTest.cs similarity index 96% rename from tests/introspection/Mac/MacApiSignatureTest.cs rename to tests/introspection/MacApiSignatureTest.cs index d6a00963887d..88c9db01e086 100644 --- a/tests/introspection/Mac/MacApiSignatureTest.cs +++ b/tests/introspection/MacApiSignatureTest.cs @@ -242,19 +242,6 @@ protected override bool Check (char encodedType, Type type) return base.Check (encodedType, type); } -#if !NET - protected override bool CheckType (Type t, ref int n) - { - switch (t.Name) { - case "NSPasteboardReading": - case "NSPasteboardWriting": - return true; - } - - return base.CheckType (t, ref n); - } -#endif - protected override void CheckManagedMemberSignatures (MethodBase m, Type t, ref int n) { #if !XAMCORE_5_0 // let's review the tests exceptions if we break things @@ -265,13 +252,6 @@ protected override void CheckManagedMemberSignatures (MethodBase m, Type t, ref if (t.Name == "NSTableView") return; break; -#if !NET - case "AddEventListener": - // Fixed in NET - if (t.Name == "DomNode") - return; - break; -#endif // !NET } #endif // XAMCORE_5_0 base.CheckManagedMemberSignatures (m, t, ref n); diff --git a/tests/introspection/MacApiTypoTest.cs b/tests/introspection/MacApiTypoTest.cs new file mode 100644 index 000000000000..18358f71590b --- /dev/null +++ b/tests/introspection/MacApiTypoTest.cs @@ -0,0 +1,32 @@ +using System; +using NUnit.Framework; + +using Foundation; +using ObjCRuntime; +using AppKit; + +namespace Introspection { + + [TestFixture] + public class MacApiTypoTest : ApiTypoTest { + NSSpellChecker? checker; + + public override void TypoTest () + { + AssertMatchingOSVersionAndSdkVersion (); + checker = new NSSpellChecker (); + + base.TypoTest (); + } + + public override string GetTypo (string txt) + { + var checkRange = new NSRange (0, txt.Length); + nint wordCount; + var typoRange = checker!.CheckSpelling (txt, 0, "en_US", false, 0, out wordCount); + if (typoRange.Length == 0) + return String.Empty; + return txt.Substring ((int) typoRange.Location, (int) typoRange.Length); + } + } +} diff --git a/tests/introspection/Mac/MacApiWeakPropertyTest.cs b/tests/introspection/MacApiWeakPropertyTest.cs similarity index 100% rename from tests/introspection/Mac/MacApiWeakPropertyTest.cs rename to tests/introspection/MacApiWeakPropertyTest.cs diff --git a/tests/introspection/Mac/MacCoreImageFiltersTest.cs b/tests/introspection/MacCoreImageFiltersTest.cs similarity index 100% rename from tests/introspection/Mac/MacCoreImageFiltersTest.cs rename to tests/introspection/MacCoreImageFiltersTest.cs diff --git a/tests/introspection/README.md b/tests/introspection/README.md index e53dab14a935..3208484b3653 100644 --- a/tests/introspection/README.md +++ b/tests/introspection/README.md @@ -1,11 +1,11 @@ # Introspection Tests -Introspection tests are executed on target (both simulator and device for -iOS) or a specific version of OSX. The application proceed to analyze itself -using: +Introspection tests are executed on specific target (both simulator and device +for iOS and tvOS) or a specific version of macOS or Mac Catalyst. The +application proceed to analyze itself using: * `System.Reflection` for managed code; and -* the ObjectiveC runtime library for native code +* the Objective-C runtime library for native code and compare the results. E.g. if using .NET reflection it can see a binding for a `NSBundle` type then it should be able to find a native `NSBundle` @@ -13,7 +13,7 @@ type using the ObjC runtime functions. Otherwise an error is raised... Since the application analyze itself it must contains everything we wish to test. That's why the introspection tests needs to be built with the -managed linker disable, i.e. **"Don't link"**. +managed linker disabled, i.e. **"Don't link"**. Pros diff --git a/tests/introspection/dotnet/shared.csproj b/tests/introspection/dotnet/shared.csproj index c787b358fcf5..66feb03fde64 100644 --- a/tests/introspection/dotnet/shared.csproj +++ b/tests/introspection/dotnet/shared.csproj @@ -15,20 +15,29 @@ true $(DefineConstants);DEBUG + + enable + + + $(NoWarn);CA1422 + + + true + Nullable - - - - - - - - - + + + + + + + + + MacMain.cs @@ -39,33 +48,33 @@ - - - - - - - - - - + + + + + + + + + + ApiCMAttachmentTest.cs - + - - - - - - - - - - + + + + + + + + + + @@ -111,18 +120,12 @@ EnvironmentVariable.cs - - MonoNativeConfig.cs - PlatformInfo.cs TestRuntime.cs - - ApiAvailabilityTest.cs - Frameworks.cs diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/Contents.json b/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/Contents.json deleted file mode 100644 index 6be52c8f7640..000000000000 --- a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/Contents.json +++ /dev/null @@ -1,221 +0,0 @@ -{ - "images": [ - { - "size": "29x29", - "scale": "1x", - "idiom": "iphone" - }, - { - "size": "29x29", - "scale": "2x", - "idiom": "iphone" - }, - { - "size": "29x29", - "scale": "3x", - "idiom": "iphone" - }, - { - "size": "40x40", - "scale": "2x", - "idiom": "iphone" - }, - { - "size": "40x40", - "scale": "3x", - "idiom": "iphone" - }, - { - "filename": "icon-app-57.png", - "size": "57x57", - "scale": "1x", - "idiom": "iphone" - }, - { - "filename": "icon-app-57@2x.png", - "size": "57x57", - "scale": "2x", - "idiom": "iphone" - }, - { - "filename": "icon-app-60@2x.png", - "size": "60x60", - "scale": "2x", - "idiom": "iphone" - }, - { - "filename": "icon-app-60@3x.png", - "size": "60x60", - "scale": "3x", - "idiom": "iphone" - }, - { - "size": "29x29", - "scale": "1x", - "idiom": "ipad" - }, - { - "size": "29x29", - "scale": "2x", - "idiom": "ipad" - }, - { - "size": "40x40", - "scale": "1x", - "idiom": "ipad" - }, - { - "size": "40x40", - "scale": "2x", - "idiom": "ipad" - }, - { - "size": "50x50", - "scale": "1x", - "idiom": "ipad" - }, - { - "size": "50x50", - "scale": "2x", - "idiom": "ipad" - }, - { - "filename": "icon-app-83.5@2x.png", - "size": "83.5x83.5", - "scale": "2x", - "idiom": "ipad" - }, - { - "filename": "icon-app-72.png", - "size": "72x72", - "scale": "1x", - "idiom": "ipad" - }, - { - "filename": "icon-app-72@2x.png", - "size": "72x72", - "scale": "2x", - "idiom": "ipad" - }, - { - "filename": "icon-app-76.png", - "size": "76x76", - "scale": "1x", - "idiom": "ipad" - }, - { - "filename": "icon-app-76@2x.png", - "size": "76x76", - "scale": "2x", - "idiom": "ipad" - }, - { - "role": "notificationCenter", - "size": "24x24", - "subtype": "38mm", - "scale": "2x", - "idiom": "watch" - }, - { - "role": "notificationCenter", - "size": "27.5x27.5", - "subtype": "42mm", - "scale": "2x", - "idiom": "watch" - }, - { - "role": "companionSettings", - "size": "29x29", - "scale": "2x", - "idiom": "watch" - }, - { - "role": "companionSettings", - "size": "29x29", - "scale": "3x", - "idiom": "watch" - }, - { - "role": "appLauncher", - "size": "40x40", - "subtype": "38mm", - "scale": "2x", - "idiom": "watch" - }, - { - "role": "longLook", - "size": "44x44", - "subtype": "42mm", - "scale": "2x", - "idiom": "watch" - }, - { - "role": "quickLook", - "size": "86x86", - "subtype": "38mm", - "scale": "2x", - "idiom": "watch" - }, - { - "role": "quickLook", - "size": "98x98", - "subtype": "42mm", - "scale": "2x", - "idiom": "watch" - }, - { - "size": "16x16", - "scale": "1x", - "idiom": "mac" - }, - { - "size": "16x16", - "scale": "2x", - "idiom": "mac" - }, - { - "size": "32x32", - "scale": "1x", - "idiom": "mac" - }, - { - "size": "32x32", - "scale": "2x", - "idiom": "mac" - }, - { - "size": "128x128", - "scale": "1x", - "idiom": "mac" - }, - { - "size": "128x128", - "scale": "2x", - "idiom": "mac" - }, - { - "size": "256x256", - "scale": "1x", - "idiom": "mac" - }, - { - "size": "256x256", - "scale": "2x", - "idiom": "mac" - }, - { - "size": "512x512", - "scale": "1x", - "idiom": "mac" - }, - { - "size": "512x512", - "scale": "2x", - "idiom": "mac" - } - ], - "info": { - "version": 1, - "author": "xcode" - } -} \ No newline at end of file diff --git a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png b/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png deleted file mode 100644 index 45342a7513b6..000000000000 Binary files a/tests/introspection/iOS/Assets.xcassets/AppIcons.appiconset/Icon-app-60@3x.png and /dev/null differ diff --git a/tests/introspection/iOS/introspection-ios.csproj b/tests/introspection/iOS/introspection-ios.csproj deleted file mode 100644 index 56901f7b3870..000000000000 --- a/tests/introspection/iOS/introspection-ios.csproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - Debug - iPhoneSimulator - 8.0.30703 - 2.0 - {208744BD-504E-47D7-9A98-1CF02454A6DA} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Introspection - introspection - Xamarin.iOS - obj\$(Platform)\$(Configuration)-unified - - latest - PackageReference - ..\.. - true - - - True - full - False - bin\iPhoneSimulator\$(Configuration)-unified - DEBUG;MONOTOUCH;MONO_NATIVE_SYMLINK;$(DefineConstants) - prompt - 0 - None - True - -v -v - x86_64 - iPhone Developer - - - none - False - bin\iPhoneSimulator\$(Configuration)-unified - prompt - 0 - None - -v -v -gcc_flags="-weak_framework GameController" - x86_64 - MONOTOUCH;MONO_NATIVE_STATIC;$(DefineConstants) - - - True - full - False - bin\iPhone\$(Configuration)-unified - DEBUG;MONOTOUCH;MONO_NATIVE_STATIC;$(DefineConstants) - prompt - 0 - True - iPhone Developer - None - - ARM64 - true - - - none - False - bin\iPhone\$(Configuration)-unified - prompt - 0 - iPhone Developer - -v -v - True - None - ARM64 - MONOTOUCH;MONO_NATIVE_STATIC;$(DefineConstants) - true - - - $(RootTestsDirectory)\..\src\rsp\ios-defines.rsp - $(RootTestsDirectory)\..\src\rsp\tvos-defines.rsp - $(RootTestsDirectory)\..\src\rsp\watchos-defines.rsp - $(RootTestsDirectory)\..\src\rsp\maccatalyst-defines.rsp - - - - - - - - - - {F611ED96-54B5-4975-99BB-12F50AF95936} - Touch.Client-iOS - - - - - - - - - - - - - - - - - ApiBaseTest.cs - - - ApiClassPtrTest.cs - - - ApiCMAttachmentTest.cs - - - ApiCoreImageFiltersTest.cs - - - ApiCtorInitTest.cs - - - ApiFieldTest.cs - - - ApiPInvokeTest.cs - - - ApiProtocolTest.cs - - - ApiSelectorTest.cs - - - ApiSignatureTest.cs - - - ApiStructTest.cs - - - ApiTypoTest.cs - - - ApiWeakPropertyTest.cs - - - CoreSelectorTest.cs - - - EnvironmentVariable.cs - - - MonoNativeConfig.cs - - - PlatformInfo.cs - - - TestRuntime.cs - - - ApiAvailabilityTest.cs - - - ApplePlatform.cs - - - Frameworks.cs - - - SdkVersions.cs - - - ApiFrameworkTest.cs - - - ApiTypeTest.cs - - - - - Info.plist - - - - - - - - - - - - - - - - - - - - xamarin1.png - - - simlauncher64-sgen.frameworks - - - - - diff --git a/tests/introspection/iOS/iOSApiClassPtrTest.cs b/tests/introspection/iOSApiClassPtrTest.cs similarity index 91% rename from tests/introspection/iOS/iOSApiClassPtrTest.cs rename to tests/introspection/iOSApiClassPtrTest.cs index 9453de33d3eb..8f5b606da26e 100644 --- a/tests/introspection/iOS/iOSApiClassPtrTest.cs +++ b/tests/introspection/iOSApiClassPtrTest.cs @@ -27,12 +27,6 @@ protected override bool Skip (Type type) if (TestRuntime.IsSimulatorOrDesktop) return true; break; -#if __WATCHOS__ - case "GameKit": - if (IntPtr.Size == 4) - return true; - break; -#endif } // While the following types are categories and contains a class_ptr diff --git a/tests/introspection/iOS/iOSApiCtorInitTest.cs b/tests/introspection/iOSApiCtorInitTest.cs similarity index 94% rename from tests/introspection/iOS/iOSApiCtorInitTest.cs rename to tests/introspection/iOSApiCtorInitTest.cs index 723a679f7692..2a5923076e14 100644 --- a/tests/introspection/iOS/iOSApiCtorInitTest.cs +++ b/tests/introspection/iOSApiCtorInitTest.cs @@ -14,9 +14,7 @@ using PassKit; #endif using Foundation; -#if !__WATCHOS__ using Metal; -#endif using ObjCRuntime; using UIKit; @@ -53,7 +51,6 @@ protected override bool Skip (Type type) if (TestRuntime.IsSimulatorOrDesktop && !TestRuntime.CheckXcodeVersion (7, 0)) return true; break; -#if !__WATCHOS__ case "MetalKit": case "MonoTouch.MetalKit": case "MetalPerformanceShaders": @@ -64,7 +61,6 @@ protected override bool Skip (Type type) if (!TestRuntime.CheckXcodeVersion (7, 0) || (MTLDevice.SystemDefault is null)) return true; break; -#endif // !__WATCHOS__ #if __TVOS__ case "MetalPerformanceShadersGraph": if (TestRuntime.IsSimulatorOrDesktop) @@ -96,11 +92,9 @@ protected override bool Skip (Type type) return true; // Objective-C exception thrown. Name: NSInvalidArgumentException Reason: UISplitViewController is only supported when running under UIUserInterfaceIdiomPad case "UISplitViewController": -#if !__WATCHOS__ // Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: ADInterstitialAd is available on iPad only. case "ADInterstitialAd": return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; -#endif case "UIVideoEditorController": return true; @@ -184,28 +178,11 @@ protected override bool Skip (Type type) case "MTLHeapDescriptor": case "MTLSharedEventListener": return TestRuntime.IsSimulatorOrDesktop; -#if __WATCHOS__ - // The following watchOS 3.2 Beta 2 types Fails, but they can be created we verified using an ObjC app, we will revisit before stable - case "INRequestPaymentIntent": - case "INRequestRideIntent": - case "INResumeWorkoutIntent": - case "INRideVehicle": - case "INSearchCallHistoryIntent": - case "INSearchForMessagesIntent": - case "INSearchForPhotosIntent": - case "INSendMessageIntent": - case "INSendPaymentIntent": - case "INStartAudioCallIntent": - case "INStartPhotoPlaybackIntent": - case "INStartWorkoutIntent": - case "CLKComplicationWidgetMigrator": // Only available on device - return true; -#endif // iOS 11 Beta 1 case "UICollectionViewFocusUpdateContext": // [Assert] -init is not a useful initializer for this class. Use one of the designated initializers instead case "UIFocusUpdateContext": // [Assert] -init is not a useful initializer for this class. Use one of the designated initializers instead case "EKCalendarItem": // Fails with NSInvalidArgumentException +[EKCalendarItem frozenClass]: unrecognized selector sent to class, will fill a radar - case "EKParticipant": // ctor disabled in XAMCORE_3_0 + case "EKParticipant": case "UITableViewFocusUpdateContext": // Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Invalid parameter not satisfying: focusSystem, will fill a radar return true; case "INBookRestaurantReservationIntentResponse": // iOS 11 beta 2: stack overflow in description. radar:32945914 @@ -222,10 +199,6 @@ protected override bool Skip (Type type) case "INGetRestaurantGuestIntentResponse": // Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Unable to initialize 'INGetRestaurantGuestIntentResponse'. Please make sure that your intent definition file is valid. return TestRuntime.CheckXcodeVersion (10, 0); case "CMMovementDisorderManager": // Not available in simulator, added info to radar://41110708 -#if __WATCHOS__ - // Doesn't exist in the simulator; aborts on device if the required entitlement isn't available. - return true; -#endif return TestRuntime.IsSimulatorOrDesktop; case "RPSystemBroadcastPickerView": // Symbol not available in simulator return TestRuntime.IsSimulatorOrDesktop; @@ -243,7 +216,7 @@ protected override bool Skip (Type type) // MPSPredicate.mm:102: failed assertion `[MPSPredicate initWithBuffer:offset:] device: Apple A8 GPU does not support predication.' return (TestRuntime.IsDevice && (UIScreen.MainScreen.NativeBounds.Width <= 1920)); #endif -#if __TVOS__ || __WATCHOS__ +#if __TVOS__ case "NSMetadataQuery": // hangs on xcode 13 beta 1 on simulator if (TestRuntime.CheckXcodeVersion (13, 0)) diff --git a/tests/introspection/iOS/iOSApiFieldTest.cs b/tests/introspection/iOSApiFieldTest.cs similarity index 97% rename from tests/introspection/iOS/iOSApiFieldTest.cs rename to tests/introspection/iOSApiFieldTest.cs index 6890864add48..329b55e2f848 100644 --- a/tests/introspection/iOS/iOSApiFieldTest.cs +++ b/tests/introspection/iOSApiFieldTest.cs @@ -14,6 +14,9 @@ using UIKit; using NUnit.Framework; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [TestFixture] @@ -166,10 +169,6 @@ protected override bool Skip (string constantName, string libraryName) // Xcode 12.2 Beta 1 does not ship this but it is available in Xcode 12.0... case "HKMetadataKeyBarometricPressure": return true; -#if __WATCHOS__ - case "AVCaptureLensPositionCurrent": // looks like this was bound by mistake in watchOS - return true; -#endif default: return false; } diff --git a/tests/introspection/iOS/iOSApiPInvokeTest.cs b/tests/introspection/iOSApiPInvokeTest.cs similarity index 96% rename from tests/introspection/iOS/iOSApiPInvokeTest.cs rename to tests/introspection/iOSApiPInvokeTest.cs index 3713c6e0255a..d145785ff124 100644 --- a/tests/introspection/iOS/iOSApiPInvokeTest.cs +++ b/tests/introspection/iOSApiPInvokeTest.cs @@ -29,10 +29,8 @@ protected override bool Skip (string symbolName) var simulator = TestRuntime.IsSimulatorOrDesktop; switch (symbolName) { // Metal support inside simulator is only available in recent iOS9 SDK -#if !__WATCHOS__ case "MTLCreateSystemDefaultDevice": return simulator && !UIDevice.CurrentDevice.CheckSystemVersion (9, 0); -#endif // still most Metal helpers are not available on the simulator (even when the framework is present, it's missing symbols) case "MPSSupportsMTLDevice": case "MPSGetPreferredDevice": @@ -78,10 +76,7 @@ protected override bool SkipAssembly (Assembly a) // we only want to check this on a version of iOS that // 1. is the current SDK target (or a newer one) var sdk = new Version (Constants.SdkVersion); -#if __WATCHOS__ - if (!TestRuntime.CheckSystemVersion (ApplePlatform.WatchOS, sdk.Major, sdk.Minor)) - return true; -#elif __IOS__ || __TVOS__ +#if __IOS__ || __TVOS__ if (!UIDevice.CurrentDevice.CheckSystemVersion (sdk.Major, sdk.Minor)) return true; #else diff --git a/tests/introspection/iOS/iOSApiProtocolTest.cs b/tests/introspection/iOSApiProtocolTest.cs similarity index 80% rename from tests/introspection/iOS/iOSApiProtocolTest.cs rename to tests/introspection/iOSApiProtocolTest.cs index 8d7c19d5c7a0..656579917953 100644 --- a/tests/introspection/iOS/iOSApiProtocolTest.cs +++ b/tests/introspection/iOSApiProtocolTest.cs @@ -101,17 +101,6 @@ protected override bool Skip (Type type) // but that web page doesn't explain anything (it's mostly empty, so this is probably just lagging documentation) // I also tried enabling every entitlement in Xcode, but it still didn't work. return true; -#if __WATCHOS__ && !NET - case "INCarAirCirculationModeResolutionResult": - case "INCarAudioSourceResolutionResult": - case "INCarDefrosterResolutionResult": - case "INCarSeatResolutionResult": - case "INRadioTypeResolutionResult": - case "INRelativeSettingResolutionResult": - case "INRelativeReferenceResolutionResult": - // These were bound by mistake, and they're gone in NET. - return true; -#endif case "SNClassificationResult": // Class is not being created properly return true; case "SNClassifySoundRequest": // Class is not being created properly @@ -173,13 +162,6 @@ protected override bool Skip (Type type, string protocolName) switch (type.Name) { case "CAMetalLayer": return TestRuntime.IsSimulatorOrDesktop && !TestRuntime.CheckXcodeVersion (11, 0); -#if !XAMCORE_3_0 - // mistake (base type) fixed by a breaking change - case "MFMailComposeViewControllerDelegate": - if (protocolName == "UINavigationControllerDelegate") - return true; - break; -#endif // special case: the Delegate property is id so we made A subclass B in managed // but this test see the conformance is not correct case "UIImagePickerControllerDelegate": @@ -394,74 +376,7 @@ protected override bool Skip (Type type, string protocolName) case "DDDevice": case "DDDeviceEvent": return true; -#if __WATCHOS__ - case "CLKComplicationTemplate": - case "CLKComplicationTemplateCircularSmallRingImage": - case "CLKComplicationTemplateCircularSmallRingText": - case "CLKComplicationTemplateCircularSmallSimpleImage": - case "CLKComplicationTemplateCircularSmallSimpleText": - case "CLKComplicationTemplateCircularSmallStackImage": - case "CLKComplicationTemplateCircularSmallStackText": - case "CLKComplicationTemplateModularLargeColumns": - case "CLKComplicationTemplateModularLargeStandardBody": - case "CLKComplicationTemplateModularLargeTable": - case "CLKComplicationTemplateModularLargeTallBody": - case "CLKComplicationTemplateModularSmallColumnsText": - case "CLKComplicationTemplateModularSmallRingImage": - case "CLKComplicationTemplateModularSmallRingText": - case "CLKComplication": - case "CLKComplicationTemplateModularSmallSimpleImage": - case "CLKTextProvider": - case "CLKComplicationTemplateModularSmallSimpleText": - case "CLKTimeIntervalTextProvider": - case "CLKComplicationTemplateModularSmallStackImage": - case "CLKTimeTextProvider": - case "CLKComplicationTemplateModularSmallStackText": - case "CLKComplicationTemplateUtilitarianLargeFlat": - case "CLKComplicationTemplateUtilitarianSmallFlat": - case "CLKComplicationTemplateUtilitarianSmallRingImage": - case "CLKComplicationTemplateUtilitarianSmallRingText": - case "CLKComplicationTemplateUtilitarianSmallSquare": - case "CLKComplicationTimelineEntry": - case "CLKDateTextProvider": - case "CLKImageProvider": - case "CLKRelativeDateTextProvider": - case "CLKSimpleTextProvider": - case "WKAlertAction": - // watchOS 3 - case "CLKComplicationTemplateExtraLargeSimpleImage": - case "CLKComplicationTemplateExtraLargeSimpleText": - case "CLKComplicationTemplateExtraLargeStackImage": - case "CLKComplicationTemplateExtraLargeStackText": - case "CLKComplicationTemplateExtraLargeColumnsText": - case "CLKComplicationTemplateExtraLargeRingImage": - case "CLKComplicationTemplateExtraLargeRingText": - // watchOS 5 / Xcode 10 GM - case "CLKComplicationTemplateGraphicBezelCircularText": - case "CLKComplicationTemplateGraphicCircular": - case "CLKComplicationTemplateGraphicCircularClosedGaugeImage": - case "CLKComplicationTemplateGraphicCircularClosedGaugeText": - case "CLKComplicationTemplateGraphicCircularImage": - case "CLKComplicationTemplateGraphicCircularOpenGaugeImage": - case "CLKComplicationTemplateGraphicCircularOpenGaugeRangeText": - case "CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText": - case "CLKComplicationTemplateGraphicCornerCircularImage": - case "CLKComplicationTemplateGraphicCornerGaugeImage": - case "CLKComplicationTemplateGraphicCornerGaugeText": - case "CLKComplicationTemplateGraphicCornerStackText": - case "CLKComplicationTemplateGraphicCornerTextImage": - case "CLKComplicationTemplateGraphicRectangularLargeImage": - case "CLKComplicationTemplateGraphicRectangularStandardBody": - case "CLKComplicationTemplateGraphicRectangularTextGauge": - case "CLKFullColorImageProvider": - case "CLKGaugeProvider": - case "CLKSimpleGaugeProvider": - case "CLKTimeIntervalGaugeProvider": - // watchOS 6 / Xcode 11 - case "CLKComplicationTemplateGraphicCircularStackImage": - case "CLKComplicationTemplateGraphicCircularStackText": - return true; -#elif __TVOS__ +#if __TVOS__ case "TVTopShelfAction": case "TVTopShelfCarouselContent": case "TVTopShelfCarouselItem": @@ -660,74 +575,7 @@ protected override bool Skip (Type type, string protocolName) case "DDDevice": case "DDDeviceEvent": return true; -#if __WATCHOS__ - case "CLKComplicationTemplate": - case "CLKComplicationTemplateCircularSmallRingImage": - case "CLKComplicationTemplateCircularSmallRingText": - case "CLKComplicationTemplateCircularSmallSimpleImage": - case "CLKComplicationTemplateCircularSmallSimpleText": - case "CLKComplicationTemplateCircularSmallStackImage": - case "CLKComplicationTemplateCircularSmallStackText": - case "CLKComplicationTemplateModularLargeColumns": - case "CLKComplicationTemplateModularLargeStandardBody": - case "CLKComplicationTemplateModularLargeTable": - case "CLKComplicationTemplateModularLargeTallBody": - case "CLKComplicationTemplateModularSmallColumnsText": - case "CLKComplicationTemplateModularSmallRingImage": - case "CLKComplicationTemplateModularSmallRingText": - case "CLKComplicationTemplateModularSmallSimpleImage": - case "CLKComplicationTemplateModularSmallSimpleText": - case "CLKComplicationTemplateModularSmallStackImage": - case "CLKComplicationTemplateModularSmallStackText": - case "CLKComplicationTemplateUtilitarianLargeFlat": - case "CLKComplicationTemplateUtilitarianSmallFlat": - case "CLKComplicationTemplateUtilitarianSmallRingImage": - case "CLKComplicationTemplateUtilitarianSmallRingText": - case "CLKComplicationTemplateUtilitarianSmallSquare": - case "CLKComplicationTimelineEntry": - case "CLKDateTextProvider": - case "CLKImageProvider": - case "CLKRelativeDateTextProvider": - case "CLKSimpleTextProvider": - case "CLKTextProvider": - case "CLKTimeIntervalTextProvider": - case "CLKTimeTextProvider": - case "CLKComplication": - case "WKAlertAction": - // watchOS 3 - case "CLKComplicationTemplateExtraLargeSimpleImage": - case "CLKComplicationTemplateExtraLargeSimpleText": - case "CLKComplicationTemplateExtraLargeStackImage": - case "CLKComplicationTemplateExtraLargeStackText": - case "CLKComplicationTemplateExtraLargeColumnsText": - case "CLKComplicationTemplateExtraLargeRingImage": - case "CLKComplicationTemplateExtraLargeRingText": - // watchOS 5 / Xcode 10 GM - case "CLKComplicationTemplateGraphicBezelCircularText": - case "CLKComplicationTemplateGraphicCircular": - case "CLKComplicationTemplateGraphicCircularClosedGaugeImage": - case "CLKComplicationTemplateGraphicCircularClosedGaugeText": - case "CLKComplicationTemplateGraphicCircularImage": - case "CLKComplicationTemplateGraphicCircularOpenGaugeImage": - case "CLKComplicationTemplateGraphicCircularOpenGaugeRangeText": - case "CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText": - case "CLKComplicationTemplateGraphicCornerCircularImage": - case "CLKComplicationTemplateGraphicCornerGaugeImage": - case "CLKComplicationTemplateGraphicCornerGaugeText": - case "CLKComplicationTemplateGraphicCornerStackText": - case "CLKComplicationTemplateGraphicCornerTextImage": - case "CLKComplicationTemplateGraphicRectangularLargeImage": - case "CLKComplicationTemplateGraphicRectangularStandardBody": - case "CLKComplicationTemplateGraphicRectangularTextGauge": - case "CLKFullColorImageProvider": - case "CLKGaugeProvider": - case "CLKSimpleGaugeProvider": - case "CLKTimeIntervalGaugeProvider": - // watchOS 6 / Xcode 11 - case "CLKComplicationTemplateGraphicCircularStackImage": - case "CLKComplicationTemplateGraphicCircularStackText": - return true; -#elif __TVOS__ +#if __TVOS__ case "TVTopShelfAction": case "TVTopShelfCarouselContent": case "TVTopShelfCarouselItem": @@ -829,10 +677,6 @@ protected override bool Skip (Type type, string protocolName) // iOS 16 case "DDDevice": return true; -#if __WATCHOS__ - case "CLKComplicationTimelineEntry": - return true; -#endif // Xcode 10 case "ILClassificationUIExtensionContext": // Conformance not in headers return true; @@ -940,14 +784,6 @@ protected override bool Skip (Type type, string protocolName) if ((type.Name == "UISearchBar") && !TestRuntime.CheckXcodeVersion (5, 1)) return true; break; -#if !XAMCORE_3_0 - case "UINavigationControllerDelegate": - switch (type.Name) { - case "ABPeoplePickerNavigationControllerDelegate": // 37180 - return true; - } - break; -#endif case "GKSavedGameListener": switch (type.Name) { case "GKLocalPlayerListener": // 37180 @@ -975,7 +811,7 @@ protected override bool Skip (Type type, string protocolName) return !TestRuntime.CheckXcodeVersion (8, 0); case "SCNNode": case "SCNReferenceNode": - return !TestRuntime.CheckXcodeVersion (9, 0); + return TestRuntime.CheckXcodeVersion (16, 1); // Conformance removed in Xcode 16.1 will be removed in XAMCORE_5_0 } break; @@ -1095,7 +931,7 @@ protected override bool Skip (Type type, string protocolName) return !TestRuntime.CheckXcodeVersion (8, 0); case "SCNNode": case "SCNReferenceNode": - return !TestRuntime.CheckXcodeVersion (9, 0); + return TestRuntime.CheckXcodeVersion (16, 1); // Conformance removed in Xcode 16.1 will be removed in XAMCORE_5_0 } break; @@ -1141,11 +977,9 @@ protected override bool Skip (Type type, string protocolName) return !TestRuntime.CheckXcodeVersion (8, 0); } break; -#if !__WATCHOS__ // Undocumented conformance (members were inlinded in 'UIViewController' before so all subtypes should conform) case "UIStateRestoring": return type.Name == "UIViewController" || type.IsSubclassOf (typeof (UIViewController)); -#endif #if __IOS__ || __TVOS__ case "UIFocusItemContainer": case "UICoordinateSpace": diff --git a/tests/introspection/iOS/iOSApiSelectorTest.cs b/tests/introspection/iOSApiSelectorTest.cs similarity index 90% rename from tests/introspection/iOS/iOSApiSelectorTest.cs rename to tests/introspection/iOSApiSelectorTest.cs index 11224b11ae6d..15f7cdaf1cd8 100644 --- a/tests/introspection/iOS/iOSApiSelectorTest.cs +++ b/tests/introspection/iOSApiSelectorTest.cs @@ -18,6 +18,9 @@ #endif using NUnit.Framework; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [TestFixture] @@ -34,12 +37,6 @@ public iOSApiSelectorTest () protected override bool Skip (Type type) { switch (type.Namespace) { -#if __WATCHOS__ - case "GameKit": - if (IntPtr.Size == 4) - return true; - break; -#endif // they don't answer on the simulator (Apple implementation does not work) but fine on devices case "GameController": case "MonoTouch.GameController": @@ -127,52 +124,6 @@ protected override bool Skip (Type type) case "MTLRasterizationRateLayerDescriptor": case "MTLRasterizationRateMapDescriptor": return TestRuntime.IsSimulatorOrDesktop; -#if __WATCHOS__ - // The following watchOS 3.2 Beta 2 types Fails, but they can be created we verified using an ObjC app, we will revisit before stable - case "INPersonResolutionResult": - case "INPlacemarkResolutionResult": - case "INPreferences": - case "INRadioTypeResolutionResult": - case "INRelativeReferenceResolutionResult": - case "INRelativeSettingResolutionResult": - case "INRideCompletionStatus": - case "INSpeakableStringResolutionResult": - case "INStringResolutionResult": - case "INTemperatureResolutionResult": - case "INWorkoutGoalUnitTypeResolutionResult": - case "INWorkoutLocationTypeResolutionResult": - case "INBillPayeeResolutionResult": - case "INBillTypeResolutionResult": - case "INBooleanResolutionResult": - case "INCallRecordTypeResolutionResult": - case "INCarAirCirculationModeResolutionResult": - case "INCarAudioSourceResolutionResult": - case "INCarDefrosterResolutionResult": - case "INCarSeatResolutionResult": - case "INCarSignalOptionsResolutionResult": - case "INCurrencyAmountResolutionResult": - case "INDateComponentsRangeResolutionResult": - case "INDateComponentsResolutionResult": - case "INDoubleResolutionResult": - case "INImage": - case "INIntegerResolutionResult": - case "INInteraction": - case "INMessageAttributeOptionsResolutionResult": - case "INPaymentAmountResolutionResult": - case "INMessageAttributeResolutionResult": - case "INPaymentMethod": - case "INPaymentStatusResolutionResult": - case "INPaymentAccountResolutionResult": - return true; - case "CMMovementDisorderManager": - // From Xcode 10 beta 2: - // This requires a special entitlement: - // Usage of CMMovementDisorderManager requires a special entitlement. Please see for more information https://developer.apple.com/documentation/coremotion/cmmovementdisordermanager - // but that web page doesn't explain anything (it's mostly empty, so this is probably just lagging documentation) - // I also tried enabling every entitlement in Xcode, but it still didn't work. - return true; -#endif - default: return base.Skip (type); } @@ -448,25 +399,6 @@ protected override bool CheckResponse (bool value, Type actualType, MethodBase m } break; #endif -#if __WATCHOS__ - case "INUserContext": - switch (name) { - case "encodeWithCoder:": - if (!TestRuntime.CheckXcodeVersion (12, 0)) - return true; - break; - } - break; - case "HKHealthStore": - switch (name) { - case "workoutSessionMirroringStartHandler": - if (TestRuntime.IsSimulatorOrDesktop) - return true; - break; - } - break; -#endif - break; } switch (name) { @@ -805,11 +737,6 @@ protected override bool CheckResponse (bool value, Type actualType, MethodBase m case "HKElectrocardiogramVoltageMeasurement": // NSCopying conformance added in Xcode 14 return !TestRuntime.CheckXcodeVersion (14, 0); -#if __WATCHOS__ - case "INParameter": - // NSCopying conformance added in Xcode 10 - return !TestRuntime.CheckXcodeVersion (10, 0); -#endif } break; @@ -932,18 +859,6 @@ protected override bool CheckStaticResponse (bool value, Type actualType, Type d break; } break; -#if __WATCHOS__ - case "fetchAllRecordZonesOperation": - case "fetchCurrentUserRecordOperation": - case "notificationFromRemoteNotificationDictionary:": - case "containerWithIdentifier:": - case "defaultContainer": - case "defaultRecordZone": - // needs investigation, seems all class selectors from CloudKit don't answer - if (declaredType.Namespace == "CloudKit") - return true; - break; -#endif case "affectsColorAppearance": switch (declaredType.Name) { case "UITraitTypesettingLanguage": diff --git a/tests/introspection/iOS/iOSApiSignatureTest.cs b/tests/introspection/iOSApiSignatureTest.cs similarity index 95% rename from tests/introspection/iOS/iOSApiSignatureTest.cs rename to tests/introspection/iOSApiSignatureTest.cs index e0a33ed967d5..f15bc3417f1c 100644 --- a/tests/introspection/iOS/iOSApiSignatureTest.cs +++ b/tests/introspection/iOSApiSignatureTest.cs @@ -16,6 +16,9 @@ using Foundation; using UIKit; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [TestFixture] @@ -182,16 +185,6 @@ protected override void CheckManagedMemberSignatures (MethodBase m, Type t, ref return; break; #endif // !XAMCORE_5_0 -#if !NET - case "get_ImagePickerControllerDelegate": - case "set_ImagePickerControllerDelegate": - case "get_NavigationControllerDelegate": - case "set_NavigationControllerDelegate": - // fixed in NET - alternative are the Weak* delegates - if (t.Name == "UIImagePickerController") - return; - break; -#endif #if !XAMCORE_5_0 // let's review the tests exceptions if we break things case "get_Model": case "set_Model": diff --git a/tests/introspection/iOS/iOSApiTypoTest.cs b/tests/introspection/iOSApiTypoTest.cs similarity index 86% rename from tests/introspection/iOS/iOSApiTypoTest.cs rename to tests/introspection/iOSApiTypoTest.cs index 42bb6fce8466..0af54108c03d 100644 --- a/tests/introspection/iOS/iOSApiTypoTest.cs +++ b/tests/introspection/iOSApiTypoTest.cs @@ -9,28 +9,19 @@ namespace Introspection { [TestFixture] public class iOSApiTypoTest : ApiTypoTest { -#if !__WATCHOS__ UITextChecker checker = new UITextChecker (); -#endif public override string GetTypo (string txt) { -#if __WATCHOS__ - return string.Empty; -#else var checkRange = new NSRange (0, txt.Length); var typoRange = checker.RangeOfMisspelledWordInString (txt, checkRange, checkRange.Location, false, "en_US"); if (typoRange.Length == 0) return String.Empty; return txt.Substring ((int) typoRange.Location, (int) typoRange.Length); -#endif } public override void TypoTest () { -#if __WATCHOS__ - Assert.Ignore ("Need to find alternative for UITextChecker on WatchOS."); -#else // the dictionary used by iOS varies with versions and // we don't want to maintain special cases for each version var sdk = new Version (Constants.SdkVersion); @@ -42,7 +33,6 @@ public override void TypoTest () TestRuntime.AssertSimulatorOrDesktop ("Typos only detected on simulator"); base.TypoTest (); -#endif } } } diff --git a/tests/introspection/iOS/iOSApiWeakPropertyTest.cs b/tests/introspection/iOSApiWeakPropertyTest.cs similarity index 81% rename from tests/introspection/iOS/iOSApiWeakPropertyTest.cs rename to tests/introspection/iOSApiWeakPropertyTest.cs index 90466b97c3c5..20de3b39454b 100644 --- a/tests/introspection/iOS/iOSApiWeakPropertyTest.cs +++ b/tests/introspection/iOSApiWeakPropertyTest.cs @@ -5,6 +5,9 @@ using NUnit.Framework; +// Disable until we get around to enable + fix any issues. +#nullable disable + namespace Introspection { [TestFixture] @@ -41,14 +44,6 @@ protected override bool Skip (PropertyInfo property) // NSString manually bound as smart enum CLSContextTopic case "CLSContext": return property.Name == "WeakTopic"; -#if !XAMCORE_3_0 - // #37451 - setter does not exists but we have to keep it for binary compatibility - // OTOH we can't give it a selector (private API) even if we suspect Apple is mostly running `strings` on executable - case "IUIViewControllerPreviewing": - return property.Name == "WeakDelegate"; - case "UIViewControllerPreviewingWrapper": - return property.Name == "WeakDelegate"; -#endif case "CHHapticPatternDefinition": return property.Name == "WeakParameterCurve" || property.Name == "WeakParameterCurveControlPoints"; } diff --git a/tests/introspection/iOS/iOSCoreImageFiltersTest.cs b/tests/introspection/iOSCoreImageFiltersTest.cs similarity index 94% rename from tests/introspection/iOS/iOSCoreImageFiltersTest.cs rename to tests/introspection/iOSCoreImageFiltersTest.cs index 0e7beb6d662b..ba9a8ea4cb39 100644 --- a/tests/introspection/iOS/iOSCoreImageFiltersTest.cs +++ b/tests/introspection/iOSCoreImageFiltersTest.cs @@ -8,8 +8,6 @@ // Copyright 2012-2013 Xamarin Inc. All rights reserved. // -#if !__WATCHOS__ - using System; using System.Reflection; using CoreImage; @@ -34,4 +32,3 @@ protected override bool Skip (Type type) } } } -#endif // !__WATCHOS__ diff --git a/tests/linker/ios/link all/LinkAllTest.cs b/tests/linker/ios/link all/LinkAllTest.cs index 19796568a4e1..f5fd3587c2a0 100644 --- a/tests/linker/ios/link all/LinkAllTest.cs +++ b/tests/linker/ios/link all/LinkAllTest.cs @@ -278,9 +278,6 @@ public void DetectPlatform () #endif // !__MACOS__ [Test] -#if !XAMCORE_3_0 && !NET - [Availability ()] -#endif #if NET [SupportedOSPlatform ("none")] [UnsupportedOSPlatform ("none)")] @@ -298,9 +295,6 @@ public void RemovedAttributes () string suffix = AssemblyName; // since we're linking the attributes will NOT be available - even if they are used -#if !XAMCORE_3_0 - Assert.Null (Helper.GetType (prefix + "ObjCRuntime.AvailabilityAttribute, " + suffix), "AvailabilityAttribute"); -#endif Assert.Null (Helper.GetType (prefix + "ObjCRuntime.IntroducedAttribute, " + suffix), "IntroducedAttribute"); Assert.Null (Helper.GetType (prefix + "ObjCRuntime.DeprecatedAttribute, " + suffix), "DeprecatedAttribute"); Assert.Null (Helper.GetType (prefix + "ObjCRuntime.ObsoletedAttribute, " + suffix), "ObsoletedAttribute"); diff --git a/tests/linker/ios/trimmode copy/dotnet/Makefile b/tests/linker/ios/trimmode copy/dotnet/Makefile index a97c2cbb3d5d..07a44358c22d 100644 --- a/tests/linker/ios/trimmode copy/dotnet/Makefile +++ b/tests/linker/ios/trimmode copy/dotnet/Makefile @@ -1,2 +1,2 @@ -TOP=../../../.. +TOP=../../../../.. include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/linker/ios/trimmode link/dotnet/Makefile b/tests/linker/ios/trimmode link/dotnet/Makefile index a97c2cbb3d5d..07a44358c22d 100644 --- a/tests/linker/ios/trimmode link/dotnet/Makefile +++ b/tests/linker/ios/trimmode link/dotnet/Makefile @@ -1,2 +1,2 @@ -TOP=../../../.. +TOP=../../../../.. include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/mac-binding-project/Makefile b/tests/mac-binding-project/Makefile index 4b88693c821a..9a8d411caf9d 100644 --- a/tests/mac-binding-project/Makefile +++ b/tests/mac-binding-project/Makefile @@ -25,50 +25,6 @@ bin/SimpleClass.%.a: ../common/mac/SimpleClass.m bin bin/SimpleClassStatic.a: bin/SimpleClass.x86_64.a | bin $(Q) $(CP) $< $@ -bin/Mobile-dynamic/MobileBinding.dll: bin/SimpleClassDylib.dylib - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic.csproj - -bin/Mobile-dynamic-newstyle/MobileBinding.dll: bin/SimpleClassDylib.dylib - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic_newstyle.csproj - -bin/Mobile-dynamic-spaces/Mobile\ Binding.dll: bin/SimpleClass\ Dylib.dylib - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic_spaces.csproj - -bin/Mobile-static/MobileBinding.dll: bin/SimpleClassStatic.a - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_static.csproj - -bin/Mobile-static-newstyle/MobileBinding.dll: bin/SimpleClassStatic.a - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_static_newstyle.csproj - - -bin/Mobile-framework/MobileBinding.dll: - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_framework.csproj - - -bin/MobileTest-static/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-static/MobileBinding.dll - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_static.csproj - -bin/MobileTest-static-newstyle/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-static-newstyle/MobileBinding.dll - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_static_newstyle.csproj - -bin/MobileTest-withLinker/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-static/MobileBinding.dll - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_WithLinker.csproj - -bin/MobileTest-dynamic/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-dynamic/MobileBinding.dll - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic.csproj - -bin/MobileTest-dynamic-newstyle/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-dynamic-newstyle/MobileBinding.dll - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic_newstyle.csproj - -bin/MobileTest-dynamic-spaces/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-dynamic-spaces/Mobile\ Binding.dll - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic_spaces.csproj - -bin/MobileTest-framework/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-framework/MobileBinding.dll - $(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_framework.csproj - - - - test-static:: bin/MobileTest-static/MobileTestApp.app/Contents/MacOS/MobileTestApp bin/MobileTest-static-newstyle/MobileTestApp.app/Contents/MacOS/MobileTestApp $(Q) ./bin/MobileTest-static/MobileTestApp.app/Contents/MacOS/MobileTestApp 2>&1 | grep 42 > /dev/null $(Q) ./bin/MobileTest-static-newstyle/MobileTestApp.app/Contents/MacOS/MobileTestApp 2>&1 | grep 42 > /dev/null diff --git a/tests/mmp-regression/Makefile b/tests/mmp-regression/Makefile index da4f7a154f47..18dfb9b18fa9 100644 --- a/tests/mmp-regression/Makefile +++ b/tests/mmp-regression/Makefile @@ -35,7 +35,7 @@ all-local:: run CONFIG?=Debug $(foreach test,$(ALL_TESTS),$(test)/bin): dylib/libTest.dylib - $(QF_GEN) if ! $(SYSTEM_XIBUILD) -- $(@D)/$(@D).csproj /p:Configuration=$(CONFIG); then EC=$$?; rm -Rf $@; exit $$EC; fi + $(QF_GEN) if ! $(SYSTEM_MSBUILD) -- $(@D)/$(@D).csproj /p:Configuration=$(CONFIG); then EC=$$?; rm -Rf $@; exit $$EC; fi dylib/libTest.dylib: dylib/src.c $(QF_GEN) $(XCODE_CC) $< -o$@ -arch x86_64 -shared -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib diff --git a/tests/mmptest/Makefile b/tests/mmptest/Makefile index 6d43fc541978..14eb41a35da9 100644 --- a/tests/mmptest/Makefile +++ b/tests/mmptest/Makefile @@ -37,8 +37,8 @@ run: build @[[ ! -e .failed-stamp ]] build: - $(Q_XBUILD) $(SYSTEM_XIBUILD) -t -- /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore ../tests-mac.sln - $(SYSTEM_XIBUILD) -- mmptest.csproj $(XBUILD_VERBOSITY) + $(Q_XBUILD) $(SYSTEM_MSBUILD) -t -- /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore ../tests-mac.sln + $(SYSTEM_MSBUILD) mmptest.csproj $(XBUILD_VERBOSITY) clean-local:: @rm -rf ./obj 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/mmptest/src/CodeStrippingTests.cs b/tests/mmptest/src/CodeStrippingTests.cs index 5fb469da1b54..45ec14d41849 100644 --- a/tests/mmptest/src/CodeStrippingTests.cs +++ b/tests/mmptest/src/CodeStrippingTests.cs @@ -9,11 +9,11 @@ namespace Xamarin.MMP.Tests { public class CodeStrippingTests { static Func LipoStripConditional = s => s.Contains ("lipo") && s.Contains ("-extract_family"); - static Func LipoStripSkipPosixAndMonoNativeConditional = s => LipoStripConditional (s) && !s.Contains ("libMonoPosixHelper.dylib") && !s.Contains ("libmono-native.dylib"); + static Func LipoStripSkipPosixConditional = s => LipoStripConditional (s) && !s.Contains ("libMonoPosixHelper.dylib"); - static bool DidAnyLipoStripSkipPosixAndMonoNative (BuildResult buildResult) + static bool DidAnyLipoStripSkipPosix (BuildResult buildResult) { - return buildResult.BuildOutputLines.Any (LipoStripSkipPosixAndMonoNativeConditional); + return buildResult.BuildOutputLines.Any (LipoStripSkipPosixConditional); } static bool DidAnyLipoStrip (BuildResult buildResult) @@ -129,9 +129,9 @@ void AssertNoLipoOrWarning (BuildResult buildOutput, string context) Assert.False (buildOutput.HasMessage (2108), "MM2108 incorrectly given in in context: " + context); } - void AssertLipoOnlyMonoPosixAndMonoNative (BuildResult buildOutput, string context) + void AssertLipoOnlyMonoPosix (BuildResult buildOutput, string context) { - Assert.False (DidAnyLipoStripSkipPosixAndMonoNative (buildOutput), "lipo incorrectly run in context outside of libMonoPosixHelper/libmono-native: " + context); + Assert.False (DidAnyLipoStripSkipPosix (buildOutput), "lipo incorrectly run in context outside of libMonoPosixHelper/libmono-native: " + context); Assert.False (buildOutput.HasMessage (2108), "MM2108 incorrectly given in in context: " + context); } @@ -173,7 +173,7 @@ public void ThirdPartyLibrary_WithCorrectBitness_ShouldNotStripOrWarn () test.Release = true; testResult = TI.TestUnifiedExecutable (test); - AssertLipoOnlyMonoPosixAndMonoNative (testResult.BuildResult, "Release"); // libMonoPosixHelper.dylib and libmono-native.dylib will lipo in Release + AssertLipoOnlyMonoPosix (testResult.BuildResult, "Release"); // libMonoPosixHelper.dylib and libmono-native.dylib will lipo in Release }); } } diff --git a/tests/mono-native/.gitignore b/tests/mono-native/.gitignore deleted file mode 100644 index 7f0c25398785..000000000000 --- a/tests/mono-native/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.csproj diff --git a/tests/mono-native/AppDelegate.cs b/tests/mono-native/AppDelegate.cs deleted file mode 100644 index e08e3de2785a..000000000000 --- a/tests/mono-native/AppDelegate.cs +++ /dev/null @@ -1,117 +0,0 @@ -#if !__WATCHOS__ && !MONOMAC -using System; -using System.Collections.Generic; -using System.Reflection; -using Foundation; -using UIKit; -using MonoTouch.NUnit.UI; -using NUnit.Framework.Internal; - -namespace Mono.Native.Tests { - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register ("AppDelegate")] - public partial class AppDelegate : UIApplicationDelegate { - // class-level declarations - static UIWindow window; - TouchRunner runner; - -#if !__TVOS__ - public override bool AccessibilityPerformMagicTap () - { - try { - runner.OpenWriter ("Magic Tap"); - runner.Run (runner.LoadedTest as TestSuite); - } finally { - runner.CloseWriter (); - } - return true; - } -#endif - // - // This method is invoked when the application has loaded and is ready to run. In this - // method you should instantiate the window, load the UI into it and then make the window - // visible. - // - // You have 17 seconds to return from this method, or iOS will terminate your application. - // - public override bool FinishedLaunching (UIApplication app, NSDictionary options) - { - // create a new window instance based on the screen size - window = new UIWindow (UIScreen.MainScreen.Bounds); - runner = new TouchRunner (window); - - // tests can be inside the main assembly - runner.Add (Assembly.GetExecutingAssembly ()); - - window.RootViewController = new UINavigationController (runner.GetViewController ()); - // make the window visible - window.MakeKeyAndVisible (); - - return true; - } - - public static void PresentModalViewController (UIViewController vc, double duration) - { - var bckp = window.RootViewController; - window.RootViewController = vc; - try { - NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (duration)); - } finally { - window.RootViewController = bckp; - } - } - - public static bool RunAsync (DateTime timeout, Action action, Func check_completed) - { - var vc = new AsyncController (action); - var bckp = window.RootViewController; - window.RootViewController = vc; - try { - do { - if (timeout < DateTime.Now) - return false; - NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (0.1)); - } while (!check_completed ()); - } finally { - window.RootViewController = bckp; - } - - return true; - } - - static void Main (string [] args) - { - UIApplication.Main (args, null, typeof (AppDelegate)); - } - } - - class AsyncController : UIViewController { - Action action; - static int counter; - - public AsyncController (Action action) - { - this.action = action; - counter++; - } - - public override void ViewDidLoad () - { - base.ViewDidLoad (); - - switch (counter % 2) { - case 0: - View.BackgroundColor = UIColor.Yellow; - break; - default: - View.BackgroundColor = UIColor.LightGray; - break; - } - NSTimer.CreateScheduledTimer (0.01, (v) => action ()); - } - } -} - -#endif // !__WATCHOS__ diff --git a/tests/mono-native/Introspection.cs b/tests/mono-native/Introspection.cs deleted file mode 100644 index 6343229c77ca..000000000000 --- a/tests/mono-native/Introspection.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Threading; -using System.Reflection; -using System.Runtime.InteropServices; -using NUnit.Framework; -using ObjCRuntime; - -namespace Xamarin.Tests { - [TestFixture] - public class Introspection { - public static string RootDirectory => Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location); - - void AssertShouldExist (string name) - { - var pathName = Path.Combine (RootDirectory, name); - Assert.That (File.Exists (pathName), $"Found {name}."); - } - - void AssertShouldNotExist (string name) - { - var pathName = Path.Combine (RootDirectory, name); - Assert.That (File.Exists (pathName), Is.False, $"Should not have {name}."); - } - - int CountFiles (string pattern) - { - // Don't use Linq as it'd use too much memory. - return Directory.GetFiles (RootDirectory, pattern, SearchOption.AllDirectories).Length; - } - - void CheckDynamicLibrary () - { - AssertShouldExist (MonoNativeConfig.DynamicLibraryName); - AssertShouldNotExist ("libmono-native.dylib"); - - var count = CountFiles ("libmono-native*"); - Assert.That (count, Is.EqualTo (1), "exactly one mono-native library."); - } - - void CheckStaticLibrary () - { - AssertShouldNotExist ("libmono-native.dylib"); - AssertShouldNotExist ("libmono-native-compat.dylib"); - AssertShouldNotExist ("libmono-native-unified.dylib"); - - var count = CountFiles ("libmono-native*"); - Assert.That (count, Is.EqualTo (0), "zero mono-native libraries."); - } - - void CheckSymlinkedLibrary () - { - AssertShouldExist ("libmono-native.dylib"); - AssertShouldNotExist ("libmono-native-compat.dylib"); - AssertShouldNotExist ("libmono-native-unified.dylib"); - - var count = CountFiles ("libmono-native*"); - Assert.That (count, Is.EqualTo (1), "exactly one mono-native library."); - } - - [Test] - public void CheckLibrary () - { - switch (MonoNativeConfig.LinkMode) { - case MonoNativeLinkMode.Dynamic: - CheckDynamicLibrary (); - break; - case MonoNativeLinkMode.Static: - CheckStaticLibrary (); - break; - case MonoNativeLinkMode.Symlink: - CheckSymlinkedLibrary (); - break; - default: - Assert.Fail ($"Unknown link mode: {MonoNativeConfig.LinkMode}"); - break; - } - } - - [DllImport ("System.Native")] - extern static void mono_native_initialize (); - - [Test] - public void TestInvoke () - { - mono_native_initialize (); - } - } -} diff --git a/tests/mono-native/MacAppDelegate.cs b/tests/mono-native/MacAppDelegate.cs deleted file mode 100644 index b8b1ef0127ae..000000000000 --- a/tests/mono-native/MacAppDelegate.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using NUnitLite; -using AppKit; -using Foundation; - -namespace Mono.Native.Tests { - [Register ("AppDelegate")] - public class MacAppDelegate : NSApplicationDelegate { - public override void DidFinishLaunching (NSNotification notification) - { - } - - public override void WillTerminate (NSNotification notification) - { - // Insert code here to tear down your application - } - } -} diff --git a/tests/mono-native/MacMain.cs b/tests/mono-native/MacMain.cs deleted file mode 100644 index b2e379ef7de7..000000000000 --- a/tests/mono-native/MacMain.cs +++ /dev/null @@ -1,10 +0,0 @@ -using NUnitLite; - -namespace mononativetests { - public class Application { - static int Main (string [] args) - { - return new AutoRun ().Execute (args); - } - } -} diff --git a/tests/mono-native/Main.cs b/tests/mono-native/Main.cs deleted file mode 100644 index aaa9fe15eeb7..000000000000 --- a/tests/mono-native/Main.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -#if __WATCHOS__ -using Foundation; -#endif -using UIKit; - -partial class TestRuntime { - public static bool RunAsync (DateTime timeout, Action action, Func check_completed) - { -#if __WATCHOS__ - NSTimer.CreateScheduledTimer (0.01, (v) => action ()); - do { - if (timeout < DateTime.Now) - return false; - NSRunLoop.Main.RunUntil (NSDate.Now.AddSeconds (0.1)); - } while (!check_completed ()); - - return true; -#else - return Mono.Native.Tests.AppDelegate.RunAsync (timeout, action, check_completed); -#endif - } -} diff --git a/tests/mono-native/NativePlatformConfig.cs b/tests/mono-native/NativePlatformConfig.cs deleted file mode 100644 index 08f3a9056122..000000000000 --- a/tests/mono-native/NativePlatformConfig.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using NUnit.Framework; -using Mono; - -namespace Xamarin.Tests { - [TestFixture] - public class NativePlatformConfig { - [Test] - public void PlatformType () - { - var type = MonoNativePlatform.GetPlatformType (); - Assert.That ((int) type, Is.GreaterThan (0), "platform type"); - - var usingCompat = (type & MonoNativePlatformType.MONO_NATIVE_PLATFORM_TYPE_COMPAT) != 0; - Assert.AreEqual (MonoNativeConfig.UsingCompat, usingCompat, "using compatibility layer"); - } - } -} diff --git a/tests/mono-native/iOS/Info.plist b/tests/mono-native/iOS/Info.plist deleted file mode 100644 index 1a07cf53dc9a..000000000000 --- a/tests/mono-native/iOS/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleDisplayName - MonoNativeTest - CFBundleIdentifier - com.xamarin.mono-native-test - CFBundleName - MonoNativeTest - MinimumOSVersion - 12.2 - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UIDeviceFamily - - 1 - 2 - - UILaunchStoryboardName - LaunchScreen - UIRequiresFullScreen - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - XSAppIconAssets - Assets.xcassets/AppIcons.appiconset - - diff --git a/tests/mono-native/iOS/mono-native.csproj.template b/tests/mono-native/iOS/mono-native.csproj.template deleted file mode 100644 index 18c13ef180c5..000000000000 --- a/tests/mono-native/iOS/mono-native.csproj.template +++ /dev/null @@ -1,125 +0,0 @@ - - - - Debug - iPhoneSimulator - 10.0.0 - 2.0 - {26125265-2204-4514-A572-36079CA4F925} - {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Mono.Native.Tests - Resources - mononativetests - 168,169,219,414,612,618,649,672 - Xamarin.iOS - obj\$(Platform)\$(Configuration)-unified - PackageReference - ..\.. - latest - true - - - MONO_NATIVE_SYMLINK - MONO_NATIVE_STATIC - $(MonoNativeMode);$(DefineConstants) - - - True - full - False - bin\iPhoneSimulator\$(Configuration)-unified - DEBUG;$(DefineConstants) - prompt - 4 - True - None - True - -v -v - x86_64 - iPhone Developer - HttpClientHandler - - - none - True - bin\iPhoneSimulator\$(Configuration)-unified - $(DefineConstants) - prompt - 4 - None - True - -v -v - x86_64 - HttpClientHandler - - - True - full - False - bin\iPhone\$(Configuration)-unified - DEBUG;$(DefineConstants) - prompt - 4 - iPhone Developer - True - True - -v -v - ARM64 - SdkOnly - HttpClientHandler - - - none - True - bin\iPhone\$(Configuration)-unified - $(DefineConstants) - prompt - 4 - iPhone Developer - True - -v -v - ARM64 - true - SdkOnly - HttpClientHandler - - - - - - - - {F611ED96-54B5-4975-99BB-12F50AF95936} - Touch.Client-iOS - - - - - - - - Info.plist - - - - - - - - MonoNativePlatform.cs - - - MonoNativePlatformType.cs - - - NativePlatformTest.cs - - - MonoNativeConfig.cs - - - - - - diff --git a/tests/mono-native/macOS/Entitlements.plist b/tests/mono-native/macOS/Entitlements.plist deleted file mode 100644 index 9ae599370b42..000000000000 --- a/tests/mono-native/macOS/Entitlements.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/mono-native/macOS/Info.plist b/tests/mono-native/macOS/Info.plist deleted file mode 100644 index 7d7eb38e1bd1..000000000000 --- a/tests/mono-native/macOS/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleName - mononativetests - CFBundleIdentifier - com.xamarin.mononativetests - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - 12.0 - CFBundleDevelopmentRegion - en - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleSignature - ???? - NSHumanReadableCopyright - Xamarin Inc. (http://www.xamarin.com) - NSPrincipalClass - NSApplication - NSMainStoryboardFile - Main - - diff --git a/tests/mono-native/macOS/mono-native.csproj.template b/tests/mono-native/macOS/mono-native.csproj.template deleted file mode 100644 index 82a7761c8c04..000000000000 --- a/tests/mono-native/macOS/mono-native.csproj.template +++ /dev/null @@ -1,85 +0,0 @@ - - - - ..\.. - Debug - AnyCPU - {2B174B45-CC6B-443D-870F-6B5394FDE3FD} - {A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Exe - Mono.Native.Tests - mononativetests - Resources - 67,168,169,219,414,612,618,649,672 - Xamarin.Mac - v2.0 - $(DefineConstants);MOBILE;XAMMAC - PackageReference - latest - true - - - false - bin\Mac - 4 - false - false - false - false - HttpClientHandler - None - $(DefineConstants); - - - - - - - - - - Info.plist - - - - - - MacMain.cs - - - Assert.cs - - - MonoNativeConfig.cs - - - TestAssemblyLoader.cs - - - - MonoNativePlatform.cs - - - MonoNativePlatformType.cs - - - NativePlatformTest.cs - - - TestRuntime.cs - - - ApplePlatform.cs - - - SdkVersions.cs - - - - - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06} - Touch.Client-macOS-mobile - - - - \ No newline at end of file diff --git a/tests/monotouch-test/AudioToolbox/AudioSessionTest.cs b/tests/monotouch-test/AudioToolbox/AudioSessionTest.cs deleted file mode 100644 index 904c4709af14..000000000000 --- a/tests/monotouch-test/AudioToolbox/AudioSessionTest.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2011 Xamarin Inc. All rights reserved - -#if !__TVOS__ && !__WATCHOS__ && !MONOMAC && !XAMCORE_3_0 - -using System; -using Foundation; -using AudioToolbox; -using ObjCRuntime; -using NUnit.Framework; - -namespace MonoTouchFixtures.AudioToolbox { - - [TestFixture] - [Preserve (AllMembers = true)] - public class AudioSessionTest { - - public AudioSessionTest () - { - TestRuntime.RequestMicrophonePermission (); - AudioSession.Initialize (); - } - - [Test] - public void Properties () - { - var input = AudioSession.InputRoute; - - Assert.That (Enum.IsDefined (typeof (AudioSessionInputRouteKind), input), "InputRoute"); - - var outputs = AudioSession.OutputRoutes; - if (outputs is not null) { - foreach (var output in outputs) - Assert.That (Enum.IsDefined (typeof (AudioSessionOutputRouteKind), output), "Output: " + output.ToString ()); - } - - if (TestRuntime.IsDevice) { - Assert.That (outputs is not null && outputs.Length > 0, "All known devices have at least speakers #1"); - Assert.That (outputs [0] != AudioSessionOutputRouteKind.None, "All known devices have at least speakers #2"); - } - } - } -} -#endif // !__TVOS__ && !__WATCHOS__ && !MONOMAC && !XAMCORE_3_0 diff --git a/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs b/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs index 9f58a4070cd0..283fac00a4ae 100644 --- a/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs +++ b/tests/monotouch-test/CoreBluetooth/CentralManagerTest.cs @@ -41,16 +41,6 @@ public override void UpdatedState (CBCentralManager central) PoweredOnEvent.Set (); } -#if !XAMCORE_3_0 && !NET - public override void RetrievedPeripherals (CBCentralManager central, CBPeripheral [] peripherals) - { - } - - public override void RetrievedConnectedPeripherals (CBCentralManager central, CBPeripheral [] peripherals) - { - } -#endif // !XAMCORE_3_0 && !NET - public override void DiscoveredPeripheral (CBCentralManager central, CBPeripheral peripheral, NSDictionary advertisementData, NSNumber RSSI) { } @@ -119,11 +109,6 @@ public void RetrievePeripherals () // ToString in a CBUUID with true returns the full uuid which can be used to create a NSUuid using (var uuid = new NSUuid (heartRateMonitorUUID.ToString (true))) mgr.RetrievePeripheralsWithIdentifiers (uuid); - } else { -#if !XAMCORE_3_0 && !NET - // that API was deprecated in 7.0 and removed from 9.0 - mgr.RetrievePeripherals (heartRateMonitorUUID); -#endif // !XAMCORE_3_0 && !NET } } } diff --git a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs index 63019ca03b3e..b5af4fba3281 100644 --- a/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs +++ b/tests/monotouch-test/CoreGraphics/ColorSpaceTest.cs @@ -37,14 +37,6 @@ void CheckUnknown (CGColorSpace cs) Assert.That (cs.GetColorTable ().Length, Is.EqualTo (0), "Unknown-GetColorTable"); } -#if !XAMCORE_3_0 - [Test] - public void Null () - { - CheckUnknown (CGColorSpace.Null); - } -#endif - [Test] public void CreateDeviceGray () { diff --git a/tests/monotouch-test/CoreGraphics/GradientTest.cs b/tests/monotouch-test/CoreGraphics/GradientTest.cs index d3c04d9e66ce..739beb03f9df 100644 --- a/tests/monotouch-test/CoreGraphics/GradientTest.cs +++ b/tests/monotouch-test/CoreGraphics/GradientTest.cs @@ -50,9 +50,6 @@ public void Colorspace_Null () static CGColorSpace [] spaces = { CGColorSpace.CreateDeviceGray (), CGColorSpace.CreateDeviceRGB (), -#if !XAMCORE_3_0 - CGColorSpace.Null -#endif }; [Test] diff --git a/tests/monotouch-test/CoreMedia/CMTimeTests.cs b/tests/monotouch-test/CoreMedia/CMTimeTests.cs index ee7453d35346..26ec65851e51 100644 --- a/tests/monotouch-test/CoreMedia/CMTimeTests.cs +++ b/tests/monotouch-test/CoreMedia/CMTimeTests.cs @@ -116,9 +116,6 @@ public void CMTimeRangeConstants () Assert.DoesNotThrow (() => { var x = CMTimeRange.Zero; }, "CMTimeRangeConstants - Zero"); Assert.DoesNotThrow (() => { var x = CMTimeRange.InvalidRange; }, "CMTimeRangeConstants - InvalidRange"); Assert.DoesNotThrow (() => { var x = CMTimeRange.InvalidMapping; }, "CMTimeRangeConstants - InvalidMapping"); -#if !XAMCORE_3_0 - Assert.DoesNotThrow (() => { var x = CMTimeRange.Invalid; }, "CMTimeRangeConstants - Invalid"); -#endif if (TestRuntime.CheckXcodeVersion (7, 0)) { Assert.DoesNotThrow (() => { var x = CMTimeRange.InvalidMapping; }, "CMTimeRangeConstants - InvalidMapping"); Assert.DoesNotThrow (() => { var x = CMTimeRange.TimeMappingSourceKey; }, "CMTimeRangeConstants - TimeMappingSourceKey"); diff --git a/tests/monotouch-test/CoreText/FontManagerTest.cs b/tests/monotouch-test/CoreText/FontManagerTest.cs index 098f7789f929..63ab0b683b9a 100644 --- a/tests/monotouch-test/CoreText/FontManagerTest.cs +++ b/tests/monotouch-test/CoreText/FontManagerTest.cs @@ -188,7 +188,6 @@ public void UnregisterFontDescriptors_Null () Assert.Throws (() => CTFontManager.UnregisterFontDescriptors (new CTFontDescriptor [] { null }, CTFontManagerScope.Process, null), "null element"); } -#if !__WATCHOS__ [Test] public void RegisterFontDescriptors_NoCallback () { @@ -205,11 +204,6 @@ public void RegisterFontDescriptors_NoCallback () } } -#if __TVOS__ - [Ignore ("Fails on tvOS with undocumented error code 'The operation couldn’t be completed. (com.apple.CoreText.CTFontManagerErrorDomain error 500.'")] -#elif __IOS__ - [Ignore ("https://github.com/xamarin/xamarin-macios/issues/6690. This began failing for no aparent reason in iOS 13 Beta 5. Check back with GM.")] -#endif [Test] public void RegisterFontDescriptors_WithCallback () { @@ -220,13 +214,30 @@ public void RegisterFontDescriptors_WithCallback () StyleName = "Bold", Size = 16.0f }; + Exception? ex = null; using (CTFontDescriptor fd = new CTFontDescriptor (fda)) { var array = new [] { fd }; - CTFontManager.RegisterFontDescriptors (array, CTFontManagerScope.Process, true, SuccessDone); - CTFontManager.UnregisterFontDescriptors (array, CTFontManagerScope.Process, SuccessDone); + CTFontManager.RegisterFontDescriptors (array, CTFontManagerScope.Process, true, (NSError [] errors, bool done) => { + try { + Assert.True (done, "done: RegisterFontDescriptors"); + } catch (Exception e) { + ex = e; + } + return true; + }); + Assert.That (ex, Is.Null.Or.Not.Null, "RegisterFontDescriptors"); + + CTFontManager.UnregisterFontDescriptors (array, CTFontManagerScope.Process, (NSError [] errors, bool done) => { + try { + Assert.True (done, "done: UnregisterFontDescriptors"); + } catch (Exception e) { + ex = e; + } + return true; + }); + Assert.That (ex, Is.Null.Or.Not.Null, "UnregisterFontDescriptors"); } } -#endif [Test] public void GetFontsNullUrl () diff --git a/tests/monotouch-test/CoreText/StringAttributes.cs b/tests/monotouch-test/CoreText/StringAttributes.cs index 049196ae4455..7bc7e36d8ded 100644 --- a/tests/monotouch-test/CoreText/StringAttributes.cs +++ b/tests/monotouch-test/CoreText/StringAttributes.cs @@ -24,13 +24,9 @@ namespace MonoTouchFixtures.CoreText { [TestFixture] [Preserve (AllMembers = true)] public class StringAttributesTests { -#if !MONOMAC // No UIGraphics on mac [Test] - public void SimpleValuesSet () + public void NoCTLine () { - if (TestRuntime.CheckXcodeVersion (15, 0)) - Assert.Ignore ("Test timeouts on Xcode 15 beta 4: https://github.com/xamarin/xamarin-macios/issues/18656"); - var sa = new CTStringAttributes (); sa.ForegroundColor = UIColor.Blue.CGColor; sa.Font = new CTFont ("Georgia-BoldItalic", 24); @@ -50,14 +46,51 @@ public void SimpleValuesSet () sa.TrackingAdjustment = 1.0f; AdaptiveImageProvider? provider = null; -#if NET + if (TestRuntime.CheckXcodeVersion (16, 0)) { + sa.AdaptiveImageProvider = provider = new AdaptiveImageProvider (); + Assert.AreSame (provider, sa.AdaptiveImageProvider, "AdaptiveImageProvider"); + } + } + + [Test] + public void SimpleValuesSet () + { + var sa = new CTStringAttributes (); + sa.ForegroundColor = UIColor.Blue.CGColor; + sa.Font = new CTFont ("Georgia-BoldItalic", 24); + sa.UnderlineStyle = CTUnderlineStyle.Double; // It does not seem to do anything + sa.UnderlineColor = UIColor.Blue.CGColor; + sa.UnderlineStyleModifiers = CTUnderlineStyleModifiers.PatternDashDotDot; + + Assert.IsNull (sa.BaselineClass, "#0"); + sa.BaselineClass = CTBaselineClass.IdeographicHigh; + Assert.AreEqual (CTBaselineClass.IdeographicHigh, sa.BaselineClass, "#1"); + + // Calling sa.SetBaselineInfo makes the CTLine ctor crash (https://github.com/xamarin/maccore/issues/2947) + // so don't do that here. + // sa.SetBaselineInfo (CTBaselineClass.Roman, 13); + // sa.SetBaselineInfo (CTBaselineClass.IdeographicHigh, 3); + sa.SetWritingDirection (CTWritingDirection.LeftToRight); + + if (TestRuntime.CheckXcodeVersion (11, 0)) + sa.TrackingAdjustment = 1.0f; + + AdaptiveImageProvider? provider = null; if (TestRuntime.CheckXcodeVersion (16, 0)) sa.AdaptiveImageProvider = provider = new AdaptiveImageProvider (); -#endif var size = new CGSize (300, 300); +#if MONOMAC + using var imageRep = new NSBitmapImageRep (IntPtr.Zero, (nint) size.Width, (nint) size.Height, 8, 4, true, false, NSColorSpace.DeviceRGB, 4 * (int) size.Width, 32); + using var graphicsContext = NSGraphicsContext.FromBitmap (imageRep); + using var img = new NSImage (size); + img.AddRepresentation (imageRep); + img.LockFocus (); + using var gctx = graphicsContext.CGContext; +#else UIGraphics.BeginImageContext (size); - var gctx = UIGraphics.GetCurrentContext (); + using var gctx = UIGraphics.GetCurrentContext (); +#endif gctx.SetFillColor (UIColor.Green.CGColor); @@ -67,9 +100,8 @@ public void SimpleValuesSet () textLine.Draw (gctx); } -#if NET if (TestRuntime.CheckXcodeVersion (16, 0)) - Assert.AreEqual (0, provider!.Count, "AdaptiveImageProvider #0"); + Assert.AreEqual (1, provider!.Count, "AdaptiveImageProvider #0"); attributedString = new NSAttributedString ("🙈`", sa); using (var textLine = new CTLine (attributedString)) { @@ -77,12 +109,14 @@ public void SimpleValuesSet () } if (TestRuntime.CheckXcodeVersion (16, 0)) - Assert.AreEqual (1, provider!.Count, "AdaptiveImageProvider #1"); -#endif + Assert.AreEqual (2, provider!.Count, "AdaptiveImageProvider #1"); +#if MONOMAC + img.UnlockFocus (); +#else UIGraphics.EndImageContext (); - } #endif + } [Test] public void BackgroundColor () diff --git a/tests/monotouch-test/MapKit/AnnotationViewTest.cs b/tests/monotouch-test/MapKit/AnnotationViewTest.cs index d2c35290bfda..83b28940a0ae 100644 --- a/tests/monotouch-test/MapKit/AnnotationViewTest.cs +++ b/tests/monotouch-test/MapKit/AnnotationViewTest.cs @@ -21,35 +21,6 @@ using Xamarin.Utils; namespace MonoTouchFixtures.MapKit { - -#if !XAMCORE_3_0 - class AnnotationViewPoker : MKAnnotationView { - - static FieldInfo bkAnnotation; - - static AnnotationViewPoker () - { - var t = typeof (MKAnnotationView); - bkAnnotation = t.GetField ("__mt_Annotation_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public AnnotationViewPoker (IMKAnnotation annotation) : base (annotation, "reuse") - { - } - - public NSObject AnnotationBackingField { - get { - return (NSObject) bkAnnotation.GetValue (this); - } - } - } -#endif - [TestFixture] [Preserve (AllMembers = true)] public class AnnotationViewTest { @@ -81,21 +52,6 @@ public void InitWithAnnotation () } } -#if !XAMCORE_3_0 - [Test] - public void Annotation_BackingFields () - { - if (AnnotationViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var a = new MKPolygon ()) - using (var av = new AnnotationViewPoker (a)) { - Assert.AreSame (a, av.AnnotationBackingField, "1a"); - Assert.AreSame (a, av.Annotation, "2a"); - } - } -#endif // !XAMCORE_3_0 - [Test] public void Default () { diff --git a/tests/monotouch-test/MapKit/CircleViewTest.cs b/tests/monotouch-test/MapKit/CircleViewTest.cs index fe0f7be494e4..b637ad579164 100644 --- a/tests/monotouch-test/MapKit/CircleViewTest.cs +++ b/tests/monotouch-test/MapKit/CircleViewTest.cs @@ -11,39 +11,6 @@ using NUnit.Framework; namespace MonoTouchFixtures.MapKit { - -#if !XAMCORE_3_0 - class CircleViewPoker : MKCircleView { - - static FieldInfo bkCircle; - - static CircleViewPoker () - { - var t = typeof (MKCircleView); - bkCircle = t.GetField ("__mt_Circle_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public CircleViewPoker () - { - } - - public CircleViewPoker (MKCircle circle) : base (circle) - { - } - - public MKCircle CircleBackingField { - get { - return (MKCircle) bkCircle.GetValue (this); - } - } - } - -#endif // !XAMCORE_3_0 [TestFixture] [Preserve (AllMembers = true)] public class CircleViewTest { @@ -56,33 +23,6 @@ public void InitWithFrame () Assert.That (cv.Frame, Is.EqualTo (frame), "Frame"); } } - -#if !XAMCORE_3_0 - [Test] - public void Defaults_BackingFields () - { - if (CircleViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var cv = new CircleViewPoker ()) { - Assert.Null (cv.CircleBackingField, "1a"); - Assert.Null (cv.Circle, "2a"); - } - } - - [Test] - public void Circle_BackingFields () - { - if (CircleViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var c = new MKCircle ()) - using (var cv = new CircleViewPoker (c)) { - Assert.AreSame (c, cv.CircleBackingField, "1a"); - Assert.AreSame (c, cv.Circle, "2a"); - } - } -#endif // !XAMCORE_3_0 } } diff --git a/tests/monotouch-test/MapKit/MapViewTest.cs b/tests/monotouch-test/MapKit/MapViewTest.cs index c7c45e37bcc6..c638943c8921 100644 --- a/tests/monotouch-test/MapKit/MapViewTest.cs +++ b/tests/monotouch-test/MapKit/MapViewTest.cs @@ -17,56 +17,6 @@ using Xamarin.Utils; namespace MonoTouchFixtures.MapKit { - -#if !XAMCORE_3_0 - class MapViewPoker : MKMapView { - - static FieldInfo bkAnnotations; - static FieldInfo bkSelectedAnnotations; - static FieldInfo bkOverlays; - - static MapViewPoker () - { - var t = typeof (MKMapView); - bkAnnotations = t.GetField ("__mt_Annotations_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkSelectedAnnotations = t.GetField ("__mt_SelectedAnnotations_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkOverlays = t.GetField ("__mt_Overlays_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public MapViewPoker () - { - } - - // if created (and even if unused) iOS will call it back later (retain) - public MapViewPoker (IntPtr p) : base (p) - { - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public NSObject [] AnnotationsBackingField { - get { - return (NSObject []) bkAnnotations.GetValue (this); - } - } - - public NSObject [] SelectedAnnotationsBackingField { - get { - return (NSObject []) bkSelectedAnnotations.GetValue (this); - } - } - - public NSObject [] OverlaysBackingField { - get { - return (NSObject []) bkOverlays.GetValue (this); - } - } - } -#endif // !XAMCORE_3_0 - [TestFixture] [Preserve (AllMembers = true)] public class MapViewTest { @@ -85,140 +35,6 @@ public void InitWithFrame () } } -#if !XAMCORE_3_0 - [Test] - public void Annotations_BackingFields () - { - if (MapViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var a = new MKCircle ()) // MKAnnotation is abstract - using (var o1 = new MKPolygon ()) // it must export 'coordinate' or this will fail - using (var o2 = new MKPolyline ()) - using (var mv = new MapViewPoker ()) { - Assert.Null (mv.AnnotationsBackingField, "1a"); - Assert.That (mv.Annotations, Is.Empty, "1b"); - - mv.AddAnnotation (a); - Assert.AreSame (a, mv.AnnotationsBackingField [0], "2a"); - Assert.AreSame (a, mv.Annotations [0], "2b"); - - mv.RemoveAnnotation (a); - Assert.That (mv.AnnotationsBackingField, Is.Empty, "3a"); - Assert.That (mv.Annotations, Is.Empty, "3b"); - - mv.AddAnnotation (o1); - Assert.AreSame (o1, mv.AnnotationsBackingField [0], "4a"); - Assert.AreSame (o1, mv.Annotations [0], "4b"); - - mv.RemoveAnnotation (o1); - Assert.That (mv.AnnotationsBackingField, Is.Empty, "5a"); - Assert.That (mv.Annotations, Is.Empty, "5b"); - - mv.AddAnnotations (new IMKAnnotation [] { o1, o2 }); - // don't assume ordering - Assert.That (mv.AnnotationsBackingField.Length, Is.EqualTo (2), "6a"); - Assert.That (mv.Annotations.Length, Is.EqualTo (2), "6b"); - - mv.RemoveAnnotations (new IMKAnnotation [] { o2, o1 }); - Assert.That (mv.AnnotationsBackingField, Is.Empty, "7a"); - Assert.That (mv.Annotations, Is.Empty, "7b"); - } - } - - [Test] - public void SelectedAnnotations_BackingFields () - { - if (MapViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - -#if !MONOMAC - if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 7, 0)) { - // This test selects annotations on a map view, but according to apple's docs - // and a lot of googling this will not necessarily work until the map view is - // show. Since we can't relinquish control of the UI thread, we have no option - // but ignoring this test. For now I've only seen it fail on iOS 7 DP4. - Assert.Inconclusive ("This test is not deterministic on iOS7 DP4."); - } -#endif - - using (var a = new MKCircle ()) // MKAnnotation is abstract - using (var o1 = new MKPolygon ()) // it must export 'coordinate' or this will fail - using (var o2 = new MKPolyline ()) - using (var mv = new MapViewPoker ()) { - Assert.Null (mv.SelectedAnnotationsBackingField, "1a"); - Assert.Null (mv.SelectedAnnotations, "1b"); // not an empty array - - mv.SelectAnnotation (a, false); - Assert.AreSame (a, mv.SelectedAnnotationsBackingField [0], "2a"); - Assert.AreSame (a, mv.SelectedAnnotations [0], "2b"); - - // sanity - Assert.Null (mv.AnnotationsBackingField, "3a"); - Assert.That (mv.Annotations, Is.Empty, "3b"); - - mv.SelectedAnnotations = new IMKAnnotation [] { o1, o2 }; - // note: when assigning the property only the first item is selected (by design) - // so we're not exactly backing up correctly (we still hold 'o2') - // OTOH we do not want to recursively [PostGet] the same property (unless handled by the generator) - Assert.That (mv.SelectedAnnotationsBackingField.Length, Is.EqualTo (2), "4a"); - Assert.That (mv.SelectedAnnotations.Length, Is.EqualTo (1), "4b"); - - mv.DeselectAnnotation (o1, false); - // since only 'o1' was really selected, unselecting it will return null - Assert.Null (mv.SelectedAnnotationsBackingField, "5a"); - Assert.Null (mv.SelectedAnnotations, "5b"); // not an empty array - } - } - - [Test] - public void Overlays_BackingFields () - { - if (MapViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var o1 = new MKPolygon ()) // it must export 'boundingMapRect' or this will fail - using (var o2 = new MKPolyline ()) - using (var mv = new MapViewPoker ()) { - var overlays = new IMKOverlay [] { o1, o2 }; - Assert.Null (mv.OverlaysBackingField, "1a"); - Assert.Null (mv.Overlays, "1b"); // not an empty array - - mv.AddOverlay (o1); - Assert.AreSame (o1, mv.OverlaysBackingField [0], "2a"); - Assert.AreSame (o1, mv.Overlays [0], "2b"); - - mv.InsertOverlay (o2, 0); - Assert.That (mv.OverlaysBackingField.Length, Is.EqualTo (2), "3a"); - Assert.That (mv.Overlays.Length, Is.EqualTo (2), "3b"); - - mv.RemoveOverlay (o1); - Assert.AreSame (o2, mv.OverlaysBackingField [0], "4a"); - Assert.AreSame (o2, mv.Overlays [0], "4b"); - - mv.InsertOverlayAbove (o1, o2); - Assert.That (mv.OverlaysBackingField.Length, Is.EqualTo (2), "5a"); - Assert.That (mv.Overlays.Length, Is.EqualTo (2), "5b"); - - mv.RemoveOverlay (o2); - Assert.AreSame (o1, mv.OverlaysBackingField [0], "6a"); - Assert.AreSame (o1, mv.Overlays [0], "6b"); - - mv.InsertOverlayBelow (o2, o1); - Assert.That (mv.OverlaysBackingField.Length, Is.EqualTo (2), "7a"); - Assert.That (mv.Overlays.Length, Is.EqualTo (2), "7b"); - - mv.RemoveOverlays (overlays); - Assert.That (mv.OverlaysBackingField, Is.Empty, "8a"); - Assert.That (mv.Overlays, Is.Empty, "8b"); - - mv.AddOverlays (overlays); - Assert.That (mv.OverlaysBackingField.Length, Is.EqualTo (2), "9a"); - Assert.That (mv.Overlays.Length, Is.EqualTo (2), "9b"); - } - } -#endif // !XAMCORE_3_0 - [Test] public void Overlays () { diff --git a/tests/monotouch-test/MapKit/OverlayViewTest.cs b/tests/monotouch-test/MapKit/OverlayViewTest.cs index 6cfb26c7eaeb..6cde522c62c6 100644 --- a/tests/monotouch-test/MapKit/OverlayViewTest.cs +++ b/tests/monotouch-test/MapKit/OverlayViewTest.cs @@ -13,35 +13,6 @@ using NUnit.Framework; namespace MonoTouchFixtures.MapKit { - -#if !XAMCORE_3_0 - class OverlayViewPoker : MKOverlayView { - - static FieldInfo bkOverlay; - - static OverlayViewPoker () - { - var t = typeof (MKOverlayView); - bkOverlay = t.GetField ("__mt_Overlay_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public OverlayViewPoker (IMKOverlay overlay) : base (overlay) - { - } - - public NSObject OverlayBackingField { - get { - return (NSObject) bkOverlay.GetValue (this); - } - } - } -#endif // !XAMCORE_3_0 - [TestFixture] [Preserve (AllMembers = true)] public class OverlayViewTest { @@ -55,21 +26,6 @@ public void InitWithFrame () Assert.Null (ov.Overlay, "Overlay"); } } - -#if !XAMCORE_3_0 - [Test] - public void Overlay_BackingFields () - { - if (OverlayViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var c = new MKCircle ()) - using (var ov = new OverlayViewPoker (c)) { - Assert.AreSame (c, ov.Overlay, "1a"); - Assert.AreSame (c, ov.Overlay, "2a"); - } - } -#endif // !XAMCORE_3_0 } } diff --git a/tests/monotouch-test/MapKit/PolygonViewTest.cs b/tests/monotouch-test/MapKit/PolygonViewTest.cs index e8f572f78cb6..d719cb0bfa8f 100644 --- a/tests/monotouch-test/MapKit/PolygonViewTest.cs +++ b/tests/monotouch-test/MapKit/PolygonViewTest.cs @@ -11,39 +11,6 @@ using NUnit.Framework; namespace MonoTouchFixtures.MapKit { - -#if !XAMCORE_3_0 - class PolygonViewPoker : MKPolygonView { - - static FieldInfo bkPolygon; - - static PolygonViewPoker () - { - var t = typeof (MKPolygonView); - bkPolygon = t.GetField ("__mt_Polygon_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public PolygonViewPoker () - { - } - - public PolygonViewPoker (MKPolygon polygon) : base (polygon) - { - } - - public MKPolygon PolygonBackingField { - get { - return (MKPolygon) bkPolygon.GetValue (this); - } - } - } -#endif // !XAMCORE_3_0 - [TestFixture] [Preserve (AllMembers = true)] public class PolygonViewTest { @@ -56,33 +23,6 @@ public void InitWithFrame () Assert.That (pv.Frame, Is.EqualTo (frame), "Frame"); } } - -#if !XAMCORE_3_0 - [Test] - public void Defaults_BackingFields () - { - if (PolygonViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var pv = new PolygonViewPoker ()) { - Assert.Null (pv.PolygonBackingField, "1a"); - Assert.Null (pv.Polygon, "2a"); - } - } - - [Test] - public void Polygon_BackingFields () - { - if (PolygonViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var p = new MKPolygon ()) - using (var pv = new PolygonViewPoker (p)) { - Assert.AreSame (p, pv.PolygonBackingField, "1a"); - Assert.AreSame (p, pv.Polygon, "2a"); - } - } -#endif // !XAMCORE_3_0 } } diff --git a/tests/monotouch-test/MapKit/PolylineViewTest.cs b/tests/monotouch-test/MapKit/PolylineViewTest.cs index 4cdf25c7c4d7..53dd8d80e0e3 100644 --- a/tests/monotouch-test/MapKit/PolylineViewTest.cs +++ b/tests/monotouch-test/MapKit/PolylineViewTest.cs @@ -11,39 +11,6 @@ using NUnit.Framework; namespace MonoTouchFixtures.MapKit { - -#if !XAMCORE_3_0 - class PolylineViewPoker : MKPolylineView { - - static FieldInfo bkPolyline; - - static PolylineViewPoker () - { - var t = typeof (MKPolylineView); - bkPolyline = t.GetField ("__mt_Polyline_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public PolylineViewPoker () - { - } - - public PolylineViewPoker (MKPolyline polyline) : base (polyline) - { - } - - public MKPolyline PolylineBackingField { - get { - return (MKPolyline) bkPolyline.GetValue (this); - } - } - } -#endif // !XAMCORE_3_0 - [TestFixture] [Preserve (AllMembers = true)] public class PolylineViewTest { @@ -56,33 +23,6 @@ public void InitWithFrame () Assert.That (pl.Frame, Is.EqualTo (frame), "Frame"); } } - -#if !XAMCORE_3_0 - [Test] - public void Defaults_BackingFields () - { - if (PolylineViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var pv = new PolylineViewPoker ()) { - Assert.Null (pv.PolylineBackingField, "1a"); - Assert.Null (pv.Polyline, "2a"); - } - } - - [Test] - public void Polygon_BackingFields () - { - if (PolylineViewPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var p = new MKPolyline ()) - using (var pv = new PolylineViewPoker (p)) { - Assert.AreSame (p, pv.PolylineBackingField, "1a"); - Assert.AreSame (p, pv.Polyline, "2a"); - } - } -#endif // !XAMCORE_3_0 } } diff --git a/tests/monotouch-test/MapKit/UserTrackingBarButtonItemTest.cs b/tests/monotouch-test/MapKit/UserTrackingBarButtonItemTest.cs deleted file mode 100644 index db90db6f8f5d..000000000000 --- a/tests/monotouch-test/MapKit/UserTrackingBarButtonItemTest.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// MKUserTrackingBarButtonItem Unit Tests -// -// Authors: -// Sebastien Pouliot -// -// Copyright 2012 Xamarin Inc. All rights reserved. -// - -#if !XAMCORE_3_0 && !MONOMAC - -using System; -using System.Drawing; -using System.Reflection; -using Foundation; -using MapKit; -using ObjCRuntime; - -using NUnit.Framework; - -namespace MonoTouchFixtures.MapKit { - - class UserTrackingBarButtonItemPoker : MKUserTrackingBarButtonItem { - - static FieldInfo bkMapView; - - static UserTrackingBarButtonItemPoker () - { - var t = typeof (MKUserTrackingBarButtonItem); - bkMapView = t.GetField ("__mt_MapView_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public UserTrackingBarButtonItemPoker (MKMapView view) : base (view) - { - } - - public MKMapView MapViewBackingField { - get { - return (MKMapView) bkMapView.GetValue (this); - } - } - } - - [TestFixture] - [Preserve (AllMembers = true)] - public class UserTrackingBarButtonItemTest { - - [Test] - public void Ctor_Defaults () - { - using (var a = new NSObject ()) - using (MKUserTrackingBarButtonItem ut = new MKUserTrackingBarButtonItem ()) { - Assert.Null (ut.MapView, "MapView"); - } - } - - [Test] - public void Ctor_MKMapView () - { - using (MKMapView mv = new MKMapView ()) - using (MKUserTrackingBarButtonItem ut = new MKUserTrackingBarButtonItem (mv)) { - Assert.AreSame (mv, ut.MapView, "MapView"); - } - } - - [Test] - public void MapView_BackingFields () - { - if (UserTrackingBarButtonItemPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var mv = new MKMapView ()) - using (var ut = new UserTrackingBarButtonItemPoker (mv)) { - Assert.AreSame (mv, ut.MapViewBackingField, "1a"); - Assert.AreSame (mv, ut.MapView, "2a"); - } - } - } -} - -#endif // !XAMCORE_3_0 && !MONOMAC diff --git a/tests/monotouch-test/MediaAccessibility/CaptionAppearanceTest.cs b/tests/monotouch-test/MediaAccessibility/CaptionAppearanceTest.cs index 1c8c60489073..15ab7a6f9ddd 100644 --- a/tests/monotouch-test/MediaAccessibility/CaptionAppearanceTest.cs +++ b/tests/monotouch-test/MediaAccessibility/CaptionAppearanceTest.cs @@ -20,23 +20,6 @@ namespace MonoTouchFixtures.MediaAccessibility { // we want the test to be availble if we use the linker [Preserve (AllMembers = true)] public class CaptionAppearanceTest { - -#if !XAMCORE_3_0 - [Test] - public void Fields () - { - if (TestRuntime.CheckXcodeVersion (5, 0, 1)) { - Assert.NotNull (MACaptionAppearance.MediaCharacteristicDescribesMusicAndSoundForAccessibility, "MediaCharacteristicDescribesMusicAndSoundForAccessibility"); - Assert.NotNull (MACaptionAppearance.MediaCharacteristicTranscribesSpokenDialogForAccessibility, "MediaCharacteristicTranscribesSpokenDialogForAccessibility"); - Assert.NotNull (MACaptionAppearance.SettingsChangedNotification, "SettingsChangedNotification"); - } else { - Assert.Null (MACaptionAppearance.MediaCharacteristicDescribesMusicAndSoundForAccessibility, "MediaCharacteristicDescribesMusicAndSoundForAccessibility"); - Assert.Null (MACaptionAppearance.MediaCharacteristicTranscribesSpokenDialogForAccessibility, "MediaCharacteristicTranscribesSpokenDialogForAccessibility"); - Assert.Null (MACaptionAppearance.SettingsChangedNotification, "SettingsChangedNotification"); - } - } -#endif // !XAMCORE_3_0 - [Test] [Culture ("en")] // this setting depends on locale of the device according to apple docs on MACaptionAppearanceGetDisplayType, we know english works public void GetDisplayType () diff --git a/tests/monotouch-test/MessageUI/MailComposeViewControllerTest.cs b/tests/monotouch-test/MessageUI/MailComposeViewControllerTest.cs index 746e83d9abc7..7196598522e6 100644 --- a/tests/monotouch-test/MessageUI/MailComposeViewControllerTest.cs +++ b/tests/monotouch-test/MessageUI/MailComposeViewControllerTest.cs @@ -29,12 +29,7 @@ public void TextShadowOffset_7443 () if (!MFMailComposeViewController.CanSendMail) Assert.Inconclusive ("Not configured to send emails"); -#if XAMCORE_3_0 var cancelAttributes = new UIStringAttributes (); -#else - var cancelAttributes = new UITextAttributes (); - cancelAttributes.TextShadowOffset = new UIOffset (0, -1); -#endif UIBarButtonItem.AppearanceWhenContainedIn (typeof (UISearchBar)).SetTitleTextAttributes (cancelAttributes, UIControlState.Disabled); using (var mail = new MFMailComposeViewController ()) { // we're happy the .ctor did not crash (only on iOS6) because the dictionary had a null key (typo) diff --git a/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs b/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs index 54ab17be2f74..3dafe6dec6b0 100644 --- a/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs +++ b/tests/monotouch-test/PassKit/PKPayLaterViewTest.cs @@ -1,31 +1,55 @@ -// Can be uncommented when this issue is resolved: # https://github.com/xamarin/xamarin-macios/issues/19271 +#if __IOS__ && !__MACCATALYST__ -// #if __IOS__ && !__MACCATALYST__ +using System; +using System.Threading; -// using System; -// using Foundation; -// using UIKit; -// using PassKit; -// using NUnit.Framework; +using Foundation; +using UIKit; -// namespace MonoTouchFixtures.PassKit { +using PassKit; -// [TestFixture] -// [Preserve (AllMembers = true)] -// public class PKPayLaterViewTest { +using NUnit.Framework; -// [Test] -// public void ValidateAmountTest () -// { -// TestRuntime.AssertXcodeVersion (15, 0); +namespace MonoTouchFixtures.PassKit { -// for (int i = 0; i < 1000; i++){ -// PKPayLaterView.ValidateAmount (new NSDecimalNumber (i), "USD", (eligible) => { -// Assert.False (eligible); -// }); -// } -// } -// } -// } + [TestFixture] + [Preserve (AllMembers = true)] + public class PKPayLaterViewTest { -// #endif + [Test] + public void ValidateAmountTest_NSDecimal () + { + TestRuntime.AssertXcodeVersion (15, 0); + + var counter = 100; + var cnt = 0; + for (int i = 0; i < counter; i++) { + PKPayLaterView.ValidateAmount (new NSDecimalNumber (i), "USD", (eligible) => { + Interlocked.Increment (ref cnt); + }); + } + // The callback is rarely called, so just assert that we don't get more callbacks than + // actual validation requests. + Assert.That (cnt, Is.Not.LessThan (0).And.Not.GreaterThan (counter), $"NSDecimalNumber overload"); + } + + [Test] + public void ValidateAmountTest_Decimal () + { + TestRuntime.AssertXcodeVersion (15, 0); + + var counter = 100; + var cnt = 0; + for (int i = 0; i < counter; i++) { + PKPayLaterView.ValidateAmount (i, "USD", (eligible) => { + Interlocked.Increment (ref cnt); + }); + } + // The callback is rarely called, so just assert that we don't get more callbacks than + // actual validation requests. + Assert.That (cnt, Is.Not.LessThan (0).And.Not.GreaterThan (counter), $"decimal overload"); + } + } +} + +#endif diff --git a/tests/monotouch-test/Security/RecordTest.cs b/tests/monotouch-test/Security/RecordTest.cs index c356ccf2e17f..322914ed0626 100644 --- a/tests/monotouch-test/Security/RecordTest.cs +++ b/tests/monotouch-test/Security/RecordTest.cs @@ -315,16 +315,16 @@ public void DeskCase_83099_InmutableDictionary () var testUsername = "testusername"; //TEST 1: Save a keychain value - var test1 = SaveUserPassword (testUsername, "testValue1"); - Assert.IsTrue (test1, "Password could not be saved to keychain"); + var test1 = SaveUserPassword (testUsername, "testValue1", out var queryCode, out var addCode, out var updateCode); + Assert.IsTrue (test1, $"Password could not be saved to keychain. queryCode: {queryCode} addCode: {addCode} updateCode: {updateCode}"); //TEST 2: Get the saved keychain value var test2 = GetUserPassword (testUsername); Assert.IsTrue (StringUtil.StringsEqual (test2, "testValue1", false)); //TEST 3: Update the keychain value - var test3 = SaveUserPassword (testUsername, "testValue2"); - Assert.IsTrue (test3, "Password could not be saved to keychain"); + var test3 = SaveUserPassword (testUsername, "testValue2", out queryCode, out addCode, out updateCode); + Assert.IsTrue (test3, "Password could not be saved to keychain. queryCode: {queryCode} addCode: {addCode} updateCode: {updateCode}"); //TEST 4: Get the updated keychain value var test4 = GetUserPassword (testUsername); @@ -353,14 +353,15 @@ public static string GetUserPassword (string username) return password; } - public static bool SaveUserPassword (string username, string password) + public static bool SaveUserPassword (string username, string password, out SecStatusCode queryCode, out SecStatusCode addCode, out SecStatusCode updateCode) { + addCode = (SecStatusCode) (-1); // pick a value that doesn't already exist in SecStatusCode + updateCode = (SecStatusCode) (-1); // pick a value that doesn't already exist in SecStatusCode var success = false; var searchRecord = CreateSecRecord (SecKind.InternetPassword, server: "Test1", account: username.ToLower () ); - SecStatusCode queryCode; var record = SecKeyChain.QueryAsRecord (searchRecord, out queryCode); if (queryCode == SecStatusCode.ItemNotFound) { record = CreateSecRecord (SecKind.InternetPassword, @@ -368,12 +369,12 @@ record = CreateSecRecord (SecKind.InternetPassword, account: username.ToLower (), valueData: NSData.FromString (password) ); - var addCode = SecKeyChain.Add (record); + addCode = SecKeyChain.Add (record); success = (addCode == SecStatusCode.Success); } if (queryCode == SecStatusCode.Success && record is not null) { record.ValueData = NSData.FromString (password); - var updateCode = SecKeyChain.Update (searchRecord, record); + updateCode = SecKeyChain.Update (searchRecord, record); success = (updateCode == SecStatusCode.Success); } return success; diff --git a/tests/monotouch-test/UIKit/BarButtonItemTest.cs b/tests/monotouch-test/UIKit/BarButtonItemTest.cs index b4cc9460c84d..526f9dcd4cfe 100644 --- a/tests/monotouch-test/UIKit/BarButtonItemTest.cs +++ b/tests/monotouch-test/UIKit/BarButtonItemTest.cs @@ -128,11 +128,7 @@ public void SetTitleTextAttributes_Null () { using (MyView v = new MyView ("note")) using (var b = new UIBarButtonItem (v)) { -#if XAMCORE_3_0 b.SetTitleTextAttributes ((UIStringAttributes) null, UIControlState.Disabled); -#else - b.SetTitleTextAttributes ((UITextAttributes) null, UIControlState.Disabled); -#endif } } #endif diff --git a/tests/monotouch-test/UIKit/PasteboardTest.cs b/tests/monotouch-test/UIKit/PasteboardTest.cs index 78209a87f968..f9028528fd96 100644 --- a/tests/monotouch-test/UIKit/PasteboardTest.cs +++ b/tests/monotouch-test/UIKit/PasteboardTest.cs @@ -19,6 +19,7 @@ namespace MonoTouchFixtures.UIKit { public class PasteboardTest { [Test] + [Retry (10)] public void ImagesTest () { string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "basn3p08.png"); @@ -29,10 +30,6 @@ public void ImagesTest () if (TestRuntime.CheckXcodeVersion (8, 0)) Assert.True (UIPasteboard.General.HasImages, "HasImages"); - // https://github.com/xamarin/xamarin-macios/issues/6254 - if (TestRuntime.CheckXcodeVersion (11, 0)) - return; - Assert.AreEqual (1, UIPasteboard.General.Images.Length, "a - length"); UIPasteboard.General.Images = new UIImage [] { img, img }; diff --git a/tests/monotouch-test/UIKit/SearchDisplayControllerTest.cs b/tests/monotouch-test/UIKit/SearchDisplayControllerTest.cs deleted file mode 100644 index 9ea0042f1a6b..000000000000 --- a/tests/monotouch-test/UIKit/SearchDisplayControllerTest.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// Unit tests for UISearchDisplayController -// -// Authors: -// Sebastien Pouliot -// -// Copyright 2012 Xamarin Inc. All rights reserved. -// - -#if !XAMCORE_3_0 && !MONOMAC && !__MACCATALYST__ - -using System; -using System.Drawing; -using System.Reflection; -using Foundation; -using UIKit; -using NUnit.Framework; - -namespace MonoTouchFixtures.UIKit { - - class SearchDisplayControllerPoker : UISearchDisplayController { - - static FieldInfo bkSearchBar; - static FieldInfo bkSearchContentsController; - static FieldInfo bkSearchResultsTableView; - - static SearchDisplayControllerPoker () - { - var t = typeof (UISearchDisplayController); - bkSearchBar = t.GetField ("__mt_SearchBar_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkSearchContentsController = t.GetField ("__mt_SearchContentsController_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkSearchResultsTableView = t.GetField ("__mt_SearchResultsTableView_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public SearchDisplayControllerPoker () - { - } - - public SearchDisplayControllerPoker (UISearchBar searchBar, UIViewController viewController) : base (searchBar, viewController) - { - } - - public UISearchBar SearchBarBackingField { - get { - return (UISearchBar) bkSearchBar.GetValue (this); - } - } - - public UIViewController SearchContentsControllerBackingField { - get { - return (UIViewController) bkSearchContentsController.GetValue (this); - } - } - - public UITableView SearchResultsTableViewBackingField { - get { - return (UITableView) bkSearchResultsTableView.GetValue (this); - } - } - } - - [TestFixture] - [Preserve (AllMembers = true)] - public class SearchDisplayControllerTest { - - [Test] - public void Ctor_Default_BackingFields () - { - if (SearchDisplayControllerPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var sc = new SearchDisplayControllerPoker ()) { - // default constructor does not set any UIViewController so the backing fields are null - Assert.Null (sc.SearchBarBackingField, "1a"); - Assert.Null (sc.SearchContentsControllerBackingField, "2a"); - Assert.Null (sc.SearchResultsTableViewBackingField, "3a"); - - Assert.Null (sc.SearchBar, "1b"); - Assert.Null (sc.SearchContentsController, "2b"); - // not an issue (backing field being null before calling the getter) - // since it's not something we supplied to the instance - Assert.NotNull (sc.SearchResultsTableView, "3b"); - // the backing field will be set afterward - Assert.NotNull (sc.SearchResultsTableViewBackingField, "3c"); - } - } - - [Test] - public void Ctor_BackingFields () - { - if (SearchDisplayControllerPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var sb = new UISearchBar ()) - using (var vc = new UIViewController ()) - using (var sc = new SearchDisplayControllerPoker (sb, vc)) { - // default constructor does not set any UIViewController so the backing fields are null - Assert.AreSame (sb, sc.SearchBarBackingField, "1a"); - Assert.AreSame (vc, sc.SearchContentsControllerBackingField, "2a"); - Assert.Null (sc.SearchResultsTableViewBackingField, "3a"); - - Assert.AreSame (sb, sc.SearchBar, "1b"); - Assert.AreSame (vc, sc.SearchContentsController, "2b"); - // not an issue (backing field being null before calling the getter) - // since it's not something we supplied to the instance - Assert.NotNull (sc.SearchResultsTableView, "3b"); - // the backing field will be set afterward - Assert.NotNull (sc.SearchResultsTableViewBackingField, "3c"); - } - } - } -} - -#endif // !XAMCORE_3_0 && !MONOMAC diff --git a/tests/monotouch-test/UIKit/SimpleTextPrintFormatterTest.cs b/tests/monotouch-test/UIKit/SimpleTextPrintFormatterTest.cs index 195783b2fd5b..337f90f11e29 100644 --- a/tests/monotouch-test/UIKit/SimpleTextPrintFormatterTest.cs +++ b/tests/monotouch-test/UIKit/SimpleTextPrintFormatterTest.cs @@ -23,31 +23,6 @@ namespace MonoTouchFixtures.UIKit { [TestFixture] [Preserve (AllMembers = true)] public class SimpleTextPrintFormatterTest { - -#if !XAMCORE_3_0 // The default ctor is not available in XAMCORE_3_0+ - [Test] - public void DefaultCtor () - { - using (var stpf = new UISimpleTextPrintFormatter ()) { - Assert.That (stpf.Handle, Is.Not.EqualTo (IntPtr.Zero), "Handle"); - if (TestRuntime.CheckXcodeVersion (11, 0)) { - Assert.NotNull (stpf.Color, "Color"); - Assert.Null (stpf.Font, "Font"); - Assert.That (stpf.TextAlignment, Is.EqualTo (UITextAlignment.Natural), "TextAlignment"); - } else if (TestRuntime.CheckSystemVersion (ApplePlatform.iOS, 7, 0, throwIfOtherPlatform: false)) { - Assert.Null (stpf.Color, "Color"); - Assert.Null (stpf.Font, "Font"); - Assert.That (stpf.TextAlignment, Is.EqualTo (UITextAlignment.Natural), "TextAlignment"); - } else { - Assert.That (stpf.Color, Is.EqualTo (UIColor.Black), "Color"); - Assert.NotNull (stpf.Font, "Font"); - Assert.That (stpf.TextAlignment, Is.EqualTo (UITextAlignment.Left), "TextAlignment"); - } - Assert.That (stpf.Text, Is.Empty, "Text"); - } - } -#endif // !XAMCORE_3_0 - [Test] public void StringCtor () { diff --git a/tests/monotouch-test/UIKit/SliderTest.cs b/tests/monotouch-test/UIKit/SliderTest.cs deleted file mode 100644 index 94d4a5bf355d..000000000000 --- a/tests/monotouch-test/UIKit/SliderTest.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2011-2012 Xamarin Inc. All rights reserved - -#if !XAMCORE_3_0 && !MONOMAC - -using System; -using System.Drawing; -using System.Reflection; -using CoreGraphics; -using Foundation; -using UIKit; -using NUnit.Framework; - -namespace MonoTouchFixtures.UIKit { - - class SliderPoker : UISlider { - - static FieldInfo bkCurrentThumbImage; - static FieldInfo bkCurrentMinTrackImage; - static FieldInfo bkCurrentMaxTrackImage; - static FieldInfo bkMinValueImage; - static FieldInfo bkMaxValueImage; - - static SliderPoker () - { - var t = typeof (UISlider); - bkCurrentThumbImage = t.GetField ("__mt_CurrentThumbImage_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkCurrentMinTrackImage = t.GetField ("__mt_CurrentMinTrackImage_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkCurrentMaxTrackImage = t.GetField ("__mt_CurrentMaxTrackImage_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkMinValueImage = t.GetField ("__mt_MinValueImage_var", BindingFlags.Instance | BindingFlags.NonPublic); - bkMaxValueImage = t.GetField ("__mt_MaxValueImage_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public SliderPoker () - { - } - - public UIImage CurrentThumbImageBackingField { - get { - return (UIImage) bkCurrentThumbImage.GetValue (this); - } - } - - public UIImage CurrentMinTrackImageBackingField { - get { - return (UIImage) bkCurrentMinTrackImage.GetValue (this); - } - } - - public UIImage CurrentMaxTrackImageBackingField { - get { - return (UIImage) bkCurrentMaxTrackImage.GetValue (this); - } - } - - public UIImage MinValueImageBackingField { - get { - return (UIImage) bkMinValueImage.GetValue (this); - } - } - - public UIImage MaxValueImageBackingField { - get { - return (UIImage) bkMaxValueImage.GetValue (this); - } - } - } - - [TestFixture] - [Preserve (AllMembers = true)] - public class SliderTest { - - [Test] - public void InitWithFrame () - { - var frame = new CGRect (10, 10, 100, 100); - using (UISlider s = new UISlider (frame)) { - Assert.That (s.Frame, Is.EqualTo (frame), "Frame"); - } - } - - [Test] - public void Ctor_Default_BackingFields () - { - if (SliderPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var s = new SliderPoker ()) { - // default constructor does not set any UIViewController so the backing fields are null - Assert.Null (s.CurrentThumbImageBackingField, "1a"); - Assert.Null (s.CurrentMinTrackImageBackingField, "2a"); - Assert.Null (s.CurrentMaxTrackImageBackingField, "3a"); - Assert.Null (s.MinValueImageBackingField, "4a"); - Assert.Null (s.MaxValueImageBackingField, "5a"); - - Assert.Null (s.CurrentThumbImage, "1b"); - Assert.Null (s.CurrentMinTrackImage, "2b"); - Assert.Null (s.CurrentMaxTrackImage, "3b"); - Assert.Null (s.MinValueImage, "4b"); - Assert.Null (s.MaxValueImage, "5b"); - } - } - - [Test] - public void CurrentThumbImage_BackingFields () - { - if (SliderPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var i = new UIImage ()) - using (var s = new SliderPoker ()) { - // default constructor does not set any UIViewController so the backing fields are null - Assert.Null (s.CurrentThumbImageBackingField, "1a"); - Assert.Null (s.CurrentThumbImage, "1b"); - - s.SetThumbImage (i, UIControlState.Normal); - Assert.NotNull (s.CurrentThumbImageBackingField, "1c"); - Assert.NotNull (s.CurrentThumbImage, "1d"); - } - } - - [Test] - public void CurrentMinTrackImage_BackingFields () - { - if (SliderPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var i = new UIImage ()) - using (var s = new SliderPoker ()) { - // default constructor does not set any UIViewController so the backing fields are null - Assert.Null (s.CurrentMinTrackImageBackingField, "1a"); - Assert.Null (s.CurrentMinTrackImage, "1b"); - - s.SetMinTrackImage (i, UIControlState.Normal); - Assert.NotNull (s.CurrentMinTrackImageBackingField, "1c"); - Assert.NotNull (s.CurrentMinTrackImage, "1d"); - } - } - - [Test] - public void CurrentMaxTrackImage_BackingFields () - { - if (SliderPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - using (var i = new UIImage ()) - using (var s = new SliderPoker ()) { - // default constructor does not set any UIViewController so the backing fields are null - Assert.Null (s.CurrentMaxTrackImageBackingField, "1a"); - Assert.Null (s.CurrentMaxTrackImage, "1b"); - - s.SetMaxTrackImage (i, UIControlState.Normal); - Assert.NotNull (s.CurrentMaxTrackImageBackingField, "1c"); - Assert.NotNull (s.CurrentMaxTrackImage, "1d"); - } - } - } -} - -#endif // !XAMCORE_3_0 && !MONOMAC diff --git a/tests/monotouch-test/UIKit/StringAttributesTest.cs b/tests/monotouch-test/UIKit/StringAttributesTest.cs index f70a399fa62a..2b4e357f37ef 100644 --- a/tests/monotouch-test/UIKit/StringAttributesTest.cs +++ b/tests/monotouch-test/UIKit/StringAttributesTest.cs @@ -14,11 +14,7 @@ using UIKit; using NUnit.Framework; -#if XAMCORE_3_0 using TextAttributes = UIKit.UIStringAttributes; -#else -using TextAttributes = UIKit.UITextAttributes; -#endif namespace MonoTouchFixtures.UIKit { diff --git a/tests/monotouch-test/UIKit/UIDocumentTest.cs b/tests/monotouch-test/UIKit/UIDocumentTest.cs index 93803be14d71..40bb9a8f847e 100644 --- a/tests/monotouch-test/UIKit/UIDocumentTest.cs +++ b/tests/monotouch-test/UIKit/UIDocumentTest.cs @@ -22,34 +22,6 @@ namespace MonoTouchFixtures.UIKit { -#if !XAMCORE_3_0 - class DocumentPoker : UIDocument { - - static FieldInfo bkFileUrl; - - static DocumentPoker () - { - var t = typeof (UIDocument); - bkFileUrl = t.GetField ("__mt_FileUrl_var", BindingFlags.Instance | BindingFlags.NonPublic); - } - - public static bool NewRefcountEnabled () - { - return NSObject.IsNewRefcountEnabled (); - } - - public DocumentPoker (NSUrl url) : base (url) - { - } - - public NSUrl FileUrlBackingField { - get { - return (NSUrl) bkFileUrl.GetValue (this); - } - } - } - -#endif // !XAMCORE_3_0 class MyUrl : NSUrl { public MyUrl (string url, string annotation) : base (url) @@ -125,48 +97,6 @@ public void PerformAsynchronousFileAccess_Null () } } -#if !XAMCORE_3_0 - [Test] - public void FileUrl_BackingField () - { - if (DocumentPoker.NewRefcountEnabled ()) - Assert.Inconclusive ("backing fields are removed when newrefcount is enabled"); - - string file = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "uidocument.txt"); - if (File.Exists (file)) - File.Delete (file); - - using (NSUrl url = NSUrl.FromFilename (file)) - using (var doc = new DocumentPoker (url)) { - Assert.NotNull (doc.FileUrlBackingField, "1a"); - Assert.AreSame (doc.FileUrl, doc.FileUrlBackingField, "2a"); - // not a big deal in this case since we can't subclass NSUrl - } - } - - [Test] - [Ignore ("crash on the bots, run fines locally on sim")] - public void NSUrl_Subclass () - { - string file = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "uidocument.txt"); - if (File.Exists (file)) - File.Delete (file); - - // interesting limitation - using (MyUrl url2 = new MyUrl (file, "my document")) { - // Objective-C exception thrown. Name: NSInvalidArgumentException Reason: must pass a valid file URL to -[UIDocument initWithFileURL:] -#if NET - Assert.Throws (delegate { -#else - Assert.Throws (delegate - { -#endif - new DocumentPoker (url2); - }); - } - } -#endif // !XAMCORE_3_0 - [Test] public void Fields () { diff --git a/tests/monotouch-test/VideoToolbox/VTUtilitiesTests.cs b/tests/monotouch-test/VideoToolbox/VTUtilitiesTests.cs index 557edde95ed0..7e3d3f85db6b 100644 --- a/tests/monotouch-test/VideoToolbox/VTUtilitiesTests.cs +++ b/tests/monotouch-test/VideoToolbox/VTUtilitiesTests.cs @@ -55,21 +55,13 @@ public void ToCGImageTest () var pxbuffer = new CVPixelBuffer (originalCGImage.Width, originalCGImage.Height, CVPixelFormatType.CV32ARGB, new CVPixelBufferAttributes { CGImageCompatibility = true, CGBitmapContextCompatibility = true }); -#if !XAMCORE_3_0 - pxbuffer.Lock (CVOptionFlags.None); -#else pxbuffer.Lock (CVPixelBufferLock.None); -#endif using (var colorSpace = CGColorSpace.CreateDeviceRGB ()) using (var ctx = new CGBitmapContext (pxbuffer.BaseAddress, originalCGImage.Width, originalCGImage.Height, 8, 4 * originalCGImage.Width, colorSpace, CGBitmapFlags.NoneSkipLast)) { ctx.RotateCTM (0); ctx.DrawImage (new CGRect (0, 0, originalCGImage.Width, originalCGImage.Height), originalCGImage); -#if !XAMCORE_3_0 - pxbuffer.Unlock (CVOptionFlags.None); -#else pxbuffer.Unlock (CVPixelBufferLock.None); -#endif } Assert.NotNull (pxbuffer, "VTUtilitiesTests.ToCGImageTest pxbuffer should not be null"); 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/monotouch-test/dotnet/shared.csproj b/tests/monotouch-test/dotnet/shared.csproj index 59339e82e4b7..19995733734e 100644 --- a/tests/monotouch-test/dotnet/shared.csproj +++ b/tests/monotouch-test/dotnet/shared.csproj @@ -261,9 +261,9 @@ - - + Condition="!Exists('$(TestLibrariesDirectory)/.libs/dotnet/macos/custom-type-assembly.dll')" > + + diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/AssemblySetup.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/AssemblySetup.cs index c48fad5d318e..4c485e135bee 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/AssemblySetup.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/AssemblySetup.cs @@ -18,9 +18,6 @@ public void AssemblyInitialization () if (is_in_vsmac) { var env = new Dictionary { { "MD_APPLE_SDK_ROOT", Path.GetDirectoryName (Path.GetDirectoryName (Configuration.xcode_root)) }, - { "TargetFrameworkFallbackSearchPaths", Path.Combine (Configuration.TargetDirectoryXI, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks") }, - { "MSBuildExtensionsPathFallbackPathsOverride", Path.Combine (Configuration.TargetDirectoryXI, "Library", "Frameworks", "Mono.framework", "External", "xbuild") }, - { "MD_MTOUCH_SDK_ROOT", Path.Combine (Configuration.TargetDirectoryXI, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current") }, { "MSBUILD_EXE_PATH", msbuild_exe_path }, }; diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs deleted file mode 100644 index cd6218df2379..000000000000 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; -using System.Xml; -using NUnit.Framework; -using Xamarin.Tests; -using System.Linq; - -namespace Xamarin.MacDev.Tasks { - [TestFixture] - 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) - { - Configuration.AssertLegacyXamarinAvailable (); - - var fameworkListFileParts = frameworkListFile.Split ('-'); - string frameworkName = fameworkListFileParts [0]; - switch (frameworkName) { - case "Xamarin.iOS": - if (!Configuration.include_ios) - Assert.Inconclusive ("include_ios is disabled"); - break; - case "Xamarin.TVOS": - 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"); - break; - } - var isMac = frameworkName == "Xamarin.Mac"; - var isFull = fameworkListFileParts [1] == "Full"; - var frameworkListAssemblies = ScanFrameworkListXml (frameworkListFile); - var installedAssemblies = ScanAssemblyDirectory (frameworkName, isMac, isFull); - - foreach (var assembly in frameworkListAssemblies) { - if (!installedAssemblies.Any (a => a.Name == assembly.Name)) - ReportAssemblies (assembly, $"One or more assemblies listed in '{frameworkListFile}' were not found in the final SDK root folder. Update the list if an assembly was intentionally removed."); - } - - foreach (var assembly in installedAssemblies) { - if (!frameworkListAssemblies.Any (a => a.Name == assembly.Name)) - ReportAssemblies (assembly, $"One or more assemblies in the the SDK root folder are not listed in '{frameworkListFile}'. Update the list if an assembly was intentionally added."); - else if (!frameworkListAssemblies.Single (a => a.Name == assembly.Name).Equals (assembly)) - ReportAssemblies (assembly, $"One or more assemblies in the the SDK root folder do not match the entry in '{frameworkListFile}'. Update the list if an assembly was intentionally modified."); - } - } - - void ReportAssemblies (AssemblyInfo assembly, string message) - { - var errorCount = 0; - using (var sw = new StringWriter ()) { - using (var writer = XmlWriter.Create (sw, new XmlWriterSettings { Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Fragment, Indent = true })) { - writer.WriteStartElement ("File"); - writer.WriteAttributeString ("AssemblyName", assembly.Name); - WriteNonEmptyAttribute ("Version", assembly.Version); - WriteNonEmptyAttribute ("PublicKeyToken", assembly.PublicKeyToken); - WriteNonEmptyAttribute ("Culture", assembly.Culture); - if (assembly.ProcessorArchitecture != ProcessorArchitecture.None) - writer.WriteAttributeString ("ProcessorArchitecture", assembly.ProcessorArchitecture.ToString ()); - if (assembly.InGac) - writer.WriteAttributeString ("InGac", "true"); - writer.WriteEndElement (); - errorCount++; - - void WriteNonEmptyAttribute (string name, string val) - { - if (!string.IsNullOrEmpty (val)) - writer.WriteAttributeString (name, val); - } - } - Assert.AreEqual (0, errorCount, $"{message}\n{sw.ToString ()}"); - } - } - - List ScanFrameworkListXml (string frameworkListFile) - { - var assemblies = new List (); - var path = Path.GetFullPath (Path.Combine (Configuration.SourceRoot, "msbuild", "Xamarin.Shared", frameworkListFile)); - using (var reader = XmlReader.Create (path)) { - while (reader.Read ()) { - if (reader.IsStartElement ()) { - switch (reader.LocalName) { - case "File": - assemblies.Add (ReadFileElement (reader)); - break; - } - } - } - } - return assemblies; - } - - List ScanAssemblyDirectory (string frameworkName, bool isMac, bool isFull) - { - var assemblies = new List (); - var assembliesPath = Path.GetFullPath (Path.Combine (isMac ? Configuration.SdkRootXM : Configuration.MonoTouchRootDirectory, "lib", "mono", isFull ? "4.5" : frameworkName)); - AddAssemblies (assembliesPath); - AddAssemblies (Path.Combine (assembliesPath, "Facades")); - - void AddAssemblies (string path) - { - foreach (var f in Directory.EnumerateFiles (path, "*.dll")) { - try { - var an = AssemblyName.GetAssemblyName (f); - assemblies.Add (new AssemblyInfo (an)); - } catch (Exception ex) { - Assert.Fail ("Error reading assembly '{0}' in framework '{1}':{2}{3}", f, frameworkName, Environment.NewLine, ex); - } - } - } - - return assemblies; - } - - static AssemblyInfo ReadFileElement (XmlReader reader) - { - var ainfo = new AssemblyInfo (); - if (reader.MoveToAttribute ("AssemblyName") && reader.ReadAttributeValue ()) - ainfo.Name = reader.ReadContentAsString (); - if (string.IsNullOrEmpty (ainfo.Name)) - throw new Exception ("Missing AssemblyName attribute"); - if (reader.MoveToAttribute ("Version") && reader.ReadAttributeValue ()) - ainfo.Version = reader.ReadContentAsString (); - if (reader.MoveToAttribute ("PublicKeyToken") && reader.ReadAttributeValue ()) - ainfo.PublicKeyToken = reader.ReadContentAsString (); - if (reader.MoveToAttribute ("Culture") && reader.ReadAttributeValue ()) - ainfo.Culture = reader.ReadContentAsString (); - if (reader.MoveToAttribute ("ProcessorArchitecture") && reader.ReadAttributeValue ()) - ainfo.ProcessorArchitecture = (ProcessorArchitecture) - Enum.Parse (typeof (ProcessorArchitecture), reader.ReadContentAsString (), true); - if (reader.MoveToAttribute ("InGac") && reader.ReadAttributeValue ()) - ainfo.InGac = reader.ReadContentAsBoolean (); - return ainfo; - } - } - - class AssemblyInfo { - public string Name; - - public string Version; - - public string PublicKeyToken; - - public string Culture; - - public ProcessorArchitecture ProcessorArchitecture = ProcessorArchitecture.MSIL; - - public bool InGac; - - public AssemblyInfo () - { - } - - public AssemblyInfo (AssemblyName aname) - { - Name = aname.Name; - Version = aname.Version.ToString (); - ProcessorArchitecture = aname.ProcessorArchitecture; - Culture = aname.CultureInfo.Name; - string fn = aname.ToString (); - string key = "publickeytoken="; - int i = fn.IndexOf (key, StringComparison.OrdinalIgnoreCase) + key.Length; - int j = fn.IndexOf (',', i); - if (j == -1) j = fn.Length; - PublicKeyToken = fn.Substring (i, j - i); - } - - public bool Equals (AssemblyInfo other) - { - // ignore Culture and InGac for equality since those are not mentioned in the FrameworkList.xml - return other.Name == this.Name && - other.Version == this.Version && - other.PublicKeyToken == this.PublicKeyToken && - other.ProcessorArchitecture == this.ProcessorArchitecture; - } - } -} diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ACToolTaskTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ACToolTaskTest.cs new file mode 100644 index 000000000000..6c3204fe530c --- /dev/null +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ACToolTaskTest.cs @@ -0,0 +1,642 @@ +using System; +using System.IO; +using System.Linq; +using System.Collections.Generic; + +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +using NUnit.Framework; + +using Xamarin.MacDev; +using Xamarin.MacDev.Tasks; +using Xamarin.Tests; +using Xamarin.Utils; + +namespace Xamarin.MacDev.Tasks { + [TestFixture] + public class ACToolTaskTests : TestBase { + ACTool CreateACToolTask (ApplePlatform platform, string projectDir, out string intermediateOutputPath, params string [] imageAssets) + { + Configuration.IgnoreIfIgnoredPlatform (platform); + + intermediateOutputPath = Cache.CreateTemporaryDirectory (); + + var sdk = Sdks.GetAppleSdk (platform); + var version = AppleSdkVersion.UseDefault.ToString (); + var root = sdk.GetSdkPath (version, false); + var usr = Path.Combine (sdk.DeveloperRoot, "usr"); + var bin = Path.Combine (usr, "bin"); + string sdkPlatform; + var uiDeviceFamily = ""; + + switch (platform) { + case ApplePlatform.TVOS: + sdkPlatform = "AppleTVOS"; + uiDeviceFamily = "TV"; + break; + case ApplePlatform.iOS: + sdkPlatform = "iPhoneOS"; + uiDeviceFamily = "IPhone, IPad"; + break; + case ApplePlatform.MacOSX: + sdkPlatform = "MacOSX"; + break; + case ApplePlatform.MacCatalyst: + sdkPlatform = "MacCatalyst"; + break; + default: + throw new NotImplementedException (platform.ToString ()); + } + + var task = CreateTask (); + task.ImageAssets = imageAssets + .Select (v => { + var spl = v.Split ('|'); + var rv = new TaskItem (spl [0]); + rv.SetMetadata ("Link", spl [1]); + return rv; + }) + .Cast () + .ToArray (); + task.IntermediateOutputPath = intermediateOutputPath; + task.MinimumOSVersion = Xamarin.SdkVersions.GetMinVersion (platform).ToString (); + task.OutputPath = Path.Combine (intermediateOutputPath, "OutputPath"); + task.ProjectDir = projectDir; + task.SdkDevPath = Configuration.xcode_root; + task.SdkPlatform = sdkPlatform; + task.SdkVersion = version.ToString (); + task.SdkUsrPath = usr; + task.SdkBinPath = bin; + task.TargetFrameworkMoniker = TargetFramework.GetTargetFramework (platform, true).ToString (); + task.UIDeviceFamily = uiDeviceFamily; + return task; + } + + ACTool CreateACToolTaskWithResources (ApplePlatform platform) + { + var projectDir = Path.Combine (Configuration.SourceRoot, "tests", "dotnet", "AppWithXCAssets", platform.AsString ()); + var files = Directory.GetFiles (Path.Combine (projectDir, "Resources", "Images.xcassets"), "*", SearchOption.AllDirectories); + var imageAssets = files.Select (v => v + "|" + v.Substring (projectDir.Length + 1)).ToArray (); + return CreateACToolTask ( + platform, + projectDir, + out var _, + imageAssets + ); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void DefaultAppIcons (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + ExecuteTask (actool); + + Assert.IsNotNull (actool.PartialAppManifest, "PartialAppManifest"); + var appIconsManifestPath = actool.PartialAppManifest.ItemSpec!; + var appIconsManifest = PDictionary.FromFile (appIconsManifestPath)!; + Assert.AreEqual (0, appIconsManifest.Count, $"Partial plist contents: {actool.PartialAppManifest.ItemSpec}"); + var expectedXml = + """ + + + + + + + """; + PListAsserts.AreStringsEqual (expectedXml, File.ReadAllText (appIconsManifestPath), "Partial plist contents"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void AllAppIcons (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.IncludeAllAppIcons = true; + + ExecuteTask (actool); + + Assert.IsNotNull (actool.PartialAppManifest, "PartialAppManifest"); + + var appIconsManifestPath = actool.PartialAppManifest.ItemSpec!; + string expectedXml; + if (platform == ApplePlatform.TVOS) { + expectedXml = + """ + + + + + CFBundleIcons + + CFBundleAlternateIcons + + AlternateAppIcons + + CFBundleIconName + AlternateAppIcons + + + + + + """; + } else { + expectedXml = ""; + } + PListAsserts.AreStringsEqual (expectedXml, File.ReadAllText (appIconsManifestPath), "Partial plist contents"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void AllAppIconsWithAppIcon (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.IncludeAllAppIcons = true; + if (platform == ApplePlatform.TVOS) { + actool.AppIcon = "AlternateBrandAssets"; + } else { + actool.AppIcon = "AlternateAppIcons"; + } + + ExecuteTask (actool); + + Assert.IsNotNull (actool.PartialAppManifest, "PartialAppManifest"); + + var appIconsManifestPath = actool.PartialAppManifest?.ItemSpec!; + string expectedXml; + if (platform == ApplePlatform.MacOSX || platform == ApplePlatform.MacCatalyst) { + expectedXml = + """ + + + + + CFBundleIconFile + AlternateAppIcons + CFBundleIconName + AlternateAppIcons + + + """; + } else if (platform == ApplePlatform.TVOS) { + expectedXml = + """ + + + + + CFBundleIcons + + CFBundleAlternateIcons + + AlternateAppIcons + + CFBundleIconName + AlternateAppIcons + + + CFBundlePrimaryIcon + AppIcon + + TVTopShelfImage + + TVTopShelfPrimaryImage + TopShelfImage + TVTopShelfPrimaryImageWide + TopShelfImageWide + + + + """; + } else { + expectedXml = + """ + + + + + CFBundleIcons + + CFBundleAlternateIcons + + AppIcons + + CFBundleIconFiles + + AppIcons60x60 + AppIcons76x76 + + CFBundleIconName + AppIcons + + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AlternateAppIcons60x60 + + CFBundleIconName + AlternateAppIcons + + + CFBundleIcons~ipad + + CFBundleAlternateIcons + + AppIcons + + CFBundleIconFiles + + AppIcons60x60 + AppIcons76x76 + + CFBundleIconName + AppIcons + + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AlternateAppIcons60x60 + AlternateAppIcons76x76 + + CFBundleIconName + AlternateAppIcons + + + + + """; + } + PListAsserts.AreStringsEqual (expectedXml, File.ReadAllText (appIconsManifestPath), "Partial plist contents"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void AppIcon (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.AppIcon = "AppIcons"; + + ExecuteTask (actool); + + Assert.IsNotNull (actool.PartialAppManifest, "PartialAppManifest"); + + var appIconsManifestPath = actool.PartialAppManifest.ItemSpec!; + string expectedXml; + if (platform == ApplePlatform.MacOSX || platform == ApplePlatform.MacCatalyst) { + expectedXml = + """ + + + + + CFBundleIconFile + AppIcons + CFBundleIconName + AppIcons + + + """; + } else if (platform == ApplePlatform.TVOS) { + expectedXml = + """ + + + + + CFBundleIcons + + CFBundlePrimaryIcon + AppIcons + + TVTopShelfImage + + TVTopShelfPrimaryImage + TopShelfImage + TVTopShelfPrimaryImageWide + TopShelfImageWide + + + + """; + } else { + expectedXml = + """ + + + + + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcons60x60 + + CFBundleIconName + AppIcons + + + CFBundleIcons~ipad + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcons60x60 + AppIcons76x76 + + CFBundleIconName + AppIcons + + + + + """; + } + PListAsserts.AreStringsEqual (expectedXml, File.ReadAllText (appIconsManifestPath), "Partial plist contents"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void AppIconAndAlternateIcons (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + if (platform == ApplePlatform.TVOS) { + actool.AppIcon = "AppIcons"; + actool.AlternateAppIcons = new ITaskItem [] { new TaskItem ("AlternateAppIcons") }; + } else { + actool.AppIcon = "AppIcons"; + actool.AlternateAppIcons = new ITaskItem [] { new TaskItem ("AlternateAppIcons") }; + } + + ExecuteTask (actool); + + Assert.IsNotNull (actool.PartialAppManifest, "PartialAppManifest"); + + var appIconsManifestPath = actool.PartialAppManifest.ItemSpec!; + string expectedXml; + if (platform == ApplePlatform.MacOSX || platform == ApplePlatform.MacCatalyst) { + expectedXml = + """ + + + + + CFBundleIconFile + AppIcons + CFBundleIconName + AppIcons + + + """; + } else if (platform == ApplePlatform.TVOS) { + expectedXml = + """ + + + + + CFBundleIcons + + CFBundleAlternateIcons + + AlternateAppIcons + + CFBundleIconName + AlternateAppIcons + + + CFBundlePrimaryIcon + AppIcons + + TVTopShelfImage + + TVTopShelfPrimaryImage + TopShelfImage + TVTopShelfPrimaryImageWide + TopShelfImageWide + + + + """; + } else { + expectedXml = + """ + + + + + CFBundleIcons + + CFBundleAlternateIcons + + AlternateAppIcons + + CFBundleIconFiles + + AlternateAppIcons60x60 + AlternateAppIcons76x76 + + CFBundleIconName + AlternateAppIcons + + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcons60x60 + + CFBundleIconName + AppIcons + + + CFBundleIcons~ipad + + CFBundleAlternateIcons + + AlternateAppIcons + + CFBundleIconFiles + + AlternateAppIcons60x60 + AlternateAppIcons76x76 + + CFBundleIconName + AlternateAppIcons + + + CFBundlePrimaryIcon + + CFBundleIconFiles + + AppIcons60x60 + AppIcons76x76 + + CFBundleIconName + AppIcons + + + + + """; + } + PListAsserts.AreStringsEqual (expectedXml, File.ReadAllText (appIconsManifestPath), "Partial plist contents"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void AlternateIcons (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.AlternateAppIcons = new ITaskItem [] { new TaskItem ("AlternateAppIcons") }; + + ExecuteTask (actool); + + string expectedXml; + switch (platform) { + case ApplePlatform.TVOS: + expectedXml = """ + + + + + CFBundleIcons + + CFBundleAlternateIcons + + AlternateAppIcons + + CFBundleIconName + AlternateAppIcons + + + + + +"""; + break; + case ApplePlatform.iOS: + case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: + expectedXml = ""; + break; + default: + throw new NotImplementedException (platform.ToString ()); + } + + var appIconsManifestPath = actool.PartialAppManifest.ItemSpec!; + PListAsserts.AreStringsEqual (expectedXml, File.ReadAllText (appIconsManifestPath), "Partial plist contents"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void InexistentAppIcon (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.AppIcon = "InexistentAppIcons"; + + ExecuteTask (actool, 1); + string expectedErrorMessage; + switch (platform) { + case ApplePlatform.TVOS: + expectedErrorMessage = "Can't find the AppIcon 'InexistentAppIcons' among the image resources. There are 2 app icons in the image resources: AlternateBrandAssets, AppIcons."; + break; + case ApplePlatform.iOS: + case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: + expectedErrorMessage = "Can't find the AppIcon 'InexistentAppIcons' among the image resources. There are 2 app icons in the image resources: AlternateAppIcons, AppIcons."; + break; + default: + throw new NotImplementedException (platform.ToString ()); + } + Assert.AreEqual (expectedErrorMessage, Engine.Logger.ErrorEvents [0].Message, "Error message"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void InexistentAlternateIcons (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.AlternateAppIcons = new ITaskItem [] { new TaskItem ("InexistentAlternateAppIcons") }; + + ExecuteTask (actool, 1); + string expectedErrorMessage; + switch (platform) { + case ApplePlatform.TVOS: + expectedErrorMessage = "Can't find the AlternateAppIcon 'InexistentAlternateAppIcons' among the image resources. There are 5 app icons in the image resources: AlternateAppIcons, AppIcon, AppIcon-AppStore, AppIcons, AppIcons-AppStore."; + break; + case ApplePlatform.iOS: + case ApplePlatform.MacOSX: + case ApplePlatform.MacCatalyst: + expectedErrorMessage = "Can't find the AlternateAppIcon 'InexistentAlternateAppIcons' among the image resources. There are 2 app icons in the image resources: AlternateAppIcons, AppIcons."; + break; + default: + throw new NotImplementedException (platform.ToString ()); + } + Assert.AreEqual (expectedErrorMessage, Engine.Logger.ErrorEvents [0].Message, "Error message"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void BothAlternateAndMainIcon (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.AlternateAppIcons = new ITaskItem [] { new TaskItem ("AppIcons") }; + actool.AppIcon = "AppIcons"; + + ExecuteTask (actool, 1); + Assert.AreEqual ($"The image resource '{actool.AppIcon}' is specified as both 'AppIcon' and 'AlternateAppIcon'.", Engine.Logger.ErrorEvents [0].Message, "Error message"); + } + + [Test] + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void XSAppIconAssetsAndAppIcon (ApplePlatform platform) + { + var actool = CreateACToolTaskWithResources (platform); + actool.AppIcon = "AppIcons"; + actool.XSAppIconAssets = "Resources/Images.xcassets/AppIcons.appiconset"; + + ExecuteTask (actool, 1); + Assert.AreEqual ("Can't specify both 'XSAppIconAssets' in the Info.plist and 'AppIcon' in the project file. Please select one or the other.", Engine.Logger.ErrorEvents [0].Message, "Error message"); + } + } +} diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs index 93cc0b5e6d41..54b1e55a42d7 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs @@ -77,6 +77,36 @@ public void MultipleMinimumOSVersions () Assert.AreEqual ("13.0", plist.GetMinimumOSVersion (), "MinimumOSVersion"); } + [Test] + [TestCase (false, "14.0")] + [TestCase (true, "13.0")] + public void MultipleMinimumOSVersions_Overwrite (bool overwrite, string expectedMinimumOSVersion) + { + var dir = Cache.CreateTemporaryDirectory (); + var task = CreateTask (dir); + + var mainPath = Path.Combine (dir, "Info.plist"); + var main = new PDictionary (); + main.SetMinimumOSVersion ("14.0"); + main.Save (mainPath); + + var partialPath = Path.Combine (dir, "PartialAppManifest.plist"); + var partial = new PDictionary (); + partial.SetMinimumOSVersion ("13.0"); + partial.Save (partialPath); + + task.AppManifest = new TaskItem (mainPath); + var partialAppManifest = new TaskItem (partialPath); + partialAppManifest.SetMetadata ("Overwrite", overwrite ? "true" : "false"); + task.PartialAppManifests = new [] { partialAppManifest }; + task.SupportedOSPlatformVersion = "14.0"; + + ExecuteTask (task); + + var plist = PDictionary.FromFile (task.CompiledAppManifest!.ItemSpec)!; + Assert.AreEqual (expectedMinimumOSVersion, plist.GetMinimumOSVersion (), "MinimumOSVersion"); + } + [Test] public void ErrorWithMismatchedInfoPlistMinimumOSVersion () { diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs index 00c90fc9d9a1..17186c306f29 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs @@ -34,8 +34,8 @@ CustomCompileEntitlements CreateEntitlementsTask (out string compiledEntitlement task.AppBundleDir = AppBundlePath; task.BundleIdentifier = "com.xamarin.MySingleView"; task.CompiledEntitlements = new TaskItem (Path.Combine (MonoTouchProjectObjPath, "Entitlements.xcent")); - task.Entitlements = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "Resources", "Entitlements.plist"); - task.ProvisioningProfile = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "Resources", "profile.mobileprovision"); + task.Entitlements = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location)!, "Resources", "Entitlements.plist"); + task.ProvisioningProfile = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location)!, "Resources", "profile.mobileprovision"); task.SdkPlatform = "iPhoneOS"; task.SdkVersion = "6.1"; task.TargetFrameworkMoniker = "Xamarin.iOS,v1.0"; diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs index 9255a818a2fc..d72eecdb893b 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs @@ -496,7 +496,7 @@ public void DuplicatedWithDifferentMetadata (ApplePlatform platform, bool isDotN Assert.AreEqual (3, Engine.Logger.WarningsEvents.Count, "Warning Count"); Assert.AreEqual ("Code signing has been requested multiple times for 'Bundle.app/Contents/MonoBundle/createdump', with different metadata. The metadata 'OnlyIn1=true' has been set for one item, but not the other.", Engine.Logger.WarningsEvents [0].Message, "Message #0"); Assert.AreEqual ("Code signing has been requested multiple times for 'Bundle.app/Contents/MonoBundle/createdump', with different metadata. The metadata 'InOneAndTwoWithDifferentValues' has different values for each item (once it's '1', another time it's '2').", Engine.Logger.WarningsEvents [1].Message, "Message #1"); - Assert.AreEqual ("Code signing has been requested multiple times for 'Bundle.app/Contents/MonoBundle/createdump', with different metadata. The metadata for one are: 'RequireCodeSigning, OnlyIn1, InOneAndTwoWithDifferentValues, CodesignStampFile', while the metadata for the other are: 'RequireCodeSigning, CodesignStampFile'", Engine.Logger.WarningsEvents [2].Message, "Message #2"); + Assert.AreEqual ("Code signing has been requested multiple times for 'Bundle.app/Contents/MonoBundle/createdump', with different metadata. The metadata for one are: 'CodesignStampFile, InOneAndTwoWithDifferentValues, OnlyIn1, RequireCodeSigning', while the metadata for the other are: 'CodesignStampFile, RequireCodeSigning'", Engine.Logger.WarningsEvents [2].Message, "Message #2"); VerifyCodesigningResults (infos, task.OutputCodesignItems, platform); } finally { @@ -532,7 +532,7 @@ void VerifyCodesigningResults (CodesignInfo [] infos, ITaskItem [] outputCodesig var metadata = item.GetMetadata (kvp.Key); if (metadata == string.Empty && kvp.Value != string.Empty) { failures.Add ($"Item '{info.ItemSpec}': Expected metadata '{kvp.Key}' not found (with value '{kvp.Value}')."); - } else if (!string.Equals (metadata, kvp.Value)) { + } else if (!string.Equals (metadata, kvp.Value, StringComparison.Ordinal)) { failures.Add ($"Item '{info.ItemSpec}': Expected value '{kvp.Value}' for metadata '{kvp.Key}', but got '{metadata}' instead.\nExpected: {kvp.Value}\nActual: {metadata}"); } } @@ -587,7 +587,7 @@ void Touch (string root, params string [] files) if (file.EndsWith (".appex", StringComparison.OrdinalIgnoreCase) || file.EndsWith (".app", StringComparison.OrdinalIgnoreCase)) { Directory.CreateDirectory (f); } else { - Directory.CreateDirectory (Path.GetDirectoryName (file)); + Directory.CreateDirectory (Path.GetDirectoryName (file)!); File.WriteAllText (file, string.Empty); } } @@ -637,7 +637,7 @@ public static Dictionary CopyCustomMetadata (this ITaskItem self { var rv = new Dictionary (); foreach (DictionaryEntry de in self.CloneCustomMetadata ()) { - rv [(string) de.Key] = (string) de.Value; + rv [(string) de.Key!] = (string) de.Value!; } return rv; } 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/MTouchTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MTouchTaskTests.cs index 0f357b4c8d1e..8831a7b4890a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MTouchTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MTouchTaskTests.cs @@ -206,26 +206,6 @@ public void BuildEntitlementFlagsTest () Assert.That (args, Does.Contain ("Entitlements.plist"), "#2"); } - [Test] - public void ReferenceFrameworkFileResolution_WhenReceivedReferencePathExists () - { - using (var sdk = new TempSdk ()) { - Task.TargetFrameworkMoniker = "MonoTouch,v1.0"; - - var expectedPath = Path.Combine (Cache.CreateTemporaryDirectory (), "tmpfile"); - - Task.References = new [] { new TaskItem (expectedPath, new Dictionary { { "FrameworkFile", "true" } }) }; - - var args = Task.GenerateCommandLineCommands (); - - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - // In Windows, the path slashes are escaped. - expectedPath = expectedPath.Replace ("\\", "\\\\"); - - Assert.IsTrue (Task.ResponseFile.Contains (expectedPath)); - } - } - [Test] public void ResponseFileTest () { @@ -233,70 +213,6 @@ public void ResponseFileTest () Assert.IsTrue (args.Contains ($"@{Task.ResponseFilePath}"), "#@response-file"); } - [TestCase ("Xamarin.iOS,v1.0", "Xamarin.iOS")] - public void ReferenceFrameworkFileResolution_WhenFacadeFileExists (string targetFrameworkMoniker, string frameworkDir) - { - using (var sdk = new TempSdk ()) { - Task.TargetFrameworkMoniker = targetFrameworkMoniker; - var expectedPath = Path.Combine (Sdks.XamIOS.LibDir, "mono", frameworkDir, "Facades", "System.Collections.dll"); - Directory.CreateDirectory (Path.GetDirectoryName (expectedPath)); - File.WriteAllText (expectedPath, ""); - - Task.References = new [] { new TaskItem ("System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; - - var args = Task.GenerateCommandLineCommands (); - - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - // In Windows, the path slashes are escaped. - expectedPath = expectedPath.Replace ("\\", "\\\\"); - - Assert.IsTrue (Task.ResponseFile.Contains (expectedPath), string.Format ( - @"Failed to resolve facade assembly to the Sdk path. - Expected path:{0} - - Actual args:{1}", expectedPath, Task.ResponseFile)); - } - } - - [TestCase ("Xamarin.iOS,v1.0", "Xamarin.iOS")] - public void ReferenceFrameworkFileResolution_WhenFrameworkFileExists (string targetFrameworkMoniker, string frameworkDir) - { - using (var sdk = new TempSdk ()) { - Task.TargetFrameworkMoniker = targetFrameworkMoniker; - var expectedPath = Path.Combine (Sdks.XamIOS.LibDir, "mono", frameworkDir, "System.Collections.dll"); - Directory.CreateDirectory (Path.GetDirectoryName (expectedPath)); - File.WriteAllText (expectedPath, ""); - - Task.References = new [] { new TaskItem ("System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; - - var args = Task.GenerateCommandLineCommands (); - - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - // In Windows, the path slashes are escaped. - expectedPath = expectedPath.Replace ("\\", "\\\\"); - - Assert.IsTrue (Task.ResponseFile.Contains (expectedPath), string.Format ( - @"Failed to resolve facade assembly to the Sdk path. - Expected path:{0} - - Actual args:{1}", expectedPath, Task.ResponseFile)); - } - } - - [TestCase ("Xamarin.iOS,v1.0", "Xamarin.iOS")] - public void ReferenceFrameworkFileResolution_WhenResolutionFails (string targetFrameworkMoniker, string frameworkDir) - { - using (var sdk = new TempSdk ()) { - Task.TargetFrameworkMoniker = targetFrameworkMoniker; - - Task.References = new [] { new TaskItem ("/usr/foo/System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; - - var args = Task.GenerateCommandLineCommands (); - - Assert.IsTrue (Task.ResponseFile.Contains ("/usr/foo/System.Collections.dll")); - } - } - [Test] public void NativeReference_None () { @@ -344,28 +260,5 @@ public void NativeReference_Framework () // 3 additional files (as we do not duplicate the TaskItem for the native library itself) Assert.That (items.Count (), Is.EqualTo (3), "framework files"); } - - class TempSdk : IDisposable { - MonoTouchSdk sdk; - - public TempSdk () - { - SdkDir = Cache.CreateTemporaryDirectory (); - Directory.CreateDirectory (Path.Combine (SdkDir, "bin")); - File.WriteAllText (Path.Combine (SdkDir, "Version"), "1.0.0.0"); // Fake Version file so that MonoTouchSdk detects this as a real Sdk location. - File.WriteAllText (Path.Combine (SdkDir, "bin", "mtouch"), "echo \"fake mtouch\""); // Fake mtouch binary so that MonoTouchSdk detects this as a real Sdk location. - Directory.CreateDirectory (Path.Combine (SdkDir, "lib")); - sdk = Sdks.XamIOS; - - Sdks.XamIOS = new MonoTouchSdk (SdkDir); - } - - public string SdkDir { get; private set; } - - public void Dispose () - { - Sdks.XamIOS = sdk; - } - } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs index f74137996492..d99670d24726 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs @@ -23,8 +23,7 @@ public void SetUp () }; RunMake (Path.Combine (Configuration.RootPath, "tests", "test-libraries"), environment: env); - if (Configuration.include_dotnet) - RunMake (Path.Combine (Configuration.RootPath, "tests", "common", "TestProjects", "ComplexAssembly"), environment: env); + RunMake (Path.Combine (Configuration.RootPath, "tests", "common", "TestProjects", "ComplexAssembly"), environment: env); } static void RunMake (string directory, Dictionary environment = null) diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs index 838d1be627ce..431fc489d2cd 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Threading; using Microsoft.Build.Utilities; using NUnit.Framework; @@ -38,9 +39,9 @@ public void Xcode12_x (string targetFrameworkMoniker, bool isSimulator, string a // some architecture changes recently, e.g. // in Xcode 12.1+ watchOS does not have an i386 architecture anymore // on Xcode 12.2+ you get arm64 for all (iOS, tvOS and watchOS) simulators - var path = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "Resources", "xcf-xcode12.2.plist"); + var path = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location)!, "Resources", "xcf-xcode12.2.plist"); var plist = PDictionary.FromFile (path)!; - var result = ResolveNativeReferences.TryResolveXCFramework (log, plist, "N/A", targetFrameworkMoniker, isSimulator, architecture, out var frameworkPath); + var result = ResolveNativeReferences.TryResolveXCFramework (log, plist, "N/A", targetFrameworkMoniker, isSimulator, architecture, null, out var frameworkPath); Assert.AreEqual (result, !string.IsNullOrEmpty (expected), "result"); Assert.That (frameworkPath, Is.EqualTo (expected), "frameworkPath"); } @@ -51,9 +52,9 @@ public void Xcode12_x (string targetFrameworkMoniker, bool isSimulator, string a [TestCase (TargetFramework.Xamarin_WatchOS_1_0_String, true, "i386", "watchos-i386-simulator/XTest.framework/XTest")] public void PreXcode12 (string targetFrameworkMoniker, bool isSimulator, string architecture, string expected) { - var path = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location), "Resources", "xcf-prexcode12.plist"); + var path = Path.Combine (Path.GetDirectoryName (GetType ().Assembly.Location)!, "Resources", "xcf-prexcode12.plist"); var plist = PDictionary.FromFile (path)!; - var result = ResolveNativeReferences.TryResolveXCFramework (log, plist, "N/A", targetFrameworkMoniker, isSimulator, architecture, out var frameworkPath); + var result = ResolveNativeReferences.TryResolveXCFramework (log, plist, "N/A", targetFrameworkMoniker, isSimulator, architecture, null, out var frameworkPath); Assert.AreEqual (result, !string.IsNullOrEmpty (expected), "result"); Assert.That (frameworkPath, Is.EqualTo (expected), "frameworkPath"); } @@ -62,7 +63,7 @@ public void PreXcode12 (string targetFrameworkMoniker, bool isSimulator, string public void BadInfoPlist () { var plist = new PDictionary (); - var result = ResolveNativeReferences.TryResolveXCFramework (log, plist, "N/A", TargetFramework.DotNet_iOS_String, false, "x86_64", out var frameworkPath); + var result = ResolveNativeReferences.TryResolveXCFramework (log, plist, "N/A", TargetFramework.DotNet_iOS_String, false, "x86_64", null, out var frameworkPath); Assert.IsFalse (result, "Invalid Info.plist"); } } 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/TestHelpers/Logger.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/Logger.cs index bb131d1b7ad4..77523db0ce61 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/Logger.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/Logger.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Microsoft.Build.Framework; @@ -48,5 +49,33 @@ public void Clear () MessageEvents.Clear (); WarningsEvents.Clear (); } + + public IEnumerable AllEvents { + get { + var rv = new List (); + rv.AddRange (CustomEvents); + rv.AddRange (ErrorEvents); + rv.AddRange (MessageEvents); + rv.AddRange (WarningsEvents); + return rv; + } + } + } + + public static class BuildEventArgsExtensions { + public static string AsString (this BuildEventArgs ea) + { + if (ea is BuildErrorEventArgs eea) { + return $"{eea.Code}: error: {eea.Message}"; + } else if (ea is BuildMessageEventArgs bmea) { + return $"{bmea.Code}: {bmea.Message}"; + } else if (ea is BuildWarningEventArgs bwea) { + return $"{bwea.Code}: warning: {bwea.Message}"; + } else if (ea is CustomBuildEventArgs cbea) { + return cbea.Message; + } else { + return ea.Message; + } + } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs index b836f1fc62d9..c3ecbbe86ac9 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs @@ -67,8 +67,9 @@ public void ExecuteTask (Task task, int expectedErrorCount = 0) var rv = task.Execute (); if (expectedErrorCount != Engine.Logger.ErrorEvents.Count) { string messages = string.Empty; - if (Engine.Logger.ErrorEvents.Count > 0) { - messages = "\n\t" + string.Join ("\n\t", Engine.Logger.ErrorEvents.Select ((v) => v.Message).ToArray ()); + var allEvents = Engine.Logger.AllEvents.ToArray (); + if (allEvents.Any ()) { + messages = "\n\t" + string.Join ("\n\t", allEvents.Select ((v) => v.AsString ()).ToArray ()); } Assert.AreEqual (expectedErrorCount, Engine.Logger.ErrorEvents.Count, "#RunTask-ErrorCount" + messages); } 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 126d96deee76..33be922235b1 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 @@ -1,7 +1,7 @@ - net472 + net$(BundledNETCoreAppTargetFrameworkVersion) false true latest @@ -32,12 +32,12 @@ - - - - - - + + + + + + @@ -52,6 +52,9 @@ external\Configuration.cs + + external\ConfigurationNUnit.cs + external\DotNet.cs @@ -64,6 +67,15 @@ external\ErrorHelper.tests.cs + + external\PListAsserts.cs + + + external\SdkVersions.cs + + + external\StringUtils.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/ProjectsTests/ProjectReference.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectReference.cs index 0f9bef6e937c..c21fc0dc3eb8 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectReference.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectReference.cs @@ -25,7 +25,7 @@ public void BasicTest () NugetRestore (Path.Combine (Configuration.TestProjectsDirectory, "MyExtensionWithPackageReference", "MyExtensionWithPackageReference.csproj")); // Can't use the in-process MSBuild engine, because it complains that the project file is invalid (the attribute 'Version' in the element '' is unrecognized) - var rv = ExecutionHelper.Execute (Configuration.XIBuildPath, new [] { "--", Path.Combine (Configuration.TestProjectsDirectory, "MyAppWithPackageReference", "MyAppWithPackageReference.csproj"), $"/p:Platform={Platform}", "/p:Configuration=Debug" }, out var output); + var rv = ExecutionHelper.Execute ("Legacy projects not supported anymore", new [] { "--", Path.Combine (Configuration.TestProjectsDirectory, "MyAppWithPackageReference", "MyAppWithPackageReference.csproj"), $"/p:Platform={Platform}", "/p:Configuration=Debug" }, out var output); if (rv != 0) { Console.WriteLine ("Build failed:"); Console.WriteLine (output); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs index 6cf38341ca61..aed1fa38d413 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs @@ -100,17 +100,17 @@ static string [] ExpectedLibraryEmbeddedResources { return new [] { "MyLibrary.MyLibraryFolder.LibraryLinkedEmbeddedResource.txt", "MyLibrary.MyLibraryFolder.LibraryEmbeddedResource.txt", - "__monotouch_content_MyLibraryFolder_fLibraryLinkedBundleResource.txt", - "__monotouch_content_MyLibraryFolder_fLibraryBundleResource.txt", - "__monotouch_content_MyLibraryFolder_fLibraryLinkedContent.txt", - "__monotouch_content_MyLibraryFolder_fLibraryContent.txt", - "__monotouch_content_LibraryStoryboard.storyboardc_f1-view-2.nib", - "__monotouch_content_LibraryStoryboard.storyboardc_fInfo.plist", - "__monotouch_content_LibraryStoryboard.storyboardc_fUIViewController-1.nib", - "__monotouch_content_LibrarySecondStoryboard.storyboardc_f43-view-49.nib", - "__monotouch_content_LibrarySecondStoryboard.storyboardc_f45-view-53.nib", - "__monotouch_content_LibrarySecondStoryboard.storyboardc_fInfo.plist", - "__monotouch_content_LibrarySecondStoryboard.storyboardc_fUITabBarController-41.nib" + "__monotouch_content_MyLibraryFolder_sLibraryLinkedBundleResource.txt", + "__monotouch_content_MyLibraryFolder_sLibraryBundleResource.txt", + "__monotouch_content_MyLibraryFolder_sLibraryLinkedContent.txt", + "__monotouch_content_MyLibraryFolder_sLibraryContent.txt", + "__monotouch_content_LibraryStoryboard.storyboardc_s1-view-2.nib", + "__monotouch_content_LibraryStoryboard.storyboardc_sInfo.plist", + "__monotouch_content_LibraryStoryboard.storyboardc_sUIViewController-1.nib", + "__monotouch_content_LibrarySecondStoryboard.storyboardc_s43-view-49.nib", + "__monotouch_content_LibrarySecondStoryboard.storyboardc_s45-view-53.nib", + "__monotouch_content_LibrarySecondStoryboard.storyboardc_sInfo.plist", + "__monotouch_content_LibrarySecondStoryboard.storyboardc_sUITabBarController-41.nib" }; } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs index 59b130f99d1d..f89ef2500cc2 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs @@ -238,23 +238,7 @@ static ExecutionResult MSBuild (ApplePlatform platform, string project, string t if (!File.Exists (project)) throw new FileNotFoundException ($"The project file '{project}' does not exist."); - var args = new List (); - args.Add ("--"); - args.Add ($"/t:{target}"); - args.Add (project); - if (properties is not null) { - foreach (var prop in properties) - args.Add ($"/p:{prop.Key}={prop.Value}"); - } - var binlog = Path.Combine (Path.GetDirectoryName (project), $"log-{target}-{DateTime.Now:yyyyMMdd_HHmmss}.binlog"); - args.Add ($"/bl:{binlog}"); - - var output = new StringBuilder (); - var executable = Configuration.XIBuildPath; - var rv = Execution.RunWithStringBuildersAsync (executable, args, Configuration.GetBuildEnvironment (platform), output, output, Console.Out, workingDirectory: Path.GetDirectoryName (project), timeout: TimeSpan.FromMinutes (10)).Result; - return new ExecutionResult (output, output, rv.ExitCode) { - BinLogPath = binlog, - }; + throw new NotSupportedException ("Legacy projects not supported anymore"); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj b/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj index 87ff4869076f..2e130dd64d2a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj +++ b/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj @@ -1,7 +1,7 @@ - net472 + net$(BundledNETCoreAppTargetFrameworkVersion) false true latest @@ -11,8 +11,8 @@ - - + + @@ -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..c707cf8cd19a 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)] @@ -2760,14 +2729,6 @@ public void BuildTestProject (Target target, Profile profile, string subdir, str XBuild.BuildXI (csproj, configuration, platform, timeout: TimeSpan.FromMinutes (15)); } - [Test] - public void ScriptedTests () - { - AssertDeviceAvailable (); - - ExecutionHelper.Execute ("make", new [] { "-C", Path.Combine (Configuration.SourceRoot, "tests", "scripted") }, timeout: TimeSpan.FromMinutes (10)); - } - [Test] // fully linked + llvm (+thumb) + default registrar [TestCase (Target.Dev, MTouchLinker.Unspecified, MTouchRegistrar.Static, "armv7+llvm")] diff --git a/tests/mtouch/Makefile b/tests/mtouch/Makefile index 088f8dd8261e..14d40beb8c8e 100644 --- a/tests/mtouch/Makefile +++ b/tests/mtouch/Makefile @@ -32,7 +32,7 @@ mtouchtests.csproj.inc: export BUILD_VERBOSITY=$(MSBUILD_VERBOSITY) -include mtouchtests.csproj.inc bin/Debug/mtouchtests.dll: $(mtouchtests_dependencies) - $(SYSTEM_XIBUILD) -- mtouchtests.csproj /r $(XBUILD_VERBOSITY) /bl + $(SYSTEM_MSBUILD) mtouchtests.csproj /r $(XBUILD_VERBOSITY) /bl $(Q) rm -f .failed-stamp $(abspath $(TOP)/tools/mtouch/Constants.cs): diff --git a/tests/mtouch/MonoNativeTests.cs b/tests/mtouch/MonoNativeTests.cs deleted file mode 100644 index f132c64667b3..000000000000 --- a/tests/mtouch/MonoNativeTests.cs +++ /dev/null @@ -1,271 +0,0 @@ -// -// MonoNativeTests.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; -using System.IO; -using System.Linq; -using NUnit.Framework; - -// using MTouchLinker = Xamarin.Tests.LinkerOption; -// using ExecutionHelper = Xamarin.Tests.ExecutionHelper; -// using MTouchRegistrar = Xamarin.Tests.RegistrarOption; - -namespace Xamarin { - using Tests; - using Utils; - - [TestFixture] - public class MonoNativeTests { - [Test] - public void TestDebugSymlink () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Debug = true; - mtouch.Linker = LinkerOption.DontLink; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertSymlinked (mtouch.AppPath); - } - } - - [Test] - public void TestDebugLinkOut () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Debug = true; - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - public void TestDeviceLinkOut () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Linker = LinkerOption.LinkSdk; - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - public void TestDebugLinkAll () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (code: MonoNativeInitialize); - mtouch.Debug = true; - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - public void TestDeviceLinkAll () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (code: MonoNativeInitialize); - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - AssertStaticLinked (mtouch); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_mono_native_initialize")); - Assert.That (mtouch.NativeSymbolsInExecutable, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - } - } - - [Test] - [TestCase (Profile.iOS, "9.3", "libmono-native-compat.dylib", SdkVersions.MiniOS)] - [TestCase (Profile.iOS, "10.0", "libmono-native-unified.dylib", SdkVersions.MiniOS)] - [TestCase (Profile.tvOS, "9.0", "libmono-native-compat.dylib", SdkVersions.MinTVOS)] - [TestCase (Profile.tvOS, "10.0", "libmono-native-unified.dylib", SdkVersions.MinTVOS)] - [TestCase (Profile.watchOS, "2.0", "libmono-native-compat.dylib", SdkVersions.MinWatchOS)] - [TestCase (Profile.watchOS, "5.0", "libmono-native-unified.dylib", SdkVersions.MinWatchOS)] - public void TestDeviceDylib (Profile profile, string version, string mono_native_dylib, string min_version) - { - if (mono_native_dylib.Contains ("compat") && Version.Parse (min_version) > Version.Parse (version)) - Assert.Ignore ("No OS versions that require compat libmono-unified are supported anymore"); - if (Version.Parse (min_version) > Version.Parse (version)) - version = min_version; - - using (var mtouch = new MTouchTool ()) { - mtouch.Profile = profile; - if (profile == Profile.watchOS) { - mtouch.CreateTemporaryWatchKitExtension (code: MonoNativeWatchInitialize, extraCode: MonoNativeInitialize); - } else { - mtouch.CreateTemporaryApp (code: MonoNativeInitialize); - } - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssemblyBuildTargets.Add ("@all=dynamiclibrary"); - mtouch.TargetVer = version; - - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - var files = Directory.EnumerateFiles (mtouch.AppPath, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (1), "One single libmono-native* library"); - Assert.That (files.First (), Is.EqualTo (mono_native_dylib)); - - var mono_native_path = Path.Combine (mtouch.AppPath, mono_native_dylib); - - var symbols = MTouch.GetNativeSymbols (mono_native_path); - var otool_dylib = ExecutionHelper.Execute ("otool", new [] { "-L", mono_native_path }, hide_output: true); - - Assert.That (symbols, Does.Contain ("_mono_native_initialize")); - Assert.That (otool_dylib, Does.Contain ($"@rpath/{mono_native_dylib}")); - Assert.That (otool_dylib.Replace (mono_native_path, ""), Does.Not.Contain ("/Users/")); - - if (profile == Profile.iOS) { - Assert.That (symbols, Does.Contain ("_NetSecurityNative_ImportUserName")); - Assert.That (otool_dylib, Does.Contain ("/System/Library/Frameworks/GSS.framework/GSS")); - } else { - Assert.That (symbols, Does.Not.Contain ("_NetSecurityNative_ImportUserName")); - Assert.That (otool_dylib, Does.Not.Contain ("/System/Library/Frameworks/GSS.framework/GSS")); - } - - var otool_exe = ExecutionHelper.Execute ("otool", new [] { "-L", mtouch.NativeExecutablePath }, hide_output: true); - Assert.That (otool_exe, Does.Not.Contain ("GSS")); - Assert.That (otool_exe, Does.Contain ($"@rpath/{mono_native_dylib}")); - } - } - - [Test] - public void TestDeviceFrameworkLinkOut () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (); - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssemblyBuildTargets.Add ("@all=framework"); - mtouch.TargetVer = SdkVersions.MiniOSVersion.Major >= 10 ? SdkVersions.MiniOS : "10.0"; - - mtouch.AssertExecute (MTouchAction.BuildDev, "build"); - - var files = Directory.EnumerateFiles (mtouch.AppPath, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (0), "No libmono-native* library"); - } - } - - [Test] - public void TestGss () - { - using (var mtouch = new MTouchTool ()) { - mtouch.CreateTemporaryApp (code: MonoNativeGss); - mtouch.Linker = LinkerOption.LinkAll; - mtouch.AssertExecute (MTouchAction.BuildSim, "build"); - - AssertStaticLinked (mtouch); - var symbols = mtouch.NativeSymbolsInExecutable; - Assert.That (symbols, Does.Contain ("_mono_native_initialize")); - Assert.That (symbols, Does.Contain ("_NetSecurityNative_ImportUserName")); - - var otool_exe = ExecutionHelper.Execute ("otool", new [] { "-L", mtouch.NativeExecutablePath }, hide_output: true); - Assert.That (otool_exe, Does.Contain ("/System/Library/Frameworks/GSS.framework/GSS")); - } - } - - [Test] - public void TestGssTv () - { - using (var mtouch = new MTouchTool ()) { - mtouch.Profile = Profile.tvOS; - mtouch.CreateTemporaryApp (code: MonoNativeGss); - mtouch.Linker = LinkerOption.LinkAll; - - mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build"); - mtouch.AssertError (5214, "Native linking failed, undefined symbol: _NetSecurityNative_ImportUserName. This symbol was referenced by the managed member X.NetSecurityNative_ImportUserName. Please verify that all the necessary frameworks have been referenced and native libraries linked."); - } - } - - void AssertSymlinked (string path) - { - var files = Directory.EnumerateFiles (path, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (1), "One single libmono-native* library"); - Assert.That (files.First (), Is.EqualTo ("libmono-native.dylib"), "Found libmono-native.dylib"); - } - - void AssertStaticLinked (MTouchTool app) - { - var files = Directory.EnumerateFiles (app.AppPath, "libmono-native*", SearchOption.AllDirectories).Select (Path.GetFileName); - Assert.That (files.Count, Is.EqualTo (0), "No libmono-native* libraries"); - } - - string MonoNativeWatchInitialize => @" -using WatchKit; -public partial class NotificationController : WKUserNotificationInterfaceController -{ - protected NotificationController (System.IntPtr handle) : base (handle) { X.Main(); } -} -"; - - string MonoNativeInitialize => @" -class X { - [System.Runtime.InteropServices.DllImport (""System.Native"")] - extern static void mono_native_initialize (); - - public static void Main () - { - System.Console.WriteLine (typeof (ObjCRuntime.Runtime).ToString ()); - mono_native_initialize (); - } -} -"; - - string MonoNativeGss => @" -using System; - -class X { - [System.Runtime.InteropServices.DllImport (""System.Native"")] - extern static void mono_native_initialize (); - - [System.Runtime.InteropServices.DllImport (""System.Net.Security.Native"")] - extern static void NetSecurityNative_ImportUserName (IntPtr a, IntPtr b, int c, IntPtr d); - - static void Main () - { - // Reference Xamarin.iOS - var runtime = typeof (ObjCRuntime.Runtime).ToString (); - // Always false, but the linker does not know that, so the following code won't be linked out. - if (runtime.Equals (""XXX"")) { - mono_native_initialize (); - NetSecurityNative_ImportUserName (IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero); - } - } -} -"; - - } -} diff --git a/tests/mtouch/mtouchtests.csproj b/tests/mtouch/mtouchtests.csproj index feec07e1769c..be319512d85d 100644 --- a/tests/mtouch/mtouchtests.csproj +++ b/tests/mtouch/mtouchtests.csproj @@ -44,6 +44,9 @@ Configuration.cs + + ConfigurationNUnit.cs + @@ -74,7 +77,6 @@ BundlerTool.cs - SdkVersions.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 b3ff5765d1d4..11bb868ab3be 100755 --- a/tests/package-mac-tests.sh +++ b/tests/package-mac-tests.sh @@ -16,72 +16,40 @@ mkdir -p "$DIR" make test.config cat test.config -INCLUDE_XAMARIN_LEGACY=$(grep ^INCLUDE_XAMARIN_LEGACY= test.config | sed 's/.*=//') -ENABLE_DOTNET=$(grep ^ENABLE_DOTNET= test.config | sed 's/.*=//') INCLUDE_MAC=$(grep ^INCLUDE_MAC= test.config | sed 's/.*=//') INCLUDE_MACCATALYST=$(grep ^INCLUDE_MACCATALYST= test.config | sed 's/.*=//') XCODE_DEVELOPER_ROOT=$(grep ^XCODE_DEVELOPER_ROOT= test.config | sed 's/.*=//') -MAC_DESTDIR=$(grep ^MAC_DESTDIR= test.config | sed 's/.*=//') export MD_APPLE_SDK_ROOT="$(dirname "$(dirname "$XCODE_DEVELOPER_ROOT")")" -export XAMMAC_FRAMEWORK_PATH=$MAC_DESTDIR/Library/Frameworks/Xamarin.Mac.framework/Versions/Current -export XamarinMacFrameworkRoot=$MAC_DESTDIR/Library/Frameworks/Xamarin.Mac.framework/Versions/Current -export TargetFrameworkFallbackSearchPaths=$MAC_DESTDIR/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPathFallbackPathsOverride=$MAC_DESTDIR/Library/Frameworks/Mono.framework/External/xbuild export RootTestsDirectory="$(pwd)" make -make .stamp-xharness-configure -if test -n "$INCLUDE_XAMARIN_LEGACY"; then - ../tools/xibuild/xibuild -- /r ../external/Touch.Unit/Touch.Client/macOS/mobile/Touch.Client-macOS-mobile.csproj - ../tools/xibuild/xibuild -- /r ../external/Touch.Unit/Touch.Client/macOS/full/Touch.Client-macOS-full.csproj - ../tools/xibuild/xibuild -- /r bindings-test/macOS/bindings-test.csproj -fi TEST_SUITE_DEPENDENCIES+=(bindings-test) TEST_SUITE_DEPENDENCIES+=(EmbeddedResources) TEST_SUITE_DEPENDENCIES+=(fsharplibrary) TEST_SUITE_DEPENDENCIES+=(BundledResources) -if test -n "$ENABLE_DOTNET"; then - for dep in "${TEST_SUITE_DEPENDENCIES[@]}"; do - if test -n "$INCLUDE_MAC"; then - make -C "$dep"/dotnet/macOS build - fi - if test -n "$INCLUDE_MACCATALYST"; then - make -C "$dep"/dotnet/MacCatalyst build - fi - done -fi +for dep in "${TEST_SUITE_DEPENDENCIES[@]}"; do + if test -n "$INCLUDE_MAC"; then + make -C "$dep"/dotnet/macOS build + fi + if test -n "$INCLUDE_MACCATALYST"; then + make -C "$dep"/dotnet/MacCatalyst build + fi +done TEST_SUITES+=(build-dontlink) TEST_SUITES+=(build-linksdk) TEST_SUITES+=(build-linkall) TEST_SUITES+=(build-introspection) -if test -n "$INCLUDE_XAMARIN_LEGACY"; then - TEST_SUITES+=(build-xammac_tests) -fi TEST_SUITES+=(build-monotouch-test) -# Don't build in parallel in CI, it fails randomly due to trying to write to the same files. -if test -z "$BUILD_REVISION"; then - MAKE_FLAGS=-j -fi - make -f packaged-macos-tests.mk "${TEST_SUITES[@]}" $MAKE_FLAGS -if test -n "$INCLUDE_XAMARIN_LEGACY"; then - for app in */bin/x86/*/*.app linker/mac/*/bin/x86/*/*.app linker/mac/*/generated-projects/*/bin/x86/*/*.app introspection/Mac/bin/x86/*/*.app; do - mkdir -p "$DIR/tests/$app" - $CP -R "$app" "$DIR/tests/$app/.." - done -fi - -if test -n "$ENABLE_DOTNET"; then - for app in linker/*/*/dotnet/*/bin/*/*/*/*.app */dotnet/*/bin/*/*/*/*.app; do - mkdir -p "$DIR/tests/$app" - $CP -R "$app" "$DIR/tests/$app/.." - done -fi +for app in linker/*/*/dotnet/*/bin/*/*/*/*.app */dotnet/*/bin/*/*/*/*.app; do + mkdir -p "$DIR/tests/$app" + $CP -R "$app" "$DIR/tests/$app/.." +done $CP -p packaged-macos-tests.mk "$DIR/tests" $CP -p run-with-timeout.* "$DIR/tests" @@ -95,5 +63,11 @@ $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" +$CP -cp ../Directory.Build.props "$DIR/" +mkdir -p "$DIR/scripts/run-with-timeout" +$CP -cp ../scripts/Directory.Build.props "$DIR/scripts/" +$CP -cp ../scripts/*.mk "$DIR/scripts/" +$CP -cp ../scripts/run-with-timeout/*.cs* "$DIR/scripts/run-with-timeout/" +$CP -cp ../scripts/run-with-timeout/*.mk "$DIR/scripts/run-with-timeout/" cd mac-test-package && 7z a ../mac-test-package.7z ./* diff --git a/tests/packaged-macos-tests.mk b/tests/packaged-macos-tests.mk index fa506b9b6beb..daf867bedd32 100644 --- a/tests/packaged-macos-tests.mk +++ b/tests/packaged-macos-tests.mk @@ -2,10 +2,7 @@ TOP=.. include $(TOP)/Make.config -# Env Variables to use local not system XM - -export TargetFrameworkFallbackSearchPaths:=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPathFallbackPathsOverride:=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +export DOTNET=$(shell which dotnet) ifeq ($(shell arch),"arm64") IS_ARM64=1 @@ -16,109 +13,15 @@ IS_ROSETTA=1 IS_APPLE_SILICON=1 endif -MACOS_VERSION:=$(shell sw_vers -productVersion) -MACOS_MAJOR_VERSION:=$(shell echo $(MACOS_VERSION) | awk -F'.' '{print $$1}') -MACOS_MINOR_VERSION:=$(shell echo $(MACOS_VERSION) | awk -F'.' '{print $$2}') -SUPPORTS_MACCATALYST:=$(shell echo '$(MACOS_MAJOR_VERSION).$(MACOS_MINOR_VERSION) >= 10.15' | bc) - CONFIG?=Debug LAUNCH_ARGUMENTS=--autostart --autoexit -# Time test runs out after 5 minutes (300 seconds) -RUN_WITH_TIMEOUT=./run-with-timeout.csharp 300 -# Some tests need a bit more time... (introspection, monotouch-test/xammac_tests) -RUN_WITH_TIMEOUT_LONGER=./run-with-timeout.csharp 600 - -.stamp-configure-projects-mac: Makefile xharness/xharness.exe - $(Q) $(MAKE) .stamp-xharness-configure - $(Q) touch $@ - -PACKAGES_CONFIG:=$(shell git ls-files -- '*.csproj' '*/packages.config' | sed 's/ /\\ /g') -ifdef INCLUDE_XAMARIN_LEGACY -.stamp-nuget-restore-mac: tests-mac.sln $(PACKAGES_CONFIG) - $(Q_XBUILD) $(SYSTEM_XIBUILD) -t -- /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore tests-mac.sln - $(Q) touch $@ -else -.stamp-nuget-restore-mac: - $(Q) echo "Legacy Xamarin is disabled, so nothing to restore" - $(Q) touch $@ -endif - -# -# dont link -# - -## macOS/legacy/modern -build-mac-modern-dontlink: linker/mac/dont\ link/dont\ link-mac.csproj .stamp-nuget-restore-mac - $(Q_XBUILD) $(SYSTEM_XIBUILD) -- "/property:Configuration=$(CONFIG)" /r /t:Build $(XBUILD_VERBOSITY) "linker/mac/dont link/dont link-mac.csproj" - -exec-mac-modern-dontlink: - @echo "ℹ️ Executing the 'dont link' test for Xamarin.Mac (Modern profile) ℹ️" - $(Q) "linker/mac/dont link/bin/x86/$(CONFIG)/dont link.app/Contents/MacOS/dont link" - -# macOS/legacy/full -build-mac-full-dontlink: linker/mac/dont\ link/generated-projects/full/dont\ link-mac-full.csproj .stamp-nuget-restore-mac - $(Q_XBUILD) $(SYSTEM_XIBUILD) -- "/property:Configuration=$(CONFIG)" /r /t:Build $(XBUILD_VERBOSITY) "linker/mac/dont link/generated-projects/full/dont link-mac-full.csproj" - -exec-mac-full-dontlink: - @echo "ℹ️ Executing the 'dont link' test for Xamarin.Mac (Full profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT) "linker/mac/dont link/generated-projects/full/bin/x86/$(CONFIG)-full/dont link.app/Contents/MacOS/dont link" - -# macOS/legacy/system -build-mac-system-dontlink: linker/mac/dont\ link/generated-projects/system/dont\ link-mac-system.csproj .stamp-nuget-restore-mac - $(Q_XBUILD) $(SYSTEM_XIBUILD) -- "/property:Configuration=$(CONFIG)" /r /t:Build $(XBUILD_VERBOSITY) "linker/mac/dont link/generated-projects/system/dont link-mac-system.csproj" - -exec-mac-system-dontlink: - @echo "ℹ️ Executing the 'dont link' test for Xamarin.Mac (System profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT) "linker/mac/dont link/generated-projects/system/bin/x86/$(CONFIG)-system/dont link.app/Contents/MacOS/dont link" - -# -# introspection -# - -## macOS/legacy/modern -build-mac-modern-introspection: introspection/Mac/introspection-mac.csproj .stamp-nuget-restore-mac - $(Q_XBUILD) $(SYSTEM_XIBUILD) -- "/property:Configuration=$(CONFIG)" /r /t:Build $(XBUILD_VERBOSITY) "introspection/Mac/introspection-mac.csproj" - -exec-mac-modern-introspection: - @echo "ℹ️ Executing the 'introspection' test for Xamarin.Mac (Modern profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT) introspection/Mac/bin/x86/$(CONFIG)/introspection.app/Contents/MacOS/introspection +include $(TOP)/scripts/run-with-timeout/fragment.mk -# -# xammac tests -# - -## macOS/legacy/modern -build-mac-modern-xammac_tests: xammac_tests/xammac_tests.csproj .stamp-nuget-restore-mac - $(Q_XBUILD) $(SYSTEM_XIBUILD) -- "/property:Configuration=$(CONFIG)" /r /t:Build $(XBUILD_VERBOSITY) "xammac_tests/xammac_tests.csproj" - -exec-mac-modern-xammac_tests: - @echo "ℹ️ Executing the 'xammac' test for Xamarin.Mac (Modern profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT_LONGER) xammac_tests/bin/x86/$(CONFIG)/xammac_tests.app/Contents/MacOS/xammac_tests - -# -# link all -# - -## macOS/legacy/modern -build-mac-modern-linkall: linker/mac/link\ all/link\ all-mac.csproj .stamp-nuget-restore-mac - $(Q_XBUILD) $(SYSTEM_XIBUILD) -- "/property:Configuration=$(CONFIG)" /r /t:Build $(XBUILD_VERBOSITY) "linker/mac/link all/link all-mac.csproj" - -exec-mac-modern-linkall: - @echo "ℹ️ Executing the 'link all' test for Xamarin.Mac (Modern profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT) "./linker/mac/link all/bin/x86/$(CONFIG)/link all.app/Contents/MacOS/link all" - -# -# link sdk -# - -## macOS/legacy/modern -build-mac-modern-linksdk: linker/mac/link\ sdk/link\ sdk-mac.csproj .stamp-nuget-restore-mac - $(Q_XBUILD) $(SYSTEM_XIBUILD) -- "/property:Configuration=$(CONFIG)" /r /t:Build $(XBUILD_VERBOSITY) "linker/mac/link sdk/link sdk-mac.csproj" - -exec-mac-modern-linksdk: - @echo "ℹ️ Executing the 'link sdk' test for Xamarin.Mac (Modern profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT) "./linker/mac/link sdk/bin/x86/$(CONFIG)/link sdk.app/Contents/MacOS/link sdk" +# Time test runs out after 5 minutes (300 seconds) +LAUNCH_WITH_TIMEOUT=$(RUN_WITH_TIMEOUT_EXEC) 300 +# Some tests need a bit more time... (introspection, monotouch-test) +LAUNCH_WITH_TIMEOUT_LONGER=$(RUN_WITH_TIMEOUT_EXEC) 600 ### .NET dependency projects @@ -129,7 +32,6 @@ exec-mac-modern-linksdk: # on eachother. So here we build those library projects first, serialized, # so that when the test projects need them, they're already built. - define DotNetDependentProject .stamp-dotnet-dependency-$(2)-$(1): Makefile $$(Q) $$(MAKE) -C "$(1)/dotnet/$(2)" build @@ -150,68 +52,44 @@ define DotNetNormalTest build-mac-dotnet-x64-$(1): .stamp-dotnet-dependency-macOS $$(Q) $$(MAKE) -C "$(1)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-x64 -exec-mac-dotnet-x64-$(1): -ifdef ENABLE_DOTNET +exec-mac-dotnet-x64-$(1): $(RUN_WITH_TIMEOUT) @echo "ℹ️ Executing the '$(1)' test for macOS/.NET (x64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT$(3)) "./$(1)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-x64/$(2).app/Contents/MacOS/$(2)" -else - $(Q) echo "Not executing $@, because .NET is not enabled" -endif + $$(Q) $(LAUNCH_WITH_TIMEOUT$(3)) "./$(1)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-x64/$(2).app/Contents/MacOS/$(2)" # macOS/.NET/arm64 build-mac-dotnet-arm64-$(1): .stamp-dotnet-dependency-macOS $$(Q) $$(MAKE) -C "$(1)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-arm64 -exec-mac-dotnet-arm64-$(1): -ifdef ENABLE_DOTNET +exec-mac-dotnet-arm64-$(1): $(RUN_WITH_TIMEOUT) ifeq ($(IS_APPLE_SILICON),1) @echo "ℹ️ Executing the '$(1)' test for macOS/.NET (arm64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT$(3)) "./$(1)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-arm64/$(2).app/Contents/MacOS/$(2)" + $$(Q) $(LAUNCH_WITH_TIMEOUT$(3)) "./$(1)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-arm64/$(2).app/Contents/MacOS/$(2)" else @echo "⚠️ Not executing the '$(1)' test for macOS/.NET (arm64) - not executing on Apple Silicon ⚠️" endif -else - $(Q) echo "Not executing $@, because .NET is not enabled" -endif # MacCatalyst/.NET/x64 build-maccatalyst-dotnet-x64-$(1): .stamp-dotnet-dependency-MacCatalyst $$(Q_BUILD) $$(MAKE) -C "$(1)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-x64 -exec-maccatalyst-dotnet-x64-$(1): -ifdef ENABLE_DOTNET -ifeq ($(SUPPORTS_MACCATALYST),1) +exec-maccatalyst-dotnet-x64-$(1): $(RUN_WITH_TIMEOUT) @echo "ℹ️ Executing the '$(1)' test for Mac Catalyst/.NET (x64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT$(3)) "./$(1)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-x64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) -else - @echo "⚠️ Not executing the '$(1)' test for Mac Catalyst/.NET (x64) - macOS version $(MACOS_VERSION) is too old ⚠️" -endif -else - $(Q) echo "Not executing $@, because .NET is not enabled" -endif + $$(Q) $(LAUNCH_WITH_TIMEOUT$(3)) "./$(1)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-x64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) # MacCatalyst/.NET/arm64 build-maccatalyst-dotnet-arm64-$(1):.stamp-dotnet-dependency-MacCatalyst $$(Q) $$(MAKE) -C "$(1)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-arm64 -exec-maccatalyst-dotnet-arm64-$(1): -ifdef ENABLE_DOTNET +exec-maccatalyst-dotnet-arm64-$(1): $(RUN_WITH_TIMEOUT) ifeq ($(IS_APPLE_SILICON),1) @echo "ℹ️ Executing the '$(1)' test for Mac Catalyst/.NET (arm64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT$(3)) "./$(1)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-arm64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) + $$(Q) $(LAUNCH_WITH_TIMEOUT$(3)) "./$(1)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-arm64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) else @echo "⚠️ Not executing the '$(1)' test for Mac Catalyst/.NET (arm64) - not executing on Apple Silicon ⚠️" endif -else - $(Q) echo "Not executing $@, because .NET is not enabled" -endif -build-$(1): .stamp-nuget-restore-mac +build-$(1): $$(Q) rm -f ".$$@-failure.stamp" -ifdef INCLUDE_XAMARIN_LEGACY - $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-legacy-$(1) || echo "build-legacy-$(1) failed" >> ".$$@-failure.stamp" -endif -ifdef ENABLE_DOTNET ifdef INCLUDE_MAC $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-mac-dotnet-x64-$(1) || echo "build-mac-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-mac-dotnet-arm64-$(1) || echo "build-mac-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" @@ -219,16 +97,11 @@ endif ifdef INCLUDE_MACCATALYST $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-maccatalyst-dotnet-x64-$(1) || echo "build-maccatalyst-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-maccatalyst-dotnet-arm64-$(1) || echo "build-maccatalyst-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" -endif endif $$(Q) if test -e ".$$@-failure.stamp"; then cat ".$$@-failure.stamp"; rm ".$$@-failure.stamp"; exit 1; fi exec-$(1): $$(Q) rm -f ".$$@-failure.stamp" -ifdef INCLUDE_XAMARIN_LEGACY - $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-legacy-$(1) || echo "exec-legacy-$(1) failed" >> ".$$@-failure.stamp" -endif -ifdef ENABLE_DOTNET ifdef INCLUDE_MAC $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-mac-dotnet-x64-$(1) || echo "exec-mac-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-mac-dotnet-arm64-$(1) || echo "exec-mac-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" @@ -236,7 +109,6 @@ endif ifdef INCLUDE_MACCATALYST $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-maccatalyst-dotnet-x64-$(1) || echo "exec-maccatalyst-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-maccatalyst-dotnet-arm64-$(1) || echo "exec-maccatalyst-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" -endif endif $$(Q) if test -e ".$$@-failure.stamp"; then cat ".$$@-failure.stamp"; rm ".$$@-failure.stamp"; exit 1; fi endef @@ -251,18 +123,18 @@ define DotNetLinkerTest build-mac-dotnet-x64-$(1): .stamp-dotnet-dependency-macOS $$(Q_BUILD) $$(MAKE) -C "linker/ios/$(2)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-x64 -exec-mac-dotnet-x64-$(1): +exec-mac-dotnet-x64-$(1): $(RUN_WITH_TIMEOUT) @echo "ℹ️ Executing the '$(2)' test for macOS/.NET (x64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-x64/$(2).app/Contents/MacOS/$(2)" + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-x64/$(2).app/Contents/MacOS/$(2)" # macOS/.NET/arm64 build-mac-dotnet-arm64-$(1): .stamp-dotnet-dependency-macOS $$(Q) $$(MAKE) -C "linker/ios/$(2)/dotnet/macOS" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=osx-arm64 -exec-mac-dotnet-arm64-$(1): +exec-mac-dotnet-arm64-$(1): $(RUN_WITH_TIMEOUT) ifeq ($(IS_APPLE_SILICON),1) @echo "ℹ️ Executing the '$(2)' test for macOS/.NET (arm64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-arm64/$(2).app/Contents/MacOS/$(2)" + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/macOS/bin/$(CONFIG)/$(DOTNET_TFM)-macos/osx-arm64/$(2).app/Contents/MacOS/$(2)" else @echo "⚠️ Not executing the '$(2)' test for macOS/.NET (arm64) - not executing on Apple Silicon ⚠️" endif @@ -271,32 +143,24 @@ endif build-maccatalyst-dotnet-x64-$(1): .stamp-dotnet-dependency-MacCatalyst $$(Q_BUILD) $$(MAKE) -C "linker/ios/$(2)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-x64 -exec-maccatalyst-dotnet-x64-$(1): -ifeq ($(SUPPORTS_MACCATALYST),1) +exec-maccatalyst-dotnet-x64-$(1): $(RUN_WITH_TIMEOUT) @echo "ℹ️ Executing the '$(2)' test for Mac Catalyst/.NET (x64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-x64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) -else - @echo "⚠️ Not executing the '$(2)' test for Mac Catalyst/.NET (x64) - macOS version $(MACOS_VERSION) is too old ⚠️" -endif + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-x64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) # MacCatalyst/.NET/arm64 build-maccatalyst-dotnet-arm64-$(1): .stamp-dotnet-dependency-MacCatalyst $$(Q) $$(MAKE) -C "linker/ios/$(2)/dotnet/MacCatalyst" build BUILD_ARGUMENTS=/p:RuntimeIdentifier=maccatalyst-arm64 -exec-maccatalyst-dotnet-arm64-$(1): +exec-maccatalyst-dotnet-arm64-$(1): $(RUN_WITH_TIMEOUT) ifeq ($(IS_APPLE_SILICON),1) @echo "ℹ️ Executing the '$(2)' test for Mac Catalyst/.NET (arm64) ℹ️" - $$(Q) $(RUN_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-arm64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) + $$(Q) $(LAUNCH_WITH_TIMEOUT) "./linker/ios/$(2)/dotnet/MacCatalyst/bin/$(CONFIG)/$(DOTNET_TFM)-maccatalyst/maccatalyst-arm64/$(2).app/Contents/MacOS/$(2)" $(LAUNCH_ARGUMENTS) else @echo "⚠️ Not executing the '$(2)' test for Mac Catalyst/.NET (arm64) - not executing on Apple Silicon ⚠️" endif -build-$(1): .stamp-nuget-restore-mac +build-$(1): $$(Q) rm -f ".$$@-failure.stamp" -ifdef INCLUDE_XAMARIN_LEGACY - $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-legacy-$(1) || echo "build-legacy-$(1) failed" >> ".$$@-failure.stamp" -endif -ifdef ENABLE_DOTNET ifdef INCLUDE_MAC $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-mac-dotnet-x64-$(1) || echo "build-mac-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-mac-dotnet-arm64-$(1) || echo "build-mac-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" @@ -304,16 +168,11 @@ endif ifdef INCLUDE_MACCATALYST $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-maccatalyst-dotnet-x64-$(1) || echo "build-maccatalyst-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk build-maccatalyst-dotnet-arm64-$(1) || echo "build-maccatalyst-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" -endif endif $$(Q) if test -e ".$$@-failure.stamp"; then cat ".$$@-failure.stamp"; rm ".$$@-failure.stamp"; exit 1; fi exec-$(1): $$(Q) rm -f ".$$@-failure.stamp" -ifdef INCLUDE_XAMARIN_LEGACY - $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-legacy-$(1) || echo "exec-legacy-$(1) failed" >> ".$$@-failure.stamp" -endif -ifdef ENABLE_DOTNET ifdef INCLUDE_MAC $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-mac-dotnet-x64-$(1) || echo "exec-mac-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-mac-dotnet-arm64-$(1) || echo "exec-mac-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" @@ -321,97 +180,10 @@ endif ifdef INCLUDE_MACCATALYST $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-maccatalyst-dotnet-x64-$(1) || echo "exec-maccatalyst-dotnet-x64-$(1) failed" >> ".$$@-failure.stamp" $$(Q) $$(MAKE) -f packaged-macos-tests.mk exec-maccatalyst-dotnet-arm64-$(1) || echo "exec-maccatalyst-dotnet-arm64-$(1) failed" >> ".$$@-failure.stamp" -endif endif $$(Q) if test -e ".$$@-failure.stamp"; then cat ".$$@-failure.stamp"; rm ".$$@-failure.stamp"; exit 1; fi endef $(eval $(call DotNetLinkerTest,dontlink,dont link)) $(eval $(call DotNetLinkerTest,linksdk,link sdk)) -$(eval $(call DotNetLinkerTest,linkall,link all)) - -# Container targets that run multiple test projects - -# build targets - -build-legacy-dontlink: .stamp-nuget-restore-mac - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk build-mac-modern-dontlink || echo "build-mac-modern-dontlink failed" >> ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk build-mac-full-dontlink || echo "build-mac-full-dontlink failed" >> ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk build-mac-system-dontlink || echo "build-mac-system-dontlink failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi - -build-legacy-introspection: .stamp-nuget-restore-mac - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk build-mac-modern-introspection || echo "build-mac-modern-introspection failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi - -build-xammac_tests: .stamp-nuget-restore-mac - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk build-mac-modern-xammac_tests || echo "build-mac-modern-xammac_tests failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi - -build-legacy-monotouch-test: ; - # nothing to do here - -build-legacy-linkall: .stamp-nuget-restore-mac - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk build-mac-modern-linkall || echo "build-mac-modern-link all failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi - -build-legacy-linksdk: .stamp-nuget-restore-mac - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk build-mac-modern-linksdk || echo "build-mac-modern-linksdk failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi - -# execution targets - -exec-legacy-dontlink: -ifdef INCLUDE_XAMARIN_LEGACY - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk exec-mac-modern-dontlink || echo "exec-mac-modern-dont link failed" >> ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk exec-mac-full-dontlink || echo "exec-mac-full-dont link failed" >> ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk exec-mac-system-dontlink || echo "exec-mac-system-dont link failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi -else - $(Q) echo "Not executing $@, because legacy Xamarin is not enabled" -endif - -exec-legacy-introspection: -ifdef INCLUDE_XAMARIN_LEGACY - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk exec-mac-modern-introspection || echo "exec-mac-modern-introspection failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi -else - $(Q) echo "Not executing $@, because legacy Xamarin is not enabled" -endif - -exec-xammac_tests: -ifdef INCLUDE_XAMARIN_LEGACY - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk exec-mac-modern-xammac_tests || echo "exec-mac-modern-xammac_tests failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi -else - $(Q) echo "Not executing $@, because legacy Xamarin is not enabled" -endif - -exec-legacy-monotouch-test: ; - # nothing to do here - -exec-legacy-linkall: -ifdef INCLUDE_XAMARIN_LEGACY - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk exec-mac-modern-linkall || echo "exec-mac-modern-linkall failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi -else - $(Q) echo "Not executing $@, because legacy Xamarin is not enabled" -endif - -exec-legacy-linksdk: -ifdef INCLUDE_XAMARIN_LEGACY - $(Q) rm -f ".$@-failure.stamp" - $(Q) $(MAKE) -f packaged-macos-tests.mk exec-mac-modern-linksdk || echo "exec-mac-modern-link sdk failed" >> ".$@-failure.stamp" - $(Q) if test -e ".$@-failure.stamp"; then cat ".$@-failure.stamp"; rm ".$@-failure.stamp"; exit 1; fi -else - $(Q) echo "Not executing $@, because legacy Xamarin is not enabled" -endif +$(eval $(call DotNetLinkerTest,linkall,link all)) \ No newline at end of file diff --git a/tests/rgen/Makefile b/tests/rgen/Makefile new file mode 100644 index 000000000000..d676915e4cb7 --- /dev/null +++ b/tests/rgen/Makefile @@ -0,0 +1,22 @@ +TOP=../.. +include $(TOP)/Make.config + +# Example TEST_FILTER: +# TEST_FILTER="--filter FullyQualifiedName~BuildMyCocoaApp" +# Docs: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#filter-option-details + +build-bindings-analyzer-tests: + $(Q) $(DOTNET) build Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj $(DOTNET_BUILD_VERBOSITY) + +run-bindings-analyzer-tests: + $(Q) $(DOTNET) test Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj $(TEST_FILTER) + +build-generator-tests: + $(Q) $(DOTNET) build Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj $(DOTNET_BUILD_VERBOSITY) + +run-generator-tests: + $(Q) $(DOTNET) test Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj $(TEST_FILTER) + +build-all: build-bindings-analyzer-tests build-generator-tests + +run-tests run test: run-bindings-analyzer-tests run-generator-tests 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..bc0ee3b6654e --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/BindingTypeSemanticAnalyzerTests.cs @@ -0,0 +1,38 @@ +using System.Linq; +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); + var analyzerDiagnotics = diagnostics + .Where (d => d.Id == BindingTypeSemanticAnalyzer.DiagnosticId).ToArray (); + Assert.Single (analyzerDiagnotics); + // verify the diagnostic message + VerifyDiagnosticMessage (analyzerDiagnotics [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..1c37290bc01f --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj @@ -0,0 +1,27 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + false + true + + + + + + + + + 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..2d3967d91774 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/BaseGeneratorTestClass.cs @@ -0,0 +1,90 @@ +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; + + // list of the defines for each platform, this is passed to the parser to ensure that + // we are testing the platforms as if they were being compiled. + readonly Dictionary platformDefines = new () { + { ApplePlatform.iOS, new [] { "__IOS__" } }, + { ApplePlatform.TVOS, new [] { "__TVOS__" } }, + { ApplePlatform.MacOSX, new [] { "__MACOS__" } }, + { ApplePlatform.MacCatalyst, new [] { "__MACCATALYST__" } }, + }; + + 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 CompilationResult 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 parseOptions = new CSharpParseOptions (LanguageVersion.Latest, DocumentationMode.None, preprocessorSymbols: platformDefines [platform]); + var trees = sources.Select (s => CSharpSyntaxTree.ParseText (s, parseOptions)).ToImmutableArray (); + + var options = new CSharpCompilationOptions (OutputKind.NetModule) + .WithAllowUnsafe (true); + + return new (CSharpCompilation.Create (name, trees, references, options), trees); + } + + protected void CompareGeneratedCode (ApplePlatform platform, string className, string inputFileName, string inputText, string outputFileName, string expectedOutputText, string? expectedLibraryText) + { + // 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); + + if (expectedLibraryText is not null) { + // validate that Library.g.cs was created by the LibraryEmitter and matches the expectation + var generatedLibSyntax = runResult.GeneratedTrees.Single (t => t.FilePath.EndsWith ("Libraries.g.cs")); + Assert.Equal (expectedLibraryText, generatedLibSyntax.GetText ().ToString ()); + } + + } +} 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..418e5d629454 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs @@ -0,0 +1,56 @@ +using System.Linq; +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 usingImportInput = @" +using System; +using Foundation; +using ObjCBindings; +namespace TestNamespace; + +[BindingType (Name = ""AVAudioPCMBuffer"")] +public partial class AVAudioPcmBuffer : AVAudioBuffer { +} +"; + + const string usingImportOutput = @"// + +#nullable enable + +using Foundation; +using ObjCBindings; +using System; + +namespace TestNamespace +{ + public partial class AVAudioPcmBuffer + { + // TODO: add binding code here + } +} +"; + + [Theory] + [AllSupportedPlatforms (usingImportInput, usingImportOutput)] + public void CorrectUsingImports (ApplePlatform platform, string input, string expectedOutput) + { + // We need to create a compilation with the required source code. + var (compilation, _) = CreateCompilation (nameof (CorrectUsingImports), + platform, input); + + // Run generators and retrieve all results. + var runResult = Driver.RunGenerators (compilation).GetRunResult (); + Assert.Empty (runResult.Diagnostics); + + // ensure that we do have all the needed attributes present + var generatedFile = runResult.GeneratedTrees.SingleOrDefault (t => t.FilePath.EndsWith ("AVAudioPcmBuffer.g.cs")); + Assert.NotNull (generatedFile); + Assert.Equal (expectedOutput, generatedFile.GetText ().ToString ()); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/CompilationResult.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/CompilationResult.cs new file mode 100644 index 000000000000..f01cf39d0174 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/CompilationResult.cs @@ -0,0 +1,15 @@ +using System.Collections.Immutable; +using Microsoft.CodeAnalysis; + +namespace Microsoft.Macios.Generator.Tests; + +public readonly struct CompilationResult (Compilation compilation, ImmutableArray syntaxTrees) { + public Compilation Compilation { get; init; } = compilation; + public ImmutableArray SyntaxTrees { get; init; } = syntaxTrees; + + public void Deconstruct (out Compilation compilation, out ImmutableArray trees) + { + compilation = Compilation; + trees = SyntaxTrees; + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributeCodeChangeTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributeCodeChangeTests.cs new file mode 100644 index 000000000000..708c5aef295e --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributeCodeChangeTests.cs @@ -0,0 +1,68 @@ +using Microsoft.Macios.Generator.DataModel; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.DataModel; + +public class AttributeCodeChangeTests { + + [Fact] + public void EqualsNoParams () + { + var attributeCodeChange1 = new AttributeCodeChange ("name", []); + var attributeCodeChange2 = new AttributeCodeChange ("name", []); + Assert.True (attributeCodeChange1.Equals (attributeCodeChange2)); + Assert.True (attributeCodeChange1 == attributeCodeChange2); + Assert.False (attributeCodeChange1 != attributeCodeChange2); + } + + [Fact] + public void EqualsWithParams () + { + var attributeCodeChange1 = new AttributeCodeChange ("name", ["arg1", "arg2"]); + var attributeCodeChange2 = new AttributeCodeChange ("name", ["arg1", "arg2"]); + Assert.True (attributeCodeChange1.Equals (attributeCodeChange2)); + Assert.True (attributeCodeChange1 == attributeCodeChange2); + Assert.False (attributeCodeChange1 != attributeCodeChange2); + } + + [Fact] + public void NotEqualsDifferentName () + { + var attributeCodeChange1 = new AttributeCodeChange ("name", []); + var attributeCodeChange2 = new AttributeCodeChange ("name2", []); + Assert.False (attributeCodeChange1.Equals (attributeCodeChange2)); + Assert.False (attributeCodeChange1 == attributeCodeChange2); + Assert.True (attributeCodeChange1 != attributeCodeChange2); + } + + [Fact] + public void NotEqualsDifferentParams () + { + var attributeCodeChange1 = new AttributeCodeChange ("name", ["arg1", "arg2"]); + var attributeCodeChange2 = new AttributeCodeChange ("name", ["arg1", "arg3"]); + Assert.False (attributeCodeChange1.Equals (attributeCodeChange2)); + Assert.False (attributeCodeChange1 == attributeCodeChange2); + Assert.True (attributeCodeChange1 != attributeCodeChange2); + } + + [Fact] + public void NotEqualsDifferentParamsLength () + { + var attributeCodeChange1 = new AttributeCodeChange ("name", ["arg1", "arg2"]); + var attributeCodeChange2 = new AttributeCodeChange ("name", ["arg1"]); + Assert.False (attributeCodeChange1.Equals (attributeCodeChange2)); + Assert.False (attributeCodeChange1 == attributeCodeChange2); + Assert.True (attributeCodeChange1 != attributeCodeChange2); + } + + [Fact] + public void NotEqualsDifferentParamsOrder () + { + var attributeCodeChange1 = new AttributeCodeChange ("name", ["arg1", "arg2"]); + var attributeCodeChange2 = new AttributeCodeChange ("name", ["arg2", "arg1"]); + Assert.False (attributeCodeChange1.Equals (attributeCodeChange2)); + Assert.False (attributeCodeChange1 == attributeCodeChange2); + Assert.True (attributeCodeChange1 != attributeCodeChange2); + } + +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributeComparerTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributeComparerTests.cs new file mode 100644 index 000000000000..fc1c2052182c --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributeComparerTests.cs @@ -0,0 +1,39 @@ +using System; +using Microsoft.Macios.Generator.DataModel; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.DataModel; + +public class AttributeComparerTests { + AttributeComparer comparer; + public AttributeComparerTests () + { + comparer = new (); + } + + [Fact] + public void CompareBasedOnNames () + { + var x = new AttributeCodeChange ("First"); + var y = new AttributeCodeChange ("Second"); + Assert.Equal (String.Compare (x.Name, y.Name, StringComparison.Ordinal), comparer.Compare (x, y)); + y = new AttributeCodeChange (x.Name); + Assert.Equal (0, comparer.Compare (x, y)); + } + + [Fact] + public void CompareBasedOnAttributeLength () + { + var x = new AttributeCodeChange ("First", ["1", "2", "2"]); + var y = new AttributeCodeChange ("First", ["1", "2"]); + Assert.Equal (3.CompareTo (2), comparer.Compare (x, y)); + } + + [Fact] + public void CompareBasedOnAttributeArguments () + { + var x = new AttributeCodeChange ("First", ["1", "2", "2"]); + var y = new AttributeCodeChange ("First", ["2", "1", "3"]); + Assert.Equal (String.Compare (x.Arguments [0], y.Arguments [0], StringComparison.Ordinal), comparer.Compare (x, y)); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributesComparerTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributesComparerTests.cs new file mode 100644 index 000000000000..14e23a654625 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/AttributesComparerTests.cs @@ -0,0 +1,54 @@ +using System.Collections.Immutable; +using Microsoft.Macios.Generator.DataModel; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.DataModel; + +public class AttributesComparerTests { + + readonly AttributesComparer comparer; + public AttributesComparerTests () + { + comparer = new AttributesComparer (); + } + + [Fact] + public void NotEqualsDiffLength () + { + ImmutableArray x = [new ("name", []), new ("name1")]; + ImmutableArray y = [new ("name", [])]; + Assert.False (comparer.Equals (x, y)); + } + + [Fact] + public void NotEqualsDiffAttributes () + { + ImmutableArray x = [new ("name", []), new ("name1")]; + ImmutableArray y = [new ("name1", []), new ("name1")]; + Assert.False (comparer.Equals (x, y)); + } + + [Fact] + public void EqualsSameOrder () + { + ImmutableArray x = [new ("name", []), new ("name1")]; + ImmutableArray y = [new ("name", []), new ("name1")]; + Assert.True (comparer.Equals (x, y)); + } + + [Fact] + public void EqualsDiffOrder () + { + ImmutableArray x = [new ("name1", []), new ("name")]; + ImmutableArray y = [new ("name", []), new ("name1")]; + Assert.True (comparer.Equals (x, y)); + } + + [Fact] + public void EqualsSameOrderSameArguments () + { + ImmutableArray x = [new ("SupportedOSPlatform", ["ios15.0"]), new ("SupportedOSPlatform", ["maccatalyst15.0"])]; + ImmutableArray y = [new ("SupportedOSPlatform", ["maccatalyst15.0"]), new ("SupportedOSPlatform", ["ios15.0"])]; + Assert.True (comparer.Equals (x, y)); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/CodeChangesComparerTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/CodeChangesComparerTests.cs new file mode 100644 index 000000000000..72310e3689de --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/CodeChangesComparerTests.cs @@ -0,0 +1,172 @@ +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.DataModel; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.DataModel; + +public class CodeChangesComparerTests : BaseGeneratorTestClass { + readonly CodeChangesComparer comparer = new (); + + // returns a node that matches the given node type from an example syntax tree + T GetSyntaxNode (ApplePlatform platform) where T : BaseTypeDeclarationSyntax + { + var attrsText = @" +using System; + +namespace ObjCBindings; +public class SimpleAttribute : Attribute { +} + +public class AttributeWithParams : Attribute { + public AttributeWithParams (string name, int value) { + } +} +"; + var inputText = @" +using System; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +[SimpleAttribute, AttributeWithParams (""first"", 2)] +public class TestClass { + + [SimpleAttribute, AttributeWithParams (""first"", 2)] + public void SayHello () { + } +} + +[SimpleAttribute, AttributeWithParams (""first"", 2)] +public enum TestEnum { + [SimpleAttribute, AttributeWithParams (""first"", 2)] + First, +} + +[SimpleAttribute, AttributeWithParams (""first"", 2)] +public interface IInterface { + [SimpleAttribute, AttributeWithParams (""first"", 2)] + public void SayHello (); +} +"; + var (_, sourceTrees) = + CreateCompilation (nameof (CodeChangesComparerTests), platform, attrsText, inputText); + Assert.Equal (2, sourceTrees.Length); + // get the declarations we want to work with and the semantic model + var nodes = sourceTrees [1].GetRoot ().DescendantNodes ().ToArray (); + var declarationNode = nodes + .OfType () + .FirstOrDefault (); + Assert.NotNull (declarationNode); + return declarationNode; + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CompareDifferentFullyQualifiedSymbol (ApplePlatform platform) + { + var node = GetSyntaxNode (platform); + var changes1 = new CodeChanges (BindingType.SmartEnum, "name1", node, [], []); + var changes2 = new CodeChanges (BindingType.SmartEnum, "name2", node, [], []); + Assert.False (comparer.Equals (changes1, changes2)); + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CompareDifferentBindingType (ApplePlatform platform) + { + var node = GetSyntaxNode (platform); + var changes1 = new CodeChanges (BindingType.SmartEnum, "name", node, [], []); + var changes2 = new CodeChanges (BindingType.Unknown, "name", node, [], []); + Assert.False (comparer.Equals (changes1, changes2)); + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CompareDifferentSymbolDeclaration (ApplePlatform platform) + { + var node1 = GetSyntaxNode (platform); + var node2 = GetSyntaxNode (platform); + var changes1 = new CodeChanges (BindingType.SmartEnum, "name", node1, [], []); + var changes2 = new CodeChanges (BindingType.SmartEnum, "name", node2, [], []); + Assert.False (comparer.Equals (changes1, changes2)); + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CompareDifferentAttributesLength (ApplePlatform platform) + { + var node = GetSyntaxNode (platform); + var changes1 = new CodeChanges (BindingType.SmartEnum, "name", node, [], []); + var changes2 = new CodeChanges (BindingType.SmartEnum, "name", node, [ + new AttributeCodeChange ("name", ["arg1", "arg2"]) + ], []); + Assert.False (comparer.Equals (changes1, changes2)); + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CompareDifferentAttributes (ApplePlatform platform) + { + var node = GetSyntaxNode (platform); + var changes1 = new CodeChanges (BindingType.SmartEnum, "name", node, [ + new AttributeCodeChange ("name", ["arg1", "arg2"]) + ], []); + var changes2 = new CodeChanges (BindingType.SmartEnum, "name", node, [ + new AttributeCodeChange ("name2", ["arg1", "arg2"]) + ], []); + Assert.False (comparer.Equals (changes1, changes2)); + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CompareDifferentMembersLength (ApplePlatform platform) + { + var node = GetSyntaxNode (platform); + var changes1 = new CodeChanges (BindingType.SmartEnum, "name", node, [], []); + var changes2 = new CodeChanges (BindingType.SmartEnum, "name", node, [], [ + new MemberCodeChange ("name", []) + ]); + Assert.False (comparer.Equals (changes1, changes2)); + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CompareDifferentMembers (ApplePlatform platform) + { + var node = GetSyntaxNode (platform); + var changes1 = new CodeChanges (BindingType.SmartEnum, "name", node, [], [ + new MemberCodeChange ("name", []) + ]); + var changes2 = new CodeChanges (BindingType.SmartEnum, "name", node, [], [ + new MemberCodeChange ("name2", []) + ]); + Assert.False (comparer.Equals (changes1, changes2)); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EnumDeclarationCodeChangesTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EnumDeclarationCodeChangesTests.cs new file mode 100644 index 000000000000..6b12f54e6cd0 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EnumDeclarationCodeChangesTests.cs @@ -0,0 +1,187 @@ +using System.Linq; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.DataModel; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.DataModel; + +public class EnumDeclarationCodeChangesTests : BaseGeneratorTestClass { + CodeChanges CreateCodeChanges (ApplePlatform platform, string name, string inputText) + { + var (compilation, sourceTrees) = + CreateCompilation (nameof (CreateCodeChangeNoFieldsNoAttributes), platform, inputText); + Assert.Single (sourceTrees); + var enumDeclaration = sourceTrees [0].GetRoot () + .DescendantNodes () + .OfType () + .FirstOrDefault (); + Assert.NotNull (enumDeclaration); + var semanticModel = compilation.GetSemanticModel (sourceTrees [0]); + var codeChange = CodeChanges.FromDeclaration (semanticModel, enumDeclaration); + Assert.NotNull (codeChange); + return codeChange.Value; + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CreateCodeChangeNoFieldsNoAttributes (ApplePlatform platform) + { + const string inputString = @" +using System; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +[BindingType] +public enum AVCaptureDeviceType { +} +"; + var codeChanges = + CreateCodeChanges (platform, nameof (CreateCodeChangeNoFieldsNoAttributes), inputString); + Assert.Equal ("AVFoundation.AVCaptureDeviceType", codeChanges.FullyQualifiedSymbol); + Assert.Equal (BindingType.SmartEnum, codeChanges.BindingType); + Assert.Single (codeChanges.Attributes); + Assert.Equal (AttributesNames.BindingAttribute, codeChanges.Attributes [0].Name); + Assert.Empty (codeChanges.Members); + Assert.True (codeChanges.SymbolDeclaration is EnumDeclarationSyntax); + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CreateCodeChangeFields (ApplePlatform platform) + { + const string inputString = @" +using System; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +[BindingType] +public enum AVCaptureDeviceType { + + [Field (""AVCaptureDeviceTypeBuiltInMicrophone"")] + BuiltInMicrophone, + + [Field (""AVCaptureDeviceTypeBuiltInWideAngleCamera"")] + BuiltInWideAngleCamera, + + [Field (""AVCaptureDeviceTypeBuiltInTelephotoCamera"")] + BuiltInTelephotoCamera, +} +"; + + var codeChanges = + CreateCodeChanges (platform, nameof (CreateCodeChangeNoFieldsNoAttributes), inputString); + Assert.Equal ("AVFoundation.AVCaptureDeviceType", codeChanges.FullyQualifiedSymbol); + Assert.Equal (BindingType.SmartEnum, codeChanges.BindingType); + Assert.Single (codeChanges.Attributes); + Assert.Equal (AttributesNames.BindingAttribute, codeChanges.Attributes [0].Name); + Assert.True (codeChanges.SymbolDeclaration is EnumDeclarationSyntax); + // validate that we have the 3 members and their attrs + Assert.Equal (3, codeChanges.Members.Length); + Assert.Equal ("BuiltInMicrophone", codeChanges.Members [0].Name); + var expectedFields = new [] { + "AVCaptureDeviceTypeBuiltInMicrophone", + "AVCaptureDeviceTypeBuiltInWideAngleCamera", + "AVCaptureDeviceTypeBuiltInTelephotoCamera" + }; + for (var index = 0; index < expectedFields.Length; index++) { + Assert.Equal ("ObjCBindings.FieldAttribute", codeChanges.Members [index].Attributes [0].Name); + Assert.Equal (expectedFields [index], codeChanges.Members [index].Attributes [0].Arguments [0]); + } + } + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CreateCodeChangeNoFieldAttributes (ApplePlatform platform) + { + const string inputString = @" +using System; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +[BindingType] +public enum AVCaptureDeviceType { + // should be ignored + BuiltInMicrophone, + // should be ignored + BuiltInWideAngleCamera, + // should be ignored + BuiltInTelephotoCamera, +} +"; + + var codeChanges = + CreateCodeChanges (platform, nameof (CreateCodeChangeNoFieldsNoAttributes), inputString); + Assert.Equal ("AVFoundation.AVCaptureDeviceType", codeChanges.FullyQualifiedSymbol); + Assert.Equal (BindingType.SmartEnum, codeChanges.BindingType); + Assert.Single (codeChanges.Attributes); + Assert.Equal (AttributesNames.BindingAttribute, codeChanges.Attributes [0].Name); + Assert.Empty (codeChanges.Members); + Assert.True (codeChanges.SymbolDeclaration is EnumDeclarationSyntax); + } + + + [Theory] + [PlatformInlineData (ApplePlatform.iOS)] + [PlatformInlineData (ApplePlatform.TVOS)] + [PlatformInlineData (ApplePlatform.MacCatalyst)] + [PlatformInlineData (ApplePlatform.MacOSX)] + public void CreateCodeChangeFieldsMissing (ApplePlatform platform) + { + const string inputString = @" +using System; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +[BindingType] +public enum AVCaptureDeviceType { + + [Field (""AVCaptureDeviceTypeBuiltInMicrophone"")] + BuiltInMicrophone, + + [Field (""AVCaptureDeviceTypeBuiltInWideAngleCamera"")] + BuiltInWideAngleCamera, + + // missing attr, this should not be present in the code changes, ie: it was removed by the user + BuiltInTelephotoCamera, +} +"; + + var codeChanges = + CreateCodeChanges (platform, nameof (CreateCodeChangeNoFieldsNoAttributes), inputString); + Assert.Equal ("AVFoundation.AVCaptureDeviceType", codeChanges.FullyQualifiedSymbol); + Assert.Equal (BindingType.SmartEnum, codeChanges.BindingType); + Assert.Single (codeChanges.Attributes); + Assert.Equal (AttributesNames.BindingAttribute, codeChanges.Attributes [0].Name); + Assert.True (codeChanges.SymbolDeclaration is EnumDeclarationSyntax); + // validate that we have the 3 members and their attrs + Assert.Equal (2, codeChanges.Members.Length); + Assert.Equal ("BuiltInMicrophone", codeChanges.Members [0].Name); + var expectedFields = new [] { + "AVCaptureDeviceTypeBuiltInMicrophone", + "AVCaptureDeviceTypeBuiltInWideAngleCamera", + }; + for (var index = 0; index < expectedFields.Length; index++) { + Assert.Equal ("ObjCBindings.FieldAttribute", codeChanges.Members [index].Attributes [0].Name); + Assert.Equal (expectedFields [index], codeChanges.Members [index].Attributes [0].Arguments [0]); + } + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MemberCodeChangesTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MemberCodeChangesTests.cs new file mode 100644 index 000000000000..247d9ca896fd --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MemberCodeChangesTests.cs @@ -0,0 +1,99 @@ +using Microsoft.Macios.Generator.DataModel; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.DataModel; + +public class MemberCodeChangesTests { + [Fact] + public void EqualsNoParams () + { + var memberCodeChange1 = new MemberCodeChange ("name", []); + var memberCodeChange2 = new MemberCodeChange ("name", []); + Assert.True (memberCodeChange1.Equals (memberCodeChange2)); + Assert.True (memberCodeChange1 == memberCodeChange2); + Assert.False (memberCodeChange1 != memberCodeChange2); + } + + [Fact] + public void EqualsWithArgumentParams () + { + var memberCodeChange1 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg1", "arg2"]) + ]); + var memberCodeChange2 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg1", "arg2"]) + ]); + Assert.True (memberCodeChange1.Equals (memberCodeChange2)); + Assert.True (memberCodeChange1 == memberCodeChange2); + Assert.False (memberCodeChange1 != memberCodeChange2); + } + + [Fact] + public void NotEqualsDifferentName () + { + var memberCodeChange1 = new MemberCodeChange ("name", []); + var memberCodeChange2 = new MemberCodeChange ("name2", []); + Assert.False (memberCodeChange1.Equals (memberCodeChange2)); + Assert.False (memberCodeChange1 == memberCodeChange2); + Assert.True (memberCodeChange1 != memberCodeChange2); + } + + [Fact] + public void NotEqualsDiffenretAttributeNames () + { + var memberCodeChange1 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg1", "arg2"]) + ]); + var memberCodeChange2 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name2", ["arg1", "arg2"]) + ]); + Assert.False (memberCodeChange1.Equals (memberCodeChange2)); + Assert.False (memberCodeChange1 == memberCodeChange2); + Assert.True (memberCodeChange1 != memberCodeChange2); + } + + [Fact] + public void NotEqualsDifferentAttributeParams () + { + var memberCodeChange1 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg1", "arg2"]) + ]); + var memberCodeChange2 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg1", "arg3"]) + ]); + Assert.False (memberCodeChange1.Equals (memberCodeChange2)); + Assert.False (memberCodeChange1 == memberCodeChange2); + Assert.True (memberCodeChange1 != memberCodeChange2); + } + + [Fact] + public void NotEqualsDifferentAttributeParamsOrder () + { + var memberCodeChange1 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg1", "arg2"]) + ]); + var memberCodeChange2 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg2", "arg1"]) + ]); + Assert.False (memberCodeChange1.Equals (memberCodeChange2)); + Assert.False (memberCodeChange1 == memberCodeChange2); + Assert.True (memberCodeChange1 != memberCodeChange2); + } + + [Fact] + public void NotEqualsDifferentAttributesCount () + { + + var memberCodeChange1 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg1", "arg2"]), + new AttributeCodeChange ("name2", []) + ]); + var memberCodeChange2 = new MemberCodeChange ("name", [ + new AttributeCodeChange ("name", ["arg2", "arg1"]) + ]); + Assert.False (memberCodeChange1.Equals (memberCodeChange2)); + Assert.False (memberCodeChange1 == memberCodeChange2); + Assert.True (memberCodeChange1 != memberCodeChange2); + } + +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MemberComparerTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MemberComparerTests.cs new file mode 100644 index 000000000000..fabcea64012e --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MemberComparerTests.cs @@ -0,0 +1,47 @@ +using System.Collections.Immutable; +using Microsoft.Macios.Generator.DataModel; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.DataModel; + +public class MemberComparerTests { + + readonly MemberComparer comparer; + + public MemberComparerTests () + { + comparer = new MemberComparer (); + } + + [Fact] + public void NotEqualsDiffLength () + { + ImmutableArray x = [new ("name", []), new ("name1")]; + ImmutableArray y = [new ("name", [])]; + Assert.False (comparer.Equals (x, y)); + } + + [Fact] + public void NotEqualsDiffAttributes () + { + ImmutableArray x = [new ("name", []), new ("name1")]; + ImmutableArray y = [new ("name1", []), new ("name1")]; + Assert.False (comparer.Equals (x, y)); + } + + [Fact] + public void EqualsSameOrder () + { + ImmutableArray x = [new ("name", []), new ("name1")]; + ImmutableArray y = [new ("name", []), new ("name1")]; + Assert.True (comparer.Equals (x, y)); + } + + [Fact] + public void EqualsDiffOrder () + { + ImmutableArray x = [new ("name1", []), new ("name")]; + ImmutableArray y = [new ("name", []), new ("name1")]; + Assert.True (comparer.Equals (x, y)); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/BaseTypeDeclarationSyntaxExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/BaseTypeDeclarationSyntaxExtensionsTests.cs new file mode 100644 index 000000000000..a1f1cbf59b24 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/BaseTypeDeclarationSyntaxExtensionsTests.cs @@ -0,0 +1,117 @@ +using System.Linq; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.Extensions; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.Extensions; + +public class BaseTypeDeclarationSyntaxExtensionsTests : BaseGeneratorTestClass { + + T GetDeclaration (ApplePlatform platform, string inputText) where T : BaseTypeDeclarationSyntax + { + var (compilation, sourceTrees) = CreateCompilation (nameof (BaseTypeDeclarationSyntaxExtensionsTests), platform, inputText); + Assert.Single (sourceTrees); + var declaration = sourceTrees [0].GetRoot () + .DescendantNodes () + .OfType () + .FirstOrDefault (); + Assert.NotNull (declaration); + return declaration; + } + + [Theory] + [AllSupportedPlatforms] + public void GetFullyQualifiedIdentifierFileScopedNamespace (ApplePlatform platform) + { + const string inputText = @" +namespace Test; +public class Foo { +} +"; + var declaration = GetDeclaration (platform, inputText); + Assert.Equal ("Test.Foo", declaration.GetFullyQualifiedIdentifier ()); + } + + [Theory] + [AllSupportedPlatforms] + public void GetFullyQualifiedIdentifierFileScopedNamespaceNestedClass (ApplePlatform platform) + { + const string inputText = @" +namespace Test; +public class Foo { + public enum Bar { + } +} +"; + var declaration = GetDeclaration (platform, inputText); + Assert.Equal ("Test.Foo.Bar", declaration.GetFullyQualifiedIdentifier ()); + } + + [Theory] + [AllSupportedPlatforms] + public void GetFullyQualifiedIdentifierNamespaceDeclaration (ApplePlatform platform) + { + const string inputText = @" +namespace Test { + public class Foo { + } +} +"; + var declaration = GetDeclaration (platform, inputText); + Assert.Equal ("Test.Foo", declaration.GetFullyQualifiedIdentifier ()); + } + + [Theory] + [AllSupportedPlatforms] + public void GetFullyQualifiedIdentifierMultipleNamespaceDeclaration (ApplePlatform platform) + { + const string inputText = @" +namespace Test { + public class Foo {} +} +namespace Test2 { + public class Bar {} +} +"; + var declaration = GetDeclaration (platform, inputText); + Assert.Equal ("Test.Foo", declaration.GetFullyQualifiedIdentifier ()); + } + + [Theory] + [AllSupportedPlatforms] + public void GetFullyQualifiedIdentifierNestedNamespaceDeclaration (ApplePlatform platform) + { + const string inputText = @" +namespace Foo { + namespace Bar { + public class Test {} + } +} +"; + var declaration = GetDeclaration (platform, inputText); + Assert.Equal ("Foo.Bar.Test", declaration.GetFullyQualifiedIdentifier ()); + } + + [Theory] + [AllSupportedPlatforms] + public void GetFullyQualifiedIdentifierNamespaceDeclarationNestedClass (ApplePlatform platform) + { + const string inputText = @" +namespace Foo { + namespace Bar { + public class Test { + public enum Final { + None, + } + } + } +} +"; + var declaration = GetDeclaration (platform, inputText); + Assert.Equal ("Foo.Bar.Test.Final", declaration.GetFullyQualifiedIdentifier ()); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/CompilationExtensionsTest.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/CompilationExtensionsTest.cs new file mode 100644 index 000000000000..076fc6acf8b0 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/CompilationExtensionsTest.cs @@ -0,0 +1,22 @@ +using Microsoft.Macios.Generator.Extensions; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.Extensions; + +public class CompilationExtensionsTest : BaseGeneratorTestClass { + + [Theory] + [PlatformInlineData (ApplePlatform.iOS, PlatformName.iOS)] + [PlatformInlineData (ApplePlatform.TVOS, PlatformName.TvOS)] + [PlatformInlineData (ApplePlatform.MacOSX, PlatformName.MacOSX)] + [PlatformInlineData (ApplePlatform.MacCatalyst, PlatformName.MacCatalyst)] + public void GetCurrentPlatformTests (ApplePlatform platform, PlatformName expectedPlatform) + { + // get the current compilation for the platform and assert we return the correct one from + // the compilation + var (compilation, _) = CreateCompilation (nameof (GetCurrentPlatformTests), platform); + Assert.Equal (expectedPlatform, compilation.GetCurrentPlatform ()); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/MemberDeclarationSyntaxExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/MemberDeclarationSyntaxExtensionsTests.cs new file mode 100644 index 000000000000..8ffe02f04a77 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/MemberDeclarationSyntaxExtensionsTests.cs @@ -0,0 +1,187 @@ +using System.Linq; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.Macios.Generator.Extensions; +using Xamarin.Tests; +using Xamarin.Utils; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests.Extensions; + +public class MemberDeclarationSyntaxExtensionsTests : BaseGeneratorTestClass { + [Theory] + [AllSupportedPlatforms] + public void GetAttributeCodeChanges (ApplePlatform platform) + { + var attrsText = @" +using System; + +namespace ObjCBindings; +public class SimpleAttribute : Attribute { +} + +public class AttributeWithParams : Attribute { + public AttributeWithParams (string name, int value) { + } +} +"; + var inputText = @" +using System; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +[SimpleAttribute, AttributeWithParams (""first"", 2)] +public class TestClass { + + [SimpleAttribute, AttributeWithParams (""first"", 2)] + public void SayHello () { + } +} + +[SimpleAttribute, AttributeWithParams (""first"", 2)] +public enum TestEnum { + [SimpleAttribute, AttributeWithParams (""first"", 2)] + First, +} + +[SimpleAttribute, AttributeWithParams (""first"", 2)] +public interface IInterface { + [SimpleAttribute, AttributeWithParams (""first"", 2)] + public void SayHello (); +} +"; + // create a compilation unit and get the diff syntax node, semantic model and expected attr result + var (compilation, sourceTrees) = + CreateCompilation (nameof (MemberDeclarationSyntaxExtensionsTests), platform, attrsText, inputText); + Assert.Equal (2, sourceTrees.Length); + // get the declarations we want to work with and the semantic model + var nodes = sourceTrees [1].GetRoot ().DescendantNodes ().ToArray (); + var classDeclaration = nodes + .OfType () + .FirstOrDefault (); + Assert.NotNull (classDeclaration); + var methodDeclaration = classDeclaration.DescendantNodes () + .OfType () + .FirstOrDefault (); + Assert.NotNull (methodDeclaration); + var enumDeclaration = nodes + .OfType () + .FirstOrDefault (); + Assert.NotNull (enumDeclaration); + var enumValueDeclaration = enumDeclaration.DescendantNodes () + .OfType () + .FirstOrDefault (); + Assert.NotNull (enumValueDeclaration); + var interfaceDeclaration = nodes + .OfType () + .FirstOrDefault (); + Assert.NotNull (interfaceDeclaration); + var semanticModel = compilation.GetSemanticModel (sourceTrees [1]); + var declarations = new MemberDeclarationSyntax [] { + classDeclaration, methodDeclaration, enumDeclaration, enumValueDeclaration, interfaceDeclaration + }; + + foreach (var declarationSyntax in declarations) { + var attributeCodeChanges = declarationSyntax.GetAttributeCodeChanges (semanticModel); + Assert.Equal (2, attributeCodeChanges.Length); + // assert the values of each of the attr + Assert.Equal ("ObjCBindings.SimpleAttribute", attributeCodeChanges [0].Name); + Assert.Empty (attributeCodeChanges [0].Arguments); + Assert.Equal ("ObjCBindings.AttributeWithParams", attributeCodeChanges [1].Name); + Assert.Equal (2, attributeCodeChanges [1].Arguments.Length); + Assert.Equal ("first", attributeCodeChanges [1].Arguments [0]); + Assert.Equal ("2", attributeCodeChanges [1].Arguments [1]); + } + } + + [Theory] + [AllSupportedPlatforms] + public void GetAttributeCodeChangesSameAttrDiffText (ApplePlatform platform) + { + const string inputText = @" +using System; +using System.ComponentModel; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +public class TestClass { + + [EditorBrowsableAttribute (EditorBrowsableState.Never)] + public void SayHello () { + } + + [System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Never)] + public void SayGoodbye () { + } +} +"; + var (compilation, sourceTrees) = + CreateCompilation (nameof (MemberDeclarationSyntaxExtensionsTests), platform, inputText); + Assert.Single (sourceTrees); + // get the declarations we want to work with and the semantic model + var declarations = sourceTrees [0].GetRoot () + .DescendantNodes () + .OfType () + .ToArray (); + Assert.Equal (2, declarations.Length); + // get the attr for each of the declaration and assert they are the same attrs + var semanticModel = compilation.GetSemanticModel (sourceTrees [0]); + var sayHelloAttrs = declarations [0].GetAttributeCodeChanges (semanticModel); + var sayGoodbyeAttrs = declarations [0].GetAttributeCodeChanges (semanticModel); + Assert.Single (sayHelloAttrs); + Assert.Single (sayGoodbyeAttrs); + Assert.Equal (sayHelloAttrs [0].Name, sayGoodbyeAttrs [0].Name); + Assert.Equal (sayHelloAttrs [0].Arguments [0], sayGoodbyeAttrs [0].Arguments [0]); + } + + [Theory] + [AllSupportedPlatforms] + public void GetAttributeCodeChangesTypeOf (ApplePlatform platform) + { + + var attrsText = @" +using System; + +namespace ObjCBindings; + +public class AttributeWithParams : Attribute { + Type _type; + public AttributeWithParams (Type type) { + _type = type; + } +} +"; + var inputText = @" +using System; +using Foundation; +using ObjCBindings; + +namespace AVFoundation; + +public class TestClass { + + [AttributeWithParams (typeof(TestClass))] + public void SayHello () { + } +} +"; + // create a compilation unit and get the diff syntax node, semantic model and expected attr result + var (compilation, sourceTrees) = + CreateCompilation (nameof (MemberDeclarationSyntaxExtensionsTests), platform, attrsText, inputText); + Assert.Equal (2, sourceTrees.Length); + // get the declarations we want to work with and the semantic model + var nodes = sourceTrees [1].GetRoot ().DescendantNodes ().ToArray (); + var methodDeclarationSyntax = nodes + .OfType () + .FirstOrDefault (); + Assert.NotNull (methodDeclarationSyntax); + var semanticModel = compilation.GetSemanticModel (sourceTrees [1]); + var methodAttrs = methodDeclarationSyntax.GetAttributeCodeChanges (semanticModel); + Assert.Single (methodAttrs); + Assert.Equal ("ObjCBindings.AttributeWithParams", methodAttrs [0].Name); + Assert.Equal ("AVFoundation.TestClass", methodAttrs [0].Arguments [0]); + } +} 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..a1b0cb747e01 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj @@ -0,0 +1,53 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion) + enable + false + true + NU1608 + Microsoft.Macios.Generator.Tests + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + + external\Configuration.cs + + + external\ConfigurationXUnit.cs + + + external\Profile.cs + + + external\ExecutionHelper.cs + + + external\StringUtils.cs + + + external\Execution.cs + + + external\Cache.cs + + + + diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/TabbedStringBuilderTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/TabbedStringBuilderTests.cs new file mode 100644 index 000000000000..489dfb5917b1 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/TabbedStringBuilderTests.cs @@ -0,0 +1,228 @@ +using System.Text; +using Xunit; + +namespace Microsoft.Macios.Generator.Tests; + +public class TabbedStringBuilderTests { + StringBuilder sb; + + public TabbedStringBuilderTests () + { + sb = new (); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void ConstructorNotBlockTest (uint tabCount, string expectedTabs) + { + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + block.AppendLine ("Test"); + result = block.ToString (); + } + Assert.Equal ($"{expectedTabs}Test\n", result); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void ConstructorBlockTest (uint tabCount, string expectedTabs) + { + string result; + using (var block = new TabbedStringBuilder (sb, tabCount, true)) { + block.AppendLine ("Test"); + result = block.ToString (); + } + Assert.Equal ($"{expectedTabs}{{\n{expectedTabs}\tTest\n{expectedTabs}}}\n", result); + } + + [Theory] + [InlineData (0)] + [InlineData (1)] + [InlineData (5)] + public void AppendLineTest (uint tabCount) + { + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + block.AppendLine (); + result = block.ToString (); + } + // an empty line should have not tabs + Assert.Equal ("\n", result); + } + + [Theory] + [InlineData ("// test comment", 0, "")] + [InlineData ("var t = 1;", 1, "\t")] + [InlineData ("Console.WriteLine (\"1\");", 5, "\t\t\t\t\t")] + public void AppendLineStringTest (string line, uint tabCount, string expectedTabs) + { + string result; + using (var block = new TabbedStringBuilder (sb, tabCount, true)) { + block.AppendLine (line); + result = block.ToString (); + } + Assert.Equal ($"{expectedTabs}{{\n{expectedTabs}\t{line}\n{expectedTabs}}}\n", result); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void AppendInterpolatedLineTest (uint tabCount, string expectedTabs) + { + string result; + var val1 = "Hello"; + var val2 = "World"; + var val3 = '!'; + var line = "Hello World!"; + var expected = $"{expectedTabs}{{\n{expectedTabs}\t{line}\n{expectedTabs}}}\n"; + using (var block = new TabbedStringBuilder (sb, tabCount, true)) { + block.AppendLine ($"{val1} {val2}{val3}"); + result = block.ToString (); + } + Assert.Equal (expected, result); + } + + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void AppendRawTest (uint tabCount, string expectedTabs) + { + var input = @" +## Raw string +Because we are using a raw string we expected: + 1. The string to be split in lines + 2. All lines should have the right indentation + - This means nested one + 3. And all lines should have the correct tabs +"; + var expected = $@" +{expectedTabs}## Raw string +{expectedTabs}Because we are using a raw string we expected: +{expectedTabs} 1. The string to be split in lines +{expectedTabs} 2. All lines should have the right indentation +{expectedTabs} - This means nested one +{expectedTabs} 3. And all lines should have the correct tabs +"; + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + block.AppendRaw (input); + result = block.ToString (); + } + Assert.Equal (expected, result); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void AppendGeneratedCodeAttributeTest (uint tabCount, string expectedTabs) + { + var expected = $"{expectedTabs}[BindingImpl (BindingImplOptions.GeneratedCode)]\n"; + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + block.AppendGeneratedCodeAttribute (false); + result = block.ToString (); + } + Assert.Equal (expected, result); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void AppendGeneratedCodeAttributeOptimizableTest (uint tabCount, string expectedTabs) + { + var expected = $"{expectedTabs}[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]\n"; + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + block.AppendGeneratedCodeAttribute (); + result = block.ToString (); + } + Assert.Equal (expected, result); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void AppendEditorBrowsableAttributeTest (uint tabCount, string expectedTabs) + { + var expected = $"{expectedTabs}[EditorBrowsable (EditorBrowsableState.Never)]\n"; + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + block.AppendEditorBrowsableAttribute (); + result = block.ToString (); + } + Assert.Equal (expected, result); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void CreateEmptyBlockTest (uint tabCount, string expectedTabs) + { + var blockContent = "// the test"; + var expected = $@"{expectedTabs}{{ +{expectedTabs}{"\t"}{blockContent} +{expectedTabs}}} +"; + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + using (var nested = block.CreateBlock (true)) { + nested.AppendLine (blockContent); + } + result = block.ToString (); + } + Assert.Equal (expected, result); + } + + [Theory] + [InlineData (0, "", "if (true)")] + [InlineData (1, "\t", "using (var t = new StringBuilder)")] + [InlineData (5, "\t\t\t\t\t", "fixed (*foo)")] + public void CreateBlockTest (uint tabCount, string expectedTabs, string blockType) + { + var blockContent = "// the test"; + var expected = $@"{expectedTabs}{blockType} +{expectedTabs}{{ +{expectedTabs}{"\t"}{blockContent} +{expectedTabs}}} +"; + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + using (var nested = block.CreateBlock (blockType, true)) { + nested.AppendLine (blockContent); + } + result = block.ToString (); + } + Assert.Equal (expected, result); + } + + [Theory] + [InlineData (0, "")] + [InlineData (1, "\t")] + [InlineData (5, "\t\t\t\t\t")] + public void WriteHeaderTest (uint tabCount, string expectedTabs) + { + var expected = $@"{expectedTabs}// + +{expectedTabs}#nullable enable + +"; + string result; + using (var block = new TabbedStringBuilder (sb, tabCount)) { + block.WriteHeader (); + result = block.ToString (); + } + Assert.Equal (expected, result); + } + +} diff --git a/tests/run-with-timeout.csharp b/tests/run-with-timeout.csharp deleted file mode 100755 index 54fe58395a1f..000000000000 --- a/tests/run-with-timeout.csharp +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -// arguments are: - -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Threading; -using System.Xml; - -static class NativeMethods { - [DllImport ("__Internal", SetLastError = true)] - static extern int kill (int pid, int signal); - - public static void Abort (this Process process) - { - var exitTimeout = TimeSpan.FromSeconds (60); - var pid = process.Id; - Console.WriteLine ($"kill ({pid}, 6);"); - var rv = kill (pid, 6 /* SIGABRT - this triggers a crash report */); - if (rv != 0) { - // This might randomly happen, because there's a race condition here: we waited for the process to exit, - // the timeout occurred so we decided to kill the process, and *then* the process exited, before we got - // around to kill it. In that case, the kill call would fail. - Console.WriteLine ($"Failed to execute 'kill -6 {pid}'. errno = {Marshal.GetLastWin32Error ()} - process already exited?"); - return; - } - var watch = Stopwatch.StartNew (); - while (watch.Elapsed < exitTimeout) { - Console.WriteLine ($"kill ({pid}, 0);"); - rv = kill (pid, 0); // check if pid is still alive (valid) - if (rv != 0) { - // Nope it's not, so it must have terminated. - return; - } - Thread.Sleep (50); - } - - // Send SIGKILL - time to finish it off. - Console.WriteLine ($"kill ({pid}, 9);"); - kill (pid, 9); - } -} - -var args = Args; -if (args.Length <= 1) { - Console.WriteLine ($"Need two arguments (the timeout + the command to launch), got {args.Length} argument(s)"); - Environment.Exit (1); - return; -} - -var launchTimeout = TimeSpan.FromSeconds (10); // must launch within a few seconds. -var argIndex = 0; -var executionTimeout = TimeSpan.FromSeconds (int.Parse (args [argIndex++])); -var commands = args.Skip (argIndex).ToArray (); - -var pid = Process.GetCurrentProcess ().Id; -var maxLaunchAttempts = 10; -var exitCode = -1; -for (var attempt = 0; attempt < maxLaunchAttempts; attempt++) { - var launchTimeoutFile = Path.GetFullPath ($"launch-timeout-sentinel-{pid}-{attempt}.txt"); - var launchTimedOut = new ManualResetEvent (false); - var p = new Process (); - - var launchTimer = new Thread (() => { - if (p.WaitForExit ((int) launchTimeout.TotalMilliseconds)) { - Console.WriteLine ($"App finished before launch timeout triggered."); - } else if (!File.Exists (launchTimeoutFile)) { - Console.WriteLine ($"Launch timed out after {launchTimeout.TotalSeconds} seconds."); - launchTimedOut.Set (); - p.Abort (); - } - }) { - IsBackground = true, - }; - - try { - p.StartInfo.FileName = commands [0]; - p.StartInfo.Arguments = string.Join (" ", commands.Skip (1)); - p.StartInfo.UseShellExecute = false; - p.StartInfo.EnvironmentVariables ["LAUNCH_SENTINEL_FILE"] = launchTimeoutFile; - - Console.WriteLine ($"Launching (attempt #{attempt + 1}):"); - Console.WriteLine ($" {p.StartInfo.FileName} {p.StartInfo.Arguments}"); - - p.Start (); - - launchTimer.Start (); - - if (!p.WaitForExit ((int) executionTimeout.TotalMilliseconds)) { - Console.WriteLine ($"Execution timed out after {executionTimeout.TotalSeconds} seconds."); - p.Abort (); - p.WaitForExit (); - } - - launchTimer.Join (); - - exitCode = p.ExitCode; - - if (launchTimedOut.WaitOne (0)) { - Console.WriteLine ($"Launching again since the launch timeout triggered."); - continue; - } - Console.WriteLine ($"Execution completed with exit code {exitCode}"); - } finally { - File.Delete (launchTimeoutFile); - p.Dispose (); - } - break; -} - -Environment.Exit (exitCode); diff --git a/tests/scripted/Makefile b/tests/scripted/Makefile deleted file mode 100644 index defe922062ca..000000000000 --- a/tests/scripted/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -TOP=../.. -include $(TOP)/Make.config - -ALL_TESTS=select-native-compiler bug-13945 bug-35786 - -all-local tests run-tests:: $(ALL_TESTS) - -select-native-compiler: - $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -miphoneos-version-min=$(IOS_SDK_VERSION) -isysroot $(XCODE_DEVELOPER_ROOT)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(IOS_SDK_VERSION).sdk -Wall -g -c select-native-compiler/native.cpp -o select-native-compiler/libNative.a - mkdir -p select-native-compiler/SelectNativeCompiler.app - $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/btouch-native select-native-compiler/binding.cs --link-with=select-native-compiler/libNative.a,Native -s:select-native-compiler/managed.cs -o:select-native-compiler/binding.dll - $(SYSTEM_CSC) select-native-compiler/app.cs -r:$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll -r:select-native-compiler/binding.dll -out:select-native-compiler/app.exe - $(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/mtouch -r:select-native-compiler/binding.dll select-native-compiler/app.exe --abi=arm64 -sdk "$(IOS_SDK_VERSION)" -dev:select-native-compiler/SelectNativeCompiler.app -sdkroot $(XCODE_DEVELOPER_ROOT) -r:$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll - -bug-13945 bug-35786: - $(MAKE) -C $@ - -.PHONY: $(ALL_TESTS) - -include $(TOP)/mk/rules.mk diff --git a/tests/scripted/bug-13945/.gitignore b/tests/scripted/bug-13945/.gitignore deleted file mode 100644 index 198f6ccbfad3..000000000000 --- a/tests/scripted/bug-13945/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -.libs -*.exe -*.dll -*.a -*.m -TheApp.app* -cache* diff --git a/tests/scripted/bug-13945/Makefile b/tests/scripted/bug-13945/Makefile deleted file mode 100644 index b5ddccf23705..000000000000 --- a/tests/scripted/bug-13945/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -TOP=../../.. -include $(TOP)/Make.config - -all-local:: bug-13945 - -bug-13945: - @git clean -xfdq - @echo "void foo () {}" > nativeA.m - @echo "void bar () {}" > nativeB.m - @mkdir -p .libs - @$(MAKE) .libs/iphoneos/nativeA.arm64.o - @$(MAKE) .libs/iphoneos/nativeB.arm64.o - @rm -Rf TheApp.app cache cache-first - @mkdir -p TheApp.app - @mkdir -p cache - - @cp .libs/iphoneos/nativeA.arm64.o libNative.a - @$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/btouch-native binding.cs --link-with=libNative.a,Native -s:managed.cs -o:binding.dll - @$(SYSTEM_CSC) app.cs -r:$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll -r:binding.dll -out:app.exe - @$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/mtouch -r:binding.dll app.exe --abi=arm64 -sdk "$(IOS_SDK_VERSION)" -dev:TheApp.app -sdkroot $(XCODE_DEVELOPER_ROOT) --cache=$(shell pwd)/cache -r:$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll - - @cp -Rp cache cache-first - - @cp .libs/iphoneos/nativeB.arm64.o libNative.a - @$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/btouch-native binding.cs --link-with=libNative.a,Native -s:managed.cs -o:binding.dll - # do not rebuild the .exe - @$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/bin/mtouch -r:binding.dll app.exe --abi=arm64 -sdk "$(IOS_SDK_VERSION)" -dev:TheApp.app -sdkroot $(XCODE_DEVELOPER_ROOT) --cache=$(shell pwd)/cache -r:$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll - - # this will verify that binding.dll wasn't AOT'ed again - if binding.dll.arm64.s differ then the AOT compiler executed. - @diff -u cache-first/arm64/binding.dll.s cache/arm64/binding.dll.s - @echo "$@: Success" - -include $(TOP)/mk/rules.mk diff --git a/tests/scripted/bug-13945/app.cs b/tests/scripted/bug-13945/app.cs deleted file mode 100644 index 9f4a84ad6265..000000000000 --- a/tests/scripted/bug-13945/app.cs +++ /dev/null @@ -1,7 +0,0 @@ -class Test { - static void Main () - { - System.Console.WriteLine (typeof (UIKit.UIButton)); - System.Console.WriteLine (typeof (Native)); - } -} diff --git a/tests/scripted/bug-13945/binding.cs b/tests/scripted/bug-13945/binding.cs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/scripted/bug-13945/managed.cs b/tests/scripted/bug-13945/managed.cs deleted file mode 100644 index 761aa36d2667..000000000000 --- a/tests/scripted/bug-13945/managed.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Foundation; -using ObjCRuntime; - -[assembly: LinkWith ("Native", ForceLoad = true, LinkTarget = LinkTarget.ArmV7)] - -public class Native { -} diff --git a/tests/scripted/bug-35786/.gitignore b/tests/scripted/bug-35786/.gitignore deleted file mode 100644 index 22a3df7ac78b..000000000000 --- a/tests/scripted/bug-35786/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -libs - diff --git a/tests/scripted/bug-35786/Main.cs b/tests/scripted/bug-35786/Main.cs deleted file mode 100644 index 4e92cf266b94..000000000000 --- a/tests/scripted/bug-35786/Main.cs +++ /dev/null @@ -1,7 +0,0 @@ -class M { - static void Main () - { - System.Console.WriteLine (typeof (UIKit.UIWindow)); - All.UseMe (); - } -} diff --git a/tests/scripted/bug-35786/Makefile b/tests/scripted/bug-35786/Makefile deleted file mode 100644 index 4c013f49472d..000000000000 --- a/tests/scripted/bug-35786/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -TOP=../../.. -include $(TOP)/Make.config - -all-local:: bug-35786 - -ITERATIONS=100 -ALL_DLLS:=$(shell printf "libs/C%i.dll " {1..$(ITERATIONS)}) - -libs/C%.cs: Makefile - @echo "public class C$* {}" >> $@ - -libs/C%.dll: libs/C%.cs Makefile - $(SYSTEM_CSC) -target:library $< -out:$@ - -libs/All.cs: Makefile - @echo "public class All {" > $@ - @echo " public static void UseMe ()" >> $@ - @echo " {" >> $@ - @printf " System.Console.WriteLine (typeof (C%i));\n" {1..$(ITERATIONS)} >> $@ - @echo " }" >> $@ - @echo "}" >> $@ - -libs/All.dll.rsp: Makefile - @printf -- "-r:libs/C%i.dll\n" {1..$(ITERATIONS)} > $@ - -libs/All.dll: libs/All.cs libs/All.dll.rsp $(ALL_DLLS) - $(SYSTEM_CSC) -target:library @$@.rsp $< -out:$@ - -libs/bug-35786.exe: Main.cs libs/All.dll - $(SYSTEM_CSC) -target:exe $< -out:$@ -r:libs/All.dll -r:$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll -lib:$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS - -bug-35786: - @git clean -xfdq - @mkdir -p libs - @$(MAKE) -j20 libs/bug-35786.exe - @mkdir -p libs/bug-35786.app - @# ulimit -n=64 works while testing (with the fix for this bug), so use 96 to have some buffer. - @# we lower the ulimit here so that we don't have to create that many assemblies to test with - @# the ulimit default on Yosemite is ulimit=256, which requires 300 assemblies to break the stripper, and 400 assemblies to break the AOT compiler. - @# with 96 here, we only need 20 assemblies to break the stripper, and 35 to break the AOT compiler, so running the test with 100 assemblies should be more than enough. - ulimit -n 96 && $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/mtouch --dev libs/bug-35786.app --targetver=10.3 --abi armv7,arm64 libs/bug-35786.exe --sdkroot $(XCODE_DEVELOPER_ROOT) --sdk $(IOS_SDK_VERSION) -r:$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.iOS/Xamarin.iOS.dll - - -include $(TOP)/mk/rules.mk diff --git a/tests/scripted/select-native-compiler/.gitignore b/tests/scripted/select-native-compiler/.gitignore deleted file mode 100644 index 0bc2cb306dad..000000000000 --- a/tests/scripted/select-native-compiler/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.app -*.dSYM -*.a -*.exe -*.dll diff --git a/tests/scripted/select-native-compiler/app.cs b/tests/scripted/select-native-compiler/app.cs deleted file mode 100644 index 9f4a84ad6265..000000000000 --- a/tests/scripted/select-native-compiler/app.cs +++ /dev/null @@ -1,7 +0,0 @@ -class Test { - static void Main () - { - System.Console.WriteLine (typeof (UIKit.UIButton)); - System.Console.WriteLine (typeof (Native)); - } -} diff --git a/tests/scripted/select-native-compiler/binding.cs b/tests/scripted/select-native-compiler/binding.cs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/scripted/select-native-compiler/managed.cs b/tests/scripted/select-native-compiler/managed.cs deleted file mode 100644 index 80701a432a53..000000000000 --- a/tests/scripted/select-native-compiler/managed.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Foundation; -using ObjCRuntime; - -[assembly: LinkWith ("Native", ForceLoad = true, LinkTarget = LinkTarget.ArmV7, IsCxx = true)] - -public class Native { -} diff --git a/tests/scripted/select-native-compiler/native.cpp b/tests/scripted/select-native-compiler/native.cpp deleted file mode 100644 index 983732173a25..000000000000 --- a/tests/scripted/select-native-compiler/native.cpp +++ /dev/null @@ -1,4 +0,0 @@ -void do_cpp_stuff () -{ - throw "exception"; -} \ No newline at end of file diff --git a/tests/templates/WatchContainer/Container.csproj b/tests/templates/WatchContainer/Container.csproj index 7a28c6740122..be21316fde9a 100644 --- a/tests/templates/WatchContainer/Container.csproj +++ b/tests/templates/WatchContainer/Container.csproj @@ -10,7 +10,7 @@ Resources Container obj\$(Platform)\$(Configuration)-watchos - XAMCORE_3_0; + PackageReference latest diff --git a/tests/test-dependencies.sh b/tests/test-dependencies.sh index 0e23982874ce..844befe448df 100755 --- a/tests/test-dependencies.sh +++ b/tests/test-dependencies.sh @@ -1,4 +1,4 @@ #!/bin/bash -ex cd "$(dirname "$0")" -./system-dependencies.sh --provision-mono --ignore-xamarin-studio --ignore-xcode --ignore-osx --ignore-cmake --ignore-dotnet --ignore-shellcheck --ignore-yamllint +./system-dependencies.sh --provision-mono --ignore-xamarin-studio --ignore-xcode --ignore-osx --ignore-dotnet --ignore-shellcheck --ignore-yamllint diff --git a/tests/test-libraries/Makefile b/tests/test-libraries/Makefile index 61725d4db362..1b1c188866d6 100644 --- a/tests/test-libraries/Makefile +++ b/tests/test-libraries/Makefile @@ -216,10 +216,6 @@ $$($(1)_DIRECTORIES): endef -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -IOS_SIMULATOR_ARCHITECTURES=x86 -IOS_DEVICE_ARCHITECTURES=armv7 armv7s -endif IOS_SIMULATOR_ARCHITECTURES+=x86_64 arm64 IOS_DEVICE_ARCHITECTURES+=arm64 @@ -235,18 +231,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 +238,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 @@ -266,24 +250,10 @@ $(5)_TARGETS += .libs/$(4)/libtest.$(1).a all-local:: $$($(5)_TARGETS) endef -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -$(eval $(call LibTemplate,armv7+7s,.libs/iphoneos/libtest.armv7.o,.libs/iphoneos/libtest.armv7s.o,ios-fat,IOS)) -$(eval $(call LibTemplate,armv7+x86,.libs/iphoneos/libtest.armv7.o,.libs/iphonesimulator/libtest.x86.o,ios-fat,IOS)) -$(eval $(call LibTemplate,armv7s+x86,.libs/iphoneos/libtest.armv7s.o,.libs/iphonesimulator/libtest.x86.o,ios-fat,IOS)) -endif - 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 +309,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 +350,6 @@ endif ifdef INCLUDE_TVOS XCPLATFORMS+= tvos tvsimulator endif -ifdef INCLUDE_WATCH -XCPLATFORMS+= watchos watchsimulator -endif ifdef INCLUDE_MAC XCPLATFORMS+= macos endif @@ -406,9 +370,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 @@ -475,10 +436,15 @@ SWIFTTEST_XCTARGETS += \ all-local:: .libs/SwiftTest.xcframework -.libs/XTest.xcframework.zip: .libs/XTest.xcframework - $(Q_ZIP) cd .libs && $(ZIP) -r "$(notdir $@)" "$(notdir $<)" +define ZippedXcframework +.libs/$(1).xcframework.zip: .libs/$(1).xcframework + $(Q_ZIP) cd .libs && $(ZIP) -r "$$(notdir $$@)" "$$(notdir $$<)" +all-local:: .libs/$(1).xcframework.zip +endef -all-local:: .libs/XTest.xcframework.zip +$(eval $(call ZippedXcframework,XTest)) +$(eval $(call ZippedXcframework,XStaticArTest)) +$(eval $(call ZippedXcframework,XStaticObjectTest)) # Xamarin.Mac 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/custom-type-assembly/Makefile b/tests/test-libraries/custom-type-assembly/Makefile index 29527c3b0295..31af087078fe 100644 --- a/tests/test-libraries/custom-type-assembly/Makefile +++ b/tests/test-libraries/custom-type-assembly/Makefile @@ -2,32 +2,19 @@ TOP=../../.. include $(TOP)/Make.config -.libs/macos/custom-type-assembly.dll: custom-type-assembly.cs Makefile | .libs/macos - $(Q_CSC) $(MAC_mobile_CSC) $< -out:$@ -r:$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono/Xamarin.Mac/Xamarin.Mac.dll -target:library /nologo - .libs/dotnet/macos/custom-type-assembly.dll: bin/Debug/$(DOTNET_TFM)-macos/custom-type-assembly.dll | .libs/dotnet/macos $(Q) $(CP) $< $@ -.libs/macos .libs/dotnet/macos: +.libs/dotnet/macos: $(Q) mkdir -p $@ bin/Debug/$(DOTNET_TFM)-macos/custom-type-assembly.dll: custom-type-assembly.csproj custom-type-assembly.cs - $(Q) unset MSBUILD_EXE_PATH && $(DOTNET) build $< "/bl:$@.binlog" $(MSBUILD_VERBOSITY) + $(Q) unset MSBUILD_EXE_PATH && $(DOTNET) build $< "/bl:$@.binlog" $(DOTNET_BUILD_VERBOSITY) ifdef INCLUDE_MAC - -ifdef INCLUDE_XAMARIN_LEGACY -TARGETS += \ - .libs/macos/custom-type-assembly.dll \ - -endif - -ifdef ENABLE_DOTNET TARGETS += \ .libs/dotnet/macos/custom-type-assembly.dll \ -endif - endif # INCLUDE_MAC build-assembly: $(TARGETS) 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/frameworks/Makefile b/tests/test-libraries/frameworks/Makefile index 1fc6a5e265e1..296de8d449ea 100644 --- a/tests/test-libraries/frameworks/Makefile +++ b/tests/test-libraries/frameworks/Makefile @@ -50,13 +50,8 @@ maccatalyst_INFO_PLIST_INFIX=/Versions/A/Resources maccatalyst_BINARY_INFIX=/Versions/A # For XCFrameworks, we have to lipo some of the RID-specific frameworks together (the ones with multiple RIDs below) -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -iphonesimulator_XC_RUNTIMEIDENTIFIERS=iossimulator-x86 iossimulator-x64 iossimulator-arm64 -iphoneos_XC_RUNTIMEIDENTIFIERS=ios-arm ios-arm64 -else iphonesimulator_XC_RUNTIMEIDENTIFIERS=iossimulator-x64 iossimulator-arm64 iphoneos_XC_RUNTIMEIDENTIFIERS=ios-arm64 -endif tvsimulator_XC_RUNTIMEIDENTIFIERS=tvossimulator-x64 tvossimulator-arm64 tvos_XC_RUNTIMEIDENTIFIERS=tvos-arm64 mac_XC_RUNTIMEIDENTIFIERS=osx-x64 osx-arm64 @@ -200,9 +195,7 @@ ZIPPED_TARGETS += .libs/$(1).xcframework.zip all-local:: .libs/$(1).xcframework.stamp endef -ifdef ENABLE_DOTNET $(foreach name,$(NAMES),$(eval $(call XCFrameworkTemplate,$(name)))) -endif zip: $(ZIPPED_TARGETS) all-local:: $(ZIPPED_TARGETS) 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/nugets/DynamicLibrariesInRuntimesNativeDirectory/Makefile b/tests/test-libraries/nugets/DynamicLibrariesInRuntimesNativeDirectory/Makefile index 67d7001b137b..1b91461712d3 100644 --- a/tests/test-libraries/nugets/DynamicLibrariesInRuntimesNativeDirectory/Makefile +++ b/tests/test-libraries/nugets/DynamicLibrariesInRuntimesNativeDirectory/Makefile @@ -1,29 +1,3 @@ -TOP=../../../.. -include $(TOP)/Make.config - -unexport MSBUILD_EXE_PATH - -.libs: - $(Q) mkdir -p $@ - -PACKAGE_ID=$(shell grep PackageId DynamicLibrariesInRuntimesNativeDirectory.csproj | sed 's_.*\(.*\).*_\1_') -PACKAGE_VERSION=$(shell grep '' DynamicLibrariesInRuntimesNativeDirectory.csproj | sed 's_.*\(.*\).*_\1_') - # Test case for dynamic libraries -.libs/DynamicLibrariesInRuntimesNativeDirectory.nupkg: export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';') -.libs/DynamicLibrariesInRuntimesNativeDirectory.nupkg: DynamicLibrariesInRuntimesNativeDirectory.csproj $(wildcard *.cs) | .libs - $(Q) mkdir -p $(abspath $(NUGET_TEST_FEED)) - $(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $< - $(Q) $(CP) bin/Release/Xamarin.Tests.DynamicLibrariesInRuntimesNativeDirectory.$(PACKAGE_VERSION).nupkg $@ - -INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/xamarin.tests.DynamicLibrariesInRuntimesNativeDirectory/$(PACKAGE_VERSION)/xamarin.tests.DynamicLibrariesInRuntimesNativeDirectory.$(PACKAGE_VERSION).nupkg - -$(INSTALLED_PACKAGE): .libs/DynamicLibrariesInRuntimesNativeDirectory.nupkg - if test -d $(NUGET_TEST_FEED)/$(PACKAGE_ID)/$(PACKAGE_VERSION); then nuget delete $(PACKAGE_ID) $(PACKAGE_VERSION) -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive || true; fi - rm -Rf $(TOP)/tests/dotnet/packages/xamarin.tests.DynamicLibrariesInRuntimesNativeDirectory - mkdir -p $(abspath $(NUGET_TEST_FEED)) - nuget add "$<" -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive -ifdef ENABLE_DOTNET -all-local:: $(INSTALLED_PACKAGE) -endif +include ../shared.mk diff --git a/tests/test-libraries/nugets/FrameworksInRuntimesNativeDirectory/Makefile b/tests/test-libraries/nugets/FrameworksInRuntimesNativeDirectory/Makefile index f39b801533bf..88f00a8889ff 100644 --- a/tests/test-libraries/nugets/FrameworksInRuntimesNativeDirectory/Makefile +++ b/tests/test-libraries/nugets/FrameworksInRuntimesNativeDirectory/Makefile @@ -1,29 +1,3 @@ -TOP=../../../.. -include $(TOP)/Make.config - -unexport MSBUILD_EXE_PATH - -.libs: - $(Q) mkdir -p $@ - -PACKAGE_ID=$(shell grep PackageId FrameworksInRuntimesNativeDirectory.csproj | sed 's_.*\(.*\).*_\1_') -PACKAGE_VERSION=$(shell grep '' FrameworksInRuntimesNativeDirectory.csproj | sed 's_.*\(.*\).*_\1_') - # Test case for https://github.com/xamarin/xamarin-macios/issues/12440 -.libs/FrameworksInRuntimesNativeDirectory.nupkg: export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';') -.libs/FrameworksInRuntimesNativeDirectory.nupkg: FrameworksInRuntimesNativeDirectory.csproj $(wildcard *.cs) | .libs - $(Q) mkdir -p $(abspath $(NUGET_TEST_FEED)) - $(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $< - $(Q) $(CP) bin/Release/Xamarin.Tests.FrameworksInRuntimesNativeDirectory.$(PACKAGE_VERSION).nupkg $@ - -INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/xamarin.tests.frameworksinruntimesnativedirectory/$(PACKAGE_VERSION)/xamarin.tests.frameworksinruntimesnativedirectory.$(PACKAGE_VERSION).nupkg - -$(INSTALLED_PACKAGE): .libs/FrameworksInRuntimesNativeDirectory.nupkg - if test -d $(NUGET_TEST_FEED)/$(PACKAGE_ID)/$(PACKAGE_VERSION); then nuget delete $(PACKAGE_ID) $(PACKAGE_VERSION) -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive || true; fi - rm -Rf $(TOP)/tests/dotnet/packages/xamarin.tests.frameworksinruntimesnativedirectory - mkdir -p $(abspath $(NUGET_TEST_FEED)) - nuget add "$<" -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive -ifdef ENABLE_DOTNET -all-local:: $(INSTALLED_PACKAGE) -endif +include ../shared.mk diff --git a/tests/test-libraries/nugets/XCFrameworkWithStaticLibraryInRuntimesNativeDirectory/Makefile b/tests/test-libraries/nugets/XCFrameworkWithStaticLibraryInRuntimesNativeDirectory/Makefile index 351978a16fed..88f00a8889ff 100644 --- a/tests/test-libraries/nugets/XCFrameworkWithStaticLibraryInRuntimesNativeDirectory/Makefile +++ b/tests/test-libraries/nugets/XCFrameworkWithStaticLibraryInRuntimesNativeDirectory/Makefile @@ -1,32 +1,3 @@ -TOP=../../../.. -include $(TOP)/Make.config - -unexport MSBUILD_EXE_PATH - -NAME=XCFrameworkWithStaticLibraryInRuntimesNativeDirectory -LOWERCASED_NAME:=$(shell echo $(NAME) | tr 'A-Z' 'a-z') - -.libs: - $(Q) mkdir -p $@ - -PACKAGE_ID=$(shell grep PackageId $(NAME).csproj | sed 's_.*\(.*\).*_\1_') -PACKAGE_VERSION=$(shell grep '' $(NAME).csproj | sed 's_.*\(.*\).*_\1_') - # Test case for https://github.com/xamarin/xamarin-macios/issues/12440 -.libs/$(NAME).nupkg: export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';') -.libs/$(NAME).nupkg: $(NAME).csproj $(wildcard *.cs) | .libs - $(Q) mkdir -p $(abspath $(NUGET_TEST_FEED)) - $(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $< - $(Q) $(CP) bin/Release/Xamarin.Tests.$(NAME).$(PACKAGE_VERSION).nupkg $@ - -INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/xamarin.tests.$(LOWERCASED_NAME)/$(PACKAGE_VERSION)/xamarin.tests.$(LOWERCASED_NAME).$(PACKAGE_VERSION).nupkg - -$(INSTALLED_PACKAGE): .libs/$(NAME).nupkg - if test -d $(NUGET_TEST_FEED)/$(PACKAGE_ID)/$(PACKAGE_VERSION); then nuget delete $(PACKAGE_ID) $(PACKAGE_VERSION) -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive || true; fi - rm -Rf $(TOP)/tests/dotnet/packages/xamarin.tests.$(LOWERCASED_NAME) - mkdir -p $(abspath $(NUGET_TEST_FEED)) - nuget add "$<" -source $(abspath $(NUGET_TEST_FEED)) -NonInteractive -ifdef ENABLE_DOTNET -all-local:: $(INSTALLED_PACKAGE) -endif +include ../shared.mk diff --git a/tests/test-libraries/nugets/shared.mk b/tests/test-libraries/nugets/shared.mk new file mode 100644 index 000000000000..f94d95731a80 --- /dev/null +++ b/tests/test-libraries/nugets/shared.mk @@ -0,0 +1,29 @@ +TOP=../../../.. +include $(TOP)/Make.config + +unexport MSBUILD_EXE_PATH + +NAME=$(shell basename "$(CURDIR)") +LOWERCASED_NAME:=$(shell echo $(NAME) | tr 'A-Z' 'a-z') + +.libs: + $(Q) mkdir -p $@ + +PACKAGE_ID=$(shell grep PackageId $(NAME).csproj | sed 's_.*\(.*\).*_\1_') +PACKAGE_VERSION=$(shell grep '' $(NAME).csproj | sed 's_.*\(.*\).*_\1_') +NUPKG_PATH=bin/Release/$(PACKAGE_ID).$(PACKAGE_VERSION).nupkg + +# Test case for dynamic libraries +$(NUPKG_PATH): export DOTNET_PLATFORMS:=$(shell echo $(DOTNET_PLATFORMS) | tr ' ' ';') +$(NUPKG_PATH): $(NAME).csproj $(wildcard *.cs) | .libs + $(Q) rm -f $(NUPKG_PATH) + $(Q) mkdir -p $(abspath $(NUGET_TEST_FEED)) + $(Q_GEN) $(DOTNET) pack /bl $(DOTNET_PACK_VERBOSITY) $< + +INSTALLED_PACKAGE=$(NUGET_TEST_FEED)/$(PACKAGE_ID).$(PACKAGE_VERSION).nupkg + +$(INSTALLED_PACKAGE): $(NUPKG_PATH) + rm -rf $(NUGET_TEST_FEED)/$(PACKAGE_ID).*.nupkg + $(CP) $< $@ + +all-local:: $(INSTALLED_PACKAGE) 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/tests-mac.sln b/tests/tests-mac.sln deleted file mode 100644 index 2cf89214e93f..000000000000 --- a/tests/tests-mac.sln +++ /dev/null @@ -1,119 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mmptest", "mmptest\mmptest.csproj", "{6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xammac_tests", "xammac_tests\xammac_tests.csproj", "{22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dont link-mac", "linker\mac\dont link\dont link-mac.csproj", "{78831857-A261-8EE0-A5F6-33D2628DE5D0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "framework-test-mac", "framework-test\macOS\framework-test-mac.csproj", "{E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link all-mac", "linker\mac\link all\link all-mac.csproj", "{4C943B12-C5AF-4CD4-B583-B4011D13CAAB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link sdk-mac", "linker\mac\link sdk\link sdk-mac.csproj", "{F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-test", "bindings-test\macOS\bindings-test.csproj", "{20BEA313-7E2D-4209-93C0-E4D99C72695A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Touch.Client-macOS-mobile", "..\external\Touch.Unit\Touch.Client\macOS\mobile\Touch.Client-macOS-mobile.csproj", "{88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Touch.Client-macOS-full", "..\external\Touch.Unit\Touch.Client\macOS\full\Touch.Client-macOS-full.csproj", "{A1209F3A-3876-4EAC-ADA7-99F660002AB6}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-framework-test-mac", "bindings-framework-test\macOS\bindings-framework-test.csproj", "{E40B0B77-3467-4891-9117-7AF8F248E306}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Default|Any CPU = Default|Any CPU - AppStore|Any CPU = AppStore|Any CPU - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Debug|Any CPU.ActiveCfg = Debug|x86 - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Debug|Any CPU.Build.0 = Debug|x86 - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Release|Any CPU.ActiveCfg = Release|x86 - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Release|Any CPU.Build.0 = Release|x86 - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Debug|x86.ActiveCfg = Debug|x86 - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Debug|x86.Build.0 = Debug|x86 - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Release|x86.ActiveCfg = Release|x86 - {6E5405EC-1F68-4CD8-AD4B-E4CCFBE47977}.Release|x86.Build.0 = Release|x86 - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Release|Any CPU.ActiveCfg = Release|Any CPU - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Release|Any CPU.Build.0 = Release|Any CPU - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Debug|x86.ActiveCfg = Debug|Any CPU - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Debug|x86.Build.0 = Debug|Any CPU - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Release|x86.ActiveCfg = Release|Any CPU - {22BF080C-AFAD-445B-8BB5-42B9E7FDBC68}.Release|x86.Build.0 = Release|Any CPU - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|Any CPU.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|Any CPU.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|Any CPU.ActiveCfg = Release|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|Any CPU.Build.0 = Release|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|x86.ActiveCfg = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Debug|x86.Build.0 = Debug|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|x86.ActiveCfg = Release|x86 - {78831857-A261-8EE0-A5F6-33D2628DE5D0}.Release|x86.Build.0 = Release|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Debug|Any CPU.ActiveCfg = Debug|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Debug|Any CPU.Build.0 = Debug|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Release|Any CPU.ActiveCfg = Release|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Release|Any CPU.Build.0 = Release|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Debug|x86.ActiveCfg = Debug|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Debug|x86.Build.0 = Debug|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Release|x86.ActiveCfg = Release|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Release|x86.Build.0 = Release|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Default|Any CPU.ActiveCfg = Debug|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.Default|Any CPU.Build.0 = Debug|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.AppStore|Any CPU.ActiveCfg = Debug|x86 - {E0E84B58-C333-1BF3-D1EC-42EE3EA0D071}.AppStore|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|Any CPU.ActiveCfg = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|Any CPU.Build.0 = Debug|x86 - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|x86.ActiveCfg = Debug|Any CPU - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Debug|x86.Build.0 = Debug|Any CPU - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|x86.ActiveCfg = Release|Any CPU - {4C943B12-C5AF-4CD4-B583-B4011D13CAAB}.Release|x86.Build.0 = Release|Any CPU - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|Any CPU.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|Any CPU.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|x86.ActiveCfg = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Debug|x86.Build.0 = Debug|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|x86.ActiveCfg = Release|x86 - {F5FF0F5E-0C30-4719-A2B1-5DAE33D1E579}.Release|x86.Build.0 = Release|x86 - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Release|Any CPU.Build.0 = Release|Any CPU - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Debug|x86.ActiveCfg = Debug|Any CPU - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Debug|x86.Build.0 = Debug|Any CPU - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Release|x86.ActiveCfg = Release|Any CPU - {20BEA313-7E2D-4209-93C0-E4D99C72695A}.Release|x86.Build.0 = Release|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Debug|Any CPU.Build.0 = Debug|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Release|Any CPU.ActiveCfg = Release|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Release|Any CPU.Build.0 = Release|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Debug|x86.ActiveCfg = Debug|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Debug|x86.Build.0 = Debug|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Release|x86.ActiveCfg = Release|Any CPU - {88A8A1AC-0829-4C98-8F4A-9FC23DC42A06}.Release|x86.Build.0 = Release|Any CPU - {A1209F3A-3876-4EAC-ADA7-99F660002AB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A1209F3A-3876-4EAC-ADA7-99F660002AB6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A1209F3A-3876-4EAC-ADA7-99F660002AB6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A1209F3A-3876-4EAC-ADA7-99F660002AB6}.Release|Any CPU.Build.0 = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|Any CPU.Build.0 = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Default|Any CPU.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Default|Any CPU.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|x86.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|x86.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|x86.ActiveCfg = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/tests/tests.sln b/tests/tests.sln deleted file mode 100644 index 0adc1fa5e4e7..000000000000 --- a/tests/tests.sln +++ /dev/null @@ -1,729 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monotouch-test", "monotouch-test\monotouch-test.csproj", "{AC6D070F-2ED4-4701-B701-81915B931D1D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "framework-test", "framework-test\iOS\framework-test-ios.csproj", "{2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}" -EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "fsharp", "fsharp\fsharp.fsproj", "{7862FE5A-530A-4651-825F-C80836B0A3A1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BundledResources", "BundledResources\BundledResources.csproj", "{FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbeddedResources", "EmbeddedResources\EmbeddedResources.csproj", "{676F527D-3352-42EA-9DE2-181C45003568}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-test", "bindings-test\iOS\bindings-test.csproj", "{D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-framework-test", "bindings-framework-test\iOS\bindings-framework-test.csproj", "{E40B0B77-3467-4891-9117-7AF8F248E306}" -EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "fsharplibrary", "fsharplibrary\fsharplibrary.fsproj", "{C7212169-BA46-413B-91CD-A32C52AD5E0D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "introspection-ios", "introspection\iOS\introspection-ios.csproj", "{208744BD-504E-47D7-9A98-1CF02454A6DA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dont link", "linker\ios\dont link\dont link.csproj", "{839212D5-C25B-4284-AA96-59C3872B8184}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link all", "linker\ios\link all\link all.csproj", "{370CC763-EDC3-41DA-A21A-D4C82CABEFE4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "link sdk", "linker\ios\link sdk\link sdk.csproj", "{C47F8F72-A7CA-4149-AA7D-BC4814803EF3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mtouchtests", "mtouch\mtouchtests.csproj", "{9A1177F5-16E6-45DE-AA69-DC9924EC39B8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testgenerator", "test-libraries\testgenerator.csproj", "{CD430449-8E59-4ECD-ADD9-ACF79E9E660B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sampletester", "sampletester\sampletester.csproj", "{7340A1C6-61A5-42D2-9DBC-6688D2E70F62}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cecil-tests", "cecil-tests\cecil-tests.csproj", "{0C979851-15E9-4BB6-AD79-5F0C7DF69456}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Touch.Client-iOS", "..\external\Touch.Unit\Touch.Client\iOS\Touch.Client-iOS.csproj", "{F611ED96-54B5-4975-99BB-12F50AF95936}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xcframework-test", "xcframework-test\iOS\xcframework-test-ios.csproj", "{2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bindings-xcframework-test", "bindings-xcframework-test\iOS\bindings-xcframework-test.csproj", "{E40B0B77-3467-4891-9117-7AF8F248E307}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator - Debug|iPhone = Debug|iPhone - Release|iPhone = Release|iPhone - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|iPhone.ActiveCfg = Debug|iPhone - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|iPhone.Build.0 = Debug|iPhone - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Release|iPhone.ActiveCfg = Release|iPhone - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Release|iPhone.Build.0 = Release|iPhone - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {AC6D070F-2ED4-4701-B701-81915B931D1D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Debug|iPhone.ActiveCfg = Debug|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Debug|iPhone.Build.0 = Debug|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Release|iPhone.ActiveCfg = Release|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Release|iPhone.Build.0 = Release|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Debug|iPhone.ActiveCfg = Debug|iPhone - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Debug|iPhone.Build.0 = Debug|iPhone - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Release|iPhone.ActiveCfg = Release|iPhone - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Release|iPhone.Build.0 = Release|iPhone - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {5BDBB8B4-5D6B-43E8-9664-C4D5CA3C9B11}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|iPhone.ActiveCfg = Debug|iPhone - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|iPhone.Build.0 = Debug|iPhone - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Release|iPhone.ActiveCfg = Release|iPhone - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Release|iPhone.Build.0 = Release|iPhone - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {7862FE5A-530A-4651-825F-C80836B0A3A1}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|iPhone.Build.0 = Debug|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|Any CPU.Build.0 = Release|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|iPhone.ActiveCfg = Release|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|iPhone.Build.0 = Release|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {FE6EDEE9-ADF6-4F42-BCF2-B68C0A44EC3D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Debug|Any CPU.Build.0 = Debug|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Debug|iPhone.Build.0 = Debug|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Release|Any CPU.ActiveCfg = Release|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Release|Any CPU.Build.0 = Release|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Release|iPhone.ActiveCfg = Release|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Release|iPhone.Build.0 = Release|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {676F527D-3352-42EA-9DE2-181C45003568}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhone.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|Any CPU.Build.0 = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhone.ActiveCfg = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhone.Build.0 = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|iPhone.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|Any CPU.Build.0 = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|iPhone.ActiveCfg = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|iPhone.Build.0 = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E306}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|iPhone.Build.0 = Debug|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|Any CPU.Build.0 = Release|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|iPhone.ActiveCfg = Release|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|iPhone.Build.0 = Release|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C7212169-BA46-413B-91CD-A32C52AD5E0D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Debug|iPhone.ActiveCfg = Debug|iPhone - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Debug|iPhone.Build.0 = Debug|iPhone - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Release|iPhone.ActiveCfg = Release|iPhone - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Release|iPhone.Build.0 = Release|iPhone - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {BEF0140A-A6A6-4074-B55F-03856A6B5862}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Debug|iPhone.ActiveCfg = Debug|iPhone - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Debug|iPhone.Build.0 = Debug|iPhone - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Release|iPhone.ActiveCfg = Release|iPhone - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Release|iPhone.Build.0 = Release|iPhone - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {D7212E3D-CD1B-4E58-A11D-C7B7898168AA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Debug|iPhone.ActiveCfg = Debug|iPhone - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Debug|iPhone.Build.0 = Debug|iPhone - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Release|iPhone.ActiveCfg = Release|iPhone - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Release|iPhone.Build.0 = Release|iPhone - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {DA061019-04C3-4221-AF04-63F2BFB5DA42}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {93268FFB-571C-4402-8899-027A7778D2C0}.Debug|iPhone.ActiveCfg = Debug|iPhone - {93268FFB-571C-4402-8899-027A7778D2C0}.Debug|iPhone.Build.0 = Debug|iPhone - {93268FFB-571C-4402-8899-027A7778D2C0}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {93268FFB-571C-4402-8899-027A7778D2C0}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {93268FFB-571C-4402-8899-027A7778D2C0}.Release|iPhone.ActiveCfg = Release|iPhone - {93268FFB-571C-4402-8899-027A7778D2C0}.Release|iPhone.Build.0 = Release|iPhone - {93268FFB-571C-4402-8899-027A7778D2C0}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {93268FFB-571C-4402-8899-027A7778D2C0}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhone.ActiveCfg = Debug|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhone.Build.0 = Debug|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhone.ActiveCfg = Release|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhone.Build.0 = Release|iPhone - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {208744BD-504E-47D7-9A98-1CF02454A6DA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhone.ActiveCfg = Debug|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhone.Build.0 = Debug|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhone.ActiveCfg = Release|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhone.Build.0 = Release|iPhone - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {839212D5-C25B-4284-AA96-59C3872B8184}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhone.ActiveCfg = Debug|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhone.Build.0 = Debug|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhone.ActiveCfg = Release|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhone.Build.0 = Release|iPhone - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {370CC763-EDC3-41DA-A21A-D4C82CABEFE4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhone.ActiveCfg = Debug|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhone.Build.0 = Debug|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhone.ActiveCfg = Release|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhone.Build.0 = Release|iPhone - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {C47F8F72-A7CA-4149-AA7D-BC4814803EF3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhoneSimulator.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|iPhone.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhone.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|iPhone.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|Any CPU.ActiveCfg = Debug|Any CPU - {9A1177F5-16E6-45DE-AA69-DC9924EC39B8}.Release|Any CPU.Build.0 = Debug|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Debug|iPhone.Build.0 = Debug|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Release|iPhone.ActiveCfg = Release|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Release|iPhone.Build.0 = Release|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6F47C092-2F85-43D6-1111-E687426F6BF3}.Release|Any CPU.Build.0 = Release|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Debug|iPhone.Build.0 = Debug|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Release|iPhone.ActiveCfg = Release|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Release|iPhone.Build.0 = Release|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6F47C092-2F85-43D6-2222-E687426F6BF3}.Release|Any CPU.Build.0 = Release|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Debug|iPhone.Build.0 = Debug|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Release|iPhone.ActiveCfg = Release|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Release|iPhone.Build.0 = Release|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD430449-8E59-4ECD-ADD9-ACF79E9E660B}.Release|Any CPU.Build.0 = Release|Any CPU - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Debug|iPhone.ActiveCfg = Debug|iPhone - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Debug|iPhone.Build.0 = Debug|iPhone - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Release|iPhone.ActiveCfg = Release|iPhone - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Release|iPhone.Build.0 = Release|iPhone - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {3A835432-B054-32FD-07CB-F9A8FFCFB44D}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Debug|iPhone.ActiveCfg = Debug|iPhone - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Debug|iPhone.Build.0 = Debug|iPhone - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Release|iPhone.ActiveCfg = Release|iPhone - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Release|iPhone.Build.0 = Release|iPhone - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {E5B0BF8F-128E-8C1F-5A10-99D26AA71E76}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Debug|iPhone.ActiveCfg = Debug|iPhone - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Debug|iPhone.Build.0 = Debug|iPhone - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Release|iPhone.ActiveCfg = Release|iPhone - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Release|iPhone.Build.0 = Release|iPhone - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {387EAD7C-3E00-6BEC-8914-586A0BE31907}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Debug|iPhone.ActiveCfg = Debug|iPhone - {274328F1-9A35-ED63-A95C-D995076011DA}.Debug|iPhone.Build.0 = Debug|iPhone - {274328F1-9A35-ED63-A95C-D995076011DA}.Release|iPhone.ActiveCfg = Release|iPhone - {274328F1-9A35-ED63-A95C-D995076011DA}.Release|iPhone.Build.0 = Release|iPhone - {274328F1-9A35-ED63-A95C-D995076011DA}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {274328F1-9A35-ED63-A95C-D995076011DA}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Debug|iPhone.ActiveCfg = Debug|iPhone - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Debug|iPhone.Build.0 = Debug|iPhone - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Release|iPhone.ActiveCfg = Release|iPhone - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Release|iPhone.Build.0 = Release|iPhone - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {36263A92-DACE-4BB0-063E-CD7107CF788A}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Debug|iPhone.ActiveCfg = Debug|iPhone - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Debug|iPhone.Build.0 = Debug|iPhone - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Release|iPhone.ActiveCfg = Release|iPhone - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Release|iPhone.Build.0 = Release|iPhone - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {F8CFE6AE-81B3-C1D5-B6E3-881EFB19D8B6}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Debug|iPhone.ActiveCfg = Debug|iPhone - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Debug|iPhone.Build.0 = Debug|iPhone - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Release|iPhone.ActiveCfg = Release|iPhone - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Release|iPhone.Build.0 = Release|iPhone - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {022B4AF2-F62F-8EF3-9375-7CCE2820C54C}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Debug|iPhone.ActiveCfg = Debug|iPhone - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Debug|iPhone.Build.0 = Debug|iPhone - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Release|iPhone.ActiveCfg = Release|iPhone - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Release|iPhone.Build.0 = Release|iPhone - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {ECFE62D9-1BC5-C44F-4D47-9BBA5B2C7F36}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Debug|iPhone.ActiveCfg = Debug|iPhone - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Debug|iPhone.Build.0 = Debug|iPhone - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Release|iPhone.ActiveCfg = Release|iPhone - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Release|iPhone.Build.0 = Release|iPhone - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {569FFC00-3699-63C0-E0B7-9C2DA8F015D9}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Debug|iPhone.ActiveCfg = Debug|iPhone - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Debug|iPhone.Build.0 = Debug|iPhone - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Release|iPhone.ActiveCfg = Release|iPhone - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Release|iPhone.Build.0 = Release|iPhone - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {7017DF4C-80ED-A7C3-7D44-F3A9CA5B4DF4}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Debug|iPhone.ActiveCfg = Debug|iPhone - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Debug|iPhone.Build.0 = Debug|iPhone - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Release|iPhone.ActiveCfg = Release|iPhone - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Release|iPhone.Build.0 = Release|iPhone - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {ABACCDE0-14CC-8C9F-7044-CE101CA9D818}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Debug|iPhone.ActiveCfg = Debug|iPhone - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Debug|iPhone.Build.0 = Debug|iPhone - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Release|iPhone.ActiveCfg = Release|iPhone - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Release|iPhone.Build.0 = Release|iPhone - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {E44B6A87-C5AF-DF76-B514-841F9DF59CDF}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Debug|iPhone.ActiveCfg = Debug|iPhone - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Debug|iPhone.Build.0 = Debug|iPhone - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Release|iPhone.ActiveCfg = Release|iPhone - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Release|iPhone.Build.0 = Release|iPhone - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {E76564D2-12A8-219F-F69C-6FE35B8BCDFC}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Debug|iPhone.ActiveCfg = Debug|iPhone - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Debug|iPhone.Build.0 = Debug|iPhone - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Release|iPhone.ActiveCfg = Release|iPhone - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Release|iPhone.Build.0 = Release|iPhone - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {3D2B8C63-52B0-C706-B745-95453F8B90D3}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Debug|iPhone.ActiveCfg = Debug|iPhone - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Debug|iPhone.Build.0 = Debug|iPhone - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Release|iPhone.ActiveCfg = Release|iPhone - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Release|iPhone.Build.0 = Release|iPhone - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {0477B067-9914-2C4F-14C4-CBDFDC0653CF}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Debug|iPhone.ActiveCfg = Debug|iPhone - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Debug|iPhone.Build.0 = Debug|iPhone - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Release|iPhone.ActiveCfg = Release|iPhone - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Release|iPhone.Build.0 = Release|iPhone - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {44F02498-1AF8-CB2B-5F52-83C74B4F8F9F}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Debug|iPhone.ActiveCfg = Debug|iPhone - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Debug|iPhone.Build.0 = Debug|iPhone - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Release|iPhone.ActiveCfg = Release|iPhone - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Release|iPhone.Build.0 = Release|iPhone - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {0D2AC6C4-5EC1-0927-876B-0658DEC4FF94}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Debug|iPhone.ActiveCfg = Debug|iPhone - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Debug|iPhone.Build.0 = Debug|iPhone - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Release|iPhone.ActiveCfg = Release|iPhone - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Release|iPhone.Build.0 = Release|iPhone - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C63F3DD4-EC06-1CE5-BA87-1D038C5A0BBD}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Debug|iPhone.ActiveCfg = Debug|iPhone - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Debug|iPhone.Build.0 = Debug|iPhone - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Release|iPhone.ActiveCfg = Release|iPhone - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Release|iPhone.Build.0 = Release|iPhone - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {797B6029-DEFB-CEA8-B5D3-BDA6E5EC7B35}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Debug|iPhone.ActiveCfg = Debug|iPhone - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Debug|iPhone.Build.0 = Debug|iPhone - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Release|iPhone.ActiveCfg = Release|iPhone - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Release|iPhone.Build.0 = Release|iPhone - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {5A2B9BB6-B845-92E1-B036-677BECEABD46}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Debug|iPhone.ActiveCfg = Debug|iPhone - {ADF8645F-3737-8342-704B-006A887760CF}.Debug|iPhone.Build.0 = Debug|iPhone - {ADF8645F-3737-8342-704B-006A887760CF}.Release|iPhone.ActiveCfg = Release|iPhone - {ADF8645F-3737-8342-704B-006A887760CF}.Release|iPhone.Build.0 = Release|iPhone - {ADF8645F-3737-8342-704B-006A887760CF}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {ADF8645F-3737-8342-704B-006A887760CF}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Debug|iPhone.ActiveCfg = Debug|iPhone - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Debug|iPhone.Build.0 = Debug|iPhone - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Release|iPhone.ActiveCfg = Release|iPhone - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Release|iPhone.Build.0 = Release|iPhone - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {CDD9B9BA-6E8C-CE0F-DF98-F198484EDAC6}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Debug|iPhone.ActiveCfg = Debug|iPhone - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Debug|iPhone.Build.0 = Debug|iPhone - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Release|iPhone.ActiveCfg = Release|iPhone - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Release|iPhone.Build.0 = Release|iPhone - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {0E046C2E-0261-F92B-20AB-8E27CDC8F859}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Debug|iPhone.ActiveCfg = Debug|iPhone - {CB000449-11E5-37D7-C757-4180FA74275D}.Debug|iPhone.Build.0 = Debug|iPhone - {CB000449-11E5-37D7-C757-4180FA74275D}.Release|iPhone.ActiveCfg = Release|iPhone - {CB000449-11E5-37D7-C757-4180FA74275D}.Release|iPhone.Build.0 = Release|iPhone - {CB000449-11E5-37D7-C757-4180FA74275D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {CB000449-11E5-37D7-C757-4180FA74275D}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Debug|iPhone.ActiveCfg = Debug|iPhone - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Debug|iPhone.Build.0 = Debug|iPhone - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Release|iPhone.ActiveCfg = Release|iPhone - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Release|iPhone.Build.0 = Release|iPhone - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {FB0374D9-4A15-4F14-BC79-A88406FC4966}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Debug|iPhone.ActiveCfg = Debug|iPhone - {D348AA85-B644-2187-C237-34DA88BFCA77}.Debug|iPhone.Build.0 = Debug|iPhone - {D348AA85-B644-2187-C237-34DA88BFCA77}.Release|iPhone.ActiveCfg = Release|iPhone - {D348AA85-B644-2187-C237-34DA88BFCA77}.Release|iPhone.Build.0 = Release|iPhone - {D348AA85-B644-2187-C237-34DA88BFCA77}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {D348AA85-B644-2187-C237-34DA88BFCA77}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Debug|iPhone.ActiveCfg = Debug|iPhone - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Debug|iPhone.Build.0 = Debug|iPhone - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Release|iPhone.ActiveCfg = Release|iPhone - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Release|iPhone.Build.0 = Release|iPhone - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {2FD12269-09D5-AD2C-9E59-6A18FCB2241F}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Debug|iPhone.ActiveCfg = Debug|iPhone - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Debug|iPhone.Build.0 = Debug|iPhone - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Release|iPhone.ActiveCfg = Release|iPhone - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Release|iPhone.Build.0 = Release|iPhone - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {D4AF3416-BC36-1522-41E9-43C85DB18D84}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Debug|iPhone.ActiveCfg = Debug|iPhone - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Debug|iPhone.Build.0 = Debug|iPhone - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Release|iPhone.ActiveCfg = Release|iPhone - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Release|iPhone.Build.0 = Release|iPhone - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {BA08B246-1AE4-F419-926F-2EA9ED5DAF90}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Debug|iPhone.ActiveCfg = Debug|iPhone - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Debug|iPhone.Build.0 = Debug|iPhone - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Release|iPhone.ActiveCfg = Release|iPhone - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Release|iPhone.Build.0 = Release|iPhone - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {EA3885C2-6A88-1007-BE44-29E6997B9856}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Debug|iPhone.ActiveCfg = Debug|iPhone - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Debug|iPhone.Build.0 = Debug|iPhone - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Release|iPhone.ActiveCfg = Release|iPhone - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Release|iPhone.Build.0 = Release|iPhone - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {C761790B-0C12-72AA-D4E3-671F2AA1719E}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Debug|iPhone.ActiveCfg = Debug|iPhone - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Debug|iPhone.Build.0 = Debug|iPhone - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Release|iPhone.ActiveCfg = Release|iPhone - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Release|iPhone.Build.0 = Release|iPhone - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {01D5D6F0-C210-0165-D4AC-85B038CCC1D8}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Debug|iPhone.ActiveCfg = Debug|iPhone - {89B53407-2C05-975F-A09F-F131D5312DAA}.Debug|iPhone.Build.0 = Debug|iPhone - {89B53407-2C05-975F-A09F-F131D5312DAA}.Release|iPhone.ActiveCfg = Release|iPhone - {89B53407-2C05-975F-A09F-F131D5312DAA}.Release|iPhone.Build.0 = Release|iPhone - {89B53407-2C05-975F-A09F-F131D5312DAA}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {89B53407-2C05-975F-A09F-F131D5312DAA}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Debug|iPhone.ActiveCfg = Debug|iPhone - {A823F088-0836-20BB-D955-8B26BD9057BC}.Debug|iPhone.Build.0 = Debug|iPhone - {A823F088-0836-20BB-D955-8B26BD9057BC}.Release|iPhone.ActiveCfg = Release|iPhone - {A823F088-0836-20BB-D955-8B26BD9057BC}.Release|iPhone.Build.0 = Release|iPhone - {A823F088-0836-20BB-D955-8B26BD9057BC}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {A823F088-0836-20BB-D955-8B26BD9057BC}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Debug|iPhone.ActiveCfg = Debug|iPhone - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Debug|iPhone.Build.0 = Debug|iPhone - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Release|iPhone.ActiveCfg = Release|iPhone - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Release|iPhone.Build.0 = Release|iPhone - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator - {3D440BA8-29F8-EB17-6858-209114E79FD3}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|iPhone.Build.0 = Debug|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhone.ActiveCfg = Release|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|iPhone.Build.0 = Release|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7340A1C6-61A5-42D2-9DBC-6688D2E70F62}.Release|Any CPU.Build.0 = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|iPhone.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhone.ActiveCfg = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|iPhone.Build.0 = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0C979851-15E9-4BB6-AD79-5F0C7DF69456}.Release|Any CPU.Build.0 = Release|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Debug|iPhone.Build.0 = Debug|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Release|iPhone.ActiveCfg = Release|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Release|iPhone.Build.0 = Release|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F611ED96-54B5-4975-99BB-12F50AF95936}.Release|Any CPU.Build.0 = Release|Any CPU - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Debug|iPhone.ActiveCfg = Debug|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Debug|iPhone.Build.0 = Debug|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Release|iPhone.ActiveCfg = Release|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Release|iPhone.Build.0 = Release|iPhone - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator - {2ECCE3D0-AAD1-46B9-B190-B567249DCF9D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {E40B0B77-3467-4891-9117-7AF8F248E307}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E307}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E307}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E307}.Debug|iPhone.Build.0 = Debug|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E307}.Release|iPhone.ActiveCfg = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E307}.Release|iPhone.Build.0 = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E307}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {E40B0B77-3467-4891-9117-7AF8F248E307}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal 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/xcframework-test/dotnet/Makefile b/tests/xcframework-test/dotnet/Makefile index c07acf79f160..6affa45ff122 100644 --- a/tests/xcframework-test/dotnet/Makefile +++ b/tests/xcframework-test/dotnet/Makefile @@ -1,8 +1,2 @@ TOP=../../.. -include $(TOP)/Make.config - -build-all: - for platform in $(DOTNET_PLATFORMS); do \ - echo "Building in $$platform"; \ - $(MAKE) -C "$$platform" build; \ - done +include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/xharness/AppBundleLocator.cs b/tests/xharness/AppBundleLocator.cs index c69cf14519d5..3257b5f01250 100644 --- a/tests/xharness/AppBundleLocator.cs +++ b/tests/xharness/AppBundleLocator.cs @@ -16,7 +16,6 @@ namespace Xharness { public class AppBundleLocator : IAppBundleLocator { readonly IProcessManager processManager; readonly Func getLog; - readonly string msBuildPath; readonly string systemDotnetPath; readonly string dotnetPath; @@ -24,11 +23,10 @@ public class AppBundleLocator : IAppBundleLocator { // config file found in the specified directory or any containing directories. readonly Dictionary dotnet_executables = new Dictionary (); - public AppBundleLocator (IProcessManager processManager, Func getLog, string msBuildPath, string systemDotnetPath, string dotnetPath) + public AppBundleLocator (IProcessManager processManager, Func getLog, string systemDotnetPath, string dotnetPath) { this.processManager = processManager; this.getLog = getLog; - this.msBuildPath = msBuildPath; this.systemDotnetPath = systemDotnetPath; this.dotnetPath = dotnetPath; } @@ -84,7 +82,10 @@ private async Task GetPropertyByMSBuildEvaluationAsync (XmlDocument cspr using (var proc = new Process ()) { var isDotNetProject = csproj.IsDotNetProject (); - proc.StartInfo.FileName = isDotNetProject ? GetDotNetExecutable (projectPath) : msBuildPath; + if (!isDotNetProject) + throw new NotSupportedException ("Legacy projects not supported anymore"); + + proc.StartInfo.FileName = GetDotNetExecutable (projectPath); var args = new List (); if (isDotNetProject) 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 2d6f5b1bc2d0..3591dec744da 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. @@ -142,8 +138,6 @@ public class Harness : IHarness { public ITunnelBore TunnelBore { get; } public AppBundleLocator AppBundleLocator { get; } - public string XIBuildPath => Path.GetFullPath (Path.Combine (RootDirectory, "..", "tools", "xibuild", "xibuild")); - string sdkRoot; string SdkRoot { get => sdkRoot; @@ -157,9 +151,6 @@ bool TryGetMlaunchDotnetPath (out string value) { value = null; - if (!ENABLE_DOTNET) - return false; - ApplePlatform platform; if (INCLUDE_IOS) { platform = ApplePlatform.iOS; @@ -185,9 +176,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,29 +198,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 string MONO_IOS_SDK_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; } @@ -280,8 +253,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) @@ -295,28 +266,19 @@ 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)); - MONO_IOS_SDK_DESTDIR = GetVariable (nameof (MONO_IOS_SDK_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)) SdkRoot = GetVariable ("XCODE_DEVELOPER_ROOT", configuration.SdkRoot); processManager = new MlaunchProcessManager (XcodeRoot, MlaunchPath); - AppBundleLocator = new AppBundleLocator (processManager, () => HarnessLog, XIBuildPath, "/usr/local/share/dotnet/dotnet", GetVariable ("DOTNET")); + AppBundleLocator = new AppBundleLocator (processManager, () => HarnessLog, "/usr/local/share/dotnet/dotnet", GetVariable ("DOTNET")); TunnelBore = new TunnelBore (processManager); } @@ -330,9 +292,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. @@ -395,7 +354,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); @@ -407,11 +365,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, }); } @@ -422,12 +377,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, }); } @@ -437,8 +389,6 @@ void AutoConfigureDotNet () Name = projectName, IsDotNetProject = true, TargetFrameworkFlavors = MacFlavors.DotNet, - Platform = "AnyCPU", - Ignore = dotnetIgnored, TestPlatform = TestPlatform.Mac, Configurations = projectInfo.Configurations, }); @@ -449,8 +399,6 @@ void AutoConfigureDotNet () Name = projectName, IsDotNetProject = true, TargetFrameworkFlavors = MacFlavors.MacCatalyst, - Platform = "AnyCPU", - Ignore = dotnetIgnored, TestPlatform = TestPlatform.MacCatalyst, Configurations = projectInfo.Configurations, }); @@ -458,175 +406,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, - }); - } - - var monoNativeInfo = new MonoNativeInfo (DevicePlatform.macOS, RootDirectory, Log); - var macTestProject = new MacTestProject (TestLabel.Mononative, monoNativeInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full) { - MonoNativeInfo = monoNativeInfo, - Name = monoNativeInfo.ProjectName, - Platform = "AnyCPU", - Ignore = !INCLUDE_XAMARIN_LEGACY, - - }; - MacTestProjects.Add (macTestProject); - - - // Generate test projects from templates (mono-native templates) - if (generate_projects) { - foreach (var mtp in MacTestProjects.Where (x => x.MonoNativeInfo is not null).Select (x => x.MonoNativeInfo)) - mtp.Convert (); - } - - // 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" }, - }); - - var monoNativeInfo = new MonoNativeInfo (DevicePlatform.iOS, RootDirectory, Log); - var iosTestProject = new iOSTestProject (TestLabel.Mononative, monoNativeInfo.ProjectPath) { - MonoNativeInfo = monoNativeInfo, - Name = monoNativeInfo.ProjectName, - }; - IOSTestProjects.Add (iosTestProject); - - // 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) { @@ -673,97 +452,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. - // * For the mono-native template project, we generate a compat+unified version of the mono-native template project (in MonoNativeInfo.Convert). - // GenerateVariations is true for mono-native projects, which means we'll generate platform variations. - - 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 monoNativeInfo in IOSTestProjects.Where (x => x.MonoNativeInfo is not null).Select (x => x.MonoNativeInfo)) - monoNativeInfo.Convert (); - - 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 (); @@ -855,8 +543,6 @@ public string VSDropsUri { public int Execute () { switch (Action) { - case HarnessAction.Configure: - return Configure (); case HarnessAction.Run: return Run (); case HarnessAction.Install: @@ -874,8 +560,6 @@ int Jenkins () { if (autoConf) { AutoConfigureDotNet (); - AutoConfigureIOS (); - AutoConfigureMac (false); } var jenkins = new Jenkins.Jenkins (this, processManager, ResultParser, TunnelBore); @@ -901,16 +585,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 4c2ba87a8faf..8161a934a322 100644 --- a/tests/xharness/IHarness.cs +++ b/tests/xharness/IHarness.cs @@ -22,28 +22,13 @@ public interface IHarness { IResultParser ResultParser { get; } AppBundleLocator AppBundleLocator { get; } ITunnelBore TunnelBore { get; } - 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; } - string MONO_IOS_SDK_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; } @@ -61,7 +46,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..564c975d64fe 100644 --- a/tests/xharness/Jenkins/Jenkins.cs +++ b/tests/xharness/Jenkins/Jenkins.cs @@ -101,16 +101,6 @@ public bool IsIncluded (TestProject project) return false; } - if (project.IsDotNetProject && !TestSelection.IsEnabled (PlatformLabel.Dotnet)) { - MainLog.WriteLine ($"Ignoring {project.Name} with label {project.Label} because it's a .NET project and .NET is not included."); - 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 +135,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 @@ -160,7 +149,7 @@ Task PopulateTasksAsync () TestName = "Xtro", Target = "dotnet-wrench", WorkingDirectory = Path.Combine (HarnessConfiguration.RootDirectory, "xtro-sharpie"), - Ignored = !(TestSelection.IsEnabled (TestLabel.Xtro) && TestSelection.IsEnabled (PlatformLabel.Dotnet)), + Ignored = !TestSelection.IsEnabled (TestLabel.Xtro), Timeout = TimeSpan.FromMinutes (15), SupportsParallelExecution = false, }; @@ -189,10 +178,46 @@ Task PopulateTasksAsync () Platform = TestPlatform.iOS, TestName = "Generator tests", Mode = ".NET", - Ignored = !TestSelection.IsEnabled (TestLabel.Generator) || !TestSelection.IsEnabled (PlatformLabel.Dotnet), + Ignored = !TestSelection.IsEnabled (TestLabel.Generator), }; 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), + }; + 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), + }; + Tasks.Add (runDotNetRoslynAnalyzer); + var buildDotNetTestsProject = new TestProject (TestLabel.DotnetTest, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "dotnet", "UnitTests", "DotNetUnitTests.csproj"))) { IsDotNetProject = true, }; @@ -208,7 +233,7 @@ Task PopulateTasksAsync () TestName = "DotNet tests", Filter = "Category!=Windows", Timeout = TimeSpan.FromMinutes (360), - Ignored = !TestSelection.IsEnabled (TestLabel.DotnetTest) || !TestSelection.IsEnabled (PlatformLabel.Dotnet), + Ignored = !TestSelection.IsEnabled (TestLabel.DotnetTest), }; Tasks.Add (runDotNetTests); 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 8b807022b6ac..13809c45353a 100644 --- a/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs +++ b/tests/xharness/Jenkins/NUnitTestTasksEnumerable.cs @@ -19,27 +19,22 @@ public NUnitTestTasksEnumerable (Jenkins jenkins, IMlaunchProcessManager process public IEnumerator GetEnumerator () { - var netstandard2Project = new TestProject (TestLabel.Msbuild, Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tasks.Tests", "Xamarin.MacDev.Tasks.Tests.csproj"))) { + 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: netstandard2Project, processManager: processManager) { + var buildiOSMSBuild = new MSBuildTask (jenkins: jenkins, testProject: msbuildTasksTestsProject, processManager: processManager) { SpecifyPlatform = false, - SpecifyConfiguration = true, ProjectConfiguration = "Debug", - Platform = TestPlatform.iOS, - SolutionPath = Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "..", "msbuild", "Xamarin.MacDev.Tasks.sln")), + Platform = TestPlatform.All, + Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Msbuild), SupportsParallelExecution = false, - Environment = env, }; - var nunitExecutioniOSMSBuild = new NUnitExecuteTask (jenkins, buildiOSMSBuild, processManager) { - TestLibrary = Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tasks.Tests", "bin", "Debug", "net472", "Xamarin.MacDev.Tasks.Tests.dll"), - TestProject = netstandard2Project, + var nunitExecutioniOSMSBuild = new DotNetTestTask (jenkins, buildiOSMSBuild, processManager) { + TestProject = msbuildTasksTestsProject, ProjectConfiguration = "Debug", - Platform = TestPlatform.iOS, + Platform = TestPlatform.All, TestName = "MSBuild tests", Mode = "Tasks", Timeout = TimeSpan.FromMinutes (60), @@ -53,18 +48,15 @@ public IEnumerator GetEnumerator () }; var buildiOSMSBuildIntegration = new MSBuildTask (jenkins: jenkins, testProject: msbuildIntegrationTestsProject, processManager: processManager) { SpecifyPlatform = false, - SpecifyConfiguration = true, ProjectConfiguration = "Debug", - Platform = TestPlatform.iOS, - SolutionPath = Path.GetFullPath (Path.Combine (HarnessConfiguration.RootDirectory, "..", "msbuild", "Xamarin.MacDev.Tasks.sln")), + Platform = TestPlatform.All, + Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Msbuild), SupportsParallelExecution = false, - Environment = env, }; - var nunitExecutioniOSMSBuildIntegration = new NUnitExecuteTask (jenkins, buildiOSMSBuildIntegration, processManager) { - TestLibrary = Path.Combine (HarnessConfiguration.RootDirectory, "msbuild", "Xamarin.MacDev.Tests", "bin", "Debug", "net472", "Xamarin.MacDev.Tests.dll"), + var nunitExecutioniOSMSBuildIntegration = new DotNetTestTask (jenkins, buildiOSMSBuildIntegration, processManager) { TestProject = msbuildIntegrationTestsProject, ProjectConfiguration = "Debug", - Platform = TestPlatform.iOS, + Platform = TestPlatform.All, TestName = "MSBuild tests", Mode = "Integration", Timeout = TimeSpan.FromMinutes (120), @@ -73,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, }; @@ -126,7 +80,7 @@ public IEnumerator GetEnumerator () Platform = TestPlatform.iOS, TestName = "Cecil-based tests", Timeout = TimeSpan.FromMinutes (10), - Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Cecil) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Dotnet), + Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Cecil), }; yield return runCecilTests; 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 ca268427dfb7..6555f78cf291 100644 --- a/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs +++ b/tests/xharness/Jenkins/RunSimulatorTasksFactory.cs @@ -29,13 +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)); - if (project.MonoNativeInfo is not null) - ps.Add (new Tuple (project, TestPlatform.iOS_TodayExtension64, 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; @@ -46,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; @@ -118,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 411f64cdac9f..62606cf308eb 100644 --- a/tests/xharness/Jenkins/TestData.cs +++ b/tests/xharness/Jenkins/TestData.cs @@ -15,12 +15,9 @@ class TestData { public string Undefines; public bool? Ignored; public bool EnableSGenConc; - public bool UseThumb; public bool UseLlvm; public bool? UseMonoRuntime; - public MonoNativeLinkMode MonoNativeLinkMode; 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 3751141bc004..a3d82d6a7817 100644 --- a/tests/xharness/Jenkins/TestSelector.cs +++ b/tests/xharness/Jenkins/TestSelector.cs @@ -20,12 +20,9 @@ class TestSelection { PlatformLabel platform = PlatformLabel.None | PlatformLabel.tvOS | - PlatformLabel.watchOS | PlatformLabel.iOS | PlatformLabel.iOSSimulator | - PlatformLabel.MacCatalyst | - PlatformLabel.LegacyXamarin | - PlatformLabel.Dotnet; + PlatformLabel.MacCatalyst; public bool ForceExtensionBuildOnly { get; set; } @@ -248,11 +245,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,21 +260,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.Mononative, 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/BuildProjectTask.cs b/tests/xharness/Jenkins/TestTasks/BuildProjectTask.cs index 82690ed5b203..e63718d23763 100644 --- a/tests/xharness/Jenkins/TestTasks/BuildProjectTask.cs +++ b/tests/xharness/Jenkins/TestTasks/BuildProjectTask.cs @@ -21,8 +21,5 @@ public bool RestoreNugets { } public override bool SupportsParallelExecution => BuildProject.SupportsParallelExecution; - - protected override void InitializeTool () - => buildToolTask = new BuildProject (() => Jenkins.Harness.XIBuildPath, ProcessManager, ResourceManager, this, this); } } 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/MSBuildTask.cs b/tests/xharness/Jenkins/TestTasks/MSBuildTask.cs index c846f2d25acf..c407e45b08f2 100644 --- a/tests/xharness/Jenkins/TestTasks/MSBuildTask.cs +++ b/tests/xharness/Jenkins/TestTasks/MSBuildTask.cs @@ -9,9 +9,7 @@ namespace Xharness.Jenkins.TestTasks { class MSBuildTask : BuildProjectTask { protected virtual string ToolName { get { - if (TestProject.IsDotNetProject) - return Jenkins.Harness.GetDotNetExecutable (Path.GetDirectoryName (ProjectFile)); - return Jenkins.Harness.XIBuildPath; + return Jenkins.Harness.GetDotNetExecutable (Path.GetDirectoryName (ProjectFile)); } } 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/NUnitExecuteTask.cs b/tests/xharness/Jenkins/TestTasks/NUnitExecuteTask.cs index 62db5eca4e59..6adac729dbaa 100644 --- a/tests/xharness/Jenkins/TestTasks/NUnitExecuteTask.cs +++ b/tests/xharness/Jenkins/TestTasks/NUnitExecuteTask.cs @@ -132,52 +132,9 @@ public override string Mode { } } - public override async Task RunTestAsync () + public override Task RunTestAsync () { - using (var resource = await NotifyAndAcquireDesktopResourceAsync ()) { - var xmlLog = Logs.CreateFile ($"log-{Timestamp}.xml", LogType.XmlLog.ToString ()); - var log = Logs.Create ($"execute-{Timestamp}.txt", LogType.ExecutionLog.ToString ()); - FindNUnitConsoleExecutable (log); - - var args = new List (); - args.Add ("-t"); - args.Add ("--"); - args.Add (Path.GetFullPath (TestExecutable)); - args.Add (Path.GetFullPath (TestLibrary)); - if (IsNUnit3) { - args.Add ("-result=" + xmlLog + ";format=nunit2"); - args.Add ("--labels=After"); - if (InProcess) - args.Add ("--inprocess"); - } else { - args.Add ("-xml=" + xmlLog); - args.Add ("-labels"); - } - - await ExecuteProcessAsync (log, Jenkins.Harness.XIBuildPath, args); - - if (ProduceHtmlReport) { - try { - var output = Logs.Create ($"Log-{Timestamp}.html", "HTML log"); - using (var srt = new StringReader (File.ReadAllText (Path.Combine (RootDirectory, "HtmlTransform.xslt")))) { - using (var sri = File.OpenRead (xmlLog)) { - using (var xrt = XmlReader.Create (srt)) { - using (var xri = XmlReader.Create (sri)) { - var xslt = new System.Xml.Xsl.XslCompiledTransform (); - xslt.Load (xrt); - using (var xwo = XmlWriter.Create (File.Create (output.FullPath), xslt.OutputSettings)) // use OutputSettings of xsl, so it can be output as HTML - { - xslt.Transform (xri, xwo); - } - } - } - } - } - } catch (Exception e) { - log.WriteLine ("Failed to produce HTML report: {0}", e); - } - } - } + throw new NotSupportedException ("Legacy projects not supported anymore"); } public override void Reset () 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 15825b450eea..f7aca9bb6224 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,28 +60,15 @@ 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, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, 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, MonoNativeLinkMode = MonoNativeLinkMode.Static, Ignored = ignore }; - yield return new TestData { Variation = "AssemblyBuildTarget: dylib (debug, profiling)", AppBundleExtraOptions = $"--assembly-build-target=@all=dynamiclibrary", Debug = true, Profiling = true, MonoNativeLinkMode = MonoNativeLinkMode.Dynamic, 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, MonoNativeLinkMode = MonoNativeLinkMode.Static, Ignored = ignore }; - } - + var supports_debug = true; if (test.ProjectConfiguration.Contains ("Debug")) - yield return new TestData { Variation = "Release", Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static }; - if (test.Platform == TestPlatform.iOS_Unified32 && !test.TestProject.IsDotNetProject) - yield return new TestData { Variation = "Release: UseThumb", Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, UseThumb = true }; + yield return new TestData { Variation = "Release", Debug = false, Profiling = false }; // 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"; sdk_release_skip = sdk_release_skip || test.TestProject.IsDotNetProject; if (!sdk_release_skip) - yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (release)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = false, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, }; + yield return new TestData { Variation = "AssemblyBuildTarget: SDK framework (release)", AppBundleExtraOptions = $"--assembly-build-target=@sdk=framework=Xamarin.Sdk --assembly-build-target=@all=staticobject", Debug = false, Profiling = false, }; switch (test.TestName) { case "monotouch-test": @@ -94,7 +79,7 @@ IEnumerable GetTestData (RunTestTask test) yield return new TestData { Variation = "Release (all optimizations)", AppBundleExtraOptions = "--optimize:all", Registrar = "static", Debug = false, Profiling = false, Defines = "OPTIMIZEALL", Ignored = ignore }; if (supports_debug) { yield return new TestData { Variation = "Debug (all optimizations)", AppBundleExtraOptions = "--optimize:all", Registrar = "static", Debug = true, Profiling = false, Defines = "OPTIMIZEALL", Ignored = ignore }; - yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true, Ignored = ignore }; + yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, EnableSGenConc = true, Ignored = ignore }; } if (supports_interpreter) { if (supports_debug) { @@ -113,7 +98,7 @@ IEnumerable GetTestData (RunTestTask test) break; case string name when name.StartsWith ("mscorlib", StringComparison.Ordinal): if (supports_debug) - yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, MonoNativeLinkMode = MonoNativeLinkMode.Static, EnableSGenConc = true }; + yield return new TestData { Variation = "Debug: SGenConc", AppBundleExtraOptions = "", Debug = true, Profiling = false, EnableSGenConc = true }; if (supports_interpreter) { if (supports_debug) { yield return new TestData { Variation = "Debug (interpreter)", AppBundleExtraOptions = "--interpreter", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME", KnownFailure = new KnownIssue ("#1683", issueLink: "https://github.com/xamarin/maccore/issues/1683") }; @@ -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 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/MonoNativeInfo.cs b/tests/xharness/MonoNativeInfo.cs deleted file mode 100644 index a1e1b2170f19..000000000000 --- a/tests/xharness/MonoNativeInfo.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -// MonoNativeInfo.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; -using System.IO; -using System.Xml; - -using Microsoft.DotNet.XHarness.iOS.Shared.Utilities; -using Microsoft.DotNet.XHarness.iOS.Shared.Hardware; - -namespace Xharness { - public enum MonoNativeLinkMode { - None, - Static, - Dynamic, - Symlink, - } - - public static class MonoNativeHelper { - public static void AddProjectDefines (XmlDocument project, MonoNativeLinkMode link) - { - switch (link) { - case MonoNativeLinkMode.Static: - project.AddTopLevelProperty ("MonoNativeMode", "MONO_NATIVE_STATIC"); - break; - case MonoNativeLinkMode.Dynamic: - project.AddTopLevelProperty ("MonoNativeMode", "MONO_NATIVE_DYNAMIC"); - break; - case MonoNativeLinkMode.Symlink: - project.AddTopLevelProperty ("MonoNativeMode", "MONO_NATIVE_SYMLINK"); - break; - default: - throw new Exception ($"Unknown MonoNativeLinkMode: {link}"); - } - } - - public static string GetMinimumOSVersion (DevicePlatform platform) - { - switch (platform) { - case DevicePlatform.iOS: - return Xamarin.SdkVersions.MiniOS; - case DevicePlatform.tvOS: - return Xamarin.SdkVersions.MinTVOS; - case DevicePlatform.watchOS: - return Xamarin.SdkVersions.LegacyMinWatchOS; - case DevicePlatform.macOS: - return Xamarin.SdkVersions.MinOSX; - default: - throw new Exception ($"Unknown DevicePlatform: {platform}"); - } - } - } - - public class MonoNativeInfo { - Action log; - public DevicePlatform DevicePlatform { get; set; } - string rootDirectory; - - public MonoNativeInfo (DevicePlatform platform, string rootDirectory, Action logAction = null) - { - DevicePlatform = platform; - this.log = logAction; - this.rootDirectory = rootDirectory ?? throw new ArgumentNullException (nameof (rootDirectory)); - } - - public string FlavorSuffix => "-unified"; - public string ProjectName => "mono-native" + FlavorSuffix; - public string ProjectPath => Path.Combine (rootDirectory, "mono-native", DevicePlatform.ToString (), FlavorSuffix.TrimStart ('-'), TemplateName + FlavorSuffix + ".csproj"); - string TemplateName => "mono-native"; - public string TemplatePath => Path.Combine (rootDirectory, "mono-native", DevicePlatform.ToString (), TemplateName + ".csproj.template"); - - public void Convert () - { - var inputProject = new XmlDocument (); - - var xml = File.ReadAllText (TemplatePath); - inputProject.LoadXmlWithoutNetworkAccess (xml); - inputProject.SetAssemblyName (inputProject.GetAssemblyName () + FlavorSuffix); - inputProject.AddAdditionalDefines ("MONO_NATIVE_UNIFIED"); - inputProject.ResolveAllPaths (TemplatePath); - - var template_info_plist = HarnessConfiguration.EvaluateRootTestsDirectory (inputProject.GetInfoPListInclude ().Replace ('\\', '/')); - var target_info_plist = Path.Combine (Path.GetDirectoryName (ProjectPath), "Info" + FlavorSuffix + ".plist"); - SetInfoPListMinimumOSVersion (template_info_plist, target_info_plist); - target_info_plist = HarnessConfiguration.InjectRootTestsDirectory (target_info_plist); - inputProject.FixInfoPListInclude (FlavorSuffix, newName: target_info_plist); - - inputProject.Save (ProjectPath, log); - } - - public XmlDocument SetInfoPListMinimumOSVersion (string template_plist, string target_plist) - { - var template_info_plist = template_plist; - var info_plist = new XmlDocument (); - info_plist.LoadWithoutNetworkAccess (template_info_plist); - SetInfoPListMinimumOSVersion (info_plist, MonoNativeHelper.GetMinimumOSVersion (DevicePlatform)); - info_plist.Save (target_plist, log); - return info_plist; - } - - public virtual void SetInfoPListMinimumOSVersion (XmlDocument info_plist, string version) - { - if (DevicePlatform == DevicePlatform.macOS) { - info_plist.SetMinimummacOSVersion (version); - } else { - info_plist.SetMinimumOSVersion (version); - } - } - } -} 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 c026021ad1d0..000000000000 --- a/tests/xharness/Targets/TVOSTarget.cs +++ /dev/null @@ -1,114 +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) - { - if (MonoNativeInfo is null) - return Xamarin.SdkVersions.MinTVOS; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.tvOS); - } - - 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 47b845f9857c..088f2b673de1 100644 --- a/tests/xharness/Targets/Target.cs +++ b/tests/xharness/Targets/Target.cs @@ -1,287 +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 (templateName.Equals ("mono-native-mac", StringComparison.Ordinal)) - templateName = "mono-native"; - - 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 ae4e6867c7a5..000000000000 --- a/tests/xharness/Targets/TodayExtensionTarget.cs +++ /dev/null @@ -1,144 +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) - { - if (MonoNativeInfo is null) - return templateMinimumOSVersion; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.iOS); - } - - 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 a782a2063f53..000000000000 --- a/tests/xharness/Targets/UnifiedTarget.cs +++ /dev/null @@ -1,107 +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) - { - if (MonoNativeInfo is null) - return templateMinimumOSVersion; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.iOS); - } - - 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 19d9df59a371..000000000000 --- a/tests/xharness/Targets/WatchOSTarget.cs +++ /dev/null @@ -1,251 +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) - { - if (MonoNativeInfo is null) - return templateMinimumOSVersion; - return MonoNativeHelper.GetMinimumOSVersion (DevicePlatform.watchOS); - } - - 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 a06b3242996d..000000000000 --- a/tests/xharness/Targets/iOSTarget.cs +++ /dev/null @@ -1,36 +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; - - public MonoNativeInfo MonoNativeInfo => TestProject.MonoNativeInfo; - - 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 61e73d0e976c..10d1db68cf38 100644 --- a/tests/xharness/TestLabel.cs +++ b/tests/xharness/TestLabel.cs @@ -51,24 +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, - [Label ("mononative")] - Mononative = 1 << 19, + // 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")] @@ -101,12 +96,9 @@ public enum PlatformLabel : uint { OldiOSSimulator = 1 << 9, [Label ("tvos")] tvOS = 1 << 10, - [Label ("watchos")] - watchOS = 1 << 11, - [Label ("dotnet")] - Dotnet = 1 << 12, - [Label ("legacy-xamarin")] - LegacyXamarin = 1 << 13, + // 1 << 11 is unused + // 1 << 12 is unused + // 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 caceaa93c253..e749522c3df9 100644 --- a/tests/xharness/TestProject.cs +++ b/tests/xharness/TestProject.cs @@ -37,9 +37,6 @@ public class TestProject { public IEnumerable? ProjectReferences; - // Optional - public MonoNativeInfo? MonoNativeInfo { get; set; } - public TestProject (TestLabel label, string path, bool isExecutableProject = true) { Label = label; @@ -115,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 85ad3e3526f7..ec6f171726a4 100644 --- a/tests/xharness/iOSTestProject.cs +++ b/tests/xharness/iOSTestProject.cs @@ -4,40 +4,31 @@ 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); } public bool IsSupported (DevicePlatform devicePlatform, string productVersion) { - if (MonoNativeInfo is null) - return true; - var min_version = MonoNativeHelper.GetMinimumOSVersion (devicePlatform); - return Version.Parse (productVersion) >= Version.Parse (min_version); + return true; } 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 27ef8e5ea82a..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 @@ - @@ -105,18 +100,10 @@ - - - - - - - - diff --git a/tests/xtro-sharpie/Makefile b/tests/xtro-sharpie/Makefile index 8284cd7d6197..e6a9b839b9cf 100644 --- a/tests/xtro-sharpie/Makefile +++ b/tests/xtro-sharpie/Makefile @@ -41,13 +41,8 @@ XTRO_SHARPIE_EXEC=$(MONO) --debug $(XTRO_SHARPIE) build: $(XTRO_SHARPIE) $(XTRO_REPORT) $(XTRO_SANITY) -.stamp-build: export SHARPIE:=$(SHARPIE) -.stamp-build: $(wildcard *.cs) pch-info.proj $(XTRO_REPORT) $(XTRO_SANITY) $(XTRO_SHARPIE) - $(Q_BUILD) $(SYSTEM_MSBUILD) $(MSBUILD_VERBOSITY) xtro-sharpie.csproj /r /bl:$@.binlog - $(Q) touch $@ - $(XTRO_SHARPIE): $(wildcard xtro-sharpie/*.cs) $(wildcard xtro-sharpie/*.csproj) pch-info.proj $(XTRO_REPORT) - $(Q_BUILD) $(SYSTEM_MSBUILD) $(MSBUILD_VERBOSITY) xtro-sharpie/xtro-sharpie.csproj /r /bl:$@.binlog + $(Q_GEN) unset MSBUILD_EXE_PATH && $(DOTNET) build xtro-sharpie/xtro-sharpie.csproj /bl:xtro-sharpie.binlog $(DOTNET_BUILD_VERBOSITY) $(XTRO_REPORT): $(wildcard xtro-report/*.cs) $(wildcard xtro-report/*.csproj) xtro-sharpie/Filter.cs Makefile $(Q_GEN) unset MSBUILD_EXE_PATH && $(DOTNET) build xtro-report/xtro-report.csproj /bl:xtro-report.binlog $(DOTNET_BUILD_VERBOSITY) 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-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-AppKit.ignore index 6f9811c32731..d8151a01de31 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-AppKit.ignore @@ -16,3 +16,6 @@ !missing-field! NSTypeIdentifierTransitInformationText not bound !missing-protocol! NSAnimatablePropertyContainer not bound !missing-selector! NSTouchBar::itemIdentifiers not bound + +# NSToolbarItemVisibilityPriority is a collection of constants we've bound as an enum. +!unknown-native-enum! NSToolbarItemVisibilityPriority bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreGraphics.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreGraphics.ignore index 5b2c8c5a0c99..a32969807625 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreGraphics.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreGraphics.ignore @@ -95,3 +95,6 @@ !missing-pinvoke! CGSizeEqualToSize is not bound !missing-pinvoke! CGErrorSetCallback is not bound !missing-pinvoke! CGConvertColorDataWithFormat is not bound +!missing-field! kCGUseLegacyHDREcosystem not bound +!missing-pinvoke! CGColorConversionInfoConvertData is not bound +!missing-pinvoke! CGColorConversionInfoCreateForToneMapping is not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-SpriteKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-SpriteKit.ignore index a7eea7cfd4f3..0c3378bd1cf4 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-SpriteKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-SpriteKit.ignore @@ -1,7 +1,7 @@ ## it's an internal that is called from a non-generated binding !incorrect-designated-initializer! SKWarpGeometryGrid::initWithColumns:rows:sourcePositions:destPositions: is not a constructor -## bad API signature, removed in XAMCORE_3_0 +## bad API signature, bound manually !extra-null-allowed! 'SpriteKit.SKShapeNode SpriteKit.SKShapeNode::FromPoints(CoreGraphics.CGPoint&,System.UIntPtr)' has a extraneous [NullAllowed] on parameter #0 !extra-null-allowed! 'SpriteKit.SKShapeNode SpriteKit.SKShapeNode::FromSplinePoints(CoreGraphics.CGPoint&,System.UIntPtr)' has a extraneous [NullAllowed] on parameter #0 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/common-Vision.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-Vision.ignore index 4fca98ac62c5..022cd97667f7 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-Vision.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-Vision.ignore @@ -1,8 +1,3 @@ -# note: framework not available on watchOS - -## we do not expose internal framework versions -!missing-field! VNVisionVersionNumber not bound - ## called indirectly (there's a required native layer for them) !missing-pinvoke! VNImagePointForFaceLandmarkPoint is not bound !missing-pinvoke! VNNormalizedFaceBoundingBoxPointForLandmarkPoint is not 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/iOS-PassKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-PassKit.ignore index a4d141ea5e35..1be18a80705a 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-PassKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-PassKit.ignore @@ -6,6 +6,3 @@ # needed to allow our WeakDelegate wrap !extra-null-allowed! 'System.Void PassKit.PKPayLaterView::set_WeakDelegate(Foundation.NSObject)' has a extraneous [NullAllowed] on parameter #0 - -# https://github.com/xamarin/xamarin-macios/issues/19271 -!missing-pinvoke! PKPayLaterValidateAmount is 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/macOS-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore index 85789b1901b0..c42597e7b1c7 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore @@ -1679,5 +1679,3 @@ !incorrect-protocol-member! NSAccessibility::setAccessibilityUserInputLabels: is REQUIRED and should be abstract # introduced and deprecated in the same version -!missing-protocol-member! NSTextInputTraits::setWritingToolsAllowedInputOptions: not found -!missing-protocol-member! NSTextInputTraits::writingToolsAllowedInputOptions not found diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-FSKit.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-FSKit.todo new file mode 100644 index 000000000000..33a0da7a7f0a --- /dev/null +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-FSKit.todo @@ -0,0 +1,256 @@ +!missing-enum! FSAccessMask not bound +!missing-enum! FSBlockmapFlags not bound +!missing-enum! FSContainerState not bound +!missing-enum! FSDeactivateOptions not bound +!missing-enum! FSExtentType not bound +!missing-enum! FSItemAttribute not bound +!missing-enum! FSItemType not bound +!missing-enum! FSMatchResult not bound +!missing-enum! FSPreallocateFlags not bound +!missing-enum! FSSetXattrPolicy not bound +!missing-enum! FSVolumeErrorCode not bound +!missing-enum! FSVolumeOpenModes not bound +!missing-field! FSDirectoryCookieInitial not bound +!missing-field! FSDirectoryVerifierInitial not bound +!missing-field! FSKitVersionNumber not bound +!missing-field! FSKitVersionString not bound +!missing-field! FSModuleIdentityAttributeActivateOptionSyntax not bound +!missing-field! FSModuleIdentityAttributeCheckOptionSyntax not bound +!missing-field! FSModuleIdentityAttributeFormatOptionSyntax not bound +!missing-field! FSModuleIdentityAttributeMediaTypes not bound +!missing-field! FSModuleIdentityAttributePersonalities not bound +!missing-field! FSModuleIdentityAttributeShortName not bound +!missing-field! FSModuleIdentityAttributeSupportsBlockResources not bound +!missing-field! FSModuleIdentityAttributeSupportsKOIO not bound +!missing-field! FSModuleIdentityAttributeSupportsServerURLs not bound +!missing-field! FSVolumeErrorDomain not bound +!missing-pinvoke! fs_errorForCocoaError is not bound +!missing-pinvoke! fs_errorForMachError is not bound +!missing-pinvoke! fs_errorForPOSIXError is not bound +!missing-pinvoke! fskit_std_log is not bound +!missing-protocol! FSBlockDeviceOperations not bound +!missing-protocol! FSFileSystemBase not bound +!missing-protocol! FSManageableResourceMaintenanceOperations not bound +!missing-protocol! FSUnaryFileSystemOperations not bound +!missing-protocol! FSVolumeAccessCheckOperations not bound +!missing-protocol! FSVolumeKOIOOperations not bound +!missing-protocol! FSVolumeOpenCloseOperations not bound +!missing-protocol! FSVolumeOperations not bound +!missing-protocol! FSVolumePathConfOperations not bound +!missing-protocol! FSVolumePreallocateOperations not bound +!missing-protocol! FSVolumeReadWriteOperations not bound +!missing-protocol! FSVolumeRenameOperations not bound +!missing-protocol! FSVolumeXattrOperations not bound +!missing-selector! +FSBlockDeviceResource::proxyResourceForBSDName: not bound +!missing-selector! +FSBlockDeviceResource::proxyResourceForBSDName:isWritable: not bound +!missing-selector! +FSClient::fetchInstalledExtensionsWithCompletionHandler: not bound +!missing-selector! +FSClient::installedExtensionsWithError: not bound +!missing-selector! +FSEntityIdentifier::identifier not bound +!missing-selector! +FSEntityIdentifier::identifierWithUUID: not bound +!missing-selector! +FSEntityIdentifier::identifierWithUUID:byteQualifier: not bound +!missing-selector! +FSEntityIdentifier::identifierWithUUID:data: not bound +!missing-selector! +FSEntityIdentifier::identifierWithUUID:longByteQualifier: not bound +!missing-selector! +FSFileName::nameWithBytes:length: not bound +!missing-selector! +FSFileName::nameWithCString: not bound +!missing-selector! +FSFileName::nameWithData: not bound +!missing-selector! +FSFileName::nameWithString: not bound +!missing-selector! +FSGenericURLResource::resourceWithURL: not bound +!missing-selector! +FSMetadataBlockRange::rangeWithOffset:blockLength:numberOfBlocks: not bound +!missing-selector! +FSProbeResult::resultWithResult:name:containerID: not bound +!missing-selector! FSBlockDeviceResource::blockCount not bound +!missing-selector! FSBlockDeviceResource::blockSize not bound +!missing-selector! FSBlockDeviceResource::BSDName not bound +!missing-selector! FSBlockDeviceResource::delayedMetadataWriteFrom:startingAt:length:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::isTerminated not bound +!missing-selector! FSBlockDeviceResource::isWritable not bound +!missing-selector! FSBlockDeviceResource::metadataWriteFrom:startingAt:length:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::physicalBlockSize not bound +!missing-selector! FSBlockDeviceResource::readInto:startingAt:length:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousMetadataClear:wait:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousMetadataFlushWithReplyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousMetadataPurge:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousMetadataReadInto:startingAt:length:readAheadExtents:readAheadCount:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousMetadataReadInto:startingAt:length:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousMetadataWriteFrom:startingAt:length:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousReadInto:startingAt:length:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::synchronousWriteFrom:startingAt:length:replyHandler: not bound +!missing-selector! FSBlockDeviceResource::terminate not bound +!missing-selector! FSBlockDeviceResource::writeFrom:startingAt:length:replyHandler: not bound +!missing-selector! FSContainerIdentifier::volumeIdentifier not bound +!missing-selector! FSEntityIdentifier::init not bound +!missing-selector! FSEntityIdentifier::initWithUUID: not bound +!missing-selector! FSEntityIdentifier::initWithUUID:byteQualifier: not bound +!missing-selector! FSEntityIdentifier::initWithUUID:data: not bound +!missing-selector! FSEntityIdentifier::initWithUUID:longByteQualifier: not bound +!missing-selector! FSEntityIdentifier::qualifier not bound +!missing-selector! FSEntityIdentifier::setQualifier: not bound +!missing-selector! FSEntityIdentifier::setUuid: not bound +!missing-selector! FSEntityIdentifier::uuid not bound +!missing-selector! FSFileName::data not bound +!missing-selector! FSFileName::debugDescription not bound +!missing-selector! FSFileName::initWithBytes:length: not bound +!missing-selector! FSFileName::initWithCString: not bound +!missing-selector! FSFileName::initWithData: not bound +!missing-selector! FSFileName::initWithString: not bound +!missing-selector! FSFileName::string not bound +!missing-selector! FSGenericURLResource::URL not bound +!missing-selector! FSItemAttributes::accessTime not bound +!missing-selector! FSItemAttributes::addedTime not bound +!missing-selector! FSItemAttributes::allocSize not bound +!missing-selector! FSItemAttributes::backupTime not bound +!missing-selector! FSItemAttributes::birthTime not bound +!missing-selector! FSItemAttributes::changeTime not bound +!missing-selector! FSItemAttributes::fileID not bound +!missing-selector! FSItemAttributes::flags not bound +!missing-selector! FSItemAttributes::gid not bound +!missing-selector! FSItemAttributes::inhibitKOIO not bound +!missing-selector! FSItemAttributes::invalidateAllProperties not bound +!missing-selector! FSItemAttributes::isValid: not bound +!missing-selector! FSItemAttributes::linkCount not bound +!missing-selector! FSItemAttributes::mode not bound +!missing-selector! FSItemAttributes::modifyTime not bound +!missing-selector! FSItemAttributes::parentID not bound +!missing-selector! FSItemAttributes::setAccessTime: not bound +!missing-selector! FSItemAttributes::setAddedTime: not bound +!missing-selector! FSItemAttributes::setAllocSize: not bound +!missing-selector! FSItemAttributes::setBackupTime: not bound +!missing-selector! FSItemAttributes::setBirthTime: not bound +!missing-selector! FSItemAttributes::setChangeTime: not bound +!missing-selector! FSItemAttributes::setFileID: not bound +!missing-selector! FSItemAttributes::setFlags: not bound +!missing-selector! FSItemAttributes::setGid: not bound +!missing-selector! FSItemAttributes::setInhibitKOIO: not bound +!missing-selector! FSItemAttributes::setLinkCount: not bound +!missing-selector! FSItemAttributes::setMode: not bound +!missing-selector! FSItemAttributes::setModifyTime: not bound +!missing-selector! FSItemAttributes::setParentID: not bound +!missing-selector! FSItemAttributes::setSize: not bound +!missing-selector! FSItemAttributes::setSupportsLimitedXAttrs: not bound +!missing-selector! FSItemAttributes::setType: not bound +!missing-selector! FSItemAttributes::setUid: not bound +!missing-selector! FSItemAttributes::size not bound +!missing-selector! FSItemAttributes::supportsLimitedXAttrs not bound +!missing-selector! FSItemAttributes::type not bound +!missing-selector! FSItemAttributes::uid not bound +!missing-selector! FSItemGetAttributesRequest::isWanted: not bound +!missing-selector! FSItemGetAttributesRequest::setWantedAttributes: not bound +!missing-selector! FSItemGetAttributesRequest::wantedAttributes not bound +!missing-selector! FSItemSetAttributesRequest::consumedAttributes not bound +!missing-selector! FSItemSetAttributesRequest::setConsumedAttributes: not bound +!missing-selector! FSItemSetAttributesRequest::wasConsumed: not bound +!missing-selector! FSMessageConnection::didCompleteWithError:completionHandler: not bound +!missing-selector! FSMessageConnection::logMessage: not bound +!missing-selector! FSMetadataBlockRange::blockLength not bound +!missing-selector! FSMetadataBlockRange::initWithOffset:blockLength:numberOfBlocks: not bound +!missing-selector! FSMetadataBlockRange::numberOfBlocks not bound +!missing-selector! FSMetadataBlockRange::startBlockOffset not bound +!missing-selector! FSModuleIdentity::attributes not bound +!missing-selector! FSModuleIdentity::bundleIdentifier not bound +!missing-selector! FSModuleIdentity::isEnabled not bound +!missing-selector! FSModuleIdentity::isSystem not bound +!missing-selector! FSModuleIdentity::url not bound +!missing-selector! FSProbeResult::containerID not bound +!missing-selector! FSProbeResult::name not bound +!missing-selector! FSProbeResult::result not bound +!missing-selector! FSResource::isRevoked not bound +!missing-selector! FSResource::makeProxy not bound +!missing-selector! FSResource::revoke not bound +!missing-selector! FSStatFSResult::availableBlocks not bound +!missing-selector! FSStatFSResult::availableBytes not bound +!missing-selector! FSStatFSResult::blockSize not bound +!missing-selector! FSStatFSResult::filesystemSubType not bound +!missing-selector! FSStatFSResult::filesystemTypeName not bound +!missing-selector! FSStatFSResult::freeBlocks not bound +!missing-selector! FSStatFSResult::freeBytes not bound +!missing-selector! FSStatFSResult::freeFiles not bound +!missing-selector! FSStatFSResult::initWithFSTypeName: not bound +!missing-selector! FSStatFSResult::ioSize not bound +!missing-selector! FSStatFSResult::setAvailableBlocks: not bound +!missing-selector! FSStatFSResult::setAvailableBytes: not bound +!missing-selector! FSStatFSResult::setBlockSize: not bound +!missing-selector! FSStatFSResult::setFilesystemSubType: not bound +!missing-selector! FSStatFSResult::setFreeBlocks: not bound +!missing-selector! FSStatFSResult::setFreeBytes: not bound +!missing-selector! FSStatFSResult::setFreeFiles: not bound +!missing-selector! FSStatFSResult::setIoSize: not bound +!missing-selector! FSStatFSResult::setTotalBlocks: not bound +!missing-selector! FSStatFSResult::setTotalBytes: not bound +!missing-selector! FSStatFSResult::setTotalFiles: not bound +!missing-selector! FSStatFSResult::setUsedBlocks: not bound +!missing-selector! FSStatFSResult::setUsedBytes: not bound +!missing-selector! FSStatFSResult::totalBlocks not bound +!missing-selector! FSStatFSResult::totalBytes not bound +!missing-selector! FSStatFSResult::totalFiles not bound +!missing-selector! FSStatFSResult::usedBlocks not bound +!missing-selector! FSStatFSResult::usedBytes not bound +!missing-selector! FSUnaryItem::queue not bound +!missing-selector! FSVolume::initWithVolumeID:volumeName: not bound +!missing-selector! FSVolume::name not bound +!missing-selector! FSVolume::setName: not bound +!missing-selector! FSVolume::volumeID not bound +!missing-selector! FSVolumeSupportedCapabilities::doesNotSupportImmutableFiles not bound +!missing-selector! FSVolumeSupportedCapabilities::doesNotSupportRootTimes not bound +!missing-selector! FSVolumeSupportedCapabilities::doesNotSupportSettingFilePermissions not bound +!missing-selector! FSVolumeSupportedCapabilities::doesNotSupportVolumeSizes not bound +!missing-selector! FSVolumeSupportedCapabilities::setDoesNotSupportImmutableFiles: not bound +!missing-selector! FSVolumeSupportedCapabilities::setDoesNotSupportRootTimes: not bound +!missing-selector! FSVolumeSupportedCapabilities::setDoesNotSupportSettingFilePermissions: not bound +!missing-selector! FSVolumeSupportedCapabilities::setDoesNotSupportVolumeSizes: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupports2TBFiles: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupports64BitObjectIDs: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsActiveJournal: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsCasePreservingNames: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsCaseSensitiveNames: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsDocumentID: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsFastStatFS: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsHardLinks: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsHiddenFiles: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsJournal: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsOpenDenyModes: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsPersistentObjectIDs: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsSharedSpace: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsSparseFiles: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsSymbolicLinks: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsVolumeGroups: not bound +!missing-selector! FSVolumeSupportedCapabilities::setSupportsZeroRuns: not bound +!missing-selector! FSVolumeSupportedCapabilities::supports2TBFiles not bound +!missing-selector! FSVolumeSupportedCapabilities::supports64BitObjectIDs not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsActiveJournal not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsCasePreservingNames not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsCaseSensitiveNames not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsDocumentID not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsFastStatFS not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsHardLinks not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsHiddenFiles not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsJournal not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsOpenDenyModes not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsPersistentObjectIDs not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsSharedSpace not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsSparseFiles not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsSymbolicLinks not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsVolumeGroups not bound +!missing-selector! FSVolumeSupportedCapabilities::supportsZeroRuns not bound +!missing-selector! NSUUID::fs_containerIdentifier not bound +!missing-selector! NSUUID::fs_entityIdentifier not bound +!missing-selector! NSUUID::fs_volumeIdentifier not bound +!missing-type! FSBlockDeviceResource not bound +!missing-type! FSClient not bound +!missing-type! FSContainerIdentifier not bound +!missing-type! FSEntityIdentifier not bound +!missing-type! FSFileName not bound +!missing-type! FSGenericURLResource not bound +!missing-type! FSItem not bound +!missing-type! FSItemAttributes not bound +!missing-type! FSItemGetAttributesRequest not bound +!missing-type! FSItemSetAttributesRequest not bound +!missing-type! FSMessageConnection not bound +!missing-type! FSMetadataBlockRange not bound +!missing-type! FSModuleIdentity not bound +!missing-type! FSProbeResult not bound +!missing-type! FSResource not bound +!missing-type! FSStatFSResult not bound +!missing-type! FSUnaryFileSystem not bound +!missing-type! FSUnaryItem not bound +!missing-type! FSVolume not bound +!missing-type! FSVolumeIdentifier not bound +!missing-type! FSVolumeSupportedCapabilities 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/tests/xtro-sharpie/xtro-sharpie/FieldCheck.cs b/tests/xtro-sharpie/xtro-sharpie/FieldCheck.cs index b87f38d2a01c..4ce062948c9a 100644 --- a/tests/xtro-sharpie/xtro-sharpie/FieldCheck.cs +++ b/tests/xtro-sharpie/xtro-sharpie/FieldCheck.cs @@ -16,7 +16,8 @@ using System; using System.Collections.Generic; - +using System.Linq; +using System.Text; using Mono.Cecil; using Clang.Ast; @@ -54,7 +55,8 @@ public override void VisitManagedType (TypeDefinition type) void CheckAttributes (string memberName, ICustomAttributeProvider p) { foreach (var ca in p.CustomAttributes) { - if (ca.Constructor.DeclaringType.Name != "FieldAttribute") + if (ca.Constructor.DeclaringType.Name != "FieldAttribute" + && ca.Constructor.DeclaringType.Name != "FieldAttribute`1") continue; var name = ca.ConstructorArguments [0].Value as string; diff --git a/tests/xtro-sharpie/xtro-sharpie/xtro-sharpie.csproj b/tests/xtro-sharpie/xtro-sharpie/xtro-sharpie.csproj index f5a67769f9cb..f28b4da3c550 100644 --- a/tests/xtro-sharpie/xtro-sharpie/xtro-sharpie.csproj +++ b/tests/xtro-sharpie/xtro-sharpie/xtro-sharpie.csproj @@ -1,59 +1,12 @@ - + - Debug - AnyCPU - 8.0.30703 - 2.0 - {D890A042-93C2-4B4B-ABF8-7ECBCBF059D8} + net4.7.2 Exe - xtrosharpie - xtro-sharpie - v4.7 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - ../../../iphoneos12.0-arm64.pch /Library/Frameworks/Xamarin.iOS.framework/Versions/Current//lib/64bits/iOS/Xamarin.iOS.dll - x64 - latest - - - full - true - bin\Release - prompt - 4 - true + false latest - - Project - ../$(WATCHOS_PCH) ../../../_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/lib/32bits/watchOS/Xamarin.WatchOS.dll - . - - - Project - ../$(iOS_PCH) ../../../_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/lib/64bits/iOS/Xamarin.iOS.dll ../../_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/OpenTK-1.0.dll - . - - - Project - ../$(tvOS_PCH) ../../../_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/lib/mono/Xamarin.TVOS/Xamarin.TVOS.dll ../../_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/lib/mono/Xamarin.TVOS/OpenTK-1.0.dll - . - - - Project - ../$(macOS_PCH) ../../../_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/64bits/mobile/Xamarin.Mac.dll - . - Project ../$(iOS_PCH) --output-directory ../api-annotations-dotnet --lib ../../../packages/microsoft.netcore.app.ref/$(MicrosoftNETCoreAppRefPackageVersion)/ref/$(DOTNET_TFM) $(iOS_DLL) @@ -75,7 +28,6 @@ . - \Library\Frameworks\ObjectiveSharpie.framework\Versions\Current\bin\Clang.dll @@ -83,31 +35,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + $(SHARPIE)/../bin/x64/Release/libclang-mono.dylib /Library/Frameworks/ObjectiveSharpie.framework/Versions/Current/bin/libclang-mono.dylib diff --git a/tools/Makefile b/tools/Makefile index 5a840a4d286d..223e358b08bf 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -8,20 +8,12 @@ ifdef INCLUDE_MAC SUBDIRS+=mmp endif - -ifdef INCLUDE_XAMARIN_LEGACY -SUBDIRS += xibuild -endif - ifdef INCLUDE_IOS INCLUDE_MTOUCH=1 endif ifdef INCLUDE_TVOS INCLUDE_MTOUCH=1 endif -ifdef INCLUDE_WATCH -INCLUDE_MTOUCH=1 -endif ifdef INCLUDE_MACCATALYST INCLUDE_MTOUCH=1 endif @@ -32,12 +24,4 @@ endif SUBDIRS+=mlaunch siminstaller -ifdef ENABLE_DOTNET -ifdef INCLUDE_XAMARIN_LEGACY -SUBDIRS += nnyeah -endif -endif - -ifdef ENABLE_DOTNET SUBDIRS += dotnet-linker -endif diff --git a/tools/apidiff/Makefile b/tools/apidiff/Makefile index a2862f1cccb3..c44015355be6 100644 --- a/tools/apidiff/Makefile +++ b/tools/apidiff/Makefile @@ -208,6 +208,3 @@ $(APIDIFF_DIR)/references/current/Microsoft.$(1).xml: $(DOTNET_DESTDIR)/$($(1)_N update-current-refs:: $(APIDIFF_DIR)/references/current/Microsoft.$(1).xml endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call GenerateCurrentReferenceXml,$(platform)))) - -merger.exe: merger.cs - $(Q) $(SYSTEM_CSC) -debug $< -out:$@ /nologo diff --git a/tools/apidiff/merger.cs b/tools/apidiff/merger.cs deleted file mode 100644 index 34f335d6da0b..000000000000 --- a/tools/apidiff/merger.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Security.Cryptography; -using System.Text; - -#nullable enable - -class Merger { - - static string GetVersion (string line) - { - var end = line.LastIndexOf ('"'); - var start = line.LastIndexOf ('"', end - 1) + 1; - return line.Substring (start, end - start); - } - - public static void Process (string platform, string path, string os, string? destinationPath) - { - if (!Directory.Exists (path)) - throw new DirectoryNotFoundException (path); - - var content = new StringWriter (); - var files = Directory.GetFileSystemEntries (path, "*.md"); - Array.Sort (files); - string from = "unknown"; - string to = "unknown"; - bool lookForVersion = false; - foreach (var file in files) { - if (new FileInfo (file).Length == 0) - continue; - // skip everything before and including title (single #) from each file, we already have one - string? foundTitle = null; - foreach (var line in File.ReadAllLines (file)) { - if (foundTitle is not null) { - content.WriteLine (line); - if (line == "#### Type Changed: ObjCRuntime.Constants") { - lookForVersion = true; - } else if (line.StartsWith ("#### ")) { - lookForVersion = false; - } - if (lookForVersion) { - if (line.StartsWith ("-public const string Version = ", StringComparison.Ordinal)) - from = GetVersion (line); - if (line.StartsWith ("+public const string Version = ", StringComparison.Ordinal)) - to = GetVersion (line); - } - } else if (line.StartsWith ("## ")) { - // everything with ## becomes an entry in the ToC - foundTitle = line.Substring (3); - content.WriteLine ($""); - content.WriteLine (); // required empty line - content.WriteLine (line); - } - } - } - var hasVersions = from != "unknown" && to != "unknown"; - - // https://github.com/MicrosoftDocs/xamarin-docs/blob/live/contributing-guidelines/template.md#file-name - var filename = $"{os}-{from}-{to}".Replace ('.', '-').ToLowerInvariant () + ".md"; - byte []? digest = null; - using (var md = SHA256.Create ()) - digest = md.ComputeHash (Encoding.UTF8.GetBytes (filename)); - // (not cryptographically) unique (but good enough) for each filename - so document remains with the same id when it's updated/regenerated - var guid = new Guid (digest [0..16]); - - var headers = new StringWriter (); - var title = $"{platform} SDK API diff"; - if (hasVersions) { - title += $": {from} vs {to}"; - } - // https://github.com/MicrosoftDocs/xamarin-docs/blob/live/contributing-guidelines/template.md#metadata - headers.WriteLine ("---"); - headers.WriteLine ($"title: \"{title}\""); - if (hasVersions) { - headers.WriteLine ($"description: List of API changes between {platform} versions {from} and {to}."); - } else { - headers.WriteLine ($"description: List of API changes for {platform}."); - } - headers.WriteLine ($"author: spouliot"); - headers.WriteLine ($"ms.author: sepoulio"); - headers.WriteLine ($"ms.date: {DateTime.Now.ToString ("d", new CultureInfo ("en-US"))}"); - headers.WriteLine ($"ms.topic: article"); - headers.WriteLine ($"ms.assetid: {guid.ToString ().ToLowerInvariant ()}"); - headers.WriteLine ($"ms.prod: xamarin"); - headers.WriteLine ("---"); - headers.WriteLine (); - headers.WriteLine ($"# {title}"); - headers.WriteLine (); - - var filePath = destinationPath; - File.WriteAllText (filePath, headers.ToString ()); - - var alldiffs = content.ToString (); - if (alldiffs.Length == 0) - alldiffs = "No changes were found between both versions."; // should not happen for releases (versions change) - File.AppendAllText (filePath, alldiffs); - } - - public static int Main (string [] args) - { - try { - // if calling merger.cs from tools/apidiff/Makefile, we want to pass in the destinationPath 'arg [3]' - // to make sure diffs go to the correct location - Process (args [0], args [1], args [2], args.Length > 3 ? args [3] : null); - return 0; - } catch (Exception e) { - Console.WriteLine (e); - return 1; - } - } -} diff --git a/tools/autoformat.sh b/tools/autoformat.sh index 62e4b180490b..9d632006f51e 100755 --- a/tools/autoformat.sh +++ b/tools/autoformat.sh @@ -37,7 +37,6 @@ IFS=$'\n' cd .. # Start formatting! -dotnet format "$SRC_DIR/tools/xibuild/xibuild.csproj" dotnet format whitespace "$SRC_DIR/tests/cecil-tests/cecil-tests.csproj" dotnet format whitespace "$SRC_DIR/tests/dotnet/UnitTests/DotNetUnitTests.csproj" dotnet format whitespace "$SRC_DIR/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj" @@ -56,8 +55,6 @@ dotnet format whitespace "$SRC_DIR/tests/introspection/dotnet/iOS/introspection. dotnet format whitespace "$SRC_DIR/tests/introspection/dotnet/MacCatalyst/introspection.csproj" dotnet format whitespace "$SRC_DIR/tests/introspection/dotnet/macOS/introspection.csproj" dotnet format whitespace "$SRC_DIR/tests/introspection/dotnet/tvOS/introspection.csproj" -dotnet format whitespace "$SRC_DIR/tests/introspection/iOS/introspection-ios.csproj" -dotnet format whitespace "$SRC_DIR/tests/introspection/Mac/introspection-mac.csproj" dotnet format whitespace "$SRC_DIR/tests/monotouch-test/dotnet/iOS/monotouch-test.csproj" dotnet format whitespace "$SRC_DIR/tests/monotouch-test/dotnet/MacCatalyst/monotouch-test.csproj" dotnet format whitespace "$SRC_DIR/tests/monotouch-test/dotnet/macOS/monotouch-test.csproj" diff --git a/tools/class-redirector/class-redirector/class-redirector.csproj b/tools/class-redirector/class-redirector/class-redirector.csproj index 13301992bc25..93aabb3f2186 100644 --- a/tools/class-redirector/class-redirector/class-redirector.csproj +++ b/tools/class-redirector/class-redirector/class-redirector.csproj @@ -10,7 +10,7 @@ - + diff --git a/tools/common/Application.cs b/tools/common/Application.cs index 6e571717d6cf..5036b2b8d4fe 100644 --- a/tools/common/Application.cs +++ b/tools/common/Application.cs @@ -24,7 +24,7 @@ using PlatformResolver = MonoTouch.Tuner.MonoTouchResolver; #elif MMP using PlatformResolver = Xamarin.Bundler.MonoMacResolver; -#elif NET +#elif NET && !LEGACY_TOOLS using PlatformResolver = Xamarin.Linker.DotNetResolver; #else #error Invalid defines @@ -107,7 +107,7 @@ public bool EnableMSym { } // Linker config -#if !NET +#if !NET || LEGACY_TOOLS public LinkMode LinkMode = LinkMode.Full; #endif bool? are_any_assemblies_trimmed; @@ -115,7 +115,7 @@ public bool AreAnyAssembliesTrimmed { get { if (are_any_assemblies_trimmed.HasValue) return are_any_assemblies_trimmed.Value; -#if NET +#if NET && !LEGACY_TOOLS // This shouldn't happen, we should always set AreAnyAssembliesTrimmed to some value for .NET. throw ErrorHelper.CreateError (99, "A custom LinkMode value is not supported for .NET"); #else @@ -128,7 +128,7 @@ public bool AreAnyAssembliesTrimmed { } public List LinkSkipped = new List (); public List Definitions = new List (); -#if !NET +#if !NET || LEGACY_TOOLS public I18nAssemblies I18n; #endif public List WarnOnTypeRef = new List (); @@ -444,7 +444,7 @@ public bool ArchSpecificExecutable { } } -#if !NET +#if !NET || LEGACY_TOOLS public static int Concurrency => Driver.Concurrency; #endif public Version DeploymentTarget; @@ -546,7 +546,13 @@ public void ParseInterpreter (string value) InterpretedAssemblies.AddRange (value.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries)); } -#if !NET + public void UnsetInterpreter () + { + UseInterpreter = false; + InterpretedAssemblies.Clear (); + } + +#if !NET || LEGACY_TOOLS public void ParseI18nAssemblies (string i18n) { var assemblies = I18nAssemblies.None; @@ -652,7 +658,7 @@ public bool RequiresPInvokeWrappers { } } -#if NET +#if NET && !LEGACY_TOOLS public bool RequireLinkWithAttributeForObjectiveCClassSearch; #else public bool RequireLinkWithAttributeForObjectiveCClassSearch = true; @@ -830,7 +836,7 @@ public static void CopyFile (string source, string target) public void InitializeCommon () { InitializeDeploymentTarget (); -#if !NET +#if !NET || LEGACY_TOOLS SelectRegistrar (); #endif SelectMonoNative (); @@ -1257,13 +1263,13 @@ public void ParseRegistrar (string v) Registrar = RegistrarMode.PartialStatic; break; #endif -#if NET +#if NET && !LEGACY_TOOLS case "managed-static": Registrar = RegistrarMode.ManagedStatic; break; #endif default: -#if NET +#if NET && !LEGACY_TOOLS throw ErrorHelper.CreateError (20, Errors.MX0020, "--registrar", "managed-static, static, dynamic or default"); #else throw ErrorHelper.CreateError (20, Errors.MX0020, "--registrar", "static, dynamic or default"); @@ -1469,7 +1475,7 @@ public bool IsInterpreted (string assembly) if (Platform == ApplePlatform.MacOSX) throw ErrorHelper.CreateError (99, Errors.MX0099, "IsInterpreted isn't a valid operation for macOS apps."); -#if !NET +#if !NET || LEGACY_TOOLS if (IsSimulatorBuild) return false; #endif @@ -1501,7 +1507,7 @@ public bool IsInterpreted (string assembly) // revision/testing to be used so desired. public bool IsAOTCompiled (string assembly) { -#if NET +#if NET && !LEGACY_TOOLS if (Platform == ApplePlatform.MacOSX) return false; // AOT on .NET for macOS hasn't been implemented yet. #else @@ -1639,7 +1645,7 @@ public void GetAotArguments (string filename, Abi abi, string outputDir, string if (enable_llvm) aotArguments.Add ($"llvm-outfile={llvmOutputFile}"); -#if NET +#if NET && !LEGACY_TOOLS // If the interpreter is enabled, and we're building for x86_64, we're AOT-compiling but we // don't have access to infinite trampolines. So we're bumping the trampoline count (unless // the developer has already set a value) to something higher than the default. @@ -1683,8 +1689,6 @@ internal ProductConstants ProductConstants { return ProductConstants.iOS; case ApplePlatform.TVOS: return ProductConstants.tvOS; - case ApplePlatform.WatchOS: - return ProductConstants.watchOS; case ApplePlatform.MacOSX: return ProductConstants.macOS; default: diff --git a/tools/common/Assembly.cs b/tools/common/Assembly.cs index e5197378050b..152486277c89 100644 --- a/tools/common/Assembly.cs +++ b/tools/common/Assembly.cs @@ -67,7 +67,7 @@ public string FullPath { set { full_path = value; if (!is_framework_assembly.HasValue && !string.IsNullOrEmpty (full_path)) { -#if NET +#if NET && !LEGACY_TOOLS is_framework_assembly = Target.App.Configuration.FrameworkAssemblies.Contains (GetIdentity (full_path)); #else var real_full_path = Target.GetRealPath (full_path); @@ -582,7 +582,7 @@ public void ComputeLinkerFlags () if (Frameworks.Add ("OpenAL")) Driver.Log (3, "Linking with the framework OpenAL because {0} is referenced by a module reference in {1}", file, FileName); break; -#if NET +#if NET && !LEGACY_TOOLS case "Carbon": if (App.Platform != ApplePlatform.MacOSX) { Driver.Log (3, $"Not linking with the framework {file} (referenced by a module reference in {FileName}) because it doesn't exist on the target platform."); diff --git a/tools/common/DerivedLinkContext.cs b/tools/common/DerivedLinkContext.cs index dd7e33ec4c5a..22c6dc9d2701 100644 --- a/tools/common/DerivedLinkContext.cs +++ b/tools/common/DerivedLinkContext.cs @@ -9,7 +9,7 @@ using Mono.Tuner; using Xamarin.Bundler; -#if NET +#if NET && !LEGACY_TOOLS using LinkContext = Xamarin.Bundler.DotNetLinkContext; #endif @@ -43,7 +43,7 @@ public class DerivedLinkContext : LinkContext { // so we need a second dictionary Dictionary LinkedAwayTypeMap = new Dictionary (); -#if NET +#if NET && !LEGACY_TOOLS public DerivedLinkContext (Xamarin.Linker.LinkerConfiguration configuration, Target target) : base (configuration) { @@ -103,7 +103,7 @@ public bool RequireMonoNative { get; set; } -#if !NET +#if !NET || LEGACY_TOOLS public DerivedLinkContext (Pipeline pipeline, AssemblyResolver resolver) : base (pipeline, resolver) { diff --git a/tools/common/Driver.cs b/tools/common/Driver.cs index d532e81c10a4..a1641bee39c4 100644 --- a/tools/common/Driver.cs +++ b/tools/common/Driver.cs @@ -38,7 +38,7 @@ public partial class Driver { static Version min_xcode_version = new Version (6, 0); #endif -#if !NET +#if !NET || LEGACY_TOOLS public static int Main (string [] args) { try { @@ -303,7 +303,7 @@ static bool ParseOptions (Application app, Mono.Options.OptionSet options, strin } #endif // !NET -#if !NET +#if !NET || LEGACY_TOOLS static int Jobs; public static int Concurrency { get { diff --git a/tools/common/Make.common b/tools/common/Make.common index 838256b0934d..7d6a5e21edb3 100644 --- a/tools/common/Make.common +++ b/tools/common/Make.common @@ -1,12 +1,11 @@ # We check in SdkVersions.cs so that it's easier to use this file when building tests on Windows. -../common/SdkVersions.cs: ../common/SdkVersions.in.cs Makefile $(TOP)/Make.config $(TOP)/Make.versions +$(abspath ../common/SdkVersions.cs): ../common/SdkVersions.in.cs Makefile $(TOP)/Make.config $(TOP)/Make.versions $(Q_GEN) sed \ - -e 's/@IOS_SDK_VERSION@/$(IOS_SDK_VERSION)/g' -e 's/@WATCHOS_SDK_VERSION@/$(WATCH_SDK_VERSION)/' -e 's/@TVOS_SDK_VERSION@/$(TVOS_SDK_VERSION)/' -e 's/@MACOS_SDK_VERSION@/$(MACOS_SDK_VERSION)/' \ + -e 's/@IOS_SDK_VERSION@/$(IOS_SDK_VERSION)/g' -e 's/@TVOS_SDK_VERSION@/$(TVOS_SDK_VERSION)/' -e 's/@MACOS_SDK_VERSION@/$(MACOS_SDK_VERSION)/' \ -e 's/@MACCATALYST_SDK_VERSION@/$(MACCATALYST_SDK_VERSION)/g' \ \ -e 's/@MIN_IOS_SDK_VERSION@/$(MIN_IOS_SDK_VERSION)/g' \ - -e 's/@MIN_WATCHOS_SDK_VERSION@/$(MIN_WATCHOS_SDK_VERSION)/' \ -e 's/@MIN_TVOS_SDK_VERSION@/$(MIN_TVOS_SDK_VERSION)/' \ -e 's/@MIN_MACOS_SDK_VERSION@/$(MIN_MACOS_SDK_VERSION)/' \ -e 's/@MIN_MACCATALYST_SDK_VERSION@/$(MIN_MACCATALYST_SDK_VERSION)/g' \ @@ -19,15 +18,11 @@ -e 's/@XCODE_VERSION@/$(XCODE_VERSION)/g' \ -e 's/@MIN_XM_MONO_VERSION@/$(MIN_XM_MONO_VERSION)/g' \ -e 's/@MIN_IOS_SIMULATOR_VERSION@/$(MIN_IOS_SIMULATOR_VERSION)/g' \ - -e 's/@MIN_WATCHOS_SIMULATOR_VERSION@/$(MIN_WATCHOS_SIMULATOR_VERSION)/' \ - -e 's/@MIN_WATCHOS_COMPANION_SIMULATOR_VERSION@/$(MIN_WATCHOS_COMPANION_SIMULATOR_VERSION)/' \ -e 's/@MIN_TVOS_SIMULATOR_VERSION@/$(MIN_TVOS_SIMULATOR_VERSION)/' \ -e "s/@MAX_IOS_SIMULATOR_VERSION@/$(MAX_IOS_SIMULATOR_VERSION)/g" \ -e "s/@MAX_MACOS_VERSION@/$(MAX_MACOS_VERSION)/g" \ - -e "s/@MAX_WATCH_SIMULATOR_VERSION@/$(MAX_WATCH_SIMULATOR_VERSION)/g" \ -e "s/@MAX_TVOS_SIMULATOR_VERSION@/$(MAX_TVOS_SIMULATOR_VERSION)/g" \ -e "s/@MAX_IOS_DEPLOYMENT_TARGET@/$(MAX_IOS_DEPLOYMENT_TARGET)/g" \ - -e "s/@MAX_WATCH_DEPLOYMENT_TARGET@/$(MAX_WATCH_DEPLOYMENT_TARGET)/g" \ -e "s/@MAX_TVOS_DEPLOYMENT_TARGET@/$(MAX_TVOS_DEPLOYMENT_TARGET)/g" \ \ -e "s/@IOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ @@ -40,20 +35,20 @@ -e "s/@TVOS_NUGET_VERSION@/$(TVOS_NUGET_VERSION)/g" \ -e "s/@TVOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(TVOS_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g" \ \ - -e "s/@WATCHOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ - -e 's/@WATCHOS_REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ - -e "s/@WATCHOS_NUGET_VERSION@/$(WATCHOS_NUGET_VERSION)/g" \ - -e "s/@WATCHOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(WATCHOS_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g" \ - \ -e "s/@MACOS_VERSION@/$(MAC_PACKAGE_VERSION_MAJOR).$(MAC_PACKAGE_VERSION_MINOR).$(MAC_PACKAGE_VERSION_REV)/g" \ -e 's/@MACOS_REVISION@/$(MAC_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ -e "s/@MACOS_NUGET_VERSION@/$(MACOS_NUGET_VERSION)/g" \ -e "s/@MACOS_NUGET_REVISION@/$(NUGET_PRERELEASE_IDENTIFIER)$(MACOS_NUGET_COMMIT_DISTANCE)$(NUGET_BUILD_METADATA)/g" \ \ - -e "s/@TARGET_PLATFORM_VERSION_IOS@/$(IOS_NUGET_OS_VERSION)/g" \ - -e "s/@TARGET_PLATFORM_VERSION_TVOS@/$(TVOS_NUGET_OS_VERSION)/g" \ - -e "s/@TARGET_PLATFORM_VERSION_MACOS@/$(MACOS_NUGET_OS_VERSION)/g" \ - -e "s/@TARGET_PLATFORM_VERSION_MACCATALYST@/$(MACCATALYST_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_EXECUTABLE_IOS@/$(IOS_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_EXECUTABLE_TVOS@/$(TVOS_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_EXECUTABLE_MACOS@/$(MACOS_NUGET_OS_VERSION)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_EXECUTABLE_MACCATALYST@/$(MACCATALYST_NUGET_OS_VERSION)/g" \ + \ + -e "s/@TARGET_PLATFORM_VERSION_LIBRARY_IOS@/$(IOS_TARGET_PLATFORM_VERSION_LIBRARY)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_LIBRARY_TVOS@/$(TVOS_TARGET_PLATFORM_VERSION_LIBRARY)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_LIBRARY_MACOS@/$(MACOS_TARGET_PLATFORM_VERSION_LIBRARY)/g" \ + -e "s/@TARGET_PLATFORM_VERSION_LIBRARY_MACCATALYST@/$(MACCATALYST_TARGET_PLATFORM_VERSION_LIBRARY)/g" \ \ -e "s/@PRODUCT_HASH@/$(CURRENT_HASH_LONG)/g" \ \ @@ -63,11 +58,10 @@ $(Q) if ! diff $@ $@.tmp >/dev/null; then $(CP) $@.tmp $@; git diff "$@"; echo "The file $(TOP)/tools/common/SdkVersions.cs has been automatically re-generated; please commit the changes."; exit 1; fi $(Q) touch $@ -../common/ProductConstants.cs: ../common/ProductConstants.in.cs Makefile $(TOP)/Make.config $(GIT_DIRECTORY)/index +$(abspath ../common/ProductConstants.cs): ../common/ProductConstants.in.cs Makefile $(TOP)/Make.config $(GIT_DIRECTORY)/index $(Q_GEN) sed \ -e "s/@IOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ -e "s/@TVOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ - -e "s/@WATCHOS_VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ -e "s/@MACOS_VERSION@/$(MAC_PACKAGE_VERSION_MAJOR).$(MAC_PACKAGE_VERSION_MINOR).$(MAC_PACKAGE_VERSION_REV)/g" \ \ $(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),-e 's/@$(platform)_REVISION@/$($(platform)_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g') \ diff --git a/tools/common/ProductConstants.in.cs b/tools/common/ProductConstants.in.cs index abfa8c12457a..88da439fabf2 100644 --- a/tools/common/ProductConstants.in.cs +++ b/tools/common/ProductConstants.in.cs @@ -23,12 +23,10 @@ sealed class ProductConstants { #if BUNDLER public readonly static ProductConstants iOS = new ProductConstants ("@IOS_NUGET_VERSION@", "@IOS_NUGET_REVISION@"); public readonly static ProductConstants tvOS = new ProductConstants ("@TVOS_NUGET_VERSION@", "@TVOS_NUGET_REVISION@"); - public readonly static ProductConstants watchOS = new ProductConstants ("@WATCHOS_NUGET_VERSION@", "@WATCHOS_NUGET_REVISION@"); public readonly static ProductConstants macOS = new ProductConstants ("@MACOS_NUGET_VERSION@", "@MACOS_NUGET_REVISION@"); #else public readonly static ProductConstants iOS = new ProductConstants ("@IOS_VERSION@", "@IOS_REVISION@"); public readonly static ProductConstants tvOS = new ProductConstants ("@TVOS_VERSION@", "@TVOS_REVISION@"); - public readonly static ProductConstants watchOS = new ProductConstants ("@WATCHOS_VERSION@", "@WATCHOS_REVISION@"); public readonly static ProductConstants macOS = new ProductConstants ("@MACOS_VERSION@", "@MACOS_REVISION@"); #endif } diff --git a/tools/common/ProjectInspector.csproj b/tools/common/ProjectInspector.csproj index 4dfa51eabbc8..0d6674088a90 100644 --- a/tools/common/ProjectInspector.csproj +++ b/tools/common/ProjectInspector.csproj @@ -23,7 +23,7 @@ diff --git a/tools/common/SdkVersions.cs b/tools/common/SdkVersions.cs index eb863c6ceec6..0cd01e486c7c 100644 --- a/tools/common/SdkVersions.cs +++ b/tools/common/SdkVersions.cs @@ -14,80 +14,61 @@ namespace Xamarin { static class SdkVersions { - public const string Xcode = "16.0"; - public const string OSX = "15.0"; - public const string iOS = "18.0"; - public const string WatchOS = "11.0"; - public const string TVOS = "18.0"; - public const string MacCatalyst = "18.0"; - -#if NET + public const string Xcode = "16.1"; + public const string OSX = "15.1"; + public const string iOS = "18.1"; + public const string TVOS = "18.1"; + public const string MacCatalyst = "18.1"; + public const string MinOSX = "12.0"; public const string MiniOS = "12.2"; public const string MinTVOS = "12.2"; public const string MinMacCatalyst = "15.0"; -#else - public const string MinOSX = "12.0"; - public const string MiniOS = "11.0"; - public const string MinWatchOS = "4.0"; - public const string MinTVOS = "11.0"; - public const string MinMacCatalyst = "15.0"; -#endif public const string DotNetMinOSX = "12.0"; public const string DotNetMiniOS = "12.2"; 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 LegacyMinWatchOS = "4.0"; - public const string LegacyMinTVOS = "11.0"; + public const string LegacyMiniOS = "12.2"; + public const string LegacyMinTVOS = "12.2"; public const string MiniOSSimulator = "15.0"; - public const string MinWatchOSSimulator = "8.0"; - public const string MinWatchOSCompanionSimulator = "15.0"; public const string MinTVOSSimulator = "15.0"; - public const string MaxiOSSimulator = "18.0"; - public const string MaxWatchOSSimulator = "11.0"; - public const string MaxWatchOSCompanionSimulator = "18.0"; - public const string MaxTVOSSimulator = "18.0"; + public const string MaxiOSSimulator = "18.1"; + public const string MaxTVOSSimulator = "18.1"; - public const string MaxiOSDeploymentTarget = "18.0"; - public const string MaxWatchDeploymentTarget = "11.0"; - public const string MaxTVOSDeploymentTarget = "18.0"; + public const string MaxiOSDeploymentTarget = "18.1"; + public const string MaxTVOSDeploymentTarget = "18.1"; - public const string TargetPlatformVersioniOS = "18.0"; - public const string TargetPlatformVersiontvOS = "18.0"; - public const string TargetPlatformVersionmacOS = "15.0"; - public const string TargetPlatformVersionMacCatalyst = "18.0"; + public const string TargetPlatformVersionExecutableiOS = "18.1"; + public const string TargetPlatformVersionExecutabletvOS = "18.1"; + public const string TargetPlatformVersionExecutablemacOS = "15.1"; + public const string TargetPlatformVersionExecutableMacCatalyst = "18.1"; + + public const string TargetPlatformVersionLibraryiOS = "18.0"; + public const string TargetPlatformVersionLibrarytvOS = "18.0"; + public const string TargetPlatformVersionLibrarymacOS = "15.0"; + public const string TargetPlatformVersionLibraryMacCatalyst = "18.0"; public static Version OSXVersion { get { return new Version (OSX); } } public static Version iOSVersion { get { return new Version (iOS); } } - public static Version WatchOSVersion { get { return new Version (WatchOS); } } public static Version TVOSVersion { get { return new Version (TVOS); } } public static Version MacCatalystVersion { get { return new Version (MacCatalyst); } } public static Version iOSTargetVersion { get { return new Version (MaxiOSDeploymentTarget); } } - public static Version WatchOSTargetVersion { get { return new Version (MaxWatchDeploymentTarget); } } public static Version TVOSTargetVersion { get { return new Version (MaxTVOSDeploymentTarget); } } public static Version MinOSXVersion { get { return new Version (MinOSX); } } public static Version MiniOSVersion { get { return new Version (MiniOS); } } -#if !NET - public static Version MinWatchOSVersion { get { return new Version (MinWatchOS); } } -#endif public static Version MinTVOSVersion { get { return new Version (MinTVOS); } } public static Version MinMacCatalystVersion { get { return new Version (MinMacCatalyst); } } public static Version MiniOSSimulatorVersion { get { return new Version (MiniOSSimulator); } } - public static Version MinWatchOSSimulatorVersion { get { return new Version (MinWatchOSSimulator); } } - public static Version MinWatchOSCompanionSimulatorVersion { get { return new Version (MinWatchOSCompanionSimulator); } } public static Version MinTVOSSimulatorVersion { get { return new Version (MinTVOSSimulator); } } public static Version MaxiOSSimulatorVersion { get { return new Version (MaxiOSSimulator); } } - public static Version MaxWatchOSSimulatorVersion { get { return new Version (MaxWatchOSSimulator); } } - public static Version MaxWatchOSCompanionSimulatorVersion { get { return new Version (MaxWatchOSCompanionSimulator); } } public static Version MaxTVOSSimulatorVersion { get { return new Version (MaxTVOSSimulator); } } public static Version XcodeVersion { get { return new Version (Xcode); } } @@ -98,7 +79,6 @@ public static Version GetVersion (Application app) switch (app.Platform) { case ApplePlatform.MacOSX: return OSXVersion; case ApplePlatform.iOS: return iOSVersion; - case ApplePlatform.WatchOS: return WatchOSVersion; case ApplePlatform.TVOS: return TVOSVersion; case ApplePlatform.MacCatalyst: return MacCatalystVersion; default: @@ -111,7 +91,6 @@ public static Version GetTargetVersion (Application app) switch (app.Platform) { case ApplePlatform.MacOSX: return OSXVersion; case ApplePlatform.iOS: return iOSTargetVersion; - case ApplePlatform.WatchOS: return WatchOSTargetVersion; case ApplePlatform.TVOS: return TVOSTargetVersion; default: throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", app.Platform, app.ProductName); @@ -123,9 +102,6 @@ public static Version GetMinVersion (Application app) switch (app.Platform) { case ApplePlatform.MacOSX: return MinOSXVersion; case ApplePlatform.iOS: return MiniOSVersion; -#if !NET - case ApplePlatform.WatchOS: return MinWatchOSVersion; -#endif case ApplePlatform.TVOS: return MinTVOSVersion; case ApplePlatform.MacCatalyst: return MinMacCatalystVersion; default: @@ -139,7 +115,6 @@ public static Version GetVersion (ApplePlatform platform) switch (platform) { case ApplePlatform.MacOSX: return OSXVersion; case ApplePlatform.iOS: return iOSVersion; - case ApplePlatform.WatchOS: return WatchOSVersion; case ApplePlatform.TVOS: return TVOSVersion; case ApplePlatform.MacCatalyst: return MacCatalystVersion; default: @@ -152,9 +127,6 @@ public static Version GetMinVersion (ApplePlatform platform) switch (platform) { case ApplePlatform.MacOSX: return MinOSXVersion; case ApplePlatform.iOS: return MiniOSVersion; -#if !NET - case ApplePlatform.WatchOS: return MinWatchOSVersion; -#endif case ApplePlatform.TVOS: return MinTVOSVersion; case ApplePlatform.MacCatalyst: return MinMacCatalystVersion; default: diff --git a/tools/common/SdkVersions.in.cs b/tools/common/SdkVersions.in.cs index 78d07d826860..a505fc9ea2cc 100644 --- a/tools/common/SdkVersions.in.cs +++ b/tools/common/SdkVersions.in.cs @@ -17,22 +17,13 @@ static class SdkVersions { public const string Xcode = "@XCODE_VERSION@"; public const string OSX = "@MACOS_SDK_VERSION@"; public const string iOS = "@IOS_SDK_VERSION@"; - public const string WatchOS = "@WATCHOS_SDK_VERSION@"; public const string TVOS = "@TVOS_SDK_VERSION@"; public const string MacCatalyst = "@MACCATALYST_SDK_VERSION@"; -#if NET public const string MinOSX = "@DOTNET_MIN_MACOS_SDK_VERSION@"; public const string MiniOS = "@DOTNET_MIN_IOS_SDK_VERSION@"; public const string MinTVOS = "@DOTNET_MIN_TVOS_SDK_VERSION@"; public const string MinMacCatalyst = "@DOTNET_MIN_MACCATALYST_SDK_VERSION@"; -#else - public const string MinOSX = "@MIN_MACOS_SDK_VERSION@"; - public const string MiniOS = "@MIN_IOS_SDK_VERSION@"; - public const string MinWatchOS = "@MIN_WATCHOS_SDK_VERSION@"; - public const string MinTVOS = "@MIN_TVOS_SDK_VERSION@"; - public const string MinMacCatalyst = "@MIN_MACCATALYST_SDK_VERSION@"; -#endif public const string DotNetMinOSX = "@DOTNET_MIN_MACOS_SDK_VERSION@"; public const string DotNetMiniOS = "@DOTNET_MIN_IOS_SDK_VERSION@"; @@ -40,54 +31,44 @@ static class SdkVersions { public const string DotNetMinMacCatalyst = "@DOTNET_MIN_MACCATALYST_SDK_VERSION@"; public const string LegacyMinOSX = "@MIN_MACOS_SDK_VERSION@"; public const string LegacyMiniOS = "@MIN_IOS_SDK_VERSION@"; - public const string LegacyMinWatchOS = "@MIN_WATCHOS_SDK_VERSION@"; public const string LegacyMinTVOS = "@MIN_TVOS_SDK_VERSION@"; public const string MiniOSSimulator = "@MIN_IOS_SIMULATOR_VERSION@"; - public const string MinWatchOSSimulator = "@MIN_WATCHOS_SIMULATOR_VERSION@"; - public const string MinWatchOSCompanionSimulator = "@MIN_WATCHOS_COMPANION_SIMULATOR_VERSION@"; public const string MinTVOSSimulator = "@MIN_TVOS_SIMULATOR_VERSION@"; public const string MaxiOSSimulator = "@MAX_IOS_SIMULATOR_VERSION@"; - public const string MaxWatchOSSimulator = "@MAX_WATCH_SIMULATOR_VERSION@"; - public const string MaxWatchOSCompanionSimulator = "@MAX_IOS_SIMULATOR_VERSION@"; public const string MaxTVOSSimulator = "@MAX_TVOS_SIMULATOR_VERSION@"; public const string MaxiOSDeploymentTarget = "@MAX_IOS_DEPLOYMENT_TARGET@"; - public const string MaxWatchDeploymentTarget = "@MAX_WATCH_DEPLOYMENT_TARGET@"; public const string MaxTVOSDeploymentTarget = "@MAX_TVOS_DEPLOYMENT_TARGET@"; - public const string TargetPlatformVersioniOS = "@TARGET_PLATFORM_VERSION_IOS@"; - public const string TargetPlatformVersiontvOS = "@TARGET_PLATFORM_VERSION_TVOS@"; - public const string TargetPlatformVersionmacOS = "@TARGET_PLATFORM_VERSION_MACOS@"; - public const string TargetPlatformVersionMacCatalyst = "@TARGET_PLATFORM_VERSION_MACCATALYST@"; + public const string TargetPlatformVersionExecutableiOS = "@TARGET_PLATFORM_VERSION_EXECUTABLE_IOS@"; + public const string TargetPlatformVersionExecutabletvOS = "@TARGET_PLATFORM_VERSION_EXECUTABLE_TVOS@"; + public const string TargetPlatformVersionExecutablemacOS = "@TARGET_PLATFORM_VERSION_EXECUTABLE_MACOS@"; + public const string TargetPlatformVersionExecutableMacCatalyst = "@TARGET_PLATFORM_VERSION_EXECUTABLE_MACCATALYST@"; + + public const string TargetPlatformVersionLibraryiOS = "@TARGET_PLATFORM_VERSION_LIBRARY_IOS@"; + public const string TargetPlatformVersionLibrarytvOS = "@TARGET_PLATFORM_VERSION_LIBRARY_TVOS@"; + public const string TargetPlatformVersionLibrarymacOS = "@TARGET_PLATFORM_VERSION_LIBRARY_MACOS@"; + public const string TargetPlatformVersionLibraryMacCatalyst = "@TARGET_PLATFORM_VERSION_LIBRARY_MACCATALYST@"; public static Version OSXVersion { get { return new Version (OSX); } } public static Version iOSVersion { get { return new Version (iOS); } } - public static Version WatchOSVersion { get { return new Version (WatchOS); } } public static Version TVOSVersion { get { return new Version (TVOS); } } public static Version MacCatalystVersion { get { return new Version (MacCatalyst); } } public static Version iOSTargetVersion { get { return new Version (MaxiOSDeploymentTarget); } } - public static Version WatchOSTargetVersion { get { return new Version (MaxWatchDeploymentTarget); } } public static Version TVOSTargetVersion { get { return new Version (MaxTVOSDeploymentTarget); } } public static Version MinOSXVersion { get { return new Version (MinOSX); } } public static Version MiniOSVersion { get { return new Version (MiniOS); } } -#if !NET - public static Version MinWatchOSVersion { get { return new Version (MinWatchOS); } } -#endif public static Version MinTVOSVersion { get { return new Version (MinTVOS); } } public static Version MinMacCatalystVersion { get { return new Version (MinMacCatalyst); } } public static Version MiniOSSimulatorVersion { get { return new Version (MiniOSSimulator); } } - public static Version MinWatchOSSimulatorVersion { get { return new Version (MinWatchOSSimulator); } } - public static Version MinWatchOSCompanionSimulatorVersion { get { return new Version (MinWatchOSCompanionSimulator); } } public static Version MinTVOSSimulatorVersion { get { return new Version (MinTVOSSimulator); } } public static Version MaxiOSSimulatorVersion { get { return new Version (MaxiOSSimulator); } } - public static Version MaxWatchOSSimulatorVersion { get { return new Version (MaxWatchOSSimulator); } } - public static Version MaxWatchOSCompanionSimulatorVersion { get { return new Version (MaxWatchOSCompanionSimulator); } } public static Version MaxTVOSSimulatorVersion { get { return new Version (MaxTVOSSimulator); } } public static Version XcodeVersion { get { return new Version (Xcode); } } @@ -98,7 +79,6 @@ public static Version GetVersion (Application app) switch (app.Platform) { case ApplePlatform.MacOSX: return OSXVersion; case ApplePlatform.iOS: return iOSVersion; - case ApplePlatform.WatchOS: return WatchOSVersion; case ApplePlatform.TVOS: return TVOSVersion; case ApplePlatform.MacCatalyst: return MacCatalystVersion; default: @@ -111,7 +91,6 @@ public static Version GetTargetVersion (Application app) switch (app.Platform) { case ApplePlatform.MacOSX: return OSXVersion; case ApplePlatform.iOS: return iOSTargetVersion; - case ApplePlatform.WatchOS: return WatchOSTargetVersion; case ApplePlatform.TVOS: return TVOSTargetVersion; default: throw ErrorHelper.CreateError (71, "Unknown platform: {0}. This usually indicates a bug in {1}; please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new with a test case.", app.Platform, app.ProductName); @@ -123,9 +102,6 @@ public static Version GetMinVersion (Application app) switch (app.Platform) { case ApplePlatform.MacOSX: return MinOSXVersion; case ApplePlatform.iOS: return MiniOSVersion; -#if !NET - case ApplePlatform.WatchOS: return MinWatchOSVersion; -#endif case ApplePlatform.TVOS: return MinTVOSVersion; case ApplePlatform.MacCatalyst: return MinMacCatalystVersion; default: @@ -139,7 +115,6 @@ public static Version GetVersion (ApplePlatform platform) switch (platform) { case ApplePlatform.MacOSX: return OSXVersion; case ApplePlatform.iOS: return iOSVersion; - case ApplePlatform.WatchOS: return WatchOSVersion; case ApplePlatform.TVOS: return TVOSVersion; case ApplePlatform.MacCatalyst: return MacCatalystVersion; default: @@ -152,9 +127,6 @@ public static Version GetMinVersion (ApplePlatform platform) switch (platform) { case ApplePlatform.MacOSX: return MinOSXVersion; case ApplePlatform.iOS: return MiniOSVersion; -#if !NET - case ApplePlatform.WatchOS: return MinWatchOSVersion; -#endif case ApplePlatform.TVOS: return MinTVOSVersion; case ApplePlatform.MacCatalyst: return MinMacCatalystVersion; default: diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index 340d6a06a6dc..48a2becaade8 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -1598,7 +1598,7 @@ protected override IEnumerable GetProtocolMemberAttribu } } -#if !NET +#if !NET || LEGACY_TOOLS PlatformName AsPlatformName (ApplePlatform platform) { switch (platform) { @@ -1735,7 +1735,7 @@ bool GetLegacyAvailabilityAttribute (ICustomAttribute ca, ApplePlatform platform } #endif // !NET -#if NET +#if NET && !LEGACY_TOOLS bool GetDotNetAvailabilityAttribute (ICustomAttribute ca, ApplePlatform currentPlatform, out Version sdkVersion, out string message) { var caType = ca.AttributeType; @@ -1790,7 +1790,7 @@ bool CollectAvailabilityAttributes (IEnumerable attributes, ou ApplePlatform [] platforms; -#if !NET +#if !NET || LEGACY_TOOLS if (currentPlatform == ApplePlatform.MacCatalyst) { // Fall back to any iOS attributes if we can't find something for Mac Catalyst platforms = new ApplePlatform [] { @@ -1812,7 +1812,7 @@ bool CollectAvailabilityAttributes (IEnumerable attributes, ou foreach (var platform in platforms) { foreach (var ca in attributes) { var caType = ca.AttributeType; -#if NET +#if NET && !LEGACY_TOOLS if (!caType.Is ("System.Runtime.Versioning", "SupportedOSPlatformAttribute")) continue; if (GetDotNetAvailabilityAttribute (ca, platform, out sdkVersion, out message)) @@ -2265,7 +2265,7 @@ void CheckNamespace (string ns, List exceptions) } } goto default; -#if !NET +#if !NET || LEGACY_TOOLS case "Chip": switch (App.Platform) { case ApplePlatform.iOS when App.SdkVersion.Major <= 15: @@ -2348,7 +2348,7 @@ void CheckNamespace (string ns, List exceptions) } } goto default; -#if !NET +#if !NET || LEGACY_TOOLS case "QTKit": if (App.Platform == ApplePlatform.MacOSX && App.SdkVersion >= MacOSTenTwelveVersion) return; // 10.12 removed the header files for QTKit @@ -2361,7 +2361,7 @@ void CheckNamespace (string ns, List exceptions) header.WriteLine ("#import "); header.WriteLine ("#import "); return; -#if !NET +#if !NET || LEGACY_TOOLS case "iAd": if (App.SdkVersion.Major >= 13) { // most of the framework has been obliterated from the headers @@ -2810,7 +2810,7 @@ static bool IsTypeCore (ObjCType type, string nsToMatch) return ns == nsToMatch; } -#if !NET +#if !NET || LEGACY_TOOLS static bool IsQTKitType (ObjCType type) => IsTypeCore (type, "QTKit"); #endif static bool IsMapKitType (ObjCType type) => IsTypeCore (type, "MapKit"); @@ -2871,13 +2871,13 @@ List GetAllTypes (List exceptions) continue; // Some types are not supported in the simulator. } } else { -#if !NET +#if !NET || LEGACY_TOOLS if (IsQTKitType (@class) && App.SdkVersion >= MacOSTenTwelveVersion) continue; // QTKit header was removed in 10.12 SDK #endif } -#if !NET +#if !NET || LEGACY_TOOLS // Xcode 11 removed WatchKit for iOS! if (IsTypeCore (@class, "WatchKit") && App.Platform == Xamarin.Utils.ApplePlatform.iOS) { exceptions.Add (ErrorHelper.CreateWarning (4178, $"The class '{@class.Type.FullName}' will not be registered because the WatchKit framework has been removed from the iOS SDK.")); @@ -2950,7 +2950,7 @@ public CSToObjCMap GetTypeMapDictionary (List exceptions) public void Rewrite () { -#if NET +#if NET && !LEGACY_TOOLS if (App.Optimizations.RedirectClassHandles == true) { var exceptions = new List (); var map_dict = GetTypeMapDictionary (exceptions); @@ -3513,7 +3513,7 @@ bool SpecializeTrampoline (AutoIndentStringBuilder sb, ObjCMethod method, List nslog_start.AppendLine (");"); } -#if NET +#if NET && !LEGACY_TOOLS // Generate the native trampoline to call the generated UnmanagedCallersOnly method if we're using the managed static registrar. if (LinkContext.App.Registrar == RegistrarMode.ManagedStatic) { GenerateCallToUnmanagedCallersOnlyMethod (sb, method, isCtor, isVoid, num_arg, descriptiveMethodName, exceptions); @@ -4378,7 +4378,7 @@ void Specialize (AutoIndentStringBuilder sb, ObjCMethod method, List } } -#if NET +#if NET && !LEGACY_TOOLS void GenerateCallToUnmanagedCallersOnlyMethod (AutoIndentStringBuilder sb, ObjCMethod method, bool isCtor, bool isVoid, int num_arg, string descriptiveMethodName, List exceptions) { // Generate the native trampoline to call the generated UnmanagedCallersOnly method. @@ -5319,7 +5319,7 @@ bool TryCreateTokenReferenceUncached (MemberReference member, TokenType implied_ { var token = member.MetadataToken; -#if NET +#if NET && !LEGACY_TOOLS if (App.Registrar == RegistrarMode.ManagedStatic) { if (implied_type == TokenType.TypeDef && member is TypeDefinition td) { if (App.Configuration.AssemblyTrampolineInfos.TryGetValue (td.Module.Assembly, out var infos) && infos.TryGetRegisteredTypeIndex (td, out var id)) { diff --git a/tools/common/Target.cs b/tools/common/Target.cs index bafed3bb2495..0d3c4b37c43b 100644 --- a/tools/common/Target.cs +++ b/tools/common/Target.cs @@ -216,7 +216,7 @@ public void GatherFrameworks () if (Driver.GetFrameworks (App).TryGetValue (nspace, out framework)) { // framework specific processing switch (framework.Name) { -#if MONOMAC && !NET +#if MONOMAC && (!NET || LEGACY_TOOLS) case "QTKit": // we already warn in Frameworks.cs Gather method if (!Driver.LinkProhibitedFrameworks) @@ -257,7 +257,7 @@ public void GatherFrameworks () continue; } break; -#if !NET +#if !NET || !LEGACY_TOOLS case "WatchKit": // Xcode 11 doesn't ship WatchKit for iOS if (Driver.XcodeVersion.Major == 11 && App.Platform == ApplePlatform.iOS) { @@ -619,7 +619,7 @@ public void GenerateMain (StringBuilder sb, ApplePlatform platform, Abi abi, str GenerateIOSMain (sw, abi); break; case ApplePlatform.MacOSX: -#if NET +#if NET && !LEGACY_TOOLS GenerateIOSMain (sw, abi); #else GenerateMacMain (sw); @@ -641,7 +641,7 @@ void GenerateMacMain (StringWriter sw) { sw.WriteLine ("#define MONOMAC 1"); sw.WriteLine ("#include "); -#if !NET +#if !NET || LEGACY_TOOLS if (App.Registrar == RegistrarMode.PartialStatic) sw.WriteLine ($"extern \"C\" void {StaticRegistrar.GetInitializationMethodName ("Xamarin.Mac")} ();"); #endif @@ -783,7 +783,7 @@ void GenerateIOSMain (StringWriter sw, Abi abi) sw.WriteLine ("extern \"C\" { void mono_sgen_mono_ilgen_init (void); }"); } -#if NET +#if NET && !LEGACY_TOOLS if (app.MonoNativeMode != MonoNativeMode.None) { sw.WriteLine ("static const char *xamarin_runtime_libraries_array[] = {"); foreach (var lib in app.MonoLibraries) @@ -806,7 +806,7 @@ void GenerateIOSMain (StringWriter sw, Abi abi) sw.WriteLine ("\tmono_marshal_ilgen_init ();"); sw.WriteLine ("\tmono_method_builder_ilgen_init ();"); sw.WriteLine ("\tmono_sgen_mono_ilgen_init ();"); -#if !NET +#if !NET || LEGACY_TOOLS sw.WriteLine ("\tmono_ee_interp_init (NULL);"); #endif if ((abi & Abi.x86_64) == Abi.x86_64) { @@ -830,7 +830,7 @@ void GenerateIOSMain (StringWriter sw, Abi abi) sw.WriteLine ("\txamarin_invoke_registration_methods ();"); if (app.MonoNativeMode != MonoNativeMode.None) { -#if NET +#if NET && !LEGACY_TOOLS // Mono doesn't support dllmaps for Mac Catalyst / macOS in .NET, so we're using an alternative: // the PINVOKE_OVERRIDE runtime option. Since we have to use it for Mac Catalyst + macOS, let's // just use it everywhere to simplify code. This means that at runtime we need to know how we @@ -873,7 +873,7 @@ void GenerateIOSMain (StringWriter sw, Abi abi) sw.WriteLine ("\tsetenv (\"{0}\", \"{1}\", 1);", kvp.Key.Replace ("\"", "\\\""), kvp.Value.Replace ("\"", "\\\"")); if (app.XamarinRuntime != XamarinRuntime.NativeAOT) sw.WriteLine ("\txamarin_supports_dynamic_registration = {0};", app.DynamicRegistrationSupported ? "TRUE" : "FALSE"); -#if NET +#if NET && !LEGACY_TOOLS sw.WriteLine ("\txamarin_runtime_configuration_name = {0};", string.IsNullOrEmpty (app.RuntimeConfigurationFile) ? "NULL" : $"\"{app.RuntimeConfigurationFile}\""); #endif if (app.Registrar == RegistrarMode.ManagedStatic) @@ -946,7 +946,7 @@ void GenerateIOSMain (StringWriter sw, Abi abi) sw.WriteLine ("}"); } -#if NET +#if NET && !LEGACY_TOOLS static readonly char [] charsToReplaceAot = new [] { '.', '-', '+', '<', '>' }; #endif static string EncodeAotSymbol (string symbol) @@ -963,7 +963,7 @@ static string EncodeAotSymbol (string symbol) (c == '_')) { sb.Append (c); continue; -#if NET +#if NET && !LEGACY_TOOLS } else if (charsToReplaceAot.Contains (c)) { sb.Append ('_'); } else { @@ -971,7 +971,7 @@ static string EncodeAotSymbol (string symbol) sb.Append ($"_{b:X}_"); #endif } -#if !NET +#if !NET || LEGACY_TOOLS sb.Append ('_'); #endif } diff --git a/tools/common/create-makefile-fragment.sh b/tools/common/create-makefile-fragment.sh index 42bf3a7882f2..3b86f5b57491 100755 --- a/tools/common/create-makefile-fragment.sh +++ b/tools/common/create-makefile-fragment.sh @@ -34,7 +34,11 @@ if test -z "$FRAGMENT_PATH"; then fi if test -z "$BUILD_EXECUTABLE"; then - BUILD_EXECUTABLE=msbuild + if test -z "$DOTNET"; then + echo "The DOTNET environment variable isn't set to the location of the 'dotnet' executable" + exit 1 + fi + BUILD_EXECUTABLE="$DOTNET build" fi if test -z "$BUILD_VERBOSITY"; then 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/Makefile b/tools/devops/Makefile index 74771d5c78d6..873bc40bfc4b 100644 --- a/tools/devops/Makefile +++ b/tools/devops/Makefile @@ -1,44 +1,13 @@ TOP=../.. include $(TOP)/Make.config -device-tests-provisioning.csx: device-tests-provisioning.csx.in Makefile $(TOP)/Make.config - $(Q_GEN) sed \ - -e 's#@XCODE_XIP_NAME@#$(notdir $(XCODE_URL))#g' \ - -e 's#@MONO_PACKAGE@#$(MIN_MONO_URL)#g' \ - -e 's#@MIN_SHARPIE_URL@#$(MIN_SHARPIE_URL)#g' \ - -e 's#@INCLUDE_MAC@#$(INCLUDE_MAC)#g' \ - -e 's#@INCLUDE_IOS@#$(INCLUDE_IOS)#g' \ - -e 's#@INCLUDE_TVOS@#$(INCLUDE_TVOS)#g' \ - -e 's#@INCLUDE_WATCH@#$(INCLUDE_WATCH)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ - -build-provisioning.csx: build-provisioning.csx.in Makefile $(TOP)/Make.config +provision-shared.csx: provision-shared.in.csx Makefile $(TOP)/Make.config $(Q_GEN) sed \ -e 's#@XCODE_XIP_NAME@#$(notdir $(XCODE_URL))#g' \ + -e 's#@XCODE_ROOT_PATH@#$(XCODE_DEVELOPER_ROOT)#g' \ -e 's#@MONO_PACKAGE@#$(MIN_MONO_URL)#g' \ -e 's#@MIN_SHARPIE_URL@#$(MIN_SHARPIE_URL)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ - -mac-tests-provisioning.csx: mac-tests-provisioning.csx.in Makefile $(TOP)/Make.config - $(Q_GEN) sed \ - -e 's#@MONO_PACKAGE@#$(MIN_MONO_URL)#g' \ - -e 's#@INCLUDE_MAC@#$(INCLUDE_MAC)#g' \ - -e 's#@INCLUDE_IOS@#$(INCLUDE_IOS)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ - -provision-xcode.csx: provision-xcode.csx.in Makefile $(TOP)/Make.config - $(Q_GEN) sed \ - -e 's#@XCODE_XIP_NAME@#$(notdir $(XCODE_URL))#g' \ - -e 's#@XCODE_ROOT_PATH@#$(XCODE_DEVELOPER_ROOT)#g' \ - $< > $@; - @echo "Generated $@:" - @cat $@ + $< > $@ LocProject.json: LocProject.json.in Makefile $(TOP)/Make.config $(Q_GEN) sed \ @@ -65,4 +34,4 @@ print-variable: print-variable-value-to-file: @echo $($(VARIABLE)) > "$(FILE)" -provisioning: build-provisioning.csx device-tests-provisioning.csx provision-xcode.csx +provisioning: provision-shared.csx diff --git a/tools/devops/automation/build-cronjob.yml b/tools/devops/automation/build-cronjob.yml index ab229beac9fb..a632e6b367b7 100644 --- a/tools/devops/automation/build-cronjob.yml +++ b/tools/devops/automation/build-cronjob.yml @@ -16,7 +16,7 @@ parameters: default: false variables: -- template: templates/variables.yml +- template: templates/variables/common.yml - name: MaciosUploadPrefix value: '' @@ -44,12 +44,6 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - trigger: - main diff --git a/tools/devops/automation/build-lego.yml b/tools/devops/automation/build-lego.yml index 4c52d4df3ae8..206cd16e14eb 100644 --- a/tools/devops/automation/build-lego.yml +++ b/tools/devops/automation/build-lego.yml @@ -12,9 +12,7 @@ parameters: default: true variables: -- template: templates/variables.yml -- name: MaciosUploadPrefix - value: '' +- template: templates/variables/common.yml resources: repositories: @@ -40,12 +38,6 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - trigger: branches: include: diff --git a/tools/devops/automation/build-pipeline.yml b/tools/devops/automation/build-pipeline.yml index a7d0d72d8484..19aebaec5301 100644 --- a/tools/devops/automation/build-pipeline.yml +++ b/tools/devops/automation/build-pipeline.yml @@ -35,11 +35,6 @@ parameters: type: boolean default: false - - name: skipESRP - displayName: Skip ESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - - name: pushNugets type: boolean displayName: 'Push Nugets (dotnet)' @@ -155,12 +150,6 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - - repository: CustomPipelineTemplates type: git name: 1ESPipelineTemplates/MicroBuildTemplate @@ -169,11 +158,11 @@ variables: - ${{ if contains(variables['Build.DefinitionName'], 'private') }}: - template: templates/vsts-variables.yml - template: templates/common/vs-release-vars.yml@sdk-insertions - - template: templates/variables.yml + - template: templates/variables/common.yml + - template: templates/variables/api-scan.yml + - template: templates/variables/signing.yml - name: MicrobuildConnector value: 'MicroBuild Signing Task (DevDiv)' - - name: MaciosUploadPrefix - value: '' - name: DisablePipelineConfigDetector value: true @@ -231,7 +220,6 @@ extends: exclude: - repository: yaml-templates - repository: sdk-insertions - - repository: release-scripts stages: - template: templates/main-stage.yml parameters: @@ -242,14 +230,9 @@ extends: pool: ${{ parameters.pool }} runGovernanceTests: ${{ parameters.runGovernanceTests }} forceInsertion: ${{ parameters.forceInsertion }} - skipESRP: ${{ parameters.skipESRP }} pushNugets: ${{ parameters.pushNugets }} pushNugetsToMaestro: ${{ parameters.pushNugetsToMaestro }} ${{ if ne(length(parameters.testConfigurations), 0)}}: testConfigurations: ${{ parameters.testConfigurations }} deviceTestsConfigurations: ${{ parameters.deviceTestsConfigurations }} macTestsConfigurations: ${{ parameters.macTestsConfigurations }} - signingSetupSteps: - - template: ./templates/sign-and-notarized/setup.yml - parameters: - isPR: false diff --git a/tools/devops/automation/build-pull-request.yml b/tools/devops/automation/build-pull-request.yml index 8603fec56c9a..ec6c90b03844 100644 --- a/tools/devops/automation/build-pull-request.yml +++ b/tools/devops/automation/build-pull-request.yml @@ -36,11 +36,6 @@ parameters: type: boolean default: false -- name: skipESRP - displayName: Skip ESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - - name: testConfigurations displayName: Test configurations to run type: object @@ -146,23 +141,14 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - - repository: CustomPipelineTemplates type: git name: 1ESPipelineTemplates/MicroBuildTemplate variables: -- template: templates/variables.yml +- template: templates/variables/common.yml +- template: templates/variables/api-scan.yml - template: templates/common/vs-release-vars.yml@sdk-insertions -- name: MicrobuildConnector - value: '' -- name: MaciosUploadPrefix - value: '' - name: Packaging.EnableSBOMSigning value: false @@ -219,7 +205,6 @@ extends: exclude: - repository: yaml-templates - repository: sdk-insertions - - repository: release-scripts stages: - template: templates/main-stage.yml parameters: @@ -230,14 +215,9 @@ extends: pool: ${{ parameters.pool }} runGovernanceTests: ${{ parameters.runGovernanceTests }} forceInsertion: ${{ parameters.forceInsertion }} - skipESRP: ${{ parameters.skipESRP }} pushNugets: false pushNugetsToMaestro: false ${{ if ne(length(parameters.testConfigurations), 0)}}: testConfigurations: ${{ parameters.testConfigurations }} deviceTestsConfigurations: ${{ parameters.deviceTestsConfigurations }} macTestsConfigurations: ${{ parameters.macTestsConfigurations }} - signingSetupSteps: - - template: ./templates/sign-and-notarized/setup.yml - parameters: - isPR: true diff --git a/tools/devops/automation/publish-pr-html-results.yml b/tools/devops/automation/publish-pr-html-results.yml index fd58eddcaf96..623a08c408c3 100644 --- a/tools/devops/automation/publish-pr-html-results.yml +++ b/tools/devops/automation/publish-pr-html-results.yml @@ -29,12 +29,6 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - - repository: macios.ci type: github name: xamarin/macios.ci diff --git a/tools/devops/automation/run-post-ci-build-api-scan.yml b/tools/devops/automation/run-post-ci-build-api-scan.yml new file mode 100644 index 000000000000..c95684af0b41 --- /dev/null +++ b/tools/devops/automation/run-post-ci-build-api-scan.yml @@ -0,0 +1,17 @@ +# pipeline to run after a ci build that will execute the apiscan and other governance tests +trigger: none +pr: none + +# we cannot use a template in a pipeline context +resources: + pipelines: + - pipeline: macios + source: \Xamarin\Mac-iOS\ci pipelines\xamarin-macios-ci + trigger: + stages: + - build_packages + +extends: + template: templates/pipelines/run-api-scan.yml + parameters: + isPR: false diff --git a/tools/devops/automation/run-post-ci-build-macos-tests.yml b/tools/devops/automation/run-post-ci-build-macos-tests.yml index bbdb367de5d7..da312f9e6997 100644 --- a/tools/devops/automation/run-post-ci-build-macos-tests.yml +++ b/tools/devops/automation/run-post-ci-build-macos-tests.yml @@ -9,7 +9,7 @@ pr: none resources: pipelines: - pipeline: macios - source: xamarin-macios-ci + source: \Xamarin\Mac-iOS\ci pipelines\xamarin-macios-ci trigger: stages: - build_macos_tests diff --git a/tools/devops/automation/run-post-ci-build-tests.yml b/tools/devops/automation/run-post-ci-build-tests.yml index 5ffbfa0917f6..af8677d8b4e6 100644 --- a/tools/devops/automation/run-post-ci-build-tests.yml +++ b/tools/devops/automation/run-post-ci-build-tests.yml @@ -4,12 +4,11 @@ trigger: none pr: none - # we cannot use a template in a pipeline context resources: pipelines: - pipeline: macios - source: xamarin-macios-ci + source: \Xamarin\Mac-iOS\ci pipelines\xamarin-macios-ci trigger: stages: - build_packages diff --git a/tools/devops/automation/run-post-ci-build-vs-insertion.yml b/tools/devops/automation/run-post-ci-build-vs-insertion.yml new file mode 100644 index 000000000000..b11f9fda1085 --- /dev/null +++ b/tools/devops/automation/run-post-ci-build-vs-insertion.yml @@ -0,0 +1,87 @@ +# YAML pipeline for post build operations. +# This pipeline will sign the nugets and will prepare them for a release. + +trigger: none +pr: none + +parameters: + + - name: stageDisplayNamePrefix + type: string + default: '' + + - name: repositoryAlias + type: string + default: self + + - name: commit + type: string + default: HEAD + + - name: pushNugets + type: boolean + default: true # default to true until otherwhise + + - name: pushNugetsToMaestro + type: boolean + default: true + +# we cannot use a template in a pipeline context +resources: + pipelines: + - pipeline: macios + source: \Xamarin\Mac-iOS\ci pipelines\xamarin-macios-ci + trigger: + branches: + include: + - main + - release-test/* + - release/* + - net7.0 + - net8.0 + - net9.0 + - net10.0 + - xcode?? + stages: + - build_packages + +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@CustomPipelineTemplates + parameters: + pool: # default pool to be used for validation jobs + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + os: windows + sdl: + baseline: + baselineFile: '$(System.DefaultWorkingDirectory)\\xamarin-macios\\tools\\devops\\governance\\baselines.gdnbaselines' + suppression: + suppressionFile: '$(System.DefaultWorkingDirectory)\\xamarin-macios\\tools\\devops\\governance\\suppress.gdnsuppress' + sourceAnalysisPool: + name: AzurePipelines-EO + image: 1ESPT-Windows2022 + os: windows + tsa: + configFile: '$(System.DefaultWorkingDirectory)\\xamarin-macios\\tools\\devops\\governance\\tsa_config.gdntsa' + sbom: + enabled: false # we run our on sbom generation + credscan: + suppressionsFile: '$(System.DefaultWorkingDirectory)\\xamarin-macios\\tools\\devops\\governance\\CredScanSuppressions.json' + policheck: + exclusionsFile: '$(System.DefaultWorkingDirectory)\\xamarin-macios\\tools\\devops\\governance\\PoliCheckExclusions.xml' + sourceRepositoriesToScan: + runInSingleJob: true # run both maccore and macios in the same job + include: + - repository: maccore + exclude: + - repository: yaml-templates + - repository: sdk-insertions + stages: + - template: templates/release/vs-insertion-prep.yml + parameters: + stageDisplayNamePrefix: ${{ parameters.stageDisplayNamePrefix }} + isPR: false + repositoryAlias: ${{ parameters.repositoryAlias }} + commit: ${{ parameters.commit }} + pushNugets: ${{ parameters.pushNugets }} + pushNugetsToMaestro: ${{ parameters.pushNugetsToMaestro }} diff --git a/tools/devops/automation/run-post-pr-build-api-scan.yml b/tools/devops/automation/run-post-pr-build-api-scan.yml new file mode 100644 index 000000000000..84ebf69d6e44 --- /dev/null +++ b/tools/devops/automation/run-post-pr-build-api-scan.yml @@ -0,0 +1,18 @@ +# pipeline to run after a PR build that will execute the apiscan and other governance tests +trigger: none +pr: none + +# we cannot use a template in a pipeline context +resources: + pipelines: + - pipeline: macios + source: \Xamarin\Mac-iOS\pr pipelines\xamarin-macios-pr + trigger: + stages: + - build_packages + +extends: + template: templates/pipelines/run-api-scan.yml + parameters: + isPR: true + diff --git a/tools/devops/automation/run-post-pr-build-macos-tests.yml b/tools/devops/automation/run-post-pr-build-macos-tests.yml index e324fe5d8b3e..fdda5ca9e088 100644 --- a/tools/devops/automation/run-post-pr-build-macos-tests.yml +++ b/tools/devops/automation/run-post-pr-build-macos-tests.yml @@ -8,7 +8,7 @@ pr: none resources: pipelines: - pipeline: macios - source: xamarin-macios-pr + source: \Xamarin\Mac-iOS\pr pipelines\xamarin-macios-pr trigger: stages: - build_macos_tests diff --git a/tools/devops/automation/run-post-pr-build-tests.yml b/tools/devops/automation/run-post-pr-build-tests.yml index 45a676699994..16bdd59d45bd 100644 --- a/tools/devops/automation/run-post-pr-build-tests.yml +++ b/tools/devops/automation/run-post-pr-build-tests.yml @@ -8,7 +8,7 @@ pr: none resources: pipelines: - pipeline: macios - source: xamarin-macios-pr + source: \Xamarin\Mac-iOS\pr pipelines\xamarin-macios-pr trigger: stages: - build_packages diff --git a/tools/devops/automation/scripts/GitHub.psm1 b/tools/devops/automation/scripts/GitHub.psm1 index db3636044d8c..69774dc33b32 100644 --- a/tools/devops/automation/scripts/GitHub.psm1 +++ b/tools/devops/automation/scripts/GitHub.psm1 @@ -294,7 +294,8 @@ class GitHubComments { } [void] WriteCommentFooter( - [object] $stringBuilder + [object] $stringBuilder, + [string] $commentId ) { $targetUrl = Get-TargetUrl $stringBuilder.AppendLine("[Pipeline]($targetUrl) on Agent $Env:TESTS_BOT") # Env:TESTS_BOT is added by the pipeline as a variable coming from the execute tests job @@ -308,12 +309,20 @@ class GitHubComments { $hashUrl= "https://github.com/$($this.Org)/$($this.Repo)/commit/$($this.Hash)" $hashSource = " [CI build]" } - $ciComment = "[comment]: <> (This is a comment added by Azure DevOps)" + $ciComment = $this.GetCommentIdentifier($commentId) $stringBuilder.AppendLine("Hash: [$($this.Hash)]($hashUrl) $hashSource") $stringBuilder.AppendLine("") $stringBuilder.AppendLine($ciComment) } + [string] GetCommentIdentifier([string] $commentId) + { + $sanitizedId = $commentId + $sanitizedId = $sanitizedId.Replace("(","_").Replace(")","_").Replace("[","_").Replace("]","_") + $sanitizedId = $sanitizedId.Replace("{","_").Replace("}","_").Replace("<","_").Replace(">","_") + return "[comment]: <> (This is a comment added by Azure DevOps, id: $sanitizedId)" + } + [string] GetCommentUrl() { # if the build was due to PR, we want to write the comment in the PR rather than in the commit if ([GitHubComments]::IsPR()) { @@ -360,11 +369,46 @@ class GitHubComments { return $request } + [void] HideComments( + [string] $commentId + ) { + if (!$commentId) { + Write-Host "Not hiding comments, because no comment id provided" + return + } + + if (![GitHubComments]::IsPR()) { + Write-Host "Not hiding comments, because we're not in a pull request" + return + } + + $prId = "$Env:BUILD_SOURCEBRANCH".Replace("refs/pull/", "").Replace("/merge", "") + $prComments = $this.GetCommentsForPR($prId) + + $botComments = [System.Collections.ArrayList]@() + $commentToHide = $this.GetCommentIdentifier($commentId) + + foreach ($c in $prComments) { + if ($c.Author -eq "vs-mobiletools-engineering-service2") { + if ($c.Body.Contains($CommentToHide)) { + $botComments.Add($c) + } + } + } + + Write-Host "Hiding $($botComments.Count) comments for PR #$prId with comment id '$commentId'" + + $this.MinimizeComments($botComments) + } + [object] NewCommentFromObject( [string] $commentTitle, [string] $commentEmoji, - [object] $commentObject + [object] $commentObject, + [string] $commentId ) { + $this.HideComments($commentId) + # build the message, which will be sent to github, users can use markdown $msg = [System.Text.StringBuilder]::new() @@ -376,7 +420,7 @@ class GitHubComments { $msg.AppendLine() # footer - $this.WriteCommentFooter($msg) + $this.WriteCommentFooter($msg, $commentId) return $this.NewComment($msg) } @@ -384,8 +428,11 @@ class GitHubComments { [object] NewCommentFromFile( [string] $commentTitle, [string] $commentEmoji, - [string] $filePath + [string] $filePath, + [string] $commentId ) { + $this.HideComments($commentId) + # build the message, which will be sent to github, users can use markdown $msg = [System.Text.StringBuilder]::new() @@ -404,7 +451,7 @@ class GitHubComments { $msg.AppendLine() # footer - $this.WriteCommentFooter($msg) + $this.WriteCommentFooter($msg, $commentId) return $this.NewComment($msg) } @@ -412,8 +459,11 @@ class GitHubComments { [object] NewCommentFromMessage( [string] $commentTitle, [string] $commentEmoji, - [string] $content + [string] $content, + [string] $commentId ) { + $this.HideComments($commentId) + $msg = [System.Text.StringBuilder]::new() # header @@ -424,7 +474,7 @@ class GitHubComments { $msg.AppendLine() # footer - $this.WriteCommentFooter($msg) + $this.WriteCommentFooter($msg, $commentId) return $this.NewComment($msg) } diff --git a/tools/devops/automation/scripts/System.psm1 b/tools/devops/automation/scripts/System.psm1 index f8dd87b35b70..d9bad3e0258c 100644 --- a/tools/devops/automation/scripts/System.psm1 +++ b/tools/devops/automation/scripts/System.psm1 @@ -207,22 +207,82 @@ function Clear-AfterTests { <# .SYNOPSIS - Checks if there is enough space in the HD + Get the remaining space in the HD (in GB) #> -function Test-HDFreeSpace { +function Get-HDFreeSpace { + $drive = Get-PSDrive "/" + return $drive.Free / 1GB +} + +<# + .SYNOPSIS + Asserts that the HD has he specified number of GB left, if will: + + * Add a GitHub comment. + * File an AzureDevOps issue. + * Throw an exception + + (all of these will be done) +#> +function Assert-HDFreeSpace { param ( [Parameter(Mandatory)] [int] $Size ) - $drive = Get-PSDrive "/" - return $drive.Free / 1GB -gt $Size + + $space = Get-HDFreeSpace + if ($space -gt $Size) { + Write-Host "This machine has plenty of space, $Size GB are required, and there's $space GB free space left." + return + } + + $space = Get-HDFreeSpace + $shortMessage = "Not enough free space in the host $Env:AGENT_MACHINENAME, need $Size GB, has $space GB." + + Write-Host $shortMessage + try { + Write-Host "Adding GitHub comment..." + New-GitHubComment -Header "Tests failed catastrophically on $Env:CONTEXT" -Emoji ":fire:" -Description "$shortMessage" + } catch { + Write-Host "Failed to post GitHub comment: $_" + } + + Write-Host "" + + $stepUrl = "$Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$Env:SYSTEM_TEAMPROJECT/_build/results?buildId=$Env:BUILD_BUILDID&view=logs&j=$Env:SYSTEM_JOBID&t=$Env:SYSTEM_TASKINSTANCEID" + $workItemTitle = "[CI] Bot '$Env:AGENT_MACHINENAME' out of disk space" + $workItemMessage = @" +
    The bot $Env:AGENT_MACHINENAME does not have enough hard disk space left.
    +

    +
    The bot has $space GB left (needs $Size GB).
    +

    +
    See: $stepUrl for more logs.
    +"@ + + Write-Host "Creating new DevOps issue..." + try { + $workItemId = Find-AzureDevOpsWorkItemWithTitle -Title $workItemTitle + if ($workItemId -gt 0) { + # there's already an existing work item open for this bot + Write-Host "There's already an existing issue for this bot, so just adding a comment to the existing issue $workItemId instead..." + $issueUrl = New-AzureDevOpsWorkItemComment -WorkItemId $workItemId -Comment $workItemMessage + } else { + $issueUrl = New-AzureDevOpsWorkItem -Title $workItemTitle -Message $workItemMessage + } + Write-Host "Completed, DevOps issue: $issueUrl" + } catch { + Write-Host "Failed to create work item: $_" + } + + throw [System.InvalidOperationException]::new("$shortMessage") } # module exports, any other functions are private and should not be used outside the module Export-ModuleMember -Function Get-SystemInfo Export-ModuleMember -Function Clear-XamarinProcesses -Export-ModuleMember -Function Test-HDFreeSpace +Export-ModuleMember -Function Get-HDFreeSpace +Export-ModuleMember -Function Assert-HDFreeSpace Export-ModuleMember -Function Clear-AfterTests Export-ModuleMember -Function Remove-InstalledSimulators diff --git a/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 b/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 index 8e4cbd27a126..bf39d03e9f78 100644 --- a/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 +++ b/tools/devops/automation/scripts/TestConfiguration.Tests.ps1 @@ -5,9 +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' { BeforeAll { $TestConfigurations = @" @@ -154,15 +151,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 +194,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 +219,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 +307,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..f36860ae7b89 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-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-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-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-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-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-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..10e51bd062d2 100644 --- a/tools/devops/automation/scripts/VSTS.psm1 +++ b/tools/devops/automation/scripts/VSTS.psm1 @@ -447,11 +447,6 @@ class BuildConfiguration { $this.StoreParentBuildVariables($configuration) - # store if dotnet has been enabled - $variableName = "ENABLE_DOTNET" - $variableValue = [Environment]::GetEnvironmentVariable($variableName) - $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue - # For each .NET platform we support, add a INCLUDE_DOTNET_ variable specifying whether that platform is enabled or not. $dotnetPlatforms = $configuration.DOTNET_PLATFORMS.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) foreach ($platform in $dotnetPlatforms) { @@ -483,24 +478,7 @@ class BuildConfiguration { } } - # store all the variables needed when classic xamarin has been enabled - $configuration | Add-Member -NotePropertyName "INCLUDE_XAMARIN_LEGACY" -NotePropertyValue $Env:INCLUDE_XAMARIN_LEGACY - - # 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") - if ($configuration.INCLUDE_XAMARIN_LEGACY -eq "true") { - foreach ($platform in $xamarinPlatforms) { - $variableName = "INCLUDE_LEGACY_$($platform.ToUpper())" - $variableValue = [Environment]::GetEnvironmentVariable("$variableName") - $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue $variableValue - } - } else { - foreach ($platform in $xamarinPlatforms) { - $variableName = "INCLUDE_LEGACY_$($platform.ToUpper())" - $configuration | Add-Member -NotePropertyName $variableName -NotePropertyValue "false" - } - } + $xamarinPlatforms = @("ios", "macos", "tvos", "maccatalyst") # add all the include platforms as well as the nuget os version foreach ($platform in $xamarinPlatforms) { @@ -886,7 +864,155 @@ function Edit-BuildConfiguration { return $buildConfiguration.Update($ConfigKey, $ConfigValue, $ConfigFile) } +function Find-AzureDevOpsWorkItemWithTitle { + param + ( + [Parameter(Mandatory)] + [string] + $Title, + + [string] + $WorkItemType = 'Bug', + + [string] + $AreaPath = 'DevDiv\VS Client - Runtime SDKs\iOS and Mac' + ) + + $headers = Get-AuthHeader -AccessToken $Env:ACCESSTOKEN + + $url = "$Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$Env:SYSTEM_TEAMPROJECT/_apis/wit/wiql?api-version=7.1" + $escapedTitle = $Title.Replace("'", "''") + $payload = @{ + "query" = "Select [System.Id] FROM WorkItems WHERE [System.State] = 'Active' AND [System.Title] = '$escapedTitle' AND [System.WorkItemType] = '$WorkItemType' AND [System.AreaPath] UNDER '$AreaPath'" + } + $body = ConvertTo-Json $payload -Depth 100 + + try { + Write-Host "Uri: $url" + Write-Host "Body:" + $body | Out-String | Write-Host + + $response = Invoke-RestMethod -Uri $url -Headers $headers -Method "POST" -ContentType 'application/json' -Body $body + + Write-Host "Response:" + $response | Out-String | Write-Host + + $itemCount = $response.workItems.count + if ($itemCount -eq 0) { + Write-Host "No work items found with the given criteria" + return 0 + } + + $workItemId = $response.workItems[0].id + Write-Host "Found $itemCount work items with the given criteria, returning id: $workItemId" + return $workItemId + } catch { + Write-Host "Failed to find work item: $_" + } + return 0 +} + +function New-AzureDevOpsWorkItem { + param + ( + [Parameter(Mandatory)] + [string] + $Message, + + [Parameter(Mandatory)] + [string] + $Title, + + [string] + $WorkItemType = 'Bug', + + [string] + $AreaPath = 'DevDiv\VS Client - Runtime SDKs\iOS and Mac' + ) + + $headers = Get-AuthHeader -AccessToken $Env:ACCESSTOKEN + + $payload = @( + @{ + "op" = "add" + "path" = "/fields/System.Title" + "from" = $null + "value" = $Title + } + @{ + "op" = "add" + "path" = "/fields/System.AreaPath" + "from" = $null + "value" = $AreaPath + } + @{ + "op" = "add" + "path" = "/fields/Microsoft.VSTS.TCM.ReproSteps" + "from" = $null + "value" = $Message + } + ) + + $body = ConvertTo-Json $payload -Depth 100 + + $url = "$Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$Env:SYSTEM_TEAMPROJECT/_apis/wit/workitems/`$$($WorkItemType)?api-version=7.1" + try { + Write-Host "Creating DevOps $WorkItemType with Title=$Title and AreaPath=$AreaPath" + Write-Host "Uri: $url" + Write-Host "Body:" + $body | Out-String | Write-Host + $response = Invoke-RestMethod -Uri $url -Headers $headers -Method "POST" -ContentType 'application/json-patch+json' -Body $body + Write-Host "Response = $response" + $workItemId = $response.id + $workItemUrl = "$Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$Env:SYSTEM_TEAMPROJECT/_workitems/edit/$workItemId" + Write-Host "Work Item Url: $workItemUrl" + return $workItemUrl + } catch { + Write-Host "Failed to create work item:" + $_ | Out-String | Write-Host + return "" + } +} + +function New-AzureDevOpsWorkItemComment { + param + ( + [Parameter(Mandatory)] + [int] + $WorkItemId, + + [Parameter(Mandatory)] + [string] + $Comment + ) + + $headers = Get-AuthHeader -AccessToken $Env:ACCESSTOKEN + $payload = + @{ + "text" = $Comment + } + + $body = ConvertTo-Json $payload -Depth 100 + + $url = "$Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$Env:SYSTEM_TEAMPROJECT/_apis/wit/workItems/$WorkItemId/comments?api-version=7.1-preview.4" + try { + Write-Host "Uri: $url" + Write-Host "Headers:" + $headers + Write-Host "Body:" + $body + $response = Invoke-RestMethod -Uri $url -Headers $headers -Method "POST" -ContentType 'application/json' -Body $body + Write-Host "Response:" + $response + $workItemUrl = "$Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$Env:SYSTEM_TEAMPROJECT/_workitems/edit/$workItemId" + return $workItemUrl + } catch { + Write-Host "Failed to add comment to work item:" + $_ | Out-String | Write-Host + return "" + } +} # export public functions, other functions are private and should not be used ouside the module. Export-ModuleMember -Function Stop-Pipeline Export-ModuleMember -Function Set-PipelineResult @@ -896,3 +1022,7 @@ Export-ModuleMember -Function New-BuildConfiguration Export-ModuleMember -Function Import-BuildConfiguration Export-ModuleMember -Function Edit-BuildConfiguration Export-ModuleMember -Function Get-YamlPreview +Export-ModuleMember -Function New-AzureDevOpsWorkItem +Export-ModuleMember -Function New-AzureDevOpsWorkItemComment +Export-ModuleMember -Function Find-AzureDevOpsWorkItemWithTitle + diff --git a/tools/devops/automation/scripts/bash/build-nugets.sh b/tools/devops/automation/scripts/bash/build-nugets.sh index 8f469722b4dd..b133aa2da864 100755 --- a/tools/devops/automation/scripts/bash/build-nugets.sh +++ b/tools/devops/automation/scripts/bash/build-nugets.sh @@ -10,8 +10,8 @@ cd "$XAM_TOP" DOTNET_NUPKG_DIR=$(make -C tools/devops print-abspath-variable VARIABLE=DOTNET_NUPKG_DIR | grep "^DOTNET_NUPKG_DIR=" | sed -e 's/^DOTNET_NUPKG_DIR=//') +rm -rf ../package/ mkdir -p ../package/ -rm -f ../package/*.nupkg cp -c "$DOTNET_NUPKG_DIR"/*.nupkg ../package/ cp -c "$DOTNET_NUPKG_DIR"/vs-workload.props ../package/ cp -c dotnet/Workloads/SignList.xml ../package/ diff --git a/tools/devops/automation/scripts/bash/clean-bot.sh b/tools/devops/automation/scripts/bash/clean-bot.sh index 923d353c1a8d..07e0adc41bb7 100755 --- a/tools/devops/automation/scripts/bash/clean-bot.sh +++ b/tools/devops/automation/scripts/bash/clean-bot.sh @@ -12,6 +12,31 @@ df -h # We don't care about errors in this section, we just want to clean as much as possible set +e +# Clean workspace +( + for repo in "$SYSTEM_DEFAULTWORKINGDIRECTORY"/.git "$SYSTEM_DEFAULTWORKINGDIRECTORY"/*/.git; do + if test -d "$repo"; then + cd "$repo" + cd .. + echo "Running 'git clean' (for all submodules too) in $(pwd)" + git clean -xffd | sed 's/^/ /' || true + git submodule foreach --recursive git clean -xffd | sed 's/^/ /' || true + else + echo "$repo is not a git repository" + fi + done + + echo "Cleaning packages directory:" + rm -rv "$SYSTEM_DEFAULTWORKINGDIRECTORY/packages" | sed 's/^/ /' || true + + echo "Contents of SYSTEM_DEFAULTWORKINGDIRECTORY ($SYSTEM_DEFAULTWORKINGDIRECTORY):" + # shellcheck disable=SC2012 + ls -la "$SYSTEM_DEFAULTWORKINGDIRECTORY" | sed 's/^/ /' || true + echo "Contents of BUILD_SOURCESDIRECTORY ($BUILD_SOURCESDIRECTORY):" + # shellcheck disable=SC2012 + ls -la "$BUILD_SOURCESDIRECTORY" | sed 's/^/ /' || true +) + # Delete all the simulator devices. These can take up a lot of space over time (I've seen 100+GB on the bots) /Applications/Xcode.app/Contents/Developer/usr/bin/simctl delete all @@ -118,7 +143,9 @@ XCODE_SELECT=$(xcode-select -p) for oldXcode in "${oldXcodes[@]}"; do if [ "$XCODE_SELECT" != "$oldXcode/Contents/Developer" ]; then - sudo rm -Rf "$oldXcode" + if test -d "$oldXcode"; then + sudo rm -Rf "$oldXcode" + fi else echo "Not removing $oldXcode because is the currently selected one." fi @@ -126,6 +153,13 @@ done DIR="$(dirname "${BASH_SOURCE[0]}")" "$DIR"/clean-simulator-runtime.sh +"$DIR"/kill-deadlocked-processes.sh + +# Remove legacy Xamarin/MonoTouch stuff +sudo rm -Rf /Developer/MonoTouch +sudo rm -Rf /Library/Frameworks/Xamarin.iOS.framework +sudo rm -Rf /Library/Frameworks/Xamarin.Mac.framework +ls -R /Library/Frameworks # Print disk status after cleaning df -h diff --git a/tools/devops/automation/scripts/bash/clean-results-dir.sh b/tools/devops/automation/scripts/bash/clean-results-dir.sh deleted file mode 100755 index 3e1aa2dfb4e1..000000000000 --- a/tools/devops/automation/scripts/bash/clean-results-dir.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -ex - -rm -Rvf package -time make -C xamarin-macios/ git-clean-all diff --git a/tools/devops/automation/scripts/bash/clean-simulator-runtime.sh b/tools/devops/automation/scripts/bash/clean-simulator-runtime.sh index ed23cf1193c2..3e55e489fd3d 100755 --- a/tools/devops/automation/scripts/bash/clean-simulator-runtime.sh +++ b/tools/devops/automation/scripts/bash/clean-simulator-runtime.sh @@ -5,6 +5,18 @@ set -o pipefail IFS=$'\n\t' +# delete all watchOS simulators, we don't need them anymore +for i in $(xcrun simctl runtime list | grep "watchOS.*Ready" | sed -e 's/.* - //' -e 's/ .*//'); do + xcrun simctl runtime delete "$i" +done + +# delete all simulators not used in the last 90 days +echo "Checking if there are any old runtimes to delete:" +xcrun simctl runtime delete --notUsedSinceDays 90 --dry-run | sed 's/^/ /' +echo "Deleting..." +xcrun simctl runtime delete --notUsedSinceDays 90| sed 's/^/ /' +echo "Delete completed." + xcrun simctl runtime list -j > simruntime.json cat simruntime.json diff --git a/tools/devops/automation/scripts/bash/configure-decisions.sh b/tools/devops/automation/scripts/bash/configure-decisions.sh index 9100784e1965..669cbc6d3f15 100755 --- a/tools/devops/automation/scripts/bash/configure-decisions.sh +++ b/tools/devops/automation/scripts/bash/configure-decisions.sh @@ -26,9 +26,6 @@ elif [[ "${LABELS_SKIP_ALL_TESTS:-}" == "True" ]]; then elif [[ "${CONFIGURE_PLATFORMS_INCLUDE_DOTNET_MACOS:-}" != "" ]]; then # Run mac tests if a .NET desktop platform is enabled RUN_MAC_TESTS=true -elif [[ "${CONFIGURE_PLATFORMS_INCLUDE_LEGACY_MAC:-}" != "" ]]; then - # Run mac tests if a legacy desktop platform is enabled - RUN_MAC_TESTS=true else # Otherwise don't run mac tests RUN_MAC_TESTS=false diff --git a/tools/devops/automation/scripts/bash/configure-platforms.sh b/tools/devops/automation/scripts/bash/configure-platforms.sh index 2613227e3e80..f4aa55b06e63 100755 --- a/tools/devops/automation/scripts/bash/configure-platforms.sh +++ b/tools/devops/automation/scripts/bash/configure-platforms.sh @@ -13,22 +13,12 @@ DOTNET_PLATFORMS=$(cat "$FILE") make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=ALL_DOTNET_PLATFORMS ALL_DOTNET_PLATFORMS=$(cat "$FILE") -make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=ENABLE_DOTNET -ENABLE_DOTNET=$(cat "$FILE") - - -make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=INCLUDE_XAMARIN_LEGACY -INCLUDE_XAMARIN_LEGACY=$(cat "$FILE") - make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=INCLUDE_IOS 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") @@ -50,7 +40,6 @@ MACCATALYST_NUGET_OS_VERSION=$(cat "$FILE") # print it out, so turn off echoing since that confuses Azure DevOps set +x -echo "##vso[task.setvariable variable=ENABLE_DOTNET;isOutput=true]$ENABLE_DOTNET" echo "##vso[task.setvariable variable=DOTNET_PLATFORMS;isOutput=true]$DOTNET_PLATFORMS" DISABLED_DOTNET_PLATFORMS=" $ALL_DOTNET_PLATFORMS " for platform in $DOTNET_PLATFORMS; do @@ -91,22 +80,8 @@ for platform in $DISABLED_DOTNET_PLATFORMS; do echo "##vso[task.setvariable variable=INCLUDE_DOTNET_$PLATFORM_UPPER;isOutput=true]" done -echo "##vso[task.setvariable variable=INCLUDE_XAMARIN_LEGACY;isOutput=true]$INCLUDE_XAMARIN_LEGACY" -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/bash/delete-library-dirs.sh b/tools/devops/automation/scripts/bash/delete-library-dirs.sh deleted file mode 100755 index 3c647824f72b..000000000000 --- a/tools/devops/automation/scripts/bash/delete-library-dirs.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -ex - -sudo rm -Rf /Developer/MonoTouch -sudo rm -Rf /Library/Frameworks/Xamarin.iOS.framework -sudo rm -Rf /Library/Frameworks/Xamarin.Mac.framework -ls -R /Library/Frameworks diff --git a/tools/devops/automation/scripts/bash/export-mono-filenames.sh b/tools/devops/automation/scripts/bash/export-mono-filenames.sh deleted file mode 100755 index ac0fe56c31f1..000000000000 --- a/tools/devops/automation/scripts/bash/export-mono-filenames.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -eu - -env | sort - -set -o pipefail -IFS=$'\n\t ' - -FILE=$(pwd)/tmp.txt - -make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=MONO_IOS_FILENAME -MONO_IOS_FILENAME=$(cat "$FILE") -MONO_IOS_FILENAME=$(basename "$MONO_IOS_FILENAME" ".7z") - -make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=MONO_MAC_FILENAME -MONO_MAC_FILENAME=$(cat "$FILE") -MONO_MAC_FILENAME=$(basename "$MONO_MAC_FILENAME" ".7z") - -make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable-value-to-file FILE="$FILE" VARIABLE=MONO_MACCATALYST_FILENAME -MONO_MACCATALYST_FILENAME=$(cat "$FILE") -MONO_MACCATALYST_FILENAME=$(basename "$MONO_MACCATALYST_FILENAME" ".7z") - -# allow the rest of the build use the values -echo "##vso[task.setvariable variable=MONO_IOS_FILENAME;]$MONO_IOS_FILENAME" -echo "##vso[task.setvariable variable=MONO_MAC_FILENAME;]$MONO_MAC_FILENAME" -echo "##vso[task.setvariable variable=MONO_MACCATALYST_FILENAME;]$MONO_MACCATALYST_FILENAME" - -rm -f "$FILE" diff --git a/tools/devops/automation/scripts/bash/install-workloads.sh b/tools/devops/automation/scripts/bash/install-workloads.sh index c3249512f4df..4ee3436bba9e 100755 --- a/tools/devops/automation/scripts/bash/install-workloads.sh +++ b/tools/devops/automation/scripts/bash/install-workloads.sh @@ -42,15 +42,6 @@ make global.json make -C builds dotnet -# Check if .NET is even enabled -# Note that we do this after downloading .NET, because we need .NET to build some of our tests that may contain legacy tests (such as the MSBuild tests). -var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable VARIABLE=ENABLE_DOTNET) -ENABLE_DOTNET=${var#*=} -if test -z "$ENABLE_DOTNET"; then - echo "Not installing anything, because .NET is not enabled." - exit 0 -fi - var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable VARIABLE=DOTNET) DOTNET=${var#*=} echo "Using dotnet found at $DOTNET" diff --git a/tools/devops/automation/scripts/bash/kill-deadlocked-processes.sh b/tools/devops/automation/scripts/bash/kill-deadlocked-processes.sh new file mode 100755 index 000000000000..7610d51a7200 --- /dev/null +++ b/tools/devops/automation/scripts/bash/kill-deadlocked-processes.sh @@ -0,0 +1,27 @@ +#!/bin/bash -e + +echo "Looking for processes that have been stuck for more than a day, and will try to kill them." + +# Collect the list of processes for the current user, including the CPU time. +# We then split the CPU time into separate fields, so that it's easier to figure out the total number of minutes later on. +IFS=$'\n' +PROCESSES=() +while IFS='' read -r line; do PROCESSES+=("$line"); done < <(ps -o cputime=,pid=,user=,lstart=,args= -U "$USER" -w -w -w | sed -e 's/\([0-9]*\):\([0-9][0-9]\)\.\([0-9][0-9]\)/\1 m \2 s \3 ms/' | sort -nr) + +IFS=' ' +for process in "${PROCESSES[@]}"; do + IFS=" " read -r -a FIELDS <<< "$process" + minutes=${FIELDS[0]} + pid=${FIELDS[6]} + + echo "$process" + + # looking for processes that have spent more than a day using the CPU (24h * 60min = 1440min) + if (( minutes > 1440 )); then + echo " This process has been stuck for more than $minutes minutes, so assuming it's deadlocked and we'll try to kill it:" + echo " kill -9 $pid" + kill -9 "$pid" | sed 's/^/ /' || true + fi +done + +echo "No (more) processes stuck for more than a day." 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/clean_past_comments.ps1 b/tools/devops/automation/scripts/clean_past_comments.ps1 deleted file mode 100644 index c24e1be430ce..000000000000 --- a/tools/devops/automation/scripts/clean_past_comments.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -param -( - - [Parameter(Mandatory)] - [String] - $GithubToken, - - [Parameter(Mandatory)] - [String] - $RepositoryUri, - - [Parameter(Mandatory)] - [String] - $SourceBranch, - - [Parameter(Mandatory)] - [String] - $CommentToHide -) - -Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1 - -$comments = New-GitHubCommentsObjectFromUrl -Url "$RepositoryUri" -Token $GithubToken - -$prId = "$SourceBranch".Replace("refs/pull/", "").Replace("/merge", "") -$prComments = $comments.GetCommentsForPR($prId) - -$botComments = [System.Collections.ArrayList]@() -foreach ($c in $prComments) { - if ($c.Author -eq "vs-mobiletools-engineering-service2") { - if ($c.Body.Contains($CommentToHide)) { - $botComments.Add($c) - } - } -} -$comments.MinimizeComments($botComments) diff --git a/tools/devops/automation/scripts/notarize.ps1 b/tools/devops/automation/scripts/notarize.ps1 deleted file mode 100644 index cd507cbf1740..000000000000 --- a/tools/devops/automation/scripts/notarize.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -$summaryPath = "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tests/TestSummary.md" -try { - # Notarize - & "$Env:BUILD_SOURCESDIRECTORY/release-scripts/notarize.ps1" -FolderForApps $Env:BUILD_SOURCESDIRECTORY/package/notarized - - # Verify that the notarized output is valid - $notarizedRoot = Join-Path $Env:BUILD_SOURCESDIRECTORY package notarized - Get-ChildItem -Path $notarizedRoot -Filter *.pkg -Recurse -File | ForEach-Object { - Write-Debug "pkgutil --check-signature $($_.FullName)" - pkgutil --check-signature "$($_.FullName)" - if ($LastExitCode -eq 0) { - Write-Debug "Signature check of $($_.FullName) succeeded." - } else { - Write-Debug "Signature check of $($_.FullName) failed (exit code: $LastExitCode)." - throw "Signature check of $($_.FullName) failed (exit code: $LastExitCode)." - } - } -} catch { - Add-Content -Path $summaryPath -Value "# :x: Notarization (ESRP) failed :x:`n`n```````n$PSItem`n```````n" - throw -} 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/scripts/run-generator-tests-on-windows.ps1 b/tools/devops/automation/scripts/run-generator-tests-on-windows.ps1 index 493b3026c0c2..a59e58043535 100644 --- a/tools/devops/automation/scripts/run-generator-tests-on-windows.ps1 +++ b/tools/devops/automation/scripts/run-generator-tests-on-windows.ps1 @@ -1,5 +1,5 @@ # Dump the environment to see what we're working with. -& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\show_env.ps1" +& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY\$($Env:BUILD_REPOSITORY_NAME.Split('/')[1])\tools\devops\automation\scripts\show_bot_info.ps1" # Set a few variables $Env:DOTNET = "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe" diff --git a/tools/devops/automation/scripts/run-local-windows-tests.ps1 b/tools/devops/automation/scripts/run-local-windows-tests.ps1 new file mode 100644 index 000000000000..092b60b1253a --- /dev/null +++ b/tools/devops/automation/scripts/run-local-windows-tests.ps1 @@ -0,0 +1,20 @@ +if ("$Env:DOTNET" -eq "") { + $Env:DOTNET = "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe" + $Env:PATH = "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet;$Env:PATH" +} + +$Env:ServerAddress = "" +$Env:ServerUser = "" +$Env:ServerPassword = "" + +& $Env:DOTNET ` + test ` + "$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/tests/dotnet/UnitTests/DotNetUnitTests.csproj" ` + --filter Category=Windows ` + --verbosity quiet ` + --settings $Env:BUILD_SOURCESDIRECTORY/xamarin-macios/tests/dotnet/Windows/config.runsettings ` + "--results-directory:$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/jenkins-results/windows-remote-tests/" ` + "--logger:console;verbosity=detailed" ` + "--logger:trx;LogFileName=$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/jenkins-results/windows-local-dotnet-tests.trx" ` + "--logger:html;LogFileName=$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/jenkins-results/windows-local-dotnet-tests.html" ` + "-bl:$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/tests/dotnet/Windows/windows-local-dotnet-tests.binlog" diff --git a/tools/devops/automation/scripts/run-remote-windows-tests.ps1 b/tools/devops/automation/scripts/run-remote-windows-tests.ps1 index e90cc2457028..9905812dbe68 100644 --- a/tools/devops/automation/scripts/run-remote-windows-tests.ps1 +++ b/tools/devops/automation/scripts/run-remote-windows-tests.ps1 @@ -1,4 +1,7 @@ -$Env:DOTNET = "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe" +if ("$Env:DOTNET" -eq "") { + $Env:DOTNET = "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe" +} + $Env:ServerAddress = $Env:MAC_AGENT_IP $Env:ServerUser = $Env:MAC_AGENT_USER $Env:ServerPassword = $Env:XMA_PASSWORD diff --git a/tools/devops/automation/scripts/run_mac_tests.ps1 b/tools/devops/automation/scripts/run_mac_tests.ps1 index 67011801bd5c..ff459df5ae15 100644 --- a/tools/devops/automation/scripts/run_mac_tests.ps1 +++ b/tools/devops/automation/scripts/run_mac_tests.ps1 @@ -36,7 +36,7 @@ dir env: # Claim that the tests timed out before we start Set-Content -Path "$GithubFailureCommentFile" -Value "Tests timed out" -$macTest = @("dontlink", "introspection", "linksdk", "linkall", "xammac_tests", "monotouch-test") +$macTest = @("dontlink", "introspection", "linksdk", "linkall", "monotouch-test") foreach ($t in $macTest) { $testName = "exec-$t" Write-Host "Execution test $testName" diff --git a/tools/devops/automation/scripts/show_bot_info.ps1 b/tools/devops/automation/scripts/show_bot_info.ps1 new file mode 100644 index 000000000000..0369422be80e --- /dev/null +++ b/tools/devops/automation/scripts/show_bot_info.ps1 @@ -0,0 +1,49 @@ +Write-Host "IsMacOS: ${IsMacOS}" +Write-Host "IsWindows: ${IsWindows}" +Write-Host "IsLinux: ${IsLinux}" + +if ($IsMacOS -or $IsLinux) { + Write-Host "HOSTNAME: $(hostname)" +} else { + Write-Host "COMPUTERNAME: ${env:COMPUTERNAME}" +} + +Get-ChildItem env: | Sort-Object -Property Name | Format-Table -AutoSize | Out-String -Width 81920 + +if ($IsMacOS) { + Write-Host "" + Write-Host "## Uptime" + Write-Host "" + uptime + + Write-Host "" + Write-Host "## System profile" + Write-Host "" + system_profiler SPSoftwareDataType SPHardwareDataType SPDeveloperToolsDataType + + Write-Host "" + Write-Host "## Network configuration" + Write-Host "" + ifconfig | grep 'inet ' + + Write-Host "" + Write-Host "## Top processes (ps)" + Write-Host "" + ps aux + + Write-Host "" + Write-Host "## Python3 location:" + Write-Host "" + which python3 + + Write-Host "" + Write-Host "## Pip3 version:" + Write-Host "" + pip3 -V + + Write-Host "" + Write-Host "## Hardware info" + Write-Host "" + ioreg -l | grep -e Manufacturer -e 'Vendor Name' +} + diff --git a/tools/devops/automation/scripts/show_env.ps1 b/tools/devops/automation/scripts/show_env.ps1 deleted file mode 100644 index 2a265dd21563..000000000000 --- a/tools/devops/automation/scripts/show_env.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -Write-Host "IsMacOS: ${IsMacOS}" -Write-Host "IsWindows: ${IsWindows}" -Write-Host "IsLinux: ${IsLinux}" - -if ($IsMacOS -or $IsLinux) { - Write-Host "HOSTNAME: $(hostname)" -} else { - Write-Host "COMPUTERNAME: ${env:COMPUTERNAME}" -} - -gci env: | format-table -autosize - -gci env: | format-table -autosize | Out-String -Width 8192 - -gci env: | format-table -autosize -wrap - -if ($IsMacOS) { - system_profiler SPSoftwareDataType SPHardwareDataType SPDeveloperToolsDataType -} - diff --git a/tools/devops/automation/scripts/show_python_env.ps1 b/tools/devops/automation/scripts/show_python_env.ps1 deleted file mode 100644 index 79873375cf32..000000000000 --- a/tools/devops/automation/scripts/show_python_env.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -Write-Host "Python3 location" -which python3 - -Write-Host "Pip3 version" -pip3 -V - diff --git a/tools/devops/automation/scripts/undo_github_merge.ps1 b/tools/devops/automation/scripts/undo_github_merge.ps1 index 32befd505352..15f83a063936 100644 --- a/tools/devops/automation/scripts/undo_github_merge.ps1 +++ b/tools/devops/automation/scripts/undo_github_merge.ps1 @@ -11,8 +11,11 @@ param if($IsPr.ToLower() -eq "true") { Write-Host "Working on a PR, Undoing the github merge with main." - git config remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' - git fetch origin + $refspec="+refs/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*:refs/remotes/origin/pull/$Env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER/*" + + Write-Host "Refspec: $refspec" + + git fetch origin --no-tags "$refspec" $branch="$SourceBranch".Replace("merge", "head") $branch=$branch.Replace("refs", "origin") diff --git a/tools/devops/automation/templates/api-diff-stage.yml b/tools/devops/automation/templates/api-diff-stage.yml index 081a1f58e172..295e018dd15d 100644 --- a/tools/devops/automation/templates/api-diff-stage.yml +++ b/tools/devops/automation/templates/api-diff-stage.yml @@ -33,18 +33,6 @@ parameters: stages: -- ${{ if parameters.isPR }}: - - stage: clean - displayName: 'Clean up' - dependsOn: [] - jobs: - - job: - displayName: 'Clean comments' - pool: - vmImage: windows-latest - steps: - - template: ./common/clean.yml - - stage: configure_build displayName: 'Configure' jobs: @@ -79,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-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true use1ES: false diff --git a/tools/devops/automation/templates/build/api-diff-process-results.yml b/tools/devops/automation/templates/build/api-diff-process-results.yml index a73bcb9e572f..4d3f74c10c27 100644 --- a/tools/devops/automation/templates/build/api-diff-process-results.yml +++ b/tools/devops/automation/templates/build/api-diff-process-results.yml @@ -27,8 +27,8 @@ steps: repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} - - pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' + - pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' + displayName: 'Show Bot Info' - pwsh: | if (Test-Path "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/Artifacts" -PathType Container) { @@ -84,7 +84,7 @@ steps: $converted = $inputContents + "`n`nUnable to convert markdown: $_`n`n" } $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH - $result = $githubComments.NewCommentFromMessage("", "", $converted) + $result = $githubComments.NewCommentFromMessage("", "", $converted, "api diff") displayName: 'Publish GitHub comment for change detection' timeoutInMinutes: 10 continueOnError: true # don't let any failures here stop us diff --git a/tools/devops/automation/templates/build/build-mac-tests-stage.yml b/tools/devops/automation/templates/build/build-mac-tests-stage.yml index b365553f4a5d..1d3310e3dfe8 100644 --- a/tools/devops/automation/templates/build/build-mac-tests-stage.yml +++ b/tools/devops/automation/templates/build/build-mac-tests-stage.yml @@ -42,8 +42,6 @@ jobs: timeoutInMinutes: 180 variables: DOTNET_PLATFORMS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.DOTNET_PLATFORMS'] ] - ENABLE_DOTNET: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'] ] - INCLUDE_XAMARIN_LEGACY: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_XAMARIN_LEGACY'] ] ${{ if eq(parameters.pool, 'automatic') }}: AgentPoolComputed: $[ stageDependencies.configure_build.AgentPoolSelector.outputs['setAgentPool.AgentPoolComputed'] ] ${{ if eq(parameters.pool, 'ci') }}: diff --git a/tools/devops/automation/templates/build/build-pkgs.yml b/tools/devops/automation/templates/build/build-pkgs.yml index b37b7d06ca8b..2492c247d458 100644 --- a/tools/devops/automation/templates/build/build-pkgs.yml +++ b/tools/devops/automation/templates/build/build-pkgs.yml @@ -20,10 +20,6 @@ parameters: type: boolean default: true - - name: skipESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - - name: isPR type: boolean @@ -50,22 +46,10 @@ steps: gitHubToken: ${{ parameters.gitHubToken }} xqaCertPass: ${{ parameters.xqaCertPass }} buildSteps: - # build not signed .pkgs for the SDK - - bash: | - set -x - set -e - rm -Rf $(Build.SourcesDirectory)/package/*.pkg - rm -Rf $(Build.SourcesDirectory)/package/notarized/*.pkg - time make -C $(Build.SourcesDirectory)/xamarin-macios/ package - name: packages - displayName: 'Build Packages' - condition: and(succeeded(), contains(variables['configuration.BuildPkgs'], 'True')) - timeoutInMinutes: 180 - # build nugets - bash: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/build-nugets.sh displayName: 'Build Nugets' - condition: and(succeeded(), contains(variables['configuration.BuildNugets'], 'True'), ne(variables['ENABLE_DOTNET'], '')) + condition: and(succeeded(), contains(variables['configuration.BuildNugets'], 'True')) timeoutInMinutes: 180 - bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/generate-workload-rollback.sh @@ -79,34 +63,6 @@ steps: artifact: '${{ parameters.uploadPrefix }}WorkloadRollback' continueOnError: true - - bash: | - var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=IOS_PACKAGE_VERSION) - IOS_PACKAGE_VERSION=${var#*=} - IOS_PACKAGE_VERSION=$(echo $IOS_PACKAGE_VERSION | cut -d "+" -f1) - - var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=MAC_PACKAGE_VERSION) - MAC_PACKAGE_VERSION=${var#*=} - MAC_PACKAGE_VERSION=$(echo $MAC_PACKAGE_VERSION | cut -d "+" -f1) - - PKG_DST="$(Build.SourcesDirectory)/PkgsVersions.json" - - echo "{" > $PKG_DST - echo "\"iOS\": \"$IOS_PACKAGE_VERSION\"," >> $PKG_DST - echo "\"macOS\": \"$MAC_PACKAGE_VERSION\"" >> $PKG_DST - echo "}" >> $PKG_DST - - echo "PkgVersions.json file contents:" - echo "$(cat $PKG_DST)" - name: pkg_versions_file - displayName: 'Generate PkgsVersions.json' - - - task: 1ES.PublishPipelineArtifact@1 - displayName: 'Publish PkgsVersions.json' - inputs: - path: $(Build.SourcesDirectory)/PkgsVersions.json - artifact: '${{ parameters.uploadPrefix }}PkgsVersions' - continueOnError: true - # upload each of the pkgs into the pipeline artifacts - task: 1ES.PublishPipelineArtifact@1 displayName: 'Publish Build Artifacts' diff --git a/tools/devops/automation/templates/build/build-stage.yml b/tools/devops/automation/templates/build/build-stage.yml index 950196987a92..2cf94db56128 100644 --- a/tools/devops/automation/templates/build/build-stage.yml +++ b/tools/devops/automation/templates/build/build-stage.yml @@ -14,10 +14,6 @@ parameters: - name: xqaCertPass type: string - - name: skipESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - - name: pool type: string default: automatic @@ -46,16 +42,10 @@ jobs: timeoutInMinutes: 1000 variables: DOTNET_PLATFORMS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.DOTNET_PLATFORMS'] ] - ENABLE_DOTNET: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'] ] INCLUDE_DOTNET_IOS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_DOTNET_IOS'] ] INCLUDE_DOTNET_MACCATALYST: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_DOTNET_MACCATALYST'] ] INCLUDE_DOTNET_MACOS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_DOTNET_MACOS'] ] INCLUDE_DOTNET_TVOS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_DOTNET_TVOS'] ] - INCLUDE_LEGACY_IOS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_LEGACY_IOS'] ] - INCLUDE_LEGACY_MAC: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_LEGACY_MAC'] ] - INCLUDE_LEGACY_TVOS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_LEGACY_TVOS'] ] - INCLUDE_LEGACY_WATCH: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_LEGACY_WATCH'] ] - INCLUDE_XAMARIN_LEGACY: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_XAMARIN_LEGACY'] ] ${{ if eq(parameters.pool, 'automatic') }}: AgentPoolComputed: $[ stageDependencies.configure_build.AgentPoolSelector.outputs['setAgentPool.AgentPoolComputed'] ] ${{ if eq(parameters.pool, 'ci') }}: @@ -97,4 +87,3 @@ jobs: keyringPass: ${{ parameters.keyringPass }} gitHubToken: ${{ parameters.gitHubToken }} xqaCertPass: ${{ parameters.xqaCertPass }} - skipESRP: ${{ parameters.skipESRP }} diff --git a/tools/devops/automation/templates/build/build.yml b/tools/devops/automation/templates/build/build.yml index 7838afd4894c..5bac994abb82 100644 --- a/tools/devops/automation/templates/build/build.yml +++ b/tools/devops/automation/templates/build/build.yml @@ -64,18 +64,8 @@ steps: MacDeveloper: $(mac-developer) HostedMacKeychainPassword: ${{ parameters.keyringPass }} - - task: xamops.azdevex.provisionator-task.provisionator@2 - displayName: 'Provision Brew components' - inputs: - provisioning_script: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/provision-brew-packages.csx - provisioning_extra_args: '-vvvv' - github_token: ${{ parameters.gitHubToken }} - timeoutInMinutes: 30 - enabled: true - continueOnError: true # brew installation can be temperamental, and things usually work even if the installation fail. - - bash: | - make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops build-provisioning.csx + make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops provisioning displayName: 'Generate provisionator files.' - task: xamops.azdevex.provisionator-task.provisionator@2 @@ -167,20 +157,6 @@ steps: rm -rf ~/Library/Caches/com.apple.dt.Xcode displayName: 'Clear Xcode cache' - # downloding mono takes time and has been shown to be problematic when we have network issues. This is why we - # are using the cache. Mono does not get bump a lot of times if any (after dotnet) - - - bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/export-mono-filenames.sh - displayName: "Export mono download filenames" - workingDirectory: "$(Build.SourcesDirectory)/xamarin-macios" - timeoutInMinutes: 5 - - - task: Cache@2 - displayName: 'Cache iOS Mono download' - inputs: - key: "$(MONO_IOS_FILENAME)" - path: "$(Build.SourcesDirectory)/xamarin-macios/builds/downloads/$(MONO_IOS_FILENAME)" - # Actual build of the project - bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/build-macios.sh name: build @@ -205,7 +181,7 @@ steps: - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH - $githubComments.NewCommentFromMessage("Build failed", ":fire:", "Build failed for the job '$(System.JobDisplayName)'") + $githubComments.NewCommentFromMessage("Build failed", ":fire:", "Build failed for the job '$(System.JobDisplayName)'", "build") condition: failed() displayName: 'Report build failure' env: diff --git a/tools/devops/automation/templates/common/checkout.yml b/tools/devops/automation/templates/common/checkout.yml index 6996389bff39..9213d39fd26c 100644 --- a/tools/devops/automation/templates/common/checkout.yml +++ b/tools/devops/automation/templates/common/checkout.yml @@ -21,6 +21,7 @@ steps: clean: true submodules: recursive path: s/xamarin-macios + fetchTags: false - pwsh: ./undo_github_merge.ps1 -SourceBranch "$(Build.SourceBranch)" -IsPr "${{ parameters.isPR }}" name: fix_commit @@ -32,12 +33,11 @@ steps: clean: true fetchDepth: 0 persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail + fetchTags: false - checkout: yaml-templates clean: true - -- checkout: release-scripts - clean: true + fetchTags: false - pwsh: ./clean_git_vsts.ps1 -GithubToken "$(GitHub.Token)" -MaccorePath "$(System.DefaultWorkingDirectory)/maccore" displayName: 'Clean git mess from VSTS' diff --git a/tools/devops/automation/templates/common/clean.yml b/tools/devops/automation/templates/common/clean.yml deleted file mode 100644 index ea5849595778..000000000000 --- a/tools/devops/automation/templates/common/clean.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Perform gihub cleaning steps - -parameters: -- name: commentToHide - type: string - default: '[comment]: <> (This is a comment added by Azure DevOps)' - -- name: checkoutCode - type: boolean - default: true - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -steps: - -- ${{ if parameters.checkoutCode }}: - - template: checkout.yml - parameters: - isPR: false # always use the latests version of the script - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - -- pwsh: >- - ./clean_past_comments.ps1 - -GithubToken "$(GitHub.Token)" - -RepositoryUri "$(Build.Repository.Uri)" - -SourceBranch "$(Build.SourceBranch)" - -CommentToHide "${{ parameters.commentToHide }}" - displayName: Clear past comments - workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts diff --git a/tools/devops/automation/templates/common/configure.yml b/tools/devops/automation/templates/common/configure.yml index e909e535fe88..c30328ef600c 100644 --- a/tools/devops/automation/templates/common/configure.yml +++ b/tools/devops/automation/templates/common/configure.yml @@ -65,8 +65,8 @@ steps: name: decisions displayName: 'Make decisions' -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' +- pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' + displayName: 'Show Bot Info' - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1 diff --git a/tools/devops/automation/templates/common/load_configuration.yml b/tools/devops/automation/templates/common/load_configuration.yml index 5ecac652b11f..536cad18268f 100644 --- a/tools/devops/automation/templates/common/load_configuration.yml +++ b/tools/devops/automation/templates/common/load_configuration.yml @@ -75,8 +75,8 @@ steps: name: decisions displayName: 'Make decisions' - - pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' + - pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' + displayName: 'Show Bot Info' - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/xamarin-macios/tools/devops/automation/scripts/MaciosCI.psd1 diff --git a/tools/devops/automation/templates/common/setup.yml b/tools/devops/automation/templates/common/setup.yml index 91df3be177c1..e059f8df1ca6 100644 --- a/tools/devops/automation/templates/common/setup.yml +++ b/tools/devops/automation/templates/common/setup.yml @@ -17,30 +17,14 @@ steps: - bash: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/fix-github-ssh-key.sh displayName: 'Fix GitHub SSH host key' -- bash: cd $(System.DefaultWorkingDirectory)/xamarin-macios/ && git clean -xdf - displayName: 'Clean workspace' +- 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)/xamarin-macios/tools/devops/automation/scripts/bash/clean-bot.sh +- bash: '$SYSTEM_DEFAULTWORKINGDIRECTORY/${BUILD_REPOSITORY_NAME/#*\//}/tools/devops/automation/scripts/bash/clean-bot.sh' displayName: 'Clean bot' continueOnError: true timeoutInMinutes: 60 -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' - -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_python_env.ps1 - displayName: 'Show Python information' - -- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/delete-library-dirs.sh - displayName: 'Delete library folders' - timeoutInMinutes: 5 - -- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/clean-results-dir.sh - workingDirectory: $(System.DefaultWorkingDirectory) - displayName: 'Clear results directory' - timeoutInMinutes: 5 - continueOnError: true - - bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/remove-ui-prompt.sh env: OSX_KEYCHAIN_PASS: ${{ parameters.keyringPass }} @@ -58,3 +42,7 @@ steps: displayName: 'Set Jenkins variables' env: BRANCH_NAME: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ] + +# Write MSBuild logs into the jenkins-results directory, so they're uploaded after test runs. +- pwsh: Write-Host "##vso[task.setvariable variable=MSBUILDDEBUGPATH]$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$Env:BUILD_REPOSITORY_TITLE/jenkins-results/MSBuildCrashLogs" + displayName: 'Set MSBuild crash log directory' diff --git a/tools/devops/automation/templates/governance/apiscan.yml b/tools/devops/automation/templates/governance/apiscan.yml index 9c241139abba..b154cd6aed62 100644 --- a/tools/devops/automation/templates/governance/apiscan.yml +++ b/tools/devops/automation/templates/governance/apiscan.yml @@ -15,6 +15,10 @@ parameters: type: string default: '$(MaciosUploadPrefix)' +- name: use1ES + type: boolean + default: true + steps: - template: ../common/checkout.yml @@ -23,12 +27,32 @@ steps: repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} -- task: DownloadPipelineArtifact@2 - displayName: Download artifacts - inputs: - artifactName: not-signed-package - allowFailedBuilds: true - path: $(Build.SourcesDirectory)/not-signed-package +- ${{ if or(contains(variables['Build.Reason'], 'ResourceTrigger'), contains(variables['Build.Reason'], 'BuildCompletion')) }}: + - download: macios + displayName: Download artifacts + artifact: not-signed-package + + # When we download an artifact from a resource pipeline, the download task places the artifact under $(Pipeline.Workspace)/$(pipeline-ref)/artifact + # in our case, it will be "$(Pipeline.Workspace)/macios/not-signed-package". Becuase this stage was originally part of the build, all the scripts + # assume that the location of the nugets is "$(Build.SourcesDirectory)/not-signed-package" already unzipped in a flat dir. This pwsh script does + # the move and flattering of the files. + - pwsh: | + $source = "$(Pipeline.Workspace)/macios/not-signed-package" + $destination = "$(Build.SourcesDirectory)/not-signed-package" + New-Item -ItemType Directory -Force -Path $destination + Write-Host "Moving content from $source to $destination" + # move all the files from the source to the destination + Get-ChildItem -Path $source -Recurse -File | Move-Item -Destination $destination + displayName: Move artifacts to the expected location + +- ${{ else }}: + + - task: DownloadPipelineArtifact@2 + displayName: Download artifacts + inputs: + artifactName: not-signed-package + allowFailedBuilds: true + path: $(Build.SourcesDirectory)/not-signed-package - pwsh: >- ./prepare_workload_apiscan.ps1 @@ -51,6 +75,7 @@ steps: preserveLogsFolder: true env: AzureServicesAuthConnectionString: RunAs=App;AppId=$(CLIENT_ID) + SYSTEM_ACCESSTOKEN: $(System.AccessToken) - task: PublishSecurityAnalysisLogs@3 displayName: Publish Security Analysis Logs @@ -88,9 +113,17 @@ steps: GdnBreakOutputSuppressionFile: $(Build.ArtifactStagingDirectory)\GuardianSuppressions\falsepositives.gdnsuppress GdnBreakOutputSuppressionSet: falsepositives -- task: 1ES.PublishPipelineArtifact@1 - displayName: Publish Artifact for Guardian Supressions - inputs: - path: $(Build.ArtifactStagingDirectory)\GuardianSuppressions - artifact: Guardian Suppressions APIScan $(PLATFORM) $(VERSION) - condition: failed() +- ${{ if eq(parameters.use1ES, true) }}: + - task: 1ES.PublishPipelineArtifact@1 + displayName: Publish Artifact for Guardian Supressions + inputs: + path: $(Build.ArtifactStagingDirectory)\GuardianSuppressions + artifact: Guardian Suppressions APIScan $(PLATFORM) $(VERSION) + condition: failed() +- ${{ else }}: + - task: PublishPipelineArtifact@1 + displayName: Publish Artifact for Guardian Supressions + inputs: + targetPath: $(Build.ArtifactStagingDirectory)\GuardianSuppressions + artifactName: Guardian Suppressions APIScan $(PLATFORM) $(VERSION) + condition: failed() diff --git a/tools/devops/automation/templates/governance/stage.yml b/tools/devops/automation/templates/governance/stage.yml index 1b81ae6ca5d5..10bcf4ac2321 100644 --- a/tools/devops/automation/templates/governance/stage.yml +++ b/tools/devops/automation/templates/governance/stage.yml @@ -16,11 +16,18 @@ parameters: type: string default: '' +- name: dependsOn + type: object + default: [configure_build, build_packages] + +- name: use1ES + type: boolean + default: true stages: - stage: governance_checks displayName: '${{ parameters.stageDisplayNamePrefix }}API Scan' - dependsOn: [ configure_build, build_packages] + dependsOn: ${{ parameters.dependsOn }} jobs: - job: apiscan @@ -40,3 +47,4 @@ stages: isPR: ${{ parameters.isPR }} repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} + use1ES: ${{ parameters.use1ES }} diff --git a/tools/devops/automation/templates/loc-translations.yml b/tools/devops/automation/templates/loc-translations.yml index 58dc6f056b7b..1a6b2ceaf41e 100644 --- a/tools/devops/automation/templates/loc-translations.yml +++ b/tools/devops/automation/templates/loc-translations.yml @@ -24,6 +24,7 @@ steps: clean: true submodules: recursive path: s/xamarin-macios + fetchTags: false - ${{ if parameters.isPR }}: - pwsh: | diff --git a/tools/devops/automation/templates/mac/build.yml b/tools/devops/automation/templates/mac/build.yml index 00e08489a799..adc4dc4b6892 100644 --- a/tools/devops/automation/templates/mac/build.yml +++ b/tools/devops/automation/templates/mac/build.yml @@ -64,18 +64,16 @@ steps: condition: succeededOrFailed() # we do not care about the previous process cleanup continueOnError: true -- bash: cd $(System.DefaultWorkingDirectory)/xamarin-macios/ && git clean -xdf - displayName: 'Clean workspace' - # download the packages that have been created, install them, later download the zip files that contain the already built # tests and execute them. -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' +- pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' + displayName: 'Show Bot Info' -- bash: | - ioreg -l | grep -e Manufacturer -e 'Vendor Name' - displayName: 'Dump Hardware' +- bash: '$SYSTEM_DEFAULTWORKINGDIRECTORY/${BUILD_REPOSITORY_NAME/#*\//}/tools/devops/automation/scripts/bash/clean-bot.sh' + displayName: 'Clean bot' + continueOnError: true + timeoutInMinutes: 60 - bash: | if [[ $(ioreg -l | grep -e 'VMware' | wc -l) -ne 0 ]]; then @@ -95,11 +93,6 @@ steps: displayName: 'Set VM Vendor' -- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/clean-bot.sh - displayName: 'Clean bot' - continueOnError: true - timeoutInMinutes: 60 - # Use a cmdlet to check if the space available in the devices root system is larger than 50 gb. If there is not # enough space available it: # 1. Set the status of the build to error. It is not a failure since no tests have been ran. @@ -107,11 +100,7 @@ steps: # 3. Cancel the pipeline and do not execute any of the following steps. - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 - - if ( -not (Test-HDFreeSpace -Size 5)) { - Set-Content -Path "$GITHUB_FAILURE_COMMENT_FILE" -Value "Not enough free space in the host." - exit 1 - } + Assert-HDFreeSpace -Size 5 env: CONTEXT: ${{ parameters.statusContext }} GITHUB_TOKEN: $(GitHub.Token) @@ -182,6 +171,10 @@ steps: displayName: Install dependencies. timeoutInMinutes: 60 +- task: UseDotNet@2 + inputs: + version: 8.x + - pwsh: >- $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/run_mac_tests.ps1 -GithubToken $(GitHub.Token) @@ -213,10 +206,10 @@ steps: $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH if (Test-Path -Path "$Env:GITHUB_FAILURE_COMMENT_FILE" -PathType Leaf) { - $githubComments.NewCommentFromFile("Tests on macOS ${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE") + $githubComments.NewCommentFromFile("Tests on macOS ${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE", "macOS ${{ parameters.statusContext }}") } else { $message = ":white_check_mark: **All** tests on macOS ${{ parameters.statusContext }} passed." - $githubComments.NewCommentFromMessage("Tests on macOS ${{ parameters.statusContext }} passed", ":computer:", $message) + $githubComments.NewCommentFromMessage("Tests on macOS ${{ parameters.statusContext }} passed", ":computer:", $message, "macOS ${{ parameters.statusContext }}") } displayName: 'Report results to GitHub' timeoutInMinutes: 5 diff --git a/tools/devops/automation/templates/main-stage.yml b/tools/devops/automation/templates/main-stage.yml index 47009cd3be4d..8a4f39f018f9 100644 --- a/tools/devops/automation/templates/main-stage.yml +++ b/tools/devops/automation/templates/main-stage.yml @@ -24,10 +24,6 @@ parameters: type: boolean default: false - - name: skipESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - - name: pushNugets type: boolean default: true # default to true until otherwhise @@ -159,27 +155,6 @@ parameters: - name: macTestsConfigurations type: object - - name: signingSetupSteps - type: stepList - default: [] - - - name: legacyPackageJobs - type: object - default: [ - { - job: 'xamarin_ios_sign_notarize', - name: 'Xamarin.iOS', - pattern: 'xamarin.ios-*', - conditionVariable: "INCLUDE_LEGACY_IOS", - }, - { - job: 'xamarin_mac_sing_notarie', - name: 'Xamarin.Mac', - pattern: 'xamarin.mac-*', - conditionVariable: "INCLUDE_LEGACY_MAC", - } - ] - - name: stageDisplayNamePrefix type: string default: '' @@ -194,29 +169,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 }} - - - ${{ if parameters.isPR }}: - - stage: clean - displayName: '${{ parameters.stageDisplayNamePrefix }}Clean up' - dependsOn: [] - jobs: - - job: - displayName: 'Clean comments' - pool: - name: AzurePipelines-EO - demands: - - ImageOverride -equals 1ESPT-Windows2022 - - steps: - - template: ./common/clean.yml - - stage: configure_build displayName: '${{ parameters.stageDisplayNamePrefix }}Configure' dependsOn: ${{ parameters.dependsOn }} @@ -259,7 +211,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-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true use1ES: true @@ -279,7 +231,6 @@ stages: keyringPass: $(pass--lab--mac--builder--keychain) gitHubToken: $(Github.Token) xqaCertPass: $(xqa--certificates--password) - skipESRP: ${{ parameters.skipESRP }} pool: ${{ parameters.pool }} - stage: build_macos_tests @@ -299,23 +250,6 @@ stages: xqaCertPass: $(xqa--certificates--password) pool: ${{ parameters.pool }} - - stage: prepare_packages_legacy - displayName: '${{ parameters.stageDisplayNamePrefix }}Prepare legacy packages' - condition: and(eq(dependencies.build_packages.result, 'Succeeded'), eq('${{ parameters.enableLegacySigning }}', true)) - dependsOn: - - build_packages - - configure_build - jobs: - - template: ./sign-and-notarized/prepare-pkg-stage.yml - parameters: - isPR: ${{ parameters.isPR }} - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - signingSetupSteps: ${{ parameters.signingSetupSteps }} - keyringPass: $(pass--lab--mac--builder--keychain) - skipESRP: ${{ parameters.skipESRP }} - packages: ${{ parameters.legacyPackageJobs }} - # .NET Release Prep and VS Insertion Stages, only execute them when the build comes from an official branch and is not a schedule build from OneLoc # setting the stage at this level makes the graph of the UI look better, else the lines overlap and is not clear. - ? ${{ if @@ -328,6 +262,7 @@ stages: eq(variables['Build.SourceBranch'], 'refs/heads/net7.0'), eq(variables['Build.SourceBranch'], 'refs/heads/net8.0'), eq(variables['Build.SourceBranch'], 'refs/heads/net9.0'), + eq(variables['Build.SourceBranch'], 'refs/heads/net10.0'), eq(variables['Build.SourceBranch'], 'refs/heads/xcode16'), eq(parameters.forceInsertion, true) ) @@ -343,19 +278,3 @@ stages: commit: ${{ parameters.commit }} pushNugets: ${{ parameters.pushNugets }} pushNugetsToMaestro: ${{ parameters.pushNugetsToMaestro }} - - - stage: funnel - displayName: '${{ parameters.stageDisplayNamePrefix }}Collect signed artifacts' - condition: and(eq(dependencies.prepare_packages_legacy.result, 'Succeeded'), eq('${{ parameters.enableLegacySigning }}', true)) - dependsOn: - - prepare_packages_legacy - - configure_build - jobs: - - template: ./sign-and-notarized/funnel.yml - parameters: - isPR: ${{ parameters.isPR }} - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - packages: # flatten the pkgs for the parameter - - ${{ each pkg in parameters.legacyPackageJobs }}: - - ${{ pkg }} diff --git a/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml b/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml index 0b9e55395b11..7ae6cc065a13 100644 --- a/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml +++ b/tools/devops/automation/templates/pipelines/api-diff-pipeline.yml @@ -50,25 +50,13 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - variables: -- ${{ if eq(parameters.isPR, false) }}: - - ${{ if contains(variables['Build.DefinitionName'], 'private') }}: - - template: ../vsts-variables.yml - - template: ../variables.yml - - name: MaciosUploadPrefix - value: '' - - name: DisablePipelineConfigDetector +- template: ../variables/common.yml +- name: DisablePipelineConfigDetector + ${{ if eq(parameters.isPR, false) }}: value: true -- ${{ else }}: - - template: ../variables.yml - - name: MaciosUploadPrefix - value: '' + ${{ else }}: + value: false stages: - template: ../api-diff-stage.yml diff --git a/tools/devops/automation/templates/pipelines/build-pipeline.yml b/tools/devops/automation/templates/pipelines/build-pipeline.yml index 6b6415af3731..9967da9d5c98 100644 --- a/tools/devops/automation/templates/pipelines/build-pipeline.yml +++ b/tools/devops/automation/templates/pipelines/build-pipeline.yml @@ -37,11 +37,6 @@ parameters: type: boolean default: false -- name: skipESRP - displayName: Skip ESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - - name: pushNugets type: boolean default: true @@ -55,10 +50,6 @@ parameters: type: boolean default: false -- name: signingSetupSteps - type: stepList - default: [] - - name: testConfigurations displayName: Test configurations to run type: object @@ -164,13 +155,6 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - - variables: - ${{ if eq(parameters.isPR, false) }}: - ${{ if contains(variables['Build.DefinitionName'], 'private') }}: @@ -202,7 +186,6 @@ stages: runGovernanceTests: ${{ parameters.runGovernanceTests }} enableAPIDiff: ${{ parameters.enableAPIDiff }} forceInsertion: ${{ parameters.forceInsertion }} - skipESRP: ${{ parameters.skipESRP }} pushNugets: ${{ parameters.pushNugets }} pushNugetsToMaestro: ${{ parameters.pushNugetsToMaestro }} ${{ if ne(length(parameters.testConfigurations), 0)}}: @@ -211,4 +194,3 @@ stages: macTestsConfigurations: ${{ parameters.macTestsConfigurations }} azureStorage: ${{ variables['azureStorage'] }} azureContainer: ${{ variables['azureContainer'] }} - signingSetupSteps: ${{ parameters.signingSetupSteps }} diff --git a/tools/devops/automation/templates/pipelines/run-api-scan.yml b/tools/devops/automation/templates/pipelines/run-api-scan.yml new file mode 100644 index 000000000000..246ee77f4129 --- /dev/null +++ b/tools/devops/automation/templates/pipelines/run-api-scan.yml @@ -0,0 +1,132 @@ +# template that can be extended by pipelines that will be used to run the api-scan tests. This +# allows to share resources and parameters +parameters: + + - name: isPR + displayName: Is PR build + type: boolean + default: false + + - name: pool + type: string + displayName: Bot pool to use + default: automatic + values: + - pr + - ci + - automatic + + - name: testConfigurations + displayName: Test configurations to run + type: object + default: [] + + - name: supportedPlatforms + type: object + default: [ + { + platform: iOS, + isDotNetPlatform: true, + }, + { + platform: macOS, + isDotNetPlatform: true, + }, + { + platform: tvOS, + isDotNetPlatform: true, + }, + { + platform: MacCatalyst, + isDotNetPlatform: true, + }, + { + # when running platform-specific test runs, we also need a special test run that executes tests that only runs when multiple platforms are enabled + platform: Multiple, + isDotNetPlatform: true, + } + ] + + +resources: + repositories: + - repository: self + checkoutOptions: + submodules: true + + - repository: yaml-templates + type: github + name: xamarin/yaml-templates + ref: refs/heads/main + endpoint: xamarin + + - repository: maccore + type: github + name: xamarin/maccore + ref: refs/heads/main + endpoint: xamarin + + - repository: release-scripts + type: github + name: xamarin/release-scripts + ref: refs/heads/only_codesign + endpoint: xamarin + +variables: + - template: ../variables/common.yml + - template: ../variables/api-scan.yml + - ${{ if eq(parameters.isPR, false) }}: + - name: DisablePipelineConfigDetector + value: true + - ${{ else }}: + - name: DisablePipelineConfigDetector + value: false + +stages: + - stage: configure_build + displayName: 'Configure' + jobs: + + - ${{ if eq(parameters.pool, 'automatic') }}: + - job: AgentPoolSelector # https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml + pool: # Consider using an agentless (server) job here, but would need to host selection logic as an Azure function: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#server + vmImage: ubuntu-latest + steps: + - checkout: none # https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout + + # Selects appropriate agent pool based on trigger type (PR or CI); manually triggered builds target the PR pool + - template: azure-devops-pools/agent-pool-selector.yml@yaml-templates + parameters: + agentPoolPR: $(PRBuildPool) + agentPoolPRUrl: $(PRBuildPoolUrl) + agentPoolCI: $(CIBuildPool) + agentPoolCIUrl: $(CIBuildPoolUrl) + + - job: configure + displayName: 'Configure build' + pool: + vmImage: windows-latest + + variables: + isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')] + isScheduled: $[eq(variables['Build.Reason'], 'Schedule')] + BRANCH_NAME: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ] + + steps: + - template: ../common/configure.yml + parameters: + repositoryAlias: self + commit: HEAD + testConfigurations: ${{ parameters.testConfigurations }} + supportedPlatforms: ${{ parameters.supportedPlatforms }} + testsLabels: '--label=skip-all-tests,run-ios-tests,run-ios-simulator-tests,run-tvos-tests,run-mac-tests,run-maccatalyst-tests,run-system-permission-tests' + statusContext: 'VSTS: simulator tests' + uploadArtifacts: true + + - template: ../governance/stage.yml + parameters: + isPR: ${{ parameters.isPR }} + repositoryAlias: self + commit: HEAD + dependsOn: configure_build + use1ES: false 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 1bf2a4b2c6d3..59b1c38fdf2d 100644 --- a/tools/devops/automation/templates/pipelines/run-macos-tests-pipeline.yml +++ b/tools/devops/automation/templates/pipelines/run-macos-tests-pipeline.yml @@ -195,18 +195,8 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - variables: - - ${{ if contains(variables['Build.DefinitionName'], 'private') }}: - - template: ../vsts-variables.yml - - template: ../variables.yml - - name: MaciosUploadPrefix - value: '' + - template: ../variables/common.yml - name: DisablePipelineConfigDetector value: true @@ -248,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-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true diff --git a/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml b/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml index 1fde3871aaa4..d40034d6782f 100644 --- a/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml +++ b/tools/devops/automation/templates/pipelines/run-tests-pipeline.yml @@ -97,18 +97,8 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/only_codesign - endpoint: xamarin - variables: - - ${{ if contains(variables['Build.DefinitionName'], 'private') }}: - - template: ../vsts-variables.yml - - template: ../variables.yml - - name: MaciosUploadPrefix - value: '' + - template: ../variables/common.yml - name: DisablePipelineConfigDetector value: true diff --git a/tools/devops/automation/templates/release/vs-insertion-prep.yml b/tools/devops/automation/templates/release/vs-insertion-prep.yml index a51d2d5f7f5d..7aa7f82c959d 100644 --- a/tools/devops/automation/templates/release/vs-insertion-prep.yml +++ b/tools/devops/automation/templates/release/vs-insertion-prep.yml @@ -61,7 +61,6 @@ stages: artifactName: '${{ parameters.uploadPrefix }}not-signed-package' signType: Real usePipelineArtifactTasks: true - condition: "ne(stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'],'')" setupSteps: - template: tools/devops/automation/templates/common/checkout.yml@${{ parameters.repositoryAlias }} parameters: @@ -84,7 +83,6 @@ stages: propsArtifactName: ${{ parameters.uploadPrefix }}not-signed-package binlogsArtifactName: ${{ parameters.uploadPrefix }}nuget-msi-convert-binlogs signType: Real - condition: "ne(stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'],'')" preConvertSteps: - pwsh: | New-Item "$(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/governance" -ItemType Directory -ea 0 @@ -122,8 +120,7 @@ stages: or( eq(dependencies.nuget_convert.result, 'Succeeded'), eq(dependencies.nuget_convert.result, 'SucceededWithIssues') - ), - ne(stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'],'') + ) ) variables: - name: skipNugetSecurityAnalysis diff --git a/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml b/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml deleted file mode 100644 index ca16f53215e2..000000000000 --- a/tools/devops/automation/templates/sign-and-notarized/artifact-github-comment.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Job that will download the other artifact from the build and will add a comment with the contents. -parameters: - -- name: isPR - type: boolean - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -steps: - -- template: ../common/checkout.yml - parameters: - isPR: ${{ parameters.isPR }} - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - -- template: ../build/download-artifacts.yml - parameters: - runTests: false # we do not run tests on builds - enableAPIDiff: false # we do not run the api diff here. - -- pwsh: | - Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 - $artifact = New-ArtifactsFromJsonFile -Path "$Env:ARTIFACTS_JSON_PATH" - $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH - $result = $gihubComments.NewCommentFromObject("Artifacts", ":books:", $artifact) - Write-Host $result - env: - GITHUB_TOKEN: $(GitHub.Token) - ACCESSTOKEN: $(System.AccessToken) - ${{ if eq(parameters.repositoryAlias, 'self') }}: - COMMENT_HASH: $(GIT_HASH) - ${{ else }}: - COMMENT_HASH: $(Build.SourceVersion) - displayName: 'Create github comment.' - enabled: true - timeoutInMinutes: 10 diff --git a/tools/devops/automation/templates/sign-and-notarized/funnel.yml b/tools/devops/automation/templates/sign-and-notarized/funnel.yml deleted file mode 100644 index 36ed9035e0be..000000000000 --- a/tools/devops/automation/templates/sign-and-notarized/funnel.yml +++ /dev/null @@ -1,193 +0,0 @@ -# funnel job that will download all the signed artifacts and puts them in the final location -parameters: -- name: packages - type: object - -- name: isPR - type: boolean - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -- name: uploadPrefix - type: string - default: '$(MaciosUploadPrefix)' - -jobs: -- job: funnel_job - displayName: 'Collect signed artifacts' - condition: and(not(failed()), not(canceled())) # default is succeded(), but that fails if there are any skipped jobs, so change the condition to !failed && !cancelled - timeoutInMinutes: 1000 - variables: - AgentPoolComputed: $[ stageDependencies.configure_build.AgentPoolSelector.outputs['setAgentPool.AgentPoolComputed'] ] - ${{ each pkg in parameters.packages }}: - ${{ pkg.conditionVariable }}: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.${{ pkg.conditionVariable }}'] ] - - pool: - os: macOS - name: $(AgentPoolComputed) - - steps: - - # DO NOT USE THE checkout.yml template. The reason is that the template changes the hash which results in a problem with the artifacts scripts - - template: sdk-unified/steps/checkout/v1.yml@yaml-templates - parameters: - resource: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - clean: true - submodules: recursive - path: s/xamarin-macios - - - checkout: maccore - clean: true - persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail - - - checkout: yaml-templates - clean: true - - - checkout: release-scripts - clean: true - - - pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' - - - bash: | - sudo rm -Rf $(Build.SourcesDirectory)/package - sudo rm -Rf $(Build.SourcesDirectory)/classic-*-signed - sudo rm -Rf $(Build.SourcesDirectory)/package-internal - displayName: "Remove artifacts" - condition: always() - - - bash: | - mkdir -p $(Build.SourcesDirectory)/package/notarized - displayName: 'Create target directories.' - - - ${{ each pkg in parameters.packages }}: - - task: DownloadPipelineArtifact@2 - displayName: Download notarized build ${{ pkg.name }} - condition: ne('', variables['${{ pkg.conditionVariable }}']) - inputs: - artifact: '${{ parameters.uploadPrefix }}classic-${{ pkg.name }}-signed' - allowFailedBuilds: true - path: '$(Build.ArtifactStagingDirectory)/classic-${{ pkg.name }}-signed' - - - bash: | - set -x - set -e - - FULL_PATH="$(Build.ArtifactStagingDirectory)/classic-${{ pkg.name }}-signed" - ls -lR $FULL_PATH - cp -a "$FULL_PATH/." "$(Build.SourcesDirectory)/package" - displayName: 'Move pkg ${{ pkg.name }} to its final destination' - condition: ne('', variables['${{ pkg.conditionVariable }}']) - - - template: generate-workspace-info.yml@yaml-templates - parameters: - GitHubToken: $(GitHub.Token) - ArtifactDirectory: $(Build.SourcesDirectory)/package-internal - - # download workload json and add it to out package internal dir, this allows the rest of jobs - # not to need several artifacts but just package-internal - - task: DownloadPipelineArtifact@2 - displayName: Download WorkloadRollback.json - inputs: - patterns: '**/WorkloadRollback.json' - allowFailedBuilds: true - path: $(Build.SourcesDirectory)/package-internal - - - task: 1ES.PublishPipelineArtifact@1 - displayName: 'Publish Build Artifacts (notarized)' - inputs: - path: $(Build.SourcesDirectory)/package-internal - artifact: '${{ parameters.uploadPrefix }}package-internal' - continueOnError: true - - # download msbuild.zip and bundle.zip to the 'package' dir, so that they're uploaded into the 'package' artifact, - # since we later depend on these files being there later. - - task: DownloadPipelineArtifact@2 - displayName: Download msbuild.zip and bundle.zip - inputs: - patterns: | - not-signed-package/msbuild.zip - not-signed-package/bundle.zip - allowFailedBuilds: true - path: $(Build.SourcesDirectory)/not-signed-package - - - bash: | - set -x - set -e - ls -la "$BUILD_SOURCESDIRECTORY"/not-signed-package - cp "$BUILD_SOURCESDIRECTORY"/not-signed-package/not-signed-package/*.zip "$BUILD_SOURCESDIRECTORY"/package - ls -la "$BUILD_SOURCESDIRECTORY"/package - displayName: Copy msbuild.zip and bundle.zip to the package artifact - - - task: 1ES.PublishPipelineArtifact@1 - displayName: 'Publish Build Artifacts (notarized)' - inputs: - path: $(Build.SourcesDirectory)/package - artifact: '${{ parameters.uploadPrefix }}package' - continueOnError: true - -# This job uploads the pkgs generated by the build step in the azure blob storage. This has to be done in a different job -# because the azure blob storate tools DO NOT work on mac OS meaning that we need a bot running Windows. build uploads the contents -# to the pipeline artefacts and we download and upload to azure in this job. -- job: upload_azure_blob - displayName: 'Upload packages to Azure & SBOM' - timeoutInMinutes: 1000 - templateContext: # disable some of the sdl tasks for this job - sdl: - credscan: # run in the sdl stage - enabled: false - binskim: # job does not compile anything - enabled: false - eslint: # no js or anything similar - enabled: false - bandit: # we have no python - enabled: false - dependsOn: - - funnel_job - condition: and(not(failed()), not(canceled())) # default is succeded(), but that fails if there are any skipped jobs, so change the condition to !failed && !cancelled - - variables: - Parameters.outputStorageUri: '' - SKIP_NUGETS: $[ stageDependencies.configure_build.configure.outputs['labels.skip_nugets'] ] - INCLUDE_LEGACY_IOS: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_LEGACY_IOS'] ] - INCLUDE_LEGACY_MAC: $[ stageDependencies.configure_build.configure.outputs['configure_platforms.INCLUDE_LEGACY_MAC'] ] - - pool: - name: azurepipelines-EO - demands: - - ImageOverride -equals 1ESPT-Windows2022 - steps: - - template: upload-azure.yml - parameters: - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - sbomFilter: '*.nupkg;*.pkg;*.msi' - -# Job that runs on a vm that downloads the artifacts information and adds a github comment pointing to the results of the build. -- job: artifacts_github_comment - displayName: 'Publish GitHub Comment - Artifacts' - timeoutInMinutes: 1000 - dependsOn: - - upload_azure_blob - condition: succeededOrFailed() - variables: - PR_ID: $[ stageDependencies.configure_build.configure.outputs['labels.pr_number'] ] - TESTS_BOT: $[ stageDependencies.build_packages.build.outputs['build.TESTS_BOT'] ] # we build in a diff bot than the ones used for the comments - GIT_HASH: $[ stageDependencies.build_packages.build.outputs['fix_commit.GIT_HASH'] ] - pool: - name: AzurePipelines-EO - demands: - - ImageOverride -equals 1ESPT-Windows2022 - steps: - - template: artifact-github-comment.yml - parameters: - isPR: ${{ parameters.isPR }} - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} diff --git a/tools/devops/automation/templates/sign-and-notarized/prepare-pkg-stage.yml b/tools/devops/automation/templates/sign-and-notarized/prepare-pkg-stage.yml deleted file mode 100644 index 54c4bf3a98e5..000000000000 --- a/tools/devops/automation/templates/sign-and-notarized/prepare-pkg-stage.yml +++ /dev/null @@ -1,50 +0,0 @@ -parameters: - -- name: keyringPass - type: string - -- name: skipESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - -- name: signingSetupSteps - type: stepList - default: [] - -- name: isPR - type: boolean - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -- name: packages - type: object - default: [] - -jobs: -- ${{ each pkg in parameters.packages }}: - - job: ${{ pkg.job }} - dependsOn: - displayName: 'Sign & Notarize ${{ pkg.name }}' - condition: ne(stageDependencies.configure_build.configure.outputs['configure_platforms.${{ pkg.conditionVariable }}'],'') - timeoutInMinutes: 1000 - pool: - name: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Trusted' # always use the trusted pool for signing. - os: macOS - - steps: - - template: sign-and-notarized.yml - parameters: - isPR: ${{ parameters.isPR }} - repositoryAlias: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - signingSetupSteps: ${{ parameters.signingSetupSteps }} - keyringPass: ${{ parameters.keyringPass }} - skipESRP: ${{ parameters.skipESRP }} - packageName: ${{ pkg.name }} - packagePattern: ${{ pkg.pattern }} diff --git a/tools/devops/automation/templates/sign-and-notarized/setup.yml b/tools/devops/automation/templates/sign-and-notarized/setup.yml deleted file mode 100644 index b6c212bf4f7a..000000000000 --- a/tools/devops/automation/templates/sign-and-notarized/setup.yml +++ /dev/null @@ -1,77 +0,0 @@ -# template that setups all the diff plugins needed to perform the sign and notarize step -parameters: - -- name: signatureType - type: string - default: 'Real' - -- name: isPR - type: boolean - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -- name: condition - default: succeeded() - -steps: - -# DO NOT USE THE checkout.yml template. The reason is that the template changes the hash which results in a problem with the artifacts scripts -- template: sdk-unified/steps/checkout/v1.yml@yaml-templates - parameters: - resource: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - clean: true - submodules: recursive - path: s/xamarin-macios - -- checkout: maccore - clean: true - persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail - -- checkout: yaml-templates - clean: true - -- checkout: release-scripts - clean: true - -# the ddsign plugin needs this version or it will crash and will make the sign step fail - -- ${{ if eq(parameters.isPR, false) }}: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.11.x' - - - task: UseDotNet@2 - inputs: - packageType: sdk - version: 3.x - displayName: 'Install .NET Core SDK 3.x needed for ESRP' - - - pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' - - - task: MicroBuildSigningPlugin@4 - displayName: 'Install Signing Plugin' - inputs: - signType: '${{ parameters.signatureType }}' - azureSubscription: $(MicrobuildConnector) - zipSources: false # we do not use the feature and makes the installation to last 10/12 mins instead of < 1 min - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: ${{ parameters.condition }} - - - task: MicroBuildSigningPlugin@4 - displayName: 'Install Notarizing Plugin' - inputs: - signType: 'Real' # test is not present for mac.. - azureSubscription: $(MicrobuildConnector) - zipSources: false # we do not use the feature and makes the installation to last 10/12 mins instead of < 1 min - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - condition: ${{ parameters.condition }} diff --git a/tools/devops/automation/templates/sign-and-notarized/sign-and-notarized.yml b/tools/devops/automation/templates/sign-and-notarized/sign-and-notarized.yml deleted file mode 100644 index d4b403888828..000000000000 --- a/tools/devops/automation/templates/sign-and-notarized/sign-and-notarized.yml +++ /dev/null @@ -1,136 +0,0 @@ -# Provides all the steps to sign and notarize pks and msi -parameters: - -- name: signatureType - type: string - default: 'Real' - -- name: skipESRP - type: boolean - default: false # only to be used when testing the CI and we do not need a signed pkg - -- name: keyringPass - type: string - -- name: packageName - type: string - -- name: packagePattern - type: string - -- name: condition - default: succeeded() - -- name: signingSetupSteps - type: stepList - default: [] - -- name: isPR - type: boolean - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -- name: uploadPrefix - type: string - default: '$(MaciosUploadPrefix)' - -steps: - -- ${{ each step in parameters.signingSetupSteps }}: - - ${{ each pair in step }}: - ${{ pair.key }}: ${{ pair.value }} - -- bash: | - sudo rm -Rf $(Build.SourcesDirectory)/package - displayName: "Remove artifacts" - condition: always() - -- task: DownloadPipelineArtifact@2 - displayName: Download not notarized build - inputs: - artifact: '${{ parameters.uploadPrefix }}not-signed-package' - patterns: ${{ parameters.packagePattern }} - allowFailedBuilds: true - path: $(Build.SourcesDirectory)/package - -- bash: | - set -x - set -e - - PACKAGES=$(find $(Build.SourcesDirectory)/package -type f -name "${{ parameters.packagePattern }}" | xargs basename) - if [ -z "$PACKAGES" ]; then - echo "Packages ${{ parameters.packageName }} not found." - else - PACKAGES_PATH="$(Build.SourcesDirectory)/package/$PACKAGES" - set +x - echo "##vso[task.setvariable variable=PACKAGES;]$PACKAGES_PATH" - echo "${{ parameters.packageName }} package found at $PACKAGES_PATH" - set -x - fi - displayName: 'Retrieve packages to sign' - condition: ${{ parameters.condition }} - timeoutInMinutes: 180 - -- bash: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/disable-codeql-arm64.sh - displayName: 'Disable CodeQL' - name: disableCodeQLOnArm64 - -- ${{ if and(eq(parameters.skipESRP, false), eq(parameters.isPR, false)) }}: - - bash: | - set -exo pipefail - if [[ "$SYSTEM_DEBUG" == "true" ]]; then - export ESRP_TEMP="$WORKING_DIR/esrp" - echo "Temp dir is $ESRP_TEMP" - mkdir -p "$ESRP_TEMP" - fi - - echo "$PACKAGES" | xargs -t python3 $(Build.SourcesDirectory)/release-scripts/esrp_sign.py -vv -c "8025" -d $(Build.SourcesDirectory)/package/notarized -e "$MAC_ENTITLEMENTS" - ls -R $(Build.SourcesDirectory)/package - env: - WORKING_DIR: $(System.DefaultWorkingDirectory) - PRODUCTSIGN_KEYCHAIN_PASSWORD: ${{ parameters.keyringPass }} - MAC_ENTITLEMENTS: $(Build.SourcesDirectory)/xamarin-macios/mac-entitlements.plist - name: notarize - displayName: 'Signing Release Build (ESRP)' - timeoutInMinutes: 180 - condition: ${{ parameters.condition }} - -- ${{ if eq(parameters.isPR, false) }}: - - task: ArchiveFiles@1 - displayName: 'Archive ESRP temp' - inputs: - rootFolder: '$(System.DefaultWorkingDirectory)/esrp' - includeRootFolder: false - archiveFile: '$(Build.ArtifactStagingDirectory)/esrp.zip' - continueOnError: true - condition: ${{ and(eq(parameters.condition, true), eq(variables['System.debug'], 'true')) }} - - # Upload the esrp temp dir - - task: 1ES.PublishPipelineArtifact@1 - displayName: 'Publish Artifact: ESRP temp' - inputs: - path: '$(Build.ArtifactStagingDirectory)/esrp.zip' - artifact: '${{ parameters.uploadPrefix }}ESRP-tmp-${{ parameters.packageName }}' - continueOnError: true - condition: ${{ and(eq(parameters.condition, true), eq(variables['System.debug'], 'true')) }} - -- ${{ if eq(parameters.isPR, false) }}: - - task: PowerShell@2 - inputs: - filePath: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/notarize.ps1 - displayName: 'Notarize & verify packages (ESRP)' - condition: ${{ parameters.condition }} - -# always upload no matter what, since if we are not signing we need the artifact in the pipeline -- task: 1ES.PublishPipelineArtifact@1 - displayName: 'Publish Notarized Classic Artifacts' - inputs: - path: $(Build.SourcesDirectory)/package - artifact: '${{ parameters.uploadPrefix }}classic-${{ parameters.packageName }}-signed' - continueOnError: true diff --git a/tools/devops/automation/templates/sign-and-notarized/upload-azure.yml b/tools/devops/automation/templates/sign-and-notarized/upload-azure.yml deleted file mode 100644 index 24aa23ad50d0..000000000000 --- a/tools/devops/automation/templates/sign-and-notarized/upload-azure.yml +++ /dev/null @@ -1,327 +0,0 @@ -parameters: -- name: sbomFilter - type: string - default: '*' # Supports multiple filters separated by semi-colon such as *.msi;*.nupkg - -- name: repositoryAlias - type: string - default: self - -- name: commit - type: string - default: HEAD - -- name: uploadPrefix - type: string - default: '$(MaciosUploadPrefix)' - -- name: packages - type: object - default: [ - "package", - ] - -steps: -# Do not use the templates/common/checkout.yaml for this job else the azure upload tool will fail because -# it cannot find the correct branch to be used. -- template: sdk-unified/steps/checkout/v1.yml@yaml-templates - parameters: - resource: ${{ parameters.repositoryAlias }} - commit: ${{ parameters.commit }} - clean: true - persistCredentials: true - path: s/xamarin-macios - -- checkout: maccore - clean: true - persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail - -# checkout an extra repo to ensure that we have the same tree structure in the working directory in all pipelines. -# if you delete this checkout the unified pipeline will have issues. -- checkout: yaml-templates - clean: true - -- pwsh: | - if (Test-Path "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/artifacts" -PathType Container) { - Remove-Item -Path "$Env:BUILD_SOURCESDIRECTORY/artifacts" -Force -Recurse - } - displayName: "Remove artifacts" - condition: always() - -# Download the Html Report that was added by the tests job. -- ${{ each pkg in parameters.packages }}: - - task: DownloadPipelineArtifact@2 - displayName: Download packages - inputs: - artifactName: ${{ parameters.uploadPrefix }}${{ pkg }} - allowFailedBuilds: true - path: $(Build.SourcesDirectory)/artifacts/${{ parameters.uploadPrefix }}${{ pkg }} - -- pwsh: | - Get-ChildItem -Path "$(Build.SourcesDirectory)\\artifacts" - displayName: "Show downloaded artifacts" - -- pwsh: | - $DropServiceUrl = "https://devdiv.artifacts.visualstudio.com/DefaultCollection" - $StatusDropUrl = "https://vsdrop.microsoft.com/file/v1" - $BuildShortHash = "$(Build.SourceVersion)".subString(0, 7) - $ProjectPathUrl = "Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$BuildShortHash/$(Build.BuildId)" - $PackagePrefix = "$StatusDropUrl/$ProjectPathUrl/${{ parameters.uploadPrefix }}package" - - Write-Host "##vso[task.setvariable variable=PackagePrefix]$PackagePrefix" - displayName: "Set drop status URL variables" - -- pwsh: | - $files = Get-ChildItem -Path "$(Build.SourcesDirectory)\\artifacts\\${{ parameters.uploadPrefix }}package" -File -Force -Name - $manifestFile = "$(Build.SourcesDirectory)\\artifacts\${{ parameters.uploadPrefix }}package\\manifest" - foreach ($f in $files) { - Add-Content -Path "$manifestFile" -Value "$(PackagePrefix);$f" - } - Add-Content -Path "$manifestFile" -Value "$(PackagePrefix);$artifacts.json" - Add-Content -Path "$manifestFile" -Value "$(PackagePrefix);manifest" - env: - VIRTUAL_PATH: $(Build.SourceBranchName)/$(Build.SourceVersion)/$(Build.BuildId) - displayName: "Build manifest" - -# Important needed for the next step -- template: generate-workspace-info.yml@yaml-templates - parameters: - GitHubToken: $(GitHub.Token) - ArtifactDirectory: $(Build.SourcesDirectory)/${{ parameters.uploadPrefix }}package-internal - -- template: upload-to-drop/v1.yml@yaml-templates - parameters: - SourcesDirectory: $(Build.SourcesDirectory)/xamarin-macios - ArtifactsDirectory: $(Build.SourcesDirectory)/artifacts/${{ parameters.uploadPrefix }}package - Azure.DropPrefix: ${{ parameters.uploadPrefix }}package - GitHub.Context: 'vsts-devdiv artifacts' - -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' - -- pwsh: | - Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\\xamarin-macios\\tools\\devops\\automation\\scripts\\MaciosCI.psd1 - $statuses = New-GitHubStatusesObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) - - Dir "$(Build.SourcesDirectory)\\artifacts\\${{ parameters.uploadPrefix }}package" - - # the azure step sets the env variable, but it points to the wrong url since it uses the one in bosstorage, we - # need to use the dl version. - $pkgsVirtualUrl = "$(PackagePrefix)" - Write-Host "Urls is $pkgsVirtualUrl" - - $pkgsPath = "$(Build.SourcesDirectory)\\artifacts\\${{ parameters.uploadPrefix }}package" - - $iOSPkg = Get-ChildItem -Path $pkgsPath -File -Force -Name xamarin.ios-*.pkg - Write-Host "iOS PKG is $iOSPkg" - - - if ($Env:BUILD_REASON -eq "PullRequest") { - $notarizedShouldExist = $false; - } else { - $notarizedShouldExist = $true; - } - - # create an array with objects so that we can set each of the statuses: - if (![string]::IsNullOrEmpty($Env:INCLUDE_LEGACY_IOS)) { - $iOSPkg = Get-ChildItem -Path $pkgsPath -File -Force -Name xamarin.ios-*.pkg - Write-Host "iOS PKG is $iOSPkg" - - $statusInfo += @( - @{ - Path = "$pkgsPath\\$iOSPkg"; - Context = "PKG-Xamarin.iOS"; - Description = $iOSPkg; - TargetUrl = "$pkgsVirtualUrl;$iOSPkg"; - Error = "xamarin.ios pkg not found"; - ShouldExist = $true; - }, - @{ - Path = "$pkgsPath\\notarized\\xamarin.ios-*.pkg"; - Context = "PKG-Xamarin.iOS-notarized" - Description = "$iOSPkg (Notarized)" ; - TargetUrl = "$pkgsVirtualUrl/notarized;$iOSPkg" ; - Error = "Notarized xamarin.ios pkg not found" ; - ShouldExist = $notarizedShouldExist; - } - ) - } else { - Write-Host "Legacy iOS build is disabled" - } - - if (![string]::IsNullOrEmpty($Env:INCLUDE_LEGACY_MAC)) { - $macPkg = Get-ChildItem -Path $pkgsPath -File -Force -Name xamarin.mac-*.pkg - Write-Host "mac PKG is $macPkg" - - $statusInfo += @( - @{ - Path = "$pkgsPath\\xamarin.mac-*.pkg" ; - Context = "PKG-Xamarin.Mac" ; - Description = "$macPkg" ; - TargetUrl = "$pkgsVirtualUrl;$macPkg" ; - Error = "xamarin.mac pkg not found." ; - ShouldExist = $true; - }, - @{ - Path = "$pkgsPath\\notarized\\xamarin.mac-*.pkg" ; - Context = "PKG-Xamarin.Mac-notarized" ; - Description = "$macPkg (Notarized)" ; - TargetUrl = "$pkgsVirtualUrl/notarized;$macPkg" ; - Error = "Notarized xamarin.mac pkg not found." ; - ShouldExist = $notarizedShouldExist; - } - ) - } else { - Write-Host "Legacy macOS build is disabled" - } - - # bundle.zip and msbuild.zip should always exist - $statusInfo += @( - @{ - Path = "$pkgsPath\\bundle.zip" ; - Context = "bundle.zip" ; - Description = "bundle.zip" ; - TargetUrl = "$pkgsVirtualUrl;bundle.zip" ; - Error = "bundle.zip not found." ; - ShouldExist = $true; - }, - @{ - Path = "$pkgsPath\msbuild.zip" ; - Context = "msbuild.zip" ; - Description = "msbuild.zip" ; - TargetUrl = "$pkgsVirtualUrl;msbuild.zip" ; - Error = "msbuild.zip not found." ; - ShouldExist = $true; - } - ) - - foreach ($info in $statusInfo) { - if (Test-Path $info.Path -PathType Leaf) { - $statuses.SetStatus("success", $info.Description, $info.Context, $info.TargetUrl) - } elseif ($info.ShouldExist) { - $statuses.SetStatus("error", $info.Error, $info.Context) - } - } - - $msi = Get-ChildItem -Path $pkgsPath -Filter *.msi -File -Name - - foreach ($n in $msi) { - $statuses.SetStatus("success", "$n", "$n", "$pkgsVirtualUrl;$n") - } - - Write-Host "Setting SBOM.PackagesPath: ${pkgsPath}" - Write-Host "##vso[task.setvariable variable=SBOM.PackagesPath]$pkgsPath" - env: - GITHUB_TOKEN: $(GitHub.Token) - ACCESSTOKEN: $(System.AccessToken) - VIRTUAL_PATH: $(Build.SourceBranchName)/$(Build.SourceVersion)/$(Build.BuildId) - displayName: 'Set GithubStatus' - -# Executive Order (EO): Software Bill of Materials (SBOM): https://www.1eswiki.com/wiki/ADO_sbom_Generator -- pwsh: | - # https://stackoverflow.com/questions/188892/glob-pattern-matching-in-net - function Is-Match([string] $Text, [string] $Filter) - { - $isMatch = $false - - $regexGlobEquivalent = [Regex]::Escape($Filter).Replace("\*", ".*").Replace("\?", ".") - $pattern = "^${regexGlobEquivalent}$" - - # https://stackoverflow.com/questions/42700341/how-can-i-use-powershell-to-do-a-net-regex-matches-method-and-add-a-timeout - $regEx = New-Object -TypeName regex -ArgumentList $pattern, ([Text.RegularExpressions.RegexOptions]::Singleline, [Text.RegularExpressions.RegexOptions]::IgnoreCase) - $isMatch = $regEx.IsMatch($Text) - - return $isMatch - } - - $filter = "${{ parameters.sbomFilter }}" - Write-Host "sbomFilter: ${filter}" - - $sbomStagingDirectory = "$(Build.ArtifactStagingDirectory)/sbom" - Write-Host "Creating SBOM staging directory: ${sbomStagingDirectory}" - - if (-not ([IO.Directory]::Exists($sbomStagingDirectory))) { - [IO.Directory]::CreateDirectory($sbomStagingDirectory) - } - - $pkgsPath = "$(SBOM.PackagesPath)" - Write-Host "Packages path: ${pkgsPath}" - - if ([string]::IsNullOrEmpty($filter)) { - $filter = '*' # Even if the caller attempts to force the parameter to an empty string treat empty as all '*' - } - - $filters = $filter.Split(';', [StringSplitOptions]::RemoveEmptyEntries) - Write-Host "Copying files based on ${filter}" - - $files = [IO.Directory]::GetFiles($pkgsPath) - $files | foreach { - $filename = [IO.Path]::GetFileName($_) - $isMatch = $false - $filters | foreach { - if (-not $isMatch) { - $isMatch = Is-Match -Text $filename -Filter $_ - } - } - - if ($isMatch) { - $destPathAndFilename = [IO.Path]::Combine($sbomStagingDirectory, $filename) - Write-Host "Copying $_ to ${destPathAndFilename}. Filter: ${filter}" - [IO.File]::Copy($_, $destPathAndFilename) - } else { - Write-Host "Skipped file copy based on filter ${filter}: ${filename}" - } - } - displayName: 'SBOM: Staging' - -- pwsh: | - function Get-PackageFileNames([string] $PkgsPath) { - $files = [IO.Directory]::GetFiles($PkgsPath) - $pkgFiles = $files | foreach { [IO.Path]::GetFileName($_) } - return $pkgFiles - } - - $pkgsPath = "$(SBOM.PackagesPath)" - Write-Host "Packages path: ${pkgsPath}" - - $packageFileNames = Get-PackageFileNames -PkgsPath $pkgsPath - $packageFileNames = @($packageFileNames) - Write-Host "Package files: $($packageFileNames.Count)" - $packageFileNames | foreach { Write-Host $_ } - - Write-Host "Setting SBOM.ProductName: Xamarin iOS" - Write-Host "##vso[task.setvariable variable=SBOM.ProductName]Xamarin iOS" # SBOM generation only lets us use a single package name and so choose 'Xamarin iOS' instead of 'Xamarin Mac' - - $sbomManifestVersion = "$(Build.BuildId)" - Write-Host "Setting SBOM.ProductVersion to the build number: ${sbomManifestVersion}" - Write-Host "##vso[task.setvariable variable=SBOM.ProductVersion]$sbomManifestVersion" - displayName: 'SBOM: Set ProductVersion' - -- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 - displayName: 'SBOM: Generation' - inputs: - BuildDropPath: '$(Build.ArtifactStagingDirectory)/sbom' - PackageName: '$(SBOM.ProductName)' - PackageVersion: '$(SBOM.ProductVersion)' - Verbosity: Verbose - -- pwsh: | - # The pkg files are already included under the drop-x64 and drop-arm locations - # We only needed them temporarily here as a means to produce the Software Bill of Materials (SBOM) manifest - # No need to include the pkg files (and duplicate them) in the SBOM drop - $sbomStagingDirectory = "$(Build.ArtifactStagingDirectory)/sbom" - - # Delete all top-level package files. This should leave the SBOM '_manifest' directory intact - $pkgFiles = [IO.Directory]::GetFiles($sbomStagingDirectory) - $pkgFiles | foreach { - Write-Host "Deleting PKG: $_" - [IO.File]::Delete($_) - } - displayName: 'SBOM: Cleanup' - -- task: 1ES.PublishPipelineArtifact@1 - displayName: 'SBOM: Publish' - inputs: - artifact: '${{ parameters.uploadPrefix }}sbom' - path: $(Build.ArtifactStagingDirectory)/sbom - condition: succeeded() diff --git a/tools/devops/automation/templates/tests-stage.yml b/tools/devops/automation/templates/tests-stage.yml index e54a23ee9cd7..951605b7ccb2 100644 --- a/tools/devops/automation/templates/tests-stage.yml +++ b/tools/devops/automation/templates/tests-stage.yml @@ -163,18 +163,6 @@ parameters: stages: -- ${{ if parameters.isPR }}: - - stage: clean - displayName: '${{ parameters.stageDisplayNamePrefix }}Clean up' - dependsOn: [] - jobs: - - job: - displayName: 'Clean comments' - pool: - vmImage: windows-latest - steps: - - template: ./common/clean.yml - - stage: configure_build displayName: '${{ parameters.stageDisplayNamePrefix }}Configure' dependsOn: ${{ parameters.dependsOn }} @@ -214,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-system-permission-tests' statusContext: 'VSTS: simulator tests' uploadArtifacts: true diff --git a/tools/devops/automation/templates/tests/build.yml b/tools/devops/automation/templates/tests/build.yml index dd8b8158bf5f..8f3f39a1f9be 100644 --- a/tools/devops/automation/templates/tests/build.yml +++ b/tools/devops/automation/templates/tests/build.yml @@ -97,11 +97,7 @@ steps: # 2. Cancel the pipeline and do not execute any of the following steps. - pwsh: | Import-Module ./MaciosCI.psd1 - - if ( -not (Test-HDFreeSpace -Size 20)) { - New-GitHubComment -Header "Tests failed catastrophically on $Env:CONTEXT" -Emoji ":fire:" -Description "Not enough free space in the host." - Stop-Pipeline - } + Assert-HDFreeSpace -Size 20 env: CONTEXT: ${{ parameters.statusContext }} GITHUB_TOKEN: $(GitHub.Token) @@ -155,9 +151,11 @@ steps: # use a diff step depending if we have been trigger by a pipeline of by a PR/Commit - ${{ if or(contains(variables['Build.Reason'], 'ResourceTrigger'), contains(variables['Build.Reason'], 'BuildCompletion'), contains(variables['Build.DefinitionName'], 'xamarin-macios-ci-tests'), contains(variables['Build.DefinitionName'], 'xamarin-macios-pr-tests')) }}: - - download: macios - displayName: Download PkgsVersions.json - artifact: PkgsVersions + - bash: | + ls -la "$PIPELINE_WORKSPACE/macios" || true + rm -Rf "$PIPELINE_WORKSPACE/macios" + displayName: "Remove previously downloaded artifacts" + condition: always() - download: macios displayName: Download WorkloadRollback.json @@ -172,8 +170,8 @@ steps: artifact: package-test-libraries - pwsh: | - Get-ChildItem -Path "$(Pipeline.Workspace)/macios" -Recurse -Force - displayName: 'Display downloads' + Get-ChildItem -Path "$(Pipeline.Workspace)/macios" -Recurse -Force | Format-Table -AutoSize | Out-String -Width 1000 + displayName: 'List downloaded macios artifacts' timeoutInMinutes: 5 # the default location when downloading is $(Pipeline.Workspace)// @@ -185,13 +183,6 @@ steps: displayName: Move artifacts to the expected location - ${{ else }}: - - task: DownloadPipelineArtifact@2 - displayName: Download PkgsVersions.json - inputs: - allowFailedBuilds: true - patterns: '**/PkgsVersions.json' - path: $(Build.SourcesDirectory)/artifacts - - task: DownloadPipelineArtifact@2 displayName: Download WorkloadRollback.json inputs: @@ -215,12 +206,12 @@ steps: # print the downloads to make our life easier on debug - pwsh: | - Get-ChildItem -Path $(Build.SourcesDirectory)/artifacts -Recurse -Force - displayName: 'Display downloads' + Get-ChildItem -Path $(Build.SourcesDirectory)/artifacts -Recurse -Force | Format-Table -AutoSize | Out-String -Width 1000 + displayName: 'List downloaded artifacts' timeoutInMinutes: 5 - bash: | - make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ device-tests-provisioning.csx + make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ provisioning displayName: 'Generate Provisionator csx file' # Executed ONLY if we want to clear the provisionator cache. @@ -234,19 +225,7 @@ steps: - task: xamops.azdevex.provisionator-task.provisionator@2 displayName: 'Provision dependencies' inputs: - provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/device-tests-provisioning.csx - provisioning_extra_args: '-vvvv' - github_token: ${{ parameters.gitHubToken }} - timeoutInMinutes: 250 - -- bash: | - make -C $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/ mac-tests-provisioning.csx - displayName: 'Generate Provisionator csx file for macOS' - -- task: xamops.azdevex.provisionator-task.provisionator@2 - displayName: 'Provision Xamarin.Mac' - inputs: - provisioning_script: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/mac-tests-provisioning.csx + provisioning_script: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/build-provisioning.csx provisioning_extra_args: '-vvvv' github_token: ${{ parameters.gitHubToken }} timeoutInMinutes: 250 diff --git a/tools/devops/automation/templates/tests/publish-html.yml b/tools/devops/automation/templates/tests/publish-html.yml index 7b0926fad01b..e163ac2ba609 100644 --- a/tools/devops/automation/templates/tests/publish-html.yml +++ b/tools/devops/automation/templates/tests/publish-html.yml @@ -49,14 +49,8 @@ steps: - template: download-artifacts.yml -- ${{ if parameters.isPR }}: - - template: ../common/clean.yml - parameters: - commentToHide: '[comment]: <> (This is a test result report added by Azure DevOps)' - checkoutCode: false # we already execute the 'clean.yml' template elsewhere in this job, and running 'checkout' again is useless (it also leads to duplicate step names which Azure DevOps doesn't like). - -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' +- pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' + displayName: 'Show Bot Info' # build a message with all the content of all tests, to do so, we get the labels and to pass them to pwsh we do a join with ; # as the separator @@ -83,7 +77,7 @@ steps: } $gihubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH -Debug - $result = $gihubComments.NewCommentFromObject("Test results", $emoji, $parallelResults) + $result = $gihubComments.NewCommentFromObject("Test results", $emoji, $parallelResults, "test results") } catch { Write-Host "##vso[task.complete result=Failed;]Failed to compute test summaries: $_" New-GitHubComment -Header "Failed to compute test summaries on $Env:CONTEXT" -Emoji ":fire:" -Description "Failed to compute test summaries: $_." diff --git a/tools/devops/automation/templates/tests/publish-results.yml b/tools/devops/automation/templates/tests/publish-results.yml index 02729046d4a2..a02fa11d5911 100644 --- a/tools/devops/automation/templates/tests/publish-results.yml +++ b/tools/devops/automation/templates/tests/publish-results.yml @@ -119,7 +119,7 @@ stages: $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $Env:GITHUB_TOKEN -Hash $Env:COMMENT_HASH -Debug $sb = [System.Text.StringBuilder]::new() $sb.AppendLine("All tests have been skipped because the label 'skip-all-tests' was set.") - $result = $githubComments.NewCommentFromMessage("Test results", ":seedling:", $sb.ToString()) + $result = $githubComments.NewCommentFromMessage("Test results", ":seedling:", $sb.ToString(), "test results") displayName: 'Set comment' env: CONTEXT: ${{ parameters.statusContext }} diff --git a/tools/devops/automation/templates/tests/run-tests.yml b/tools/devops/automation/templates/tests/run-tests.yml index f625ab48d289..8b3976f11736 100644 --- a/tools/devops/automation/templates/tests/run-tests.yml +++ b/tools/devops/automation/templates/tests/run-tests.yml @@ -108,23 +108,6 @@ steps: env: MACIOS_UPLOAD_PREFIX: ${{ parameters.uploadPrefix }} -- bash: | - set -x - set -e - - make -C src build/ios.rsp - workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios - displayName: Generate rsp files - timeoutInMinutes: 30 - -- bash: | - set -x - set -e - make -C tools/xibuild - workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-macios - displayName: Build test dependencies - timeoutInMinutes: 30 - # expand all the prebuilt test dependencies - bash: | ls -Rla@ $(Build.SourcesDirectory)/artifacts @@ -147,8 +130,6 @@ steps: # show environment env -0 | sort -z | tr '\0' '\n' || true - make -C builds download -j - make -C builds .stamp-mono-ios-sdk-destdir -j make -C tests ${{ parameters.makeTarget }} # We reached the end! This means we succeeded! diff --git a/tools/devops/automation/templates/variables.yml b/tools/devops/automation/templates/variables.yml deleted file mode 100644 index cabd95d39e32..000000000000 --- a/tools/devops/automation/templates/variables.yml +++ /dev/null @@ -1,38 +0,0 @@ -variables: -- ${{ if contains(variables['Build.DefinitionName'], 'private') }}: - - template: templates/vsts-variables.yml -- group: xamops-azdev-secrets -- group: Xamarin-Secrets -- group: Xamarin Signing -- group: Xamarin Release -- group: Xamarin Notarization -- group: XamarinCompatLab # provisionator-uri setting -- group: VSEng DTL secrets -- name: GitHub.Token # Override the GitHub.Token setting defined in the Xamarin Release group - value: $(github--pat--vs-mobiletools-engineering-service2) # Use a token dedicated to critical production workflows and help avoid GitHub throttling -- name: AzDoBuildAccess.Token - value: $(pat--xamarinc--build-access) -- name: system.debug - value: false -- name: SigningKeychain - value: "builder.keychain" -- name: VSDropsPrefix - value: 'https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/device-tests' -- name: USE_TCP_TUNNEL # Needed to ensure that devices uses the usb cable to communicate with the devices to run the tests. - value: true -- name: TeamName - value: 'xamarin-macios' -- name: PROVISIONATOR_CHANNEL - value: ${{ parameters.provisionatorChannel }} -- name: PRBuildPool - value: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Untrusted' -- name: PRBuildPoolUrl - value: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=366&view=agents' -- name: CIBuildPool - value: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Trusted' -- name: CIBuildPoolUrl - value: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=367&view=agents' -- name: CIBuild - value: true -- name: BUILD_REVISION - value: azure-devops-$(Build.SourceVersion) diff --git a/tools/devops/automation/templates/variables/api-scan.yml b/tools/devops/automation/templates/variables/api-scan.yml new file mode 100644 index 000000000000..0d3b37c119be --- /dev/null +++ b/tools/devops/automation/templates/variables/api-scan.yml @@ -0,0 +1,3 @@ +variables: +- name: TeamName + value: 'xamarin-macios' diff --git a/tools/devops/automation/templates/variables/common.yml b/tools/devops/automation/templates/variables/common.yml new file mode 100644 index 000000000000..c8f729d5e219 --- /dev/null +++ b/tools/devops/automation/templates/variables/common.yml @@ -0,0 +1,64 @@ +variables: +# provisionator-uri setting +- group: XamarinCompatLab + +# allow to override the provisionator channel via a paramter +- name: PROVISIONATOR_CHANNEL + value: ${{ parameters.provisionatorChannel }} + +- group: xamops-azdev-secrets + +# needed to install the dev certificates in the build machine +- group: Xamarin Notarization +- group: Xamarin Signing + +# Override the GitHub.Token setting defined in the Xamarin Release group +# Use a token dedicated to critical production workflows and help avoid GitHub throttling +# this variable comes from the Xamarin-Secrets group, so we have do have both together +- group: Xamarin-Secrets +- name: GitHub.Token + value: $(github--pat--vs-mobiletools-engineering-service2) + +# Overrude the azdo build access, as with the GitHub token, this variables depend on the +# Xamarin-Secrets group. +- name: AzDoBuildAccess.Token + value: $(pat--xamarinc--build-access) + +- name: AzDoBuildAccess.Token + value: $(pat--xamarinc--build-access) + +# keying to use for the sining +- name: SigningKeychain + value: "builder.keychain" + +# Needed to ensure that devices uses the usb cable to communicate with the devices to run the tests. +- name: USE_TCP_TUNNEL + value: true + +# pool information +- name: PRBuildPool + value: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Untrusted' +- name: PRBuildPoolUrl + value: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=366&view=agents' +- name: CIBuildPool + value: 'VSEng-Xamarin-RedmondMacBuildPool-iOS-Trusted' +- name: CIBuildPoolUrl + value: 'https://devdiv.visualstudio.com/_settings/agentpools?poolId=367&view=agents' + +# override the default build revision +- name: BUILD_REVISION + value: azure-devops-$(Build.SourceVersion) + +- name: MaciosUploadPrefix + value: '' + +# set the pipeline to debug mode or not +- name: system.debug + value: false + +# point to the vsdrops that we will be using for the diff uploads. +- name: VSDropsPrefix + value: 'https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/device-tests' + +- name: BUILD_REPOSITORY_TITLE + value: 'xamarin-macios' diff --git a/tools/devops/automation/templates/variables/signing.yml b/tools/devops/automation/templates/variables/signing.yml new file mode 100644 index 000000000000..dcfc58ec54fa --- /dev/null +++ b/tools/devops/automation/templates/variables/signing.yml @@ -0,0 +1,7 @@ +# signing related variables +variables: +- group: Xamarin-Secrets +- group: Xamarin Signing +- group: Xamarin Release +- group: Xamarin Notarization +- group: VSEng DTL secrets diff --git a/tools/devops/automation/templates/windows/build.yml b/tools/devops/automation/templates/windows/build.yml index 6f83e39da959..aa1f4254a229 100644 --- a/tools/devops/automation/templates/windows/build.yml +++ b/tools/devops/automation/templates/windows/build.yml @@ -37,8 +37,8 @@ steps: repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Dump Environment' +- pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' + displayName: 'Show Bot Info' - ${{ if or(contains(variables['Build.Reason'], 'ResourceTrigger'), contains(variables['Build.Reason'], 'BuildCompletion'), contains(variables['Build.DefinitionName'], 'xamarin-macios-ci-tests'), contains(variables['Build.DefinitionName'], 'xamarin-macios-pr-tests')) }}: - download: macios @@ -127,9 +127,6 @@ steps: displayName: "Write and verify id_rsa" continueOnError: true -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Show Environment' - - pwsh: | Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\\xamarin-macios\\tools\\devops\\automation\\scripts\\MaciosCI.psd1 ssh -v -i "$(ID_RSA_PATH)" -o IdentitiesOnly=yes -o StrictHostKeyChecking=no builder@$Env:MAC_AGENT_IP pwd @@ -231,33 +228,29 @@ steps: Get-Content -Path $(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/config.runsettings | Write-Host displayName: 'Create runsettings for .NET tests' -- pwsh: | - $Env:PATH = "$(Build.SourcesDirectory)\xamarin-macios\tests\dotnet\Windows\bin\dotnet;$env:PATH" - $Env:DOTNET = "$(Build.SourcesDirectory)\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe" - & $(Build.SourcesDirectory)\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe ` - test ` - "$(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/UnitTests/DotNetUnitTests.csproj" ` - --filter Category=Windows ` - --verbosity quiet ` - --settings $(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/config.runsettings ` - "--results-directory:$(Build.SourcesDirectory)/xamarin-macios/jenkins-results/" ` - "--logger:console;verbosity=detailed" ` - "--logger:trx;LogFileName=$(Build.SourcesDirectory)/xamarin-macios/jenkins-results/windows-dotnet-tests.trx" ` - "--logger:html;LogFileName=$(Build.SourcesDirectory)/xamarin-macios/jenkins-results/windows-dotnet-tests.html" ` - "-bl:$(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/run-dotnet-tests.binlog" - displayName: 'Run .NET tests' +- pwsh: $(Build.SourcesDirectory)\xamarin-macios\tools\devops\automation\scripts\run-local-windows-tests.ps1 + displayName: 'Run .NET tests locally' timeoutInMinutes: 30 + continueOnError: true ${{ if not(parameters.isPR) }}: retryCountOnTaskFailure: ${{ parameters.retryCount }} - pwsh: $(Build.SourcesDirectory)\xamarin-macios\tools\devops\automation\scripts\run-remote-windows-tests.ps1 displayName: 'Run .NET tests remotely' timeoutInMinutes: 120 + continueOnError: true ${{ if not(parameters.isPR) }}: retryCountOnTaskFailure: ${{ parameters.retryCount }} env: XMA_PASSWORD: $(XMA.Password) +- pwsh: | + Write-Host "There are test failures, so failing the build" + exit 1 + displayName: 'Fail if test failures' + timeoutInMinutes: 1 + condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues') + - pwsh: $(Build.SourcesDirectory)\xamarin-macios\tools\devops\automation\scripts\fetch-remote-binlogs.ps1 displayName: 'Fetch remote binlogs' timeoutInMinutes: 5 @@ -342,13 +335,13 @@ steps: $githubComments = New-GitHubCommentsObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) -Hash $Env:COMMENT_HASH if (Test-Path -Path "$Env:GITHUB_FAILURE_COMMENT_FILE" -PathType Leaf) { - $githubComments.NewCommentFromFile("${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE") + $githubComments.NewCommentFromFile("${{ parameters.statusContext }} failed", ":x:", "$Env:GITHUB_FAILURE_COMMENT_FILE", "windows tests") } elseif ("$($Env:AGENT_JOBSTATUS)" -ne "Succeeded") { $message = ":x: $($Env:AGENT_JOBSTATUS) :x:" - $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} failed", ":x:", $message) + $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} failed", ":x:", $message, "windows tests") } else { $message = ":white_check_mark: **All** ${{ parameters.statusContext }} passed." - $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} passed", ":computer:", $message) + $githubComments.NewCommentFromMessage("${{ parameters.statusContext }} passed", ":computer:", $message, "windows tests") } displayName: 'Report results to GitHub' timeoutInMinutes: 5 diff --git a/tools/devops/automation/templates/windows/reenable-mac.yml b/tools/devops/automation/templates/windows/reenable-mac.yml index 269802117011..833788b3092b 100644 --- a/tools/devops/automation/templates/windows/reenable-mac.yml +++ b/tools/devops/automation/templates/windows/reenable-mac.yml @@ -19,8 +19,8 @@ steps: repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} -- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/show_env.ps1 - displayName: 'Dump Environment' +- pwsh: '& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$($Env:BUILD_REPOSITORY_NAME.Split(''/'')[1])/tools/devops/automation/scripts/show_bot_info.ps1"' + displayName: 'Show Bot Info' - task: AzureKeyVault@2 inputs: diff --git a/tools/devops/automation/templates/windows/reserve-mac.yml b/tools/devops/automation/templates/windows/reserve-mac.yml index afbd6e7dc216..1882594aaa0c 100644 --- a/tools/devops/automation/templates/windows/reserve-mac.yml +++ b/tools/devops/automation/templates/windows/reserve-mac.yml @@ -29,9 +29,21 @@ steps: commit: ${{ parameters.commit }} clean: true path: s/xamarin-macios + fetchTags: false - checkout: maccore + clean: true + fetchDepth: 0 persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail + fetchTags: false + +- 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' + displayName: 'Clean bot' + continueOnError: true + timeoutInMinutes: 60 - bash: $(Build.SourcesDirectory)/xamarin-macios/tools/devops/automation/scripts/disable-codeql-arm64.sh displayName: 'Disable CodeQL on arm64' @@ -85,7 +97,7 @@ steps: $vsts.Agents.SetEnabled($pool, $agent, $False) displayName: "Disable macOS bot from pool" -- bash: make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops provision-xcode.csx +- bash: make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops provisioning displayName: 'Generate Xcode provisioning csx file' - task: xamops.azdevex.provisionator-task.provisionator@2 diff --git a/tools/devops/automation/templates/windows/stage.yml b/tools/devops/automation/templates/windows/stage.yml index cbe843878af1..c315fadef3f8 100644 --- a/tools/devops/automation/templates/windows/stage.yml +++ b/tools/devops/automation/templates/windows/stage.yml @@ -56,7 +56,6 @@ stages: dependsOn: displayName: "Reserve macOS bot for tests" timeoutInMinutes: 120 - condition: ne(stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'],'') workspace: clean: all pool: @@ -81,7 +80,6 @@ stages: - mac_reservation displayName: 'Dotnet tests' timeoutInMinutes: 120 - condition: and(succeeded(),ne(stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'],'')) workspace: clean: all @@ -115,8 +113,7 @@ stages: - run_tests displayName: "Re-enable macOS bot for tests" timeoutInMinutes: 120 - # the condition must be exactly the same as for the mac_reservation job (or if no condition there, then 'always ()') - condition: ne(stageDependencies.configure_build.configure.outputs['configure_platforms.ENABLE_DOTNET'],'') + condition: always() workspace: clean: all pool: diff --git a/tools/devops/automation/vs-insertion.yml b/tools/devops/automation/vs-insertion.yml index 177ae4456788..31d7d1b7d754 100644 --- a/tools/devops/automation/vs-insertion.yml +++ b/tools/devops/automation/vs-insertion.yml @@ -21,12 +21,6 @@ resources: ref: refs/heads/main endpoint: xamarin - - repository: release-scripts - type: github - name: xamarin/release-scripts - ref: refs/heads/sign-and-notarized - endpoint: xamarin - # we need all stages to be completed, else we do not have the test results, this trigger is just for CI, because we have # but because we have device issues, and it needs to be gree to trigger, we will deal with it later pipelines: diff --git a/tools/devops/build-provisioning.csx b/tools/devops/build-provisioning.csx new file mode 100644 index 000000000000..de6a84226d26 --- /dev/null +++ b/tools/devops/build-provisioning.csx @@ -0,0 +1,8 @@ +#load "provision-shared.csx" + +if (!ProvisionXcode ()) + return 1; +ProvisionMono (); +ProvisionSharpie (); +ProvisionBrewPackages (); +SetDefaultXcodeInVSMac (); diff --git a/tools/devops/build-provisioning.csx.in b/tools/devops/build-provisioning.csx.in deleted file mode 100644 index 2fba863a6961..000000000000 --- a/tools/devops/build-provisioning.csx.in +++ /dev/null @@ -1,38 +0,0 @@ -#r "_provisionator/provisionator.dll" - -using System.IO; -using System.Reflection; -using System.Linq; - -using static Xamarin.Provisioning.ProvisioningScript; - -// Provision Xcode using the xip name declared in Make.config -Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); - -// provisionator knows how to deal with this items -Item ("@MONO_PACKAGE@"); -Item ("@MIN_SHARPIE_URL@"); - -var appleSdkOverride = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "Library", "Preferences", "Xamarin", "Settings.plist"); -Item ("Override Apple SDK Settings") - .Action (item => { - DeleteSafe (appleSdkOverride); - CreateSetting (appleSdkOverride, "AppleSdkRoot", GetSelectedXcodePath ()); - Console.WriteLine ($"New iOS SDK Location: {GetSettingValue (appleSdkOverride, "AppleSdkRoot")}"); - }); - -void DeleteSafe (string file) -{ - if (File.Exists (file)) - File.Delete (file); -} - -void CreateSetting (string settingFile, string key, string value) -{ - Exec ("defaults", "write", settingFile, key, value); -} - -string GetSettingValue (string settingFile, string keyName) -{ - return Exec ("defaults", "read", settingFile, keyName).FirstOrDefault (); -} diff --git a/tools/devops/device-tests-provisioning.csx.in b/tools/devops/device-tests-provisioning.csx.in deleted file mode 100644 index 1834b99bbe52..000000000000 --- a/tools/devops/device-tests-provisioning.csx.in +++ /dev/null @@ -1,15 +0,0 @@ -#r "_provisionator/provisionator.dll" - -using System.IO; -using System.Reflection; -using System.Linq; - -using static Xamarin.Provisioning.ProvisioningScript; - -// Provision Xcode using the xip name declared in Make.config -Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); - -Item ("@MONO_PACKAGE@"); -Item ("@MIN_SHARPIE_URL@"); - -BrewPackages ("p7zip"); diff --git a/tools/devops/mac-tests-provisioning.csx.in b/tools/devops/mac-tests-provisioning.csx.in deleted file mode 100644 index 7bbea84ce87e..000000000000 --- a/tools/devops/mac-tests-provisioning.csx.in +++ /dev/null @@ -1,34 +0,0 @@ -#r "_provisionator/provisionator.dll" - -using System.IO; -using System.Reflection; -using System.Linq; - -using static Xamarin.Provisioning.ProvisioningScript; - -BrewPackages ("p7zip"); - -var appleSdkOverride = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), "Library", "Preferences", "Xamarin", "Settings.plist"); -Item ("Override Apple SDK Settings") - .Condition (item => !File.Exists (appleSdkOverride) || GetSettingValue (appleSdkOverride, "AppleSdkRoot") != GetSelectedXcodePath ()) - .Action (item => { - DeleteSafe (appleSdkOverride); - CreateSetting (appleSdkOverride, "AppleSdkRoot", GetSelectedXcodePath ()); - Console.WriteLine ($"New VSMac iOS SDK Location: {GetSelectedXcodePath ()}"); - }); - -void DeleteSafe (string file) -{ - if (File.Exists (file)) - File.Delete (file); -} - -void CreateSetting (string settingFile, string key, string value) -{ - Exec ("defaults", "write", settingFile, key, value); -} - -string GetSettingValue (string settingFile, string keyName) -{ - return Exec ("defaults", "read", settingFile, keyName).FirstOrDefault (); -} diff --git a/tools/devops/provision-brew-packages.csx b/tools/devops/provision-brew-packages.csx index 291ec5e294cd..1b0789b311f6 100644 --- a/tools/devops/provision-brew-packages.csx +++ b/tools/devops/provision-brew-packages.csx @@ -1,9 +1,3 @@ -BrewPackages ( - "shellcheck", - "yamllint", - "cmake", - "p7zip", - "msitools", - "wget", - "azure-cli" - ); +#load "provision-shared.csx" + +ProvisionBrewPackages (); diff --git a/tools/devops/provision-shared.csx b/tools/devops/provision-shared.csx deleted file mode 100644 index f01699237aee..000000000000 --- a/tools/devops/provision-shared.csx +++ /dev/null @@ -1,103 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -using Newtonsoft.Json.Linq; - -using Xamarin.Provisioning; -using Xamarin.Provisioning.Model; -using Xamarin.Provisioning.IO; - -var commit = Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION"); -var provision_from_commit = Environment.GetEnvironmentVariable ("PROVISION_FROM_COMMIT") ?? commit; - -// Looks for a variable either in the environment, or in current repo's Make.config. -// Returns null if the variable couldn't be found. -IEnumerable make_config = null; -string FindConfigurationVariable (string variable, string hash = "HEAD") -{ - var value = Environment.GetEnvironmentVariable (variable); - if (!string.IsNullOrEmpty (value)) - return value; - - if (make_config == null) { - try { - make_config = Exec ("git", "show", $"{hash}:Make.config"); - } catch { - Console.WriteLine ("Could not find a Make.config"); - return null; - } - } - foreach (var line in make_config) { - if (line.StartsWith (variable + "=", StringComparison.Ordinal)) - return line.Substring (variable.Length + 1); - } - - return null; -} - -string FindVariable (string variable) -{ - var value = FindConfigurationVariable (variable, provision_from_commit); - if (!string.IsNullOrEmpty (value)) - return value; - - throw new Exception ($"Could not find {variable} in environment nor in the commit's ({commit}) manifest."); -} - -void ExecVerbose (string filename, params string[] args) -{ - Console.WriteLine ($"{filename} {string.Join (" ", args)}"); - Exec (filename, args); -} - -bool IsAtLeastVersion(string actualVer, string minVer) -{ - if (actualVer.Equals(minVer, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - var actualVerChars = actualVer.ToCharArray(); - var minVerChars = minVer.ToCharArray(); - - var length = Math.Min (minVerChars.Length, actualVerChars.Length); - - var i = 0; - while (i < length) - { - if (actualVerChars[i] > minVerChars[i]) - { - return true; - } - else if (minVerChars[i] > actualVerChars[i]) - { - return false; - } - i++; - } - - if (actualVerChars.Length == minVerChars.Length) - { - return true; - } - - return actualVerChars.Length > minVerChars.Length; -} - -void RemoveXcodeSymlinks (string xcodePath) -{ - Console.WriteLine ($"Checkig if '{xcodePath}' is a symlink..."); - var resolvedPath = Symlink.Resolve (xcodePath); - Console.WriteLine ($"Path resolved: '{resolvedPath}'"); - if (resolvedPath is string) { - Console.WriteLine ($"Removing '{xcodePath}' symlink."); - Symlink.Delete (xcodePath); - Console.WriteLine ($"Renaming '{resolvedPath}' into '{xcodePath}'"); - ElevatedExec ("/bin/mv", resolvedPath, xcodePath); - } else - Console.WriteLine ($"'{xcodePath}' is not a symlink."); -} diff --git a/tools/devops/provision-shared.in.csx b/tools/devops/provision-shared.in.csx new file mode 100644 index 000000000000..23947808f1aa --- /dev/null +++ b/tools/devops/provision-shared.in.csx @@ -0,0 +1,115 @@ +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +using Newtonsoft.Json.Linq; + +using Xamarin.Provisioning; +using Xamarin.Provisioning.Model; +using Xamarin.Provisioning.IO; + +var commit = Environment.GetEnvironmentVariable ("BUILD_SOURCEVERSION"); +var provision_from_commit = Environment.GetEnvironmentVariable ("PROVISION_FROM_COMMIT") ?? commit; + +void RemoveXcodeSymlinks (string xcodePath) +{ + Console.WriteLine ($"Checking if '{xcodePath}' is a symlink..."); + var resolvedPath = Symlink.Resolve (xcodePath); + Console.WriteLine ($"Path resolved: '{resolvedPath}'"); + if (resolvedPath is string) { + Console.WriteLine ($"Removing '{xcodePath}' symlink."); + Symlink.Delete (xcodePath); + Console.WriteLine ($"Renaming '{resolvedPath}' into '{xcodePath}'"); + ElevatedExec ("/bin/mv", resolvedPath, xcodePath); + } else + Console.WriteLine ($"'{xcodePath}' is not a symlink."); +} + +void ListXcodes () +{ + Console.WriteLine ($"Xcodes:"); + var lines = Exec ("bash", "-c", "ls -lad /Applications/Xcode*"); + foreach (var line in lines) + Console.WriteLine ($"\t{line}"); +} + +// Provision Xcode using the xip name declared in Make.config +// +// Overrides: +// * The current commit can be overridden by setting the PROVISION_FROM_COMMIT variable. +bool ProvisionXcode () +{ + + if (string.IsNullOrEmpty (provision_from_commit)) { + Console.Error.WriteLine ($"Either BUILD_SOURCEVERSION or PROVISION_FROM_COMMIT must be set."); + Environment.Exit (1); + return false; + } + + ListXcodes (); + + // Provision Xcode + Console.WriteLine ($"Provisioning Xcode from {provision_from_commit}..."); + + // Let's turn symlink into an actual path + var reqXcode = Path.GetDirectoryName (Path.GetDirectoryName ("@XCODE_ROOT_PATH@")); + RemoveXcodeSymlinks (reqXcode); + + // Provision Xcode using the xip name declared in Make.config + Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); + + LogInstalledXcodes (); + return true; +} + +void ProvisionBrewPackages () +{ + BrewPackages ( + "shellcheck", + "yamllint", + "p7zip", + "azure-cli" + ); +} + +void SetDefaultXcodeInVSMac () +{ + var appleSdkOverride = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), "Library", "Preferences", "Xamarin", "Settings.plist"); + Item ("Override Apple SDK Settings") + .Condition (item => !File.Exists (appleSdkOverride) || GetSettingValue (appleSdkOverride, "AppleSdkRoot") != GetSelectedXcodePath ()) + .Action (item => { + DeleteSafe (appleSdkOverride); + CreateSetting (appleSdkOverride, "AppleSdkRoot", GetSelectedXcodePath ()); + Console.WriteLine ($"New VSMac iOS SDK Location: {GetSelectedXcodePath ()}"); + }); + +} + +void DeleteSafe (string file) +{ + if (File.Exists (file)) + File.Delete (file); +} + +void CreateSetting (string settingFile, string key, string value) +{ + Exec ("defaults", "write", settingFile, key, value); +} + +string GetSettingValue (string settingFile, string keyName) +{ + return Exec ("defaults", "read", settingFile, keyName).FirstOrDefault (); +} + +void ProvisionMono () +{ + Item ("@MONO_PACKAGE@"); +} + +void ProvisionSharpie () +{ + Item ("@MIN_SHARPIE_URL@"); +} diff --git a/tools/devops/provision-xcode.csx b/tools/devops/provision-xcode.csx new file mode 100644 index 000000000000..4a4785ea7462 --- /dev/null +++ b/tools/devops/provision-xcode.csx @@ -0,0 +1,4 @@ +#load "provision-shared.csx" + +if (ProvisionXcode ()) + return 1; diff --git a/tools/devops/provision-xcode.csx.in b/tools/devops/provision-xcode.csx.in deleted file mode 100644 index ea30ad8f6ec8..000000000000 --- a/tools/devops/provision-xcode.csx.in +++ /dev/null @@ -1,34 +0,0 @@ -#load "provision-shared.csx" - -// Provision Xcode -// -// Overrides: -// * The current commit can be overridden by setting the PROVISION_FROM_COMMIT variable. - -void ListXcodes () -{ - Console.WriteLine ($"Xcodes:"); - var lines = Exec ("bash", "-c", "ls -lad /Applications/Xcode*"); - foreach (var line in lines) - Console.WriteLine ($"\t{line}"); -} - -if (string.IsNullOrEmpty (provision_from_commit)) { - Console.Error.WriteLine ($"Either BUILD_SOURCEVERSION or PROVISION_FROM_COMMIT must be set."); - Environment.Exit (1); - return 1; -} - -ListXcodes (); - -// Provision Xcode -Console.WriteLine ($"Provisioning Xcode from {provision_from_commit}..."); - -// Let's turn symlink into an actual path -var reqXcode = Path.GetDirectoryName (Path.GetDirectoryName ("@XCODE_ROOT_PATH@")); -RemoveXcodeSymlinks (reqXcode); - -// Provision Xcode using the xip name declared in Make.config -Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true); - -LogInstalledXcodes (); diff --git a/tools/dotnet-linker/LinkerConfiguration.cs b/tools/dotnet-linker/LinkerConfiguration.cs index 78e29d716f07..e450d03902ea 100644 --- a/tools/dotnet-linker/LinkerConfiguration.cs +++ b/tools/dotnet-linker/LinkerConfiguration.cs @@ -425,6 +425,11 @@ public static LinkerConfiguration GetInstance (LinkContext context) if (Driver.TargetFramework.Platform != Platform) throw ErrorHelper.CreateError (99, "Inconsistent platforms. TargetFramework={0}, Platform={1}", Driver.TargetFramework.Platform, Platform); + if (Application.XamarinRuntime != XamarinRuntime.MonoVM && Application.UseInterpreter) { + Driver.Log (4, "The interpreter is enabled, but the current runtime isn't MonoVM. The interpreter settings will be ignored."); + Application.UnsetInterpreter (); + } + Driver.ValidateXcode (Application, false, false); Application.InitializeCommon (); diff --git a/tools/dotnet-linker/Steps/ConfigurationAwareStep.cs b/tools/dotnet-linker/Steps/ConfigurationAwareStep.cs index 1fb21c07eccf..fd8c498dcdd6 100644 --- a/tools/dotnet-linker/Steps/ConfigurationAwareStep.cs +++ b/tools/dotnet-linker/Steps/ConfigurationAwareStep.cs @@ -106,17 +106,17 @@ bool CollectProductExceptions (Exception e, [NotNullWhen (true)] out List ErrorHelper.CreateError (ErrorCode, Errors.MX_ConfigurationAwareStepWithAssembly, Name, assembly?.FullName, e.Message)); + return CollectExceptions (e, () => ErrorHelper.CreateError (ErrorCode, e, Errors.MX_ConfigurationAwareStepWithAssembly, Name, assembly?.FullName, e.Message)); } protected virtual Exception [] Fail (Exception e) { - return CollectExceptions (e, () => ErrorHelper.CreateError (ErrorCode | 1, Errors.MX_ConfigurationAwareStep, Name, e.Message)); + return CollectExceptions (e, () => ErrorHelper.CreateError (ErrorCode | 1, e, Errors.MX_ConfigurationAwareStep, Name, e.Message)); } protected virtual Exception [] FailEnd (Exception e) { - return CollectExceptions (e, () => ErrorHelper.CreateError (ErrorCode | 2, Errors.MX_ConfigurationAwareStep, Name, e.Message)); + return CollectExceptions (e, () => ErrorHelper.CreateError (ErrorCode | 2, e, Errors.MX_ConfigurationAwareStep, Name, e.Message)); } Exception [] CollectExceptions (Exception e, Func createException) diff --git a/tools/linker/ApplyPreserveAttribute.cs b/tools/linker/ApplyPreserveAttribute.cs index d2ea827ff674..753fffe14385 100644 --- a/tools/linker/ApplyPreserveAttribute.cs +++ b/tools/linker/ApplyPreserveAttribute.cs @@ -13,7 +13,7 @@ namespace Xamarin.Linker.Steps { public class ApplyPreserveAttribute : ApplyPreserveAttributeBase { -#if !NET +#if !NET || LEGACY_TOOLS HashSet preserve_synonyms; #endif @@ -26,7 +26,7 @@ public override bool IsActiveFor (AssemblyDefinition assembly) return Annotations.GetAction (assembly) == AssemblyAction.Link; } -#if NET +#if NET && !LEGACY_TOOLS protected override void Process (AssemblyDefinition assembly) { base.Process (assembly); @@ -64,7 +64,7 @@ void ProcessAssemblyAttributes (AssemblyDefinition assembly) // (b) it will try to fetch the [Preserve] attribute on the type (and it's not there) as `base` would var type = tr.Resolve (); -#if NET +#if NET && !LEGACY_TOOLS PreserveType (type, attribute); #else Annotations.Mark (type); @@ -78,7 +78,7 @@ void ProcessAssemblyAttributes (AssemblyDefinition assembly) // In .NET6, ApplyPreserveAttribute no longer runs on all assemblies. // [assembly: Preserve (typeof (SomeAttribute))] no longer gives SomeAttribute "Preserve" semantics. -#if !NET +#if !NET || LEGACY_TOOLS // if the type is a custom attribute then it means we want to preserve what's decorated // with this attribute (not just the attribute alone) if (type.Inherits ("System", "Attribute")) { @@ -100,7 +100,7 @@ protected override bool IsPreservedAttribute (ICustomAttributeProvider provider, removeAttribute = true; return true; } -#if NET +#if NET && !LEGACY_TOOLS return false; #else // we need to resolve (as many reference instances can exists) diff --git a/tools/linker/CoreOptimizeGeneratedCode.cs b/tools/linker/CoreOptimizeGeneratedCode.cs index 356e3289ae67..4a653811e9cb 100644 --- a/tools/linker/CoreOptimizeGeneratedCode.cs +++ b/tools/linker/CoreOptimizeGeneratedCode.cs @@ -12,13 +12,13 @@ using Xamarin.Bundler; using MonoTouch.Tuner; -#if NET +#if NET && !LEGACY_TOOLS using Mono.Linker.Steps; #endif namespace Xamarin.Linker { -#if NET +#if NET && !LEGACY_TOOLS public class OptimizeGeneratedCodeHandler : ExceptionalMarkHandler { #else public class OptimizeGeneratedCodeSubStep : ExceptionalSubStep { @@ -30,7 +30,7 @@ public class OptimizeGeneratedCodeSubStep : ExceptionalSubStep { protected override string Name { get; } = "Binding Optimizer"; protected override int ErrorCode { get; } = 2020; -#if NET +#if NET && !LEGACY_TOOLS Dictionary _hasOptimizableCode; Dictionary HasOptimizableCode { get { @@ -76,7 +76,7 @@ protected Optimizations Optimizations { bool? is_arm64_calling_convention; -#if NET +#if NET && !LEGACY_TOOLS public override void Initialize (LinkContext context, MarkContext markContext) #else public override void Initialize (LinkContext context) @@ -112,25 +112,25 @@ public override void Initialize (LinkContext context) is_arm64_calling_convention = false; } } -#if NET +#if NET && !LEGACY_TOOLS markContext.RegisterMarkMethodAction (ProcessMethod); #endif } -#if !NET +#if !NET || LEGACY_TOOLS public override SubStepTargets Targets { get { return SubStepTargets.Assembly | SubStepTargets.Type | SubStepTargets.Method; } } #endif -#if NET +#if NET && !LEGACY_TOOLS bool IsActiveFor (AssemblyDefinition assembly, out bool hasOptimizableCode) #else public override bool IsActiveFor (AssemblyDefinition assembly) #endif { -#if NET +#if NET && !LEGACY_TOOLS hasOptimizableCode = false; if (HasOptimizableCode.TryGetValue (assembly, out bool? optimizable)) { if (optimizable == true) @@ -145,7 +145,7 @@ public override bool IsActiveFor (AssemblyDefinition assembly) #if DEBUG Console.WriteLine ("Assembly {0} : skipped (SDK)", assembly); #endif -#if NET +#if NET && !LEGACY_TOOLS HasOptimizableCode.Add (assembly, null); #endif return false; @@ -157,7 +157,7 @@ public override bool IsActiveFor (AssemblyDefinition assembly) #if DEBUG Console.WriteLine ("Assembly {0} : skipped ({1})", assembly, action); #endif -#if NET +#if NET && !LEGACY_TOOLS HasOptimizableCode.Add (assembly, null); #endif return false; @@ -183,7 +183,7 @@ public override bool IsActiveFor (AssemblyDefinition assembly) Console.WriteLine ("Assembly {0} : no [CompilerGeneratedAttribute] nor [BindingImplAttribute] present (applying basic optimizations)", assembly); #endif // we always apply the step -#if NET +#if NET && !LEGACY_TOOLS HasOptimizableCode.Add (assembly, hasOptimizableCode); #else HasOptimizableCode = hasOptimizableCode; @@ -191,7 +191,7 @@ public override bool IsActiveFor (AssemblyDefinition assembly) return true; } -#if !NET +#if !NET || LEGACY_TOOLS protected override void Process (TypeDefinition type) { if (!HasOptimizableCode) @@ -669,7 +669,7 @@ protected void EliminateDeadCode (MethodDefinition caller) bool GetInlineIntPtrSize (AssemblyDefinition assembly) { -#if NET +#if NET && !LEGACY_TOOLS if (InlineIntPtrSize.TryGetValue (assembly, out bool inlineIntPtrSize)) return inlineIntPtrSize; #else @@ -697,7 +697,7 @@ bool GetInlineIntPtrSize (AssemblyDefinition assembly) if (inlineIntPtrSize) Driver.Log (4, "Optimization 'inline-intptr-size' enabled for assembly '{0}'.", assembly.Name); -#if NET +#if NET && !LEGACY_TOOLS InlineIntPtrSize.Add (assembly, inlineIntPtrSize); #else InlineIntPtrSize = inlineIntPtrSize; @@ -705,7 +705,7 @@ bool GetInlineIntPtrSize (AssemblyDefinition assembly) return inlineIntPtrSize; } -#if !NET +#if !NET || LEGACY_TOOLS protected override void Process (AssemblyDefinition assembly) { GetInlineIntPtrSize (assembly); @@ -723,7 +723,7 @@ bool GetIsExtensionType (TypeDefinition type) protected override void Process (MethodDefinition method) { -#if NET +#if NET && !LEGACY_TOOLS if (!IsActiveFor (method.DeclaringType.Module.Assembly, out bool hasOptimizableCode)) return; #endif @@ -734,7 +734,7 @@ protected override void Process (MethodDefinition method) if (method.IsBindingImplOptimizableCode (LinkContext)) { // We optimize all methods that have the [BindingImpl (BindingImplAttributes.Optimizable)] attribute. } else if ((method.IsGeneratedCode (LinkContext) && ( -#if NET +#if NET && !LEGACY_TOOLS GetIsExtensionType (method.DeclaringType) #else IsExtensionType @@ -789,7 +789,7 @@ protected virtual int ProcessCalls (MethodDefinition caller, Instruction ins) case "get_IsDirectBinding": ProcessIsDirectBinding (caller, ins); break; -#if !NET +#if !NET || LEGACY_TOOLS // ILLink does this optimization since the property returns a constant `true` (built time) // or `false` - if `RegistrarRemovalTrackingStep` decide it's possible to do without case "get_DynamicRegistrationSupported": @@ -845,7 +845,7 @@ void ProcessEnsureUIThread (MethodDefinition caller, Instruction ins) void ProcessIntPtrSize (MethodDefinition caller, Instruction ins) { -#if NET +#if NET && !LEGACY_TOOLS if (!GetInlineIntPtrSize (caller.Module.Assembly)) return; #else @@ -877,7 +877,7 @@ void ProcessIsDirectBinding (MethodDefinition caller, Instruction ins) if (Optimizations.InlineIsDirectBinding != true) return; -#if NET +#if NET && !LEGACY_TOOLS bool? isdirectbinding_constant = IsDirectBindingConstant (caller.DeclaringType); #endif // If we don't know the constant isdirectbinding value, then we can't inline anything @@ -904,7 +904,7 @@ void ProcessIsDirectBinding (MethodDefinition caller, Instruction ins) ins.Operand = null; } -#if !NET +#if !NET || LEGACY_TOOLS void ProcessIsDynamicSupported (MethodDefinition caller, Instruction ins) { const string operation = "inline Runtime.DynamicRegistrationSupported"; diff --git a/tools/linker/CoreTypeMapStep.cs b/tools/linker/CoreTypeMapStep.cs index 2be807fe88d0..877ec85ea5b4 100644 --- a/tools/linker/CoreTypeMapStep.cs +++ b/tools/linker/CoreTypeMapStep.cs @@ -22,14 +22,14 @@ namespace MonoTouch.Tuner { // This class is shared between Xamarin.Mac and Xamarin.iOS public class CoreTypeMapStep : -#if NET +#if NET && !LEGACY_TOOLS ConfigurationAwareStep #else TypeMapStep #endif { -#if NET +#if NET && !LEGACY_TOOLS protected override string Name { get; } = "CoreTypeMap"; protected override int ErrorCode { get; } = 2390; @@ -145,7 +145,7 @@ DerivedLinkContext LinkContext { HashSet cached_isnsobject = new HashSet (); Dictionary isdirectbinding_value = new Dictionary (); -#if NET +#if NET && !LEGACY_TOOLS protected override void TryEndProcess () { #else @@ -159,12 +159,12 @@ protected override void EndProcess () } protected -#if !NET +#if !NET || LEGACY_TOOLS override #endif void MapType (TypeDefinition type) { -#if !NET +#if !NET || LEGACY_TOOLS base.MapType (type); #endif diff --git a/tools/linker/CustomSymbolWriter.cs b/tools/linker/CustomSymbolWriter.cs index 26b8928f9f30..eadad6cfaebf 100644 --- a/tools/linker/CustomSymbolWriter.cs +++ b/tools/linker/CustomSymbolWriter.cs @@ -78,7 +78,7 @@ static ImageDebugHeaderEntry ProcessEntry (ImageDebugHeaderEntry entry) public void Write (MethodDebugInformation info) => _symbolWriter.Write (info); public void Write () => _symbolWriter.Write (); public void Dispose () => _symbolWriter.Dispose (); -#if NET +#if NET && !LEGACY_TOOLS public void Write (ICustomDebugInformationProvider provider) => _symbolWriter.Write (provider); #endif } diff --git a/tools/linker/ExceptionalSubStep.cs b/tools/linker/ExceptionalSubStep.cs index 2c222ea27aa6..48b977bbedb9 100644 --- a/tools/linker/ExceptionalSubStep.cs +++ b/tools/linker/ExceptionalSubStep.cs @@ -18,7 +18,7 @@ public abstract class ExceptionalSubStep : BaseSubStep { protected DerivedLinkContext LinkContext { get { -#if NET +#if NET && !LEGACY_TOOLS return Configuration.DerivedLinkContext; #else return (DerivedLinkContext) base.context; @@ -26,7 +26,7 @@ protected DerivedLinkContext LinkContext { } } -#if NET +#if NET && !LEGACY_TOOLS protected LinkContext context { get { return Context; } } diff --git a/tools/linker/MonoTouch.Tuner/ListExportedSymbols.cs b/tools/linker/MonoTouch.Tuner/ListExportedSymbols.cs index a863498b226e..8f7d5eea35c4 100644 --- a/tools/linker/MonoTouch.Tuner/ListExportedSymbols.cs +++ b/tools/linker/MonoTouch.Tuner/ListExportedSymbols.cs @@ -17,13 +17,13 @@ namespace Xamarin.Linker.Steps { public class ListExportedSymbols : BaseStep { PInvokeWrapperGenerator state; bool is_product_assembly; -#if !NET +#if !NET || LEGACY_TOOLS bool skip_sdk_assemblies; #endif PInvokeWrapperGenerator State { get { -#if NET +#if NET && !LEGACY_TOOLS if (state is null && DerivedLinkContext.App.RequiresPInvokeWrappers) { Configuration.PInvokeWrapperGenerationState = new PInvokeWrapperGenerator () { App = DerivedLinkContext.App, @@ -38,7 +38,7 @@ PInvokeWrapperGenerator State { } } -#if NET +#if NET && !LEGACY_TOOLS protected override void EndProcess () { if (state?.Started == true) { @@ -50,7 +50,7 @@ protected override void EndProcess () } #endif -#if NET +#if NET && !LEGACY_TOOLS public LinkerConfiguration Configuration { get { return LinkerConfiguration.GetInstance (Context); @@ -60,7 +60,7 @@ public LinkerConfiguration Configuration { public DerivedLinkContext DerivedLinkContext { get { -#if NET +#if NET && !LEGACY_TOOLS return Configuration.DerivedLinkContext; #else return (DerivedLinkContext) Context; @@ -68,7 +68,7 @@ public DerivedLinkContext DerivedLinkContext { } } -#if NET +#if NET && !LEGACY_TOOLS public ListExportedSymbols () { } @@ -87,7 +87,7 @@ protected override void ProcessAssembly (AssemblyDefinition assembly) if (Annotations.GetAction (assembly) == AssemblyAction.Delete) return; -#if !NET +#if !NET || LEGACY_TOOLS if (skip_sdk_assemblies && Profile.IsSdkAssembly (assembly)) return; #endif @@ -104,7 +104,7 @@ protected override void ProcessAssembly (AssemblyDefinition assembly) if (!hasSymbols) return; -#if NET +#if NET && !LEGACY_TOOLS is_product_assembly = Configuration.Profile.IsProductAssembly (assembly); #else is_product_assembly = Profile.IsProductAssembly (assembly); @@ -191,7 +191,7 @@ bool ProcessMethod (MethodDefinition method) } } -#if NET +#if NET && !LEGACY_TOOLS // Create a list of all the libraries from Mono that we'll link with // We add 4 different variations for each library: // * with and without a "lib" prefix diff --git a/tools/linker/MonoTouch.Tuner/PreserveSmartEnumConversions.cs b/tools/linker/MonoTouch.Tuner/PreserveSmartEnumConversions.cs index 7eacd4313c79..23e495f1f74c 100644 --- a/tools/linker/MonoTouch.Tuner/PreserveSmartEnumConversions.cs +++ b/tools/linker/MonoTouch.Tuner/PreserveSmartEnumConversions.cs @@ -16,7 +16,7 @@ using Xamarin.Bundler; namespace Xamarin.Linker.Steps { -#if NET +#if NET && !LEGACY_TOOLS public class PreserveSmartEnumConversionsHandler : ExceptionalMarkHandler #else public class PreserveSmartEnumConversionsSubStep : ExceptionalSubStep @@ -26,7 +26,7 @@ public class PreserveSmartEnumConversionsSubStep : ExceptionalSubStep protected override string Name { get; } = "Smart Enum Conversion Preserver"; protected override int ErrorCode { get; } = 2200; -#if NET +#if NET && !LEGACY_TOOLS public override void Initialize (LinkContext context, MarkContext markContext) { base.Initialize (context); @@ -40,7 +40,7 @@ public override SubStepTargets Targets { } #endif -#if NET +#if NET && !LEGACY_TOOLS bool IsActiveFor (AssemblyDefinition assembly) #else public override bool IsActiveFor (AssemblyDefinition assembly) @@ -58,7 +58,7 @@ public override bool IsActiveFor (AssemblyDefinition assembly) return false; } -#if NET +#if NET && !LEGACY_TOOLS void Mark (Tuple pair) { Context.Annotations.Mark (pair.Item1); @@ -78,7 +78,7 @@ void Preserve (Tuple pair, MethodDefinition } #endif -#if NET +#if NET && !LEGACY_TOOLS void ProcessAttributeProvider (ICustomAttributeProvider provider) #else void ProcessAttributeProvider (ICustomAttributeProvider provider, MethodDefinition conditionA, MethodDefinition conditionB = null) @@ -111,7 +111,7 @@ void ProcessAttributeProvider (ICustomAttributeProvider provider, MethodDefiniti Tuple pair; if (cache is not null && cache.TryGetValue (managedEnumType, out pair)) { -#if NET +#if NET && !LEGACY_TOOLS // The pair was already marked if it was cached. #else Preserve (pair, conditionA, conditionB); @@ -173,7 +173,7 @@ void ProcessAttributeProvider (ICustomAttributeProvider provider, MethodDefiniti if (cache is null) cache = new Dictionary> (); cache.Add (managedEnumType, pair); -#if NET +#if NET && !LEGACY_TOOLS Mark (pair); #else Preserve (pair, conditionA, conditionB); @@ -183,7 +183,7 @@ void ProcessAttributeProvider (ICustomAttributeProvider provider, MethodDefiniti protected override void Process (MethodDefinition method) { -#if NET +#if NET && !LEGACY_TOOLS static bool IsPropertyMethod (MethodDefinition method) { return method.IsGetter || method.IsSetter; @@ -213,7 +213,7 @@ static bool IsPropertyMethod (MethodDefinition method) #endif } -#if !NET +#if !NET || LEGACY_TOOLS protected override void Process (PropertyDefinition property) { ProcessAttributeProvider (property, property.GetMethod, property.SetMethod); diff --git a/tools/linker/ObjCExtensions.cs b/tools/linker/ObjCExtensions.cs index cfe09d7448a4..efcdc9ed3ff4 100644 --- a/tools/linker/ObjCExtensions.cs +++ b/tools/linker/ObjCExtensions.cs @@ -97,7 +97,7 @@ static class ObjCExtensions { public static bool IsNSObject (this TypeReference type, DerivedLinkContext link_context) { return -#if NET +#if NET && !LEGACY_TOOLS link_context.LinkerConfiguration.Context.Resolve (type) #else type.Resolve () @@ -112,7 +112,7 @@ public static bool IsNSObject (this TypeDefinition type, DerivedLinkContext link return link_context.CachedIsNSObject.Contains (type); return type.Inherits (Namespaces.Foundation, "NSObject" -#if NET +#if NET && !LEGACY_TOOLS , link_context.LinkerConfiguration.Context #endif ); diff --git a/tools/linker/RegistrarRemovalTrackingStep.cs b/tools/linker/RegistrarRemovalTrackingStep.cs index 56da6bf6260b..950f01fa69d0 100644 --- a/tools/linker/RegistrarRemovalTrackingStep.cs +++ b/tools/linker/RegistrarRemovalTrackingStep.cs @@ -6,7 +6,7 @@ using Xamarin.Bundler; using Xamarin.Linker; -#if !NET +#if !NET || LEGACY_TOOLS using Mono.Linker.Steps; using Mono.Tuner; using Xamarin.Tuner; @@ -14,7 +14,7 @@ namespace MonoTouch.Tuner { -#if NET +#if NET && !LEGACY_TOOLS public class RegistrarRemovalTrackingStep : ConfigurationAwareStep { protected override string Name { get; } = "RegistrarRemovalTracking"; @@ -146,7 +146,7 @@ bool RequiresDynamicRegistrar (AssemblyDefinition assembly, bool warnIfRequired) break; case ".ctor": var md = mr.Resolve () as MethodDefinition; -#if NET +#if NET && !LEGACY_TOOLS requires |= Xamarin.Linker.OptimizeGeneratedCodeHandler.IsBlockLiteralCtor_Type_String (md); #else requires |= Xamarin.Linker.OptimizeGeneratedCodeSubStep.IsBlockLiteralCtor_Type_String (md); @@ -179,7 +179,7 @@ void Warn (AssemblyDefinition assembly, MemberReference mr) ErrorHelper.Warning (WarnCode, Errors.MM2107, assembly.Name.Name, mr.DeclaringType.FullName, mr.Name, string.Join (", ", ((MethodReference) mr).Parameters.Select ((v) => v.ParameterType.FullName))); } -#if NET +#if NET && !LEGACY_TOOLS protected override void TryEndProcess () { #else diff --git a/tools/mlaunch/Makefile b/tools/mlaunch/Makefile index c465c35fd8b8..7335cd392193 100644 --- a/tools/mlaunch/Makefile +++ b/tools/mlaunch/Makefile @@ -7,28 +7,12 @@ DOTNET_PLATFORMS_MOBILE=$(filter-out macOS MacCatalyst,$(DOTNET_PLATFORMS)) DOWNLOAD_STAMP_FILE=.download-$(MLAUNCH_NUGET_VERSION).stamp -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_IOS -TARGETS += $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch -endif -endif - TARGETS += $(foreach platform,$(DOTNET_PLATFORMS_MOBILE),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/tools/bin/mlaunch) $(DOWNLOAD_STAMP_FILE): $(Q) $(DOTNET) restore download-mlaunch.csproj /bl:$@.binlog $(MSBUILD_VERBOSITY) /p:MlaunchNuGetVersion=$(MLAUNCH_NUGET_VERSION) $(Q) touch $@ -$(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch: $(DOWNLOAD_STAMP_FILE) - $(Q) rm -Rf $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch - $(Q) rm -Rf $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mlaunch - $(Q) mkdir -p $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/ - $(Q) mkdir -p $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ - $(Q) $(CP) -R $(TOP)/packages/microsoft.tools.mlaunch/$(MLAUNCH_NUGET_VERSION)/mlaunch/bin/mlaunch $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/ - $(Q) $(CP) -R $(TOP)/packages/microsoft.tools.mlaunch/$(MLAUNCH_NUGET_VERSION)/mlaunch/lib/mlaunch $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ - $(Q) chmod a+x $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch - $(Q) chmod a+x $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mlaunch/mlaunch.app/Contents/MacOS/mlaunch - define DotNetInstall $$(DOTNET_DESTDIR)/Microsoft.$(1).Sdk/tools/bin/mlaunch: $$(DOWNLOAD_STAMP_FILE) $$(Q) rm -rf $$(DOTNET_DESTDIR)/$($(1)_NUGET_SDK_NAME)/tools/bin/mlaunch @@ -44,16 +28,8 @@ endef $(foreach platform,$(DOTNET_PLATFORMS_MOBILE),$(eval $(call DotNetInstall,$(platform)))) clean-local:: -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_IOS - $(Q) rm -rf $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch - $(Q) rm -rf $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mlaunch -endif -endif -ifdef ENABLE_DOTNET $(Q) rm -rf $(foreach platform,$(DOTNET_PLATFORMS_MOBILE),$(DOTNET_DESTDIR)/$($(platform)_NUGET_SDK_NAME)/tools/bin/mlaunch) $(Q) rm -rf $(foreach platform,$(DOTNET_PLATFORMS_MOBILE),$(DOTNET_DESTDIR)/$($(platform)_NUGET_SDK_NAME)/tools/lib/mlaunch) -endif $(Q) rm -rf .*.stamp obj .*.binlog all-local:: $(TARGETS) diff --git a/tools/mmp/Info-framework.plist.tmpl b/tools/mmp/Info-framework.plist.tmpl deleted file mode 100644 index 061e19ffb4a2..000000000000 --- a/tools/mmp/Info-framework.plist.tmpl +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - @BUNDLEDISPLAYNAME@ - CFBundleExecutable - @EXECUTABLE@ - CFBundleIdentifier - @BUNDLEID@ - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - @BUNDLENAME@ - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 1 - - diff --git a/tools/mmp/Info.plist.tmpl b/tools/mmp/Info.plist.tmpl deleted file mode 100644 index 10dd9bcbbc28..000000000000 --- a/tools/mmp/Info.plist.tmpl +++ /dev/null @@ -1,30 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - @BUNDLEDISPLAYNAME@ - CFBundleExecutable - @EXECUTABLE@ - CFBundleIdentifier - @BUNDLEID@ - @BUNDLEICON@CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - @BUNDLENAME@ - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 0.0 - NSPrincipalClass - NSApplication - NSMainNibFile - MainWindow.nib - MonoBundleExecutable - @ASSEMBLY@ - - diff --git a/tools/mmp/Makefile b/tools/mmp/Makefile index 5e0e31e53b67..be210c758496 100644 --- a/tools/mmp/Makefile +++ b/tools/mmp/Makefile @@ -9,15 +9,16 @@ export DEVELOPER_DIR=$(XCODE_DEVELOPER_ROOT) MMP_CONF=Release MMP_DIR=bin/$(MMP_CONF) -LOCAL_MMP=$(MMP_DIR)/mmp.exe -LOCAL_MMP_COMMAND=$(SYSTEM_MONO) --debug $(LOCAL_MMP) +LOCAL_MMP=$(MMP_DIR)/mmp.dll +LOCAL_MMP_COMMAND=$(DOTNET) exec $(LOCAL_MMP) # mmp.csproj.inc contains the mmp_dependencies variable used to determine if mmp needs to be rebuilt or not. mmp.csproj.inc: export BUILD_VERBOSITY=$(MSBUILD_VERBOSITY) +mmp.csproj.inc: export DOTNET:=$(DOTNET) -include mmp.csproj.inc -$(MMP_DIR)/mmp.exe: $(mmp_dependencies) - $(Q_GEN) $(SYSTEM_MSBUILD) "/bl:$@.binlog" mmp.csproj /r $(XBUILD_VERBOSITY) /p:Configuration=$(MMP_CONF) +$(LOCAL_MMP): $(mmp_dependencies) + $(Q_GEN) $(DOTNET) build "/bl:$@.binlog" mmp.csproj $(XBUILD_VERBOSITY) /p:Configuration=$(MMP_CONF) MMP_TARGETS_DOTNET = \ $(DOTNET_DESTDIR)/$(osx-x64_NUGET_RUNTIME_NAME)/runtimes/osx-x64/native/Microsoft.macOS.registrar.a \ @@ -25,32 +26,10 @@ MMP_TARGETS_DOTNET = \ $(DOTNET_DESTDIR)/$(osx-x64_NUGET_RUNTIME_NAME)/runtimes/osx-x64/native/Microsoft.macOS.registrar.coreclr.a \ $(DOTNET_DESTDIR)/$(osx-arm64_NUGET_RUNTIME_NAME)/runtimes/osx-arm64/native/Microsoft.macOS.registrar.coreclr.a \ -MMP_TARGETS = \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/mmp \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/mmp.exe \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Xamarin.Mac.registrar.mobile.a \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Xamarin.Mac.registrar.full.a \ - MMP_DIRECTORIES_DOTNET = \ $(DOTNET_DESTDIR)/$(osx-x64_NUGET_RUNTIME_NAME)/runtimes/osx-x64/native \ $(DOTNET_DESTDIR)/$(osx-arm64_NUGET_RUNTIME_NAME)/runtimes/osx-arm64/native \ -MMP_DIRECTORIES = \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin \ - $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp \ - $(MMP_DIRECTORIES_DOTNET) \ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin/mmp: mmp | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/bin - $(Q) $(CP) $< $@ - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/mmp.exe: $(MMP_DIR)/mmp.exe | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp - $(Q) $(CP) $(dir $<)/*.exe $(dir $@) - $(Q) $(CP) $(dir $<)/*.dll $(dir $@) - $(Q) $(CP) $(dir $<)/*.pdb $(dir $@) - -$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp/Xamarin.Mac.registrar.%.a: Xamarin.Mac.registrar.%.a | $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/mmp - $(Q) $(CP) $<* $(dir $@) - $(DOTNET_DESTDIR)/$(osx-x64_NUGET_RUNTIME_NAME)/runtimes/osx-x64/native/Microsoft.macOS.registrar.a: Microsoft.macOS.registrar.x86_64.a | $(DOTNET_DESTDIR)/$(osx-x64_NUGET_RUNTIME_NAME)/runtimes/osx-x64/native $(Q) $(CP) $< $@ @@ -70,15 +49,7 @@ $(MMP_DIRECTORIES): # Partial static registrar libraries # -GENERATE_PART_REGISTRAR = $(Q_GEN) $(LOCAL_MMP_COMMAND) --xamarin-framework-directory=$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR) -q --runregistrar:$(abspath $@) --sdkroot $(XCODE_DEVELOPER_ROOT) --sdk $(MACOS_SDK_VERSION) $(abspath $<) --registrar:static --nolink - -Xamarin.Mac.registrar.mobile.x86_64.m: $(TOP)/src/build/mac/mobile-64/Xamarin.Mac.dll $(LOCAL_MMP) - $(GENERATE_PART_REGISTRAR) --arch=x86_64 --target-framework Xamarin.Mac,Version=v2.0,Profile=Mobile -a:$(MOBILE_BCL_DIR)/mscorlib.dll - $(Q) touch Xamarin.Mac.registrar.mobile.x86_64.m Xamarin.Mac.registrar.mobile.x86_64.h - -Xamarin.Mac.registrar.mobile.arm64.m: $(TOP)/src/build/mac/mobile-64/Xamarin.Mac.dll $(LOCAL_MMP) - $(GENERATE_PART_REGISTRAR) --arch=arm64 --target-framework Xamarin.Mac,Version=v2.0,Profile=Mobile -a:$(MOBILE_BCL_DIR)/mscorlib.dll - $(Q) touch Xamarin.Mac.registrar.mobile.arm64.m Xamarin.Mac.registrar.mobile.arm64.h +GENERATE_PART_REGISTRAR = $(Q_GEN) $(LOCAL_MMP_COMMAND) -q --runregistrar:$(abspath $@) --sdkroot $(XCODE_DEVELOPER_ROOT) --sdk $(MACOS_SDK_VERSION) $(abspath $<) --registrar:static --nolink Microsoft.macOS.registrar.x86_64.m: $(TOP)/src/build/dotnet/macos/64/Microsoft.macOS.dll $(LOCAL_MMP) $(GENERATE_PART_REGISTRAR) --arch=x86_64 --target-framework .NETCoreApp,Version=$(subst net,,$(DOTNET_TFM)),Profile=macos -a:$(DOTNET_BCL_DIR)/System.Runtime.dll -a:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll @@ -88,10 +59,6 @@ Microsoft.macOS.registrar.coreclr.x86_64.m: $(TOP)/src/build/dotnet/macos/64/Mic $(GENERATE_PART_REGISTRAR) --arch=x86_64 --target-framework .NETCoreApp,Version=$(subst net,,$(DOTNET_TFM)),Profile=macos -a:$(DOTNET_BCL_DIR)/System.Runtime.dll -a:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll --xamarin-runtime CoreCLR $(Q) touch $@ $(basename $@).h -Xamarin.Mac.registrar.full.x86_64.m: $(TOP)/src/build/mac/full-64/Xamarin.Mac.dll $(LOCAL_MMP) - $(GENERATE_PART_REGISTRAR) --arch=x86_64 --target-framework Xamarin.Mac,Version=v4.5,Profile=Full -a:$(FULL_BCL_DIR)/mscorlib.dll - $(Q) touch Xamarin.Mac.registrar.full.x86_64.m Xamarin.Mac.registrar.full.x86_64.h - Microsoft.macOS.registrar.arm64.m: $(TOP)/src/build/dotnet/macos/64/Microsoft.macOS.dll $(LOCAL_MMP) $(GENERATE_PART_REGISTRAR) --arch=arm64 --target-framework .NETCoreApp,Version=$(subst net,,$(DOTNET_TFM)),Profile=macos -a:$(DOTNET_BCL_DIR)/System.Runtime.dll -a:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll $(Q) touch $@ $(basename $@).h @@ -100,44 +67,20 @@ Microsoft.macOS.registrar.coreclr.arm64.m: $(TOP)/src/build/dotnet/macos/64/Micr $(GENERATE_PART_REGISTRAR) --arch=arm64 --target-framework .NETCoreApp,Version=$(subst net,,$(DOTNET_TFM)),Profile=macos -a:$(DOTNET_BCL_DIR)/System.Runtime.dll -a:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll --xamarin-runtime CoreCLR $(Q) touch $@ $(basename $@).h -Xamarin.Mac.registrar.full.arm64.m: $(TOP)/src/build/mac/full-64/Xamarin.Mac.dll $(LOCAL_MMP) - $(GENERATE_PART_REGISTRAR) --arch=arm64 --target-framework Xamarin.Mac,Version=v4.5,Profile=Full -a:$(FULL_BCL_DIR)/mscorlib.dll - $(Q) touch Xamarin.Mac.registrar.full.arm64.m Xamarin.Mac.registrar.full.arm64.h - %.x86_64.a: %.x86_64.m $(Q_CC) $(MAC_CC) -DDEBUG -g -gdwarf-2 -x objective-c++ -std=c++14 -o $@ -c -arch x86_64 $< -Wall -Wno-unguarded-availability-new -I$(TOP)/runtime -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -fobjc-runtime=macosx $(EXTRA_DEFINES) %.arm64.a: %.arm64.m $(Q_CC) $(MAC_CC) -DDEBUG -g -gdwarf-2 -x objective-c++ -std=c++14 -o $@ -c -arch arm64 $< -Wall -Wno-unguarded-availability-new -I$(TOP)/runtime -mmacosx-version-min=$(MIN_MACOS_SDK_VERSION) -fobjc-runtime=macosx $(EXTRA_DEFINES) -Xamarin.Mac.registrar.%.a: Xamarin.Mac.registrar.%.x86_64.a Xamarin.Mac.registrar.%.arm64.a - $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ - dotnet: $(MMP_TARGETS_DOTNET) -ifdef ENABLE_DOTNET ifdef INCLUDE_MAC install-local:: $(MMP_TARGETS_DOTNET) all-local:: $(MMP_TARGETS_DOTNET) endif -endif - -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_MAC -install-local:: $(MMP_TARGETS) -all-local:: $(MMP_TARGETS) -endif -endif clean-local:: - rm -f mmp.stub.c mmp.helper.o rm -rf bin obj - rm -f Xamarin.Mac.registrar.* - $(SYSTEM_MSBUILD) "/t:Clean" /p:Configuration=$(MMP_CONF) *.csproj include $(TOP)/mk/rules.mk include ../common/Make.common - -# make will automatically consider files created in chained implicit rules as temporary files, and delete them afterwards -# marking those files as .SECONDARY will prevent that deletion. -.SECONDARY: $(foreach ext,h m a,Xamarin.Mac.registrar.mobile.x86_64.$(ext) Xamarin.Mac.registrar.mobile.arm64.$(ext) Xamarin.Mac.registrar.full.x86_64.$(ext) Xamarin.Mac.registrar.full.arm64.$(ext)) -.SECONDARY: Xamarin.Mac.registrar.mobile.a Xamarin.Mac.registrar.full.a diff --git a/tools/mmp/config b/tools/mmp/config deleted file mode 100644 index 46c8738be6ee..000000000000 --- a/tools/mmp/config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/mmp/config_mobile b/tools/mmp/config_mobile deleted file mode 100644 index 02f8a00ae6dc..000000000000 --- a/tools/mmp/config_mobile +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/tools/mmp/driver.cs b/tools/mmp/driver.cs index 8b09f333896e..f049b5bfc23b 100644 --- a/tools/mmp/driver.cs +++ b/tools/mmp/driver.cs @@ -497,7 +497,7 @@ static void Pack (IList unprocessed) if (Profile.IsSdkAssembly (root_wo_ext) || Profile.IsProductAssembly (root_wo_ext)) throw new ProductException (3, true, Errors.MX0003, root_wo_ext); - if (App.References.Exists (a => Path.GetFileNameWithoutExtension (a).Equals (root_wo_ext))) + if (App.References.Exists (a => Path.GetFileNameWithoutExtension (a).Equals (root_wo_ext, StringComparison.Ordinal))) throw new ProductException (23, true, Errors.MM0023, root_wo_ext); fx_dir = GetPlatformFrameworkDirectory (App); diff --git a/tools/mmp/machine.4_5.config b/tools/mmp/machine.4_5.config deleted file mode 100644 index 3dd62131762a..000000000000 --- a/tools/mmp/machine.4_5.config +++ /dev/null @@ -1,302 +0,0 @@ - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    - - - -
    - -
    -
    -
    -
    - - - - -
    -
    -
    - -
    - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/mmp/mmp b/tools/mmp/mmp deleted file mode 100755 index 62ba80a9b783..000000000000 --- a/tools/mmp/mmp +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -e - -pushd "$(dirname "$0")" > /dev/null -BIN_DIR=$(pwd -P) -popd > /dev/null - -exec /Library/Frameworks/Mono.framework/Commands/mono --debug "$BIN_DIR/../lib/mmp/mmp.exe" "$@" diff --git a/tools/mmp/mmp.csproj b/tools/mmp/mmp.csproj index c8522084c3b8..ae18dba271b6 100644 --- a/tools/mmp/mmp.csproj +++ b/tools/mmp/mmp.csproj @@ -1,44 +1,18 @@ - + - Debug - AnyCPU - {F3232882-0FA0-4BB6-9D9C-E2CC779EAF0D} Exe - mmp - mmp - v4.8 + net$(BundledNETCoreAppTargetFrameworkVersion) latest - - - True - portable - False - bin\Debug - MONOMAC;MMP;DEBUG - prompt - 4 - True - true - - - true - portable - False - bin\Release - prompt - MONOMAC;MMP - 4 - True + false + false + false + false + MONOMAC;MMP;LEGACY_TOOLS true - - - - - @@ -318,8 +292,8 @@ tools\linker\MonoTouch.Tuner\PreserveSmartEnumConversions.cs - - src\build\mac\Constants.cs + + src\build\dotnet\macos\Constants.cs src\ObjCRuntime\Constants.cs @@ -491,23 +465,7 @@ tools\common\XamarinRuntime.cs - - - config - - - config_mobile - - - machine.4_5.config - - - Info-framework.plist.tmpl - - - Info.plist.tmpl - tools\mtouch\Errors.resx ResXFileCodeGenerator @@ -568,12 +526,6 @@ Xamarin.Bundler.Errors.zh-Hant - - - - docs\website\mmp-errors.md - - diff --git a/tools/mtouch/Errors.designer.cs b/tools/mtouch/Errors.designer.cs index 7f9c62922ebf..bb89458e8651 100644 --- a/tools/mtouch/Errors.designer.cs +++ b/tools/mtouch/Errors.designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/tools/mtouch/Makefile b/tools/mtouch/Makefile index b09ac77dff9a..6ee9d92a7a99 100644 --- a/tools/mtouch/Makefile +++ b/tools/mtouch/Makefile @@ -5,240 +5,26 @@ include $(TOP)/Make.config # in system headers show up. export CCACHE_CPP2=1 -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -SIMLAUNCHERS = simlauncher32-sgen simlauncher64-sgen -else -SIMLAUNCHERS = simlauncher64-sgen -endif - -UNREFERENCED_SYMBOLS = \ - _xamarin_dyn_objc_msgSend \ - _xamarin_dyn_objc_msgSendSuper \ - _xamarin_dyn_objc_msgSend_stret \ - _xamarin_dyn_objc_msgSendSuper_stret \ - _xamarin_init_nsthread \ - _xamarin_get_block_descriptor \ - _xamarin_get_locale_country_code \ - _xamarin_log \ - _xamarin_localized_string_format \ - _xamarin_localized_string_format_1 \ - _xamarin_localized_string_format_2 \ - _xamarin_localized_string_format_3 \ - _xamarin_localized_string_format_4 \ - _xamarin_localized_string_format_5 \ - _xamarin_localized_string_format_6 \ - _xamarin_localized_string_format_7 \ - _xamarin_localized_string_format_8 \ - _xamarin_localized_string_format_9 \ - _xamarin_start_wwan \ - _xamarin_timezone_get_data \ - _xamarin_timezone_get_names \ - _xamarin_timezone_get_local_name \ - _xamarin_IntPtr_objc_msgSend_IntPtr_exception \ - _xamarin_IntPtr_objc_msgSendSuper_IntPtr_exception \ - _xamarin_release_managed_ref \ - _xamarin_CGPoint__VNNormalizedFaceBoundingBoxPointForLandmarkPoint_Vector2_CGRect_nuint_nuint_string \ - _xamarin_CGPoint__VNImagePointForFaceLandmarkPoint_Vector2_CGRect_nuint_nuint_string \ - _CloseZStream \ - _CreateZStream \ - _Flush \ - _ReadZStream \ - _WriteZStream - -# The frameworks order is important as some symbols can be duplicated -# e.g. NSURLResponse is both in CFNetwork and Foundation in iOS8 but linking to -# CFNetwork will result in binaries that won't work with earlier iOS versions -SIMLAUNCHER_FRAMEWORKS = \ - -framework CoreFoundation \ - -framework CoreGraphics \ - -framework Foundation \ - -framework AVFoundation \ - -framework Accelerate \ - -framework AddressBook \ - -framework AddressBookUI \ - -framework AudioToolbox \ - -framework CFNetwork \ - -framework CoreAudio \ - -framework CoreData \ - -framework CoreLocation \ - -framework CoreText \ - -framework ExternalAccessory \ - -framework MapKit \ - -framework MediaPlayer \ - -framework MessageUI \ - -framework MobileCoreServices \ - -framework OpenAL \ - -framework OpenGLES \ - -framework StoreKit \ - -framework SystemConfiguration \ - -framework UIKit \ - \ - -weak_framework CoreMedia \ - -weak_framework CoreMidi \ - -weak_framework CoreMotion \ - -weak_framework CoreTelephony \ - -weak_framework CoreVideo \ - -weak_framework EventKit \ - -weak_framework EventKitUI \ - -weak_framework ImageIO \ - -weak_framework Security \ - -weak_framework QuickLook \ - -weak_framework iAd \ - -weak_framework Accounts \ - -weak_framework GLKit \ - -weak_framework CoreImage \ - -weak_framework CoreBluetooth \ - -weak_framework Twitter \ - -weak_framework PassKit \ - -weak_framework Social \ - -weak_framework AdSupport \ - -weak_framework JavaScriptCore \ - -weak_framework MultipeerConnectivity \ - -weak_framework SafariServices \ - -weak_framework SpriteKit \ - \ - -weak_framework HomeKit \ - -weak_framework HealthKit \ - -weak_framework LocalAuthentication \ - -weak_framework NotificationCenter \ - -weak_framework PushKit \ - -weak_framework Photos \ - -weak_framework PhotosUI \ - -weak_framework SceneKit \ - -weak_framework CloudKit \ - -weak_framework AVKit \ - -weak_framework WebKit \ - -weak_framework NetworkExtension \ - -weak_framework Metal \ - -weak_framework CoreAudioKit \ - \ - -weak_framework ReplayKit \ - -weak_framework Contacts \ - -weak_framework ContactsUI \ - -weak_framework CoreSpotlight \ - -weak_framework WatchConnectivity \ - -weak_framework ModelIO \ - -weak_framework GameplayKit \ - -weak_framework Metal \ - -weak_framework MetalKit \ - -weak_framework MetalPerformanceShaders \ - -weak_framework MetalPerformanceShadersGraph\ - \ - -weak_framework HealthKitUI \ - \ - -weak_framework CallKit \ - -weak_framework Messages \ - -weak_framework Speech \ - -weak_framework VideoSubscriberAccount \ - -weak_framework UserNotifications \ - -weak_framework UserNotificationsUI \ - -weak_framework Intents \ - -weak_framework IntentsUI \ - \ - -weak_framework ARKit \ - -weak_framework FileProvider \ - -weak_framework FileProviderUI \ - \ - -weak_framework IdentityLookup \ - -weak_framework BusinessChat \ - -weak_framework ClassKit \ - \ - -weak_framework AuthenticationServices \ - -weak_framework CarPlay \ - -weak_framework IdentityLookupUI \ - -weak_framework NaturalLanguage \ - -weak_framework Network \ - -weak_framework IdentityLookupUI \ - -weak_framework VisionKit \ - \ - -weak_framework BackgroundTasks \ - -weak_framework CoreHaptics \ - -weak_framework LinkPresentation \ - -weak_framework MetricKit \ - -weak_framework PencilKit \ - -weak_framework QuickLookThumbnailing \ - -weak_framework SoundAnalysis \ - -weak_framework VisionKit \ - \ - -weak_framework AutomaticAssessmentConfiguration \ - \ - -weak_framework Accessibility \ - -weak_framework AppClip \ - -weak_framework AppTrackingTransparency \ - -weak_framework ScreenTime \ - -weak_framework SensorKit \ - -weak_framework UniformTypeIdentifiers \ - -weak_framework NearbyInteraction \ - \ - -weak_framework AdServices \ - \ - -weak_framework CoreLocationUI \ - -weak_framework OSLog \ - \ - -weak_framework AVRouting \ - -weak_framework BackgroundAssets \ - -weak_framework SafetyKit \ - -weak_framework DeviceDiscoveryExtension \ - -weak_framework SharedWithYou \ - -weak_framework SharedWithYouCore \ - \ - -weak_framework Symbols \ - -weak_framework SensitiveContentAnalysis \ - -weak_framework BrowserEngineKit \ - -SIMLAUNCHER64_FRAMEWORKS = \ - -framework GameKit \ -# keep the above list of weak_framework -# 1. grouped by iOS versions; -# 2. sorted and -# 3. in sync with the list inside `tools/common/Frameworks.cs` -# except it is no a mistake that GameController and MediaAccessibility (#13636) are not built into simlauncher - -# note: there _was_ no CoreAudioKit.framework or Metal.framework for the simulator (before recent iOS9 betas) -# note 2: there's no GameKit, in iOS 9 (beta 3 at least), you're supposed to reference GameCenter instead (looks fixed in beta 4) -# note 3: there's no MetalKit or MetalPerformanceShaders in iOS 9 beta 4 - but other frameworks were added -# note 4: GameCenter was removed in Xcode 7 beta 5, and GameKit is back. -# note 5: Metal* seems to be supported as of some Xcode 7 beta (b2 didn't, but the final release does) -# note 6: Xcode 11 beta 1 shipped without WatchKit. -# note 7: Xcode 11 beta 3 documented that shipping without WatchKit was done on purpose (in the release notes). -# note 8: Xcode 14 beta 2 removed GameKit for 32-bit iOS - -define SimlauncherTemplate - -simlauncher$(3)-sgen: simlauncher.mm $(TOP)/runtime/.libs/iphonesimulator/libxamarin-debug.a Makefile Xamarin.iOS.registrar.ios.simulator.a - $(QT_CC) $(SIMULATOR_CC) -DDEBUG -DSIMLAUNCHER $(1) -gdwarf-2 \ - -L$(TOP)/runtime/.libs/iphonesimulator \ - -I$(TOP)/runtime \ - $(MONO_IOS_SDK_DESTDIR)/ios-libs/ios-sim/libmonosgen-2.0.a \ - $(foreach u,$(UNREFERENCED_SYMBOLS),-u $u) \ - $(TOP)/runtime/.libs/iphonesimulator/libapp.a \ - -Wl,-w \ - -lz -liconv $(TOP)/runtime/.libs/iphonesimulator/libxamarin-debug.a simlauncher.mm $(SIMLAUNCHER_FRAMEWORKS) $(SIMLAUNCHER$(3)_FRAMEWORKS) $(SIMULATOR$(2)_OBJC_CFLAGS) -o $$@ - $(Q) xcrun otool -L $$@ > $$@.frameworks -endef - -$(eval $(call SimlauncherTemplate,Xamarin.iOS.registrar.ios.simulator.a,86,32)) -$(eval $(call SimlauncherTemplate,Xamarin.iOS.registrar.ios.simulator.a,64,64)) - # # mtouch # MTOUCH_CONF=Release MTOUCH_DIR=bin/$(MTOUCH_CONF) -LOCAL_MTOUCH=$(MTOUCH_DIR)/mtouch.exe -LOCAL_MTOUCH_COMMAND=$(SYSTEM_MONO) --debug $(LOCAL_MTOUCH) +LOCAL_MTOUCH=$(MTOUCH_DIR)/mtouch.dll +LOCAL_MTOUCH_COMMAND=$(DOTNET) exec $(LOCAL_MTOUCH) DOTNET_PLATFORMS_MTOUCH=$(filter-out macOS,$(DOTNET_PLATFORMS)) # mtouch.csproj.inc contains the mtouch_dependencies variable used to determine if mtouch needs to be rebuilt or not. mtouch.csproj.inc: export BUILD_VERBOSITY=$(MSBUILD_VERBOSITY) +mtouch.csproj.inc: export DOTNET:=$(DOTNET) -include mtouch.csproj.inc -$(MTOUCH_DIR)/mtouch.exe: $(mtouch_dependencies) - $(Q_GEN) $(SYSTEM_MSBUILD) mtouch.csproj /r $(XBUILD_VERBOSITY) /p:Configuration=$(MTOUCH_CONF) +$(LOCAL_MTOUCH): $(mtouch_dependencies) + $(Q_GEN) $(DOTNET) build mtouch.csproj $(DOTNET_BUILD_VERBOSITY) /p:Configuration=$(MTOUCH_CONF) -Constants.cs: Constants.cs.in Makefile $(TOP)/Make.config.inc +$(abspath Constants.cs): Constants.cs.in Makefile $(TOP)/Make.config.inc $(Q_GEN) sed \ -e "s/@VERSION@/$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)/g" \ -e 's/@REVISION@/$(IOS_COMMIT_DISTANCE) ($(CURRENT_BRANCH_SED_ESCAPED): $(CURRENT_HASH))/g' \ @@ -247,168 +33,36 @@ Constants.cs: Constants.cs.in Makefile $(TOP)/Make.config.inc # Partial static registrar libraries # define RunRegistrar -%.registrar.$(1).$(2).m %.registrar.$(1).$(2).h: $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/$(3)bits/$(9)/%.dll $(LOCAL_MTOUCH) - $$(Q_GEN) $$(LOCAL_MTOUCH_COMMAND) --xamarin-framework-directory=$$(IOS_DESTDIR)/$$(MONOTOUCH_PREFIX) $$(MTOUCH_VERBOSITY) --runregistrar:$$(abspath $$(basename $$@).m) --sdkroot $$(XCODE_DEVELOPER_ROOT) --sdk $(4) $$< --registrar:static --target-framework Xamarin.$(5),v1.0 --abi $(2) -r:$(8)/mscorlib.dll - $$(Q) touch $$(basename $$@).m $$(basename $$@).h - .libs/Microsoft.$(9).registrar.$(10)%m .libs/Microsoft.$(9).registrar.$(10)%h: $(TOP)/src/build/dotnet/$(1)/$(3)/Microsoft.$(9).dll $(LOCAL_MTOUCH) | .libs - $$(Q_GEN) $$(LOCAL_MTOUCH_COMMAND) --xamarin-framework-directory=$$(IOS_DESTDIR)/$$(MONOTOUCH_PREFIX) $$(MTOUCH_VERBOSITY) --runregistrar:$$(abspath $$(basename $$@).m) --sdkroot $$(XCODE_DEVELOPER_ROOT) --sdk $(4) $$< --registrar:static --target-framework .NETCoreApp,Version=$(subst net,,$(DOTNET_TFM)),Profile=$(1) --abi $(2) -r:$(DOTNET_BCL_DIR)/System.Runtime.dll -r:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll --rid $(10) + $$(Q_GEN) $$(LOCAL_MTOUCH_COMMAND) $$(MTOUCH_VERBOSITY) --runregistrar:$$(abspath $$(basename $$@).m) --sdkroot $$(XCODE_DEVELOPER_ROOT) --sdk $(4) $$< --registrar:static --target-framework .NETCoreApp,Version=$(subst net,,$(DOTNET_TFM)),Profile=$(1) --abi $(2) -r:$(DOTNET_BCL_DIR)/System.Runtime.dll -r:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll --rid $(10) $$(Q) touch $$(basename $$@).m $$(basename $$@).h -%.registrar.$(1).$(2).a: %.registrar.$(1).$(2).m %.registrar.$(1).$(2).h - $$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(7) -I$(TOP)/runtime - .libs/Microsoft.$(9).registrar.$(10).a: .libs/Microsoft.$(9).registrar.$(10).m .libs/Microsoft.$(9).registrar.$(10).h | .libs - $$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(7) -I$(TOP)/runtime - -# make will automatically consider files created in chained implicit rules as temporary files, and delete them afterwards -# marking those files as .SECONDARY will prevent that deletion. -.SECONDARY: Xamarin.$(5).registrar.$(1).$(2).m Xamarin.$(5).registrar.$(1).$(2).h Xamarin.$(5).registrar.$(1).$(2).a -.SECONDARY: .libs/Microsoft.$(8).registrar.$(2).m .libs/Microsoft.$(8).registrar.$(2).h .libs/Microsoft.$(8).registrar.$(2).a + $$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(TOP)/runtime endef -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -$(eval $(call RunRegistrar,ios,i386,32,$(IOS_SDK_VERSION),iOS,$(SIMULATOR86_CFLAGS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphonesimulator.sdk/include,$(MONOTOUCH_MONO_PATH),iOS,iossimulator-x86)) -endif -$(eval $(call RunRegistrar,ios,x86_64,64,$(IOS_SDK_VERSION),iOS,$(SIMULATOR64_CFLAGS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphonesimulator.sdk/include,$(MONOTOUCH_MONO_PATH),iOS,iossimulator-x64)) -$(eval $(call RunRegistrar,ios,arm64,64,$(IOS_SDK_VERSION),iOS,$(SIMULATOR_ARM64_CFLAGS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphonesimulator.sdk/include,$(MONOTOUCH_MONO_PATH),iOS,iossimulator-arm64)) -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -$(eval $(call RunRegistrar,ios,armv7,32,$(IOS_SDK_VERSION),iOS,$(DEVICE7_CFLAGS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphoneos.sdk/include,$(MONOTOUCH_MONO_PATH),iOS,armv7)) -$(eval $(call RunRegistrar,ios,armv7s,32,$(IOS_SDK_VERSION),iOS,$(DEVICE7S_CFLAGS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphoneos.sdk/include,$(MONOTOUCH_MONO_PATH),iOS,armv7s)) -endif -$(eval $(call RunRegistrar,ios,arm64,64,$(IOS_SDK_VERSION),iOS,$(DEVICE64_CFLAGS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/SDKs/MonoTouch.iphoneos.sdk/include,$(MONOTOUCH_MONO_PATH),iOS,ios-arm64)) -$(eval $(call RunRegistrar,tvos,x86_64,64,$(TVOS_SDK_VERSION),TVOS,$(SIMULATORTV_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/include,$(MONOTOUCH_TV_MONO_PATH),tvOS,tvossimulator-x64)) -$(eval $(call RunRegistrar,tvos,arm64,64,$(TVOS_SDK_VERSION),TVOS,$(SIMULATORTV_ARM64_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/include,$(MONOTOUCH_TV_MONO_PATH),tvOS,tvossimulator-arm64)) -$(eval $(call RunRegistrar,tvos,arm64,64,$(TVOS_SDK_VERSION),TVOS,$(DEVICETV_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/include,$(MONOTOUCH_TV_MONO_PATH),tvOS,tvos-arm64)) -$(eval $(call RunRegistrar,watchos,x86_64,64,$(WATCH_SDK_VERSION),WatchOS,$(SIMULATORWATCH64_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/include,$(MONOTOUCH_WATCH_MONO_PATH),watchOS,watchos-x64)) -ifdef WATCHOS_SUPPORTS_32BIT_SIMULATOR_ARCHITECTURES -$(eval $(call RunRegistrar,watchos,i386,32,$(WATCH_SDK_VERSION),WatchOS,$(SIMULATORWATCH_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/include,$(MONOTOUCH_WATCH_MONO_PATH),watchOS,watchos-x86)) -endif -ifdef WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES -$(eval $(call RunRegistrar,watchos,armv7k,32,$(WATCH_SDK_VERSION),WatchOS,$(DEVICEWATCH_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/include,$(MONOTOUCH_WATCH_MONO_PATH),watchOS,armv7k)) -endif -$(eval $(call RunRegistrar,watchos,arm64_32,32,$(WATCH_SDK_VERSION),WatchOS,$(DEVICEWATCH64_32_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/include,$(MONOTOUCH_WATCH_MONO_PATH),watchOS,arm64_32)) -$(eval $(call RunRegistrar,maccatalyst,x86_64,64,$(MACCATALYST_SDK_VERSION),MacCatalyst,$(MACCATALYST_X86_64_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/include,$(MONOTOUCH_MACCATALYST_MONO_PATH),MacCatalyst,maccatalyst-x64)) -$(eval $(call RunRegistrar,maccatalyst,arm64,64,$(MACCATALYST_SDK_VERSION),MacCatalyst,$(MACCATALYST_ARM64_CFLAGS),$(IOS_DESTDIR)$(XAMARIN_MACCATALYST_SDK)/include,$(MONOTOUCH_MACCATALYST_MONO_PATH),MacCatalyst,maccatalyst-arm64)) - -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -%.registrar.ios.simulator.a: %.registrar.ios.i386.a %.registrar.ios.x86_64.a -else -%.registrar.ios.simulator.a: %.registrar.ios.x86_64.a -endif - $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ - -ifdef IOS_SUPPORTS_32BIT_ARCHITECTURES -%.registrar.ios.device.a: %.registrar.ios.arm64.a %.registrar.ios.armv7.a %.registrar.ios.armv7s.a -else -%.registrar.ios.device.a: %.registrar.ios.arm64.a -endif - $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ - -ifdef WATCHOS_SUPPORTS_32BIT_DEVICE_ARCHITECTURES -%.registrar.watchos.device.a: %.registrar.watchos.armv7k.a %.registrar.watchos.arm64_32.a -else -%.registrar.watchos.device.a: %.registrar.watchos.arm64_32.a -endif - $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ - -ifdef WATCHOS_SUPPORTS_32BIT_SIMULATOR_ARCHITECTURES -%.registrar.watchos.simulator.a: %.registrar.watchos.i386.a %.registrar.watchos.x86_64.a -else -%.registrar.watchos.simulator.a: %.registrar.watchos.x86_64.a -endif - $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ - -.libs/Microsoft.iOS.registrar.ios-arm.a: .libs/Microsoft.iOS.registrar.armv7.a .libs/Microsoft.iOS.registrar.armv7s.a - $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ - -.libs/Microsoft.watchOS.registrar.watchos-arm.a: .libs/Microsoft.watchOS.registrar.armv7k.a .libs/Microsoft.watchOS.registrar.arm64_32.a - $(Q_LIPO) $(DEVICE_BIN_PATH)/lipo -create -output $@ $^ +$(eval $(call RunRegistrar,ios,x86_64,64,$(IOS_SDK_VERSION),iOS,$(SIMULATOR64_CFLAGS),,,iOS,iossimulator-x64)) +$(eval $(call RunRegistrar,ios,arm64,64,$(IOS_SDK_VERSION),iOS,$(SIMULATOR_ARM64_CFLAGS),,,iOS,iossimulator-arm64)) +$(eval $(call RunRegistrar,ios,arm64,64,$(IOS_SDK_VERSION),iOS,$(DEVICE64_CFLAGS),,,iOS,ios-arm64)) +$(eval $(call RunRegistrar,tvos,x86_64,64,$(TVOS_SDK_VERSION),TVOS,$(SIMULATORTV_CFLAGS),,,tvOS,tvossimulator-x64)) +$(eval $(call RunRegistrar,tvos,arm64,64,$(TVOS_SDK_VERSION),TVOS,$(SIMULATORTV_ARM64_CFLAGS),,,tvOS,tvossimulator-arm64)) +$(eval $(call RunRegistrar,tvos,arm64,64,$(TVOS_SDK_VERSION),TVOS,$(DEVICETV_CFLAGS),,,tvOS,tvos-arm64)) +$(eval $(call RunRegistrar,maccatalyst,x86_64,64,$(MACCATALYST_SDK_VERSION),MacCatalyst,$(MACCATALYST_X86_64_CFLAGS),,,MacCatalyst,maccatalyst-x64)) +$(eval $(call RunRegistrar,maccatalyst,arm64,64,$(MACCATALYST_SDK_VERSION),MacCatalyst,$(MACCATALYST_ARM64_CFLAGS),,,MacCatalyst,maccatalyst-arm64)) TARGETS_DOTNET = \ $(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$($(rid)_NUGET_RUNTIME_NAME)/runtimes/$(rid)/native/Microsoft.$(platform).registrar.a)) \ -TARGETS = \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/mtouch \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mtouch/mtouch.exe \ - $(foreach launcher,$(SIMLAUNCHERS),$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/$(launcher)) \ - $(IOS_DESTDIR)$(MONOTOUCH_SIMULATOR_SDK)/lib/Xamarin.iOS.registrar.a \ - -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 \ - -ifdef INCLUDE_DEVICE -TARGETS += $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib/Xamarin.TVOS.registrar.a -endif -endif - TARGET_DIRS_DOTNET = \ $(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(DOTNET_DESTDIR)/$($(rid)_NUGET_RUNTIME_NAME)/runtimes/$(rid)/native)) \ TARGET_DIRS = \ .libs \ bin/Makefile \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mtouch \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/etc/mono/assemblies/System \ - $(IOS_DESTDIR)$(MONOTOUCH_SIMULATOR_SDK)/lib \ - $(IOS_DESTDIR)$(MONOTOUCH_DEVICE_SDK)/lib \ - $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib \ - $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib \ - $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib \ - $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib \ $(TARGET_DIRS_DOTNET) \ $(TARGET_DIRS): $(Q) mkdir -p $@ -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mtouch/mtouch.exe: $(MTOUCH_DIR)/mtouch.exe | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mtouch - $(Q) $(CP) $(dir $<)/*.exe $(dir $@) - $(Q) $(CP) $(dir $<)/*.dll $(dir $@) - $(Q) $(CP) $(dir $<)/*.pdb $(dir $@) - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/mtouch: mtouch | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/%: % | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/%: % | $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_SIMULATOR_SDK)/lib/%.registrar.a: %.registrar.ios.simulator.a | $(IOS_DESTDIR)$(MONOTOUCH_SIMULATOR_SDK)/lib - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib/%.registrar.a: %.registrar.watchos.simulator.a | $(IOS_DESTDIR)$(XAMARIN_WATCHSIMULATOR_SDK)/lib - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib/%.registrar.a: %.registrar.tvos.x86_64.a | $(IOS_DESTDIR)$(XAMARIN_TVSIMULATOR_SDK)/lib - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(MONOTOUCH_DEVICE_SDK)/lib/%.registrar.a: %.registrar.ios.device.a | $(IOS_DESTDIR)$(MONOTOUCH_DEVICE_SDK)/lib - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib/%.registrar.a: %.registrar.watchos.device.a | $(IOS_DESTDIR)$(XAMARIN_WATCHOS_SDK)/lib - $(Q) $(CP) $< $@ - -$(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib/%.registrar.a: %.registrar.tvos.arm64.a | $(IOS_DESTDIR)$(XAMARIN_TVOS_SDK)/lib - $(Q) $(CP) $< $@ - define InstallRegistrar $(DOTNET_DESTDIR)/$$($(2)_NUGET_RUNTIME_NAME)/runtimes/$(2)/native/Microsoft.$(1).registrar.a: .libs/Microsoft.$(1).registrar.$(rid).a | $(DOTNET_DESTDIR)/$($(2)_NUGET_RUNTIME_NAME)/runtimes/$(2)/native $(Q) $(CP) $$< $$@ @@ -417,26 +71,11 @@ endef $(foreach platform,$(DOTNET_PLATFORMS_MTOUCH),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(eval $(call InstallRegistrar,$(platform),$(rid))))) dotnet: $(TARGETS_DOTNET) -ifdef ENABLE_DOTNET install-local:: $(TARGETS_DOTNET) all-local:: $(TARGETS_DOTNET) -endif - -ifdef INCLUDE_XAMARIN_LEGACY -ifdef INCLUDE_IOS -install-local:: $(TARGETS) -all-local:: $(TARGETS) -endif -endif - -install-mtouch: \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/mtouch \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mtouch/mtouch.exe \ clean-local:: rm -Rf bin obj - rm -f $(SIMLAUNCHERS) - $(SYSTEM_MSBUILD) "/t:Clean" /p:Configuration=$(MTOUCH_CONF) *.csproj all-local:: verify-sorted-resx verify-sorted-resx: @@ -456,7 +95,3 @@ clean-dotnet: include $(TOP)/mk/rules.mk include ../common/Make.common - -# make will automatically consider files created in chained implicit rules as temporary files, and delete them afterwards -# marking those files as .SECONDARY will prevent that deletion. -.SECONDARY: Xamarin.iOS.registrar.ios.simulator.a Xamarin.iOS.registrar.ios.device.a Xamarin.WatchOS.registrar.watchos.device.a diff --git a/tools/mtouch/monotouch-fixes.c b/tools/mtouch/monotouch-fixes.c deleted file mode 100644 index 1186e7860860..000000000000 --- a/tools/mtouch/monotouch-fixes.c +++ /dev/null @@ -1,130 +0,0 @@ -// -// monotouch-fixes.c: -// -// Author: -// Rolf Bjarne Kvinge -// -// Copyright 2011 Xamarin Inc. -// - -#include -#include -#include -#include -#include -#include -#include -#include - -// Apple uses LLVM to implement OpenGL ES on the iPhone Simulator, unfortunately -// LLVM has a race condition in their signal handling - they set one-shot -// signal handlers and restore the previous handler in those handlers. The -// problem is that they set SA_RESETHAND|SA_NODEFER when setting their signal -// handler, which means that if another signal arrives before their signal handler -// has been able to restore our signal handler, the default signal handler will -// be called (which just exits the process without any diagnostics at all). -// -// For the 32bit simulator we inject our own sigaction method, which takes precedence -// over the system one, and reset the flags to 0 if flags is SA_RESETHAND|SA_NODEFER. -// -// Unfortunately this technique does not seem to work for the 64bit simulator, so there -// we patch the system sigaction instead. -// - -typedef int (*SigAction) (int sig, const struct sigaction *__restrict act, struct sigaction *__restrict oact); -static SigAction system_sigaction = sigaction; - -static int -my_sigaction (int sig, const struct sigaction *__restrict act, struct sigaction *__restrict oact) -{ - //fprintf (stderr, "my_sigaction (%i, %p: handler = %p mask = %i flags = %i, %p)\n", sig, act, act ? act->sa_handler : NULL, act ? act->sa_mask : -1, act ? act->sa_flags : -1, oact); - - if (act && act->sa_flags == (SA_NODEFER | SA_RESETHAND)) { - switch (sig) { - case SIGUSR1: - case SIGUSR2: - case SIGFPE: - // fprintf (stderr, "fixed up sicaction (%i, %p: handler = %p mask = %i flags = %i, %p)\n", sig, act, act ? act->sa_handler : NULL, act ? act->sa_mask : -1, act ? act->sa_flags : -1, oact); - ((struct sigaction *) act)->sa_flags = 0; - break; - } - } - - return system_sigaction (sig, act, oact); -} - -#if defined(__i386__) - -typedef struct interpose_s { - void *new_func; - void *orig_func; -} interpose_t; - -static const interpose_t interposers[] __attribute__ ((unused)) \ - __attribute__ ((section("__DATA, __interpose"))) = { - { (void *) &my_sigaction, (void *) &sigaction }, - }; - -#elif defined(__x86_64__) - -static void -patch_sigaction () -{ - // Sanity check. - uint64_t * func = (uint64_t *) &sigaction; - uint64_t first = 0x20ec8348e5894855; // first 8 bytes of sigaction - uint64_t second = 0x0a771ef883ff478d; // second 8 bytes of sigaction - if (func [0] != first || func [1] != second) { - fprintf (stderr, "MonoTouch: Could not install sigaction override, unexpected sigaction implementation.\n"); - return; - } - - // allocate executable memory - uint64_t pagesize = (uint64_t) getpagesize (); - void *exec = mmap (NULL, pagesize, PROT_EXEC | PROT_WRITE | PROT_READ, MAP_ANON | MAP_PRIVATE, -1, 0); - if (exec == NULL) { - fprintf (stderr, "MonoTouch: Could not allocate memory for sigaction override: %s\n", strerror (errno)); - return; - } - - // create a trampoline that jumps to the real sigaction (to just after where we modified it). - uint64_t *i64 = (uint64_t *) exec; - i64 [0] = first; - i64 [1] = second; - uint16_t *i16 = (uint16_t *) exec; - // movabsq &sigaction + 14,%r11 - i16 [7] = 0xbb49; - i64 [2] = (uint64_t) (14 + (char *) &sigaction); - // jmpq *%r11 - i16 [12] = 0xff41; - i16 [13] = 0x00e3; - - // make sigaction patchable. - uint64_t symbol = (uint64_t) (char *) &sigaction; - void *aligned_symbol = (void *) (symbol & ~(pagesize - 1)); - int ret; - - ret = mprotect (aligned_symbol, pagesize * 2, PROT_READ | PROT_WRITE | PROT_EXEC); - - if (ret != 0) { - fprintf (stderr, "MonoTouch: could not patch sigaction: %s\n", strerror (errno)); - munmap (exec, pagesize); - return; - } - - // patch sigaction to call my_sigaction instead. - uint16_t *f16 = (uint16_t *) &sigaction; - // movabsq my_sigaction,%r11 - f16 [0] = 0xbb49; - uint64_t *f64 = (uint64_t *) (f16 + 1); - f64 [0] = (uint64_t) &my_sigaction; - // jmpq *%r11 - f16 [5] = 0xff41; - f16 [6] = 0x00e3; - - // Make sigaction non-writeable again. - mprotect (aligned_symbol, pagesize * 2, PROT_READ | PROT_EXEC); - - system_sigaction = (SigAction) exec; -} -#endif diff --git a/tools/mtouch/mtouch b/tools/mtouch/mtouch deleted file mode 100755 index 5b4baf57301b..000000000000 --- a/tools/mtouch/mtouch +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -e - -pushd "$(dirname "$0")/.." > /dev/null -MONOTOUCH_PREFIX=$(pwd -P) -popd > /dev/null - -exec /Library/Frameworks/Mono.framework/Commands/mono64 --debug "$MONOTOUCH_PREFIX/lib/mtouch/mtouch.exe" "$@" diff --git a/tools/mtouch/mtouch.csproj b/tools/mtouch/mtouch.csproj index 471433bd1381..66c01efa7f88 100644 --- a/tools/mtouch/mtouch.csproj +++ b/tools/mtouch/mtouch.csproj @@ -1,38 +1,16 @@ - + - Debug - AnyCPU - {A737EFCC-4348-4EB1-9C14-4FDC0975388D} Exe - mtouch - mtouch - v4.8 + net$(BundledNETCoreAppTargetFrameworkVersion) latest - - - True - portable - False - bin\Debug - MONOTOUCH;MTOUCH;DEBUG - prompt - 4 - True + false + false + false + false + false + MONOTOUCH;MTOUCH;LEGACY_TOOLS true - latest - - - true - portable - False - bin\Release - prompt - MONOTOUCH;MTOUCH - 4 - True - true - latest @@ -505,23 +483,10 @@ tools\linker\RegistrarRemovalTrackingStep.cs - - - - - - - - - - - docs\website\mtouch-errors.md - - Resx diff --git a/tools/mtouch/simlauncher.mm b/tools/mtouch/simlauncher.mm deleted file mode 100644 index 2c43d9a6a0b0..000000000000 --- a/tools/mtouch/simlauncher.mm +++ /dev/null @@ -1,59 +0,0 @@ -// -// simlauncher.m: Defaults for the simlauncher binaries -// -// Authors: -// Rolf Bjarne Kvinge -// -// Copyright 2012-2015 Xamarin Inc. -// - -#include "xamarin/xamarin.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void xamarin_create_classes_Xamarin_iOS (); - -#ifdef __cplusplus -} -#endif - -void xamarin_setup_impl () -{ -#if DEBUG - xamarin_debug_mode = TRUE; -#endif - xamarin_create_classes_Xamarin_iOS (); - xamarin_marshal_managed_exception_mode = MarshalManagedExceptionModeDisable; -#if DEBUG - xamarin_marshal_objectivec_exception_mode = MarshalObjectiveCExceptionModeUnwindManagedCode; -#else - xamarin_marshal_objectivec_exception_mode = MarshalObjectiveCExceptionModeDisable; -#endif - - mono_dllmap_insert (NULL, "System.Native", NULL, "mono-native", NULL); - mono_dllmap_insert (NULL, "System.Security.Cryptography.Native.Apple", NULL, "mono-native", NULL); - mono_dllmap_insert (NULL, "System.Net.Security.Native", NULL, "mono-native", NULL); -} - -int -main (int argc, char** argv) -{ - // There's a potentially uncaught exception here, which: - // 1. only happens when/if `xamarin_initialize / ObjCRuntime.Initialize` throws a native exception. - // This should not happen (nor be ignored) since the runtime would not be fully initialized; - // 2. only happens when (non default) `MarshalManagedExceptionModeThrowObjectiveCException` is used, - // specifically asking for the native exception to be thrown; and - // 3. only happens on simulator builds (hint: filename), i.e. not on code that ships to customers; - // 4. catching the exception creates an empty/white app, which hides the issue or confuses developers. - // A crash (report) is much more useful to them (and us). - @autoreleasepool { return xamarin_main (argc, argv, XamarinLaunchModeApp); } -} - - -void xamarin_initialize_callbacks () __attribute__ ((constructor)); -void xamarin_initialize_callbacks () -{ - xamarin_setup = xamarin_setup_impl; -} diff --git a/tools/xibuild/Main.cs b/tools/xibuild/Main.cs deleted file mode 100644 index 4a246b5b90f7..000000000000 --- a/tools/xibuild/Main.cs +++ /dev/null @@ -1,252 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Xml; -using Mono.Options; -using Xamarin.Utils; - -namespace xibuild { - class MainClass { - - static bool verbose; - public static int Main (string [] args) - { - bool runTool = false; - bool configGenerationOnly = false; - string baseConfigFile = null; - string verbosity = ""; - bool no_logo = true; - bool show_help = false; - OptionSet p = null; - p = new OptionSet () { - "xibuild: Run msbuild or a tool with a custom msbuild config file which adds fallback paths from $MSBuildExtensionsPathFallbackPathsOverride.", - String.Empty, - "Usage: xibuild [-v] [-c] [-t] [-m ] [-h] -- [path to managed tool] [arguments...]", - String.Empty, - "Default: Generate a temporary app.config file and run msbuild", - String.Empty, - "Options:", - - { "c", "Generate config file only", c => configGenerationOnly = true }, // merge - { "t", "Path to the managed tool to run. If this and `-c` are not used, then this runs msbuild", t => runTool = true }, - { "m=", "< base config file >: Config file to merge with the one from msbuild.dll.config", m => baseConfigFile = m }, - { "h|?|help", "Show this help message and exit.", v => show_help = true }, - { "v|verbosity:", "Show verbose output.", v => verbosity = string.IsNullOrEmpty (v) ? "diagnostic" : v }, - { "nologo", "Do not display the startup banner and copyright message when running msbuild.", v => no_logo = true }, - - String.Empty, - "Note: Adds the path from the environment variable named", - "`$MSBuildExtensionsPathFallbackPathsOverride` to the list of fallback paths in the generated app.config", - String.Empty, - "Examples:", - String.Empty, - "Generate /path/to/foo.exe.config:", - "\txibuild -c /path/to/foo.exe", - "Run msbuild with a custom app.config and the arguments passed to msbuild:", - "\txibuild -- /v:diag /path/to/project.csproj", - "Run managed_tool.exe with the arguments, and a custom app.config:", - "\txibuild -t -- /path/to/managed_tool.exe args", - String.Empty, - "Add `-m /path/to/base.exe.config` to merge the generated app.config with base.exe.config ." - }; - - List remaining = null; - try { - remaining = p.Parse (args); - } catch (OptionException oe) { - Console.WriteLine (oe.Message); - return -1; - } - - verbose = !string.IsNullOrEmpty (verbosity) && verbosity [0] == 'd'; - if (verbose) - Console.WriteLine ($"Running xibuild with args: {String.Join (" ", args)}\n"); - - if (show_help) { - p.WriteOptionDescriptions (Console.Out); - return 0; - } - - if (configGenerationOnly && runTool) { - Console.WriteLine ("Use either -c or -t, but not both.\n"); - p.WriteOptionDescriptions (Console.Out); - return -1; - } - - if (!String.IsNullOrEmpty (baseConfigFile) && !File.Exists (baseConfigFile)) { - Console.WriteLine ($"Base config file {baseConfigFile} not found."); - return -1; - } - - if (configGenerationOnly && remaining.Count == 0) { - Console.WriteLine ("Please specify the path to managed tool to generate an app.config file for it."); - return -1; - } - - if (runTool && remaining.Count == 0) { - Console.WriteLine ("Please specify the path to managed tool to run."); - return -1; - } - - bool runMSBuild = !runTool && !configGenerationOnly; - - if (!runTool && !runMSBuild) { - GenerateAppConfig (remaining [0] + ".config", baseConfigFile, out string _); - return 0; - } - - if (runMSBuild) { - // Add back any arguments we consumed. - if (!string.IsNullOrEmpty (verbosity)) - remaining.Add ($"/verbosity:{verbosity}"); - if (no_logo) - remaining.Add ("/nologo"); - } - var arguments = remaining.Skip (runMSBuild ? 0 : 1).ToArray (); - return RunTool ( - toolPath: runMSBuild ? "msbuild" : remaining [0], - combinedArgs: StringUtils.FormatArguments (arguments), - baseConfigFile: runMSBuild ? null : baseConfigFile); - } - - static int RunTool (string toolPath, string combinedArgs, string baseConfigFile) - { - var tmpMSBuildExePathForConfig = Path.GetTempFileName (); - var configFilePath = tmpMSBuildExePathForConfig + ".config"; - try { - GenerateAppConfig (configFilePath, baseConfigFile, out string MSBuildSdksPath); - - var psi = new ProcessStartInfo { - FileName = toolPath, - Arguments = combinedArgs, - UseShellExecute = false, - }; - // Required so that msbuild can read the correct config file - psi.EnvironmentVariables ["MSBUILD_EXE_PATH"] = tmpMSBuildExePathForConfig; - // MSBuildSDKsPath only works via an env var - psi.EnvironmentVariables ["MSBuildSDKsPath"] = MSBuildSdksPath; - - var p = Process.Start (psi); - - p.WaitForExit (); - return p.ExitCode; - } finally { - if (File.Exists (tmpMSBuildExePathForConfig)) - File.Delete (tmpMSBuildExePathForConfig); - if (File.Exists (tmpMSBuildExePathForConfig)) - File.Delete (configFilePath); - } - } - - static void GenerateAppConfig (string targetConfigFile, string baseConfigFile, out string MSBuildSdksPath) - { - bool IsMacOS = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (System.Runtime.InteropServices.OSPlatform.OSX); - - //FIXME: Current? or from PATH? - string mono = IsMacOS ? "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono" : "/usr/lib/mono"; - string vsVersion = "15.0"; - string MSBuildBin = Path.Combine (mono, "msbuild", vsVersion, "bin"); - - string MSBuildConfig = Path.Combine (MSBuildBin, "MSBuild.dll.config"); - string MSBuildExtensionsPath = Path.Combine (mono, "xbuild"); - string FrameworksDirectory = Path.Combine (mono, "xbuild-frameworks"); - MSBuildSdksPath = Path.Combine (MSBuildBin, "Sdks"); - - var dstXml = new XmlDocument (); - - var dstConfigNode = dstXml.CreateNode (XmlNodeType.Element, "configuration", ""); - dstXml.AppendChild (dstConfigNode); - - if (!String.IsNullOrEmpty (baseConfigFile) && File.Exists (baseConfigFile)) { - var baseXml = new XmlDocument (); - baseXml.Load (baseConfigFile); - CopyConfigNode (baseXml, dstConfigNode); - } - - // Copy over msbuild.dll.config - { - var msbuildXml = new XmlDocument (); - msbuildXml.Load (MSBuildConfig); - CopyConfigNode (msbuildXml, dstConfigNode); - } - - var toolsets = dstXml.SelectSingleNode ("configuration/msbuildToolsets/toolset"); - - var SearchPathsOS = IsMacOS ? "osx" : "unix"; - var projectImportSearchPaths = toolsets.SelectSingleNode ("projectImportSearchPaths"); - var searchPaths = projectImportSearchPaths.SelectSingleNode ($"searchPaths[@os='{SearchPathsOS}']") as XmlElement; - - //NOTE: on Linux, the searchPaths XML element does not exist, so we have to create it - if (searchPaths is null) { - searchPaths = dstXml.CreateElement ("searchPaths"); - searchPaths.SetAttribute ("os", SearchPathsOS); - - var property = dstXml.CreateElement ("property"); - property.SetAttribute ("name", "MSBuildExtensionsPath"); - property.SetAttribute ("value", ""); - searchPaths.AppendChild (property); - - property = dstXml.CreateElement ("property"); - property.SetAttribute ("name", "MSBuildExtensionsPath32"); - property.SetAttribute ("value", ""); - searchPaths.AppendChild (property); - - property = dstXml.CreateElement ("property"); - property.SetAttribute ("name", "MSBuildExtensionsPath64"); - property.SetAttribute ("value", ""); - searchPaths.AppendChild (property); - - projectImportSearchPaths.AppendChild (searchPaths); - } - - string monoExternal = IsMacOS ? "/Library/Frameworks/Mono.framework/External/" : "/usr/lib/mono"; - string [] ProjectImportSearchPaths = new [] { Environment.GetEnvironmentVariable ("MSBuildExtensionsPathFallbackPathsOverride"), Path.Combine (monoExternal, "xbuild") }; - - foreach (XmlNode property in searchPaths.SelectNodes ("property[starts-with(@name, 'MSBuildExtensionsPath')]/@value")) - property.Value = string.Join (";", ProjectImportSearchPaths); - - SetToolsetProperty ("MSBuildToolsPath", MSBuildBin); - SetToolsetProperty ("MSBuildToolsPath32", MSBuildBin); - SetToolsetProperty ("MSBuildToolsPath64", MSBuildBin); - SetToolsetProperty ("MSBuildExtensionsPath", MSBuildExtensionsPath); - SetToolsetProperty ("MSBuildExtensionsPath32", MSBuildExtensionsPath); - SetToolsetProperty ("MSBuildExtensionsPath64", MSBuildExtensionsPath); - SetToolsetProperty ("RoslynTargetsPath", Path.Combine (MSBuildBin, "Roslyn")); - - dstXml.Save (targetConfigFile); - return; - - void CopyConfigNode (XmlDocument src, XmlNode dstNode) - { - var srcConfigNode = src.SelectSingleNode ("configuration"); - if (srcConfigNode is not null && srcConfigNode.HasChildNodes) { - srcConfigNode.ChildNodes.OfType ().ToList () - .ForEach (node => dstNode.AppendChild (dstXml.ImportNode (node, deep: true))); - } - } - - /// - /// If the value exists, sets value attribute, else creates the element - /// - void SetToolsetProperty (string name, string value) - { - if (string.IsNullOrEmpty (value)) - return; - - // MSBuild property names are case insensitive - var valueAttribute = toolsets.SelectSingleNode ($"property[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='{name.ToLowerInvariant ()}']/@value"); - if (valueAttribute is not null) { - valueAttribute.Value = value; - } else { - var property = toolsets.OwnerDocument.CreateElement ("property"); - property.SetAttribute ("name", name); - property.SetAttribute ("value", value); - toolsets.PrependChild (property); - } - } - } - - } -} diff --git a/tools/xibuild/Makefile b/tools/xibuild/Makefile deleted file mode 100644 index a0ca825fd466..000000000000 --- a/tools/xibuild/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -TOP = ../.. - -include $(TOP)/Make.config - -CONFIGURATION=Debug -SRC_FILES=Main.cs $(TOP)/tools/common/StringUtils.cs - -all: bin/$(CONFIGURATION)/xibuild.exe - -bin/$(CONFIGURATION)/xibuild.exe: xibuild.csproj $(SRC_FILES) - $(Q) $(SYSTEM_MSBUILD) "/bl:$@.binlog" /restore xibuild.csproj /p:Configuration=$(CONFIGURATION) $(MSBUILD_VERBOSITY) - -clean-local:: - $(SYSTEM_MSBUILD) /t:Clean xibuild.csproj diff --git a/tools/xibuild/xibuild b/tools/xibuild/xibuild deleted file mode 100755 index 169b0579ad98..000000000000 --- a/tools/xibuild/xibuild +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -e - -ABSOLUTE_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}") -TOOL_DIR=$(dirname "$ABSOLUTE_PATH") - -if ! test -f "$TOOL_DIR/bin/Debug/xibuild.exe"; then - make -C "$TOOL_DIR" -fi - -mono "$TOOL_DIR/bin/Debug/xibuild.exe" "$@" diff --git a/tools/xibuild/xibuild.csproj b/tools/xibuild/xibuild.csproj deleted file mode 100644 index f59d980f9657..000000000000 --- a/tools/xibuild/xibuild.csproj +++ /dev/null @@ -1,50 +0,0 @@ - - - - Debug - x86 - {F045D371-40B4-487F-B2A3-3CF318A77CA4} - Exe - xibuild - xibuild - v4.7 - default - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - true - x86 - - - true - bin\Release - prompt - 4 - true - x86 - - - - - - - - - - - - - StringUtils.cs - - - NullableAttributes.cs - - - - diff --git a/versions-check.csharp b/versions-check.csharp deleted file mode 100755 index 8c74494a0198..000000000000 --- a/versions-check.csharp +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp -s - -// this script is to make sure our versions.plist files are not out of date with our min/max supported OS versions. - -// arguments are: plistPath iOSMinVersion iOSMaxVersion tvOSMinVersion tvOSMaxVersion watchOSMinVersion watchOSMaxVersion macOSMinVersion macOSMaxVersion MacCatalystOSMinVersion MacCatalystOSMaxVersion - -using System.IO; -using System.Xml; - -try { - var args = Args; - var expectedArgumentCount = 11; - if (args.Length != expectedArgumentCount) { - Console.WriteLine ("Need 11 arguments, got {0}", args.Length); - Environment.Exit (1); - return; - } - - var plistPath = args [0]; - var iOSMin = args [1]; - var iOSMax = args [2]; - var tvOSMin = args [3]; - var tvOSMax = args [4]; - var watchOSMin = args [5]; - var watchOSMax = args [6]; - var macOSMin = args [7]; - var macOSMax = args [8]; - var MacCatalystMin = args [9]; - var MacCatalystMax = args [10]; - - var doc = new System.Xml.XmlDocument (); - doc.Load (plistPath); - - var failed = false; - - var check = new Action ((product, min, max) => - { - var minVersion = Version.Parse (min); - var maxVersion = Version.Parse (max); - var foundMax = false; - var foundMin = false; - var versions = doc.SelectNodes ($"/plist/dict/key[text()='KnownVersions']/following-sibling::dict[1]/key[text()='{product}']/following-sibling::array[1]/string"); - if (versions.Count == 0) { - // Skip this (iOS/tvOS/watchOS versions for macOS, or vice versa) - return; - } - var versionsHashSet = new HashSet (versions.Cast ().Select (v => v.InnerText)); - foreach (XmlNode node in versions) { - // Console.WriteLine ($"{product}: checking: {node.InnerText}"); - var v = node.InnerText; - var version = Version.Parse (v); - if (version < minVersion) { - Console.Error.WriteLine ($"Found the {product} version {v} in {Path.GetFileName (plistPath)}, but it's smaller than the supported min {product} version we support ({min})."); - failed = true; - } else if (version > maxVersion) { - Console.Error.WriteLine ($"Found the {product} version {v} in {Path.GetFileName (plistPath)}, but it's higher than the supported max {product} version we support ({max})."); - failed = true; - } - if (version == maxVersion) - foundMax = true; - if (version == minVersion) - foundMin = true; - } - if (!foundMax) { - Console.Error.WriteLine ($"Could not find the max {product} version {max} in {Path.GetFileName (plistPath)}."); - failed = true; - } - if (!foundMin) { - Console.Error.WriteLine ($"Could not find the min {product} version {min} in {Path.GetFileName (plistPath)}."); - failed = true; - } - - var supportedTPVNodes = doc.SelectNodes ($"/plist/dict/key[text()='SupportedTargetPlatformVersions']/following-sibling::dict[1]/key[text()='{product}']/following-sibling::array[1]/string").Cast ().ToArray (); - var supportedTPVs = supportedTPVNodes.Select (v => v.InnerText).ToArray (); - if (supportedTPVs?.Any () == true) { - var supportedTPVSet = new HashSet (supportedTPVs); - var missingTPVs = versionsHashSet.Except (supportedTPVSet); - if (missingTPVs.Any ()) { - Console.Error.WriteLine ($"The array SupportedTargetPlatformVersions are missing the following entries (they're in the KnownVersions array): {string.Join (", ", missingTPVs)}"); - failed = true; - } - } else if (plistPath.Contains ("/builds/")) { - Console.Error.WriteLine ($"No SupportedTargetPlatformVersions array found in the plist: {plistPath}"); - failed = true; - } - }); - - check ("iOS", iOSMin, iOSMax); - check ("tvOS", tvOSMin, tvOSMax); - check ("watchOS", watchOSMin, watchOSMax); - check ("macOS", macOSMin, macOSMax); - check ("MacCatalyst", MacCatalystMin, MacCatalystMax); - - Environment.Exit (failed ? 1 : 0); -} catch (Exception e) { - Console.WriteLine (e); - Environment.Exit (1); -}