Skip to content

Commit

Permalink
AUI-74 - Improve the gallery exporter
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.liferay.com/repos/public/alloy/trunk@53572 05bdf26c-840f-0410-9ced-eb539d925f36
  • Loading branch information
natecavanaugh committed May 23, 2010
1 parent 95d4121 commit ca71305
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 70 deletions.
138 changes: 72 additions & 66 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,76 @@

<target name="build-skins">
<clean-variables regex="${regex.clean.vars}|component\.cssfiles|component"/>


<antcall target="generate-skin-src" />

<delete dir="${project.dir}/src/${build.aui.prefix}aui-skin-*/build_tmp" />

<subant target="local">
<property name="clean.skip" value="true"/>

<fileset dir="${project.dir}/src">
<include name="${build.aui.prefix}aui-skin-*/build*.xml"/>
</fileset>
</subant>

<!-- Deploy to the build directory -->

<copy todir="${project.dir}/build" overwrite="true">
<fileset dir="${project.dir}/src">
<include name="${build.aui.prefix}aui-skin-*/css/**"/>
<include name="${build.aui.prefix}aui-skin-*/images/**"/>
<include name="${build.aui.prefix}aui-skin-*/build_tmp/**"/>
</fileset>
</copy>

<!-- Move the built files into the CSS directory -->

<for param="dir">
<path>
<dirset
dir="${project.dir}/build"
includes="${build.aui.prefix}aui-skin-*"
/>
</path>
<sequential>
<copy todir="@{dir}/css" overwrite="true">
<fileset dir="@{dir}/build_tmp" includes="*"/>
</copy>
</sequential>
</for>

<delete includeemptydirs="true">
<fileset dir="${project.dir}/build">
<include name="${build.aui.prefix}aui-skin-*/build_tmp/**"/>
<include name="${build.aui.prefix}aui-skin-*/build_tmp"/>
</fileset>
</delete>

<create-module-list/>
</target>

<target name="clean-skin-src">
<for param="dir">
<path>
<dirset
dir="${project.dir}/src"
includes="${build.aui.prefix}aui-skin-*"
excludes="${build.aui.prefix}aui-skin-base"
/>
</path>
<sequential>
<delete includeemptydirs="true">
<fileset dir="@{dir}">
<include name="**/*"/>
<exclude name="_diffs/**"/>
</fileset>
</delete>
</sequential>
</for>
</target>

<target name="generate-skin-src">
<for param="dir">
<path>
<dirset
Expand Down Expand Up @@ -183,71 +252,6 @@

</sequential>
</for>

<delete dir="${project.dir}/src/${build.aui.prefix}aui-skin-*/build_tmp" />

<subant target="local">
<property name="clean.skip" value="true"/>

<fileset dir="${project.dir}/src">
<include name="${build.aui.prefix}aui-skin-*/build*.xml"/>
</fileset>
</subant>

<!-- Deploy to the build directory -->

<copy todir="${project.dir}/build" overwrite="true">
<fileset dir="${project.dir}/src">
<include name="${build.aui.prefix}aui-skin-*/css/**"/>
<include name="${build.aui.prefix}aui-skin-*/images/**"/>
<include name="${build.aui.prefix}aui-skin-*/build_tmp/**"/>
</fileset>
</copy>

<!-- Move the built files into the CSS directory -->

<for param="dir">
<path>
<dirset
dir="${project.dir}/build"
includes="${build.aui.prefix}aui-skin-*"
/>
</path>
<sequential>
<copy todir="@{dir}/css" overwrite="true">
<fileset dir="@{dir}/build_tmp" includes="*"/>
</copy>
</sequential>
</for>

<delete includeemptydirs="true">
<fileset dir="${project.dir}/build">
<include name="${build.aui.prefix}aui-skin-*/build_tmp/**"/>
<include name="${build.aui.prefix}aui-skin-*/build_tmp"/>
</fileset>
</delete>

<create-module-list/>

<!-- Clean up skin src directories -->

<for param="dir">
<path>
<dirset
dir="${project.dir}/src"
includes="${build.aui.prefix}aui-skin-*"
excludes="${build.aui.prefix}aui-skin-base"
/>
</path>
<sequential>
<delete includeemptydirs="true">
<fileset dir="@{dir}">
<include name="**/*"/>
<exclude name="_diffs/**"/>
</fileset>
</delete>
</sequential>
</for>
</target>

<target name="build-yui">
Expand All @@ -268,6 +272,8 @@
<include name="**/*build_rollup_tmp*/**" />
</fileset>
</delete>

<antcall target="clean-skin-src"/>
</target>

<target name="clean-release">
Expand Down
74 changes: 70 additions & 4 deletions resources/gallery/export_alloy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ if [[ ! $fromDir ]]; then
fromDir=$projectDir
fi

rm -rf $toDir
cp -R $fromDir $toDir

find $toDir -type d -name ".svn" | xargs rm -rf
parentDir=`dirname $toDir`

srcDir=${toDir}/src
demosDir=${toDir}/demos
buildDir=${toDir}/build

rm -rf $toDir
cp -R $fromDir $toDir

find $toDir -type d -name ".svn" | xargs rm -rf

find ${toDir} -type f -name "build.xml" | xargs perl -pi -e 's/<property name="build\.aui\.prefix" value=""\/>/<property name="build.aui.prefix" value="gallery-"\/>/g;'

find $demosDir/* -type f -name "*.html" | xargs perl -pi -e 's/<script src="\.\.\/\.\.\/build\/aui\/aui\.js" type="text\/javascript"><\/script>/<script src="..\/..\/build\/yui\/yui.js" type="text\/javascript"><\/script><script src="..\/..\/build\/aui-base\/aui-base.js" type="text\/javascript"><\/script>/g;'

find $srcDir/aui-base -type f -name "build.properties" | xargs perl -pi -e 's/(,widget-css)/$1,aui-skin-base/g;'

find $srcDir/* -type f \( -name "build*.xml" -or -name "build*.properties" \) | xargs perl -pi -e 's/aui-/gallery-aui-/g;'
Expand All @@ -42,9 +46,71 @@ for f in `find $srcDir -name 'aui-*' -or -name 'build.aui-*'` ;
do
cp -R $f ${f//aui-/gallery-aui-}
done

rm -rf `find $srcDir -name 'aui-*' -or -name 'build.aui-*'`
rm -rf `find $buildDir -type d -name 'aui-*'`

#flatten rollups
for f in `find $srcDir -name 'build.gallery-aui-*.properties'` ;
do
newName=${f}
baseName=`basename $newName`
oldDirName=`dirname $newName`
baseModuleName=`basename $oldDirName`

moduleName=${baseName#build.}
moduleName=${moduleName%.properties}

oldModuleDir=$oldDirName
newModuleDir=$srcDir/$moduleName
mkdir -p $newModuleDir/js

mv $oldModuleDir/build.$moduleName.properties $newModuleDir/build.properties
mv $oldModuleDir/build.$moduleName.xml $newModuleDir/build.xml
mv $oldModuleDir/js/$moduleName.js $newModuleDir/js/$moduleName.js

coreCSSFile=assets/${moduleName}-core.css
skinCSSFile=assets/skins/sam/${moduleName}-skin.css

if [[ -f $oldModuleDir/$coreCSSFile ]]; then
mkdir -p $newModuleDir/assets
mv $oldModuleDir/$coreCSSFile $newModuleDir/$coreCSSFile
fi

if [[ -f $oldModuleDir/$skinCSSFile ]]; then
mkdir -p $newModuleDir/assets/skins/sam
mv $oldModuleDir/$skinCSSFile $newModuleDir/$skinCSSFile
fi

perl -pi -e 's/^(srcdir|global\.)/#$1/g;' $newModuleDir/build.properties
perl -pi -e "s/build\.${moduleName}\.properties/build.properties/g;" $newModuleDir/build.xml

touch $oldModuleDir/js/${baseModuleName}.js
perl -pi -e 's/^(srcdir|global\.|component\.rollup)/#$1/g;' $oldModuleDir/build.properties
perl -pi -e "s/^(component=)/component.jsfiles=${baseModuleName}.js\n\$1/g;" $oldModuleDir/build.properties
perl -pi -e "s/^component.use=/component.requires=/g;" $oldModuleDir/build.properties
done

find ${toDir} -type f -name "build.xml" | xargs perl -pi -e 's/<import file="\.\.\/\.\.\/resources\/builder\/bootstrap\.xml" \/>/<import file="\${builddir}\/3.x\/bootstrap.xml" \/>/g;'

find ${toDir} -type f -name "build.properties" | xargs perl -pi -e "s/^(component=)/lint.skip=true\n\$1/"
find ${toDir} -type f -name "build.properties" | xargs perl -pi -e "s/^(component=)/builddir=..\/..\/..\/builder\/componentbuild\n\$1/"
find ${toDir} -type f -name "build.properties" | xargs perl -pi -e "s/^(component=)/yui.variable=A\n\$1/"

#Uncomment the following lines to move the builder to it's default location
#above the project directory
# perl -pi -e 's/<import file="resources\/builder\/bootstrap\.xml"\/>//' ${toDir}/build.xml
#
# if [[ ! -d ${parentDir}/builder ]]; then
# cp -R ${toDir}/lib/builder ${parentDir}/builder
# fi

cd $toDir

ant build-gallery
ant generate-skin-src

if [[ $? = 0 ]]; then
find ${toDir}/src -type d -name "_diffs" | xargs rm -rf
find ${toDir}/src -type f -name "build.all-css.*" | xargs rm
fi

0 comments on commit ca71305

Please sign in to comment.