Skip to content

Commit ff0d1f1

Browse files
committed
chore(build): update Gradle and Kotlin tooling
Update Gradle, Kotlin, Dokka, ktlint, cloud-build-logic, and GitHub Actions. Configure the Kotlin language and API versions independently from the compiler plugin and standard library versions. Update Sonatype Central publishing to use the new snapshot repository, Central Portal plugin APIs, and publication tasks.
1 parent 92576b7 commit ff0d1f1

24 files changed

Lines changed: 167 additions & 214 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ jobs:
1212
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
1313
runs-on: "ubuntu-latest"
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v7
1616
- name: Set up JDK
17-
uses: actions/setup-java@v4
17+
uses: actions/setup-java@v5
1818
with:
1919
distribution: 'temurin'
2020
java-version: 21
21-
- uses: gradle/actions/setup-gradle@v4
21+
- uses: gradle/actions/setup-gradle@v6
2222
with:
2323
# allow master and *-dev branches to write caches (default is only master/main)
2424
cache-read-only: ${{ github.ref != 'refs/heads/master' && !(endsWith(github.ref, '-dev') && startsWith(github.ref, 'refs/heads/')) }}
2525
- name: Build
2626
run: ./gradlew build
2727
- name: Upload Test Results
2828
if: always()
29-
uses: actions/upload-artifact@v4
29+
uses: actions/upload-artifact@v7
3030
with:
3131
name: Test Results
3232
path: |
@@ -40,13 +40,13 @@ jobs:
4040
fi
4141
- name: Publish Snapshot
4242
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}"
43-
run: ./gradlew publish
43+
run: ./gradlew publishAllPublicationsToSonatypeSnapshots
4444
env:
4545
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
4646
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
4747
- name: Publish Release
4848
if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}"
49-
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
49+
run: ./gradlew publishReleaseCentralPortalBundle
5050
env:
5151
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
5252
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
@@ -59,7 +59,7 @@ jobs:
5959
runs-on: ubuntu-latest
6060
steps:
6161
- name: Upload
62-
uses: actions/upload-artifact@v4
62+
uses: actions/upload-artifact@v7
6363
with:
6464
name: Event File
6565
path: ${{ github.event_path }}

‎.github/workflows/dependency_submission.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
dependency-submission:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
15-
- uses: actions/setup-java@v4
14+
- uses: actions/checkout@v7
15+
- uses: actions/setup-java@v5
1616
with:
1717
distribution: 'temurin'
1818
java-version: 21
19-
- uses: gradle/actions/dependency-submission@v3
19+
- uses: gradle/actions/dependency-submission@v6

‎.github/workflows/test_results.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
actions: read
2121
steps:
2222
- name: Download and Extract Artifacts
23-
uses: dawidd6/action-download-artifact@v3
23+
uses: dawidd6/action-download-artifact@v6
2424
with:
2525
run_id: ${{ github.event.workflow_run.id }}
2626
path: artifacts

‎cloud-kotlin/cloud-kotlin-coroutines-annotations/src/main/kotlin/org/incendo/cloud/kotlin/coroutines/annotations/KotlinAnnotatedMethods.kt‎

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ private class KotlinSuggestionProvider<C>(
143143
private val instance: Any
144144
) : SuggestionProvider<C> {
145145

146-
override fun suggestionsFuture(context: CommandContext<C>, input: CommandInput): CompletableFuture<Iterable<Suggestion>> {
147-
return coroutineScope.future(coroutineContext) {
146+
override fun suggestionsFuture(context: CommandContext<C>, input: CommandInput): CompletableFuture<Iterable<Suggestion>> =
147+
coroutineScope.future(coroutineContext) {
148148
try {
149149
if (kFunction.valueParameters.isEmpty()) {
150150
kFunction.callSuspend(instance)
@@ -163,7 +163,6 @@ private class KotlinSuggestionProvider<C>(
163163
else -> MethodSuggestionProvider.mapSuggestions(result)
164164
}
165165
}
166-
}
167166
}
168167

169168
private class KotlinMethodArgumentParserFactory<C>(
@@ -227,7 +226,8 @@ private class KotlinMethodArgumentParser<C, T>(
227226
private val suggestionProvider: SuggestionProvider<C>,
228227
javaMethod: Method,
229228
parameterInjectorRegistry: ParameterInjectorRegistry<C>
230-
) : FutureArgumentParser<C, T>, AnnotatedMethodHandler<C>(javaMethod, instance, parameterInjectorRegistry) {
229+
) : AnnotatedMethodHandler<C>(javaMethod, instance, parameterInjectorRegistry),
230+
FutureArgumentParser<C, T> {
231231

232232
private val paramsWithoutContinuation = parameters()
233233
.filterNot { Continuation::class.java == it.type }
@@ -236,33 +236,31 @@ private class KotlinMethodArgumentParser<C, T>(
236236
override fun parseFuture(
237237
commandContext: CommandContext<C>,
238238
commandInput: CommandInput
239-
): CompletableFuture<ArgumentParseResult<T>> =
240-
executeSuspendFunction(
241-
coroutineScope,
242-
coroutineContext,
243-
kFunction,
244-
instance,
245-
paramsWithoutContinuation,
246-
commandContext,
247-
listOf(commandInput)
248-
)
249-
.mapResult()
239+
): CompletableFuture<ArgumentParseResult<T>> = executeSuspendFunction(
240+
coroutineScope,
241+
coroutineContext,
242+
kFunction,
243+
instance,
244+
paramsWithoutContinuation,
245+
commandContext,
246+
listOf(commandInput)
247+
)
248+
.mapResult()
250249

251250
override fun suggestionProvider(): SuggestionProvider<C> = suggestionProvider
252251

253252
@Suppress("UNCHECKED_CAST")
254-
private fun <T> CompletableFuture<*>.mapResult(): CompletableFuture<ArgumentParseResult<T>> =
255-
handle { result, exception ->
256-
if (exception != null) {
257-
ArgumentParseResult.failure(exception)
258-
} else {
259-
when (result) {
260-
null -> ArgumentParseResult.failure(IllegalArgumentException("Result not found"))
261-
is ArgumentParseResult<*> -> result as ArgumentParseResult<T>
262-
else -> ArgumentParseResult.success((result as T)!!)
263-
}
253+
private fun <T> CompletableFuture<*>.mapResult(): CompletableFuture<ArgumentParseResult<T>> = handle { result, exception ->
254+
if (exception != null) {
255+
ArgumentParseResult.failure(exception)
256+
} else {
257+
when (result) {
258+
null -> ArgumentParseResult.failure(IllegalArgumentException("Result not found"))
259+
is ArgumentParseResult<*> -> result as ArgumentParseResult<T>
260+
else -> ArgumentParseResult.success((result as T)!!)
264261
}
265262
}
263+
}
266264
}
267265

268266
private fun <C> AnnotatedMethodHandler<C>.executeSuspendFunction(
@@ -324,5 +322,4 @@ private fun <C> AnnotatedMethodHandler<C>.executeSuspendFunction(
324322
}
325323
}
326324

327-
private fun KParameter.hasType(clazz: Class<*>): Boolean =
328-
GenericTypeReflector.erase(type.javaType) == clazz
325+
private fun KParameter.hasType(clazz: Class<*>): Boolean = GenericTypeReflector.erase(type.javaType) == clazz

‎cloud-kotlin/cloud-kotlin-coroutines-annotations/src/test/kotlin/org/incendo/cloud/kotlin/coroutines/annotations/KotlinAnnotatedMethodsTest.kt‎

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -219,23 +219,23 @@ class KotlinAnnotatedMethodsTest {
219219

220220
public class TestCommandSender
221221

222-
private class TestCommandManager : CommandManager<TestCommandSender>(
223-
ExecutionCoordinator.builder<TestCommandSender>()
224-
.executor(executorService)
225-
.build(),
226-
CommandRegistrationHandler.nullCommandRegistrationHandler()
227-
) {
222+
private class TestCommandManager :
223+
CommandManager<TestCommandSender>(
224+
ExecutionCoordinator.builder<TestCommandSender>()
225+
.executor(executorService)
226+
.build(),
227+
CommandRegistrationHandler.nullCommandRegistrationHandler()
228+
) {
228229

229230
override fun hasPermission(sender: TestCommandSender, permission: String): Boolean = true
230231
}
231232

232233
public class CommandMethods {
233234

234235
@Command("test")
235-
public suspend fun suspendingCommand(): Unit =
236-
withContext(Dispatchers.Default) {
237-
println("called from thread: ${Thread.currentThread().name}")
238-
}
236+
public suspend fun suspendingCommand(): Unit = withContext(Dispatchers.Default) {
237+
println("called from thread: ${Thread.currentThread().name}")
238+
}
239239

240240
@Command("test-exception")
241241
public suspend fun suspendingCommandWithException(): Unit = throw IllegalStateException()
@@ -268,10 +268,9 @@ class KotlinAnnotatedMethodsTest {
268268
class ParserMethods {
269269

270270
@Parser
271-
suspend fun suspendingParser(input: CommandInput): ParserResult =
272-
withContext(Dispatchers.Default) {
273-
ParserResult(input.lastRemainingToken().toInt())
274-
}
271+
suspend fun suspendingParser(input: CommandInput): ParserResult = withContext(Dispatchers.Default) {
272+
ParserResult(input.lastRemainingToken().toInt())
273+
}
275274

276275
@Parser
277276
suspend fun suspendingParser2(input: CommandInput): ArgumentParseResult<ParserResult2> =
@@ -280,9 +279,8 @@ class KotlinAnnotatedMethodsTest {
280279
}
281280

282281
@Parser
283-
suspend fun exceptionParser(input: CommandInput): ParserResult3 =
284-
withContext(Dispatchers.Default) {
285-
throw IllegalStateException()
286-
}
282+
suspend fun exceptionParser(input: CommandInput): ParserResult3 = withContext(Dispatchers.Default) {
283+
throw IllegalStateException()
284+
}
287285
}
288286
}

‎cloud-kotlin/cloud-kotlin-coroutines/src/main/kotlin/org/incendo/cloud/kotlin/coroutines/SuspendingArgumentParser.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ package org.incendo.cloud.kotlin.coroutines
2626
import kotlinx.coroutines.CoroutineScope
2727
import kotlinx.coroutines.GlobalScope
2828
import kotlinx.coroutines.future.future
29-
import org.incendo.cloud.CommandManager
3029
import org.incendo.cloud.context.CommandContext
3130
import org.incendo.cloud.context.CommandInput
31+
import org.incendo.cloud.execution.CommandExecutor
3232
import org.incendo.cloud.execution.ExecutionCoordinator
3333
import org.incendo.cloud.parser.ArgumentParseResult
3434
import org.incendo.cloud.parser.ArgumentParser
@@ -50,7 +50,7 @@ public fun interface SuspendingArgumentParser<C : Any, T : Any> {
5050
* Returns the result of parsing the given [commandInput].
5151
*
5252
* This method may be called when a command chain is being parsed for execution
53-
* (using [CommandManager.executeCommand])
53+
* (using [CommandExecutor.executeCommand])
5454
* or when a command is being parsed to provide context for suggestions
5555
* (using [SuggestionFactory.suggest]).
5656
* It is possible to use [CommandContext.isSuggestions] to see what the purpose of the

‎cloud-kotlin/cloud-kotlin-coroutines/src/main/kotlin/org/incendo/cloud/kotlin/coroutines/SuspendingSuggestionProvider.kt‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,11 @@ public fun interface SuspendingSuggestionProvider<C : Any> {
7777
scope: CoroutineScope = GlobalScope,
7878
context: CoroutineContext = EmptyCoroutineContext,
7979
provider: SuspendingSuggestionProvider<C>
80-
): SuggestionProvider<C> =
81-
SuggestionProvider { ctx, input ->
82-
scope.future(context) {
83-
provider(ctx, input).toList()
84-
}
80+
): SuggestionProvider<C> = SuggestionProvider { ctx, input ->
81+
scope.future(context) {
82+
provider(ctx, input).toList()
8583
}
84+
}
8685
}
8786
}
8887

‎cloud-kotlin/cloud-kotlin-coroutines/src/test/kotlin/org/incendo/cloud/kotlin/coroutines/SuspendingArgumentParserTest.kt‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@ class SuspendingArgumentParserTest {
7272

7373
private class TestCommandSender
7474

75-
private class TestCommandManager : CommandManager<TestCommandSender>(
76-
ExecutionCoordinator.builder<TestCommandSender>()
77-
.executor(executorService)
78-
.build(),
79-
CommandRegistrationHandler.nullCommandRegistrationHandler()
80-
) {
75+
private class TestCommandManager :
76+
CommandManager<TestCommandSender>(
77+
ExecutionCoordinator.builder<TestCommandSender>()
78+
.executor(executorService)
79+
.build(),
80+
CommandRegistrationHandler.nullCommandRegistrationHandler()
81+
) {
8182

8283
override fun hasPermission(sender: TestCommandSender, permission: String): Boolean = true
8384
}

‎cloud-kotlin/cloud-kotlin-coroutines/src/test/kotlin/org/incendo/cloud/kotlin/coroutines/SuspendingHandlerTest.kt‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ class SuspendingHandlerTest {
5959

6060
private class TestCommandSender
6161

62-
private class TestCommandManager : CommandManager<TestCommandSender>(
63-
ExecutionCoordinator.builder<TestCommandSender>()
64-
.executor(executorService)
65-
.build(),
66-
CommandRegistrationHandler.nullCommandRegistrationHandler()
67-
) {
62+
private class TestCommandManager :
63+
CommandManager<TestCommandSender>(
64+
ExecutionCoordinator.builder<TestCommandSender>()
65+
.executor(executorService)
66+
.build(),
67+
CommandRegistrationHandler.nullCommandRegistrationHandler()
68+
) {
6869

6970
override fun hasPermission(sender: TestCommandSender, permission: String): Boolean = true
7071
}

0 commit comments

Comments
 (0)