mfn

react.gradle fix

mfn
Jan 10th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.80 KB | None | 0 0
  1.             doLast {
  2.               def moveFunc = { resSuffix ->
  3.                 File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
  4.                 if (originalDir.exists()) {
  5.                   File destDir = file("$buildDir/../src/main/res/drawable-${resSuffix}");
  6.                   ant.move(file: originalDir, tofile: destDir);
  7.                 }
  8.               }
  9.               def appJsonFunc = { resSuffix ->
  10.                 File appJsonFile = file("$buildDir/generated/res/react/release/raw/${resSuffix}");
  11.                 if (appJsonFile.exists()) {
  12.                   File destappJsonFile = file("$buildDir/../src/main/res/raw/${resSuffix}");
  13.                   ant.move(file: appJsonFile, tofile: destappJsonFile);
  14.                 }
  15.               }
  16.               def flavorPathSegment = ""
  17.               android.productFlavors.all { flavor ->
  18.                   if (targetName.toLowerCase().contains(flavor.name)) {
  19.                       flavorPathSegment = flavor.name + "/"
  20.                   }
  21.               }
  22.               def moveRawFunc = { dir ->
  23.                     File originalDir = file("$buildDir/generated/res/react/${flavorPathSegment}release/${dir}");
  24.                 if (originalDir.exists()) {
  25.                   File destDir = file("$buildDir/../src/main/res/${dir}");
  26.                   ant.move(file: originalDir, tofile: destDir);
  27.                 }
  28.               }
  29.               moveFunc.curry("ldpi").call();
  30.               moveFunc.curry("mdpi").call();
  31.               moveFunc.curry("hdpi").call();
  32.               moveFunc.curry("xhdpi").call();
  33.               moveFunc.curry("xxhdpi").call();
  34.               moveFunc.curry("xxxhdpi").call();
  35.               appJsonFunc.curry("app.json").call();
  36.               moveRawFunc.curry("raw").call()
  37.             }
Add Comment
Please, Sign In to add comment