Skip to content

Commit

Permalink
Merge pull request #131 from NeoA11y/kotlin-1922
Browse files Browse the repository at this point in the history
build: refactor, update Kotlin to v1.9.22
  • Loading branch information
PatrykMis authored Dec 28, 2023
2 parents 23c7272 + b79e21b commit f2c15b8
Show file tree
Hide file tree
Showing 13 changed files with 217 additions and 222 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: SpeakTouch-APKs
path: |
app/build/outputs/apk/debug/SpeakTouch-debug.apk
app/build/outputs/apk/release/SpeakTouch-release-unsigned.apk
path: app/build/outputs/apk/**/*.apk
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 7 additions & 17 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
@file:Suppress("UnstableApiUsage")

plugins {
id(libs.plugins.android.application.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
alias(libs.plugins.ksp)
alias(libs.plugins.android.application)
alias(libs.plugins.dagger)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ksp)
}

val keystorePropertiesFile = rootProject.file("keystore.properties")

java {
toolchain {
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
Expand Down Expand Up @@ -61,6 +61,8 @@ android {
defaultConfig {
applicationId = "com.neo.speaktouch"

configure<BasePluginExtension> { archivesName.set(rootProject.name) }

minSdk = 22
targetSdk = 34

Expand Down Expand Up @@ -92,18 +94,6 @@ android {
}
}

applicationVariants.all {
val variant = this
variant.outputs
.map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl }
.forEach { output ->
output.outputFileName = "${rootProject.name}-${buildType.name}.apk"
if (buildType.name == "release" && variant.signingConfig == null) {
output.outputFileName = "${rootProject.name}-${buildType.name}-unsigned.apk"
}
}
}

buildFeatures {
buildConfig = true
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

plugins {
id(libs.plugins.android.application.get().pluginId) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.dagger) apply false
id(libs.plugins.kotlin.android.get().pluginId) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ksp) apply false
}
8 changes: 2 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ plugins {
`kotlin-dsl`
}

java {
toolchain {
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
}

dependencies {
implementation(libs.kotlin.gradlePlugin)
implementation(libs.android.gradlePlugin)
implementation(libs.android.gradlePluginApi)

implementation(libs.squareup.javapoet)
}
4 changes: 2 additions & 2 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

dependencyResolutionManagement {
repositories {
mavenCentral()
google()
mavenCentral()
}
versionCatalogs {
create("libs") {
Expand All @@ -31,5 +31,5 @@ dependencyResolutionManagement {
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
}
8 changes: 4 additions & 4 deletions buildSrc/src/main/kotlin/Project.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.Project
import java.io.File
import java.io.FileInputStream
Expand Down Expand Up @@ -59,6 +59,6 @@ fun Project.appVersion(
}
}

fun Project.android(): BaseAppModuleExtension {
return extensions.getByName("android") as BaseAppModuleExtension
}
fun Project.android(): ApplicationExtension {
return extensions.getByName("android") as ApplicationExtension
}
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/VersionConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data class VersionConfig(

val majorValue = major * MAJOR_WEIGHT
val minorValue = minor * MINOR_WEIGHT
val patchValue = patch * PATH_WEIGHT
val patchValue = patch * PATCH_WEIGHT

return majorValue + minorValue + patchValue
}
Expand Down Expand Up @@ -72,6 +72,6 @@ data class VersionConfig(
companion object {
private const val MAJOR_WEIGHT = 100
private const val MINOR_WEIGHT = 10
private const val PATH_WEIGHT = 1
private const val PATCH_WEIGHT = 1
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
Expand Down
7 changes: 2 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ androidx-appcompat = "1.6.1"
androidx-constraintlayout = "2.1.4"
androidx-core = "1.12.0"
dagger = "2.50"
javapoet = "1.13.0"
kotlin = "1.9.21"
ksp = "1.9.21-1.0.16"
kotlin = "1.9.22"
ksp = "1.9.22-1.0.16"
material = "1.11.0"
robolectric = "4.11.1"
test-junit = "4.13.2"
Expand All @@ -24,8 +23,6 @@ timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "tim
# Plugins
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" }
android-gradlePluginApi = { group = "com.android.tools.build", name = "gradle-api", version.ref = "agp" }
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
squareup-javapoet = { group = "com.squareup", name = "javapoet", version.ref = "javapoet" }

# Unit test
junit = { group = "junit", name = "junit", version.ref = "test-junit" }
Expand Down
Loading

0 comments on commit f2c15b8

Please sign in to comment.