forked from rapid7/le_js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
118 lines (101 loc) · 3.7 KB
/
Copy pathbuild.xml
File metadata and controls
118 lines (101 loc) · 3.7 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
<project name="le_js" default="build" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Official Logentries JavaScript client
</description>
<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="wru.js,xhr.js"/>
<filelist dir="src" files="le.js"/>
<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>
<!-- The closure compiler task doesn't behave well with
Ivy, so in the interim we explicitly define our
classpath dependencies here.
-->
<path id="compiler-cp">
<pathelement path="${lib}/closure-compiler-v20130603.jar"/>
<pathelement path="${lib}/guava-14.0.1.jar"/>
<pathelement path="${lib}/args4j-2.0.16.jar"/>
<pathelement path="${lib}/jackson-core-asl-1.9.9.jar"/>
<pathelement path="${lib}/json-20090211.jar"/>
</path>
<target name="build" depends="test">
<taskdef name="jscomp"
classname="com.google.javascript.jscomp.ant.CompileTask"
classpathref="compiler-cp"/>
<mkdir dir="build"/>
<copy todir="build">
<fileset dir="src"/>
</copy>
<replace file="build/le.js">
<replacefilter>
<replacetoken>localhost:8080</replacetoken>
<replacevalue>js.logentries.com</replacevalue>
</replacefilter>
</replace>
<jscomp compilationLevel="simple" warning="verbose"
debug="false" output="build/le.min.js"
languageIn="ECMASCRIPT5_STRICT">
<externs dir="deps">
<file name="console-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>
</target>
</project>