view javac.in @ 1773:2786abf763ce default tip

Backed out changeset b6d5c31b16fe Commited to wrong branch.
author Andrew Su <asu@redhat.com>
date Mon, 23 Aug 2010 17:31:40 -0400
parents 52b6f4605e43
children
line wrap: on
line source

#!/usr/bin/perl -w
use strict;
use constant NO_DUP_ARGS => qw(-source -target -d -encoding);
use constant STRIP_ARGS => qw(-Werror);

my @bcoption;
push @bcoption, '-bootclasspath', glob '@SYSTEM_GCJ_DIR@/jre/lib/rt.jar'
    unless grep {$_ eq '-bootclasspath'} @ARGV;

# Work around ecj's inability to handle duplicate command-line
# options.

my @new_args = @ARGV;

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;
}

my @CLASSPATH = ('@ECJ_JAR@');
push @CLASSPATH, split /:/, $ENV{CLASSPATH} if exists $ENV{CLASSPATH};
$ENV{CLASSPATH} = join ':', @CLASSPATH;

if ( -e "@abs_top_builddir@/native-ecj" )
{
    exec '@abs_top_builddir@/native-ecj', '-1.5', '-nowarn', @bcoption, @new_args ;
}
elsif ( -e "@ECJ@" )
{
    exec '@ECJ@', '-1.5', '-nowarn', @bcoption, @new_args ;
}
else
{
    exec '@JAVA@', 'org.eclipse.jdt.internal.compiler.batch.Main', '-1.5',
    '-nowarn', @bcoption, @new_args;
}