{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/buck/issues/342","labels_url":"https://api.github.com/repos/facebook/buck/issues/342/labels{/name}","comments_url":"https://api.github.com/repos/facebook/buck/issues/342/comments","events_url":"https://api.github.com/repos/facebook/buck/issues/342/events","html_url":"https://github.com/facebook/buck/issues/342","id":87928787,"number":342,"title":"Artifact is not re-created when it was manually removed","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":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-06-13T04:42:16Z","updated_at":"2015-06-24T12:47:12Z","closed_at":"2015-06-15T17:24:38Z","body":"So I disabled watchman for now, and have a simple `java_library()` rule with jar outcome, as described in #341:\r\n\r\n```\r\n$ buck targets --json plugins/foo:foo\r\nNot using buckd because watchman isn't installed.\r\n[+] PARSING BUCK FILES...0,1s\r\n[\r\n{\r\n  \"annotationProcessorDeps\" : [ ],\r\n  \"annotationProcessorOnly\" : null,\r\n  \"annotationProcessorParams\" : [ ],\r\n  \"annotationProcessors\" : [ ],\r\n  \"buck.base_path\" : \"plugins/foo\",\r\n  \"deps\" : [ ],\r\n  \"exportedDeps\" : [ ],\r\n  \"extraArguments\" : [ ],\r\n  \"javac\" : null,\r\n  \"javacJar\" : null,\r\n  \"name\" : \"foo\",\r\n  \"postprocessClassesCommands\" : [ ],\r\n  \"proguardConfig\" : null,\r\n  \"providedDeps\" : [ ],\r\n  \"resources\" : [ ],\r\n  \"resourcesRoot\" : null,\r\n  \"source\" : null,\r\n  \"srcs\" : [ \"src/main/java/org/ostrovsky/buck/Main.java\" ],\r\n  \"target\" : null,\r\n  \"type\" : \"java_library\",\r\n  \"visibility\" : [ \"PUBLIC\" ]\r\n}\r\n]\r\n\r\n$ buck targets --show_output plugins/foo:foo\r\nNot using buckd because watchman isn't installed.\r\n[+] PARSING BUCK FILES...0,1s\r\n//plugins/foo:foo buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\n```\r\n\r\nRunning it creates the artifact `buck-out/gen/plugins/foo/lib__foo__output/foo.jar`:\r\n\r\n```\r\n$ buck build plugins/foo:foo\r\nNot using buckd because watchman isn't installed.\r\n[-] PROCESSING BUCK FILES...FINISHED 0,0s\r\n[-] BUILDING...FINISHED 0,2s (1/1 JOBS)\r\n\r\n$ ls -all buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\n-rw-r--r-- 1 davido users 1589 Jun 13 06:32 buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\n```\r\n\r\nHowever, when this artifact is removed for some reasons, I would expect Buck invocation re-creates it, but it doesn't happen:\r\n\r\n```\r\n$ rm buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\n\r\n$ buck build plugins/foo:foo\r\nNot using buckd because watchman isn't installed.\r\n[-] PROCESSING BUCK FILES...FINISHED 0,0s\r\n[-] BUILDING...FINISHED 0,2s (1/1 JOBS)\r\n\r\n$ ls -all buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\nls: cannot access buck-out/gen/plugins/foo/lib__foo__output/foo.jar: No such file or directory\r\n```\r\n\r\nEven when I remove the cache entry for this target, it's not re-created:\r\n\r\n```\r\n$ buck targets --show-rulekey plugins/foo:foo\r\nNot using buckd because watchman isn't installed.\r\n[+] PARSING BUCK FILES...0,1s\r\n//plugins/foo:foo 77c8818e718a4f5d1356ed0347e9fd09cfdac92b\r\n\r\n$ rm -rf ./buck-out/cache/77c8818e718a4f5d1356ed0347e9fd09cfdac92b\r\n\r\n$ buck build plugins/foo:foo\r\nNot using buckd because watchman isn't installed.\r\n[-] PROCESSING BUCK FILES...FINISHED 0,0s\r\n[-] BUILDING...FINISHED 0,2s (1/1 JOBS)\r\n\r\n$ ls -all buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\nls: cannot access buck-out/gen/plugins/foo/lib__foo__output/foo.jar: No such file or directory\r\n```\r\n\r\nThe only known way to recover from here is to run `buck clean`:\r\n\r\n```\r\n$ buck clean\r\nNot using buckd because watchman isn't installed.\r\n\r\n$ buck build plugins/foo:foo\r\nNot using buckd because watchman isn't installed.\r\n[-] PROCESSING BUCK FILES...FINISHED 0,0s\r\n[-] BUILDING...FINISHED 0,6s (1/1 JOBS)\r\n\r\n$ ls -all buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\n-rw-r--r-- 1 davido users 1589 Jun 13 06:40 buck-out/gen/plugins/foo/lib__foo__output/foo.jar\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/buck/issues/comments/114856693","html_url":"https://github.com/facebook/buck/issues/342#issuecomment-114856693","issue_url":"https://api.github.com/repos/facebook/buck/issues/342","id":114856693,"user":{"login":"shs96c","id":28229,"avatar_url":"https://avatars.githubusercontent.com/u/28229?v=3","gravatar_id":"","url":"https://api.github.com/users/shs96c","html_url":"https://github.com/shs96c","followers_url":"https://api.github.com/users/shs96c/followers","following_url":"https://api.github.com/users/shs96c/following{/other_user}","gists_url":"https://api.github.com/users/shs96c/gists{/gist_id}","starred_url":"https://api.github.com/users/shs96c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shs96c/subscriptions","organizations_url":"https://api.github.com/users/shs96c/orgs","repos_url":"https://api.github.com/users/shs96c/repos","events_url":"https://api.github.com/users/shs96c/events{/privacy}","received_events_url":"https://api.github.com/users/shs96c/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T12:47:11Z","updated_at":"2015-06-24T12:47:11Z","body":"There's someone working on maven interop right now (we should see some diffs land soon). We'll probably either extend \"buck install\" or add a new command to handle pushing artifacts to maven central.\r\n\r\nIf you're interested in hacking on it, I think the first step would be to add an optional \"maven_coord\", \"binary_sha1\" and \"source_sha1\" to \"prebuilt_jar\" and allow us to (optionally) download the jar by adding \"remote_file\" rules into the action graph if necessary.\r\n\r\nThere's still some thinking to be done on minimizing the number of artifacts that we'd push to a maven repo --- naively, you can imagine one artifact per buck target, but that would be a nightmare to maintain, and I'd not want to have to handle versioning :)\r\n\r\nConceptually, Buck is a build tool, rather than SDLC tool. More concretely, \"buck build\" is just for the assembly of artifacts: side-effects break the functional model it's based on. Other phases of an artifact's lifecycle are handled by separate commands, and support side-effects. For example, things like deploying or running commands are handled by \"buck install\", \"buck run\" and \"buck test\" respectively."}}