-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.xml
135 lines (118 loc) · 4.95 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Profile Flair Extension Builder" description="Builds an extension.zip from a git repository" default="all">
<property name="vendor-name" value="stevotvr" />
<property name="extension-name" value="groupsub" />
<!--
Only set this to "true" if you have dependencies in the composer.json,
otherwise use "false".
-->
<property name="has-dependencies" value="true" />
<target name="clean-package">
<!--
Remove some unnecessary files/directories
${dir}/ is the folder of your extension, e.g. ext/nickvergessen/newspage/
-->
<delete dir="${dir}/tests" />
<delete dir="${dir}/vendor/bin" />
<delete dir="${dir}/vendor/paypal/paypal-checkout-sdk/samples" />
<delete dir="${dir}/vendor/paypal/paypal-checkout-sdk/tests" />
<delete dir="${dir}/vendor/phing" />
<delete file="${dir}/.gitignore" />
<delete file="${dir}/.gitattributes" />
<delete file="${dir}/.codeclimate.yml" />
<delete file="${dir}/.csslintrc" />
<delete file="${dir}/.editorconfig" />
<delete file="${dir}/.jscsrc" />
<delete file="${dir}/.jshintrc" />
<delete file="${dir}/build.xml" />
<delete file="${dir}/composer.lock" />
<delete file="${dir}/composer.phar" />
<delete file="${dir}/README.md" />
<delete file="${dir}/vendor/paypal/paypal-checkout-sdk/.gitignore" />
<delete file="${dir}/vendor/paypal/paypal-checkout-sdk/composer.phar" />
<delete file="${dir}/vendor/paypal/paypal-checkout-sdk/gen.yml" />
<delete file="${dir}/vendor/paypal/paypal-checkout-sdk/homepage.jpg" />
<delete file="${dir}/vendor/paypal/paypal-checkout-sdk/init" />
<delete file="${dir}/vendor/paypal/paypal-checkout-sdk/phpunit.xml" />
<delete file="${dir}/vendor/paypal/paypal-checkout-sdk/README.md" />
<delete file="${dir}/vendor/paypal/paypalhttp/.gitattributes" />
<delete file="${dir}/vendor/paypal/paypalhttp/.gitignore" />
<delete file="${dir}/vendor/paypal/paypalhttp/.travis.yml" />
<delete file="${dir}/vendor/paypal/paypalhttp/CHANGELOG.md" />
<delete file="${dir}/vendor/paypal/paypalhttp/CONTRIBUTING.md" />
<delete file="${dir}/vendor/paypal/paypalhttp/phpunit.xml" />
<delete file="${dir}/vendor/paypal/paypalhttp/Rakefile" />
<delete file="${dir}/vendor/paypal/paypalhttp/README.md" />
</target>
<!--
DO NOT EDIT BELOW THIS LINE!!!!
-->
<property name="version" value="HEAD" override="true" />
<property name="build-directory" value="build" override="true" />
<property name="package-directory" value="${build-directory}/package/${vendor-name}/${extension-name}" />
<!-- These are the main targets which you will probably want to use -->
<target name="all" depends="prepare-structure,package" />
<!--
Clean up the build directory
-->
<target name="clean">
<delete dir="${build-directory}" />
</target>
<target name="composer">
<exec dir="${build-directory}/../" command="php composer.phar install" passthru="true" />
</target>
<!--
Recreate the necessary folders
-->
<target name="prepare-structure" depends="clean">
<mkdir dir="${build-directory}" />
<mkdir dir="${build-directory}/checkout" />
<mkdir dir="${build-directory}/package" />
<mkdir dir="${build-directory}/package/${vendor-name}" />
<mkdir dir="${build-directory}/package/${vendor-name}/${extension-name}" />
<mkdir dir="${build-directory}/upload" />
</target>
<!--
The real packaging
-->
<target name="package">
<echo msg="Extracting ${version}" />
<phingcall target="git-checkout">
<property name="archive-version" value="${version}" />
</phingcall>
<if>
<equals arg1="${has-dependencies}" arg2="1" />
<then>
<exec dir="${package-directory}" command="php composer.phar install --no-dev"
checkreturn="true" />
</then>
</if>
<phingcall target="clean-package">
<property name="dir" value="${package-directory}" />
</phingcall>
<!-- Try setting the package version property from composer.json -->
<exec executable="php" outputProperty="package-version">
<arg value="-r" />
<arg value="$j = json_decode(file_get_contents('composer.json')); echo (isset($j->version) ? $j->version : '${version}');" />
</exec>
<phingcall target="wrap-package">
<property name="destination-filename" value="${build-directory}/upload/${vendor-name}_${extension-name}_${package-version}" />
</phingcall>
</target>
<!--
Checkout a given version and install/clean the dependencies
-->
<target name="git-checkout">
<echo msg="Getting archive for ${archive-version}" />
<exec command="git archive ${archive-version} --format zip --output ${build-directory}/checkout/${archive-version}.zip"
checkreturn="true" />
<unzip file="${build-directory}/checkout/${archive-version}.zip" todir="${package-directory}" />
</target>
<!--
Create the zip and tar ball
-->
<target name="wrap-package">
<echo msg="Creating archives (${vendor-name}/${extension-name} ${version})" />
<zip basedir="${build-directory}/package/" destfile="${destination-filename}.zip" />
</target>
</project>