kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@apache.org
Subject kafka git commit: MINOR: Make kafka-run-class.sh work under Cygwin
Date Tue, 09 Aug 2016 15:46:49 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk fb65ff40a -> cb7af0b7f


MINOR: Make kafka-run-class.sh work under Cygwin

kafka-run-class.sh now runs under Cygwin; paths and classpath are set up properly.

**WARNING:**  The script was not tested on a Linux machine, only under Cygwin.  Prior to merge
it into trunk, if accepted, please run a quick test to ensure nothing broke.  From my own
code review, there should not be any problem, but we can never be too sure.

I do not have the environment to test it under Linux at this moment.

Author: deragon <32nx9812masakjds>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #1487 from deragon/trunk


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

Branch: refs/heads/trunk
Commit: cb7af0b7fb546cee7a3761b9a80078948f699b33
Parents: fb65ff4
Author: deragon <32nx9812masakjds>
Authored: Tue Aug 9 08:33:53 2016 -0700
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Tue Aug 9 08:33:53 2016 -0700

----------------------------------------------------------------------
 bin/kafka-run-class.sh | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/cb7af0b7/bin/kafka-run-class.sh
----------------------------------------------------------------------
diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh
index 76d0b88..1f5140b 100755
--- a/bin/kafka-run-class.sh
+++ b/bin/kafka-run-class.sh
@@ -20,6 +20,13 @@ then
   exit 1
 fi
 
+# CYGINW == 1 if Cygwin is detected, else 0.
+if [[ $(uname -a) =~ "CYGWIN" ]]; then
+  CYGWIN=1
+else
+  CYGWIN=0
+fi
+
 if [ -z "$INCLUDE_TEST_JARS" ]; then
   INCLUDE_TEST_JARS=false
 fi
@@ -41,11 +48,11 @@ should_include_file() {
 base_dir=$(dirname $0)/..
 
 if [ -z "$SCALA_VERSION" ]; then
-	SCALA_VERSION=2.10.6
+  SCALA_VERSION=2.10.6
 fi
 
 if [ -z "$SCALA_BINARY_VERSION" ]; then
-	SCALA_BINARY_VERSION=2.10
+  SCALA_BINARY_VERSION=2.10
 fi
 
 # run ./gradlew copyDependantLibs to get all dependant jars in a local dir
@@ -145,13 +152,16 @@ fi
 
 # Log directory to use
 if [ "x$LOG_DIR" = "x" ]; then
-    LOG_DIR="$base_dir/logs"
+  LOG_DIR="$base_dir/logs"
 fi
 
 # Log4j settings
 if [ -z "$KAFKA_LOG4J_OPTS" ]; then
   # Log to console. This is a tool.
-  KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/config/tools-log4j.properties"
+  LOG4J_DIR="$base_dir/config/tools-log4j.properties"
+  # If Cygwin is detected, LOG4J_DIR is converted to Windows format.
+  (( CYGWIN )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}")
+  KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:${LOG4J_DIR}"
 else
   # create logs directory
   if [ ! -d "$LOG_DIR" ]; then
@@ -159,6 +169,8 @@ else
   fi
 fi
 
+# If Cygwin is detected, LOG_DIR is converted to Windows format.
+(( CYGWIN )) && LOG_DIR=$(cygpath --path --mixed "${LOG_DIR}")
 KAFKA_LOG4J_OPTS="-Dkafka.logs.dir=$LOG_DIR $KAFKA_LOG4J_OPTS"
 
 # Generic jvm settings you want to add
@@ -236,6 +248,9 @@ if [ "x$GC_LOG_ENABLED" = "xtrue" ]; then
   KAFKA_GC_LOG_OPTS="-Xloggc:$LOG_DIR/$GC_LOG_FILE_NAME -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps "
 fi
 
+# If Cygwin is detected, classpath is converted to Windows format.
+(( CYGWIN )) && CLASSPATH=$(cygpath --path --mixed "${CLASSPATH}")
+
 # Launch mode
 if [ "x$DAEMON_MODE" = "xtrue" ]; then
   nohup $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS
$KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" > "$CONSOLE_OUTPUT_FILE" 2>&1
< /dev/null &


Mime
View raw message