Skip to content

Commit 5eb306d

Browse files
RReichertjungleraptorkrisukoxakleemanismolyakov
committed
open source publish 1cb4e5f..47524f3
--- automate leap second generation (cherry picked from commit a0fc272ed341bdc67e20a51b15bc8ff645394e12) --- Fix roll-over edge case with GPS_TIME_UNKNOWN * fix roll-over edge case * add check for edge case * add additional test cases * and 2 more cases --- Subsystem status report --- Adds gpsdifftime_week_second function Adds a new time_duration data type Adds gpsdifftime_week_second to compute time differences with better floating point precision --- cmake - clang-tidy: allow target to be disabled * write clang-tidy to build dir * port clang-tidy enable/disable from legacy module * Revert "write clang-tidy to build dir" This reverts commit 8dfb9554b8941ff1cd466af634591f92bf2bfb79. * update docs * Update ClangTidy.cmake * define early_exit macro Triggered-By: cmake 31604e72e72c09fa32effdbc37acc79dda7c99d7 Upstream-PR: http://github.com/swift-nav/cmake/pull/109 --- Journaled status reports --- cmake - Integrity unit tests framework Triggered-By: cmake 4c16386e790c6f142cc53579017d032f5b5b9196 Upstream-PR: http://github.com/swift-nav/cmake/pull/111 --- cmake - Removed enabled features Triggered-By: cmake 93df75d47790091548827c2b430979ddee6e1328 Upstream-PR: http://github.com/swift-nav/cmake/pull/113 --- Update SBP to RTCM converter to make it fuzz test safe - Step 1 * Add `setbitul/setbitsl` to deal with `uint64_t/int64_t` encoding. * Add `swiftnav_bitstream_setbit**()` functions taking `swiftnav_bitstream_t` as input. This type helps tracking the encoding/decoding len & buff len. --- cmake - Upgrade Sonarcloud Functionality Triggered-By: cmake 6320bbfa506469d5420c2718c7f377f573323fd0 Upstream-PR: http://github.com/swift-nav/cmake/pull/114 --- Update build badges --- Add SonarCloud code coverage * Add SonarCloud code coverage * fix-up build path * fix TESTENV * update sonar info * add auto cancel * formatting --- cmake - Sonarcloud submodule inclusion fix Triggered-By: cmake 63396d60278f8b92e1f8f71696110a3309e3ee23 Upstream-PR: http://github.com/swift-nav/cmake/pull/115 --- Add float literal version of R2D --- Update setbitul to align with setbitu * Update setbitul function created in TSV-49 to align with setbitu. In TSV-49 it is temporarily copied from rtcm_setbitul. --- B11 to B1I --- cmake - Add Module For Checking Atomic Adds function for detecting if linking against libatomic is required. Triggered-By: cmake 449f9b373311186f651058a23e26d8956cf5d097 Upstream-PR: http://github.com/swift-nav/cmake/pull/117 --- Regenerate leap_seconds.h --- Add missing include * Add missing include * Update include statement --- cmake - Add clang format 11 (#363) Triggered-By: cmake 62f063fe21b19eaee6321407e02f9d9593f071c1 Upstream-PR: http://github.com/swift-nav/cmake/pull/119 --- cmake - Fix Sonarcloud sonar-project.properties Fixes the emitted sonar.properties file so that header and test files are picked up by Sonarcloud analysis. According to the docs `sonar.tests` is ignored for C/C++ code, so test paths should be treated the same as source paths. Also switches `sonar.inclusions` with `sonar.sources` to fix the include paths being filtered out. Triggered-By: cmake 3550197d7033f9eccfdc3611e335e91227ce92df Upstream-PR: http://github.com/swift-nav/cmake/pull/120 --- cmake - sonarcloud: Use Inclusions Property Fixes code coverage builds by switching to using the sonar.inclusions property. Some of our build targets set their source directories in the include paths. Those paths are then emitted in the sonar-project.properties file here. The issue is that this can lead to files being indexed twice which the sonar-scanner treats as an error. Using the `sonar.inclusions` property and adding pattern strings avoids this issue. Triggered-By: cmake 1773f34dbdbb5c551a0eab8d7f95b66e81eeb550 Upstream-PR: http://github.com/swift-nav/cmake/pull/121 --- cmake - Rollback SonarCloud Changes * Revert "sonarcloud: Use Inclusions Property (#121)" This reverts commit 1773f34dbdbb5c551a0eab8d7f95b66e81eeb550. * Revert "Fix Sonarcloud sonar-project.properties (#120)" This reverts commit 3550197d7033f9eccfdc3611e335e91227ce92df. Rolling back recent sonarcloud changes until we get a better grip on how to properly configure C/C++ projects. Triggered-By: cmake ea15fa9b1e5dd296d932866ee0b9a1d2eab9296c Upstream-PR: http://github.com/swift-nav/cmake/pull/126 --- Automatically create alias targets in cmake * Removes manual ALIAS addition for targets. * All dependencies are updated to be called with alias. --- remove ccache volume --- Add gnss metric struct * add gnss metric struct * helper type change --- Bump clang format to 14 --- cmake - Fix Sonarcloud sonar-project.properties Triggered-By: cmake 2d81b27be8e90ccb95493c5417bb34d8a5a665c5 Upstream-PR: http://github.com/swift-nav/cmake/pull/127 --- cmake - Fix empty test source files Triggered-By: cmake cc1a63b6ea4456c214945ca2cd1dcca2873ffbbf Upstream-PR: http://github.com/swift-nav/cmake/pull/129 --- Adds bazel build to libswiftnav Adds experimental bazel build for libswiftnav + check. --- cmake - compile compile command cleanup Triggered-By: cmake c5c4d80588d28695bd377cfe89d7df64980341d6 Upstream-PR: http://github.com/swift-nav/cmake/pull/130 --- Add Clarification Comments For Time of Transmission --- Bazel build in CI --- cmake - Ability to Enable Extra Clang-Tidy Flags Triggered-By: cmake a2e709d177493a1b5a183ff5fe26c516a0737bd6 Upstream-PR: http://github.com/swift-nav/cmake/pull/131 --- Bazel build for macOS - Switches to using rules_foreign_cc for building check - Adds select option for choosing correct link libraries - Always build bazel but only notify failures on master --- Output compile_commands.json file from Bazel --- cmake - Fix compile_commands.json generation in newer cmake versions Triggered-By: cmake b8d744bd40f8254ec5543c80658e70350eff2863 Upstream-PR: http://github.com/swift-nav/cmake/pull/132 --- Build for x86_64-win64-msvc Small change to support bazel build of check on windows. Co-authored-by: Isaac Torres <[email protected]> Co-authored-by: Krzysztof Naglik <[email protected]> Co-authored-by: Alex Kleeman <[email protected]> Co-authored-by: Ivan Smolyakov <[email protected]> Co-authored-by: Rafał Paradowski <[email protected]> Co-authored-by: Lucas Le <[email protected]> Co-authored-by: antrikshsrivastava <[email protected]> Co-authored-by: Matt Woodward <[email protected]> Co-authored-by: tlgnsss <[email protected]> Co-authored-by: Jason Mobarak <[email protected]> Co-authored-by: Rodrigo Reichert <[email protected]> Co-authored-by: Jan Bolting <[email protected]> Co-authored-by: richarddeurloo <[email protected]>
1 parent c96bba3 commit 5eb306d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1724
-197
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: Cancelling previous actions runs.
3+
"on": pull_request
4+
jobs:
5+
cancel:
6+
name: auto-cancellation-running-action
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: fauguste/[email protected]
10+
with:
11+
githubToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,37 @@ on:
1313

1414
jobs:
1515

16+
ubuntu-codecov:
17+
runs-on: ubuntu-18.04
18+
steps:
19+
20+
- name: Checkout source
21+
uses: actions/checkout@v2
22+
with:
23+
fetch-depth: 0
24+
submodules: recursive
25+
ssh-key: ${{ secrets.SSH_KEY }}
26+
27+
- name: Install llvm-cov
28+
run: |
29+
sudo apt-get update && sudo apt-get install llvm -y
30+
31+
- name: Run build
32+
env:
33+
CC: clang
34+
CXX: clang++
35+
TESTENV: codecov
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
38+
SONAR_ORGANIZATION: swift-nav
39+
SONAR_PROJECT_KEY: swift-nav_libswiftnav
40+
SONAR_PROJECT_NAME: libswiftnav
41+
SONAR_HOST_URL: https://sonarcloud.io
42+
SONAR_SCANNER_VERSION: 4.2.0.1873
43+
44+
run: |
45+
bash ./ci-build.sh
46+
1647
windows:
1748
strategy:
1849
matrix:
@@ -119,5 +150,6 @@ jobs:
119150
CC: ${{ matrix.cc }}
120151
CXX: ${{ matrix.cxx }}
121152
TEST_SUITE: ${{ matrix.test_suite }}
153+
TESTENV: c
122154
run: |
123155
bash ./ci-build.sh

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@ include/swiftnav/config.h
55

66
# IDE files
77
.vscode/
8+
9+
### Added by Hedron's Bazel Compile Commands Extractor: https://github.com/hedronvision/bazel-compile-commands-extractor
10+
# The external link: Differs on Windows vs macOS/Linux, so we can't check it in. The pattern needs to not have a trailing / because it's a symlink on macOS/Linux.
11+
/external
12+
# Bazel output symlinks: Same reasoning as /external. You need the * because people can change the name of the directory your repository is cloned into, changing the bazel-<workspace_name> symlink.
13+
/bazel-*
14+
# Compiled output -> don't check in
15+
/compile_commands.json
16+
# Directory where clangd puts its indexing work
17+
/.cache/

BUILD.bazel

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library")
2+
load(":bazel/configure_file.bzl", "configure_file")
3+
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
4+
5+
refresh_compile_commands(
6+
name = "refresh_compile_commands",
7+
)
8+
9+
configure_file(
10+
name = "max_channels",
11+
out = "max_channels.h",
12+
template = "src/max_channels.h.in",
13+
vars = {"MAX_CHANNELS": "63"},
14+
)
15+
16+
cc_library(
17+
name = "swiftnav",
18+
srcs = [
19+
"src/almanac.c",
20+
"src/bits.c",
21+
"src/coord_system.c",
22+
"src/correct_iono_tropo.c",
23+
"src/decode_glo.c",
24+
"src/edc.c",
25+
"src/ephemeris.c",
26+
"src/fifo_byte.c",
27+
"src/geoid_model.c",
28+
"src/geoid_model_15_minute.inc",
29+
"src/geoid_model_1_degree.inc",
30+
"src/glo_map.c",
31+
"src/glonass_phase_biases.c",
32+
"src/gnss_time.c",
33+
"src/ionosphere.c",
34+
"src/linear_algebra.c",
35+
"src/logging.c",
36+
"src/logging_common.c",
37+
"src/memcpy_s.c",
38+
"src/nav_meas.c",
39+
"src/set.c",
40+
"src/shm.c",
41+
"src/sid_set.c",
42+
"src/signal.c",
43+
"src/single_epoch_solver.c",
44+
"src/subsystem_status_report.c",
45+
"src/troposphere.c",
46+
":max_channels",
47+
],
48+
hdrs = [
49+
"include/swiftnav/almanac.h",
50+
"include/swiftnav/array_tools.h",
51+
"include/swiftnav/bits.h",
52+
"include/swiftnav/bitstream.h",
53+
"include/swiftnav/bytestream.h",
54+
"include/swiftnav/ch_meas.h",
55+
"include/swiftnav/common.h",
56+
"include/swiftnav/constants.h",
57+
"include/swiftnav/coord_system.h",
58+
"include/swiftnav/correct_iono_tropo.h",
59+
"include/swiftnav/decode_glo.h",
60+
"include/swiftnav/edc.h",
61+
"include/swiftnav/ephemeris.h",
62+
"include/swiftnav/fifo_byte.h",
63+
"include/swiftnav/float_equality.h",
64+
"include/swiftnav/geoid_model.h",
65+
"include/swiftnav/glo_map.h",
66+
"include/swiftnav/glonass_phase_biases.h",
67+
"include/swiftnav/gnss_capabilities.h",
68+
"include/swiftnav/gnss_time.h",
69+
"include/swiftnav/ionosphere.h",
70+
"include/swiftnav/leap_seconds.h",
71+
"include/swiftnav/linear_algebra.h",
72+
"include/swiftnav/logging.h",
73+
"include/swiftnav/macro_overload.h",
74+
"include/swiftnav/macros.h",
75+
"include/swiftnav/memcpy_s.h",
76+
"include/swiftnav/nav_meas.h",
77+
"include/swiftnav/pvt_result.h",
78+
"include/swiftnav/sbas_raw_data.h",
79+
"include/swiftnav/set.h",
80+
"include/swiftnav/shm.h",
81+
"include/swiftnav/sid_set.h",
82+
"include/swiftnav/signal.h",
83+
"include/swiftnav/single_epoch_solver.h",
84+
"include/swiftnav/subsystem_status_report.h",
85+
"include/swiftnav/swift_strnlen.h",
86+
"include/swiftnav/troposphere.h",
87+
],
88+
includes = ["include"],
89+
textual_hdrs = [
90+
"src/signal.c",
91+
"src/geoid_model.c",
92+
],
93+
)
94+
95+
cc_library(
96+
name = "check-utils",
97+
srcs = ["tests/common/check_utils.c"],
98+
hdrs = ["tests/common/check_utils.h"],
99+
deps = ["//:swiftnav"],
100+
)
101+
102+
cc_test(
103+
name = "swiftnav-test",
104+
srcs = [
105+
"tests/check_almanac.c",
106+
"tests/check_bits.c",
107+
"tests/check_coord_system.c",
108+
"tests/check_decode_glo.c",
109+
"tests/check_edc.c",
110+
"tests/check_ephemeris.c",
111+
"tests/check_geoid_model.cc",
112+
"tests/check_glo_map.c",
113+
"tests/check_gnss_time.c",
114+
"tests/check_gnss_time_cpp.cc",
115+
"tests/check_ionosphere.c",
116+
"tests/check_linear_algebra.c",
117+
"tests/check_log.c",
118+
"tests/check_main.c",
119+
"tests/check_nav_meas.c",
120+
"tests/check_pvt.c",
121+
"tests/check_set.c",
122+
"tests/check_shm.c",
123+
"tests/check_sid_set.c",
124+
"tests/check_signal.c",
125+
"tests/check_subsystem_status_report.c",
126+
"tests/check_suites.h",
127+
"tests/check_troposphere.c",
128+
],
129+
deps = [
130+
"//:check-utils",
131+
"//:swiftnav",
132+
"@my-check//:check",
133+
],
134+
)

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ include(TestTargets)
1313
include(LanguageStandards)
1414
include(CompileOptions)
1515

16+
find_package(Python3 COMPONENTS Interpreter)
17+
1618
set(disable_tests FALSE)
1719
if(WIN32)
1820
message(STATUS "MSVC detected, skipping unit tests")
@@ -99,13 +101,14 @@ set(SRCS
99101
src/sid_set.c
100102
src/signal.c
101103
src/single_epoch_solver.c
104+
src/subsystem_status_report.c
102105
src/troposphere.c)
103106

104107
swift_add_library(swiftnav
105108
SOURCES ${HDRS} ${SRCS}
106109
REMOVE_COMPILE_OPTIONS -Wconversion -Wstack-protector
107110
)
108-
add_library(swiftnav::swiftnav ALIAS swiftnav)
111+
109112
target_include_directories(swiftnav PUBLIC ${PROJECT_SOURCE_DIR}/include)
110113
target_include_directories(swiftnav PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
111114
if(LIBSWIFTNAV_ENABLE_STDERR_LOGGING)
@@ -127,5 +130,9 @@ if(libswiftnav_BUILD_TESTS OR libswiftnav_BUILD_TEST_LIBS)
127130
add_subdirectory(tests)
128131
endif()
129132

133+
add_custom_target(do-update-leap_seconds
134+
COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/scripts/leap_seconds_generator.py ${PROJECT_SOURCE_DIR}/include/swiftnav/leap_seconds.h
135+
)
136+
130137
swift_validate_targets()
131138
swift_create_clang_tidy_targets(DONT_GENERATE_CLANG_TIDY_CONFIG)

Dockerfile.modern

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Base image is created by https://github.com/swift-nav/docker-recipes
2+
FROM 571934480752.dkr.ecr.us-west-2.amazonaws.com/swift-build-modern:2022-07-29
3+
4+
WORKDIR /mnt/workspace

Jenkinsfile

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ context.setRepo("libswiftnav")
1414
def builder = context.getBuilder()
1515

1616
/**
17-
* - Mount the ccache to speed up builds
1817
* - Mount the refrepo to keep git operations functional on a repo that uses ref-repo during clone
1918
**/
20-
String dockerMountArgs = "-v /mnt/efs/ccache:/home/jenkins/.ccache -v /mnt/efs/refrepo:/mnt/efs/refrepo"
19+
String dockerMountArgs = "-v /mnt/efs/refrepo:/mnt/efs/refrepo"
2120

2221
pipeline {
2322
// Override agent in each stage to make sure we don't share containers among stages.
@@ -30,21 +29,6 @@ pipeline {
3029
buildDiscarder(logRotator(daysToKeepStr: '7'))
3130
}
3231

33-
// Overwrite in stages that need clang
34-
environment {
35-
// Default compiler. Override in each stage as needed.
36-
CC='gcc-6'
37-
CXX='g++-6'
38-
COMPILER='gcc-6'
39-
40-
// Default parallelism for make
41-
MAKEJ='4'
42-
43-
// Since ~/.ccache is mounted from a shared NFS disk, make sure the temp
44-
// dir is local to the container.
45-
CCACHE_TEMPDIR='/tmp/ccache_tmp'
46-
}
47-
4832
stages {
4933
stage('Build') {
5034
parallel {
@@ -67,39 +51,51 @@ pipeline {
6751
includes: 'build/tests/test_results_junit.xml')
6852
}
6953
}
70-
stage('Lint') {
54+
stage('Bazel Build') {
55+
agent {
56+
docker {
57+
image '571934480752.dkr.ecr.us-west-2.amazonaws.com/swift-build-bazel:2022-09-09'
58+
}
59+
}
60+
steps {
61+
gitPrep()
62+
script {
63+
try {
64+
sh('''#!/bin/bash -ex
65+
| CC=gcc-8 CXX=g++-8 bazel build --subcommands //...
66+
| bazel run //:refresh_compile_commands
67+
| bazel run //:swiftnav-test
68+
|'''.stripMargin())
69+
} catch(e) {
70+
// Notify bazel-alerts when master fails
71+
if (context.isBranchPush(branches: ["master"])) {
72+
slackSend(
73+
channel: "#bazel-alerts",
74+
color: 'danger',
75+
message: 'FAILURE'
76+
+ " on master "
77+
+ ": <${env.RUN_DISPLAY_URL}|${env.JOB_NAME} #${env.BUILD_NUMBER}>"
78+
+ " - "
79+
+ currentBuild.durationString.replace(' and counting', ''))
80+
}
81+
}
82+
}
83+
}
84+
}
85+
stage('Format & Lint') {
7186
agent {
7287
dockerfile {
88+
filename "Dockerfile.modern"
7389
args dockerMountArgs
7490
}
7591
}
7692
steps {
7793
gitPrep()
7894
script {
7995
builder.cmake()
80-
builder.make(workDir: "build")
81-
builder.make(workDir: "build", target: "clang-format-all")
96+
builder.make(workDir: "build", target: "clang-format-all-check")
97+
builder.make(workDir: "build", target: "clang-tidy-all-check")
8298
}
83-
/** Run clang-format.
84-
* If the resulting 'git diff' is non-empty, then it found something,
85-
* so error out and display the diff.
86-
*/
87-
sh '''#!/bin/bash -ex
88-
git --no-pager diff --name-only HEAD > /tmp/clang-format-diff
89-
if [ -s "/tmp/clang-format-diff" ]; then
90-
echo "clang-format warning found"
91-
git --no-pager diff
92-
exit 1
93-
fi
94-
'''
95-
96-
sh '''#!/bin/bash -ex
97-
(cd build && make clang-tidy-all)
98-
if [ -e "fixes.yaml" ]; then
99-
echo "clang-tidy warning found"
100-
exit 1
101-
fi
102-
'''
10399
}
104100
post {
105101
always {

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
[![CI](https://github.com/swift-nav/libswiftnav/actions/workflows/ci.yaml/badge.svg)](https://github.com/swift-nav/libswiftnav/actions/workflows/ci.yaml)
22
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=swift-nav_libswiftnav&metric=alert_status)](https://sonarcloud.io/dashboard?id=swift-nav_libswiftnav)
33

4+
45
libswiftnav
56
===========
67

78
Libswiftnav (LSN) is a platform independent library that implements GNSS utility functions for use by software-defined GNSS receivers or software requiring GNSS functionality. It is intended to be as portable as possible and is written in standards compliant C with no dependancies
89

9-
LSN does not provide any functionality for communicating with Swift
10-
Navigation receivers. See [libsbp](https://github.com/swift-nav/libsbp) to
11-
communicate with receivers using Swift Binary Protocol (SBP).
10+
LSN does not provide any functionality for communicating with Swift Navigation receivers. See [libsbp](https://github.com/swift-nav/libsbp) to communicate with receivers using Swift Binary Protocol (SBP).
1211

1312
To checkout the library run the following commands in an appropriate directory
1413
```
@@ -64,4 +63,3 @@ Now you can build and run the libswiftnav image with
6463
#### Run clang-format
6564

6665
make docker-lint
67-

0 commit comments

Comments
 (0)