Merge remote-tracking branch 'origin/main' into msr

This commit is contained in:
Rolf Bjarne Kvinge 2023-05-12 08:45:15 +02:00
Родитель f32c9e149f feebcfaa07
Коммит dd2252f365
9 изменённых файлов: 41 добавлений и 58 удалений

Просмотреть файл

@ -285,7 +285,7 @@ namespace ObjCRuntime {
var rv = class_map.handle; var rv = class_map.handle;
is_custom_type = (class_map.flags & Runtime.MTTypeFlags.CustomType) == Runtime.MTTypeFlags.CustomType; is_custom_type = (class_map.flags & Runtime.MTTypeFlags.CustomType) == Runtime.MTTypeFlags.CustomType;
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"FindClass ({type.FullName}, {is_custom_type}): 0x{rv.ToString ("x")} = {Marshal.PtrToStringAuto (class_getName (rv))}."); Runtime.NSLog ($"FindClass ({type.FullName}, {is_custom_type}): 0x{rv.ToString ("x")} = {Marshal.PtrToStringAuto (class_getName (rv))}.");
#endif #endif
return rv; return rv;
} }
@ -367,11 +367,15 @@ namespace ObjCRuntime {
{ {
var map = Runtime.options->RegistrationMap; var map = Runtime.options->RegistrationMap;
#if LOG_TYPELOAD
Runtime.NSLog ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))})");
#endif
is_custom_type = false; is_custom_type = false;
if (map is null) { if (map is null) {
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => found no map."); Runtime.NSLog ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => found no map.");
#endif #endif
return null; return null;
} }
@ -380,23 +384,30 @@ namespace ObjCRuntime {
var mapIndex = FindMapIndex (map->map, 0, map->map_count - 1, @class); var mapIndex = FindMapIndex (map->map, 0, map->map_count - 1, @class);
if (mapIndex == -1) { if (mapIndex == -1) {
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => found no type."); Runtime.NSLog ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => found no type.");
#endif #endif
return null; return null;
} }
#if LOG_TYPELOAD
Runtime.NSLog ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => found index {mapIndex}.");
#endif
is_custom_type = (map->map [mapIndex].flags & Runtime.MTTypeFlags.CustomType) == Runtime.MTTypeFlags.CustomType; is_custom_type = (map->map [mapIndex].flags & Runtime.MTTypeFlags.CustomType) == Runtime.MTTypeFlags.CustomType;
var type = class_to_type [mapIndex]; var type = class_to_type [mapIndex];
if (type is not null) if (type is not null) {
#if LOG_TYPELOAD
Runtime.NSLog ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => found type {type.FullName} for map index {mapIndex}.");
#endif
return type; return type;
}
// Resolve the map entry we found to a managed type // Resolve the map entry we found to a managed type
var type_reference = map->map [mapIndex].type_reference; var type_reference = map->map [mapIndex].type_reference;
type = ResolveTypeTokenReference (type_reference); type = ResolveTypeTokenReference (type_reference);
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => {type?.FullName}; is custom: {is_custom_type} (token reference: 0x{type_reference:X})."); Runtime.NSLog ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => {type?.FullName}; is custom: {is_custom_type} (token reference: 0x{type_reference:X}).");
#endif #endif
class_to_type [mapIndex] = type; class_to_type [mapIndex] = type;
@ -414,7 +425,7 @@ namespace ObjCRuntime {
var token = entry.token; var token = entry.token;
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"ResolveFullTokenReference (0x{token_reference:X}) assembly name: {assembly_name} module token: 0x{module_token:X} token: 0x{token:X}."); Runtime.NSLog ($"ResolveFullTokenReference (0x{token_reference:X}) assembly name: {assembly_name} module token: 0x{module_token:X} token: 0x{token:X}.");
#endif #endif
var assembly = ResolveAssembly (assembly_name); var assembly = ResolveAssembly (assembly_name);
@ -455,7 +466,7 @@ namespace ObjCRuntime {
uint token = (token_reference >> 8) + implicit_token_type; uint token = (token_reference >> 8) + implicit_token_type;
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"ResolveTokenReference (0x{token_reference:X}) assembly index: {assembly_index} token: 0x{token:X}."); Runtime.NSLog ($"ResolveTokenReference (0x{token_reference:X}) assembly index: {assembly_index} token: 0x{token:X}.");
#endif #endif
var assembly_name = map->assemblies [(int) assembly_index].name; var assembly_name = map->assemblies [(int) assembly_index].name;
@ -487,7 +498,7 @@ namespace ObjCRuntime {
type = module.ResolveType ((int) token); type = module.ResolveType ((int) token);
} }
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"ResolveToken (0x{token:X}) => Type: {type.FullName}"); Runtime.NSLog ($"ResolveToken (0x{token:X}) => Type: {type.FullName}");
#endif #endif
return type; return type;
case 0x06000000: // Method case 0x06000000: // Method
@ -499,7 +510,7 @@ namespace ObjCRuntime {
var method = module.ResolveMethod ((int) token); var method = module.ResolveMethod ((int) token);
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"ResolveToken (0x{token:X}) => Method: {method?.DeclaringType?.FullName}.{method.Name}"); Runtime.NSLog ($"ResolveToken (0x{token:X}) => Method: {method?.DeclaringType?.FullName}.{method?.Name}");
#endif #endif
return method; return method;
default: default:
@ -517,7 +528,7 @@ namespace ObjCRuntime {
continue; continue;
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"ResolveModule (\"{assembly.FullName}\", 0x{token:X}): {mod.Name}."); Runtime.NSLog ($"ResolveModule (\"{assembly.FullName}\", 0x{token:X}): {mod.Name}.");
#endif #endif
return mod; return mod;
} }
@ -591,7 +602,7 @@ namespace ObjCRuntime {
continue; continue;
#if LOG_TYPELOAD #if LOG_TYPELOAD
Console.WriteLine ($"TryResolveAssembly (0x{assembly_name:X}): {asm.FullName}."); Runtime.NSLog ($"TryResolveAssembly (0x{assembly_name:X}): {asm.FullName}.");
#endif #endif
assembly = asm; assembly = asm;
return true; return true;

Просмотреть файл

@ -525,6 +525,13 @@ public class BindingTouch : IDisposable {
typeManager ??= new (this, api, universe.CoreAssembly, baselib); typeManager ??= new (this, api, universe.CoreAssembly, baselib);
foreach (var linkWith in AttributeManager.GetCustomAttributes<LinkWithAttribute> (api)) { foreach (var linkWith in AttributeManager.GetCustomAttributes<LinkWithAttribute> (api)) {
#if NET
if (string.IsNullOrEmpty (linkWith.LibraryName))
#else
if (linkWith.LibraryName is null || string.IsNullOrEmpty (linkWith.LibraryName))
#endif
continue;
if (!linkwith.Contains (linkWith.LibraryName)) { if (!linkwith.Contains (linkWith.LibraryName)) {
Console.Error.WriteLine ("Missing native library {0}, please use `--link-with' to specify the path to this library.", linkWith.LibraryName); Console.Error.WriteLine ("Missing native library {0}, please use `--link-with' to specify the path to this library.", linkWith.LibraryName);
return 1; return 1;

Просмотреть файл

@ -211,7 +211,7 @@ public partial class Generator {
if (export is null) if (export is null)
throw new BindingException (1074, true, type.Name, p.Name); throw new BindingException (1074, true, type.Name, p.Name);
var sel = export.Selector; var sel = export.Selector!;
if (sel.StartsWith ("input", StringComparison.Ordinal)) if (sel.StartsWith ("input", StringComparison.Ordinal))
name = sel; name = sel;
else else
@ -237,7 +237,7 @@ public partial class Generator {
if (export is null) if (export is null)
return; return;
var selector = export.Selector; var selector = export.Selector!;
if (setter) if (setter)
selector = "set" + selector.Capitalize () + ":"; selector = "set" + selector.Capitalize () + ":";

Просмотреть файл

@ -5,6 +5,7 @@
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework> <TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<DefineConstants>DEBUG;BGENERATOR;NET_4_0;NO_AUTHENTICODE;STATIC;NO_SYMBOL_WRITER;NET</DefineConstants> <DefineConstants>DEBUG;BGENERATOR;NET_4_0;NO_AUTHENTICODE;STATIC;NO_SYMBOL_WRITER;NET</DefineConstants>
<WarningsAsErrors>Nullable</WarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

Просмотреть файл

@ -7157,12 +7157,20 @@ namespace Foundation {
[Export ("fileURLWithPath:isDirectory:relativeToURL:")] [Export ("fileURLWithPath:isDirectory:relativeToURL:")]
NSUrl CreateFileUrl (string path, bool isDir, [NullAllowed] NSUrl relativeToUrl); NSUrl CreateFileUrl (string path, bool isDir, [NullAllowed] NSUrl relativeToUrl);
[Static]
[Export ("fileURLWithPath:isDirectory:")]
NSUrl CreateFileUrl (string path, bool isDir);
[iOS (9, 0), Mac (10, 11)] [iOS (9, 0), Mac (10, 11)]
[MacCatalyst (13, 1)] [MacCatalyst (13, 1)]
[Static] [Static]
[Export ("fileURLWithPath:relativeToURL:")] [Export ("fileURLWithPath:relativeToURL:")]
NSUrl CreateFileUrl (string path, [NullAllowed] NSUrl relativeToUrl); NSUrl CreateFileUrl (string path, [NullAllowed] NSUrl relativeToUrl);
[Static]
[Export ("fileURLWithPath:")]
NSUrl CreateFileUrl (string path);
[iOS (9, 0), Mac (10, 11)] [iOS (9, 0), Mac (10, 11)]
[MacCatalyst (13, 1)] [MacCatalyst (13, 1)]
[Static] [Static]

Просмотреть файл

@ -32,10 +32,7 @@ namespace MonoTouchFixtures.MediaAccessibility {
using (NSUrl url = new NSUrl (NetworkResources.MicrosoftUrl)) { using (NSUrl url = new NSUrl (NetworkResources.MicrosoftUrl)) {
var s = MAImageCaptioning.GetCaption (url, out var e); var s = MAImageCaptioning.GetCaption (url, out var e);
Assert.Null (s, "remote / return value"); Assert.Null (s, "remote / return value");
if (e is not null && e.Description.Contains ("Invalid url:")) { Assert.That (e, Is.Null.Or.Not.Null, "remote / error"); // sometimes we get an error, and sometimes we don't 🤷‍♂️
TestRuntime.IgnoreInCI ($"Ignore this failure when network is down: {e}"); // could not connect to the network, fail and add a nice reason
}
Assert.Null (e, "remote / no error"); // weird should be an "image on disk"
} }
string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "basn3p08.png"); string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "basn3p08.png");
file = file.Replace (" ", "%20"); file = file.Replace (" ", "%20");

Просмотреть файл

@ -363,8 +363,6 @@
!missing-selector! +NSTimer::scheduledTimerWithTimeInterval:invocation:repeats: not bound !missing-selector! +NSTimer::scheduledTimerWithTimeInterval:invocation:repeats: not bound
!missing-selector! +NSTimer::timerWithTimeInterval:invocation:repeats: not bound !missing-selector! +NSTimer::timerWithTimeInterval:invocation:repeats: not bound
!missing-selector! +NSTimeZone::setAbbreviationDictionary: not bound !missing-selector! +NSTimeZone::setAbbreviationDictionary: not bound
!missing-selector! +NSURL::fileURLWithPath: not bound
!missing-selector! +NSURL::fileURLWithPath:isDirectory: not bound
!missing-selector! +NSURL::resourceValuesForKeys:fromBookmarkData: not bound !missing-selector! +NSURL::resourceValuesForKeys:fromBookmarkData: not bound
!missing-selector! +NSURLProtocol::canInitWithTask: not bound !missing-selector! +NSURLProtocol::canInitWithTask: not bound
!missing-selector! +NSURLQueryItem::queryItemWithName:value: not bound !missing-selector! +NSURLQueryItem::queryItemWithName:value: not bound

Просмотреть файл

@ -372,8 +372,6 @@
!missing-selector! +NSTimer::scheduledTimerWithTimeInterval:invocation:repeats: not bound !missing-selector! +NSTimer::scheduledTimerWithTimeInterval:invocation:repeats: not bound
!missing-selector! +NSTimer::timerWithTimeInterval:invocation:repeats: not bound !missing-selector! +NSTimer::timerWithTimeInterval:invocation:repeats: not bound
!missing-selector! +NSTimeZone::setAbbreviationDictionary: not bound !missing-selector! +NSTimeZone::setAbbreviationDictionary: not bound
!missing-selector! +NSURL::fileURLWithPath: not bound
!missing-selector! +NSURL::fileURLWithPath:isDirectory: not bound
!missing-selector! +NSURL::resourceValuesForKeys:fromBookmarkData: not bound !missing-selector! +NSURL::resourceValuesForKeys:fromBookmarkData: not bound
!missing-selector! +NSURLProtocol::canInitWithTask: not bound !missing-selector! +NSURLProtocol::canInitWithTask: not bound
!missing-selector! +NSURLQueryItem::queryItemWithName:value: not bound !missing-selector! +NSURLQueryItem::queryItemWithName:value: not bound

Просмотреть файл

@ -222,22 +222,6 @@ steps:
TargetUrl = "$pkgsVirtualUrl/notarized/$macPkg" ; TargetUrl = "$pkgsVirtualUrl/notarized/$macPkg" ;
Error = "Notarized xamarin.mac pkg not found." ; Error = "Notarized xamarin.mac pkg not found." ;
ShouldExist = $notarizedShouldExist; ShouldExist = $notarizedShouldExist;
},
@{
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;
} }
) )
@ -248,27 +232,6 @@ steps:
$statuses.SetStatus("error", $info.Error, $info.Context) $statuses.SetStatus("error", $info.Error, $info.Context)
} }
} }
if ($Env:ENABLE_DOTNET -eq "True" -and $Env:SkipNugets -ne "True") {
$nugets = Get-ChildItem -Path $pkgsPath -Filter *.nupkg -File -Name
Write-Host $nugets
Write-Host "nuget count is $($nugets.Count)"
if ($nugets.Count -gt 0) {
Write-Host "Setting status to success."
$statuses.SetStatus("success", "Nugets built.", "$(Build.DefinitionName) (Nugets built)", "$pkgsVirtualUrl/$n")
Write-Host "Publishing result is $Env:NUGETS_PUBLISHED"
if ($Env:NUGETS_PUBLISHED -ne "Failed") {
$statuses.SetStatus("success", "Nugets published.", "$(Build.DefinitionName) (Nugets published)", "$pkgsVirtualUrl/$n")
} else {
$statuses.SetStatus("error", "Error when publishing nugets.", "$(Build.DefinitionName) (Nugets published)", "$pkgsVirtualUrl/$n")
}
} else {
Write-Host "Setting nuget status to failure."
$statuses.SetStatus("error", "No nugets were built.", "$(Build.DefinitionName) (Nugets built)", "$pkgsVirtualUrl/$n")
$statuses.SetStatus("error", "No nugets were published.", "$(Build.DefinitionName) (Nugets published)", "$pkgsVirtualUrl/$n")
}
}
$msi = Get-ChildItem -Path $pkgsPath -Filter *.msi -File -Name $msi = Get-ChildItem -Path $pkgsPath -Filter *.msi -File -Name