From 03d6ffc822d96190e042e8187ce7e9ce856fb793 Mon Sep 17 00:00:00 2001 From: Oliver-Loeffler Date: Mon, 3 Feb 2025 19:45:09 +0100 Subject: [PATCH 1/4] build: Updated PlantUML dependency to 2025.0. Also added Java-17 requirement. Removed download code from build.sbt and added PlantUML as regular dependency. --- build.sbt | 19 ++++++------------- src/main/scala/Plugin.scala | 3 ++- .../plugins/plantuml/PlantUMLController.scala | 4 ++-- src/test/scala/plugin/PlantUMLUtilsSpec.scala | 3 ++- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/build.sbt b/build.sbt index 214d14a..4906bfe 100644 --- a/build.sbt +++ b/build.sbt @@ -2,25 +2,18 @@ name := "gitbucket-plantuml-plugin" organization := "com.yotaichino" -version := "1.7.0" +version := "1.8.0" scalaVersion := "2.13.7" -gitbucketVersion := "4.37.0" +gitbucketVersion := "4.42.1" libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "3.0.8" % "test" ) -scalacOptions := Seq("-deprecation", "-feature", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-1.8") -javacOptions in compile ++= Seq("-target", "8", "-source", "8") +libraryDependencies += "net.sourceforge.plantuml" % "plantuml-asl" % "1.2025.0" -useJCenter := true +scalacOptions := Seq("-deprecation", "-feature", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-17") +javacOptions in compile ++= Seq("-target", "17", "-source", "17") -lazy val downloadPlantuml = taskKey[Unit]("Download the PlantUML ASL Version.") -downloadPlantuml := { - val url = "https://downloads.sourceforge.net/project/plantuml/1.2022.5/plantuml-jar-asl-1.2022.5.zip" - if (java.nio.file.Files.notExists(new File("lib/plantuml.jar").toPath())) { - println(url) - IO.unzipURL(new URL(url), new File("lib")) - } -} +useJCenter := true diff --git a/src/main/scala/Plugin.scala b/src/main/scala/Plugin.scala index 2c5bb3a..e5ce0b5 100644 --- a/src/main/scala/Plugin.scala +++ b/src/main/scala/Plugin.scala @@ -22,7 +22,8 @@ class Plugin extends gitbucket.core.plugin.Plugin { new Version("1.6.0"), new Version("1.6.1"), new Version("1.6.2"), - new Version("1.7.0") + new Version("1.7.0"), + new Version("1.8.0") ) override def initialize(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Unit = { diff --git a/src/main/scala/com/yotaichino/gitbucket/plugins/plantuml/PlantUMLController.scala b/src/main/scala/com/yotaichino/gitbucket/plugins/plantuml/PlantUMLController.scala index 6c13e24..e5f433f 100644 --- a/src/main/scala/com/yotaichino/gitbucket/plugins/plantuml/PlantUMLController.scala +++ b/src/main/scala/com/yotaichino/gitbucket/plugins/plantuml/PlantUMLController.scala @@ -28,9 +28,9 @@ trait PlantUMLControllerBase extends ControllerBase { contentType = "image/svg+xml" PlantUMLUtils.generateSVGImage(new String(content)) } - case _ => unsupportedMediaType + case _ => unsupportedMediaType() } - } getOrElse NotFound + } getOrElse NotFound() } }) diff --git a/src/test/scala/plugin/PlantUMLUtilsSpec.scala b/src/test/scala/plugin/PlantUMLUtilsSpec.scala index 39172bc..64e990e 100644 --- a/src/test/scala/plugin/PlantUMLUtilsSpec.scala +++ b/src/test/scala/plugin/PlantUMLUtilsSpec.scala @@ -5,7 +5,8 @@ class PlantUMLUtilsSpec extends FunSpec { describe("generateSVGImage") { it("should return a SVG image.") { val content = new String(PlantUMLUtils.generateSVGImage("@startuml\n@enduml"), "utf-8") - assert(content.startsWith(""" Date: Tue, 4 Feb 2025 08:14:46 +0100 Subject: [PATCH 2/4] Updated build.sbt to eliminate slash-syntax warning. Also reverted target platform to Java 1.8. --- build.sbt | 6 +++--- src/main/scala/Plugin.scala | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 4906bfe..80e826e 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ name := "gitbucket-plantuml-plugin" organization := "com.yotaichino" -version := "1.8.0" +version := "1.8.1" scalaVersion := "2.13.7" gitbucketVersion := "4.42.1" @@ -13,7 +13,7 @@ libraryDependencies ++= Seq( libraryDependencies += "net.sourceforge.plantuml" % "plantuml-asl" % "1.2025.0" -scalacOptions := Seq("-deprecation", "-feature", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-17") -javacOptions in compile ++= Seq("-target", "17", "-source", "17") +scalacOptions := Seq("-deprecation", "-feature", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-1.8") +Compile / javacOptions ++= Seq("-target", "8", "-source", "17") useJCenter := true diff --git a/src/main/scala/Plugin.scala b/src/main/scala/Plugin.scala index e5ce0b5..cecaf79 100644 --- a/src/main/scala/Plugin.scala +++ b/src/main/scala/Plugin.scala @@ -23,7 +23,8 @@ class Plugin extends gitbucket.core.plugin.Plugin { new Version("1.6.1"), new Version("1.6.2"), new Version("1.7.0"), - new Version("1.8.0") + new Version("1.8.0"), + new Version("1.8.1") ) override def initialize(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Unit = { From 47df02e64134d4d341b137d007d0f614c91809d0 Mon Sep 17 00:00:00 2001 From: Oliver-Loeffler Date: Tue, 4 Feb 2025 08:14:46 +0100 Subject: [PATCH 3/4] Updated build.sbt to eliminate slash-syntax warning. Also reverted target platform to Java 1.8. --- build.sbt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 4906bfe..65f84a6 100644 --- a/build.sbt +++ b/build.sbt @@ -2,10 +2,10 @@ name := "gitbucket-plantuml-plugin" organization := "com.yotaichino" -version := "1.8.0" +version := "1.8.1" scalaVersion := "2.13.7" -gitbucketVersion := "4.42.1" +gitbucketVersion := "4.32.0" libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "3.0.8" % "test" @@ -13,7 +13,7 @@ libraryDependencies ++= Seq( libraryDependencies += "net.sourceforge.plantuml" % "plantuml-asl" % "1.2025.0" -scalacOptions := Seq("-deprecation", "-feature", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-17") -javacOptions in compile ++= Seq("-target", "17", "-source", "17") +scalacOptions := Seq("-deprecation", "-feature", "-language:postfixOps", "-Ydelambdafy:method", "-target:jvm-1.8") +Compile / javacOptions ++= Seq("-target", "8", "-source", "17") -useJCenter := true +useJCenter := true From bdc1f0dfbdb936726618fa28497abca459e7514d Mon Sep 17 00:00:00 2001 From: Oliver-Loeffler Date: Tue, 4 Feb 2025 08:47:52 +0100 Subject: [PATCH 4/4] Minimum Gitbucket version is now 4.36.0 as previous versions fail to build due to misisng dependencies. --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 65f84a6..927e416 100644 --- a/build.sbt +++ b/build.sbt @@ -2,10 +2,10 @@ name := "gitbucket-plantuml-plugin" organization := "com.yotaichino" -version := "1.8.1" +version := "1.8.0" scalaVersion := "2.13.7" -gitbucketVersion := "4.32.0" +gitbucketVersion := "4.36.0" libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "3.0.8" % "test"