Skip to content

Commit 94ff75b

Browse files
committed
SCBC-378: Support Scala 3
The Scala 3 version of the SDK, while built from the same code-base, diverges significantly to the point that it should be considered a new major. These major changes are made: * A new Scala 3.3 build of the SDK is now to be published, alongside existing 2.12 and 2.13 builds. The 3.3 build is compatible with apps compiled with 3.3 to 3.7 inclusive, plus 2.13. It is now the primary Scala SDK build. * Reactor API is not carried forward, as the Scala Reactor Extensions library that it depends on is long-EOL. * Not carrying forward built-in support for JSON libraries (Circe, json4s etc). * Not carrying forward support for views, analytics, replica reads, all management operations, and datastructures. * There are two overloads for most API methods, one that takes an options block, and one that tries to be a convenience method offering a few popular settings. The latter is removed, significantly tidying the API. All this functionality continues to work unchanged in the Scala 2 builds. (With the small exception of the removal of a long-deprecated transactions method). Support for 2.11 has been removed. scalafmt is temporarily removed. Since this change touches almost every file in the SDK, a follow-up commit is going to scalafmt the full SDK. Testing ======= All tests pass for both Scala 2 and 3 builds. https://github.com/couchbaselabs/scala-sdk-test-matrix created to test the matrix of supported combinations. The FIT performer continues to exclusively test the 2.12 build. Change-Id: I5de11eae460fefc91144d830c0a0699af3980c03 Reviewed-on: https://review.couchbase.org/c/couchbase-jvm-clients/+/230429 Tested-by: Build Bot <[email protected]> Reviewed-by: Graham Pople <[email protected]>
1 parent 516ef26 commit 94ff75b

File tree

211 files changed

+5409
-2861
lines changed

Some content is hidden

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

211 files changed

+5409
-2861
lines changed

.github/scripts/deploy.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ cd tracing-opentelemetry ; ./shade-check.sh ; cd ..
2323

2424
./mvnw --batch-mode deploy -Dgpg.signer=bc -Dsurefire.rerunFailingTestsCount=1 --activate-profiles ${MAVEN_PROFILE}
2525
./mvnw --batch-mode clean deploy -Dgpg.signer=bc -Dmaven.test.skip=true --activate-profiles ${MAVEN_PROFILE},scala-2.13 --projects scala-implicits,scala-client
26+
./mvnw --batch-mode clean deploy -Dgpg.signer=bc -Dmaven.test.skip=true --activate-profiles ${MAVEN_PROFILE},scala-3 --projects scala-implicits,scala-client

.scalafmt.conf

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
version=2.3.2
2-
edition = 2019-10
1+
version=3.9.8
32
# Starting point was https://copperlight.github.io/scala/scalafmt-configuration-tips/
43
# https://scalameta.org/scalafmt/docs/configuration.html
5-
align = more
4+
align.preset = more
65
maxColumn = 100
76
lineEndings=preserve
7+
runner.dialect = scala213
8+
fileOverride {
9+
"glob:**/src/*/scala-3/**" {
10+
runner.dialect = scala3
11+
}
12+
"glob:**/src/*/scala-2.13-/**" {
13+
runner.dialect = scala212
14+
}
15+
}
16+
17+
docstrings.wrap = no
18+
newlines.implicitParamListModifierPrefer = before

Jenkinsfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,17 @@ pipeline {
122122
}
123123
}
124124

125+
stage('Build Scala 3 (OpenJDK 17)') {
126+
agent { label "sdkqe" }
127+
when {
128+
beforeAgent true
129+
expression { notTriggeredByGerrit() }
130+
}
131+
steps {
132+
buildScala(defaultBuildJvm(), "3", REFSPEC)
133+
}
134+
}
135+
125136
// Test against mock - this skips a lot of tests, and is intended for quick validation
126137
stage('Validation testing (mock, Oracle JDK 8)') {
127138
agent { label "sdkqe" }

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ want to build for different Scala versions, after the first `make` you can do th
5151

5252
```sh
5353
$ ./mvnw -Pscala-2.13 clean install
54+
$ ./mvnw -Pscala-3 clean install
5455
```
5556

5657
Notes:
57-
+ Couchbase provides, tests and supports builds for Scala 2.12 and 2.13.
58-
+ Default `scala.compat.`X properties are defined as properties in file [pom.xml]
59-
+ You can always go into one of the sub-directories like `core-io` to only build or test an
60-
individual project:
58+
+ Couchbase provides, tests and supports builds for Scala 2.12, 2.13 and 3.3 LTS (which in turn supports apps built with Scala 3.3 through 3.7 inclusive).
59+
+ The build is currently biased towards building Scala 2.12 by default, but this is likely to change in future.
60+
+ You can build or test an individual project as so:
6161
```shell script
6262
cd scala-client
63-
../mvnw -DskipTests clean install
63+
../mvnw -DskipTests clean install -pl scala-client -am
6464
```
6565
+ Use `-DskipTests` to skip testing.
6666

pom.xml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,23 @@
4343
<!-- 3.3.1 is the final version of the 3.x family, with 4.0 introducing breaking changes -->
4444
<scala.upickle.version>3.3.1</scala.upickle.version>
4545
<scala.collection-compat.version>2.12.0</scala.collection-compat.version>
46+
<scala.major>2</scala.major>
4647
<scala.compat.version>2.12</scala.compat.version>
4748
<scala.compat.library.version>2.12.20</scala.compat.library.version>
48-
<scala.version-specific.src>src/main/scala-2.13-</scala.version-specific.src>
49+
<scala.scala-maven-plugin.rules>-target:jvm-1.8</scala.scala-maven-plugin.rules>
50+
<!-- Should be set to the latest available version of the Scala 3.3 LTS -->
51+
<scala.scala3-library.version>3.3.6</scala.scala3-library.version>
52+
<scala.version-specific.src1>src/main/scala-2</scala.version-specific.src1>
53+
<scala.version-specific.src2>src/main/scala-2.13-</scala.version-specific.src2>
54+
<scala.version-specific.test-src>src/integrationTest/scala-2</scala.version-specific.test-src>
4955

5056
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
5157
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
5258
<maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
5359
<build-helper-maven-plugin.version>3.2.0</build-helper-maven-plugin.version>
5460
<flatten-maven-plugin.version>1.7.0</flatten-maven-plugin.version>
5561
<scala-maven-plugin.version>4.8.1</scala-maven-plugin.version>
56-
<mvn-scalafmt.version>1.1.1684076452.9f83818</mvn-scalafmt.version>
62+
<mvn-scalafmt.version>1.1.1713302731.c3d0074</mvn-scalafmt.version>
5763

5864
<!-- When changing this, make sure to update these versions:
5965
tracing-opentelemetry-deps/pom.xml opentelemetry-grpc-1.6
@@ -99,6 +105,16 @@
99105
<artifactId>scala-client_2.13</artifactId>
100106
<version>${revision}</version>
101107
</dependency>
108+
<dependency>
109+
<groupId>com.couchbase.client</groupId>
110+
<artifactId>scala-implicits_3</artifactId>
111+
<version>${revision}</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>com.couchbase.client</groupId>
115+
<artifactId>scala-client_3</artifactId>
116+
<version>${revision}</version>
117+
</dependency>
102118
<dependency>
103119
<groupId>com.couchbase.client</groupId>
104120
<artifactId>kotlin-client</artifactId>
@@ -427,7 +443,9 @@
427443
<properties>
428444
<scala.compat.version>2.13</scala.compat.version>
429445
<scala.compat.library.version>2.13.16</scala.compat.library.version>
430-
<scala.version-specific.src>src/main/scala-2.13+</scala.version-specific.src>
446+
<scala.version-specific.src1>src/main/scala-2</scala.version-specific.src1>
447+
<scala.version-specific.src2>src/main/scala-2.13</scala.version-specific.src2>
448+
<scala.version-specific.test-src>src/main/scala-2</scala.version-specific.test-src>
431449
</properties>
432450
</profile>
433451
<profile>
@@ -501,6 +519,19 @@
501519
</plugins>
502520
</build>
503521
</profile>
522+
<profile>
523+
<id>scala-3</id>
524+
<properties>
525+
<scala.major>3</scala.major>
526+
<scala.compat.version>3</scala.compat.version>
527+
<scala.compat.library.version>3.3.6</scala.compat.library.version>
528+
<scala.version-specific.src1>src/main/scala-3</scala.version-specific.src1>
529+
<!-- Maven requires this duplicate to be present -->
530+
<scala.version-specific.src2>src/main/scala-3</scala.version-specific.src2>
531+
<scala.version-specific.test-src>src/integrationTest/scala-3</scala.version-specific.test-src>
532+
<scala.scala-maven-plugin.rules></scala.scala-maven-plugin.rules>
533+
</properties>
534+
</profile>
504535
</profiles>
505536

506537
<!-- version changing -->

0 commit comments

Comments
 (0)