Skip to content

Commit

Permalink
Process
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Oct 12, 2024
1 parent a4ce5f6 commit 9518056
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
17 changes: 7 additions & 10 deletions sbtdynver/src/sbt-test/dynver/custom-version-string/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import scala.sys.process.stringToProcess
import scala.sys.process.Process

def versionFmt(out: sbtdynver.GitDescribeOutput): String = {
val dirtySuffix = out.dirtySuffix.dropPlus.mkString("-", "")
Expand Down Expand Up @@ -35,26 +36,22 @@ TaskKey[Unit]("checkOnTagAndCommitDirty") := check(version.value, s"1.0.0-1-${he

TaskKey[Unit]("gitInitSetup") := {
implicit def log2log(log: Logger): scala.sys.process.ProcessLogger = sbtLoggerToScalaSysProcessLogger(log)
"git init".!!(streams.value.log)
"git config user.email dynver@mailinator.com".!!(streams.value.log)
"git config user.name dynver".!!(streams.value.log)
Process("git init", Option(baseDirectory.value)).!!(streams.value.log)
Process("git config user.email dynver@mailinator.com", Option(baseDirectory.value)).!!(streams.value.log)
Process("git config user.name dynver", Option(baseDirectory.value)).!!(streams.value.log)
}

TaskKey[Unit]("gitAdd") := {
implicit def log2log(log: Logger): scala.sys.process.ProcessLogger = sbtLoggerToScalaSysProcessLogger(log)
"git add .".!!(streams.value.log)
Process("git add .", Option(baseDirectory.value)).!!(streams.value.log)
}
TaskKey[Unit]("gitCommit") := {
implicit def log2log(log: Logger): scala.sys.process.ProcessLogger = sbtLoggerToScalaSysProcessLogger(log)
"git commit -am1".!!(streams.value.log)
}
TaskKey[Unit]("gitDiff") := {
implicit def log2log(log: Logger): scala.sys.process.ProcessLogger = sbtLoggerToScalaSysProcessLogger(log)
"git diff".!!(streams.value.log)
Process("git commit -am1", Option(baseDirectory.value)).!!(streams.value.log)
}
TaskKey[Unit]("gitTag") := {
implicit def log2log(log: Logger): scala.sys.process.ProcessLogger = sbtLoggerToScalaSysProcessLogger(log)
"git tag -a v1.0.0 -m1.0.0".!!(streams.value.log)
Process("git tag -a v1.0.0 -m1.0.0", Option(baseDirectory.value)).!!(streams.value.log)
}

TaskKey[Unit]("dirty") := {
Expand Down
6 changes: 0 additions & 6 deletions sbtdynver/src/sbt-test/dynver/custom-version-string/test
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,26 @@
> dirty
> gitAdd
> gitCommit
$ sleep 100
> reload
> checkOnCommit

> dirty
$ sleep 100
> reload
> checkOnCommitDirty

> gitCommit
> gitTag
$ sleep 100
> reload
> checkOnTag

> dirty
$ sleep 100
> reload
> checkOnTagDirty

> gitCommit
$ sleep 100
> reload
> checkOnTagAndCommit

> dirty
$ sleep 100
> reload
> checkOnTagAndCommitDirty

0 comments on commit 9518056

Please sign in to comment.