File: javac.in

package info (click to toggle)
openjdk-6 6b27-1.12.6-1~deb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-proposed-updates
  • size: 133,540 kB
  • ctags: 37,146
  • sloc: java: 173,188; cpp: 13,710; asm: 6,470; ansic: 4,827; sh: 4,156; makefile: 4,149; perl: 1,005; python: 310
file content (100 lines) | stat: -rw-r--r-- 2,580 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/perl -w
use strict;
use constant NO_DUP_ARGS => qw(-source -target -d -encoding);
use constant STRIP_ARGS => qw(-Werror -implicit:none -J-Xbootclasspath/p:);

my $ECJ_WARNINGS="-nowarn";
my $JAVAC_WARNINGS="-nowarn";

my @bcoption;
my @bcoptionsp = grep {$_ =~ '^-Xbootclasspath/p:' } @ARGV;
my @bcoptions = grep {$_ =~ '^-Xbootclasspath:' } @ARGV;
my @bcoptionsa = grep {$_ =~ '^-Xbootclasspath/a:' } @ARGV;
my $bcp = $bcoptionsp[0];
my $bc = $bcoptions[0];
my $bca = $bcoptionsa[0];
my $systembc = glob '@abs_top_builddir@/bootstrap/jdk1.6.0/jre/lib/rt.jar';
if ($bcp)
{
    $bcp =~ s/^[^:]*://;
    $systembc = join ":", $bcp, $systembc;
}
if ($bc)
{
    $bc =~ s/^[^:]*://;
    $systembc = $bc;
}
if ($bca)
{
    $bca =~ s/^[^:]*://;
    $systembc = join ":", $systembc, $bca;
}
push @bcoption, '-bootclasspath', $systembc
    unless grep {$_ eq '-bootclasspath'} @ARGV;
my @ecj_parms = ($ECJ_WARNINGS, @bcoption);
my @javac_parms = ($JAVAC_WARNINGS, '-Xprefer:source', '-XDignore.symbol.file=true');

# Work around ecj's inability to handle duplicate command-line
# options and unknown javac options.
sub gen_ecj_opts
{
    my @new_args = @{$_[0]};

    for my $opt (NO_DUP_ARGS) 
    {
	my @indices = reverse grep {$new_args[$_] eq $opt} 0..$#new_args;
	if (@indices > 1) {
	    shift @indices;    # keep last instance only
	    splice @new_args, $_, 2 for @indices;
	}
    }

    for my $opt (STRIP_ARGS) 
    {
	my @indices = reverse grep {$new_args[$_] eq $opt} 0..$#new_args;
	splice @new_args, $_, 1 for @indices;
    }

    return \@new_args;
}

sub split_vm_args
{
    my @new_args = @{$_[0]};

    my @vm_args = map { substr $_, 2 } grep $_ =~ /^-J/, @new_args;
    my @javac_args = grep $_ !~ /^-J/, @new_args;

    return (\@vm_args, \@javac_args);
}

if ( -e "@abs_top_builddir@/native-ecj" )
{
    my $ecj_args = gen_ecj_opts( \@ARGV );
    exec '@abs_top_builddir@/native-ecj', @ecj_parms, @$ecj_args ;
}
elsif ( -e "@JAVAC@" )
{
    if ("@USING_ECJ@" eq "yes")
    {
	my $ecj_args = gen_ecj_opts( \@ARGV );
	exec '@JAVAC@', @ecj_parms, @$ecj_args ;
    }
    else
    {
	exec '@JAVAC@', @javac_parms, @ARGV ;
    }
}
elsif ( -e "@ECJ_JAR@" )
{
    my ($vm_args, $javac_args) = split_vm_args (gen_ecj_opts( \@ARGV ));
    my @CLASSPATH = ('@ECJ_JAR@');
    push @CLASSPATH, split /:/, $ENV{"CLASSPATH"} if exists $ENV{"CLASSPATH"};
    $ENV{"CLASSPATH"} = join ':', @CLASSPATH;
    exec '@JAVA@', @$vm_args, 'org.eclipse.jdt.internal.compiler.batch.Main', @ecj_parms, @$javac_args;
}
else
{
    print STDERR "No Java compiler to run";
    exit -1;
}