-
What's the right way to make a Command with parameters from other targets? I'm refactoring some cut/paste code in a build.sc file, and would like to get rid of the duplicate code. The code uploads one file or another via scp.
I'd like to consolidate the complexity into a general command that take parameters - along the lines of
but I get Thanks, David |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
The issue is, that you can't call another task in the parameter list of the command. The solution is, to move the task execution (actually, it's only a dependency and a reference to the outcome) into the shared task. def scpUp(localPathTask: Task[Path], remotePath: String): Task[CommandResult] = T.task {
val localPath: Path = localPathTask()
// scp command here...
}
scpUp(T.task{ assembly().path }, s"${artifactName()}.jar")() |
Beta Was this translation helpful? Give feedback.
-
(How do you define a type in a way that it can't be used in a parameter? I didn't know that was possible.) My own (less satisfying) fix was to define the method outside of Mill's abstractions:
and then call it with some ugly type monkeying:
What I'd really like to have to show the kids is an uncluttered:
It seems like I could get there by adding a conversion from Are there any parts for that already around? Is there a good reason not to pursue the cleanup? Thanks, David |
Beta Was this translation helpful? Give feedback.
The issue is, that you can't call another task in the parameter list of the command.
The solution is, to move the task execution (actually, it's only a dependency and a reference to the outcome) into the shared task.