diff --git a/.drone.star b/.drone.star index cd31666..911c1f3 100644 --- a/.drone.star +++ b/.drone.star @@ -168,6 +168,7 @@ def generate(ctx, lang): 'rm -Rf %s/*' % config["languages"][lang]["src"], '/usr/local/bin/docker-entrypoint.sh generate --enable-post-process-file -i api/openapi-spec/v1.0.yaml $${TEMPLATE_ARG} --additional-properties=packageName=libregraph --git-user-id=owncloud --git-repo-id=%s -g %s -o %s %s' % (config["languages"][lang]["repo-slug"], lang, config["languages"][lang]["src"], config["languages"][lang].get('generator-args', '') ), 'cp LICENSE %s/LICENSE' % config["languages"][lang]["src"], + 'test -d "templates/{0}-files" && cp -rT "templates/{0}-files" "{1}" || true'.format(lang, config["languages"][lang]["src"]), ], } ] + validate(lang) + [ @@ -229,10 +230,18 @@ def generate(ctx, lang): def validate(lang): steps = { "cpp-qt-client": [ + { + "name": "validate-cpp-format", + "image": "xianpengshen/clang-tools:17", + "commands": [ + "git clang-format -force" + ] + }, { "name": "validate-cpp", "image": "owncloudci/client", "commands": [ + "git clang-format -force", "mkdir build-qt", "cd build-qt", "cmake -GNinja -S ../%s/client" % config["languages"][lang]["src"], diff --git a/templates/cpp-qt-client-files/.clang-format b/templates/cpp-qt-client-files/.clang-format new file mode 100644 index 0000000..6e17f17 --- /dev/null +++ b/templates/cpp-qt-client-files/.clang-format @@ -0,0 +1,62 @@ +# Copyright (C) 2016 Olivier Goffart +# +# You may use this file under the terms of the 3-clause BSD license. +# See the file LICENSE from this package for details. + +# This is the clang-format configuration style to be used by Qt, +# based on the rules from https://wiki.qt.io/Qt_Coding_Style and +# https://wiki.qt.io/Coding_Conventions + +--- +# Webkit style was loosely based on the Qt style +BasedOnStyle: WebKit + +Standard: c++17 +ColumnLimit: 160 + +# Disable reflow of qdoc comments: indentation rules are different. +# Translation comments are also excluded +CommentPragmas: "^!|^:" + +# We want a space between the type and the star for pointer types +PointerBindsToType: false + +# We want to break before the operators, but not before a '=' +BreakBeforeBinaryOperators: NonAssignment + +# Braces are usually attached, but not after functions or classes declaration +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + +# The coding style does not specify the following, but this is what gives +# results closest to the existing code. +AlignAfterOpenBracket: DontAlign +AlwaysBreakTemplateDeclarations: true + +# Ideally we should also allow less short function in a single line, but +# clang-format does not handle that +AllowShortFunctionsOnASingleLine: Inline + +SortIncludes: true + +# macros for which the opening brace stays attached +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ] + +# Allow two empty lines for structuring +MaxEmptyLinesToKeep: 2 +KeepEmptyLinesAtTheStartOfBlocks: false + +# Properly format c++11 initializer +SpaceBeforeCpp11BracedList: false +Cpp11BracedListStyle: true \ No newline at end of file