mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-27 21:46:50 +08:00
add support for publish doc jar, add dockerBuild task
This commit is contained in:
parent
7cf06a539c
commit
7e668bd974
@ -8,7 +8,7 @@ ARG DOCKER_BUILD=yes
|
||||
RUN cd ./source \
|
||||
&& sbt assembly \
|
||||
&& cd .. \
|
||||
&& cp ./source/target/morny-coeur-docker-build.jar ./morny-coeur.jar
|
||||
&& cp ./source/morny-coeur/target/morny-coeur-docker-build.jar ./morny-coeur.jar
|
||||
#&& rm -r ./source \
|
||||
#&& rm -r /root/.gradle \
|
||||
|
||||
|
28
build.sbt
28
build.sbt
@ -13,7 +13,10 @@ ThisBuild / resolvers ++= Seq(
|
||||
|
||||
ThisBuild / crossPaths := false
|
||||
|
||||
ThisBuild / Compile / packageDoc / publishArtifact := false
|
||||
if (!MornyProject.publishWithDocJar) {
|
||||
(ThisBuild / packageDoc / publishArtifact := false) :: Nil
|
||||
} else Nil
|
||||
|
||||
artifactName := {(sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
|
||||
val classifier = artifact.classifier match {
|
||||
case Some(value) => s"-$value"
|
||||
@ -50,6 +53,7 @@ ThisBuild / apiMappings ++= {
|
||||
ThisBuild / publishTo := MornyProject.publishTo
|
||||
ThisBuild / credentials ++= MornyProject.publishCredentials
|
||||
|
||||
|
||||
lazy val morny_system_lib = (project in file (MornyProject.morny_system_lib.id))
|
||||
.settings(
|
||||
|
||||
@ -110,6 +114,10 @@ lazy val morny_coeur = (project in file(MornyProject.morny_coeur.id))
|
||||
|
||||
)
|
||||
|
||||
lazy val dockerImageName: SettingKey[String] = settingKey[String]("Docker image name that want to built")
|
||||
lazy val dockerImageTag: SettingKey[String] = settingKey[String]("Docker image tag or aka image version of the built image")
|
||||
lazy val dockerBuild: TaskKey[Unit] = taskKey("Build using system docker with current version as the container tag")
|
||||
|
||||
lazy val root = (project in file ("."))
|
||||
.aggregate(morny_system_lib, morny_coeur)
|
||||
.settings(
|
||||
@ -126,6 +134,24 @@ lazy val root = (project in file ("."))
|
||||
run / aggregate := false,
|
||||
run := {
|
||||
(morny_coeur / Compile / run).evaluated
|
||||
},
|
||||
|
||||
dockerImageName := MornyProject.docker_image_name,
|
||||
dockerImageTag := version.value,
|
||||
dockerBuild := {
|
||||
|
||||
val builtImageName = dockerImageName.value
|
||||
val builtImageTag = (ThisProject / dockerImageTag).value
|
||||
sLog.value info s"Building docker image with name $builtImageName:$builtImageTag"
|
||||
|
||||
import scala.language.postfixOps
|
||||
import scala.sys.process.*
|
||||
s"docker build -t $builtImageName:$builtImageTag ."!
|
||||
|
||||
sLog.value info s"Built docker image $builtImageName:$builtImageTag"
|
||||
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
@ -6,15 +6,17 @@ object MornyConfiguration {
|
||||
val MORNY_CODE_STORE = "https://github.com/Eyre-S/Coeur-Morny-Cono"
|
||||
val MORNY_COMMIT_PATH = "https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s"
|
||||
|
||||
val VERSION = "2.0.0-alpha20"
|
||||
val VERSION = "2.0.0-alpha21"
|
||||
val VERSION_DELTA: Option[String] = None
|
||||
val CODENAME = "xinzheng"
|
||||
|
||||
val SNAPSHOT = false
|
||||
val SNAPSHOT = true
|
||||
|
||||
val GROUP = "cc.sukazyo"
|
||||
val GROUP_NAME = "A.C. Sukazyo Eyre"
|
||||
|
||||
val DOCKER_IMAGE_NAME = "coeur-morny-cono"
|
||||
|
||||
trait ProjectMetadata {
|
||||
|
||||
val name: String
|
||||
|
@ -44,7 +44,10 @@ object MornyProject {
|
||||
val group = MornyConfiguration.GROUP
|
||||
val group_name = MornyConfiguration.GROUP_NAME
|
||||
|
||||
val docker_image_name = MornyConfiguration.DOCKER_IMAGE_NAME
|
||||
|
||||
val publishWithFatJar = !version_is_snapshot
|
||||
val publishWithDocJar = !version_is_snapshot
|
||||
def publishTo = MornyConfiguration.publishTo
|
||||
val publishCredentials = MornyConfiguration.publishCredentials
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user