简体   繁体   English

什么样的轴是git变量?

[英]What kind of axis is git variable?

My build.sbt file looks as the following: 我的build.sbt文件如下所示:

//Git settings
git.useGitDescribe := true
git.formattedShaVersion := git.gitHeadCommit.value map { _ =>
  git.gitCurrentTags.value.head
}

Docker / dockerAlias := DockerAlias(None, Some("zerocoder"), (packageName in Docker).value, git.gitDescribedVersion.value)

lazy val root = (project in file("."))
  .enablePlugins(DockerPlugin, JavaServerAppPackaging, GitVersioning)
  .settings(
    name := "plugger",
    libraryDependencies ++= Seq(
      "org.typelevel" %% "cats-core" % "1.6.0",
      "ch.qos.logback" % "logback-classic" % "1.2.3",
      "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
      "com.typesafe.akka" %% "akka-slf4j" % "2.5.22",
      "io.circe" %% "circe-core" % "0.11.1",
      "io.circe" %% "circe-generic" % "0.11.1",
      "io.circe" %% "circe-parser" % "0.11.1",
      "org.scala-lang" % "scala-library" % "2.12.8",
      "com.typesafe.akka" %% "akka-actor" % "2.5.22",
      "com.typesafe.akka" %% "akka-stream" % "2.5.22",
      "com.typesafe.akka" %% "akka-http" % "10.1.8",
      "com.typesafe.akka" %% "akka-stream-kafka" % "1.0.1",
      "org.scalacheck" %% "scalacheck" % "1.14.0" % "test",
      "org.scalactic" %% "scalactic" % "3.0.6" % "test",
      "org.scalatest" %% "scalatest" % "3.0.6" % "test",
      "com.dimafeng" %% "testcontainers-scala" % "0.25.0" % "test"
    ),
    addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3"),
    scalacOptions ++= Seq(
      "-encoding", "UTF-8", // source files are in UTF-8
      "-deprecation", // warn about use of deprecated APIs
      "-unchecked", // warn about unchecked type parameters
      "-feature", // warn about misused language features
      "-language:higherKinds", // allow higher kinded types without `import scala.language.higherKinds`
      "-Xlint", // enable handy linter warnings
      "-Xfatal-warnings", // turn compiler warnings into errors
      "-Ypartial-unification" // allow the compiler to unify type constructors of different arities
    ),
    scalacOptions in(Compile, console) ~= {
      _.filterNot(Set("-Xlint"))
    }

  )

As you can see, I am using GitVersioning plugin and what kind of axis scope is git variable? 如您所见,我正在使用GitVersioning插件,哪种轴范围是git变量?

Docker is a scope and the dockerAlias in the scope, that because I can write Docker / dockerAlias . Docker是一个范围和dockerAlias的范围,因为我可以编写Docker / dockerAlias

I also tried to write git / useGitDescribe but it does not work. 我也尝试编写git / useGitDescribe但它不起作用。

git isn't in any of sbt's scope axes. git不在任何sbt的范围轴中。 It's just an object that holds keys: https://github.com/sbt/sbt-git/blob/v1.0.0/src/main/scala/com/typesafe/sbt/SbtGit.scala#L212 它只是一个包含密钥的对象: https//github.com/sbt/sbt-git/blob/v1.0.0/src/main/scala/com/typesafe/sbt/SbtGit.scala#L212

It also, as you can see, re-scopes the majority of the keys in the ThisBuild reference scope axis. 如您所见,它还重新调整了ThisBuild引用范围轴中的大多数键的范围。 I've only ever seen sbt-git do this, but the effect is that if you use git.baseVersion within a project's settings (ie .settings(..) ) then it will stay defined at build-level rather than at project-level. 我只见过sbt-git这样做,但效果是如果你在项目的设置中使用git.baseVersion (即.settings(..) )那么它将保持在构建级而不是项目级别 -水平。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM