Skip to content

Commit

Permalink
[macos] Fix Constants.mac.cs.in for backward compatibility (#5181)
Browse files Browse the repository at this point in the history
On macOS the path changes are forward but not backward compatible.

This means we need to keep older values, as they will work on newer OS,
while the new path won't work (on older OS).

The test are updated to add exceptions for such cases - in order to
give us a better chance to spot typos (since they were some).

This should fix
xamarin/maccore#1174
xamarin/maccore#1175
xamarin/maccore#1176
xamarin/maccore#1177
  • Loading branch information
spouliot authored and rolfbjarne committed Nov 27, 2018
1 parent eb8b4f0 commit acf8357
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Constants.mac.cs.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ namespace MonoMac {
public const string ScriptingBridgeLibrary = "/System/Library/Frameworks/ScriptingBridge.framework/ScriptingBridge";
public const string CoreDataLibrary = "/System/Library/Frameworks/CoreData.framework/CoreData";
public const string CoreImageLibrary = "/System/Library/Frameworks/QuartzCore.framework/Versions/A/Frameworks/CoreImage.framework/CoreImage";
public const string CFNetworkLibrary = "/System/Library/Frameworks/CFNetwork.framework/CFNetwork";
public const string CFNetworkLibrary = "/System/Library/Frameworks/CoreServices.framework/Frameworks/CFNetwork.framework/CFNetwork";
public const string CoreMidiLibrary = "/System/Library/Frameworks/CoreMIDI.framework/CoreMIDI";
public const string QuickLookLibrary = "/System/Library/Frameworks/QuickLook.framework/QuickLook";
public const string AVFoundationLibrary = "/System/Library/Frameworks/AVFoundation.framework/AVFoundation";
public const string AccelerateImageLibrary = "/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/vImage";

public const string CoreBluetoothLibrary = "/System/Library/Frameworks//CoreBluetooth.framework/CoreBluetooth";
public const string CoreBluetoothLibrary = "/System/Library/Frameworks/IOBluetooth.framework/Versions/A/Frameworks/CoreBluetooth.framework/CoreBluetooth";
public const string GameKitLibrary = "/System/Library/Frameworks/GameKit.framework/GameKit";
public const string SceneKitLibrary = "/System/Library/Frameworks/SceneKit.framework/SceneKit";
public const string StoreKitLibrary = "/System/Library/Frameworks/StoreKit.framework/StoreKit";
Expand Down
14 changes: 11 additions & 3 deletions tests/introspection/ApiTypoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,10 +1042,18 @@ bool CheckLibrary (string lib)
#if MONOMAC
// on macOS the file should exist on the specified path
// for iOS the simulator paths do not match the strings
if (!File.Exists (lib)) {
if (lib != Constants.CoreImageLibrary)
switch (lib) {
// location changed in 10.8 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CFNetworkLibrary:
// location changed in 10.10 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CoreBluetoothLibrary:
// location changed in 10.11 but it loads fine (and fixing it breaks on earlier macOS)
case Constants.CoreImageLibrary:
break;
default:
if (!File.Exists (lib))
return false;
// location changed in 10.11 but it loads fine (and fixing it breaks on earlier macOS)
break;
}
#endif
var h = IntPtr.Zero;
Expand Down

3 comments on commit acf8357

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run' 🔥

Build succeeded
API Diff (from stable)
⚠️ API Diff (from PR only) (🔥 breaking changes 🔥)
Generator Diff (no change)
🔥 Test run failed 🔥

Test results

1 tests failed, 0 tests skipped, 283 tests passed.

Failed tests

  • [xUnit] Mono SystemJsonXunit/watchOS - simulator/Debug: Crashed

@dalexsoto
Copy link
Member

@dalexsoto dalexsoto commented on acf8357 Nov 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failures are unrelated.

Xamarin.Mac.dll

Namespace ObjCRuntime

Type Changed: ObjCRuntime.Constants

Modified fields:

-	public const string CFNetworkLibrary = "/System/Library/Frameworks/CFNetwork.framework/CFNetwork"
+	public const string CFNetworkLibrary = "/System/Library/Frameworks/CoreServices.framework/Frameworks/CFNetwork.framework/CFNetwork";

-	public const string CoreBluetoothLibrary = "/System/Library/Frameworks//CoreBluetooth.framework/CoreBluetooth"
+	public const string CoreBluetoothLibrary = "/System/Library/Frameworks/IOBluetooth.framework/Versions/A/Frameworks/CoreBluetooth.framework/CoreBluetooth";

@dalexsoto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting state to success where context is continuous-integration/jenkins/branch.

No blocking issues found

Please sign in to comment.