From 6a65262ae702364e448ed94837199c40eac8eefd Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 13 Jan 2003 15:52:12 +0000 Subject: [PATCH] Make build.sysclasspath handling more consistent. PR: 15014 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273795 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 ++ .../apache/tools/ant/taskdefs/Javadoc.java | 4 ++-- .../compilers/DefaultCompilerAdapter.java | 22 ++++++++----------- .../tools/ant/taskdefs/optional/Javah.java | 6 +++-- .../optional/ejb/IPlanetEjbcTask.java | 9 +++++--- .../ant/taskdefs/optional/jsp/WLJspc.java | 4 ++-- .../optional/jsp/compilers/JasperC.java | 5 +++-- .../ant/taskdefs/rmic/DefaultRmicAdapter.java | 21 ++++++++---------- .../apache/tools/ant/types/XMLCatalog.java | 10 +++++---- 9 files changed, 43 insertions(+), 40 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 0ea1ebded..8d2cfdda3 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -88,6 +88,8 @@ Fixed bugs: * The task can now be compiled (and Ant thus bootstrapped) using Kaffee. +* build.sysclasspath will now be honored by more tasks. + Other changes: -------------- * The filesetmanifest attribute of has been reenabled. diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 2c7a008cd..6e07ae585 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -1559,7 +1559,7 @@ public class Javadoc extends Task { } if (classpath == null) { - classpath = Path.systemClasspath; + classpath = (new Path(getProject())).concatSystemClasspath("last"); } else { classpath = classpath.concatSystemClasspath("ignore"); } diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index bb249cde3..3df5d6b9d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -167,20 +167,16 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { } // Combine the build classpath with the system classpath, in an - // order determined by the value of build.classpath + // order determined by the value of build.sysclasspath - if (compileClasspath == null) { - if (includeAntRuntime) { - classpath.addExisting(Path.systemClasspath); - } + Path cp = compileClasspath; + if (cp == null) { + cp = new Path(project); + } + if (includeAntRuntime) { + classpath.addExisting(cp.concatSystemClasspath("last")); } else { - if (includeAntRuntime) { - classpath.addExisting(compileClasspath - .concatSystemClasspath("last")); - } else { - classpath.addExisting(compileClasspath - .concatSystemClasspath("ignore")); - } + classpath.addExisting(cp.concatSystemClasspath("ignore")); } if (includeJavaRuntime) { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java b/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java index 030ed432e..55dd20ed5 100755 --- a/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -296,7 +296,9 @@ public class Javah extends Task { } if (classpath == null) { - classpath = Path.systemClasspath; + classpath = (new Path(getProject())).concatSystemClasspath("last"); + } else { + classpath = classpath.concatSystemClasspath("ignore"); } String compiler = getProject().getProperty("build.compiler"); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java index 3d08a2e46..caa0a664c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -342,10 +342,13 @@ public class IPlanetEjbcTask extends Task { * @return Path The classpath to be used for EJBc. */ private Path getClasspath() { + Path cp = null; if (classpath == null) { - classpath = Path.systemClasspath; + cp = (new Path(getProject())).concatSystemClasspath("last"); + } else { + cp = classpath.concatSystemClasspath("ignore"); } - return classpath; + return cp; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java index 955eb6a65..be821e656 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000,2002 The Apache Software Foundation. All rights + * Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -150,7 +150,7 @@ public class WLJspc extends MatchingTask { compileClasspath = new Path(getProject()); } - compileClasspath.append(Path.systemClasspath); + compileClasspath = compileClasspath.concatSystemClasspath(); String[] files = ds.getIncludedFiles(); //Weblogic.jspc calls System.exit() ... have to fork diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java index 252ddc85e..f256ce381 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -106,7 +106,8 @@ public class JasperC extends DefaultJspCompilerAdapter { if (getJspc().getClasspath() != null) { getProject().log("using user supplied classpath: "+getJspc().getClasspath(), Project.MSG_DEBUG); - java.setClasspath(getJspc().getClasspath()); + java.setClasspath(getJspc().getClasspath() + .concatSystemClasspath("ignore")); } else { Path classpath=new Path(getProject()); classpath=classpath.concatSystemClasspath("only"); diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index c1f95aa39..780117b31 100644 --- a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -144,18 +144,15 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { // Combine the build classpath with the system classpath, in an // order determined by the value of build.sysclasspath - if (attributes.getClasspath() == null) { - if (attributes.getIncludeantruntime()) { - classpath.addExisting(Path.systemClasspath); - } + + Path cp = attributes.getClasspath(); + if (cp == null) { + cp = new Path(attributes.getProject()); + } + if (attributes.getIncludeantruntime()) { + classpath.addExisting(cp.concatSystemClasspath("last")); } else { - if (attributes.getIncludeantruntime()) { - classpath.addExisting(attributes.getClasspath() - .concatSystemClasspath("last")); - } else { - classpath.addExisting(attributes.getClasspath() - .concatSystemClasspath("ignore")); - } + classpath.addExisting(cp.concatSystemClasspath("ignore")); } if (attributes.getIncludejavaruntime()) { diff --git a/src/main/org/apache/tools/ant/types/XMLCatalog.java b/src/main/org/apache/tools/ant/types/XMLCatalog.java index 1a7e6c720..7d94e9f72 100644 --- a/src/main/org/apache/tools/ant/types/XMLCatalog.java +++ b/src/main/org/apache/tools/ant/types/XMLCatalog.java @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -697,11 +697,13 @@ public class XMLCatalog extends DataType InputSource source = null; AntClassLoader loader = null; - if (classpath != null) { - loader = new AntClassLoader(getProject(), classpath); + Path cp = classpath; + if (cp != null) { + cp = classpath.concatSystemClasspath("ignore"); } else { - loader = new AntClassLoader(getProject(), Path.systemClasspath); + cp = (new Path(getProject())).concatSystemClasspath("last"); } + loader = new AntClassLoader(getProject(), cp); // // for classpath lookup we ignore the base directory