This repository has been archived by the owner on Jul 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
119 lines (113 loc) · 3.74 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?xml version="1.0" encoding="UTF-8"?>
<project name="yetanothersocial" default="dev_head" basedir=".">
<!-- Project properties -->
<property name="repo.dir" value="." />
<property name="version" value="2.0.0" />
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd" />
</tstamp>
<macrodef name="git">
<attribute name="command" />
<attribute name="dir" default="" />
<element name="args" optional="true" />
<sequential>
<exec executable="git" dir="@{dir}">
<arg value="@{command}" />
<args/>
</exec>
</sequential>
</macrodef>
<!-- Build a package for testing -->
<target name="dev_head" description="Builds test packages based on the development head" depends="rebuild-packages,build-temp">
<echo message="Deleting old master build" />
<delete includeemptydirs="true">
<fileset dir=".">
<include name="plg_content_yetanothersocial_master.zip" />
</fileset>
</delete>
<echo message="Build package" />
<zip destfile="plg_content_yetanothersocial_master.zip">
<fileset dir="packages">
<include name="**" />
</fileset>
</zip>
</target>
<!-- Build a package for release -->
<target name="release" description="Builds a release package" depends="rebuild-packages,build-temp">
<echo message="Build package" />
<zip destfile="releases/plg_content_yetanothersocial_${version}.zip">
<fileset dir="packages">
<include name="**" />
</fileset>
</zip>
<echo message="Committing version" />
<git command="commit">
<args>
<arg value="-am 'Prepare ${version} release'" />
</args>
</git>
<echo message="Creating Git tag" />
<git command="tag">
<args>
<arg value="${version}" />
</args>
</git>
<echo message="Pushing Version commit and tag to GitHub" />
<git command="push">
</git>
<git command="push">
<args>
<arg value="--tags" />
</args>
</git>
</target>
<!-- Copy files to staging to allow for manipulation pre-package -->
<target name="build-temp" description="Stages the files" depends="rebuild-packages">
<echo message="Create temp folder" />
<mkdir dir="packages" />
<echo message="Copy files" />
<copy todir="packages/language">
<fileset dir="language" />
</copy>
<copy todir="packages/media">
<fileset dir="media" />
</copy>
<copy todir="packages/tmpl">
<fileset dir="tmpl" />
</copy>
<copy todir="packages">
<fileset dir=".">
<include name="script.php" />
<include name="yetanothersocial.php" />
<include name="yetanothersocial.xml" />
</fileset>
</copy>
<replace file="packages/yetanothersocial.xml" token="##DATE##" value="${build.date}" />
<replace file="packages/yetanothersocial.xml" token="##VERSION##" value="${version}" />
</target>
<target name="rebuild-packages" description="Delete old packages">
<echo message="Deleting packages dir" />
<delete dir="${repo.dir}/packages" includeemptydirs="true" failonerror="true" />
<echo message="Creating packages dir" />
<mkdir dir="packages" />
</target>
<!-- Check code style based on Joomla Coding Standard -->
<target name="phpcs" description="Generate codestyle report using PHP_CodeSniffer">
<echo message="Remove previous codestyle report" />
<delete quiet="yes" includeemptydirs="true">
<fileset dir=".">
<include name="build/logs/checkstyle.xml" />
</fileset>
</delete>
<echo message="Running phpcs with Joomla! Coding Standard" />
<exec executable="phpcs">
<arg value="--report=checkstyle" />
<arg value="--extensions=php" />
<arg value="-p" />
<arg value="--report-file=${repo.dir}/build/logs/checkstyle.xml" />
<arg value="--standard=${repo.dir}/build/phpcs/Joomla" />
<arg value="--ignore=${repo.dir}/packages,${repo.dir}/releases,${repo.dir}/tmpl" />
<arg path="${repo.dir}" />
</exec>
</target>
</project>