{"action":"created","issue":{"url":"https://api.github.com/repos/gradle/gradle/issues/1062","repository_url":"https://api.github.com/repos/gradle/gradle","labels_url":"https://api.github.com/repos/gradle/gradle/issues/1062/labels{/name}","comments_url":"https://api.github.com/repos/gradle/gradle/issues/1062/comments","events_url":"https://api.github.com/repos/gradle/gradle/issues/1062/events","html_url":"https://github.com/gradle/gradle/issues/1062","id":197393586,"number":1062,"title":"Gradle up-to-date false positive with clean + zipTree","user":{"login":"MarkRx","id":17504314,"avatar_url":"https://avatars.githubusercontent.com/u/17504314?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkRx","html_url":"https://github.com/MarkRx","followers_url":"https://api.github.com/users/MarkRx/followers","following_url":"https://api.github.com/users/MarkRx/following{/other_user}","gists_url":"https://api.github.com/users/MarkRx/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkRx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkRx/subscriptions","organizations_url":"https://api.github.com/users/MarkRx/orgs","repos_url":"https://api.github.com/users/MarkRx/repos","events_url":"https://api.github.com/users/MarkRx/events{/privacy}","received_events_url":"https://api.github.com/users/MarkRx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-12-23T16:11:20Z","updated_at":"2016-12-23T18:30:13Z","closed_at":"2016-12-23T18:30:13Z","body":"I am hitting a strange bug with gradle 2.12. My task is being considered up to date when it has input files and I explicitly disabled the up-to-date checking. Given the setup below, running\r\n\r\n> gradle doCopy\r\n\r\nworks as expected. Running\r\n\r\n> gradle clean doCopy\r\n\r\ndoes not and results in my task being skipped.\r\n\r\n### Expected Behavior\r\nMy task runs\r\n\r\n### Current Behavior\r\nMy task does not run. Gradle thinks it is up to date and skips it. It appears that https://github.com/gradle/gradle/blob/REL_2.12/subprojects/core/src/main/groovy/org/gradle/api/internal/tasks/execution/SkipEmptySourceFilesTaskExecuter.java thinks the source files are empty when they are not.\r\n\r\n### Context\r\nMy task is not being run and is appearing in the console as being up-to-date.\r\n\r\n### Steps to Reproduce (for bugs)\r\nbuild.gradle:\r\n\r\n```\r\napply plugin: 'java'\r\n\r\nconfigurations {\r\n\tcfg\r\n}\r\n\r\ndependencies {\r\n\tcfg files(\"$projectDir/replaceme.zip\")\r\n}\r\n\r\ntask doCopy(type: Copy) {\r\n\r\n\toutputs.upToDateWhen { false }\r\n\tdef templates = zipTree(configurations.cfg.singleFile).matching({ \"folder/*\" }).files;\r\n\tprintln \"TEMPLATES: \" + templates;\r\n\t\r\n\tfrom(templates) {\r\n\t\tinclude '**/replaceme.json'\r\n\t\texpand([bar: \"BBB\"])\r\n\t\t\t\r\n\t}\r\n\t\r\n\tinto \"$buildDir\"\r\n}\r\n```\r\nreplaceme.zip/folder/replaceme.json:\r\n```\r\n{\r\n\t\"foo\": ${bar}\r\n}\r\n```\r\n\r\n\r\n### Your Environment\r\nGradle 2.12 Windows 7 x64\r\n\r\n### Output\r\n\r\n> gradle doCopy --info\r\n> Starting Build\r\n> Settings evaluated using settings file 'C:\\master\\settings.gradle'.\r\n> Projects loaded. Root project using build file 'C:\\git\\gradle\\gradle_bug2\\build.gradle'.\r\n> Included projects: [root project 'gradle_bug2']\r\n> Evaluating root project 'gradle_bug2' using build file 'C:\\git\\gradle\\gradle_bug2\\build.gradle'.\r\n> TEMPLATES: [C:\\git\\gradle\\gradle_bug2\\build\\tmp\\expandedArchives\\replaceme.zip_24fq9z7f0usxdwntyo7ey8sd7\\folder\\replaceme.json]\r\n> All projects evaluated.\r\n> Selected primary task 'doCopy' from project :\r\n> Tasks to be executed: [task ':doCopy']\r\n> :doCopy (Thread[main,5,main]) started.\r\n> :doCopy\r\n> Executing task ':doCopy' (up-to-date check took 0.032 secs) due to:\r\n>   Task.upToDateWhen is false.\r\n> :doCopy (Thread[main,5,main]) completed. Took 0.28 secs.\r\n\r\n> gradle clean doCopy --info\r\n> Starting Build\r\n> Settings evaluated using settings file 'C:\\master\\settings.gradle'.\r\n> Projects loaded. Root project using build file 'C:\\git\\gradle\\gradle_bug2\\build.gradle'.\r\n> Included projects: [root project 'gradle_bug2']\r\n> Evaluating root project 'gradle_bug2' using build file 'C:\\git\\gradle\\gradle_bug2\\build.gradle'.\r\n> TEMPLATES: [C:\\git\\gradle\\gradle_bug2\\build\\tmp\\expandedArchives\\replaceme.zip_24fq9z7f0usxdwntyo7ey8sd7\\folder\\replaceme.json]\r\n> All projects evaluated.\r\n> Selected primary task 'clean' from project :\r\n> Selected primary task 'doCopy' from project :\r\n> Tasks to be executed: [task ':clean', task ':doCopy']\r\n> :clean (Thread[main,5,main]) started.\r\n> :clean\r\n> Executing task ':clean' (up-to-date check took 0.0 secs) due to:\r\n>   Task has not declared any outputs.\r\n> :clean (Thread[main,5,main]) completed. Took 0.019 secs.\r\n> :doCopy (Thread[main,5,main]) started.\r\n> :doCopy\r\n> Skipping task ':doCopy' as it has no source files.\r\n> :doCopy UP-TO-DATE\r\n> :doCopy (Thread[main,5,main]) completed. Took 0.021 secs.\r\n\r\n\r\nThis could be related to https://discuss.gradle.org/t/zip-task-ignores-output-when-checking-if-up-to-date/12003 and GRADLE-2579"},"comment":{"url":"https://api.github.com/repos/gradle/gradle/issues/comments/269028796","html_url":"https://github.com/gradle/gradle/issues/1062#issuecomment-269028796","issue_url":"https://api.github.com/repos/gradle/gradle/issues/1062","id":269028796,"user":{"login":"oehme","id":1191797,"avatar_url":"https://avatars.githubusercontent.com/u/1191797?v=3","gravatar_id":"","url":"https://api.github.com/users/oehme","html_url":"https://github.com/oehme","followers_url":"https://api.github.com/users/oehme/followers","following_url":"https://api.github.com/users/oehme/following{/other_user}","gists_url":"https://api.github.com/users/oehme/gists{/gist_id}","starred_url":"https://api.github.com/users/oehme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oehme/subscriptions","organizations_url":"https://api.github.com/users/oehme/orgs","repos_url":"https://api.github.com/users/oehme/repos","events_url":"https://api.github.com/users/oehme/events{/privacy}","received_events_url":"https://api.github.com/users/oehme/received_events","type":"User","site_admin":false},"created_at":"2016-12-23T18:30:13Z","updated_at":"2016-12-23T18:30:13Z","body":"Calling getFiles unzips the tree, that is expected. getFiles forces any file collection to be realized. The correct way to handle this is to just not call getFiles and instead pass the zipTree itself around."}}
{"actor":{"display_login":"oehme"}}