JetBrains / sbt-idea-example

SBT based IntellJ plugin template project
Apache License 2.0
33 stars 17 forks source link

Patch the plugin.xml with readme description #14

Open zhutmost opened 6 months ago

zhutmost commented 6 months ago

As discussed in this issue, I added some code to enable automatic pluginXml patching.

Because JetBrains's org.jetbrains.changelog repository (link) is a Gradle plugin (which provides similar functions in the Gradle template), I use Laika to convert Markdown to HTML.

The main code is in project/Utils.sc. To keep compatibility, maybe you can comment out the last three lines in build.sbt (to disable the patchPluginXml task?) (but I never tried this.)

zhutmost commented 6 months ago

The second commit is about to create GitHub action workflows to run build and release automatically. If you think it is unnecessary, feel free to revert it.

unkarjedy commented 6 months ago

Because JetBrains's org.jetbrains.changelog repository (link) is a Gradle plugin (which provides similar functions in the Gradle template), I use Laika to convert Markdown to HTML.

In principle, we could still use it. plugins.sbt

...
libraryDependencies += "org.jetbrains.changelog" % "org.jetbrains.changelog.gradle.plugin" % "2.2.0"
resolvers += MavenRepo("Gradle Plugins", "https://plugins.gradle.org/m2/")

Utils.scala

val readmeDescriptionMd = readmeContent.substring(startIndex + startMarker.length, endIndex).trim
org.jetbrains.changelog.ExtensionsKt.markdownToHTML(readmeDescriptionMd, "\\n")

That would allow us to reuse changelog construction logic in future (though not in this PR)

zhutmost commented 6 months ago

I made these changes:

  1. According to your recommendation, I changed the dependency from Laika to changelog.
  2. Move the readmeDescriptionExtract function to build.sbt to simplify directory structure.
  3. Bump sbt to 1.10.0 and scala to 2.13.13