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

[3.0] COM Binding Transformation #2406

Open
wants to merge 34 commits into
base: develop/3.0
Choose a base branch
from

Conversation

curin
Copy link
Contributor

@curin curin commented Dec 31, 2024

Summary of the PR

Adds the necessary enhancements to allow for easy to use COM bindings and any changes required to get Microsoft Bindings building.

-Adds TransformCOM mod to implement in place ComPtr transformations in all COM classes
-Adds DisableWarnings mod to disable warnings in all files for a job in order to avoid build errors from unavoidable or ignorable errors
-Adds several additions to ClangScraper to disable caching and remove generated files from the output.
-Adds some QOL improvements such as --only and csv list support to silk touch

@Perksey Perksey changed the base branch from main to develop/3.0 December 31, 2024 15:04
@curin curin marked this pull request as ready for review January 10, 2025 02:25
@curin curin requested a review from a team as a code owner January 10, 2025 02:25
@curin
Copy link
Contributor Author

curin commented Jan 10, 2025

@Perksey Ready for Review

Copy link
Member

@Perksey Perksey left a comment

Choose a reason for hiding this comment

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

Nice work! It's cool to see this come together :)

Some notes...

@Perksey
Copy link
Member

Perksey commented Jan 12, 2025

Obviously note the CI errors as well if you haven't already.

Copy link
Member

@Perksey Perksey left a comment

Choose a reason for hiding this comment

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

Sorry this review is a bit all over the place, I wrote things as I saw them so comments may not be placed at their root causes.

Glad to see this moving along nicely.

/// <summary>
/// compares boolean value and int
/// </summary>
/// <param name="lh"></param>
Copy link
Member

Choose a reason for hiding this comment

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

I haven't really called this out in past PRs as it is a bit of a nitpick, but it would be nice if you did fill out the documentation template generated!

[MethodImpl(
MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization
)]
public static implicit operator Ptr<T>(nuint ptr) => new((T*)ptr.ToPointer());
Copy link
Member

Choose a reason for hiding this comment

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

Same comment.

Perksey and others added 21 commits February 15, 2025 18:33
-also support for csv lists in --only and --skip
-Setup to run using new mod system properly
-Added pointer member accessor to member accessor conversion
-Added Logging
per Mod Performance
-Added early out
-fix duplicate call
-Add INativeGuid
-fixed some broken using from TerraFX files
-Allowed BaseType to be specified for ComTypes
-Added several files for override due to issue in generation
-allowed for multiple COM base types
-allowed for addition of manual COM types
-added several manual overrides
-added all manual files necessary for compilation
Fixed some manual warnings as well
This reverts commit 0a1bd47.
-using globbing instead of regex
-removed an unnecessary restriction on interface finding
-updates single line code to expression bodies
Co-authored-by: Dylan Perks <[email protected]>
for rollback purposes
moved to internal Native struct
INativeInterface and IComInterface added to represent all interfaces and Com interfaces, respectively.
- IComInterface is a child of INativeInterface and INativeGuid
-and fixing issues with how it works
added manual file importer
added a progress bar in some cases for QoL
moved rename function into NameUtils
Added per job file logs
fixed up the progress bar system to be cleaner
@curin curin force-pushed the develop/3/com-bindings-refactor branch from 6c6d633 to fe2f36c Compare February 16, 2025 00:05
Also split some common classes out into core
Benefit of the doubt is expected and will now be accounted for
also fix for CI issues
Copy link
Member

@Perksey Perksey left a comment

Choose a reason for hiding this comment

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

I'm really getting excited at this point now, and really happy with the progress on this PR. Yes I know there's 30 comments, but most of these are fairly small (in my opinion) and don't call into question conceptual/large ways of doing things as previous reviews have. Thanks for keeping with it!

@@ -409,8 +409,7 @@ ptr.Native is not null && ptr.Native->Native is not null
[MethodImpl(
MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization
)]
// TODO analyzer to ensure ptr is on stack or otherwise pinned
Copy link
Member

Choose a reason for hiding this comment

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

Can you keep this comment please


namespace Silk.NET.Windows;
#pragma warning disable CS1589, CS1591, CS0419, CA1416, CS0618
namespace Silk.NET.Core;

public readonly partial struct BOOL : IComparable, IComparable<BOOL>, IEquatable<BOOL>, IFormattable
Copy link
Member

Choose a reason for hiding this comment

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

We need to have a discussion on whether we want to keep this type. We already have MaybeBool<int> - if this is missing functionality then we should probably add that functionality there.


namespace Silk.NET.Windows;
#pragma warning disable CS1589, CS1591, CS0419, CA1416, CS0618
namespace Silk.NET.Core;

public readonly unsafe partial struct HANDLE
Copy link
Member

Choose a reason for hiding this comment

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

Should this be Handle? Or perhaps NativeHandle/Win32Handle?


namespace Silk.NET.Windows;
#pragma warning disable CS1589, CS1591, CS0419, CA1416, CS0618
namespace Silk.NET.Core;

public readonly unsafe partial struct HRESULT
Copy link
Member

Choose a reason for hiding this comment

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

Should this be HResult?


namespace Silk.NET.WinRT;
#pragma warning disable CS1589, CS1591, CS0419, CA1416, CS0618
namespace Silk.NET.Core;

public readonly unsafe partial struct HSTRING
Copy link
Member

Choose a reason for hiding this comment

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

Should this be HString? Note: In 2.X this was called WinString iirc, which is also a terrible name but oh well.

using Silk.NET.SilkTouch.Mods.Transformation;
using Silk.NET.SilkTouch.Naming;
using Silk.NET.SilkTouch.Utility;
using static System.Runtime.InteropServices.JavaScript.JSType;
Copy link
Member

Choose a reason for hiding this comment

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

What?

Copy link
Contributor Author

@curin curin Mar 13, 2025

Choose a reason for hiding this comment

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

not sure what happened here

SeparatedList(
x.Attributes.Where(y =>
!y.IsAttribute(
"System.Runtime.InteropServices.UnmanagedCallersOnly"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe my other comment makes this unnecessary or invalid?

"Namespace": "Silk.NET.Win32",
"Parent": "IDispatch.Interface"
},
"IInspectable.Interface": {
Copy link
Member

Choose a reason for hiding this comment

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

Tbh, all the ones that are in Silk.NET.Core should be in additional COM types by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair, we can append them easily enough.

/// <summary>
/// Information on the current Job
/// </summary>
public class JobContext
Copy link
Member

Choose a reason for hiding this comment

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

Let's make this internal for now given that it's only our CLI that uses it today and there's no immediate use case for anyone else using this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't, makes DI upset for the progressService. You would have to make the constructor internal as well and DI doesn't seem to like that. It only seems to work with a public one.

var sp = new ServiceCollection()
.AddSingleton(jobContext)
.AddSingleton<IProgressService, ProgressService>()
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps this line should be part of AddSilkTouch. Note that you'll probably have to move the ConsoleRenderer AddSingleton call to after AddSilkTouch (might not though, but if it breaks this might be why).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants