Skip to content

Commit

Permalink
Fix regression of improper assets copy (revert facebook#24518 faceboo…
Browse files Browse the repository at this point in the history
…k#24778) (facebook#25363)

Summary:
Pull requests facebook#24518 facebook#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 facebook#24518 facebook#24778 were merged into 0.60.0-rc release and cause regression.

This pull request will:

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

## Changelog

[Android] [Fixed] - Fix regression of improper assets copy (revert facebook#24518 facebook#24778)
Pull Request resolved: facebook#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 M-i-k-e-l committed Mar 10, 2020
1 parent 13d621e commit 28d90a9
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 28d90a9

Please sign in to comment.