Revision: 9908
Author:   [email protected]
Date:     Tue Mar 29 09:58:14 2011
Log: Fixes issue 6189. WebAppCreator was not scanning war/WEB-INF/lib to fill up .classpath

Review at http://gwt-code-reviews.appspot.com/1393801

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9908

Modified:
 /trunk/user/src/com/google/gwt/user/tools/WebAppCreator.java
 /trunk/user/test/com/google/gwt/user/tools/WebAppCreatorTest.java

=======================================
--- /trunk/user/src/com/google/gwt/user/tools/WebAppCreator.java Mon Mar 7 08:21:08 2011 +++ /trunk/user/src/com/google/gwt/user/tools/WebAppCreator.java Tue Mar 29 09:58:14 2011
@@ -542,7 +542,7 @@
     replacements.put("@copyServletDeps", copyServletDeps);

     // Collect the list of server libs to include on the eclipse classpath.
-    File libDirectory = new File(outDir + warFolder + "WEB-INF/lib");
+ File libDirectory = new File(outDir + "/" + warFolder + "/WEB-INF/lib");
     StringBuilder serverLibs = new StringBuilder();
     if (libDirectory.exists()) {
       for (File file : libDirectory.listFiles()) {
=======================================
--- /trunk/user/test/com/google/gwt/user/tools/WebAppCreatorTest.java Mon Mar 7 08:21:08 2011 +++ /trunk/user/test/com/google/gwt/user/tools/WebAppCreatorTest.java Tue Mar 29 09:58:14 2011
@@ -15,6 +15,7 @@
  */
 package com.google.gwt.user.tools;

+import com.google.gwt.dev.util.Util;
 import com.google.gwt.user.tools.WebAppCreator.ArgProcessor;

 import junit.framework.TestCase;
@@ -263,6 +264,32 @@
     assertFileDoesNotExist("test/com/foo/HelloJUnit.gwt.xml");
     assertFileDoesNotExist("test/com/foo/client/HelloTest.java");
   }
+
+  /**
+   * Generate a .classpath containing a .jar in war/WEB-INF/lib
+   */
+ public void testCreatorOnlyEclipseWithJars() throws IOException, WebAppCreatorException {
+    runCreator("-out", projectFolder, "-XnoEclipse", "-junit", mockJar,
+        MY_PROJECT);
+
+    String libDir = "war" + File.separatorChar
+        + "WEB-INF" + File.separatorChar
+        + "lib";
+ assertTrue(new File(projectFolder + File.separatorChar + libDir).mkdirs());
+
+    String libJarName = libDir + File.separatorChar + "foo.jar";
+ File libFile = new File(projectFolder + File.separatorChar + libJarName);
+    assertTrue(libFile.createNewFile());
+
+    runCreator("-out", projectFolder, "-XonlyEclipse", "-junit", mockJar,
+        MY_PROJECT);
+
+    assertFileExists(".classpath");
+ File classpathFile = new File(projectFolder + File.separatorChar + ".classpath"); + String classpathContents = Util.readURLAsString(classpathFile.toURI().toURL());
+    assertTrue(".classpath does not contain " + libJarName,
+        classpathContents.contains(libJarName));
+  }

   /**
    * Test the main method.

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

Reply via email to