View | Details | Raw Unified | Return to bug 35571
Collapse All | Expand All

(-)JspC.java (-4 / +31 lines)
Lines 47-52 Link Here
47
import org.apache.jasper.compiler.TldLocationsCache;
47
import org.apache.jasper.compiler.TldLocationsCache;
48
import org.apache.jasper.servlet.JspCServletContext;
48
import org.apache.jasper.servlet.JspCServletContext;
49
import org.apache.tools.ant.AntClassLoader;
49
import org.apache.tools.ant.AntClassLoader;
50
import org.apache.tools.ant.Project;
51
import org.apache.tools.ant.util.FileUtils;
50
52
51
/**
53
/**
52
 * Shell for the jspc compiler.  Handles all options associated with the
54
 * Shell for the jspc compiler.  Handles all options associated with the
Lines 146-151 Link Here
146
    private String targetClassName;
148
    private String targetClassName;
147
    private String uriBase;
149
    private String uriBase;
148
    private String uriRoot;
150
    private String uriRoot;
151
    private Project project;
149
    private int dieLevel;
152
    private int dieLevel;
150
    private boolean helpNeeded = false;
153
    private boolean helpNeeded = false;
151
    private boolean compile = false;
154
    private boolean compile = false;
Lines 596-601 Link Here
596
    }
599
    }
597
600
598
    /**
601
    /**
602
     * Ant project. Set by Ant when this class is invoked as a
603
     * Task, so that the uriRoot can be resolved correctly.
604
     */
605
    public void setProject( Project p ) {
606
        project=p;
607
    }
608
    
609
    /**
599
     * Base dir for the webapp. Used to generate class names and resolve
610
     * Base dir for the webapp. Used to generate class names and resolve
600
     * includes
611
     * includes
601
     */
612
     */
Lines 605-611 Link Here
605
            return;
616
            return;
606
        }
617
        }
607
        try {
618
        try {
608
            uriRoot=new File( s ).getCanonicalPath();
619
            uriRoot=resolveFile( s ).getCanonicalPath();
609
        } catch( Exception ex ) {
620
        } catch( Exception ex ) {
610
            uriRoot=s;
621
            uriRoot=s;
611
        }
622
        }
Lines 648-654 Link Here
648
659
649
    public void setOutputDir( String s ) {
660
    public void setOutputDir( String s ) {
650
        if( s!= null ) {
661
        if( s!= null ) {
651
            scratchDir = new File(s).getAbsoluteFile();
662
            scratchDir=resolveFile( s ).getAbsoluteFile();
652
        } else {
663
        } else {
653
            scratchDir=null;
664
            scratchDir=null;
654
        }
665
        }
Lines 671-677 Link Here
671
     * File where we generate a web.xml fragment with the class definitions.
682
     * File where we generate a web.xml fragment with the class definitions.
672
     */
683
     */
673
    public void setWebXmlFragment( String s ) {
684
    public void setWebXmlFragment( String s ) {
674
        webxmlFile=s;
685
        webxmlFile=resolveFile( s ).getAbsolutePath();
675
        webxmlLevel=INC_WEBXML;
686
        webxmlLevel=INC_WEBXML;
676
    }
687
    }
677
688
Lines 679-685 Link Here
679
     * File where we generate a complete web.xml with the class definitions.
690
     * File where we generate a complete web.xml with the class definitions.
680
     */
691
     */
681
    public void setWebXml( String s ) {
692
    public void setWebXml( String s ) {
682
        webxmlFile=s;
693
        webxmlFile=resolveFile( s ).getAbsolutePath();
683
        webxmlLevel=ALL_WEBXML;
694
        webxmlLevel=ALL_WEBXML;
684
    }
695
    }
685
696
Lines 1257-1260 Link Here
1257
            // pass straight through
1268
            // pass straight through
1258
        }
1269
        }
1259
    }
1270
    }
1271
1272
    /**
1273
     * Resolves the relative or absolute pathname correctly
1274
     * in both Ant and command-line situations.  If Ant launched
1275
     * us, we should use the basedir of the current project
1276
     * to resolve relative paths.
1277
     */
1278
    protected File resolveFile( String s )
1279
    {
1280
        if( null==project ) {
1281
            return FileUtils.getFileUtils().resolveFile(null, s);
1282
        } else {
1283
            return FileUtils.getFileUtils().resolveFile(project.getBaseDir(), s);
1284
        }
1285
    }
1286
    
1260
}
1287
}

Return to bug 35571