-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
134 lines (118 loc) · 4 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
// About
inThisBuild(
List(
organization := "org.sangria-graphql",
homepage := Some(url("https://github.com/sangria-graphql/sangria-federated/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer("xsoufiane", "Soufiane Maguerra", "", url("https://github.com/xsoufiane")),
Developer("yanns", "Yann Simon", "", url("https://github.com/yanns"))),
scmInfo := Some(
ScmInfo(
browseUrl = url("https://github.com/sangria-graphql/sangria-federated"),
connection = "scm:git:git@github.com:sangria-graphql/sangria-federated.git"
))
)
)
// Build
ThisBuild / crossScalaVersions := Seq("2.12.20", "2.13.15")
ThisBuild / scalaVersion := crossScalaVersions.value.last
ThisBuild / githubWorkflowBuildPreamble ++= List(
WorkflowStep.Sbt(List("scalafmtCheckAll"), name = Some("Check formatting"))
)
// Release
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches :=
Seq(RefPredicate.StartsWith(Ref.Tag("v")))
ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
List("ci-release"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)
)
lazy val root = (project in file("."))
.settings(
name := "sangria-federated",
description := "Federation for Sangria"
)
.settings(noPublishSettings)
.aggregate(core, exampleCommon, exampleReview, exampleState, exampleProduct, exampleTest)
lazy val core = libraryProject("core")
.settings(
name := "sangria-federated",
description := "Sangria federated",
libraryDependencies ++= Seq(
Dependencies.sangria,
Dependencies.scalapbRuntime
),
Compile / PB.targets := Seq(
scalapb.gen(grpc = false) -> (Compile / sourceManaged).value / "scalapb"
),
libraryDependencies ++= Seq(
Dependencies.scalaTest,
Dependencies.circeGeneric,
Dependencies.circeParser,
Dependencies.sangriaCirce
).map(_ % Test)
)
lazy val exampleReview = exampleProject("example-review")
.dependsOn(exampleCommon)
.settings(libraryDependencies ++= serviceDependencies)
lazy val exampleState = exampleProject("example-state")
.dependsOn(exampleCommon)
.settings(libraryDependencies ++= serviceDependencies)
lazy val exampleProduct = exampleProject("example-product")
.dependsOn(core)
.settings(libraryDependencies ++= Seq(
Dependencies.sangriaCirce,
Dependencies.http4sEmberServer,
Dependencies.http4sCirce,
Dependencies.http4sDsl,
Dependencies.circeOptics,
Dependencies.circeGeneric,
Dependencies.circeCore
))
lazy val serviceDependencies = Seq(
Dependencies.logbackClassic,
Dependencies.circeGeneric
)
lazy val exampleCommon = exampleProject("example-common")
.dependsOn(core)
.settings(
libraryDependencies ++= Seq(
Dependencies.catsEffect,
Dependencies.http4sEmberServer,
Dependencies.http4sCirce,
Dependencies.http4sDsl,
Dependencies.circeOptics,
Dependencies.sangria,
Dependencies.sangriaCirce
)
)
lazy val exampleTest = exampleProject("example-test")
.dependsOn(exampleReview, exampleState)
.settings(
libraryDependencies ++= Seq(Dependencies.weaver, Dependencies.fs2Process).map(_ % Test),
testFrameworks += new TestFramework("weaver.framework.CatsEffect")
)
def libraryProject(name: String) = newProject(name)
def exampleProject(name: String) =
newProject(name)
.in(file(name.replace("example-", "example/")))
.settings(noPublishSettings)
def newProject(name: String) =
Project(name, file(name))
.settings(commonSettings)
lazy val commonSettings = Seq(
scalacOptions ++= Seq("-deprecation", "-feature"),
scalacOptions += "-target:jvm-1.8",
javacOptions ++= Seq("-source", "8", "-target", "8")
)
lazy val noPublishSettings = Seq(
publish / skip := true
)