Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we change reStartArgs to be a task ? #38

Open
MasseGuillaume opened this issue Jul 9, 2014 · 3 comments
Open

Can we change reStartArgs to be a task ? #38

MasseGuillaume opened this issue Jul 9, 2014 · 3 comments

Comments

@MasseGuillaume
Copy link

A setting cannot depend on a task.

@MasseGuillaume
Copy link
Author

current work arround:

lazy val startArgs = TaskKey[Seq[String]]("start-args",
        "The arguments to be passed to the applications main method when being started")

Revolver.reStart <<= InputTask(Actions.startArgsParser) { args =>
    (
        streams,
        Revolver.reLogTag,
        thisProjectRef,
        Revolver.reForkOptions,
        mainClass in Revolver.reStart,
        fullClasspath in Revolver.reStart,
        startArgs in Revolver.reStart,
        args
    ).map(Actions.restartApp)
     .dependsOn(products in Compile)
}

startArgs in Revolver.reStart := Seq()

https://github.com/MasseGuillaume/ScalaKata/blob/0.2.0/Plugin/src/main/scala/com.scalakata/ScalaKata.scala#L46
https://github.com/MasseGuillaume/ScalaKata/blob/0.2.0/Plugin/src/main/scala/com.scalakata/ScalaKata.scala#L98

@jrudolph
Copy link
Member

I guess I could change it. I would be a bit against sbt principles which would usually make only those things a Task which likely need to be recomputed for every usage. It may be no problem in this case as only reStart depends on it which already is a Task.

@jedesah
Copy link
Contributor

jedesah commented Jun 8, 2018

I'd like to +1 this issue as I have also now run into a situation where startArgs needs to depend on the classpath TaskKey defined in sbt and I can't actually express that because startArgs is a SettingKey and thus cannot depend on a TaskKey.

This has me wondering on a philosophical level whether a SettingKey is ever the right choice unless one is 100% sure a client will never need it to depend on a TaskKey which is kind of a hard determination to make for all possile scenarios so what's the drawback of just making everything a TaskKey just in case?

In any event, beyond the broader observation above, I think reStartArgs has certainly demonstrated a usefulness to being declared a TaskKey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants