mirror of
https://github.com/boostorg/bcp.git
synced 2026-07-21 13:13:34 +00:00
Merge pull request #20 from grafikrobot/modular
Add support for modular build structure.
This commit is contained in:
+20
-11
@@ -1,27 +1,31 @@
|
||||
# Copyright 2020 Evan Miller
|
||||
# Copyright 2020 Matt Borland
|
||||
# Copyright 2021 John Maddock
|
||||
# Copyright René Ferdinand Rivera Morell 2024
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
release:
|
||||
types: [published, created, edited]
|
||||
- feature/**
|
||||
- modular
|
||||
jobs:
|
||||
ubuntu-jammy:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [ g++-12 ]
|
||||
include:
|
||||
- compiler: g++-12
|
||||
toolset: gcc
|
||||
os: ubuntu-latest
|
||||
runs-on: ${{matrix.os}}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: '0'
|
||||
- uses: mstachniuk/ci-skip@v1
|
||||
@@ -29,19 +33,24 @@ jobs:
|
||||
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
|
||||
commit-filter-separator: ';'
|
||||
fail-fast: true
|
||||
- name: Set TOOLSET
|
||||
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
|
||||
- name: Add repository
|
||||
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
|
||||
- name: Install packages
|
||||
run: sudo apt install g++-12 git xsltproc docbook-xsl docbook-xml
|
||||
- name: Checkout main boost
|
||||
run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root
|
||||
run: |
|
||||
BOOST_GIT=https://github.com/${GITHUB_REPOSITORY/bcp/boost}.git
|
||||
BOOST_BRANCH=develop && ( test "${GITHUB_REF_NAME}" == "master" || test "${GITHUB_REF_NAME}" == "modular" ) && BOOST_BRANCH=${GITHUB_REF_NAME} || true
|
||||
echo "BOOST_GIT: ${BOOST_GIT}"
|
||||
echo "BRANCH/TAG: ${BOOST_BRANCH}"
|
||||
git clone -b "${BOOST_BRANCH}" --depth 1 "${BOOST_GIT}" '../boost-root'
|
||||
- name: Update tools/boostdep
|
||||
run: git submodule update --init
|
||||
working-directory: ../boost-root
|
||||
- name: Copy files
|
||||
run: cp -r $GITHUB_WORKSPACE/* tools/bcp
|
||||
run: |
|
||||
rm -rf tools/bcp/*
|
||||
cp -rv $GITHUB_WORKSPACE/* tools/bcp
|
||||
working-directory: ../boost-root
|
||||
- name: Bootstrap
|
||||
run: ./bootstrap.sh
|
||||
@@ -50,7 +59,7 @@ jobs:
|
||||
run: ./b2 headers
|
||||
working-directory: ../boost-root
|
||||
- name: Generate user config
|
||||
run: 'echo "using $TOOLSET : : ${{ matrix.compiler }} ;" > ~/user-config.jam'
|
||||
run: 'echo "using ${{ matrix.toolset }} : : ${{ matrix.compiler }} ;" > ~/user-config.jam'
|
||||
working-directory: ../boost-root
|
||||
- name: Config info
|
||||
run: ./b2 libs/config/test//print_config_info
|
||||
|
||||
+31
-30
@@ -1,36 +1,37 @@
|
||||
# (C) Copyright John Maddock 2006.
|
||||
# Copyright René Ferdinand Rivera Morell 2024
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
exe bcp
|
||||
:
|
||||
add_dependent_lib.cpp add_path.cpp bcp_imp.cpp copy_path.cpp file_types.cpp
|
||||
fileview.cpp main.cpp path_operations.cpp scan_cvs_path.cpp
|
||||
licence_info.cpp scan_licence.cpp output_licence_info.cpp
|
||||
/boost/filesystem//boost_filesystem
|
||||
/boost/regex//boost_regex
|
||||
:
|
||||
:
|
||||
release
|
||||
;
|
||||
|
||||
install dist-bin
|
||||
:
|
||||
bcp
|
||||
:
|
||||
<install-type>EXE
|
||||
<location>../../dist/bin
|
||||
:
|
||||
release
|
||||
;
|
||||
|
||||
install dist-lib
|
||||
:
|
||||
bcp
|
||||
:
|
||||
<install-type>LIB
|
||||
<location>../../dist/lib
|
||||
:
|
||||
release
|
||||
require-b2 5.2 ;
|
||||
|
||||
import option ;
|
||||
import path ;
|
||||
|
||||
local DIST_DIR = [ option.get distdir ] ;
|
||||
DIST_DIR ?= [ option.get build-dir ] ;
|
||||
DIST_DIR ?= [ path.join $(BOOST_ROOT) dist ] ;
|
||||
DIST_DIR ?= dist ;
|
||||
DIST_DIR = [ path.root [ path.make $(DIST_DIR) ] [ path.pwd ] ] ;
|
||||
|
||||
project /boost/bcp ;
|
||||
|
||||
explicit
|
||||
[ exe bcp
|
||||
:
|
||||
add_dependent_lib.cpp add_path.cpp bcp_imp.cpp copy_path.cpp file_types.cpp
|
||||
fileview.cpp main.cpp path_operations.cpp scan_cvs_path.cpp
|
||||
licence_info.cpp scan_licence.cpp output_licence_info.cpp
|
||||
/boost/filesystem//boost_filesystem
|
||||
/boost/regex//boost_regex
|
||||
:
|
||||
: release ]
|
||||
[ install dist-bin
|
||||
: bcp/<link>static
|
||||
: <install-type>EXE <location>$(DIST_DIR)/bin
|
||||
: release ]
|
||||
[ alias all : bcp test dist-bin ]
|
||||
;
|
||||
|
||||
# Install distribution files/execs by default.
|
||||
alias dist : dist-bin ;
|
||||
|
||||
+78
-32
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2003 Dr John Maddock
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* Copyright René Ferdinand Rivera Morell 2023
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* This file implements the following:
|
||||
@@ -42,25 +43,45 @@ void bcp_implementation::add_path(const fs::path& p)
|
||||
|
||||
void bcp_implementation::add_directory(const fs::path& p)
|
||||
{
|
||||
auto is_good_path = [this](const fs::path& p)
|
||||
{
|
||||
//
|
||||
// Don't add files created by build system:
|
||||
//
|
||||
if((p.filename() == "bin") || (p.filename() == "bin-stage"))
|
||||
return false;
|
||||
//
|
||||
// Don't add version control directories:
|
||||
//
|
||||
if((p.filename() == "CVS") || (p.filename() == ".svn") || (p.filename() == ".git"))
|
||||
return false;
|
||||
//
|
||||
// Don't add CI directories:
|
||||
//
|
||||
if((p.filename() == ".github") || (p.filename() == ".drone")
|
||||
|| (p.filename() == ".circleci") || (p.filename() == ".ci"))
|
||||
return false;
|
||||
//
|
||||
// Don't add CI files:
|
||||
//
|
||||
if((p.filename() == ".travis.yml") || (p.filename() == "appveyor.yml")
|
||||
|| (p.filename() == ".drone.star")
|
||||
|| (p.filename() == ".drone.jsonnet")
|
||||
|| (p.filename() == ".cirrus.yml")
|
||||
|| (p.filename() == "azure-pipelines.yml"))
|
||||
return false;
|
||||
//
|
||||
// don't add directories not under version control:
|
||||
//
|
||||
if(m_cvs_mode && !fs::exists(m_boost_path / p / "CVS/Entries"))
|
||||
return false;
|
||||
if(m_svn_mode && !fs::exists(m_boost_path / p / ".svn/entries"))
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
if (!is_good_path(p)) return;
|
||||
//
|
||||
// Don't add files created by build system:
|
||||
//
|
||||
if((p.filename() == "bin") || (p.filename() == "bin-stage"))
|
||||
return;
|
||||
//
|
||||
// Don't add version control directories:
|
||||
//
|
||||
if((p.filename() == "CVS") || (p.filename() == ".svn"))
|
||||
return;
|
||||
//
|
||||
// don't add directories not under version control:
|
||||
//
|
||||
if(m_cvs_mode && !fs::exists(m_boost_path / p / "CVS/Entries"))
|
||||
return;
|
||||
if(m_svn_mode && !fs::exists(m_boost_path / p / ".svn/entries"))
|
||||
return;
|
||||
//
|
||||
// enermerate files and directories:
|
||||
// enumerate files and directories:
|
||||
//
|
||||
fs::directory_iterator i(m_boost_path / p);
|
||||
fs::directory_iterator j;
|
||||
@@ -74,7 +95,7 @@ void bcp_implementation::add_directory(const fs::path& p)
|
||||
if(m_boost_path.string().size())
|
||||
s.erase(0, m_boost_path.string().size() + 1);
|
||||
fs::path np = s;
|
||||
if(!m_dependencies.count(np))
|
||||
if(is_good_path(np) && !m_dependencies.count(np))
|
||||
{
|
||||
m_dependencies[np] = p; // set up dependency tree
|
||||
if (m_excluded.find(np) == m_excluded.end())
|
||||
@@ -107,7 +128,30 @@ void bcp_implementation::add_file(const fs::path& p)
|
||||
{
|
||||
add_file_dependencies(p, false);
|
||||
}
|
||||
if(is_jam_file(p) && m_namespace_name.size() && ((std::distance(p.begin(), p.end()) < 3) || (*p.begin() != "tools") || (*++p.begin() != "build")))
|
||||
if(is_jam_file(p) && *p.begin() == "libs" && (std::distance(p.begin(), p.end()) >= 3))
|
||||
{
|
||||
//
|
||||
// Modular libs jamfile(s) have references to all the user level
|
||||
// dependent libraries to also include.
|
||||
//
|
||||
auto lib = *(++p.begin());
|
||||
static const boost::regex e(">/boost/([a-zA-Z0-9_]+)");
|
||||
fileview view(m_boost_path / p);
|
||||
boost::regex_token_iterator<const char*> i(view.begin(), view.end(), e, 1);
|
||||
boost::regex_token_iterator<const char*> j;
|
||||
while(i != j)
|
||||
{
|
||||
std::cout << "INFO: Adding modular lib reference from: " << lib << " to: " << *i << "\n";
|
||||
if (*i == "numeric_conversion") add_path(m_boost_path / "libs/numeric/conversion");
|
||||
else if (*i == "interval") add_path(m_boost_path / "libs/numeric/interval");
|
||||
else if (*i == "odeint") add_path(m_boost_path / "libs/numeric/odeint");
|
||||
else if (*i == "ublas") add_path(m_boost_path / "libs/numeric/ublas");
|
||||
else add_path(m_boost_path / "libs" / *i);
|
||||
++i;
|
||||
}
|
||||
add_path(m_boost_path / "libs" / lib);
|
||||
}
|
||||
else if(is_jam_file(p) && m_namespace_name.size() && ((std::distance(p.begin(), p.end()) < 3) || (*p.begin() != "tools") || (*++p.begin() != "build")))
|
||||
{
|
||||
//
|
||||
// We're doing a rename of namespaces and library names
|
||||
@@ -181,7 +225,7 @@ void bcp_implementation::add_file(const fs::path& p)
|
||||
// only concatonate if it's a relative path
|
||||
// rather than a URL:
|
||||
fs::path dep(p.parent_path() / s);
|
||||
if(!m_dependencies.count(dep))
|
||||
if(!m_dependencies.count(dep))
|
||||
{
|
||||
m_dependencies[dep] = p; // set up dependency tree
|
||||
add_pending_path(dep);
|
||||
@@ -295,13 +339,15 @@ static const std::pair<fs::path, fs::path>
|
||||
std::pair<fs::path, fs::path>("boost/graph/rmat_graph_generator.hpp", "boost/graph/distributed/rmat_graph_generator.hpp"),
|
||||
std::pair<fs::path, fs::path>("boost/graph/strong_components.hpp", "boost/graph/distributed/strong_components.hpp"),
|
||||
std::pair<fs::path, fs::path>("boost/graph/two_bit_color_map.hpp", "boost/graph/distributed/two_bit_color_map.hpp"),
|
||||
std::pair<fs::path, fs::path>("libs/context/build.jam", "libs/predef/tools/check/predef.jam"),
|
||||
std::pair<fs::path, fs::path>("libs/test/build/Jamfile.v2", "libs/predef/tools/check/predef.jam"),
|
||||
};
|
||||
|
||||
for(unsigned int n = 0; n < (sizeof(specials)/sizeof(specials[0])); ++n)
|
||||
{
|
||||
if(0 == compare_paths(specials[n].first, p))
|
||||
{
|
||||
if(!m_dependencies.count(specials[n].second))
|
||||
if(!m_dependencies.count(specials[n].second))
|
||||
{
|
||||
m_dependencies[specials[n].second] = p; // set up dependency tree
|
||||
add_pending_path(specials[n].second);
|
||||
@@ -317,7 +363,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
"^[[:blank:]]*(?://@bcp[[:blank:]]+([^\\n]*)\n)?#[[:blank:]]*include[[:blank:]]*[\"<]([^\">]+)[\">]"
|
||||
);
|
||||
|
||||
if(!m_dependencies.count(p))
|
||||
if(!m_dependencies.count(p))
|
||||
m_dependencies[p] = p; // set terminal dependency
|
||||
|
||||
fileview view;
|
||||
@@ -354,7 +400,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
fs::path test_file(m_boost_path / p.parent_path() / include_file);
|
||||
if(fs::exists(test_file) && !fs::is_directory(test_file) && (p.parent_path().string() != "boost"))
|
||||
{
|
||||
if(!m_dependencies.count(p.parent_path() / include_file))
|
||||
if(!m_dependencies.count(p.parent_path() / include_file))
|
||||
{
|
||||
m_dependencies[p.parent_path() / include_file] = p;
|
||||
add_pending_path(p.parent_path() / include_file);
|
||||
@@ -362,7 +408,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
}
|
||||
else if(fs::exists(m_boost_path / include_file))
|
||||
{
|
||||
if(!m_dependencies.count(include_file))
|
||||
if(!m_dependencies.count(include_file))
|
||||
{
|
||||
m_dependencies[include_file] = p;
|
||||
add_pending_path(include_file);
|
||||
@@ -404,7 +450,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
fs::path test_file(m_boost_path / p.parent_path() / include_file);
|
||||
if(fs::exists(test_file) && !fs::is_directory(test_file) && (p.parent_path().string() != "boost"))
|
||||
{
|
||||
if(!m_dependencies.count(p.parent_path() / include_file))
|
||||
if(!m_dependencies.count(p.parent_path() / include_file))
|
||||
{
|
||||
m_dependencies[p.parent_path() / include_file] = p;
|
||||
add_pending_path(p.parent_path() / include_file);
|
||||
@@ -412,7 +458,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
}
|
||||
else if(fs::exists(m_boost_path / include_file))
|
||||
{
|
||||
if(!m_dependencies.count(include_file))
|
||||
if(!m_dependencies.count(include_file))
|
||||
{
|
||||
m_dependencies[include_file] = p;
|
||||
add_pending_path(include_file);
|
||||
@@ -428,7 +474,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
//
|
||||
// Scan for any #include MACRO includes that we don't recognise.
|
||||
//
|
||||
// Begin by declaring all of the macros that get #included that
|
||||
// Begin by declaring all of the macros that get #included that
|
||||
// we know about and are correctly handled as special cases:
|
||||
//
|
||||
static const std::string known_macros[] = {
|
||||
@@ -536,7 +582,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
if(!scanfile)
|
||||
{
|
||||
//
|
||||
// grab the name of the library to which the header belongs,
|
||||
// grab the name of the library to which the header belongs,
|
||||
// and if that library has source then add the source to our
|
||||
// list:
|
||||
//
|
||||
@@ -578,4 +624,4 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2003 Dr John Maddock
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* This file implements the bcp_implementation virtuals.
|
||||
@@ -18,8 +18,8 @@
|
||||
#include <string>
|
||||
|
||||
bcp_implementation::bcp_implementation()
|
||||
: m_list_mode(false), m_list_summary_mode(false), m_license_mode(false), m_cvs_mode(false),
|
||||
m_svn_mode(false), m_unix_lines(false), m_scan_mode(false), m_bsl_convert_mode(false),
|
||||
: m_list_mode(false), m_list_summary_mode(false), m_license_mode(false), m_cvs_mode(false),
|
||||
m_svn_mode(false), m_unix_lines(false), m_scan_mode(false), m_bsl_convert_mode(false),
|
||||
m_bsl_summary_mode(false), m_namespace_alias(false), m_list_namespaces(false)
|
||||
{
|
||||
}
|
||||
@@ -80,8 +80,8 @@ void bcp_implementation::enable_unix_lines()
|
||||
|
||||
void bcp_implementation::set_boost_path(const char* p)
|
||||
{
|
||||
// Hack to strip trailing slashes from the path
|
||||
m_boost_path = (fs::path(p) / "boost").parent_path();
|
||||
// Hack to strip trailing slashes from the path
|
||||
m_boost_path = (fs::path(p) / "boost").parent_path();
|
||||
fs::path check = m_boost_path / "boost" / "version.hpp";
|
||||
if(!fs::exists(check))
|
||||
{
|
||||
@@ -124,8 +124,8 @@ void bcp_implementation::add_excluded(const char* p)
|
||||
{
|
||||
std::cerr << "CAUTION: excluded path " << p << " does not exist." << std::endl;
|
||||
return;
|
||||
}
|
||||
m_excluded.insert(p);
|
||||
}
|
||||
m_excluded.insert(p);
|
||||
}
|
||||
|
||||
fs::path get_short_path(const fs::path& p)
|
||||
@@ -202,7 +202,7 @@ int bcp_implementation::run()
|
||||
fs::path exmodule;
|
||||
module = fs::path(*i);
|
||||
exmodule = fs::path(*i + ".hpp");
|
||||
|
||||
|
||||
if(m_scan_mode)
|
||||
{
|
||||
// in scan mode each module must be a real file:
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2003 Dr John Maddock
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* This file implements the following:
|
||||
@@ -20,7 +20,7 @@ bool bcp_implementation::is_source_file(const fs::path& p)
|
||||
".*\\."
|
||||
"(?:"
|
||||
"c|cxx|h|hxx|inc|inl|.?pp|yy?"
|
||||
")",
|
||||
")",
|
||||
boost::regex::perl | boost::regex::icase
|
||||
);
|
||||
return boost::regex_match(p.filename().generic_string(), e);
|
||||
@@ -64,7 +64,7 @@ bool bcp_implementation::is_jam_file(const fs::path& p)
|
||||
"jam|v2"
|
||||
")"
|
||||
"|"
|
||||
"(Jamfile|Jamroot)\\.?",
|
||||
"(Jamfile|Jamroot)\\.?",
|
||||
boost::regex::perl | boost::regex::icase
|
||||
);
|
||||
return boost::regex_match(p.filename().generic_string(), e);
|
||||
|
||||
+5
-5
@@ -8,7 +8,7 @@
|
||||
|
||||
# boost-root:
|
||||
cd ../../..
|
||||
./b2 -j3 tools/bcp || { echo './b2 -j3 tools/bcp failed' ; exit 1; }
|
||||
./b2 -j3 tools/bcp//dist || { echo './b2 -j3 tools/bcp failed' ; exit 1; }
|
||||
rm -rf ../bcp-output
|
||||
mkdir ../bcp-output || { echo 'mkdir failed' ; exit 1; }
|
||||
./dist/bin/bcp program_options build ../bcp-output || { echo './dist/bin/bcp program_options build ../bcp-output failed' ; exit 1; }
|
||||
@@ -26,9 +26,9 @@ cd ../boost-root
|
||||
echo "using xsltproc ;" | tee -a $HOME/user-config.jam
|
||||
echo "using boostbook : /usr/share/xml/docbook/stylesheet/docbook-xsl : /usr/share/sgml/docbook/dtd/xml/4.2 ;" | tee -a $HOME/user-config.jam
|
||||
cd tools/inspect/build
|
||||
../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxflags="-std=gnu++14" release dist-bin || { echo 'building inspect failed' ; exit 1; }
|
||||
cd ../../bcp/doc
|
||||
rm -rf html
|
||||
../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxflags="-std=gnu++14" release || { echo 'building docs failed' ; exit 1; }
|
||||
../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxstd=14 release dist-bin || { echo 'building inspect failed' ; exit 1; }
|
||||
cd ../../bcp/doc
|
||||
rm -rf html
|
||||
../../../b2 -j2 address-model=64 architecture=x86 toolset=gcc cxxstd=14 release || { echo 'building docs failed' ; exit 1; }
|
||||
../../../dist/bin/inspect -text || { echo 'inspect failed' ; exit 1; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user