Revision: 6463
Author: jlaba...@google.com
Date: Mon Oct 26 09:31:34 2009
Log: Recommitting r6449 (Adds basic test case for SOYC) with fix. Compiled  
user files are now added to javac.junit.out instead of javac.out to prevent  
rebuilding of dev.

Patch by: kprobst
Review by: jlabanca (pair programmed incremental change from r6449)


http://code.google.com/p/google-web-toolkit/source/detail?r=6463

Added:
  /trunk/dev/core/test/com/google/gwt/dev/SoycTest.java
Modified:
  /trunk/dev/build.xml

=======================================
--- /dev/null
+++ /trunk/dev/core/test/com/google/gwt/dev/SoycTest.java       Mon Oct 26  
09:31:34 2009
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may  
not
+ * use this file except in compliance with the License. You may obtain a  
copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations  
under
+ * the License.
+ */
+package com.google.gwt.dev;
+
+import com.google.gwt.core.ext.UnableToCompleteException;
+import com.google.gwt.dev.Compiler.CompilerOptionsImpl;
+import com.google.gwt.dev.util.Util;
+import com.google.gwt.dev.util.log.PrintWriterTreeLogger;
+import com.google.gwt.util.tools.Utility;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Test for {...@link Compiler} with option -soyc.
+ */
+public class SoycTest extends TestCase {
+
+  private final CompilerOptionsImpl options = new CompilerOptionsImpl();
+
+  public void testSoyc() throws UnableToCompleteException, IOException {
+    options.setSoycEnabled(true);
+    options.addModuleName("com.google.gwt.sample.hello.Hello");
+    options.setWarDir(Utility.makeTemporaryDirectory(null, "hellowar"));
+    PrintWriterTreeLogger logger = new PrintWriterTreeLogger();
+    new Compiler(options).run(logger);
+
+    // make sure the files have been produced
+    assertTrue(new File(options.getWarDir()  
+ "/hello/compile-report/index.html").exists());
+    assertTrue(new File(options.getWarDir()  
+ "/hello/compile-report/SoycDashboard-0-index.html").exists());
+    assertTrue(new File(options.getWarDir()  
+ "/hello/compile-report/total-0-overallBreakdown.html").exists());
+    assertTrue(new File(options.getWarDir()  
+ "/hello/compile-report/soycStyling.css").exists());
+
+    assertFalse(new File(options.getWarDir()  
+ "/hello/compile-report/index2.html").exists());
+    Util.recursiveDelete(options.getWarDir(), false);
+  }
+}
=======================================
--- /trunk/dev/build.xml        Fri Oct 23 19:19:09 2009
+++ /trunk/dev/build.xml        Mon Oct 26 09:31:34 2009
@@ -16,7 +16,7 @@
      </delete>
    </target>

-  <target name="compile.tests" depends="build, compile.emma.if.enabled"  
description="Compiles the test code for this project">
+  <target name="compile.tests" depends="build, compile.emma.if.enabled,  
build.alldeps.jar" description="Compiles the test code for this project">
      <mkdir dir="${javac.junit.out}" />
      <gwt.javac srcdir="" destdir="${javac.junit.out}">
        <src path="core/src" />
@@ -27,6 +27,20 @@
          <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
        </classpath>
      </gwt.javac>
+    <gwt.javac srcdir="${gwt.root}/user/src" destdir="${javac.junit.out}">
+      <classpath>
+        <pathelement location="${javac.out}" />
+        <pathelement  
location="${gwt.tools.lib}/tomcat/servlet-api-2.5.jar" />
+        <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
+        <pathelement  
location="${gwt.tools.lib}/jfreechart/jfreechart-1.0.3.jar" />
+        <pathelement  
location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
+        <pathelement location="${gwt.tools.lib}/w3c/sac/sac-1.3.jar" />
+        <pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3.jar" />
+        <pathelement  
location="${gwt.build.lib}/gwt-dev-${build.host.platform}.jar" />
+        <pathelement location="${alldeps.jar}" />
+      </classpath>
+    </gwt.javac>
+
    </target>

    <target name="build.alldeps.jar" description="Merges all dependency jars  
into a single jar">
@@ -153,7 +167,7 @@
      <touch file="${filter.sentinel}" />
    </target>

-  <target name="compiler.standalone" description="Validates that the  
standalone gwt-compiler project can build.">
+  <target name="compiler.standalone" depends="build.alldeps.jar"  
description="Validates that the standalone gwt-compiler project can build.">
      <mkdir dir="${javac.out}" />
      <gwt.javac srcdir="core/super"  
excludes="com/google/gwt/dev/jjs/intrinsic/"/>
      <gwt.javac srcdir="core/src">
@@ -238,6 +252,8 @@
          <!-- Pull in gwt-dev and gwt-user sources for .gwt.xml files -->
          <pathelement location="${gwt.root}/user/src/" />
          <pathelement location="${gwt.root}/user/super/" />
+        <!-- CompilerTest compiles the hello sample. -->
+        <pathelement location="${gwt.root}/samples/hello/src/" />
        </extraclasspaths>
      </gwt.junit>
    </target>

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

Reply via email to