Sorry, for late reply, I just saw your post. I think you are correct. But, my goal is to eliminate the need for users to physically add the extra JAR file associated with the optional library to their project (unless they need the optional features it provides).
What I want is: o Just 1 JAR distributed by me. o Code for optional library in separate JAR distributed/maintained by others o Users of my library don't have to physically mess with the optional JAR (no need to download it, place it on build path, or add an inherits clause) if they don't use those optional features in their code. Ideally, my code might even somehow check if the optional library is available. If so, it uses it, otherwise it uses the built-in fallback. But it would be OK if the developer using my library would just tell it if the optional library is to be used or not. I think that if my code contains explicit references to the external library, the GWT compiler will complain about classes that don't exist (even if users of my library never call that code) unless that optional JAR is on the build path, etc. The fact that the compiler may eliminate the dead code in the end doesn't eliminate the hassle of having to add a JAR you are not using to your build path, etc. just to make the compiler happy. I realize this is a relatively small hassle but every little bit helps. I don't want to just bundle the code from the optional library into my JAR (as I've seen some projects do) because I can't control when the optional library guys release their next version, and don't want to release a new version of my library every time they do. John On Mar 15, 8:10 pm, Vitali Lovich <[email protected]> wrote: > I may not be understanding your question. GWT will compile your code into > whatever Javascript is actually used. > > So when GWT compiles your user's code, if they don't use the parts that rely > on the optional library, they won't get that library automagically, AFAIK, > by the GWT compiler recognizing this. > > Caveat: The inherits stuff in the module configuration might still cause > code to be compiled, but the dead-code elimination in the compiler should > cause it to not be included in the result, thus your user's code should have > those optional libraries omitted. If you care about compilation-speed, > you'd have to have the user edit your gwt.xml file to include only the > modules used by your code they rely on. > > Perhaps someone more familiar with the internals of the gwt compiler can > comment as to whether or not my explanation is correct or way off base. > > On Sun, Mar 15, 2009 at 12:28 AM, John Gunther > <[email protected]>wrote: > > > > > Is it possible to release a GWT library that has optional features > > that require an additional library (written by someone else, packaged > > in a module JAR) but that does not require its users to load that > > additional library if they don't need the optional features? > > > What is the best way to do this that results in users of the library > > having the least number of steps to configure it with or without the > > optional features? > > > John > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
