Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cpp_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
We are moving to Forgejo!
You are on a read-only GitLab instance.
Show more breadcrumbs
namark
cpp_tools
Commits
82c42993
Commit
82c42993
authored
6 years ago
by
namark
Browse files
Options
Downloads
Patches
Plain Diff
Exclusion for allinclude.
parent
c7b842d1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
allinclude.cpp
+22
-4
22 additions, 4 deletions
allinclude.cpp
allinclude_sort.sh
+1
-1
1 addition, 1 deletion
allinclude_sort.sh
with
23 additions
and
5 deletions
allinclude.cpp
+
22
−
4
View file @
82c42993
...
...
@@ -6,11 +6,15 @@
#include
<exception>
#include
"simple/file.hpp"
#include
"simple/support/algorithm.hpp"
namespace
fs
=
std
::
filesystem
;
using
namespace
simple
::
file
;
using
namespace
simple
::
support
;
void
generate_allinclude
(
fs
::
path
directory
)
const
char
*
exclude_filename
=
".allinclude_exclude"
;
void
generate_allinclude
(
fs
::
path
directory
,
const
std
::
vector
<
fs
::
path
>&
excluded_headers
=
{})
{
std
::
cout
<<
"generating allinclude files under: "
<<
directory
<<
'\n'
;
auto
i
=
fs
::
directory_iterator
(
directory
);
...
...
@@ -35,7 +39,8 @@ void generate_allinclude(fs::path directory)
include
=
entry
.
path
();
}
if
(
!
include
.
empty
())
if
(
!
include
.
empty
()
&&
none_of
(
excluded_headers
,
[
&
](
auto
&
p
){
return
equivalent
(
p
,
include
);}))
{
auto
relative
=
fs
::
relative
(
include
,
directory
);
std
::
cout
<<
"including: "
<<
entry
<<
" as "
<<
relative
<<
'\n'
;
...
...
@@ -46,7 +51,7 @@ void generate_allinclude(fs::path directory)
}
for
(
auto
&&
target
:
next_targets
)
generate_allinclude
(
target
);
generate_allinclude
(
target
,
excluded_headers
);
}
void
clear_allinclude
(
fs
::
path
directory
)
...
...
@@ -74,6 +79,7 @@ void clear_allinclude(fs::path directory)
int
main
(
int
argc
,
char
const
*
argv
[])
try
{
fs
::
path
target
=
fs
::
current_path
();
if
(
argc
>
1
)
target
=
argv
[
1
];
...
...
@@ -84,9 +90,21 @@ int main(int argc, char const* argv[]) try
return
-
1
;
}
std
::
vector
<
fs
::
path
>
excluded_headers
;
for
(
int
i
=
2
;
i
<
argc
;
++
i
)
excluded_headers
.
emplace_back
(
argv
[
i
]);
if
(
fs
::
exists
(
exclude_filename
))
{
auto
exclude_file
=
ropen
(
exclude_filename
);
string
line
;
while
(
std
::
getline
(
exclude_file
,
line
))
excluded_headers
.
emplace_back
(
line
);
}
clear_allinclude
(
target
);
std
::
cout
<<
'\n'
;
generate_allinclude
(
target
);
generate_allinclude
(
target
,
excluded_headers
);
}
catch
(
const
std
::
exception
&
ex
)
{
...
...
This diff is collapsed.
Click to expand it.
allinclude_sort.sh
+
1
−
1
View file @
82c42993
#!/bin/sh
allinclude
$1
|
grep
creating |
sed
's/creating: //'
| xargs
-I
{}
sort
-o
{}
{}
allinclude
"
$@
"
|
grep
creating |
sed
's/creating: //'
| xargs
-I
{}
sort
-o
{}
{}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment