Skip to content

Commit

Permalink
Merge pull request #873 from ScorexFoundation/v5.0.7-RC
Browse files Browse the repository at this point in the history
Release candidate v5.0.7
  • Loading branch information
aslesarenko authored Apr 21, 2023
2 parents f730a04 + 941a71b commit 5360cf4
Show file tree
Hide file tree
Showing 395 changed files with 3,911 additions and 3,589 deletions.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,19 @@ This library is
on Maven repository and can be added to the SBT configuration of Scala project.

```scala
libraryDependencies += "org.scorexfoundation" %% "sigma-state" % "4.0.3"
libraryDependencies += "org.scorexfoundation" %% "sigma-state" % "5.0.6"
```

## Repository Organization

| sub-module | description |
|---|-----|
| common | Used in all other submodules and contain basic utility classes |
| core | Implementation of graph-based intermediate representation of ErgoTree, which is used in cost estimation and interpretation |
| docs | Collection of documents |
| library | Implementation of graph IR nodes for Coll, Size and other types |
| library-api | Declarations of interfaces |
| library-impl | Implementation of interfaces |
| sigma-api | Declarations of runtime interfaces which are used in ErgoTree interpreter |
| sigma-impl | Implementation of sigma-api interfaces |
| sigma-library | Implementation of graph IR nodes for Sigma types |
| sigmastate | Implementation ErgoTree, Interpreter and cost estimation |
| sub-module | description |
|-------------|-------------------------------------------------------------------------------------------|
| common | Used in all other submodules and contain basic utility classes |
| core-lib | Contains core classes such as Coll, BigInt used by interpreter |
| docs | Collection of documents |
| graph-ir | Implementation of graph-based intermediate representation of ErgoTree, which is used in by ErgoScript compiler |
| interpreter | Implementation of ErgoTree Interpreter |
| sc | Implementation of ErgoScript compiler |

## Contributing

Expand Down
99 changes: 34 additions & 65 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,27 @@ dynverSonatypeSnapshots in ThisBuild := true
dynverSeparator in ThisBuild := "-"

val bouncycastleBcprov = "org.bouncycastle" % "bcprov-jdk15on" % "1.66"
val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0-RC1"
val scrypto = "org.scorexfoundation" %% "scrypto" % "2.3.0"
val scorexUtil = "org.scorexfoundation" %% "scorex-util" % "0.2.0"
val debox = "org.scorexfoundation" %% "debox" % "0.10.0"
val spireMacros = "org.typelevel" %% "spire-macros" % "0.17.0-M1"
val fastparse = "com.lihaoyi" %% "fastparse" % "2.3.3"
val scalaCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0"

lazy val circeCore211 = "io.circe" %% "circe-core" % "0.10.0"
lazy val circeGeneric211 = "io.circe" %% "circe-generic" % "0.10.0"
lazy val circeParser211 = "io.circe" %% "circe-parser" % "0.10.0"

lazy val circeCore = "io.circe" %% "circe-core" % "0.13.0"
lazy val circeGeneric = "io.circe" %% "circe-generic" % "0.13.0"
lazy val circeParser = "io.circe" %% "circe-parser" % "0.13.0"

def circeDeps(scalaVersion: String) = if (scalaVersion == scala211)
Seq(circeCore211, circeGeneric211, circeParser211)
else
Seq(circeCore, circeGeneric, circeParser)


val testingDependencies = Seq(
"org.scalatest" %% "scalatest" % "3.2.14" % Test,
"org.scalactic" %% "scalactic" % "3.2.14" % Test,
Expand All @@ -101,19 +115,7 @@ libraryDependencies ++= Seq(
scorexUtil,
"org.bouncycastle" % "bcprov-jdk15on" % "1.+",
fastparse, debox, spireMacros, scalaCompat
) ++ testingDependencies ++
(if (scalaVersion.value == scala211)
Seq(circeCore211, circeGeneric211, circeParser211)
else
Seq(circeCore, circeGeneric, circeParser))

lazy val circeCore211 = "io.circe" %% "circe-core" % "0.10.0"
lazy val circeGeneric211 = "io.circe" %% "circe-generic" % "0.10.0"
lazy val circeParser211 = "io.circe" %% "circe-parser" % "0.10.0"

lazy val circeCore = "io.circe" %% "circe-core" % "0.13.0"
lazy val circeGeneric = "io.circe" %% "circe-generic" % "0.13.0"
lazy val circeParser = "io.circe" %% "circe-parser" % "0.13.0"
) ++ testingDependencies ++ circeDeps(scalaVersion.value)

scalacOptions ++= Seq("-feature", "-deprecation")

Expand Down Expand Up @@ -152,76 +154,43 @@ lazy val common = Project("common", file("common"))
))
.settings(publish / skip := true)

lazy val libraryapi = Project("library-api", file("library-api"))
lazy val corelib = Project("core-lib", file("core-lib"))
.dependsOn(common % allConfigDependency)
.settings(libraryDefSettings,
libraryDependencies ++= Seq())
.settings(publish / skip := true)

lazy val libraryimpl = Project("library-impl", file("library-impl"))
.dependsOn(libraryapi % allConfigDependency)
.settings(libraryDefSettings,
libraryDependencies ++= Seq( debox ))
libraryDependencies ++= Seq( debox, scrypto ))
.settings(publish / skip := true)

lazy val core = Project("core", file("core"))
.dependsOn(common % allConfigDependency, libraryapi % allConfigDependency)
.settings(libraryDefSettings,
libraryDependencies ++= Seq( debox ))
.settings(publish / skip := true)

lazy val library = Project("library", file("library"))
.dependsOn(common % allConfigDependency, core % allConfigDependency, libraryapi, libraryimpl)
lazy val graphir = Project("graph-ir", file("graph-ir"))
.dependsOn(common % allConfigDependency, corelib)
.settings(
libraryDefSettings,
libraryDependencies ++= Seq( debox ))
libraryDependencies ++= Seq( debox, scrypto, bouncycastleBcprov ))
.settings(publish / skip := true)

lazy val sigmaapi = Project("sigma-api", file("sigma-api"))
.dependsOn(common, libraryapi)
.settings(libraryDefSettings,
libraryDependencies ++= Seq(
scrypto, bouncycastleBcprov
))
.settings(publish / skip := true)

lazy val sigmalibrary = Project("sigma-library", file("sigma-library"))
.dependsOn(
common % allConfigDependency,
core % allConfigDependency,
libraryapi % allConfigDependency,
libraryimpl % allConfigDependency,
library % allConfigDependency,
sigmaapi % allConfigDependency)
.settings(libraryDefSettings,
libraryDependencies ++= Seq(
scrypto,
bouncycastleBcprov
))
lazy val interpreter = (project in file("interpreter"))
.dependsOn(graphir % allConfigDependency)
.settings(libraryDefSettings)
.settings(libraryDependencies ++=
Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value)
)
.settings(publish / skip := true)

lazy val sigmastate = (project in file("sigmastate"))
.dependsOn(sigmalibrary % allConfigDependency)
lazy val sc = (project in file("sc"))
.dependsOn(graphir % allConfigDependency, interpreter % allConfigDependency)
.settings(libraryDefSettings)
.settings(libraryDependencies ++= Seq(
scorexUtil, fastparse,
if (scalaVersion.value == scala211) circeCore211 else circeCore,
if (scalaVersion.value == scala211) circeGeneric211 else circeGeneric,
if (scalaVersion.value == scala211) circeParser211 else circeParser
))
.settings(libraryDependencies ++=
Seq(scorexUtil, fastparse) ++ circeDeps(scalaVersion.value)
)
.settings(publish / skip := true)

lazy val sigma = (project in file("."))
.aggregate(
sigmastate, common, core, libraryapi, libraryimpl, library,
sigmaapi, sigmalibrary)
.aggregate(common, corelib, graphir, interpreter, sc)
.settings(libraryDefSettings, rootSettings)
.settings(publish / aggregate := false)
.settings(publishLocal / aggregate := false)

lazy val aggregateCompile = ScopeFilter(
inProjects(common, core, libraryapi, libraryimpl, library, sigmaapi,
sigmalibrary, sigmastate),
inProjects(common, corelib, graphir, interpreter, sc),
inConfigurations(Compile))

lazy val rootSettings = Seq(
Expand Down
3 changes: 0 additions & 3 deletions common/src/main/scala/scalan/Typeclass.scala

This file was deleted.

1 change: 0 additions & 1 deletion common/src/main/scala/scalan/package.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

import scala.language.experimental.macros
import scala.reflect.ClassTag

package object scalan {
Expand Down
74 changes: 74 additions & 0 deletions common/src/main/scala/scalan/reflection/CommonReflection.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package scalan.reflection

import scala.collection.compat.immutable.ArraySeq
import scala.collection.mutable
import scala.collection.immutable

/** Reflection metadata and global dictionaries to access it.
* For each class of this module that needs reflection metadata,
* we register a class entry with the necessary information.
* Only information that is needed at runtime is registered.
*/
object CommonReflection {
/** Descriptors of classes. */
val classes = mutable.HashMap.empty[Class[_], SRClass[_]]

/** Registers a class entry in the map of classes.
*
* @tparam T the type of the class to be registered
* @param clazz the class to be registered
* @param constructors the constructors of the class
* @param fields the fields of the class
* @param methods the methods of the class (represented as a map of method names and argument types to the corresponding RMethod instances)
*/
def registerClassEntry[T](clazz: Class[T],
constructors: Seq[SRConstructor[_]] = ArraySeq.empty,
fields: Map[String, SRField] = Map.empty,
methods: Map[(String, Seq[Class[_]]), RMethod] = Map.empty): Unit = classes.synchronized {
classes.put(clazz, new SRClass(clazz, constructors, fields, methods))
}

registerClassEntry(classOf[Boolean])

registerClassEntry(classOf[Byte])

registerClassEntry(classOf[Short])

registerClassEntry(classOf[Int])

registerClassEntry(classOf[Long])

registerClassEntry(classOf[Product2[_, _]])

registerClassEntry(classOf[immutable.$colon$colon[_]],
constructors = Array(
mkConstructor(Array(classOf[java.lang.Object], classOf[immutable.List[_]])) { args =>
new immutable.$colon$colon(args(0).asInstanceOf[java.lang.Object], args(1).asInstanceOf[immutable.List[_]])
}
)
)

{ val clazz = classOf[scala.Option[_]]
registerClassEntry(clazz,
methods = Map(
mkMethod(clazz, "filter", Array(classOf[scala.Function1[_,_]])) { (obj, args) =>
obj.asInstanceOf[Option[Any]].filter(args(0).asInstanceOf[Any => Boolean])
},
mkMethod(clazz, "map", Array(classOf[scala.Function1[_,_]])) { (obj, args) =>
obj.asInstanceOf[Option[Any]].map(args(0).asInstanceOf[Any => Any])
}
)
)
}

{ val clazz = classOf[scala.Some[_]]
registerClassEntry(clazz,
constructors = Array(
mkConstructor(Array(classOf[java.lang.Object])) { args =>
new scala.Some(args(0).asInstanceOf[java.lang.Object])
}
)
)
}

}
Loading

0 comments on commit 5360cf4

Please sign in to comment.