You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2022/08/24 10:39:09 UTC

[ant] branch master updated: create manifest file's parent if needed.

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 39c9b0c93 create manifest file's parent if needed.
39c9b0c93 is described below

commit 39c9b0c9384da0e1b7d31a54d96a48c2d7df380b
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Wed Aug 24 12:38:33 2022 +0200

    create manifest file's parent if needed.
    
    Bugzilla Report 66231
---
 WHATSNEW                                                 | 4 ++++
 src/main/org/apache/tools/ant/taskdefs/ManifestTask.java | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/WHATSNEW b/WHATSNEW
index c0fe5ea7d..9872c70c4 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -59,6 +59,10 @@ Other changes:
    performance in some special cases.
    Bugzilla Report 66048
 
+ * <manifest> will now create the parent directory of the manifestFile
+   attribute if it doesn't exist.
+   Bugzilla Report 66231
+
 Changes from Ant 1.10.11 TO Ant 1.10.12
 =======================================
 
diff --git a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java
index 2345b3137..f344a6b29 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ManifestTask.java
@@ -238,6 +238,14 @@ public class ManifestTask extends Task {
                 error = new BuildException("Failed to read " + manifestFile,
                                            e, getLocation());
             }
+        } else {
+            final File parent = manifestFile.getParentFile();
+            if (parent != null && !parent.isDirectory()
+                && !(parent.mkdirs() || parent.isDirectory())) {
+                throw new BuildException(
+                    "Failed to create missing parent directory for %s",
+                    manifestFile);
+            }
         }
 
         // look for and print warnings