Skip to content

Commit

Permalink
Added ktlint, detekt, gitVersioner plugin
Browse files Browse the repository at this point in the history
Dependency updates
  • Loading branch information
r0adkll committed Oct 31, 2019
1 parent cd780ff commit 14e2600
Show file tree
Hide file tree
Showing 5 changed files with 615 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{kt,kts}]
max_line_length = 120
63 changes: 37 additions & 26 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,30 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.oss.licenses.plugin'
apply plugin: 'io.fabric'

def GIT_SHA = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()

def VERSION_NAME = "1.10.0"

ext.gitVersioner = [
defaultBranch : "master",
stableBranches : ["release"],
yearFactor : 1200,
snapshotEnabled : false,
localChangesCountEnabled: false,
shortName: { gitVersion ->
return gitVersion.commit.subSequence(0, 7)
}
]
apply from: 'https://raw.githubusercontent.com/passsy/gradle-GitVersioner/master/git-versioner.gradle'

gitVersioner {
baseBranch 'master'
yearFactor 1200
addSnapshot false
addLocalChangesDetails false
}

android {
compileSdkVersion 29

defaultConfig {
applicationId "com.r0adkll.deckbuilder"
buildToolsVersion "28.0.3"
buildToolsVersion "29.0.2"

minSdkVersion 22
targetSdkVersion 29

versionCode gitVersion.version
versionName "$VERSION_NAME.${gitVersion.version}"
versionCode gitVersioner.versionCode
versionName "$VERSION_NAME.${gitVersioner.versionName}"
multiDexEnabled true

buildConfigField "String", "GIT_SHA", "\"$GIT_SHA\""
buildConfigField "String", "GIT_SHA", "\"${gitVersioner.currentSha1Short}\""
buildConfigField "String", "DATABASE_NAME", "\"deckbox.db\""
buildConfigField "String", "AFFILIATE_CODE", "\"DeckBox\""
buildConfigField "String", "PREVIEW_API_URL", "\"https://deckboxtcg.app/api/v1/\""
Expand All @@ -49,11 +41,6 @@ android {
"$projectDir/schemas".toString()]
}
}

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

buildTypes {
Expand All @@ -63,11 +50,35 @@ android {
}
}

lintOptions {
xmlReport true
}

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}

kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = ["-Xallow-result-return-type"]
}

// Always show the result of every unit test, even if it passes.
testOptions.unitTests {
includeAndroidResources = true

all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}

applicationVariants.all { variant ->
variant.outputs.all { output ->
if (variant.buildType.name == "release") {
outputFileName = "deckbox-" + variant.versionName + "." + GIT_SHA.toUpperCase() + ".apk"
outputFileName = "deckbox-" + variant.versionName + "." + gitVersioner.currentSha1Short + ".apk"
}
}
}
Expand Down Expand Up @@ -129,8 +140,8 @@ dependencies {
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.browser:browser:1.2.0-alpha09"

implementation "com.google.firebase:firebase-core:17.2.0"
implementation "com.google.firebase:firebase-firestore:21.2.0"
implementation "com.google.firebase:firebase-core:17.2.1"
implementation "com.google.firebase:firebase-firestore:21.2.1"
implementation "com.google.firebase:firebase-auth:19.1.0"
implementation "com.google.firebase:firebase-config:19.0.3"
implementation "com.google.android.gms:play-services-auth:17.0.0"
Expand Down
25 changes: 20 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,41 @@ buildscript {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
classpath 'io.pokemontcg:pokemon-tcg-sdk-kotlin:1.0.19'
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath 'com.google.gms:oss-licenses:0.9.2'
classpath 'com.github.triplet.gradle:play-publisher:1.2.2'
classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta07'
classpath 'com.github.holgerbrandl:kscript-annotations:1.2'
classpath 'com.pascalwelsch.gitversioner:gitversioner:0.4.1'
classpath 'io.pokemontcg:pokemon-tcg-sdk-kotlin:1.0.19'
}
}

plugins {
id "io.gitlab.arturbosch.detekt" version "1.0.0-RC16"
id "org.jlleitschuh.gradle.ktlint" version "8.2.0"
}

ext.ReporterType = org.jlleitschuh.gradle.ktlint.reporter.ReporterType

allprojects {
apply from: "$rootDir/detekt.gradle"
apply plugin: "org.jlleitschuh.gradle.ktlint"

repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url 'https://maven.fabric.io/public' }
}

ktlint {
android = true
reporters = [ReporterType.PLAIN, ReporterType.CHECKSTYLE]
}
}

apply plugin: 'com.pascalwelsch.gitversioner'

task clean(type: Delete) {
delete rootProject.buildDir
}
Loading

0 comments on commit 14e2600

Please sign in to comment.