Created
March 14, 2013 03:17
-
-
Save XavierTalpe/5158552 to your computer and use it in GitHub Desktop.
Bugfix for copying assets using v0.3 of the Android Gradle build system. This allows assets to be recursively copied into the APK.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task copyAssetsRec { | |
| description 'Temporary fix to recursively add folders and files from assets. Remove in v0.4.' | |
| ext.assetsSrcDir = file( "${projectDir}/src/main/assets" ) | |
| ext.assetsBuildDir = file( "${buildDir}/assets" ) | |
| inputs.dir assetsSrcDir | |
| outputs.dir assetsBuildDir | |
| doLast { | |
| android.buildVariants.each { target -> | |
| copy { | |
| from assetsSrcDir | |
| into "${assetsBuildDir}/${target.dirName}" | |
| } | |
| } | |
| } | |
| } | |
| copyAssetsRec.dependsOn { | |
| tasks.matching { task -> task.name.startsWith( 'merge' ) && task.name.endsWith( 'Assets' ) } | |
| } | |
| tasks.withType( Compile ) { | |
| compileTask -> compileTask.dependsOn copyAssetsRec | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment