-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.xml
118 lines (103 loc) · 3.92 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="QuickInstall Build Script" description="Builds an ZIP package from a git repository" default="all">
<property name="package-vendor" value="phpbb" />
<property name="package-name" value="quickinstall" />
<!--
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
-->
<delete dir="${dir}/.github" />
<delete dir="${dir}/node_modules" />
<delete dir="${dir}/scss" />
<delete dir="${dir}/vendor/twig/twig/doc" />
<delete dir="${dir}/vendor/twig/twig/ext" />
<delete dir="${dir}/vendor/twig/twig/test" />
<delete file="${dir}/vendor/twig/twig/.editorconfig" />
<delete file="${dir}/vendor/twig/twig/.gitignore" />
<delete file="${dir}/vendor/twig/twig/.php_cs.dist" />
<delete file="${dir}/vendor/twig/twig/.travis.yml" />
<delete file="${dir}/vendor/twig/twig/CHANGELOG" />
<delete file="${dir}/vendor/twig/twig/drupal_test.sh" />
<delete file="${dir}/vendor/twig/twig/phpunit.xml.dist" />
<delete file="${dir}/vendor/twig/twig/README.rst" />
<delete file="${dir}/.gitignore" />
<delete file="${dir}/.gitattributes" />
<delete file="${dir}/build.xml" />
<delete file="${dir}/composer.lock" />
<delete file="${dir}/composer.phar" />
<delete file="${dir}/package.json" />
<delete file="${dir}/package-lock.json" />
</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/${package-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>
<!--
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/${package-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 dir="${package-directory}"
command='php -r "\$j = json_decode(file_get_contents(\"composer.json\")); echo (isset(\$j->version) ? \$j->version : \"${version}\");"'
checkreturn="true"
outputProperty='package-version' />
<phingcall target="wrap-package">
<property name="destination-filename" value="${build-directory}/upload/${package-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 (${package-name} ${version})" />
<zip basedir="${build-directory}/package/" destfile="${destination-filename}.zip" />
</target>
</project>