Skip to content
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

Setup scripts improvements (no more Java 8) #15334

Merged
merged 7 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/compile_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
token: ${{secrets.ACCESS_TOKEN}}

- name: setup
run: ./Tools/setup/OSX.sh
run: ./Tools/setup/macos.sh

- name: Prepare ccache timestamp
id: ccache_cache_timestamp
Expand Down
64 changes: 0 additions & 64 deletions Tools/setup/OSX.sh

This file was deleted.

2 changes: 1 addition & 1 deletion Tools/setup/arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ if [[ $INSTALL_SIM == "true" ]]; then
# java (jmavsim or fastrtps)
sudo pacman -S --noconfirm --needed \
ant \
jdk8-openjdk \
jdk-openjdk \
;

# Gazebo setup
Expand Down
59 changes: 59 additions & 0 deletions Tools/setup/macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#! /usr/bin/env bash

# script directory
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Reinstall if --reinstall set
REINSTALL_FORMULAS=""
# Install simulation tools?
INSTALL_SIM=""

# Parse arguments
for arg in "$@"
do
if [[ $arg == "--reinstall" ]]; then
REINSTALL_FORMULAS=$arg
elif [[ $arg == "--sim-tools" ]]; then
INSTALL_SIM=$arg
fi
done

if ! command -v brew &> /dev/null
then
# install Homebrew if not installed yet
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi

# Install px4-dev formula
if [[ $REINSTALL_FORMULAS == "--reinstall" ]]; then
echo "Re-installing PX4 general dependencies (homebrew px4-dev)"

# confirm Homebrew installed correctly
brew doctor

brew tap PX4/px4
brew reinstall px4-dev
else
if brew ls --versions px4-dev > /dev/null; then
echo "px4-dev already installed"
else
echo "Installing PX4 general dependencies (homebrew px4-dev)"
brew tap PX4/px4
brew install px4-dev
fi
fi

# Python dependencies
echo "Installing PX4 Python3 dependencies"
pip3 install --user -r ${DIR}/requirements.txt

# Optional, but recommended additional simulation tools:
if [[ $INSTALL_SIM == "--sim-tools" ]]; then
if brew ls --versions px4-sim > /dev/null; then
brew install px4-sim
elif [[ $REINSTALL_FORMULAS == "--reinstall" ]]; then
brew reinstall px4-sim
fi
fi

echo "All set! PX4 toolchain installed!"
23 changes: 15 additions & 8 deletions Tools/setup/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ fi


# check ubuntu version
# instructions for 16.04, 18.04, 20.04
# otherwise warn and point to docker?
UBUNTU_RELEASE="`lsb_release -rs`"

if [[ "${UBUNTU_RELEASE}" == "14.04" ]]; then
echo "Ubuntu 14.04 unsupported, see docker px4io/px4-dev-base"
echo "Ubuntu 14.04 is no longer supported"
exit 1
elif [[ "${UBUNTU_RELEASE}" == "16.04" ]]; then
echo "Ubuntu 16.04"
echo "Ubuntu 16.04 is no longer supported"
exit 1
elif [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
echo "Ubuntu 18.04"
elif [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
Expand Down Expand Up @@ -175,15 +175,22 @@ if [[ $INSTALL_SIM == "true" ]]; then
bc \
;

# Java 8 (jmavsim or fastrtps)
if [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
java_version=11
elif [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
java_version=14
else
java_version=14
fi
# Java (jmavsim or fastrtps)
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
ant \
openjdk-8-jre \
openjdk-8-jdk \
openjdk-$java_version-jre \
openjdk-$java_version-jdk \
;

# Set Java 8 as default
sudo update-alternatives --set java $(update-alternatives --list java | grep "java-8")
# Set Java 11 as default
sudo update-alternatives --set java $(update-alternatives --list java | grep "java-$java_version")

# Gazebo
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
Expand Down