How do I make sbt run a task only once even though it is indirectly specified multiple times on the cli? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!In SBT 0.13, does scalaVersion still control the version of scala used for compile, run and test?Including project in build depending on setting's value, e.g. scalaVersion?webappResources in package := Seq(baseDirectory.value …) throws Error parsing expressionHow to use SBT IntegrationTest configuration from Scala objectsscala reference sbt project versionUsing SBT to manage projects that contain both Scala and PythonHow to define build-scoped settings in multi-project .sbt builds?sbt console - set scala-version for all sub-projectssbt: set the base-directory of a remote RootProjectsbt fails to run when I try add the node modules in the project

My bank got bought out, am I now going to have to start filing tax returns in a different state?

All ASCII characters with a given bit count

Implementing 3DES algorithm in Java: is my code secure?

Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?

Is Bran literally the world's memory?

As an international instructor, should I openly talk about my accent?

Are all CP/M-80 implementations binary compatible?

Why did Israel vote against lifting the American embargo on Cuba?

With indentation set to `0em`, when using a line break, there is still an indentation of a size of a space

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

What *exactly* is electrical current, voltage, and resistance?

A strange hotel

Why isn't everyone flabbergasted about Bran's "gift"?

Raising a bilingual kid. When should we introduce the majority language?

Seek and ye shall find

finding a tangent line to a parabola

What is the best way to deal with NPC-NPC combat?

Why is an operator the quantum mechanical analogue of an observable?

What is it called when you ride around on your front wheel?

Book with legacy programming code on a space ship that the main character hacks to escape

What is the ongoing value of the Kanban board to the developers as opposed to management

Suing a Police Officer Instead of the Police Department

Can you stand up from being prone using Skirmisher outside of your turn?

Does Mathematica have an implementation of the Poisson Binomial Distribution?



How do I make sbt run a task only once even though it is indirectly specified multiple times on the cli?



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!In SBT 0.13, does scalaVersion still control the version of scala used for compile, run and test?Including project in build depending on setting's value, e.g. scalaVersion?webappResources in package := Seq(baseDirectory.value …) throws Error parsing expressionHow to use SBT IntegrationTest configuration from Scala objectsscala reference sbt project versionUsing SBT to manage projects that contain both Scala and PythonHow to define build-scoped settings in multi-project .sbt builds?sbt console - set scala-version for all sub-projectssbt: set the base-directory of a remote RootProjectsbt fails to run when I try add the node modules in the project



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Here is my plugin code. It defines a master lint task that is triggered from the CLI like so: sbt api/lint jobs/lint. It calls out to some project-specific linters and some build-wide linters. The build-wide linter runs scalafix, but if I call lint multiple times from the CLI, as above (for multiple projects), then scalafix is run multiple times.



How do I make scalafix (and scalafixLinter) run only one time for a given sbt invocation? I thought sbt caches task results, but it seems to not be working here.



object LinterPlugin extends AutoPlugin 

object autoImport
lazy val scalafixLinter = taskKey[Unit]("Run scalafix on all scala code")
lazy val lint = taskKey[Unit]("Run all linters")


override val buildSettings = Seq(
scalafixLinter :=
Def.taskDyn
if (...)
Def.task
// run scalafix
(Compile / scalafix).toTask("").value
(Test / scalafix).toTask("").value

else
Def.task

.all(ScopeFilter(inAnyProject)).value // run on all projects

)

override val projectSettings = Seq(
lint :=
// run all the linters
otherLinters.value
scalafixLinter.value

)










share|improve this question




























    0















    Here is my plugin code. It defines a master lint task that is triggered from the CLI like so: sbt api/lint jobs/lint. It calls out to some project-specific linters and some build-wide linters. The build-wide linter runs scalafix, but if I call lint multiple times from the CLI, as above (for multiple projects), then scalafix is run multiple times.



    How do I make scalafix (and scalafixLinter) run only one time for a given sbt invocation? I thought sbt caches task results, but it seems to not be working here.



    object LinterPlugin extends AutoPlugin 

    object autoImport
    lazy val scalafixLinter = taskKey[Unit]("Run scalafix on all scala code")
    lazy val lint = taskKey[Unit]("Run all linters")


    override val buildSettings = Seq(
    scalafixLinter :=
    Def.taskDyn
    if (...)
    Def.task
    // run scalafix
    (Compile / scalafix).toTask("").value
    (Test / scalafix).toTask("").value

    else
    Def.task

    .all(ScopeFilter(inAnyProject)).value // run on all projects

    )

    override val projectSettings = Seq(
    lint :=
    // run all the linters
    otherLinters.value
    scalafixLinter.value

    )










    share|improve this question
























      0












      0








      0








      Here is my plugin code. It defines a master lint task that is triggered from the CLI like so: sbt api/lint jobs/lint. It calls out to some project-specific linters and some build-wide linters. The build-wide linter runs scalafix, but if I call lint multiple times from the CLI, as above (for multiple projects), then scalafix is run multiple times.



      How do I make scalafix (and scalafixLinter) run only one time for a given sbt invocation? I thought sbt caches task results, but it seems to not be working here.



      object LinterPlugin extends AutoPlugin 

      object autoImport
      lazy val scalafixLinter = taskKey[Unit]("Run scalafix on all scala code")
      lazy val lint = taskKey[Unit]("Run all linters")


      override val buildSettings = Seq(
      scalafixLinter :=
      Def.taskDyn
      if (...)
      Def.task
      // run scalafix
      (Compile / scalafix).toTask("").value
      (Test / scalafix).toTask("").value

      else
      Def.task

      .all(ScopeFilter(inAnyProject)).value // run on all projects

      )

      override val projectSettings = Seq(
      lint :=
      // run all the linters
      otherLinters.value
      scalafixLinter.value

      )










      share|improve this question














      Here is my plugin code. It defines a master lint task that is triggered from the CLI like so: sbt api/lint jobs/lint. It calls out to some project-specific linters and some build-wide linters. The build-wide linter runs scalafix, but if I call lint multiple times from the CLI, as above (for multiple projects), then scalafix is run multiple times.



      How do I make scalafix (and scalafixLinter) run only one time for a given sbt invocation? I thought sbt caches task results, but it seems to not be working here.



      object LinterPlugin extends AutoPlugin 

      object autoImport
      lazy val scalafixLinter = taskKey[Unit]("Run scalafix on all scala code")
      lazy val lint = taskKey[Unit]("Run all linters")


      override val buildSettings = Seq(
      scalafixLinter :=
      Def.taskDyn
      if (...)
      Def.task
      // run scalafix
      (Compile / scalafix).toTask("").value
      (Test / scalafix).toTask("").value

      else
      Def.task

      .all(ScopeFilter(inAnyProject)).value // run on all projects

      )

      override val projectSettings = Seq(
      lint :=
      // run all the linters
      otherLinters.value
      scalafixLinter.value

      )







      scala plugins sbt






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 15:51









      benwafflebenwaffle

      1021210




      1021210






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303394%2fhow-do-i-make-sbt-run-a-task-only-once-even-though-it-is-indirectly-specified-mu%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303394%2fhow-do-i-make-sbt-run-a-task-only-once-even-though-it-is-indirectly-specified-mu%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript