From b87a2b954875540105b75c3949dec0522ce7b204 Mon Sep 17 00:00:00 2001 From: Katherine Yang Date: Tue, 12 Sep 2023 17:20:50 -0700 Subject: [PATCH 1/3] add to build script --- .../scripts/install_dependencies_and_build.sh | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/java-api-bindings/scripts/install_dependencies_and_build.sh b/src/java-api-bindings/scripts/install_dependencies_and_build.sh index 903e1e638..e31a40d5e 100755 --- a/src/java-api-bindings/scripts/install_dependencies_and_build.sh +++ b/src/java-api-bindings/scripts/install_dependencies_and_build.sh @@ -36,11 +36,12 @@ Installs Maven, Java JDK and builds Tritonserver Java bindings -j|--jar-install-path Path to install the bindings .jar --javacpp-branch Javacpp-presets git path, default is https://github.com/bytedeco/javacpp-presets.git --javacpp-tag Javacpp-presets branch tag, default "master" ---enable-developer-tools-server Include C++ bindings from developer_tools repository +--enable-developer-tools-server Include C++ bindings from developer_tools repository +--keep-build-dependencies Keep build dependencies instead of deleting " # Get all options: -OPTS=$(getopt -l ht:b:v:c:j:,help,triton-home,build-home:,maven-version:,core-tag:,jar-install-path:,javacpp-branch:,javacpp-tag:,enable-developer-tools-server -- "$@") +OPTS=$(getopt -l ht:b:v:c:j:,help,triton-home,build-home:,maven-version:,core-tag:,jar-install-path:,javacpp-branch:,javacpp-tag:,enable-developer-tools-server,keep-build-libraries -- "$@") TRITON_HOME="/opt/tritonserver" BUILD_HOME="/tmp/build" @@ -52,6 +53,7 @@ JAVACPP_BRANCH_TAG=${JAVACPP_BRANCH_TAG:="master"} CMAKE_VERSION=${CMAKE_VERSION:="3.21.1"} export JAR_INSTALL_PATH="/workspace/install/java-api-bindings" export INCLUDE_DEVELOPER_TOOLS_SERVER=1 +KEEP_BUILD_DEPENDENCIES=1 for OPTS; do case "$OPTS" in @@ -98,6 +100,10 @@ for OPTS; do export INCLUDE_DEVELOPER_TOOLS_SERVER=0 echo "Including developer tools server C++ bindings" ;; + --keep-build-dependencies) + KEEP_BUILD_DEPENDENCIES=0 + echo "Including developer tools server C++ bindings" + ;; esac done set -x @@ -128,6 +134,12 @@ cd ${BUILD_HOME} git clone --single-branch --depth=1 -b ${JAVACPP_BRANCH_TAG} ${JAVACPP_BRANCH} cd javacpp-presets +# Remove developer_tools/server related build +if [ ${INCLUDE_DEVELOPER_TOOLS_SERVER} -eq 1 ]; then + rm -r tritonserver/src/gen + rm tritonserver/src/main/java/org/bytedeco/tritonserver/presets/tritondevelopertoolsserver.java +fi + ${MAVEN_PATH} clean install --projects .,tritonserver ${MAVEN_PATH} clean install -f platform --projects ../tritonserver/platform -Djavacpp.platform=linux-x86_64 @@ -135,7 +147,9 @@ ${MAVEN_PATH} clean install -f platform --projects ../tritonserver/platform -Dja mkdir -p ${JAR_INSTALL_PATH} cp ${BUILD_HOME}/javacpp-presets/tritonserver/platform/target/tritonserver-platform-*shaded.jar ${JAR_INSTALL_PATH}/tritonserver-java-bindings.jar -rm -r ${BUILD_HOME}/javacpp-presets/ -rm -r /root/.m2/repository +if [ ${KEEP_BUILD_DEPENDENCIES} -eq 1 ]; then + rm -r ${BUILD_HOME}/javacpp-presets/ + rm -r /root/.m2/repository +fi set +x From 26eb66bf0679d54988cedaac78c248a068da36ab Mon Sep 17 00:00:00 2001 From: Katherine Yang Date: Wed, 13 Sep 2023 10:59:17 -0700 Subject: [PATCH 2/3] update maven path --- .../scripts/install_dependencies_and_build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/java-api-bindings/scripts/install_dependencies_and_build.sh b/src/java-api-bindings/scripts/install_dependencies_and_build.sh index e31a40d5e..5a86b3d75 100755 --- a/src/java-api-bindings/scripts/install_dependencies_and_build.sh +++ b/src/java-api-bindings/scripts/install_dependencies_and_build.sh @@ -41,7 +41,7 @@ Installs Maven, Java JDK and builds Tritonserver Java bindings " # Get all options: -OPTS=$(getopt -l ht:b:v:c:j:,help,triton-home,build-home:,maven-version:,core-tag:,jar-install-path:,javacpp-branch:,javacpp-tag:,enable-developer-tools-server,keep-build-libraries -- "$@") +OPTS=$(getopt -l ht:b:v:c:j:,help,triton-home,build-home:,maven-version:,core-tag:,jar-install-path:,javacpp-branch:,javacpp-tag:,enable-developer-tools-server,keep-build-dependencies -- "$@") TRITON_HOME="/opt/tritonserver" BUILD_HOME="/tmp/build" @@ -68,11 +68,13 @@ for OPTS; do ;; -b|--build-home) BUILD_HOME=$2 + export MAVEN_PATH=${BUILD_HOME}/apache-maven-${MAVEN_VERSION}/bin/mvn shift 2 echo "Build home set to: ${BUILD_HOME}" ;; -v|--maven-version) MAVEN_VERSION=$2 + export MAVEN_PATH=${BUILD_HOME}/apache-maven-${MAVEN_VERSION}/bin/mvn echo "Maven version is set to: ${MAVEN_VERSION}" shift 2 ;; @@ -140,8 +142,8 @@ if [ ${INCLUDE_DEVELOPER_TOOLS_SERVER} -eq 1 ]; then rm tritonserver/src/main/java/org/bytedeco/tritonserver/presets/tritondevelopertoolsserver.java fi -${MAVEN_PATH} clean install --projects .,tritonserver -${MAVEN_PATH} clean install -f platform --projects ../tritonserver/platform -Djavacpp.platform=linux-x86_64 +mvn clean install --projects .,tritonserver +mvn clean install -f platform --projects ../tritonserver/platform -Djavacpp.platform=linux-x86_64 # Copy over the jar to a specific location mkdir -p ${JAR_INSTALL_PATH} From 95313af71f6829e89e0c4eed47c807f1c1da4618 Mon Sep 17 00:00:00 2001 From: Katherine Yang Date: Mon, 18 Sep 2023 15:54:16 -0700 Subject: [PATCH 3/3] added comment for true/false in bash script --- src/java-api-bindings/scripts/install_dependencies_and_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/java-api-bindings/scripts/install_dependencies_and_build.sh b/src/java-api-bindings/scripts/install_dependencies_and_build.sh index 5a86b3d75..013769f1b 100755 --- a/src/java-api-bindings/scripts/install_dependencies_and_build.sh +++ b/src/java-api-bindings/scripts/install_dependencies_and_build.sh @@ -52,6 +52,7 @@ JAVACPP_BRANCH=${JAVACPP_BRANCH:="https://github.com/bytedeco/javacpp-presets.gi JAVACPP_BRANCH_TAG=${JAVACPP_BRANCH_TAG:="master"} CMAKE_VERSION=${CMAKE_VERSION:="3.21.1"} export JAR_INSTALL_PATH="/workspace/install/java-api-bindings" +# Note: Following bashscript convention where True/success == 0 and False == 1 export INCLUDE_DEVELOPER_TOOLS_SERVER=1 KEEP_BUILD_DEPENDENCIES=1