Skip to content

Commit

Permalink
Rewrite gradle scripts to kotlin DSL + remove a bit of code that was …
Browse files Browse the repository at this point in the history
…not used
  • Loading branch information
Sergey-Makarov committed Jul 24, 2023
1 parent 611a6e2 commit 9dbc1c9
Show file tree
Hide file tree
Showing 11 changed files with 221 additions and 210 deletions.
108 changes: 0 additions & 108 deletions app/build.gradle

This file was deleted.

102 changes: 102 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl

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

android {
compileSdk = 33

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.

defaultConfig {
applicationId = "com.fingerprintjs.android.playground"
minSdk = 21

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
targetSdk = 33

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
versionCode = Integer.parseInt(project.property("VERSION_CODE") as String)
versionName = project.property("VERSION_NAME") as String

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
create("release") {
storeFile = file("release.jks")
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("RELEASE_SIGN_KEY_ALIAS")
keyPassword = System.getenv("RELEASE_SIGN_KEY_PASSWORD")
}

create("releaseDummySign") {
storeFile = file("release_dummy.jks")
storePassword = "password"
keyAlias = "key0"
keyPassword = "password"
}
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.getByName("release")
}
// build release app locally using a dummy signature
create("releaseDummySign") {
isMinifyEnabled = true
proguardFiles (getDefaultProguardFile ("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.getByName("releaseDummySign")
setMatchingFallbacks("release")
}
// same as previous, but also profileable
// when changing the name of the following build type, don't forget to update src/{this_build_type} dir
create("releaseDummySignProfileable") {
initWith(buildTypes.getByName("releaseDummySign"))
}
}

namespace = "com.fingerprintjs.android.playground"

applicationVariants.all {
val variant = this
this.outputs.all {
(this as? BaseVariantOutputImpl)?.outputFileName = "Playground-${variant.name}-${variant.versionName}.apk"
}
}

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = "1.4.7"
}
}

dependencies {
implementation(project(":fingerprint"))
implementation("org.jetbrains.kotlin:kotlin-stdlib:${Constants.kotlinVersion}")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.core:core-ktx:1.10.0")
implementation("androidx.appcompat:appcompat:1.6.1")

val composeBom = platform("androidx.compose:compose-bom:2022.11.00")
implementation(composeBom)
androidTestImplementation(composeBom)
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
implementation("androidx.compose.material:material-icons-extended")
implementation("androidx.activity:activity-compose:1.7.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
implementation("androidx.navigation:navigation-compose:2.5.3")
implementation("androidx.core:core-splashscreen:1.0.1")

implementation("com.google.accompanist:accompanist-pager:0.27.0")

implementation("com.google.dagger:dagger:2.44")
kapt("com.google.dagger:dagger-compiler:2.44")

implementation("com.google.code.gson:gson:2.10")
}
23 changes: 0 additions & 23 deletions build.gradle

This file was deleted.

16 changes: 16 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:7.4.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Constants.kotlinVersion}")
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
}
}

task<Delete>("clean") {
delete(rootProject.buildDir)
}
2 changes: 2 additions & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gradle
/build
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Constants {
const val kotlinVersion = "1.8.21"
}
76 changes: 0 additions & 76 deletions fingerprint/build.gradle

This file was deleted.

Loading

0 comments on commit 9dbc1c9

Please sign in to comment.