Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-2256

FileCopyDetails.setMode() from within copy { from zipTree() eachFile { ... } } doesn't work

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Resolution: Fixed
  • Affects Version/s: 1.0-rc-1
  • Fix Version/s: None

Description

The following fails to correctly set the file mode on files ending with ".sh" in "archive.zip":

copy {
from zipTree("archive.zip")
eachFile {
if (it.getName().endsWith(".sh")) { it.setMode(0755) }
}
into "targetDir"
}

If the ".sh" files included in the ZIP are mode 0644, they get copied from the ZIP into "targetDir" as mode 0644, not mode 0755 as requested by the code in eachFile(). (Adding a println to the "if" condition in the eachFile closure shows that the files are getting correctly matched and having the setMode() method called, but this seems to have no effect on the copied files.)

Activity

  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews
Hide
Permalink
René Gröschke added a comment - 13/May/12 3:21 PM - edited

this seems to be a bug with the eachFile closure. I can reproduce this issue with the following more simple snippet:

task myCopy(type:Copy) {
from "test"
eachFile {
if (it.getName().endsWith(".sh")) { it.setMode(0755) }
}
into "targetDir"
}

Show
René Gröschke added a comment - 13/May/12 3:21 PM - edited this seems to be a bug with the eachFile closure. I can reproduce this issue with the following more simple snippet: task myCopy(type:Copy) { from "test" eachFile { if (it.getName().endsWith(".sh")) { it.setMode(0755) } } into "targetDir" }

People

  • Assignee:
    René Gröschke
    Reporter:
    Bob Glamm
Vote (0)
Watch (0)

Dates

  • Created:
    26/Apr/12 2:42 PM
    Updated:
    04/Jan/13 5:10 AM
    Resolved:
    15/May/12 2:44 AM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.