{"action":"created","comment":{"url":"https://api.github.com/repos/realm/realm-java/pulls/comments/41502792","id":41502792,"diff_hunk":"@@ -87,16 +87,39 @@ if (project.forceDownloadCore instanceof String) {\n     ext.forceDownloadCore = Boolean.parseBoolean(project.forceDownloadCore)\n }\n \n-task checkProperties(group: 'check', description: 'Check the user provided gradle.properties') << {\n-    if (!project.ext['ndk.dir']) {\n-        throw new GradleException('The ndkDir property in the gradle.properties file is not set.')\n-    } else if (project.ext['ndk.dir'].endsWith('/')) {\n-        throw new GradleException('The path provided in the ndkProperty in the gradle.properties ends with /')\n-    } else if (!file(project.ext['ndk.dir']).directory) {\n-        throw new GradleException('The path provided in the ndkDir property in the gradle.properties is not a folder.')\n-    } else if (!file(new File(project.ext['ndk.dir'], 'RELEASE.TXT')).file) {\n-        throw new GradleException('The path provided in the ndkDir property in the gradle.properties does not seem to be an Android NDK.')\n+def getNdkDir() {\n+    def ndkDir = null\n+    if (project.ext.properties.containsKey('ndk.dir')) {\n+        ndkDir = project.ext['ndk.dir']\n+    } else if (System.getenv('NDK_HOME')) {\n+        ndkDir = System.getenv('NDK_HOME')\n+    }\n+    if (ndkDir && ndkDir[-1] == \"/\") {\n+        ndkDir = ndkDir[0..-2]\n+    }\n+    return ndkDir\n+}\n+\n+def verifyNdk() {\n+    def ndkDir = getNdkDir()\n+    if (!ndkDir) {\n+        throw new GradleException('The ndk.dir property in the local.properties file and NDK_HOME are not set. One of them should be set.')\n+    }\n+    if (!file(ndkDir).directory) {","path":"realm-jni/build.gradle","position":31,"original_position":31,"commit_id":"c2dea441f72269d950fb981bb7598e4f9177af8d","original_commit_id":"c2dea441f72269d950fb981bb7598e4f9177af8d","user":{"login":"cmelchior","id":406066,"avatar_url":"https://avatars.githubusercontent.com/u/406066?v=3","gravatar_id":"","url":"https://api.github.com/users/cmelchior","html_url":"https://github.com/cmelchior","followers_url":"https://api.github.com/users/cmelchior/followers","following_url":"https://api.github.com/users/cmelchior/following{/other_user}","gists_url":"https://api.github.com/users/cmelchior/gists{/gist_id}","starred_url":"https://api.github.com/users/cmelchior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmelchior/subscriptions","organizations_url":"https://api.github.com/users/cmelchior/orgs","repos_url":"https://api.github.com/users/cmelchior/repos","events_url":"https://api.github.com/users/cmelchior/events{/privacy}","received_events_url":"https://api.github.com/users/cmelchior/received_events","type":"User","site_admin":false},"body":"Shouldn't this check be part of `getNdkDir`?","created_at":"2015-10-08T11:38:36Z","updated_at":"2015-10-08T11:38:36Z","html_url":"https://github.com/realm/realm-java/pull/1539#discussion_r41502792","pull_request_url":"https://api.github.com/repos/realm/realm-java/pulls/1539","_links":{"self":{"href":"https://api.github.com/repos/realm/realm-java/pulls/comments/41502792"},"html":{"href":"https://github.com/realm/realm-java/pull/1539#discussion_r41502792"},"pull_request":{"href":"https://api.github.com/repos/realm/realm-java/pulls/1539"}}},"pull_request":{"url":"https://api.github.com/repos/realm/realm-java/pulls/1539","id":46991439,"html_url":"https://github.com/realm/realm-java/pull/1539","diff_url":"https://github.com/realm/realm-java/pull/1539.diff","patch_url":"https://github.com/realm/realm-java/pull/1539.patch","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1539","number":1539,"state":"open","locked":false,"title":"Support environment variable, path ends with / and determining the right NDK version.","user":{"login":"dalinaum","id":145585,"avatar_url":"https://avatars.githubusercontent.com/u/145585?v=3","gravatar_id":"","url":"https://api.github.com/users/dalinaum","html_url":"https://github.com/dalinaum","followers_url":"https://api.github.com/users/dalinaum/followers","following_url":"https://api.github.com/users/dalinaum/following{/other_user}","gists_url":"https://api.github.com/users/dalinaum/gists{/gist_id}","starred_url":"https://api.github.com/users/dalinaum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalinaum/subscriptions","organizations_url":"https://api.github.com/users/dalinaum/orgs","repos_url":"https://api.github.com/users/dalinaum/repos","events_url":"https://api.github.com/users/dalinaum/events{/privacy}","received_events_url":"https://api.github.com/users/dalinaum/received_events","type":"User","site_admin":false},"body":"@realm/java I made a simple patch to supports `ANDROID_NDK`. Please help to review.","created_at":"2015-10-07T06:35:54Z","updated_at":"2015-10-08T11:38:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b61fc1df0db6a680c0366362680f4bcf99b2fd36","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/realm/realm-java/pulls/1539/commits","review_comments_url":"https://api.github.com/repos/realm/realm-java/pulls/1539/comments","review_comment_url":"https://api.github.com/repos/realm/realm-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1539/comments","statuses_url":"https://api.github.com/repos/realm/realm-java/statuses/c2dea441f72269d950fb981bb7598e4f9177af8d","head":{"label":"realm:lk-improve-jni-gradle","ref":"lk-improve-jni-gradle","sha":"c2dea441f72269d950fb981bb7598e4f9177af8d","user":{"login":"realm","id":7575099,"avatar_url":"https://avatars.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"repo":{"id":4084908,"name":"realm-java","full_name":"realm/realm-java","owner":{"login":"realm","id":7575099,"avatar_url":"https://avatars.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/realm/realm-java","description":"Realm is a mobile database: a replacement for SQLite & ORMs","fork":false,"url":"https://api.github.com/repos/realm/realm-java","forks_url":"https://api.github.com/repos/realm/realm-java/forks","keys_url":"https://api.github.com/repos/realm/realm-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/realm/realm-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/realm/realm-java/teams","hooks_url":"https://api.github.com/repos/realm/realm-java/hooks","issue_events_url":"https://api.github.com/repos/realm/realm-java/issues/events{/number}","events_url":"https://api.github.com/repos/realm/realm-java/events","assignees_url":"https://api.github.com/repos/realm/realm-java/assignees{/user}","branches_url":"https://api.github.com/repos/realm/realm-java/branches{/branch}","tags_url":"https://api.github.com/repos/realm/realm-java/tags","blobs_url":"https://api.github.com/repos/realm/realm-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/realm/realm-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/realm/realm-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/realm/realm-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/realm/realm-java/statuses/{sha}","languages_url":"https://api.github.com/repos/realm/realm-java/languages","stargazers_url":"https://api.github.com/repos/realm/realm-java/stargazers","contributors_url":"https://api.github.com/repos/realm/realm-java/contributors","subscribers_url":"https://api.github.com/repos/realm/realm-java/subscribers","subscription_url":"https://api.github.com/repos/realm/realm-java/subscription","commits_url":"https://api.github.com/repos/realm/realm-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/realm/realm-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/realm/realm-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/realm/realm-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/realm/realm-java/contents/{+path}","compare_url":"https://api.github.com/repos/realm/realm-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/realm/realm-java/merges","archive_url":"https://api.github.com/repos/realm/realm-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/realm/realm-java/downloads","issues_url":"https://api.github.com/repos/realm/realm-java/issues{/number}","pulls_url":"https://api.github.com/repos/realm/realm-java/pulls{/number}","milestones_url":"https://api.github.com/repos/realm/realm-java/milestones{/number}","notifications_url":"https://api.github.com/repos/realm/realm-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/realm/realm-java/labels{/name}","releases_url":"https://api.github.com/repos/realm/realm-java/releases{/id}","created_at":"2012-04-20T09:18:42Z","updated_at":"2015-10-08T11:24:02Z","pushed_at":"2015-10-08T11:17:52Z","git_url":"git://github.com/realm/realm-java.git","ssh_url":"git@github.com:realm/realm-java.git","clone_url":"https://github.com/realm/realm-java.git","svn_url":"https://github.com/realm/realm-java","homepage":"http://realm.io","size":57322,"stargazers_count":2571,"watchers_count":2571,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":266,"mirror_url":null,"open_issues_count":161,"forks":266,"open_issues":161,"watchers":2571,"default_branch":"master"}},"base":{"label":"realm:master","ref":"master","sha":"9e4bc55e5039684220ce4ca4fbbc4fb8d0b152ce","user":{"login":"realm","id":7575099,"avatar_url":"https://avatars.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"repo":{"id":4084908,"name":"realm-java","full_name":"realm/realm-java","owner":{"login":"realm","id":7575099,"avatar_url":"https://avatars.githubusercontent.com/u/7575099?v=3","gravatar_id":"","url":"https://api.github.com/users/realm","html_url":"https://github.com/realm","followers_url":"https://api.github.com/users/realm/followers","following_url":"https://api.github.com/users/realm/following{/other_user}","gists_url":"https://api.github.com/users/realm/gists{/gist_id}","starred_url":"https://api.github.com/users/realm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realm/subscriptions","organizations_url":"https://api.github.com/users/realm/orgs","repos_url":"https://api.github.com/users/realm/repos","events_url":"https://api.github.com/users/realm/events{/privacy}","received_events_url":"https://api.github.com/users/realm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/realm/realm-java","description":"Realm is a mobile database: a replacement for SQLite & ORMs","fork":false,"url":"https://api.github.com/repos/realm/realm-java","forks_url":"https://api.github.com/repos/realm/realm-java/forks","keys_url":"https://api.github.com/repos/realm/realm-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/realm/realm-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/realm/realm-java/teams","hooks_url":"https://api.github.com/repos/realm/realm-java/hooks","issue_events_url":"https://api.github.com/repos/realm/realm-java/issues/events{/number}","events_url":"https://api.github.com/repos/realm/realm-java/events","assignees_url":"https://api.github.com/repos/realm/realm-java/assignees{/user}","branches_url":"https://api.github.com/repos/realm/realm-java/branches{/branch}","tags_url":"https://api.github.com/repos/realm/realm-java/tags","blobs_url":"https://api.github.com/repos/realm/realm-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/realm/realm-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/realm/realm-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/realm/realm-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/realm/realm-java/statuses/{sha}","languages_url":"https://api.github.com/repos/realm/realm-java/languages","stargazers_url":"https://api.github.com/repos/realm/realm-java/stargazers","contributors_url":"https://api.github.com/repos/realm/realm-java/contributors","subscribers_url":"https://api.github.com/repos/realm/realm-java/subscribers","subscription_url":"https://api.github.com/repos/realm/realm-java/subscription","commits_url":"https://api.github.com/repos/realm/realm-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/realm/realm-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/realm/realm-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/realm/realm-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/realm/realm-java/contents/{+path}","compare_url":"https://api.github.com/repos/realm/realm-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/realm/realm-java/merges","archive_url":"https://api.github.com/repos/realm/realm-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/realm/realm-java/downloads","issues_url":"https://api.github.com/repos/realm/realm-java/issues{/number}","pulls_url":"https://api.github.com/repos/realm/realm-java/pulls{/number}","milestones_url":"https://api.github.com/repos/realm/realm-java/milestones{/number}","notifications_url":"https://api.github.com/repos/realm/realm-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/realm/realm-java/labels{/name}","releases_url":"https://api.github.com/repos/realm/realm-java/releases{/id}","created_at":"2012-04-20T09:18:42Z","updated_at":"2015-10-08T11:24:02Z","pushed_at":"2015-10-08T11:17:52Z","git_url":"git://github.com/realm/realm-java.git","ssh_url":"git@github.com:realm/realm-java.git","clone_url":"https://github.com/realm/realm-java.git","svn_url":"https://github.com/realm/realm-java","homepage":"http://realm.io","size":57322,"stargazers_count":2571,"watchers_count":2571,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":266,"mirror_url":null,"open_issues_count":161,"forks":266,"open_issues":161,"watchers":2571,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/realm/realm-java/pulls/1539"},"html":{"href":"https://github.com/realm/realm-java/pull/1539"},"issue":{"href":"https://api.github.com/repos/realm/realm-java/issues/1539"},"comments":{"href":"https://api.github.com/repos/realm/realm-java/issues/1539/comments"},"review_comments":{"href":"https://api.github.com/repos/realm/realm-java/pulls/1539/comments"},"review_comment":{"href":"https://api.github.com/repos/realm/realm-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/realm/realm-java/pulls/1539/commits"},"statuses":{"href":"https://api.github.com/repos/realm/realm-java/statuses/c2dea441f72269d950fb981bb7598e4f9177af8d"}}}}