-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
gradle fetchDeps is platform-dependent #365375
Comments
If I understand this correctly: given the way mitm-cache works, the So, in the case of keyboard-layout-editor, we’d need to collect |
Indeed, that would be the solution. Unless Gradle has some flag to specify the platform to build for. |
Gradle builds scripts are Turing-complete, and dependency resolution is Turing-complete as well, the only way to remotely achieve anything like automatically fetching dependencies for all platforms would be static analysis of Gradle build scripts, which is definitely out of scope, the current integration took a lot of effort already. Please look at some of the existing Gradle packages - they run Gradle multiple times in the update script to fetch dependencies for all platforms. Which is to say, I did have the idea of automatically detecting some common architecture names in filenames and automatically fetching jar files by substituting the architecture in the URL - it doesn't sound like too good of an idea, but it could be enabled with a whitelist or behind a flag as an experimental feature. |
Taking an example from jabref, this should work as for keyboard-layout-editor to resolve dependencies for all architectures: gradleUpdateScript = ''
runHook preBuild
gradle nixDownloadDeps -Dos.family=linux -Dos.arch=amd64
gradle nixDownloadDeps -Dos.family=linux -Dos.arch=aarch64
gradle nixDownloadDeps -Dos.name='mac os x' -Dos.arch=amd64
gradle nixDownloadDeps -Dos.name='mac os x' -Dos.arch=aarch64
''; |
It looks like this is specific to OpenJFX. I cannot find any reference to these properties in the gradle manual: https://docs.gradle.org/current/userguide/build_environment.html#gradle_properties_reference |
Gradle itself is a Java application that mostly doesn't have any platform-dependent behavior. Whenever there is platform-dependent behavior, it's the build scripts checking env vars and etc to figure out what dependencies to pick, what code to build, etc.
In case of OpenJFX, the official way is to use the OpenJFX plugin (which uses this), but it's often done manually (don't have the time to dig for examples so here's one from OpenJFX issues). Gradle itself uses In essence, |
Describe the bug
As observed in #353165, fetchDeps only resolves the dependencies needed for the build platform.
This leads to build failures later on if the same deps are used on other platforms.
Steps To Reproduce
Use openjfx in a gradle project. This may apply to other dependencies too.
Expected behavior
Just Works ™
Screenshots
Additional context
For this particular package it might be possible to use nixpkgs' openjfx package.
Metadata
Notify maintainers
gradle: @lorenzleutgeb @liff @NixOS/java
mitm-cache: @chayleaf
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: