{"action":"created","comment":{"url":"https://api.github.com/repos/uber/needle/pulls/comments/199246404","pull_request_review_id":133332353,"id":199246404,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTI0NjQwNA==","diff_hunk":"@@ -0,0 +1,143 @@\n+//\n+//  Copyright (c) 2018. Uber Technologies\n+//\n+//  Licensed under the Apache License, Version 2.0 (the \"License\");\n+//  you may not use this file except in compliance with the License.\n+//  You may obtain 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,\n+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+//  See the License for the specific language governing permissions and\n+//  limitations under the License.\n+//\n+\n+import Foundation\n+\n+class PluginizedDependencyProviderContentTask: AbstractTask<[PluginizedProcessedDependencyProvider]> {\n+\n+    /// Initializer.\n+    ///\n+    /// - parameter providers: The list of providers that we need to fill in\n+    /// - parameter providers: The list of pluginized components\n+    init(providers: [DependencyProvider], pluginizedComponents: [PluginizedComponent]) {\n+        self.providers = providers\n+\n+        var nonCoreComponentMap = [String: AuxillaryProperties]()\n+        var pluginExtensionMap = [String: AuxillaryProperties]()\n+        for pluginizedComponent in pluginizedComponents {\n+            nonCoreComponentMap[pluginizedComponent.data.name] = AuxillaryProperties(sourceName: pluginizedComponent.nonCoreComponent.name, properties: pluginizedComponent.nonCoreComponent.properties)\n+            pluginExtensionMap[pluginizedComponent.data.name] = AuxillaryProperties(sourceName: pluginizedComponent.pluginExtension.name, properties:pluginizedComponent.pluginExtension.properties)\n+        }\n+        self.nonCoreComponentMap = nonCoreComponentMap\n+        self.pluginExtensionMap = pluginExtensionMap\n+\n+        nonCoreComponentNames = Set(pluginizedComponents.map { pluginizedComponent in\n+            pluginizedComponent.nonCoreComponent.name\n+        })\n+    }\n+\n+    /// Execute the task and returns the processed in-memory dependency graph\n+    /// data models.\n+    ///\n+    /// - returns: The list of `ProcessedDependencyProvider`.\n+    override func execute() -> [PluginizedProcessedDependencyProvider] {\n+\n+        return providers.map { (provider: DependencyProvider) -> PluginizedProcessedDependencyProvider in\n+            do {\n+                if provider.pathContains(anyOf: nonCoreComponentNames) {\n+                    return try process(provider, auxillaryPropertyMap: nonCoreComponentMap)\n+                } else {\n+                    return try process(provider, auxillaryPropertyMap: pluginExtensionMap)\n+                }\n+            } catch DependencyProviderContentError.propertyNotFound(let info) {\n+                var message = \"Could not find a provider for \\(info.name): \\(info.type) which was required by \\(info.dependency).\"\n+                if let possibleMatchComponent = info.possibleMatchComponent {\n+                    message += \" Found possible matches \\(info.possibleNames) at \\(possibleMatchComponent).\"\n+                }\n+                fatalError(message)\n+            } catch {\n+                fatalError(\"Unhandled error while processing dependency provider content: \\(error)\")\n+            }\n+        }\n+    }\n+\n+    // MARK: - Private\n+\n+    struct AuxillaryProperties {\n+        let sourceName: String\n+        let properties: [Property]\n+    }\n+\n+    private let providers: [DependencyProvider]\n+    private let nonCoreComponentMap: [String: AuxillaryProperties]\n+    private let pluginExtensionMap: [String: AuxillaryProperties]\n+    private let nonCoreComponentNames: Set<String>\n+\n+    private func process(_ provider: DependencyProvider, auxillaryPropertyMap: [String: AuxillaryProperties]) throws -> PluginizedProcessedDependencyProvider  {\n+        var levelMap = [String: Int]()\n+\n+        let properties = try provider.dependency.properties.map { (property : Property) -> PluginizedProcessedProperty in\n+            var level = 0\n+            let revesedPath = provider.path.reversed()\n+            for component in revesedPath {\n+                if component.properties.contains(property) {\n+                    levelMap[component.name] = level\n+                    return PluginizedProcessedProperty(data: ProcessedProperty(unprocessed: property, sourceComponentType: component.name), auxillarySourceType: nil)\n+                } else if let auxillaryProperties = auxillaryPropertyMap[component.name] {\n+                    if auxillaryProperties.properties.contains(property) {\n+                        levelMap[component.name] = level\n+                        return PluginizedProcessedProperty(data: ProcessedProperty(unprocessed: property, sourceComponentType: auxillaryProperties.sourceName), auxillarySourceType: .pluginExtension)","path":"Generator/Sources/NeedleFramework/Generating/Pluginized/PluginizedDependencyProviderContentTask.swift","position":92,"original_position":92,"commit_id":"759a9e07c46def90aa2d66c5f86b5289e540ac79","original_commit_id":"759a9e07c46def90aa2d66c5f86b5289e540ac79","user":{"login":"neakor","id":1827517,"node_id":"MDQ6VXNlcjE4Mjc1MTc=","avatar_url":"https://avatars2.githubusercontent.com/u/1827517?v=4","gravatar_id":"","url":"https://api.github.com/users/neakor","html_url":"https://github.com/neakor","followers_url":"https://api.github.com/users/neakor/followers","following_url":"https://api.github.com/users/neakor/following{/other_user}","gists_url":"https://api.github.com/users/neakor/gists{/gist_id}","starred_url":"https://api.github.com/users/neakor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neakor/subscriptions","organizations_url":"https://api.github.com/users/neakor/orgs","repos_url":"https://api.github.com/users/neakor/repos","events_url":"https://api.github.com/users/neakor/events{/privacy}","received_events_url":"https://api.github.com/users/neakor/received_events","type":"User","site_admin":false},"body":"The `auxillarySourceType` should be passed into this method right? It's not always `pluginExtension`.","created_at":"2018-06-29T18:34:34Z","updated_at":"2018-06-29T18:39:02Z","html_url":"https://github.com/uber/needle/pull/105#discussion_r199246404","pull_request_url":"https://api.github.com/repos/uber/needle/pulls/105","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/uber/needle/pulls/comments/199246404"},"html":{"href":"https://github.com/uber/needle/pull/105#discussion_r199246404"},"pull_request":{"href":"https://api.github.com/repos/uber/needle/pulls/105"}}},"pull_request":{"url":"https://api.github.com/repos/uber/needle/pulls/105","id":198390923,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MzkwOTIz","html_url":"https://github.com/uber/needle/pull/105","diff_url":"https://github.com/uber/needle/pull/105.diff","patch_url":"https://github.com/uber/needle/pull/105.patch","issue_url":"https://api.github.com/repos/uber/needle/issues/105","number":105,"state":"open","locked":false,"title":"Add logic for the Pluginized components when generating the dependenc…","user":{"login":"rudro","id":126961,"node_id":"MDQ6VXNlcjEyNjk2MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/126961?v=4","gravatar_id":"","url":"https://api.github.com/users/rudro","html_url":"https://github.com/rudro","followers_url":"https://api.github.com/users/rudro/followers","following_url":"https://api.github.com/users/rudro/following{/other_user}","gists_url":"https://api.github.com/users/rudro/gists{/gist_id}","starred_url":"https://api.github.com/users/rudro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudro/subscriptions","organizations_url":"https://api.github.com/users/rudro/orgs","repos_url":"https://api.github.com/users/rudro/repos","events_url":"https://api.github.com/users/rudro/events{/privacy}","received_events_url":"https://api.github.com/users/rudro/received_events","type":"User","site_admin":false},"body":"Add logic for the Pluginized components when generating the dependency provider content","created_at":"2018-06-29T18:25:44Z","updated_at":"2018-06-29T18:39:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"003ba68657bd12afd7c6034653b95ad96c523987","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uber/needle/pulls/105/commits","review_comments_url":"https://api.github.com/repos/uber/needle/pulls/105/comments","review_comment_url":"https://api.github.com/repos/uber/needle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber/needle/issues/105/comments","statuses_url":"https://api.github.com/repos/uber/needle/statuses/759a9e07c46def90aa2d66c5f86b5289e540ac79","head":{"label":"uber:rudro_noncoreproviding","ref":"rudro_noncoreproviding","sha":"759a9e07c46def90aa2d66c5f86b5289e540ac79","user":{"login":"uber","id":538264,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODI2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/538264?v=4","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":128424492,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg0MjQ0OTI=","name":"needle","full_name":"uber/needle","owner":{"login":"uber","id":538264,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODI2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/538264?v=4","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/needle","description":"Compile-time safe Swift dependency injection framework","fork":false,"url":"https://api.github.com/repos/uber/needle","forks_url":"https://api.github.com/repos/uber/needle/forks","keys_url":"https://api.github.com/repos/uber/needle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/needle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/needle/teams","hooks_url":"https://api.github.com/repos/uber/needle/hooks","issue_events_url":"https://api.github.com/repos/uber/needle/issues/events{/number}","events_url":"https://api.github.com/repos/uber/needle/events","assignees_url":"https://api.github.com/repos/uber/needle/assignees{/user}","branches_url":"https://api.github.com/repos/uber/needle/branches{/branch}","tags_url":"https://api.github.com/repos/uber/needle/tags","blobs_url":"https://api.github.com/repos/uber/needle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/needle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/needle/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/needle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/needle/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/needle/languages","stargazers_url":"https://api.github.com/repos/uber/needle/stargazers","contributors_url":"https://api.github.com/repos/uber/needle/contributors","subscribers_url":"https://api.github.com/repos/uber/needle/subscribers","subscription_url":"https://api.github.com/repos/uber/needle/subscription","commits_url":"https://api.github.com/repos/uber/needle/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/needle/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/needle/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/needle/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/needle/contents/{+path}","compare_url":"https://api.github.com/repos/uber/needle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/needle/merges","archive_url":"https://api.github.com/repos/uber/needle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/needle/downloads","issues_url":"https://api.github.com/repos/uber/needle/issues{/number}","pulls_url":"https://api.github.com/repos/uber/needle/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/needle/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/needle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/needle/labels{/name}","releases_url":"https://api.github.com/repos/uber/needle/releases{/id}","deployments_url":"https://api.github.com/repos/uber/needle/deployments","created_at":"2018-04-06T17:22:11Z","updated_at":"2018-06-28T21:40:59Z","pushed_at":"2018-06-29T18:26:55Z","git_url":"git://github.com/uber/needle.git","ssh_url":"git@github.com:uber/needle.git","clone_url":"https://github.com/uber/needle.git","svn_url":"https://github.com/uber/needle","homepage":"","size":338,"stargazers_count":10,"watchers_count":10,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":4,"watchers":10,"default_branch":"master"}},"base":{"label":"uber:master","ref":"master","sha":"9b15587b2dfbd99dbcec55ebea1f0698cae017c4","user":{"login":"uber","id":538264,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODI2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/538264?v=4","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":128424492,"node_id":"MDEwOlJlcG9zaXRvcnkxMjg0MjQ0OTI=","name":"needle","full_name":"uber/needle","owner":{"login":"uber","id":538264,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODI2NA==","avatar_url":"https://avatars3.githubusercontent.com/u/538264?v=4","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/needle","description":"Compile-time safe Swift dependency injection framework","fork":false,"url":"https://api.github.com/repos/uber/needle","forks_url":"https://api.github.com/repos/uber/needle/forks","keys_url":"https://api.github.com/repos/uber/needle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/needle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/needle/teams","hooks_url":"https://api.github.com/repos/uber/needle/hooks","issue_events_url":"https://api.github.com/repos/uber/needle/issues/events{/number}","events_url":"https://api.github.com/repos/uber/needle/events","assignees_url":"https://api.github.com/repos/uber/needle/assignees{/user}","branches_url":"https://api.github.com/repos/uber/needle/branches{/branch}","tags_url":"https://api.github.com/repos/uber/needle/tags","blobs_url":"https://api.github.com/repos/uber/needle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/needle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/needle/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/needle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/needle/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/needle/languages","stargazers_url":"https://api.github.com/repos/uber/needle/stargazers","contributors_url":"https://api.github.com/repos/uber/needle/contributors","subscribers_url":"https://api.github.com/repos/uber/needle/subscribers","subscription_url":"https://api.github.com/repos/uber/needle/subscription","commits_url":"https://api.github.com/repos/uber/needle/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/needle/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/needle/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/needle/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/needle/contents/{+path}","compare_url":"https://api.github.com/repos/uber/needle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/needle/merges","archive_url":"https://api.github.com/repos/uber/needle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/needle/downloads","issues_url":"https://api.github.com/repos/uber/needle/issues{/number}","pulls_url":"https://api.github.com/repos/uber/needle/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/needle/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/needle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/needle/labels{/name}","releases_url":"https://api.github.com/repos/uber/needle/releases{/id}","deployments_url":"https://api.github.com/repos/uber/needle/deployments","created_at":"2018-04-06T17:22:11Z","updated_at":"2018-06-28T21:40:59Z","pushed_at":"2018-06-29T18:26:55Z","git_url":"git://github.com/uber/needle.git","ssh_url":"git@github.com:uber/needle.git","clone_url":"https://github.com/uber/needle.git","svn_url":"https://github.com/uber/needle","homepage":"","size":338,"stargazers_count":10,"watchers_count":10,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":4,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber/needle/pulls/105"},"html":{"href":"https://github.com/uber/needle/pull/105"},"issue":{"href":"https://api.github.com/repos/uber/needle/issues/105"},"comments":{"href":"https://api.github.com/repos/uber/needle/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/uber/needle/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/uber/needle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber/needle/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/uber/needle/statuses/759a9e07c46def90aa2d66c5f86b5289e540ac79"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"neakor"}}