yii2

Форк
1
/
build.xml 
276 строк · 9.4 Кб
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
/**
4
 * Phing build file for Yii 2.
5
 *
6
 * @author Qiang Xue <qiang.xue@gmail.com>
7
 * @link https://www.yiiframework.com/
8
 * @copyright 2008 Yii Software LLC
9
 * @license https://www.yiiframework.com/license/
10
 */
11
-->
12
<project name="yii" basedir="." default="help">
13
  <!-- task definitions -->
14
  <taskdef name="yii-init-build" classname="YiiInitTask" classpath="tasks" />
15
  <!--
16
  <taskdef name="yii-pear" classname="YiiPearTask" classpath="tasks"/>
17
  -->
18

19
  <!-- init yii.version, yii.revision and yii.winbuild -->
20
  <yii-init-build />
21

22
  <!-- these are required external commands -->
23
  <property name="php" value="php" /> <!-- PHP parser -->
24
  <property name="composer" value="composer" /> <!-- composer -->
25
  <property name="pdflatex" value="pdflatex" />  <!-- generates PDF from LaTex -->
26

27
  <property name="pkgname" value="${phing.project.name}-${yii.version}.${yii.revision}"/>
28
  <property name="docname" value="${phing.project.name}-docs-${yii.version}.${yii.revision}"/>
29
  <property name="pearname" value="${phing.project.name}-${yii.release}.tgz" />
30

31
  <!-- directory definitions -->
32
  <property name="build.base.dir" value="release"/>
33
  <property name="build.dist.dir" value="${build.base.dir}/dist"/>
34
  <property name="build.src.dir" value="${build.base.dir}/${pkgname}"/>
35
  <property name="build.pear.src.dir" value="${build.src.dir}/framework" />
36
  <property name="build.doc.dir" value="${build.base.dir}/${docname}"/>
37
  <property name="build.web.dir" value="${build.base.dir}/web"/>
38

39
  <tstamp>
40
    <format property="DATE" pattern="%b %e %Y" />
41
  </tstamp>
42

43
  <if>
44
    <equals arg1="${yii.winbuild}" arg2="true"/>
45
    <then>
46
      <property name="build" value="build"/>
47
    </then>
48
    <else>
49
      <property name="build" value="php build"/>
50
    </else>
51
  </if>
52

53
  <!-- source files in the framework -->
54
  <fileset dir=".." id="framework">
55
    <exclude name="**/.gitignore"/>
56
    <exclude name="**/*.bak"/>
57
    <exclude name="**/*~"/>
58
    <include name="framework/**/*"/>
59
    <include name="requirements/**/*"/>
60
    <include name="demos/**/*"/>
61
    <include name="CHANGELOG"/>
62
    <include name="UPGRADE"/>
63
    <include name="LICENSE"/>
64
    <include name="README"/>
65
  </fileset>
66

67
  <!-- doc files -->
68
  <fileset dir="../docs" id="docs">
69
    <exclude name="**/.gitignore"/>
70
    <exclude name="**/*.bak"/>
71
    <exclude name="**/*~"/>
72
    <include name="guide/**/*"/>
73
    <include name="blog/**/*"/>
74
  </fileset>
75

76
  <fileset dir="../docs/guide" id="docs-guide">
77
    <exclude name="**/.gitignore"/>
78
    <exclude name="**/*.bak"/>
79
    <exclude name="**/*~"/>
80
    <include name="**/*"/>
81
  </fileset>
82

83
  <fileset dir="../docs/blog" id="docs-blog">
84
    <exclude name="**/.gitignore"/>
85
    <exclude name="**/*.bak"/>
86
    <exclude name="**/*~"/>
87
    <include name="**/*"/>
88
  </fileset>
89

90
  <fileset dir="." id="writables">
91
    <include name="${build.src.dir}/**/runtime" />
92
    <include name="${build.src.dir}/**/assets" />
93
    <include name="${build.src.dir}/demos/**/data" />
94
  </fileset>
95

96
  <fileset dir="." id="executables">
97
    <include name="${build.src.dir}/**/yii" />
98
  </fileset>
99

100
  <target name="src" depends="sync">
101
    <echo>Building package ${pkgname}...</echo>
102
    <echo>Copying files to build directory...</echo>
103
    <copy todir="${build.src.dir}">
104
      <fileset refid="framework"/>
105
    </copy>
106

107
    <echo>Changing file permissions...</echo>
108
    <chmod mode="0777">
109
      <fileset refid="writables" />
110
    </chmod>
111
    <chmod mode="0755">
112
      <fileset refid="executables" />
113
    </chmod>
114

115
    <echo>Generating source release file...</echo>
116
    <mkdir dir="${build.dist.dir}" />
117
    <if>
118
      <equals arg1="${yii.winbuild}" arg2="true"/>
119
      <then>
120
        <tar destfile="${build.dist.dir}/${pkgname}.tar.gz" compression="gzip">
121
          <fileset dir="${build.base.dir}">
122
            <include name="${pkgname}/**/*"/>
123
          </fileset>
124
        </tar>
125
      </then>
126
      <else>
127
        <exec command="tar czpf ${pkgname}.tar.gz ${pkgname}" dir="${build.base.dir}"/>
128
        <move file="${build.base.dir}/${pkgname}.tar.gz" todir="${build.dist.dir}" />
129
      </else>
130
    </if>
131
    <zip destfile="${build.dist.dir}/${pkgname}.zip">
132
      <fileset dir="${build.base.dir}">
133
        <include name="${pkgname}/**/*"/>
134
      </fileset>
135
    </zip>
136
  </target>
137

138
  <target name="doc" depends="sync">
139
    <echo>Building documentation...</echo>
140

141
    <echo>Building Guide PDF...</echo>
142
    <exec command="${build} guideLatex" dir="." passthru="true" />
143
    <exec command="${pdflatex} guide.tex -interaction=nonstopmode -max-print-line=120" dir="commands/guide" passthru="true"/>
144
    <exec command="${pdflatex} guide.tex -interaction=nonstopmode -max-print-line=120" dir="commands/guide" passthru="true"/>
145
    <exec command="${pdflatex} guide.tex -interaction=nonstopmode -max-print-line=120" dir="commands/guide" passthru="true"/>
146
    <move file="commands/guide/guide.pdf" tofile="${build.doc.dir}/yii-guide-${yii.version}.pdf" />
147

148
    <echo>Building Blog PDF...</echo>
149
    <exec command="${build} blogLatex" dir="." passthru="true" />
150
    <exec command="${pdflatex} blog.tex -interaction=nonstopmode -max-print-line=120" dir="commands/blog" passthru="true"/>
151
    <exec command="${pdflatex} blog.tex -interaction=nonstopmode -max-print-line=120" dir="commands/blog" passthru="true"/>
152
    <exec command="${pdflatex} blog.tex -interaction=nonstopmode -max-print-line=120" dir="commands/blog" passthru="true"/>
153
    <move file="commands/blog/blog.pdf" tofile="${build.doc.dir}/yii-blog-${yii.version}.pdf" />
154

155
    <echo>Building API...</echo>
156
    <exec command="${build} api ${build.doc.dir}" dir="." passthru="true" />
157

158
    <!--
159
    <echo>Building API CHM...</echo>
160
    <exec command="${hhc} ${build.doc.dir}/api/manual.hhp" />
161
    <move file="${build.doc.dir}/api/manual.chm" tofile="${build.doc.dir}/yii-api-${yii.version}.chm" />
162
    <delete>
163
      <fileset dir="${build.doc.dir}/api">
164
        <include name="manual.*" />
165
      </fileset>
166
    </delete>
167
    -->
168

169
    <echo>Generating doc release file...</echo>
170
    <mkdir dir="${build.dist.dir}" />
171
    <tar destfile="${build.dist.dir}/${docname}.tar.gz" compression="gzip">
172
      <fileset dir="${build.base.dir}">
173
        <include name="${docname}/**/*"/>
174
      </fileset>
175
    </tar>
176
    <zip destfile="${build.dist.dir}/${docname}.zip">
177
      <fileset dir="${build.base.dir}">
178
        <include name="${docname}/**/*"/>
179
      </fileset>
180
    </zip>
181
  </target>
182

183
  <target name="web" depends="sync">
184

185
    <echo>Building online API...</echo>
186
    <mkdir dir="${build.web.dir}/common/data/${yii.version}" />
187
    <exec command="${build} api ${build.web.dir}/common/data/${yii.version} online" dir="." passthru="true" />
188

189
    <echo>Copying tutorials...</echo>
190
    <copy todir="${build.web.dir}/common/data/${yii.version}/tutorials/guide">
191
      <fileset refid="docs-guide"/>
192
    </copy>
193
    <copy todir="${build.web.dir}/common/data/${yii.version}/tutorials/blog">
194
      <fileset refid="docs-blog"/>
195
    </copy>
196

197
	<echo>Copying release text files...</echo>
198
    <mkdir dir="${build.web.dir}/frontend/www/files" />
199
	<copy file="../CHANGELOG" tofile="${build.web.dir}/frontend/www/files/CHANGELOG-${yii.version}.txt" />
200
	<copy file="../UPGRADE" tofile="${build.web.dir}/frontend/www/files/UPGRADE-${yii.version}.txt" />
201

202
	<echo>
203

204
Finished building Web files.
205
Please update yiisite/common/data/versions.php file with the following code:
206

207
    '1.1'=>array(
208
        'version'=>'${yii.version}',
209
        'revision'=>'${yii.revision}',
210
        'date'=>'${yii.date}',
211
        'latest'=>true,
212
    ),
213

214
	</echo>
215
  </target>
216

217
  <target name="sync">
218
    <echo>Synchronizing code changes for ${pkgname}...</echo>
219

220
    <echo>Building autoload map...</echo>
221
    <exec command="${build} autoload" dir="." passthru="true"/>
222

223
    <echo>Building yiilite.php...</echo>
224
    <exec command="${build} lite" dir="." passthru="true"/>
225
  </target>
226

227
  <target name="message">
228
    <echo>Extracting i18n messages...</echo>
229
    <exec command="${build} message ../framework/messages/config.php" dir="." passthru="true"/>
230
  </target>
231

232
  <!--
233
  <target name="pear" depends="clean,build">
234
    <echo>Generating pear package for ${phing.project.name}-${yii.release}</echo>
235
    <mkdir dir="${build.dist.dir}" />
236
    <yii-pear   pkgdir="${build.pear.src.dir}"
237
                channel="pear.php.net"
238
                version="${yii.release}"
239
                state="stable"
240
                category="framework"
241
                package="${phing.project.name}"
242
                summary="Yii PHP Framework"
243
                pkgdescription="Yii PHP Framework: Best for Web 2.0 Development"
244
                notes="https://www.yiiframework.com/files/CHANGELOG-${yii.release}.txt"
245
                license="BSD"
246
                />
247
    <exec command="pear package" dir="${build.pear.src.dir}" passthru="true" />
248
    <move file="${build.pear.src.dir}/${pearname}" tofile="${build.dist.dir}/${pearname}" />
249
  </target>
250
  -->
251

252
  <target name="clean">
253
    <echo>Cleaning up the build...</echo>
254
    <delete dir="${build.base.dir}"/>
255
  </target>
256

257
  <target name="help">
258
    <echo>
259

260
    Welcome to use Yii build script!
261
    --------------------------------
262
    You may use the following command format to build a target:
263

264
              phing   &lt;target name&gt;
265

266
    where &lt;target name&gt; can be one of the following:
267

268
    - sync    : synchronize yiilite.php and BaseYii.php
269
    - message : extract i18n messages of the framework
270
    - src     : build source release
271
    - doc     : build documentation release (Windows only)
272
    - clean   : clean up the build
273

274
    </echo>
275
  </target>
276
</project>
277

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.