Skip to content
This repository was archived by the owner on Jan 10, 2020. It is now read-only.

Ticket #34: Builder does not find nodejs, which is already installed. #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 52 additions & 16 deletions componentbuild/shared/macrolib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

<project name="YuiMacroLib">

<!-- ANT contrib library for loops, if/else support, with property fix for FOR task -->
<taskdef resource="antcontrib.properties">
<classpath>
<pathelement location="${builddir}/lib/ant-contrib/ant-contrib-1.0b3-modified.jar" />
</classpath>
</taskdef>

<macrodef name="arrayliteral">
<attribute name="from" />
<attribute name="to" />
Expand Down Expand Up @@ -34,7 +41,7 @@
<arrayliteral from="component.requires" to="component.details.requires" key="requires" />
<arrayliteral from="component.optional" to="component.details.optional" key="optional" />
<arrayliteral from="component.after" to="component.details.after" key="after" />
<arrayliteral from="component.lang" to="component.details.lang" key="lang" />
<arrayliteral from="component.lang" to="component.details.lang" key="lang" />
<if>
<isset property="component.skinnable" />
<then>
Expand Down Expand Up @@ -202,10 +209,10 @@
</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
<!--
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'
-->
Expand All @@ -222,6 +229,35 @@
</sequential>
</macrodef>

<macrodef name="node">
<attribute name="spawn" default="false" />
<attribute name="resultproperty" default="" description="ignored if spawn is true" />
<attribute name="failonerror" default="false" />
<attribute name="failifexecutionfails" default="true" description="ignored if spawn is true" />
<element name="exec-elements" implicit="true" optional="true" />
<sequential>
<if>
<istrue value="@{spawn}" />
<then>
<exec executable="${node.executable}" spawn="true"
failonerror="@{failonerror}"
searchpath="true" resolveexecutable="true">
<env key="PATH" path="${env.PATH}:${node.path}" />
<exec-elements />
</exec>
</then>
<else>
<exec executable="${node.executable}" resultproperty="@{resultproperty}"
failonerror="@{failonerror}" failifexecutionfails="@{failifexecutionfails}"
searchpath="true" resolveexecutable="true">
<env key="PATH" path="${env.PATH}:${node.path}" />
<exec-elements />
</exec>
</else>
</if>
</sequential>
</macrodef>

<macrodef name="registerversion">
<attribute name="module" />
<attribute name="classname" />
Expand All @@ -246,7 +282,7 @@
<attribute name="module" />
<attribute name="dest" />
<attribute name="lang" default="" />
<attribute name="details" default = ""/>
<attribute name="details" default = ""/>

<sequential>
<if>
Expand All @@ -268,7 +304,7 @@
<property name="@{module}@{lang}_fullname" value="@{module}_@{lang}" />
</else>
</if>

<if>
<available file="@{dir}/${@{module}@{lang}_fullname}.pres" />
<then>
Expand Down Expand Up @@ -302,7 +338,7 @@
</sequential>

</macrodef>

<macrodef name="addmodule">
<attribute name="file" />
<attribute name="module" />
Expand Down Expand Up @@ -361,25 +397,25 @@

<macrodef name="addlangrollup">

<attribute name="module" />
<attribute name="module" />
<attribute name="dir" />

<sequential>
<echo level="verbose">Registering rollup info for lang files in @{dir} using YUI.add</echo>

<for list="${component.rollup.lang}" param="lang" trim="true">
<for list="${component.rollup.lang}" param="lang" trim="true">
<sequential>
<loadfile srcfile="@{dir}/@{module}_@{lang}.js" property="@{module}-@{lang}-code" />

<var name="lang.use" value="{use:[" />

<for list="${component.lang.use}" param="submod" trim="true">
<for list="${component.lang.use}" param="submod" trim="true">
<sequential>
<var name="lang.use" value="${lang.use}'lang/@{submod}_@{lang}'," />
</sequential>
</for>

<var name="lang.use" value="${lang.use}]}" />
<var name="lang.use" value="${lang.use}]}" />

<propertyregex property="@{module}-@{lang}-details"
input="${lang.use}"
Expand All @@ -395,13 +431,13 @@
<filter token="DETAILS" value=", ${@{module}-@{lang}-details}"/>
</filterset>
</copy>
</sequential>
</for>
</sequential>
</for>

<loadfile srcfile="@{dir}/@{module}.js" property="@{module}--code" />

<var name="lang.use" value="{use:[" />
<for list="${component.lang.use}" param="submod" trim="true">
<for list="${component.lang.use}" param="submod" trim="true">
<sequential>
<var name="lang.use" value="${lang.use}'lang/@{submod}'," />
</sequential>
Expand Down Expand Up @@ -440,6 +476,6 @@
<echo level="verbose">Adding CSS Registration Code to @{file}</echo>
<concat destfile="@{file}" append="true" fixlastline="true">${@{module}}</concat>
</sequential>
</macrodef>
</macrodef>

</project>
4 changes: 4 additions & 0 deletions componentbuild/shared/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<dirname property="buildfile.dir" file="${ant.file}" />

<property environment="env"/>

<!--
builddir : The path to the builder/componentbuild directory from the component build file
srcdir : The path to top of the project source directory (e.g. yui2) from the component build file
Expand Down Expand Up @@ -179,6 +181,8 @@

<property name="lint.failonerror" value="false"/>

<property name="node.executable" value="node"/>
<property name="node.path" value=""/>
<property name="node.jslint.url" value="http://127.0.0.1:8081/"/>
<property name="yuicompressor.url" value="http://127.0.0.1:${yuicompressor.port}/compress"/>

Expand Down
40 changes: 20 additions & 20 deletions componentbuild/shared/targets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@
<then>
<!-- You can't set failifexecutionfails if spawn is true. Argh. -->
<!-- Check if it's installed first. -->
<exec resultproperty="node.status" executable="node" failonerror="false" failifexecutionfails="false" searchpath="true" resolveexecutable="true">
<node resultproperty="node.status" failifexecutionfails="false">
<arg value="-v"/>
</exec>
</node>
<if>
<equals arg1="${node.status}" arg2="0"/>
<then>
<echo level="info">Spawning Node.js app at: ${src}</echo>
<exec executable="node" spawn="true" failonerror="false" searchpath="true" resolveexecutable="true">
<node spawn="true">
<arg value="${src}"/>
</exec>
</node>
</then>
<else>
<echo level="info">For faster builds, install Node.js.</echo>
Expand All @@ -80,18 +80,18 @@
<!-- MIN -->
<target name="minify" description="Create component-min.js from component.js">
<yuicompress src="${component.builddir}/${component.basefilename}.js" dest="${component.builddir}/${component.basefilename}-min.js" args="${yuicompressor.js.args.internal}" />
<if>
<if>
<available file="${component.builddir}/lang" type="dir" />
<then>
<for param="file">
<path>
<fileset dir="${component.builddir}/lang" includes="*.js"/>
</path>
<sequential>
<yuicompress src="@{file}" dest="@{file}" args="${yuicompressor.js.args.internal}" />
</sequential>
</for>
</then>
<then>
<for param="file">
<path>
<fileset dir="${component.builddir}/lang" includes="*.js"/>
</path>
<sequential>
<yuicompress src="@{file}" dest="@{file}" args="${yuicompressor.js.args.internal}" />
</sequential>
</for>
</then>
</if>
</target>

Expand Down Expand Up @@ -144,7 +144,7 @@
<target name="deployskins" if="skins.exist">
<for param="skin.dir">
<path>
<dirset dir="${component.assets.base}/skins/" includes="*"/>
<dirset dir="${component.assets.base}/skins/" includes="*"/>
</path>
<sequential>
<basename property="skin.name" file="@{skin.dir}"/>
Expand All @@ -156,15 +156,15 @@
<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" />
</sequential>
<var name="skin.name" unset="true" />
</sequential>
</for>
</target>

<target name="deploylang" description="Copy language bundles to global build location">
<if>
<if>
<available file="${component.builddir}/lang" type="dir" />
<then>
<then>
<copy todir="${global.build.component}/lang" overwrite="true" failonerror="false">
<fileset dir="${component.builddir}/lang" includes="*.js" />
</copy>
Expand Down