Skip to content

Commit

Permalink
Build with kts
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Jan 10, 2025
1 parent 29bd975 commit 43b0b43
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 273 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "screenShotScript"]
path = screenShotScript
url = [email protected]:hannesa2/screenShotScript.git
[submodule "buildSrc"]
path = buildSrc
url = [email protected]:hannesa2/KotlinBuildSource.git
49 changes: 0 additions & 49 deletions basicSample/build.gradle

This file was deleted.

57 changes: 57 additions & 0 deletions basicSample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import info.git.versionHelper.getGitCommitCount
import info.git.versionHelper.getLatestGitHash
import info.git.versionHelper.getVersionText

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

android {
namespace = "info.mqtt.java.example"
defaultConfig {
applicationId = "info.mqtt.java.example"
minSdk = 21
compileSdk = 35
targetSdk = 35
versionCode = getGitCommitCount()
versionName = "${getVersionText()}.${versionCode}-${getLatestGitHash()}"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments.putAll(
mapOf(
"useTestStorageService" to "true",
),
)
}

buildFeatures {
viewBinding = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

dependencies {
implementation(project(":serviceLibrary"))
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("com.github.AppDevNext.Logcat:LogcatCoreLib:3.3.1")

implementation("androidx.core:core-ktx:1.15.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.0")

testImplementation("junit:junit:4.13.2")
androidTestImplementation("com.github.AppDevNext:Moka:1.7")
androidTestImplementation("androidx.test.ext:junit-ktx:1.2.1")
androidTestImplementation("androidx.test:core:1.6.1")
androidTestUtil("androidx.test.services:test-services:1.5.0")
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.6.1")
}
70 changes: 0 additions & 70 deletions build.gradle

This file was deleted.

40 changes: 40 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import org.gradle.internal.jvm.Jvm

buildscript {
repositories {
mavenCentral()
google()
maven { url = uri("https://plugins.gradle.org/m2/") }
}
dependencies {
classpath("com.android.tools.build:gradle:8.7.3")
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
classpath("org.jlleitschuh.gradle:ktlint-gradle:12.1.2")
}
}

plugins {
id("com.google.devtools.ksp") version "2.1.0-1.0.29" apply false
}

println("Gradle uses Java ${Jvm.current()}")

subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")

// Optionally configure plugin
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
debug.set(false)
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url = uri("https://repo.eclipse.org/content/repositories/paho-releases/") }
maven { url = uri("https://jitpack.io") }
}

}
1 change: 1 addition & 0 deletions buildSrc
Submodule buildSrc added at 78bfc5
64 changes: 0 additions & 64 deletions extendedSample/build.gradle

This file was deleted.

72 changes: 72 additions & 0 deletions extendedSample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import info.git.versionHelper.getGitCommitCount
import info.git.versionHelper.getLatestGitHash
import info.git.versionHelper.getVersionText

plugins {
id("com.android.application")
id("kotlin-android")
id("com.google.devtools.ksp")
}

android {
namespace = "info.mqtt.android.extsample"

defaultConfig {
applicationId = "info.mqtt.android.extsample"
minSdk = 21
compileSdk = 35
targetSdk = 35
versionCode = getGitCommitCount()
versionName = "${getVersionText()}.${versionCode}-${getLatestGitHash()}"

if (System.getenv("CI") == "true") { // Github action
resValue("string", "add_connection_server_default", "10.0.2.2")
} else
resValue("string", "add_connection_server_default", "broker.hivemq.com")

ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments.putAll(
mapOf(
"useTestStorageService" to "true",
),
)
}

buildFeatures {
viewBinding = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

dependencies {
implementation(project(":serviceLibrary"))

implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.core:core-ktx:1.15.0")
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.0")
implementation("com.github.AppDevNext.Logcat:LogcatCoreUI:3.3.1")
implementation("androidx.room:room-runtime:2.6.1")
implementation("androidx.test.uiautomator:uiautomator:2.3.0")
ksp("androidx.room:room-compiler:2.6.1")

testImplementation("junit:junit:4.13.2")
androidTestImplementation("com.github.AppDevNext:Moka:1.7")
androidTestImplementation("androidx.test.ext:junit-ktx:1.2.1")
androidTestUtil("androidx.test.services:test-services:1.5.0")
androidTestImplementation("org.hamcrest:hamcrest:2.2")
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.6.1")
}
Loading

0 comments on commit 43b0b43

Please sign in to comment.