Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-3122

Copy spec expand() fails on files bigger than 64K

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Won't Fix
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Gradle Forums topic Reference:

      Description

      While attempting to migrate our first project from Maven to Gradle we are running in the following issue.

      Here is a simple gradle script:

      task filterBigFile(type: Copy)

      { from '.' into 'build/big_file_filtered.txt' include 'big_file.txt' expand(expand_me: 'test') }

      If 'big_file' is bigger than 64K, the copy task will fail with the following stacktrace: [1]https://gist.github.com/anonymous/20b...

      Reproduced with Gradle 2.0 and 1.12.

      Filtering with maven is working as expected.

        Activity

        forums Gradle Forums created issue -
        ldaley Luke Daley made changes -
        Field Original Value New Value
        Summary Cannot filter files bigger than 64K Copy spec expand() fails on files bigger than 64K
        Affects Version/s 2.0 [ 10961 ]
        Description While attempting to migrate our first project from Maven to Gradle we are running in the following issue.

        Here is a simple gradle script:

        task filterBigFile(type: Copy) {
        from '.'
        into 'build/big_file_filtered.txt'
        include 'big_file.txt'
        expand(expand_me: 'test')
        }


        If 'big_file' is bigger than 64K, the copy task will fail with the following stacktrace: [1]https://gist.github.com/anonymous/20b...

        Reproduced with Gradle 2.0 and 1.12.

        Filtering with maven is working as expected.

        Any feedback is welcome.

        Thanks,
        Marc
        ----------------------------------------------------------------------------------------
        [1] https://gist.github.com/anonymous/20b64ee5992c312bc01d
        While attempting to migrate our first project from Maven to Gradle we are running in the following issue.

        Here is a simple gradle script:

        task filterBigFile(type: Copy) {
        from '.'
        into 'build/big_file_filtered.txt'
        include 'big_file.txt'
        expand(expand_me: 'test')
        }


        If 'big_file' is bigger than 64K, the copy task will fail with the following stacktrace: [1]https://gist.github.com/anonymous/20b...

        Reproduced with Gradle 2.0 and 1.12.

        Filtering with maven is working as expected.
        ldaley Luke Daley made changes -
        Comment [ btw, this is the Groovy issue: [1]http://jira.codehaus.org/browse/GROOV...
        ----------------------------------------------------------------------------------------
        [1] http://jira.codehaus.org/browse/GROOVY-3457 ]
        ldaley Luke Daley made changes -
        Comment [ Hi Marc,

        Can you try with Gradle 2.0 please to see if this is fixed by the newer Groovy version.

        If it doesn't work what we might look at doing is use [1]https://github.com/mbjarland/groovy-s... as the basis for this templating to get around this limit.
        ----------------------------------------------------------------------------------------
        [1] https://github.com/mbjarland/groovy-streaming-template-engine ]
        ldaley Luke Daley made changes -
        Comment [ Hello Luke, thanks for the hint!

        However, it seems that the filter method as other shortcomings:
        - Using the ReplaceTokens ant filter (as proposed in the documentation) requires a Hashtable, which does not accept null as key or value. So, I cannot directly use the HashMap project.properties.
        - ReplaceTokens only allows a single character delimiter, in turn, we cannot use the maven default syntax (${...}) for filtering (we have some shared resource files that are used both by maven and gradle).

        The documentation only sparingly describes the differences between expand and filter. The 64k limit should really be explicitly stated IMHO.

        I could probably work around these limitations one way or another, but I will submit a ticket on the subject I think. (filtering is such an important feature, we should at least have parity with maven) ]
        ldaley Luke Daley made changes -
        Comment [ expand() just won't work on a file this big. The filter() methods will work though, and will be more efficient. ]
        bmuschko Benjamin Muschko made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            forums Gradle Forums
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development