This repository was archived by the owner on Aug 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
executable file
·93 lines (82 loc) · 4.51 KB
/
build.xml
File metadata and controls
executable file
·93 lines (82 loc) · 4.51 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
<?xml version="1.0" ?>
<project name="Tagiris" default="buildNewVersion">
<property name="src.dir" value="code" />
<property name="dist.dir" value="dist" />
<property name="dist.loc" location="dist" />
<property name="ext.name.lower" value="tagiris" />
<property name="ext.prefname" value="Tagiris" />
<target name="_getVersionFromPref">
<loadfile srcFile="${src.dir}/defaults/preferences/${ext.name.lower}.js" property="installVersion">
<filterchain>
<linecontains>
<contains value="extensions.${ext.prefname}.installVersion" />
</linecontains>
<striplinebreaks />
<!-- filtering like this is a bit dirty -->
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="tokenchar" name="begintoken" value="p" />
<param type="tokenchar" name="endtoken" value="," />
<param type="token" name="ref("extensions.${ext.prefname}.installVersion"" value="" />
</filterreader>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="tokenchar" name="begintoken" value=" " />
<param type="tokenchar" name="endtoken" value=""" />
<param type="token" name="" value="" />
</filterreader>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="tokenchar" name="begintoken" value=""" />
<param type="tokenchar" name="endtoken" value=";" />
<param type="token" name=")" value="" />
</filterreader>
</filterchain>
</loadfile>
</target>
<target name="_setVersionInRDF" depends="_getVersionFromPref">
<replaceregexp file="${src.dir}/install.rdf" match="em:version="[\x00-\x7f]+?"" replace="em:version="${installVersion}"" />
<replaceregexp file="${dist.dir}/update.rdf" match="em:version>[\x00-\x7f]+?<" replace="em:version>${installVersion}<" />
</target>
<target name="_makeXPI" depends="_setVersionInRDF">
<fail message="Version ${installVersion} has already been built! You have to delete ${ext.name.lower}_${installVersion}.xpi and ${ext.name.lower}_${installVersion}_moz.xpi manually if you want to rebuilt this version.">
<condition>
<and>
<available file="${dist.dir}/${ext.name.lower}_${installVersion}.xpi" />
<available file="${dist.dir}/${ext.name.lower}_${installVersion}_moz.xpi" />
</and>
</condition>
</fail>
<condition property="fileExt" value="_moz" else="">
<isset property="moz" />
</condition>
<zip destfile="${dist.dir}/${ext.name.lower}_${installVersion}${fileExt}.xpi">
<fileset dir="${src.dir}">
<exclude name="**/.DS_Store" />
<include name="chrome/content/**" />
<include name="chrome/locale/**" />
<include name="chrome/skin/**" />
<include name="components/**" />
<include name="defaults/**" />
<include name="modules/**" />
<include name="install.rdf" />
<include name="chrome.manifest" />
<exclude name="**/.*" />
</fileset>
</zip>
</target>
<target name="_moveXPI" depends="_makeXPI">
<copy file="${dist.dir}/${ext.name.lower}_${installVersion}.xpi" tofile="${dist.dir}/${ext.name.lower}.xpi" overwrite="yes" />
</target>
<target name="_buildExtSelfHosted" depends="_moveXPI" />
<target name="_buildExtForMozilla">
<copy file="${src.dir}/install.rdf" tofile="${src.dir}/install.rdf.safe" overwrite="yes" />
<replaceregexp file="${src.dir}/install.rdf" match="[\s]*em:updateURL=.*"" replace="" />
<antcall target="_makeXPI">
<param name="moz" value="yes" />
</antcall>
<copy file="${src.dir}/install.rdf.safe" tofile="${src.dir}/install.rdf" overwrite="yes" />
<delete file="${src.dir}/install.rdf.safe" />
</target>
<target name="buildNewVersion">
<antcall target="_buildExtSelfHosted" />
<antcall target="_buildExtForMozilla" />
</target>
</project>