-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
122 lines (113 loc) · 3.47 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
import ReleaseTransformations._
import UpdateReadme.updateReadme
val scala213Version = "2.13.16"
val defaultScalacOptions = Seq(
"-deprecation",
"-encoding", "UTF-8",
"-Xlint",
"-language:implicitConversions", "-language:higherKinds", "-language:existentials",
"-unchecked"
)
lazy val root = project.in(file("."))
.settings(
publishArtifact := false,
publish := {},
publishLocal := {}
)
.settings(publishSettings)
.aggregate(
featherweightGoCoreJVM,
featherweightGoCoreJS,
featherweightGoJS,
featherweightGoJVM
)
lazy val featherweightGo = (crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Full) in file("."))
.settings(
scalaVersion := scala213Version,
scalacOptions ++= defaultScalacOptions,
publishArtifact := false,
publish := {},
publishLocal := {}
)
.settings(publishSettings)
.dependsOn(
featherweightGoCore
)
.jsSettings(
scalacOptions += {
val a = (LocalRootProject / baseDirectory).value.toURI.toString
val g = "https://raw.githubusercontent.com/y-yu/featherweight_go/" + tagOrHash.value
s"-P:scalajs:mapSourceURI:$a->$g/"
}
)
.jvmSettings(
mainClass := Some("featherweightgo.Main")
)
lazy val featherweightGoCore = (crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Pure) in file("./core"))
.settings(
organization := "com.github.y-yu",
name := "featherweight_go",
description := "Scala implementation of Featherweight (Generics) Go",
homepage := Some(url("https://github.com/y-yu")),
licenses := Seq("MIT" -> url(s"https://github.com/y-yu/featherweight_go/blob/master/LICENSE")),
scalaVersion := scala213Version,
scalacOptions ++= defaultScalacOptions,
libraryDependencies ++= Seq(
"org.scala-lang.modules" %%% "scala-parser-combinators" % "2.4.0",
"org.scalatest" %%% "scalatest" % "3.2.19" % "test",
"com.lihaoyi" %%% "pprint" % "0.9.0"
)
)
.settings(publishSettings)
lazy val featherweightGoCoreJVM = featherweightGoCore.jvm
lazy val featherweightGoCoreJS = featherweightGoCore.js
lazy val featherweightGoJVM = featherweightGo.jvm
lazy val featherweightGoJS = featherweightGo.js
lazy val publishSettings = Seq(
publishMavenStyle := true,
publishTo := (
if (isSnapshot.value)
Opts.resolver.sonatypeOssSnapshots.headOption
else
Some(Opts.resolver.sonatypeStaging)
),
Test / publishArtifact := false,
pomExtra :=
<developers>
<developer>
<id>y-yu</id>
<name>Yoshimura Hikaru</name>
<url>https://github.com/y-yu</url>
</developer>
</developers>
<scm>
<url>[email protected]:y-yu/featherweight_go.git</url>
<connection>scm:git:[email protected]:y-yu/featherweight_go.git</connection>
<tag>{tagOrHash.value}</tag>
</scm>,
releaseTagName := tagName.value,
releaseCrossBuild := false,
releaseProcess := List[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
updateReadme,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("^ publishSigned"),
setNextVersion,
updateReadme,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll"),
pushChanges
)
)
val tagName = Def.setting {
s"v${if (releaseUseGlobalVersion.value) (ThisBuild / version).value else version.value}"
}
val tagOrHash = Def.setting {
if (isSnapshot.value) sys.process.Process("git rev-parse HEAD").lineStream_!.head
else tagName.value
}