Skip to content

Commit 9dd01f5

Browse files
committed
SCBC-489: Fix 2.13 build regression
Motivation ---------- Getting `./mvnw -Pscala-2.13 clean install` to work. The issue was that the existing scala_2.13 profile was not being activated by the new scala-2.13 profile introduced here: https://review.couchbase.org/c/couchbase-jvm-clients/+/226920 Modifications ------------- Add a `scala.version-specific.src` property that defaults to the Scala 2.12 sources. In the `scala-2.13` profile, override the property to point to Scala 2.13+ sources. Instead of declaring profiles with different build-helper-maven-plugin configurations, unconditionally add the src directory identified by `scala.version-specific.src`. Also updating the CI tests to use the new profile build mode. Change-Id: I39426f4778bd7ef6d0e478c059449e43fd5959ca Reviewed-on: https://review.couchbase.org/c/couchbase-jvm-clients/+/228435 Tested-by: Build Bot <[email protected]> Reviewed-by: Graham Pople <[email protected]>
1 parent 5ac9265 commit 9dd01f5

File tree

3 files changed

+19
-70
lines changed

3 files changed

+19
-70
lines changed

Jenkinsfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pipeline {
118118
expression { notTriggeredByGerrit() }
119119
}
120120
steps {
121-
buildScala(defaultBuildJvm(), "2.13", "2.13.16", REFSPEC)
121+
buildScala(defaultBuildJvm(), "2.13", REFSPEC)
122122
}
123123
}
124124

@@ -541,15 +541,14 @@ void test(Map args=[:],
541541

542542
void buildScala(Jvm buildJvm,
543543
String scalaCompatVersion,
544-
String scalaLibraryVersion,
545544
String refspec) {
546545
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
547546
cleanupWorkspace()
548547

549548
dir('couchbase-jvm-clients') {
550549
doCheckout(refspec)
551550
makeDeps(buildJvm)
552-
runMaven(buildJvm, null, "-Dmaven.test.skip -Dscala.compat.version=${scalaCompatVersion} -Dscala.compat.library.version=${scalaLibraryVersion} clean compile")
551+
runMaven(buildJvm, null, "-Dmaven.test.skip -Pscala-${scalaCompatVersion} clean compile")
553552
}
554553
}
555554
}

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
<scala.collection-compat.version>2.12.0</scala.collection-compat.version>
5959
<scala.compat.version>2.12</scala.compat.version>
6060
<scala.compat.library.version>2.12.20</scala.compat.library.version>
61+
<scala.version-specific.src>src/main/scala-2.13-</scala.version-specific.src>
6162

6263
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
6364
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
@@ -417,6 +418,7 @@
417418
<properties>
418419
<scala.compat.version>2.13</scala.compat.version>
419420
<scala.compat.library.version>2.13.16</scala.compat.library.version>
421+
<scala.version-specific.src>src/main/scala-2.13+</scala.version-specific.src>
420422
</properties>
421423
</profile>
422424
<profile>

scala-client/pom.xml

Lines changed: 15 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -180,73 +180,6 @@
180180

181181
</dependencies>
182182

183-
<profiles>
184-
<profile>
185-
<!-- We need 2 profile scala_2.13 & scala_NOT_2.13 to Cross-building custom scala collections.
186-
See https://docs.scala-lang.org/overviews/core/custom-collections.html#appendix-cross-building-custom-collections -->
187-
<id>scala_2.13</id>
188-
<activation>
189-
<property>
190-
<name>scala.compat.version</name>
191-
<value>2.13</value>
192-
</property>
193-
</activation>
194-
<build>
195-
<plugins>
196-
<plugin>
197-
<groupId>org.codehaus.mojo</groupId>
198-
<artifactId>build-helper-maven-plugin</artifactId>
199-
<executions>
200-
<execution>
201-
<id>add-source</id>
202-
<phase>generate-sources</phase>
203-
<goals>
204-
<goal>add-source</goal>
205-
</goals>
206-
<configuration>
207-
<sources>
208-
<source>src/main/scala-2.13+</source>
209-
</sources>
210-
</configuration>
211-
</execution>
212-
</executions>
213-
</plugin>
214-
</plugins>
215-
</build>
216-
</profile>
217-
<profile>
218-
<id>scala_NOT_2.13</id>
219-
<activation>
220-
<property>
221-
<name>scala.compat.version</name>
222-
<value>!2.13</value>
223-
</property>
224-
</activation>
225-
<build>
226-
<plugins>
227-
<plugin>
228-
<groupId>org.codehaus.mojo</groupId>
229-
<artifactId>build-helper-maven-plugin</artifactId>
230-
<executions>
231-
<execution>
232-
<id>add-source</id>
233-
<phase>generate-sources</phase>
234-
<goals>
235-
<goal>add-source</goal>
236-
</goals>
237-
<configuration>
238-
<sources>
239-
<source>src/main/scala-2.13-</source>
240-
</sources>
241-
</configuration>
242-
</execution>
243-
</executions>
244-
</plugin>
245-
</plugins>
246-
</build>
247-
</profile>
248-
</profiles>
249-
250183
<build>
251184
<sourceDirectory>src/main/scala</sourceDirectory>
252185
<testSourceDirectory>src/test/scala</testSourceDirectory>
@@ -430,6 +363,21 @@
430363
<version>${build-helper-maven-plugin.version}</version>
431364
<executions>
432365
<execution>
366+
<!-- Required for cross-building custom scala collections.
367+
See https://docs.scala-lang.org/overviews/core/custom-collections.html#appendix-cross-building-custom-collections -->
368+
<id>add-version-specific-source</id>
369+
<phase>generate-sources</phase>
370+
<goals>
371+
<goal>add-source</goal>
372+
</goals>
373+
<configuration>
374+
<sources>
375+
<source>${scala.version-specific.src}</source>
376+
</sources>
377+
</configuration>
378+
</execution>
379+
<execution>
380+
<id>add-integration-test-sources</id>
433381
<phase>generate-test-sources</phase>
434382
<goals>
435383
<goal>add-test-source</goal>

0 commit comments

Comments
 (0)