forked from fkling/floatnotes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
142 lines (125 loc) · 4.38 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="FloatNotes" default="dist" basedir="." xmlns:jsl="antlib:com.googlecode.jslint4java">
<loadfile property="version" srcfile="version.txt" >
<filterchain>
<striplinebreaks/>
</filterchain>
</loadfile>
<property name="src.dir" location="src" />
<property name="build.dir" location="build" />
<property name="tmp.dir" value="tmp"/>
<property name="dist.dir" location="dist" />
<property name="debug.dir" location="debug" />
<property name="cpp.debug" value="0" />
<property name="cpp.testrun" value="0" />
<scriptdef name="generateguid" language="javascript">
<attribute name="property" />
<![CDATA[
importClass( java.util.UUID );
project.setProperty( attributes.get( "property" ), UUID.randomUUID() );
]]>
</scriptdef>
<generateguid property="guid" />
<macrodef name="prepare-cpp">
<attribute name="dest" />
<attribute name="src" />
<sequential>
<copy todir="@{dest}">
<fileset dir="@{src}" />
</copy>
<replaceregexp byline="true" match="^//!#" replace="#">
<fileset dir="@{dest}" />
</replaceregexp>
</sequential>
</macrodef>
<target name="-init">
<tstamp />
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/defaults" />
<mkdir dir="${tmp.dir}" />
</target>
<target name="-copy" depends="-init">
<copy todir="${build.dir}" file="LICENSE" />
<copy todir="${build.dir}/note_content">
<fileset dir="${src.dir}/note_content" />
</copy>
<copy todir="${build.dir}/content">
<fileset dir="${src.dir}/XUL" />
</copy>
<copy todir="${build.dir}/defaults/preferences">
<fileset dir="${src.dir}/preferences/" />
</copy>
<copy todir="${build.dir}/locale">
<fileset dir="locale" />
</copy>
<copy todir="${build.dir}/modules">
<fileset dir="lib" />
</copy>
<copy todir="${build.dir}/components">
<fileset dir="${src.dir}/js/components" />
</copy>
<copy todir="${build.dir}/skin">
<fileset dir="${src.dir}/css" />
<filterset>
<filter token="U" value="${guid}" />
</filterset>
</copy>
<copy todir="${build.dir}/skin">
<fileset dir="images" />
</copy>
<copy todir="${build.dir}" filtering="true">
<fileset dir="META" />
<filterset>
<filter token="VERSION" value="${version}" />
</filterset>
</copy>
</target>
<target name="build" depends="-copy">
<prepare-cpp dest="${tmp.dir}" src="${src.dir}/js"/>
<apply executable="cpp" dir="${tmp.dir}">
<fileset file="${tmp.dir}/main.js" />
<arg value="-P" />
<arg value="-C" />
<arg value="-DDEBUG=${cpp.debug}" />
<arg value="-DTESTRUN=${cpp.testrun}" />
<srcfile />
<arg value="${build.dir}/content/floatnotes.js" />
</apply>
<apply executable="cpp" dest="${build.dir}/modules">
<fileset dir="${tmp.dir}/modules" />
<arg line="-P -C -DDEBUG=${cpp.debug} -DTESTRUN=${cpp.testrun}" />
<srcfile />
<targetfile />
<globmapper from="*.js" to="*.js" />
</apply>
<exec executable="git" outputproperty="date">
<arg line="log -1 --pretty=format:%ad" />
</exec>
<replaceregexp match="@DATE@" replace="${date}" file="${build.dir}/content/floatnotes.js" />
<replaceregexp match="@VERSION@" replace="${version}" file="${build.dir}/content/floatnotes.js" />
<replaceregexp match="@U@" replace="${guid}" file="${build.dir}/modules/util-Css.js" />
</target>
<target name="debug">
<antcall target="build">
<param name="cpp.debug" value="1" />
</antcall>
</target>
<target name="ddist">
<antcall target="build">
<param name="cpp.debug" value="1" />
</antcall>
<mkdir dir="${dist.dir}" />
<zip destfile="${dist.dir}/floatnotes-${version}.xpi" basedir="${build.dir}" excludes="**/.*" />
<delete dir="${tmp.dir}" failonerror="false" />
</target>
<target name="dist" depends="clean,build">
<mkdir dir="${dist.dir}" />
<zip destfile="${dist.dir}/floatnotes-${version}.xpi" basedir="${build.dir}" excludes="**/.*" />
<delete dir="${tmp.dir}" failonerror="false" />
</target>
<target name="clean">
<delete dir="${build.dir}" failonerror="false" />
<delete dir="${dist.dir}" failonerror="false" />
<delete dir="${tmp.dir}" failonerror="false" />
</target>
</project>