Browse Source

set target's name before the depends attribute - leads to more meaningful errors. PR 37655

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@393610 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 19 years ago
parent
commit
dfaca18fce
2 changed files with 8 additions and 8 deletions
  1. +3
    -3
      src/main/org/apache/tools/ant/Target.java
  2. +5
    -5
      src/main/org/apache/tools/ant/helper/ProjectHelper2.java

+ 3
- 3
src/main/org/apache/tools/ant/Target.java View File

@@ -129,9 +129,9 @@ public class Target implements TaskContainer {

// Make sure the dependency is not empty string
if ("".equals(token) || ",".equals(token)) {
throw new BuildException("Syntax Error: Depend "
+ "attribute for target \"" + getName()
+ "\" has an empty string for dependency.");
throw new BuildException("Syntax Error: depends "
+ "attribute of target \"" + getName()
+ "\" has an empty string as dependency.");
}

addDependency(token);


+ 5
- 5
src/main/org/apache/tools/ant/helper/ProjectHelper2.java View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2005 The Apache Software Foundation
* Copyright 2000-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -817,10 +817,6 @@ public class ProjectHelper2 extends ProjectHelper {
"Duplicate target '" + name + "'", target.getLocation());
}

if (depends.length() > 0) {
target.setDepends(depends);
}

Hashtable projectTargets = project.getTargets();
boolean usedTarget = false;
// If the name has not already been defined define it
@@ -834,6 +830,10 @@ public class ProjectHelper2 extends ProjectHelper {
usedTarget = true;
}

if (depends.length() > 0) {
target.setDepends(depends);
}

if (context.isIgnoringProjectTag() && context.getCurrentProjectName() != null
&& context.getCurrentProjectName().length() != 0) {
// In an impored file (and not completely


Loading…
Cancel
Save