mardi 29 mars 2016

Gradle Copy task does not copy files

I have the following task to copy files from my android projects resources files to a different path that is accessible by a ClassLoader instance in a unit test.

task copyResDirectoryToClasses(type: Copy){
    println 'COPYINGCOPYINGCOPYING!!!!!!!!!!!!!!!!!!!!'
    println "$projectDir/src/test/java/com/textmeinc/topmeup/resources/"
    println "$buildDir/intermediates/classes/test/staging/debug/"

    from "$projectDir/app/src/test/java/com/textmeinc/topmeup/resources/mock.json"
    into  "$buildDir/intermediates/classes/staging/debug/mock.json"
}

assembleDebug.dependsOn(copyResDirectoryToClasses)

I see the task run in my gradle console.

Parallel execution with configuration on demand is an incubating feature.
COPYINGCOPYINGCOPYING!!!!!!!!!!!!!!!!!!!!
/Users/tylerpfaff/Documents/Development/topmeup-android/app/src/test/java/com/textmeinc/topmeup/resources/
/Users/tylerpfaff/Documents/Development/topmeup-android/app/build/intermediates/classes/test/staging/debug/

However, no files are transferred. If I manually move them in the terminal, my tests run fine with my mock.json file. Why isn't the copy working?

This is the command I used to copy the file manually.

cp /Users/tylerpfaff/Documents/Development/topmeup-android/app/src/test/java/com/textmeinc/topmeup/resources/mock.json /Users/tylerpfaff/Documents/Development/topmeup-android/app/build/intermediates/classes/test/staging/debug/

Aucun commentaire:

Enregistrer un commentaire