Mostly based on Shiraz work, I added the change proposed by Glenn.

Here is a summary of ideas from the original mails:
- attr is a Windows only task
- attr breaks the consistency with the chmod by using specific boolean
parameters for each permissions (readonly archive system hidden)

---
I noted a little problem that may come from the ExecuteOn parent class: if
the task file argument refers to a directory, the task will do nothing and
won't complain.
I don't know if this is an expected behavior and I didn't investigate it
further yet.
---


Here's a diff versus the 1.3 version of the Ant tree.

diff -u Ant1.3/jakarta-ant-1.3/docs/manual/coretasklist.html
jakarta-ant-1.3/docs/manual/coretasklist.html
--- Ant1.3/jakarta-ant-1.3/docs/manual/coretasklist.html        Fri Mar  2 
23:46:34
2001
+++ jakarta-ant-1.3/docs/manual/coretasklist.html       Tue Jun 12 15:20:54 2001
@@ -21,6 +21,7 @@
 <a href="CoreTasks/antcall.html">AntCall</a><br>
 <a href="CoreTasks/antstructure.html">AntStructure</a><br>
 <a href="CoreTasks/apply.html">Apply</a><br>
+<a href="CoreTasks/attrib.html">Attrib</a><br>
 <a href="CoreTasks/available.html">Available</a><br>
 <a href="CoreTasks/chmod.html">Chmod</a><br>
 <a href="CoreTasks/copy.html">Copy</a><br>

diff -u
Ant1.3/jakarta-ant-1.3/src/main/org/apache/tools/ant/taskdefs/defaults.prope
rties
jakarta-ant-1.3/src/main/org/apache/tools/ant/taskdefs/defaults.properties
---
Ant1.3/jakarta-ant-1.3/src/main/org/apache/tools/ant/taskdefs/defaults.prope
rties   Fri Mar  2 23:46:26 2001
+++
jakarta-ant-1.3/src/main/org/apache/tools/ant/taskdefs/defaults.properties
Tue Jun 12 14:22:22 2001
@@ -1,6 +1,7 @@
 # standard ant tasks
 mkdir=org.apache.tools.ant.taskdefs.Mkdir
 javac=org.apache.tools.ant.taskdefs.Javac
+attrib=org.apache.tools.ant.taskdefs.Attrib
 chmod=org.apache.tools.ant.taskdefs.Chmod
 delete=org.apache.tools.ant.taskdefs.Delete
 copy=org.apache.tools.ant.taskdefs.Copy

New files attached:
- jakarta-ant-1.3/docs/manual/CoreTasks/attrib.html
- jakarta-ant-1.3/src/main/org/apache/tools/ant/taskdefs/Attrib.java

Cheers,

Jerome
Title: Ant User Manual

Attrib

Description

Changes the attributes of a file or all files inside specified directories. Right now it has effect only under Windows. Each of the 4 possible permissions has its own attribute, matching the arguments for the attrib command.

See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns.

This task holds an implicit FileSet and supports all of FileSet's attributes and nested elements directly. More FileSets can be specified using nested <fileset> elements.

Parameters

Attribute Description Required
file the file or single directory of which the permissions must be changed. exactly one of the two or nested <fileset> elements.
dir the directory which holds the files whose permissions must be changed.
readonly the readonly permission. at least one of the four.
archive the archive permission.
system the system permission.
hidden the hidden permission.
includes comma separated list of patterns of files that must be included. All files are included when omitted. No
includesfile the name of a file. Each line of this file is taken to be an include pattern No
excludes comma separated list of patterns of files that must be excluded. No files (except default excludes) are excluded when omitted. No
excludesfile the name of a file. Each line of this file is taken to be an exclude pattern No
defaultexcludes indicates whether default excludes should be used or not ("yes"/"no"). Default excludes are used when omitted. No
type One of file, dir or both. If set to file, only the permissions of plain files are going to be changed. If set to dir, only the directories are considered. No, default is file

Examples

<attrib file="${dist}/run.bat" readonly="true" hidden="true"/>

makes the "run.bat" file read-only and hidden.

<attrib dir="${meta.inf}" readonly="false" includes="**/*.xml"/>

makes all ".xml" files below ${meta.inf} readable.

<attrib readonly="true" archive="true">
  <fileset dir="shared/sources1">
    <exclude name="**/trial/**"/>
  </fileset>
  <fileset refid="other.shared.sources"/>
</attrib>

makes all files below shared/sources1 (except those below any directory named trial) read-only and archived. In addition all files belonging to a FileSet with id other.shared.sources get the same attributes.


Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.

Attachment: Attrib.java
Description: JavaScript source

Reply via email to