Last active
June 25, 2020 22:32
-
-
Save ghale/207bc39ffcda0b1417b6c2f040b54134 to your computer and use it in GitHub Desktop.
Workaround for old version of Apollo graphql
This file contains hidden or 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.apollographql.apollo.gradle.ApolloCodegenTask).configureEach { task -> | |
FileTree originalSource | |
// Create a synthetic input with the original source value and RELATIVE path sensitivity | |
project.gradle.taskGraph.beforeTask { | |
if (it == task) { | |
originalSource = task.getSource() | |
// Set the source to something static for the purpose of input calculation | |
task.source = fileTree("foo") | |
task.inputs.files(originalSource) | |
.withPathSensitivity(PathSensitivity.RELATIVE) | |
.withPropertyName("source.workaround") | |
.skipWhenEmpty() | |
} | |
} | |
// Set the source back to its original value before we execute the main task action | |
task.doFirst { | |
task.source = originalSource | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment