Issue
project is Gradle based
I have this command
apollo schema:download --endpoint=https://*******************************/graphql schema.json
this downloads json file from that endpoint then I put that file under the schema(name) package, manually, this is what I tried I worked this command and put it under the package is there any way to do this with scripts so this is automatically done?
I tried this
task<Exec>("apollo") {
commandLine("exec", "apollo schema:download --endpoint=https://*************************/graphql schema.json")
}
I want to do ./gradlew build and during build also run this apollo command
Solution
You can make your build task depend on another task like this:
task downloadStuff {
logger.error('Downloading dependency.')
logger.error('Moving dependency somewhere or whatever.')
}
build {
dependsOn downloadStuff
}
Make sure to add it to the root project build.gradle
file if you have multiple and it should also be top level.
Answered By - void void
Answer Checked By - Pedro (JavaFixing Volunteer)