]> source.dussan.org Git - vaadin-framework.git/commitdiff
#2891: wrapper for GWT compiler to enable compiling widgetsets using GWT 1.6 and...
authorHenri Sara <henri.sara@itmill.com>
Tue, 5 May 2009 10:54:22 +0000 (10:54 +0000)
committerHenri Sara <henri.sara@itmill.com>
Tue, 5 May 2009 10:54:22 +0000 (10:54 +0000)
svn changeset:7621/svn branch:6.0

src/com/itmill/toolkit/launcher/WidgetsetCompiler.java [new file with mode: 0644]

diff --git a/src/com/itmill/toolkit/launcher/WidgetsetCompiler.java b/src/com/itmill/toolkit/launcher/WidgetsetCompiler.java
new file mode 100644 (file)
index 0000000..dd782f5
--- /dev/null
@@ -0,0 +1,54 @@
+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