From c89099e9b9bc911f43d0a58fcd410ea6a7b4157c Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 12 Oct 2000 13:22:49 +0000 Subject: [PATCH] Make use the value of srcdir as destdir if the latter has not been specified. Submitted by: Alexander Pokahr <5pokahr@informatik.uni-hamburg.de> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268075 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Javac.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index d6d1a3dd3..55e4ff1da 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -281,20 +281,23 @@ public class Javac extends MatchingTask { * Executes the task. */ public void execute() throws BuildException { - // first off, make sure that we've got a srcdir and destdir + // first off, make sure that we've got a srcdir if (src == null) { throw new BuildException("srcdir attribute must be set!", location); } - String [] list = src.list(); if (list.length == 0) { throw new BuildException("srcdir attribute must be set!", location); } + if (destDir == null) { - throw new BuildException("destdir attribute must be set!", location); + destDir = project.resolveFile(list[0]); + log("destdir set to "+destDir.getPath()+" from srcdir attribute", + Project.MSG_INFO); } + if (!destDir.isDirectory()) { throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location); }