Last active
July 11, 2020 12:53
-
-
Save ghale/c5318501da2d50a9f084812e1c9e9bbc to your computer and use it in GitHub Desktop.
Workaround for MergeResources cache miss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks.withType(com.android.build.gradle.tasks.MergeResources) { task -> | |
Map<String, FileCollection> originalResources = [:] | |
// Create a synthetic input with the original value and RELATIVE path sensitivity | |
project.gradle.taskGraph.beforeTask { | |
if (it == task) { | |
originalResources.putAll(task.resourcesComputer.resources) | |
task.resourcesComputer.resources.clear() | |
task.inputs.files(originalResources.values()) | |
.withPathSensitivity(PathSensitivity.RELATIVE) | |
.withPropertyName("rawLocalResources.workaround") | |
} | |
} | |
// Set the source back to its original value before we execute the main task action | |
task.doFirst { | |
task.resourcesComputer.resources.putAll(originalResources) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment