Skip to content

Commit

Permalink
Open source publish (#34)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
13 people committed Sep 30, 2023
1 parent 374a792 commit f329a40
Show file tree
Hide file tree
Showing 36 changed files with 616 additions and 407 deletions.
1 change: 1 addition & 0 deletions .bazeliskrc
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
USE_BAZEL_VERSION=6.2.0
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,6 @@
build:clang-format-check --aspects @rules_swiftnav//clang_format:clang_format_check.bzl%clang_format_check_aspect
build:clang-format-check --@rules_swiftnav//clang_format:clang_format_config=//:clang_format_config
build:clang-format-check --output_groups=report

build:clang-tidy --aspects @rules_swiftnav//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
build:clang-tidy --output_groups=report
57 changes: 45 additions & 12 deletions BUILD.bazel
Original file line number Original file line Diff line number Diff line change
@@ -1,25 +1,42 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load(":bazel/configure_file.bzl", "configure_file")
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands") load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@rules_swiftnav//cc:defs.bzl", "UNIT", "swift_c_library", "swift_cc_test", "swift_cc_test_library")
load("@bazel_skylib//rules:common_settings.bzl", "int_flag", "bool_flag")
load("//bazel:max_channels_config.bzl", "max_channels_config")


refresh_compile_commands( refresh_compile_commands(
name = "refresh_compile_commands", name = "gen_compile_commands",
visibility = ["//visibility:public"],
) )


configure_file( int_flag(
name = "max_channels", name = "max_channels",
build_setting_default = 63,
)

bool_flag(
name = "enable_stderr_logging",
build_setting_default = True,
visibility = ["//visibility:public"],
)

config_setting(
name = "_enable_stderr_logging",
flag_values = {"enable_stderr_logging": "true"},
)

max_channels_config(
name = "max_channels_h",
out = "max_channels.h", out = "max_channels.h",
max_channels = ":max_channels",
template = "src/max_channels.h.in", template = "src/max_channels.h.in",
vars = {"MAX_CHANNELS": "63"},
) )


cc_library( swift_c_library(
name = "swiftnav", name = "swiftnav",
srcs = [ srcs = [
"src/almanac.c", "src/almanac.c",
"src/bits.c", "src/bits.c",
"src/coord_system.c", "src/coord_system.c",
"src/correct_iono_tropo.c",
"src/decode_glo.c", "src/decode_glo.c",
"src/edc.c", "src/edc.c",
"src/ephemeris.c", "src/ephemeris.c",
Expand All @@ -43,7 +60,7 @@ cc_library(
"src/single_epoch_solver.c", "src/single_epoch_solver.c",
"src/subsystem_status_report.c", "src/subsystem_status_report.c",
"src/troposphere.c", "src/troposphere.c",
":max_channels", ":max_channels_h",
], ],
hdrs = [ hdrs = [
"include/swiftnav/almanac.h", "include/swiftnav/almanac.h",
Expand All @@ -55,7 +72,6 @@ cc_library(
"include/swiftnav/common.h", "include/swiftnav/common.h",
"include/swiftnav/constants.h", "include/swiftnav/constants.h",
"include/swiftnav/coord_system.h", "include/swiftnav/coord_system.h",
"include/swiftnav/correct_iono_tropo.h",
"include/swiftnav/decode_glo.h", "include/swiftnav/decode_glo.h",
"include/swiftnav/edc.h", "include/swiftnav/edc.h",
"include/swiftnav/ephemeris.h", "include/swiftnav/ephemeris.h",
Expand Down Expand Up @@ -85,21 +101,31 @@ cc_library(
"include/swiftnav/swift_strnlen.h", "include/swiftnav/swift_strnlen.h",
"include/swiftnav/troposphere.h", "include/swiftnav/troposphere.h",
], ],
copts = ["-UNDEBUG"],
local_defines = select({
"_enable_stderr_logging": ["LIBSWIFTNAV_ENABLE_STDERR_LOGGING=ON"],
"//conditions:default": [],
}),
includes = ["include"], includes = ["include"],
nocopts = [
"-Wconversion",
"-Wstack-protector",
],
textual_hdrs = [ textual_hdrs = [
"src/signal.c", "src/signal.c",
"src/geoid_model.c", "src/geoid_model.c",
], ],
visibility = ["//visibility:public"],
) )


cc_library( swift_cc_test_library(
name = "check-utils", name = "check-utils",
srcs = ["tests/common/check_utils.c"], srcs = ["tests/common/check_utils.c"],
hdrs = ["tests/common/check_utils.h"], hdrs = ["tests/common/check_utils.h"],
deps = ["//:swiftnav"], deps = ["//:swiftnav"],
) )


cc_test( swift_cc_test(
name = "swiftnav-test", name = "swiftnav-test",
srcs = [ srcs = [
"tests/check_almanac.c", "tests/check_almanac.c",
Expand All @@ -126,9 +152,16 @@ cc_test(
"tests/check_suites.h", "tests/check_suites.h",
"tests/check_troposphere.c", "tests/check_troposphere.c",
], ],
type = UNIT,
deps = [ deps = [
"//:check-utils", "//:check-utils",
"//:swiftnav", "//:swiftnav",
"@my-check//:check", "@check",
], ],
) )

filegroup(
name = "clang_format_config",
srcs = [".clang-format"],
visibility = ["//visibility:public"],
)
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ set(HDRS
include/swiftnav/common.h include/swiftnav/common.h
include/swiftnav/constants.h include/swiftnav/constants.h
include/swiftnav/coord_system.h include/swiftnav/coord_system.h
include/swiftnav/correct_iono_tropo.h
include/swiftnav/decode_glo.h include/swiftnav/decode_glo.h
include/swiftnav/edc.h include/swiftnav/edc.h
include/swiftnav/ephemeris.h include/swiftnav/ephemeris.h
Expand Down Expand Up @@ -82,7 +81,6 @@ set(SRCS
src/almanac.c src/almanac.c
src/bits.c src/bits.c
src/coord_system.c src/coord_system.c
src/correct_iono_tropo.c
src/decode_glo.c src/decode_glo.c
src/edc.c src/edc.c
src/ephemeris.c src/ephemeris.c
Expand Down
34 changes: 14 additions & 20 deletions Jenkinsfile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -54,31 +54,25 @@ pipeline {
stage('Bazel Build') { stage('Bazel Build') {
agent { agent {
docker { docker {
image '571934480752.dkr.ecr.us-west-2.amazonaws.com/swift-build-bazel:2022-09-09' image '571934480752.dkr.ecr.us-west-2.amazonaws.com/swift-build-bazel:2023-06-21'
} }
} }
steps { steps {
gitPrep() gitPrep()
script { script {
try { sh('''#!/bin/bash -ex
sh('''#!/bin/bash -ex | CC=gcc-8 CXX=g++-8 bazel build --subcommands //...
| CC=gcc-8 CXX=g++-8 bazel build --subcommands //... | bazel run //:gen_compile_commands
| bazel run //:refresh_compile_commands | bazel run //:swiftnav-test
| bazel run //:swiftnav-test | bazel coverage --collect_code_coverage --combined_report=lcov //...
|'''.stripMargin()) | genhtml bazel-out/_coverage/_coverage_report.dat -o coverage
} catch(e) { | tar -zcvf coverage.tar.gz coverage/
// Notify bazel-alerts when master fails |'''.stripMargin())
if (context.isBranchPush(branches: ["master"])) { }
slackSend( }
channel: "#bazel-alerts", post {
color: 'danger', always {
message: 'FAILURE' archiveArtifacts(artifacts: 'coverage.tar.gz', allowEmptyArchive: true)
+ " on master "
+ ": <${env.RUN_DISPLAY_URL}|${env.JOB_NAME} #${env.BUILD_NUMBER}>"
+ " - "
+ currentBuild.durationString.replace(' and counting', ''))
}
}
} }
} }
} }
Expand Down
24 changes: 24 additions & 0 deletions Makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,3 +11,27 @@ docker-build: docker-image
docker-lint: docker-image docker-lint: docker-image
mkdir -p build mkdir -p build
docker-compose run -T libswiftnav /bin/bash -c "cd build && cmake .. && make -j4 clang-format-all" docker-compose run -T libswiftnav /bin/bash -c "cd build && cmake .. && make -j4 clang-format-all"

do-all-unit-tests:
bazel test --test_tag_filters=unit --test_output=all //...

do-all-integration-tests:
bazel test --test_tag_filters=integration --test_output=all //...

clang-format-all-check:
bazel build //... --config=clang-format-check

clang-format-all:
bazel run @rules_swiftnav//clang_format

clang-tidy-all-check:
bazel build //... --config=clang-tidy

do-code-coverage:
bazel coverage --test_tag_filters=unit --collect_code_coverage --combined_report=lcov //...

do-generate-coverage-report: do-code-coverage
genhtml bazel-out/_coverage/_coverage_report.dat -o coverage

gen-compile-commands:
bazel run //:gen_compile_commands
20 changes: 13 additions & 7 deletions WORKSPACE → WORKSPACE.bazel
Original file line number Original file line Diff line number Diff line change
@@ -1,13 +1,13 @@
workspace(name = "root") workspace(name = "libswiftnav")

new_local_repository(
name = "my-check",
build_file = "bazel/check.BUILD",
path = "third_party/check",
)


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


http_archive(
name = "rules_swiftnav",
strip_prefix = "rules_swiftnav-26426be6b89a5b9f0489158098599b9fcd973ed4",
url = "https://github.com/swift-nav/rules_swiftnav/archive/26426be6b89a5b9f0489158098599b9fcd973ed4.tar.gz",
)

http_archive( http_archive(
name = "rules_foreign_cc", name = "rules_foreign_cc",
strip_prefix = "rules_foreign_cc-c65e8cfbaa002bcd1ce9c26e9fec63b0b866c94b", strip_prefix = "rules_foreign_cc-c65e8cfbaa002bcd1ce9c26e9fec63b0b866c94b",
Expand All @@ -30,3 +30,9 @@ http_archive(
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")


hedron_compile_commands_setup() hedron_compile_commands_setup()

new_local_repository(
name = "check",
build_file = "@rules_swiftnav//third_party:check.BUILD",
path = "third_party/check",
)
Empty file added bazel/BUILD.bazel
Empty file.
23 changes: 0 additions & 23 deletions bazel/check.BUILD

This file was deleted.

31 changes: 0 additions & 31 deletions bazel/configure_file.bzl

This file was deleted.

20 changes: 20 additions & 0 deletions bazel/max_channels_config.bzl
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,20 @@
load("@rules_swiftnav//tools:configure_file.bzl", "configure_file_impl")
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")

def _max_channels_config_impl(ctx):
vars = {
"MAX_CHANNELS": str(ctx.attr.max_channels[BuildSettingInfo].value),
}
return configure_file_impl(ctx, vars)

max_channels_config = rule(
implementation = _max_channels_config_impl,
attrs = {
"out": attr.string(),
"template": attr.label(
allow_single_file = [".in"],
mandatory = True,
),
"max_channels": attr.label(),
},
)
Loading

0 comments on commit f329a40

Please sign in to comment.