You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I like your plug in very much.
My normal workflow is to open sbt and leave it open even for days (unless changing something related to the build, there is no need to reload the project)
The version setting isn't changed unless I reload the project.
It is technically understood (version is a setting not a task) but in case of a dirty files I will have to reload the project each minute and it takes more than 30 seconds (or use an outdated version).
I ended up doing:
defrefreshVersion=Command.command("refreshVersion") { state =>valextracted=Project extract state
importextracted._/* - At first I thought to manually set the version. It seems unimportant - just refresh the session val result: Option[(State, Result[String])] = Project.runTask(dynver, state) result match { case None => state.fail // Key wasn't defined. case Some((newState, Inc(inc))) => state.fail // error detail, inc is of type Incomplete, use Incomplete.show(inc.tpe) to get an error message case Some((newState, Value(v))) => println(s"Setting the version to $v") appendWithoutSession(Seq(version := v), state) // do something with v: inc.Analysis }*/
state.log.info("refreshing version")
appendWithoutSession(Seq(), state) // do something with v: inc.Analysis
}
ThisBuild/ commands += refreshVersion
valdirtyEnd=""".*(-\d\d\d\d)$""".r
defstripTime(version: String) = version match {
case dirtyEnd(time) => version.stripSuffix(time)
case _ => version
}
ThisBuild/ version ~= stripTime
ThisBuild/ dynver ~= stripTime
and make compile depend on:
versionCheck := {
val dynamicVersion = dynver.value
val staticVersion = version.value
if (dynamicVersion != staticVersion)
sys.error(s"The version setting ($staticVersion) is different from the dynamic (dynver) one ($dynamicVersion). Please use the refreshVersion command to refresh the setting.")
}
This way the dynamic version only contains the day - refresh is needed only once a day.
Also, reload in our project takes more than 30 seconds. The refresh command works 2 in seconds.
But, still, the refresh should be done manually.
Do you have a better idea?
Thanks!
The text was updated successfully, but these errors were encountered:
It's a good idea (I spent quite an amount of time creating this setup).
I am not a sbt expect and don't fully understand why appendWithoutSession(Seq(), state) works and refreshes the version of the state, but it works.
Also, please note I didn't use dynverAssertVersion . Our project have multiple sub-projects and setting the version of only one project didn't trigger the assert.
Commands can redefine State (that's why they have a State => State function), so that appendWithoutSession triggers sbt to recompute the setting values.
Hi,
I like your plug in very much.
My normal workflow is to open sbt and leave it open even for days (unless changing something related to the build, there is no need to reload the project)
The version setting isn't changed unless I reload the project.
It is technically understood (version is a setting not a task) but in case of a dirty files I will have to reload the project each minute and it takes more than 30 seconds (or use an outdated version).
I ended up doing:
and make compile depend on:
This way the dynamic version only contains the day - refresh is needed only once a day.
Also, reload in our project takes more than 30 seconds. The refresh command works 2 in seconds.
But, still, the refresh should be done manually.
Do you have a better idea?
Thanks!
The text was updated successfully, but these errors were encountered: