]> source.dussan.org Git - vaadin-framework.git/commitdiff
Correctly report theme version in the debug window (#11442)
authorArtur Signell <artur@vaadin.com>
Thu, 6 Jun 2013 20:48:25 +0000 (23:48 +0300)
committerVaadin Code Review <review@vaadin.com>
Fri, 7 Jun 2013 06:34:23 +0000 (06:34 +0000)
* Adds a special v-vaadin-version selector for detecting the theme version
* The version in the base theme is replaced during build (for releases) and by the current version also when compiling in the IDE

Change-Id: Id6b94ab2edead61602fed021b7152f6e46be809f

WebContent/VAADIN/themes/base/base.scss
build/ide.xml
common.xml
theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java
themes/build.xml

index 514579830db18b459dcce9f42e99449ba45cb9ba..f22af7670e29a4774ce15d76fcc7c1c66244e61f 100644 (file)
 @import "window/window.scss";
 @import "debug/debug.scss";
 
+.v-vaadin-version:after {
+       content: "@version@";
+}
+
 /* References the BODY tag generated by Vaadin application servlet */
 .v-generated-body {
        width: 100%;
index 5380536e2e02e93354a8d8c70d5cb8a09a18eb76..37cd3dd8020f3fe8c94ca1254610de8f421192ce 100755 (executable)
@@ -14,7 +14,6 @@
     <property name="gwt.user.super.src" location="${gwt.basedir}/user/super" />
 
     <property name="work.dir" location="work" />
-    <property name="theme-version" location="9.9.9.INTERNAL-DEBUG-BUILD" />
     <echo>Using gwt files from ${gwt.user.classes} and
         ${gwt.dev.classes}</echo>
 
@@ -80,8 +79,6 @@
             <jvmarg value="-Djava.awt.headless=true" />
             <arg value="--theme" />
             <arg value="${theme}" />
-            <arg value="--theme-version" />
-            <arg value="${theme-version}" />
             <arg value="--theme-folder" />
             <arg value="WebContent/VAADIN/themes" />
         </java>
index f00d4c8baf027c1900049d13c9208c815ffe69a0..f1245724c4b878bbf309bd31fc3eba22e359a346 100644 (file)
     <antcontrib:propertyregex property="vaadin.version.revision"
         input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)"
         select="\3" />
-
+    <filterset begintoken="@" endtoken="@" id="filter-vaadin.version">
+       <filter token="version" value="${vaadin.version}" />
+    </filterset>
+    
     <union id="empty.reference" />
 
     <property name="filtered.webcontent.dir"
index 3cd08c4abcf29954f0923fb9daedfb353375bc67..dece1691f02db4150fd57cab77d2b0a20ddc976a 100644 (file)
@@ -29,6 +29,7 @@ import org.apache.commons.cli.ParseException;
 import org.apache.commons.cli.PosixParser;
 
 import com.vaadin.sass.internal.ScssStylesheet;
+import com.vaadin.shared.Version;
 
 /**
  * Helper to combine css divided into separate per component dirs into one to
@@ -44,8 +45,6 @@ public class CompileTheme {
     public static void main(String[] args) throws IOException, ParseException {
         Options options = new Options();
         options.addOption("t", "theme", true, "the theme to compile");
-        options.addOption("v", "theme-version", true,
-                "the version to add to the compiled theme");
         options.addOption("f", "theme-folder", true,
                 "the folder containing the theme");
         CommandLineParser parser = new PosixParser();
@@ -58,11 +57,11 @@ public class CompileTheme {
         }
         String themeName = params.getOptionValue("theme");
         String themeFolder = params.getOptionValue("theme-folder");
-        String themeVersion = params.getOptionValue("theme-version");
 
         // Regular theme
         try {
-            processSassTheme(themeFolder, themeName, "styles", themeVersion);
+            processSassTheme(themeFolder, themeName, "styles",
+                    Version.getFullVersion());
             System.out.println("Compiling theme " + themeName
                     + " styles successful");
         } catch (Exception e) {
@@ -73,7 +72,7 @@ public class CompileTheme {
         // Legacy theme w/o .themename{} wrapping
         try {
             processSassTheme(themeFolder, themeName, "legacy-styles",
-                    themeVersion);
+                    Version.getFullVersion());
             System.out.println("Compiling theme " + themeName
                     + " legacy-styles successful");
         } catch (Exception e) {
@@ -88,11 +87,6 @@ public class CompileTheme {
 
         StringBuffer cssHeader = new StringBuffer();
 
-        version = version.replaceAll("\\.", "_");
-        cssHeader.append(".v-theme-version:after {content:\"" + version
-                + "\";}\n");
-        cssHeader.append(".v-theme-version-" + version + " {display: none;}\n");
-
         String stylesCssDir = themeFolder + File.separator + themeName
                 + File.separator;
 
@@ -107,10 +101,9 @@ public class CompileTheme {
                     + " not found");
         }
         scss.compile();
-
         BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName));
         out.write(cssHeader.toString());
-        out.write(scss.toString());
+        out.write(scss.toString().replace("@version@", version));
         out.close();
 
         System.out.println("Compiled CSS to " + stylesCssName + " ("
index 5bca50e5f581bb87330565b1122f4bdda11f2882..89c78b11b9a26a8b38d8b247e6172efbf725db97 100644 (file)
 
         <copy todir="${theme.result.dir}">
             <fileset dir="${theme.source.dir}">
-                <include name="${theme}/**" />
+                <include name="${theme}/**/*.scss" />
+            </fileset>
+            <filterset refid="filter-vaadin.version"/>
+        </copy>
+        <copy todir="${theme.result.dir}">
+            <fileset dir="${theme.source.dir}">
+                <exclude name="${theme}/**/*.scss" />
             </fileset>
         </copy>
     </target>
@@ -84,8 +90,6 @@
             <arg value="${theme}" />
             <arg value="--theme-folder" />
             <arg value="${theme.result.dir}" />
-            <arg value="--theme-version" />
-            <arg value="${vaadin.version}" />
             <jvmarg value="-Xss8M" />
             <jvmarg value="-XX:MaxPermSize=256M" />
             <jvmarg value="-Djava.awt.headless=true" />