Skip to content

Commit

Permalink
Merge branch 'main' into dotnet-sealer
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Pouliot committed Aug 9, 2021
2 parents 46cdb8d + 9307052 commit f72f113
Show file tree
Hide file tree
Showing 32 changed files with 363 additions and 241 deletions.
2 changes: 0 additions & 2 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -707,13 +707,11 @@
<_AOTInputDirectory>$(_IntermediateNativeLibraryDir)aot-input/</_AOTInputDirectory>
<_AOTOutputDirectory>$(_IntermediateNativeLibraryDir)aot-output/</_AOTOutputDirectory>

<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And '$(_RunAotCompiler)' == 'true'">static</_LibMonoLinkMode> <!-- https://github.com/dotnet/runtime/issues/55000 -->
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And ('$(ComputedPlatform)' != 'iPhone' Or '$(_PlatformName)' == 'macOS')">dylib</_LibMonoLinkMode>
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == ''">static</_LibMonoLinkMode>
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'dylib'">dylib</_LibMonoExtension>
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'static'">a</_LibMonoExtension>

<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == '' And '$(_RunAotCompiler)' == 'true'">static</_LibXamarinLinkMode> <!-- https://github.com/dotnet/runtime/issues/55000 -->
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == '' And '$(ComputedPlatform)' != 'iPhone' And '$(_PlatformName)' != 'macOS'">dylib</_LibXamarinLinkMode>
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == ''">static</_LibXamarinLinkMode>
<_LibXamarinExtension Condition="'$(_LibXamarinLinkMode)' == 'dylib'">dylib</_LibXamarinExtension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<PackageReference Include="System.IO.Abstractions" Version="6.0.27" />
<PackageReference Include="Mono.Cecil" Version="0.11.1" />
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
<PackageReference Include="GitInfo" Version="2.1.2" />
<!-- We only include build assets to get targets related to agent generation, the assemblies come from Xamarin.iOS.Tasks -->
<PackageReference Include="Xamarin.Messaging.Core" Version="$(MessagingVersion)" IncludeAssets="build" />
Expand Down
68 changes: 63 additions & 5 deletions msbuild/Xamarin.MacDev.Tasks.Core/Xamarin.MacDev.Tasks.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,72 @@
<Link>external\FileUtils.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="..\..\tools\mtouch\errors.resx">
<EmbeddedResource Include="../../tools/mtouch/Errors.resx">
<Type>Resx</Type>
<Generator>ResXFileCodeGenerator</Generator>
<XlfSourceFormat>Resx</XlfSourceFormat>
<XlfOutputItem>EmbeddedResource</XlfOutputItem>
<LastGenOutput>Errors.Designer.cs</LastGenOutput>
<LastGenOutput>../../tools/mtouch/Errors.Designer.cs</LastGenOutput>
<CustomToolNamespace>Xamarin.Bundler</CustomToolNamespace>
<LogicalName>mtouch.Errors.resources</LogicalName>
<ManifestResourceName>Xamarin.Bundler.Errors</ManifestResourceName>
<StronglyTypedFileName>../../tools/mtouch/Errors.Designer.cs</StronglyTypedFileName>
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
<StronglyTypedNamespace>Xamarin.Bundler</StronglyTypedNamespace>
<StronglyTypedClassName>Errors</StronglyTypedClassName>
<GenerateResource>true</GenerateResource>
<PublicClass>true</PublicClass>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.cs.resx">
<Link>Errors.cs.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.cs</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.de.resx">
<Link>Errors.de.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.de</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.es.resx">
<Link>Errors.es.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.es</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.fr.resx">
<Link>Errors.fr.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.fr</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.it.resx">
<Link>Errors.it.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.it</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.ja.resx">
<Link>Errors.ja.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.ja</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.ko.resx">
<Link>Errors.ko.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.ko</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.pl.resx">
<Link>Errors.pl.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.pl</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.pt-BR.resx">
<Link>Errors.pt-BR.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.pt-BR</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.ru.resx">
<Link>Errors.ru.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.ru</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.tr.resx">
<Link>Errors.tr.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.tr</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.zh-Hans.resx">
<Link>Errors.zh-Hans.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.zh-Hans</ManifestResourceName>
</EmbeddedResource>
<EmbeddedResource Include="../../tools/mtouch/TranslatedAssemblies\Errors.zh-Hant.resx">
<Link>Errors.zh-Hant.resx</Link>
<ManifestResourceName>Xamarin.Bundler.Errors.zh-Hant</ManifestResourceName>
</EmbeddedResource>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mono.Cecil" Version="0.11.1" />
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
<!-- Compile against Microsoft.Build* NuGet refs, but do not copy to OutputDir. -->
<PackageReference Include="Microsoft.Build" Version="15.9.20" IncludeAssets="compile" />
<PackageReference Include="Microsoft.Build.Framework" Version="16.8.0" IncludeAssets="compile" />
Expand Down
38 changes: 19 additions & 19 deletions src/NearbyInteraction/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@

namespace NearbyInteraction {

[Watch (8,0), NoTV, NoMac, iOS (14,0)]
[ErrorDomain ("NIErrorDomain")]
[Native]
public enum NIErrorCode : long
{
UnsupportedPlatform = -5889,
InvalidConfiguration = -5888,
SessionFailed = -5887,
ResourceUsageTimeout = -5886,
ActiveSessionsLimitExceeded = -5885,
UserDidNotAllow = -5884,
}
[Watch (8,0), NoTV, NoMac, iOS (14,0)]
[ErrorDomain ("NIErrorDomain")]
[Native]
public enum NIErrorCode : long
{
UnsupportedPlatform = -5889,
InvalidConfiguration = -5888,
SessionFailed = -5887,
ResourceUsageTimeout = -5886,
ActiveSessionsLimitExceeded = -5885,
UserDidNotAllow = -5884,
}

[Watch (8,0), NoTV, NoMac, iOS (14,0)]
[Native]
public enum NINearbyObjectRemovalReason : long
{
Timeout,
PeerEnded,
}
[Watch (8,0), NoTV, NoMac, iOS (14,0)]
[Native]
public enum NINearbyObjectRemovalReason : long
{
Timeout,
PeerEnded,
}
}
36 changes: 18 additions & 18 deletions src/NearbyInteraction/NINearbyObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@

#if __IOS__ || WATCH
namespace NearbyInteraction {
partial class NINearbyObject
{
static Vector3? _DirectionNotAvailable;
partial class NINearbyObject
{
static Vector3? _DirectionNotAvailable;

// TODO: https://github.com/xamarin/maccore/issues/2274
// We do not have generator support to trampoline Vector3 -> vector_float3 for Fields
[Field ("NINearbyObjectDirectionNotAvailable", "NearbyInteraction")]
public static Vector3 DirectionNotAvailable {
get {
if (_DirectionNotAvailable == null) {
unsafe {
Vector3 *pointer = (Vector3 *) Dlfcn.GetIndirect (Libraries.NearbyInteraction.Handle, "NINearbyObjectDirectionNotAvailable");
_DirectionNotAvailable = *pointer;
}
}
return (Vector3)_DirectionNotAvailable;
}
}
}
// TODO: https://github.com/xamarin/maccore/issues/2274
// We do not have generator support to trampoline Vector3 -> vector_float3 for Fields
[Field ("NINearbyObjectDirectionNotAvailable", "NearbyInteraction")]
public static Vector3 DirectionNotAvailable {
get {
if (_DirectionNotAvailable == null) {
unsafe {
Vector3 *pointer = (Vector3 *) Dlfcn.GetIndirect (Libraries.NearbyInteraction.Handle, "NINearbyObjectDirectionNotAvailable");
_DirectionNotAvailable = *pointer;
}
}
return (Vector3)_DirectionNotAvailable;
}
}
}

}
#endif
14 changes: 8 additions & 6 deletions src/ObjCRuntime/ErrorHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using ProductException=ObjCRuntime.RuntimeException;
#endif

#nullable enable

#if BUNDLER || MSBUILD_TASKS
namespace Xamarin.Bundler {
#else
Expand All @@ -19,20 +21,20 @@ namespace ObjCRuntime {
static partial class ErrorHelper {
public static ProductException CreateError (int code, string message, params object [] args)
{
return new ProductException (code, true, message, args);
return new ProductException (code, true, null, message, args);
}

public static ProductException CreateError (int code, Exception innerException, string message, params object [] args)
public static ProductException CreateError (int code, Exception? innerException, string message, params object [] args)
{
return new ProductException (code, true, innerException, message, args);
}

public static ProductException CreateWarning (int code, string message, params object [] args)
{
return new ProductException (code, false, message, args);
return new ProductException (code, false, null, message, args);
}

public static ProductException CreateWarning (int code, Exception innerException, string message, params object [] args)
public static ProductException CreateWarning (int code, Exception? innerException, string message, params object [] args)
{
return new ProductException (code, false, innerException, message, args);
}
Expand All @@ -47,9 +49,9 @@ internal static IList<Exception> CollectExceptions (IEnumerable<Exception> excep

internal static void CollectExceptions (Exception ex, List<Exception> exceptions)
{
AggregateException ae = ex as AggregateException;
var ae = ex as AggregateException;

if (ae != null && ae.InnerExceptions.Count > 0) {
if (ae is not null && ae.InnerExceptions.Count > 0) {
foreach (var ie in ae.InnerExceptions)
CollectExceptions (ie, exceptions);
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/ObjCRuntime/RuntimeException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;

#nullable enable

namespace ObjCRuntime {
public class RuntimeException : Exception {
public RuntimeException (string message, params object[] args)
Expand All @@ -11,7 +13,7 @@ public RuntimeException (string message, params object[] args)
}

public RuntimeException (int code, string message, params object[] args) :
this (code, false, message, args)
this (code, false, null, message, args)
{
}

Expand All @@ -20,7 +22,7 @@ public RuntimeException (int code, bool error, string message, params object[] a
{
}

public RuntimeException (int code, bool error, Exception innerException, string message, params object[] args) :
public RuntimeException (int code, bool error, Exception? innerException, string message, params object[] args) :
base (String.Format (message, args), innerException)
{
Code = code;
Expand Down
6 changes: 5 additions & 1 deletion src/generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,11 @@ public TrampolineInfo MakeTrampoline (Type t)
convert.Append ($"var {refname} = Runtime.GetINativeObject<{RenderType (nt)}> ({safe_name}, false);");
pars.Append ($"ref IntPtr {safe_name}");
postConvert.Append ($"{safe_name} = {refname} is null ? IntPtr.Zero : {refname}.Handle;");
invoke.Append ($"ref {refname}");
if (pi.IsOut)
invoke.Append ("out ");
else
invoke.Append ("ref ");
invoke.Append (refname);
continue;
}
} else if (IsNativeEnum (pi.ParameterType)) {
Expand Down
Loading

0 comments on commit f72f113

Please sign in to comment.