From 29cd170bf4cc045e302a65ef326f45bb69e64e90 Mon Sep 17 00:00:00 2001 From: Artyom Sayadyan Date: Tue, 11 Oct 2022 09:41:44 +0300 Subject: [PATCH] Lang clean-up (#3762) --- build.sbt | 17 +- .../com/wavesplatform/utils/DocExport.scala | 186 --------- .../wavesplatform/utils/doc/DocExport.scala | 124 ------ .../wavesplatform/utils/doc/DocExportV3.scala | 57 --- .../wavesplatform/utils/doc/MustacheDoc.scala | 90 ----- .../utils/doc/RideFullContext.scala | 18 - .../wavesplatform/lang/v1/parser/Parser.scala | 372 +++++++++--------- .../FunctionComplexityDocTest.scala} | 6 +- .../ObjectTypesDocTest.scala} | 4 +- ...{DocExportTest.scala => VarsDocTest.scala} | 27 +- .../lang/{v1 => evaluator}/FoldTest.scala | 85 +--- .../lang/evaluator/fold/GenericFoldTest.scala | 80 ---- .../lang/evaluator/fold/MacroFoldTest.scala | 49 --- .../v1/estimator/FoldEstimationTest.scala | 56 +++ 14 files changed, 246 insertions(+), 925 deletions(-) delete mode 100644 lang/doc/src/main/scala/com/wavesplatform/utils/DocExport.scala delete mode 100644 lang/doc/src/main/scala/com/wavesplatform/utils/doc/DocExport.scala delete mode 100644 lang/doc/src/main/scala/com/wavesplatform/utils/doc/DocExportV3.scala delete mode 100644 lang/doc/src/main/scala/com/wavesplatform/utils/doc/MustacheDoc.scala delete mode 100644 lang/doc/src/main/scala/com/wavesplatform/utils/doc/RideFullContext.scala rename lang/tests/src/test/scala/com/wavesplatform/lang/{v1/estimator/FunctionComplexityTest.scala => doc/FunctionComplexityDocTest.scala} (96%) rename lang/tests/src/test/scala/com/wavesplatform/lang/{ObjectTypesTest.scala => doc/ObjectTypesDocTest.scala} (94%) rename lang/tests/src/test/scala/com/wavesplatform/lang/doc/{DocExportTest.scala => VarsDocTest.scala} (60%) rename lang/tests/src/test/scala/com/wavesplatform/lang/{v1 => evaluator}/FoldTest.scala (50%) delete mode 100644 lang/tests/src/test/scala/com/wavesplatform/lang/evaluator/fold/GenericFoldTest.scala delete mode 100644 lang/tests/src/test/scala/com/wavesplatform/lang/evaluator/fold/MacroFoldTest.scala create mode 100644 lang/tests/src/test/scala/com/wavesplatform/lang/v1/estimator/FoldEstimationTest.scala diff --git a/build.sbt b/build.sbt index c17fd3c00bc..941ad38d997 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ 2. You've checked "Make project before run" */ -import sbt.Def +import sbt.{Compile, Def} import sbt.Keys.{concurrentRestrictions, _} Global / onChangedBuildSource := ReloadOnSourceChanges @@ -20,6 +20,7 @@ lazy val lang = libraryDependencies ++= Dependencies.lang.value ++ Dependencies.test, inConfig(Compile)( Seq( + sourceGenerators += Tasks.docSource, PB.targets += scalapb.gen(flatPackage = true) -> sourceManaged.value, PB.protoSources += PB.externalIncludePath.value, PB.generate / includeFilter := { (f: File) => @@ -40,9 +41,6 @@ lazy val `lang-jvm` = lang.jvm lazy val `lang-js` = lang.js .enablePlugins(VersionObject) - .settings( - Compile / sourceGenerators += Tasks.docSource - ) lazy val `lang-testkit` = project .dependsOn(`lang-jvm`) @@ -54,17 +52,6 @@ lazy val `lang-testkit` = project lazy val `lang-tests` = project .in(file("lang/tests")) .dependsOn(`lang-testkit`) - .settings( - Compile / sourceGenerators += Tasks.docSource - ) - -lazy val `lang-doc` = project - .in(file("lang/doc")) - .dependsOn(`lang-jvm`) - .settings( - Compile / sourceGenerators += Tasks.docSource, - libraryDependencies ++= Seq("com.github.spullara.mustache.java" % "compiler" % "0.9.10") ++ Dependencies.test - ) lazy val node = project.dependsOn(`lang-jvm`, `lang-testkit` % "test") diff --git a/lang/doc/src/main/scala/com/wavesplatform/utils/DocExport.scala b/lang/doc/src/main/scala/com/wavesplatform/utils/DocExport.scala deleted file mode 100644 index 011050cfd0b..00000000000 --- a/lang/doc/src/main/scala/com/wavesplatform/utils/DocExport.scala +++ /dev/null @@ -1,186 +0,0 @@ -package com.wavesplatform.utils - -import com.github.mustachejava._ -import com.wavesplatform.DocSource -import com.wavesplatform.common.utils.EitherExt2 -import com.wavesplatform.lang.directives.values._ -import com.wavesplatform.lang.directives.{DirectiveDictionary, DirectiveSet} -import com.wavesplatform.lang.v1.CTX -import com.wavesplatform.lang.v1.compiler.Types._ -import com.wavesplatform.lang.v1.traits.Environment -import com.wavesplatform.utils.doc.RideFullContext - -import scala.jdk.CollectionConverters._ - -object DocExport { - def main(args: Array[String]): Unit = { - if (args.size != 4 || args(0) != "--gen-doc") { - System.err.println("Expected args: --gen-doc