Skip to content

Commit 0e99f7a

Browse files
committed
Use sbt instead of Maven
1 parent 71c8f06 commit 0e99f7a

File tree

120 files changed

+284
-921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+284
-921
lines changed

.m2/maven-version-rules.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.m2/travis-ci-toolchains.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.travis.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
11
language: scala
22
os: linux
3+
jdk:
4+
- openjdk8
35

46
cache:
57
directories:
6-
- "$HOME/.m2"
8+
- $HOME/.sbt/
9+
- $HOME/.ivy2/cache
10+
- $HOME/.cache/coursier
711

8-
install:
9-
- which java
10-
- mvn install -DskipTests=true -DskipITs=true -Dmaven.javadoc.skip=true -B -V --toolchains .m2/travis-ci-toolchains.xml
11-
12-
jobs:
13-
include:
14-
- stage: test
15-
scala:
16-
- 2.11.12
17-
script: mvn test -pl scala/scala_2.11 -B --toolchains .m2/travis-ci-toolchains.xml
18-
jdk: openjdk8
19-
- stage: test
20-
scala:
21-
- 2.12.11
22-
script: mvn test -pl scala/scala_2.12,examples -B --toolchains .m2/travis-ci-toolchains.xml
23-
jdk: openjdk8
24-
- stage: test
25-
scala:
26-
- 2.13.2
27-
script: mvn test -pl scala/scala_2.13,examples -B --toolchains .m2/travis-ci-toolchains.xml
28-
jdk: openjdk8
12+
script:
13+
- sbt +compile +test
2914

3015
branches:
3116
only:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions

Makefile

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
SHELL := /usr/bin/env bash
22

33
default:
4-
mvn clean install
4+
sbt clean +publishLocal
55
.PHONY: default
66

7-
VERSION = $(shell mvn help:evaluate -Dexpression=project.version -q -DforceStdout 2> /dev/null)
7+
VERSION = $(shell sbt "print cucumberScala/version" | tail -n 1)
88
NEW_VERSION = $(subst -SNAPSHOT,,$(VERSION))
99
CURRENT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
1010

1111
clean:
12-
mvn clean release:clean
12+
sbt clean
1313
.PHONY: clean
1414

1515
version:
@@ -18,24 +18,6 @@ version:
1818
@echo ""
1919
.PHONY: version
2020

21-
update-compatibility:
22-
MSG_VERSION=$$(mvn help:evaluate -Dexpression=messages.version -q -DforceStdout 2> /dev/null) && \
23-
git clone --branch messages/v$$MSG_VERSION [email protected]:cucumber/cucumber.git target/cucumber
24-
rm -rf compatibility/src/test/resources/*
25-
cp -r target/cucumber/compatibility-kit/javascript/features compatibility/src/test/resources
26-
rm -rf target/cucumber
27-
.PHONY: update-compatibility
28-
29-
update-dependency-versions:
30-
mvn versions:force-releases
31-
mvn versions:update-properties -DallowMajorUpdates=false -Dmaven.version.rules="file://`pwd`/.m2/maven-version-rules.xml"
32-
.PHONY: update-dependency-versions
33-
34-
update-major-dependency-versions:
35-
mvn versions:force-releases
36-
mvn versions:update-properties -DallowMajorUpdates=true -Dmaven.version.rules="file://`pwd`/.m2/maven-version-rules.xml"
37-
.PHONY: update-major-dependency-versions
38-
3921
update-installdoc:
4022
cat docs/install.md | ./scripts/update-install-doc.sh $(NEW_VERSION) > docs/install.md.tmp
4123
mv docs/install.md.tmp docs/install.md
@@ -53,15 +35,12 @@ update-changelog:
5335

5436
.release-in-docker: default update-changelog update-installdoc .commit-and-push-changelog-and-docs
5537
[ -f '/home/cukebot/import-gpg-key.sh' ] && /home/cukebot/import-gpg-key.sh
56-
mvn --batch-mode release:clean release:prepare -DautoVersionSubmodules=true -Darguments="-DskipTests=true -DskipITs=true -Darchetype.test.skip=true"
57-
git checkout "v$(NEW_VERSION)"
58-
mvn deploy -P-examples -P-compatibility -Psign-source-javadoc -DskipTests=true -DskipITs=true -Darchetype.test.skip=true
59-
git checkout $(CURRENT_BRANCH)
60-
git fetch
38+
sbt release cross with-defaults
6139
.PHONY: release-in-docker
6240

6341
release:
6442
[ -d '../secrets' ] || git clone keybase://team/cucumberbdd/secrets ../secrets
43+
git -C ../secrets reset HEAD --hard
6544
git -C ../secrets pull
6645
../secrets/update_permissions
6746
docker pull cucumber/cucumber-build:latest
@@ -70,7 +49,8 @@ release:
7049
--volume "${shell pwd}/../secrets/import-gpg-key.sh":/home/cukebot/import-gpg-key.sh \
7150
--volume "${shell pwd}/../secrets/codesigning.key":/home/cukebot/codesigning.key \
7251
--volume "${shell pwd}/../secrets/.ssh":/home/cukebot/.ssh \
73-
--volume "${HOME}/.m2"/repository:/home/cukebot/.m2/repository \
52+
--volume "${HOME}/.ivy2":/home/cukebot/.ivy2 \
53+
--volume "${HOME}/.cache/coursier":/home/cukebot/.cache/coursier \
7454
--volume "${HOME}/.gitconfig":/home/cukebot/.gitconfig \
7555
--env-file ../secrets/secrets.list \
7656
--user 1000 \

RELEASING.md

Lines changed: 4 additions & 6 deletions

build.sbt

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
2+
import ReleaseTransformations._
3+
import xerial.sbt.Sonatype.sonatypeSettings
4+
5+
// Metadata
6+
7+
ThisBuild / organization := "io.cucumber"
8+
ThisBuild / organizationName := "Cucumber"
9+
ThisBuild / organizationHomepage := Some(url("https://github.com/cucumber"))
10+
ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/cucumber/cucumber-jvm-scala"), "scm:[email protected]:cucumber/cucumber-jvm-scala.git"))
11+
ThisBuild / developers := List(
12+
Developer("cucumber", "Cucumber Developers", "[email protected]", url("https://github.com/cucumber"))
13+
)
14+
ThisBuild / licenses := Seq(
15+
"MIT License" -> url("http://www.opensource.org/licenses/mit-license")
16+
)
17+
ThisBuild / description := "Cucumber for Scala"
18+
ThisBuild / homepage := Some(url("https://github.com/cucumber/cucumber-jvm-scala"))
19+
20+
// Scala versions
21+
22+
val scala211 = "2.11.12"
23+
val scala212 = "2.12.12"
24+
val scala213 = "2.13.3"
25+
26+
scalaVersion := scala213
27+
28+
// Library versions
29+
30+
val cucumberVersion = "6.8.2"
31+
val jacksonVersion = "2.11.3"
32+
val mockitoScalaVersion = "1.16.3"
33+
val junitVersion = "4.13.1"
34+
35+
// Projects and settings
36+
37+
lazy val commonSettings = Seq(
38+
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
39+
scalacOptions += "-target:jvm-1.8",
40+
scalacOptions ++= {
41+
CrossVersion.partialVersion(scalaVersion.value) match {
42+
case Some((2, 11)) => ScalacOptions.scalacOptions211
43+
case Some((2, 12)) => ScalacOptions.scalacOptions212
44+
case Some((2, 13)) => ScalacOptions.scalacOptions213
45+
case _ => Seq()
46+
}
47+
},
48+
)
49+
50+
lazy val root = (project in file("."))
51+
.settings(commonSettings)
52+
.settings(
53+
publishArtifact := false
54+
)
55+
.aggregate(
56+
cucumberScala.projectRefs ++
57+
examples.projectRefs: _*
58+
)
59+
60+
// Main project
61+
lazy val cucumberScala = (projectMatrix in file("cucumber-scala"))
62+
.settings(commonSettings)
63+
.settings(
64+
name := "cucumber-scala",
65+
libraryDependencies ++= Seq(
66+
"io.cucumber" % "cucumber-core" % cucumberVersion,
67+
68+
// Users have to provide it (for JacksonDefaultDataTableTransformer)
69+
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion % Provided,
70+
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion % Provided,
71+
72+
"junit" % "junit" % junitVersion % Test,
73+
"io.cucumber" % "cucumber-junit" % cucumberVersion % Test,
74+
"org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test
75+
),
76+
libraryDependencies ++= {
77+
CrossVersion.partialVersion(scalaVersion.value) match {
78+
case Some((2, n)) if n <= 12 => List("org.scala-lang.modules" %% "scala-collection-compat" % "2.2.0")
79+
case _ => Nil
80+
}
81+
},
82+
unmanagedSourceDirectories in Compile ++= {
83+
val sourceDir = (sourceDirectory in Compile).value
84+
CrossVersion.partialVersion(scalaVersion.value) match {
85+
case Some((2, n)) if n <= 11 => Seq(sourceDir / "scala-2.11")
86+
case _ => Seq()
87+
}
88+
},
89+
// Generate I18n traits
90+
Compile / sourceGenerators += Def.task {
91+
val file = (Compile / sourceManaged).value / "io/cucumber/scala" / "I18n.scala"
92+
IO.write(file, I18nGenerator.i18n)
93+
Seq(file)
94+
}.taskValue
95+
)
96+
.jvmPlatform(scalaVersions = Seq(scala213, scala212, scala211))
97+
98+
// Examples project
99+
lazy val examples = (projectMatrix in file("examples"))
100+
.settings(commonSettings)
101+
.settings(
102+
name := "scala-examples",
103+
libraryDependencies ++= Seq(
104+
"io.cucumber" % "cucumber-junit" % cucumberVersion % Test,
105+
"junit" % "junit" % junitVersion % Test
106+
),
107+
publishArtifact := false
108+
)
109+
.dependsOn(cucumberScala % Test)
110+
.jvmPlatform(scalaVersions = Seq(scala213, scala212))
111+
112+
// Release & Publish
113+
114+
Global / publishMavenStyle := true
115+
Global / publishTo := sonatypePublishToBundle.value
116+
117+
// https://github.com/sbt/sbt-pgp/issues/173
118+
Global / PgpKeys.gpgCommand := (baseDirectory.value / "gpg.sh").getAbsolutePath
119+
120+
// GPG key to sign artifacts
121+
Global / credentials += Credentials("GnuPG Key ID", "gpg", "E60E1F911B996560FFB135DAF4CABFB5B89B8BE6", "ignored")
122+
// Sonatype credentials
123+
Global / credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", "cukebot", sys.env("SONATYPE_PASSWORD"))
124+
125+
// https://github.com/xerial/sbt-sonatype#using-with-sbt-release-plugin
126+
ThisBuild / releaseCrossBuild := true
127+
ThisBuild / releaseProcess := Seq[ReleaseStep](
128+
checkSnapshotDependencies,
129+
inquireVersions,
130+
runClean,
131+
runTest,
132+
setReleaseVersion,
133+
commitReleaseVersion,
134+
tagRelease,
135+
releaseStepCommandAndRemaining("publishSigned"),
136+
releaseStepCommand("sonatypeBundleRelease"),
137+
setNextVersion,
138+
commitNextVersion,
139+
pushChanges
140+
)
File renamed without changes.

scala/sources/src/main/scala/io/cucumber/scala/ScalaDefaultTransformerDetails.scala renamed to cucumber-scala/src/main/scala/io/cucumber/scala/ScalaDefaultTransformerDetails.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.cucumber.scala
22

3-
import io.cucumber.scala.Aliases.{DefaultDataTableCellTransformerBody, DefaultDataTableEntryTransformerBody, DefaultParameterTransformerBody}
3+
import Aliases.{DefaultDataTableCellTransformerBody, DefaultDataTableEntryTransformerBody, DefaultParameterTransformerBody}
44

55
case class ScalaDefaultParameterTransformerDetails(body: DefaultParameterTransformerBody)
66

scala/sources/src/main/scala/io/cucumber/scala/ScalaDocStringTypeDetails.scala renamed to cucumber-scala/src/main/scala/io/cucumber/scala/ScalaDocStringTypeDetails.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.cucumber.scala
22

3-
import io.cucumber.scala.Aliases.DocStringDefinitionBody
3+
import Aliases.DocStringDefinitionBody
44

55
import scala.reflect.ClassTag
66

scala/sources/src/main/scala/io/cucumber/scala/ScalaDsl.scala renamed to cucumber-scala/src/main/scala/io/cucumber/scala/ScalaDsl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.cucumber.scala
22

3-
import io.cucumber.scala.Aliases._
3+
import Aliases._
44

55
import scala.reflect.ClassTag
66

scala/sources/src/main/scala/io/cucumber/scala/ScalaDslRegistry.scala renamed to cucumber-scala/src/main/scala/io/cucumber/scala/ScalaDslRegistry.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.cucumber.scala
22

3-
import io.cucumber.scala.HookType.{AFTER, AFTER_STEP, BEFORE, BEFORE_STEP}
3+
import HookType.{AFTER, AFTER_STEP, BEFORE, BEFORE_STEP}
44

55
class ScalaDslRegistry {
66

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package io.cucumber.scala
22

3-
import io.cucumber.scala.Aliases.HookDefinitionBody
3+
import Aliases.HookDefinitionBody
44

55
case class ScalaHookDetails(tagExpression: String, order: Int, body: HookDefinitionBody)

0 commit comments

Comments
 (0)