How to gracefully compose two problems with SBT?

I would like to convert this bash expression:

$ sbt clean lint

      

into a nice build.sbt expression something like:

precommit := clean <> lint

      

so that I can execute the following bash expression:

$ sbt precommit

      

For example, this is more or less how you would do it with a Makefile:

lint:
    echo linting
    touch foo.txt

clean:
    echo cleaning
    rm -f foo.txt

precommit: clean lint

      

The Makefile can be used like:

$ make precommit
echo cleaning
cleaning
rm -f foo.txt
echo linting
linting
touch foo.txt

      

Any ideas?

+3


source to share


2 answers


Use a sequential task

precommit := Def.sequential(clean, lint).value

      



while wearing a bespoke British suit, driving an Aston Martin on a country road for added elegance.

+7


source


Use the command alias:



addCommandAlias("precommit", ";clean;lint")

      

+3


source







All Articles