diff --git a/README.md b/README.md index 48bdf75..39c9765 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ libraryDependencies += "org.apache.avro" % "avro" % "1.9.2" | Name | Default | Description | |:-------------------------------|:----------------------------------|:------------| | `avroSource` | `sourceDirectory` / `avro` | Source directory with `*.avsc`, `*.avdl` and `*.avpr` files. | -| `avroGeneratedSource` | `sourceManaged` / `compiled_avro` | Source directory for generated `.java` files. | +| `avroGenerated / target` | `sourceManaged` / `compiled_avro` | Source directory for generated `.java` files. | | `avroStringType` | `CharSequence` | Type for representing strings. Possible values: `CharSequence`, `String`, `Utf8`. | | `avroUseNamespace` | `false` | Validate that directory layout reflects namespaces, i.e. `src/main/avro/com/myorg/MyRecord.avsc`. | | `avroFieldVisibility` | `public_deprecated` | Field Visibility for the properties. Possible values: `private`, `public`, `public_deprecated`. | diff --git a/src/main/scala/sbtavro/SbtAvro.scala b/src/main/scala/sbtavro/SbtAvro.scala index dbe86dc..b8dec8b 100644 --- a/src/main/scala/sbtavro/SbtAvro.scala +++ b/src/main/scala/sbtavro/SbtAvro.scala @@ -28,14 +28,14 @@ object SbtAvro extends AutoPlugin { val avroFieldVisibility = settingKey[String]("Field visibility for the properties. Possible values: private, public, public_deprecated. Default: public_deprecated.") val avroUseNamespace = settingKey[Boolean]("Validate that directory layout reflects namespaces, i.e. src/main/avro/com/myorg/MyRecord.avsc.") val avroSource = settingKey[File]("Default Avro source directory.") - val avroGeneratedSource = settingKey[File]("Default Avro generated source directory.") val avroGenerate = taskKey[Seq[File]]("Generate Java sources for Avro schemas.") // settings to be applied for both Compile and Test lazy val configScopedSettings: Seq[Setting[_]] = Seq( avroSource := sourceDirectory.value / "avro", - avroGeneratedSource := sourceManaged.value / "compiled_avro", + avroGenerate / target := sourceManaged.value / "compiled_avro", + sourceDirectories += (avroGenerate / target).value, // source generation avroGenerate := sourceGeneratorTask(avroGenerate).value, @@ -135,7 +135,7 @@ object SbtAvro extends AutoPlugin { private def sourceGeneratorTask(key: TaskKey[Seq[File]]) = Def.task { val out = (key / streams).value val srcDir = (key / avroSource).value - val outDir = (key / avroGeneratedSource).value + val outDir = (key / avroGenerate / target).value val strType = avroStringType.value val fieldVis = avroFieldVisibility.value val enbDecimal = avroEnableDecimalLogicalType.value diff --git a/src/sbt-test/sbt-avro/settings/build.sbt b/src/sbt-test/sbt-avro/settings/build.sbt index fb9c7bc..f4cac7f 100644 --- a/src/sbt-test/sbt-avro/settings/build.sbt +++ b/src/sbt-test/sbt-avro/settings/build.sbt @@ -8,4 +8,4 @@ libraryDependencies ++= Seq( avroStringType := "String" avroFieldVisibility := "public" (Compile / avroSource) := (Compile / sourceDirectory).value / "avro_source" -(Compile / avroGeneratedSource) := (Compile / sourceManaged).value / "avro" +(Compile / avroGenerate / target) := (Compile / sourceManaged).value / "avro"