Skip to content

Commit

Permalink
Clean up thrifty-runtime project to fix gradle warnings (#12)
Browse files Browse the repository at this point in the history
* Clean up thrifty-runtime project to fix gradle warnings

* Remove Java plugin from MPP
  • Loading branch information
benjamin-bader authored Nov 25, 2024
1 parent bb975cb commit 691cf53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import org.gradle.api.Project

class ThriftyMppPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.plugins.apply<ThriftyJavaPlugin>()
project.plugins.apply(Plugins.KOTLIN_MPP)
project.plugins.apply(Plugins.JACOCO)
if (project.shouldSignAndDocumentBuild) {
project.plugins.apply(Plugins.DOKKA)
}
Expand Down
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ plugins {
}

tasks.register("codeCoverageReport", JacocoReport) { t ->
subprojects.each {
t.dependsOn it.tasks.withType(Test)
t.dependsOn it.tasks.findAll { it.name == "allTests" } // MPP why are you like this
t.sourceSets it.sourceSets.main
subprojects.each { sp ->
t.dependsOn sp.tasks.withType(Test)
t.dependsOn sp.tasks.findAll { it.name == "allTests" } // MPP why are you like this

def commonMain = it.file("src/commonMain/kotlin")
def jvmMain = it.file("src/jvmMain/kotlin")
def commonMain = sp.file("src/commonMain/kotlin")
def jvmMain = sp.file("src/jvmMain/kotlin")
def isMpp = commonMain.exists() || jvmMain.exists()

if (isMpp) {
[commonMain, jvmMain].findAll(File::exists).each { d -> t.sourceDirectories.from(d) }
t.classDirectories.from(it.fileTree("build/classes/kotlin/jvm/main"))
t.classDirectories.from(sp.fileTree("build/classes/kotlin/jvm/main"))
} else {
t.sourceSets sp.sourceSets.main
}
}

Expand All @@ -49,7 +50,7 @@ tasks.register("codeCoverageReport", JacocoReport) { t ->
csv.required = false
}

def filters = [ "**/AutoValue_*", "**/antlr/*", "com/bendb/thrifty/test/gen/*"]
def filters = ["**/antlr/*", "com/bendb/thrifty/test/gen/*"]
t.classDirectories.setFrom(files(t.classDirectories.files.collect {
fileTree(dir: it, exclude: filters)
}))
Expand Down
30 changes: 0 additions & 30 deletions thrifty-runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,50 +88,20 @@ kotlin {
}
}

jvmMain {
}

jvmTest {
dependencies {
implementation libs.kotlin.test.junit5
implementation libs.kotest.assertions.coreJvm
implementation libs.junit
}
}

iosMain {
dependsOn commonMain
}

iosArm64Main {
dependsOn iosMain
}

iosX64Main {
dependsOn iosMain
}
}
}

jvmTest {
useJUnitPlatform()
}

//tasks.register("iosTest") {
// def device = project.findProperty("iosDevice")?.toString() ?: "iPhone 14 Pro Max"
// dependsOn 'linkDebugTestIosX64'
// group = JavaBasePlugin.VERIFICATION_GROUP
// description = "Runs tests for target 'ios' on an iOS simulator"
//
// doLast {
// def binary = kotlin.targets.iosX64.binaries.getTest('DEBUG').outputFile
// println("muh binary: ${binary.absolutePath}")
// exec {
// commandLine 'xcrun', 'simctl', 'spawn', device, binary.absolutePath
// }
// }
//}

// What have I gotten myself in to
configurations {
jvmApiElements {
Expand Down

0 comments on commit 691cf53

Please sign in to comment.