Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / android_webview / tools / find_files.pl
1 #!/usr/bin/perl -w
2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # Use: find_files.pl <start-from> [exclude-dir ...]
7
8 use strict;
9 use warnings;
10 use File::Basename;
11
12 my $progname = basename($0);
13
14 my $root_dir = shift @ARGV;
15 my @find_args = ();
16 while (@ARGV) {
17     my $path = shift @ARGV;
18     push @find_args, qw'-not ( -path', "*/$path/*", qw'-prune )'
19 }
20 push @find_args, qw(-follow -type f -print);
21
22 open FIND, '-|', 'find', $root_dir, @find_args
23             or die "$progname: Couldn't exec find: $!\n";
24 my $check_regex = '\.(asm|c(c|pp|xx)?|h(h|pp|xx)?|p(l|m)|xs|sh|php|py(|x)' .
25     '|rb|idl|java|el|sc(i|e)|cs|pas|inc|js|pac|html|dtd|xsl|mod|mm?' .
26     '|tex|mli?)$';
27 my @files = ();
28 while (<FIND>) {
29     chomp;
30     print "$_\n" unless (-z $_ || !m%$check_regex%);
31 }
32 close FIND;