本文整理汇总了Scala中sbt.Keys.version类的典型用法代码示例。如果您正苦于以下问题:Scala version类的具体用法?Scala version怎么用?Scala version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了version类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: PublishLocalSnapshot
//设置package包名称以及导入依赖的类
package x7c1.chaff.publish
import sbt.Def.{SettingsDefinition, taskKey}
import sbt.Keys.{publishLocal, version}
import sbt.{Compile, TaskKey}
object PublishLocalSnapshot {
def definition: SettingsDefinition = StateCommand.taskDefinition(
key = publishLocalSnapshot,
updates = Seq(
version := withSuffix(version.value, "-SNAPSHOT")
),
task = publishLocal in Compile
)
lazy val publishLocalSnapshot: TaskKey[Unit] = taskKey[Unit](
"Runs publishLocal on '-SNAPSHOT' version."
)
private def withSuffix(original: String, suffix: String) = {
if (original endsWith suffix) {
original
} else {
original + suffix
}
}
}
开发者ID:x7c1,项目名称:Chaff,代码行数:29,代码来源:PublishLocalSnapshot.scala
示例2: LatestVersion
//设置package包名称以及导入依赖的类
import sbt.Keys.version
import sbt._
import sbtrelease.ReleasePlugin.autoImport.ReleaseStep
import sbtrelease.ReleaseStateTransformations.reapply
object LatestVersion extends AutoPlugin {
object autoImport {
lazy val latestVersion: SettingKey[String] =
settingKey[String]("latest released version")
lazy val setLatestVersion: ReleaseStep = { st: State =>
val extracted = Project.extract(st)
val newVersion = extracted.get(version)
val latestVersionSbt = "latestVersion.sbt"
val content = Seq(s"""latestVersion in ThisBuild := "$newVersion"""")
IO.writeLines(file(latestVersionSbt), content)
val vcs = sbtrelease.Vcs.detect(file("."))
vcs.foreach(_.add(latestVersionSbt) !! st.log)
reapply(Seq(latestVersion in ThisBuild := newVersion), st)
}
}
}
开发者ID:fthomas,项目名称:crjdt,代码行数:26,代码来源:LatestVersion.scala
注:本文中的sbt.Keys.version类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论