Skip to content

Commit f329a40

Browse files
Jason MobarakjbangeloIvan SmolyakovAlttiJokinenmarcoamm
authored
Open source publish (#34)
Open source publish of df25faf9f28eb74ace9f9765c451087320b2d8ba..cae2886bb7ef4baa3c44864b5b637ea3d227a25f Jira: https://swift-nav.atlassian.net/browse/DIP-307 - Install the leap seconds header - updated leap second - bazel: add swift_cc* wrappers - bazel: fix code-coverage - Remove bazel submodule - Fetches swift's bazel rules via http_archive instead of using a submodule - Add cn0 mask to calc-pvt - bazel: Require build passes in CI - Export decode_sisa_index(), decode_bds_ura_index() and decode_fit_interval() functions: This allows external code to reuse libswiftnav's functions for decoding URA/SISA index values. - Also includes a couple of minor improvements: - Move definition of GAL_WEEK_TO_GPS_WEEK from ephemeris.h to gnss_time.h to be consistent with BDS_WEEK_TO_GPS_WEEK - Fix test for platforms where time_t is a signed 32-bit integer - Added Makefile with bazel wrappers - Fix group delay type for B1C - bazel: fix optimized compilation - clean up iono handling and navigation_measurement_t - bazel add gen_compile_commands target - bazel: make max_channels a configurable attribute - bazel: use c only macros to build libswiftnav - Handle endianess in bytestreams - Byte swap inline function - Regenerate leap second - bazel: Add bazeliskrc file - Use float whenever possible in satellite attitude and std - Revert "Use float whenever possible in satellite attitude and std" - Use float is satellite vel and acc when possible: Changed satellite acceleration and velocity to float when possible - Handle BDS B3I in get_tgd_correction() - Revert "Use float is satellite vel and acc when possible" - Add support for GPS L1CQ in health check --- Co-authored-by: Jason Mobarak <jason@swift-nav.com> Co-authored-by: Ivan Smolyakov <ivan.smolyakov@swift-nav.com> Co-authored-by: Altti Jokinen <altti.jokinen@swift-nav.com> Co-authored-by: Marco <marco.mendonca@swift-nav.com> Co-authored-by: Ivan Smolyakov <ivan.smolyakov@swift-nav.com> Co-authored-by: Antriksh Srivastava <antriksh.srivastava@swift-nav.com> Co-authored-by: Joseph Angelo <joseph.angelo@swift-nav.com> Co-authored-by: Isaac Torres <isaac.torres@swift-nav.com> Co-authored-by: Lucas Le <97814268+lucasle-sn@users.noreply.github.com> Co-authored-by: Rodrigo Reichert <rodrigo.reichert@swift-nav.com> Co-authored-by: Matt Woodward <46688854+woodfell@users.noreply.github.com> Co-authored-by: Wiktor Więcław <110531204+wwieclaw@users.noreply.github.com> Co-authored-by: Krzysztof Naglik <krzysztofnaglik96@gmail.com> Co-authored-by: dgburr <dburr@dburr.net> --------- Co-authored-by: Joseph Angelo <joseph.angelo@swift-nav.com> Co-authored-by: Ivan Smolyakov <ivan.smolyakov@swift-nav.com> Co-authored-by: Altti Jokinen <altti.jokinen@swift-nav.com> Co-authored-by: Marco <marco.mendonca@swift-nav.com> Co-authored-by: Antriksh Srivastava <antriksh.srivastava@swift-nav.com> Co-authored-by: Isaac Torres <isaac.torres@swift-nav.com> Co-authored-by: Lucas Le <97814268+lucasle-sn@users.noreply.github.com> Co-authored-by: Rodrigo Reichert <rodrigo.reichert@swift-nav.com> Co-authored-by: Matt Woodward <46688854+woodfell@users.noreply.github.com> Co-authored-by: Wiktor Więcław <110531204+wwieclaw@users.noreply.github.com> Co-authored-by: Krzysztof Naglik <krzysztofnaglik96@gmail.com> Co-authored-by: dgburr <dburr@dburr.net>
1 parent 374a792 commit f329a40

36 files changed

+616
-407
lines changed

.bazeliskrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
USE_BAZEL_VERSION=6.2.0

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build:clang-format-check --aspects @rules_swiftnav//clang_format:clang_format_check.bzl%clang_format_check_aspect
2+
build:clang-format-check --@rules_swiftnav//clang_format:clang_format_config=//:clang_format_config
3+
build:clang-format-check --output_groups=report
4+
5+
build:clang-tidy --aspects @rules_swiftnav//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
6+
build:clang-tidy --output_groups=report

BUILD.bazel

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
1-
load("@rules_cc//cc:defs.bzl", "cc_library")
2-
load(":bazel/configure_file.bzl", "configure_file")
31
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
2+
load("@rules_swiftnav//cc:defs.bzl", "UNIT", "swift_c_library", "swift_cc_test", "swift_cc_test_library")
3+
load("@bazel_skylib//rules:common_settings.bzl", "int_flag", "bool_flag")
4+
load("//bazel:max_channels_config.bzl", "max_channels_config")
45

56
refresh_compile_commands(
6-
name = "refresh_compile_commands",
7+
name = "gen_compile_commands",
8+
visibility = ["//visibility:public"],
79
)
810

9-
configure_file(
11+
int_flag(
1012
name = "max_channels",
13+
build_setting_default = 63,
14+
)
15+
16+
bool_flag(
17+
name = "enable_stderr_logging",
18+
build_setting_default = True,
19+
visibility = ["//visibility:public"],
20+
)
21+
22+
config_setting(
23+
name = "_enable_stderr_logging",
24+
flag_values = {"enable_stderr_logging": "true"},
25+
)
26+
27+
max_channels_config(
28+
name = "max_channels_h",
1129
out = "max_channels.h",
30+
max_channels = ":max_channels",
1231
template = "src/max_channels.h.in",
13-
vars = {"MAX_CHANNELS": "63"},
1432
)
1533

16-
cc_library(
34+
swift_c_library(
1735
name = "swiftnav",
1836
srcs = [
1937
"src/almanac.c",
2038
"src/bits.c",
2139
"src/coord_system.c",
22-
"src/correct_iono_tropo.c",
2340
"src/decode_glo.c",
2441
"src/edc.c",
2542
"src/ephemeris.c",
@@ -43,7 +60,7 @@ cc_library(
4360
"src/single_epoch_solver.c",
4461
"src/subsystem_status_report.c",
4562
"src/troposphere.c",
46-
":max_channels",
63+
":max_channels_h",
4764
],
4865
hdrs = [
4966
"include/swiftnav/almanac.h",
@@ -55,7 +72,6 @@ cc_library(
5572
"include/swiftnav/common.h",
5673
"include/swiftnav/constants.h",
5774
"include/swiftnav/coord_system.h",
58-
"include/swiftnav/correct_iono_tropo.h",
5975
"include/swiftnav/decode_glo.h",
6076
"include/swiftnav/edc.h",
6177
"include/swiftnav/ephemeris.h",
@@ -85,21 +101,31 @@ cc_library(
85101
"include/swiftnav/swift_strnlen.h",
86102
"include/swiftnav/troposphere.h",
87103
],
104+
copts = ["-UNDEBUG"],
105+
local_defines = select({
106+
"_enable_stderr_logging": ["LIBSWIFTNAV_ENABLE_STDERR_LOGGING=ON"],
107+
"//conditions:default": [],
108+
}),
88109
includes = ["include"],
110+
nocopts = [
111+
"-Wconversion",
112+
"-Wstack-protector",
113+
],
89114
textual_hdrs = [
90115
"src/signal.c",
91116
"src/geoid_model.c",
92117
],
118+
visibility = ["//visibility:public"],
93119
)
94120

95-
cc_library(
121+
swift_cc_test_library(
96122
name = "check-utils",
97123
srcs = ["tests/common/check_utils.c"],
98124
hdrs = ["tests/common/check_utils.h"],
99125
deps = ["//:swiftnav"],
100126
)
101127

102-
cc_test(
128+
swift_cc_test(
103129
name = "swiftnav-test",
104130
srcs = [
105131
"tests/check_almanac.c",
@@ -126,9 +152,16 @@ cc_test(
126152
"tests/check_suites.h",
127153
"tests/check_troposphere.c",
128154
],
155+
type = UNIT,
129156
deps = [
130157
"//:check-utils",
131158
"//:swiftnav",
132-
"@my-check//:check",
159+
"@check",
133160
],
134161
)
162+
163+
filegroup(
164+
name = "clang_format_config",
165+
srcs = [".clang-format"],
166+
visibility = ["//visibility:public"],
167+
)

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ set(HDRS
4949
include/swiftnav/common.h
5050
include/swiftnav/constants.h
5151
include/swiftnav/coord_system.h
52-
include/swiftnav/correct_iono_tropo.h
5352
include/swiftnav/decode_glo.h
5453
include/swiftnav/edc.h
5554
include/swiftnav/ephemeris.h
@@ -82,7 +81,6 @@ set(SRCS
8281
src/almanac.c
8382
src/bits.c
8483
src/coord_system.c
85-
src/correct_iono_tropo.c
8684
src/decode_glo.c
8785
src/edc.c
8886
src/ephemeris.c

Jenkinsfile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,25 @@ pipeline {
5454
stage('Bazel Build') {
5555
agent {
5656
docker {
57-
image '571934480752.dkr.ecr.us-west-2.amazonaws.com/swift-build-bazel:2022-09-09'
57+
image '571934480752.dkr.ecr.us-west-2.amazonaws.com/swift-build-bazel:2023-06-21'
5858
}
5959
}
6060
steps {
6161
gitPrep()
6262
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-
}
63+
sh('''#!/bin/bash -ex
64+
| CC=gcc-8 CXX=g++-8 bazel build --subcommands //...
65+
| bazel run //:gen_compile_commands
66+
| bazel run //:swiftnav-test
67+
| bazel coverage --collect_code_coverage --combined_report=lcov //...
68+
| genhtml bazel-out/_coverage/_coverage_report.dat -o coverage
69+
| tar -zcvf coverage.tar.gz coverage/
70+
|'''.stripMargin())
71+
}
72+
}
73+
post {
74+
always {
75+
archiveArtifacts(artifacts: 'coverage.tar.gz', allowEmptyArchive: true)
8276
}
8377
}
8478
}

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,27 @@ docker-build: docker-image
1111
docker-lint: docker-image
1212
mkdir -p build
1313
docker-compose run -T libswiftnav /bin/bash -c "cd build && cmake .. && make -j4 clang-format-all"
14+
15+
do-all-unit-tests:
16+
bazel test --test_tag_filters=unit --test_output=all //...
17+
18+
do-all-integration-tests:
19+
bazel test --test_tag_filters=integration --test_output=all //...
20+
21+
clang-format-all-check:
22+
bazel build //... --config=clang-format-check
23+
24+
clang-format-all:
25+
bazel run @rules_swiftnav//clang_format
26+
27+
clang-tidy-all-check:
28+
bazel build //... --config=clang-tidy
29+
30+
do-code-coverage:
31+
bazel coverage --test_tag_filters=unit --collect_code_coverage --combined_report=lcov //...
32+
33+
do-generate-coverage-report: do-code-coverage
34+
genhtml bazel-out/_coverage/_coverage_report.dat -o coverage
35+
36+
gen-compile-commands:
37+
bazel run //:gen_compile_commands

WORKSPACE renamed to WORKSPACE.bazel

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
workspace(name = "root")
2-
3-
new_local_repository(
4-
name = "my-check",
5-
build_file = "bazel/check.BUILD",
6-
path = "third_party/check",
7-
)
1+
workspace(name = "libswiftnav")
82

93
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
104

5+
http_archive(
6+
name = "rules_swiftnav",
7+
strip_prefix = "rules_swiftnav-26426be6b89a5b9f0489158098599b9fcd973ed4",
8+
url = "https://github.com/swift-nav/rules_swiftnav/archive/26426be6b89a5b9f0489158098599b9fcd973ed4.tar.gz",
9+
)
10+
1111
http_archive(
1212
name = "rules_foreign_cc",
1313
strip_prefix = "rules_foreign_cc-c65e8cfbaa002bcd1ce9c26e9fec63b0b866c94b",
@@ -30,3 +30,9 @@ http_archive(
3030
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
3131

3232
hedron_compile_commands_setup()
33+
34+
new_local_repository(
35+
name = "check",
36+
build_file = "@rules_swiftnav//third_party:check.BUILD",
37+
path = "third_party/check",
38+
)

bazel/BUILD.bazel

Whitespace-only changes.

bazel/check.BUILD

Lines changed: 0 additions & 23 deletions
This file was deleted.

bazel/configure_file.bzl

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)