-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
149 lines (134 loc) · 5.04 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
ThisBuild / scalaVersion := "3.3.3"
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17"))
// === Common settings used by all modules ===
val commonSettings = Seq(
organization := "com.mobimeo",
cancelable in Global := true,
headerLicense := Some(HeaderLicense.ALv2("2021", "Mobimeo GmbH")),
licenses += ("The Apache Software License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/mobimeo/fs2-gtfs")),
developers := List(
Developer(
id = "mobimeo",
name = "Mobimeo OSS Team",
email = "opensource@mobimeo.com",
url = url("https://github.com/mobimeo")
)
),
libraryDependencies ++= Dependencies.common,
resolvers ++= Resolver.sonatypeOssRepos("public"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
testFrameworks += new TestFramework("weaver.framework.CatsEffect")
)
val noPublish = List(
publish := {},
publishLocal := {},
publishArtifact := false
)
// publishing
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches +=
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 }}"
)
)
)
// don't use sbt thin client
ThisBuild / githubWorkflowUseSbtThinClient := false
// publish website
ThisBuild / githubWorkflowAddedJobs += WorkflowJob(
id = "site",
name = "Deploy site",
needs = List("publish"),
javas = (ThisBuild / githubWorkflowJavaVersions).value.toList,
scalas = (ThisBuild / scalaVersion).value :: Nil,
cond = "startsWith(github.ref, 'refs/tags/v')".some,
steps = githubWorkflowGeneratedDownloadSteps.value.toList :+
WorkflowStep.Sbt(
List("site/makeMicrosite"),
name = Some("Compile Website")
) :+
WorkflowStep.Use(
UseRef.Public("peaceiris", "actions-gh-pages", "v3"),
name = Some(s"Deploy site"),
params = Map(
"publish_dir" -> "./site/target/site",
"github_token" -> "${{ secrets.GITHUB_TOKEN }}"
)
)
)
// === aggregating root project ===
lazy val root = project
.in(file("."))
.settings(commonSettings)
.settings(noPublish)
.settings(
test := {},
testOnly := {}
)
.aggregate(core, rules, rulesSyntax)
// === The modules ===
lazy val docsMappingsAPIDir = settingKey[String]("Name of subdirectory in site target directory for api docs")
lazy val site = project
.in(file("site"))
.enablePlugins(MicrositesPlugin)
.enablePlugins(ScalaUnidocPlugin)
.settings(commonSettings)
.settings(noPublish)
.settings(
test := {},
testOnly := {},
githubWorkflowArtifactUpload := false,
micrositeName := "fs2-gtfs Website",
micrositeDescription := "fs2 based GTFS processing library",
micrositeBaseUrl := "/fs2-gtfs",
micrositeDocumentationUrl := "/fs2-gtfs/documentation",
micrositeAuthor := "Mobimeo GmbH",
micrositeOrganizationHomepage := "https://mobimeo.com",
micrositeTwitter := "@MobimeoMobility",
micrositeGithubOwner := "mobimeo",
micrositeGithubRepo := "fs2-gtfs",
micrositeGitterChannel := false,
micrositeFooterText := Some(
"""Icons by Becris and Zulfa Mahendra from the <a href="https://thenounproject.com">Noun Project</a>"""
),
autoAPIMappings := true,
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(core, rules, rulesSyntax),
docsMappingsAPIDir := "api",
addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, docsMappingsAPIDir),
libraryDependencies ++= Dependencies.site,
tpolecatCiModeOptions ~= { opts => opts.filterNot(_ == ScalacOptions.fatalWarnings) },
mdocExtraArguments := Seq("--no-link-hygiene"),
githubWorkflowArtifactUpload := false
)
.dependsOn(core, rules, rulesSyntax)
ThisBuild / githubWorkflowBuildPostamble ++= List(
WorkflowStep.Sbt(
List("site/mdoc"),
name = Some("Compile Documentation")
)
)
lazy val core = project
.in(file("core"))
.settings(commonSettings)
.settings(
name := "fs2-gtfs-core",
libraryDependencies ++= Dependencies.core
)
lazy val rules = project
.in(file("rules"))
.settings(commonSettings)
.settings(name := "fs2-gtfs-rules", libraryDependencies ++= Dependencies.rules)
.dependsOn(core)
lazy val rulesSyntax = project
.in(file("rules/syntax"))
.settings(commonSettings)
.settings(name := "fs2-gtfs-rules-syntax", libraryDependencies ++= Dependencies.rulesSyntax)
.dependsOn(rules)