Structuring win32 package types #634
Replies: 5 comments 9 replies
-
Yep, it's getting out of hand.
Does this also apply to COM APIs? Will this package only expose Win32 and COM APIs after we separate out WinRT APIs?
That would be great! I imagine every package for WinRT top-level namespace would specify which types (Class, Interface, Enum, and Struct) it wants to be generated and the
I love this idea. Do you imagine these packages will be in a single repository ( |
Beta Was this translation helpful? Give feedback.
-
COM APIs
If we start with the package consumer as the target audience, there are probably two principles at play:
If we can achieve these goals while also broadening the range of modern APIs exposed, that would be excellent. The challenge with Win32/COM is that there's no built-in namespace. The win32metadata has attempted to retrofit a namespace, but it's too broad to be useful (for example, I tried at one point to export everything (the old "v3" constants in the generator were vestiges of that approach), but that was unmanageable. And selectively exporting based on namespace never generated all the dependencies. That's why I've reverted back to the current approach of curating which APIs are exposed based on usage. I'm less worried about Win32 APIs, because there are fewer of them, but COM is certainly a problem here. At some point, I'd like to use the metadata to generate a true dependency chain, which might allow a more automated approach, but that's a way off. So in the interim, my suggestion would be that we:
Open to other ideas, of course. Packagespub.devIn terms of pub.dev, I propose we'd have the following packages:
As a package consumer, you'd either take a dependency on Rather than publishing them from the GitHub repo
I suppose there are two choices:
What's important to me is that you get the appropriate credit. It's not lost on me that today the repos and packages are listed under my name, but realistically you're doing a huge amount of the work and I want that to be reflected appropriately. Basically, I want you to feel rewarded for working on this, and I'm realizing that I don't know enough about your motivations! This started as a lightweight hobby project for me, but you're bringing a tremendous amount of professionalism to it and it's a huge encouragement to me! |
Beta Was this translation helpful? Give feedback.
-
Just to explore this a bit more, I created a test repo: https://github.com/timsneath/windows_devices. This contains just the contents of the Windows.Devices namespace. This depends on a private branch of win32 (v5), which has the requisite files removed. The changes necessary for the The changes to the core package are a little more painful: mostly because it introduces a circular dependency, since IMapView and other foundation classes use a couple of classes from Windows.Devices ( |
Beta Was this translation helpful? Give feedback.
-
I made a lot of progress over the weekend in separating out the WinRT bits from this package and I have realized that it might be a good idea to split the |
Beta Was this translation helpful? Give feedback.
-
With growing support for Win32, COM and WinRT types, this package could become cumbersome: either by exporting so many types that Dart analysis is compromised, or because too many changes lead to a breaking change that requires a major version bump. I'm therefore opening this issue to discuss a more radical overhaul of the package structure.
Fortunately, Dart has good support for a hierarchy of dependent packages, so it would be possible to split it up with little fuss.
The Win32 APIs are somewhat difficult to separate out, unfortunately. They have lots of interdependencies and are designed without hierarchy. The philosophy so far has been to be somewhat selective in which APIs are added, with the focus on core APIs (user32, kernel32) that are likely to be used by other Dart apps, rather than including obsolete APIs like fax services or XPS).
The code generator tooling (tools\generator) could be extracted into a separate package; perhaps it could even support build_runner rather than being a batch file.
The WinRT APIs are highly structured and hierarchical, with few interdependencies between each other. It's possible to imagine a separate package for each of the top-level namespaces (e.g. Windows.Storage), each of which depends on the core
win32
library and perhaps the Windows.Foundation package.Curious on your thoughts, @halildurmus?
Beta Was this translation helpful? Give feedback.
All reactions