distributedlog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject incubator-distributedlog git commit: DL-49: Support building project with scala 2.10 and 2.11
Date Sat, 03 Dec 2016 06:45:46 GMT
Repository: incubator-distributedlog
Updated Branches:
  refs/heads/master e4dce21cb -> f03249dfb


DL-49: Support building project with scala 2.10 and 2.11

Author: Sijie Guo <sijieg@twitter.com>
Author: Sijie Guo <sijie@apache.org>

Reviewers: Franck Cuny <franck.cuny@gmail.com>

Closes #22 from sijie/sijie/support_scala_2.10_and_2.11


Project: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/commit/f03249df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/tree/f03249df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/diff/f03249df

Branch: refs/heads/master
Commit: f03249dfbfa976a851377645c24cc5c3ff30bd74
Parents: e4dce21
Author: Sijie Guo <sijieg@twitter.com>
Authored: Fri Dec 2 22:45:43 2016 -0800
Committer: Sijie Guo <sijie@apache.org>
Committed: Fri Dec 2 22:45:43 2016 -0800

----------------------------------------------------------------------
 .travis.yml                                     |  5 ++
 distributedlog-core/pom.xml                     |  4 -
 .../distributedlog/basic/AtomicWriter.java      |  4 +-
 .../basic/ConsoleProxyMultiWriter.java          |  4 +-
 .../basic/ConsoleProxyWriter.java               |  4 +-
 .../distributedlog/basic/RecordGenerator.java   |  4 +-
 .../ConsoleProxyPartitionedMultiWriter.java     |  4 +-
 .../messaging/ConsoleProxyRRMultiWriter.java    |  4 +-
 scripts/change-scala-version.sh                 | 92 ++++++++++++++++++++
 9 files changed, 109 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 7c177fc..eb91334 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,11 +19,16 @@ matrix:
   include:
     - os: osx
       osx_image: xcode8
+      env: SCALA_VERSION="2.10"
+    - os: osx
+      osx_image: xcode8
+      env: SCALA_VERSION="2.11"
 
 before_install:
   - echo "MAVEN_OPTS='-Xmx3072m -XX:MaxPermSize=512m'" > ~/.mavenrc
 
 script:
+  - travis_retry ./scripts/change-scala-version.sh $SCALA_VERSION
   - travis_retry mvn --batch-mode clean apache-rat:check
   - travis_retry mvn --batch-mode clean install findbugs:check -DskipTests=true
 

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/distributedlog-core/pom.xml
----------------------------------------------------------------------
diff --git a/distributedlog-core/pom.xml b/distributedlog-core/pom.xml
index c7a0431..20d3139 100644
--- a/distributedlog-core/pom.xml
+++ b/distributedlog-core/pom.xml
@@ -39,10 +39,6 @@
           <groupId>org.slf4j</groupId>
           <artifactId>slf4j-log4j12</artifactId>
         </exclusion>
-        <exclusion>
-          <groupId>com.twitter</groupId>
-          <artifactId>finagle-core_2.11</artifactId>
-        </exclusion>
       </exclusions>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/AtomicWriter.java
----------------------------------------------------------------------
diff --git a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/AtomicWriter.java
b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/AtomicWriter.java
index 92f5d46..1f9cc9e 100644
--- a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/AtomicWriter.java
+++ b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/AtomicWriter.java
@@ -24,7 +24,7 @@ import com.twitter.distributedlog.io.CompressionCodec.Type;
 import com.twitter.distributedlog.service.DistributedLogClient;
 import com.twitter.distributedlog.service.DistributedLogClientBuilder;
 import com.twitter.distributedlog.util.FutureUtils;
-import com.twitter.finagle.thrift.ClientId;
+import com.twitter.finagle.thrift.ClientId$;
 import com.twitter.util.Future;
 import com.twitter.util.FutureEventListener;
 import com.twitter.util.Promise;
@@ -53,7 +53,7 @@ public class AtomicWriter {
         System.arraycopy(args, 2, messages, 0, messages.length);
 
         DistributedLogClient client = DistributedLogClientBuilder.newBuilder()
-                .clientId(ClientId.apply("atomic-writer"))
+                .clientId(ClientId$.MODULE$.apply("atomic-writer"))
                 .name("atomic-writer")
                 .thriftmux(true)
                 .finagleNameStr(finagleNameStr)

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyMultiWriter.java
----------------------------------------------------------------------
diff --git a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyMultiWriter.java
b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyMultiWriter.java
index f9d245c..e5a52d0 100644
--- a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyMultiWriter.java
+++ b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyMultiWriter.java
@@ -22,7 +22,7 @@ import com.twitter.distributedlog.DLSN;
 import com.twitter.distributedlog.client.DistributedLogMultiStreamWriter;
 import com.twitter.distributedlog.service.DistributedLogClient;
 import com.twitter.distributedlog.service.DistributedLogClientBuilder;
-import com.twitter.finagle.thrift.ClientId;
+import com.twitter.finagle.thrift.ClientId$;
 import com.twitter.util.FutureEventListener;
 import jline.ConsoleReader;
 import org.apache.commons.lang.StringUtils;
@@ -49,7 +49,7 @@ public class ConsoleProxyMultiWriter {
         final String streamList = args[1];
 
         DistributedLogClient client = DistributedLogClientBuilder.newBuilder()
-                .clientId(ClientId.apply("console-proxy-writer"))
+                .clientId(ClientId$.MODULE$.apply("console-proxy-writer"))
                 .name("console-proxy-writer")
                 .thriftmux(true)
                 .finagleNameStr(finagleNameStr)

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyWriter.java
----------------------------------------------------------------------
diff --git a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyWriter.java
b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyWriter.java
index 3e98b27..d719015 100644
--- a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyWriter.java
+++ b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/ConsoleProxyWriter.java
@@ -20,7 +20,7 @@ package com.twitter.distributedlog.basic;
 import com.twitter.distributedlog.*;
 import com.twitter.distributedlog.service.DistributedLogClient;
 import com.twitter.distributedlog.service.DistributedLogClientBuilder;
-import com.twitter.finagle.thrift.ClientId;
+import com.twitter.finagle.thrift.ClientId$;
 import com.twitter.util.FutureEventListener;
 import jline.ConsoleReader;
 
@@ -46,7 +46,7 @@ public class ConsoleProxyWriter {
         final String streamName = args[1];
 
         DistributedLogClient client = DistributedLogClientBuilder.newBuilder()
-                .clientId(ClientId.apply("console-proxy-writer"))
+                .clientId(ClientId$.MODULE$.apply("console-proxy-writer"))
                 .name("console-proxy-writer")
                 .thriftmux(true)
                 .finagleNameStr(finagleNameStr)

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/RecordGenerator.java
----------------------------------------------------------------------
diff --git a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/RecordGenerator.java
b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/RecordGenerator.java
index e759f12..63b03f5 100644
--- a/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/RecordGenerator.java
+++ b/distributedlog-tutorials/distributedlog-basic/src/main/java/com/twitter/distributedlog/basic/RecordGenerator.java
@@ -21,7 +21,7 @@ import com.google.common.util.concurrent.RateLimiter;
 import com.twitter.distributedlog.DLSN;
 import com.twitter.distributedlog.service.DistributedLogClient;
 import com.twitter.distributedlog.service.DistributedLogClientBuilder;
-import com.twitter.finagle.thrift.ClientId;
+import com.twitter.finagle.thrift.ClientId$;
 import com.twitter.util.FutureEventListener;
 
 import java.nio.ByteBuffer;
@@ -50,7 +50,7 @@ public class RecordGenerator {
         RateLimiter limiter = RateLimiter.create(rate);
 
         DistributedLogClient client = DistributedLogClientBuilder.newBuilder()
-                .clientId(ClientId.apply("record-generator"))
+                .clientId(ClientId$.MODULE$.apply("record-generator"))
                 .name("record-generator")
                 .thriftmux(true)
                 .finagleNameStr(finagleNameStr)

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyPartitionedMultiWriter.java
----------------------------------------------------------------------
diff --git a/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyPartitionedMultiWriter.java
b/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyPartitionedMultiWriter.java
index 73d153a..da804b6 100644
--- a/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyPartitionedMultiWriter.java
+++ b/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyPartitionedMultiWriter.java
@@ -20,7 +20,7 @@ package com.twitter.distributedlog.messaging;
 import com.twitter.distributedlog.DLSN;
 import com.twitter.distributedlog.service.DistributedLogClient;
 import com.twitter.distributedlog.service.DistributedLogClientBuilder;
-import com.twitter.finagle.thrift.ClientId;
+import com.twitter.finagle.thrift.ClientId$;
 import com.twitter.util.Future;
 import com.twitter.util.FutureEventListener;
 import jline.ConsoleReader;
@@ -70,7 +70,7 @@ public class ConsoleProxyPartitionedMultiWriter {
         final String streamList = args[1];
 
         DistributedLogClient client = DistributedLogClientBuilder.newBuilder()
-                .clientId(ClientId.apply("console-proxy-writer"))
+                .clientId(ClientId$.MODULE$.apply("console-proxy-writer"))
                 .name("console-proxy-writer")
                 .thriftmux(true)
                 .finagleNameStr(finagleNameStr)

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyRRMultiWriter.java
----------------------------------------------------------------------
diff --git a/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyRRMultiWriter.java
b/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyRRMultiWriter.java
index c3b94ca..142aec2 100644
--- a/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyRRMultiWriter.java
+++ b/distributedlog-tutorials/distributedlog-messaging/src/main/java/com/twitter/distributedlog/messaging/ConsoleProxyRRMultiWriter.java
@@ -20,7 +20,7 @@ package com.twitter.distributedlog.messaging;
 import com.twitter.distributedlog.DLSN;
 import com.twitter.distributedlog.service.DistributedLogClient;
 import com.twitter.distributedlog.service.DistributedLogClientBuilder;
-import com.twitter.finagle.thrift.ClientId;
+import com.twitter.finagle.thrift.ClientId$;
 import com.twitter.util.FutureEventListener;
 import jline.ConsoleReader;
 import jline.Terminal;
@@ -44,7 +44,7 @@ public class ConsoleProxyRRMultiWriter {
         final String streamList = args[1];
 
         DistributedLogClient client = DistributedLogClientBuilder.newBuilder()
-                .clientId(ClientId.apply("console-proxy-writer"))
+                .clientId(ClientId$.MODULE$.apply("console-proxy-writer"))
                 .name("console-proxy-writer")
                 .thriftmux(true)
                 .finagleNameStr(finagleNameStr)

http://git-wip-us.apache.org/repos/asf/incubator-distributedlog/blob/f03249df/scripts/change-scala-version.sh
----------------------------------------------------------------------
diff --git a/scripts/change-scala-version.sh b/scripts/change-scala-version.sh
new file mode 100755
index 0000000..89c8a70
--- /dev/null
+++ b/scripts/change-scala-version.sh
@@ -0,0 +1,92 @@
+#!/usr/bin/env bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This shell script is from Apache Spark with some modification.
+
+set -e
+
+VALID_VERSIONS=( 2.10 2.11 )
+
+usage() {
+  echo "Usage: $(basename $0) [-h|--help] <scala version to be used>
+where :
+  -h| --help Display this help text
+  valid scala version values : ${VALID_VERSIONS[*]}
+" 1>&2
+  exit 1
+}
+
+if [[ ($# -ne 1) || ( $1 == "--help") ||  $1 == "-h" ]]; then
+  usage
+fi
+
+TO_VERSION=$1
+
+check_scala_version() {
+  for i in ${VALID_VERSIONS[*]}; do [ $i = "$1" ] && return 0; done
+  echo "Invalid Scala version: $1. Valid versions: ${VALID_VERSIONS[*]}" 1>&2
+  exit 1
+}
+
+check_scala_version "$TO_VERSION"
+
+if [ $TO_VERSION = "2.11" ]; then
+  FROM_SUFFIX="_2\.10"
+  TO_SUFFIX="_2\.11"
+else
+  FROM_SUFFIX="_2\.11"
+  TO_SUFFIX="_2\.10"
+fi
+
+sed_i() {
+  sed -e "$1" "$2" > "$2.tmp" && mv "$2.tmp" "$2"
+}
+
+export -f sed_i
+
+BASEDIR=$(dirname $0)/..
+
+# Fix the finagle versions
+echo "sed_i 's/\(artifactId>finagle.*'$FROM_SUFFIX'\)<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}";
+find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
+  -exec bash -c "sed_i 's/\(artifactId>finagle.*\)'$FROM_SUFFIX'<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}" \;
+
+# Fix the scrooge versions
+echo "sed_i 's/\(artifactId>scrooge.*'$FROM_SUFFIX'\)<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}";
+find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
+  -exec bash -c "sed_i 's/\(artifactId>scrooge.*\)'$FROM_SUFFIX'<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}" \;
+
+# Fix the util versions
+echo "sed_i 's/\(artifactId>util.*'$FROM_SUFFIX'\)<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}";
+find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
+  -exec bash -c "sed_i 's/\(artifactId>util.*\)'$FROM_SUFFIX'<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}" \;
+
+# Fix the distributedlog versions
+echo "sed_i 's/\(artifactId>distributedlog\)<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}"
+find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
+  -exec bash -c "sed_i 's/\(artifactId>distributedlog\)<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}" \;
+echo "sed_i 's/\(artifactId>distributedlog-[a-z]*\)<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}"
+find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
+  -exec bash -c "sed_i 's/\(artifactId>distributedlog-[a-z]*\)<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}" \;
+echo "sed_i 's/\(artifactId>distributedlog.*\)'$FROM_SUFFIX'<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}"
+find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
+  -exec bash -c "sed_i 's/\(artifactId>distributedlog.*\)'$FROM_SUFFIX'<\/artifactId>/\1'$TO_SUFFIX'<\/artifactId>/g'
{}" \;
+echo "sed_i 's/\(module>distributedlog.*\)'$FROM_SUFFIX'<\/module>/\1'$TO_SUFFIX'<\/module>/g'
{}"
+find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \
+  -exec bash -c "sed_i 's/\(module>distributedlog.*\)'$FROM_SUFFIX'<\/module>/\1'$TO_SUFFIX'<\/module>/g'
{}" \;


Mime
View raw message