Permalink
Browse files

Added rudimentary support for language bundles for rollups of rollups…

… (e.g. datatype_en-US.js, datatype-date_en-US.js, datatype-date-format_en-US.js)
  • Loading branch information...
1 parent 1e6e3fa commit d24c924515f99c4254881cfbff68081873a896ba @sdesai sdesai committed Feb 13, 2010
@@ -6,7 +6,7 @@
<target name="build" depends="buildcore, -rollupjs, buildskins, buildlangs" />
<target name="buildskins" depends="-buildskins, -rollupcss" />
- <target name="buildlangs" depends="-buildlangs" />
+ <target name="buildlangs" depends="-buildlangs, -rolluplangs" />
<!-- CORE -->
<target name="buildcore" depends="builddebug, -createcore, -loggerregex" description="Create component.js">
@@ -57,6 +57,7 @@
<target name="-buildlangs" description="Create language packs in the local component build directory" if="component.langs.exist">
<mkdir dir="${component.builddir}/lang" />
+ <!-- TODO: Break compress/concat out into separate pieces -->
<for list="${component.lang}" param="lang" trim="true">
<sequential>
<addlang dir="${component.lang.base}" module="${component}" lang="@{lang}" dest="${component.builddir}/lang" />
@@ -66,9 +67,28 @@
<addlang dir="${component.lang.base}" module="${component}" lang="" dest="${component.builddir}/lang/" />
<yuicompress src="${component.builddir}/lang/${component}.js" dest="${component.builddir}/lang/${component}-min.js" args="${yuicompressor.js.args.internal}" />
-
+
</target>
+ <target name="-rolluplangs" if="rolluplangs">
+ <for list="${component.lang}" param="lang" trim="true">
+ <sequential>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}_@{lang}.js" append="true" fixlastline="true">
+ <fileset dir="${component.builddir}/lang" includes="*_@{lang}.js" />
+ </concat>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}_@{lang}-min.js" append="true" fixlastline="true">
+ <fileset dir="${component.builddir}/lang" includes="*_@{lang}-min.js" />
+ </concat>
+ </sequential>
+ </for>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}.js" append="true" fixlastline="true">
+ <filelist dir="${component.builddir}/lang" files="${component}.js" />
+ </concat>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}-min.js" append="true" fixlastline="true">
+ <filelist dir="${component.builddir}/lang" files="${component}-min.js" />
+ </concat>
+ </target>
+
<target name="-concatskins" if="component.skins.exist">
<concatsource destfile="${component.builddir}/assets/skins/sam/${component}.css" sourcedir="${component.assets.base}" sourcefiles="${component}-core.css, skins/sam/${component}-skin.css" />
<yuicompress src="${component.builddir}/assets/skins/sam/${component}.css" dest="${component.builddir}/assets/skins/sam/${component}.css" args="${yuicompressor.css.args.internal}" />
@@ -6,7 +6,7 @@
<target name="build" depends="buildmodules" description="Create component.js"></target>
- <target name="buildmodules" depends="-buildmodules, -registerall, -prependall, -appendall, -rollupjs">
+ <target name="buildmodules" depends="-buildmodules, -registerall, -prependall, -appendall, -rollupjs, -rolluplangs">
<fixcrlf srcdir="${component.builddir}" eol="${buildfiles.eol}" />
</target>
@@ -22,14 +22,36 @@
<target name="-rollupjs" if="rollup">
<echo level="info">Rolling up ${component.basefilename}-debug.js into ${rollup.component.basefilename}-debug.js</echo>
- <concat destfile="${rollup.builddir}/${rollup.component.basefilename}.js" append="true" fixlastline="true">
+ <concat destfile="${rollup.builddir}/${rollup.component.basefilename}.js" append="true" fixlastline="true" >
<filelist dir="${component.builddir}" files="${component.basefilename}.js" />
</concat>
<concat destfile="${rollup.builddir}/${rollup.component.basefilename}-debug.js" append="true" fixlastline="true">
<filelist dir="${component.builddir}" files="${component.basefilename}-debug.js" />
</concat>
</target>
+ <target name="-rolluplangs" if="rolluplangs">
+ <echo>${component}</echo>
+ <echo>${component.lang}</echo>
+ <echo>${component.langs.exist}</echo>
+ <for list="${component.lang}" param="lang" trim="true">
+ <sequential>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}_@{lang}.js" append="true" fixlastline="true">
+ <fileset dir="${component.builddir}/lang" includes="*_@{lang}.js" />
+ </concat>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}_@{lang}-min.js" append="true" fixlastline="true">
+ <fileset dir="${component.builddir}/lang" includes="*_@{lang}-min.js" />
+ </concat>
+ </sequential>
+ </for>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}.js" append="true" fixlastline="true">
+ <filelist dir="${component.builddir}/lang" files="${component}.js" />
+ </concat>
+ <concat destfile="${rollup.builddir}/lang/${rollup.component}-min.js" append="true" fixlastline="true">
+ <filelist dir="${component.builddir}/lang" files="${component}-min.js" />
+ </concat>
+ </target>
+
<target name="-prependall" depends="-prependdebug, -prepend" if="component.prependfiles" />
<target name="-appendall" depends="-appenddebug, -append" if="component.appendfiles" />
@@ -139,7 +139,7 @@
</tr>
<tr>
<td class="term">component.lang</td>
- <td>Comma separated list of BCP 47 language codes, specifying the language packs which are available for this module [YUI3 Only].</td>
+ <td>Comma separated list of BCP 47 language tags, specifying the language packs which are available for this module [YUI3 Only].</td>
<td class="default">No Default Value</td>
</tr>
<tr>
@@ -87,9 +87,19 @@
<available file="${component.assets.base}" type="dir" property="component.assets.exist"/>
<condition property="component.langs.exist">
- <isset property="component.lang" />
+ <and>
+ <isset property="component.lang" />
+ <available file="${component.lang.base}" type="dir" />
+ </and>
</condition>
+ <condition property="rolluplangs">
+ <and>
+ <istrue value="${rollup}" />
+ <istrue value="${component.langs.exist}" />
+ </and>
+ </condition>
+
<!--
DEPRECATED: component.basefilename and component.releasetype are deprecated
We used to mark filenames with suffixes (-beta, -experimental), which we no longer do
@@ -52,7 +52,7 @@
</target>
<!-- DEPLOY -->
- <target name="deploy" description="Copy files to global location" depends="deploybuild, deployassets, deployskins, deploydocs"></target>
+ <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}" preservelastmodified="true">
@@ -80,8 +80,8 @@
</copy>
</target>
- <target name="deploylang" description="Copy language bundles to global build location" if="component.langs.exist">
- <copy todir="${global.build.component.assets}/lang" preservelastmodified="true">
+ <target name="deploylang" description="Copy language bundles to global build location">
+ <copy todir="${global.build.component}/lang" preservelastmodified="true" failonerror="false">
<fileset dir="${component.builddir}/lang" includes="*.js" />
</copy>
</target>

0 comments on commit d24c924

Please sign in to comment.