From 05f943bce3f015abf7af31b1923e326429640274 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Sat, 17 Sep 2022 10:14:28 +0200 Subject: [PATCH 1/9] Add latest released version to binary compat checks (#48) Pull request: https://github.com/com-lihaoyi/geny/pull/48 --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index be32d84..cd3785a 100644 --- a/build.sc +++ b/build.sc @@ -22,7 +22,7 @@ val scalaNativeVersions = scalaVersions.map((_, "0.4.5")) trait MimaCheck extends Mima { - override def mimaPreviousVersions = Seq("0.6.7", "0.6.8", "0.6.9", "0.6.10", "0.7.0", "0.7.1") + override def mimaPreviousVersions = Seq("0.6.7", "0.6.8", "0.6.9", "0.6.10", "0.7.0", "0.7.1", "1.0.0") // Temporary until the next version of Mima gets released with // https://github.com/lightbend/mima/issues/693 included in the release. From 542b2785de3b648f5efbe9ab591b2d6156bc9ffb Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Tue, 20 Sep 2022 14:54:58 +0200 Subject: [PATCH 2/9] Added more versions to mima checks (#49) Updated mill-mima to 0.0.13. Not all previous versions were released for all supported platforms, so we don't check against all older versions for some platforms. Pull request: https://github.com/com-lihaoyi/geny/pull/49 --- build.sc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/build.sc b/build.sc index cd3785a..fb228e3 100644 --- a/build.sc +++ b/build.sc @@ -1,6 +1,6 @@ // plugins import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.2.0` -import $ivy.`com.github.lolgab::mill-mima::0.0.12` +import $ivy.`com.github.lolgab::mill-mima::0.0.13` // imports import mill._, scalalib._, scalajslib._, scalanativelib._, publish._ @@ -22,13 +22,18 @@ val scalaNativeVersions = scalaVersions.map((_, "0.4.5")) trait MimaCheck extends Mima { - override def mimaPreviousVersions = Seq("0.6.7", "0.6.8", "0.6.9", "0.6.10", "0.7.0", "0.7.1", "1.0.0") - - // Temporary until the next version of Mima gets released with - // https://github.com/lightbend/mima/issues/693 included in the release. - override def mimaPreviousArtifacts = T{ - if (ZincWorkerUtil.isScala3(scalaVersion())) Agg.empty[Dep] - else super.mimaPreviousArtifacts() + override def mimaPreviousVersions = T{ + val sv = scalaVersion() + val is3 = ZincWorkerUtil.isScala3(sv) + val is211 = sv.startsWith("2.11.") + val isNative = this.isInstanceOf[ScalaNativeModule] + Seq( + Seq("0.6.0", "0.6.2").filter(_ => !is3 && !is211 && !isNative), + Seq("0.6.4", "0.6.5", "0.6.6").filter(_ => !is3 && !is211), + Seq("0.6.7", "0.6.8", "0.6.9").filter(_ => !is3), + Seq("0.6.10", "0.7.0").filter(_ => !is3 || !isNative), + Seq("0.7.1", "1.0.0") + ).flatten } override def mimaBinaryIssueFilters: T[Seq[ProblemFilter]] = Seq( From 213637d28d1a1d92a3dcb609ded55863f9d3c8c1 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 26 Oct 2022 10:27:38 +0200 Subject: [PATCH 3/9] Update mill-main to 0.10.8 (#50) Pull request: https://github.com/com-lihaoyi/geny/pull/50 --- .mill-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mill-version b/.mill-version index a988815..933f18d 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.10.7 \ No newline at end of file +0.10.8 \ No newline at end of file From 1c690036fa9018e543328f8d50509bf44cafa362 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 26 Oct 2022 10:28:27 +0200 Subject: [PATCH 4/9] Update de.tobiasroeser.mill.vcs.version to 0.3.0 (#51) Pull request: https://github.com/com-lihaoyi/geny/pull/51 --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index fb228e3..05b0ced 100644 --- a/build.sc +++ b/build.sc @@ -1,5 +1,5 @@ // plugins -import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.2.0` +import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.3.0` import $ivy.`com.github.lolgab::mill-mima::0.0.13` // imports From 751c6c8a02f15ee299d8b2af91838aabd2bc8818 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Fri, 4 Nov 2022 15:19:07 +0100 Subject: [PATCH 5/9] Converted Readme to Asciidoc(tor), fixed links (#52) Pull request: https://github.com/com-lihaoyi/geny/pull/52 --- readme.md => Readme.adoc | 367 ++++++++++++++++++++------------------- 1 file changed, 188 insertions(+), 179 deletions(-) rename readme.md => Readme.adoc (65%) diff --git a/readme.md b/Readme.adoc similarity index 65% rename from readme.md rename to Readme.adoc index 93d441c..fc0f382 100644 --- a/readme.md +++ b/Readme.adoc @@ -1,29 +1,42 @@ -Geny 1.0.0 -========== += Geny +:version: 1.0.0 +:toc-placement: preamble +:toc: +:link-geny: https://github.com/com-lihaoyi/geny +:link-oslib: https://github.com/com-lihaoyi/os-lib +:link-upickle: https://github.com/com-lihaoyi/upickle +:link-scalatags: https://github.com/com-lihaoyi/scalatags +:link-requests: https://github.com/lihaoyi/requests-scala +:link-cask: https://github.com/com-lihaoyi/cask +:link-fastparse: https://github.com/com-lihaoyi/fastparse +:idprefix: +:idseparator: - +:example-scalatags-version: 0.12.0 + +[source,scala,subs="attributes,verbatim"] +---- +// Mill +ivy"com.lihaoyi::geny:{version}" +ivy"com.lihaoyi::geny::{version}" // Scala.js / Native -```scala // SBT -"com.lihaoyi" %% "geny" % "1.0.0" -"com.lihaoyi" %%% "geny" % "1.0.0" // Scala.js / Native - -// Mill -ivy"com.lihaoyi::geny:1.0.0" -ivy"com.lihaoyi::geny::1.0.0" // Scala.js / Native -``` +"com.lihaoyi" %% "geny" % "{version}" +"com.lihaoyi" %%% "geny" % "{version}" // Scala.js / Native +---- Geny is a small library that provides push-based versions of common standard library interfaces: -- [geny.Generator[T]](#generator), a push-based version of `scala.Iterator[T]` -- [geny.Writable](#writable), a push-based version of `java.io.InputStream` - - [geny.Readable](#readable), a pull-based subclass of `Writable` +* <>, a push-based version of `scala.Iterator[T]` +* <>, a push-based version of `java.io.InputStream` +* <>, a pull-based subclass of `Writable` More background behind the `Writable` and `Readable` interface can be found in this blog post: -- [Standardizing IO Interfaces for Scala Libraries](http://www.lihaoyi.com/post/StandardizingIOInterfacesforScalaLibraries.html) +* http://www.lihaoyi.com/post/StandardizingIOInterfacesforScalaLibraries.html[Standardizing IO Interfaces for Scala Libraries] -## Generator +== `Generator` `Generator` is basically the inverse of a `scala.Iterator`: instead of the core functionality being the pull-based `hasNext` and `next: T` methods, the core is @@ -32,7 +45,7 @@ with some tweaks. Unlike a `scala.Iterator`, subclasses of `Generator` can guarantee any clean up logic is performed by placing it after the `generate` call is made. This is -useful for using `Generator`s to model streaming data from files or other +useful for using ``Generator``s to model streaming data from files or other sources that require cleanup: the most common alternative, `scala.Iterator`, has no way of guaranteeing that the file gets properly closed after reading. Even so called "self-closing iterators" that close the file after the iterator @@ -48,11 +61,13 @@ Geny is intentionally a tiny library with one file and zero dependencies, so you can depend on it (or even copy-paste it into your project) without fear of taking on unknown heavyweight dependencies. -### Construction -The two simplest ways to construct a `Generator` are via the `Generator(...)` +=== Construction + +The two simplest ways to construct a `Generator` are via the `+Generator(...)+` and `Generator.from` constructors: -```scala +[source,scala] +---- import geny.Generator scala> Generator(0, 1, 2) @@ -60,14 +75,15 @@ res1: geny.Generator[Int] = Generator(WrappedArray(0, 1, 2)) scala> Generator.from(Seq(1, 2, 3)) // pass in any iterable or iterator res2: geny.Generator[Int] = Generator(List(1, 2, 3)) -``` +---- If you need a `Generator` for a source that needs cleanup (closing file-handles, database connections, etc.) you can use the `Generator.selfClosing` constructor: -```scala -scala> class DummyCloseableSource{ +[source,scala] +---- +scala> class DummyCloseableSource { | val iterator = Iterator(1, 2, 3, 4, 5, 6, 7, 8, 9) | var closed = false | def close() = { @@ -76,23 +92,22 @@ scala> class DummyCloseableSource{ | } defined class DummyCloseableSource -scala> val g = Generator.selfClosing{ +scala> val g = Generator.selfClosing { | val closeable = new DummyCloseableSource() | (closeable.iterator, () => closeable.close()) | } g: geny.Generator[Int] = Gen.SelfClosing(...) -``` +---- This constructor takes a block that will be called to generate a tuple of an -`Iterator[T]` and a cleanup function of type `() => Unit`. Each time the +`Iterator[T]` and a cleanup function of type `+() => Unit+`. Each time the `Generator` is evaluated: -- A new pair of `(Iterator[T], () => Unit)` is created using this block -- The iterator is used to generate however many elements are necessary -- the cleanup function is called. - +* A new pair of `+(Iterator[T], () => Unit)+` is created using this block +* The iterator is used to generate however many elements are necessary +* the cleanup function is called. -### Terminal Operations +=== Terminal Operations Transformations on a `Generator` are lazy: calling methods like `filter` or `map` do not evaluate the entire Generator, but instead construct a new @@ -104,7 +119,8 @@ similar. In this way, `Generator` behaves similarly to `Iterator`, whose Terminal operations include the following: -```scala +[source,scala] +---- scala> Generator(0, 1, 2).toSeq res3: Seq[Int] = ArrayBuffer(0, 1, 2) @@ -122,39 +138,42 @@ res7: Int = 2 scala> Generator(0, 1, 2).forall(_ >= 0) res8: Boolean = true -``` +---- Overall, they behave mostly the same as on the standard Scala collections. Not every method is supported, but even those that aren't provided can easily be re-implemented using `foreach` and the other methods available. -### Transformations +=== Transformations Transformations on a `Generator` are lazy: they do not immediately return a result, and only build up a computation: -```scala +[source,scala] +---- scala> Generator(0, 1, 2).map(_ + 1) res9: geny.Generator[Int] = Generator(WrappedArray(0, 1, 2)).map() -scala> Generator(0, 1, 2).map{x => println(x); x + 1} +scala> Generator(0, 1, 2).map { x => println(x); x + 1 } res10: geny.Generator[Int] = Generator(WrappedArray(0, 1, 2)).map() -``` +---- This computation will be evaluated when one of the -[Terminal Operation](#terminal-operation)s described above is called: +<>s described above is called: -```scala +[source,scala] +---- scala> res10.toSeq 0 1 2 res11: Seq[Int] = ArrayBuffer(1, 2, 3) -``` +---- Most of the common operations on the Scala collections are supported: -```scala +[source,scala] +---- scala> (Generator(0, 1, 2).filter(_ % 2 == 0).map(_ * 2).drop(2) ++ Generator(5, 6, 7).map(_.toString.toSeq).flatMap(x => x)) res12: geny.Generator[AnyVal] = Generator(WrappedArray(0, 1, 2)).filter().map().slice(2, 2147483647) ++ Generator(WrappedArray(5, 6, 7)).map().map() @@ -167,9 +186,9 @@ res14: geny.Generator[(Char, Int)] = Generator(WrappedArray(0, 1, 2, 3, 4, 5, 6, scala> res14.toVector res15: Vector[(Char, Int)] = Vector((0,0), (1,1), (3,3), (4,4), (5,5)) -``` +---- -As you can see, you can `flatMap`, `filter`, `map`, `drop`, `takeWhile`, `++` +As you can see, you can `flatMap`, `filter`, `map`, `drop`, `takeWhile`, `pass:c[++]` and call other methods on the `Generator`, and it simply builds up the computation without running it. Only when a terminal operation like `toSeq` or `toVector` is called is it finally evaluated into a result. @@ -181,19 +200,20 @@ evaluate any preceding transformations multiple times. If you do not want this to be the case, call `.toSeq` to turn it into a concrete sequence and work with that. -### Self Closing Generators +=== Self Closing Generators One major use case of `geny.Generator` is to ensure resources involved in streaming results from some external source get properly cleaned up. For example, using `scala.io.Source`, we can get a `scala.Iterator` over the lines of a file. For example, you may define a helper function like this: -```scala +[source,scala] +---- def getFileLines(path: String): Iterator[String] = { val s = scala.io.Source.fromFile(path)(charSet) s.getLines() } -``` +---- However, this is incorrect: you never close the source `s`, and thus if you call this lots of times, you end up leaving tons of open file handles! If you @@ -209,49 +229,53 @@ possibility that the caller will use `.head` or `.take` on the iterator: a perfectly reasonable thing to do if you don't need all the output, but one that would leave a "self-closing" iterator open and still leaking file handles. -Using `geny.Generator`s, the helper function can instead return a +Using ``geny.Generator``s, the helper function can instead return a `Generator.selfClosing`: -```scala -def getFileLines(path: String): geny.Generator[String] = Generator.selfClosing{ +[source,scala] +---- +def getFileLines(path: String): geny.Generator[String] = Generator.selfClosing { val s = scala.io.Source.fromFile(path)(charSet) (s.getLines(), () => s.close()) } -``` +---- The caller can then use normal collection operations on the returned `geny.Generator`: `map` it, `filter` it, `take`, `toSeq`, etc. and it will always be properly opened when a terminal operation is called, the required operations performed, and properly closed when everything is done. -## Writable +== `Writable` `geny.Writable` is a minimal interface that can be implemented by any data type that writes binary output to a `java.io.OutputStream`: -```scala -trait Writable{ +[source,scala] +---- +trait Writable { def writeBytesTo(out: OutputStream): Unit } -``` +---- `Writable` allows for zero-friction zero-overhead streaming data exchange -between these libraries, e.g. allowing you pass Scalatags `Frag`s directly +between these libraries, e.g. allowing you pass Scalatags ``Frag``s directly `os.write`: -```scala -@ import $ivy.`com.lihaoyi::scalatags:0.8.0`, scalatags.Text.all._ +[source,scala,subs="attributes,verbatim"] +---- +@ import $ivy.`com.lihaoyi::scalatags:{example-scalatags-version}`, scalatags.Text.all._ import $ivy.$ , scalatags.Text.all._ @ os.write(os.pwd / "hello.html", html(body(h1("Hello"), p("World!")))) @ os.read(os.pwd / "hello.html") res1: String = "

Hello

World!

" -``` +---- -Sending `ujson.Value`s directly to `requests.post` +Sending ``ujson.Value``s directly to `requests.post` -```scala +[source,scala] +---- @ requests.post("https://httpbin.org/post", data = ujson.Obj("hello" -> 1)) @ res2.text @@ -261,27 +285,29 @@ res3: String = """{ "files": {}, "form": {}, ... -``` +---- Serialize Scala data types directly to disk: -```scala +[source,scala] +---- @ os.write(os.pwd / "two.json", upickle.default.stream(Map((1, 2) -> (3, 4), (5, 6) -> (7, 8)))) @ os.read(os.pwd / "two.json") res5: String = "[[[1,2],[3,4]],[[5,6],[7,8]]]" -``` +---- Or streaming file uploads over HTTP: -```scala +[source,scala] +---- @ requests.post("https://httpbin.org/post", data = os.read.stream(os.pwd / "two.json")).text res6: String = """{ "args": {}, "data": "[[[1,2],[3,4]],[[5,6],[7,8]]]", "files": {}, "form": {}, -``` +---- All this data exchange happens efficiently in a streaming fashion, without unnecessarily buffering data in-memory. @@ -292,56 +318,51 @@ resources) and is much easier to implement than `java.io.InputStream`. Writable has implicit constructors from the following types: -- `String` -- `Array[Byte]` -- `java.io.InputStream` +* `String` +* `Array[Byte]` +* `java.io.InputStream` And implemented by the following libraries: -- [uPickle](https://github.com/lihaoyi/upickle): implemented by `ujson.Value`, - `upack.Msg`, and can be constructed from JSON-serializable data structures via - `upickle.default.stream` or `upickle.default.writableBinary` - -- [Scalatags](https://github.com/lihaoyi/scalatags): implemented by `scalatags.Text.Tag` - -- [Requests-Scala](https://github.com/lihaoyi/requests-scala): - `requests.get.stream(...)` methods return a [Readable](#readable) subtype of - `Writable` - -- [OS-Lib](https://github.com/lihaoyi/os-lib): `os.read.stream` returns a - [Readable](#readable) subtype of `Writable` - -- [Cask](https://github.com/lihaoyi/cask): `cask.Request` returns a - [Readable](#readable) subtype of `Writable` +* {link-upickle}[uPickle]: implemented by `ujson.Value`, +`upack.Msg`, and can be constructed from JSON-serializable data structures via +`upickle.default.stream` or `upickle.default.writableBinary` +* {link-scalatags}[Scalatags]: implemented by `scalatags.Text.Tag` +* {link-requests}[Requests-Scala]: +`+requests.get.stream(...)+` methods return a <> subtype of +<> +* https://github.com/lihaoyi/os-lib[OS-Lib]: `os.read.stream` returns a +<> subtype of <> +* https://github.com/lihaoyi/cask[Cask]: `cask.Request` returns a +<> subtype of <> And is accepted by the following libraries: -- [Requests-Scala](https://github.com/lihaoyi/requests-scala) takes `Writable` in the - `data =` field of `requests.post` and `requests.put` - -- [OS-Lib](https://github.com/lihaoyi/os-lib) accepts a `Writable` in `os.write` and - the `stdin` parameter of `subprocess.call` or `subprocess.spawn` - -- [Cask](https://github.com/lihaoyi/cask): supports returning a `Writable` - from any Cask endpoint +* {link-requests}[Requests-Scala] takes <> in the +`data =` field of `requests.post` and `requests.put` +* {link-oslib}[OS-Lib] accepts a <> in `os.write` and +the `stdin` parameter of `subprocess.call` or `subprocess.spawn` +* {link-cask}[Cask]: supports returning a <> +from any Cask endpoint Any data type that writes bytes out to a `java.io.OutputStream`, `java.io.Writer`, or `StringBuilder` can be trivially made to implement -`Writable`, which allows it to output data in a streaming fashion without -needing to buffer it in memory. You can also implement `Writable`s in your own +<>, which allows it to output data in a streaming fashion without +needing to buffer it in memory. You can also implement <>s in your own datatypes or accept it in your own method, if you want to inter-operate with this existing ecosystem of libraries. -### Readable +== `Readable` -```scala -trait Readable extends Writable{ +[source,scala] +---- +trait Readable extends Writable { def readBytesThrough[T](f: InputStream => T): T def writeBytesTo(out: OutputStream): Unit = readBytesThrough(Internal.transfer(_, out)) } -```` +---- -`Readable` is a subtype of [Writable](#writable) that provides an additional +`Readable` is a subtype of <> that provides an additional guarantee: not only can it be written to an `java.io.OutputStream`, it can also be read from by providing a `java.io.InputStream`. Note that the `InputStream` is scoped and only available within the `readBytesThrough` callback: after that @@ -350,35 +371,33 @@ file handles, etc.) will be released. `Readable` is supported by the following built in types: -- `String` -- `Array[Byte]` -- `java.io.InputStream` +* `String` +* `Array[Byte]` +* `java.io.InputStream` Implemented by the following libraries -- [Requests-Scala](https://github.com/lihaoyi/requests-scala): - `requests.get.stream(...)` methods return a `Readable` - -- [OS-Lib](https://github.com/lihaoyi/os-lib): `os.read.stream` returns a - `Readable` - -- [Cask](https://github.com/lihaoyi/cask): `cask.Request` implements `Readable` - to allow streaming of request data +* {link-requests}[Requests-Scala]: +`+requests.get.stream(...)+` methods return a <> +* {link-oslib}[OS-Lib]: `os.read.stream` returns a +<> +* {link-cask}[Cask]: `cask.Request` implements <> +to allow streaming of request data And is accepted by the following libraries: -- [uPickle](https://github.com/lihaoyi/upickle): `upickle.default.read`, - `upickle.default.readBinary`, `ujson.read`, and `upack.read` all support - `Readable` - -- [FastParse](https://github.com/lihaoyi/os-lib): `fastparse.parse` accepts - parsing streaming input from any `Readable` +* {link-upickle}[uPickle]: `upickle.default.read`, +`upickle.default.readBinary`, `ujson.read`, and `upack.read` all support +`Readable` +* {link-fastparse}[FastParse]: `fastparse.parse` accepts +parsing streaming input from any `Readable` `Readable` can be used to allow handling of streaming input, e.g. parsing JSON directly from a file or HTTP request, without needing to buffer the whole file in memory: -```scala +[source,scala] +---- @ val data = ujson.read(requests.get.stream("https://api.github.com/events")) data: ujson.Value.Value = Arr( ArrayBuffer( @@ -388,7 +407,7 @@ data: ujson.Value.Value = Arr( "type" -> Str("PushEvent"), "actor" -> Obj( ... -``` +---- You can also implement `Readable` in your own data types, to allow them to be seamlessly passed into uPickle or FastParse to be parsed in a streaming fashion. @@ -399,104 +418,94 @@ penalty over parsing data already in memory, due to the additional book-keeping necessary with streaming data. Whether it is worthwhile or not depends on your particular usage pattern. -Changelog -========= -1.0.0 ------ -- Support Semantic Versioning -- Removed deprecated API +== Changelog + +=== 1.0.0 - 2022-09-15 + +* Support Semantic Versioning +* Removed deprecated API + +=== 0.7.1 - 2022-01-23 + +* Support Scala Native for Scala 3 + +=== 0.7.0 - 2021-12-10 -0.7.1 ------ +_Re-release of 0.6.11_ -- Support Scala Native for Scala 3 +=== Older Versions -0.7.0 ------ +==== 0.6.11 - 2021-11-26 -- Add `httpContentType` to `inputStreamReadable` +* Add `httpContentType` to `inputStreamReadable` +* Improved Build and CI setup +* Added MiMa checks -0.6.10 ------ +==== 0.6.10 - 2021-05-14 -- Add support for Scala 3.0.0 +* Add support for Scala 3.0.0 -0.6.9 ------ +==== 0.6.9 - 2021-04-28 -- Add support for Scala 3.0.0-RC3 +* Add support for Scala 3.0.0-RC3 -0.6.8 ------ +==== 0.6.8 - 2021-04-28 -- Add support for Scala 3.0.0-RC2 +* Add support for Scala 3.0.0-RC2 -0.6.4 ------ +==== 0.6.4 -- Scala-Native 0.4.0 support +* Scala-Native 0.4.0 support -0.6.2 ------ +==== 0.6.2 -- Improve performance of writing small strings via `StringWritable` +* Improve performance of writing small strings via `StringWritable` -0.5.0 ------ +==== 0.5.0 -- Improve streaming of `InputStream`s to `OutputStream`s by dynamically sizing - the transfer buffer. +* Improve streaming of ``InputStream``s to ``OutputStream``s by dynamically sizing +the transfer buffer. -0.4.2 ------ +==== 0.4.2 -- Standardize `geny.Readable` as well +* Standardize `geny.Readable` as well -0.2.0 ------ +==== 0.2.0 -- Added [geny.Writable](#writable) interface +* Added <> interface -0.1.8 ------ +==== 0.1.8 -- Support for Scala 2.13.0 final +* Support for Scala 2.13.0 final -0.1.6 ------ +==== 0.1.6 - 2019-01-15 -- Add scala-native support +* Add scala-native support -0.1.5 ------ +==== 0.1.5 -- Add `.withFilter` +* Add `.withFilter` -0.1.4 ------ +==== 0.1.4 -- Add `.collect`, `.collectFirst`, `.headOption` methods +* Add `.collect`, `.collectFirst`, `.headOption` methods -0.1.3 ------ +==== 0.1.3 -- Allow calling `.count()` without a predicate to count the total number of items - in the generator +* Allow calling `.count()` without a predicate to count the total number of items +in the generator -0.1.2 ------ +==== 0.1.2 -- Add `.reduce`, `.fold`, `.sum`, `.product`, `.min`, `.max`, `.minBy`, `.maxBy` -- Rename `.fromIterable` to `.from`, make it also take `Iterator`s +* Add `.reduce`, `.fold`, `.sum`, `.product`, `.min`, `.max`, `.minBy`, `.maxBy` +* Rename `.fromIterable` to `.from`, make it also take ``Iterator``s -0.1.1 ------ +==== 0.1.1 -- Publish for Scala 2.12.0 +* Publish for Scala 2.12.0 -0.1.0 ------ +==== 0.1.0 -- First release +* First release From e716c680d4512337a5829dfcbbafa34aa1e2f96f Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Fri, 3 Mar 2023 13:21:07 +0100 Subject: [PATCH 6/9] Add scalacOptions for Scala.js Source Maps (#57) --- build.sc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.sc b/build.sc index 05b0ced..4fab418 100644 --- a/build.sc +++ b/build.sc @@ -85,6 +85,17 @@ object geny extends Module { extends Common with ScalaJSModule with GenyPublishModule { def scalaJSVersion = crossJSVersion + private def sourceMapOptions = T.task { + val vcsState = VcsVersion.vcsState() + vcsState.lastTag.collect { + case tag if vcsState.commitsSinceLastTag == 0 => + val baseUrl = pomSettings().url.replace("github.com", "raw.githubusercontent.com") + val sourcesOptionName = if(ZincWorkerUtil.isScala3(crossScalaVersion)) "-scalajs-mapSourceURI" else "-P:scalajs:mapSourceURI" + s"$sourcesOptionName:${T.workspace.toIO.toURI}->$baseUrl/$tag/" + } + } + override def scalacOptions = super.scalacOptions() ++ sourceMapOptions() + object test extends Tests with CommonTestModule } From 332c75d59dae5f3cce0c8c547f8d92da43c6ad36 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 3 Mar 2023 13:23:19 +0100 Subject: [PATCH 7/9] Update mill-main to 0.10.11 (#55) Pull request: https://github.com/com-lihaoyi/geny/pull/55 --- .mill-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mill-version b/.mill-version index 933f18d..25fb08c 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.10.8 \ No newline at end of file +0.10.11 \ No newline at end of file From 43d4238a5d3063146416ad767c69f839bee942be Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 14 Apr 2024 19:46:30 +0800 Subject: [PATCH 8/9] Support Scala-Native 0.5.0, bump minimum versions of Scala 2 and Scala 3 accordingly (#73) This would be the first step in getting the rest of com.lihaoyi out for scala native 0.5.0 Given the version support drops, which version should we bump here? Would it be the major version (i.e. geny 2.0.0), or a minor version (i.e. geny 1.1.0)? I am inclined to make it a minor version, reflecting the fact that Scala 3.1.3 is not LTS so dropping support is not a huge deal --- .mill-version | 2 +- Readme.adoc | 6 ++++++ build.sc | 40 +++++++++++++++------------------------- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.mill-version b/.mill-version index 25fb08c..5e81ce5 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.10.11 \ No newline at end of file +0.11.7-29-f2e220 diff --git a/Readme.adoc b/Readme.adoc index fc0f382..b3e0f60 100644 --- a/Readme.adoc +++ b/Readme.adoc @@ -422,6 +422,12 @@ particular usage pattern. == Changelog +=== master + +* Support for Scala-Native 0.5.0 +* Minimum version of Scala 3 increased from 3.1.3 to 3.3.1 +* Minimum version of Scala 2 increased from 2.11.x to 2.12.x + === 1.0.0 - 2022-09-15 * Support Semantic Versioning diff --git a/build.sc b/build.sc index 4fab418..3b3860e 100644 --- a/build.sc +++ b/build.sc @@ -1,6 +1,6 @@ // plugins -import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.3.0` -import $ivy.`com.github.lolgab::mill-mima::0.0.13` +import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0` +import $ivy.`com.github.lolgab::mill-mima::0.0.23` // imports import mill._, scalalib._, scalajslib._, scalanativelib._, publish._ @@ -11,16 +11,11 @@ import mill.scalalib.api.ZincWorkerUtil val communityBuildDottyVersion = sys.props.get("dottyVersion").toList val scalaVersions = Seq( - "3.1.3", + "3.3.1", "2.13.8", "2.12.17", - "2.11.12" ) ++ communityBuildDottyVersion -val scalaJSVersions = scalaVersions.map((_, "1.10.1")) -val scalaNativeVersions = scalaVersions.map((_, "0.4.5")) - - trait MimaCheck extends Mima { override def mimaPreviousVersions = T{ val sv = scalaVersion() @@ -69,22 +64,18 @@ trait Common extends CrossScalaModule { } trait CommonTestModule extends ScalaModule with TestModule.Utest { - override def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.1") + override def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.3") } object geny extends Module { - object jvm extends Cross[JvmGenyModule](scalaVersions: _*) - class JvmGenyModule(val crossScalaVersion: String) - extends Common with ScalaModule with GenyPublishModule - { - object test extends Tests with CommonTestModule + object jvm extends Cross[JvmGenyModule](scalaVersions) + trait JvmGenyModule extends Common with ScalaModule with GenyPublishModule { + object test extends ScalaTests with CommonTestModule } - object js extends Cross[JSGenyModule](scalaJSVersions: _*) - class JSGenyModule(val crossScalaVersion: String, crossJSVersion: String) - extends Common with ScalaJSModule with GenyPublishModule - { - def scalaJSVersion = crossJSVersion + object js extends Cross[JSGenyModule](scalaVersions) + trait JSGenyModule extends Common with ScalaJSModule with GenyPublishModule { + def scalaJSVersion = "1.12.0" private def sourceMapOptions = T.task { val vcsState = VcsVersion.vcsState() vcsState.lastTag.collect { @@ -96,14 +87,13 @@ object geny extends Module { } override def scalacOptions = super.scalacOptions() ++ sourceMapOptions() - object test extends Tests with CommonTestModule + object test extends ScalaJSTests with CommonTestModule } - object native extends Cross[NativeGenyModule](scalaNativeVersions: _*) - class NativeGenyModule(val crossScalaVersion: String, crossScalaNativeVersion: String) - extends Common with ScalaNativeModule with GenyPublishModule + object native extends Cross[NativeGenyModule](scalaVersions) + trait NativeGenyModule extends Common with ScalaNativeModule with GenyPublishModule { - def scalaNativeVersion = crossScalaNativeVersion - object test extends Tests with CommonTestModule + def scalaNativeVersion = "0.5.0" + object test extends ScalaNativeTests with CommonTestModule } } From a6395edfead4c35a25ae456332c2b990065547a6 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 14 Apr 2024 19:47:15 +0800 Subject: [PATCH 9/9] 1.1.0 --- Readme.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.adoc b/Readme.adoc index b3e0f60..e23c836 100644 --- a/Readme.adoc +++ b/Readme.adoc @@ -1,5 +1,5 @@ = Geny -:version: 1.0.0 +:version: 1.1.0 :toc-placement: preamble :toc: :link-geny: https://github.com/com-lihaoyi/geny @@ -422,7 +422,7 @@ particular usage pattern. == Changelog -=== master +=== 1.1.0 - 2024-04-14 * Support for Scala-Native 0.5.0 * Minimum version of Scala 3 increased from 3.1.3 to 3.3.1