Hi Scott,

I'd like to you do a code review. To apply this patch, navigate to the the
root of the GWT 1.6 releases branch, and perform the following steps:

svn update -r4449
patch -p0 < updatedWebAppCreatorWithProjectNameParam-r4449.patch

Description:

In the migration from ApplicationCreator to WebAppCreator, the parameter to
specify the Eclipse project name to the createApplication method was
removed. This is a useful argument, as there are other clients of this API
that wish to specify the Eclipse project name directly, instead of having it
inferred from the module name.

Affected Files:

M      user/src/com/google/gwt/user/tools/.projectsrc
M      user/src/com/google/gwt/user/tools/App.launchsrc
M      user/src/com/google/gwt/user/tools/WebAppCreator.java


Thanks,
Rajeev

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Index: user/src/com/google/gwt/user/tools/.projectsrc
===================================================================
--- user/src/com/google/gwt/user/tools/.projectsrc	(revision 4449)
+++ user/src/com/google/gwt/user/tools/.projectsrc	(working copy)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <projectDescription>
-   <name>@moduleShortName</name>
-   <comment>@moduleShortName project</comment>
+   <name>@projectName</name>
+   <comment>@projectName project</comment>
    <projects/>
    <buildSpec>
        <buildCommand>
Index: user/src/com/google/gwt/user/tools/App.launchsrc
===================================================================
--- user/src/com/google/gwt/user/tools/App.launchsrc	(revision 4449)
+++ user/src/com/google/gwt/user/tools/App.launchsrc	(working copy)
@@ -3,13 +3,13 @@
 <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="@shellClass"/>
 <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;@moduleShortName&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
-<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/@moduleShortName/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
-<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento project=&quot;@moduleShortName&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;@projectName&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/@projectName/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento project=&quot;@projectName&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
 <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry externalArchive=&quot;@gwtDevPath&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
 </listAttribute>
 <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-xmx2...@vmargs"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl&#10;@startupUrl @moduleName"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@moduleShortName"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName"/>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 </launchConfiguration>
Index: user/src/com/google/gwt/user/tools/WebAppCreator.java
===================================================================
--- user/src/com/google/gwt/user/tools/WebAppCreator.java	(revision 4449)
+++ user/src/com/google/gwt/user/tools/WebAppCreator.java	(working copy)
@@ -159,7 +159,22 @@
    */
   static void createApplication(String moduleName, File outDir,
       boolean overwrite, boolean ignore) throws IOException {
+    createApplication(moduleName, outDir, null, overwrite, ignore);
+  }
 
+  /**
+   * @param moduleName name of the fully-qualified GWT module to create as an
+   *          Application.
+   * @param outDir Where to put the output files
+   * @param projectName The name of the generated Eclipse project for this
+   *          application, or null to generate one automatically
+   * @param overwrite Overwrite an existing files if they exist.
+   * @param ignore Ignore existing files if they exist.
+   * @throws IOException
+   */
+  static void createApplication(String moduleName, File outDir,
+      String projectName, boolean overwrite, boolean ignore) throws IOException {
+
     // Figure out the installation directory
     String installPath = Utility.getInstallPath();
     String gwtUserPath = installPath + '/' + "gwt-user.jar";
@@ -197,6 +212,8 @@
     // Create a map of replacements
     Map<String, String> replacements = new HashMap<String, String>();
     replacements.put("@moduleShortName", moduleShortName);
+    replacements.put("@projectName", (projectName == null ? moduleShortName
+        : projectName));
     replacements.put("@moduleName", moduleName);
     replacements.put("@clientPackage", modulePackageName + ".client");
     replacements.put("@serverPackage", modulePackageName + ".server");

Reply via email to