Basic proto file start.

This commit is contained in:
2023-10-24 22:01:15 -07:00
parent d9f779f071
commit 79f30684de
16 changed files with 224 additions and 43 deletions

67
.clang-format Normal file
View File

@@ -0,0 +1,67 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -8
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: TopLevel
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 4
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 8
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
QualifierAlignment: Left
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 8
UseTab: ForContinuationAndIndentation

31
.clang-tidy Normal file
View File

@@ -0,0 +1,31 @@
Checks: >-
bugprone-*,
cppcoreguidelines-*,
google-*,
misc-*,
modernize-*,
performance-*,
readability-*,
-bugprone-lambda-function-name,
-bugprone-easily-swappable-parameters,
-bugprone-reserved-identifier,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-vararg,
-google-readability-braces-around-statements,
-google-readability-function-size,
-misc-no-recursion,
-modernize-return-braced-init-list,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-performance-unnecessary-value-param,
-readability-identifier-length,
-readability-magic-numbers
CheckOptions:
readability-function-cognitive-complexity.Threshold: 100
readability-function-cognitive-complexity.IgnoreMacros: true
readability-identifier-naming.ClassCase: CamelCase

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

4
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/sgard.iml" filepath="$PROJECT_DIR$/.idea/sgard.iml" />
</modules>
</component>
</project>

2
.idea/sgard.iml generated Normal file
View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

8
.trunk/.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml

View File

@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154
# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091

View File

@@ -0,0 +1,10 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true

34
.trunk/trunk.yaml Normal file
View File

@@ -0,0 +1,34 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.17.1
plugins:
sources:
- id: trunk
ref: v1.2.6
uri: https://github.com/trunk-io/plugins
runtimes:
enabled:
- go@1.21.0
- node@18.12.1
- python@3.10.8
lint:
enabled:
- checkov@2.5.9
- clang-format@16.0.3
- clang-tidy@16.0.3
- git-diff-check
- prettier@3.0.3
- shellcheck@0.9.0
- shfmt@3.6.0
- trivy@0.46.0
- trufflehog@3.60.0
- yamllint@1.32.0
actions:
disabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
enabled:
- trunk-upgrade-available

View File

@@ -4,7 +4,8 @@ package sgardpb;
import "google/protobuf/timestamp.proto";
// Header defines common metadata for messages in sgard.
message Header {
message Header
{
uint32 version = 1;
google.protobuf.Timestamp created = 2;
google.protobuf.Timestamp updated = 3;

View File

@@ -4,7 +4,8 @@ package sgardpb;
import 'header.proto';
import 'path.proto';
message HomeDir {
message HomeDir
{
Header header = 1;
map<string, Source> files = 5;

View File

@@ -11,7 +11,8 @@ enum PathType {
PATHTYPE_LINK = 3;
};
message FilePath {
message FilePath
{
Header header = 1;
string source_path = 2;
@@ -20,12 +21,13 @@ message FilePath {
};
message Source {
message Source
{
Header header = 1;
PathType path_type = 2;
oneof path {
oneof path
{
FilePath file = 5;
};
};

View File

@@ -15,7 +15,7 @@
set -eu
install_debianesque () {
install_debianesque() {
echo "[+] distribution is ${DISTRIB_ID}, choosing Debianesque install."
echo "[+] installing tools"
@@ -28,7 +28,7 @@ install_debianesque () {
sudo apt-get install protobuf-compiler-grpc grpc-proto libgrpc++-dev
}
install_redhat () {
install_redhat() {
echo "[+] distribution is ${DISTRIB_ID}, choosing Redhat install."
echo "[!] WARNING: installation for Redhat systems is unverified."
@@ -39,7 +39,7 @@ install_redhat () {
sudo dnf install protobuf-compiler libprotobuf-dev
}
install_alpine () {
install_alpine() {
echo "[+] distribution is ${DISTRIB_ID}, choosing Alpine install."
echo "[!] WARNING: installation for Alpine systems is unverified."
@@ -50,7 +50,7 @@ install_alpine () {
sudo dnf install sdl2-dev freetype-dev protobuf-compiler-grpc
}
install_macos () {
install_macos() {
# TODO: consider supporting macports?
echo "[+] host system is MacOS"
@@ -61,20 +61,15 @@ install_macos () {
# TODO: look up proper package names in homebrew
}
install_linux () {
install_linux() {
echo "[+] host system is Linux"
[[ -f "/etc/lsb-release" ]] && source /etc/lsb-release
if [ -z "${DISTRIB_ID}" ]
then
if [ -d /etc/apt ]
then
if [ -z "${DISTRIB_ID}" ]; then
if [ -d /etc/apt ]; then
DISTRIB_ID="apt-based"
elif [ -f /etc/alpine-release ]
then
elif [ -f /etc/alpine-release ]; then
DISTRIB_ID=Alpine
elif [ -d /etc/dnf -o /etc/yum.repos.d ]
then
elif [ -d /etc/dnf -o /etc/yum.repos.d ]; then
# I don't use Fedora, this is based on a cursory
# glance at the filesystem on a Docker image.
DISTRIB_ID="Fedora"
@@ -89,18 +84,15 @@ install_linux () {
Alpine) install_alpine ;;
*)
echo "[!] distribution ${DISTRIB_ID} isn't supported in this script." > /dev/null
echo "[!] distribution ${DISTRIB_ID} isn't supported in this script." >/dev/null
;;
esac
}
case "$(uname -s)" in
Linux) install_linux ;;
Darwin) install_macos ;;
*)
echo "[!] platform $(uname -s) isn't supported in this script." > /dev/null
Linux) install_linux ;;
Darwin) install_macos ;;
*)
echo "[!] platform $(uname -s) isn't supported in this script." >/dev/null
;;
esac