-
Notifications
You must be signed in to change notification settings - Fork 512
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
Find winmd files without reading PATH
nor copying to target/
#1047
Conversation
My link was just meant to show how we copy artifacts out of the .windows subfolders. No PATH handling should remain. |
@riverar I interpreted it as pointing to a specific commit, conveniently right before |
windows-rs/crates/macros/src/lib.rs Lines 121 to 132 in 49ecfbc
I don't understand this loop. That's wrong if someone builds with their target folder ( |
b825dce
to
622aa18
Compare
Yep, that loop should not be needed anymore. It was an attempt to find dirs across crates which we no longer need. |
It's gone now, let me know if this is okay. I'm happy because this has now unblocked building on Linux (I'm not cross-compiling at all 😳), but it should work for your Windows (and rustdoc) purposes as well. |
@MarijnS95 🤣 I've actually had some internal interest for cross-platform support, so you never know. |
Just shoot and I'll throw the cross-platform working DirectXShaderCompiler example back online 😁 Joking aside, really glad to hear 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.
Looks OK to me. I defer to @kennykerr due to high impact. 😂
Non-Windows platforms - which are supported for cross-compiling - do not set the output directory in `PATH` nor use semicolons to separate this variable, resulting in errors. Replace it with the old `include_bytes!` logic that does not require paths at runtime (of the macro) at all. Copying of DLL targets to the `target/<profile>` dir for easy consumption and running of crates is still performed.
622aa18
to
81e8abb
Compare
Haven't had a chance to dig in, but a quick smoke testing compiling https://github.com/microsoft/windows-app-rs fails unfortunately. |
For a change as invasive as this, it may also help to smoke out issues by building https://github.com/microsoft/windows-samples-rs |
@kennykerr Can you clarify what exact issue you're seeing? For error: `Microsoft.UI.Xaml.Application` not extendable
--> src/main.rs:27:41
|
27 | #[implement(extend Microsoft::UI::Xaml::Application, override OnLaunched)]
| Is this a result of building with the wrong metadata? Same for the samples; what errors should I be looking out for? Do I need to be on Windows to test specific things (need to revive a Windows install first that decided to corrupt itself for no apparent reason)? |
Yes, that's the error I saw. I think its misleading because the type is not actually found in metadata at all and because its not found its not extendable. |
And that error isn't present when compiling against windows-rs master? This is hard to test for me currently due to the original "Path doesn't contain |
Yes that error is not present in master. |
@kennykerr It's pretty obvious what happens: Let's discuss before jumping on an implementation detail. (EDIT: This requirement is pretty much your "scenario 3" we were trying to avoid 😛) |
Tip: Symlinks in Windows require administrative privileges in normal scenarios, so that's out. |
@riverar I'm unfortunately aware, and it nauseates me. IMO this should be fully solved from Rust, no messing around with paths and links/copies by the user. |
This worked before because the |
Basically, the
|
"Before" referring to the situation before,
That's what it's doing already, but not relative to Should we use cargo metadata to point windows-rs to a different directory, so that we can just parse |
Yes, that's the way it worked before the binary packaging support was added. |
I need to get this wrapped up. It sounds like you still have some open questions about how to proceed. Do you mind terribly if I just take this over and get it done. I'd like to get this fixed up and publish a new version of the crate. |
Closing in favor of #1067 |
I don't have time for this back-and-forth so feel free. Looks like #1067 is a simple "yes" to my question in #1047 (comment), but in code form. |
@kennykerr Do you mind awfully if I rebase this branch and open a new PR after yours is merged, so that we at least keep some cleanups/simplifications? |
That would be great. |
Fixes #979
Non-Windows platforms - which are supported for cross-compiling - do not set the output directory in
PATH
nor use semicolons to separate this variable, resulting in errors Split outwinmd
"discovery" by emitting the path to these files in a build step, that is subsequently compiled intowindows_gen
. This is more efficient thaninclude_bytes!
which was used prior to thePATH
system as no copies or binary includes are required at all. Copying of DLL targets to thetarget/
dir for easy consumption and running of crates is still performed, but only on Windows for the samePATH
reason.In the future, if a chain of crates is required to export
winmd
files for downstream crates to consume, this can be extended to also export their$CARGO_MANIFEST_DIR/.winmd/windows
in such a way that the next crate can pick it up, again without copying any files around.TODO
@riverar Linked to the copy function on an older commit, but I think he intended to link to the way the target directory for those copies was derived:
windows-rs/crates/macros/src/lib.rs
Line 121 in 49ecfbc
Should be migrate back to this and drop any and all
PATH
handling entirely?