Skip to content

Fix/plugin file generation#215

Merged
twisti-dev merged 2 commits into
version/1.21.11from
fix/plugin-file-generation
Feb 8, 2026
Merged

Fix/plugin file generation#215
twisti-dev merged 2 commits into
version/1.21.11from
fix/plugin-file-generation

Conversation

@twisti-dev

Copy link
Copy Markdown
Contributor

This pull request updates the surf-api-gradle-plugin to improve plugin file generation and bump the plugin version. The main changes involve switching the plugin file generation task from outputting a single file to specifying an output directory and file name separately, which simplifies configuration and improves flexibility.

Version update:

  • Bumped the plugin version from 1.12.2 to 1.12.3 in build.gradle.kts for improved release tracking.

Plugin file generation improvements:

  • Refactored the GeneratePluginFile task to use an output directory (DirectoryProperty) and file name (Property<String>) instead of an output file (RegularFileProperty). This change streamlines how the generated plugin file is specified and written.
  • Updated the plugin file generation logic in CommonSurfPluginWithPluginFile.kt to set the output directory instead of the output file, aligning with the refactored task interface.

@twisti-dev twisti-dev self-assigned this Feb 8, 2026
Copilot AI review requested due to automatic review settings February 8, 2026 13:21
@twisti-dev twisti-dev merged commit 621b0f8 into version/1.21.11 Feb 8, 2026
4 of 5 checks passed
@twisti-dev twisti-dev deleted the fix/plugin-file-generation branch February 8, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the surf-api-gradle-plugin to refactor plugin file generation so the generator task is configured via an output directory + file name, and bumps the plugin version for release tracking.

Changes:

  • Refactored GeneratePluginFile to use @OutputDirectory outputDir plus @Input fileName instead of a single @OutputFile.
  • Updated common plugin setup to configure the generator task with the generated resources directory.
  • Bumped surf-api-gradle-plugin version from -1.12.2 to -1.12.3.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/common/CommonSurfPluginWithPluginFile.kt Updates task configuration to set outputDir instead of outputFile.
surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/generators/GeneratePluginFile.kt Changes task outputs to a directory + file name and adjusts write/delete logic accordingly.
surf-api-gradle-plugin/build.gradle.kts Increments plugin version suffix to 1.12.3.

Comment on lines +26 to +35
val outFile = outputDir.file(fileName).get().asFile
val json = pluginFileJson.get()

if (json.isNotBlank()) {
out.parentFile.mkdirs()
out.writeText(json)
} else {
if (out.exists()) out.delete()
if (json.isBlank()) {
if (outFile.exists()) outFile.delete()
return
}

outFile.parentFile.mkdirs()
outFile.writeText(json)

Copilot AI Feb 8, 2026

Copy link

Choose a reason for hiding this comment

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

GeneratePluginFile now declares an @OutputDirectory but only deletes the specific outFile when pluginFileJson is blank. If fileName changes across builds (or older outputs exist), stale files can remain in outputDir and be picked up as resources, and it also makes the @CacheableTask output less deterministic. Consider cleaning outputDir at the start of the task (similar to GenerateLibrariesLoaderTask), or switch back to an @OutputFile that is derived from outputDir + fileName so Gradle tracks a single output file.

Copilot uses AI. Check for mistakes.
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.

2 participants