forked from rapid7/le_js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
127 lines (107 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
119
120
121
122
123
124
125
126
127
<project name="le_js" default="build" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Official Logentries JavaScript client
</description>
<property name="api.version" value="1"/>
<property name="api.endpoint" value="js.logentries.com/v${api.version}"/>
<property name="src" location="src"/>
<property name="lib" location="lib"/>
<property name="ivy.install.version" value="2.1.0-rc2" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<path id="build-classpath" description="The default classpath.">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<target name="download-ivy" unless="offline">
<!-- Let's grab Ivy now if it's not installed -->
<mkdir dir="${ivy.jar.dir}"/>
<get
src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has
not already dropped it into ant's lib dir (note that the
latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may
be empty) and ivy is in at least one of ant's lib dir or the
local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant"
classpathref="ivy.lib.path"/>
</target>
<target name="fetch-deps" depends="init-ivy">
<mkdir dir="${lib}"/>
<!-- Retrieves all dependencies from m2 repo -->
<ivy:retrieve />
</target>
<target name="test" depends="fetch-deps">
<concat destfile="lib/le_test.js">
<filelist dir="deps" files="xhr.js,wru.js"/>
<filelist dir="deps" files="reload-context.js.start"/>
<filelist dir="src" files="le.js"/>
<filelist dir="deps" files="reload-context.js.end"/>
<filelist dir="test" files="suite.js"/>
</concat>
<java classname="org.dynjs.cli.Main" fork="true" failonerror="true">
<classpath>
<pathelement path="${lib}/*"/>
</classpath>
<arg value="lib/le_test.js"/>
</java>
</target>
<target name="build" depends="test">
<taskdef name="jscomp"
classname="com.google.javascript.jscomp.ant.CompileTask"
classpathref="build-classpath"/>
<mkdir dir="build"/>
<copy todir="build">
<fileset dir="src"/>
</copy>
<replace file="build/le.js"
token="localhost:8080/v1"
value="${api.endpoint}"/>
<jscomp compilationLevel="simple" warning="verbose"
debug="false" output="build/le.min.js"
languageIn="ECMASCRIPT5_STRICT">
<externs dir="deps">
<file name="console-extern.js"/>
<file name="umd-extern.js"/>
</externs>
<sources dir="build">
<file name="le.js"/>
</sources>
</jscomp>
</target>
<target name="package" depends="build">
<mkdir dir="product"/>
<copy todir="product">
<fileset dir="build"/>
</copy>
<exec executable="git">
<arg line="submodule init"/>
</exec>
<exec executable="git">
<arg line="submodule update"/>
</exec>
<exec executable="git">
<arg line="submodule foreach git pull origin master"/>
</exec>
<concat destfile="product/le.dyn.js">
<filelist dir="dyn.xhr" files="dyn.xhr.js"/>
<filelist dir="product" files="le.js"/>
</concat>
<!-- Replace the product readme -->
<copy file="deps/template" tofile="product/README.md"/>
</target>
</project>