fix assembly, add u8 (#45)

This commit is contained in:
Dima 2021-04-08 15:53:54 +03:00 committed by GitHub
parent 6540550f08
commit 2e5f986961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 11 deletions

View File

@ -22,7 +22,7 @@ jobs:
### Update & build ### Update & build
- name: Assembly - name: Assembly
run: sbt assembly run: sbt cli/assembly
### Create release ### Create release
- name: Get project version - name: Get project version
@ -35,7 +35,7 @@ jobs:
- name: Add version to .jar name - name: Add version to .jar name
run: | run: |
JAR="target/scala-2.13/aqua-hll-${{ env.VERSION }}.jar" JAR="target/scala-2.13/aqua-hll-${{ env.VERSION }}.jar"
mv "target/scala-2.13/aqua-hll.jar" $JAR mv "cli/target/scala-2.13/aqua-hll.jar" $JAR
echo "JAR=$JAR" >> $GITHUB_ENV echo "JAR=$JAR" >> $GITHUB_ENV
- uses: marvinpinto/action-automatic-releases@latest - uses: marvinpinto/action-automatic-releases@latest

View File

@ -4,7 +4,7 @@ scalaVersion := dottyVersion
//val dottyVersion = "3.0.0-RC1" //val dottyVersion = "3.0.0-RC1"
val aquaV = "0.1.0" val aquaV = "0.1.1"
val catsV = "2.4.2" val catsV = "2.4.2"
val catsParseV = "0.3.1" val catsParseV = "0.3.1"
@ -12,10 +12,7 @@ val monocleV = "3.0.0-M3"
val scalaTestV = "3.2.5" val scalaTestV = "3.2.5"
val fs2V = "3.0.0-M7" val fs2V = "3.0.0-M7"
name := "aqua-hll" name := "aqua-hll"
mainClass in (Compile, run) := Some("aqua.Main")
mainClass in assembly := Some("aqua.Main")
assemblyJarName in assembly := "aqua-hll.jar"
val commons = Seq( val commons = Seq(
version := aquaV, version := aquaV,
@ -27,6 +24,9 @@ val commons = Seq(
lazy val cli = project lazy val cli = project
.settings(commons: _*) .settings(commons: _*)
.settings( .settings(
mainClass in (Compile, run) := Some("aqua.Main"),
mainClass in assembly := Some("aqua.Main"),
assemblyJarName in assembly := "aqua-hll.jar",
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.github.scopt" %% "scopt" % "4.0.1", "com.github.scopt" %% "scopt" % "4.0.1",
"org.typelevel" %% "cats-effect" % "3.0.0-RC2", "org.typelevel" %% "cats-effect" % "3.0.0-RC2",

View File

@ -5,7 +5,7 @@ import aqua.parser.Ast.parser
import aqua.parser.expr._ import aqua.parser.expr._
import aqua.parser.lexer.{ArrowTypeToken, BasicTypeToken, EqOp} import aqua.parser.lexer.{ArrowTypeToken, BasicTypeToken, EqOp}
import aqua.parser.lift.LiftParser.Implicits.idLiftParser import aqua.parser.lift.LiftParser.Implicits.idLiftParser
import aqua.types.ScalarType.{bool, string, u32, u64} import aqua.types.ScalarType.{bool, string, u32, u64, u8}
import cats.Id import cats.Id
import cats.data.Chain import cats.data.Chain
import cats.free.Cofree import cats.free.Cofree
@ -26,8 +26,8 @@ class FuncExprSpec extends AnyFlatSpec with Matchers with AquaSpec {
funcExpr("func some()") should be(FuncExpr("some", List(), None, None)) funcExpr("func some()") should be(FuncExpr("some", List(), None, None))
val arrowToken = val arrowToken =
ArrowTypeToken[Id]((), List(BasicTypeToken[Id](u32)), Some(BasicTypeToken[Id](bool))) ArrowTypeToken[Id]((), List(BasicTypeToken[Id](u8)), Some(BasicTypeToken[Id](bool)))
funcExpr("func some(peer: PeerId, other: u32 -> bool)") should be( funcExpr("func some(peer: PeerId, other: u8 -> bool)") should be(
FuncExpr( FuncExpr(
toName("some"), toName("some"),
List(toCustomArg("peer", "PeerId"), toArg("other", arrowToken)), List(toCustomArg("peer", "PeerId"), toArg("other", arrowToken)),

View File

@ -21,6 +21,7 @@ case class ScalarType private (name: String) extends DataType {
object ScalarType { object ScalarType {
// TODO https://github.com/fluencelabs/interface-types/blob/master/crates/it-types/src/values.rs#L45-L49 // TODO https://github.com/fluencelabs/interface-types/blob/master/crates/it-types/src/values.rs#L45-L49
val u8 = ScalarType("u8")
val u32 = ScalarType("u32") val u32 = ScalarType("u32")
val u64 = ScalarType("u64") val u64 = ScalarType("u64")
val s32 = ScalarType("s32") val s32 = ScalarType("s32")
@ -32,13 +33,15 @@ object ScalarType {
val float = Set(f32, f64) val float = Set(f32, f64)
val signed = float ++ Set(s32, s64) val signed = float ++ Set(s32, s64)
val number = signed ++ Set(u32, u64) val number = signed ++ Set(u8, u32, u64)
val all = number ++ Set(bool, string) val all = number ++ Set(bool, string)
val scalarOrder: PartialOrder[ScalarType] = val scalarOrder: PartialOrder[ScalarType] =
PartialOrder.from { PartialOrder.from {
case (a, b) if a == b => 0.0 case (a, b) if a == b => 0.0
case (`u32`, `u64`) => -1.0 case (`u32`, `u64`) => -1.0
case (`u8`, `u64`) => -1.0
case (`u8`, `u32`) => -1.0
case (`s32`, `s64`) => -1.0 case (`s32`, `s64`) => -1.0
case (`f32`, `f64`) => -1.0 case (`f32`, `f64`) => -1.0
case (`u64`, `u32`) => 1.0 case (`u64`, `u32`) => 1.0