From 5751ba0c1c774d69512cad2bd2c17e40b03af31a Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 21 Jul 2015 23:40:13 +0100 Subject: Use container-based infrastructure for Travis --- .travis.yml | 20 +++++++++----------- CIbuild.sh | 5 +++++ SetFlags.cmake | 7 +++++++ src/Bindings/LuaState.cpp | 2 +- src/Enchantments.cpp | 4 ++-- src/Protocol/Protocol18x.cpp | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index e39cdbc14..d5305f601 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,17 @@ language: cpp +sudo: false compiler: - clang - gcc -before_install: - - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - - sudo apt-get update -qq - -install: - - sudo apt-get install -qq g++-4.8 - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 - - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90 - - # lua, needed for style checking and possibly later on for bindings generation - - sudo apt-get install -qq lua5.1 +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + - lua5.1 script: ./CIbuild.sh @@ -26,3 +23,4 @@ notifications: email: on_success: change on_failure: always + diff --git a/CIbuild.sh b/CIbuild.sh index 60fed73c2..100a64b0c 100755 --- a/CIbuild.sh +++ b/CIbuild.sh @@ -6,6 +6,11 @@ export MCSERVER_BUILD_SERIES_NAME="Travis $CC $TRAVIS_MCSERVER_BUILD_TYPE" export MCSERVER_BUILD_ID=$TRAVIS_JOB_NUMBER export MCSERVER_BUILD_DATETIME=`date` +if [ "$CXX" == "g++" ]; then + # This is a temporary workaround to allow the identification of GCC-4.8 by CMake, required for C++11 features + # Travis Docker containers don't allow sudo, which update-alternatives needs, and it seems no alternative to this command is provided, hence: + export CXX="/usr/bin/g++-4.8" +fi cmake . -DBUILD_TOOLS=1 -DSELF_TEST=1; echo "Checking basic style..." diff --git a/SetFlags.cmake b/SetFlags.cmake index ca5f1d289..9931e4b64 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -266,11 +266,18 @@ macro(set_exe_flags) add_flags_cxx("-Wno-documentation") endif() if ("${CLANG_VERSION}" VERSION_GREATER 3.5) + include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-Wno-reserved-id-macro HAS_NO_RESERVED_ID_MACRO) + check_cxx_compiler_flag(-Wno-documentation-unknown-command HAS_NO_DOCUMENTATION_UNKNOWN) if (HAS_NO_RESERVED_ID_MACRO) # Use this flag to ignore error for a reserved macro problem in sqlite 3 add_flags_cxx("-Wno-reserved-id-macro") endif() + if (HAS_NO_DOCUMENTATION_UNKNOWN) + # Ignore another problem in sqlite + add_flags_cxx("-Wno-documentation-unknown-command") + endif() + add_flags_cxx("-Wno-format-pedantic") endif() endif() endif() diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 7c0d2a121..7b519a798 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -868,7 +868,7 @@ cLuaState::cStackValue cLuaState::WalkToValue(const AString & a_Name) // Remove the previous value from the stack (keep only the new one): lua_remove(m_LuaState, -2); } // for elem - path[] - return std::move(cStackValue(*this)); + return cStackValue(*this); } diff --git a/src/Enchantments.cpp b/src/Enchantments.cpp index 17c77dd93..34270b2f3 100644 --- a/src/Enchantments.cpp +++ b/src/Enchantments.cpp @@ -1040,7 +1040,7 @@ cEnchantments cEnchantments::SelectEnchantmentFromVector(const cWeightedEnchantm { // Sum up all the enchantments' weights: int AllWeights = 0; - for (const auto Enchantment : a_Enchantments) + for (const auto & Enchantment : a_Enchantments) { AllWeights += Enchantment.m_Weight; } @@ -1054,7 +1054,7 @@ cEnchantments cEnchantments::SelectEnchantmentFromVector(const cWeightedEnchantm // Pick a random enchantment: cNoise Noise(a_Seed); int RandomNumber = Noise.IntNoise1DInt(AllWeights) / 7 % AllWeights; - for (const auto Enchantment : a_Enchantments) + for (const auto & Enchantment : a_Enchantments) { RandomNumber -= Enchantment.m_Weight; if (RandomNumber <= 0) diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index da5c451db..6ebd214d2 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -724,7 +724,7 @@ void cProtocol180::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataS Pkt.WriteBEUInt8(static_cast(a_Map.GetScale())); Pkt.WriteVarInt32(static_cast(a_Map.GetDecorators().size())); - for (const auto Decorator : a_Map.GetDecorators()) + for (const auto & Decorator : a_Map.GetDecorators()) { Pkt.WriteBEUInt8(static_cast((static_cast(Decorator.GetType()) << 4) | (Decorator.GetRot() & 0xF))); Pkt.WriteBEUInt8(static_cast(Decorator.GetPixelX())); -- cgit v1.2.3