forked from janodvarko/harviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
144 lines (117 loc) · 5.79 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
142
143
144
<?xml version="1.0" ?>
<!-- Build instruction for HAR Viewer application. In order to build final
distribution, run: $ant build within the root directory and
deploy files located within 'webapp-build' directory -->
<project name="HARViewer" basedir="." default="build">
<!-- OS depeding tasks -->
<condition property="isMac">
<os family="mac" />
</condition>
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isUnix">
<os family="unix" />
</condition>
<!-- Directories -->
<property name="app.dir" value="webapp"/>
<property name="build.dir" value="${app.dir}-build"/>
<property name="examples.dir" value="${app.dir}/examples"/>
<property file="ant.properties"/>
<property name="build.tools.dir" value="build-tools"/>
<!-- Tools for building release package of HAR Viewer.
js-build-tools: http://code.google.com/p/js-build-tools/
js-min (ant task): http://code.google.com/p/jsmin-ant-task/
shrink-safe: http://shrinksafe.dojotoolkit.org/ -->
<property name="jsmin.jar" value="${build.tools.dir}/jsmin/jsmin.0.2.3.jar"/>
<property name="js_build_tools.jar" value="${build.tools.dir}/js-build-tools/lib/js_build_tools.jar"/>
<path id="js-build-tasks.classpath">
<pathelement location="."/>
<fileset dir="${build.tools.dir}/js-build-tools/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- Task definitions -->
<taskdef name="jsmin"
classname="net.matthaynes.jsmin.JSMin_Task"
classpath="${jsmin.jar}"/>
<taskdef name="preprocess"
classname="com.moxiecode.ant.tasks.PreProcessTask"
classpathref="js-build-tasks.classpath"/>
<!-- Remove the previous HAR Viewer build. -->
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<!-- Run RequireJS build tools (depending on the current OS) -->
<target name="requirejs-mac" if="isMac">
<property name="rjs-build.bat" value="../../requirejs/build/buildj.sh"/>
<exec dir="${app.dir}/scripts" executable="${rjs-build.bat}" resolveexecutable="true">
<arg value="app.build.js"/>
</exec>
</target>
<target name="requirejs-win" if="isWindows">
<property name="rjs-build.bat" value="../../requirejs/build/buildj.bat"/>
<exec dir="${app.dir}/scripts" executable="${rjs-build.bat}" resolveexecutable="true">
<arg value="app.build.js"/>
</exec>
</target>
<target name="requirejs-unix" if="isUnix">
<property name="rjs-build.bat" value="../../requirejs/build/buildj.sh"/>
<exec dir="${app.dir}/scripts" executable="${rjs-build.bat}" resolveexecutable="true">
<arg value="app.build.js"/>
</exec>
</target>
<!-- Build HAR Viewer package (the result is within build.dir) -->
<target name="build" depends="clean, requirejs-mac, requirejs-win, requirejs-unix">
<!-- Log info about the current OS -->
<echo message="Building HAR Viewer on:" />
<echo message="os.name = ${os.name}" />
<echo message="os.arch = ${os.arch}" />
<echo message="os.version = ${os.version}" />
<!-- Copy fresh harSchema.js we don't want it to be compressed
its content is displayed in the Schema tab -->
<copy file="${app.dir}/scripts/preview/harSchema.js"
todir="${build.dir}/scripts/preview" overwrite="true"/>
<!-- Copy fresh domplate to the build.dir and compile using jsmin.
The Google's Closure Compliler breaks the domplate code
(by replacing local var names like e.g.: __path__) -->
<copy file="${app.dir}/scripts/domplate/domplate.js"
todir="${build.dir}/scripts/domplate" overwrite="true"/>
<jsmin srcfile="${build.dir}/scripts/domplate/domplate.js" force="true"/>
<!-- Preprocess script/core/trace file to avoid using the console object -->
<preprocess infile="${app.dir}/scripts/core/trace.js"
outfile="${build.dir}/scripts/core/trace.js" defines="_RELEASE" />
<!-- Generate version number. The version info is loaded from 'ant.properties' file. -->
<replace dir="${build.dir}" propertyFile="ant.properties">
<include name="*.php" />
<replacefilter token="@VERSION@" property="VERSION"/>
<replacefilter token="@GOOGLE-ANALYTICS-PROFILE@" property="GOOGLE-ANALYTICS-PROFILE"/>
</replace>
<!-- Final version message -->
<echo message="HAR Viewer version: ${VERSION} build OK"/>
</target>
<!-- Support for generating docs from Firebug source code using js-doc-toolkit
See the output in $svn/jsdoc/out directory -->
<target name="jsdoc" depends="build" description="Generate documentation">
<!-- Directories -->
<property name="jsdoc.dir" value="${build.tools.dir}/jsdoc/"/>
<property name="jsdoc-toolkit.dir" value="${jsdoc.dir}/jsdoc-toolkit-2.3.0/"/>
<property name="jsdoc-output.dir" value="${app.dir}-jsdoc"/>
<delete dir="${jsdoc-output.dir}"/>
<path id="jsdoctoolkit">
<!-- Rhino js.jar 1.7.R2 must be used with jsdoctoolkit-ant-task-1.0.1.jar -->
<fileset dir="${jsdoc.dir}" includes="*.jar"/>
</path>
<taskdef name="jsdoctoolkit"
classpathref="jsdoctoolkit"
classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"/>
<echo message="Generate doc from Firebug source."/>
<!-- Clean the output direcotory -->
<delete dir="${jsdoc-output.dir}"/>
<!-- Parse all source files -->
<jsdoctoolkit jsdochome="${jsdoc-toolkit.dir}"
template="firebug"
outputdir="${jsdoc-output.dir}"
inputdir="." />
</target>
</project>