From 8d60b10e5a14ac63709badde8cd4b58fc7c0da65 Mon Sep 17 00:00:00 2001 From: Steve Etherington Date: Fri, 5 Jan 2024 14:46:50 +0000 Subject: [PATCH 1/6] Issue 190 - use fully qualified names for fixed types to handle potential name clashes. --- .../scala/matchers/DefaultParamMatcher.scala | 3 +- .../src/main/scala/matchers/TypeMatcher.scala | 3 +- avrohugger-core/src/test/avro/fixed_two.avsc | 25 ++++++++++++ .../specific/example/fixedtwo/FixedTwo.scala | 40 +++++++++++++++++++ .../specific/example/fixedtwo/one/fixed.scala | 24 +++++++++++ .../specific/example/fixedtwo/two/fixed.scala | 24 +++++++++++ .../specific/example/logical/LogicalSc.scala | 6 +-- .../example/logical/LogicalSc.scala | 2 +- .../standard/example/logical/LogicalSc.scala | 2 +- .../example/shanested/foo/HashRecord.scala | 2 +- .../example/sharecord/HashRecord.scala | 2 +- .../specific/SpecificFileToFileSpec.scala | 18 ++++++++- 12 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 avrohugger-core/src/test/avro/fixed_two.avsc create mode 100644 avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala create mode 100644 avrohugger-core/src/test/expected/specific/example/fixedtwo/one/fixed.scala create mode 100644 avrohugger-core/src/test/expected/specific/example/fixedtwo/two/fixed.scala diff --git a/avrohugger-core/src/main/scala/matchers/DefaultParamMatcher.scala b/avrohugger-core/src/main/scala/matchers/DefaultParamMatcher.scala index 12088ff9..e496c537 100644 --- a/avrohugger-core/src/main/scala/matchers/DefaultParamMatcher.scala +++ b/avrohugger-core/src/main/scala/matchers/DefaultParamMatcher.scala @@ -65,7 +65,8 @@ object DefaultParamMatcher { } case Schema.Type.NULL => NULL case Schema.Type.FIXED => - REF(classStore.generatedClasses(avroSchema)).APPLY(CustomDefaultParamMatcher.checkCustomDecimalType( + val name = RootClass.newClass(s"${avroSchema.getNamespace()}.${classStore.generatedClasses(avroSchema)}") + REF(name).APPLY(CustomDefaultParamMatcher.checkCustomDecimalType( decimalType = typeMatcher.avroScalaTypes.decimal, schema = avroSchema, default = ArrayClass.APPLY())) diff --git a/avrohugger-core/src/main/scala/matchers/TypeMatcher.scala b/avrohugger-core/src/main/scala/matchers/TypeMatcher.scala index acd5a4c4..b0c9ee35 100644 --- a/avrohugger-core/src/main/scala/matchers/TypeMatcher.scala +++ b/avrohugger-core/src/main/scala/matchers/TypeMatcher.scala @@ -68,7 +68,8 @@ class TypeMatcher( default = StringClass) { case UUID => RootClass.newClass(nme.createNameType("java.util.UUID")) } - case Schema.Type.FIXED => classStore.generatedClasses(schema) + case Schema.Type.FIXED => + RootClass.newClass(s"${schema.getNamespace()}.${classStore.generatedClasses(schema)}") case Schema.Type.BYTES => CustomTypeMatcher.checkCustomDecimalType(avroScalaTypes.decimal, schema) case Schema.Type.RECORD => { diff --git a/avrohugger-core/src/test/avro/fixed_two.avsc b/avrohugger-core/src/test/avro/fixed_two.avsc new file mode 100644 index 00000000..14581ff5 --- /dev/null +++ b/avrohugger-core/src/test/avro/fixed_two.avsc @@ -0,0 +1,25 @@ +{ + "type": "record", + "name": "FixedTwo", + "namespace": "fixedtwo", + "fields": [ + { + "name": "first", + "type": { + "type": "fixed", + "name": "fixed", + "namespace": "fixedtwo.one", + "size": 16 + } + }, + { + "name": "second", + "type": { + "type": "fixed", + "name": "fixed", + "namespace": "fixedtwo.two", + "size": 16 + } + } + ] +} diff --git a/avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala b/avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala new file mode 100644 index 00000000..4b4cc076 --- /dev/null +++ b/avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala @@ -0,0 +1,40 @@ +/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */ +package fixedtwo + +import scala.annotation.switch + +import fixedtwo.two.fixed + +import fixedtwo.one.fixed + +final case class FixedTwo(var first: fixedtwo.one.fixed, var second: fixedtwo.two.fixed) extends org.apache.avro.specific.SpecificRecordBase { + def this() = this(fixedtwo.one.fixed(Array()), fixedtwo.two.fixed(Array())) + def get(field$: Int): AnyRef = { + (field$: @switch) match { + case 0 => { + first + }.asInstanceOf[AnyRef] + case 1 => { + second + }.asInstanceOf[AnyRef] + case _ => new org.apache.avro.AvroRuntimeException("Bad index") + } + } + def put(field$: Int, value: Any): Unit = { + (field$: @switch) match { + case 0 => this.first = { + value + }.asInstanceOf[fixedtwo.one.fixed] + case 1 => this.second = { + value + }.asInstanceOf[fixedtwo.two.fixed] + case _ => new org.apache.avro.AvroRuntimeException("Bad index") + } + () + } + def getSchema: org.apache.avro.Schema = fixedtwo.FixedTwo.SCHEMA$ +} + +object FixedTwo { + val SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"FixedTwo\",\"namespace\":\"fixedtwo\",\"fields\":[{\"name\":\"first\",\"type\":{\"type\":\"fixed\",\"name\":\"fixed\",\"namespace\":\"fixedtwo.one\",\"size\":16}},{\"name\":\"second\",\"type\":{\"type\":\"fixed\",\"name\":\"fixed\",\"namespace\":\"fixedtwo.two\",\"size\":16}}]}") +} \ No newline at end of file diff --git a/avrohugger-core/src/test/expected/specific/example/fixedtwo/one/fixed.scala b/avrohugger-core/src/test/expected/specific/example/fixedtwo/one/fixed.scala new file mode 100644 index 00000000..97935038 --- /dev/null +++ b/avrohugger-core/src/test/expected/specific/example/fixedtwo/one/fixed.scala @@ -0,0 +1,24 @@ +/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */ +package fixedtwo.one + +final case class fixed() extends org.apache.avro.specific.SpecificFixed { + def getSchema: org.apache.avro.Schema = fixedtwo.one.fixed.SCHEMA$ + def readExternal(in: java.io.ObjectInput): Unit = { + fixedtwo.one.fixed.READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)) + () + } + def writeExternal(out: java.io.ObjectOutput): Unit = { + fixedtwo.one.fixed.WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out)) + } +} + +object fixed { + val SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"fixed\",\"name\":\"fixed\",\"namespace\":\"fixedtwo.one\",\"size\":16}") + val READER$ = new org.apache.avro.specific.SpecificDatumReader[fixed](fixedtwo.one.fixed.SCHEMA$) + val WRITER$ = new org.apache.avro.specific.SpecificDatumWriter[fixed](fixedtwo.one.fixed.SCHEMA$) + def apply(data: Array[Byte]): fixed = { + val fixed = new fixedtwo.one.fixed() + fixed.bytes(data) + fixed + } +} \ No newline at end of file diff --git a/avrohugger-core/src/test/expected/specific/example/fixedtwo/two/fixed.scala b/avrohugger-core/src/test/expected/specific/example/fixedtwo/two/fixed.scala new file mode 100644 index 00000000..21c3a0cc --- /dev/null +++ b/avrohugger-core/src/test/expected/specific/example/fixedtwo/two/fixed.scala @@ -0,0 +1,24 @@ +/** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */ +package fixedtwo.two + +final case class fixed() extends org.apache.avro.specific.SpecificFixed { + def getSchema: org.apache.avro.Schema = fixedtwo.two.fixed.SCHEMA$ + def readExternal(in: java.io.ObjectInput): Unit = { + fixedtwo.two.fixed.READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)) + () + } + def writeExternal(out: java.io.ObjectOutput): Unit = { + fixedtwo.two.fixed.WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out)) + } +} + +object fixed { + val SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"fixed\",\"name\":\"fixed\",\"namespace\":\"fixedtwo.two\",\"size\":16}") + val READER$ = new org.apache.avro.specific.SpecificDatumReader[fixed](fixedtwo.two.fixed.SCHEMA$) + val WRITER$ = new org.apache.avro.specific.SpecificDatumWriter[fixed](fixedtwo.two.fixed.SCHEMA$) + def apply(data: Array[Byte]): fixed = { + val fixed = new fixedtwo.two.fixed() + fixed.bytes(data) + fixed + } +} \ No newline at end of file diff --git a/avrohugger-core/src/test/expected/specific/example/logical/LogicalSc.scala b/avrohugger-core/src/test/expected/specific/example/logical/LogicalSc.scala index dccff297..a93ed041 100644 --- a/avrohugger-core/src/test/expected/specific/example/logical/LogicalSc.scala +++ b/avrohugger-core/src/test/expected/specific/example/logical/LogicalSc.scala @@ -3,8 +3,8 @@ package example.logical import scala.annotation.switch -final case class LogicalSc(var data: BigDecimal, var fxField: fxType, var ts: java.time.Instant, var dt: java.time.LocalDate, var uuid: java.util.UUID, var dataBig: BigDecimal, var tm: java.time.LocalTime, var timeMicros: java.time.LocalTime, var timestampMicros: java.time.ZonedDateTime, var localTimestampMicros: java.time.LocalDateTime, var localTimestampMillis: java.time.LocalDateTime) extends org.apache.avro.specific.SpecificRecordBase { - def this() = this(scala.math.BigDecimal(0), fxType(scala.math.BigDecimal(0)), java.time.Instant.now, java.time.LocalDate.now, java.util.UUID.randomUUID, scala.math.BigDecimal(0), java.time.LocalTime.now, java.time.LocalTime.MIDNIGHT, java.time.ZonedDateTime.of(java.time.LocalDateTime.MIN, java.time.ZoneId.of("UTC")), java.time.LocalDateTime.MIN, java.time.LocalDateTime.MIN) +final case class LogicalSc(var data: BigDecimal, var fxField: example.logical.fxType, var ts: java.time.Instant, var dt: java.time.LocalDate, var uuid: java.util.UUID, var dataBig: BigDecimal, var tm: java.time.LocalTime, var timeMicros: java.time.LocalTime, var timestampMicros: java.time.ZonedDateTime, var localTimestampMicros: java.time.LocalDateTime, var localTimestampMillis: java.time.LocalDateTime) extends org.apache.avro.specific.SpecificRecordBase { + def this() = this(scala.math.BigDecimal(0), example.logical.fxType(scala.math.BigDecimal(0)), java.time.Instant.now, java.time.LocalDate.now, java.util.UUID.randomUUID, scala.math.BigDecimal(0), java.time.LocalTime.now, java.time.LocalTime.MIDNIGHT, java.time.ZonedDateTime.of(java.time.LocalDateTime.MIN, java.time.ZoneId.of("UTC")), java.time.LocalDateTime.MIN, java.time.LocalDateTime.MIN) def get(field$: Int): AnyRef = { (field$: @switch) match { case 0 => { @@ -83,7 +83,7 @@ final case class LogicalSc(var data: BigDecimal, var fxField: fxType, var ts: ja }.asInstanceOf[BigDecimal] case 1 => this.fxField = { value - }.asInstanceOf[fxType] + }.asInstanceOf[example.logical.fxType] case 2 => this.ts = { value match { case (l: Long) => { diff --git a/avrohugger-core/src/test/expected/standard-tagged/example/logical/LogicalSc.scala b/avrohugger-core/src/test/expected/standard-tagged/example/logical/LogicalSc.scala index 1134732f..1c188271 100644 --- a/avrohugger-core/src/test/expected/standard-tagged/example/logical/LogicalSc.scala +++ b/avrohugger-core/src/test/expected/standard-tagged/example/logical/LogicalSc.scala @@ -3,4 +3,4 @@ package example.logical import shapeless.tag.@@ -final case class LogicalSc(data: @@[scala.math.BigDecimal, (shapeless.Nat._9, shapeless.Nat._2)], fxField: fxType, ts: java.time.Instant, dt: java.time.LocalDate, uuid: java.util.UUID, dataBig: @@[scala.math.BigDecimal, ((shapeless.Nat._2, shapeless.Nat._0), (shapeless.Nat._1, shapeless.Nat._2))], tm: java.time.LocalTime, timeMicros: java.time.LocalTime, timestampMicros: java.time.ZonedDateTime, localTimestampMicros: java.time.LocalDateTime, localTimestampMillis: java.time.LocalDateTime) \ No newline at end of file +final case class LogicalSc(data: @@[scala.math.BigDecimal, (shapeless.Nat._9, shapeless.Nat._2)], fxField: example.logical.fxType, ts: java.time.Instant, dt: java.time.LocalDate, uuid: java.util.UUID, dataBig: @@[scala.math.BigDecimal, ((shapeless.Nat._2, shapeless.Nat._0), (shapeless.Nat._1, shapeless.Nat._2))], tm: java.time.LocalTime, timeMicros: java.time.LocalTime, timestampMicros: java.time.ZonedDateTime, localTimestampMicros: java.time.LocalDateTime, localTimestampMillis: java.time.LocalDateTime) \ No newline at end of file diff --git a/avrohugger-core/src/test/expected/standard/example/logical/LogicalSc.scala b/avrohugger-core/src/test/expected/standard/example/logical/LogicalSc.scala index c490a52b..a28868b7 100644 --- a/avrohugger-core/src/test/expected/standard/example/logical/LogicalSc.scala +++ b/avrohugger-core/src/test/expected/standard/example/logical/LogicalSc.scala @@ -1,4 +1,4 @@ /** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */ package example.logical -final case class LogicalSc(data: BigDecimal, fxField: fxType, ts: java.time.Instant, dt: java.time.LocalDate, uuid: java.util.UUID, dataBig: BigDecimal, tm: java.time.LocalTime, timeMicros: java.time.LocalTime, timestampMicros: java.time.ZonedDateTime, localTimestampMicros: java.time.LocalDateTime, localTimestampMillis: java.time.LocalDateTime) \ No newline at end of file +final case class LogicalSc(data: BigDecimal, fxField: example.logical.fxType, ts: java.time.Instant, dt: java.time.LocalDate, uuid: java.util.UUID, dataBig: BigDecimal, tm: java.time.LocalTime, timeMicros: java.time.LocalTime, timestampMicros: java.time.ZonedDateTime, localTimestampMicros: java.time.LocalDateTime, localTimestampMillis: java.time.LocalDateTime) \ No newline at end of file diff --git a/avrohugger-core/src/test/expected/standard/example/shanested/foo/HashRecord.scala b/avrohugger-core/src/test/expected/standard/example/shanested/foo/HashRecord.scala index 46823567..10ddc8dc 100644 --- a/avrohugger-core/src/test/expected/standard/example/shanested/foo/HashRecord.scala +++ b/avrohugger-core/src/test/expected/standard/example/shanested/foo/HashRecord.scala @@ -3,4 +3,4 @@ package example.shanested.foo import example.shanested.{Prop, Sha256} -final case class HashRecord(my_hash: Sha256, prop: example.shanested.Prop) \ No newline at end of file +final case class HashRecord(my_hash: example.shanested.Sha256, prop: example.shanested.Prop) \ No newline at end of file diff --git a/avrohugger-core/src/test/expected/standard/example/sharecord/HashRecord.scala b/avrohugger-core/src/test/expected/standard/example/sharecord/HashRecord.scala index 6f94d181..73694ad0 100644 --- a/avrohugger-core/src/test/expected/standard/example/sharecord/HashRecord.scala +++ b/avrohugger-core/src/test/expected/standard/example/sharecord/HashRecord.scala @@ -1,4 +1,4 @@ /** MACHINE-GENERATED FROM AVRO SCHEMA. DO NOT EDIT DIRECTLY */ package example.sharecord -final case class HashRecord(my_hash: Sha256) \ No newline at end of file +final case class HashRecord(my_hash: example.sharecord.Sha256) \ No newline at end of file diff --git a/avrohugger-core/src/test/scala/specific/SpecificFileToFileSpec.scala b/avrohugger-core/src/test/scala/specific/SpecificFileToFileSpec.scala index f3f4d237..3e476290 100644 --- a/avrohugger-core/src/test/scala/specific/SpecificFileToFileSpec.scala +++ b/avrohugger-core/src/test/scala/specific/SpecificFileToFileSpec.scala @@ -49,7 +49,8 @@ class SpecificFileToFileSpec extends Specification { correctly generate logical types with custom date, timestamp and time types $e27 correctly generate a protocol with special strings $e28 - correcty generate a simple case class with a wildcarded custom namespace $e29 + correctly generate a simple case class with a wildcarded custom namespace $e29 + correctly handle namespaces for complex types $e30 """ // correctly generate logical types from IDL $e26 @@ -433,4 +434,19 @@ class SpecificFileToFileSpec extends Specification { sourceTrait === util.Util.readFile("avrohugger-core/src/test/expected/specific/example/protocol/Mail.scala") sourceRecord === util.Util.readFile("avrohugger-core/src/test/expected/specific/example/protocol/Message.scala") } + + def e30 = { + val infile = new java.io.File("avrohugger-core/src/test/avro/fixed_two.avsc") + val gen = new Generator(SpecificRecord) + val outDir = gen.defaultOutputDir + "/specific/" + gen.fileToFile(infile, outDir) + + val source1 = util.Util.readFile("target/generated-sources/specific/fixedtwo/FixedTwo.scala") + val source2 = util.Util.readFile("target/generated-sources/specific/fixedtwo/one/fixed.scala") + val source3 = util.Util.readFile("target/generated-sources/specific/fixedtwo/two/fixed.scala") + + source1 === util.Util.readFile("avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala") and + source2 === util.Util.readFile("avrohugger-core/src/test/expected/specific/example/fixedtwo/one/fixed.scala") and + source3 === util.Util.readFile("avrohugger-core/src/test/expected/specific/example/fixedtwo/two/fixed.scala") + } } From c1e33bca9ca081dd4398b708ad5893427cd35502 Mon Sep 17 00:00:00 2001 From: Steve Etherington Date: Fri, 5 Jan 2024 15:05:30 +0000 Subject: [PATCH 2/6] emotycommit From e6cb8c050582863e45dd265a58a565abe99baaa9 Mon Sep 17 00:00:00 2001 From: Julian Peeters Date: Fri, 5 Jan 2024 19:03:16 -0800 Subject: [PATCH 3/6] Bump to SNAPSHOT --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index afdb599d..433150d6 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val avroVersion = "1.11.3" lazy val commonSettings = Seq( organization := "com.julianpeeters", - version := "2.8.1", + version := "2.8.2-SNAPSHOT", ThisBuild / versionScheme := Some("semver-spec"), scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature"), Test / scalacOptions ++= Seq("-Yrangepos"), From 543b6d92c13ff2061d0a87b19a9cb1e8ecfe1714 Mon Sep 17 00:00:00 2001 From: Julian Peeters Date: Fri, 5 Jan 2024 19:06:27 -0800 Subject: [PATCH 4/6] Remove imports for fixed types Since fixed types are now generated as fully qualified Scala types, there is no longer a need to generate imports for them. --- .../src/main/scala/format/specific/SpecificImporter.scala | 3 +-- .../test/expected/specific/example/fixedtwo/FixedTwo.scala | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/avrohugger-core/src/main/scala/format/specific/SpecificImporter.scala b/avrohugger-core/src/main/scala/format/specific/SpecificImporter.scala index d1d0ad66..1b8d7403 100644 --- a/avrohugger-core/src/main/scala/format/specific/SpecificImporter.scala +++ b/avrohugger-core/src/main/scala/format/specific/SpecificImporter.scala @@ -28,8 +28,7 @@ object SpecificImporter extends Importer { getTopLevelSchemas(schemaOrProtocol, schemaStore, typeMatcher) val recordSchemas = getRecordSchemas(topLevelSchemas) val enumSchemas = getEnumSchemas(topLevelSchemas) - val fixedSchemas = getFixedSchemas(topLevelSchemas) - val userDefinedDeps = getUserDefinedImports(recordSchemas ++ enumSchemas ++ fixedSchemas, currentNamespace, typeMatcher) + val userDefinedDeps = getUserDefinedImports(recordSchemas ++ enumSchemas, currentNamespace, typeMatcher) val shapelessDeps = getShapelessImports(recordSchemas, typeMatcher) val libraryDeps = shapelessDeps diff --git a/avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala b/avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala index 4b4cc076..f133c7ef 100644 --- a/avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala +++ b/avrohugger-core/src/test/expected/specific/example/fixedtwo/FixedTwo.scala @@ -3,10 +3,6 @@ package fixedtwo import scala.annotation.switch -import fixedtwo.two.fixed - -import fixedtwo.one.fixed - final case class FixedTwo(var first: fixedtwo.one.fixed, var second: fixedtwo.two.fixed) extends org.apache.avro.specific.SpecificRecordBase { def this() = this(fixedtwo.one.fixed(Array()), fixedtwo.two.fixed(Array())) def get(field$: Int): AnyRef = { From 3765b4126bd7469513532aa95d13868d8a38ec66 Mon Sep 17 00:00:00 2001 From: Julian Peeters Date: Fri, 5 Jan 2024 19:11:16 -0800 Subject: [PATCH 5/6] Update README --- README.md | 10 +++++----- build.sbt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3c24afb8..87667a62 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ _Note:_ Currently [Treehugger](http://eed3si9n.com/treehugger/comments.html#Scal ##### Get the dependency with: - "com.julianpeeters" %% "avrohugger-core" % "2.8.0" + "com.julianpeeters" %% "avrohugger-core" % "2.8.2" ##### Description: @@ -211,7 +211,7 @@ namespace rewritten. Multiple conflicting wildcards are not permitted. ##### Get the dependency with: - "com.julianpeeters" %% "avrohugger-filesorter" % "2.8.0" + "com.julianpeeters" %% "avrohugger-filesorter" % "2.8.2" ##### Description: @@ -231,17 +231,17 @@ To ensure dependent schemas are compiled in the proper order (thus avoiding `org #### `avrohugger-tools` - Download the avrohugger-tools jar for Scala [2.12](https://search.maven.org/remotecontent?filepath=com/julianpeeters/avrohugger-tools_2.12/2.8.0/avrohugger-tools_2.12-2.8.0-assembly.jar), or Scala [2.13](https://search.maven.org/remotecontent?filepath=com/julianpeeters/avrohugger-tools_2.13/2.8.0/avrohugger-tools_2.13-2.8.0-assembly.jar) (>30MB!) and use it like the avro-tools jar `Usage: [-string] (schema|protocol|datafile) input... outputdir`: + Download the avrohugger-tools jar for Scala [2.12](https://search.maven.org/remotecontent?filepath=com/julianpeeters/avrohugger-tools_2.12/2.8.2/avrohugger-tools_2.12-2.8.2-assembly.jar), or Scala [2.13](https://search.maven.org/remotecontent?filepath=com/julianpeeters/avrohugger-tools_2.13/2.8.2/avrohugger-tools_2.13-2.8.2-assembly.jar) (>30MB!) and use it like the avro-tools jar `Usage: [-string] (schema|protocol|datafile) input... outputdir`: * `generate` generates Scala case class definitions: -`java -jar /path/to/avrohugger-tools_2.12-2.8.0-assembly.jar generate schema user.avsc . ` +`java -jar /path/to/avrohugger-tools_2.12-2.8.2-assembly.jar generate schema user.avsc . ` * `generate-specific` generates definitions that extend Avro's `SpecificRecordBase`: -`java -jar /path/to/avrohugger-tools_2.12-2.8.0-assembly.jar generate-specific schema user.avsc . ` +`java -jar /path/to/avrohugger-tools_2.12-2.8.2-assembly.jar generate-specific schema user.avsc . ` ## Warnings diff --git a/build.sbt b/build.sbt index 433150d6..94f9e76d 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val avroVersion = "1.11.3" lazy val commonSettings = Seq( organization := "com.julianpeeters", - version := "2.8.2-SNAPSHOT", + version := "2.8.2", ThisBuild / versionScheme := Some("semver-spec"), scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature"), Test / scalacOptions ++= Seq("-Yrangepos"), From fe909cbc26b4e195b15bd16e39e48108d467e067 Mon Sep 17 00:00:00 2001 From: Julian Peeters Date: Fri, 5 Jan 2024 19:18:50 -0800 Subject: [PATCH 6/6] Bump sbt version in build.properties --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index e8a1e246..8cf07b7c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.7 +sbt.version=1.9.8 \ No newline at end of file