Skip to content

Commit

Permalink
Merge pull request #14 from windymelt/pre-release-prepare
Browse files Browse the repository at this point in the history
Mavenから使えるようにする準備
  • Loading branch information
windymelt authored Mar 23, 2024
2 parents 3fb4eb8 + c12e8f4 commit c361aff
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 41 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -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. */
/* ----------------------------------------------------------------- */
```
```
7 changes: 7 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Release procedure

```
% sbt
> project dehydrated
> release skip-tests
```
161 changes: 126 additions & 35 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
import Dependencies._
import ReleaseTransformations._

ThisBuild / scalaVersion := "2.13.8"
ThisBuild / organization := "com.github.windymelt"
import xerial.sbt.Sonatype.sonatypeCentralHost

ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / sonatypeCredentialHost := sonatypeCentralHost

ThisBuild / scalaVersion := "2.13.13"
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",
"[email protected]",
url("https://www.3qe.us/")
)
releasePublishArtifactsAction := PgpKeys.publishSigned.value

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

Expand All @@ -18,47 +44,112 @@ 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 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(
"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
),
downloadCore := {},
Compile / unmanagedResourceDirectories ++= {
Seq(
baseDirectory.value / "open_jtalk_dic_utf_8-1.11" // 辞書はリソースに含める
)
}
)
.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
releaseStepCommand("publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
releaseStepTask(assembly),
setNextVersion, // : ReleaseStep
commitNextVersion, // : ReleaseStep
pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured
)
)

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())) {
// 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",
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.
2 changes: 1 addition & 1 deletion project/metals.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

7 changes: 7 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 1 addition & 1 deletion project/project/metals.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

2 changes: 1 addition & 1 deletion project/project/project/metals.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ThisBuild / version := "0.14.2-SNAPSHOT"
ThisBuild / version := "0.14.2-ALPHA-1"

0 comments on commit c361aff

Please sign in to comment.