Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- doLast {
- def moveFunc = { resSuffix ->
- File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
- if (originalDir.exists()) {
- File destDir = file("$buildDir/../src/main/res/drawable-${resSuffix}");
- ant.move(file: originalDir, tofile: destDir);
- }
- }
- def appJsonFunc = { resSuffix ->
- File appJsonFile = file("$buildDir/generated/res/react/release/raw/${resSuffix}");
- if (appJsonFile.exists()) {
- File destappJsonFile = file("$buildDir/../src/main/res/raw/${resSuffix}");
- ant.move(file: appJsonFile, tofile: destappJsonFile);
- }
- }
- def flavorPathSegment = ""
- android.productFlavors.all { flavor ->
- if (targetName.toLowerCase().contains(flavor.name)) {
- flavorPathSegment = flavor.name + "/"
- }
- }
- def moveRawFunc = { dir ->
- File originalDir = file("$buildDir/generated/res/react/${flavorPathSegment}release/${dir}");
- if (originalDir.exists()) {
- File destDir = file("$buildDir/../src/main/res/${dir}");
- ant.move(file: originalDir, tofile: destDir);
- }
- }
- moveFunc.curry("ldpi").call();
- moveFunc.curry("mdpi").call();
- moveFunc.curry("hdpi").call();
- moveFunc.curry("xhdpi").call();
- moveFunc.curry("xxhdpi").call();
- moveFunc.curry("xxxhdpi").call();
- appJsonFunc.curry("app.json").call();
- moveRawFunc.curry("raw").call()
- }
Add Comment
Please, Sign In to add comment