From 80799e5366d0e537dbb93a038e62bc20b19c5957 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sat, 23 Mar 2024 22:14:52 +0900 Subject: [PATCH 1/9] scalafmt --- build.sbt | 91 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 34 deletions(-) diff --git a/build.sbt b/build.sbt index e09572f..1d00e65 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,8 @@ ThisBuild / scalaVersion := "2.13.8" ThisBuild / organization := "com.github.windymelt" ThisBuild / organizationName := "windymelt" -lazy val downloadCore = taskKey[Unit]("Download libcore zip and extract it ./voicevox_core-*") +lazy val downloadCore = + taskKey[Unit]("Download libcore zip and extract it ./voicevox_core-*") Compile / compile := (Compile / compile).dependsOn(downloadCore).value @@ -18,47 +19,69 @@ lazy val common = project "net.java.dev.jna" % "jna" % "5.12.1", "net.java.dev.jna" % "jna-platform" % "5.12.1", "com.lihaoyi" %% "os-lib" % "0.7.2", // for extracting resources - "com.typesafe.scala-logging" %% "scala-logging" % "3.9.4", // wrapper for SLF4J - ), + "com.typesafe.scala-logging" %% "scala-logging" % "3.9.4" // wrapper for SLF4J + ) ) -lazy val x8664linuxcpu = (project in file(".")).settings( - name := "voicevoxcore4s-linux-x64-cpu", - buildInfoKeys := Seq[BuildInfoKey]("libcoreFile" -> "libvoicevox_core.so", "libonnxFile" -> "libonnxruntime.so.1.13.1"), - libraryDependencies ++= Seq( - scalaTest % Test, - ), - downloadCore := { - if(java.nio.file.Files.notExists(new File("voicevox_core-linux-x64-cpu-0.14.1").toPath())) { +lazy val x8664linuxcpu = (project in file(".")) + .settings( + name := "voicevoxcore4s-linux-x64-cpu", + buildInfoKeys := Seq[BuildInfoKey]( + "libcoreFile" -> "libvoicevox_core.so", + "libonnxFile" -> "libonnxruntime.so.1.13.1" + ), + libraryDependencies ++= Seq( + scalaTest % Test + ), + downloadCore := { + if ( + java.nio.file.Files + .notExists(new File("voicevox_core-linux-x64-cpu-0.14.1").toPath()) + ) { println("[libcore] Path does not exist, downloading...") - IO.unzipURL(new URL("https://github.com/VOICEVOX/voicevox_core/releases/download/0.14.1/voicevox_core-linux-x64-cpu-0.14.1.zip"), new File("voicevox_core-linux-x64-cpu-0.14.1")) - } else { + IO.unzipURL( + new URL( + "https://github.com/VOICEVOX/voicevox_core/releases/download/0.14.1/voicevox_core-linux-x64-cpu-0.14.1.zip" + ), + new File("voicevox_core-linux-x64-cpu-0.14.1") + ) + } else { println("[libcore] Path exists, no need to download.") + } + }, + Compile / unmanagedResourceDirectories ++= { + Seq( + baseDirectory.value / "open_jtalk_dic_utf_8-1.11", + baseDirectory.value / "voicevox_core-linux-x64-cpu-0.14.1/voicevox_core-linux-x64-cpu-0.14.1/model" + ) + }, + Compile / unmanagedResources ++= { + Seq( + file( + "voicevox_core-linux-x64-cpu-0.14.1/voicevox_core-linux-x64-cpu-0.14.1/libvoicevox_core.so" + ), + file( + "voicevox_core-linux-x64-cpu-0.14.1/voicevox_core-linux-x64-cpu-0.14.1/libonnxruntime.so.1.13.1" + ) + ) } - }, - Compile / unmanagedResourceDirectories ++= { Seq( - baseDirectory.value / "open_jtalk_dic_utf_8-1.11", - baseDirectory.value / "voicevox_core-linux-x64-cpu-0.14.1/voicevox_core-linux-x64-cpu-0.14.1/model" -)}, - Compile / unmanagedResources ++= { Seq( - file("voicevox_core-linux-x64-cpu-0.14.1/voicevox_core-linux-x64-cpu-0.14.1/libvoicevox_core.so"), - file("voicevox_core-linux-x64-cpu-0.14.1/voicevox_core-linux-x64-cpu-0.14.1/libonnxruntime.so.1.13.1"), - ) }, -).dependsOn(common).enablePlugins(BuildInfoPlugin) -.settings( + ) + .dependsOn(common) + .enablePlugins(BuildInfoPlugin) + .settings( releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, // : ReleaseStep - inquireVersions, // : ReleaseStep - runClean, // : ReleaseStep - runTest, // : ReleaseStep - setReleaseVersion, // : ReleaseStep - commitReleaseVersion, // : ReleaseStep, performs the initial git checks - tagRelease, // : ReleaseStep + checkSnapshotDependencies, // : ReleaseStep + inquireVersions, // : ReleaseStep + runClean, // : ReleaseStep + runTest, // : ReleaseStep + setReleaseVersion, // : ReleaseStep + commitReleaseVersion, // : ReleaseStep, performs the initial git checks + tagRelease, // : ReleaseStep // publishArtifacts, // : ReleaseStep, checks whether `publishTo` is properly set up releaseStepTask(assembly), - setNextVersion, // : ReleaseStep - commitNextVersion, // : ReleaseStep - pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured + setNextVersion, // : ReleaseStep + commitNextVersion, // : ReleaseStep + pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured ) ) // See https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html for instructions on how to publish to Sonatype. From 40ef720f16b9cbe24c8c344ecc8ae101b7aa1958 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sat, 23 Mar 2024 22:15:07 +0900 Subject: [PATCH 2/9] bump to Scala 2.13.13 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 1d00e65..b7c8fd4 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,7 @@ import Dependencies._ import ReleaseTransformations._ -ThisBuild / scalaVersion := "2.13.8" +ThisBuild / scalaVersion := "2.13.13" ThisBuild / organization := "com.github.windymelt" ThisBuild / organizationName := "windymelt" From 2d61c49d11de0a66bd709ed5cc5f6b73018d4f16 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 24 Mar 2024 02:09:43 +0900 Subject: [PATCH 3/9] release procedure --- RELEASE.md | 7 ++++ build.sbt | 64 +++++++++++++++++++++++++++++- project/metals.sbt | 2 +- project/plugins.sbt | 7 ++++ project/project/metals.sbt | 2 +- project/project/project/metals.sbt | 2 +- 6 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..f84fa0a --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,7 @@ +# Release procedure + +``` +% sbt +> project dehydrated +> release skip-tests +``` diff --git a/build.sbt b/build.sbt index b7c8fd4..17bacae 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,34 @@ import Dependencies._ import ReleaseTransformations._ +import xerial.sbt.Sonatype.sonatypeCentralHost + +ThisBuild / publishTo := sonatypePublishToBundle.value +ThisBuild / sonatypeCredentialHost := sonatypeCentralHost + ThisBuild / scalaVersion := "2.13.13" -ThisBuild / organization := "com.github.windymelt" +ThisBuild / organization := "dev.capslock" ThisBuild / organizationName := "windymelt" +ThisBuild / startYear := Some(2024) +ThisBuild / licenses += License.MIT +ThisBuild / homepage := Some( + url( + "https://github.com/windymelt/scala-new-maven-central-exercise" + ) +) +ThisBuild / scmInfo := Some( + ScmInfo( + url("https://github.com/windymelt/scala-new-maven-central-exercise"), + "https://github.com/windymelt/scala-new-maven-central-exercise.git" + ) +) +ThisBuild / developers += Developer( + "windymelt", + "windymelt", + "windymelt@3qe.us", + url("https://www.3qe.us/") +) +releasePublishArtifactsAction := PgpKeys.publishSigned.value lazy val downloadCore = taskKey[Unit]("Download libcore zip and extract it ./voicevox_core-*") @@ -23,6 +48,43 @@ lazy val common = project ) ) +lazy val dehydrated = (project in file(".")) + .settings( + name := "voicevoxcore4s", + buildInfoKeys := Seq[BuildInfoKey]( + "libcoreFile" -> "you don't need to extract library", + "libonnxFile" -> "you don't need to extract library" + ), + libraryDependencies ++= Seq( + scalaTest % Test + ), + downloadCore := {}, + Compile / unmanagedResourceDirectories ++= { + Seq( + baseDirectory.value / "open_jtalk_dic_utf_8-1.11" // 辞書はリソースに含める + ) + } + ) + .dependsOn(common) + .enablePlugins(BuildInfoPlugin) + .settings( + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, // : ReleaseStep + inquireVersions, // : ReleaseStep + runClean, // : ReleaseStep + runTest, // : ReleaseStep + setReleaseVersion, // : ReleaseStep + commitReleaseVersion, // : ReleaseStep, performs the initial git checks + tagRelease, // : ReleaseStep + publishArtifacts, + releaseStepTask(assembly), + setNextVersion, // : ReleaseStep + commitNextVersion, // : ReleaseStep + pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured + ) + ) + +// We don't provide Maven Central artifact for this build config due to huge size of library. lazy val x8664linuxcpu = (project in file(".")) .settings( name := "voicevoxcore4s-linux-x64-cpu", diff --git a/project/metals.sbt b/project/metals.sbt index 05fd2b3..119c929 100644 --- a/project/metals.sbt +++ b/project/metals.sbt @@ -2,5 +2,5 @@ // This file enables sbt-bloop to create bloop config files. -addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6") +addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.15") diff --git a/project/plugins.sbt b/project/plugins.sbt index 179fec6..fc13d76 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,3 +3,10 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.0") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") + +addSbtPlugin( + "org.xerial.sbt" % "sbt-sonatype" % "0.0.0-734-5b5db727" +) // CAVEAT: Due to incapability with latest sbt-sonatype, use local built one +// cf. https://github.com/xerial/sbt-sonatype/issues/465 + +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") diff --git a/project/project/metals.sbt b/project/project/metals.sbt index 05fd2b3..119c929 100644 --- a/project/project/metals.sbt +++ b/project/project/metals.sbt @@ -2,5 +2,5 @@ // This file enables sbt-bloop to create bloop config files. -addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6") +addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.15") diff --git a/project/project/project/metals.sbt b/project/project/project/metals.sbt index 05fd2b3..119c929 100644 --- a/project/project/project/metals.sbt +++ b/project/project/project/metals.sbt @@ -2,5 +2,5 @@ // This file enables sbt-bloop to create bloop config files. -addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6") +addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.15") From b787de466b3910b1ad9d862fb19dbb4c4950c1a3 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 24 Mar 2024 02:14:26 +0900 Subject: [PATCH 4/9] fixed publishTo --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 17bacae..7c386e2 100644 --- a/build.sbt +++ b/build.sbt @@ -63,7 +63,9 @@ lazy val dehydrated = (project in file(".")) Seq( baseDirectory.value / "open_jtalk_dic_utf_8-1.11" // 辞書はリソースに含める ) - } + }, + publishTo := sonatypePublishToBundle.value, + sonatypeCredentialHost := sonatypeCentralHost ) .dependsOn(common) .enablePlugins(BuildInfoPlugin) From 3a6b33f65327009122519dbf055fdc5c756e6aa5 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 24 Mar 2024 02:21:33 +0900 Subject: [PATCH 5/9] fixed build step --- build.sbt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 7c386e2..7f10f61 100644 --- a/build.sbt +++ b/build.sbt @@ -63,9 +63,7 @@ lazy val dehydrated = (project in file(".")) Seq( baseDirectory.value / "open_jtalk_dic_utf_8-1.11" // 辞書はリソースに含める ) - }, - publishTo := sonatypePublishToBundle.value, - sonatypeCredentialHost := sonatypeCentralHost + } ) .dependsOn(common) .enablePlugins(BuildInfoPlugin) @@ -78,7 +76,8 @@ lazy val dehydrated = (project in file(".")) setReleaseVersion, // : ReleaseStep commitReleaseVersion, // : ReleaseStep, performs the initial git checks tagRelease, // : ReleaseStep - publishArtifacts, + releaseStepCommand("publishSigned"), + releaseStepCommand("sonatypeBundleRelease"), releaseStepTask(assembly), setNextVersion, // : ReleaseStep commitNextVersion, // : ReleaseStep From cb2815368bb2bbd910880d8a3495fe7d05e8e42a Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 24 Mar 2024 02:22:57 +0900 Subject: [PATCH 6/9] Setting version to 0.14.2-ALPHA-1 --- version.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.sbt b/version.sbt index bc026f3..4e06fa1 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -ThisBuild / version := "0.14.2-SNAPSHOT" +ThisBuild / version := "0.14.2-ALPHA-1" From 4c070041781fccdd8baa97029e19fc0ee56e37c3 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 24 Mar 2024 02:24:45 +0900 Subject: [PATCH 7/9] fix aggregation --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 7f10f61..2f47dd3 100644 --- a/build.sbt +++ b/build.sbt @@ -65,7 +65,7 @@ lazy val dehydrated = (project in file(".")) ) } ) - .dependsOn(common) + .aggregate(common) .enablePlugins(BuildInfoPlugin) .settings( releaseProcess := Seq[ReleaseStep]( From 327ba96763190b1f4db81c1827c501741c179b39 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 24 Mar 2024 02:28:12 +0900 Subject: [PATCH 8/9] ignore common --- build.sbt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2f47dd3..5de4759 100644 --- a/build.sbt +++ b/build.sbt @@ -55,6 +55,12 @@ lazy val dehydrated = (project in file(".")) "libcoreFile" -> "you don't need to extract library", "libonnxFile" -> "you don't need to extract library" ), + libraryDependencies ++= Seq( + "net.java.dev.jna" % "jna" % "5.12.1", + "net.java.dev.jna" % "jna-platform" % "5.12.1", + "com.lihaoyi" %% "os-lib" % "0.7.2", // for extracting resources + "com.typesafe.scala-logging" %% "scala-logging" % "3.9.4" // wrapper for SLF4J + ), libraryDependencies ++= Seq( scalaTest % Test ), @@ -65,7 +71,6 @@ lazy val dehydrated = (project in file(".")) ) } ) - .aggregate(common) .enablePlugins(BuildInfoPlugin) .settings( releaseProcess := Seq[ReleaseStep]( From c12e8f4a867e956b60501e78a46179e7139b00d3 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 24 Mar 2024 03:32:49 +0900 Subject: [PATCH 9/9] badge --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 59280cc..c52dae2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# voicevoxcore4s +# voicevoxcore4s [![Latest version](https://index.scala-lang.org/windymelt/voicevoxcore4s/voicevoxcore4s/latest.svg)](https://index.scala-lang.org/windymelt/voicevoxcore4s/voicevoxcore4s) + Scala wrapper for [VOICEVOX Core](https://github.com/VOICEVOX/voicevox_core) Currently this binding supports [VOICEVOX Core v0.14.1](https://github.com/VOICEVOX/voicevox_core/tree/0.14.1). @@ -394,4 +395,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ /* POSSIBILITY OF SUCH DAMAGE. */ /* ----------------------------------------------------------------- */ -``` \ No newline at end of file +```