-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
154 lines (139 loc) · 5.86 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import scala.sys.process.Process
val circeVersion = "0.14.1"
val circeDerivationVersion = "0.13.0-M5"
val catsCoreVersion = "2.6.1"
val scalaTestVersion = "3.2.3"
val javaParserVersion = "3.23.0"
val treehuggerVersion = "0.4.4"
val logbackClassicVersion = "1.2.6"
val scalaLoggingVersion = "3.9.4"
val currentBranch = "master"
val pathToCmakeWin = """C:\Program Files\JetBrains\CLion 2021.1\bin\cmake\win\bin\cmake.exe"""
val pathToCmakeLinux = """/usr/bin/cmake"""
val pathToTonClientHeaderSdk = "ever-sdk/ton_client"
val pathToTonClientHeaderNative = "native/include"
lazy val pathToBridgeDll = SettingKey[File]("pathToBridgeDll")
lazy val pathToTestResources = SettingKey[File]("pathToTestResources")
lazy val buildDependentLib = taskKey[Unit]("Build dependent libraries.")
lazy val buildBridge = taskKey[Unit]("Build bridge library.")
val root = project in file(".")
lazy val `everscale-client-scala` = project
.settings(
scalaVersion := "2.13.4",
version := "1.44.2",
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-derivation" % circeDerivationVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-generic-extras" % circeVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest-flatspec" % scalaTestVersion % Test,
"org.scalatest" %% "scalatest-shouldmatchers" % scalaTestVersion % Test,
"org.typelevel" %% "cats-core" % catsCoreVersion % Test
),
pathToTestResources := (`ever-sdk` / baseDirectory).value.getAbsoluteFile / "ton_client" / "src" / "tests" / "contracts",
pathToBridgeDll := (native / baseDirectory).value.getAbsoluteFile / "build",
Test / unmanagedResourceDirectories ++= Seq(pathToBridgeDll.value, pathToTestResources.value),
Compile / unmanagedResources / includeFilter := "*.dll" || "*.dll.a" || "*.dll.lib" || "*.so",
Test / unmanagedResources / includeFilter := "*",
assembly / test := {},
scalacOptions := Seq(
"-Xfatal-warnings",
"-encoding",
"utf-8",
"-explaintypes",
"-feature",
"-language:existentials",
"-language:experimental.macros",
"-language:higherKinds",
"-language:implicitConversions",
"-Ymacro-annotations",
"-unchecked",
"-Xcheckinit",
"-Xlint:adapted-args",
"-Xlint:constant",
"-Xlint:delayedinit-select",
"-Xlint:deprecation",
"-Xlint:doc-detached",
"-Xlint:inaccessible",
"-Xlint:infer-any",
"-Xlint:missing-interpolator",
"-Xlint:nullary-unit",
"-Xlint:option-implicit",
"-Xlint:package-object-classes",
"-Xlint:poly-implicit-overload",
"-Xlint:private-shadow",
"-Xlint:stars-align",
"-Xlint:type-parameter-shadow",
"-Wdead-code",
"-Wextra-implicit",
"-Wnumeric-widen",
"-Wunused:implicits",
"-Wunused:imports",
"-Wunused:locals",
"-Wunused:params",
"-Wunused:patvars",
"-Wunused:privates",
"-Wvalue-discard"
)
)
lazy val native = project
.settings(
buildBridge := buildBridgeImpl.value
)
lazy val `ever-sdk` = project
.settings(
buildDependentLib := buildDllImpl.value
)
lazy val `everscale-codegen` = project
.settings(
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-derivation" % circeDerivationVersion,
"io.circe" %% "circe-parser" % circeVersion,
"org.typelevel" %% "cats-core" % catsCoreVersion,
"com.github.javaparser" % "javaparser-core" % javaParserVersion,
"com.eed3si9n" %% "treehugger" % treehuggerVersion,
"org.scalatest" %% "scalatest-flatspec" % scalaTestVersion % Test
)
)
lazy val buildDllImpl = Def.task {
OperationSystem.define match {
case Windows =>
Process("cmd /C chcp 65001").!
case _ => ()
}
Process(s"git submodule init", new File("ever-sdk")).!
Process(s"git submodule update", new File("ever-sdk")).!
Process(s"git checkout $currentBranch", new File("ever-sdk")).!
Process(s"git pull", new File("ever-sdk")).!
Process("node build", new File("ever-sdk/ton_client")).!
}
// TODO copy tonclient.h, add Cmake generator configuration
lazy val buildBridgeImpl = Def.task {
val pathToParent = baseDirectory.value.getAbsoluteFile
val pathToBuildDir = baseDirectory.value.getAbsoluteFile / "build"
OperationSystem.define match {
case Windows =>
Process("cmd /C chcp 65001").!
val deleteDir = "cmd /C if exist build rm /S /Q build"
Process(deleteDir, new File("native")).!
val createDir = "cmd /C mkdir build"
Process(createDir, new File("native")).!
val cmakeLoadCommand =
s""""$pathToCmakeWin" -DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - NMake Makefiles" $pathToParent"""
Process(cmakeLoadCommand, new File("native/build")).!
val cmakeCleanCommand = s""""$pathToCmakeWin" --build $pathToBuildDir --target clean"""
Process(cmakeCleanCommand, new File("native")).!
val cmakeBuildCommand = s""""$pathToCmakeWin" --build $pathToBuildDir --target all"""
Process(cmakeBuildCommand, new File("native")).!
case Linux =>
Process("mkdir -p build", pathToParent).!
val cmakeLoadCommand = s"""$pathToCmakeLinux -DCMAKE_BUILD_TYPE=Release $pathToParent -B$pathToBuildDir"""
Process(cmakeLoadCommand).!
val cmakeCommand = s"""$pathToCmakeLinux --build $pathToBuildDir --target all -- -j 6"""
Process(cmakeCommand, new File("native")).!
case _ => ???
}
}