-
-
Notifications
You must be signed in to change notification settings - Fork 64
/
.boostify
88 lines (86 loc) · 3.09 KB
/
.boostify
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Files to copy over
include_files = [
(r'include/outcome/experimental/status-code/include/(.*)', r'include/boost/outcome/experimental/\1'),
(r'include/(.*)', r'include/boost/\1'),
r'^doc/src/.*$',
r'^test/.*$',
r'^\.clang-.*$',
r'^\.gitattributes$',
r'^index.html$',
]
exclude_files = [
r'.*quickcpplib.*',
r'^include/outcome/experimental/status-code/(?!include)',
r'^include/outcome.ixx',
r'.*\.natvis$',
r'.*\.vs.*',
r'^test/single-header-test.cpp$',
r'^test/constexprs/.*',
r'^doc/src/themes/boostdoc/.git',
r'^doc/src/themes/docdock.*',
r'^doc/src/layouts/partials/.*',
]
overlay_files = [
(r'boostify', r''),
]
def fix_auto_test_case(x):
# Collapse spaces until comma found, replacing any / or - with _
ret = ''
remove_spaces = True
for l in x.group(0):
if l == ',':
remove_spaces = False
if remove_spaces:
if l == ' ':
continue;
if l == '/' or l == '-':
l = '_'
ret += l
ret += '\n'
return ret
# Regexs to replace
core_macros = {
r'^OUTCOME_': r'BOOST_OUTCOME_',
r'([^_])OUTCOME_': r'\1BOOST_OUTCOME_',
r'^SYSTEM_ERROR2_': r'BOOST_OUTCOME_SYSTEM_ERROR2_',
r'([^_])SYSTEM_ERROR2_': r'\1BOOST_OUTCOME_SYSTEM_ERROR2_',
r'<outcome/([^>]+)': r'<boost/outcome/\1',
r'status-code/include/': r'',
r'// Boost.Outcome ' : r'',
r'CXX_': r'BOOST_OUTCOME_C_',
}
source_macros = {
r'DOXYGEN_': r'BOOST_OUTCOME_DOXYGEN_',
r'STANDARDESE_': r'BOOST_OUTCOME_STANDARDESE_',
r'\.\./include/outcome' : r'../include/boost/outcome',
r'#include "quickcpplib/boost/test/unit_test.hpp"' : r'#include <boost/test/unit_test.hpp>\n#include <boost/test/unit_test_monitor.hpp>',
r'BOOST_OUTCOME_AUTO_TEST_CASE\((.*)' : fix_auto_test_case,
r'#include "quickcpplib/execinfo_win64.h"' : r'#error This example can only compile on POSIX',
r'#ifdef __cpp_exceptions' : r'#ifndef BOOST_NO_EXCEPTIONS',
}
source_macros.update(core_macros)
transforms = {
r'^test/tests/.*\.cpp$': {
r'"[^"]+/\.\./include/outcome/([^"]+)"': r'<boost/outcome/\1>',
r'"[^"]+/\.\./include/outcome.hpp"': r'<boost/outcome.hpp>',
r'std::errc([^:])': r'boost::system::errc::errc_t\1',
r'std::errc::': r'boost::system::errc::',
r'std::error_code': r'boost::system::error_code',
r'std::make_error_code': r'make_error_code',
r'std::generic_category': r'boost::system::generic_category',
r'std::system_category': r'boost::system::system_category',
r'std::system_error': r'boost::system::system_error',
r'std::exception_ptr': r'boost::exception_ptr',
r'std::make_exception_ptr': r'boost::copy_exception',
r'std::current_exception': r'boost::current_exception',
r'std::rethrow_exception': r'boost::rethrow_exception',
},
r'^test/expected-pass\.cpp$': {
r'"\.\./include/outcome/([^"]+)"': r'<boost/outcome/\1>',
},
r'^.*\.hpp$' : source_macros,
r'^.*\.ipp$' : source_macros,
r'^.*\.cpp$' : source_macros,
r'^.*\.h$': source_macros,
r'^.*\.md$': core_macros,
}