Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Commit

Permalink
kiso initial code contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
yongbosch committed Dec 18, 2019
1 parent 0f5ce42 commit 057d2da
Show file tree
Hide file tree
Showing 1,424 changed files with 1,271,128 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
BasedOnStyle: LLVM
AccessModifierOffset: -4
AllowShortIfStatementsOnASingleLine: false
BreakBeforeBraces: Allman
ColumnLimit: 0
IndentCaseLabels: false
IndentWidth: 4
TabWidth: 4
UseTab: 'Never'
SortIncludes: false
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.o
*.a
/debug
build
builddir-*
.vscode
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Change Log
All notable changes to this project will be documented in this file.

## [0.1.0] - 2019-09-30
### Added
* Initial Kiso code drop
* Add BSP for CommonGateway
* Cellular added
* Add build-possibilities with CMake/Makefiles

### Changed
* Improved documentation




100 changes: 100 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
cmake_minimum_required(VERSION 3.6)

## Command line parameter for build variant
option(ENABLE_TESTING "Configure a build tree for testing instead of normal application mode" OFF)
option(ENABLE_FORMAT_CHECKS "Run format checks during configuration stage and generate target to fix formatting" ON)
option(SKIP_FORMAT_REPORTS "Skip generation of format XML reports in build directory" ON)
option(ENABLE_STATIC_CHECKS "Configure a build tree for static code analysis" OFF)
option(ENABLE_COVERAGE "Build unit tests with coverage information to use with GCOV and LCOV" ON)
option(ENABLE_ALL_FEATURES "Configure a build tree in which all optional Kiso features are 'forced-ON'. Useful for static code analysis and test coverage reports. " OFF)

## Include config file if it exists
include(default_config.cmake OPTIONAL)

## If no external toolchain is specified and we are not building just the unit tests, use the default arm toolchain.
## Should be included as early as possible, before any project specification.
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND NOT ${ENABLE_TESTING})
include(toolchain_arm_gcc.cmake)
endif()

message("------------- KISO CONFIG -------------")
message("Building Kiso tests: ${ENABLE_TESTING}")
message(" ... with coverage: ${ENABLE_COVERAGE}")
message("Selected Kiso board: ${KISO_BOARD_NAME}")
message("Selected Kiso OS: ${KISO_OS_LIB}")
message("Selected Kiso Example: ${KISO_EXAMPLE}")
message("------------- KISO CONFIG -------------")

project (Kiso C)

## Set basic project compile options
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_EXTENSIONS false)
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
add_compile_options(-Werror -Wall -Wextra -Wdouble-promotion
-Wformat=2 -Winit-self -Wunused -Wunused-const-variable -Wnull-dereference
-Wuninitialized -fstrict-overflow -Wstrict-overflow=4 -Wshadow -Wcast-qual)

set(KISO_CENTRAL_CONFIG_DIR ${CMAKE_CURRENT_LIST_DIR}/config)

## Run format checks during configure stage
if(${ENABLE_FORMAT_CHECKS})
include(cmake/CodeFormatting.cmake)
list(APPEND FOLDERS
core thirdparty examples boards config docs)
list(APPEND FILETYPES
*.c *.cc *.cpp *.cxx *.c++
*.h *.hh *.hpp *.hxx *.h++)
ADD_TO_FORMATTING_TARGET("${FOLDERS}" "${FILETYPES}" "${SKIP_FORMAT_REPORTS}")
endif()

## Needs to be in project scope before board is loaded
if(${ENABLE_TESTING})
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)

# In the gtest lib there are problems with these warnings - disable them
add_compile_options(-Wno-unused-const-variable -Wno-missing-field-initializers -Wno-pedantic -Wno-error=deprecated-declarations)

enable_testing()
if(${ENABLE_COVERAGE})
include(cmake/CodeCoverage.cmake)

APPEND_COVERAGE_COMPILER_FLAGS() # From CodeCoverage module
# Do not include coverage information for system headers and thirdparty libs
set(COVERAGE_LCOV_EXCLUDES "'/usr/include/*'" "'/usr/local/include/*'" "'${CMAKE_SOURCE_DIR}/thirdparty/*'" "*_unittest.cc" "*_th.hh")

add_custom_target(coverage)
endif(${ENABLE_COVERAGE})
endif(${ENABLE_TESTING})

## Check for valid board and include the configuration
if(NOT DEFINED KISO_BOARD_NAME)
message(SEND_ERROR "KISO_BOARD_NAME is a required parameter! Use cmake <...> -DKISO_BOARD_NAME=... to specify.")
elseif(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${KISO_BOARD_NAME}) # Use full path - undefined behavior with relative path
message(SEND_ERROR "board_config.cmake missing for board ${KISO_BOARD_NAME}")
else()
include(boards/${KISO_BOARD_NAME}/board_config.cmake)
endif()

if(${ENABLE_STATIC_CHECKS})
find_program(CLANG_TIDY clang-tidy
NAMES clang-tidy-10 clang-tidy-9 clang-tidy-8 clang-tidy-7)
message(STATUS "Looking for clang-tidy: ${CLANG_TIDY}")
endif()

## Add main application code
add_subdirectory(examples/${KISO_BOARD_NAME}/${KISO_EXAMPLE})

## Add board and core libs
add_subdirectory(boards)
add_subdirectory(core/essentials)
add_subdirectory(core/utils)
add_subdirectory(core/connectivity)

## Add thirdparty libs
add_subdirectory(thirdparty)

## Add the documentation (not built by default target)
add_subdirectory(docs)
7 changes: 7 additions & 0 deletions DISCLAIMER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Warranty, Limitation of Liability, Responsibilities

Kiso and its documentation is provided “as is” and BOSCH does not grant any warranty that Kiso is error-free or will operate without interruption. Bosch grants no warranty regarding the use of Kiso or the results there-from including but not limited to its correctness, accuracy or reliability. BOSCH does not warrant the merchantability or fitness of Kiso for any particular use. BOSCH therefore excludes to the extent permitted by applicable law all other warranties with respect to Kiso, either express or implied, including but not limited to any infringement of third party rights based on the use of Kiso by the customer.

The Liability of BOSCH is – irrespective of its legal grounds – limited as follows: BOSCH shall be liable without limitation in case of intent and gross negligence or under a guarantee granted by Bosch. Unless expressly set out before the liability of BOSCH is excluded. This includes but is not limited to any liability for any direct, indirect, incidental, consequential or other damage including but not limited to any loss of data.

The Customer shall be responsible for conducting the integration of Kiso taking account of the state of the art in technology and all applicable statutory regulations and provisions. Moreover, the Customer shall be responsible to sufficiently validate and test its Customer Applications containing Kiso and shall make sure that the Customer Applications do not poses any hazards.
184 changes: 184 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
pipeline
{
agent // Define the agent to use
{
docker
{
label 'RT-Z0KHU'
image 'rb-dtr.de.bosch.com/software-campus/kiso-toolchain:v0.4.3'
registryUrl 'https://rb-dtr.de.bosch.com'
registryCredentialsId 'docker-registry'
}
}
options
{
timeout(time: 60, unit: 'MINUTES') // Define a timeout of 60 minutes
timestamps() // Use a timestamp notation
disableConcurrentBuilds() // We don't want to have concurrent build issues here
}
triggers // Define how many times the job will be triggered
{
pollSCM('*/5 * * * *') // If new changes exist, the Pipeline will be re-triggered automatically. Check will be done every 6 minutes
}

stages
{
stage('Build Software')
{
steps // Define the steps of a stage
{
script // Run build
{
echo "Build the application"
sh 'cmake . -Bbuilddir-debug -G"Ninja"'
sh 'cmake --build builddir-debug'
}
}
}
stage('Run DoD')
{
parallel
{
stage('Format Checks')
{
steps
{
script
{
echo "enforce formatting rules"
sh 'cmake . -Bbuilddir-formatting -G"Ninja" -DENABLE_FORMAT_CHECKS=1 -DSKIP_FORMAT_REPORTS=0'
script {
def reports = findFiles(glob: 'builddir-formatting/**/*_format.xml')
sh "python3 ci/clang-format-to-junit.py ${reports.join(' ')} -o builddir-formatting/clang-format.xml -p builddir-formatting -s _format.xml"
}
}
}
}
stage('Static Analysis')
{
steps
{
script
{
echo "run static analysis"
sh 'cmake . -Bbuilddir-static -G"Unix Makefiles" -DKISO_BOARD_NAME=CommonGateway -DENABLE_STATIC_CHECKS=1 -DENABLE_ALL_FEATURES=1 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON'
sh 'cmake --build builddir-static 2> builddir-static/clang-report.txt'
sh 'cat builddir-static/clang-report.txt | python ci/thirdparty/clangTidyToJunit/clang-tidy-to-junit.py `pwd` > builddir-static/clang-report.xml'
}
}
}
stage('Unit Tests')
{
steps
{
script
{
echo "run unit-tests"
sh 'cmake . -Bbuilddir-unittests -G"Ninja" -DENABLE_TESTING=1 -DENABLE_ALL_FEATURES=1'
sh 'cmake --build builddir-unittests'
sh 'cd builddir-unittests && ctest -T test -V --no-compress-output' // Produce test results xml
sh 'cmake --build builddir-unittests --target coverage -- -j1' // Produce coverage output (single-threaded because of ninja)
}
}
}
stage('Integration Tests')
{
steps
{
script
{
echo "run integration-tests placeholder"
}
}
}
stage('Doxygen Documentation')
{
steps
{
script
{
echo "Generate Doxygen"
sh 'cmake --build builddir-debug --target docs'
}
}
}
stage('Hugo Documentation')
{
steps
{
script
{
echo "Generate Hugo Website"
sh 'hugo -s docs/website'
}
}
}
} // parallel
} // stage('Run DoD')
} // stages

post // Called at very end of the script to notify developer and github about the result of the build
{
always
{
archiveArtifacts (
artifacts: 'builddir-unittests/Testing/**/*.xml',
fingerprint: true
)
archiveArtifacts (
artifacts: 'builddir-static/clang-report.txt',
fingerprint: true
)
archiveArtifacts (
artifacts: 'builddir-formatting/**/*_format.xml',
fingerprint: true
)
junit (
allowEmptyResults: true,
testResults: 'builddir-static/clang-report.xml'
)
junit (
allowEmptyResults: true,
testResults: 'builddir-formatting/clang-format.xml'
)
}
success
{
archiveArtifacts (
artifacts: 'builddir-debug/docs/doxygen/**, builddir-unittests/*_cov/**',
fingerprint: true
)
}
unstable
{
notifyFailed()
}
failure
{
notifyFailed()
}
aborted
{
notifyAbort()
}
}
} // pipeline


def notifyFailed()
{
emailext (subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) is failing",
body: "Please go to ${env.BUILD_URL}, check it out AND fix it...",
recipientProviders: [[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']])
}

def notifyAbort()
{
emailext (subject: "Job '${env.JOB_NAME}' (${env.BUILD_NUMBER}) was aborted",
body: "Please go to ${env.BUILD_URL}, check what happened.",
recipientProviders: [[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']])
}
Loading

0 comments on commit 057d2da

Please sign in to comment.