Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to kotlin dsl #66

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
key: jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }}

- run:
name: Android SDK
Expand All @@ -29,7 +29,7 @@ jobs:
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
key: jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }}

- run:
name: Checkstyle
Expand Down
159 changes: 0 additions & 159 deletions app/build.gradle

This file was deleted.

126 changes: 126 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import io.gitlab.arturbosch.detekt.extensions.DetektExtension

plugins {
id("com.android.application")
id("io.gitlab.arturbosch.detekt").version("1.0.0-RC12")
kotlin("android")
kotlin("android.extensions")
}

apply(from = "checkstyle/checkstyle.gradle")
apply(from = "./jacoco.gradle")

// STORE_PASSWORD = System.getenv("PROJECT_NAME_STORE_PASSWORD")
// KEY_ALIAS = System.getenv("PROJECT_NAME_KEY_ALIAS")
// KEY_PASSWORD = System.getenv("PROJECT_NAME_KEY_PASSWORD")

detekt {
toolVersion = "1.0.0-RC12"
input = files("src/main/java")
filters = ".*/resources/.*,.*/build/.*"
}

android {
compileSdkVersion(Versions.TARGET_SDK_VERSION)
buildToolsVersion(Versions.BUILD_TOOLS_VERSION)

defaultConfig {
minSdkVersion(Versions.MIN_SDK_VERSION)
targetSdkVersion(Versions.TARGET_SDK_VERSION)

applicationId = "com.flatstack.android"
versionCode = 1
versionName = "0.9.1"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}

flavorDimensions("environment")

signingConfigs {
getByName("debug") {
storeFile = file("$rootDir/debug.jks")
storePassword = "12345678"
keyAlias = "debug"
keyPassword = "12345678"
}
// release {
// storeFile file("$rootDir/project_name.jks")
// storePassword STORE_PASSWORD
// keyAlias KEY_ALIAS
// keyPassword KEY_PASSWORD
// }
}

productFlavors {
create("staging") {
buildConfigField("String", "API_URL", "\"https://example-staging.com\"")
applicationIdSuffix = ".staging"
setDimension("environment")
}

create("production") {
buildConfigField("String", "API_URL", "\"https://example.com\"")
setDimension("environment")
}
}

buildTypes {
getByName("debug") {
}
getByName("release") {
isMinifyEnabled = true
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
setTargetCompatibility(JavaVersion.VERSION_1_8)
}

dexOptions {
preDexLibraries = true
}

packagingOptions {
exclude("META-INF/LICENSE")
exclude("META-INF/NOTICE")
exclude("META-INF/services/javax.annotation.processing.Processor")
}

lintOptions {
textReport = true
textOutput("stdout")
setLintConfig(file("$projectDir/lint.xml"))
setWarningsAsErrors(true)
}

configurations.all {
resolutionStrategy.force(Libs.SUPPORT_ANNOTATIONS)
}
}

repositories {
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.10")
implementation(Libs.APPCOMPATV7)
implementation(Libs.RECYCLER_VIEW)
implementation(Libs.RX_JAVA)
implementation(Libs.RX_ANDROID)

implementation("com.google.code.gson:gson:2.4")
implementation("com.github.bumptech.glide:glide:3.7.0")

implementation("com.jakewharton:butterknife:9.0.0-rc2")
kapt("com.jakewharton:butterknife-compiler:9.0.0-rc2")

testImplementation(Libs.JUNIT)
testImplementation(Libs.ASSERTJ)
testImplementation(Libs.SUPPORT_ANNOTATIONS)
}


apply(from = "quality.gradle")
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ class MainFragment : BaseFragment() {
override val layoutRes: Int
get() = R.layout.fragment_main

@BindView(R.id.ivImage) internal lateinit var uiImage: ImageView

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@BindView(R.id.btnButton) internal lateinit var uiButton: Button

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val uiImage = view.findViewById<ImageView>(R.id.ivImage)
uiImage.setOnClickListener {
fragmentManager?.let {
TestDialog.show("Example Hello", "Ublyudok, mat' tvoyu, a nu idi syuda, govno" +
Expand All @@ -30,7 +28,7 @@ class MainFragment : BaseFragment() {
}
}

uiButton.setOnClickListener {
view.findViewById<View>(R.id.btnButton).setOnClickListener {
startActivity(Intent(activity, SecondActivity::class.java))
}

Expand Down
25 changes: 0 additions & 25 deletions build.gradle

This file was deleted.

21 changes: 21 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
buildscript {
apply(from = "./deps.gradle.kts")
repositories {
google()
maven(url = "https://plugins.gradle.org/m2/")
jcenter()
}

dependencies {
classpath("com.android.tools.build:gradle:3.4.0-alpha09")
classpath("com.google.guava:guava:17.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10")
}
}

allprojects {
repositories {
jcenter()
google()
}
}
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import org.gradle.kotlin.dsl.`kotlin-dsl`

plugins {
`kotlin-dsl`
}

repositories {
jcenter()
}
Empty file added buildSrc/settings.gradle.kts
Empty file.
Loading