-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update client build script to be source of truth for java related installations #395
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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-dependencies -- "$@") | ||
|
||
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 | ||
|
@@ -66,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 | ||
;; | ||
|
@@ -98,6 +102,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,14 +136,22 @@ cd ${BUILD_HOME} | |
git clone --single-branch --depth=1 -b ${JAVACPP_BRANCH_TAG} ${JAVACPP_BRANCH} | ||
cd javacpp-presets | ||
|
||
${MAVEN_PATH} clean install --projects .,tritonserver | ||
${MAVEN_PATH} clean install -f platform --projects ../tritonserver/platform -Djavacpp.platform=linux-x86_64 | ||
# 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 | ||
|
||
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} | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like the reverse. Shouldn't this be if it's not equal to 1, then delete? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have been pretty bad at following the guidelines for bash scripting. I would advocate for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great find! Let's start a conversation offline about this. This is news to me. I don't want to block this PR, but I think we'd want to decide this on a team level and have a PR to standardize all of our tests. Otherwise, it would be inconsistent and could lead to confusion/problems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this change has been propagated to the javacpp side, can we do this in a separate PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, but please let's do it ASAP. We do not want this getting forgotten and us being inconsistent. |
||
rm -r ${BUILD_HOME}/javacpp-presets/ | ||
rm -r /root/.m2/repository | ||
fi | ||
|
||
set +x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the below comment gets addressed, we may want to review the other code for things like this which will be inconsistent (e.g. if KEEP=0, then the statement should say we are excluding developer tools bindings).