{"action":"created","comment":{"url":"https://api.github.com/repos/realm/realm-java/pulls/comments/49699015","id":49699015,"diff_hunk":"@@ -248,6 +248,72 @@ task deployCore(group: 'build setup', description: 'Deploy the latest version of\n     }\n }\n \n+task assembleRobolectric(description: \"Build the Robolectric shared library for Darwin\") {\n+    def staticLibPath = \"/usr/local/lib/librealm.a\"\n+\n+    if (System.env.REALM_CORE_LIB) {\n+        def realmCoreLibDir = file(System.env.REALM_CORE_LIB)\n+        staticLibPath = \"$realmCoreLibDir/librealm.a\"\n+    }\n+\n+    doFirst {\n+        if (file(staticLibPath).exists() == false) {\n+            throw new GradleException(\"The Realm Core library for OS X is not installed correctly. If the static lib is not located in /usr/local/lib, please set the environment variable REALM_CORE_LIB\")\n+        }\n+    }\n+\n+    doLast {\n+        copy {\n+            from staticLibPath\n+            into \"${projectDir}/../realm-library/src\"\n+        }\n+\n+        exec {\n+            environment CC: \"${clang?'clang':'gcc'}\"\n+            environment STRIP: \"/usr/bin/strip -o librealm-jni-darwin-stripped.dylib\"\n+            commandLine = [\n+                'make',\n+                \"-j${Runtime.getRuntime().availableProcessors() * 2}\",\n+                \"-l${Runtime.getRuntime().availableProcessors()}\",\n+                '-C', \"${projectDir}/src\",\n+                \"CC_IS=${clang?'clang':'gcc'}\",\n+                \"REALM_CFLAGS_COMMON=-Wno-variadic-macros -DREALM_HAVE_CONFIG -DPIC -I/usr/local/include/realm/ -I/usr/local/include/ -I/System/Library/Frameworks/JavaVM.framework/Headers/\",\n+                \"CFLAGS_ARCH=${commonCflags.join(' ')}\",\n+                \"BASE_DENOM=darwin\",\n+                \"REALM_LDFLAGS_COMMON=-lrealm -lstdc++ -L${projectDir}/../realm-library/src -L/usr/local/lib/ -Wl,-dead_strip -flto -Wl,-search_paths_first -framework CoreServices\",\n+                'LIB_SUFFIX_SHARED=.dylib',\n+                \"librealm-jni-darwin${getDebugExt()}.dylib\"\n+            ]\n+        }\n+\n+        copy {\n+            from \"${projectDir}/src/librealm-jni-darwin${getDebugExt()}${getStrippedExt()}.dylib\"\n+            into \"${projectDir}/../realm-library/src/main/robolectricLibs\"\n+            rename \"librealm-jni-darwin${getDebugExt()}${getStrippedExt()}.dylib\", 'librealm-jni-darwin.dylib'\n+        }\n+\n+        // Store the unstripped version\n+        copy {\n+            from \"${projectDir}/src/librealm-jni-darwin${getDebugExt()}.dylib\"\n+            into \"${projectDir}/../build/output/jniLibs-unstripped/robolectric\"\n+            rename \"librealm-jni-darwin${getDebugExt()}.dylib\", 'librealm-jni-darwin.dylib'\n+        }\n+\n+        delete fileTree(dir: \"${projectDir}/../realm-library/src\", include: '**/librealm.a')\n+    }\n+}\n+\n+task installRobolectric(description: \"Install native library to support Robolectric.\") {","path":"realm/realm-jni/build.gradle","position":59,"original_position":59,"commit_id":"ba4dd1381a8ea5c6145fe0c6b195d0ceeb24bb6e","original_commit_id":"defd84ecf40546f5fd8de1d608c05b546216038e","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":":+1: ","created_at":"2016-01-14T08:40:34Z","updated_at":"2016-01-14T08:40:34Z","html_url":"https://github.com/realm/realm-java/pull/1867#discussion_r49699015","pull_request_url":"https://api.github.com/repos/realm/realm-java/pulls/1867","_links":{"self":{"href":"https://api.github.com/repos/realm/realm-java/pulls/comments/49699015"},"html":{"href":"https://github.com/realm/realm-java/pull/1867#discussion_r49699015"},"pull_request":{"href":"https://api.github.com/repos/realm/realm-java/pulls/1867"}}},"pull_request":{"url":"https://api.github.com/repos/realm/realm-java/pulls/1867","id":52242091,"html_url":"https://github.com/realm/realm-java/pull/1867","diff_url":"https://github.com/realm/realm-java/pull/1867.diff","patch_url":"https://github.com/realm/realm-java/pull/1867.patch","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1867","number":1867,"state":"open","locked":false,"title":"Add support for Robolectric on Max OS X","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":"#904\r\n\r\n* [x] Add the gradle script\r\n* [x] [Robolectric test sample](https://github.com/dalinaum/RobolectricTest) integrates with Realm-java\r\n* [x] Update Realm Java version. (f84bdf28a9cafdcd0eed8fd042ad70969ca4fc7d)\r\n* [x] Update Realm Java version. (735ccb4d5e8d590bfdf38847e501fc1c81f4bd17)\r\n* [x] Use Gradle plugin instead of using a prebuilt file.\r\n* [x] Apply static core lib.\r\n* [x] Update Realm Java version. (904a937b982aa3336cd2ecd450b855b584b3e5ce)\r\n* [x] Update Realm Java version. (de98da6eda1519fcc2f5cfeeb10900045c02b773)\r\n* [x] Update Realm Java version. (fe082ef0c9fab6d89392826f1a7a2c7351367a54)\r\n* [x] Packaging.\r\n* [x] Clean up.\r\n* [x] Distribution.\r\n* [x] Download support for Robolectric file from S3.\r\n* [x] Make a Gradle Plugin instead of the Gradle task.","created_at":"2015-12-01T10:47:22Z","updated_at":"2016-01-14T08:40:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61806f89a8a9109ef9bf3ba678c778798fe787df","assignee":{"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},"milestone":null,"commits_url":"https://api.github.com/repos/realm/realm-java/pulls/1867/commits","review_comments_url":"https://api.github.com/repos/realm/realm-java/pulls/1867/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/1867/comments","statuses_url":"https://api.github.com/repos/realm/realm-java/statuses/ba4dd1381a8ea5c6145fe0c6b195d0ceeb24bb6e","head":{"label":"realm:lk/robolectric","ref":"lk/robolectric","sha":"ba4dd1381a8ea5c6145fe0c6b195d0ceeb24bb6e","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":"2016-01-14T07:18:08Z","pushed_at":"2016-01-14T08:10:43Z","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":45214,"stargazers_count":3351,"watchers_count":3351,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":381,"mirror_url":null,"open_issues_count":196,"forks":381,"open_issues":196,"watchers":3351,"default_branch":"master"}},"base":{"label":"realm:master","ref":"master","sha":"1f135d7208a6928ec630e59066a833dda2faae79","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":"2016-01-14T07:18:08Z","pushed_at":"2016-01-14T08:10:43Z","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":45214,"stargazers_count":3351,"watchers_count":3351,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":381,"mirror_url":null,"open_issues_count":196,"forks":381,"open_issues":196,"watchers":3351,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/realm/realm-java/pulls/1867"},"html":{"href":"https://github.com/realm/realm-java/pull/1867"},"issue":{"href":"https://api.github.com/repos/realm/realm-java/issues/1867"},"comments":{"href":"https://api.github.com/repos/realm/realm-java/issues/1867/comments"},"review_comments":{"href":"https://api.github.com/repos/realm/realm-java/pulls/1867/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/1867/commits"},"statuses":{"href":"https://api.github.com/repos/realm/realm-java/statuses/ba4dd1381a8ea5c6145fe0c6b195d0ceeb24bb6e"}}}}