OSDN Git Service

Remove mix platform build script.
[tortoisegit/TortoiseGitJp.git] / Languages / LanguagePack.build
1 <?xml version="1.0"?>\r
2 <!--\r
3 ============================================================ \r
4  $Date: 2008-11-08 01:10:56 +0800 (Sat, 08 Nov 2008) $\r
5  $Author: steveking $\r
6  $Rev: 14529 $\r
7 ============================================================ \r
8 \r
9 NAnt build script for the TortoiseSVN language pack installers\r
10 \r
11 -->\r
12 \r
13 <project name="LanguagePack" default="all" basepath=".">\r
14         <description>\r
15                 Builds the Language pack installers\r
16         </description>\r
17         \r
18         <include buildfile="../default.build.user" if="${file::exists('../default.build.user')}"/>\r
19 \r
20         <property name="SpellCheckDir" \r
21                 value="..\..\Common\Spell\"\r
22                 unless="${property::exists('SpellCheckDir')}"\r
23         />\r
24 \r
25         <target name="clean">\r
26                 <description>\r
27                         Removes all previously built language pack installers.\r
28                 </description>\r
29                 <if test="${cleanup == 'yes'}">\r
30                         <delete>\r
31                                 <fileset>\r
32                                         <include name="..\bin\Tortoise*.dll" />\r
33                                         <include name="..\bin\LanguagePack_*-${platform}-*.msi" />\r
34                                 </fileset>\r
35                         </delete>\r
36                 </if>\r
37         </target>\r
38 \r
39         <target name="createecho2">\r
40                 <script language="C#" prefix="tsvn">\r
41                         <imports>\r
42                                 <import namespace="System.Globalization" />\r
43                                 <import namespace="System.Xml" />\r
44                                 <import namespace="NAnt.Core.Attributes" />\r
45                                 <import namespace="NAnt.Core.Util" />\r
46                                 <import namespace="NAnt.Core.Tasks" />\r
47                         </imports>\r
48                         <code>\r
49                                 <![CDATA[\r
50                                         /* Based on EchoTask.cs NAnt 0.85-rc4 */\r
51                                         /* Includes support for different Encoding, if none is set, it uses ANSI (Default) */\r
52 \r
53                                         [TaskName("echo2")]\r
54                                         public class Echo2Task : Task \r
55                                         {\r
56                                                 #region Private Instance Fields\r
57 \r
58                                                 private string _message;\r
59                                                 private string _contents;\r
60                                                 private FileInfo _file;\r
61                                                 private bool _append = false;\r
62                                                 private Level _messageLevel = Level.Info;\r
63                                                 private Encoding _encoding;\r
64 \r
65                                                 #endregion Private Instance Fields\r
66 \r
67                                                 #region Public Instance Properties\r
68 \r
69                                                 [TaskAttribute("message")]\r
70                                                 public string Message \r
71                                                 {\r
72                                                         get { return _message; }\r
73                                                         set \r
74                                                         {\r
75                                                                 if (!StringUtils.IsNullOrEmpty(value)) \r
76                                                                 {\r
77                                                                         if (!StringUtils.IsNullOrEmpty(Contents)) \r
78                                                                         {\r
79                                                                                 throw new ValidationException("Inline content and the message attribute are mutually exclusive in the <echo> task.", Location);\r
80                                                                         } \r
81                                                                         else \r
82                                                                         {\r
83                                                                                 _message = value;\r
84                                                                         }\r
85                                                                 } \r
86                                                                 else \r
87                                                                 {\r
88                                                                         _message = null; \r
89                                                                 }\r
90                                                         }\r
91                                                 }\r
92 \r
93                                                 public string Contents \r
94                                                 {\r
95                                                         get { return _contents; }\r
96                                                         set \r
97                                                         { \r
98                                                                 if (!StringUtils.IsNullOrEmpty(value)) \r
99                                                                 {\r
100                                                                         if (!StringUtils.IsNullOrEmpty(Message)) \r
101                                                                         {\r
102                                                                                 throw new ValidationException("Inline content and the message attribute are mutually exclusive in the <echo> task.", Location);\r
103                                                                         } \r
104                                                                         else \r
105                                                                         {\r
106                                                                                 _contents = value;\r
107                                                                         }\r
108                                                                 } \r
109                                                                 else \r
110                                                                 {\r
111                                                                         _contents = null;\r
112                                                                 }\r
113                                                         }\r
114                                                 }\r
115 \r
116                                                 [TaskAttribute("file")]\r
117                                                 public FileInfo File \r
118                                                 {\r
119                                                         get { return _file; }\r
120                                                         set { _file = value; }\r
121                                                 }\r
122 \r
123                                                 [TaskAttribute("append")]\r
124                                                 public bool Append \r
125                                                 {\r
126                                                         get { return _append; }\r
127                                                         set { _append = value; }\r
128                                                 }\r
129 \r
130                                                 [TaskAttribute("level")]\r
131                                                 public Level MessageLevel \r
132                                                 {\r
133                                                         get { return _messageLevel; }\r
134                                                         set \r
135                                                         {\r
136                                                                 if (!Enum.IsDefined(typeof(Level), value)) \r
137                                                                 {\r
138                                                                         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "An invalid level {0} was specified.", value)); \r
139                                                                 } \r
140                                                                 else \r
141                                                                 {\r
142                                                                         this._messageLevel = value;\r
143                                                                 }\r
144                                                         }\r
145                                                 }\r
146 \r
147                                                 [TaskAttribute("encoding")]\r
148                                                 public Encoding Encoding \r
149                                                 {\r
150                                                         get { return _encoding; }\r
151                                                         set { _encoding = value; }\r
152                                                 }\r
153 \r
154                                                 #endregion Public Instance Properties\r
155 \r
156                                                 #region Override implementation of Task\r
157 \r
158                                                 protected override void ExecuteTask() \r
159                                                 {\r
160                                                         if (File != null) \r
161                                                         { // output to file\r
162                                                                 try \r
163                                                                 {\r
164                                                                         // ensure the output directory exists\r
165                                                                         if (!File.Directory.Exists) \r
166                                                                         {\r
167                                                                                 File.Directory.Create();\r
168                                                                                 File.Directory.Refresh();\r
169                                                                         }\r
170 \r
171                                                                         // determine character encoding to use\r
172                                                                         Encoding encoding = (Encoding != null) ? Encoding : Encoding.Default;\r
173                                                                         // write the message to the file\r
174                                                                         using (StreamWriter writer = new StreamWriter(File.FullName, Append, encoding)) \r
175                                                                         {\r
176                                                                                 if (!StringUtils.IsNullOrEmpty(Message)) \r
177                                                                                 {\r
178                                                                                         writer.WriteLine(Message);\r
179                                                                                 } \r
180                                                                                 else if (!StringUtils.IsNullOrEmpty(Contents)) \r
181                                                                                 {\r
182                                                                                         writer.WriteLine(Contents);\r
183                                                                                 } \r
184                                                                                 else \r
185                                                                                 {\r
186                                                                                         writer.WriteLine();\r
187                                                                                 }\r
188                                                                         }\r
189                                                                 } \r
190                                                                 catch (Exception ex) \r
191                                                                 {\r
192                                                                         throw new BuildException(string.Format(CultureInfo.InvariantCulture,\r
193                                                                                 "Failed to write message to file '{0}'.", File.FullName), \r
194                                                                                 Location, ex);\r
195                                                                 }\r
196                                                         } \r
197                                                         else \r
198                                                         { // output to build log\r
199                                                                 if (!StringUtils.IsNullOrEmpty(Message)) \r
200                                                                 {\r
201                                                                         Log(MessageLevel, Message);\r
202                                                                 } \r
203                                                                 else if (!StringUtils.IsNullOrEmpty(Contents)) \r
204                                                                 {\r
205                                                                         Log(MessageLevel, Contents);\r
206                                                                 } \r
207                                                                 else \r
208                                                                 {\r
209                                                                         Log(MessageLevel, string.Empty);\r
210                                                                 }\r
211                                                         }\r
212                                                 }\r
213 \r
214                                                 protected override void InitializeTask(XmlNode taskNode) \r
215                                                 {\r
216                                                         Contents = Project.ExpandProperties(taskNode.InnerText, Location);\r
217                                                 }\r
218 \r
219                                                 #endregion Override implementation of Task\r
220                                         }\r
221                                 ]]>\r
222                         </code>\r
223                 </script>\r
224         </target>\r
225         \r
226         <target name="all" depends="clean">\r
227                 <description>\r
228                         Builds the installers.\r
229                 </description>\r
230                 <call target="createecho2" />\r
231 \r
232                 <if test="${platform == 'x64'}">\r
233                         <setenv>\r
234                                 <variable name="Platform" value="x64" />\r
235                         </setenv>\r
236                 </if>\r
237                 <if test="${platform != 'x64'}">\r
238                         <setenv>\r
239                                 <variable name="Platform" value="win32" />\r
240                         </setenv>\r
241                 </if>\r
242 \r
243                 <loadfile file="Languages.txt" property="languagelines" encoding="utf-8"/>\r
244                 <!-- the next line is split in two because we need the newline in the string -->\r
245                 <foreach item="String" in="${languagelines}" delim="\r
246 " property="langline">\r
247                         <call target="doit" unless="${string::starts-with(langline, '#') or string::get-length(langline)==0}" failonerror="false"/>\r
248                 </foreach>\r
249         </target>\r
250         \r
251         <target name="doit">\r
252                 <property name="platformfolder" value="${configuration}${bindirextension}" />\r
253 \r
254                 <property name="ResTextFileName" value="..\bin\release${bindirextension}\bin\restext.exe" />\r
255                 <property name="ResTextFileName" value="..\bin\release\bin\restext.exe" if="${crosscompile == 'yes'}" />\r
256 \r
257                 <regex \r
258                         pattern="^(?'langISO'[A-z_]+);[ \t]+(?'langCC'\d+);[ \t]+(?'langhelpfile'\d+);[ \t]+(?'langUI'.+);[ \t]+(?'langweb'.+);[ \t]+(?'langnative'.+)" \r
259                         input="${langline}"\r
260                 />\r
261                 <echo message="Building ${langweb} dlls and installer" />\r
262 \r
263                 <!-- create the dlls -->\r
264                 <exec program="${ResTextFileName}" failonerror="false">\r
265                         <arg value="apply" />\r
266                         <arg value="..\bin\${platformfolder}\bin\TortoiseProcLang.dll" />\r
267                         <arg value="..\bin\TortoiseProc${langCC}.dll" />\r
268                         <arg value="Tortoise_${langISO}.po" />\r
269                 </exec>\r
270                 <exec program="${ResTextFileName}" failonerror="false">\r
271                         <arg value="apply" />\r
272                         <arg value="..\bin\${platformfolder}\bin\TortoiseMergeLang.dll" />\r
273                         <arg value="..\bin\TortoiseMerge${langCC}.dll" />\r
274                         <arg value="Tortoise_${langISO}.po" />\r
275                 </exec>\r
276                 <exec program="${ResTextFileName}" failonerror="false">\r
277                         <arg value="apply" />\r
278                         <arg value="..\bin\${platformfolder}\bin\TortoiseBlameLang.dll" />\r
279                         <arg value="..\bin\TortoiseBlame${langCC}.dll" />\r
280                         <arg value="Tortoise_${langISO}.po" />\r
281                 </exec>\r
282                 <exec program="${ResTextFileName}" failonerror="false">\r
283                         <arg value="apply" />\r
284                         <arg value="..\bin\${platformfolder}\bin\TortoiseIDiffLang.dll" />\r
285                         <arg value="..\bin\TortoiseIDiff${langCC}.dll" />\r
286                         <arg value="Tortoise_${langISO}.po" />\r
287                 </exec>\r
288 \r
289                 <!-- create the mo files -->\r
290                 <property name="PoFileName" value="..\ext\Subversion\Subversion\po\${langISO}.po" />\r
291                 <exec program="msgfmt" if="${file::exists(PoFileName)}" failonerror="false" >\r
292                         <arg value="..\ext\Subversion\Subversion\po\${langISO}.po" />\r
293                         <arg value="-o" />\r
294                         <arg value="subversion.mo" />\r
295                 </exec>\r
296                 \r
297                 <!--\r
298                 Build the <Files></Files> parts for the spell checker files and thesauri.\r
299                 -->\r
300                 <property name="SpellCheckFiles" value="" />\r
301                 <foreach item="File" property="filename">\r
302                         <in>\r
303                                 <items>\r
304                                         <include name="${SpellCheckDir}${langISO}*.*" />\r
305                                 </items>\r
306                         </in>\r
307                         <do>\r
308                                 <property name="SpellCheckFiles" value="&lt;File Id='${path::get-file-name(filename)}' Name='${path::get-file-name(filename)}' DiskId='1' Source='${filename}' Vital='no'&gt;&lt;/File&gt;${SpellCheckFiles}" />\r
309                                 <echo message="${filename}" />\r
310                         </do>\r
311                 </foreach> \r
312                 \r
313                 <!-- create the files for the installer -->             \r
314                 <if test="${environment::variable-exists('MajorVersion')}">\r
315                         <loadfile file="LanguagePack.wxs" property="versionwxsfile" encoding="utf-8" >\r
316                                 <filterchain>\r
317                                         <replacetokens begintoken="$" endtoken="$">\r
318                                                 <token key="MajorVersion" value="${environment::get-variable('MajorVersion')}" />\r
319                                                 <token key="MinorVersion" value="${environment::get-variable('MinorVersion')}" />\r
320                                                 <token key="MicroVersion" value="${environment::get-variable('Microversion')}" />\r
321                                                 <token key="WCREV" value="${environment::get-variable('WCREV')}" />\r
322                                                 <token key="DEVRELEASE" value="${devrelease}" />\r
323                                                 <token key="PLATFORM" value="${platform}" />\r
324                                                 <token key="LANGUI" value="${langUI}" />\r
325                                                 <token key="COUNTRYCODE" value="${langISO}" />\r
326                                                 <token key="COUNTRYID" value="${langCC}" />\r
327                                                 <token key="LANGNATIVE" value="${langnative}" />\r
328                                                 <token key="SPELLCHECKFILES" value="${SpellCheckFiles}" />\r
329                                         </replacetokens>\r
330                                 </filterchain>\r
331                         </loadfile>\r
332                         <echo2 file="LanguagePack_${langISO}.wxs" message="${versionwxsfile}" encoding="utf-8" />\r
333                 </if>\r
334                 \r
335                 <setenv>\r
336                         <variable name="TSVNHelpFile" value=" " />\r
337                         <variable name="TMergeHelpFile" value=" " />\r
338                         <variable name="TSVNMoFile" value=" " />\r
339                 </setenv>\r
340 \r
341                 <if test="${file::exists('subversion.mo')}">\r
342                         <setenv>\r
343                                 <variable name="TSVNMoFile" value="${langISO}" />\r
344                         </setenv>\r
345                 </if>\r
346 \r
347                 <property name="chmFileName" value="..\doc\output\TortoiseSVN_${langISO}.chm" />\r
348                 <setenv if="${file::exists(chmFileName)}">\r
349                         <variable name="TSVNHelpFile" value="${langISO}" />\r
350                 </setenv>\r
351 \r
352                 <property name="chmFileName" value="..\doc\output\TortoiseMerge_${langISO}.chm" />\r
353                 <setenv if="${file::exists(chmFileName)}">\r
354                         <variable name="TMergeHelpFile" value="${langISO}" />\r
355                 </setenv>\r
356 \r
357                 <property name="verstring" value="${environment::get-variable('MajorVersion')}.${environment::get-variable('MinorVersion')}.${environment::get-variable('MicroVersion')}.${environment::get-variable('WCREV')}" />\r
358                 \r
359                 <exec program="candle">\r
360                         <arg value="-nologo" />\r
361                         <arg value="-out" />\r
362                         <arg value="..\bin\" />\r
363                         <arg value="LanguagePack_${langISO}.wxs" />\r
364                         <arg value="WixUI_LanguagePacks.wxs" />\r
365                 </exec>\r
366                 <exec program="light">\r
367                         <arg value="-nologo" />\r
368                         <arg value="-sw1008" />\r
369                         <arg value="-sice:ICE82" />\r
370                         <arg value="-sval" if="${platform == 'x64'}" />\r
371                         <arg value="-out" />\r
372                         <arg value="..\bin\LanguagePack_${verstring}${devrelease}-${platform}-${langISO}.msi" />\r
373                         <arg value="..\bin\LanguagePack_${langISO}.wixobj" />\r
374                         <arg value="..\bin\WixUI_LanguagePacks.wixobj" />\r
375                         <arg value="-ext" />\r
376                         <arg value="WixUIExtension" />\r
377                         <arg value="-cultures:en-us" />\r
378                 </exec>\r
379                 <delete>\r
380                         <fileset>\r
381                                 <include name="..\bin\*.wixobj" />\r
382                                 <include name="..\bin\*.wixpdb" />\r
383                         </fileset>\r
384                 </delete>\r
385 \r
386                 <delete file="LanguagePack_${langISO}.wxs" failonerror="false" />\r
387                 <delete file="..\bin\TortoiseProc${langCC}.dll" failonerror="false" />\r
388                 <delete file="..\bin\TortoiseMerge${langCC}.dll" failonerror="false" />\r
389                 <delete file="..\bin\TortoiseBlame${langCC}.dll" failonerror="false" />\r
390                 <delete file="..\bin\TortoiseIDiff${langCC}.dll" failonerror="false" />\r
391                 <delete file="subversion.mo" failonerror="false" />\r
392         </target>\r
393 </project>\r
394 \r
395 \r
396 \r
397 \r
398 \r
399 \r
400 \r
401 \r
402 \r
403 \r
404 \r
405 \r
406 \r
407 \r
408 \r