Skip to content

Commit 7465762

Browse files
committed
Configure publishing of the sbt plugin and tools library
Refs #60
1 parent eb15502 commit 7465762

File tree

5 files changed

+73
-10
lines changed

5 files changed

+73
-10
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ This tool generates Scala Native bindings from C headers. It's built upon clang
66

77
[Documentation](https://kornilova-l.github.io/scala-native-bindgen/)
88

9+
## Releasing
10+
11+
To release version `x.y.z` run:
12+
13+
> sbt -Dproject.version=x.y.z release
14+
915
## License
1016

1117
This project is distributed under the Scala license.

build.sbt

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ val Versions = new {
1212

1313
inThisBuild(
1414
Def.settings(
15-
organization := "org.scalanative.bindgen",
16-
version := "0.2-SNAPSHOT",
15+
organization := "org.scala-native.bindgen",
16+
licenses := Seq(
17+
"BSD 3-Clause" -> url("https://www.scala-lang.org/license/")),
18+
homepage := Some(url("https://kornilova-l.github.io/scala-native-bindgen")),
1719
scalacOptions ++= Seq(
1820
"-deprecation",
1921
"-unchecked",
@@ -24,7 +26,20 @@ inThisBuild(
2426
scmInfo := Some(
2527
ScmInfo(url("https://github.com/kornilova-l/scala-native-bindgen"),
2628
"scm:git:git@github.com:kornilova-l/scala-native-bindgen.git")),
27-
git.remoteRepo := scmInfo.value.get.connection.replace("scm:git:", "")
29+
developers := List(
30+
Developer(
31+
id = "kornilova-l",
32+
name = "Liudmila Kornilova",
33+
email = "kornilova-l@users.noreply.github.com",
34+
url = url("https://github.com/kornilova-l")
35+
),
36+
Developer(
37+
id = "jonas",
38+
name = "Jonas Fonseca",
39+
email = "jonas@users.noreply.github.com",
40+
url = url("https://github.com/jonas")
41+
)
42+
)
2843
))
2944

3045
val root = project("scala-native-bindgen")
@@ -36,10 +51,31 @@ val root = project("scala-native-bindgen")
3651
sbtPlugin,
3752
docs
3853
)
54+
.enablePlugins(ReleasePlugin)
55+
.settings(
56+
skip in publish := true,
57+
releaseCrossBuild := false,
58+
releaseVersionFile := target.value / "unused-version.sbt",
59+
releaseProcess := {
60+
import ReleaseTransformations._
61+
Seq[ReleaseStep](
62+
checkSnapshotDependencies,
63+
setReleaseVersions(version.in(ThisBuild).value),
64+
runClean,
65+
releaseStepCommandAndRemaining("verify"),
66+
setReleaseVersion,
67+
tagRelease,
68+
releaseStepCommandAndRemaining("^publish"),
69+
pushChanges,
70+
releaseStepTask(docs / ghpagesPushSite)
71+
)
72+
}
73+
)
3974

4075
lazy val tests = project("tests")
4176
.dependsOn(tools)
4277
.settings(
78+
skip in publish := true,
4379
fork in Test := true,
4480
javaOptions in Test += {
4581
val rootDir = (ThisBuild / baseDirectory).value
@@ -57,6 +93,7 @@ lazy val samples = project("samples")
5793
.in(file("tests/samples"))
5894
.enablePlugins(ScalaNativePlugin)
5995
.settings(
96+
skip in publish := true,
6097
scalaVersion := Versions.scala211,
6198
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.6.3" % "test",
6299
testFrameworks += new TestFramework("utest.runner.Framework"),
@@ -121,6 +158,7 @@ lazy val sbtPlugin = project("sbt-scala-native-bindgen", ScriptedPlugin)
121158
lazy val docs = project("docs")
122159
.enablePlugins(GhpagesPlugin, ParadoxSitePlugin, ParadoxMaterialThemePlugin)
123160
.settings(
161+
skip in publish := true,
124162
paradoxProperties in Paradox ++= Map(
125163
"github.base_url" -> scmInfo.value.get.browseUrl.toString
126164
),
@@ -134,15 +172,31 @@ lazy val docs = project("docs")
134172

135173
def project(name: String, plugged: AutoPlugin*) = {
136174
val unplugged = Seq(ScriptedPlugin).filterNot(plugged.toSet)
175+
137176
Project(id = name, base = file(name))
138177
.disablePlugins(unplugged: _*)
178+
.enablePlugins(GitPlugin)
179+
.enablePlugins(GitVersioning)
139180
.settings(
181+
versionWithGit,
182+
git.useGitDescribe := true,
183+
git.remoteRepo := scmInfo.value.get.connection.replace("scm:git:", ""),
140184
crossSbtVersions := List(Versions.sbt013, Versions.sbt1),
141185
scalaVersion := {
142186
(pluginCrossBuild / sbtBinaryVersion).value match {
143187
case "0.13" => Versions.scala210
144188
case _ => Versions.scala212
145189
}
146-
}
190+
},
191+
bintrayOrganization := Some("scala-native-bindgen"),
192+
bintrayRepository := {
193+
if (Keys.sbtPlugin.value) "sbt-plugins"
194+
else "maven"
195+
},
196+
publishMavenStyle := Keys.sbtPlugin.value == false,
197+
publishArtifact in Test := false
147198
)
148199
}
200+
201+
lazy val setReleaseVersions: String => State => State =
202+
v => _.put(ReleaseKeys.versions, (v, v))

project/plugins.sbt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8")
2-
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.2")
3-
addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.4.0")
4-
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")
1+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8")
2+
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.2")
3+
addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.4.0")
4+
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.2")
5+
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
6+
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")
7+
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")
58

69
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value

sbt-scala-native-bindgen/src/sbt-test/bindgen/generate/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name := "test"
2-
organization := "org.scalanative.bindgen.sbt.test"
2+
organization := "org.scala-native.bindgen.sbt.test"
33
enablePlugins(ScalaNativeBindgenPlugin)
44
scalaVersion := "2.11.12"
55

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
addSbtPlugin(
2-
"org.scalanative.bindgen" % "sbt-scala-native-bindgen" % sys.props(
2+
"org.scala-native.bindgen" % "sbt-scala-native-bindgen" % sys.props(
33
"plugin.version"))

0 commit comments

Comments
 (0)