ensure headers build independently

This commit is contained in:
Arvid Norberg 2019-05-11 18:28:48 -06:00 committed by Arvid Norberg
parent 7062a4f89e
commit 41a5940100
18 changed files with 55 additions and 2 deletions

View File

@ -5,7 +5,7 @@ matrix:
fast_finish: true
include:
- if: repo = arvidn/libtorrent
env: variant=release sonar_scan=1 toolset=gcc
env: variant=release sonar_scan=1 toolset=gcc check_headers=1
- env: variant=debug toolset=gcc lint=1 pylint=1 clang_tidy=1
addons:
apt:
@ -59,7 +59,7 @@ before_install:
- git submodule update --init --recursive
- 'if [[ $crypto == "" ]]; then export crypto=built-in; fi'
- 'if [[ $TRAVIS_OS_NAME == "osx" && ( "$tests" == "1" || "$sim" == 1 || "$examples" == "1" || "$tools" == "1" || "$python" == "1" ) ]]; then
- 'if [[ $TRAVIS_OS_NAME == "osx" && ( "$tests" == "1" || "$sim" == 1 || "$examples" == "1" || "$tools" == "1" || "$python" == "1" || "$check_headers" == "1" ) ]]; then
travis_retry brew update > /dev/null && brew install ccache boost-build;
fi'
- 'if [[ $TRAVIS_OS_NAME == "osx" && "$python" == "1" ]]; then
@ -207,6 +207,10 @@ script:
bjam -a -j3 clang_tidy;
fi'
- 'if [ "$check_headers" == "1" ]; then
bjam -j3 check-headers crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant;
fi'
# if we are building with code coverage, report it as soon as possible
# libtorrent is the name of the test suite target
- cd test

18
Jamfile
View File

@ -8,6 +8,7 @@ import errors ;
import feature : feature ;
import package ;
import virtual-target ;
import cast ;
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
CXXFLAGS = [ modules.peek : CXXFLAGS ] ;
@ -844,3 +845,20 @@ package.install install
: torrent
: $(headers)
;
local header_targets ;
for local target in $(headers)
{
if ! [ path.basename $(target) ] in windows.hpp win_util.hpp win_crypto_provider.hpp torrent_impl.hpp cppint_import_export.hpp
{
# this cast tells boost build that the header files really *are* cpp files
# otherwise the object rule doesn't know which language to interpret them as
obj header-build/$(target).o : [ cast.cast _ cpp : $(target) ]
: <library>/torrent <cxxflags>-fsyntax-only ;
explicit header-build/$(target).o ;
header_targets += $(target) ;
}
}
alias check-headers : header-build/$(header_targets).o ;
explicit check-headers ;

View File

@ -37,6 +37,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/error_code.hpp"
#include "libtorrent/aux_/aligned_storage.hpp"
#include "libtorrent/debug.hpp" // for TORRENT_ASSERT
#include <type_traits>
namespace libtorrent { namespace aux {

View File

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/span.hpp"
#include "libtorrent/error_code.hpp" // for system_error
#include "libtorrent/aux_/throw.hpp"
#include <fcntl.h>

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_HAS_BLOCK_HPP_INCLUDED
#include "libtorrent/piece_block.hpp"
#include "libtorrent/peer_connection.hpp" // for pending_block
namespace libtorrent { namespace aux {

View File

@ -34,6 +34,9 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_INSTANTIATE_CONNECTION
#include "libtorrent/aux_/export.hpp"
#include "libtorrent/io_service.hpp"
#include "libtorrent/aux_/proxy_settings.hpp"
#include "libtorrent/aux_/socket_type.hpp"
namespace libtorrent {

View File

@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
#define LIBTORRENT_LSD_HPP
#include "libtorrent/config.hpp"
#include "libtorrent/socket.hpp" // for tcp::endpoint
#include "libtorrent/sha1_hash.hpp"
namespace libtorrent { namespace aux {
struct TORRENT_EXTRA_EXPORT lsd_callback

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_NOEXCEPT_MOVABLE_HPP_INCLUDED
#include <type_traits>
#include <utility>
namespace libtorrent {
namespace aux {

View File

@ -35,6 +35,9 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/portmap.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/error_code.hpp"
namespace libtorrent {
namespace aux {

View File

@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_RANGE_HPP
#define TORRENT_RANGE_HPP
#include "libtorrent/aux_/vector.hpp"
namespace libtorrent { namespace aux {
template <typename Iter>

View File

@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/tracker_manager.hpp" // for tracker_connection
namespace libtorrent {

View File

@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef ANNOUNCE_FLAGS_HPP
#define ANNOUNCE_FLAGS_HPP
#include <cstdint>
#include "libtorrent/flags.hpp"
namespace libtorrent { namespace dht {

View File

@ -39,6 +39,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/time.hpp>
#include <libtorrent/address.hpp>
#include <libtorrent/flags.hpp>
#include <libtorrent/socket.hpp> // for udp
#include <libtorrent/kademlia/node_id.hpp>
namespace libtorrent {
namespace dht {

View File

@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
#define LIBTORRENT_TYPES_HPP
#include <cstdint>
#include <algorithm>
#include <array>
namespace libtorrent { namespace dht {

View File

@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_LINKED_LIST_HPP
#define TORRENT_LINKED_LIST_HPP
#include <type_traits>
#include "libtorrent/assert.hpp"
namespace libtorrent {

View File

@ -36,6 +36,9 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cstdint>
#include <array>
#include "aux_/export.hpp"
#include "peer_class.hpp" // for peer_class_t
namespace libtorrent {
// ``peer_class_type_filter`` is a simple container for rules for adding and subtracting

View File

@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_PEX_FLAGS_HPP_INCLUDE
#define TORRENT_PEX_FLAGS_HPP_INCLUDE
#include <cstdint>
#include "libtorrent/flags.hpp"
namespace libtorrent {

View File

@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_TORRENT_FLAGS_HPP
#define TORRENT_TORRENT_FLAGS_HPP
#include <cstdint>
#include "libtorrent/config.hpp"
#include "libtorrent/flags.hpp"