Skip to content

Conversation

@alexander-yevsyukov
Copy link
Contributor

This PR simplifies applying common KSP plugin settings. KSP plugins working in the Spine environment need to apply common settings once. Previously, the status of applying the settings was checked using the Build services feature. It proved to be fragile in the environments where plugins are applied in subprojects block where these blocks are not related to each other and do not have common ClassLoader.

This PR aims to solve this issue, pulling out the common settings into a plugin, which KspBasedPlugin applies via the class name. This makes Gradle to apply the plugin once, which was the intention of the previous arrangement with build services.

Copilot AI review requested due to automatic review settings November 28, 2025 22:37
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review November 28, 2025 22:37
@alexander-yevsyukov alexander-yevsyukov self-assigned this Nov 28, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors KSP plugin configuration by extracting common settings into a dedicated CommonKspSettingsPlugin. Previously, common KSP settings were applied using a synchronized mechanism with build services that proved fragile in multi-project builds with separate ClassLoaders. The new approach leverages Gradle's built-in plugin application semantics to ensure settings are applied exactly once per project.

Key changes:

  • Introduced CommonKspSettingsPlugin to encapsulate all common KSP configuration logic
  • Simplified KspBasedPlugin to delegate settings application to the new plugin
  • Updated project version from 2.0.0-SNAPSHOT.029 to 2.0.0-SNAPSHOT.030

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
version.gradle.kts Bumped version to 2.0.0-SNAPSHOT.030
pom.xml Updated version and protoc dependency to 4.33.1
ksp/src/main/kotlin/io/spine/tools/core/jvm/ksp/gradle/KspBasedPlugin.kt Removed synchronization logic and delegated common settings to new plugin
ksp/src/main/kotlin/io/spine/tools/core/jvm/ksp/gradle/CommonKspSettingsPlugin.kt New plugin containing extracted common KSP settings logic
dependencies.md Updated to reflect new version and protoc dependency changes
config Updated subproject commit reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

/**
* The function replaces default destination directory defied by
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'defied' to 'defined'.

Suggested change
* The function replaces default destination directory defied by
* The function replaces default destination directory defined by

Copilot uses AI. Check for mistakes.
sourceSet.run {
// KSP Gradle Plugin already added its output to source sets.
// We need to add the replacement manually because we filtered
// it before in `Project.makeKspIgnoreGeneratedSourceProtoDir()`.
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The referenced function name Project.makeKspIgnoreGeneratedSourceProtoDir() doesn't match the actual function name makeKspIgnoreProtocOutputDir() in the codebase. Update the comment to reference the correct function name.

Suggested change
// it before in `Project.makeKspIgnoreGeneratedSourceProtoDir()`.
// it before in `Project.makeKspIgnoreProtocOutputDir()`.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@armiol armiol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-yevsyukov LGTM in general. Please see my comments.

import org.gradle.api.file.DirectoryProperty
import org.gradle.kotlin.dsl.findByType

public class CommonKspSettingsPlugin : Plugin<Project> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document this type.

val path = protobufExtension?.generatedFilesBaseDir
return path?.let { File(it) }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is redundant.

makeKspTasksDependOnSpineCompiler()
makeCompileKotlinTasksDependOnKspTasks()
replaceKspOutputDirs()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is also redundant.

)
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one is also redundant.

Copilot AI review requested due to automatic review settings November 29, 2025 22:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alexander-yevsyukov alexander-yevsyukov merged commit 57359a7 into master Nov 30, 2025
7 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the common-ksp-settings-plugin branch November 30, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants