Skip to content

Commit

Permalink
Fixed Gradle plugin & updated Android tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SalomonBrys committed Jul 28, 2023
1 parent 600fc56 commit e0cde10
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 155 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,9 @@ jobs:
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android old layout (ubuntu)
- name: Check plugin with Android (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android-old
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android new layout (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android-new
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace check
shell: bash
- name: Upload (macos / windows)
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,9 @@ jobs:
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android old layout (ubuntu)
- name: Check plugin with Android (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android-old
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android new layout (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android-new
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace check
shell: bash
- name: Upload (macos / windows)
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,8 @@ jobs:
working-directory: tests-projects/tests-jvm-junit5
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android old layout (ubuntu)
- name: Check plugin with Android (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android-old
run: ../../gradlew --stacktrace check
shell: bash
- name: Check plugin with Android new layout (ubuntu)
if: matrix.os == 'ubuntu-latest'
working-directory: tests-projects/tests-android-new
working-directory: tests-projects/tests-android
run: ../../gradlew --stacktrace check
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,19 @@ class MocKMPGradlePlugin : Plugin<Project> {

configureKsp(project, ext)

// Adding KSP JVM as a dependency to all Kotlin compilations
project.tasks.withType<KotlinCompile<*>>().all {
if (name.startsWith("compile") && name.contains("TestKotlin")) {
when (jvmTarget.preset!!.name) {
"jvm" -> dependsOn("kspTestKotlin${jvmTarget.name.replaceFirstChar { it.titlecase() }}")
"android" -> dependsOn("kspDebugUnitTestKotlin${jvmTarget.name.replaceFirstChar { it.titlecase() }}")
// For some reason, the simple fact of calling `project.tasks.withType<KotlinCompile<*>>()`
// breaks KSP if not set in a deep level of afterEvaluate :(
afterEvaluate { afterEvaluate {
// Adding KSP JVM as a dependency to all Kotlin compilations
project.tasks.withType<KotlinCompile<*>>().all {
if (name.startsWith("compile") && name.contains("TestKotlin")) {
when (jvmTarget.preset!!.name) {
"jvm" -> dependsOn("kspTestKotlin${jvmTarget.name.replaceFirstChar { it.titlecase() }}")
"android" -> dependsOn("kspDebugUnitTestKotlin${jvmTarget.name.replaceFirstChar { it.titlecase() }}")
}
}
}
}
} }
}
}

Expand All @@ -121,7 +125,6 @@ class MocKMPGradlePlugin : Plugin<Project> {
SourceSetTarget.CommonMain -> executeOnMain(target, ext)
SourceSetTarget.CommonTest_Via_JVM -> executeOnTests(target, ext)
}

}
}

Expand Down
69 changes: 0 additions & 69 deletions tests-projects/tests-android-old/build.gradle.kts

This file was deleted.

5 changes: 0 additions & 5 deletions tests-projects/tests-android-old/gradle.properties

This file was deleted.

44 changes: 0 additions & 44 deletions tests-projects/tests-android-old/settings.gradle.kts

This file was deleted.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
}

kotlin {
android()
androidTarget()
ios()

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8

android.useAndroidX=true
android.nonTransitiveRClass=true
kotlin.mpp.androidSourceSetLayoutVersion=2

0 comments on commit e0cde10

Please sign in to comment.