Skip to content

Commit

Permalink
chore(gradle): migrate build.gradle to KTS based gradle files
Browse files Browse the repository at this point in the history
SUITEDEV-35237

Co-authored-by: davidSchuppa <[email protected]>
Co-authored-by: LasOri <[email protected]>
Co-authored-by: matusekma <[email protected]>
  • Loading branch information
4 people committed Feb 20, 2024
1 parent b0c80fc commit 81988b5
Show file tree
Hide file tree
Showing 39 changed files with 426 additions and 482 deletions.
22 changes: 22 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
USE_LOCAL_DEPENDENCY=
GOOGLE_SERVICES_API_KEY=
RELEASE_MODE=
ANDROID_RELEASE_STORE_FILE_BASE64=
ANDROID_RELEASE_STORE_PASSWORD=
ANDROID_RELEASE_KEY_ALIAS=
ANDROID_RELEASE_KEY_PASSWORD=
FIREBASE_PROJECT_ID=
FIREBASE_SERVICE_ACCOUNT_JSON=
GOOGLE_OAUTH_SERVER_CLIENT_ID=
GOOGLE_SERVICES_JSON_BASE64=
OSSRH_USERNAME=
OSSRH_PASSWORD=
SONATYPE_STAGING_PROFILE_ID=
SONATYPE_SIGNING_KEY_ID=
SONATYPE_SIGNING_PASSWORD=
SONATYPE_SIGNING_SECRET_KEY_RING_FILE=
DETECT_LATEST_RELEASE_VERSION=
DETECT_PROJECT_USER_GROUPS=
DETECT_PROJECT_VERSION_DISTRIBUTION=
BLACKDUCK_ACCESS_TOKEN=
BLACKDUCK_URL=
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ local.properties
localConfig.properties
sample/google-services.json
sample/agconnect-services.json
.fleet
.fleet
.env
42 changes: 0 additions & 42 deletions build.gradle

This file was deleted.

62 changes: 62 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import org.ajoberstar.grgit.Grgit
import java.io.FileInputStream
import java.util.Properties

plugins {
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.kapt) apply false
alias(libs.plugins.navigationSafeArgs) apply false
alias(libs.plugins.googleServices) apply false
alias(libs.plugins.kotlinAllOpen) apply false
alias(libs.plugins.grGit)
id("com.github.ben-manes.versions") version "0.46.0"
}

versionData()
loadDevConfig()

fun loadDevConfig() {

ext["devConfig"] = Properties()

try {
val inputStream = FileInputStream("$projectDir/localConfig.properties")
(ext["devConfig"] as Properties).load(inputStream)

} catch (ignore: Exception) {
}

if (ext["devConfig"] != null) {
println("Using devConfig: ${ext["devConfig"]}")
}
}

fun versionData() {
val git = Grgit.open(
mapOf("currentDir" to project.rootDir)
)

if ((if (System.getenv("BLACKDUCK") == null) false else System.getenv("BLACKDUCK")) == false) {
git.fetch()
}
if (git.describe() == null) {
throw RuntimeException("Couldn't get Version Name")
}
val v = GitVersion(
versionName =
if (System.getenv("RELEASE_VERSION") == null) git.describe() else System.getenv(
"RELEASE_VERSION"
),
versionCode = ((System.currentTimeMillis() - 1602845230) / 10000).toInt(),
versionCodeTime = git.head().time
)
ext["gitVersionName"] = v.versionName
ext["gitVersionCode"] = v.versionCode
ext["gitVersionCodeTime"] = v.versionCodeTime

println("versionName: ${v.versionName}")
println("versionCode: ${v.versionCode}")

}
5 changes: 0 additions & 5 deletions buildSrc/src/main/java/Config.kt

This file was deleted.

73 changes: 0 additions & 73 deletions buildSrc/src/main/java/Dependency.kt

This file was deleted.

1 change: 1 addition & 0 deletions buildSrc/src/main/java/GitVersion.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data class GitVersion(val versionName: String, val versionCode: Int, val versionCodeTime: Long)
10 changes: 8 additions & 2 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlin)
alias(libs.plugins.kapt)
alias(libs.plugins.kotlinAllOpen)
}
dependencies {
implementation project(':core-api')
androidTestImplementation project(':testUtils')
implementation project(":core-api")
androidTestImplementation project(":testUtils")
}
android {
namespace "com.emarsys.common"
Expand Down
14 changes: 0 additions & 14 deletions core-api/build.gradle

This file was deleted.

20 changes: 20 additions & 0 deletions core-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlin)
alias(libs.plugins.kapt)
alias(libs.plugins.kotlinAllOpen)
}
dependencies {
api(libs.androidx.annotation)
api(libs.androidx.appcompat)
api(libs.kotlin.stdlib)
api(libs.androidx.espresso.idling.resource)
api(libs.androidx.lifecycle.common.java8)
api(libs.androidx.lifecycle.process)
api(libs.androidx.security.crypto)
androidTestImplementation(project(":testUtils"))
}
android {
namespace = "com.emarsys.core.api"
}
kotlin { jvmToolchain(17) }
11 changes: 0 additions & 11 deletions core/build.gradle

This file was deleted.

21 changes: 21 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlin)
alias(libs.plugins.kapt)
alias(libs.plugins.kotlinAllOpen)
}

dependencies {
implementation(project(":core-api"))
implementation(libs.google.tink)
implementation(libs.kotlinx.coroutines.core)

androidTestImplementation(project(":testUtils"))
}
android {
namespace = "com.emarsys.core"
}

kotlin {
jvmToolchain(17)
}
2 changes: 1 addition & 1 deletion core/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/jpollak/Library/Android/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
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlin)
alias(libs.plugins.kapt)
alias(libs.plugins.kotlinAllOpen)
}

dependencies {
implementation project(':emarsys-sdk')
implementation project(':core')
implementation project(':mobile-engage')
implementation project(':predict')
implementation(project(":emarsys-sdk"))
implementation(project(":core"))
implementation(project(":mobile-engage"))
implementation(project(":predict"))

androidTestImplementation project(':testUtils')
androidTestImplementation(project(":testUtils"))
}
android {
namespace "com.emarsys.test.e2e"
sourceCompatibility = 17
namespace = "com.emarsys.test.e2e"
}

kotlin {
jvmToolchain(17)
}

//task enableMockLocationForTestsOnDevice(type: Exec, dependsOn: 'installDebugAndroidTest') {
Expand Down
26 changes: 18 additions & 8 deletions emarsys-firebase/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.kotlin)
alias(libs.plugins.kapt)
alias(libs.plugins.kotlinAllOpen)
}

dependencies {
implementation project(':core-api')
implementation project(':core')
implementation project(':mobile-engage')
implementation project(':mobile-engage-api')
implementation(project(":core-api"))
implementation(project(":core"))
implementation(project(":mobile-engage"))
implementation(project(":mobile-engage-api"))

api Libs.firebase_messaging, { exclude group: 'androidx' }
api(libs.google.fcm, { exclude group: 'androidx' })

androidTestImplementation project(':testUtils')
androidTestImplementation(project(":testUtils"))
}
android {
namespace "com.emarsys.firebase"
sourceCompatibility = 17
namespace = "com.emarsys.firebase"
}

kotlin {
jvmToolchain(17)
}
Loading

0 comments on commit 81988b5

Please sign in to comment.