diff options
author | Artur Signell <artur@vaadin.com> | 2013-06-06 23:48:25 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-06-07 06:34:23 +0000 |
commit | bca14c0d095f63275cdbe46aca946673465c56d6 (patch) | |
tree | b180c39230d71afae5ea2852f845e1cac2ddf76b | |
parent | 1b0a214100e6270abea8b9f415a0873de88aab95 (diff) | |
download | vaadin-framework-bca14c0d095f63275cdbe46aca946673465c56d6.tar.gz vaadin-framework-bca14c0d095f63275cdbe46aca946673465c56d6.zip |
Correctly report theme version in the debug window (#11442)
* 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
-rw-r--r-- | WebContent/VAADIN/themes/base/base.scss | 4 | ||||
-rwxr-xr-x | build/ide.xml | 3 | ||||
-rw-r--r-- | common.xml | 5 | ||||
-rw-r--r-- | theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java | 17 | ||||
-rw-r--r-- | themes/build.xml | 10 |
5 files changed, 20 insertions, 19 deletions
diff --git a/WebContent/VAADIN/themes/base/base.scss b/WebContent/VAADIN/themes/base/base.scss index 514579830d..f22af7670e 100644 --- a/WebContent/VAADIN/themes/base/base.scss +++ b/WebContent/VAADIN/themes/base/base.scss @@ -40,6 +40,10 @@ @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%; diff --git a/build/ide.xml b/build/ide.xml index 5380536e2e..37cd3dd802 100755 --- a/build/ide.xml +++ b/build/ide.xml @@ -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> diff --git a/common.xml b/common.xml index f00d4c8baf..f1245724c4 100644 --- a/common.xml +++ b/common.xml @@ -37,7 +37,10 @@ <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" diff --git a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java b/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java index 3cd08c4abc..dece1691f0 100644 --- a/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java +++ b/theme-compiler/src/com/vaadin/buildhelpers/CompileTheme.java @@ -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 + " (" diff --git a/themes/build.xml b/themes/build.xml index 5bca50e5f5..89c78b11b9 100644 --- a/themes/build.xml +++ b/themes/build.xml @@ -58,7 +58,13 @@ <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" /> |