Skip to content

Commit

Permalink
Updated to kotest 6.0.0.M1 causing issue with build script for the Bo…
Browse files Browse the repository at this point in the history
…t API for .Net. This script was refactored and improved. The deprecated `exec {}` was replaced.
  • Loading branch information
flemming-n-larsen committed Dec 2, 2024
1 parent 3537a32 commit ac886f3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
71 changes: 34 additions & 37 deletions bot-api/dotnet/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,41 +34,38 @@ tasks {
into("docs")
}

assemble {
dependsOn(":schema:dotnet:build", prepareNugetDocs)
val buildDotnetBotApi by registering(Exec::class) {
dependsOn(prepareNugetDocs)

doLast {
exec {
workingDir("Robocode.TankRoyale.BotApi")
commandLine("dotnet", "build", "--configuration", "Release", "-p:Version=$version")
}
}
workingDir("Robocode.TankRoyale.BotApi")
commandLine("dotnet", "build", "--configuration", "Release", "-p:Version=$version")
}

register("test") {
doLast {
exec {
workingDir("Robocode.TankRoyale.BotApi.Tests")
commandLine("dotnet", "test")
}
}
val test by registering(Exec::class) {
workingDir("Robocode.TankRoyale.BotApi.Tests")
commandLine("dotnet", "test")
}

build {
dependsOn(":schema:dotnet:build", buildDotnetBotApi)
}

val docfxMetadata by registering(Exec::class) {
workingDir("docfx_project")
commandLine("docfx", "metadata")
}

val docfxBuild by registering(Exec::class) {
workingDir("docfx_project")
delete("_site", "api", "obj")
commandLine("docfx", "build")
}

val docfx by registering {
doLast {
exec {
workingDir("docfx_project")
commandLine("docfx", "metadata") // build /api before building the _site
}
exec {
workingDir("docfx_project")
delete("_site", "api", "obj")
commandLine("docfx", "build") // build /_site
}
}
dependsOn(docfxMetadata, docfxBuild)
}

register<Copy>("uploadDocs") {
val uploadDocs by registering(Copy::class) {
dependsOn(clean, docfx)

val dotnetApiDir = "../../docs/api/dotnet"
Expand All @@ -82,17 +79,17 @@ tasks {
into(dotnetApiDir)
}

register("pushLocal") {
dependsOn(build, prepareNugetDocs)
val pushLocal by registering(Exec::class) {
dependsOn(prepareNugetDocs)

doLast {
val userhome = System.getenv("USERPROFILE") ?: System.getenv("HOME")
println("$userhome/.nuget/packages/${artifactName.lowercase()}/$version")
delete("$userhome/.nuget/packages/${artifactName.lowercase()}/$version")
exec {
workingDir("Robocode.TankRoyale.BotApi/bin/Release")
commandLine("dotnet", "nuget", "push", "$artifactName.$version.nupkg", "--source", "$userhome/.nuget/packages")
}
val userHome = System.getenv("USERPROFILE") ?: System.getenv("HOME")

doFirst {
println("$userHome/.nuget/packages/${artifactName.lowercase()}/$version")
delete("$userHome/.nuget/packages/${artifactName.lowercase()}/$version")
}

workingDir("Robocode.TankRoyale.BotApi/bin/Release")
commandLine("dotnet", "nuget", "push", "$artifactName.$version.nupkg", "--source", "$userHome/.nuget/packages")
}
}
5 changes: 3 additions & 2 deletions gradle/test-libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
assertj = "3.26.3"
junit = "5.11.3"
system-stubs = "2.1.7"
kotest = "5.9.1"
kotest = "6.0.0.M1"
kotest-datatest = "5.9.1"
mockk = "1.13.13"

[libraries]
Expand All @@ -17,7 +18,7 @@ system-stubs = { module = "uk.org.webcompere:system-stubs-jupiter", version.ref

# Kotlin testing
kotest-junit5 = { module = "io.kotest:kotest-runner-junit5-jvm", version.ref = "kotest" }
kotest-datatest = { module = "io.kotest:kotest-framework-datatest", version.ref = "kotest" }
kotest-datatest = { module = "io.kotest:kotest-framework-datatest", version.ref = "kotest-datatest" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }

[bundles]
Expand Down

0 comments on commit ac886f3

Please sign in to comment.