0

I have made a sourceGenerator plugin that builds yaml files into Scala sources. The yaml file of necessity lies outside of the project using the sourceGenerator. This works fine in all ways except triggered execution.

I've verified this by adding a nonsense file within the project to watch too and that triggers the build just fine:

    openApiGenerate / fileInputs := openApiAllInputFiles.value
    openApiGenerate / fileInputs += (baseDirectory.value / "test.txt").toGlob,

The culprit is at the use site:

openApiAllInputFiles := Seq((baseDirectory.value / ".." / ".." / "api-schema").toGlob / **)
sbt:reportingHttpApi> show openApiGenerate / fileInputs
[info] * /[myproject]/reporting/http-api/../../api-schema/**
[info] * /[myproject]/reporting/http-api/test.txt

Running ~openApiGenerate and then editing any of the real input files under api-schema does not trigger a rebuild, while editing test.txt triggers it fine.

I've tried adding into watchTriggers too, but that doesn't help.

Is there anyway to fix this without relying on soft links?

Viktor Hedefalk
  • 3,572
  • 3
  • 33
  • 48

1 Answers1

0

Relative files outside the subproject doesn't seem to work in any way I've tried but for my use case it was easy enough to just use ThisBuild to get the root:

openApiAllInputFiles := Seq((ThisBuild / baseDirectory).value / "api-schema").toGlob / **)
Viktor Hedefalk
  • 3,572
  • 3
  • 33
  • 48