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
This commit is contained in:
Robert Ying 2019-06-24 01:48:57 -07:00 коммит произвёл Facebook Github Bot
Родитель a833778553
Коммит 58beaf02ec
1 изменённых файлов: 0 добавлений и 27 удалений

Просмотреть файл

@ -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)