Skip to content

Commit

Permalink
migrating to kotlin dsl and gradle 4.10
Browse files Browse the repository at this point in the history
  • Loading branch information
juanchosaravia committed Aug 31, 2018
1 parent b3b4223 commit 69933be
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 80 deletions.
67 changes: 0 additions & 67 deletions app/build.gradle

This file was deleted.

65 changes: 65 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-android-extensions")
id("kotlin-kapt")
}

android {
compileSdkVersion(27)
buildToolsVersion = "27.0.3"

This comment has been minimized.

Copy link
@rcd27

rcd27 Sep 12, 2018

We do not have to specify buildToolsVersion explicitly any more.


defaultConfig {
applicationId = "com.droidcba.kedditbysteps"
minSdkVersion(16)
targetSdkVersion(27)
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
packagingOptions.exclude("META-INF/main.kotlin_module")
}

dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))

This comment has been minimized.

Copy link
@rcd27

rcd27 Sep 12, 2018

This line can be removed if you do not use pre-downloaded jars in your project.

implementation("com.android.support:appcompat-v7:27.1.1")
implementation("com.android.support:design:27.1.1")
implementation(kotlin("stdlib-jdk7", KotlinCompilerVersion.VERSION))

implementation("com.squareup.picasso:picasso:2.5.2")


// Retrofit
implementation("com.squareup.retrofit2:retrofit:2.4.0")
implementation("com.squareup.retrofit2:converter-moshi:2.0.0")

// Dagger 2
implementation("com.google.dagger:dagger:2.11")
kapt("com.google.dagger:dagger-compiler:2.11")
compileOnly("org.glassfish:javax.annotation:10.0-b28")

// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.23.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:0.23.0")
// Coroutines - Retrofit extention
implementation("com.jakewharton.retrofit:retrofit2-kotlin-coroutines-experimental-adapter:1.0.0")

// Tests
testImplementation("junit:junit:4.12")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-alpha04")
testImplementation("org.jetbrains.spek:spek:1.0.25")
testImplementation("org.jetbrains.kotlin:kotlin-stdlib:${KotlinCompilerVersion.VERSION}")
}

repositories {
mavenCentral()
maven("http://repository.jetbrains.com/all")
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# By default, the flags in this file are appended to flags specified
# in /Users/juancho/Documents/android_sdk/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# directive in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
14 changes: 5 additions & 9 deletions build.gradle → build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.41'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

classpath("com.android.tools.build:gradle:3.1.4")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.61")

This comment has been minimized.

Copy link
@wojteko22

wojteko22 Sep 18, 2018

You can use classpath(kotlin("gradle-plugin", "1.2.61")) here

This comment has been minimized.

Copy link
@sagar2093

sagar2093 Dec 19, 2018

furthermore, this can be used classpath(kotlin("gradle-plugin", KotlinCompilerVersion.VERSION))

This comment has been minimized.

Copy link
@mingtsay

mingtsay Jan 11, 2019

@sagar2093 that will show up a message:

There were some errors during script dependencies resolution, using previous dependencies

You will need to define the compile version here to choose a compile for the project.
So it won't able to solve the KotlinCompilerVersion here before you set it.
Use classpath(kotlin("gradle-plugin", "1.3.11")) for now the latest version.

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
maven {
url 'https://maven.google.com'
}
maven("https://maven.google.com")
jcenter()
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.register("clean", Delete::class.java) {

This comment has been minimized.

Copy link
@danherrera

danherrera Feb 22, 2019

Another way of defining this is:

task<Delete>("clean") {
    delete(rootProject.buildDir)
}
delete(rootProject.buildDir)
}
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@
# org.gradle.parallel=true

# Kotlin
kotlin.incremental=true
kotlin.coroutines=enable
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include(":app")

0 comments on commit 69933be

Please sign in to comment.