Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

genrule outdated cache when folders used #642

Closed
artemyarulin opened this issue Feb 3, 2016 · 3 comments
Closed

genrule outdated cache when folders used #642

artemyarulin opened this issue Feb 3, 2016 · 3 comments

Comments

@artemyarulin
Copy link

I have the following BUCK file

genrule(name = 'file1',
        srcs = ['file1'],
        bash = 'mkdir -p $OUT && cp $SRCS $OUT/file',
        out = 'build')

genrule(name = 'file2',
        srcs = ['file2'],
        bash = 'mkdir -p $OUT && cp $SRCS $OUT/file && cd $(location :file1) && cat file >> $OUT/file',
        out = 'build')

When I compile it with clean cache everything is fine:

$ cat file1
file1
$ cat file2
file2
$ buck build file2
[-] PROCESSING BUCK FILES...FINISHED 0.0s [100%]
[-] BUILDING...FINISHED 0.2s [100%] (2/2 JOBS, 2 UPDATED, 100.0% CACHE MISS)
$ cat buck-out/gen/file1/build/file 
file1
$ cat buck-out/gen/file2/build/file 
file2
file1

Although when I change file1 only :file1 target got rebuild, :file2 target still using an old version

$ echo 0 >> file1
$ buck build file2
[-] PROCESSING BUCK FILES...FINISHED 0.0s
[-] BUILDING...FINISHED 0.0s [100%] (2/2 JOBS, 1 UPDATED, 50.0% CACHE MISS)
$ cat buck-out/gen/file1/build/file 
file1
0
$ cat buck-out/gen/file2/build/file 
file2
file1

When I use simple files then it works just fine with following BUCK file:

genrule(name = 'file3',
        srcs = ['file3'],
        bash = 'cat $SRCS > $OUT',
        out = 'build')

genrule(name = 'file4',
        srcs = ['file4'],
        bash = 'cat $SRCS > $OUT && cat $(location :file3) >> $OUT',
        out = 'build')

So, it looks like it doesn't work only when folders got used. I'm using buck version v2016.01.18.01

@artemyarulin
Copy link
Author

Update to this: If I rename :file1 target out to 'build1' for example, then it rebuilds properly. So it looks like genrule checks that folder is there, it's the same - and doesn't do a rebuild

@k21
Copy link
Contributor

k21 commented Feb 3, 2016

A similar bug was fixed in 435cbc0. Can you please try if you can reproduce the issue with the latest release?

@artemyarulin
Copy link
Author

Yeah, it's fixed, thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants