Beispiel #1
0
  public void saveTo(File file, String renameTo) {
    boolean absoluteFile = renameTo.endsWith(".gwt.xml");
    if (absoluteFile) {
      renameTo = renameTo.substring(0, renameTo.length() - 8);
    }
    boolean rename = !renameTo.replace('/', '.').equals(module.getInheritName());

    final String inheritName;
    if (rename) {
      final String pkg, name;
      int ind = renameTo.lastIndexOf('.');
      boolean moveToPackage = ind > -1;
      if (moveToPackage) {
        pkg = renameTo.substring(0, ind).replace('.', '/');
        name = renameTo.substring(ind + 1);
      } else {
        pkg = "";
        name = renameTo;
      }
      if (pkg.length() == 0) {
        inheritName = name;
      } else {
        if (file.isDirectory()) {
          File f = new File(file, pkg);
          f.mkdirs();
          f.deleteOnExit();
          file = f;
        }
        inheritName = pkg + (pkg.length() == 0 ? "" : ".") + name;
      }
    } else {
      inheritName = renameTo;
    }
  }
Beispiel #2
0
 public GwtcContext(GwtcService gwtcService, ClassLoader resourceLoader) {
   this.gwtcService = gwtcService;
   // Start scanning the classpath, but don't block until we need to.
   final Callable<ClasspathResourceMap> scanner = X_Scanner.scanClassloaderAsync(resourceLoader);
   classpath =
       new SingletonProvider<ClasspathResourceMap>() {
         @Override
         protected ClasspathResourceMap initialValue() {
           try {
             return scanner.call();
           } catch (Exception e) {
             throw X_Debug.rethrow(e);
           }
         }
       };
   String genName = "Gwtc" + Math.abs(hashCode() - System.nanoTime());
   module = new GwtcXmlBuilder("", genName, false);
   module.addConfigurationProperty("xsiframe.failIfScriptTag", "FALSE");
   module.setPublic("public");
 }
Beispiel #3
0
 public void setRenameTo(String renameTo) {
   module.setRenameTo(renameTo);
 }
Beispiel #4
0
 public XmlBuffer getGwtXml() {
   return module.getBuffer();
 }
Beispiel #5
0
 public void addGwtXmlInherit(String value) {
   module.addInherit(value);
 }
Beispiel #6
0
 public void addGwtXmlSource(String genPrefix) {
   module.addSource(genPrefix);
 }
Beispiel #7
0
 public void setEntryPoint(String qualifiedName) {
   module.setEntryPoint(qualifiedName);
 }
Beispiel #8
0
 public String getGenName() {
   return module.getInheritName();
 }
Beispiel #9
0
 public void inheritGwtXml(String inherit) {
   module.inherit(inherit);
 }
Beispiel #10
0
 public void saveTo(File file) {
   saveTo(file, module.getInheritName());
 }
Beispiel #11
0
 public String generateGwtXml(Gwtc gwtc, String pkg, String name) {
   xml = GwtcXmlBuilder.generateGwtXml(gwtc, pkg, name);
   return xml.getInheritName();
 }