Skip to content

Commit

Permalink
Bump Scala, add native
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Nov 13, 2022
1 parent 566c43d commit 0b652d0
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 147 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/ci.yml
Expand Up @@ -28,9 +28,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.3]
scala: [3.2.1]
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 codecs/.jvm/target target .js/target core/.js/target core/.jvm/target .jvm/target .native/target examples/.jvm/target codecs/.js/target project/target
run: mkdir -p codecs/.jvm/target target .js/target core/.native/target codecs/.native/target core/.js/target core/.jvm/target .jvm/target .native/target examples/.jvm/target codecs/.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 codecs/.jvm/target target .js/target core/.js/target core/.jvm/target .jvm/target .native/target examples/.jvm/target codecs/.js/target project/target
run: tar cf targets.tar codecs/.jvm/target target .js/target core/.native/target codecs/.native/target core/.js/target core/.jvm/target .jvm/target .native/target examples/.jvm/target codecs/.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 @@ -110,7 +114,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.3]
scala: [3.2.1]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
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.1.3, rootJS)
- name: Download target directories (3.2.1, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJS

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

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

- name: Inflate target directories (3.1.3, rootJVM)
- name: Inflate target directories (3.2.1, rootNative)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
17 changes: 8 additions & 9 deletions build.sbt
Expand Up @@ -9,10 +9,10 @@ ThisBuild / tlSonatypeUseLegacyHost := false
def crossPlugin(x: sbt.librarymanagement.ModuleID) = compilerPlugin(x.cross(CrossVersion.full))

val compilerPlugins = List(
crossPlugin("org.polyvariant" % "better-tostring" % "0.3.16")
crossPlugin("org.polyvariant" % "better-tostring" % "0.3.17")
)

val Scala3 = "3.1.3"
val Scala3 = "3.2.1"

ThisBuild / scalaVersion := Scala3
ThisBuild / crossScalaVersions := Seq(Scala3)
Expand All @@ -24,14 +24,13 @@ ThisBuild / tlFatalWarningsInCi := false

val commonSettings = Seq(
libraryDependencies ++= compilerPlugins ++ Seq(
"com.disneystreaming" %%% "weaver-cats" % "0.7.15" % Test,
"com.disneystreaming" %%% "weaver-discipline" % "0.7.15" % Test,
"com.disneystreaming" %%% "weaver-scalacheck" % "0.7.15" % Test,
"com.disneystreaming" %%% "weaver-cats" % "0.8.0" % Test,
"com.disneystreaming" %%% "weaver-scalacheck" % "0.8.0" % Test,
),
testFrameworks += new TestFramework("weaver.framework.CatsEffect"),
)

lazy val core = crossProject(JVMPlatform, JSPlatform)
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
commonSettings,
Expand All @@ -40,7 +39,7 @@ lazy val core = crossProject(JVMPlatform, JSPlatform)
),
)

lazy val codecs = crossProject(JVMPlatform, JSPlatform)
lazy val codecs = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
commonSettings,
Expand All @@ -50,12 +49,12 @@ lazy val codecs = crossProject(JVMPlatform, JSPlatform)
)
.dependsOn(core)

lazy val examples = crossProject(JVMPlatform)
lazy val examples = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-io" % "3.2.12",
"com.lihaoyi" %%% "pprint" % "0.7.3",
"org.typelevel" %%% "cats-core" % "2.9.0",
),
commonSettings,
)
Expand Down
Expand Up @@ -18,8 +18,6 @@ package org.polyvariant.classfile.examples

import language.dynamics

import cats.effect.IOApp
import cats.effect.IO
import org.polyvariant.classfile.ClassFile
import org.polyvariant.classfile.ConstantPool
import org.polyvariant.classfile.ClassAccessFlag
Expand All @@ -29,12 +27,8 @@ import org.polyvariant.classfile.MethodInfo
import org.polyvariant.classfile.MethodAccessFlag
import org.polyvariant.classfile.AttributeInfo
import scodec.bits._
import fs2.io.file.Files
import fs2.io.file.Path
import org.polyvariant.classfile.codecs.ClassFileCodecs
import org.polyvariant.classfile.Instruction
import org.polyvariant.classfile.examples.Examples.AttributeCodecs
import cats.effect.kernel.Ref
import cats.Functor
import cats.implicits._
import cats.data.State
Expand All @@ -47,8 +41,9 @@ import scala.reflect.ClassTag
import scala.quoted.Expr
import scala.quoted.Quotes
import org.polyvariant.classfile.Constant.Utf8Info
import java.nio.file.Files

object BytecodeCodegen extends IOApp.Simple {
object BytecodeCodegen extends App {

trait PoolOps[F[_]] {
def add[C <: Constant](c: C): F[ConstantIndex[C]]
Expand Down Expand Up @@ -236,12 +231,6 @@ object BytecodeCodegen extends IOApp.Simple {

// pprint.pprintln(cf)

def run: IO[Unit] =
fs2
.Stream
.chunk(fs2.Chunk.byteVector(bytes))
.through(Files[IO].writeAll(Path("Foo.class")))
.compile
.drain
Files.write(Paths.get("Foo.class"), bytes.toArray)

}

0 comments on commit 0b652d0

Please sign in to comment.