Skip to content
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

[CoreData] Updated bindings for xcode9. #2210

Merged
merged 19 commits into from
Jun 22, 2017

Conversation

mandel-macaque
Copy link
Member

No description provided.

@monojenkins
Copy link
Collaborator

Build failure

@@ -51,6 +51,10 @@ public enum NSAttributeType : nuint {
Boolean = 800,
Date = 900,
Binary = 1000,
[iOS (11,0), TV (11,0), Mac (10,3), Watch (4,0)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Un likely to be mac 10,3

@@ -51,6 +51,10 @@ public enum NSAttributeType : nuint {
Boolean = 800,
Date = 900,
Binary = 1000,
[iOS (11,0), TV (11,0), Mac (10,3), Watch (4,0)]
Uuid = 1100,
[iOS (11,0), TV (11,0), Mac (10,3), Watch (4,0)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

StringPatternMatching = 1680
StringPatternMatching = 1680,
[iOS (11,0), TV (11,0), Mac (10,13), Watch (4,0)]
InvalidUri = 1690
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comma
It makes future diff cleaner and the compiler allows it

ExternalRecordImport = 134200
ExternalRecordImport = 134200,
[iOS (11,0), TV (11,0), Mac (10,3), Watch (4,0)]
HistoryTokenExpired = 134301
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

src/coredata.cs Outdated
interface NSPersistentHistoryChange : NSCopying
{
[Export ("changeID")]
long ChangeID { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

ID inconsistant with next api
Iirc we use Id (abbrev not acronym)

[NoWatch][NoTV]
[Since (7,0), Mavericks]
[Field ("NSPersistentStoreUbiquitousContainerIdentifierKey")]
NSString UbiquitousContainerIdentifierKey { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, we should add this test in intro

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you want me to add an intro test that makes sure that the Fields are correctly expelled? Or to add it for this one in particular?

Copy link
Contributor

Choose a reason for hiding this comment

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

In a separate pr you can add a check that public fields (all members in fact) should start with an uppercase letter unless it has an obsolete attribute

src/coredata.cs Outdated

[Watch (4, 0), TV (11, 0), Mac (10, 13), iOS (11, 0)]
[Field ("NSPersistentHistoryTrackingKey")]
NSString TrackingKey { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Are not we losing History from the full name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding it.

src/coredata.cs Outdated
{
[Static]
[Export ("fetchHistoryAfterDate:")]
NSPersistentHistoryChangeRequest FetchHistoryAfterDate (NSDate date);
Copy link
Member

Choose a reason for hiding this comment

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

I think you can do FetchHistoryAfter so this and the next 3 can be overloads

Copy link
Member Author

Choose a reason for hiding this comment

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

Perfectly valid idea. Doing so.

src/coredata.cs Outdated

[Static]
[Export ("deleteHistoryBeforeDate:")]
NSPersistentHistoryChangeRequest DeleteHistoryBeforeDate (NSDate date);
Copy link
Member

Choose a reason for hiding this comment

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

Same here, I think these 3 can ve overloads DeleteHistoryBefore

Copy link
Member Author

Choose a reason for hiding this comment

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

Ditto as with the previous one.

long TransactionNumber { get; }

[Export ("storeID")]
string StoreId { get; }
Copy link
Member

Choose a reason for hiding this comment

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

I think we want to keep here as ID instead of Id to keep consistency

Copy link
Member Author

Choose a reason for hiding this comment

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

@spouliot so I forgot an ID to Id, yet @dalexsoto has this comment. I'm +1 on Id (did it everywhere but one that I forgot). What do you guys prefer?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah @spouliot is right we use ID not as an acronym so it should be Id totally my bad

src/coredata.cs Outdated
@@ -263,12 +309,22 @@ interface NSEntityDescription : NSCoding, NSCopying {
[Since(5,0)]
[NullAllowed] // by default this property is null
[Export ("compoundIndexes", ArgumentSemantic.Retain)]
[Availability (Introduced = Platform.iOS_5_0 | Platform.Mac_10_7, Deprecated = Platform.iOS_11_0 | Platform.Mac_10_13, Message = "Use NSEntityDescription.Indexes instead.")]
Copy link
Contributor

@VincentDondain VincentDondain Jun 12, 2017

Choose a reason for hiding this comment

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

Please use apostrophes in your message (:

Use 'NSEntityDescription.Indexes' instead.

https://github.com/xamarin/xamarin-macios/wiki/BINDINGS#rule-2

src/coredata.cs Outdated
@@ -1947,6 +2172,7 @@ interface NSPropertyDescription : NSCoding, NSCopying {
NSDictionary UserInfo { get; set; }

[Export ("indexed")]
[Availability (Introduced = Platform.iOS_3_0 | Platform.Mac_10_5 , Deprecated = Platform.iOS_11_0 | Platform.Mac_10_13, Message = "Use NSEntityDescription.Indexes instead")]
Copy link
Contributor

Choose a reason for hiding this comment

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

src/coredata.cs Outdated
@@ -1966,6 +2192,7 @@ interface NSPropertyDescription : NSCoding, NSCopying {

[Since (5,0)]
[Export ("storedInExternalRecord")]
[Availability (Introduced = Platform.iOS_3_0 | Platform.Mac_10_5 , Deprecated = Platform.iOS_11_0 | Platform.Mac_10_13, Message = "Spotlight integration is deprecated. Use CoreSpotlight integration instead.")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please put CoreSpotlight between apostrophes. 'CoreSpotlight'

@monojenkins
Copy link
Collaborator

Build failure

@spouliot
Copy link
Contributor

@mandel pretty sure Id is what the FXDG promotes

@monojenkins
Copy link
Collaborator

Build failure

@mandel-macaque
Copy link
Member Author

The new revision has the test changed to pass a radar has been filed regarding the issues found by the introspection tests:

https://trello.com/c/y87bjnr9/69-32761925-nspersistenthistorytoken-supports-nssecurecoding-yet-supportssecurecoding-returns-false


[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[BaseType (typeof (NSObject))]
interface NSPersistentHistoryToken : NSCopying //, NSSecureCoding TODO: The class does state that it supports the NSSecureCoding YET SupportsSecureCoding returns false, radar 32761925
Copy link
Member Author

Choose a reason for hiding this comment

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

@spouliot @rolfbjarne is this the correct way? I updated the tests, maybe is not needed to comment it out. Your call :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine, make sure to tag the Trello card (for the radar) that an action is needed once apple fix it (with a link to the pr / comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build success

src/coredata.cs Outdated

[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)]
[BaseType (typeof(NSPersistentStoreRequest))]
interface NSPersistentHistoryChangeRequest
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the default ctor is usable ? Considering all the static methods to create instances

Copy link
Contributor

Choose a reason for hiding this comment

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

Unless it make sense (base types) I think we should disable the default .ctor
Easier to add later than to remove a broken API

@@ -752,7 +756,6 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Security\openssl_crt.der">
<LogicalName>monotouchtest.Security.openssl_crt.der</LogicalName>
Copy link
Contributor

Choose a reason for hiding this comment

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

That looks like a mistake

Copy link
Member Author

Choose a reason for hiding this comment

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

Ha, That is visual studio doing something in my back.. cheeky..

[Test]
public void EncodeWithCoderTest ()
{
if (!PlatformInfo.Host.IsArch32 ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Simpler to check if intptr == 8

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe our check for Xcode 9 should only return true on 64 bits (on iOS only) ?

Copy link
Member

Choose a reason for hiding this comment

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

@spouliot PlatformInfo.Host.IsArch32 does the IntPtr.Size check so why not use it? just curious 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

Not critical but it avoids adding another file + consistant with other tests

Copy link
Contributor

Choose a reason for hiding this comment

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

@mandel that test also need a version check for Xcode 9 or it will fail on older versions

src/coredata.cs Outdated
@@ -1818,8 +2029,24 @@ partial interface NSPersistentStoreCoordinator
[NoWatch][NoTV]
[Since (7,0), Mavericks]
[Field ("NSPersistentStoreUbiquitousContainerIdentifierKey")]
[Obsolete ("Use UbiquitousContainerIdentifierKey instead.")]
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be "Use 'UbiquitousContainerIdentifierKey' instead."

@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build success

Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

Minor thingy

TransactionsOnly = 3,
ChangesOnly = 4,
TransactionsAndChanges = 5
}
Copy link
Member

Choose a reason for hiding this comment

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

indentation

public void EncodeWithCoderTest ()
{
// Added test to ensure we do support NSCoding even when introspection fails.
if (IntPtr == 8 && if (TestRuntime.CheckExactXcodeVersion (11, 0, beta: 1)) {
Copy link
Member

Choose a reason for hiding this comment

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

You have an if inside the if condition, that shouldn't compile...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yet it did.. WEIRD!

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

This file only has whitespace changes, you don't need it in the diff at all.

@monojenkins
Copy link
Collaborator

Build failure

1 similar comment
@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build failure

public void EncodeWithCoderTest ()
{
// Added test to ensure we do support NSCoding even when introspection fails.
if (IntPtr.Size == 8 && TestRuntime.CheckExactXcodeVersion (9, 0, beta: 1)) {
Copy link
Member

@rolfbjarne rolfbjarne Jun 19, 2017

Choose a reason for hiding this comment

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

Why did you add an exact check for Xcode 9 b1?

In your case it means this test won't run on any other Xcode version (usually exact Xcode checks like this are used to skip a test for a specific Xcode version, so that the test runs in later Xcode versions, which allows us to manually verify if an SDK bug was fixed (or not)).

Also: is this API available on watchOS? In which case this API would still be 32-bit.

I think you'll just want to do this:

if (TestRuntime.CheckXcodeVersion (9, 0))

@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build success

@mandel-macaque mandel-macaque merged commit 4eafdb1 into xamarin:xcode9 Jun 22, 2017
@mandel-macaque mandel-macaque deleted the coredata-xcode9 branch June 22, 2017 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants