-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathbuild.xml
141 lines (131 loc) · 6.65 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
<?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="pixel-plugins" basedir="." default="main">
<property file="./build.properties" />
<!-- Fileset for all files -->
<fileset dir="${basedir}" id="sourcedir">
<exclude name=".editorconfig" />
<exclude name=".gitignore" />
<exclude name=".prettierrc" />
<exclude name="package.json" />
<exclude name="package-lock.json" />
<exclude name="phpcs.xml" />
<exclude name="build.properties" />
<exclude name="build.xml" />
<exclude name="README.md" />
<exclude name="vendor/**" />
<exclude name="task/**" />
<exclude name="__tests__/**" />
<exclude name="js/lib/**" />
<exclude name=".githooks/**" />
<exclude name=".github/**" />
</fileset>
<!-- Fileset for files using GuzzleHttp-->
<fileset dir="${buildsourcedir}/vendor/facebook/php-business-sdk" id="files_using_guzzle">
<include name="src/FacebookAds/Object/ServerSide/EventRequestAsync.php" />
<include name="src/FacebookAds/Object/ServerSide/BatchProcessor.php" />
<include name="src/FacebookAds/Object/ServerSide/AsyncClient.php" />
<include name="test/FacebookAdsTest/Object/ServerSide/BatchProcessorTest.php" />
<include name="test/FacebookAdsTest/Object/ServerSide/EventRequestAsyncTest.php" />
<include name="test/FacebookAdsTest/Object/ServerSide/AsyncClientTest.php" />
</fileset>
<!-- ============================================ -->
<!-- Target: Clean -->
<!-- ============================================ -->
<target name="Clean" description="Clean the environment">
<echo msg="Running Prepare..." />
<echo msg="Cleaning build folder..." />
<delete dir="${builddir}" />
<echo msg="Build folder deleted" />
<echo msg="Prepare complete" />
</target>
<!-- ============================================ -->
<!-- Target: Build -->
<!-- ============================================ -->
<target name="Build" description="rebuilds this package" depends="Clean">
<echo msg="Running Build..." />
<echo msg="Copy files into build folder..." />
<copy todir="${buildsourcedir}">
<fileset refid="sourcedir" />
</copy>
<echo msg="Copy complete" />
<echo msg="Run compose install..." />
<composer command="install">
<arg value="--working-dir=${buildsourcedir}" />
<arg value="--no-dev" />
</composer>
<echo msg="composer install complete" />
<echo msg="Deleting files using Guzzle" />
<delete>
<fileset refid="files_using_guzzle" />
</delete>
<echo msg="Files using Guzzle deleted" />
<echo msg="Build complete" />
<echo msg="Adding Version Number..." />
<taskdef name="addversion" classname="FacebookWordpressAddVersionNumberTask" classpath="${taskdir}" />
<addversion path="${facebookforwordpress}" />
<echo msg="Adding version number complete" />
</target>
<!-- ============================================ -->
<!-- Target: Test -->
<!-- ============================================ -->
<!-- <target name="Test" description="Run tests" depends="Clean"> -->
<target name="Test" description="Run tests">
<echo msg="Running Test..." />
<exec executable="./vendor/bin/phpunit" dir="${basedir}" passthru="true">
<arg value="--bootstrap"/>
<arg value="./__tests__/bootstrap.php" />
<arg value="--colors" />
<arg value="${testdir}" />
</exec>
<echo msg="Test complete" />
</target>
<!-- ============================================ -->
<!-- Target: Package -->
<!-- ============================================ -->
<target name="Package" description="Create package" depends="Build">
<echo msg="Running Package..." />
<taskdef name="versionnumbertask" classname="FacebookWordpressGetVersionNumberTask" classpath="${taskdir}" />
<versionnumbertask versionprop="version.number" />
<zip destfile="${builddir}/${packagebasename}-${version.number}.zip">
<fileset dir="${builddir}/" defaultexcludes="true">
<include name="**" />
<exclude name="./test" />
</fileset>
</zip>
<echo msg="Package complete" />
</target>
<!-- ============================================ -->
<!-- Target: Dockerize -->
<!-- ============================================ -->
<target name="Dockerize" description="Dockerize test website" depends="Build">
<echo msg="Composing Docker images for E2E tests..." />
<echo msg="Step1: Creating local docker image for E2E test site..." />
<exec command="docker build -t '${dockerimagename}' ." dir="${testdir}/e2e/site" passthru="true" />
<echo msg="Docker Image Creation complete" />
<echo msg="Step2: Starting up E2E test site... " />
<exec command="docker-compose down --volumes" dir="${testdir}/e2e/site" passthru="false" />
<exec command="docker-compose up -d" dir="${testdir}/e2e" passthru="true" />
<echo msg="Docker Image Creation complete" />
<echo msg="Dockerize complete" />
</target>
<!-- ============================================ -->
<!-- Target: Help -->
<!-- ============================================ -->
<target name="Help" description="Usage help">
<echo msg="Available Targets: " />
<echo msg="Clean : Clean the environment." />
<echo msg="Build : Build the project." />
<echo msg="Test : Run all tests." />
<echo msg="Package: Create plugin package (zip)." />
<echo msg="Dockerize: Create docker images for E2E site and start the containers." />
<echo msg="If you run phing without providing any target, following targets will run in order: Clean, Test, Build, Package." />
</target>
<!-- ============================================ -->
<!-- (DEFAULT) Target: main -->
<!-- ============================================ -->
<target name="main" description="Prepare, Build, Test, Package" depends="Clean, Test, Build, Package">
</target>
</project>