Skip to content

Commit

Permalink
Merge pull request #868 from ScorexFoundation/restructure-part4
Browse files Browse the repository at this point in the history
Remove unused code (restructure part 4)
  • Loading branch information
aslesarenko authored Mar 6, 2023
2 parents 3c7a72d + 637a7f0 commit cf1f192
Show file tree
Hide file tree
Showing 70 changed files with 1,045 additions and 1,544 deletions.
121 changes: 14 additions & 107 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ 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 guava = "com.google.guava" % "guava" % "30.1.1-jre"
val scalaCompat = "org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0"

val testingDependencies = Seq(
"org.scalatest" %% "scalatest" % "3.0.9" % Test,
"org.scalactic" %% "scalactic" % "3.0.9" % Test,
"org.scalacheck" %% "scalacheck" % "1.14.3" % Test,
"org.scalatest" %% "scalatest" % "3.2.14" % Test,
"org.scalactic" %% "scalactic" % "3.2.14" % Test,
"org.scalacheck" %% "scalacheck" % "1.15.2" % Test, // last supporting Scala 2.11
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.3.0" % Test, // last supporting Scala 2.11
"com.lihaoyi" %% "pprint" % "0.6.3" % Test,
"com.storm-enroute" %% "scalameter" % "0.19" % Test,
"junit" % "junit" % "4.12" % Test
Expand All @@ -101,7 +101,11 @@ libraryDependencies ++= Seq(
scorexUtil,
"org.bouncycastle" % "bcprov-jdk15on" % "1.+",
fastparse, debox, spireMacros, scalaCompat
) ++ testingDependencies
) ++ 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"
Expand All @@ -111,12 +115,6 @@ 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"

libraryDependencies ++= Seq(
if (scalaVersion.value == scala211) circeCore211 else circeCore,
if (scalaVersion.value == scala211) circeGeneric211 else circeGeneric,
if (scalaVersion.value == scala211) circeParser211 else circeParser
)

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

parallelExecution in Test := false
Expand Down Expand Up @@ -147,10 +145,10 @@ usePgpKeyHex("C1FD62B4D44BDF702CDF2B726FF59DA944B150DD")
def libraryDefSettings = commonSettings ++ testSettings

lazy val common = Project("common", file("common"))
.settings(commonSettings ++ testSettings,
.settings(libraryDefSettings,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
debox, scalaCompat, guava
debox, scalaCompat
))
.settings(publish / skip := true)

Expand All @@ -168,14 +166,14 @@ lazy val libraryimpl = Project("library-impl", file("library-impl"))

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

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

Expand Down Expand Up @@ -234,94 +232,3 @@ lazy val rootSettings = Seq(
mappings in (Test, packageBin) ++= (mappings in(Test, packageBin)).all(aggregateCompile).value.flatten,
mappings in(Test, packageSrc) ++= (mappings in(Test, packageSrc)).all(aggregateCompile).value.flatten
)

def runErgoTask(task: String, sigmastateVersion: String, log: Logger): Unit = {
val ergoBranch = "test-coverage"
val sbtEnvVars = Seq("BUILD_ENV" -> "test", "SIGMASTATE_VERSION" -> sigmastateVersion)

log.info(s"Testing current build in Ergo (branch $ergoBranch):")
val cwd = new File("").absolutePath
val ergoPath = new File(cwd + "/ergo-tests/")
log.info(s"Cleaning $ergoPath")
s"rm -rf ${ergoPath.absolutePath}" !

log.info(s"Cloning Ergo branch $ergoBranch into ${ergoPath.absolutePath}")
s"git clone -b $ergoBranch --single-branch https://github.com/ergoplatform/ergo.git ${ergoPath.absolutePath}" !


log.info(s"Updating Ergo in $ergoPath with Sigmastate version $sigmastateVersion")
Process(Seq("sbt", "unlock", "reload", "lock"), ergoPath, sbtEnvVars: _*) !

log.info("Updated Ergo lock.sbt:")
Process(Seq("git", "diff", "-U0", "lock.sbt"), ergoPath) !

log.info(s"Running Ergo tests in $ergoPath with Sigmastate version $sigmastateVersion")
val res = Process(Seq("sbt", task), ergoPath, sbtEnvVars: _*) !

if (res != 0) sys.error(s"Ergo $task failed!")
}

lazy val ergoUnitTestTask = TaskKey[Unit]("ergoUnitTestTask", "run ergo unit tests with current version")
ergoUnitTestTask := {
val log = streams.value.log
val sigmastateVersion = version.value
runErgoTask("test", sigmastateVersion, log)
}

commands += Command.command("ergoUnitTest") { state =>
"clean" ::
"publishLocal" ::
"ergoUnitTestTask" ::
state
}

lazy val ergoItTestTask = TaskKey[Unit]("ergoItTestTask", "run ergo it:test with current version")
ergoItTestTask := {
val log = streams.value.log
val sigmastateVersion = version.value
runErgoTask("it:test", sigmastateVersion, log)
}

commands += Command.command("ergoItTest") { state =>
"clean" ::
"publishLocal" ::
"ergoItTestTask" ::
state
}

def runSpamTestTask(task: String, sigmastateVersion: String, log: Logger): Unit = {
val spamBranch = "master"
val envVars = Seq("SIGMASTATE_VERSION" -> sigmastateVersion,
// SSH_SPAM_REPO_KEY should be set (see Jenkins Credentials Binding Plugin)
"GIT_SSH_COMMAND" -> "ssh -i $SSH_SPAM_REPO_KEY")

log.info(s"Testing current build with spam tests (branch $spamBranch):")
val cwd = new File("")
val spamPath = new File(cwd.absolutePath + "/spam-tests/")
log.info(s"Cleaning $spamPath")
s"rm -rf ${spamPath.absolutePath}" !

log.info(s"Cloning spam tests branch $spamBranch into ${spamPath.absolutePath}")
Process(Seq("git", "clone", "-b", spamBranch, "--single-branch", "git@github.com:greenhat/sigma-spam.git", spamPath.absolutePath),
cwd.getAbsoluteFile,
envVars: _*) !

log.info(s"Running spam tests in $spamPath with Sigmastate version $sigmastateVersion")
val res = Process(Seq("sbt", task), spamPath, envVars: _*) !

if (res != 0) sys.error(s"Spam $task failed!")
}

lazy val spamTestTask = TaskKey[Unit]("spamTestTask", "run spam tests with current version")
spamTestTask := {
val log = streams.value.log
val sigmastateVersion = version.value
runSpamTestTask("test", sigmastateVersion, log)
}

commands += Command.command("spamTest") { state =>
"clean" ::
"publishLocal" ::
"spamTestTask" ::
state
}
159 changes: 0 additions & 159 deletions common/src/main/java/java7/compat/Math.java

This file was deleted.

17 changes: 0 additions & 17 deletions common/src/main/java/scalan/Builtin.java

This file was deleted.

14 changes: 0 additions & 14 deletions common/src/main/java/scalan/Constructor.java

This file was deleted.

14 changes: 0 additions & 14 deletions common/src/main/java/scalan/ContainerType.java

This file was deleted.

12 changes: 0 additions & 12 deletions common/src/main/java/scalan/Convertible.java

This file was deleted.

Loading

0 comments on commit cf1f192

Please sign in to comment.