Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dogacel committed Aug 10, 2024
1 parent cc61b61 commit d413261
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ java {
}
}

tasks.withType(Test::class.java) {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

application {
// Define the main class for the application.
mainClass.set("dogacel.kotlinx.protobuf.gen.AppKt")
Expand Down
9 changes: 4 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ nexusPublishing {
}
}

tasks.withType(Test::class.java) {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

// Common settings for subprojects
subprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint") // Version should be inherited from parent

tasks.withType(Test::class.java) {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

tasks.withType(KotlinCompilationTask::class.java).configureEach {
compilerOptions.freeCompilerArgs.add("-opt-in=kotlinx.serialization.ExperimentalSerializationApi")
}
Expand Down
5 changes: 5 additions & 0 deletions examples/sample-grpc-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ dependencies {
runtimeOnly(libs.bundles.logging)
}

tasks.withType(Test::class.java) {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

tasks.named("generateProto") {
dependsOn(project(":app").tasks.jar)
}
Expand Down
5 changes: 5 additions & 0 deletions examples/sample-protoc-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ dependencies {
implementation(libs.bundles.kotlinx)
}

tasks.withType(Test::class.java) {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

tasks.named("generateProto") {
dependsOn(project(":app").tasks.jar)
}
Expand Down
10 changes: 7 additions & 3 deletions generated-code-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,25 @@ dependencies {
testImplementation(libs.bundles.junit)
}

tasks.withType(Test::class.java) {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

tasks.named("generateProto") {
dependsOn(project(":app").tasks.jar)
dependsOn("cleanSources")
}

tasks.register("copySources", type = Sync::class) {
dependsOn("generateProto")
from("$buildDir/generated/source/proto/main/kotlinx-protobuf-gen")
from(layout.buildDirectory.dir("generated/source/proto/main/kotlinx-protobuf-gen"))
into("src/main/kotlin")
}

tasks.register("cleanGeneratedFiles", type = Delete::class) {
dependsOn("copySources")
delete("$buildDir/generated/source/proto/main/kotlinx-protobuf-gen")
delete(layout.buildDirectory.dir("generated/source/proto/main/kotlinx-protobuf-gen"))
}

tasks.register("cleanSources") {
Expand Down Expand Up @@ -90,7 +95,6 @@ protobuf {
}

// Lint

tasks.named("runKtlintCheckOverMainSourceSet") {
dependsOn("cleanGeneratedFiles")
}
Expand Down
5 changes: 5 additions & 0 deletions runtime-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ java {
}
}

tasks.withType(Test::class.java) {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

tasks.jar {
from(sourceSets.main.get().output)

Expand Down

0 comments on commit d413261

Please sign in to comment.