From 99bc31cfa609e838779c29343684365a2ed6169f Mon Sep 17 00:00:00 2001 From: Robert Ying Date: Mon, 24 Jun 2019 01:48:57 -0700 Subject: [PATCH] Fix regression of improper assets copy (revert #24518 #24778) (#25363) Summary: Pull requests https://github.com/facebook/react-native/issues/24518 #24778 make Gradle copy all **generated** assets and resources into `android/app/src/res`, which is a bad behavior, because `src/res` goes into version control and should hold only those **original** resource files. These changes in https://github.com/facebook/react-native/issues/24518 #24778 were merged into 0.60.0-rc release and cause regression. This pull request will: - Revert pull requests https://github.com/facebook/react-native/issues/24518 #24778 - Close https://github.com/facebook/react-native/issues/25325 ## Changelog [Android] [Fixed] - Fix regression of improper assets copy (revert https://github.com/facebook/react-native/issues/24518 #24778) Pull Request resolved: https://github.com/facebook/react-native/pull/25363 Test Plan: It is a revert pull request and the reverted script should work the same as it has in 0.59.x. Differential Revision: D15963329 Pulled By: cpojer fbshipit-source-id: 5619a318dbdb40e816e37b6e37d4fe32caa46e9e --- react.gradle | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/react.gradle b/react.gradle index 9b45a8899c384e..1b8e303c4d4eee 100644 --- a/react.gradle +++ b/react.gradle @@ -64,33 +64,6 @@ afterEvaluate { resourcesDir.mkdirs() } - - // If there are flavors, remember the current flavor for use in the resource path we move from - def flavorPathSegment = "" - android.productFlavors.all { flavor -> - if (targetName.toLowerCase().contains(flavor.name)) { - flavorPathSegment = flavor.name + "/" - } - } - - // Address issue #22234 by moving generated resources into build dir so they are in one spot, not duplicated - doLast { - def moveFunc = { resSuffix -> - File originalDir = file("$buildDir/generated/res/react/${flavorPathSegment}release/${resSuffix}") - if (originalDir.exists()) { - File destDir = file("$buildDir/../src/main/res/${resSuffix}") - ant.move(file: originalDir, tofile: destDir); - } - } - moveFunc.curry("drawable-ldpi").call() - moveFunc.curry("drawable-mdpi").call() - moveFunc.curry("drawable-hdpi").call() - moveFunc.curry("drawable-xhdpi").call() - moveFunc.curry("drawable-xxhdpi").call() - moveFunc.curry("drawable-xxxhdpi").call() - moveFunc.curry("raw").call() - } - // Set up inputs and outputs so gradle can cache the result inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) outputs.dir(jsBundleDir)