emoji-catalog/build.xml
2019-10-28 17:37:42 +01:00

145 lines
5.2 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<project name="Emoji catalog" default="diagnostics" 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="diagnostics">
<diagnostics/>
</target>
<target name="setup" description="Prepare project for dev" depends="diagnostics, composer:install, phing:visualizer"/>
<target name="qa" description="Quality assurance" depends="composer:validate, php:lint"/>
<target name="update" description="Update class and catalog" depends="emoji:update, catalog:update"/>
<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"/>
</composer>
</target>
<target name="phing:visualizer">
<visualizer/>
</target>
<target name="composer:install" description="Install for dev">
<composer command="install">
<arg value="--no-suggest"/>
<arg value="--no-interaction"/>
<arg value="--profile"/>
<arg value="--prefer-dist"/>
</composer>
</target>
<target name="git:tag-listing" description="List all git tags">
<!--https://stackoverflow.com/a/34239190/4345061-->
<exec executable="git" passthru="true">
<arg value="log"/>
<arg line="--graph --all --decorate --oneline --simplify-by-decoration"/>
</exec>
</target>
<target name="changelog:links" description="Update links in composer.json">
<composer command="require">
<arg value="symplify/changelog-linker"/>
</composer>
<exec executable="vendor/bin/changelog-linker">
<arg value="link"/>
</exec>
<composer command="remove">
<arg value="symplify/changelog-linker"/>
</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">
<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 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>
</project>