This repository has been archived by the owner on Mar 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
101 lines (87 loc) · 3.76 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
<?xml version="1.0"?>
<!--
Mozilla Extension ANT Build Script
See <http://legege.com> for more information
-->
<project name="searchwp" default="all">
<!-- Include some global extension properties -->
<property file="extension.properties" />
<!-- Define other properties -->
<property name="extension.name" value="${ant.project.name}" />
<property name="src.dir" value="src" />
<property name="target.dir" value="target" />
<property name="target.xpi.dir" value="${target.dir}/${extension.id}" />
<!-- Public Targets -->
<target name="all" description="Execute all" depends="xpi, uninstall, install, run" />
<target name="build" description="Build and install only" depends="xpi, uninstall, install" />
<target name="xpi">
<!-- Copy everything -->
<copy todir="${target.xpi.dir}" preservelastmodified="true" overwrite="true">
<fileset dir="${src.dir}" includes="**/*" />
</copy>
<!-- Replace tokens everything -->
<replace dir="${target.xpi.dir}" encoding="UTF-8">
<replacefilter token="@ID@" value="${extension.id}" />
<replacefilter token="@NAME@" value="${extension.name}" />
<replacefilter token="@VERSION@" value="${extension.version}" />
</replace>
<!-- Create the xpi -->
<zip destfile="${target.dir}/${extension.name}-${extension.version}.xpi">
<fileset dir="${target.xpi.dir}" />
</zip>
<!-- Create the checksum -->
<checksum algorithm="SHA1" file="${target.dir}/${extension.name}-${extension.version}.xpi" />
</target>
<target name="clean" description="Clean the target directory">
<delete dir="${target.dir}" />
</target>
<target name="install" description="Install the extension in the application" depends="profile-env-init" if="profile.exists">
<copy file="${target.dir}/${extension.name}-${extension.version}.xpi" tofile="${install.name}" />
</target>
<target name="uninstall" description="Uninstall the extension in the application" depends="profile-env-init" if="profile.exists">
<delete file="${install.name}" />
</target>
<target name="run" description="Run the application or create the profile" depends="profile-env-init">
<echo level="verbose">Please note: Launching the application only works when it was not already running...</echo>
<exec executable="${mozapp.exec}" spawn="true">
<arg line="-no-remote -p ${mozapp.profile.name}" />
</exec>
</target>
<!-- Private Targets -->
<target name="profile-env-init">
<!-- Include user and os specific properties -->
<condition property="os.family" value="windows">
<os family="windows" />
</condition>
<condition property="os.family" value="unix">
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
<condition property="os.family" value="macosx">
<and>
<os family="mac" />
<os family="unix" />
</and>
</condition>
<loadproperties srcfile="env.properties">
<filterchain>
<containsregex byline="true" pattern="^${user.name}\.${os.family}\.(.*)" replace="\1" />
</filterchain>
</loadproperties>
<echo level="verbose">If this fails, you haven't configured your environment properties in the env.properties file.</echo>
<pathconvert property="profile.dir" pathsep=" ">
<path>
<dirset dir="${mozapp.profiles.dir}">
<include name="*.${mozapp.profile.name}" />
</dirset>
</path>
<identitymapper />
</pathconvert>
<available file="${profile.dir}/prefs.js" property="profile.exists" />
<property name="install.name" value="${profile.dir}/extensions/${extension.id}.xpi" />
</target>
</project>