Skip to content

Commit 34478e6

Browse files
committed
Kotlinize
1 parent 0c8a7a6 commit 34478e6

File tree

7 files changed

+72
-66
lines changed

7 files changed

+72
-66
lines changed

app/build.gradle

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,54 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: "org.jlleitschuh.gradle.ktlint"
24

35
android {
46
compileSdkVersion 26
7+
dataBinding.enabled = true
8+
59
defaultConfig {
610
applicationId "co.kyash.vtl"
7-
minSdkVersion 15
11+
minSdkVersion 19
812
targetSdkVersion 26
913
versionCode 1
1014
versionName "1.0"
1115
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1216
}
1317
buildTypes {
18+
debug {
19+
applicationIdSuffix '.debug'
20+
versionNameSuffix "-debug"
21+
}
1422
release {
23+
debuggable false
24+
zipAlignEnabled true
1525
minifyEnabled false
1626
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1727
}
1828
}
29+
testOptions {
30+
unitTests.returnDefaultValues = true
31+
}
32+
lintOptions {
33+
lintConfig file('lint.xml')
34+
textReport true
35+
textOutput 'stdout'
36+
}
1937
}
2038

2139
dependencies {
22-
implementation fileTree(dir: 'libs', include: ['*.jar'])
23-
implementation 'com.android.support:appcompat-v7:26.1.0'
40+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
41+
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
2442
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
43+
2544
testImplementation 'junit:junit:4.12'
2645
androidTestImplementation 'com.android.support.test:runner:1.0.1'
2746
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
2847
}
48+
49+
ktlint {
50+
version = "0.14.0"
51+
android = true
52+
reporter = "checkstyle"
53+
ignoreFailures = true
54+
}

app/src/androidTest/java/co/kyash/vtl/ExampleInstrumentedTest.java

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package co.kyash.vtl
2+
3+
import android.support.test.InstrumentationRegistry
4+
import android.support.test.runner.AndroidJUnit4
5+
import org.junit.Assert.assertEquals
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
/**
10+
* Instrumented test, which will execute on an Android device.
11+
*
12+
* @see [Testing documentation](http://d.android.com/tools/testing)
13+
*/
14+
@RunWith(AndroidJUnit4::class)
15+
class ExampleInstrumentedTest {
16+
@Test
17+
@Throws(Exception::class)
18+
fun useAppContext() {
19+
// Context of the app under test.
20+
val appContext = InstrumentationRegistry.getTargetContext()
21+
22+
assertEquals("co.kyash.vtl", appContext.packageName)
23+
}
24+
}

app/src/main/java/co/kyash/vtl/MainActivity.java

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package co.kyash.vtl
2+
3+
import android.os.Bundle
4+
import android.support.v7.app.AppCompatActivity
5+
6+
class MainActivity : AppCompatActivity() {
7+
8+
override fun onCreate(savedInstanceState: Bundle?) {
9+
super.onCreate(savedInstanceState)
10+
setContentView(R.layout.activity_main)
11+
}
12+
}

app/src/test/java/co/kyash/vtl/ExampleUnitTest.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
31
buildscript {
4-
2+
3+
ext.kotlinVersion = '1.2.10'
4+
ext.supportLibraryVersion = '26.1.0'
5+
56
repositories {
67
google()
78
jcenter()
9+
maven { url "https://plugins.gradle.org/m2/" }
810
}
911
dependencies {
1012
classpath 'com.android.tools.build:gradle:3.0.1'
11-
12-
13-
// NOTE: Do not place your application dependencies here; they belong
14-
// in the individual module build.gradle files
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
14+
classpath "gradle.plugin.org.jlleitschuh.gradle:ktlint-gradle:3.0.0"
1515
}
1616
}
1717

0 commit comments

Comments
 (0)