-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Foundation] Update to xcode9 beta 1 #2235
Conversation
Build failure |
src/Foundation/Enum.cs
Outdated
@@ -722,7 +722,8 @@ public enum NSJsonReadingOptions : nuint_compat_int { | |||
[Flags] | |||
[Native] | |||
public enum NSJsonWritingOptions : nuint_compat_int { | |||
PrettyPrinted = 1 | |||
PrettyPrinted = 1, | |||
SortedKeys = (1 << 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comma on the last entry, it's valid in c# and makes diffs smaller
src/Foundation/Enum.cs
Outdated
All = 0, | ||
Team = 1, | ||
Group = 2, | ||
OwnProcess = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same (and others)
src/Foundation/Enum.cs
Outdated
} | ||
|
||
[Native] | ||
public enum NSLinguisticTaggerUnit : nint { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing availability attributes
src/foundation.cs
Outdated
[Field ("NSMetadataItemKeywordsKey")] | ||
NSString ItemKeywordsKey { get; } | ||
|
||
// extern NSString *const _Nonnull NSMetadataItemTitleKey __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))) __attribute__((availability(ios, unavailable))) __attribute__((availability(macos, introduced=10.9))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all comments from sharpie
src/foundation.cs
Outdated
// extern NSString *const _Nonnull NSMetadataItemISOSpeedKey __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))) __attribute__((availability(ios, unavailable))) __attribute__((availability(macos, introduced=10.9))); | ||
[NoWatch, NoTV, NoiOS, Mac (10, 9)] | ||
[Field ("NSMetadataItemISOSpeedKey")] | ||
NSString ItemISOSpeedKey { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iso not ISO - only 2 letters acronyms are uppercase in .net
src/foundation.cs
Outdated
[Export ("finished")] | ||
bool Finished { [Bind ("isFinished")] get; }[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] | ||
[NullAllowed, Export ("estimatedTimeRemaining", ArgumentSemantic.Copy)] | ||
NSNumber EstimatedTimeRemaining { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at using bindas attribute
Ask @dalexsoto if you have questions
src/foundation.cs
Outdated
|
||
[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] | ||
[NullAllowed, Export ("throughput", ArgumentSemantic.Copy)] | ||
NSNumber Throughput { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/foundation.cs
Outdated
|
||
[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] | ||
[NullAllowed, Export ("fileTotalCount", ArgumentSemantic.Copy)] | ||
NSNumber FileTotalCount { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/foundation.cs
Outdated
|
||
[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] | ||
[NullAllowed, Export ("fileCompletedCount", ArgumentSemantic.Copy)] | ||
NSNumber FileCompletedCount { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
src/foundation.cs
Outdated
|
||
[NoWatch, NoTV, Mac (10,13), iOS (11,0)] | ||
[BaseType (typeof(NSObject))] | ||
interface NSFileProviderMessenger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably no default init if there's a designated initializer
src/foundation.cs
Outdated
} | ||
|
||
delegate void LinguisticTaggerEnumerateTagsBlock (string tag, NSRange tokenRange, bool stop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block
sounds strange in C#, maybe use Callback
, or something even more different, like LinguisticTagEnumerator
.
src/foundation.cs
Outdated
[BaseType (typeof(NSObject))] | ||
interface NSItemProviderWriting | ||
{ | ||
//TODO: Where to implement this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please file a bug about this so that we don't forget (and add the bug # in the comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a card for it on the trello board (https://trello.com/c/snhPxWy2/21-static-properties-inside-protocols), do you want a separate bug as well? Not 100% sure if it's a bug or if there's a way to do it that I'm not aware of
src/generator.cs
Outdated
@@ -3850,6 +3850,8 @@ void GenerateTypeLowering (MethodInfo mi, bool null_allowed_override, EnumMode e | |||
by_ref_processing.AppendLine(); | |||
if (mai.Type.GetElementType () == TypeManager.System_String){ | |||
by_ref_processing.AppendFormat("{0} = {0}Value != IntPtr.Zero ? NSString.FromHandle ({0}Value) : null;", pi.Name.GetSafeParamName ()); | |||
} else if ((pi.ParameterType.GetElementType ().IsArray)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are redundant parenthesis around the property access.
I can pull those parts out, though I'd have to wait for his to be merged and pull the commit(s) into this PR since there's other places that use the protocol I'd be pulling out. |
It can take a while to get that PR in, since we need to sort out how to bind constructors in protocols (https://bugzilla.xamarin.com/show_bug.cgi?id=57650) first. It still looks like there are useful bits here even if you remove all related code to that PR though. |
I'll pull out the NSItemProvider(Reading|Writing) stuff for now and create a trello card so it doesn't get forgotten when we figure out how to implement it all (will need updates after miguel's PR goes in) |
Build failure |
Build failure |
src/foundation.cs
Outdated
[NoWatch, NoTV, NoiOS, Mac (10, 9)] | ||
[Field ("NSMetadataItemTitleKey")] | ||
NSString ItemTitleKey { get; } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For each one of these properties that were added, you need to update Foundation/NSMetadataItem.cs which is the strongly typed version of this, and it entails figuring out the data type that is being looked up there.
For example, the documentation for this key is that the value is an NSString, so you would need to add to that class something like:
public NSString Title => return Runtime.GetNSObject<NSString> (GetHandle (NSMetadataQuery.ItemTitleKey))
And this needs to be done for each of these new keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
Heads up there's more I coming here. Some of the bindings for lost in the shuffle swapping back and forth with doing or fixes on other frameworks (stashed, so it doesn't have to be rebound. I'm fixing up merge conflicts to commit) |
Build failure |
1 similar comment
Build failure |
src/Foundation/Enum.cs
Outdated
@@ -1258,4 +1259,51 @@ public enum NSMeasurementFormatterUnitOptions : nuint { | |||
TemperatureWithoutUnit = (1 << 2) | |||
} | |||
|
|||
[Watch(2, 0), TV(9, 0), Mac(10, 8), iOS(6, 0)] | |||
[Native] | |||
public enum NSXPCConnectionOptions : nuint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XPC
-> Xpc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized this one after I pushed. I have all the Xpcs changed locally for when I push again
src/Foundation/Enum.cs
Outdated
[Native] | ||
public enum NSXPCConnectionOptions : nuint | ||
{ | ||
NSXPCConnectionPrivileged = (1 << 12) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case the enum member name should not be prefixed with NSXPCConnection
anyway
src/foundation.cs
Outdated
|
||
[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] | ||
[NullAllowed, Export ("fileURL", ArgumentSemantic.Copy)] | ||
NSUrl FileURL { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL
-> Url
.
src/foundation.cs
Outdated
void SetClasses (NSSet<Class> classes, Selector sel, nuint arg, bool ofReply); | ||
|
||
[Export ("classesForSelector:argumentIndex:ofReply:")] | ||
NSSet<Class> ClassesForSelector (Selector sel, nuint arg, bool ofReply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetClasses
src/foundation.cs
Outdated
|
||
[Export ("interfaceForSelector:argumentIndex:ofReply:")] | ||
[return: NullAllowed] | ||
NSXpcInterface InterfaceForSelector (Selector sel, nuint arg, bool ofReply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add tests for those Xpc
API to ensure the proving stuff works correctly. we should not expose (post beta) them unless they are confirmed to work properly.
src/Foundation/Enum.cs
Outdated
[Native] | ||
public enum NSXPCConnectionOptions : nuint | ||
{ | ||
NSXPCConnectionPrivileged = (1 << 12) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case the enum member name should not be prefixed with NSXPCConnection
anyway
src/Foundation/Enum.cs
Outdated
[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)] | ||
[Native] | ||
public enum NSItemProviderFileOptions : nint { | ||
NSItemProviderFileOptionOpenInPlace = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove NSItemProviderFileOption
prefix on name
src/foundation.cs
Outdated
|
||
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)] | ||
[Export ("writeToURL:error:")] | ||
bool WriteToUrl (NSUrl url, [NullAllowed] out NSError error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write
the rest is implied by the parameters
src/foundation.cs
Outdated
[Static] | ||
[Export ("arrayWithContentsOfURL:error:")] | ||
[return: NullAllowed] | ||
NSObject[] FromUrl (NSUrl url, [NullAllowed] out NSError error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's an odd case. In general returning an []
make sense, but this is a static method in NSArray
so it should return an NSArray
not another type.
src/foundation.cs
Outdated
@@ -1715,7 +1725,11 @@ interface NSDateFormatter { | |||
|
|||
[iOS (8,0), Mac (10,10)] | |||
[Export ("setLocalizedDateFormatFromTemplate:")] | |||
void SetLocalizedDateFormatFromTemplate (string dateFormatTemplate); | |||
void SetLocalizedDateFormatFromTemplate (string dateFormatTemplate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SetLocalizedDateFormat
, the rest is implied
src/foundation.cs
Outdated
|
||
[NoWatch, NoTV, Mac (10, 13), iOS (11, 0)] | ||
[Export ("observedPresentedItemUbiquityAttributes", ArgumentSemantic.Strong)] | ||
NSSet<NSString> ObservedUbiquityAttributes { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
src/foundation.cs
Outdated
|
||
[NoWatch, NoTV, Mac (10,13), iOS (11,0)] | ||
[Async, Export ("getFileProviderMessageInterfacesForItemAtURL:completionHandler:")] | ||
void GetFileProviderMessageInterfaces (NSUrl url, FileProviderMessageInterfacesCompletionHandler completionHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does FileProviderMessageInterfacesCompletionHandler
exists in ObjC ? (it's not prefixed by NS
)
When we have a single parameter or a two parameters with a NSError
then we can (when it's not confusing) use Action<T[,V]>
. That makes it easier to share delegates in code and reduce metadata (app size).
The reason why we can't do it for longer delegates is because the arguments become unclear. That's not the case here since the method name is clear about what will be given and the NSError
itself is self-documenting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. It had been pointed out one one of the other (longer) handlers that we needed the delegate because of the multiple parameters and I made all of 2 parameters (with one as an NSError) into delegates, so there's probably others I can change back as well.
I'll go through ll the delegates and convert any that match back to Action<T, V>
src/foundation.cs
Outdated
@@ -12435,6 +13368,7 @@ interface NSAffineTransform : NSSecureCoding, NSCopying { | |||
CGAffineTransform TransformStruct { get; set; } | |||
} | |||
|
|||
[Availability (Deprecated = Platform.Mac_10_13 | Platform.iOS_11_0 | Platform.Watch_2_0 | Platform.TV_11_0, Message = "Use NSXpcConnection instead")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing .
at end of message
src/foundation.cs
Outdated
@@ -12538,6 +13472,7 @@ interface NSConnection { | |||
NSConnectionDelegate Delegate { get; set; } | |||
} | |||
|
|||
[Availability (Deprecated = Platform.Mac_10_13 | Platform.iOS_11_0 | Platform.Watch_2_0 | Platform.TV_11_0, Message = "Use NSXpcConnection instead")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
src/foundation.cs
Outdated
@@ -12561,6 +13496,7 @@ interface NSConnectionDelegate { | |||
bool AllowNewConnection (NSConnection newConnection, NSConnection parentConnection); | |||
} | |||
|
|||
[Availability (Deprecated = Platform.Mac_10_13 | Platform.iOS_11_0 | Platform.Watch_2_0 | Platform.TV_11_0, Message = "Use NSXpcConnection instead")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Build failure |
Build failure |
Build failure |
Build failure |
I removed the BindAs attributes and manually bound strongly-typed versions of the properties, so I'm removing the don't-merge tag |
Build success |
This fix is needed by PDFKit because it is a remapped framework[0], the current code generates incorrect FieldAttribute on smart enums because it uses `fa.LibraryName` as first option and this causes remmaped frameworks have incorrect LibraryName generated for example if a Field uses `+CoreImage` as `LibraryName` the following incorrect code is generated: ``` [Field ("First", "+CoreImage")] internal unsafe static IntPtr First { get { fixed (IntPtr *storage = &values [0]) return Dlfcn.CachePointer (Libraries.+CoreImage.Handle, "First", storage); } } ``` [0]: https://github.com/xamarin/xamarin-macios/blob/f5956d6cc1eb5dfa7bab16628cf282d40237f64e/src/generator.cs#L5985
Apple removed (mistake?) some API in beta 1. Filed as rdar 33590997 Internal tracking in https://trello.com/c/J8BDDUV9/86-33590997-coreanimation-quartzcore-api-removals
@@ -40,7 +40,7 @@ IOS_PRODUCT=Xamarin.iOS | |||
IOS_PACKAGE_NAME=Xamarin.iOS | |||
IOS_PACKAGE_NAME_LOWER=$(shell echo $(IOS_PACKAGE_NAME) | tr "[:upper:]" "[:lower:]") | |||
# NEVER customize IOS_PACKAGE_VERSION itself, other parts (mtouch, web updater) are using the IOS_PACKAGE_VERSION_* variables | |||
IOS_PACKAGE_VERSION=10.99.1.$(IOS_COMMIT_DISTANCE) | |||
IOS_PACKAGE_VERSION=10.99.2.$(IOS_COMMIT_DISTANCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks wrong, I think you need to merge in the xcode9 branch.
@timrisi there should not be any need to merge in most cases as the PR gets tested on top of the HEAD of the branch. |
In this case, I was merging so I could get the PhotosUI commit since it fixes crashes in the introspection tests to make it a lot easier to run the tests locally. Not sure what exactly I did here, this is the first time I've accidentally pulled in other commits when I tried to merge. |
Build failure |
@timrisi the PR failed the tests (but was not investigated), it's also not mergeable (fixing this does not require a merge) and it's not clear which beta version is supported. |
Replaced with an updated (and rebased) PR: #2468 |
No description provided.