Debugging Zip task


(Vlad Dumitrescu) #1

Hi!

I have a project where at the end of the build I assemble files in a zip archive. The problem is that it works fine on my development machine, but not on the production Jenkins, and I don’ know how to investigate what is going on. The two machines are setup identically.

Does anyone have any suggestions about what I could do to fix this? Thanks in advance!
/Vlad

What works on both machines:

task assemble(type: Zip) {
    subprojects.each { subproject ->
        dependsOn subproject.build
        def app = "foo"
        into("${subproject.context}") {
            from subproject.file("_build/default/lib/${app}/out")
        }
    }

What works only on the dev machine:

task assemble(type: Zip) {
    subprojects.each { subproject ->
        dependsOn subproject.build
        into("${subproject.context}") {
            from subproject.fileTree("_build/default/lib/").matching { include '**/*.beam', '**/*.app' }.files
        }
    }

(Vlad Dumitrescu) #2

I managed to understand what was going on. The “from” is evaluated before running any tasks and thus the files generated by ‘build’ aren’t there (except on my dev machine). FileTree resolves to files, not the enclosing directory, so the result is that the list is empty. The solution is to use “subproject.file(”_build/default/lib/").list()"