2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 # checknewapi - a perl script to check for new API's
20 # using two outputs from regview and dump the intersection
26 die "usage: checknewapi <new_type_library> <reference_type_library> <buildinfodescr> <fullpath_regview>\n";
29 -e
"$ARGV[0]" || die "ERROR: type library \"$ARGV[0]\" does not exist\n";
30 -e
"$ARGV[1]" || die "ERROR: reference type library \"$ARGV[1]\" does not exist\n";
31 -e
"$ARGV[3]" || die "ERROR: invalid path to the regview tool \"$ARGV[3]\", please specify the full qualified path\n";
36 $main::buildinfo
= "$ARGV[2]";
37 $main::regview
= "$ARGV[3]";
38 %{$main::reftypes
} = ();
39 %{$main::currenttypes
} = ();
40 %{$main::removedtypes
} = ();
42 open ( FILEIN
, "$main::regview \"$ARGV[0]\" |" ) || die "could not use content of current typelibrary \"$ARGV[0]\", regview doesn't work\n";
46 open( CURRENT
, ">current_types.txt" ) || die "\nERROR: could not open current_types.txt for writing";
57 if ( $linebefore =~ m
#type class: published (.+)# )
61 } elsif ( $linebefore =~ m
#type class: (.+)# )
75 if ( (!$typeclass eq "") && ($_ =~ m
# *type name: \"([^\[.]+)\"#) )
81 if ( ! exists $main::currenttypes
->{$1} )
83 $main::currenttypes
->{$1} = { PUBLISHED
=> $published,
84 TYPECLASS
=> $typeclass,
86 # print "### $main::currenttypes->{$1}->{PUBLISHED} $main::currenttypes->{$1}->{TYPECLASS} $main::currenttypes->{$1}->{COUNT}\n";
94 open ( FILEIN
, "$main::regview \"$ARGV[1]\" |" ) || die "could not use content of reference type library \"$ARGV[1]\", regview doesn't work\n";
98 open( REFERENCE
, ">reference_types.txt" ) || die "\nERROR: could not open reference_types.txt for writing";
110 if ( $linebefore =~ m
#type class: published (.+)# )
114 } elsif ( $linebefore =~ m
#type class: (.+)# )
128 if ( (!$typeclass eq "") && ($_ =~ m
# *type name: \"([^\[.]+)\"#) )
132 print REFERENCE
"$1\n";
134 if ( ! exists $main::reftypes
->{$1} )
136 $main::reftypes
->{$1}++;
138 if ( exists $main::currenttypes
->{$1} )
140 $main::currenttypes
->{$1}->{COUNT
}++;
141 # print "###### $main::currenttypes->{$1}->{PUBLISHED} $main::currenttypes->{$1}->{TYPECLASS} $main::currenttypes->{$1}->{COUNT}\n";
146 $main::removedtypes
->{$1} = { PUBLISHED
=> $published,
147 TYPECLASS
=> $typeclass };
150 print "ERROR: type $1 is only in reference type library, this can't be happen\n";
161 @typekeys = keys %{$main::currenttypes
};
162 $allunotypes = $#typekeys+1;
166 $draftspublished = 0;
167 foreach $i ( sort @typekeys )
169 if ( $main::currenttypes
->{$i}->{COUNT
} == 1 &&
170 !("$main::currenttypes->{$i}->{TYPECLASS}" eq "module"))
175 if ($main::currenttypes
->{$i}->{PUBLISHED
} == 1)
180 if ( $t =~ m
#drafts\.com.+#)
183 if ($main::currenttypes
->{$i}->{PUBLISHED
} == 1)
188 print "$main::currenttypes->{$i}->{TYPECLASS} = $t\n";
192 # count removed not yet published types
193 $removednotpublished = 0;
195 @removedtypekeys = keys %{$main::removedtypes
};
196 foreach $i ( sort @removedtypekeys )
198 $removednotpublished++;
201 print "removed not yet published $main::currenttypes->{$i}->{TYPECLASS} = $t\n";
204 print "\n=======================================================\n\n";
205 print "Summary [last check for $main::buildinfo]:\n\n";
206 print "Number of UNO types = $allunotypes\n";
207 print "Number of new UNO types = $newunotypes\n";
208 print "New and published types = $newpublished\n";
209 print "New and draft types = $draftscount\n";
210 print "New, draft and published = $draftspublished\n";
211 print "Removed and not published = $removednotpublished\n";