{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/infer/issues/898","repository_url":"https://api.github.com/repos/facebook/infer","labels_url":"https://api.github.com/repos/facebook/infer/issues/898/labels{/name}","comments_url":"https://api.github.com/repos/facebook/infer/issues/898/comments","events_url":"https://api.github.com/repos/facebook/infer/issues/898/events","html_url":"https://github.com/facebook/infer/issues/898","id":317106239,"number":898,"title":"Differential workflow with Buck + dependencies","user":{"login":"varun531","id":113397,"avatar_url":"https://avatars0.githubusercontent.com/u/113397?v=4","gravatar_id":"","url":"https://api.github.com/users/varun531","html_url":"https://github.com/varun531","followers_url":"https://api.github.com/users/varun531/followers","following_url":"https://api.github.com/users/varun531/following{/other_user}","gists_url":"https://api.github.com/users/varun531/gists{/gist_id}","starred_url":"https://api.github.com/users/varun531/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varun531/subscriptions","organizations_url":"https://api.github.com/users/varun531/orgs","repos_url":"https://api.github.com/users/varun531/repos","events_url":"https://api.github.com/users/varun531/events{/privacy}","received_events_url":"https://api.github.com/users/varun531/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-24T07:41:19Z","updated_at":"2018-04-26T10:11:41Z","closed_at":null,"author_association":"NONE","body":"Suppose I have an iOS Buck project (Obj-C files), with the following dependency graph:\r\n\r\n**AppModule** --(depends on)--> **Dependency1** --(depends on)--> **Dependency2**\r\n\r\nand **AppModule** is a top-level target, i.e. building it produces a _.app_ bundle.\r\n\r\nIf I push a change to CI that modifies **Dependency2** (I add a new Objective-c .m file to it), does running `infer capture -- buck build AppModule` collect the compile commands for the added file in **Dependency2**? Or do I need to explicitly run `infer capture -- buck build Dependency2`?\r\n\r\nMore generally, with Buck, if I make changes in my project that create the need for new compile commands to be stored in `infer` (I add new source files to a module), or to _update_ the compile commands stored in `infer` (I make a source file in one module dependent on a source file in another module), do I have to explicitly (by name), build the modified modules in buck so that `infer` can capture the required compile commands, or can I just build the top-level module (like an app) that either directly, or transitively, uses the modified modules, and have `infer` capture the relevant compile commands that way?\r\n\r\nI would also love some insight as to how Facebook itself uses `infer` with `buck`, for understanding of best practices. For example, how would you handle the above case from commit to commit? And do you prefer to work with compilation databases, or buck output for harvesting compile commands?\r\n\r\nAny help is much appreciated!\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/infer/issues/comments/384587011","html_url":"https://github.com/facebook/infer/issues/898#issuecomment-384587011","issue_url":"https://api.github.com/repos/facebook/infer/issues/898","id":384587011,"user":{"login":"jvillard","id":1083541,"avatar_url":"https://avatars1.githubusercontent.com/u/1083541?v=4","gravatar_id":"","url":"https://api.github.com/users/jvillard","html_url":"https://github.com/jvillard","followers_url":"https://api.github.com/users/jvillard/followers","following_url":"https://api.github.com/users/jvillard/following{/other_user}","gists_url":"https://api.github.com/users/jvillard/gists{/gist_id}","starred_url":"https://api.github.com/users/jvillard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvillard/subscriptions","organizations_url":"https://api.github.com/users/jvillard/orgs","repos_url":"https://api.github.com/users/jvillard/repos","events_url":"https://api.github.com/users/jvillard/events{/privacy}","received_events_url":"https://api.github.com/users/jvillard/received_events","type":"User","site_admin":false},"created_at":"2018-04-26T10:11:41Z","updated_at":"2018-04-26T10:11:41Z","author_association":"CONTRIBUTOR","body":"`infer capture` in general will \"see\" everything that the compilation command recompiles. In your scenario, since **Dependency2** has chnaged, `buck build AppModule` should rebuild all the targets, since they all depend on **Dependency2**, and infer will capture the compilation of all the source files.\r\n\r\n> More generally, with Buck, ...\r\n\r\nAs above, capturing a target will capture everything that gets built by Buck, so if you are building the whole app it will in particular build your target.\r\n\r\nNote that Buck maintains a cache in buck-out/. Everything I've said above relies on the fact that you are doing a \"clean\" build, i.e. first removing buck-out/.\r\n\r\n> I would also love some insight as to how Facebook itself uses infer with buck, for understanding of best practices. For example, how would you handle the above case from commit to commit?\r\n\r\nOur integration works by running infer on the top commit, then removing buck-out/ and running infer on the base commit, then comparing the results with `infer-reportdiff`. We still benefit from Buck's distributed cache to get fast incremental results, as most of what we need to analyse will already be in cache.\r\n\r\n> And do you prefer to work with compilation databases, or buck output for harvesting compile commands?\r\n\r\nWe rely on the Buck integration (`infer -- buck build target`) to run all the analyses of infer, so that we benefit from Buck's distributed cache, except the clang linters for which we work with compilation databases (because they're fast enough to run without the Buck cache)."}}
{"actor":{"display_login":"jvillard"}}