Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bfdfdd0
wip:add native build
i10416 Feb 13, 2022
f5f2cbf
Update sbt-assembly to 1.1.1 (#377)
scala-steward Feb 13, 2022
e80ab78
Update sbt to 1.6.2 (#366)
scala-steward Feb 13, 2022
cdc16a0
Update sbt-typelevel to 0.4.5 (#374)
scala-steward Feb 13, 2022
366f147
Update sbt-assembly to 1.2.0 (#378)
scala-steward Feb 13, 2022
4489359
Update sbt-buildinfo to 0.11.0 (#383)
scala-steward Feb 18, 2022
9318024
update plugins
i10416 Mar 20, 2022
2cdeef2
Remove allocations from StringIn when returning a string (#368)
johnynek Feb 20, 2022
fc26c5b
Update sbt-mdoc to 2.3.1 (#387)
scala-steward Feb 24, 2022
34816ea
Update parboiled to 2.4.0 (#388)
scala-steward Feb 24, 2022
f9eaeac
Improve String generation (#385)
johnynek Feb 26, 2022
b0d91b6
Update sbt-typelevel to 0.4.6 (#390)
scala-steward Mar 5, 2022
80ab15c
resolve conflicts
i10416 Mar 20, 2022
2e82ec1
tweak
i10416 Mar 21, 2022
30c7cbd
resolve conflict
i10416 Mar 21, 2022
4131ef0
rm comment
i10416 Mar 21, 2022
1b65e38
tweak build
i10416 Mar 21, 2022
3f74d14
tweak build
i10416 Mar 30, 2022
1fc72e2
resolve conflict
i10416 Mar 30, 2022
bf3fdde
Update deps
i10416 Apr 11, 2022
da84253
remove redundant assertion
i10416 Apr 11, 2022
0c8f0b9
Merge branch 'main' into build-against-native-platform
i10416 Apr 11, 2022
bc79463
bye-bye scala 3.0
i10416 Apr 11, 2022
9d2df6c
fix workflow
i10416 Apr 11, 2022
e4a8aa3
exclude scala2.12 x scala native bincompat repo
i10416 Apr 29, 2022
33adb06
merge main and tweak to compile
i10416 Jun 11, 2022
18065c8
Update build.sbt
i10416 Jun 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 54 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.0.2, 2.11.12, 2.12.16, 2.13.8]
scala: [3.1.2, 2.11.12, 2.12.16, 2.13.8]
java: [temurin@8]
project: [rootJS, rootJVM]
project: [rootJS, rootJVM, rootNative]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand Down Expand Up @@ -77,6 +77,10 @@ jobs:
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult

- name: nativeLink
if: matrix.project == 'rootNative'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/nativeLink

- name: Test
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test

Expand All @@ -90,11 +94,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p target .js/target site/target core/js/target core/jvm/target .jvm/target .native/target project/target
run: mkdir -p target .js/target core/native/target site/target core/js/target core/jvm/target .jvm/target .native/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 target .js/target site/target core/js/target core/jvm/target .jvm/target .native/target project/target
run: tar cf targets.tar target .js/target core/native/target site/target core/js/target core/jvm/target .jvm/target .native/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 Down Expand Up @@ -147,22 +151,32 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

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

- name: Inflate target directories (3.1.2, rootJS)
run: |
tar xf targets.tar
rm targets.tar

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

- name: Inflate target directories (3.0.2, rootJS)
- name: Inflate target directories (3.1.2, rootJVM)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (3.0.2, rootJVM)
- name: Download target directories (3.1.2, rootNative)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.0.2-rootJVM
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.2-rootNative

- name: Inflate target directories (3.0.2, rootJVM)
- name: Inflate target directories (3.1.2, rootNative)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -187,6 +201,16 @@ jobs:
tar xf targets.tar
rm targets.tar

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

- name: Inflate target directories (2.11.12, rootNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.16, rootJS)
uses: actions/download-artifact@v2
with:
Expand All @@ -207,6 +231,16 @@ jobs:
tar xf targets.tar
rm targets.tar

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

- name: Inflate target directories (2.12.16, rootNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13.8, rootJS)
uses: actions/download-artifact@v2
with:
Expand All @@ -227,6 +261,16 @@ jobs:
tar xf targets.tar
rm targets.tar

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

- name: Inflate target directories (2.13.8, rootNative)
run: |
tar xf targets.tar
rm targets.tar

- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -di | gpg --import
Expand Down
37 changes: 30 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import com.typesafe.tools.mima.core._
import Dependencies._
val scala211 = "2.11.12"
val scala212 = "2.12.16"
val scala213 = "2.13.8"
val scala31 = "3.1.2"

addCommandAlias("fmt", "; scalafmtAll; scalafmtSbt")
addCommandAlias("fmtCheck", "; scalafmtCheckAll; scalafmtSbtCheck")

Expand All @@ -9,15 +14,16 @@ ThisBuild / tlBaseVersion := "0.3"
ThisBuild / startYear := Some(2021)
ThisBuild / developers += tlGitHubDev("johnynek", "P. Oscar Boykin")

ThisBuild / crossScalaVersions := List("3.0.2", "2.11.12", "2.12.16", "2.13.8")
ThisBuild / crossScalaVersions := List(scala31, scala211, scala212, scala213)

ThisBuild / tlVersionIntroduced := Map("3" -> "0.3.4")
ThisBuild / tlSkipIrrelevantScalas := true

ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
id = "coverage",
name = "Generate coverage report",
scalas = List("2.13.8"),
scalas = List(scala213),
steps = List(WorkflowStep.Checkout) ++ WorkflowStep.SetupJava(
githubWorkflowJavaVersions.value.toList
) ++ githubWorkflowGeneratedCacheSteps.value ++ List(
Expand All @@ -38,21 +44,22 @@ lazy val isScala211 = Def.setting {
scalaBinaryVersion.value == "2.11"
}

lazy val core = crossProject(JSPlatform, JVMPlatform)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Full)
.settings(
name := "cats-parse",
tlFatalWarningsInCi := !tlIsScala3.value,
libraryDependencies ++= {
if (tlIsScala3.value) Nil else Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
},
libraryDependencies ++= {
val isScala211 = CrossVersion.partialVersion(scalaVersion.value).contains((2, 11))
Seq(
if (isScala211.value) cats211.value else cats.value,
if (isScala211) cats211.value else cats.value,
munit.value % Test,
munitScalacheck.value % Test
)
},
libraryDependencies ++= {
if (tlIsScala3.value) Nil else Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
},
scalacOptions ++= {
// this code seems to trigger a bug in 2.11 pattern analysis
if (isScala211.value) List("-Xno-patmat-analysis") else Nil
Expand All @@ -79,6 +86,22 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filterNot(_.startsWith("2.11")),
coverageEnabled := false
)
.nativeSettings(
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype OSS Snapshots s01" at "https://s01.oss.sonatype.org/content/repositories/snapshots"
),
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filterNot(_.startsWith("2.11")),
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "0.3.8").toMap,
libraryDependencies := {
if (scalaVersion.value.startsWith("3.1")) {
libraryDependencies.value.filterNot(_ == Dependencies.cats) ++ Seq(
Dependencies.catsSnapshot.value
)
} else { libraryDependencies.value }
},
Comment on lines +90 to +102

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverageEnabled := false
)

lazy val bench = project
.enablePlugins(JmhPlugin, NoPublishPlugin)
Expand Down
24 changes: 24 additions & 0 deletions core/native/src/main/scala/cats/parse/BitSet.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2021 Typelevel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package cats.parse

object BitSetUtil extends BitSetUtilCompat(false, false)
8 changes: 4 additions & 4 deletions core/shared/src/test/scala/cats/parse/BitSetTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import org.scalacheck.Prop.forAll
class BitSetTest extends munit.ScalaCheckSuite {
// TODO: Remove isScalaJs/isScalaJvm in next minor version update. See https://github.com/typelevel/cats-parse/issues/391.
test("isScalaJs/isScalaJvm is consistent") {
// This will need to be updated if we ever add scala-native
assert(!(BitSetUtil.isScalaJs && BitSetUtil.isScalaJvm))
assert(BitSetUtil.isScalaJs || BitSetUtil.isScalaJvm)
assert(BitSetUtil.isScalaJs ^ BitSetUtil.isScalaJvm)
if (BitSetUtil.isScalaJs || BitSetUtil.isScalaJvm) {
assert(!(BitSetUtil.isScalaJs && BitSetUtil.isScalaJvm))
assert(BitSetUtil.isScalaJs ^ BitSetUtil.isScalaJvm)
}
}

property("BitSetUtil union works") {
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/test/scala/cats/parse/ParserTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ class ParserTest extends munit.ScalaCheckSuite {

import ParserGen.{arbParser0, arbParser, biasSmall, genString, arbString}

val tests: Int = if (BitSetUtil.isScalaJs) 50 else 2000
val tests: Int = if (BitSetUtil.isScalaJvm) 2000 else 50
Comment thread
i10416 marked this conversation as resolved.

override def scalaCheckTestParameters =
super.scalaCheckTestParameters
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/test/scala/cats/parse/RadixNodeTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.scalacheck.{Gen, Prop}
import org.scalacheck.Prop.forAll

class RadixNodeTest extends munit.ScalaCheckSuite {
val tests: Int = if (BitSetUtil.isScalaJs) 50 else 20000
val tests: Int = if (BitSetUtil.isScalaJvm) 20000 else 50
Comment thread
i10416 marked this conversation as resolved.

override def scalaCheckTestParameters =
super.scalaCheckTestParameters
Expand Down
5 changes: 3 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import sbt._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

object Dependencies {
lazy val catsSnapshot = Def.setting("org.typelevel" %%% "cats-core" % "2.8-e070e7e-SNAPSHOT")
lazy val cats = Def.setting("org.typelevel" %%% "cats-core" % "2.7.0")
lazy val cats211 = Def.setting("org.typelevel" %%% "cats-core" % "2.0.0")
lazy val munit = Def.setting("org.scalameta" %%% "munit" % "0.7.29")
lazy val munitScalacheck = Def.setting("org.scalameta" %%% "munit-scalacheck" % "0.7.29")
lazy val munit = Def.setting("org.scalameta" %%% "munit" % "1.0.0-M5")
lazy val munitScalacheck = Def.setting("org.scalameta" %%% "munit-scalacheck" % "1.0.0-M5")
lazy val fastParse = "com.lihaoyi" %% "fastparse" % "2.3.3"
lazy val parsley = "org.http4s" %% "parsley" % "1.5.0-M3"
lazy val jawnAst = "org.typelevel" %% "jawn-ast" % "1.3.2"
Expand Down
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
Expand Down