Skip to content

Commit

Permalink
Merge branch 'main' into cfnetwork-xcode13-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
mandel-macaque committed Jun 18, 2021
2 parents 6173f23 + abca8f1 commit b4b40d2
Show file tree
Hide file tree
Showing 29 changed files with 123 additions and 109 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ 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)"] || [ -n "$(ENABLE_DOTNET_WINDOWS)"]; then \
@if [ -n "$(ENABLE_XAMARIN)" ] || [ -n "$(ENABLE_DOTNET)"]; then \
CONFIGURE_FLAGS=""; \
if [ -n "$(ENABLE_XAMARIN)" ]; then \
echo "Xamarin-specific build has been re-enabled"; \
Expand All @@ -168,10 +168,6 @@ git-clean-all:
echo "Dotnet-specific build has been re-enabled"; \
CONFIGURE_FLAGS="$$CONFIGURE_FLAGS --enable-dotnet"; \
fi; \
if [ -n "$(ENABLE_DOTNET_WINDOWS)" ]; then \
echo "Dotnet-specific Windows build has been re-enabled"; \
CONFIGURE_FLAGS="$$CONFIGURE_FLAGS --enable-dotnet-windows"; \
fi; \
./configure "$$CONFIGURE_FLAGS"; \
$(MAKE) reset; \
echo "Done"; \
Expand Down
7 changes: 2 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ Usage: configure [options]
--enable-dotnet Enable building .NET 6 bits.
--disable-dotnet Disable building .NET 6 bits.
--enable-dotnet-windows Enable building Windows .NET 6 bits. Building .NET 6 bits must be also enabled (--enable-dotnet).
--disable-dotnet-windows Disable building Windows .NET 6 bits.
--enable-documentation Enable building of API documentation
--disable-documentation Disable building of API documentation.
Expand Down Expand Up @@ -134,11 +131,11 @@ while test "x$1" != x; do
shift
;;
--enable-dotnet-windows)
echo "ENABLE_DOTNET_WINDOWS=1" >> "$CONFIGURED_FILE"
echo "$1 is ignored. Use --enable-dotnet instead"
shift
;;
--disable-dotnet-windows)
echo "ENABLE_DOTNET_WINDOWS=" >> "$CONFIGURED_FILE"
echo "$1 is ignored. Use --disable-dotnet instead"
shift
;;
--enable-install-source)
Expand Down
2 changes: 0 additions & 2 deletions dotnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ $(DOTNET_NUPKG_DIR)/%.nupkg: nupkgs/%.nupkg | $(DOTNET_NUPKG_DIR)

ifdef INCLUDE_IOS
SDK_PACK_IOS_WINDOWS = $(DOTNET_NUPKG_DIR)/$(IOS_WINDOWS_NUGET).Sdk.$(IOS_WINDOWS_NUGET_VERSION_FULL).nupkg
ifdef ENABLE_DOTNET_WINDOWS
SDK_PACKS += $(SDK_PACK_IOS_WINDOWS)
endif
endif

pack-ios-windows: $(SDK_PACK_IOS_WINDOWS)

Expand Down
2 changes: 0 additions & 2 deletions msbuild/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ MSBUILD_DIRECTORIES += $(DOTNET_DIRECTORIES)
ifdef ENABLE_DOTNET
MSBUILD_PRODUCTS += $(DOTNET_TARGETS)

ifdef ENABLE_DOTNET_WINDOWS
DOTNET_IOS_WINDOWS_OUTPUT_FILES = $(foreach dll,$(IOS_WINDOWS_TASK_ASSEMBLIES),$(dll).dll $(dll).pdb) Broker.zip Build.zip
DOTNET_IOS_WINDOWS_FILES = $(IOS_WINDOWS_TARGETS) $(foreach file,$(DOTNET_IOS_WINDOWS_OUTPUT_FILES),Xamarin.iOS.Tasks.Windows/bin/$(CONFIG)/$(TARGETFRAMEWORK)/$(file))

Expand All @@ -484,7 +483,6 @@ DOTNET_IOS_WINDOWS_FILES = $(IOS_WINDOWS_TARGETS) $(foreach file,$(DOTNET_IOS_WI
all-local:: .dotnet-windows
dotnet:: .dotnet-windows
endif
endif

##
## Common targets ##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public override bool Execute ()
var lib = Path.GetFullPath (libSpec.ItemSpec);
var libExtension = Path.GetExtension (lib).ToLowerInvariant ();
switch (libExtension) {
case "": // we can get static libraries without any extensions at all
case ".a":
case ".o":
var forceLoad = string.Equals (libSpec.GetMetadata ("ForceLoad"), "true", StringComparison.OrdinalIgnoreCase);
Expand All @@ -144,7 +145,7 @@ public override bool Execute ()
arguments.Add (Path.GetFileNameWithoutExtension (lib));
break;
default:
Log.LogError ($"Unknown library extension {libExtension} to link with for {lib}.");
Log.LogError ($"Unknown library extension '{libExtension}' to link with for {lib}.");
return false;
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/CoreHaptics/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public enum CHHapticErrorCode : long {
InvalidPatternData = -4813,
InvalidPatternDictionary = -4814,
InvalidAudioSession = -4815,
InvalidEngineParameter = -4816,
InvalidParameterType = -4820,
InvalidEventType = -4821,
InvalidEventTime = -4822,
Expand All @@ -121,6 +122,8 @@ public enum CHHapticErrorCode : long {
BadEventEntry = -4830,
BadParameterEntry = -4831,
InvalidTime = -4840,
FileNotFound = -4851,
InsufficientPower = -4897,
UnknownError = -4898,
MemoryError = -4899,
}
Expand All @@ -145,4 +148,4 @@ public enum CHHapticEngineStoppedReason : long {
GameControllerDisconnect = 6,
SystemError = -1,
}
}
}
45 changes: 23 additions & 22 deletions src/UIKit/UIApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
using System.Threading;
using ObjCRuntime;
using System.Runtime.InteropServices;
using CoreFoundation;
using Foundation;

#nullable enable

namespace UIKit {
public class UIKitThreadAccessException : Exception {
public UIKitThreadAccessException () : base ("UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread.")
Expand All @@ -34,15 +37,15 @@ partial class UIApplication
: UIResponder
#endif
{
static Thread mainThread;
static Thread? mainThread;
public static bool CheckForIllegalCrossThreadCalls = true;
public static bool CheckForEventAndDelegateMismatches = true;

#if !WATCH
// We link with __Internal here so that this function is interposable from third-party native libraries.
// See: https://github.com/xamarin/MicrosoftInTune/issues/3 for an example.
[DllImport (/*Constants.UIKitLibrary*/ "__Internal")]
extern static int UIApplicationMain (int argc, /* char[]* */ string [] argv, /* NSString* */ IntPtr principalClassName, /* NSString* */ IntPtr delegateClassName);
extern static int UIApplicationMain (int argc, /* char[]* */ string []? argv, /* NSString* */ IntPtr principalClassName, /* NSString* */ IntPtr delegateClassName);
#endif

// called from NSExtension.Initialize (so other, future stuff, can be added if needed)
Expand All @@ -57,33 +60,31 @@ internal static void Initialize ()
}

#if !WATCH
public static void Main (string [] args, string principalClassName, string delegateClassName)
[Obsolete ("Use the overload with 'Type' instead of 'String' parameters for type safety.")]
public static void Main (string []? args, string? principalClassName, string? delegateClassName)
{
var p = NSString.CreateNative (principalClassName);
var d = NSString.CreateNative (delegateClassName);
try {
Main (args, p, d);
} finally {
// it just looks nicer to release them
NSString.ReleaseNative (d);
NSString.ReleaseNative (p);
}
var p = CFString.CreateNative (principalClassName);
var d = CFString.CreateNative (delegateClassName);
Initialize ();
UIApplicationMain (args?.Length ?? 0, args, p, d);
CFString.ReleaseNative (d);
CFString.ReleaseNative (p);
}

public static void Main (string [] args, Type principalClass, Type delegateClass)
public static void Main (string []? args, Type? principalClass, Type? delegateClass)
{
Main (args, principalClass == null ? null : new Class (principalClass).Name, delegateClass == null ? null : new Class (delegateClass).Name);
}

public static void Main (string [] args)
{
Main (args, IntPtr.Zero, IntPtr.Zero);
var p = principalClass == null ? IntPtr.Zero : CFString.CreateNative (new Class (principalClass).Name);
var d = delegateClass == null ? IntPtr.Zero : CFString.CreateNative (new Class (delegateClass).Name);
Initialize ();
UIApplicationMain (args?.Length ?? 0, args, p, d);
CFString.ReleaseNative (d);
CFString.ReleaseNative (p);
}

static void Main (string [] args, IntPtr principal, IntPtr @delegate)
public static void Main (string []? args)
{
Initialize ();
UIApplicationMain (args.Length, args, principal, @delegate);
UIApplicationMain (args?.Length ?? 0, args, IntPtr.Zero, IntPtr.Zero);
}
#endif

Expand All @@ -101,7 +102,7 @@ internal static void EnsureEventAndDelegateAreNotMismatched (object del, Type ex
throw new InvalidOperationException (string.Format("Event registration is overwriting existing delegate. Either just use events or your own delegate: {0} {1}", del.GetType (), expectedType));
}

internal static void EnsureDelegateAssignIsNotOverwritingInternalDelegate (object currentDelegateValue, object newDelegateValue, Type internalDelegateType)
internal static void EnsureDelegateAssignIsNotOverwritingInternalDelegate (object? currentDelegateValue, object? newDelegateValue, Type internalDelegateType)
{
if (UIApplication.CheckForEventAndDelegateMismatches && currentDelegateValue != null && newDelegateValue != null
&& currentDelegateValue.GetType().IsAssignableFrom (internalDelegateType)
Expand Down
25 changes: 24 additions & 1 deletion src/corehaptics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ partial interface CHHapticPatternDefinitionKeys {

[Field ("CHHapticPatternKeyParameterCurveControlPoints")]
NSString ParameterCurveControlPointsKey { get; }

[TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("CHHapticPatternKeyEventWaveformUseVolumeEnvelope")]
NSString EventWaveformUseVolumeEnvelopeKey { get; }
}

[Mac (10,15), iOS (13,0), TV (14, 0)]
Expand All @@ -373,6 +377,9 @@ partial interface CHHapticPatternDefinition {
NSObject WeakParameterCurve { get; set; }
[Export ("ParameterCurveControlPointsKey")]
NSObject WeakParameterCurveControlPoints { get; set; }
[Advice ("The default value is true.")]
[TV (15,0), NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
bool EventWaveformUseVolumeEnvelope { get; set; }
}

[Mac (10,15), iOS (13,0), TV (14, 0)]
Expand Down Expand Up @@ -403,4 +410,20 @@ interface CHHapticPattern {
[return: NullAllowed]
CHHapticPatternDefinition Export ([NullAllowed] out NSError outError);
}
}

[Static]
[Internal]
[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch]
partial interface CHHapticAudioResourceKeys {
[Field ("CHHapticAudioResourceKeyUseVolumeEnvelope")]
NSString UseVolumeEnvelopeKey { get; }
}

[Mac (12,0), iOS (15,0), TV (15,0), MacCatalyst (15,0), NoWatch]
[StrongDictionary ("CHHapticAudioResourceKeys")]
partial interface CHHapticAudioResourceDefinition {
[Advice ("The default value is true.")]
bool UseVolumeEnvelope { get; set; }
}

}
5 changes: 5 additions & 0 deletions src/coreml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@ interface MLMultiArrayConstraint : NSSecureCoding {
[BaseType (typeof (NSObject))]
interface MLPredictionOptions {

[Deprecated (PlatformName.WatchOS, 8, 0, message: "Use 'MLModelConfiguration.ComputeUnits' instead.")]
[Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'MLModelConfiguration.ComputeUnits' instead.")]
[Deprecated (PlatformName.iOS, 15, 0, message: "Use 'MLModelConfiguration.ComputeUnits' instead.")]
[Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'MLModelConfiguration.ComputeUnits' instead.")]
[Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'MLModelConfiguration.ComputeUnits' instead.")]
[Export ("usesCPUOnly")]
bool UsesCpuOnly { get; set; }
}
Expand Down
37 changes: 35 additions & 2 deletions src/coremotion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,23 @@ interface CMAltimeter {
[Static]
[Export ("authorizationStatus")]
CMAuthorizationStatus AuthorizationStatus { get; }

[Watch (8,0), NoTV, NoMac, iOS (15,0), MacCatalyst (15,0)]
[Static]
[Export ("isAbsoluteAltitudeAvailable")]
bool IsAbsoluteAltitudeAvailable { get; }

[Watch (8,0), NoTV, NoMac, iOS (15, 0), MacCatalyst (15,0)]
[Export ("absoluteAltitudeUpdateInterval")]
double AbsoluteAltitudeUpdateInterval { get; set; }

[Watch (8,0), NoTV, NoMac, iOS (15,0), MacCatalyst (15,0)]
[Export ("startAbsoluteAltitudeUpdatesToQueue:withHandler:")]
void StartAbsoluteAltitudeUpdates (NSOperationQueue queue, Action<CMAbsoluteAltitudeData, NSError> handler);

[Watch (8,0), NoTV, NoMac, iOS (15,0), MacCatalyst (15,0)]
[Export ("stopAbsoluteAltitudeUpdates")]
void StopAbsoluteAltitudeUpdates ();
}

[Mac (10,15)]
Expand Down Expand Up @@ -667,7 +684,7 @@ public enum CMDeviceMotionSensorLocation : long {

[iOS (14,0)][Watch (7,0)]
[MacCatalyst (14,0)]
[NoMac]
[Mac (12,0)]
[BaseType (typeof(NSObject))]
interface CMHeadphoneMotionManager {

Expand Down Expand Up @@ -705,7 +722,7 @@ interface ICMHeadphoneMotionManagerDelegate {}

[iOS (14,0)][Watch (7,0)]
[MacCatalyst (14,0)]
[NoMac]
[Mac (12,0)]
[Protocol, Model (AutoGeneratedName = true)]
[BaseType (typeof (NSObject))]
interface CMHeadphoneMotionManagerDelegate {
Expand Down Expand Up @@ -793,4 +810,20 @@ interface CMFallDetectionDelegate {
[Export ("fallDetectionManagerDidChangeAuthorization:")]
void DidChangeAuthorization (CMFallDetectionManager fallDetectionManager);
}

[DisableDefaultCtor] // will crash
[Watch (8,0), NoTV, NoMac, iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof(CMLogItem))]
interface CMAbsoluteAltitudeData
{
[Export ("altitude")]
double Altitude { get; }

[Export ("accuracy")]
double Accuracy { get; }

[Export ("precision")]
double Precision { get; }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<DefineConstants Condition="'$(Platform)' != 'iPhoneSimulator'">$(DefineConstants);DEVICE</DefineConstants>
<RootTestsDirectory>..\..\..</RootTestsDirectory>
<MtouchLink>None</MtouchLink>
<MtouchExtraArgs>-xml=${ProjectDir}/../extra-linker-defs.xml</MtouchExtraArgs>
</PropertyGroup>

<ItemGroup>
Expand All @@ -33,6 +32,8 @@
<None Include="..\..\Entitlements.plist" />
<None Include="..\..\app.config" />
<None Include="..\..\EmptyNib.xib" />

<LinkDescription Include="$(RootTestsDirectory)\monotouch-test\dotnet\extra-linker-defs.xml" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion tests/monotouch-test/dotnet/iOS/monotouch-test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<DefineConstants Condition="'$(Platform)' != 'iPhoneSimulator'">$(DefineConstants);DEVICE</DefineConstants>
<RootTestsDirectory>..\..\..</RootTestsDirectory>
<MtouchLink>None</MtouchLink>
<MtouchExtraArgs>-xml=${ProjectDir}/../extra-linker-defs.xml</MtouchExtraArgs>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,11 +27,17 @@
<PackageReference Include="System.Json" Version="4.7.1" />
</ItemGroup>

<ItemGroup>
<LinkDescription Include="$(RootTestsDirectory)\monotouch-test\dotnet\extra-linker-defs.xml" />
</ItemGroup>

<ItemGroup>
<None Include="Info.plist" />
<None Include="..\..\Entitlements.plist" />
<None Include="..\..\app.config" />
<None Include="..\..\EmptyNib.xib" />

<LinkDescription Include="$(RootTestsDirectory)\monotouch-test\dotnet\extra-linker-defs.xml" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion tests/monotouch-test/dotnet/tvOS/monotouch-test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<DefineConstants Condition="'$(Platform)' != 'iPhoneSimulator'">$(DefineConstants);DEVICE</DefineConstants>
<RootTestsDirectory>..\..\..</RootTestsDirectory>
<MtouchLink>None</MtouchLink>
<MtouchExtraArgs>-xml=${ProjectDir}/../extra-linker-defs.xml</MtouchExtraArgs>
</PropertyGroup>

<ItemGroup>
Expand All @@ -33,6 +32,8 @@
<None Include="..\..\Entitlements.plist" />
<None Include="..\..\app.config" />
<None Include="..\..\EmptyNib.xib" />

<LinkDescription Include="$(RootTestsDirectory)\monotouch-test\dotnet\extra-linker-defs.xml" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions tests/mtouch/StringUtilsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,17 @@ public void ParseVersion ()
v = StringUtils.ParseVersion ("10.13.2");
Assert.That (v.ToString (), Is.EqualTo ("10.13.2"), "10.13.2");
}

[Test]
public void QuoteForProcess ()
{
Assert.That (StringUtils.QuoteForProcess ("a"), Is.EqualTo ("a"), "normal");
Assert.That (StringUtils.QuoteForProcess ("😁"), Is.EqualTo ("😁"), "😁");
Assert.That (StringUtils.QuoteForProcess ("b b"), Is.EqualTo ("\"b b\""), "space");
Assert.That (StringUtils.QuoteForProcess ("'"), Is.EqualTo ("\"'\""), "single quote");
Assert.That (StringUtils.QuoteForProcess ("\\"), Is.EqualTo ("\"\\\\\""), "backslash");
Assert.That (StringUtils.QuoteForProcess ("\""), Is.EqualTo ("\"\\\"\""), "double quote");
Assert.That (StringUtils.QuoteForProcess (@"C:\double "" quote\single ' quote\space here\"), Is.EqualTo (@"""C:\\double \"" quote\\single ' quote\\space here\\"""), "windows path");
}
}
}
Loading

0 comments on commit b4b40d2

Please sign in to comment.