robospock / RoboSpock

A testing framework which brings powers of Spock and Groovy to Android app testing
http://robospock.org
MIT License
249 stars 44 forks source link

FYI: New robospock plugin for Gradle #28

Closed Centril closed 9 years ago

Centril commented 10 years ago

For your information:

I've created a new Gradle plugin for robospock which actually works and makes life ridiculously simple... Here it is: https://github.com/Centril/gradle-plugin-robospock

You can apply it in a host of different ways, but the most simple is:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'se.centril.robospock:gradle-plugin-robospock:0.2.0'
    }
}

['android-sdk-manager', 'com.android.application', 'robospock']
    .each { apply plugin: it }

android {
    buildTypes {
        defaultConfig {
            minSdkVersion 9
            targetSdkVersion 20
        }
    }
    compileSdkVersion 20
    buildToolsVersion "20"

    // more exciting stuff...
}

Then you can put all your testing classes in {android-project-root}/src/test/. Thats it =)

pjakubczyk commented 10 years ago

Thanks a lot for outstanding job :)

I will play more with your project v. soon but atm i see problems with java8. did you compiled the plugin using jdk8?

Centril commented 10 years ago

Thanks a bunch =)

Indeed I did - what exactly is the problem? A stack trace perhaps? Didn't think that there'd be a problem compiling the plugin it self in jdk8 since it uses Groovy for everything anyways =)

pjakubczyk commented 10 years ago

I'd compile with jdk7 since android uses it, jdk8 is not recommended especially for M$ users.

Centril commented 10 years ago

Btw, how did you even see that I've compiled with jdk8? There's no mention of jdk8 in the source code anywhere of my project =) I'm using Win8 myself (sadly) and jdk8 and have no problems...

My JAVA_HOME = %SDK%\java\jdk1.8.0_20 since I make non-android projects...

What problems could arise from compiling with jdk8 (given that Gradle uses groovy...) And how do I resolve this without changing my JAVA_HOME?

thoutbeckers commented 10 years ago

You can compile with Java 8 but you'd have to set a target of Java 7 in order for people with a Java 7 runtime environment to use your plugin.

You can do this by applying these gradle rules to your projects:

sourceCompatibility = 1.7
targetCompatibility = 1.7
Centril commented 10 years ago

Fixed in 0.2.1.

Once Gradle 2.2 is released, and the android plugin supports it, I'll release the first major v1 of the project as it requires fixing a bug in Gradle (applying groovy plugin in afterEvaluate...).

Would be great if the plugin was referenced in the README.md of this repo so people can set up robospock easily, and not just myself =)

pjakubczyk commented 10 years ago

@Centril thanks for quick update. I check in the morning if it works my projects since I'd like to be sure if I understand the plugin. Of course once it's tested I will update the readme file!

DerSchimi commented 9 years ago

good job, can't wait to test it ;)

pjakubczyk commented 9 years ago

I think it's not valid since google add support to their official plugin