Permalink
Browse files

Changed logs to verbose instead of info, added support for local inst…

…alled jshint CLI tool and only run jslint/hint on raw files by default
  • Loading branch information...
1 parent ae23155 commit 88e1c27c5382bb7e67c6429af1fd98d4925406c0 @davglass committed Apr 3, 2012
Showing with 132 additions and 70 deletions.
  1. +78 −40 componentbuild/shared/macrolib.xml
  2. +54 −30 componentbuild/shared/targets.xml
@@ -104,10 +104,10 @@
<element name="filters" optional="true" description="Additonal filters to apply to individual files"/>
<sequential>
- <echo level="info">Concatenating</echo>
- <echo level="info"> Source Files : @{sourcefiles}</echo>
- <echo level="info"> In Source Dir : @{sourcedir}</echo>
- <echo level="info"> To : @{destfile}</echo>
+ <echo level="verbose">Concatenating</echo>
+ <echo level="verbose"> Source Files : @{sourcefiles}</echo>
+ <echo level="verbose"> In Source Dir : @{sourcedir}</echo>
+ <echo level="verbose"> To : @{destfile}</echo>
<delete dir="@{workingdir}" quiet="true"/>
<copy todir="@{workingdir}">
@@ -134,44 +134,82 @@
<jsfiles />
</pathconvert>
<if>
+ <not>
+ <or>
+ <istrue value="${jshint.online}"/>
+ <istrue value="${jshint.skip}"/>
+ </or>
+ </not>
+ <then>
+ <exec executable="jshint" failifexecutionfails="false" outputproperty="jshint.version">
+ <arg line="--version"/>
+ </exec>
+ </then>
+ </if>
+ <if>
<or>
- <istrue value="${node.online}"/>
- <http url="${node.jslint.url}"/>
+ <isset property="jshint.version"/>
+ <istrue value="${jshint.online}"/>
</or>
<then>
- <property name="node.online" value="true"/>
- <post to="${node.jslint.url}" property="node.jslint.response" failonerror="${lint.failonerror}">
- <prop name="files" value="${jsfileargs}"/>
- <prop name="failonerror" value="${lint.failonerror}"/>
- </post>
- <!-- Since Ant doesn't really failonerror for the post task,
- handle this ourselves: -->
+ <property name="jshint.online" value="true"/>
+ <exec executable="jshint" failifexecutionfails="false" outputproperty="jshint.results" resultproperty="jshint.resultcode" errorproperty="jshint.error" logError="false">
+ <arg line="'${jsfileargs}'"/>
+ </exec>
<if>
- <not>
- <isset property="node.jslint.response"/>
- </not>
+ <equals arg1="${jshint.resultcode}" arg2="1" forcestring="true"/>
<then>
- <fail>JSLint failed. To view lint output and continue the build, run ant with -Dlint.failonerror=false.</fail>
+ <echo>Using JSHint Version: ${jshint.version}</echo>
+ <echo>${jshint.results}</echo>
+ <echo></echo>
</then>
</if>
- <!-- Clear property for next run: -->
- <var name="node.jslint.response" unset="true"/>
</then>
<else>
- <echo>Using Rhino. Install nodejs to improve jslint speed, or skip with -Dlint.skip=true</echo>
- <!--
- Need to find a way to convert fileset to args (script?) to
- avoid ' ', which will break for files with ' in them
-
- Evaluates to the following java execution line...
- java -r js.jar jslintconsole.js 'file1.js' 'file2.js' 'file3.js'
- -->
-
- <java jar="${rhino.jar}" fork="true" failonerror="${jslint.failonerror}">
- <arg file="${jslintconsole.js}" />
- <arg value="${jslintsrc.js}" />
- <arg line="'${jsfileargs}'" />
- </java>
+ <if>
+ <or>
+ <istrue value="${node.online}"/>
+ <http url="${node.jslint.url}"/>
+ </or>
+ <then>
+ <property name="node.online" value="true"/>
+ <post to="${node.jslint.url}" property="node.jslint.response" failonerror="${lint.failonerror}" verbose="false">
+ <prop name="files" value="${jsfileargs}"/>
+ <prop name="failonerror" value="${lint.failonerror}"/>
+ </post>
+ <!-- Since Ant doesn't really failonerror for the post task,
+ handle this ourselves: -->
+ <if>
+ <not>
+ <isset property="node.jslint.response"/>
+ </not>
+ <then>
+ <fail>JSLint failed. To view lint output and continue the build, run ant with -Dlint.failonerror=false.</fail>
+ </then>
+ <else>
+ <echo>${node.jslint.response}</echo>
+ </else>
+ </if>
+ <!-- Clear property for next run: -->
+ <var name="node.jslint.response" unset="true"/>
+ </then>
+ <else>
+ <echo>Using Rhino. Install nodejs to improve jslint speed, or skip with -Dlint.skip=true</echo>
+ <!--
+ Need to find a way to convert fileset to args (script?) to
+ avoid ' ', which will break for files with ' in them
+
+ Evaluates to the following java execution line...
+ java -r js.jar jslintconsole.js 'file1.js' 'file2.js' 'file3.js'
+ -->
+
+ <java jar="${rhino.jar}" fork="true" failonerror="${jslint.failonerror}">
+ <arg file="${jslintconsole.js}" />
+ <arg value="${jslintsrc.js}" />
+ <arg line="'${jsfileargs}'" />
+ </java>
+ </else>
+ </if>
</else>
</if>
</sequential>
@@ -190,7 +228,7 @@
</replacetokens>
</filterchain>
</loadfile>
- <echo level="info">Adding Version Registration Code to @{file}</echo>
+ <echo level="verbose">Adding Version Registration Code to @{file}</echo>
<concat destfile="@{file}" append="true" fixlastline="true">${@{module}-@{classname}-version}</concat>
</sequential>
</macrodef>
@@ -235,11 +273,11 @@
<arg file="@{dir}/${@{module}@{lang}_fullname}.pres" />
<arg file="${component.langbuilddir}/${@{module}@{lang}_fullname}.js" />
</java>
- <echo level="info">Wrapping ${component.langbuilddir}/${@{module}@{lang}_fullname}.js in YUI.add, Y.Intl.add</echo>
+ <echo level="verbose">Wrapping ${component.langbuilddir}/${@{module}@{lang}_fullname}.js in YUI.add, Y.Intl.add</echo>
<loadfile srcfile="${component.langbuilddir}/${@{module}@{lang}_fullname}.js" property="@{module}@{lang}-strs-loaded" encoding="utf-8" />
</then>
<else>
- <echo level="info">Wrapping @{dir}/${@{module}@{lang}_fullname}.js in YUI.add, Y.Intl.add</echo>
+ <echo level="verbose">Wrapping @{dir}/${@{module}@{lang}_fullname}.js in YUI.add, Y.Intl.add</echo>
<loadfile srcfile="@{dir}/${@{module}@{lang}_fullname}.js" property="@{module}@{lang}-strs-loaded" encoding="utf-8" />
</else>
</if>
@@ -274,7 +312,7 @@
</else>
</if>
<loadfile srcfile="@{file}" property="@{module}-@{file}-code" />
- <echo level="info">Wrapping @{file} in YUI.add module</echo>
+ <echo level="verbose">Wrapping @{file} in YUI.add module</echo>
<copy file="${builddir}/files/moduletemplate.txt" tofile="@{file}" overwrite="true">
<filterset>
<filter token="CODE" value="${@{module}-@{file}-code}" />
@@ -302,7 +340,7 @@
</else>
</if>
<loadfile srcfile="@{file}" property="@{module}-@{file}-code" />
- <echo level="info">Adding Rollup @{file} using YUI.add</echo>
+ <echo level="verbose">Adding Rollup @{file} using YUI.add</echo>
<copy file="${builddir}/files/rolluptemplate.txt" tofile="@{file}" overwrite="true">
<filterset>
<filter token="CODE" value="${@{module}-@{file}-code}"/>
@@ -320,7 +358,7 @@
<attribute name="dir" />
<sequential>
- <echo level="info">Registering rollup info for lang files in @{dir} using YUI.add</echo>
+ <echo level="verbose">Registering rollup info for lang files in @{dir} using YUI.add</echo>
<for list="${component.rollup.lang}" param="lang" trim="true">
<sequential>
@@ -392,7 +430,7 @@
</replacetokens>
</filterchain>
</loadfile>
- <echo level="info">Adding CSS Registration Code to @{file}</echo>
+ <echo level="verbose">Adding CSS Registration Code to @{file}</echo>
<concat destfile="@{file}" append="true" fixlastline="true">${@{module}}</concat>
</sequential>
</macrodef>
@@ -4,22 +4,22 @@
<echo level="info">Starting Build For ${component}</echo>
- <echo level="info">Ant Properties</echo>
- <echo level="info"> Home : ${ant.home}</echo>
- <echo level="info"> Ant Version : ${ant.version}</echo>
- <echo level="info"> Build File : ${ant.file}</echo>
- <echo level="info">Local Build Properties</echo>
- <echo level="info"> version : ${yui.version}</echo>
- <echo level="info"> srcdir : ${srcdir}</echo>
- <echo level="info"> builddir : ${builddir}</echo>
- <echo level="info"> component : ${component}</echo>
- <echo level="info"> component.basefilename : ${component.basefilename}</echo>
- <echo level="info"> component.basedir : ${component.basedir}</echo>
- <echo level="info"> component.builddir : ${component.builddir}</echo>
- <echo level="info">Global Build Properties</echo>
- <echo level="info"> global.build.base : ${global.build.base}</echo>
- <echo level="info"> global.build.component : ${global.build.component}</echo>
- <echo level="info"> global.build.component.assets : ${global.build.component.assets}</echo>
+ <echo level="verbose">Ant Properties</echo>
+ <echo level="verbose"> Home : ${ant.home}</echo>
+ <echo level="verbose"> Ant Version : ${ant.version}</echo>
+ <echo level="verbose"> Build File : ${ant.file}</echo>
+ <echo level="verbose">Local Build Properties</echo>
+ <echo level="verbose"> version : ${yui.version}</echo>
+ <echo level="verbose"> srcdir : ${srcdir}</echo>
+ <echo level="verbose"> builddir : ${builddir}</echo>
+ <echo level="verbose"> component : ${component}</echo>
+ <echo level="verbose"> component.basefilename : ${component.basefilename}</echo>
+ <echo level="verbose"> component.basedir : ${component.basedir}</echo>
+ <echo level="verbose"> component.builddir : ${component.builddir}</echo>
+ <echo level="verbose">Global Build Properties</echo>
+ <echo level="verbose"> global.build.base : ${global.build.base}</echo>
+ <echo level="verbose"> global.build.component : ${global.build.component}</echo>
+ <echo level="verbose"> global.build.component.assets : ${global.build.component.assets}</echo>
<dirname property="targets.basedir" file="${ant.file.YuiSharedTargets}"/>
<import file="${targets.basedir}/macrolib.xml" description="Macrodef definitions - jslint, yuicompessor, registerversion" />
@@ -96,28 +96,47 @@
</target>
<target name="lint" description="Run jslint over the local build files (default settings)" unless="lint.skip">
- <jslint>
- <jsfiles>
- <fileset dir="${component.builddir}" includes="*.js" />
- </jsfiles>
- </jslint>
+ <if>
+ <istrue value="${lint.all}" />
+ <then>
+ <!-- Lint all files -->
+ <jslint>
+ <jsfiles>
+ <fileset dir="${component.builddir}" includes="*.js" />
+ </jsfiles>
+ </jslint>
+ </then>
+ <else>
+ <!-- Only lint raw files -->
+ <jslint>
+ <jsfiles>
+ <fileset dir="${component.builddir}" includes="*.js">
+ <none>
+ <filename name="*-debug.js"/>
+ <filename name="*-min.js"/>
+ </none>
+ </fileset>
+ </jsfiles>
+ </jslint>
+ </else>
+ </if>
</target>
<!-- DEPLOY -->
<target name="deploy" description="Copy files to global location" depends="deploybuild, deployassets, deployskins, deploylang, deploydocs"></target>
<target name="deploybuild" description="Copy built files to global build location">
- <copy todir="${global.build.component}" overwrite="true" verbose="true">
+ <copy todir="${global.build.component}" overwrite="true" verbose="false">
<fileset dir="${component.builddir}" includes="*.js" />
</copy>
</target>
<target name="deployassets" if="component.assets.exist">
- <copy todir="${global.build.component.assets}" flatten="${component.assets.flatten}" overwrite="true" verbose="true">
+ <copy todir="${global.build.component.assets}" flatten="${component.assets.flatten}" overwrite="true" verbose="false">
<fileset dir="${component.assets.base}" includes="${component.assets.files}" excludes="skins/, legacy/" />
</copy>
- <copy todir="${global.build.component.assets}" flatten="${component.assets.legacy.flatten}" preservelastmodified="true" failonerror="false" verbose="true">
+ <copy todir="${global.build.component.assets}" flatten="${component.assets.legacy.flatten}" preservelastmodified="true" failonerror="false" verbose="false">
<fileset dir="${component.assets.legacy.base}" includes="${component.assets.legacy.files}" excludes="skins/" />
</copy>
</target>
@@ -129,12 +148,12 @@
</path>
<sequential>
<basename property="skin.name" file="@{skin.dir}"/>
- <echo level="info">Deploying Skin files for @{skin.dir} :: ${skin.name}</echo>
- <copy todir="${global.build.component.assets}/skins/${skin.name}" overwrite="true" verbose="true">
+ <echo level="verbose">Deploying Skin files for @{skin.dir} :: ${skin.name}</echo>
+ <copy todir="${global.build.component.assets}/skins/${skin.name}" overwrite="true" verbose="false">
<fileset dir="${component.builddir}/assets/skins/${skin.name}" includes="${component}.css" />
</copy>
- <copy todir="${global.build.component.assets}/skins/${skin.name}" overwrite="true" verbose="true">
+ <copy todir="${global.build.component.assets}/skins/${skin.name}" overwrite="true" verbose="false">
<fileset dir="${component.assets.skins.base}/${skin.name}" includes="${component.assets.skins.files}" />
</copy>
<var name="skin.name" unset="true" />
@@ -143,9 +162,14 @@
</target>
<target name="deploylang" description="Copy language bundles to global build location">
- <copy todir="${global.build.component}/lang" overwrite="true" failonerror="false" verbose="true">
- <fileset dir="${component.builddir}/lang" includes="*.js" />
- </copy>
+ <if>
+ <available file="${component.builddir}/lang" type="dir" />
+ <then>
+ <copy todir="${global.build.component}/lang" overwrite="true" failonerror="false">
+ <fileset dir="${component.builddir}/lang" includes="*.js" />
+ </copy>
+ </then>
+ </if>
</target>
<target name="deploydocs" description="Copy doc files to global doc locations">

0 comments on commit 88e1c27

Please sign in to comment.