Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
buildscript {
ext.kotlin_version = '1.2.41'
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.jacoco:org.jacoco.core:0.8.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon May 07 20:12:54 CEST 2018
#Thu Feb 28 08:10:16 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
73 changes: 68 additions & 5 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'jacoco'

group='com.github.Constructor-io'

jacoco {
toolVersion = '0.8.3'
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28

dexOptions {
maxProcessCount 4
Expand All @@ -17,7 +25,7 @@ android {

defaultConfig {
minSdkVersion 19
targetSdkVersion 27
targetSdkVersion 28
testInstrumentationRunner "${applicationId}.runner.RxAndroidJUnitRunner"
versionCode 1
versionName '1.2.0'
Expand Down Expand Up @@ -88,6 +96,61 @@ android {

}

task jacocoUnitTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {

def buildDir = "build/"

def coverageSourceDirs = [
"src/main/java"
]

def excludedClasses = [
'**/databinding/**/*.*',
'**/android/databinding/*Binding.*',
'**/BR.*',
'**/R.*',
'**/R$*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*_MembersInjector.*',
'**/Dagger*Component.*',
'**/Dagger*Component$Builder.*',
'**/*Module_*Factory.*',
'**/*Fragment*.*',
'**/*Activity*.*',
'**/*Adapter*.*',
'**/*ViewPager*.*',
'**/*ViewHolder*.*',
'**/*Module*.*'
]

def javaClasses = fileTree(
dir: "$buildDir/intermediates/classes/debug",
excludes: excludedClasses
)

def kotlinClasses = fileTree(
dir: "$buildDir/tmp/kotlin-classes/debug",
excludes: excludedClasses
)

classDirectories = files([ javaClasses ], [ kotlinClasses ])
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = fileTree(dir: "$buildDir/jacoco", includes: [
"testDebugUnitTest.exec"
])

reports {
xml.enabled = true
html.enabled = true
}
}

task getCoverage(type: Exec, dependsOn: 'jacocoUnitTestReport') {
group = "Reporting"
commandLine "open", "$buildDir/reports/jacoco/jacocoUnitTestReport/html/index.html"
}


apply from: 'dependencies.gradle'
Expand All @@ -104,8 +167,8 @@ dependencies {
implementation supportLibs
implementation networkLibs
implementation otherLibs
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
kapt annotationProcessorLibs
kaptTest daggerCompiler
kaptAndroidTest daggerCompiler
Expand Down
2 changes: 1 addition & 1 deletion library/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {
versions = [
support : "27.1.1",
support : "28.0.0",
moshi : "1.5.0",
okHttp : "3.9.0",
retrofit: '2.3.0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ import io.constructor.injection.module.ActivityModule
import io.constructor.util.d
import java.util.concurrent.atomic.AtomicLong

/**
* Abstract activity that every other Activity in this application must implement. It provides the
* following functionality:
* - Handles creation of Dagger components and makes sure that instances of
* ConfigPersistentComponent are kept across configuration changes.
* - Set up and handles a GoogleApiClient instance that can be used to access the Google sign in
* api.
* - Handles signing out when an authentication error event is received.
*/
abstract class BaseActivity : AppCompatActivity() {

private var activityComponent: ActivityComponent? = null
Expand All @@ -48,7 +39,7 @@ abstract class BaseActivity : AppCompatActivity() {
componentsArray.put(activityId, configPersistentComponent)
} else {
d("Reusing ConfigPersistentComponent id=${activityId}")
configPersistentComponent = componentsArray.get(activityId)
configPersistentComponent = componentsArray.get(activityId)!!
}
activityComponent = configPersistentComponent.activityComponent(ActivityModule(this))
activityComponent?.inject(this)
Expand Down
13 changes: 6 additions & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "io.constructor.sample"
minSdkVersion 19
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -22,7 +22,6 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '27.0.3'
}

configurations.all {
Expand All @@ -36,9 +35,9 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':library')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation "com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation "com.android.support:cardview-v7:28.0.0"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
}