Skip to content

Commit

Permalink
Update dependencies / Makefile + add Maven profile to support build w…
Browse files Browse the repository at this point in the history
…ith Scala 2.12 (apache#9339)

* Update dependencies and add Maven profile to support build with Scala 2.12

* Add empty profile for current Scala (2.11) and Makefile variable for Scala version

* remove the need to alter Scala version in Makefile, move Scala props inside Maven profiles

* reinstate top level scala version props to fix resulting errors in pom files
  • Loading branch information
EmergentOrder authored and yzhliu committed Jan 10, 2018
1 parent 46cf856 commit fd5e5fe
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 11 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ROOTDIR = $(CURDIR)

SCALA_VERSION_PROFILE := scala-2.11

ifeq ($(OS),Windows_NT)
UNAME_S := Windows
else
Expand Down Expand Up @@ -503,30 +505,30 @@ rpkgtest:

scalaclean:
(cd $(ROOTDIR)/scala-package; \
mvn clean -P$(SCALA_PKG_PROFILE))
mvn clean -P$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE))

scalapkg:
(cd $(ROOTDIR)/scala-package; \
mvn package -P$(SCALA_PKG_PROFILE) -Dcxx="$(CXX)" \
mvn package -P$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE) -Dcxx="$(CXX)" \
-Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)" \
-Dcurrent_libdir="$(ROOTDIR)/lib" \
-Dlddeps="$(LIB_DEP) $(ROOTDIR)/lib/libmxnet.a")

scalatest:
(cd $(ROOTDIR)/scala-package; \
mvn verify -P$(SCALA_PKG_PROFILE) -Dcxx="$(CXX)" \
mvn verify -P$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE) -Dcxx="$(CXX)" \
-Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)" \
-Dlddeps="$(LIB_DEP) $(ROOTDIR)/lib/libmxnet.a" $(SCALA_TEST_ARGS))

scalainstall:
(cd $(ROOTDIR)/scala-package; \
mvn install -P$(SCALA_PKG_PROFILE) -DskipTests -Dcxx="$(CXX)" \
mvn install -P$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE) -DskipTests -Dcxx="$(CXX)" \
-Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)" \
-Dlddeps="$(LIB_DEP) $(ROOTDIR)/lib/libmxnet.a")

scaladeploy:
(cd $(ROOTDIR)/scala-package; \
mvn deploy -Prelease,$(SCALA_PKG_PROFILE) -DskipTests -Dcxx="$(CXX)" \
mvn deploy -Prelease,$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE) -DskipTests -Dcxx="$(CXX)" \
-Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)" \
-Dlddeps="$(LIB_DEP) $(ROOTDIR)/lib/libmxnet.a")

Expand Down
5 changes: 4 additions & 1 deletion scala-package/dev/change-scala-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export -f sed_i
BASEDIR=$(dirname $0)/..
find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
-exec bash -c "sed_i 's/\(artifactId.*\)_'$FROM_VERSION'/\1_'$TO_VERSION'/g' {}" \;


find "$BASEDIR/.." -name 'Makefile' -not -path '*target*' -print \
-exec bash -c "sed_i 's/'$FROM_VERSION'/'$TO_VERSION'/g' {}" \;

# Also update <scala.binary.version> in parent POM
# Match any scala binary version to ensure idempotency
sed_i '1,/<scala\.binary\.version>[0-9]*\.[0-9]*</s/<scala\.binary\.version>[0-9]*\.[0-9]*</<scala.binary.version>'$TO_VERSION'</' \
Expand Down
6 changes: 3 additions & 3 deletions scala-package/examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@
<dependency>
<groupId>com.sksamuel.scrimage</groupId>
<artifactId>scrimage-core_2.11</artifactId>
<version>2.1.5</version>
<version>2.1.8</version>
</dependency>
<dependency>
<groupId>com.sksamuel.scrimage</groupId>
<artifactId>scrimage-io-extra_2.11</artifactId>
<version>2.1.5</version>
<version>2.1.8</version>
</dependency>
<dependency>
<groupId>com.sksamuel.scrimage</groupId>
<artifactId>scrimage-filters_2.11</artifactId>
<version>2.1.5</version>
<version>2.1.8</version>
</dependency>
<dependency>
<groupId>nu.pattern</groupId>
Expand Down
72 changes: 70 additions & 2 deletions scala-package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,74 @@
</plugins>
</build>
</profile>

<profile>
<id>scala-2.11</id>
<properties>
<scala.version>2.11.8</scala.version>
<scala.binary.version>2.11</scala.binary.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes combine.children="append">
<exclude>*:*_2.12</exclude>
<exclude>*:*_2.10</exclude>
</excludes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>scala-2.12</id>
<properties>
<scala.version>2.12.4</scala.version>
<scala.binary.version>2.12</scala.binary.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes combine.children="append">
<exclude>*:*_2.11</exclude>
<exclude>*:*_2.10</exclude>
</excludes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<distributionManagement>
Expand Down Expand Up @@ -309,7 +377,7 @@
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.binary.version}</artifactId>
<version>2.2.4</version>
<version>3.0.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -320,7 +388,7 @@
<dependency>
<groupId>org.scalacheck</groupId>
<artifactId>scalacheck_${scala.binary.version}</artifactId>
<version>1.11.3</version>
<version>1.13.5</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down

0 comments on commit fd5e5fe

Please sign in to comment.