You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2020/03/01 05:30:23 UTC

[kudu] branch master updated: [build] Export EXTRA_GRADLE_FLAGS before cmake runs

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ebaa8f  [build] Export EXTRA_GRADLE_FLAGS before cmake runs
9ebaa8f is described below

commit 9ebaa8f5349ec88cbe990d88321cba2b3e5ddc9a
Author: Grant Henke <gr...@apache.org>
AuthorDate: Sat Feb 29 14:00:10 2020 -0600

    [build] Export EXTRA_GRADLE_FLAGS before cmake runs
    
    This patch moves exporting `EXTRA_GRADLE_FLAGS` above
    the `cmake` call in `build-and-test.sh`.
    
    These should be set before cmake so that the Gradle command
    in the generated make file has the correct flags.
    
    It also fixes an issue where spaces in the `EXTRA_GRADLE_FLAGS`
    variable were escaped via cmake.
    
    Change-Id: I7a07f98c460b6db7e085bd74f535758674610162
    Reviewed-on: http://gerrit.cloudera.org:8080/15327
    Tested-by: Grant Henke <gr...@apache.org>
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
---
 build-support/jenkins/build-and-test.sh | 24 +++++++++++++-----------
 src/kudu/subprocess/CMakeLists.txt      |  6 +++++-
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/build-support/jenkins/build-and-test.sh b/build-support/jenkins/build-and-test.sh
index 9a54f3d..8231835 100755
--- a/build-support/jenkins/build-and-test.sh
+++ b/build-support/jenkins/build-and-test.sh
@@ -276,6 +276,19 @@ else
   CLANG=$(pwd)/thirdparty/clang-toolchain/bin/clang
 fi
 
+# Some portions of the C++ build may depend on Java code, so we may run Gradle
+# while building. Pass in some flags suitable for automated builds; these will
+# also be used in the Java build.
+# These should be set before CMAKE so that the Gradle command in the
+# generated make file has the correct flags.
+export EXTRA_GRADLE_FLAGS="--console=plain"
+EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS --no-daemon"
+EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS --continue"
+# KUDU-2524: temporarily disable scalafmt until we can work out its JDK
+# incompatibility issue.
+EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS -DskipFormat"
+EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS $GRADLE_FLAGS"
+
 # Assemble the cmake command line, starting with environment variables.
 
 # There's absolutely no reason to rebuild the thirdparty tree; we just ran
@@ -374,17 +387,6 @@ if [ -d "$TEST_TMPDIR" ]; then
   rm -Rf $TEST_TMPDIR/*
 fi
 
-# Some portions of the C++ build may depend on Java code, so we may run Gradle
-# while building. Pass in some flags suitable for automated builds; these will
-# also be used in the Java build.
-export EXTRA_GRADLE_FLAGS="--console=plain"
-EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS --no-daemon"
-EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS --continue"
-# KUDU-2524: temporarily disable scalafmt until we can work out its JDK
-# incompatibility issue.
-EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS -DskipFormat"
-EXTRA_GRADLE_FLAGS="$EXTRA_GRADLE_FLAGS $GRADLE_FLAGS"
-
 # actually do the build
 echo
 echo Building C++ code.
diff --git a/src/kudu/subprocess/CMakeLists.txt b/src/kudu/subprocess/CMakeLists.txt
index 0cd8ff4..e0b7af0 100644
--- a/src/kudu/subprocess/CMakeLists.txt
+++ b/src/kudu/subprocess/CMakeLists.txt
@@ -37,8 +37,12 @@ target_link_libraries(subprocess_proto
 #######################################
 set(ECHO_JAR ${EXECUTABLE_OUTPUT_PATH}/kudu-subprocess-echo.jar)
 
+# Add the EXTRA_GRADLE_FLAGS environment variable to a cmake list and calls `separate_arguments`.
+# This solves the problem of escaped spaces in the EXTRA_GRADLE_FLAGS environment variable.
+list(APPEND EXTRA_GRADLE_FLAGS $ENV{EXTRA_GRADLE_FLAGS})
+separate_arguments(EXTRA_GRADLE_FLAGS)
 add_custom_command(OUTPUT ${ECHO_JAR}
-  COMMAND ./gradlew :kudu-subprocess-echo:jar $ENV{EXTRA_GRADLE_FLAGS}
+  COMMAND ./gradlew :kudu-subprocess-echo:jar ${EXTRA_GRADLE_FLAGS}
   COMMAND ln -nsf
     "${JAVA_DIR}/kudu-subprocess-echo/build/libs/kudu-subprocess-echo-${KUDU_VERSION_NUMBER}.jar"
     "${ECHO_JAR}"