Skip to content
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

Please clarify if svg-salamander, jna, and jxlayer are required in the dependencies #25

Closed
vlsi opened this issue Feb 14, 2020 · 9 comments

Comments

@vlsi
Copy link
Contributor

vlsi commented Feb 14, 2020

Currently darklaf bundles the dependencies to the jar (e.g. darklaf-1.3.3.4.jar), however, its pom.xml still has the dependencies:

+--- com.github.weisj:darklaf -> 1.3.3.4
|    +--- com.metsci.ext.com.kitfox.svg:svg-salamander:0.1.19
|    +--- net.java.dev.jna:jna:4.1.0
|    \--- org.swinglabs:jxlayer:3.0.4

It looks that it is not consistent.

It would be great if
a) darklaf could either avoid shading the dependencies (e.g. to allow other projects to pick versions and avoid class duplication)
b) shade the dependencies (+repackage), and exclude the dependencies from POM file.

It would probably make sense to do both: publish shaded and non-shaded jars at the same time (e.g. under different artifactId or classifier).

Note: it would probably make sense to use Gradle's configurations to clarify which dependencies are included to the jar, and which are not (e.g. https://github.com/apache/calcite-avatica/blob/63525d7c772e3ef3db0747ef38f2f59ccdd9dbf6/standalone-server/build.gradle.kts#L90 )

@kirill-grouchnikov
Copy link

Note that the official SVG Salamander is on version 1.1.2, while this depends on a really old one - 0.1.19. This means that if you are using another dependency in your application that needs a later version of SVG Salamander, your app might not compile / run - because of the incompatible API changes introduced between these two versions.

Unfortunately, the author of SVG Salamander is not interested in making the official Maven drops happening, so it's not clear how to handle this issue.

@vlsi
Copy link
Contributor Author

vlsi commented Feb 14, 2020

Unfortunately, the author of SVG Salamander is not interested in making the official Maven drops happening, so it's not clear how to handle this issue.

E.g. convince the author :)
Have you tried that?

An alternative option is to create yet another project that pulls SVG Salamander sources and publishes them to Central.

For instance, I have a similar case with jgraphx: https://github.com/vlsi/jgraphx-publish
That is I am subscribed to jgraphx release notifications, and I just push to central.

@kirill-grouchnikov
Copy link

blackears/svgSalamander#9 and blackears/svgSalamander#23 have been open for quite some time already. One option to "work around" that would be to copy the specific source classes into the codebase and refactor them to be under a different package name - respecting the license terms, of course.

I'm not necessarily advocating for that approach since it means that you're either stuck on a really old version of one of your dependencies, or are constantly updating that effective fork to continue getting bugfixes and enhancements.

The point of my comment is that sooner or later somebody will get into a pickle with an app project that needs a newer version of SVG Salamander.

@kirill-grouchnikov
Copy link

Here's one example:

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: 'void com.kitfox.svg.LinearGradient.setStops(java.awt.Color[], float[])'
	at com.github.weisj.darklaf.icons.IconColorMapper.createColor(IconColorMapper.java:86)
	at com.github.weisj.darklaf.icons.IconColorMapper.loadColors(IconColorMapper.java:77)
	at com.github.weisj.darklaf.icons.IconColorMapper.patchColors(IconColorMapper.java:52)
	at com.github.weisj.darklaf.icons.ThemedSVGIcon.ensureTheme(ThemedSVGIcon.java:52)
	at com.github.weisj.darklaf.icons.ThemedSVGIcon.paintIcon(ThemedSVGIcon.java:45)
	at com.github.weisj.darklaf.ui.checkbox.DarkCheckBoxUI.paint(DarkCheckBoxUI.java:148)

https://github.com/weisJ/darklaf/blob/master/src/main/java/com/github/weisj/darklaf/icons/IconColorMapper.java#L86 calls LinearGradient.setStops, but it's been removed later on - see https://github.com/blackears/svgSalamander/blob/master/svg-core/src/main/java/com/kitfox/svg/Gradient.java#L235

@weisJ
Copy link
Owner

weisJ commented Feb 14, 2020

Currently darklaf bundles the dependencies to the jar (e.g. darklaf-1.3.3.4.jar), however, its pom.xml still has the dependencies:

Which jar are you referring to? The normal jar or the standalone version? The normal version should not bundle the depndencies.

As for the version of SVGSalamander I will look into publishing it to maven myself. Until then the project will remain with the older version.

@vlsi
Copy link
Contributor Author

vlsi commented Feb 14, 2020

Which jar are you referring to?

I mean the following: https://repo1.maven.org/maven2/com/github/weisj/darklaf/1.3.3.4/ -> darklaf-1.3.3.4.jar -> it does bundle third-party code.

@DevCharly
Copy link

There are already multiple forks/clones of svgSalamander, which are on maven central. E.g.

@weisJ
Copy link
Owner

weisJ commented Feb 15, 2020

I mean the following: https://repo1.maven.org/maven2/com/github/weisj/darklaf/1.3.3.4/ -> darklaf-1.3.3.4.jar -> it does bundle third-party code.

This doesn't seem to be the case for me. All of the code bundled in the jar is also included in the repository. Are you referring to the package org.pbjar.jxlayer```and javafx.swing.text````? The former isn't available via maven (or otherwise for that matter) and the latter is if you look at what is inside the package actually just a necessary hack around the implementation of swing (see here).

@DevCharly thank you for painting that out. I have switched the dependency to use the newer version of svgSalamander (5cf68e6)

@vlsi
Copy link
Contributor Author

vlsi commented Feb 15, 2020

Oh, indeed dependencies are not shaded in the default artifact.

@vlsi vlsi closed this as completed Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants