please icon indicating copy to clipboard operation
please copied to clipboard

plz clean doesn't remove LinkGeneratedSources'ed links

Open sean- opened this issue 1 year ago • 4 comments

When using LinkGeneratedSources, the linked files aren't cleaned up when executing a plz clean.

[Build]
LinkGeneratedSources = soft
UpdateGitignore = true
$ ls -lA
total 40
-rw-r--r--  1 seanc  staff   171 Apr 18 09:10 .gitignore
-rw-r--r--  1 seanc  staff  1617 Apr 18 09:11 BUILD.plz
drwxr-xr-x  5 seanc  staff   160 Apr 18 09:10 loglevel
$ plz build
Build finished; total time 3.2s, incrementality 91.6%. Outputs:
//resources/pkl/mycmd:gen-go:
  /Users/seanc/src/example/mycmd/plz-out/gen/resources/pkl/mycmd/Config.pkl.go
  /Users/seanc/src/example/mycmd/plz-out/gen/resources/pkl/mycmd/init.pkl.go
//resources/pkl/mycmd:mycmd:
  /Users/seanc/src/example/mycmd/plz-out/gen/resources/pkl/mycmd/mycmd.a
//resources/pkl/mycmd/loglevel:loglevel:
  /Users/seanc/src/example/mycmd/plz-out/gen/resources/pkl/mycmd/loglevel/loglevel.a
$ plz clean
$ ls -lA
total 40
-rw-r--r--  1 seanc  staff   171 Apr 18 09:10 .gitignore
-rw-r--r--  1 seanc  staff  1617 Apr 18 09:11 BUILD.plz
lrwxr-xr-x  1 seanc  staff    80 Apr 18 09:35 Config.pkl.go -> /Users/seanc/src/example/mycmd/plz-out/gen/resources/pkl/mycmd/Config.pkl.go
lrwxr-xr-x  1 seanc  staff    78 Apr 18 09:35 init.pkl.go -> /Users/seanc/src/example/mycmd/plz-out/gen/resources/pkl/mycmd/init.pkl.go
drwxr-xr-x  5 seanc  staff   160 Apr 18 09:10 loglevel
-rw-r--r--  1 seanc  staff  1972 Apr 17 22:29 mycmd.pkl

Maybe this is just a call to git clean?

sean- avatar Apr 18 '24 16:04 sean-

Thanks for pointing this out. I don't think a git clean will work if you have UpdateGitignore true. I'll take a look and see if there's anything we can do. Does it cause you other issues other than the links just cluttering up the directory?

goddenrich avatar Apr 18 '24 16:04 goddenrich

No actual issues, I intended to just point this out. I just discovered LinkGeneratedSources and was looking closely at my local dev environment and noticed I had a few dead symlinks from old .pkl.go files as I was iterating. With git clean -f -X . that would work:

$ cd resources/pkl/mycmd && git clean -f  -X .
Removing Config.pkl.go
Removing init.pkl.go

sean- avatar Apr 18 '24 17:04 sean-

Ah nice -X. I wasn't aware of that flag thanks for that

goddenrich avatar Apr 18 '24 17:04 goddenrich