-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
120 lines (106 loc) · 6.26 KB
/
build.xml
File metadata and controls
120 lines (106 loc) · 6.26 KB
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
<?xml version="1.0"?>
<project name="appserver-io-lab/neos-wrapper" default="deploy" basedir=".">
<property environment="env" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/build.default.properties" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="php-src.dir" value="${basedir}/src" />
<property name="php-test.dir" value="${basedir}/tests" />
<property name="php-target.dir" value="${basedir}/target" />
<!-- ==================================================================== -->
<!-- Cleans the directories with the generated source files -->
<!-- ==================================================================== -->
<target name="clean" description="Cleans almost everything, so use carefully.">
<delete dir="${php-target.dir}" includeemptydirs="true" quiet="false" verbose="true" />
</target>
<!-- ==================================================================== -->
<!-- Prepares all the required directories -->
<!-- ==================================================================== -->
<target name="prepare" depends="clean" description="Prepares all the required directories.">
<mkdir dir="${lib.dir}" />
<mkdir dir="${php-target.dir}" />
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the target directory -->
<!-- ==================================================================== -->
<target name="copy" depends="prepare" description="Copies the sources to the target directory.">
<copy todir="${php-target.dir}/${webapp.name}-${neos.version}" preservelastmodified="true" overwrite="true">
<fileset dir="${php-src.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
<!-- ==================================================================== -->
<!-- Copies the sources to the deploy directory -->
<!-- ==================================================================== -->
<target name="deploy" depends="copy" description="Copies the sources to the deploy directory.">
<echo message="Copy sources to ${deploy.dir} ..." />
<copy todir="${deploy.dir}" preservelastmodified="true" overwrite="true">
<fileset dir="${php-target.dir}">
<include name="**/*" />
</fileset>
</copy>
</target>
<!-- ==================================================================== -->
<!-- Check if TYPO3.Neos sources has been downloaded yet -->
<!-- ==================================================================== -->
<target name="check-neos-src-present" description="Check if TYPO3.Neos sources has been downloaded yet.">
<available file="${lib.dir}/neos-sources-${neos.version}.tar.gz" property="neos-src.present"/>
</target>
<!-- ==================================================================== -->
<!-- Get TYPO3.Neos source package by given version number -->
<!-- ==================================================================== -->
<target name="get-neos-src" depends="check-neos-src-present" unless="${neos-src.present}" description="Get TYPO3.Neos source package by given version number.">
<get src="${neos.download.url}" dest="${lib.dir}/neos-sources-${neos.version}.tar.gz"/>
</target>
<!-- ==================================================================== -->
<!-- Prepares the TYPO3.Neos installation -->
<!-- ==================================================================== -->
<target name="prepare-neos-src" depends="copy" description="Prepares the TYPO3.Neos installation.">
<untar src="${basedir}/lib/neos-sources-${neos.version}.tar.gz" dest="${php-target.dir}" compression="gzip" />
</target>
<!-- ==================================================================== -->
<!-- Deletes the Neos instance for testing purpose -->
<!-- ==================================================================== -->
<target name="delete-instance" description="Deletes the Neos instance for testing purposes.">
<echo message="Delete existing sources in ${instance.dir}..." />
<delete dir="${instance.dir}" includeemptydirs="true" quiet="false" verbose="false" failonerror="true" followsymlinks="false" />
<delete dir="${basedir}/instance-src" includeemptydirs="true" quiet="false" verbose="false" failonerror="true" />
</target>
<!-- ==================================================================== -->
<!-- Initializing a Neos instance for testing purpose -->
<!-- ==================================================================== -->
<target name="init-instance" description="Initializing a Neos instance for testing purposes.">
<!-- delete the old instance directory -->
<antcall target="delete-instance" />
<!-- download the TYPO3.Neos sources if necessary -->
<antcall target="get-neos-src"/>
<!-- prepare the Neos sources to prepare the PHAR archive from -->
<antcall target="prepare-neos-src" />
<!-- copy the sources to the instance directory -->
<move todir="${instance.dir}" overwrite="false">
<fileset dir="${php-target.dir}/${webapp.name}-${neos.version}"/>
</move>
<!-- create a symlink to the project folder -->
<exec dir="${basedir}" executable="/bin/ln">
<arg line="-s ${instance.dir} instance-src" />
</exec>
</target>
<!-- ==================================================================== -->
<!-- Creates a PHAR archive for deployment -->
<!-- ==================================================================== -->
<target name="create-phar" description="Creates a PHAR archive for deployment.">
<!-- download the TYPO3.Neos sources if necessary -->
<antcall target="get-neos-src"/>
<!-- prepare the Neos sources to prepare the PHAR archive from -->
<antcall target="prepare-neos-src" />
<!-- install TechDivision_Phar package to create the PHAR archive -->
<exec dir="${php-target.dir}" executable="composer">
<arg line="require techdivision/phar dev-master" />
</exec>
<!-- create the PHAR archive itself from the backup sources -->
<exec dir="${php-target.dir}" executable="vendor/bin/phar">
<arg line="-c create -n ${php-target.dir}/${webapp.name}-${neos.version}.phar -d ${php-target.dir}/${webapp.name}-${neos.version}"/>
</exec>
</target>
</project>