{"action":"created","comment":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments/190765971","pull_request_review_id":123215189,"id":190765971,"diff_hunk":"@@ -71,6 +82,28 @@ def install_resources_function\n         end\n       end\n \n+      # @return [String] The contents of the target xcassets script.\n+      #\n+      def target_xcassets\n+\n+        project_path = user_project_path.to_path\n+        user_target_name = target_name.sub(\"Pods-\", \"\")\n+\n+        script = <<-EOS \n+        require 'xcodeproj';\n+        project_path = '#{project_path}';\n+        target_name = '#{user_target_name}';\n+        project = Xcodeproj::Project.open(project_path);","path":"lib/cocoapods/generator/copy_resources_script.rb","position":53,"original_position":53,"commit_id":"dc3d97e4fd01cf29a60f7417de8484c4c58c9c11","original_commit_id":"dc3d97e4fd01cf29a60f7417de8484c4c58c9c11","user":{"login":"dnkoutso","id":310370,"avatar_url":"https://avatars2.githubusercontent.com/u/310370?v=4","gravatar_id":"","url":"https://api.github.com/users/dnkoutso","html_url":"https://github.com/dnkoutso","followers_url":"https://api.github.com/users/dnkoutso/followers","following_url":"https://api.github.com/users/dnkoutso/following{/other_user}","gists_url":"https://api.github.com/users/dnkoutso/gists{/gist_id}","starred_url":"https://api.github.com/users/dnkoutso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnkoutso/subscriptions","organizations_url":"https://api.github.com/users/dnkoutso/orgs","repos_url":"https://api.github.com/users/dnkoutso/repos","events_url":"https://api.github.com/users/dnkoutso/events{/privacy}","received_events_url":"https://api.github.com/users/dnkoutso/received_events","type":"User","site_admin":false},"body":"@i-dama the only way I can think of doing this, is what you mentioned with polluting the users app with these references. ","created_at":"2018-05-25T00:34:13Z","updated_at":"2018-05-25T00:34:13Z","html_url":"https://github.com/CocoaPods/CocoaPods/pull/7779#discussion_r190765971","pull_request_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments/190765971"},"html":{"href":"https://github.com/CocoaPods/CocoaPods/pull/7779#discussion_r190765971"},"pull_request":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779"}},"in_reply_to_id":190659547},"pull_request":{"url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779","id":190296638,"html_url":"https://github.com/CocoaPods/CocoaPods/pull/7779","diff_url":"https://github.com/CocoaPods/CocoaPods/pull/7779.diff","patch_url":"https://github.com/CocoaPods/CocoaPods/pull/7779.patch","issue_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/7779","number":7779,"state":"open","locked":false,"title":"🌈Using xcodeproj to generate .xcassets list","user":{"login":"i-dama","id":2226475,"avatar_url":"https://avatars1.githubusercontent.com/u/2226475?v=4","gravatar_id":"","url":"https://api.github.com/users/i-dama","html_url":"https://github.com/i-dama","followers_url":"https://api.github.com/users/i-dama/followers","following_url":"https://api.github.com/users/i-dama/following{/other_user}","gists_url":"https://api.github.com/users/i-dama/gists{/gist_id}","starred_url":"https://api.github.com/users/i-dama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i-dama/subscriptions","organizations_url":"https://api.github.com/users/i-dama/orgs","repos_url":"https://api.github.com/users/i-dama/repos","events_url":"https://api.github.com/users/i-dama/events{/privacy}","received_events_url":"https://api.github.com/users/i-dama/received_events","type":"User","site_admin":false},"body":"Related open issues:\r\nhttps://github.com/CocoaPods/CocoaPods/issues/7745\r\nhttps://github.com/CocoaPods/CocoaPods/issues/6159\r\nhttps://github.com/CocoaPods/CocoaPods/issues/7617\r\n\r\nThe PR is not yet ready, I'd just like to get some feedback to see if the direction is good.\r\n**The problem:**\r\nAs stated in the generated `copy_pods_resources` script\r\n```\r\n# Find all other xcassets (this unfortunately includes those of path pods and other targets).\r\nOTHER_XCASSETS=$(find \"$PWD\" -iname \"*.xcassets\" -type d)\r\n```\r\nThe script searches for all `.xcassets` in the project folder recursively, excluding `Pods` folder afterwards. This might pick up some `.xcassets` we don't want in a certain target.\r\n\r\n**Proposed solution**\r\nUse the `xcodeproj` gem to extract the list of `.xcassets` to be copied for a certain target and only use those\r\n\r\nCode that prints out paths to `.xcassets` for a given target and project:\r\n```\r\nrequire 'xcodeproj';\r\nproject_path = 'Project.xcodeproj'\r\ntarget_name = 'MyTarget'\r\nproject = Xcodeproj::Project.open(project_path)\r\n\r\ntarget = project.targets.find { |t| t.name == target_name }\r\nfiles = target.resources_build_phase.files\r\nxcassets = files.select { | file | file.display_name.end_with?('.xcassets') }\r\n\r\nxcassets.each { | file | puts file.file_ref.real_path }\r\n```\r\n\r\nIn order to do that, `copy_resources_script.rb` needs to know the location of the user project and the target we're adding the pods to.\r\n\r\nStuff I'd like to get feedback on:\r\n1. Is this an acceptable way of solving this problem?\r\n2. Is there a better way of getting a reference to the `user_project` (Currently works for `AggregatedTargetInstaller`, not sure about `PodTargetInstaller`)\r\n3. Is there a better way of getting the user project target name?\r\n4. The script inserts ruby code in the `.sh` script, is that acceptable? (`.xcassets` files can be added after `pod install` is ran, so the `xcassets` resolution needs to be done in the build script)\r\n\r\nI ran the modified code on an example project, and no unwanted `.xcassets` file were included.","created_at":"2018-05-24T13:49:13Z","updated_at":"2018-05-25T00:34:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49833f0204a98e0d39e067530d81cd4435e4c9cb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779/commits","review_comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779/comments","review_comment_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/7779/comments","statuses_url":"https://api.github.com/repos/CocoaPods/CocoaPods/statuses/dc3d97e4fd01cf29a60f7417de8484c4c58c9c11","head":{"label":"i-dama:master","ref":"master","sha":"dc3d97e4fd01cf29a60f7417de8484c4c58c9c11","user":{"login":"i-dama","id":2226475,"avatar_url":"https://avatars1.githubusercontent.com/u/2226475?v=4","gravatar_id":"","url":"https://api.github.com/users/i-dama","html_url":"https://github.com/i-dama","followers_url":"https://api.github.com/users/i-dama/followers","following_url":"https://api.github.com/users/i-dama/following{/other_user}","gists_url":"https://api.github.com/users/i-dama/gists{/gist_id}","starred_url":"https://api.github.com/users/i-dama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i-dama/subscriptions","organizations_url":"https://api.github.com/users/i-dama/orgs","repos_url":"https://api.github.com/users/i-dama/repos","events_url":"https://api.github.com/users/i-dama/events{/privacy}","received_events_url":"https://api.github.com/users/i-dama/received_events","type":"User","site_admin":false},"repo":{"id":134717961,"name":"CocoaPods","full_name":"i-dama/CocoaPods","owner":{"login":"i-dama","id":2226475,"avatar_url":"https://avatars1.githubusercontent.com/u/2226475?v=4","gravatar_id":"","url":"https://api.github.com/users/i-dama","html_url":"https://github.com/i-dama","followers_url":"https://api.github.com/users/i-dama/followers","following_url":"https://api.github.com/users/i-dama/following{/other_user}","gists_url":"https://api.github.com/users/i-dama/gists{/gist_id}","starred_url":"https://api.github.com/users/i-dama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/i-dama/subscriptions","organizations_url":"https://api.github.com/users/i-dama/orgs","repos_url":"https://api.github.com/users/i-dama/repos","events_url":"https://api.github.com/users/i-dama/events{/privacy}","received_events_url":"https://api.github.com/users/i-dama/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/i-dama/CocoaPods","description":"The Cocoa Dependency Manager.","fork":true,"url":"https://api.github.com/repos/i-dama/CocoaPods","forks_url":"https://api.github.com/repos/i-dama/CocoaPods/forks","keys_url":"https://api.github.com/repos/i-dama/CocoaPods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/i-dama/CocoaPods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/i-dama/CocoaPods/teams","hooks_url":"https://api.github.com/repos/i-dama/CocoaPods/hooks","issue_events_url":"https://api.github.com/repos/i-dama/CocoaPods/issues/events{/number}","events_url":"https://api.github.com/repos/i-dama/CocoaPods/events","assignees_url":"https://api.github.com/repos/i-dama/CocoaPods/assignees{/user}","branches_url":"https://api.github.com/repos/i-dama/CocoaPods/branches{/branch}","tags_url":"https://api.github.com/repos/i-dama/CocoaPods/tags","blobs_url":"https://api.github.com/repos/i-dama/CocoaPods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/i-dama/CocoaPods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/i-dama/CocoaPods/git/refs{/sha}","trees_url":"https://api.github.com/repos/i-dama/CocoaPods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/i-dama/CocoaPods/statuses/{sha}","languages_url":"https://api.github.com/repos/i-dama/CocoaPods/languages","stargazers_url":"https://api.github.com/repos/i-dama/CocoaPods/stargazers","contributors_url":"https://api.github.com/repos/i-dama/CocoaPods/contributors","subscribers_url":"https://api.github.com/repos/i-dama/CocoaPods/subscribers","subscription_url":"https://api.github.com/repos/i-dama/CocoaPods/subscription","commits_url":"https://api.github.com/repos/i-dama/CocoaPods/commits{/sha}","git_commits_url":"https://api.github.com/repos/i-dama/CocoaPods/git/commits{/sha}","comments_url":"https://api.github.com/repos/i-dama/CocoaPods/comments{/number}","issue_comment_url":"https://api.github.com/repos/i-dama/CocoaPods/issues/comments{/number}","contents_url":"https://api.github.com/repos/i-dama/CocoaPods/contents/{+path}","compare_url":"https://api.github.com/repos/i-dama/CocoaPods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/i-dama/CocoaPods/merges","archive_url":"https://api.github.com/repos/i-dama/CocoaPods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/i-dama/CocoaPods/downloads","issues_url":"https://api.github.com/repos/i-dama/CocoaPods/issues{/number}","pulls_url":"https://api.github.com/repos/i-dama/CocoaPods/pulls{/number}","milestones_url":"https://api.github.com/repos/i-dama/CocoaPods/milestones{/number}","notifications_url":"https://api.github.com/repos/i-dama/CocoaPods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/i-dama/CocoaPods/labels{/name}","releases_url":"https://api.github.com/repos/i-dama/CocoaPods/releases{/id}","deployments_url":"https://api.github.com/repos/i-dama/CocoaPods/deployments","created_at":"2018-05-24T13:17:22Z","updated_at":"2018-05-24T13:27:02Z","pushed_at":"2018-05-24T13:26:59Z","git_url":"git://github.com/i-dama/CocoaPods.git","ssh_url":"git@github.com:i-dama/CocoaPods.git","clone_url":"https://github.com/i-dama/CocoaPods.git","svn_url":"https://github.com/i-dama/CocoaPods","homepage":"https://cocoapods.org/","size":56110,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CocoaPods:master","ref":"master","sha":"f64b8171e0d7c315eac6fcc94506cbd4ed9f5669","user":{"login":"CocoaPods","id":1189714,"avatar_url":"https://avatars1.githubusercontent.com/u/1189714?v=4","gravatar_id":"","url":"https://api.github.com/users/CocoaPods","html_url":"https://github.com/CocoaPods","followers_url":"https://api.github.com/users/CocoaPods/followers","following_url":"https://api.github.com/users/CocoaPods/following{/other_user}","gists_url":"https://api.github.com/users/CocoaPods/gists{/gist_id}","starred_url":"https://api.github.com/users/CocoaPods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CocoaPods/subscriptions","organizations_url":"https://api.github.com/users/CocoaPods/orgs","repos_url":"https://api.github.com/users/CocoaPods/repos","events_url":"https://api.github.com/users/CocoaPods/events{/privacy}","received_events_url":"https://api.github.com/users/CocoaPods/received_events","type":"Organization","site_admin":false},"repo":{"id":2203645,"name":"CocoaPods","full_name":"CocoaPods/CocoaPods","owner":{"login":"CocoaPods","id":1189714,"avatar_url":"https://avatars1.githubusercontent.com/u/1189714?v=4","gravatar_id":"","url":"https://api.github.com/users/CocoaPods","html_url":"https://github.com/CocoaPods","followers_url":"https://api.github.com/users/CocoaPods/followers","following_url":"https://api.github.com/users/CocoaPods/following{/other_user}","gists_url":"https://api.github.com/users/CocoaPods/gists{/gist_id}","starred_url":"https://api.github.com/users/CocoaPods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CocoaPods/subscriptions","organizations_url":"https://api.github.com/users/CocoaPods/orgs","repos_url":"https://api.github.com/users/CocoaPods/repos","events_url":"https://api.github.com/users/CocoaPods/events{/privacy}","received_events_url":"https://api.github.com/users/CocoaPods/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CocoaPods/CocoaPods","description":"The Cocoa Dependency Manager.","fork":false,"url":"https://api.github.com/repos/CocoaPods/CocoaPods","forks_url":"https://api.github.com/repos/CocoaPods/CocoaPods/forks","keys_url":"https://api.github.com/repos/CocoaPods/CocoaPods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CocoaPods/CocoaPods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CocoaPods/CocoaPods/teams","hooks_url":"https://api.github.com/repos/CocoaPods/CocoaPods/hooks","issue_events_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/events{/number}","events_url":"https://api.github.com/repos/CocoaPods/CocoaPods/events","assignees_url":"https://api.github.com/repos/CocoaPods/CocoaPods/assignees{/user}","branches_url":"https://api.github.com/repos/CocoaPods/CocoaPods/branches{/branch}","tags_url":"https://api.github.com/repos/CocoaPods/CocoaPods/tags","blobs_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/refs{/sha}","trees_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CocoaPods/CocoaPods/statuses/{sha}","languages_url":"https://api.github.com/repos/CocoaPods/CocoaPods/languages","stargazers_url":"https://api.github.com/repos/CocoaPods/CocoaPods/stargazers","contributors_url":"https://api.github.com/repos/CocoaPods/CocoaPods/contributors","subscribers_url":"https://api.github.com/repos/CocoaPods/CocoaPods/subscribers","subscription_url":"https://api.github.com/repos/CocoaPods/CocoaPods/subscription","commits_url":"https://api.github.com/repos/CocoaPods/CocoaPods/commits{/sha}","git_commits_url":"https://api.github.com/repos/CocoaPods/CocoaPods/git/commits{/sha}","comments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/comments{/number}","issue_comment_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/comments{/number}","contents_url":"https://api.github.com/repos/CocoaPods/CocoaPods/contents/{+path}","compare_url":"https://api.github.com/repos/CocoaPods/CocoaPods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CocoaPods/CocoaPods/merges","archive_url":"https://api.github.com/repos/CocoaPods/CocoaPods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CocoaPods/CocoaPods/downloads","issues_url":"https://api.github.com/repos/CocoaPods/CocoaPods/issues{/number}","pulls_url":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls{/number}","milestones_url":"https://api.github.com/repos/CocoaPods/CocoaPods/milestones{/number}","notifications_url":"https://api.github.com/repos/CocoaPods/CocoaPods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CocoaPods/CocoaPods/labels{/name}","releases_url":"https://api.github.com/repos/CocoaPods/CocoaPods/releases{/id}","deployments_url":"https://api.github.com/repos/CocoaPods/CocoaPods/deployments","created_at":"2011-08-14T00:10:53Z","updated_at":"2018-05-24T12:02:25Z","pushed_at":"2018-05-24T16:20:37Z","git_url":"git://github.com/CocoaPods/CocoaPods.git","ssh_url":"git@github.com:CocoaPods/CocoaPods.git","clone_url":"https://github.com/CocoaPods/CocoaPods.git","svn_url":"https://github.com/CocoaPods/CocoaPods","homepage":"https://cocoapods.org/","size":56100,"stargazers_count":10533,"watchers_count":10533,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1921,"mirror_url":null,"archived":false,"open_issues_count":133,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1921,"open_issues":133,"watchers":10533,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779"},"html":{"href":"https://github.com/CocoaPods/CocoaPods/pull/7779"},"issue":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/7779"},"comments":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/issues/7779/comments"},"review_comments":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779/comments"},"review_comment":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/pulls/7779/commits"},"statuses":{"href":"https://api.github.com/repos/CocoaPods/CocoaPods/statuses/dc3d97e4fd01cf29a60f7417de8484c4c58c9c11"}},"author_association":"NONE"}}
{"actor":{"display_login":"dnkoutso"}}