Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cberge/dynamic-graph
  • ostasse/dynamic-graph
  • gsaurel/dynamic-graph
  • stack-of-tasks/dynamic-graph
4 results
Show changes
Commits on Source (8)
[submodule "cmake"] [submodule "cmake"]
path = cmake path = cmake
url = git://github.com/jrl-umi3218/jrl-cmakemodules.git url = https://github.com/jrl-umi3218/jrl-cmakemodules.git
[submodule ".travis"]
path = .travis
url = git://github.com/jrl-umi3218/jrl-travis.git
Subproject commit cbc92f81bdd0dcfd7fc1eae56801d8111267937d
git:
depth: false
language: cpp
sudo: required
compiler:
- gcc
- clang
env:
global:
- DEBSIGN_KEYID=5AE5CD75
- secure: "lEJYxth3fNsmvNS7Ern9+kEpHk4X3Tjo51GBUQBNL6g+YyZJKm4xwBEfwK+sewlmhY3oLUds+5H/2zE27q517kIcpP2Tlp4sRfooJfnBS7YYyF+1boxbvOXrZ2aqev3rzkyvKKMBg0UJTvAiSf7JgVCkMv33GeAX3/I+djEh23U="
- secure: "QTw5QQDaeQWBz6APcUCyl9P9UPI/T3j1++9o9fPxygS9R/7bQYNCrSH++owcAVCJgUI5oY3RmnYk/PjVygOLM0vbFqB2mMySibAhO/U3pSLtZ/HyPjqI9fX0TV/Cf7ji7soeXKk8p6kI2InMILpODLBaLdfm/jgCdAfecr5sGQI="
- secure: "JEcGQsUgEND64cAGVEHSxg8j7SlwofuYtLamANszs/h8FGYZ82rEjmG7r2zqSfBj/i1WsnSbTSsh8WJuXzvV8fw8enkcLEuJG9scQJzuzY8hnLe81o1fhEkclML0SLkLQ2Fu6rIqlKKeYwmJFFhSIj69ESRIkDhkjA1OrV7szzc="
- APT_DEPENDENCIES="doxygen libboost-dev libboost-test-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libeigen3-dev"
- PPA_URI="stack-of-tasks/snapshot"
- NSIQCPPSTYLE_FILEFILTERPATH=cmake/filefilter.txt
notifications:
hipchat:
rooms:
- secure: "SP8KX6gPzBT0BCpcL3ybK4Cgx7a7rmK3Hv/fD2lIf/RUdTwtzLh/J/l9xSYuMZisLe1tM+12vfP7r6t1RNdXrB7pSpYvFRNIWmyfBC7KnUFVn5rwxUnDPhKY3D/XaJ1cycbBJqJdUjYjFKCGEm4x6cpRRN61Ii66RAUvm1h9aHQ="
email:
- hpp-source@laas.fr
branches:
only:
- master
- devel
script: ./travis_custom/build_custom
after_success: ./.travis/run after_success
after_failure: ./.travis/run after_failure
before_install: ./travis_custom/custom_before_install
matrix:
allow_failures:
- compiler: clang
Subproject commit 9078d521dc23fabae72e3fe8d7c0068c68364eef Subproject commit 332976cc4d5305256c79a479e55ad7ab2ecc42f1
...@@ -27,7 +27,9 @@ class DYNAMIC_GRAPH_DLLAPI EitherType { ...@@ -27,7 +27,9 @@ class DYNAMIC_GRAPH_DLLAPI EitherType {
~EitherType(); ~EitherType();
operator bool() const; operator bool() const;
operator unsigned() const; operator unsigned() const;
operator unsigned long int() const;
operator int() const; operator int() const;
operator long int() const;
operator float() const; operator float() const;
operator double() const; operator double() const;
operator std::string() const; operator std::string() const;
...@@ -51,7 +53,9 @@ class DYNAMIC_GRAPH_DLLAPI Value { ...@@ -51,7 +53,9 @@ class DYNAMIC_GRAPH_DLLAPI Value {
NONE, NONE,
BOOL, BOOL,
UNSIGNED, UNSIGNED,
UNSIGNEDLONGINT,
INT, INT,
LONGINT,
FLOAT, FLOAT,
DOUBLE, DOUBLE,
STRING, STRING,
...@@ -65,7 +69,9 @@ class DYNAMIC_GRAPH_DLLAPI Value { ...@@ -65,7 +69,9 @@ class DYNAMIC_GRAPH_DLLAPI Value {
void deleteValue(); void deleteValue();
explicit Value(const bool &value); explicit Value(const bool &value);
explicit Value(const unsigned &value); explicit Value(const unsigned &value);
explicit Value(const unsigned long int &value);
explicit Value(const int &value); explicit Value(const int &value);
explicit Value(const long int &value);
explicit Value(const float &value); explicit Value(const float &value);
explicit Value(const double &value); explicit Value(const double &value);
explicit Value(const std::string &value); explicit Value(const std::string &value);
...@@ -107,7 +113,9 @@ class DYNAMIC_GRAPH_DLLAPI Value { ...@@ -107,7 +113,9 @@ class DYNAMIC_GRAPH_DLLAPI Value {
friend class EitherType; friend class EitherType;
bool boolValue() const; bool boolValue() const;
unsigned unsignedValue() const; unsigned unsignedValue() const;
unsigned long int unsignedlongintValue() const;
int intValue() const; int intValue() const;
long int longintValue() const;
float floatValue() const; float floatValue() const;
double doubleValue() const; double doubleValue() const;
std::string stringValue() const; std::string stringValue() const;
......
...@@ -22,7 +22,11 @@ EitherType::~EitherType() { ...@@ -22,7 +22,11 @@ EitherType::~EitherType() {
EitherType::operator bool() const { return value_->boolValue(); } EitherType::operator bool() const { return value_->boolValue(); }
EitherType::operator unsigned() const { return value_->unsignedValue(); } EitherType::operator unsigned() const { return value_->unsignedValue(); }
EitherType::operator unsigned long int() const {
return value_->unsignedlongintValue();
}
EitherType::operator int() const { return value_->intValue(); } EitherType::operator int() const { return value_->intValue(); }
EitherType::operator long int() const { return value_->longintValue(); }
EitherType::operator float() const { return value_->floatValue(); } EitherType::operator float() const { return value_->floatValue(); }
EitherType::operator double() const { return value_->doubleValue(); } EitherType::operator double() const { return value_->doubleValue(); }
EitherType::operator std::string() const { return value_->stringValue(); } EitherType::operator std::string() const { return value_->stringValue(); }
...@@ -40,9 +44,15 @@ void Value::deleteValue() { ...@@ -40,9 +44,15 @@ void Value::deleteValue() {
case UNSIGNED: case UNSIGNED:
delete (const unsigned *)value_; delete (const unsigned *)value_;
break; break;
case UNSIGNEDLONGINT:
delete (const unsigned long int *)value_;
break;
case INT: case INT:
delete (const int *)value_; delete (const int *)value_;
break; break;
case LONGINT:
delete (const long int *)value_;
break;
case FLOAT: case FLOAT:
delete (const float *)value_; delete (const float *)value_;
break; break;
...@@ -64,7 +74,11 @@ void Value::deleteValue() { ...@@ -64,7 +74,11 @@ void Value::deleteValue() {
case VALUES: case VALUES:
delete (const Values *)value_; delete (const Values *)value_;
break; break;
default:; case NONE: /* Equivalent to void */
break;
default:
throw "Value::deleteValue : Undefined type";
;
} }
} }
...@@ -73,6 +87,8 @@ Value::~Value() { deleteValue(); } ...@@ -73,6 +87,8 @@ Value::~Value() { deleteValue(); }
Value::Value(const bool &value) : type_(BOOL), value_(new bool(value)) {} Value::Value(const bool &value) : type_(BOOL), value_(new bool(value)) {}
Value::Value(const unsigned &value) Value::Value(const unsigned &value)
: type_(UNSIGNED), value_(new unsigned(value)) {} : type_(UNSIGNED), value_(new unsigned(value)) {}
Value::Value(const unsigned long int &value)
: type_(UNSIGNEDLONGINT), value_(new unsigned long int(value)) {}
Value::Value(const int &value) : type_(INT), value_(new int(value)) {} Value::Value(const int &value) : type_(INT), value_(new int(value)) {}
Value::Value(const float &value) : type_(FLOAT), value_(new float(value)) {} Value::Value(const float &value) : type_(FLOAT), value_(new float(value)) {}
Value::Value(const double &value) : type_(DOUBLE), value_(new double(value)) {} Value::Value(const double &value) : type_(DOUBLE), value_(new double(value)) {}
...@@ -100,9 +116,15 @@ void *copyValue(const Value &value) { ...@@ -100,9 +116,15 @@ void *copyValue(const Value &value) {
case Value::UNSIGNED: case Value::UNSIGNED:
copy = new unsigned(value.unsignedValue()); copy = new unsigned(value.unsignedValue());
break; break;
case Value::UNSIGNEDLONGINT:
copy = new unsigned long int(value.unsignedlongintValue());
break;
case Value::INT: case Value::INT:
copy = new int(value.intValue()); copy = new int(value.intValue());
break; break;
case Value::LONGINT:
copy = new long int(value.longintValue());
break;
case Value::FLOAT: case Value::FLOAT:
copy = new float(value.floatValue()); copy = new float(value.floatValue());
break; break;
...@@ -149,6 +171,8 @@ bool Value::operator==(const Value &other) const { ...@@ -149,6 +171,8 @@ bool Value::operator==(const Value &other) const {
return boolValue() == other.boolValue(); return boolValue() == other.boolValue();
case Value::UNSIGNED: case Value::UNSIGNED:
return unsignedValue() == other.unsignedValue(); return unsignedValue() == other.unsignedValue();
case Value::UNSIGNEDLONGINT:
return unsignedlongintValue() == other.unsignedlongintValue();
case Value::INT: case Value::INT:
return intValue() == other.intValue(); return intValue() == other.intValue();
case Value::DOUBLE: case Value::DOUBLE:
...@@ -188,9 +212,20 @@ unsigned Value::unsignedValue() const { ...@@ -188,9 +212,20 @@ unsigned Value::unsignedValue() const {
"value is not an unsigned int"); "value is not an unsigned int");
} }
unsigned long int Value::unsignedlongintValue() const {
if (type_ == UNSIGNEDLONGINT) return *((const unsigned long int *)value_);
throw ExceptionAbstract(ExceptionAbstract::TOOLS,
"value is not an unsigned long int");
}
long int Value::longintValue() const {
if (type_ == LONGINT) return *((const long int *)value_);
throw ExceptionAbstract(ExceptionAbstract::TOOLS, "value is not an long int");
}
int Value::intValue() const { int Value::intValue() const {
if (type_ == INT) return *((const int *)value_); if (type_ == INT) return *((const int *)value_);
throw ExceptionAbstract(ExceptionAbstract::TOOLS, "value is not an int int"); throw ExceptionAbstract(ExceptionAbstract::TOOLS, "value is not an int");
} }
float Value::floatValue() const { float Value::floatValue() const {
...@@ -249,6 +284,8 @@ std::string Value::typeName(Type type) { ...@@ -249,6 +284,8 @@ std::string Value::typeName(Type type) {
return std::string("bool"); return std::string("bool");
case UNSIGNED: case UNSIGNED:
return std::string("unsigned int"); return std::string("unsigned int");
case UNSIGNEDLONGINT:
return std::string("unsigned long int");
case INT: case INT:
return std::string("int"); return std::string("int");
case FLOAT: case FLOAT:
...@@ -279,6 +316,9 @@ std::ostream &operator<<(std::ostream &os, const Value &value) { ...@@ -279,6 +316,9 @@ std::ostream &operator<<(std::ostream &os, const Value &value) {
case Value::UNSIGNED: case Value::UNSIGNED:
os << value.unsignedValue(); os << value.unsignedValue();
break; break;
case Value::UNSIGNEDLONGINT:
os << value.unsignedlongintValue();
break;
case Value::INT: case Value::INT:
os << value.intValue(); os << value.intValue();
break; break;
...@@ -318,6 +358,9 @@ const Value::Type ValueHelper<bool>::TypeID = Value::BOOL; ...@@ -318,6 +358,9 @@ const Value::Type ValueHelper<bool>::TypeID = Value::BOOL;
template <> template <>
const Value::Type ValueHelper<unsigned>::TypeID = Value::UNSIGNED; const Value::Type ValueHelper<unsigned>::TypeID = Value::UNSIGNED;
template <> template <>
const Value::Type ValueHelper<unsigned long int>::TypeID =
Value::UNSIGNEDLONGINT;
template <>
const Value::Type ValueHelper<int>::TypeID = Value::INT; const Value::Type ValueHelper<int>::TypeID = Value::INT;
template <> template <>
const Value::Type ValueHelper<float>::TypeID = Value::FLOAT; const Value::Type ValueHelper<float>::TypeID = Value::FLOAT;
...@@ -327,6 +370,7 @@ template <> ...@@ -327,6 +370,7 @@ template <>
const Value::Type ValueHelper<std::string>::TypeID = Value::STRING; const Value::Type ValueHelper<std::string>::TypeID = Value::STRING;
template <> template <>
const Value::Type ValueHelper<Vector>::TypeID = Value::VECTOR; const Value::Type ValueHelper<Vector>::TypeID = Value::VECTOR;
template <> template <>
const Value::Type ValueHelper<Eigen::MatrixXd>::TypeID = Value::MATRIX; const Value::Type ValueHelper<Eigen::MatrixXd>::TypeID = Value::MATRIX;
template <> template <>
......
...@@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(value_exceptions) { ...@@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(value_exceptions) {
} }
BOOST_CHECK(res); BOOST_CHECK(res);
BOOST_CHECK(output.is_equal("Abstract")); BOOST_CHECK(output.is_equal("Abstract"));
BOOST_CHECK(output2.is_equal("value is not an int int")); BOOST_CHECK(output2.is_equal("value is not an int"));
// Check if the exception is working when calling boolValue // Check if the exception is working when calling boolValue
// while we are having a none. // while we are having a none.
......
#!/bin/bash
. `dirname $0`/common.sh
# Set debug mode
set -x
set -v
# build_package
# -------------
#
# Build the package using the last Eigen release (3.2) which is not
# available as a Debian package on Ubuntu 12.04.
build_package()
{
echo "--> Building package..."
cd "$build_dir"
if [[ ";${DO_COVERAGE_ON_BRANCH};" == *";${CI_BRANCH};"* ]]; then
cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
-DCMAKE_MODULE_LINKER_FLAGS="--coverage" \
${CMAKE_ADDITIONAL_OPTIONS}
else
cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \
${CMAKE_ADDITIONAL_OPTIONS}
fi
${MAKE_PREFIX} make
make install
ALLOW_TESTSUITE_FAILURE=${ALLOW_TESTSUITE_FAILURE:-false}
make test || ${ALLOW_TESTSUITE_FAILURE}
if [[ ";${DO_CPPCHECK_ON_BRANCH};" == *";${CI_BRANCH};"* ]]; then
cppcheck --quiet --enable=all \
-I $root_dir/src -I $root_dir/tests -I $root_dir/include \
-I $root_dir/tests/shared-tests \
-I $build_dir/include -I $install_dir/include \
-i $build_dir/CMakeFiles \
$root_dir || true
fi
}
# debian_build_package
# --------------------
#
# Use git-buildpackage and pbuilder to build the package in a sid
# sandbox.
debian_build_package()
{
export GNUPGHOME="$root_dir/.travis/.gnupg"
export NAME="Thomas Moulard (Travis Automatic Builds)"
export DEBEMAIL="thomas.moulard+travis@gmail.com"
echo "--> Building Debian package..."
cd "$root_dir"
buildNumber=$(git rev-list \
$(git describe --tags --match "debian/*" --abbrev=0)..HEAD | wc -l) \
|| buildNumber=1
dch --force-distribution --distribution ${DIST} \
--local ppa$buildNumber+$DIST "Travis automatic build"
echo "debian/changelog first line:"
head -n 1 debian/changelog
git add debian/changelog
git commit -m "Travis automatic commit"
${SUDO_CMD} chmod -R 777 /var/cache/pbuilder/ccache
# If orig tarball exists, delete it.
rm -f "$build_dir/export/*_*.orig.tar*"
git-buildpackage \
--git-submodules \
--git-no-pristine-tar \
--git-ignore-branch \
--git-debian-branch=HEAD \
--git-export-dir="$build_dir/export" \
--git-tag \
--git-upstream-branch=master \
--git-dist=${DIST} \
--git-pbuilder \
--git-force-create \
--git-ignore-new \
--git-retag \
-p\"gpg\\ --passphrase\\ ${GNUPG_PASSPHRASE}\" \
-k${DEBSIGN_KEYID} || exit 1
git-buildpackage \
--git-submodules \
--git-no-pristine-tar \
--git-debian-branch=HEAD \
--git-ignore-branch \
--git-export-dir="$build_dir/export" \
--git-tag \
--git-upstream-branch=master \
--git-dist=${DIST} \
--git-ignore-new \
--git-retag \
-p\"gpg --passphrase ${GNUPG_PASSPHRASE}\" \
-k${DEBSIGN_KEYID} \
-S -sa || exit 1
}
# setup_ros_build_environment
# ---------------------------
#
# Source ROS setup scripts if they exist
setup_ros_build_environment()
{
if [ -e /opt/ros/${ROS_DISTRO}/setup.sh ]; then
. /opt/ros/${ROS_DISTRO}/setup.sh
fi
CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws
if [ -e ${CATKIN_DEP_WORKSPACE}/devel/setup.sh ]; then
. ${CATKIN_DEP_WORKSPACE}/devel/setup.sh
fi
# Limit the number of parallel jobs when running catkin_make
PARALLEL_JOBS=${PARALLEL_JOBS:-1}
export ROS_PARALLEL_JOBS="-j ${PARALLEL_JOBS}"
}
# build_catkin_package
# --------------------
#
# build all the packages using catkin_make.
# Also check the installation (catkin_make install)
# and check whether the catkin package is well written (catkin_lint)
build_catkin_package()
{
# Main package workspace
CATKIN_WORKSPACE=$build_dir/..
ln -s $root_dir/.. $CATKIN_WORKSPACE/src
cd $CATKIN_WORKSPACE/src
catkin_init_workspace
cd $CATKIN_WORKSPACE
catkin_make
for pack in `ls -d ./src/*/ ./src/*/*/`; do
if test -f $pack/package.xml; then
rosdoc_lite $pack
fi
done
catkin_make install
# run catkin_lint on every directory.
ALLOW_CATKINLINT_FAILURE=${ALLOW_CATKINLINT_FAILURE:-false}
catkin_lint `ls -d ./src/*/ ./src/*/*/` || ${ALLOW_CATKINLINT_FAILURE}
}
setup_ros_build_environment
# Realize a normal build in all branches except the one containing a
# debian/ folder.
if [ -d debian ]; then
if `test x${DIST} = x`; then
echo "distribution is not set, skipping this build"
exit 0
fi
echo "Target distribution: ${DIST}"
debian_build_package
else
if [ ! x${DIST} = x ]; then
echo "skipping this build"
exit 0
fi
# checking if it is a ros folder. Taking appropriate measure.
#The current repository is a package
build_package
fi
# End debug mode
set +v
set +x
# -*- sh-mode -*
# This should be sourced, not called.
set -e
########################################
# -- VERBOSE HANDLING -- #
########################################
# More verbose handling for 'set -e'.
#
# Show a traceback if we're using bash, otherwise just a message.
# Downloaded from: https://gist.github.com/kergoth/3885825
on_exit () {
ret=$?
case $ret in
0)
;;
*)
echo >&2 "Exiting with $ret from a shell command"
;;
esac
}
on_error () {
local ret=$?
local FRAMES=${#BASH_SOURCE[@]}
echo >&2 "Traceback (most recent call last):"
for ((frame=FRAMES-2; frame >= 0; frame--)); do
local lineno=${BASH_LINENO[frame]}
printf >&2 ' File "%s", line %d, in %s\n' "${BASH_SOURCE[frame+1]}" "$lineno" "${FUNCNAME[frame+1]}"
sed >&2 -n "${lineno}s/^[ ]*/ /p" "${BASH_SOURCE[frame+1]}" || true
done
printf >&2 "Exiting with %d\n" "$ret"
exit $ret
}
case "$BASH_VERSION" in
'')
trap on_exit EXIT
;;
*)
set -o errtrace
trap on_error ERR
;;
esac
########################################
# -- GLOBAL UTILITIES -- #
########################################
# git_dependency_parsing
# ----------------------
#
# From an entry in GIT_DEPENDENCIES variable set git_dep, git_dep_uri and
# git_dep_branch in the environment
# For example given the input "jrl-umi3218/jrl-travis" the following variables
# are defined in the environment:
# - git_dep jrl-umi3218/jrl-travis
# - git_dep_uri git://github.com/jrl-umi3218/jrl-traviss
# - git_dep_branch master
# Or, given the input git@github.com:jrl-umi3218/jrl-travis#thebranch
# - git_dep jrl-umi3218/jrl-travis
# - git_dep_uri git@github.com:jrl-umi3218/jrl-travis
# - git_dep_branch thebranch
# The second (optional) argument allows to defined the default branch (defaults
# to master)
git_dependency_parsing()
{
_input=$1
export git_dep=${_input%%#*}
export git_dep_branch=${_input##*#}
if [ "$git_dep_branch" == "$git_dep" ]; then
if [ -e "$2" ]; then
export git_dep_branch=$2
else
export git_dep_branch="master"
fi
fi
git_dep_uri_base=${git_dep%%:*}
if [ "$git_dep_uri_base" == "$git_dep" ]; then
export git_dep_uri="git://github.com/$git_dep"
else
export git_dep_uri=$git_dep
export git_dep=${git_dep##*:}
fi
}
########################################
# -- ENVIRONMENT MANIPULATION -- #
########################################
_gitlab_setup_ci_vars()
{
export CI_REQUIRE_SUDO=false
export CI_PULL_REQUEST=false #FIXME Can it be provided by gitlab?
export CI_REPO_SLUG=`echo ${CI_PROJECT_DIR}|sed -e's@/builds/@@'`
export CI_BRANCH=${CI_BUILD_REF_NAME}
export CI_OS_NAME=${CI_OS_NAME:-linux}
}
_travis_setup_ci_vars()
{
export CI_REQUIRE_SUDO=${CI_REQUIRE_SUDO:-true}
export CI_PULL_REQUEST=${TRAVIS_PULL_REQUEST}
export CI_REPO_SLUG=${TRAVIS_REPO_SLUG}
export CI_BRANCH=${TRAVIS_BRANCH}
export CI_OS_NAME=${TRAVIS_OS_NAME:-linux}
}
# _setup_ci_vars
# --------------
#
# Setup CI_* variables based on the CI type
_setup_ci_vars()
{
# Check which CI tool we are using, default to travis
export CI_TOOL=${CI_TOOL:-travis}
if [ $CI_TOOL = travis ]; then
_travis_setup_ci_vars
else
_gitlab_setup_ci_vars
fi
}
# _setup_sudo_cmd
# ---------------
#
# Setup SUDO_CMD based on CI configuration
_setup_sudo_cmd()
{
if [ ${CI_REQUIRE_SUDO} = false ]; then
export SUDO_CMD=''
else
export SUDO_CMD='sudo'
fi
}
# _setup_ros
# ----------
#
# Setup ROS environment if present on the system
_setup_ros()
{
if [ -f /opt/ros/${ROS_DISTRO}/setup.sh ]; then
. /opt/ros/${ROS_DISTRO}/setup.sh
fi
}
# _setup_env_vars
# ---------------
#
# Setup environment variables
_setup_env_vars()
{
export LD_LIBRARY_PATH="$install_dir/lib:$LD_LIBRARY_PATH"
export LTDL_LIBRARY_PATH="$install_dir/lib:$LTDL_LIBRARY_PATH"
export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$install_dir/share/pkgconfig:$PKG_CONFIG_PATH"
if type "python" > /dev/null; then
pythonsite_dir=`python -c "import sys, os; print(os.sep.join(['lib', 'python' + sys.version[:3], 'site-packages']))"`
export PYTHONPATH="$install_dir/$pythonsite_dir:$PYTHONPATH"
fi
}
# _setup_linux_env
# ----------------
#
# Environment setup specific to linux
_setup_linux_env()
{
export LD_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LD_LIBRARY_PATH"
export LTDL_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LTDL_LIBRARY_PATH"
export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`/pkgconfig:$PKG_CONFIG_PATH"
}
# _setup_osx_env
# ----------------
#
# Environment setup specific to OSX
_setup_osx_env()
{
# Since default gcc on osx is just a front-end for LLVM...
if [[ ${CC} = gcc ]]; then
export CXX=g++-4.8
export CC=gcc-4.8
fi
export DYLD_LIBRARY_PATH="$install_dir/lib:$DYLD_LIBRARY_PATH"
export LTDL_LIBRARY_PATH="$install_dir/lib:$LTDL_LIBRARY_PATH"
export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$PKG_CONFIG_PATH"
}
# setup_ci_env
# ------------
#
# Setup the CI and environment variables
setup_ci_env()
{
_setup_ci_vars
_setup_sudo_cmd
_setup_ros
_setup_env_vars
if [[ ${CI_OS_NAME} = linux ]]; then
_setup_linux_env
fi
if [[ ${CI_OS_NAME} = osx ]]; then
_setup_osx_env
fi
}
# Directories.
root_dir=`pwd`
build_dir="/tmp/_ci/build"
install_dir="/tmp/_ci/install"
echo "root_dir: " $root_dir
echo "build_dir: " $build_dir
echo "install_dir: " $install_dir
# Shortcuts.
git_clone="git clone --quiet --recursive"
# Setup all variables needed by the CI scripts
setup_ci_env
# Make cmake verbose.
export CMAKE_VERBOSE_MAKEFILE=1
export CTEST_OUTPUT_ON_FAILURE=1
# Add default DO_*_ON_BRANCH if needed
if [ -z ${DO_COVERAGE_ON_BRANCH+x} ]; then
export DO_COVERAGE_ON_BRANCH=${CI_BRANCH}
fi
if [ -z ${DO_CPPCHECK_ON_BRANCH+x} ]; then
export DO_CPPCHECK_ON_BRANCH=${CI_BRANCH}
fi
# Create layout.
mkdir -p "$build_dir"
mkdir -p "$install_dir"
#!/bin/bash
rm -rf "$build_dir" "$install_dir"
. `dirname $0`/common.sh
# Set debug mode
set -x
set -v
# Add robotpkg
sudo sh -c "echo \"deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub $(lsb_release -cs) robotpkg\" >> /etc/apt/sources.list "
curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key | sudo apt-key add -
# show memory usage before install
sudo free -m -t
# Setup environment variables.
export APT_DEPENDENCIES="doxygen libboost-system-dev libboost-test-dev libboost-filesystem-dev libboost-program-options-dev libeigen3-dev liburdfdom-dev texlive-font-utils"
# Add Python dependency
export APT_DEPENDENCIES=$APT_DEPENDENCIES" libboost-python-dev robotpkg-py27-eigenpy python2.7-dev python-numpy gfortran libblas-dev liblapack-dev"
# Add Geometry dependencies
if [[ $BUILD_WITH_COLLISION_SUPPORT -eq ON ]]; then
export APT_DEPENDENCIES=$APT_DEPENDENCIES" robotpkg-hpp-fcl"
fi
##############################
# -- Helper functions -- #
##############################
_linux_setup_package_source()
{
# Speed up apt
${SUDO_CMD} sh -c "echo \"force-unsafe-io\" > /etc/dpkg/dpkg.cfg.d/02apt-speedup"
# Update the apt local cache.
${SUDO_CMD} apt-get update -qq
}
_osx_setup_package_source()
{
# Update homebrew
brew update
}
# setup_package_source
# ---------------------
#
# Setup the package source (e.g. homebrew on osx, apt on debian-like systems)
setup_package_source()
{
if [[ ${CI_OS_NAME} = linux ]]; then
_linux_setup_package_source
fi
if [[ ${CI_OS_NAME} = osx ]]; then
_osx_setup_package_source
fi
}
# setup_pbuilder
# --------------
#
# Setup a pbuilder environment
setup_pbuilder()
{
if `test x${DIST} = x`; then
echo "distribution is not set, skipping this build"
exit 0
fi
echo "Target distribution: ${DIST}"
# If we are, we install Debian package development tools and
# create a sid pbuilder. Package dependencies will be installed
# automatically.
${SUDO_CMD} apt-get install -qq \
debootstrap devscripts \
git-buildpackage debian-archive-keyring \
pkg-kde-tools dput eatmydata ccache
# Fix ccache use in pbuilder
${SUDO_CMD} addgroup --system --gid 1234 ccache
${SUDO_CMD} adduser --quiet --system --uid 1234 --ingroup ccache \
--home /var/cache/pbuilder --no-create-home pbuilder
${SUDO_CMD} mkdir -p /var/cache/pbuilder/ccache
${SUDO_CMD} chown -R pbuilder:ccache /var/cache/pbuilder/ccache
${SUDO_CMD} chmod -R g+ws /var/cache/pbuilder/ccache
# Remove previous sandbox.
${SUDO_CMD} rm -rf /var/cache/pbuilder/base-${DIST}.cow || true
# Create a pbuilder sandbox.
cp -f `dirname $0`/pbuilderrc $HOME/.pbuilderrc
sed -i "s|@DIST@|${DIST}|g" $HOME/.pbuilderrc
git-pbuilder create
# Speed up pbuilder.
echo "echo \"force-unsafe-io\" > /etc/dpkg/dpkg.cfg.d/02apt-speedup" | \
git-pbuilder login --save-after-exec
# Add additional PPAs
for ppa in ${DEBIAN_PPA}; do
echo "apt-add-repository ppa:${ppa}" | \
git-pbuilder login --save-after-exec
done
# Retrieve PPA package list.
git-pbuilder update
# FIXME There is something fishy here...
# ccache is not necessary in our case and may cause permission
# issues.
echo "apt-get -y remove ccache" | \
git-pbuilder login --save-after-exec
}
# catkin_git_dependency
# --------------------
#
# Clone catkin package into the workspace
# See arguments of build_git_dependency
# Branch defaults to $ROS_DISTRO instead of master
catkin_git_dependency()
{
git_dependency_parsing $1 $ROS_DISTRO
echo "--> Getting $git_dep (branch $git_dep_branch)"
CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws
cd $CATKIN_DEP_WORKSPACE/src
$git_clone -b $git_dep_branch "$git_dep_uri" "$git_dep"
}
# catkin_build_workspace
# ----------------------
#
# Build catkin workspace
catkin_build_workspace()
{
CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws
cd $CATKIN_DEP_WORKSPACE
catkin_make
}
# build_git_dependency
# --------------------
#
# Build a dependency directly from the Git development tree.
# First argument: repository's GitHub URL or repository's URI + optional branch
# For example: "jrl-umi3218/jrl-travis" or "jrl-umi3218/jrl-travis#dev"
# Or: user@host:path/to/repo or git@github.com:organization/repo#branch
build_git_dependency()
{
git_dependency_parsing $1
echo "--> Compiling $git_dep (branch $git_dep_branch)"
cd "$build_dir"
mkdir -p "$git_dep"
$git_clone -b $git_dep_branch "$git_dep_uri" "$git_dep"
cd "$git_dep"
mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" \
-DDISABLE_TESTS:BOOL=ON ${CMAKE_ADDITIONAL_OPTIONS}
make install || make
}
_osx_install_dependencies()
{
# Install user-specified packages
brew install cppcheck ${HOMEBREW_DEPENDENCIES}
}
_linux_install_dependencies()
{
# Add additional PPAs
for ppa in ${MASTER_PPA}; do
${SUDO_CMD} add-apt-repository -y ppa:${ppa}
done
${SUDO_CMD} apt-get update -qq
${SUDO_CMD} apt-get install -qq curl cppcheck ${APT_DEPENDENCIES}
# Install lcov from github
cd "$build_dir"
wget https://github.com/linux-test-project/lcov/releases/download/v1.12/lcov-1.12.tar.gz
tar zxvf lcov-1.12.tar.gz
cd lcov-1.12
# Reset lcov to release 1.12
${SUDO_CMD} make install
gem install coveralls-lcov
}
install_dependencies()
{
if [[ ${CI_OS_NAME} = linux ]]; then
_linux_install_dependencies
fi
if [[ ${CI_OS_NAME} = osx ]]; then
_osx_install_dependencies
fi
# and we build directly dependencies from the Git repository
for package in ${ROS_GIT_DEPENDENCIES}; do
catkin_git_dependency "$package"
done
if `test "x${ROS_GIT_DEPENDENCIES}" != x`; then
catkin_build_workspace
fi
for package in ${GIT_DEPENDENCIES}; do
build_git_dependency "$package"
done
}
#########################
# -- Main script -- #
#########################
# Print Git version
git --version
# Setup Git identity.
git config --global user.name "JRL/IDH Continuous Integration Tool"
git config --global user.email "jrl-idh+ci@gmail.com"
# Retrieve the submodules.
git submodule update --quiet --init --recursive
# Fetch tags to compute the distance between the last release tag
# and us.
git fetch --quiet --tags
# Shortcuts.
git_clone="git clone --quiet --recursive"
# Display environment
echo "Environment:"
env
setup_package_source
# Check if we are in a debian branch...
if [ -d debian ]; then
setup_pbuilder
else
if [ ! x${DIST} = x ]; then
echo "skipping this build"
exit 0
fi
install_dependencies
fi
# End debug mode
set +v
set +x