Skip to content

Commit

Permalink
Merge pull request #7 from plokhotnyuk/main
Browse files Browse the repository at this point in the history
Update dependencies, add Scala Native support for circe integration, add jsoniter-scala integration
  • Loading branch information
ybasket authored Sep 30, 2022
2 parents 71f93a6 + a3998ed commit 1592087
Show file tree
Hide file tree
Showing 9 changed files with 490 additions and 183 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.16, 2.13.8, 3.1.3]
java: [temurin@8]
scala: [2.12.17, 2.13.8, 3.2.0]
java: [temurin@11]
project: [rootJS, rootJVM, rootNative]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -38,21 +38,21 @@ jobs:
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8
java-version: 11

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -70,7 +70,7 @@ jobs:
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'temurin@8'
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: scalaJSLink
Expand All @@ -85,20 +85,20 @@ jobs:
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'temurin@8'
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@8'
if: matrix.java == 'temurin@11'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p circe/.jvm/target target polyline/js/target .js/target core/.native/target core/.js/target circe/.js/target core/.jvm/target .jvm/target .native/target polyline/jvm/target polyline/native/target project/target
run: mkdir -p jsoniter-scala/.native/target circe/.jvm/target target polyline/js/target .js/target core/.native/target core/.js/target circe/.js/target core/.jvm/target .jvm/target .native/target polyline/jvm/target circe/.native/target jsoniter-scala/.jvm/target polyline/native/target jsoniter-scala/.js/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar circe/.jvm/target target polyline/js/target .js/target core/.native/target core/.js/target circe/.js/target core/.jvm/target .jvm/target .native/target polyline/jvm/target polyline/native/target project/target
run: tar cf targets.tar jsoniter-scala/.native/target circe/.jvm/target target polyline/js/target .js/target core/.native/target core/.js/target circe/.js/target core/.jvm/target .jvm/target .native/target polyline/jvm/target circe/.native/target jsoniter-scala/.jvm/target polyline/native/target jsoniter-scala/.js/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand All @@ -115,29 +115,29 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.13.8]
java: [temurin@8]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8
java-version: 11

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
Expand All @@ -151,32 +151,32 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.12.16, rootJS)
- name: Download target directories (2.12.17, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJS

- name: Inflate target directories (2.12.16, rootJS)
- name: Inflate target directories (2.12.17, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.16, rootJVM)
- name: Download target directories (2.12.17, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJVM

- name: Inflate target directories (2.12.16, rootJVM)
- name: Inflate target directories (2.12.17, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.16, rootNative)
- name: Download target directories (2.12.17, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.16-rootNative
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootNative

- name: Inflate target directories (2.12.16, rootNative)
- name: Inflate target directories (2.12.17, rootNative)
run: |
tar xf targets.tar
rm targets.tar
Expand Down Expand Up @@ -211,32 +211,32 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.3, rootJS)
- name: Download target directories (3.2.0, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.0-rootJS

- name: Inflate target directories (3.1.3, rootJS)
- name: Inflate target directories (3.2.0, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.3, rootJVM)
- name: Download target directories (3.2.0, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.0-rootJVM

- name: Inflate target directories (3.1.3, rootJVM)
- name: Inflate target directories (3.2.0, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.3, rootNative)
- name: Download target directories (3.2.0, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.3-rootNative
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.0-rootNative

- name: Inflate target directories (3.1.3, rootNative)
- name: Inflate target directories (3.2.0, rootNative)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.gnieh/geo-scala-core_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.gnieh/geo-scala-core_2.13)
[![Continuous Integration](https://github.com/gnieh/geo-scala/actions/workflows/ci.yml/badge.svg)](https://github.com/gnieh/geo-scala/actions/workflows/ci.yml)

A core AST and utilities for GeoJSON ([RFC 7946][rfc-7946]) and more. Builds for Scala 3, 2.13 and 2.12 on JVM, JS and partially Scala Native.
A core AST and utilities for GeoJSON ([RFC 7946][rfc-7946]) and more. Builds for Scala 3, 2.13, and 2.12 on JVM, JS, and Scala Native.

The project is divided in several submodules:
- `core` contains the data model for geographical entities;
- `circe` contains a set of [circe][circe] encoders and decoders for GeoJSON data model;
- `jsoniter-scala` contains a set of [jsoniter-scala][jsoniter-scala] codecs for GeoJSON data model;
- `polyline` contains utilities to convert GeoJSON line strings to and from [polylines][polyline].

## Quickstart
Expand Down Expand Up @@ -42,4 +43,5 @@ Unless required by applicable law or agreed to in writing, software distributed

[rfc-7946]: https://tools.ietf.org/html/rfc7946
[circe]: https://circe.github.io/circe
[jsoniter-scala]: https://github.com/plokhotnyuk/jsoniter-scala
[polyline]: https://developers.google.com/maps/documentation/utilities/polylineutility
42 changes: 29 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
val scala212 = "2.12.16"
val scala212 = "2.12.17"
val scala213 = "2.13.8"
val scala3 = "3.1.3"
val scala3 = "3.2.0"

ThisBuild / tlBaseVersion := "0.2"
ThisBuild / tlBaseVersion := "0.4"

ThisBuild / organization := "org.gnieh"
ThisBuild / organizationName := "GHM Mobile Development GmbH"
Expand All @@ -16,18 +16,17 @@ ThisBuild / tlSonatypeUseLegacyHost := true

ThisBuild / crossScalaVersions := Seq(scala212, scala213, scala3)
ThisBuild / scalaVersion := scala213 // the default Scala
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
ThisBuild / tlJdkRelease := Some(8)

lazy val root = tlCrossRootProject.aggregate(core, circe, polyline).settings(name := "geo-scala")
lazy val root = tlCrossRootProject.aggregate(core, circe, jsoniterScala, polyline).settings(name := "geo-scala")

lazy val commonSettings = Seq(
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.2.12" % Test,
"org.scalatest" %%% "scalatest" % "3.2.13" % Test,
"org.scalatestplus" %%% "scalacheck-1-16" % "3.2.13.0" % Test,
"org.scalacheck" %%% "scalacheck" % "1.16.0" % Test
),
// disable MiMa until we have proper version released on gnieh / all platforms
// once removed, the tlBaseVersion has to adjusted as well
mimaPreviousArtifacts := Set.empty
)
)

lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
Expand All @@ -39,16 +38,33 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
)
)

val circeVersion = "0.14.2"
lazy val circe = crossProject(JVMPlatform, JSPlatform)
val circeVersion = "0.14.3"
lazy val circe = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("circe"))
.dependsOn(core)
.settings(
commonSettings ++ Seq(
name := "geo-scala-circe",
libraryDependencies += "io.circe" %%% "circe-core" % circeVersion,
libraryDependencies += "io.circe" %%% "circe-parser" % circeVersion % Test
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion % Test
)
)
)

val jsoniterScalaVersion = "2.17.4"
lazy val jsoniterScala = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("jsoniter-scala"))
.dependsOn(core)
.settings(
commonSettings ++ Seq(
name := "geo-scala-jsoniter-scala",
libraryDependencies ++= Seq(
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-core" % jsoniterScalaVersion,
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-macros" % jsoniterScalaVersion % Provided
)
)
)

Expand Down
Loading

0 comments on commit 1592087

Please sign in to comment.