Skip to content

Commit

Permalink
Fix regression of improper assets copy (revert #24518 #24778) (#25363)
Browse files Browse the repository at this point in the history
Summary:
Pull requests #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 #24518 #24778 were merged into 0.60.0-rc release and cause regression.

This pull request will:

- Revert pull requests #24518 #24778
- Close #25325

## Changelog

[Android] [Fixed] - Fix regression of improper assets copy (revert #24518 #24778)
Pull Request resolved: #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
  • Loading branch information
robertying authored and kelset committed Jun 28, 2019
1 parent c36c481 commit 99bc31c
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions react.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 99bc31c

Please sign in to comment.