{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/n4js/pulls/comments/202374085","pull_request_review_id":137065446,"id":202374085,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjM3NDA4NQ==","diff_hunk":"@@ -345,18 +345,44 @@ private void collectDependencies(ProjectDescription description, Map<String, Str\n \t\tfor (Map.Entry<String, String> reqestedNpm : installRequested.entrySet()) {\n \t\t\tString name = reqestedNpm.getKey();\n \t\t\tString versionRequestedString = reqestedNpm.getValue();\n-\t\t\tVersion versionRequested = new Version(versionRequestedString);\n+\n \t\t\tif (installedNpms.containsKey(name)) {\n-\t\t\t\torg.eclipse.emf.common.util.URI location = installedNpms.get(name).getKey();\n-\t\t\t\tString versionInstalledString = Strings.emptyIfNull(installedNpms.get(name).getValue());\n-\t\t\t\tVersion versionInstalled = new Version(versionInstalledString);\n-\t\t\t\tif (versionInstalledString.isEmpty() || versionRequested.compareTo(versionInstalled) == 0) {\n-\t\t\t\t\t// already installed\n-\t\t\t\t} else {\n-\t\t\t\t\t// wrong version installed -> update (uninstall, then install)\n-\t\t\t\t\trequestedChanges.add(new LibraryChange(Uninstall, location, name, versionInstalledString));\n-\t\t\t\t\trequestedChanges.add(new LibraryChange(Install, location, name, versionRequestedString));\n+\t\t\t\t// determine location of the installed package\n+\t\t\t\tfinal org.eclipse.emf.common.util.URI location = installedNpms.get(name).getKey();\n+\t\t\t\tfinal String versionInstalledString = Strings.emptyIfNull(installedNpms.get(name).getValue());\n+\t\t\t\ttry {\n+\t\t\t\t\tif (versionRequestedString.isEmpty()) {\n+\t\t\t\t\t\t// empty constraint matches any installed version\n+\t\t\t\t\t\tcontinue;\n+\t\t\t\t\t}\n+\n+\t\t\t\t\t// detect an exactly specified version\n+\t\t\t\t\tString exactRequestedVersionString = versionRequestedString;\n+\n+\t\t\t\t\t// remove preceeding '@' from requested version, if present\n+\t\t\t\t\tif (exactRequestedVersionString.startsWith(\"@\")) {\n+\t\t\t\t\t\texactRequestedVersionString = exactRequestedVersionString.substring(1);\n+\t\t\t\t\t}\n+\n+\t\t\t\t\t// If versionRequestedString is not an exact version (or uses ^ or ~) the following\n+\t\t\t\t\t// call will throw an exception. As a consequence we only support exact version matches here.\n+\t\t\t\t\t// If the requested version is a constraint , this method will always trigger the reinstallation\n+\t\t\t\t\t// of the package, according to the requested version constraint.\n+\t\t\t\t\t// TODO Once GH-940 is merged, this logic can be revised to support version constraints.\n+\t\t\t\t\tfinal Version versionRequested = new Version(exactRequestedVersionString);\n+\t\t\t\t\tfinal Version versionInstalled = new Version(versionInstalledString);\n+\t\t\t\t\tif (versionRequested.compareTo(versionInstalled) == 0) {\n+\t\t\t\t\t\t// already installed\n+\t\t\t\t\t\tcontinue;\n+\t\t\t\t\t}\n+\t\t\t\t} catch (NumberFormatException e) {\n+\t\t\t\t\tlogger.logInfo(\"Checking whether the requested version constraint \" + name + \"@\"\n+\t\t\t\t\t\t\t+ versionRequestedString\n+\t\t\t\t\t\t\t+ \" matches the installed version of the package, is currently unsupported (use an exact version instead): Package will be re-installed.\");\n \t\t\t\t}","path":"plugins/org.eclipse.n4js/src/org/eclipse/n4js/external/LibraryManager.java","position":null,"original_position":48,"commit_id":"4466d168538b8850c5b75fb3726c577cde1823d2","original_commit_id":"62ca3bbb0e469b6eeb55961578bc5402df1014f1","user":{"login":"lbeurerkellner","id":17903049,"node_id":"MDQ6VXNlcjE3OTAzMDQ5","avatar_url":"https://avatars2.githubusercontent.com/u/17903049?v=4","gravatar_id":"","url":"https://api.github.com/users/lbeurerkellner","html_url":"https://github.com/lbeurerkellner","followers_url":"https://api.github.com/users/lbeurerkellner/followers","following_url":"https://api.github.com/users/lbeurerkellner/following{/other_user}","gists_url":"https://api.github.com/users/lbeurerkellner/gists{/gist_id}","starred_url":"https://api.github.com/users/lbeurerkellner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbeurerkellner/subscriptions","organizations_url":"https://api.github.com/users/lbeurerkellner/orgs","repos_url":"https://api.github.com/users/lbeurerkellner/repos","events_url":"https://api.github.com/users/lbeurerkellner/events{/privacy}","received_events_url":"https://api.github.com/users/lbeurerkellner/received_events","type":"User","site_admin":false},"body":"Very good point, thanks! This really only is a temporary fix and I am looking forward to the proper semver support that will be merged with GH-940.","created_at":"2018-07-13T14:46:29Z","updated_at":"2018-07-13T14:46:30Z","html_url":"https://github.com/eclipse/n4js/pull/973#discussion_r202374085","pull_request_url":"https://api.github.com/repos/eclipse/n4js/pulls/973","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/eclipse/n4js/pulls/comments/202374085"},"html":{"href":"https://github.com/eclipse/n4js/pull/973#discussion_r202374085"},"pull_request":{"href":"https://api.github.com/repos/eclipse/n4js/pulls/973"}},"in_reply_to_id":202363638},"pull_request":{"url":"https://api.github.com/repos/eclipse/n4js/pulls/973","id":201036175,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxMDM2MTc1","html_url":"https://github.com/eclipse/n4js/pull/973","diff_url":"https://github.com/eclipse/n4js/pull/973.diff","patch_url":"https://github.com/eclipse/n4js/pull/973.patch","issue_url":"https://api.github.com/repos/eclipse/n4js/issues/973","number":973,"state":"open","locked":false,"title":"GH-963: Integration tests report cyclic dependencies in fabelhaft snapshot code on Jenkins","user":{"login":"lbeurerkellner","id":17903049,"node_id":"MDQ6VXNlcjE3OTAzMDQ5","avatar_url":"https://avatars2.githubusercontent.com/u/17903049?v=4","gravatar_id":"","url":"https://api.github.com/users/lbeurerkellner","html_url":"https://github.com/lbeurerkellner","followers_url":"https://api.github.com/users/lbeurerkellner/followers","following_url":"https://api.github.com/users/lbeurerkellner/following{/other_user}","gists_url":"https://api.github.com/users/lbeurerkellner/gists{/gist_id}","starred_url":"https://api.github.com/users/lbeurerkellner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbeurerkellner/subscriptions","organizations_url":"https://api.github.com/users/lbeurerkellner/orgs","repos_url":"https://api.github.com/users/lbeurerkellner/repos","events_url":"https://api.github.com/users/lbeurerkellner/events{/privacy}","received_events_url":"https://api.github.com/users/lbeurerkellner/received_events","type":"User","site_admin":false},"body":"Ticket: https://github.com/eclipse/n4js/issues/963\r\n\r\nWhile fixing the tests, I ran into a edge-case with the headless compiler: Generally, we support the use of a pre-existing target platform location (node_modules folder) in the headless compiler, however the support was not implemented properly. \r\n\r\nIn this PR, I specifically addressed an issue where an already-installed version of a package was reinstalled, even if the requested version in the target platform location would be an exact version match. In the future it would be desirable to extend this support to version constraints. As a consequence, the headless compiler will not install missing dependencies, if they are already present in the node_modules folder of the target platform location and they match the requested constraint. To support this properly, we must wait for #940 to be completed.\r\n\r\nAnother change that is introduced by this PR, is that the headless compiler now adopts an existing target platform definition file (package.json) and does no longer replace it with a default one. This was required, since otherwise the headless compiler cannot properly uninstall dependencies that only exist in the target platform in the wrong version.\r\n\r\n","created_at":"2018-07-12T15:15:50Z","updated_at":"2018-07-13T14:46:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"265f63433d30bea8a147150d4cbbdac856db9b6b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/n4js/pulls/973/commits","review_comments_url":"https://api.github.com/repos/eclipse/n4js/pulls/973/comments","review_comment_url":"https://api.github.com/repos/eclipse/n4js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/n4js/issues/973/comments","statuses_url":"https://api.github.com/repos/eclipse/n4js/statuses/4466d168538b8850c5b75fb3726c577cde1823d2","head":{"label":"lbeurerkellner:GH-963-lbk","ref":"GH-963-lbk","sha":"4466d168538b8850c5b75fb3726c577cde1823d2","user":{"login":"lbeurerkellner","id":17903049,"node_id":"MDQ6VXNlcjE3OTAzMDQ5","avatar_url":"https://avatars2.githubusercontent.com/u/17903049?v=4","gravatar_id":"","url":"https://api.github.com/users/lbeurerkellner","html_url":"https://github.com/lbeurerkellner","followers_url":"https://api.github.com/users/lbeurerkellner/followers","following_url":"https://api.github.com/users/lbeurerkellner/following{/other_user}","gists_url":"https://api.github.com/users/lbeurerkellner/gists{/gist_id}","starred_url":"https://api.github.com/users/lbeurerkellner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbeurerkellner/subscriptions","organizations_url":"https://api.github.com/users/lbeurerkellner/orgs","repos_url":"https://api.github.com/users/lbeurerkellner/repos","events_url":"https://api.github.com/users/lbeurerkellner/events{/privacy}","received_events_url":"https://api.github.com/users/lbeurerkellner/received_events","type":"User","site_admin":false},"repo":{"id":96518431,"node_id":"MDEwOlJlcG9zaXRvcnk5NjUxODQzMQ==","name":"n4js","full_name":"lbeurerkellner/n4js","owner":{"login":"lbeurerkellner","id":17903049,"node_id":"MDQ6VXNlcjE3OTAzMDQ5","avatar_url":"https://avatars2.githubusercontent.com/u/17903049?v=4","gravatar_id":"","url":"https://api.github.com/users/lbeurerkellner","html_url":"https://github.com/lbeurerkellner","followers_url":"https://api.github.com/users/lbeurerkellner/followers","following_url":"https://api.github.com/users/lbeurerkellner/following{/other_user}","gists_url":"https://api.github.com/users/lbeurerkellner/gists{/gist_id}","starred_url":"https://api.github.com/users/lbeurerkellner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbeurerkellner/subscriptions","organizations_url":"https://api.github.com/users/lbeurerkellner/orgs","repos_url":"https://api.github.com/users/lbeurerkellner/repos","events_url":"https://api.github.com/users/lbeurerkellner/events{/privacy}","received_events_url":"https://api.github.com/users/lbeurerkellner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lbeurerkellner/n4js","description":"Personal fork for contributing to the main repo.","fork":true,"url":"https://api.github.com/repos/lbeurerkellner/n4js","forks_url":"https://api.github.com/repos/lbeurerkellner/n4js/forks","keys_url":"https://api.github.com/repos/lbeurerkellner/n4js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lbeurerkellner/n4js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lbeurerkellner/n4js/teams","hooks_url":"https://api.github.com/repos/lbeurerkellner/n4js/hooks","issue_events_url":"https://api.github.com/repos/lbeurerkellner/n4js/issues/events{/number}","events_url":"https://api.github.com/repos/lbeurerkellner/n4js/events","assignees_url":"https://api.github.com/repos/lbeurerkellner/n4js/assignees{/user}","branches_url":"https://api.github.com/repos/lbeurerkellner/n4js/branches{/branch}","tags_url":"https://api.github.com/repos/lbeurerkellner/n4js/tags","blobs_url":"https://api.github.com/repos/lbeurerkellner/n4js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lbeurerkellner/n4js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lbeurerkellner/n4js/git/refs{/sha}","trees_url":"https://api.github.com/repos/lbeurerkellner/n4js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lbeurerkellner/n4js/statuses/{sha}","languages_url":"https://api.github.com/repos/lbeurerkellner/n4js/languages","stargazers_url":"https://api.github.com/repos/lbeurerkellner/n4js/stargazers","contributors_url":"https://api.github.com/repos/lbeurerkellner/n4js/contributors","subscribers_url":"https://api.github.com/repos/lbeurerkellner/n4js/subscribers","subscription_url":"https://api.github.com/repos/lbeurerkellner/n4js/subscription","commits_url":"https://api.github.com/repos/lbeurerkellner/n4js/commits{/sha}","git_commits_url":"https://api.github.com/repos/lbeurerkellner/n4js/git/commits{/sha}","comments_url":"https://api.github.com/repos/lbeurerkellner/n4js/comments{/number}","issue_comment_url":"https://api.github.com/repos/lbeurerkellner/n4js/issues/comments{/number}","contents_url":"https://api.github.com/repos/lbeurerkellner/n4js/contents/{+path}","compare_url":"https://api.github.com/repos/lbeurerkellner/n4js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lbeurerkellner/n4js/merges","archive_url":"https://api.github.com/repos/lbeurerkellner/n4js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lbeurerkellner/n4js/downloads","issues_url":"https://api.github.com/repos/lbeurerkellner/n4js/issues{/number}","pulls_url":"https://api.github.com/repos/lbeurerkellner/n4js/pulls{/number}","milestones_url":"https://api.github.com/repos/lbeurerkellner/n4js/milestones{/number}","notifications_url":"https://api.github.com/repos/lbeurerkellner/n4js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lbeurerkellner/n4js/labels{/name}","releases_url":"https://api.github.com/repos/lbeurerkellner/n4js/releases{/id}","deployments_url":"https://api.github.com/repos/lbeurerkellner/n4js/deployments","created_at":"2017-07-07T08:42:29Z","updated_at":"2018-06-21T09:50:55Z","pushed_at":"2018-07-13T14:44:28Z","git_url":"git://github.com/lbeurerkellner/n4js.git","ssh_url":"git@github.com:lbeurerkellner/n4js.git","clone_url":"https://github.com/lbeurerkellner/n4js.git","svn_url":"https://github.com/lbeurerkellner/n4js","homepage":"","size":52831,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"epl-1.0","name":"Eclipse Public License 1.0","spdx_id":"EPL-1.0","url":"https://api.github.com/licenses/epl-1.0","node_id":"MDc6TGljZW5zZTc="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"eclipse:master","ref":"master","sha":"4f1b6538d5d9f648dc3202607ff6f32207964815","user":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":87847606,"node_id":"MDEwOlJlcG9zaXRvcnk4Nzg0NzYwNg==","name":"n4js","full_name":"eclipse/n4js","owner":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eclipse/n4js","description":null,"fork":false,"url":"https://api.github.com/repos/eclipse/n4js","forks_url":"https://api.github.com/repos/eclipse/n4js/forks","keys_url":"https://api.github.com/repos/eclipse/n4js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/n4js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/n4js/teams","hooks_url":"https://api.github.com/repos/eclipse/n4js/hooks","issue_events_url":"https://api.github.com/repos/eclipse/n4js/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/n4js/events","assignees_url":"https://api.github.com/repos/eclipse/n4js/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/n4js/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/n4js/tags","blobs_url":"https://api.github.com/repos/eclipse/n4js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/n4js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/n4js/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/n4js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/n4js/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/n4js/languages","stargazers_url":"https://api.github.com/repos/eclipse/n4js/stargazers","contributors_url":"https://api.github.com/repos/eclipse/n4js/contributors","subscribers_url":"https://api.github.com/repos/eclipse/n4js/subscribers","subscription_url":"https://api.github.com/repos/eclipse/n4js/subscription","commits_url":"https://api.github.com/repos/eclipse/n4js/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/n4js/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/n4js/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/n4js/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/n4js/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/n4js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/n4js/merges","archive_url":"https://api.github.com/repos/eclipse/n4js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/n4js/downloads","issues_url":"https://api.github.com/repos/eclipse/n4js/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/n4js/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/n4js/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/n4js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/n4js/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/n4js/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/n4js/deployments","created_at":"2017-04-10T19:05:37Z","updated_at":"2018-07-11T14:12:59Z","pushed_at":"2018-07-13T14:44:30Z","git_url":"git://github.com/eclipse/n4js.git","ssh_url":"git@github.com:eclipse/n4js.git","clone_url":"https://github.com/eclipse/n4js.git","svn_url":"https://github.com/eclipse/n4js","homepage":null,"size":53755,"stargazers_count":10,"watchers_count":10,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":232,"license":{"key":"epl-1.0","name":"Eclipse Public License 1.0","spdx_id":"EPL-1.0","url":"https://api.github.com/licenses/epl-1.0","node_id":"MDc6TGljZW5zZTc="},"forks":10,"open_issues":232,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/n4js/pulls/973"},"html":{"href":"https://github.com/eclipse/n4js/pull/973"},"issue":{"href":"https://api.github.com/repos/eclipse/n4js/issues/973"},"comments":{"href":"https://api.github.com/repos/eclipse/n4js/issues/973/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/n4js/pulls/973/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/n4js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/n4js/pulls/973/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/n4js/statuses/4466d168538b8850c5b75fb3726c577cde1823d2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lbeurerkellner"}}