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

[GameController] Update bindings for Xcode 14 beta 1-5 #15692

Merged
merged 16 commits into from
Aug 31, 2022

Conversation

tj-devel709
Copy link
Contributor

No description provided.

@tj-devel709 tj-devel709 added the notes-mention Deserves a mention in release notes label Aug 17, 2022
@tj-devel709 tj-devel709 added this to the xcode14 milestone Aug 17, 2022
[DisableDefaultCtor]
interface GCPhysicalInputElementCollection<KeyIdentifierType, ElementIdentifierType> // : INSFastEnumeration // # no generator support for FastEnumeration - https://bugzilla.xamarin.com/show_bug.cgi?id=4391
where KeyIdentifierType : IGCPhysicalInputElementName /* NSString */ // there's currently not an conversion from GCPhysicalInputElementName, GCButtonElementName, and GCDirectionPadElementName to NSString
where ElementIdentifierType : IGCPhysicalInputElement
Copy link
Contributor Author

@tj-devel709 tj-devel709 Aug 17, 2022

Choose a reason for hiding this comment

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

I'm having trouble using this interface with all the different protocols that try to use different protocols for the 'KeyIdentifierType': GCPhysicalInputElementName, GCButtonElementName, and GCDirectionPadElementName

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

src/gamecontroller.cs Outdated Show resolved Hide resolved
src/gamecontroller.cs Outdated Show resolved Hide resolved

[Export ("elementForAlias:")]
[return: NullAllowed]
IGCPhysicalInputElement GetElement (string alias);
Copy link
Member

Choose a reason for hiding this comment

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

Weird, since you have a generic class that is returning the ElementIdentifierType.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@tj-devel709 tj-devel709 marked this pull request as ready for review August 23, 2022 18:32
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

float MaximumDegreesOfRotation { get; }
}

interface IGCAxisElementName {}
Copy link
Member

Choose a reason for hiding this comment

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

Whoever implemented this at Apple found a very complicated solution to something that looks quite simple.

I had a look at the headers, and it seems that these protocols is an attempt to group different NSString values together - basically creating an NSString-based enum of sorts 🤯

In any case, what I think we should do:

  1. Don't bind any protocols that are defined with objc_non_runtime_protocol:
__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCPhysicalInputElementName
@end

__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCButtonElementName <GCPhysicalInputElementName>
@end

__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCAxisElementName <GCPhysicalInputElementName>
@end

__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCSwitchElementName <GCPhysicalInputElementName>
@end

__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCDirectionPadElementName <GCPhysicalInputElementName>
@end
  1. For each of these protocols, create a strong enum, and add the fields declared with each protocol to the corresponding enum.

For example:

GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonA NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));
GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonB NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));
GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonX NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));
GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonY NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));

would become:

	enum GCInputButtonName {
		[Field ("GCInputButtonA")]
		NSString A { get; }
		[Field ("GCInputButtonB")]
		NSString B { get; }
		[Field ("GCInputButtonX")]
		NSString X { get; }
		[Field ("GCInputButtonY")]
		NSString Y { get; }
		...
	}

@dalexsoto / @chamons what do you think?

The simpler solution is of course to just not bind these protocols for now, and decide later.

Copy link
Member

Choose a reason for hiding this comment

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

I have to agree with @rolfbjarne this is way cleaner! the only thing is that it seems to be already done here as Fields

https://github.com/xamarin/xamarin-macios/pull/15692/files#diff-356008148e576743798c6d7e9adb15c283fdfe15e03fcae2edbe590828ccf533R1100-R1126

So probably this is not even needed? Also creating a test case may be the only way to figure out if the API is right. Maybe we can just leave them out, those protocols for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dalexsoto @rolfbjarne
I have removed the protocols that have the 'objc_non_runtime_protocol' attribute!

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@tj-devel709
Copy link
Contributor Author

/azp run

@tj-devel709
Copy link
Contributor Author

rekicking due to failing msbuild integration tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS Mac Catalina (10.15) passed 💻

All tests on macOS Mac Catalina (10.15) passed.

Pipeline on Agent
Hash: d15c6ed73b8d44a9abe73f3e0da080ed1d349489 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)

❗ API diff vs stable (Breaking changes)

Legacy Xamarin (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
.NET (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
Legacy Xamarin (stable) vs .NET

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: d15c6ed73b8d44a9abe73f3e0da080ed1d349489 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1168.Monterey'
Hash: d15c6ed73b8d44a9abe73f3e0da080ed1d349489 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌

Failed tests are:

  • introspection
  • monotouch-test

Pipeline on Agent
Hash: d15c6ed73b8d44a9abe73f3e0da080ed1d349489 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: simulator tests

0 tests crashed, 1 tests failed, 227 tests passed.

Failures

❌ introspection tests

1 tests failed, 12 tests passed.
  • introspection/watchOS 32-bits - simulator/Debug (watchOS 6.0): Crashed Known issue: HE0038)

Html Report (VSDrops) Download

Successes

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch: All 23 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: [PR build]

@tj-devel709 tj-devel709 merged commit 6b5364f into xamarin:xcode14 Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-mention Deserves a mention in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants