Open vcvitaly opened 8 months ago
So far resolved it the following way:
configurations
.matching(it -> it.name.contains("downloadSources"))
.configureEach {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, platform.osFamily))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, platform.arch))
}
}
@vcvitaly thanks for bringing this up. It's an unfortunate interaction between Gradle and IntelliJ and I wonder if this would better be fixed on the IntelliJ side (although I am not sure how).
The underlying issue is that there are no so-called Disambiguation Rules for OperatingSystemFamily
and MachineArchitecture
in Gradle. For Usage
for example, there is such a rule that chooses the runtime over the api if no clear selection has been made. That's why it works for other libraries that do not have the additional attributes for OperatingSystem and Architecture.
But, I also think there is no good way to define a Disambiguation Rule here (which OS should be the primary?). Although, in the case of sources download for JavaFX it won't matter. The sources are the same for each variation (I think).
Bottom line: the solution you found is the best I can think of as well. Matching based on the name (downloadSources) is not super nice, but I can't think of another way. I would reduce it to the minimum and only set the OPERATING_SYSTEM_ATTRIBUTE
and ARCHITECTURE_ATTRIBUTE
attributes, which we already have in the source code here: setClasspathAttributes
I think this can be added to the plugin. In Java it would look like this:
private void setClasspathAttributesForSourcesDownload() {
getConfigurationContainer().matching(c -> c.getName().startsWith("downloadSources")).configureEach(this::setClasspathAttributes);
}
...as an additional method in JavaFXOptions
that is called in setPlatform
.
@vcvitaly if you would like to do a PR for this, I am happy to review and maybe we can get someone from the maintainers to integrate it. 🙂 We could probably also add a test in JavaFXPluginSmokeTest
by manually re-creating the setup IntelliJ does (with a ijDownloadSources...
task and a downloadSources...
configuration).
After updating to '0.1.0' I cannot download sources for javafx with the following error:
At the same time dependency itself is downloaded without issues, I tried adding:
But it didn't help. Could you advice what could be done to fix that? I'm ready to take that issue and contribute if you point me in the right direction.