sl@0
|
1 |
@rem
|
sl@0
|
2 |
@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
@rem All rights reserved.
|
sl@0
|
4 |
@rem This component and the accompanying materials are made available
|
sl@0
|
5 |
@rem under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
@rem which accompanies this distribution, and is available
|
sl@0
|
7 |
@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
@rem
|
sl@0
|
9 |
@rem Initial Contributors:
|
sl@0
|
10 |
@rem Nokia Corporation - initial contribution.
|
sl@0
|
11 |
@rem
|
sl@0
|
12 |
@rem Contributors:
|
sl@0
|
13 |
@rem
|
sl@0
|
14 |
@rem Description:
|
sl@0
|
15 |
@rem
|
sl@0
|
16 |
|
sl@0
|
17 |
@perl -x check.bat
|
sl@0
|
18 |
@goto end
|
sl@0
|
19 |
#!perl
|
sl@0
|
20 |
|
sl@0
|
21 |
require Cwd;
|
sl@0
|
22 |
$cwd=Cwd::getcwd();
|
sl@0
|
23 |
#print "cwd: ",$cwd,"\n";
|
sl@0
|
24 |
$cwd =~ s/\//\\/;
|
sl@0
|
25 |
$cwd =~ /^(\w:)?([\\|\/]\S+[\\|\/])/isx;
|
sl@0
|
26 |
$drive=$1;
|
sl@0
|
27 |
$prjroot=$2;
|
sl@0
|
28 |
#print "drive ",$drive,"\n";
|
sl@0
|
29 |
#print "project root: ",$prjroot,"\n";
|
sl@0
|
30 |
@cpps=();
|
sl@0
|
31 |
@mmps=();
|
sl@0
|
32 |
@mmpflags=();
|
sl@0
|
33 |
%sources=();
|
sl@0
|
34 |
%sourceusers=();
|
sl@0
|
35 |
ls ($prjroot);
|
sl@0
|
36 |
#print "CPP files:\n";
|
sl@0
|
37 |
#foreach $entry (@cpps)
|
sl@0
|
38 |
# {
|
sl@0
|
39 |
# print $entry,"\n";
|
sl@0
|
40 |
# }
|
sl@0
|
41 |
#print "MMP files:\n";
|
sl@0
|
42 |
$count=0;
|
sl@0
|
43 |
$countz=0;
|
sl@0
|
44 |
$countsrc=0;
|
sl@0
|
45 |
foreach $entry (@mmps)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
# print $entry,"\n";
|
sl@0
|
48 |
$srclist=$sources{$entry};
|
sl@0
|
49 |
$mmpflags[$count]=0;
|
sl@0
|
50 |
++$count;
|
sl@0
|
51 |
++$countz if (scalar(@$srclist)==0);
|
sl@0
|
52 |
$countsrc += scalar(@$srclist);
|
sl@0
|
53 |
foreach $src (@$srclist)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
$uselist=$sourceusers{$src};
|
sl@0
|
56 |
$sourceusers{$src}=$uselist." ".$entry;
|
sl@0
|
57 |
# print "\t",$src,"\n";
|
sl@0
|
58 |
}
|
sl@0
|
59 |
}
|
sl@0
|
60 |
$hashsize=scalar(%sources);
|
sl@0
|
61 |
#print $hashsize;
|
sl@0
|
62 |
#print "Count=",$count,"\n";
|
sl@0
|
63 |
#print "CountZ=",$countz,"\n";
|
sl@0
|
64 |
#print "CountSrc=",$countsrc,"\n";
|
sl@0
|
65 |
|
sl@0
|
66 |
foreach $entry (@cpps)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
$uses=$sourceusers{$entry};
|
sl@0
|
69 |
print "File ",$entry," not referenced by any .MMP file\n" unless $uses;
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
parsebldinf();
|
sl@0
|
73 |
|
sl@0
|
74 |
$i=0;
|
sl@0
|
75 |
foreach $entry (@mmps)
|
sl@0
|
76 |
{
|
sl@0
|
77 |
next if $mmpflags[$i++];
|
sl@0
|
78 |
print "\n",$entry,".MMP does not appear in BLD.INF\n";
|
sl@0
|
79 |
print "\t Source files:\n";
|
sl@0
|
80 |
$srclist=$sources{$entry};
|
sl@0
|
81 |
foreach $src (@$srclist)
|
sl@0
|
82 |
{
|
sl@0
|
83 |
print "\t",$src,"\n";
|
sl@0
|
84 |
}
|
sl@0
|
85 |
}
|
sl@0
|
86 |
end;
|
sl@0
|
87 |
|
sl@0
|
88 |
sub ls
|
sl@0
|
89 |
{
|
sl@0
|
90 |
my $dir=@_[0];
|
sl@0
|
91 |
$dir =~ s/\//\\/;
|
sl@0
|
92 |
# print $dir,"\n";
|
sl@0
|
93 |
opendir(DIR,$dir);
|
sl@0
|
94 |
my @dir=readdir(DIR);
|
sl@0
|
95 |
closedir(DIR);
|
sl@0
|
96 |
my $entry;
|
sl@0
|
97 |
my $fullentry;
|
sl@0
|
98 |
foreach $entry (@dir)
|
sl@0
|
99 |
{
|
sl@0
|
100 |
$entry=~s/\//\\/;
|
sl@0
|
101 |
next if (($entry eq ".") or ($entry eq ".."));
|
sl@0
|
102 |
$fullentry=$dir.$entry;
|
sl@0
|
103 |
if (-d $fullentry)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
ls($fullentry."\\");
|
sl@0
|
106 |
}
|
sl@0
|
107 |
else
|
sl@0
|
108 |
{
|
sl@0
|
109 |
push @cpps, uc($fullentry) if ($entry =~ /\S+\.cpp/isx);
|
sl@0
|
110 |
if ($entry =~ /(\S+)\.mmp/isx)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
push @mmps, uc($1);
|
sl@0
|
113 |
parsemmp($fullentry,\%sources);
|
sl@0
|
114 |
}
|
sl@0
|
115 |
# print $fullentry,"\n";
|
sl@0
|
116 |
}
|
sl@0
|
117 |
}
|
sl@0
|
118 |
}
|
sl@0
|
119 |
|
sl@0
|
120 |
sub parsemmp
|
sl@0
|
121 |
{
|
sl@0
|
122 |
my $mmpfile=@_[0];
|
sl@0
|
123 |
my $array=@_[1];
|
sl@0
|
124 |
my $project;
|
sl@0
|
125 |
my $subproject;
|
sl@0
|
126 |
# print "ParseMMP ",$mmpfile,"\n";
|
sl@0
|
127 |
open(MMP,$mmpfile);
|
sl@0
|
128 |
my @sources=();
|
sl@0
|
129 |
while(<MMP>)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
if (/^PROJECT\s+(\S+)/isx)
|
sl@0
|
132 |
{
|
sl@0
|
133 |
$project=uc($1);
|
sl@0
|
134 |
# print "Project ",$project,"\n";
|
sl@0
|
135 |
}
|
sl@0
|
136 |
elsif (/^SUBPROJECT\s+(\S+)/isx)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
$subproject=uc($1);
|
sl@0
|
139 |
# print "Subproject ",$subproject,"\n";
|
sl@0
|
140 |
}
|
sl@0
|
141 |
elsif (/^source\s*(.+)/isx)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
# print $1;
|
sl@0
|
144 |
my $list=$1;
|
sl@0
|
145 |
while($list)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
$list =~ /^(\S+)\s*(.*)/isx;
|
sl@0
|
148 |
push @sources, "\\".$project."\\".$subproject."\\".uc($1);
|
sl@0
|
149 |
$list=$2;
|
sl@0
|
150 |
# print "\t Source ",$1,"\n";
|
sl@0
|
151 |
}
|
sl@0
|
152 |
}
|
sl@0
|
153 |
}
|
sl@0
|
154 |
close(MMP);
|
sl@0
|
155 |
$mmpfile =~ /\S*\\(\S+)\.mmp/isx;
|
sl@0
|
156 |
$mmpfileshort=uc($1);
|
sl@0
|
157 |
$$array{$mmpfileshort}=\@sources;
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
sub parsebldinf
|
sl@0
|
161 |
{
|
sl@0
|
162 |
my $reachedmmps=0;
|
sl@0
|
163 |
open(BLDINF,"bld.inf");
|
sl@0
|
164 |
while (<BLDINF>)
|
sl@0
|
165 |
{
|
sl@0
|
166 |
# print;
|
sl@0
|
167 |
if ($reachedmmps==0)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
$reachedmmps=1 if (/PRJ_MMPFILES|PRJ_TESTMMPFILES/isx);
|
sl@0
|
170 |
next;
|
sl@0
|
171 |
}
|
sl@0
|
172 |
/(\S+)\s*.*/isx;
|
sl@0
|
173 |
my $mmpfile=uc($1);
|
sl@0
|
174 |
# print "****************",$mmpfile,"\n";
|
sl@0
|
175 |
my $mmp;
|
sl@0
|
176 |
my $i=0;
|
sl@0
|
177 |
foreach $mmp (@mmps)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
$mmpflags[$i]=1 if ($mmp eq $mmpfile);
|
sl@0
|
180 |
++$i;
|
sl@0
|
181 |
}
|
sl@0
|
182 |
}
|
sl@0
|
183 |
close(BLDINF);
|
sl@0
|
184 |
}
|
sl@0
|
185 |
|
sl@0
|
186 |
__END__
|
sl@0
|
187 |
:end
|