--- /dev/null
+package com.itmill.toolkit.launcher;\r
+\r
+import com.google.gwt.dev.Compiler;\r
+\r
+/**\r
+ * A wrapper for the GWT 1.6 compiler that runs the compiler in a new thread.\r
+ * \r
+ * This allows circumventing a J2SE 5.0 bug (6316197) that prevents setting the\r
+ * stack size for the main thread. Thus, larger widgetsets can be compiled.\r
+ * \r
+ * This class takes the same command line arguments as the\r
+ * com.google.gwt.dev.Compiler class.\r
+ * \r
+ * A typical invocation would use e.g. the following arguments\r
+ * \r
+ * "-workDir WebContent/ITMILL/widgetsets com.itmill.toolkit.terminal.gwt.DefaultWidgetSet"\r
+ * \r
+ * In addition, larger memory usage settings for the VM should be used, e.g.\r
+ * \r
+ * "-Xms256M -Xmx512M -Xss8M"\r
+ * \r
+ * The source directory containing widgetset and related classes must be\r
+ * included in the classpath, as well as the gwt-dev-[platform].jar and other\r
+ * relevant JARs.\r
+ */\r
+public class WidgetsetCompiler {\r
+\r
+ /**\r
+ * @param args\r
+ * same arguments as for com.google.gwt.dev.Compiler\r
+ */\r
+ public static void main(final String[] args) {\r
+ try {\r
+ // run the compiler in a different thread to enable using the\r
+ // user-set stack size\r
+\r
+ // on Windows, the default stack size is too small for the main\r
+ // thread and cannot be changed in JRE 1.5 (see\r
+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6316197)\r
+\r
+ Runnable runCompiler = new Runnable() {\r
+ public void run() {\r
+ Compiler.main(args);\r
+ }\r
+ };\r
+ Thread runThread = new Thread(runCompiler);\r
+ runThread.start();\r
+ runThread.join();\r
+ System.out.println("Widgetset compilation finished");\r
+ } catch (Throwable thr) {\r
+ thr.printStackTrace();\r
+ }\r
+ }\r
+}\r