-
-
Notifications
You must be signed in to change notification settings - Fork 746
Core: Introduce cross-platform npm restore and check mismatch on publish #988
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
Core: Introduce cross-platform npm restore and check mismatch on publish #988
Conversation
pr-comment: Run #2
🎉 All tests passed!Github Test Reporter by CTRF 💚 🔄 This comment has been updated |
c4f8292 to
9d03787
Compare
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs
Show resolved
Hide resolved
src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs
Show resolved
Hide resolved
src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs
Show resolved
Hide resolved
src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs
Show resolved
Hide resolved
FlorianRappl
left a comment
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.
Great one !
I need a package 😍 |
|
@softworkz The new Any reason for this strict check? I suggest adding an option to skip those checks. WDYT? |
It is just meant to match reality: When the build process runs I don't know much about WINE, but when it is able to properly emulate Windows, then the question would be why you are seeing this error at all, because then, MSBuild should not think it is running on Linux but on Windows instead. And then, the check should succeed. |
|
Well, the OS is Linux - it's just that "all" (i.e., most) APIs are available (shimmed / proxied to use the POSIX equivalents). Nevertheless, it's right that standard npm package installation would assume Linux, too, and use the respective binary. I am, however, not sure if that would lead to a problem. The Maybe we can detect this case and allow it?
Thoughts? |
The purpose of It's fine to add another exception - there is one already: Windows with WSL, building for Linux. There, the dotnet stuff is built on Windows and When you say you have built Electron apps for Windows like this before - what exactly is "before"?
|
Actually, it’s neither. To solve these issues, we built a custom wrapper that replicated Electron.NET’s functionality but utilized a more robust architecture:
We used electron-builder via a Wine Docker image to generate Windows installers from a Linux environment. While our custom solution served us well for years, it introduced a significant maintenance burden. |
|
Thanks for the clarification. I'm glad to see that the architectural changes in Electron.NET Core are so well-aligned with the needs and desires of other implementors. 😉 Back to the subject, I can only repeat the following: I don't know much about WINE, but when it is able to properly emulate Windows, then the question would be why you are seeing this error at all, because then, MSBuild should not think it is running on Linux but on Windows instead. And then, the check should succeed. @FlorianRaappl
I said I don't know much about WINE, but I know enough to say that this is not an accurate description. WINE emulates a Windows environment by implementing a large range of Windows APIs, From that coverage, APIs having a POSIX equivalent are making a fraction at best, and even those few cannot be just shimmed but need adaption layers to provide Window-like functionality. I don't see how it would be a simplification of procedures to build Windows packages "from Linux" - you are not even doing that, but instead you are building this in a Docker container with WINE - that's not really "building from Linux" and requires you to maintain that Docker container properly to not only have the Electron requirements included, but also the .NET SDKs (which are probably not included in the Docker containers you referenced). All-in-all, I would never even think about building like that. Nowadays it's so easy to get build machines running Windows, that your way only appears to me like an unnecessary complication than making anything easier. That being said, you can try one of the Electron.NET Core packages from before the ELECTRON100 check has been introduced. If that would really work (which I doubt), then we can look into adding an exception for the check. |
|
I'd say its an accurate enough description for our discussion. WINE is not its own Linux distribution so why should a Linux binary report Windows as an OS is foreign to me and not how the OS detection works at all. If you run the Windows binary for Only thing that matters for the discussion is how to proceed. Anything else sounds like unnecessary clutter to me. |
What I wrote is based on the assumption that the Docker image has the Windows versions of nodejs and npm installed which are executed under WINE. |
This PR may seem contradictive at first sight.. :-)
It does this:
This has caused user confusion because it can too easily be gotten wrong. Now it's no longer possible to build for OS A on OS B.
One exception: Linux packages can be build on Windows (WSL)
npm installThis means for example: When you are on Windows and osx-x64 is selected as RID, then the npm restore will do the restore as if it was on OSX.
In case of mismatch, it exists with an appropriate error message
(it would fail anyway, but without explanation otherwise)
So - why do x-platform npm restore first and then error out on platform mismatch when publishing?
It's all about debugging - remote debugging. And again, the fast way is of course without packaging - i.e. how debug is working now. For remote debugging, we need to have everything ready to work on the target/remote machine. For .net it's not a problem anyway, but the Electron executable is platform-dependent, This PR allows to get the right one, so that we can end up with a file set which runs on the target direct.ly, without any additional steps needed.