1. Use `xcrun` to run `ibtool` (and `actool`) and avoid toolchain mismatches
2. Set `DEVELOPER_DIR` so everyone (well `xcrun`) use the same toolchain
3. Workaround for `macos-arm64` issue (FB8827920)
* Start `ibtool` as an `Apple` [Silicon] process
* This will ensure the `ibtoold` daemon is also running as `Apple`
* If `ibtoold` is run as `Intel` then `ibtool` asserts and build fail
```
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.757 ibtoold[37142:6681382] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-17506/InterfaceBuilderKit/Utilities/IBAbstractInterfaceBuilderPlatformToolManager.m:481
LaunchScreen.storyboard : error : Details: Failed to attach to IBAgent-iOS with error: Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with IBAgent-iOS." UserInfo={NSLocalizedFailureReason=IBAgent-iOS (37146) failed to launch and exited with status 10, NSUnderlyingError=0x7fa4e58fc760 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to launch IBAgent-iOS via CoreSimulator spawn" UserInfo={NSLocalizedDescription=Failed to launch IBAgent-iOS via CoreSimulator spawn, NSUnderlyingError=0x7fa4e5e8a900 {Error Domain=com.apple.InterfaceBuilder Code=-1 "Failed to handshake with platform tool" UserInfo={NSLocalizedFailureReason=Failed to open connection over FIFOs with platform tool, NSLocalizedDescription=Failed to handshake with platform tool, NSUnderlyingError=0x7fa4e5e237c0 {Error Domain=com.apple.InterfaceBuilder Code=-1 "" UserInfo=0x7fa4e5e8bba0 (not displayed)}}}}}, NSLocalizedRecoverySuggestion=Please check Console.app for crash reports for "IBAgent-iOS" for further information., NSLocalizedDescription=Encountered an error communicating with IBAgent-iOS.}
LaunchScreen.storyboard : error : Object: <IBCocoaTouchToolManager>
LaunchScreen.storyboard : error : Method: +_THREADSAFE_launchNewToolWithLaunchContext:executionContext:toolProxyClass:proxyDelegate:failureContext:requestingMethod:error:forReason:
LaunchScreen.storyboard : error : Thread: <NSThread: 0x7fa4e341af70>{number = 1, name = main}
LaunchScreen.storyboard : error : Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
LaunchScreen.storyboard : error : 2020-10-26 14:24:52.766 ibtoold[37142:6681382] [MT] IBPlatformTool: *** Failed to launch tool with description <IBCocoaTouchPlatformToolDescription: 0x7fa4e5f34160> System content for IBCocoaTouchFramework-fourteenAndLater <IBScaleFactorDeviceTypeDescription: 0x7fa4e5f2fb50> scaleFactor=2x, renderMode.identifier=(null): Encountered an error communicating with IBAgent-iOS. (Failure reason: IBAgent-iOS (37146) failed to launch and exited with status 10): Failed to launch IBAgent-iOS via CoreSimulator spawn: Failed to handshake with platform tool (Failure reason: Failed to open connection over FIFOs with platform tool): : Failed to open FIFOs for handshaking with platform tool (Failure reason: IBAgent-iOS exited before we could handshake)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error : ibtool exited with code 1
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1425,3): error :
LaunchScreen.storyboard : ibtool error : Encountered an error communicating with IBAgent-iOS.
```
Note: `main` has diverged quite a bit (net6 support) so this pull request
will need to be re-worked (it won't apply)
Fixes https://github.com/xamarin/xamarin-macios/issues/4634
Foreport of #9965 since the source code diverged from `xcode12.2`
This makes it so that we use the configured Xcode, and not the default (/Applications/Xcode.app), which may be a symlink, which doesn't work with Xcode 12:
Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution started with arguments: --errors --warnings --notices --output-format xml1 --minimum-deployment-target 8.0 --target-device iphone --target-device ipad --auto-activate-custom-fonts --sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk --compilation-directory /Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/obj/iPhone/Debug/ibtool /Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/LaunchScreen.storyboard
(TaskId:13)
Tool /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool execution finished (exit code = 134).
(TaskId:13)
LaunchScreen.storyboard : error : 2020-10-22 17:47:39.854 ibtoold[5120:92020] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-17515.1/DVTFoundation/PlugInArchitecture/DataModel/DVTPlugIn.m:232 [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : Details: Requested but did not find required plug-in with identifier com.apple.rc.RCIDESupportCore [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : Object: <DVTPlugIn: 0x7fe30d129560> [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : Method: -awakeWithPropertyList: [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : Thread: <NSThread: 0x7fe30780acc0>{number = 1, name = main} [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide. [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : 2020-10-22 17:47:39.863 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBCocoaTouchBuildSupport.PlatformDefinition.MacCatalyst of plug-in com.apple.dt.IDE.IBCocoaBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : 2020-10-22 17:47:39.863 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBCocoaBuildSupport.PlatformDefinition.Cocoa of plug-in com.apple.dt.IDE.IBCocoaBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : 2020-10-22 17:47:39.880 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBCocoaTouchBuildSupport.PlatformDefinition.CocoaTouch of plug-in com.apple.dt.IDE.IBCocoaTouchBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : 2020-10-22 17:47:39.880 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IBAppleTVBuildSupport.PlatformDefinition.AppleTV of plug-in com.apple.dt.IDE.IBAppleTVBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : 2020-10-22 17:47:39.883 ibtoold[5120:92020] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition for extension Xcode.IDEInterfaceBuilder.PlatformDefinition.WatchOS of plug-in com.apple.dt.IDE.IDEInterfaceBuilderWatchKitBuildSupport [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
LaunchScreen.storyboard : error : 2020-10-22 17:47:39.979 ibtoold[5120:92020] [MT] DVTAssertions: ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-17506/InterfaceBuilderKit/Utilities/IBScopedSingletonRegistry.m:45 [/Users/runner/work/1/s/xamarin-macios/tests/sampletester/BaselineTest/BaselineTest.csproj]
Merge DotNetBuildTask into MSBuildTask to simplify creation of build tasks -
these tasks are very similar, and we instantiate MSBuildTasks in over a dozen
places, and this way we don't have to update every instantiation to check if
an MSBuildTask or a DotNetBuildTask should be created.
The end result is that code that does 'new MSBuildTask (...)' will just work
without updates for .NET projects.
* [tests] Fix sample tests to take into account when a platform has been disabled.
* [devops] The INCLUDE_MAC/INCLUDE_IOS variables might not exist.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Adding a test to check a specific error code to see if the strings in other locales are translated. This test will be added to the Localization wiki in Maccore accessible to the xamarin-macios team: https://github.com/xamarin/maccore/wiki/Localization
* Add a `Microsoft.NET.Workload.<platform>` directory which contains
`WorkloadManifest.json` and `WorkloadManifest.targets` required for the
workload resolver.
* For testing, this directory is installed into our local dotnet directory
(`dotnet/sdk-manifests/5.0.100/Microsoft.NET.Workload.<platform>`).
* Convert `Microsoft.<platform>.Sdk` to an SDK workload pack.
* Replace `Sdk.props` with `AutoImport.props`, and include the default
inclusion itemgroups definitions from here.
* Split default inclusion logic in two:
* The itemgroups that import the default items has been moved into a props
file and included from `AutoImport.props`. They're also conditioned
based on the TargetPlatformIdentifier.
* The rest of the logic (to enable default inclusion) is left in the
.targets file.
* Merge several .props files into .targets files to follow the convention that
.props files should be loaded before the main csproj, and .targets files
after (these .props files were loaded after, so to avoid confusion the
simplest solution was to merge their contents into the applicable .targets
file and delete the .props files).
* Bundle the workload (WorkloadManifest.json/WorklooadManifest.targets) and
the sdk + ref packs into an installable macOS pkg (and upload these
packages).
* Updates tests to import `Microsoft.NET.Sdk` instead of
`Microsoft.<platform>.Sdk` (this also required a Touch.Unit bump).
* Install the sdk + ref packs into the local dotnet directory (using symlinks
to our on-disk nuget representation). This is required for local testing.
* Add some documentation.
* Finally fix a couple of bugs that these changes uncovered.
Ref: https://github.com/xamarin/xamarin-android/pull/5195
Backport of PR#9828 (xcode12.2) with availability changes.
No need to merge it back into `xcode12.2` (it would conflict) but another
PR will be needed to change `[iOS (14,2)]` to `[iOS (14,1)]` on the new
API
Co-authored-by: Alex Soto <alex@alexsoto.me>
For each platform the presence of `[Unavailable]` should mean there are
no other availability (introduced, deprecated or obsoleted) attributes
on the same member.
Also check if the type is unavailable. In that case no member should,
for that platform, have other availability attributes.
Also fix failures - all in WatchKit which was removed from iOS.
Split the iOS msbuild tests in two:
* Xamarin.MacDev.Tasks.Tests: contains in-process unit tests for tasks.
* Xamarin.MacDev.Tasks: contains larger tests that either invoke targets or a complete
build. These are currently in-process, but will become out-of-process soon to make
it possible to run them with dotnet.
Also make the new projects non-iOS-specific, because the macOS msbuild tests will
be moved here as well soon.
There is some duplicated code between these two test projects now (all files
that show up as new are copies of existing files), this will be cleaned up in
later pull requests.
This can easily happen when existing type(s) or framework are added to a platform. E.g.
```csharp
[Watch (6,0)][iOS (9,0)]
interface AVFoo {
[Watch (6,0)][iOS (13,0)]
void NewMember ();
}
```
Here we have duplicate attributes and, while not confusing, it does mean extra (and non required) metadata into the platform assemblies.
```csharp
[Watch (6,0)][iOS (9,0)]
interface AVFoo {
[Watch (5,0)][iOS (13,0)]
void NewMember ();
}
```
Here we declare a member as available when the type is not. I'm not sure how the IDE will react - but this should be audited since one of them is wrong (whatever the IDE behaviour is).
Fix https://github.com/xamarin/xamarin-macios/issues/6856
* [msbuild] Set DEVELOPER_DIR to the Xcode we're using when calling ibtool.
This fixes strange problems that occur when the system Xcode isn't the same as
the Xcode configured in Visual Studio for Mac, because we'd end up directly
launching VSMac's Xcode's ibtool, which would end up confused because it
wasn't the system ibtool.
Setting DEVELOPER_DIR tells VSMac's Xcode's ibtool that it's the system's ibtool.
* [msbuild] Set IBToolTask.SdkDevPath from the tests as well.
It's already set in the .targets files.
* [msbuild] Move msbuild/tests to tests/msbuild to put all the tests together.
* [tests] Move test projects for Xamarin.Mac to tests/common/TestProjects
* [tests] Move test projects for Xamarin.iOS to tests/common/TestProjects
* [msbuild] Add SceneKit assets to our items included by default.
There's a minor wrinkle here: we need to calculate the virtual path of the
SceneKit items (relative to the project), but for items included by default
their defining project is not the user's project, but our
Xamarin.Shared.Sdk.DefaultItems.targets file.
The solution is to add metadata for items included by default
('IsDefaultItem'), and if that's found when we calculate the virtual path, use
the executable project to calculate the virtual path, instead of the project
that defined the SceneKit items.
* [msbuild] Use a different temporary directory based on the platform.
Xamarin.Mac didn't have support for CoreML models before, so this effectively adds
support for CoreML models to Xamarin.Mac.
Also add a test to make sure it actually works.
Fix build warnings
```
build/mac/mobile/ReplayKit/RPScreenRecorder.g.cs(113,22): warning CS0628: 'RPScreenRecorder.RPScreenRecorder(IntPtr)': new protected member declared in sealed class
build/mac/full/ReplayKit/RPScreenRecorder.g.cs(113,22): warning CS0628: 'RPScreenRecorder.RPScreenRecorder(IntPtr)': new protected member declared in sealed class
```
which still happens even if we disable XM in `main` :|
Added generator test based on Whitney's test case from github issue
ref: https://github.com/xamarin/xamarin-macios/issues/9065
Figure out if
* we're missing enum values (easy to workaround, but annoying for developers)
* we expose enum values that are not defined natively (potential bugs)
reference: https://github.com/xamarin/xamarin-macios/issues/7527
since the files, mapped by the constants, might not be present in earlier
versions of the OS. We can only be sure, of their presence, on the
current/supported SDK version
Fix intro running on iOS 10.3 (64 bits)
```
Introspection.iOSApiTypoTest
[PASS] AttributeTypoTest
[FAIL] ConstantsCheck : NetworkLibrary
Expected: True
But was: False
: at Introspection.ApiTypoTest.ConstantsCheck () [0x00168] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiTypoTest.cs:1088
```