diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-12-19 10:19:43 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-12-19 10:59:42 +0100 |
commit | 5b59e1bd3009a2d9a37c5df86bf34b3d3673f0ea (patch) | |
tree | 1dcb124e115171eedb037eadec50f899cf18a1bf | |
parent | 4840c9fc6ab956d6210ac33d8e9c5b1abbc4172e (diff) |
Scripts for installing jvpp jars to local mvn repo
By default hc2vpp build downloads latest jvpp
packages from nexus.fd.io.
They might not be compatible with installed
vpp (e.g. in case of non-backward
compatible vpp api changes).
In order to prevent API mismatch,
it is required to use jvpp version corresponding
to the vpp installed.
The patch includes scripts that can be used
before building hc2vpp to install jvpp jars
from vpp build dir or vpp-api-java package.
Change-Id: I9aa0dc37921e022e5644c54238d3d579f6eb5ba8
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rwxr-xr-x | jvpp/common.sh | 24 | ||||
-rwxr-xr-x | jvpp/install_from_package.sh | 25 | ||||
-rwxr-xr-x | jvpp/install_from_vpp_build_dir.sh | 26 | ||||
-rw-r--r-- | release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc | 37 |
4 files changed, 101 insertions, 11 deletions
diff --git a/jvpp/common.sh b/jvpp/common.sh new file mode 100755 index 000000000..456270635 --- /dev/null +++ b/jvpp/common.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Installs jvpp jar to local maven repository. +# +# $1 - jvpp jar file path +# $1 - target artifact version +# +function install_jvpp_jar { + jarfile=$1 + version=$2 + + # Filename (includes version suffix), e.g. jvpp-core-18.01 + basefile=$(basename -s .jar "$jarfile") + + # Remove version suffix + artifactId=$(echo "$basefile" | rev | cut -d '-' -f 2- | rev) + + mvn install:install-file \ + -Dfile=$jarfile \ + -DgroupId=io.fd.vpp \ + -DartifactId=$artifactId \ + -Dversion=$version \ + -Dpackaging=jar +} diff --git a/jvpp/install_from_package.sh b/jvpp/install_from_package.sh new file mode 100755 index 000000000..f196f3ab0 --- /dev/null +++ b/jvpp/install_from_package.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Installs jvpp jars from vpp-api-java package to local maven repository. +# Use before building hc2vpp to make sure it matches installed vpp. +# Not needed when using honeycomb package from nexus.fd.io +# (compatible vpp version is given as package dependency). + +DIR_NAME=$(dirname $0) +source ${DIR_NAME}/common.sh + +# Directory used by vpp-api-java package +JAR_DIR="/usr/share/java/" +echo "Installing vpp-api-java package jars from $JAR_DIR" + +JARS=$(find "$JAR_DIR" -type f -iname 'jvpp-*.jar') +echo "Found:" +echo "$JARS" + +JVPP_VERSION=`$DIR_NAME/../jvpp-version` +echo "Target jvpp version: $JVPP_VERSION" + +for i in ${JARS} +do + install_jvpp_jar "$i" "JVPP_VERSION" +done
\ No newline at end of file diff --git a/jvpp/install_from_vpp_build_dir.sh b/jvpp/install_from_vpp_build_dir.sh new file mode 100755 index 000000000..06c1b1bff --- /dev/null +++ b/jvpp/install_from_vpp_build_dir.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Installs jvpp jars from vpp build dir to local maven repository. +# Use before building hc2vpp to make sure it matches your locally-built vpp. +# Not needed when using honeycomb package from nexus.fd.io +# (compatible vpp version is given as package dependency). + +DIR_NAME=$(dirname $0) +source ${DIR_NAME}/common.sh + +# Set VPP_DIR if not defined +DEFAULT_VPP_DIR="$HOME/vpp" +VPP_DIR=${VPP_DIR:-"$DEFAULT_VPP_DIR"} +echo "Installing jvpp jars from VPP_DIR=$VPP_DIR" + +JARS="$(find "$VPP_DIR/build-root/install-vpp-native/vpp/share/java/" -type f -iname 'jvpp-*.jar')" +echo "Found:" +echo "$JARS" + +JVPP_VERSION=`$DIR_NAME/../jvpp-version` +echo "Target jvpp version: $JVPP_VERSION" + +for i in ${JARS} +do + install_jvpp_jar "$i" "JVPP_VERSION" +done
\ No newline at end of file diff --git a/release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc b/release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc index d4449c9d3..012a8f6e9 100644 --- a/release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc +++ b/release-notes/src/main/asciidoc/install_guide/install_manual_build.adoc @@ -20,7 +20,10 @@ TIP: Make sure you have https://wiki.fd.io/view/DEV/Setting_up_Gerrit[registered == Building the code Make sure all the prerequisites are installed. -NOTE: To make sure fresh hc2vpp build is compatible with VPP, building VPP is also required to make sure the same JVpp version is used preventing out-of-sync exceptions. In case only hc2vpp needs to be built, skip Building VPP section. +NOTE: To make sure fresh hc2vpp build is compatible with VPP, it is required +to make sure the same JVpp version is used preventing out-of-sync exceptions. +Compatible JVPP artifacts can be obtained by installing vpp-api-java package or building VPP. +In case only hc2vpp needs to be built, skip Building VPP section. === Building VPP Clone VPP according to: https://gerrit.fd.io/r/#/admin/projects/vpp and checkout {project-branch} branch @@ -41,19 +44,9 @@ Start VPP: sudo start vpp -Install JVpp into local maven repository to make hc2vpp pick up the same JVpp version - -[subs="+attributes"] - cd build-vpp-native/vpp-api/java/ - mvn install:install-file -Dfile=jvpp-registry-{project-vpp-version}.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-registry -Dversion={project-vpp-snapshot-version} -Dpackaging=jar - mvn install:install-file -Dfile=jvpp-core-{project-vpp-version}.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-core -Dversion={project-vpp-snapshot-version}-Dpackaging=jar - cd ../../plugins/nat-plugin/ - mvn install:install-file -Dfile=jvpp-nat-{project-nat-version}.jar -DgroupId=io.fd.vpp -DartifactId=jvpp-nat -Dversion={project-nat-snapshot-version} -Dpackaging=jar - Now current Vpp is up and running and prepared for integration with HC. === Building hc2vpp -Now hc2vpp can be built and it will use latest JVpp produced during VPP build. ==== Setup settings.xml Put the following in your ~/.m2/settings.xml: @@ -167,6 +160,28 @@ Put the following in your ~/.m2/settings.xml: </settings> ---- + +==== Installing JVpp jars + +By default hc2vpp build downloads latest JVpp jars from nexus.fd.io. +They might not be compatible with installed VPP (e.g. in case of non-backward compatible VPP API changes). + +In order to prevent API mismatch it is required to use JVpp version corresponding to the VPP installed. + +Use + +[subs="+attributes"] + ./hc2vpp/jvpp/install_from_vpp_build_dir.sh + +to install JVpp jars produced during VPP build. + +If vpp-api-java package is installed, use: + +[subs="+attributes"] + ./hc2vpp/jvpp/install_from_package.sh + +Now hc2vpp can be built and it will use compatible JVpp artifacts. + ==== Building hc2vpp cd hc2vpp/ |