Skip to content

Commit

Permalink
Merge remote-tracking branch 'wpilibsuite/main' into mvp_cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed Nov 18, 2024
2 parents bf81de4 + 57e1075 commit d8af9b3
Show file tree
Hide file tree
Showing 280 changed files with 10,917 additions and 2,892 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
labels: 'type: bug'
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
labels: 'type: feature'
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Question
about: Ask about features or parts of this project
title: ''
labels: ''
labels: 'type: support'
assignees: ''

---
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/cmake-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CMake Android

on: [pull_request, push]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
SCCACHE_WEBDAV_ENDPOINT: "https://frcmaven.wpi.edu/artifactory/wpilib-generic-cache-cmake-local"
SCCACHE_WEBDAV_KEY_PREFIX: "sccache"

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
name: Android Arm64
abi: arm64-v8a
- os: ubuntu-22.04
name: Android X64
abi: "x86_64"

name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r27c
add-to-path: false

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Install sccache
uses: mozilla-actions/[email protected]

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y ninja-build

- name: configure
run: cmake --preset with-sccache -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_WPILIB=OFF -DWITH_GUI=OFF -DWITH_CSCORE=OFF -DWITH_TESTS=OFF -DWITH_SIMULATION_MODULES=OFF -DWITH_PROTOBUF=OFF -DWITH_JAVA=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake -DANDROID_ABI="${{ matrix.abi }}" -DANDROID_PLATFORM=android-24

- name: build
run: cmake --build build-cmake --parallel $(nproc)
20 changes: 20 additions & 0 deletions .github/workflows/upstream-utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,101 +35,121 @@ jobs:
cd upstream_utils
./apriltag.py clone
./apriltag.py copy-src
./apriltag.py format-patch
- name: Run argparse_lib.py
run: |
cd upstream_utils
./argparse_lib.py clone
./argparse_lib.py copy-src
./argparse_lib.py format-patch
- name: Run eigen.py
run: |
cd upstream_utils
./eigen.py clone
./eigen.py copy-src
./eigen.py format-patch
- name: Run expected.py
run: |
cd upstream_utils
./expected.py clone
./expected.py copy-src
./expected.py format-patch
- name: Run fmt.py
run: |
cd upstream_utils
./fmt.py clone
./fmt.py copy-src
./fmt.py format-patch
- name: Run gcem.py
run: |
cd upstream_utils
./gcem.py clone
./gcem.py copy-src
./gcem.py format-patch
- name: Run gl3w.py
run: |
cd upstream_utils
./gl3w.py clone
./gl3w.py copy-src
./gl3w.py format-patch
- name: Run glfw.py
run: |
cd upstream_utils
./glfw.py clone
./glfw.py copy-src
./glfw.py format-patch
- name: Run googletest.py
run: |
cd upstream_utils
./googletest.py clone
./googletest.py copy-src
./googletest.py format-patch
- name: Run imgui.py
run: |
cd upstream_utils
./imgui.py clone
./imgui.py copy-src
./imgui.py format-patch
- name: Run implot.py
run: |
cd upstream_utils
./implot.py clone
./implot.py copy-src
./implot.py format-patch
- name: Run json.py
run: |
cd upstream_utils
./json.py clone
./json.py copy-src
./json.py format-patch
- name: Run libuv.py
run: |
cd upstream_utils
./libuv.py clone
./libuv.py copy-src
./libuv.py format-patch
- name: Run llvm.py
run: |
cd upstream_utils
./llvm.py clone
./llvm.py copy-src
./llvm.py format-patch
- name: Run mpack.py
run: |
cd upstream_utils
./mpack.py clone
./mpack.py copy-src
./mpack.py format-patch
- name: Run stack_walker.py
run: |
cd upstream_utils
./stack_walker.py clone
./stack_walker.py copy-src
./stack_walker.py format-patch
- name: Run memory.py
run: |
cd upstream_utils
./memory.py clone
./memory.py copy-src
./memory.py format-patch
- name: Run protobuf.py
run: |
cd upstream_utils
./protobuf.py clone
./protobuf.py copy-src
./protobuf.py format-patch
- name: Run sleipnir.py
run: |
cd upstream_utils
./sleipnir.py clone
./sleipnir.py copy-src
./sleipnir.py format-patch
- name: Run stb.py
run: |
cd upstream_utils
./stb.py clone
./stb.py copy-src
./stb.py format-patch
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
Expand Down
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ set(java_lib_dest java)
if(WITH_JAVA OR WITH_JAVA_SOURCE)
set(CMAKE_JAVA_COMPILE_FLAGS "-encoding" "UTF8" "-Xlint:unchecked")
find_package(Java REQUIRED COMPONENTS Development)
find_package(JNI REQUIRED COMPONENTS JVM)
else()
# Protoc requires the java runtime
find_package(Java REQUIRED COMPONENTS Runtime)
if(NOT ANDROID)
find_package(JNI REQUIRED COMPONENTS JVM)
endif()
endif()

if(WITH_DOCS)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ ext.getCurrentArch = {
}

wrapper {
gradleVersion = '8.10.2'
gradleVersion = '8.11'
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DefaultCameraServerShared : public frc::CameraServerShared {
void ReportDriverStationErrorV(fmt::string_view format,
fmt::format_args args) override {}
std::pair<std::thread::id, bool> GetRobotMainThreadId() const override {
return std::make_pair(std::thread::id(), false);
return std::pair{std::thread::id(), false};
}
};
} // namespace
Expand Down
5 changes: 0 additions & 5 deletions cmake/modules/CompileWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,4 @@ macro(wpilib_target_warnings target)
)
target_compile_options(${target} PRIVATE -gz=zlib)
endif()

# Disable std::mutex constexpr constructor on MSVC
if(MSVC)
target_compile_options(${target} PRIVATE /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
endif()
endmacro()
10 changes: 5 additions & 5 deletions cscore/src/main/native/cpp/Telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Telemetry::Thread : public wpi::SafeThread {

int64_t Telemetry::Thread::GetValue(CS_Handle handle, CS_TelemetryKind kind,
CS_Status* status) {
auto it = m_user.find(std::make_pair(handle, static_cast<int>(kind)));
auto it = m_user.find(std::pair{handle, static_cast<int>(kind)});
if (it == m_user.end()) {
*status = CS_EMPTY_VALUE;
return 0;
Expand Down Expand Up @@ -136,8 +136,8 @@ void Telemetry::RecordSourceBytes(const SourceImpl& source, int quantity) {
return;
}
auto handleData = Instance::GetInstance().FindSource(source);
thr->m_current[std::make_pair(Handle{handleData.first, Handle::kSource},
static_cast<int>(CS_SOURCE_BYTES_RECEIVED))] +=
thr->m_current[std::pair{Handle{handleData.first, Handle::kSource},
static_cast<int>(CS_SOURCE_BYTES_RECEIVED)}] +=
quantity;
}

Expand All @@ -147,7 +147,7 @@ void Telemetry::RecordSourceFrames(const SourceImpl& source, int quantity) {
return;
}
auto handleData = Instance::GetInstance().FindSource(source);
thr->m_current[std::make_pair(Handle{handleData.first, Handle::kSource},
static_cast<int>(CS_SOURCE_FRAMES_RECEIVED))] +=
thr->m_current[std::pair{Handle{handleData.first, Handle::kSource},
static_cast<int>(CS_SOURCE_FRAMES_RECEIVED)}] +=
quantity;
}
4 changes: 2 additions & 2 deletions cscore/src/main/native/cpp/UnlimitedHandleResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ UnlimitedHandleResource<THandle, TStruct, typeValue, TMutex>::FindIf(F func) {
for (size_t i = 0; i < m_structures.size(); i++) {
auto& structure = m_structures[i];
if (structure != nullptr && func(*structure)) {
return std::make_pair(MakeHandle(i), structure);
return std::pair{MakeHandle(i), structure};
}
}
return std::make_pair(0, nullptr);
return std::pair{0, nullptr};
}

} // namespace cs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static boolean shouldLog(Logged.Importance importance) {
out.println(" config.loggingPeriod = Seconds.of(robot.getPeriod());");
out.println(" }");
out.println(" if (config.loggingPeriodOffset == null) {");
out.println(" config.loggingPeriodOffset = config.loggingPeriod.divide(2);");
out.println(" config.loggingPeriodOffset = config.loggingPeriod.div(2);");
out.println(" }");
out.println();
out.println(" robot.addPeriodic(() -> {");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static void bind(edu.wpi.first.epilogue.Example robot) {
config.loggingPeriod = Seconds.of(robot.getPeriod());
}
if (config.loggingPeriodOffset == null) {
config.loggingPeriodOffset = config.loggingPeriod.divide(2);
config.loggingPeriodOffset = config.loggingPeriod.div(2);
}
robot.addPeriodic(() -> {
Expand Down Expand Up @@ -252,7 +252,7 @@ public static void bind(edu.wpi.first.epilogue.AlphaBot robot) {
config.loggingPeriod = Seconds.of(robot.getPeriod());
}
if (config.loggingPeriodOffset == null) {
config.loggingPeriodOffset = config.loggingPeriod.divide(2);
config.loggingPeriodOffset = config.loggingPeriod.div(2);
}
robot.addPeriodic(() -> {
Expand Down Expand Up @@ -284,7 +284,7 @@ public static void bind(edu.wpi.first.epilogue.BetaBot robot) {
config.loggingPeriod = Seconds.of(robot.getPeriod());
}
if (config.loggingPeriodOffset == null) {
config.loggingPeriodOffset = config.loggingPeriod.divide(2);
config.loggingPeriodOffset = config.loggingPeriod.div(2);
}
robot.addPeriodic(() -> {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
16 changes: 16 additions & 0 deletions hal/generate_usage_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ def generate_usage_reporting(output_directory: Path, template_directory: Path):
)
usage_reporting_hdr.write_text(contents, encoding="utf-8", newline="\n")

with (template_directory / "UsageReporting.h.in").open(
encoding="utf-8"
) as cpp_usage_reporting:
contents = (
# fmt: off
cpp_usage_reporting.read()
.replace(r"${usage_reporting_types_cpp}", "\n".join(usage_reporting_types_cpp))
.replace(r"${usage_reporting_instances_cpp}", "\n".join(usage_reporting_instances_cpp))
# fmt: on
)

usage_reporting_hdr = (
output_directory / "main/native/include/hal/UsageReporting.h"
)
usage_reporting_hdr.write_text(contents, encoding="utf-8", newline="\n")


def main():
dirname = Path(__file__).parent
Expand Down
9 changes: 9 additions & 0 deletions hal/src/generate/Instances.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ kKinematics_SwerveDrive = 3
kOdometry_DifferentialDrive = 1
kOdometry_MecanumDrive = 2
kOdometry_SwerveDrive = 3
kDashboard_Unknown = 1
kDashboard_Glass = 2
kDashboard_SmartDashboard = 3
kDashboard_Shuffleboard = 4
kDashboard_Elastic = 5
kDashboard_LabVIEW = 6
kDashboard_AdvantageScope = 7
kDashboard_QFRCDashboard = 8
kDashboard_FRCWebComponents = 9
Loading

0 comments on commit d8af9b3

Please sign in to comment.