From c879f91656c5c2eae659cacdfcf80dc10e85a636 Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Fri, 17 Jul 2020 16:41:05 +0200 Subject: [PATCH] Add comments on why we are not using srcGenerators with src_managed --- build.sbt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.sbt b/build.sbt index d656972..5000e17 100644 --- a/build.sbt +++ b/build.sbt @@ -9,6 +9,8 @@ lazy val petstoreApi: Project = project .settings( openApiInputSpec := s"${baseDirectory.value.getPath}/petstore.yaml", openApiGeneratorName := "scala-sttp", + //We can't use src_managed because there is no option to tell openapi-generator to generate files into different folder than src + //see https://github.com/OpenAPITools/openapi-generator/issues/6685 for more details openApiOutputDir := baseDirectory.value.name, //Below setting is needed to configure generator not to generate other files besides src/main/scala openApiIgnoreFileOverride := s"${baseDirectory.in(ThisBuild).value.getPath}/openapi-ignore-file", @@ -17,7 +19,11 @@ lazy val petstoreApi: Project = project "com.softwaremill.sttp.client" %% "json4s" % "2.2.0", "org.json4s" %% "json4s-jackson" % "3.6.8" ), + //We can't use sourceGenerators because this requires all files to compile and openapi-generator generates + //some additional metadata files which breaks compilation. + //see https://github.com/OpenAPITools/openapi-generator/issues/6685 for more details (compile in Compile) := ((compile in Compile) dependsOn openApiGenerate).value, + //As we don't generate files into src_managed we have to do cleaning by our own cleanFiles += baseDirectory.value / "src" )