Skip to content

Add support for Robolectric on Max OS X#1867

Open
dalinaum wants to merge 83 commits intomainfrom
lk/robolectric
Open

Add support for Robolectric on Max OS X#1867
dalinaum wants to merge 83 commits intomainfrom
lk/robolectric

Conversation

@dalinaum
Copy link
Copy Markdown
Contributor

@dalinaum dalinaum commented Dec 1, 2015

Fixed by #904

  • Add the gradle script
  • Robolectric test sample integrates with Realm-java
  • Update Realm Java version. (f84bdf2)
  • Update Realm Java version. (735ccb4)
  • Use Gradle plugin instead of using a prebuilt file.
  • Apply static core lib.
  • Update Realm Java version. (904a937)
  • Update Realm Java version. (de98da6)
  • Update Realm Java version. (fe082ef)
  • Packaging.
  • Clean up.
  • Distribution.
  • Download support for Robolectric file from S3.
  • Make a Gradle Plugin instead of the Gradle task.
  • Make a Gradle task to support unit test with better objects.

@dalinaum dalinaum added the WIP label Dec 1, 2015
@dalinaum dalinaum self-assigned this Dec 1, 2015
@cmelchior
Copy link
Copy Markdown
Contributor

See also this PR for unit test example. We should probably add your PR example to that. #1833

@cmelchior cmelchior changed the title Add support for Roborectric Add support for Robolectric Dec 1, 2015
@dalinaum
Copy link
Copy Markdown
Contributor Author

dalinaum commented Dec 5, 2015

➜  robolectricExample git:(lk/robolectric) ✗ find . -name "*Medi*"
./build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/aidl/android/support/v4/media/MediaMetadataCompat.aidl
./build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/aidl/android/support/v4/media/session/MediaSessionCompat.aidl
➜  robolectricExample git:(lk/robolectric) ✗ find . -name "*Proxy*"
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'android-command'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'realm'

android {
    compileSdkVersion rootProject.sdkVersion
    buildToolsVersion rootProject.buildTools

    defaultConfig {
        applicationId 'io.realm.examples.robolectric'
        targetSdkVersion 21
        minSdkVersion 15
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    command {
        events 2000
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    testCompile 'junit:junit:4.12'
    testCompile "org.robolectric:robolectric:3.0"
}

I encountered the error when I used Gradle plugin, so the prebuilt file has used instead and comment out Gradle plugin temporarily.

The following build.gradle and the prebuilt Realm-java work.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }
}

repositories {
    jcenter()
}

//apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
//apply plugin: 'android-command'
//apply plugin: 'com.neenbedankt.android-apt'
//apply plugin: 'realm'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId 'io.realm.examples.robolectric'
        targetSdkVersion 21
        minSdkVersion 15
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    testCompile 'junit:junit:4.12'
    testCompile "org.robolectric:robolectric:3.0"
}

@dalinaum
Copy link
Copy Markdown
Contributor Author

dalinaum commented Dec 8, 2015

retest this please

@dalinaum
Copy link
Copy Markdown
Contributor Author

dalinaum commented Dec 8, 2015

@emanuelez Where should I look into?

@dalinaum dalinaum force-pushed the lk/robolectric branch 2 times, most recently from e55d0e3 to 655b97d Compare December 12, 2015 20:25
@dalinaum
Copy link
Copy Markdown
Contributor Author

If we have annotated codes in test directory, com.neenbedankt.android-apt requires testApt for unit testing. 655b97d fixed the above problem.

@bmunkholm
Copy link
Copy Markdown
Contributor

Can the example be reduced? It also includes a big CSV file.

@dalinaum
Copy link
Copy Markdown
Contributor Author

Since I had not been sure it works fine, I had migrated many tests of RealmTest into robolectricExample. I should delete most tests after stabilising.

@dalinaum dalinaum changed the title Add support for Robolectric Add support for Robolectric for OS X Dec 19, 2015
@dalinaum dalinaum changed the title Add support for Robolectric for OS X Add supporting for Robolectric for OS X Dec 23, 2015
@dalinaum dalinaum changed the title Add supporting for Robolectric for OS X Add supporting Robolectric for OS X Dec 23, 2015
@cdaringe
Copy link
Copy Markdown

Whats the latest status?

@dalinaum
Copy link
Copy Markdown
Contributor Author

It worked well before version 0.88.0, but it doesn't work now, unfortunately. I am suspecting why it doesn't work well. It will be fixed soon.

Although it will be fixed, it needs an additional CI process(or processes).

@dalinaum
Copy link
Copy Markdown
Contributor Author

I found Android's Gradle Plugin applies Transforms for build and android test, not for unit test. I think I should add Gradle task for unit test.

So I'll add the In progress label again.

@JAertgeerts
Copy link
Copy Markdown

Any update?

@dalinaum
Copy link
Copy Markdown
Contributor Author

dalinaum commented May 24, 2016

@JAertgeerts Sorry. This issue's been changed to P2 Backlog. I will look into this issue soon.

@Keerthana
Copy link
Copy Markdown

any update!?

@kneth
Copy link
Copy Markdown
Contributor

kneth commented Oct 24, 2016

@Keerthana Sorry, not really. We have not worked on it lately but I hope we can return to it soon (no promises).

@tmtrademarked
Copy link
Copy Markdown

Just to chime in, this would be tremendously helpful for those of us trying to use Realm and Robolectric. What needs to happen in order to make this real? (It's not clear from the latest status updates)

@tmtrademarked
Copy link
Copy Markdown

Following back up on this one - is this at all on the roadmap?

@cmelchior
Copy link
Copy Markdown
Contributor

cmelchior commented Mar 16, 2017

@tmtrademarked It is on the roadmap, but not scheduled yet. Most likely we will tackle this as part of providing a general JVM API since they have similar requirements in terms of building native code for the platform running it: #2339

@vivekkiran
Copy link
Copy Markdown
Contributor

@cmelchior any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.