Open salmonb opened 4 months ago
I'm also discussing with the Vertispan team (who made the J2CL Maven plugin) on Gitter, and when I asked for a J2CL library for java.time
, one participant mentioned this gwt-time library he worked on. It's not maintained anymore, but it is J2CL compatible. And he is happy that you take everything you want from it. I think it's good to look in particular at the way it is packaged so it is J2CL compatible.
If you want to look at it but have questions, I can probably connect you with the maintainer. Just let me know.
hi,
Following the discussion I started (asking if your library was J2CL compatible), it appears that it's not according to my tests, so I think it's better to open an issue now. I will try to help you making it compatible.
I investigated further, and your library has the following dependencies:
It's possible to have dependencies with J2CL, but they must be J2CL compatible. Actually only 1. is J2CL compatible. 3. is not because it uses
java.lang.ref
(not emulated by J2CL). And therefore 2. is not (because it uses 3.). Also some classes of your library itself usejavax.annotation.Nonnull
(not provided by J2CL).So I continued working on my repo1, and added some super sources for
java.lang.ref
andjavax.annotation.Nonnull
. But because J2CL compiles each module separately (as opposed to GWT that compiles the whole app in a monolithic manner), this doesn't fix the problem in the dependencies (compiled separately, so without my new super source). Therefore, I integrated them in my repo1 (see the maven-dependency-plugin in the pom.xml) instead of declaring them as dependencies. Actually I use this copy step to also filter their sources from everything else, because J2CL will try to compile everything you provide (it doesn't have agwt.xml
module file with filtering features like for GWT). In this way, the dependent sources are filtered and compiled together with my super source, which fixes that first issue mentioned above (at least temporarily for the scope of this investigation - maybe you will find a better way, like making your final super sources complete separate "clean" modules compatible with J2CL).After solving the issues with the dependencies, I'm now getting the following J2CL errors on repo2:
It's mainly because you use some GWT API not supported by J2CL such as RegEx, Logger, etc...
So the next step will be to rewrite all these calls using Elemental2 (which is GWT & J2CL compatible).
Let me know if you need help for this.
You can also contact me more directly if you wish on my WebFX support chat.
Thank you!