This message was deleted.
# community-support
s
This message was deleted.
m
I was attempting to model this flow: 1. Task runs some external service 2. That external service returns some data 3. Another task that takes that data, adds a property 4. Other tasks use the existence of that property in an
onlyIf
block
m
Have you considered a shared build service to store the data? Tasks can talk to it to put, mutate, and query the data.
m
I considered going down this route but this logic would have to interact with a
Project
object which isn't configuration-cache safe AFAIK
a
what sort of data does the external service return? E.g. A lot of files? Or a REST response with a couple of properties?
m
It would be a list of
File
s, yup!
a
okay, cool, and what property does the task in step 3 add? It edits the file’s text content, like find/replacing a version number, or applying a git diff - something like that?
maybe instead of an
onlyIf {}
block you want to just change the other tasks to only process files that contain the property.
Copy code
val downloaderTask by tasks.registering { ... }

val processorTask by tasks.registering { ... }

val otherTask by tasks.registering {
  val processedFilesWithProperty = processorTask.map {
      it.outputDirectory.asFileTree.files.filter { file -> 
          "xyzProperty" in file.readText() 
      }
  }
  inputs.files(processedFilesWithProperty)

  doLast {
    val files = processedFilesWithProperty.get()
    // ...
  }
}
m
Oh this is a good idea too - thanks, lemme run with this for a second