-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
182 lines (162 loc) · 4.94 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
lazy val root = project
.in(file("."))
.aggregate(
common.jvm, common.js,
bittorrent.jvm,
dht.jvm,
cmd.jvm,
)
inThisBuild(
List(
scalaVersion := "3.5.0",
scalacOptions ++= List(
"-source:future",
"-Ykind-projector:underscores"
),
libraryDependencies ++= List(
Deps.`munit-cats-effect`.value % Test
),
organization := "io.github.torrentdam.bittorrent",
version := sys.env.getOrElse("VERSION", "SNAPSHOT"),
description := "Bittorrent client",
publishTo := {
val nexus = "https://s01.oss.sonatype.org/"
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
credentials ++= {
sys.env.get("SONATYPE_CREDS") match {
case Some(credentials) =>
val Array(username, password) = credentials.split(':')
List(
Credentials(
"Sonatype Nexus Repository Manager",
"s01.oss.sonatype.org",
username,
password
)
)
case None => List.empty[Credentials]
}
},
developers := List(
Developer(
id = "lavrov",
name = "Vitaly Lavrov",
email = "[email protected]",
url = url("https://github.com/lavrov")
)
),
scmInfo := Some(
ScmInfo(
url("https://github.com/TorrentDamDev/bittorrent"),
"scm:[email protected]:TorrentDamDev/bittorrent.git"
)
),
licenses := List("Unlicense" -> new URL("https://unlicense.org/")),
homepage := Some(url("https://torrentdam.github.io/"))
)
)
lazy val common = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.settings(
libraryDependencies ++= Seq(
Deps.`scodec-bits`.value,
Deps.`cats-effect`.value,
Deps.ip4s.value,
)
)
lazy val bittorrent = crossProject(JVMPlatform, NativePlatform)
.in(file("bittorrent"))
.dependsOn(common)
.settings(
libraryDependencies ++= Seq(
Deps.bencode.value,
Deps.`cats-core`.value,
Deps.`cats-effect`.value,
Deps.`fs2-io`.value,
Deps.`monocle-core`.value,
Deps.`monocle-macro`.value,
Deps.`woof-core`.value,
Deps.`cats-effect-cps`.value,
)
)
.platformsSettings(NativePlatform)(
libraryDependencies ++= Seq(
"com.github.lolgab" %%% "scala-native-crypto" % "0.0.4",
)
)
lazy val dht = crossProject(JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(common)
.settings(
libraryDependencies ++= Seq(
Deps.bencode.value,
Deps.`scodec-bits`.value,
Deps.`cats-core`.value,
Deps.`cats-effect`.value,
Deps.`fs2-io`.value,
Deps.`woof-core`.value,
Deps.`cats-effect-cps`.value,
)
)
lazy val files = crossProject(JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(common, bittorrent)
.settings(
libraryDependencies ++= Seq(
Deps.`scodec-bits`.value,
Deps.`cats-core`.value,
Deps.`cats-effect`.value,
Deps.`fs2-io`.value,
Deps.`woof-core`.value,
Deps.`cats-effect-cps`.value,
)
)
lazy val cmd = crossProject(JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(
bittorrent,
dht,
files,
)
.settings(
nativeMode := "release-fast",
nativeConfig ~= { c =>
c.withLinkingOptions(c.linkingOptions :+ "-L/opt/homebrew/opt/openssl@3/lib")
},
libraryDependencies ++= Seq(
Deps.decline.value,
Deps.`woof-core`.value,
Deps.`cats-effect-cps`.value,
),
)
lazy val cmdJVM = cmd.jvm
.enablePlugins(JavaAppPackaging)
lazy val cmdNative = cmd.native
lazy val Versions = new {
val cats = "2.10.0"
val `cats-effect` = "3.5.4"
val ip4s = "3.3.0"
val fs2 = "3.9.4"
val epollcat = "0.1.4"
val monocle = "3.2.0"
val `scodec-bits` = "1.1.37"
val bencode = "1.1.0"
val decline = "2.4.1"
val woof = "0.6.0"
val `cats-effect-cps` = "0.4.0"
}
lazy val Deps = new {
val `cats-core` = Def.setting("org.typelevel" %%% "cats-core" % Versions.cats)
val `cats-effect` = Def.setting("org.typelevel" %%% "cats-effect" % Versions.`cats-effect`)
val ip4s = Def.setting("com.comcast" %%% "ip4s-core" % Versions.ip4s)
val `fs2-io` = Def.setting("co.fs2" %%% "fs2-io" % Versions.fs2)
val `scodec-bits` = Def.setting("org.scodec" %%% "scodec-bits" % Versions.`scodec-bits`)
val `woof-core` = Def.setting("org.legogroup" %%% "woof-core" % Versions.woof)
val `monocle-core` = Def.setting("dev.optics" %%% "monocle-core" % Versions.monocle)
val `monocle-macro` = Def.setting("dev.optics" %%% "monocle-macro" % Versions.monocle)
val bencode = Def.setting("io.github.torrentdam.bencode" %%% "bencode" % Versions.bencode)
val `munit-cats-effect` = Def.setting("org.typelevel" %%% "munit-cats-effect-3" % "1.0.7")
val decline = Def.setting("com.monovore" %%% "decline-effect" % Versions.decline)
val `cats-effect-cps` = Def.setting("org.typelevel" %%% "cats-effect-cps" % Versions.`cats-effect-cps`)
}