This message was deleted.
# general
s
This message was deleted.
t
Something's weird with your tasks' setup:
copyClient
copies from
client/dist
but
client
declares the whole
client/
as inputs and
buildDir
as outputs.
d
bear in mind 2 things: 1. this all works if cachIf is false 2. I have no idea what I’m doing here, it was more or less copy and paste from the internet so are you saying that maybe the issue is that I’m declaring the output as an input? Perhaps if I exclude
client/dist
from the inputs it might help?
ok, I excluded the
dist
directory from inputs (used
fileTree
but I still have the same issue. Do I need to do something with the outputs? How does the cache work, what does it check to see is changed and what is put in there?
t
The cache will record and later restore the task's outputs, whenever the task's inputs match a previous cache entry. Your
outputs.dir(buildDir)
does not seem to match the actual task's outputs: it will never save the
client/dist
, which also means it will never restore it either, so getting the task outputs from the cache will get you an empty
client/dist
(more accurately, it won't change it, and I'm assuming you build "from scratch") It's important to correctly describe your inputs and outputs to get up-to-date checks (aka incremental builds) and then caching right.
d
ok, got it. now what I don’t know is where the output’s client/dist will live. Does gradle copy or link to the inputs in some sandbox or build area, then run the task on those and therefore the dist folder will be in that area? Or will the task end up producing a dist folder in the source code directory?
t
Gradle won't setup any sandbox, so if your Yarn build generates in
client/dist
, it will be in
client/dist
. If you can, configure your Yarn build to output outside of
client
(ideally somewhere inside the
buildDir
)
d
a quick test shows that it does in fact produce the output in the source code directory directly. Thanks for your help on this!