[CoreFoundation] Update bindings up to Xcode 12.2 Beta 2 (#9720)
* [CoreFoundation] Update bindings to Xcode 12.2 * Fix NRE * Add tests for manual API * Oops, fix spacing
This commit is contained in:
Родитель
f85083b9ac
Коммит
d3d278e367
|
@ -608,5 +608,46 @@ namespace CoreFoundation {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if MONOMAC
|
||||
[Introduced (PlatformName.MacOSX, 11, 0)]
|
||||
[DllImport (Constants.CoreFoundationLibrary)]
|
||||
[return: MarshalAs (UnmanagedType.I1)]
|
||||
extern static bool CFBundleIsExecutableLoadable (IntPtr bundle);
|
||||
|
||||
[Introduced (PlatformName.MacOSX, 11, 0)]
|
||||
public static bool IsExecutableLoadable (CFBundle bundle)
|
||||
{
|
||||
if (bundle == null)
|
||||
throw new ArgumentNullException (nameof (bundle));
|
||||
if (bundle.Handle == IntPtr.Zero)
|
||||
throw new ObjectDisposedException (nameof (bundle));
|
||||
|
||||
return CFBundleIsExecutableLoadable (bundle.Handle);
|
||||
}
|
||||
|
||||
[Introduced (PlatformName.MacOSX, 11, 0)]
|
||||
[DllImport (Constants.CoreFoundationLibrary)]
|
||||
[return: MarshalAs (UnmanagedType.I1)]
|
||||
extern static bool CFBundleIsExecutableLoadableForURL (IntPtr bundle);
|
||||
|
||||
[Introduced (PlatformName.MacOSX, 11, 0)]
|
||||
public static bool IsExecutableLoadable (NSUrl url)
|
||||
{
|
||||
if (url == null)
|
||||
throw new ArgumentNullException (nameof (url));
|
||||
|
||||
return CFBundleIsExecutableLoadableForURL (url.Handle);
|
||||
}
|
||||
|
||||
[Introduced (PlatformName.MacOSX, 11, 0)]
|
||||
[DllImport (Constants.CoreFoundationLibrary)]
|
||||
[return: MarshalAs (UnmanagedType.I1)]
|
||||
extern static bool CFBundleIsArchitectureLoadable (/*cpu_type_t => integer_t => int*/ Architecture architecture);
|
||||
|
||||
[Introduced (PlatformName.MacOSX, 11, 0)]
|
||||
public static bool IsArchitectureLoadable (Architecture architecture) => CFBundleIsArchitectureLoadable (architecture);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -356,5 +356,38 @@ namespace MonoTouchFixtures.CoreFoundation {
|
|||
{
|
||||
CFBundle.GetInfoDictionary (null);
|
||||
}
|
||||
|
||||
#if MONOMAC
|
||||
[Test]
|
||||
public void TestIsArchitectureLoadable ()
|
||||
{
|
||||
TestRuntime.AssertXcodeVersion (12, 2);
|
||||
|
||||
bool loadable_x86_64 = CFBundle.IsArchitectureLoadable (CFBundle.Architecture.X86_64);
|
||||
if (global::System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == global::System.Runtime.InteropServices.Architecture.X64)
|
||||
Assert.IsTrue (loadable_x86_64, "x86_64 Expected => true");
|
||||
else
|
||||
Assert.IsFalse (loadable_x86_64, "x86_64 Expected => false");
|
||||
|
||||
bool loadable_arm64 = CFBundle.IsArchitectureLoadable (CFBundle.Architecture.ARM64);
|
||||
if (global::System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture == global::System.Runtime.InteropServices.Architecture.Arm64)
|
||||
Assert.IsTrue (loadable_arm64, "arm64 Expected => true");
|
||||
else
|
||||
Assert.IsFalse (loadable_arm64, "arm64 Expected => false");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsExecutableLoadable ()
|
||||
{
|
||||
TestRuntime.AssertXcodeVersion (12, 2);
|
||||
|
||||
var main = CFBundle.GetMain ();
|
||||
var loadableBundle = CFBundle.IsExecutableLoadable (main);
|
||||
Assert.IsTrue (loadableBundle, "loadableBundle");
|
||||
|
||||
var loadableBundleUrl = CFBundle.IsExecutableLoadable (main.ExecutableUrl);
|
||||
Assert.IsTrue (loadableBundleUrl, "loadableBundleUrl");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
!missing-pinvoke! CFBundleIsArchitectureLoadable is not bound
|
||||
!missing-pinvoke! CFBundleIsExecutableLoadable is not bound
|
||||
!missing-pinvoke! CFBundleIsExecutableLoadableForURL is not bound
|
Загрузка…
Ссылка в новой задаче