{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/buck/pulls/comments/77210967","id":77210967,"diff_hunk":"@@ -0,0 +1,109 @@\n+/*\n+ * Copyright 2016-present Facebook, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n+ * not use this file except in compliance with the License. You may obtain\n+ * a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package com.facebook.buck.swift;\n+\n+import static com.facebook.buck.swift.SwiftDescriptions.isSharedRequested;\n+\n+import com.facebook.buck.apple.AppleCxxPlatform;\n+import com.facebook.buck.cxx.CxxPlatform;\n+import com.facebook.buck.cxx.Linker;\n+import com.facebook.buck.cxx.NativeLinkable;\n+import com.facebook.buck.cxx.NativeLinkableInput;\n+import com.facebook.buck.model.BuildTarget;\n+import com.facebook.buck.model.Flavor;\n+import com.facebook.buck.model.ImmutableFlavor;\n+import com.facebook.buck.parser.NoSuchBuildTargetException;\n+import com.facebook.buck.rules.SourcePath;\n+import com.facebook.buck.rules.args.StringArg;\n+import com.google.common.collect.ImmutableMap;\n+import com.google.common.collect.ImmutableSet;\n+\n+import java.nio.file.Path;\n+\n+/**\n+ * Pseudo linkable for representing Swift runtime library's linker arguments.\n+ */\n+final class SwiftRuntimeNativeLinkable implements NativeLinkable {","path":"src/com/facebook/buck/swift/SwiftRuntimeNativeLinkable.java","position":39,"original_position":40,"commit_id":"3e88e3000e28c8a02f244cdb66a90f6ab55f9603","original_commit_id":"df35172257e37364db2df7a663fe6724e75419df","user":{"login":"nguyentruongtho","id":1457567,"avatar_url":"https://avatars.githubusercontent.com/u/1457567?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyentruongtho","html_url":"https://github.com/nguyentruongtho","followers_url":"https://api.github.com/users/nguyentruongtho/followers","following_url":"https://api.github.com/users/nguyentruongtho/following{/other_user}","gists_url":"https://api.github.com/users/nguyentruongtho/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyentruongtho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyentruongtho/subscriptions","organizations_url":"https://api.github.com/users/nguyentruongtho/orgs","repos_url":"https://api.github.com/users/nguyentruongtho/repos","events_url":"https://api.github.com/users/nguyentruongtho/events{/privacy}","received_events_url":"https://api.github.com/users/nguyentruongtho/received_events","type":"User","site_admin":false},"body":"I think the problem with NativeLinkableInput is that it is concatenated in order (that is why we are using `ImmutableList` in [here](https://github.com/facebook/buck/blob/1e1d14f23616505309e4349bdc83867c75379672/src/com/facebook/buck/cxx/AbstractNativeLinkableInput.java#L62-L62)).\r\n\r\nUsing pseudo `NativeLinkable` works, since all `NativeLinkable` created in `SwiftLibrary#getNativeLinkableDeps` has the same build target, therefore you will have only one `SwiftRuntimeNativeLinkable` instance in the list of accumulated linkables after this: https://github.com/facebook/buck/blob/b83ae5538a7c553ccd10f06b2ee034dccfa412d6/src/com/facebook/buck/cxx/NativeLinkables.java#L231-L238. \r\n\r\nI've already tested. It works pretty well. There could be still a duplication because of this https://github.com/facebook/buck/blob/34fedbea306a4b02bd47d1e5d8847a6bac87f780/src/com/facebook/buck/swift/SwiftLibraryDescription.java#L287-L287. But there can only be a duplication of 2 at most.","created_at":"2016-09-01T16:48:02Z","updated_at":"2016-09-01T16:48:02Z","html_url":"https://github.com/facebook/buck/pull/862#discussion_r77210967","pull_request_url":"https://api.github.com/repos/facebook/buck/pulls/862","_links":{"self":{"href":"https://api.github.com/repos/facebook/buck/pulls/comments/77210967"},"html":{"href":"https://github.com/facebook/buck/pull/862#discussion_r77210967"},"pull_request":{"href":"https://api.github.com/repos/facebook/buck/pulls/862"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/buck/pulls/862","id":82781092,"html_url":"https://github.com/facebook/buck/pull/862","diff_url":"https://github.com/facebook/buck/pull/862.diff","patch_url":"https://github.com/facebook/buck/pull/862.patch","issue_url":"https://api.github.com/repos/facebook/buck/issues/862","number":862,"state":"open","locked":false,"title":"Dynamic library support for swift","user":{"login":"nguyentruongtho","id":1457567,"avatar_url":"https://avatars.githubusercontent.com/u/1457567?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyentruongtho","html_url":"https://github.com/nguyentruongtho","followers_url":"https://api.github.com/users/nguyentruongtho/followers","following_url":"https://api.github.com/users/nguyentruongtho/following{/other_user}","gists_url":"https://api.github.com/users/nguyentruongtho/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyentruongtho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyentruongtho/subscriptions","organizations_url":"https://api.github.com/users/nguyentruongtho/orgs","repos_url":"https://api.github.com/users/nguyentruongtho/repos","events_url":"https://api.github.com/users/nguyentruongtho/events{/privacy}","received_events_url":"https://api.github.com/users/nguyentruongtho/received_events","type":"User","site_admin":false},"body":"Enable `swift_library` target to create dynamic library.\r\n\r\n","created_at":"2016-08-25T19:45:30Z","updated_at":"2016-09-01T16:48:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c1ae279d38fb916ec6fed12be02423d264cdfad","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/buck/pulls/862/commits","review_comments_url":"https://api.github.com/repos/facebook/buck/pulls/862/comments","review_comment_url":"https://api.github.com/repos/facebook/buck/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/buck/issues/862/comments","statuses_url":"https://api.github.com/repos/facebook/buck/statuses/3e88e3000e28c8a02f244cdb66a90f6ab55f9603","head":{"label":"nguyentruongtho:tho/dylibs","ref":"tho/dylibs","sha":"3e88e3000e28c8a02f244cdb66a90f6ab55f9603","user":{"login":"nguyentruongtho","id":1457567,"avatar_url":"https://avatars.githubusercontent.com/u/1457567?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyentruongtho","html_url":"https://github.com/nguyentruongtho","followers_url":"https://api.github.com/users/nguyentruongtho/followers","following_url":"https://api.github.com/users/nguyentruongtho/following{/other_user}","gists_url":"https://api.github.com/users/nguyentruongtho/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyentruongtho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyentruongtho/subscriptions","organizations_url":"https://api.github.com/users/nguyentruongtho/orgs","repos_url":"https://api.github.com/users/nguyentruongtho/repos","events_url":"https://api.github.com/users/nguyentruongtho/events{/privacy}","received_events_url":"https://api.github.com/users/nguyentruongtho/received_events","type":"User","site_admin":false},"repo":{"id":56134505,"name":"buck","full_name":"nguyentruongtho/buck","owner":{"login":"nguyentruongtho","id":1457567,"avatar_url":"https://avatars.githubusercontent.com/u/1457567?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyentruongtho","html_url":"https://github.com/nguyentruongtho","followers_url":"https://api.github.com/users/nguyentruongtho/followers","following_url":"https://api.github.com/users/nguyentruongtho/following{/other_user}","gists_url":"https://api.github.com/users/nguyentruongtho/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyentruongtho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyentruongtho/subscriptions","organizations_url":"https://api.github.com/users/nguyentruongtho/orgs","repos_url":"https://api.github.com/users/nguyentruongtho/repos","events_url":"https://api.github.com/users/nguyentruongtho/events{/privacy}","received_events_url":"https://api.github.com/users/nguyentruongtho/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nguyentruongtho/buck","description":"A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.","fork":true,"url":"https://api.github.com/repos/nguyentruongtho/buck","forks_url":"https://api.github.com/repos/nguyentruongtho/buck/forks","keys_url":"https://api.github.com/repos/nguyentruongtho/buck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nguyentruongtho/buck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nguyentruongtho/buck/teams","hooks_url":"https://api.github.com/repos/nguyentruongtho/buck/hooks","issue_events_url":"https://api.github.com/repos/nguyentruongtho/buck/issues/events{/number}","events_url":"https://api.github.com/repos/nguyentruongtho/buck/events","assignees_url":"https://api.github.com/repos/nguyentruongtho/buck/assignees{/user}","branches_url":"https://api.github.com/repos/nguyentruongtho/buck/branches{/branch}","tags_url":"https://api.github.com/repos/nguyentruongtho/buck/tags","blobs_url":"https://api.github.com/repos/nguyentruongtho/buck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nguyentruongtho/buck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nguyentruongtho/buck/git/refs{/sha}","trees_url":"https://api.github.com/repos/nguyentruongtho/buck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nguyentruongtho/buck/statuses/{sha}","languages_url":"https://api.github.com/repos/nguyentruongtho/buck/languages","stargazers_url":"https://api.github.com/repos/nguyentruongtho/buck/stargazers","contributors_url":"https://api.github.com/repos/nguyentruongtho/buck/contributors","subscribers_url":"https://api.github.com/repos/nguyentruongtho/buck/subscribers","subscription_url":"https://api.github.com/repos/nguyentruongtho/buck/subscription","commits_url":"https://api.github.com/repos/nguyentruongtho/buck/commits{/sha}","git_commits_url":"https://api.github.com/repos/nguyentruongtho/buck/git/commits{/sha}","comments_url":"https://api.github.com/repos/nguyentruongtho/buck/comments{/number}","issue_comment_url":"https://api.github.com/repos/nguyentruongtho/buck/issues/comments{/number}","contents_url":"https://api.github.com/repos/nguyentruongtho/buck/contents/{+path}","compare_url":"https://api.github.com/repos/nguyentruongtho/buck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nguyentruongtho/buck/merges","archive_url":"https://api.github.com/repos/nguyentruongtho/buck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nguyentruongtho/buck/downloads","issues_url":"https://api.github.com/repos/nguyentruongtho/buck/issues{/number}","pulls_url":"https://api.github.com/repos/nguyentruongtho/buck/pulls{/number}","milestones_url":"https://api.github.com/repos/nguyentruongtho/buck/milestones{/number}","notifications_url":"https://api.github.com/repos/nguyentruongtho/buck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nguyentruongtho/buck/labels{/name}","releases_url":"https://api.github.com/repos/nguyentruongtho/buck/releases{/id}","deployments_url":"https://api.github.com/repos/nguyentruongtho/buck/deployments","created_at":"2016-04-13T08:28:43Z","updated_at":"2016-04-13T08:28:54Z","pushed_at":"2016-09-01T12:13:59Z","git_url":"git://github.com/nguyentruongtho/buck.git","ssh_url":"git@github.com:nguyentruongtho/buck.git","clone_url":"https://github.com/nguyentruongtho/buck.git","svn_url":"https://github.com/nguyentruongtho/buck","homepage":"https://buckbuild.com","size":405733,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"585fa618233d725321389f1d03faec95f01b6993","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":9504214,"name":"buck","full_name":"facebook/buck","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/buck","description":"A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.","fork":false,"url":"https://api.github.com/repos/facebook/buck","forks_url":"https://api.github.com/repos/facebook/buck/forks","keys_url":"https://api.github.com/repos/facebook/buck/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/buck/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/buck/teams","hooks_url":"https://api.github.com/repos/facebook/buck/hooks","issue_events_url":"https://api.github.com/repos/facebook/buck/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/buck/events","assignees_url":"https://api.github.com/repos/facebook/buck/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/buck/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/buck/tags","blobs_url":"https://api.github.com/repos/facebook/buck/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/buck/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/buck/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/buck/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/buck/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/buck/languages","stargazers_url":"https://api.github.com/repos/facebook/buck/stargazers","contributors_url":"https://api.github.com/repos/facebook/buck/contributors","subscribers_url":"https://api.github.com/repos/facebook/buck/subscribers","subscription_url":"https://api.github.com/repos/facebook/buck/subscription","commits_url":"https://api.github.com/repos/facebook/buck/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/buck/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/buck/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/buck/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/buck/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/buck/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/buck/merges","archive_url":"https://api.github.com/repos/facebook/buck/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/buck/downloads","issues_url":"https://api.github.com/repos/facebook/buck/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/buck/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/buck/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/buck/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/buck/labels{/name}","releases_url":"https://api.github.com/repos/facebook/buck/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/buck/deployments","created_at":"2013-04-17T18:12:18Z","updated_at":"2016-09-01T16:41:48Z","pushed_at":"2016-09-01T16:43:01Z","git_url":"git://github.com/facebook/buck.git","ssh_url":"git@github.com:facebook/buck.git","clone_url":"https://github.com/facebook/buck.git","svn_url":"https://github.com/facebook/buck","homepage":"https://buckbuild.com","size":438235,"stargazers_count":2992,"watchers_count":2992,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":512,"mirror_url":null,"open_issues_count":160,"forks":512,"open_issues":160,"watchers":2992,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/buck/pulls/862"},"html":{"href":"https://github.com/facebook/buck/pull/862"},"issue":{"href":"https://api.github.com/repos/facebook/buck/issues/862"},"comments":{"href":"https://api.github.com/repos/facebook/buck/issues/862/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/buck/pulls/862/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/buck/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/buck/pulls/862/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/buck/statuses/3e88e3000e28c8a02f244cdb66a90f6ab55f9603"}}}}
{"actor":{"display_login":"nguyentruongtho"}}