Skip to content

Instantly share code, notes, and snippets.

@ghale
Last active June 25, 2020 22:32
Show Gist options
  • Save ghale/207bc39ffcda0b1417b6c2f040b54134 to your computer and use it in GitHub Desktop.
Save ghale/207bc39ffcda0b1417b6c2f040b54134 to your computer and use it in GitHub Desktop.
Workaround for old version of Apollo graphql
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