Skip to content

Runner settings not scoped #16

@steinybot

Description

@steinybot

When using the Kanela runner it behaves a bit differently to other runners as the settings are not scoped correctly. The settings it uses such as baseDirectory should be scoped to Compile/run.

For example, if I set:

run / baseDirectory := "foo"

Then the Kanela runner will not use this and instead it will use baseDirectory which by default is the project base directory.

The settings used in kanelaRunnerTask are mostly raw which is good it's just where they are used in projectSettings is where the scoping problem is.

See how sbt does it:

https://github.com/sbt/sbt/blob/ce59ea754a12709a978ac1f54306a81c6c6d68d7/main/src/main/scala/sbt/Defaults.scala#L2582

inConfig(Compile)(compileSettings)

https://github.com/sbt/sbt/blob/ce59ea754a12709a978ac1f54306a81c6c6d68d7/main/src/main/scala/sbt/Defaults.scala#L994

inTask(run)(runnerSettings ++ newRunnerSettings)

The workaround is fairly straight forward:

inConfig(Compile) {
  inTask(run) {
    runner := SbtKanelaRunner.kanelaRunnerTask.value
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions