emoji-catalog/build.xml
2022-02-08 23:37:17 +01:00

136 lines
4.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project name="jawira/emoji-catalog" default="help" phingVersion="3">
<defaultexcludes default="true"/><!--Initializing default excludes-->
<defaultexcludes add="**/.idea"/>
<defaultexcludes add="**/.idea/**"/>
<property name="phing.http.proxy" value="${env.http_proxy}"/>
<target name="setup" description="Prepare project for dev" depends="composer:install"/>
<target name="qa" description="Quality assurance" depends="composer:validate,php:lint"/>
<target name="update" description="Update class and catalog" depends="emoji:update,catalog:update,emoji:count"/>
<target name="emoji:update" description="Update Emoji.php"
depends="emoji-list:download,emoji:parse,emoji:build"/>
<target name="catalog:update" description="Update catalog.md"
depends="emoji-list:download,catalog:parse,catalog:build"/>
<target name="composer:validate" description="Validate composer.json">
<composer command="validate">
<arg value="--no-interaction"/>
<arg value="--profile"/>
<arg value="--strict"/>
<arg value="--quiet"/>
</composer>
</target>
<target name="visualizer">
<visualizer/>
</target>
<target name="composer:install" description="Install for dev">
<composer command="install">
<arg value="--quiet"/>
<arg value="--no-suggest"/>
<arg value="--no-interaction"/>
<arg value="--profile"/>
<arg value="--prefer-dist"/>
</composer>
</target>
<target name="emoji-list:download">
<mkdir dir="resources/unicode"/>
<httpget dir="resources/unicode" url="https://unicode.org/emoji/charts/full-emoji-list.html"/>
<httpget dir="resources/unicode" url="https://unicode.org/emoji/charts/full-emoji-modifiers.html"/>
</target>
<target name="emoji:parse">
<mkdir dir="resources/output"/>
<delete file="resources/output/emoji-1.txt"/>
<xslt file="resources/unicode/full-emoji-list.html"
tofile="resources/output/emoji-1.txt"
style="resources/xslt/emoji.xsl"
haltonerror="false"
overwrite="true"
html="true"/>
<delete file="resources/output/emoji-2.txt"/>
<xslt file="resources/unicode/full-emoji-modifiers.html"
tofile="resources/output/emoji-2.txt"
style="resources/xslt/emoji.xsl"
haltonerror="false"
overwrite="true"
html="true"/>
</target>
<target name="emoji:build">
<append file="resources/templates/emoji-header.php.dist" destFile="src/Emoji.php" append="false" overwrite="true"/>
<append file="resources/output/emoji-1.txt" destFile="src/Emoji.php"/>
<append file="resources/output/emoji-2.txt" destFile="src/Emoji.php"/>
<append file="resources/templates/emoji-footer.php.dist" destFile="src/Emoji.php"/>
</target>
<target name="catalog:parse">
<mkdir dir="resources/output"/>
<delete file="resources/output/catalog-1.txt"/>
<xslt file="resources/unicode/full-emoji-list.html"
tofile="resources/output/catalog-1.txt"
style="resources/xslt/catalog.xsl"
haltonerror="false"
overwrite="true"
html="true"/>
<delete file="resources/output/catalog-2.txt"/>
<xslt file="resources/unicode/full-emoji-modifiers.html"
tofile="resources/output/catalog-2.txt"
style="resources/xslt/catalog.xsl"
haltonerror="false"
overwrite="true"
html="true"/>
</target>
<target name="catalog:build">
<append file="resources/templates/catalog-header.md.dist" destFile="docs/catalog.md" append="false"
overwrite="true"/>
<append file="resources/output/catalog-1.txt" destFile="docs/catalog.md"/>
<append file="resources/output/catalog-2.txt" destFile="docs/catalog.md"/>
</target>
<target name="php:lint" description="Check PHP syntax">
<phplint deprecatedAsError="true" haltonfailure="true">
<fileset dir="src">
<include name="**/*.php"/>
</fileset>
</phplint>
</target>
<target name="emoji:count" description="Count constants in Emoji class">
<autoloader autoloaderpath="vendor/autoload.php"/>
<adhoc-task name="emoji-count"><![CDATA[
class EmojiCountTask extends \Phing\Task {
function main() {
$emojiReflection = new ReflectionClass(\Jawira\EmojiCatalog\Emoji::class);
$constants = $emojiReflection->getConstants();
$count = count($constants);
$this->log("Emoji count: $count");
$this->project->setProperty('emoji-count', $count);
}
}
]]></adhoc-task>
<emoji-count/>
</target>
<target name="help">
<uptodate property="uptodate.visualizer" srcfile="build.xml" targetfile="build.png"/>
<runtarget target="visualizer"/>
<open path="build.png"/>
</target>
<target name="visualizer" unless="uptodate.visualizer" description="Create buildfile map">
<visualizer/>
</target>
</project>