-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
94 lines (85 loc) · 3.79 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
import sbtrelease.*
import ReleaseStateTransformations.*
import sbtversionpolicy.withsbtrelease.ReleaseVersion
val contentEntityVersion = "4.0.0"
val scroogeVersion = "22.1.0" // remember to also update plugins.sbt if the scrooge version changes
val thriftVersion = "0.20.0" // remember to also update package.json if the thrift version changes
val artifactProductionSettings = Seq(
organization := "com.gu",
scalaVersion := "2.13.12",
// downgrade scrooge reserved word clashes to warnings
Compile / scroogeDisableStrict := true,
// Scrooge 21.3.0 dropped support for scala < 2.12, so we can only build for Scala 2.12+
// https://twitter.github.io/scrooge/changelog.html#id11
crossScalaVersions := Seq("2.12.18", scalaVersion.value),
licenses := Seq(License.Apache2)
/*
Test / testOptions +=
Tests.Argument(TestFrameworks.ScalaTest, "-u", s"test-results/scala-${scalaVersion.value}", "-o")
*/ // Need to uncomment when testcases gets added.Also to change ci.yml to add "Build and Test" as well.
)
lazy val root = Project(id = "root", base = file("."))
.aggregate(thrift, scalaClasses)
.settings(
publish / skip := true,
releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion
)
)
lazy val thrift = Project(id = "content-atom-model-thrift", base = file("thrift"))
.settings(artifactProductionSettings)
.disablePlugins(ScroogeSBT)
.settings(
description := "Content atom model Thrift files",
crossPaths := false,
packageDoc / publishArtifact := false,
packageSrc / publishArtifact := false,
unmanagedResources / includeFilter := "*.thrift",
Compile / unmanagedResourceDirectories += { baseDirectory.value / "src/main/thrift" }
)
lazy val scalaClasses = Project(id = "content-atom-model", base = file("scala"))
.settings(artifactProductionSettings)
.settings(
description := "Scala library built from Content-atom thrift definition",
Compile / scroogeThriftSourceFolder := baseDirectory.value / "../thrift/src/main/thrift",
Compile / scroogeThriftOutputFolder := sourceManaged.value,
Compile / scroogeThriftDependencies ++= Seq("content-entity-thrift"),
resolvers += Resolver.sonatypeRepo("public"),
libraryDependencies ++= Seq(
"com.gu" % "content-entity-thrift" % contentEntityVersion,
"com.gu" %% "content-entity-model" % contentEntityVersion,
"org.apache.thrift" % "libthrift" % thriftVersion,
"com.twitter" %% "scrooge-core" % scroogeVersion
),
// Include the Thrift file in the published jar
Compile / scroogePublishThrift := true
)
lazy val typescriptClasses = (project in file("ts"))
.enablePlugins(ScroogeTypescriptGen)
.settings(artifactProductionSettings)
.settings(
name := "content-atom-typescript",
scroogeTypescriptNpmPackageName := "@guardian/content-atom-model",
Compile / scroogeDefaultJavaNamespace := scroogeTypescriptNpmPackageName.value,
Test / scroogeDefaultJavaNamespace := scroogeTypescriptNpmPackageName.value,
description := "Typescript library built from Content-atom thrift definition",
Compile / scroogeLanguages := Seq("typescript"),
Compile / scroogeThriftSourceFolder := baseDirectory.value / "../thrift/src/main/thrift",
scroogeTypescriptPackageLicense := "Apache-2.0",
Compile / scroogeThriftDependencies ++= Seq("content-entity-thrift"),
scroogeTypescriptPackageMapping := Map(
"content-entity-thrift" -> "@guardian/content-entity-model"
),
libraryDependencies ++= Seq(
"com.gu" % "content-entity-thrift" % contentEntityVersion
)
)