602
|
1 |
#!perl
|
|
2 |
# Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
# which accompanies this distribution, and is available
|
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
#
|
|
9 |
# Initial Contributors:
|
|
10 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
#
|
|
16 |
#
|
|
17 |
|
|
18 |
use strict;
|
|
19 |
use CGI qw(:standard);
|
|
20 |
use FindBin;
|
|
21 |
use lib "$FindBin::Bin";
|
|
22 |
use Utils;
|
|
23 |
use Cwd;
|
|
24 |
use File::Basename;
|
|
25 |
use Pod::Html;
|
|
26 |
use Getopt::Long;
|
|
27 |
|
|
28 |
$|++;
|
|
29 |
|
|
30 |
#
|
|
31 |
# Constants.
|
|
32 |
#
|
|
33 |
|
|
34 |
my $KDocDir = "..\\doc";
|
|
35 |
my @intro = ({fileName => "HistoricPerspective",
|
|
36 |
caption => "Historic Perspective",
|
|
37 |
comment => ""},
|
|
38 |
# {fileName => "Environment",
|
|
39 |
# caption => "Licensee Product Environment",
|
|
40 |
# comment => ""},
|
|
41 |
{fileName => "QuickStart",
|
|
42 |
caption => "Quick Start",
|
|
43 |
comment => ""},
|
|
44 |
{fileName => "MakingReleases",
|
|
45 |
caption => "Making Releases",
|
|
46 |
comment => ""},
|
|
47 |
{fileName => "Installation",
|
|
48 |
caption => "Installation Guide",
|
|
49 |
comment => ""},
|
|
50 |
{fileName => "ExportingReleases",
|
|
51 |
caption => "Exporting and Importing Releases",
|
|
52 |
comment => ""},
|
|
53 |
{fileName => "FurtherInformation",
|
|
54 |
caption => "Further Information",
|
|
55 |
comment => ""},
|
|
56 |
{fileName => "Optimisation",
|
|
57 |
caption => "Optimisation",
|
|
58 |
comment => ""},
|
|
59 |
{fileName => "FAQ",
|
|
60 |
caption => "Frequently Asked Questions",
|
|
61 |
comment => ""});
|
|
62 |
my @commands = ({fileName => "BinInfo"},
|
|
63 |
{fileName => "BuildRel"},
|
|
64 |
{fileName => "CleanEnv"},
|
|
65 |
{fileName => "CleanLocalArch"},
|
|
66 |
{fileName => "CleanRemote"},
|
|
67 |
{fileName => "CopyRel"},
|
|
68 |
{fileName => "DeltaEnv"},
|
|
69 |
{fileName => "DiffEnv"},
|
|
70 |
{fileName => "DiffRel"},
|
|
71 |
{fileName => "EnvInfo"},
|
|
72 |
{fileName => "ExportEnv"},
|
|
73 |
{fileName => "ExportRel"},
|
|
74 |
{fileName => "EnvMembership"},
|
|
75 |
{fileName => "EnvSize"},
|
|
76 |
{fileName => "GetEnv"},
|
|
77 |
{fileName => "GetRel"},
|
|
78 |
{fileName => "GetSource"},
|
|
79 |
{fileName => "ImportEnv"},
|
|
80 |
{fileName => "ImportRel"},
|
|
81 |
{fileName => "InstallSnapShot"},
|
|
82 |
{fileName => "LatestVer"},
|
|
83 |
{fileName => "ListComponents"},
|
|
84 |
{fileName => "MakeEnv"},
|
|
85 |
{fileName => "MakeRel"},
|
|
86 |
{fileName => "MakeSnapShot"},
|
|
87 |
{fileName => "ModNotes"},
|
|
88 |
{fileName => "MrpComplexity"},
|
|
89 |
{fileName => "RemoveRel"},
|
|
90 |
{fileName => "RemoveSource"},
|
|
91 |
{fileName => "SourceInfo"},
|
|
92 |
{fileName => "PrepEnv"},
|
|
93 |
{fileName => "PrepRel"},
|
|
94 |
{fileName => "PullEnv"},
|
|
95 |
{fileName => "PushEnv"},
|
|
96 |
{fileName => "PullRel"},
|
|
97 |
{fileName => "PushRel"},
|
|
98 |
{fileName => "ValidateEnv"},
|
|
99 |
{fileName => "ValidateRel"},
|
|
100 |
{fileName => "ViewNotes"});
|
|
101 |
|
|
102 |
my @utils =({fileName => "BldDocs"},
|
|
103 |
{fileName => "CheckBc"},
|
|
104 |
{fileName => "CheckRls"},
|
|
105 |
{fileName => "InstCol2"},
|
|
106 |
{fileName => "MBld"},
|
|
107 |
{fileName => "MergeEnvironments"});
|
|
108 |
|
|
109 |
my @modules =({fileName => "CatData.pm"},
|
|
110 |
{fileName => "CheckBc.pm"},
|
|
111 |
{fileName => "CleanEnv.pm"},
|
|
112 |
{fileName => "Cleaner.pm"},
|
|
113 |
{fileName => "CommandController.pm"},
|
|
114 |
{fileName => "CopyRel.pm"},
|
|
115 |
{fileName => "Crypt.pm"},
|
|
116 |
{fileName => "Crypt/GPG.pm"},
|
|
117 |
{fileName => "Crypt/PGP.pm"},
|
|
118 |
{fileName => "EnvDb.pm"},
|
|
119 |
{fileName => "EnvDifferencer.pm"},
|
|
120 |
{fileName => "ExportData.pm"},
|
|
121 |
{fileName => "GetEnv.pm"},
|
|
122 |
{fileName => "IniData.pm"},
|
|
123 |
{fileName => "MakeRel.pm"},
|
|
124 |
{fileName => "MrpData.pm"},
|
|
125 |
{fileName => "NotesCompiler.pm"},
|
|
126 |
{fileName => "PathData.pm"},
|
|
127 |
{fileName => "PathData/ComponentBased.pm"},
|
|
128 |
{fileName => "PathData/ProjectBased.pm"},
|
|
129 |
{fileName => "PrepRel.pm"},
|
|
130 |
{fileName => "RelData.pm"},
|
|
131 |
{fileName => "RelTransfer.pm"},
|
|
132 |
{fileName => "RelTransfer/Export.pm"},
|
|
133 |
{fileName => "RelTransfer/Import.pm"},
|
|
134 |
{fileName => "RemoteSite.pm"},
|
|
135 |
{fileName => "RemoteSite/FTP.pm"},
|
|
136 |
{fileName => "RemoteSite/FTP/Proxy.pm"},
|
|
137 |
{fileName => "RemoteSite/NetDrive.pm"},
|
|
138 |
{fileName => "RemoteSite/NetDrive/MultiVolumeExport.pm"},
|
|
139 |
{fileName => "RemoteSite/NetDrive/MultiVolumeImport.pm"},
|
|
140 |
{fileName => "Symbian/CBR/ApplyDelta.pm"},
|
|
141 |
{fileName => "Symbian/CBR/CreateDelta.pm"},
|
|
142 |
{fileName => "TableFormatter.pm"},
|
|
143 |
{fileName => "TableFormatter/Text.pm"},
|
|
144 |
{fileName => "TableFormatter/Excel.pm"},
|
|
145 |
{fileName => "TableFormatter/Csv.pm"},
|
|
146 |
{fileName => "TableFormatter/Html.pm"},
|
|
147 |
{fileName => "TableFormatter/Auto.pm"},
|
|
148 |
{fileName => "Utils.pm"}
|
|
149 |
);
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
#
|
|
154 |
# Globals.
|
|
155 |
#
|
|
156 |
|
|
157 |
my $docDir;
|
|
158 |
my $devDocs = 0;
|
|
159 |
my $verbose = 0;
|
|
160 |
|
|
161 |
#
|
|
162 |
# Main.
|
|
163 |
#
|
|
164 |
|
|
165 |
ProcessCommandLine();
|
|
166 |
my $cwd = cwd;
|
|
167 |
my $toolsdir = $FindBin::Bin;
|
|
168 |
chdir $toolsdir or die "Error: Couldn't chdir to \"$toolsdir\": $!\n";
|
|
169 |
ReadCaptions(\@commands);
|
|
170 |
ReadCaptions(\@utils);
|
|
171 |
ReadCaptions(\@modules);
|
|
172 |
chdir $cwd or die "Error: Couldn't chdir to \"cwd\": $!\n";;
|
|
173 |
Utils::MakeDir($docDir);
|
|
174 |
chdir $docDir or die "Error: Couldn't chdir to \"$docDir\": $!\n";;
|
|
175 |
BldIndex();
|
|
176 |
BldDocs();
|
|
177 |
chdir $cwd or die "Error: Couldn't chdir to \"cwd\": $!\n";;
|
|
178 |
|
|
179 |
|
|
180 |
#
|
|
181 |
# Subs.
|
|
182 |
#
|
|
183 |
|
|
184 |
sub ProcessCommandLine {
|
|
185 |
Getopt::Long::Configure ("bundling");
|
|
186 |
my $help;
|
|
187 |
GetOptions('h' => \$help, 'd' => \$devDocs, 'v+' => \$verbose);
|
|
188 |
|
|
189 |
$docDir = shift @ARGV || $KDocDir;
|
|
190 |
|
|
191 |
unless (scalar(@ARGV) == 0) {
|
|
192 |
print "Error: Invalid arguments\n";
|
|
193 |
Usage(1);
|
|
194 |
}
|
|
195 |
|
|
196 |
if ($help) {
|
|
197 |
Usage(0);
|
|
198 |
}
|
|
199 |
}
|
|
200 |
|
|
201 |
sub Usage {
|
|
202 |
my $exitCode = shift;
|
|
203 |
|
|
204 |
Utils::PrintDeathMessage($exitCode, "\nUsage: blddocs [<documentation_directory>]
|
|
205 |
|
|
206 |
options:
|
|
207 |
|
|
208 |
-h help
|
|
209 |
-d generate additional documentation relevent to development of the tools
|
|
210 |
-v verbose output (-vv very verbose)\n");
|
|
211 |
}
|
|
212 |
|
|
213 |
sub BldIndex {
|
|
214 |
print "Generating index.html...\n";
|
|
215 |
|
|
216 |
open INDEX, ">index.html" or die "Couldn't open index.html for writing: $!\n";
|
|
217 |
$CGI::NO_DEBUG = 1;
|
|
218 |
$CGI::NO_DEBUG = 1;
|
|
219 |
my $cgi = new CGI;
|
|
220 |
print INDEX $cgi->start_html("LPD Release Tools Documentation");
|
|
221 |
print INDEX $cgi->h1("LPD Release Tools Documentation");
|
|
222 |
my $version = Utils::ToolsVersion();
|
|
223 |
print INDEX $cgi->h3("Version $version\n");
|
|
224 |
|
|
225 |
AddSection("Introduction", \@intro, *INDEX, $cgi);
|
|
226 |
AddSection("Command reference", \@commands, *INDEX, $cgi);
|
|
227 |
AddSection("Utilities", \@utils, *INDEX, $cgi);
|
|
228 |
AddSection("Implementation notes", \@modules, *INDEX, $cgi) if ($devDocs);
|
|
229 |
|
|
230 |
print INDEX $cgi->hr;
|
|
231 |
print INDEX $cgi->end_html();
|
|
232 |
close INDEX;
|
|
233 |
}
|
|
234 |
|
|
235 |
sub ReadCaptions {
|
|
236 |
my $list = shift;
|
|
237 |
foreach my $module (@$list) {
|
|
238 |
open (FILE, $module->{fileName}) or die "Error: Couldn't open $module->{fileName} for reading: $!\n";
|
|
239 |
|
|
240 |
# Search through file for name section.
|
|
241 |
while (<FILE>) {
|
|
242 |
if (/^=head1 NAME/) {
|
|
243 |
last;
|
|
244 |
}
|
|
245 |
}
|
|
246 |
|
|
247 |
# Read name section.
|
|
248 |
while (<FILE>) {
|
|
249 |
unless (/^\s*$/) {
|
|
250 |
(my $caption, my $comment) = split (/ - /, $_, 2);
|
|
251 |
die unless defined $caption and defined $comment;
|
|
252 |
$module->{caption} = $caption;
|
|
253 |
$module->{comment} = " - $comment";
|
|
254 |
last;
|
|
255 |
}
|
|
256 |
}
|
|
257 |
|
|
258 |
unless (exists $module->{caption}) {
|
|
259 |
$module->{caption} = "";
|
|
260 |
$module->{comment} = "";
|
|
261 |
}
|
|
262 |
|
|
263 |
close (FILE);
|
|
264 |
}
|
|
265 |
}
|
|
266 |
|
|
267 |
sub AddSection {
|
|
268 |
my $heading = shift;
|
|
269 |
my $list = shift;
|
|
270 |
local *INDEX = shift;
|
|
271 |
my $cgi = shift;
|
|
272 |
|
|
273 |
print INDEX $cgi->hr;
|
|
274 |
print INDEX $cgi->h2($heading);
|
|
275 |
foreach my $module (@$list) {
|
|
276 |
print INDEX $cgi->a({ -href => "$module->{fileName}.html" }, $module->{caption}), $module->{comment};
|
|
277 |
print INDEX $cgi->p("");
|
|
278 |
}
|
|
279 |
}
|
|
280 |
|
|
281 |
sub BldDocs {
|
|
282 |
BldList(\@intro);
|
|
283 |
BldList(\@commands);
|
|
284 |
BldList(\@utils);
|
|
285 |
BldList(\@modules) if ($devDocs);
|
|
286 |
}
|
|
287 |
|
|
288 |
sub BldList {
|
|
289 |
my $listRef = shift;
|
|
290 |
|
|
291 |
foreach my $item (@$listRef) {
|
|
292 |
my $itemMTime = Utils::FileModifiedTime("$toolsdir\\$item->{fileName}");
|
|
293 |
if ($itemMTime == 0 or not -e "$item->{fileName}.html" or $itemMTime > Utils::FileModifiedTime("$item->{fileName}.html")) {
|
|
294 |
my $dirName = dirname($item->{fileName});
|
|
295 |
unless (-e $dirName) {
|
|
296 |
eval {Utils::MakeDir($dirName)};
|
|
297 |
if ($@) {
|
|
298 |
die "Error: Couldn't make directory $docDir/$dirName : $@\n";
|
|
299 |
}
|
|
300 |
}
|
|
301 |
print "Generating $item->{fileName}.html...\n";
|
|
302 |
pod2html("--infile=$toolsdir\\$item->{fileName}", "--outfile=$item->{fileName}.html", "--title=$item->{fileName}");
|
|
303 |
}
|
|
304 |
}
|
|
305 |
}
|
|
306 |
|
|
307 |
|
|
308 |
=head1 NAME
|
|
309 |
|
|
310 |
BldDocs - Builds this HTML documentation set from the POD in the Perl sources.
|
|
311 |
|
|
312 |
=head1 SYNOPSIS
|
|
313 |
|
|
314 |
blddocs [<documentation_directory>]
|
|
315 |
|
|
316 |
options:
|
|
317 |
|
|
318 |
-h help
|
|
319 |
-d generate additional documentation relevent to development of the tools
|
|
320 |
-v verbose output (-vv very verbose)
|
|
321 |
|
|
322 |
=head1 DESCRIPTION
|
|
323 |
|
|
324 |
Invokes C<pod2html> on each source file, and puts all the generated documentation files into a F<doc> directory. On subsequent calls only generates new html for source files that have been modified. Also generates the file F<doc\index.html> which contains a set of links to the other documentation files.
|
|
325 |
|
|
326 |
=head1 KNOWN BUGS
|
|
327 |
|
|
328 |
None.
|
|
329 |
|
|
330 |
=head1 COPYRIGHT
|
|
331 |
|
|
332 |
Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
333 |
All rights reserved.
|
|
334 |
This component and the accompanying materials are made available
|
|
335 |
under the terms of the License "Eclipse Public License v1.0"
|
|
336 |
which accompanies this distribution, and is available
|
|
337 |
at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
338 |
|
|
339 |
Initial Contributors:
|
|
340 |
Nokia Corporation - initial contribution.
|
|
341 |
|
|
342 |
Contributors:
|
|
343 |
|
|
344 |
Description:
|
|
345 |
|
|
346 |
|
|
347 |
=cut
|