-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
143 lines (106 loc) · 5.05 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model xlink:href="/usr/share/php5/PEAR/data/phing/etc/phing-grammar.rng"
type="application/xml"
schematypens="http://relaxng.org/ns/structure/1.0" ?>
<project name="postmatic" default="dist">
<exec command="grep 'Version:' postmatic.php | sed -E 's/^.*Version: (.*)$/\1/'" outputProperty="version" />
<tstamp/>
<property name="tag" value="${version}-${DSTAMP}-${TSTAMP}"/>
<property name="dist_dir" value="./build"/>
<property name="build_dir" value="${dist_dir}/${tag}"/>
<property name="zip_file" value="${phing.project.name}-${version}.zip"/>
<property name="dropbox_dir" value="${env.HOME}/Dropbox/Prompt"/>
<property name="svn_dir" value="/tmp/svn-postmatic"/>
<target name="prepare">
<mkdir dir="${build_dir}" />
</target>
<fileset dir="." id="distribution_files">
<include name="postmatic.php"/>
<include name="readme.txt"/>
<include name="core/**"/>
<include name="admin/**"/>
<include name="interfaces/**"/>
<include name="enums/**"/>
<include name="css/**"/>
<include name="js/**"/>
<include name="media/**"/>
<include name="templates/**"/>
<include name="lang/**"/>
</fileset>
<fileset dir="." id="dependency_files">
<include name="vendor/autoload.php"/>
<include name="vendor/composer/**"/>
<include name="vendor/vernal-creative/**"/>
<include name="vendor/scribu/**"/>
<include name="vendor/calderawp/**"/>
<include name="vendor/salesforce/**"/>
<include name="vendor/freemius/**"/>
<include name="vendor/postmatic/**"/>
<include name="vendor/symfony/**"/>
<exclude name="**/tests/**"/>
<exclude name="**/wp-org-assets/**"/>
</fileset>
<target name="build" depends="prepare">
<append destFile="${build_dir}/version" text="${tag}" />
<copy todir="${build_dir}">
<fileset refid="distribution_files" />
</copy>
<jsmin targetDir="${build_dir}/js" suffix=".min">
<fileset dir="${build_dir}/js">
<include name="**/*.js" />
</fileset>
</jsmin>
<exec command="./vendor/bin/makepot wp-plugin ${build_dir} ${build_dir}/lang/Postmatic.pot" passthru="true" />
<copy todir="${build_dir}">
<fileset refid="dependency_files" />
</copy>
</target>
<target name="dist" depends="build">
<zip destfile="${dist_dir}/${zip_file}" prefix="${phing.project.name}/">
<fileset dir="${build_dir}">
<include name="**" />
<exclude name="." />
</fileset>
</zip>
<echo msg="Completed build ${tag}." />
</target>
<target name="test" depends="build">
<exec command="export PLUGIN_DIR=${build_dir}; ./vendor/bin/phpunit" passthru="true" checkreturn="true" />
</target>
<target name="deploy-wp-assets" depends="build">
<delete dir="${svn_dir}/assets" />
<mkdir dir="${svn_dir}/assets" />
<exec command="svn checkout http://plugins.svn.wordpress.org/postmatic/assets ${svn_dir}/assets" />
<delete>
<fileset dir="${svn_dir}/assets">
<exclude name="*.svn*"/>
</fileset>
</delete>
<copy todir="${svn_dir}/assets">
<fileset dir="wp-org-assets"/>
</copy>
<exec command="svn stat ${svn_dir}/assets | grep '^\?' | awk '{print $2}' | xargs svn add" />
<exec command="svn stat ${svn_dir}/assets | grep '^\!' | awk '{print $2}' | xargs svn rm" />
<exec command="svn commit ${svn_dir}/assets -m 'deploy from build ${env.TRAVIS_BUILD_NUMBER} of ${version}' --no-auth-cache --username '${env.SVN_USER}' --password '${env.SVN_PASSWORD}'" passthru="true" />
</target>
<target name="deploy-wp" depends="deploy-wp-assets">
<delete dir="${svn_dir}/trunk" />
<mkdir dir="${svn_dir}/trunk" />
<exec command="svn checkout http://plugins.svn.wordpress.org/postmatic/trunk ${svn_dir}/trunk" />
<delete>
<fileset dir="${svn_dir}/trunk">
<exclude name="*.svn*"/>
</fileset>
</delete>
<copy todir="${svn_dir}/trunk">
<fileset dir="${build_dir}"/>
</copy>
<exec command="svn stat ${svn_dir}/trunk | grep '^\?' | awk '{print $2}' | xargs svn add" />
<exec command="svn stat ${svn_dir}/trunk | grep '^\!' | awk '{print $2}' | xargs svn rm" />
<exec command="svn commit ${svn_dir}/trunk -m 'deploy ${version}' --no-auth-cache --username '${env.SVN_USER}' --password '${env.SVN_PASSWORD}'" passthru="true" />
<exec command="svn copy http://plugins.svn.wordpress.org/postmatic/trunk http://plugins.svn.wordpress.org/postmatic/tags/${version} -m 'Tagging ${version}' --no-auth-cache --username '${env.SVN_USER}' --password '${env.SVN_PASSWORD}'" passthru="true" />
</target>
<target name="clean">
<delete dir="./build"/>
</target>
</project>