-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sbt
125 lines (118 loc) · 3.59 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
// plugin version
ThisBuild / dynverSonatypeSnapshots := true
ThisBuild / version := {
val orig = (ThisBuild / version).value
if (orig.endsWith("-SNAPSHOT")) "4.0.0-SNAPSHOT" else orig
}
// metadata
ThisBuild / organization := "com.github.sbt"
ThisBuild / organizationName := "sbt"
ThisBuild / organizationHomepage := Some(url("https://www.scala-sbt.org/"))
ThisBuild / homepage := Some(url("https://github.com/sbt/sbt-avro"))
ThisBuild / licenses += ("BSD 3-Clause", url("https://github.com/sbt/sbt-avro/blob/main/LICENSE"))
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/sbt/sbt-avro"), "scm:git:[email protected]:sbt/sbt-avro.git")
)
ThisBuild / developers := List(
Developer(
id = "nevillelyh",
name = "Neville Li",
email = "@nevillelyh",
url = url("https://www.lyh.me/")
),
Developer(
id = "RustedBones",
name = "Michel Davit",
email = "[email protected]",
url = url("https://michel.davit.fr")
)
)
// sbt-github-actions
lazy val scala3 = "3.3.4"
lazy val scala212 = "2.12.20"
ThisBuild / scalaVersion := scala3
ThisBuild / crossScalaVersions := Seq(scala3, scala212)
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(name = Some("Build project"), commands = List("compile", "test", "scripted"))
)
ThisBuild / githubWorkflowTargetBranches := Seq("main")
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11"))
ThisBuild / githubWorkflowTargetTags := Seq("v*")
ThisBuild / githubWorkflowBuildPreamble := Seq(
WorkflowStep.Sbt(
name = Some("Check formatting"),
commands = List("scalafmtSbtCheck", "scalafmtCheckAll")
)
)
ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v")))
ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
name = Some("Release"),
commands = 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 }}"
)
)
)
// compilers
ThisBuild / javacOptions ++= Seq("--release", "8")
ThisBuild / scalacOptions ++= Seq("-release", "8")
lazy val `sbt-avro-parent`: Project = project
.in(file("."))
.settings(
publish / skip := true
)
.aggregate(
`sbt-avro-compiler-api`,
`sbt-avro-compiler-bridge`,
`sbt-avro`
)
lazy val `sbt-avro-compiler-api`: Project = project
.in(file("api"))
.settings(
crossPaths := false,
autoScalaLibrary := false
)
lazy val `sbt-avro-compiler-bridge`: Project = project
.in(file("bridge"))
.dependsOn(`sbt-avro-compiler-api`)
.settings(
crossPaths := false,
autoScalaLibrary := false,
libraryDependencies ++= Seq(
Dependencies.Provided.AvroCompiler,
Dependencies.Test.Specs2Core
)
)
lazy val `sbt-avro`: Project = project
.in(file("plugin"))
.dependsOn(
`sbt-avro-compiler-api`,
`sbt-avro-compiler-bridge` % "test"
)
.enablePlugins(BuildInfoPlugin, SbtPlugin)
.settings(
description := "Sbt plugin for compiling Avro sources",
(pluginCrossBuild / sbtVersion) := {
scalaBinaryVersion.value match {
case "2.12" => "1.5.0"
case _ => "2.0.0-M2"
}
},
scriptedSbt := {
scalaBinaryVersion.value match {
case "2.12" => "1.10.3"
case _ => "2.0.0-M2"
}
},
buildInfoKeys := Seq[BuildInfoKey](name, version),
buildInfoPackage := "com.github.sbt.avro",
scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
"-Dplugin.version=" + version.value
),
scriptedBufferLog := false
)