{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/buck/issues/341","labels_url":"https://api.github.com/repos/facebook/buck/issues/341/labels{/name}","comments_url":"https://api.github.com/repos/facebook/buck/issues/341/comments","events_url":"https://api.github.com/repos/facebook/buck/issues/341/events","html_url":"https://github.com/facebook/buck/issues/341","id":87842874,"number":341,"title":"Watchman erroneously thinks that nothing was changed when symbolic links are involved","user":{"login":"davido","id":347173,"avatar_url":"https://avatars.githubusercontent.com/u/347173?v=3","gravatar_id":"","url":"https://api.github.com/users/davido","html_url":"https://github.com/davido","followers_url":"https://api.github.com/users/davido/followers","following_url":"https://api.github.com/users/davido/following{/other_user}","gists_url":"https://api.github.com/users/davido/gists{/gist_id}","starred_url":"https://api.github.com/users/davido/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davido/subscriptions","organizations_url":"https://api.github.com/users/davido/orgs","repos_url":"https://api.github.com/users/davido/repos","events_url":"https://api.github.com/users/davido/events{/privacy}","received_events_url":"https://api.github.com/users/davido/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-12T20:35:01Z","updated_at":"2015-06-13T04:57:30Z","closed_at":null,"body":"Gerrit Code Review project uses Buck and can be extended with plugin concept. There are two plugin Buck build modes supported: in Gerrit tree and standalone (Bucklets driven).\r\n\r\nI'm seeing weird stale artifact problem in tree plugin build mode: the plugin is only built once. After that, changing the sources doesn't trigger re-build of the artifact anymore. `buck clean` doesn't help either, only `rm -rf buck-out`.\r\n\r\nI have a very small reproducer, but will try to describe the problem:\r\n\r\n Main project directory structure is\r\n\r\n```\r\ngerrit\r\n|--bucklets/gerrit_plugin.bucklet\r\n|--plugins\r\n```\r\n\r\nPlugin:\r\n\r\n```\r\nfoo\r\n|--BUCK\r\n|--src/main/[...]\r\n```\r\n\r\nThe content of `bucklets/gerrit_plugin.bucklet` is:\r\n\r\n```\r\ndef gerrit_library(\r\n    name,\r\n    srcs = []):\r\n  java_library(\r\n    name = name,\r\n    srcs = srcs,\r\n    visibility = ['PUBLIC'],\r\n  )\r\n```\r\n\r\nThe content of `foo/BUCK` is:\r\n\r\n```\r\ninclude_defs('//bucklets/gerrit_plugin.bucklet')\r\n\r\ngerrit_library(\r\n  name = 'foo',\r\n  srcs = glob(['src/main/java/**/*.java']),\r\n)\r\n```\r\n\r\nNow, when the plugin `foo` is linked to `plugins` directory with symbolic link, we can only build once and never again:\r\n\r\n```\r\n$ cd gerrit\r\n$ buck build plugins/foo:foo\r\nUsing buckd.\r\n[-] PROCESSING BUCK FILES...FINISHED 0,1s\r\n[-] BUILDING...FINISHED 0,2s (1/1 JOBS, 1 UPDATED, 0,0% CACHE HITS)\r\n```\r\n\r\nNow when we change the source file: `plugins/foo/src/main/java/org/ostrovsky/buck/Main.java` and say introduce some compile errors, and re-run, nothing happens:\r\n\r\n```\r\n$ buck build plugins/foo:foo\r\nUsing buckd.\r\n[-] PROCESSING BUCK FILES...FINISHED 0,1s\r\n[-] BUILDING...FINISHED 0,0s (1/1 JOBS, 0 UPDATED)\r\n```\r\n\r\n`buck clean` doesn't help either. The only way to re-trigger the build is to drop `buck-out` directory:\r\n\r\n```\r\n$ rm -rf buck-out/\r\n$ buck build plugins/foo:foo\r\nUsing buckd.\r\n[-] PROCESSING BUCK FILES...FINISHED 0,1s\r\n[+] BUILDING...0,0s (0/1 JOBS, 0 UPDATED)\r\n |=> //plugins/foo:foo...  0,0s (running javac[0,0s])\r\n/home/davido/projects/buck_problem/plugins/foo/src/main/java/org/ostrovsky/buck/Main.java:21: error: illegal start of type\r\n  42\r\n  ^\r\n/home/davido/projects/buck_problem/plugins/foo/src/main/java/org/ostrovsky/buck/Main.java:21: error: ';' expected\r\n  42\r\n    ^\r\nErrors: 2. Warnings: 0.\r\nBUILD FAILED: //plugins/foo:foo failed with exit code 1:\r\n```\r\n\r\nThis problem only occurs, when `foo` is a symbolic link to some directory parallel to `gerrit`:\r\n\r\n```\r\n$ ls -all plugins/\r\nlrwxrwxrwx 1 davido users    9 Jun 12 22:26 foo -> ../../foo\r\n```\r\n\r\nAll is fine when `foo` is a real directory and not a symbolic link."},"comment":{"url":"https://api.github.com/repos/facebook/buck/issues/comments/111670206","html_url":"https://github.com/facebook/buck/issues/341#issuecomment-111670206","issue_url":"https://api.github.com/repos/facebook/buck/issues/341","id":111670206,"user":{"login":"wez","id":117777,"avatar_url":"https://avatars.githubusercontent.com/u/117777?v=3","gravatar_id":"","url":"https://api.github.com/users/wez","html_url":"https://github.com/wez","followers_url":"https://api.github.com/users/wez/followers","following_url":"https://api.github.com/users/wez/following{/other_user}","gists_url":"https://api.github.com/users/wez/gists{/gist_id}","starred_url":"https://api.github.com/users/wez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wez/subscriptions","organizations_url":"https://api.github.com/users/wez/orgs","repos_url":"https://api.github.com/users/wez/repos","events_url":"https://api.github.com/users/wez/events{/privacy}","received_events_url":"https://api.github.com/users/wez/received_events","type":"User","site_admin":false},"created_at":"2015-06-13T04:57:30Z","updated_at":"2015-06-13T04:57:30Z","body":"Watchman does not follow symlinks.  https://github.com/facebook/watchman/issues/105 has some context.  We have no plans to magically and generally make symlinks \"work\" because it seems way too complex to make it work as you might expect.  We may be able to work something out that will make it easier for tools to deal with this situation though.\r\n\r\nIn the absence of any helpers, it sounds like buck should resolve symlink(s) and watch-project on the target path(s) and feed those subscriptions into its watcher implementation.\r\n\r\nWe'll need to brainstorm on this."}}