spekframework / spek

A specification framework for Kotlin
Other
2.23k stars 180 forks source link

Spek and Android Data Binding #553

Closed YervandAleksanyan closed 5 years ago

YervandAleksanyan commented 5 years ago

HI

I am trying to use the Spek in my android project. I am using android data binding in my project and an annotation processing library "com.android.databinding:compiler3.1.4" . The problem is that the android data binding Compiler version should be as same as Android Gradle Plugin Version, however after setup spek, idea tells me that I should change Android Gradle Plugin version to 3.2.1. After that it causes lots of problems because the Android Data Binding library last version is 3.1.4 which is not appropriate with new version of Graddle. Any Ideas? Can i use spek with Android Gradle Plugin 3.2.1? So here I have the following for Gradle

app

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

apply plugin: 'jacoco'

apply plugin: "de.mannodermaus.android-junit5"

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "dev.yervand.weatherapp"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        testInstrumentationRunnerArgument "runnerBuilder", "de.mannodermaus.junit5.AndroidJUnit5Builder"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true

        sourceSets.each {
            it.java.srcDirs += "src/$it.name/kotlin"
        }

        testOptions {
            junitPlatform {
                filters {
                    engines {
                        include 'spek2'
                    }
                }
                jacocoOptions {
                    // here goes all jacoco config, for example
                    html.enabled = true
                    xml.enabled = false
                    csv.enabled = false
                    unitTests.all {
                        testLogging.events = ["passed", "skipped", "failed"]
                    }
                }
            }
        }
    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

    }
}

dependencies {
    ext.kotlin_version = '1.2.30'
    ext.lifecycle_version = '1.1.1'
    ext.retrofit_version = '2.4.0'
    ext.dagger2_version = '2.16'
    ext.okhttpVersion = '3.10.0'
    ext.rxJavaVersion = '2.1.16'
    ext.rxAndroidVersion = '2.0.2'
    ext.supportLibVersion = '27.1.1'
    ext.spek_version = '2.0.0-alpha.1'
    ext.android_junit5_version = '1.2.0.0'
    ext.junit5_runner = '0.2.2'
    ext.jacoco_version = '0.8.1'

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    //testing
    // spek2
    testImplementation "org.spekframework.spek2:spek-dsl-jvm:$spek_version"
    testRuntimeOnly "org.spekframework.spek2:spek-runner-junit5:$spek_version"

    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestRuntimeOnly "de.mannodermaus.junit5:android-instrumentation-test-runner:$junit5_runner"

    //noinspection GradleCompatible
    androidTestImplementation 'com.android.support.test:rules:1.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.microsoft.appcenter:espresso-test-extension:1.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-web:3.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
    androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
    //Support library
    implementation "com.android.support:support-v4:${supportLibVersion}"
    implementation "com.android.support:appcompat-v7:${supportLibVersion}"
    implementation "com.android.support:cardview-v7:${supportLibVersion}"
    implementation "com.android.support:design:${supportLibVersion}"
    implementation "com.android.support.constraint:constraint-layout:1.1.3"

    //AAC libs
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
    implementation "android.arch.lifecycle:viewmodel:$lifecycle_version"

    //Networking libs

    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:${retrofit_version}"
    implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit_version}"
    implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
    implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"

    //Dagger 2
    implementation "com.google.dagger:dagger:$dagger2_version"
    kapt "com.google.dagger:dagger-compiler:$dagger2_version"
    kapt "com.google.dagger:dagger-android-processor:$dagger2_version"
    compileOnly "org.glassfish:javax.annotation:3.1.1"
    implementation "com.google.dagger:dagger-android-support:${dagger2_version}"

    //RxJava2
    implementation "io.reactivex.rxjava2:rxandroid:${rxAndroidVersion}"
    implementation "io.reactivex.rxjava2:rxjava:${rxJavaVersion}"

    //Leak Canary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'

    //Picasso
    implementation 'com.squareup.picasso:picasso:2.71828'

    //DataBinding
    kapt 'com.android.databinding:compiler:3.1.4'

    //Validation
    implementation 'com.baidu.unbiz:fluent-validator:1.0.9'

    implementation 'com.android.support:multidex:1.0.3'
}

project

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.2.51'
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "de.mannodermaus.gradle.plugins:android-junit5:1.2.0.0"
        classpath "org.jacoco:org.jacoco.core:0.8.1"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://dl.bintray.com/spekframework/spek-dev" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
raniejade commented 5 years ago

It should work, and you should change testRuntimeOnly "org.spekframework.spek2:spek-runner-junit5:$spek_version" to testImplementation "org.spekframework.spek2:spek-runner-junit5:$spek_version".

YervandAleksanyan commented 5 years ago

@raniejade hulsom After change , problem doesn't fixed

raniejade commented 5 years ago

can you describe what exactly the problem is?

raniejade commented 5 years ago

Closing due to no activity.