]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use non-obfuscated version of vaadinPush.js when not in production (#12527)
authorArtur Signell <artur@vaadin.com>
Mon, 9 Sep 2013 11:38:21 +0000 (14:38 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 10 Sep 2013 13:14:03 +0000 (13:14 +0000)
Change-Id: I8e0baec2391b140e6a72eedf6606fd2792c735bc

.gitignore
build/ide.xml
client/src/com/vaadin/client/communication/AtmospherePushConnection.java
push/build.xml
server/src/com/vaadin/server/BootstrapHandler.java
shared/src/com/vaadin/shared/ApplicationConstants.java

index d5899b3d5846a41444dd559c88809a4d16fc18f9..30c8597b16f01472d86ce5e4ae45ea91b0f6bb56 100644 (file)
@@ -45,6 +45,7 @@
 /WebContent/VAADIN/gwt-unitCache*
 
 WebContent/VAADIN/vaadinPush.js
+WebContent/VAADIN/vaadinPush.debug.js
 
 # /WebContent/WEB-INF/
 /WebContent/WEB-INF/classes
index 1d1049026d973ad6c67e18ba9b4720ffb6b23864..2605bf2cdd29f4fc51d7a0adcba4a5b4a7e658ce 100755 (executable)
     </target>
     <target name="vaadinPush.js">
         <property name="vaadinPush.js.output" location="WebContent/VAADIN/vaadinPush.js" />
+        <property name="vaadinPush.debug.js.output" location="WebContent/VAADIN/vaadinPush.debug.js" />
 
         <loadfile srcfile="WebContent/VAADIN/jquery-1.7.2.js" property="jquery.js.contents" />
         <loadfile srcfile="WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" />
             </filterchain>
         </loadfile>
         <echo file="${vaadinPush.js.output}">${vaadinPush.js.contents}</echo>
+        <!-- This vaadinPush.js is not obfuscated so the debug version is the same-->
+        <copy file="${vaadinPush.js.output}" tofile="${vaadinPush.debug.js.output}"/>
     </target>
 </project>
index 20ccd451733346a7560a0d1846b316b01aca7149..3cecb09dc19f5183f8b53e57194967dc4a424991 100644 (file)
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.user.client.Command;
+import com.vaadin.client.ApplicationConfiguration;
 import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.ApplicationConnection.CommunicationErrorHandler;
 import com.vaadin.client.ResourceLoader;
@@ -473,7 +474,13 @@ public class AtmospherePushConnection implements PushConnection {
         if (isAtmosphereLoaded()) {
             command.execute();
         } else {
-            final String pushJs = ApplicationConstants.VAADIN_PUSH_JS;
+            final String pushJs;
+            if (ApplicationConfiguration.isProductionMode()) {
+                pushJs = ApplicationConstants.VAADIN_PUSH_JS;
+            } else {
+                pushJs = ApplicationConstants.VAADIN_PUSH_DEBUG_JS;
+            }
+
             VConsole.log("Loading " + pushJs);
             ResourceLoader.get().loadScript(
                     connection.getConfiguration().getVaadinDirUrl() + pushJs,
index 829411ea12669035e952b18b91fd35dd4f0ca586..1cbe23d75b18bf350b3a146ebc6e636b5aa69fbb 100644 (file)
@@ -11,6 +11,7 @@
     <property name="module.symbolic" value="com.vaadin.push" />
     <property name="result.dir" location="result" />
     <property name="vaadinPush.js" location="${result.dir}/js/VAADIN/vaadinPush.js" />
+    <property name="vaadinPush.debug.js" location="${result.dir}/js/VAADIN/vaadinPush.debug.js" />
 
     <!-- Keep the version number in sync with ivy.xml, server/src/com/vaadin/server/Constants.java and jquery.atmosphere.js -->
     <property name="atmosphere.version" value="1.0.14.vaadin4" />
     <union id="jar.includes">
         <fileset dir="${result.dir}/js">
             <include name="VAADIN/vaadinPush.js" />
+            <include name="VAADIN/vaadinPush.debug.js" />
         </fileset>
     </union>
 
     <target name="vaadinPush.js">
         <mkdir dir="${result.dir}/js/VAADIN" />
-        <property name="vaadinPush.js.output" location="${result.dir}/js/VAADIN/vaadinPush.js" />
-        <property name="vaadinPush.js.combined.output" location="${result.dir}/js/VAADIN/push.combined.js" />
 
         <loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery-${jquery.version}.js" property="jquery.js.contents" />
         <loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" />
                 </replacetokens>
             </filterchain>
         </loadfile>
-        <echo file="${vaadinPush.js.combined.output}">${vaadinPush.js.contents}</echo>
+
+        <!-- Non-obfuscated version for debugging -->
+        <echo file="${vaadinPush.debug.js}">${vaadinPush.js.contents}</echo>
 
         <!-- Minify -->
         <ivy:retrieve organisation="com.yahoo.platform.yui" module="yuicompressor" revision="2.4.7" inline="true" type="jar" pattern="${result.dir}/compressor.jar" />
         <java jar="${result.dir}/compressor.jar" fork="true">
             <arg value="-v" />
             <arg value="-o" />
-            <arg file="${vaadinPush.js.output}" />
-            <arg file="${vaadinPush.js.combined.output}" />
+            <arg file="${vaadinPush.js}" />
+            <arg file="${vaadinPush.debug.js}" />
         </java>
     </target>
 
index b21fdb0b744fb9d919a852b0fc71af4ebf297c0f..0a4949ffa7e0deef146fd7fe2ae73dded5b9ab94 100644 (file)
@@ -388,9 +388,16 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
 
         if (context.getPushMode().isEnabled()) {
             // Load client-side dependencies for push support
+            String pushJS = vaadinLocation;
+            if (context.getRequest().getService().getDeploymentConfiguration()
+                    .isProductionMode()) {
+                pushJS += ApplicationConstants.VAADIN_PUSH_JS;
+            } else {
+                pushJS += ApplicationConstants.VAADIN_PUSH_DEBUG_JS;
+            }
+
             fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr(
-                    "type", "text/javascript").attr("src",
-                    vaadinLocation + ApplicationConstants.VAADIN_PUSH_JS));
+                    "type", "text/javascript").attr("src", pushJS));
         }
 
         String bootstrapLocation = vaadinLocation + "vaadinBootstrap.js";
index d7de435735487fe497f88d99744f6d52f7e69825..104f3047a8fd97d6f9ddf9a7429f334809dcd895 100644 (file)
@@ -78,6 +78,14 @@ public class ApplicationConstants implements Serializable {
      */
     public static final String VAADIN_PUSH_JS = "vaadinPush.js";
 
+    /**
+     * The name of the debug version of the javascript containing push support.
+     * The file is located in the VAADIN directory.
+     * 
+     * @since 7.1.6
+     */
+    public static final String VAADIN_PUSH_DEBUG_JS = "vaadinPush.debug.js";
+
     /**
      * Name of the parameter used to transmit the CSRF token.
      */