Skip to content

Commit

Permalink
Merge pull request #335 from nschonni/clean-build-logic
Browse files Browse the repository at this point in the history
Clean build logic
  • Loading branch information
LaurentGoderre committed Sep 6, 2012
2 parents 657a4ce + 3f4e094 commit 6d8a1b2
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 300 deletions.
9 changes: 4 additions & 5 deletions build.xml
Expand Up @@ -4,7 +4,7 @@
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>

<target name="default" depends="clean,build" description="Performs a Cleand and Build when calling ant without any target"></target>
<target name="default" depends="clean,build,clean-css" description="Performs a Cleand and Build when calling ant without any target"></target>

<target name="build" depends="">
<echo level="info" message="---Building WET Core Framework---"/>
Expand All @@ -19,7 +19,6 @@
<ant dir="${src.dir}/theme-gcwu-intranet" antfile="build.xml" target="build" inheritAll="false"/>
<echo level="info" message="---Building CLF2 Theme---"/>
<ant dir="${src.dir}/theme-clf2-nsi2" antfile="build.xml" target="build" inheritAll="false"/>
<antcall target="clean-css"/>
</target>

<target name="clean-css">
Expand All @@ -30,18 +29,18 @@
<ant dir="${src.dir}/theme-gcwu-intranet" target="clean-css" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/theme-clf2-nsi2" target="clean-css" antfile="build.xml" inheritAll="false"/>
</target>

<target name="clean">
<ant dir="${src.dir}/base" target="clean" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/grids" target="clean" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/js" target="clean" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/theme-gcwu-fegc" target="clean" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/theme-gcwu-intranet" target="clean" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/theme-clf2-nsi2" target="clean" antfile="build.xml" inheritAll="false"/>
<delete dir="${dist.dir}" />
</target>

<target name="test">
<echo level="info" message="---Running with JSLint---"/>
<echo level="info" message="---Running with JSHint---"/>
<ant dir="${src.dir}/js" target="test" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/theme-gcwu-fegc" target="test" antfile="build.xml" inheritAll="false"/>
<ant dir="${src.dir}/theme-gcwu-intranet" target="test" antfile="build.xml" inheritAll="false"/>
Expand Down
67 changes: 66 additions & 1 deletion build/build-tasks.xml
Expand Up @@ -10,7 +10,11 @@
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath refid="antcontrib.classpath" />
</taskdef>


<target name="-init" depends="-build-jruby">
<mkdir dir="${build.dir}"/>
</target>

<!-- yui-compressor task definition -->
<path id="yui.classpath">
<pathelement location="${yui-compressor.jar}" />
Expand Down Expand Up @@ -98,4 +102,65 @@
<exclude name="**/*.min.js"/>
</jshint>
</target>

<target name="-resolve-css-imports">
<antcall target="-recurse" inheritAll="false">
<param name="file.recurse" value="${file}"/>
<param name="topfile" value="${topfile}"/>
</antcall>
</target>

<target name="-recurse">
<property name="charset_regexp" value="@charset\s*?['&quot;]utf-8['&quot;]\s*?;" />
<property name="url_regexp" value="url\(\s*?['&quot;]\s*?(.*)?['&quot;]\s*?\s*?\)" />
<property name="import_regexp" value="@import\s*?${url_regexp}\s*?;?" />
<fixcrlf file="${file.recurse}"/>
<!-- Removes the charset directive if not in a core file -->
<if>
<not>
<equals arg1="${topfile}" arg2="true"/>
</not>
<then>
<replaceregexp file="${file.recurse}" match="${charset_regexp}" replace=""/>
</then>
</if>

<loadfile property="src" srcfile="${file.recurse}" encoding="utf8"/>
<!--Merge imported stylesheets-->
<for delimiter="${line.separator}" param="currline" list="${src}">
<sequential>
<propertyregex regexp="${import_regexp}" property="import" select="\0" input="@{currline}" global="true" casesensitive="true" override="true"/>
<if>
<isset property="import"/>
<then>
<propertyregex regexp="${import_regexp}" property="import.file.name" select="\1" input="${import}" casesensitive="true" override="true"/>
<dirname property="import.file.root" file="${file.recurse}"/>
<property name="import.file" value="${import.file.root}/${import.file.name}"/>
<antcall target="-resolve-css-imports" inheritAll="false">
<param name="file" value="${import.file}"/>
<param name="topfile" value="false"/>
</antcall>
<loadfile property="imported" srcfile="${import.file}"/>
<replace file="${file.recurse}" token="${import}" value="${imported}"/>
<var name="import.file.root" unset="true"/>
<var name="import.file.name" unset="true"/>
<var name="import.file" unset="true"/>
<var name="imported" unset="true"/>
<var name="import" unset="true"/>
</then>
</if>
</sequential>
</for>
<var name="src" unset="true"/>
<var name="file.recurse" unset="true"/>
</target>

<target name="clean-css">
<delete dir="${src.dir}/css" />
</target>

<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
</project>
2 changes: 1 addition & 1 deletion demos/tabs/tabs-eng.html
Expand Up @@ -264,7 +264,7 @@ <h1 id="wb-cont">Tabbed interface</h1>
Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content.</p>
<div class="clear"></div>
<p><a href="#"><img src="../grids/images/photo.jpg" width="60" height="60" class="image-actual float-left" alt="photo" />X heading</a><br />
Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content.</p>
Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content. Fake content.</p>z
</section></div>
</div>
<ul class="tabs">
Expand Down
11 changes: 1 addition & 10 deletions src/base/build.xml
Expand Up @@ -7,15 +7,6 @@

<target name="default" depends="clean,build" description="Performs a Clean and Build when calling ant without any target"></target>

<target name="build" description="" depends="-init, compile.sass" />

<target name="-init" depends="-build-jruby">
<mkdir dir="${build.dir}"/>
</target>
<target name="build" depends="-init, compile.sass" />

<target name="clean"></target>

<target name="clean-css">
<delete dir="${src.dir}/css" />
</target>
</project>
72 changes: 2 additions & 70 deletions src/grids/build.xml
Expand Up @@ -7,21 +7,14 @@

<target name="default" depends="clean,build" description="Performs a Clean and Build when calling ant without any target"></target>

<target name="build" description="" depends="-init, -minify" />
<target name="build" depends="-init, -minify" />

<target name="-init" depends="-build-jruby">
<mkdir dir="${build.dir}"/>
</target>

<target name="-minify" depends="compile.sass, build-css">
<target name="-minify" depends="compile.sass, -merge-css">
<yui-compressor warn="false" munge="true" preserveAllSemiColons="false" fromDir="${build.dir}/premin" toDir="${build.dir}">
<include name="css/*.*" />
</yui-compressor>
<delete dir="${build.dir}/premin"/>
</target>

<!--Build CSS Tasks -->
<target name="build-css" depends="-merge-css" />

<target name="-merge-css">
<copy todir="${build.dir}/premerge/css">
Expand Down Expand Up @@ -61,65 +54,4 @@
</copy>
<delete dir="${build.dir}/premerge"/>
</target>

<target name="-resolve-css-imports">
<antcall target="-recurse" inheritAll="false">
<param name="file.recurse" value="${file}"/>
<param name="topfile" value="${topfile}"/>
</antcall>
</target>

<target name="-recurse">
<property name="charset_regexp" value="@charset\s*?['&quot;]utf-8['&quot;]\s*?;" />
<property name="url_regexp" value="url\(\s*?['&quot;]\s*?(.*)?['&quot;]\s*?\s*?\)" />
<property name="import_regexp" value="@import\s*?${url_regexp}\s*?;?" />
<fixcrlf file="${file.recurse}"/>
<!-- Removes the charset directive if not in a core file -->
<if>
<not>
<equals arg1="${topfile}" arg2="true"/>
</not>
<then>
<replaceregexp file="${file.recurse}" match="${charset_regexp}" replace=""/>
</then>
</if>

<loadfile property="src" srcfile="${file.recurse}" encoding="utf8"/>
<!--Merge imported stylesheets-->
<for delimiter="${line.separator}" param="currline" list="${src}">
<sequential>
<propertyregex regexp="${import_regexp}" property="import" select="\0" input="@{currline}" global="true" casesensitive="true" override="true"/>
<if>
<isset property="import"/>
<then>
<propertyregex regexp="${import_regexp}" property="import.file.name" select="\1" input="${import}" casesensitive="true" override="true"/>
<dirname property="import.file.root" file="${file.recurse}"/>
<property name="import.file" value="${import.file.root}/${import.file.name}"/>
<antcall target="-resolve-css-imports" inheritAll="false">
<param name="file" value="${import.file}"/>
<param name="topfile" value="false"/>
</antcall>
<loadfile property="imported" srcfile="${import.file}"/>
<replace file="${file.recurse}" token="${import}" value="${imported}"/>
<var name="import.file.root" unset="true"/>
<var name="import.file.name" unset="true"/>
<var name="import.file" unset="true"/>
<var name="imported" unset="true"/>
<var name="import" unset="true"/>
</then>
</if>
</sequential>
</for>
<var name="src" unset="true"/>
<var name="file.recurse" unset="true"/>
</target>

<target name="clean-css">
<delete dir="${src.dir}/css" />
</target>

<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
</project>
10 changes: 2 additions & 8 deletions src/js/build.xml
Expand Up @@ -7,13 +7,9 @@

<target name="default" depends="clean,build" description="Performs a Clean and Build when calling ant without any target"></target>

<target name="build" description="" depends="-init, -minify" />
<target name="build" depends="-init, -minify" />

<target name="-init" depends="-build-jruby"> <!-- Future depends: -can-nodejs-coffeescript -->
<mkdir dir="${build.dir}"/>
</target>

<target name = "-minify" depends="compile.sass, build-js, build-css">
<target name = "-minify" depends="compile.sass, build-js, -base64-encode">
<yui-compressor warn="false" munge="true" preserveAllSemiColons="false" fromDir="${build.dir}/premin" toDir="${build.dir}">
<include name="*.*" />
<include name="i18n/*.*" />
Expand Down Expand Up @@ -70,8 +66,6 @@
</copy>
</target>

<target name="build-css" depends="-base64-encode" />

<!-- Build JS Tasks -->
<target name="-build-pe" depends="-merge-workers">
<concat dest="${build.dir}/premin/pe-ap.js" fixlastline="yes">
Expand Down
2 changes: 1 addition & 1 deletion src/js/pe-ap.js
Expand Up @@ -1455,4 +1455,4 @@
window.pe = $.extend(true, pe, _pe);
return window.pe;
}
(jQuery))._init();
(jQuery))._init();
2 changes: 1 addition & 1 deletion src/js/workers/slideout.js
Expand Up @@ -337,4 +337,4 @@
window.pe = _pe;
return _pe;
}
(jQuery));
(jQuery));
69 changes: 1 addition & 68 deletions src/theme-clf2-nsi2/build.xml
Expand Up @@ -8,12 +8,8 @@
<target name="default" depends="clean,build" description="Performs a Clean and Build when calling ant without any target"></target>

<target name="build" description="" depends="-init, -minify" />

<target name="-init" depends="-build-jruby">
<mkdir dir="${build.dir}"/>
</target>

<target name="-minify" depends="compile.sass, build-css">
<target name="-minify" depends="compile.sass, -base64-encode">
<move todir="${build.dir}/css/premin">
<fileset dir="${build.dir}/css"/>
</move>
Expand All @@ -29,8 +25,6 @@
<delete dir="${build.dir}/css/premin"/>
<delete dir="${build.dir}/js/premin"/>
</target>

<target name="build-css" depends="-base64-encode" />

<!--Build CSS Tasks -->
<target name="-base64-encode" depends="-merge-css">
Expand Down Expand Up @@ -111,67 +105,6 @@
</copy>
<delete dir="${build.dir}/pre"/>
</target>

<target name="-resolve-css-imports">
<antcall target="-recurse" inheritAll="false">
<param name="file.recurse" value="${file}"/>
<param name="topfile" value="${topfile}"/>
</antcall>
</target>

<target name="-recurse">
<property name="charset_regexp" value="@charset\s*?['&quot;]utf-8['&quot;]\s*?;" />
<property name="url_regexp" value="url\(\s*?['&quot;]\s*?(.*)?['&quot;]\s*?\s*?\)" />
<property name="import_regexp" value="@import\s*?${url_regexp}\s*?;?" />
<fixcrlf file="${file.recurse}"/>
<!-- Removes the charset directive if not in a core file -->
<if>
<not>
<equals arg1="${topfile}" arg2="true"/>
</not>
<then>
<replaceregexp file="${file.recurse}" match="${charset_regexp}" replace=""/>
</then>
</if>

<loadfile property="src" srcfile="${file.recurse}" encoding="utf8"/>
<!--Merge imported stylesheets-->
<for delimiter="${line.separator}" param="currline" list="${src}">
<sequential>
<propertyregex regexp="${import_regexp}" property="import" select="\0" input="@{currline}" global="true" casesensitive="true" override="true"/>
<if>
<isset property="import"/>
<then>
<propertyregex regexp="${import_regexp}" property="import.file.name" select="\1" input="${import}" casesensitive="true" override="true"/>
<dirname property="import.file.root" file="${file.recurse}"/>
<property name="import.file" value="${import.file.root}/${import.file.name}"/>
<antcall target="-resolve-css-imports" inheritAll="false">
<param name="file" value="${import.file}"/>
<param name="topfile" value="false"/>
</antcall>
<loadfile property="imported" srcfile="${import.file}"/>
<replace file="${file.recurse}" token="${import}" value="${imported}"/>
<var name="import.file.root" unset="true"/>
<var name="import.file.name" unset="true"/>
<var name="import.file" unset="true"/>
<var name="imported" unset="true"/>
<var name="import" unset="true"/>
</then>
</if>
</sequential>
</for>
<var name="src" unset="true"/>
<var name="file.recurse" unset="true"/>
</target>

<target name="clean-css">
<delete dir="${src.dir}/css" />
</target>

<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>

<target name="test" depends="-jshint"/>
</project>

0 comments on commit 6d8a1b2

Please sign in to comment.