]> source.dussan.org Git - vaadin-framework.git/commitdiff
Theme version check for #3416
authorMarc Englund <marc.englund@itmill.com>
Tue, 8 Dec 2009 14:29:24 +0000 (14:29 +0000)
committerMarc Englund <marc.englund@itmill.com>
Tue, 8 Dec 2009 14:29:24 +0000 (14:29 +0000)
svn changeset:10202/svn branch:6.2

build/build.xml
build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java
src/com/vaadin/terminal/gwt/client/VDebugConsole.java

index 5f84d8b83cfb4def4e1e731e3050a2319e6fb441..10dce77b318cb8f642b9c67ad810f12aebf512c2 100644 (file)
         </javac>
     </target>
 
-    <target name="defaulttheme">
+    <target name="defaulttheme" depends="init">
         <echo>Combining default themes css files</echo>
         <!-- ensure buildhelpers are compiled -->
         <javac source="1.5" target="1.5" srcdir="build/buildhelpers" classpath="build/smartsprites/lib/smartsprites-0.2.3-itmill.jar"/>
         <java classname="com.vaadin.buildhelpers.CompileDefaultTheme" failonerror="yes" fork="yes">
+               <arg value="-version" />
+               <arg value="${version.full}"/>
             <classpath>
                 <pathelement location="build/buildhelpers" />
                 <fileset dir="build/smartsprites/lib">
index 96d5a3440a6097b71912591a73deaf9eba80359b..b4c016d434e62418dd9fb555423bd29dbd031759 100644 (file)
@@ -19,6 +19,8 @@ import java.util.Comparator;
  */
 public class CompileDefaultTheme {
 
+    private static final String ARG_VERSION = "-version";
+
     private static final String THEME_DIR = "./WebContent/VAADIN/themes/";
     private static final String BASE = "base";
     private static final String RUNO = "runo";
@@ -29,9 +31,18 @@ public class CompileDefaultTheme {
      * @throws IOException
      */
     public static void main(String[] args) throws IOException {
-        combineTheme(new String[] { BASE }, false);
-        combineTheme(new String[] { BASE, RUNO }, false);
-        combineTheme(new String[] { BASE, REINDEER }, true);
+        String ver = null;
+        for (int i = 0; i < args.length; i++) {
+            if (ARG_VERSION.equals(args[i])) {
+                if (args.length >= i) {
+                    ver = args[i + 1];
+                }
+                break;
+            }
+        }
+        combineTheme(new String[] { BASE }, false, ver);
+        combineTheme(new String[] { BASE, RUNO }, false, ver);
+        combineTheme(new String[] { BASE, REINDEER }, true, ver);
     }
 
     /**
@@ -46,10 +57,20 @@ public class CompileDefaultTheme {
      * @throws IOException
      */
     private static void combineTheme(String[] themeNames,
-            boolean useSmartSprites) throws IOException {
+            boolean useSmartSprites, String version) throws IOException {
 
         StringBuffer combinedCss = new StringBuffer();
 
+        // Theme version
+        if (version == null) {
+            version = "9.9.9.INTERNAL-DEBUG-BUILD";
+        }
+        version = version.replaceAll("\\.", "_");
+        combinedCss.append(".v-theme-version:after {content:\"" + version
+                + "\";}\n");
+        combinedCss.append(".v-theme-version-" + version
+                + " {display: none;}\n");
+
         for (int j = 0; j < themeNames.length; j++) {
             File f = new File(THEME_DIR + themeNames[j]);
             combinedCss
index f3a59460e05aaa1eb47aa838c5cf6c304d90d7b3..45b8c9353b465b16f56035e7dcfa465ac5ca82e2 100755 (executable)
@@ -39,7 +39,7 @@ public final class VDebugConsole extends VOverlay implements Console {
     /* Initialize version numbers from string replaced by build-script. */
     static {
         if ("@VERSION@".equals("@" + "VERSION" + "@")) {
-            VERSION = "5.9.9-INTERNAL-NONVERSIONED-DEBUG-BUILD";
+            VERSION = "9.9.9.INTERNAL-DEBUG-BUILD";
         } else {
             VERSION = "@VERSION@";
         }
@@ -184,6 +184,11 @@ public final class VDebugConsole extends VOverlay implements Console {
                     + "version than the one used on server. Unexpected "
                     + "behavior may occur.");
         }
+
+        log("<div class=\"v-theme-version v-theme-version-"
+                + VERSION.replaceAll("\\.", "_")
+                + "\">Warning: widgetset version " + VERSION
+                + " does not seem to match theme version </div>");
     }
 
     private EventPreview dragpreview = new EventPreview() {