Skip to content

Commit 3093649

Browse files
committed
re-generate top commons
1 parent 1d55108 commit 3093649

6 files changed

Lines changed: 188 additions & 0 deletions

File tree

config/.clang-format

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
3+
BasedOnStyle: GNU
4+
Language: Cpp
5+
# Force pointers to the type for C++.
6+
AlignEscapedNewlines: DontAlign
7+
AlignTrailingComments: false
8+
AllowShortFunctionsOnASingleLine: false
9+
AlwaysBreakAfterReturnType: All
10+
AlwaysBreakTemplateDeclarations: Yes
11+
DerivePointerAlignment: false
12+
FixNamespaceComments: true
13+
NamespaceIndentation: All
14+
PointerAlignment: Left
15+
SortIncludes: false
16+
Standard: c++20
17+
LambdaBodyIndentation: OuterScope
18+
19+
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html

config/.cmake-format.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# .cmake-format.yaml
2+
# https://cmake-format.readthedocs.io/en/latest/configuration.html
3+
4+
tab_size: 2
5+
use_tabchars: false
6+
line_width: 80
7+
8+
# Put closing parens on a dedicated line for multi-line calls.
9+
dangle_parens: true
10+
11+
# Insert a space after control and function names.
12+
separate_ctrl_name_with_space: true
13+
separate_fn_name_with_space: true
14+
15+
enable_markup: true

config/.prettierignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# DO NOT EDIT!
2+
# Automatically generated from npm-packages-helper/templates/*.
3+
4+
# Ignore artifacts:
5+
build
6+
coverage
7+
dist
8+
bin
9+
maintenance-scripts
10+
templates
11+
12+
# Ignore Liquid template files.
13+
**/*-liquid.*
14+
**/*.liquid
15+
16+
**/CODE-REVIEW.md
17+
**/code-review.md

config/.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 80,
3+
"semi": false,
4+
"singleQuote": true,
5+
"trailingComma": "es5"
6+
}

scripts/clang-format.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
# -----------------------------------------------------------------------------
3+
# DO NOT EDIT!
4+
# Automatically generated from npm-packages-helper/templates/*.
5+
#
6+
# This file is part of the xPack project (http://xpack.github.io).
7+
# Copyright (c) 2022-2026 Liviu Ionescu. All rights reserved.
8+
#
9+
# Permission to use, copy, modify, and/or distribute this software for any
10+
# purpose is hereby granted, under the terms of the MIT license.
11+
#
12+
# If a copy of the license was not distributed with this file, it can be
13+
# obtained from https://opensource.org/licenses/mit.
14+
#
15+
# -----------------------------------------------------------------------------
16+
17+
# -----------------------------------------------------------------------------
18+
# Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d).
19+
20+
if [[ ! -z ${DEBUG} ]]
21+
then
22+
set ${DEBUG} # Activate the expand mode if DEBUG is anything but empty.
23+
else
24+
DEBUG=""
25+
fi
26+
27+
set -o errexit # Exit if command failed.
28+
set -o pipefail # Exit if pipe failed.
29+
set -o nounset # Exit if variable not set.
30+
31+
# Remove the initial space and instead use '\n'.
32+
IFS=$'\n\t'
33+
34+
# -----------------------------------------------------------------------------
35+
# Identify the script location, to reach, for example, the helper scripts.
36+
37+
build_script_path="$0"
38+
if [[ "${build_script_path}" != /* ]]
39+
then
40+
# Make relative path absolute.
41+
build_script_path="$(pwd)/$0"
42+
fi
43+
44+
script_folder_path="$(dirname "${build_script_path}")"
45+
script_folder_name="$(basename "${script_folder_path}")"
46+
47+
# =============================================================================
48+
49+
function run_verbose()
50+
{
51+
# Does not include the .exe extension.
52+
local _app_path="$1"
53+
shift
54+
55+
echo
56+
echo "[${_app_path} $@]"
57+
"${_app_path}" "$@" 2>&1
58+
}
59+
60+
run_verbose clang-format --style=file:config/.clang-format -i --verbose \
61+
$(find src \( -name '*.cpp' -o -name '*.c' \)) \
62+
$(find include -name '*.h')

scripts/cmake-format.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
# -----------------------------------------------------------------------------
3+
# DO NOT EDIT!
4+
# Automatically generated from npm-packages-helper/templates/*.
5+
#
6+
# This file is part of the xPack project (http://xpack.github.io).
7+
# Copyright (c) 2022-2026 Liviu Ionescu. All rights reserved.
8+
#
9+
# Permission to use, copy, modify, and/or distribute this software for any
10+
# purpose is hereby granted, under the terms of the MIT license.
11+
#
12+
# If a copy of the license was not distributed with this file, it can be
13+
# obtained from https://opensource.org/licenses/mit.
14+
#
15+
# -----------------------------------------------------------------------------
16+
17+
# -----------------------------------------------------------------------------
18+
# Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d).
19+
20+
if [[ ! -z ${DEBUG} ]]
21+
then
22+
set ${DEBUG} # Activate the expand mode if DEBUG is anything but empty.
23+
else
24+
DEBUG=""
25+
fi
26+
27+
set -o errexit # Exit if command failed.
28+
set -o pipefail # Exit if pipe failed.
29+
set -o nounset # Exit if variable not set.
30+
31+
# Remove the initial space and instead use '\n'.
32+
IFS=$'\n\t'
33+
34+
# -----------------------------------------------------------------------------
35+
# Identify the script location, to reach, for example, the helper scripts.
36+
37+
build_script_path="$0"
38+
if [[ "${build_script_path}" != /* ]]
39+
then
40+
# Make relative path absolute.
41+
build_script_path="$(pwd)/$0"
42+
fi
43+
44+
script_folder_path="$(dirname "${build_script_path}")"
45+
script_folder_name="$(basename "${script_folder_path}")"
46+
47+
# =============================================================================
48+
49+
# pip3 install --user cmakelang pyyaml
50+
51+
# set -x
52+
PYPATH="$(python3 -m site --user-base)"
53+
echo cmake-format "$(${PYPATH}/bin/cmake-format --version)"
54+
# "${PYPATH}/bin/cmake-format" --no-default --dump-config yaml --config-file "config/.cmake-format.yaml"
55+
56+
function run_verbose()
57+
{
58+
# Does not include the .exe extension.
59+
local _app_path="$1"
60+
shift
61+
62+
echo
63+
echo "[${_app_path} $@]"
64+
"${_app_path}" "$@" 2>&1
65+
}
66+
67+
run_verbose "${PYPATH}/bin/cmake-format" --config-file "config/.cmake-format.yaml" --in-place \
68+
$(find . \( \( -type d -name "build" \) -o \( -type d -name "xpacks" \) -o \( -type d -name "node_modules" \) \) -prune -o \
69+
-type f \( -name "CMakeLists.txt" -o -name "*.cmake" \) -print)

0 commit comments

Comments
 (0)