You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WidgetsetCompiler.java 3.4KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright 2000-2018 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tools;
  17. import java.util.logging.Level;
  18. import java.util.logging.Logger;
  19. import com.vaadin.server.widgetsetutils.WidgetSetBuilder;
  20. /**
  21. * A wrapper for the GWT compiler that runs the compiler in a new thread after
  22. * updating the widgetset file.
  23. *
  24. * This class originally existed to allow circumventing a J2SE 5.0 bug (6316197)
  25. * that prevents setting the stack size for the main thread.
  26. *
  27. * This class takes the same command line arguments as the
  28. * com.google.gwt.dev.Compiler class.
  29. *
  30. * A typical invocation would use e.g. the following arguments
  31. *
  32. * "-war WebContent/VAADIN/widgetsets com.vaadin.DefaultWidgetSet"
  33. *
  34. * In addition, larger memory usage settings for the VM should be used, e.g.
  35. *
  36. * "-Xms256M -Xmx512M -Xss8M"
  37. *
  38. * The source directory containing widgetset and related classes must be
  39. * included in the classpath, as well as other relevant JARs.
  40. *
  41. * @deprecated with Java 6, can use com.google.gwt.dev.Compiler directly (also
  42. * in Eclipse plug-in etc.)
  43. */
  44. @Deprecated
  45. public class WidgetsetCompiler {
  46. /**
  47. * @param args
  48. * same arguments as for com.google.gwt.dev.Compiler
  49. */
  50. public static void main(final String[] args) {
  51. try {
  52. // run the compiler in a different thread to enable using the
  53. // user-set stack size
  54. // on Windows, the default stack size is too small for the main
  55. // thread and cannot be changed in JRE 1.5 (see
  56. // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6316197)
  57. Runnable runCompiler = () -> {
  58. try {
  59. // GWTCompiler.main(args);
  60. // avoid warnings
  61. String wsname = args[args.length - 1];
  62. // TODO expecting this is launched via eclipse WTP
  63. // project
  64. System.out
  65. .println("Updating GWT module description file...");
  66. WidgetSetBuilder.updateWidgetSet(wsname);
  67. System.out.println("Done.");
  68. System.out.println("Starting GWT compiler");
  69. com.google.gwt.dev.Compiler.main(args);
  70. } catch (Throwable thr) {
  71. getLogger().log(Level.SEVERE,
  72. "Widgetset compilation failed", thr);
  73. }
  74. };
  75. Thread runThread = new Thread(runCompiler);
  76. runThread.start();
  77. runThread.join();
  78. System.out.println("Widgetset compilation finished");
  79. } catch (Throwable thr) {
  80. getLogger().log(Level.SEVERE, "Widgetset compilation failed", thr);
  81. }
  82. }
  83. private static final Logger getLogger() {
  84. return Logger.getLogger(WidgetsetCompiler.class.getName());
  85. }
  86. }