Browse Source

Unused CI arg

default_compile_flags
vector-of-bool 4 years ago
parent
commit
a2baa889d5
5 changed files with 54396 additions and 6 deletions
  1. +2
    -1
      pyproject.toml
  2. +54323
    -3
      src/dds/catch2_embeddead.generated.cpp
  3. +1
    -1
      src/dds/util/result.hpp
  4. +70
    -0
      tools/dds_ci/format.py
  5. +0
    -1
      tools/dds_ci/main.py

+ 2
- 1
pyproject.toml View File

@@ -22,12 +22,13 @@ distro = "^1.5.0"
[tool.poetry.dev-dependencies]
# Only needed for development
pylint = "^2.6.0"
yapf = "^0.30.0"
mypy = "^0.790"
rope = "^0.18.0"
yapf = "^0.30.0"

[tool.poetry.scripts]
dds-ci = "dds_ci.main:start"
dds-format = "dds_ci.format:start"

[build-system]
requires = ["poetry>=0.12"]

+ 54323
- 3
src/dds/catch2_embeddead.generated.cpp
File diff suppressed because it is too large
View File


+ 1
- 1
src/dds/util/result.hpp View File

@@ -1,8 +1,8 @@
#pragma once

#include <neo/pp.hpp>
#include <boost/leaf/on_error.hpp>
#include <boost/leaf/result.hpp>
#include <neo/pp.hpp>

#include <exception>
#include <string>

+ 70
- 0
tools/dds_ci/format.py View File

@@ -0,0 +1,70 @@
import argparse
from typing_extensions import Protocol

import yapf

from . import paths, proc


class FormatArguments(Protocol):
check: bool
cpp: bool
py: bool


def start() -> None:
parser = argparse.ArgumentParser()
parser.add_argument('--check',
help='Check whether files need to be formatted, but do not modify them.',
action='store_true')
parser.add_argument('--no-cpp', help='Skip formatting/checking C++ files', action='store_false', dest='cpp')
parser.add_argument('--no-py', help='Skip formatting/checking Python files', action='store_false', dest='py')
args: FormatArguments = parser.parse_args()

if args.cpp:
format_cpp(args)
if args.py:
format_py(args)


def format_cpp(args: FormatArguments) -> None:
src_dir = paths.PROJECT_ROOT / 'src'
cpp_files = src_dir.glob('**/*.[hc]pp')
cf_args: proc.CommandLine = [
('--dry-run', '--Werror') if args.check else (),
'-i', # Modify files in-place
'--verbose',
]
for cf_cand in ('clang-format-10', 'clang-format-9', 'clang-format-8', 'clang-format'):
cf = paths.find_exe(cf_cand)
if not cf:
continue
break
else:
raise RuntimeError('No clang-format executable found')

print(f'Using clang-format: {cf_cand}')
res = proc.run([cf, cf_args, cpp_files])
if res.returncode and args.check:
raise RuntimeError('Format checks failed for one or more C++ files. (See above.)')
if res.returncode:
raise RuntimeError('Format execution failed. Check output above.')


def format_py(args: FormatArguments) -> None:
py_files = paths.TOOLS_DIR.rglob('*.py')
rc = yapf.main(
list(proc.flatten_cmd([
'--parallel',
'--verbose',
('--diff') if args.check else ('--in-place'),
py_files,
])))
if rc and args.check:
raise RuntimeError('Format checks for one or more Python files. (See above.)')
if rc:
raise RuntimeError('Format execution failed for Python code. See above.')


if __name__ == "__main__":
start()

+ 0
- 1
tools/dds_ci/main.py View File

@@ -39,7 +39,6 @@ def make_argparser() -> argparse.ArgumentParser:
type=int,
help='Number of parallel jobs to use when building and testing',
default=multiprocessing.cpu_count() + 2)
parser.add_argument('--build-only', action='store_true', help='Only build the dds executable, do not run tests')
parser.add_argument('--clean', action='store_true', help="Don't remove prior build/deps results")
parser.add_argument('--no-test',
action='store_false',

Loading…
Cancel
Save