Skip to content

Commit 4ff63a7

Browse files
authored
Use TaskChampion 0.7.0, now via cxx instead of hand-rolled FFI (#3588)
TC 0.7.0 introduces a new `TaskData` type that maps to Taskwarrior's `Task` type more cleanly. It also introduces the idea of gathering lists of operations and "committing" them to a replica. A consequence of this change is that TaskChampion no longer automatically maintains dependency information, so Taskwarrior must do so, with its `TDB2::dependency_sync` method. This method does a very similar thing to what TaskChampion had been doing, so this is a shift of responsibility but not a major performance difference. Cxx is .. not great. It is missing a lot of useful things that make a general-purpose bridge impractical: - no support for trait objects - no support for `Option<T>` (dtolnay/cxx#87) - no support for `Vec<Box<..>>` As a result, some creativity is required in writing the bridge, for example returning a `Vec<OptionTaskData>` from `all_task_data` to allow individual `TaskData` values to be "taken" from the vector. That said, Cxx is the current state-of-the-art, and does a good job of ensuring memory safety, at the cost of some slightly awkward APIs. Subsequent work can remove the "TDB2" layer and allow commands and other parts of Taskwarrior to interface directly with the `Replica`.
1 parent 0f96fd3 commit 4ff63a7

Some content is hidden

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

59 files changed

+1527
-7627
lines changed

Diff for: .cargo/config.toml

-1
This file was deleted.

Diff for: .github/workflows/checks.yml

-36
Original file line numberDiff line numberDiff line change
@@ -61,39 +61,3 @@ jobs:
6161
with:
6262
command: fmt
6363
args: --all -- --check
64-
65-
codegen:
66-
runs-on: ubuntu-latest
67-
name: "codegen"
68-
steps:
69-
- uses: actions/checkout@v4
70-
71-
- name: Cache cargo registry
72-
uses: actions/cache@v4
73-
with:
74-
path: ~/.cargo/registry
75-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
76-
77-
- name: Cache cargo build
78-
uses: actions/cache@v4
79-
with:
80-
path: target
81-
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
82-
83-
- uses: actions-rs/toolchain@v1
84-
with:
85-
toolchain: "1.73.0" # MSRV
86-
override: true
87-
88-
- uses: actions-rs/[email protected]
89-
with:
90-
command: xtask
91-
args: codegen
92-
93-
- name: check for changes
94-
run: |
95-
if ! git diff; then
96-
echo "Generated code not up-to-date;
97-
run `cargo run --package xtask -- codegen` and commit the result";
98-
exit 1;
99-
fi

Diff for: .gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "src/libshared"]
22
path = src/libshared
33
url = https://github.com/GothenburgBitFactory/libshared.git
4-
[submodule "src/tc/corrosion"]
5-
path = src/tc/corrosion
4+
[submodule "src/taskchampion-cpp/corrosion"]
5+
path = src/taskchampion-cpp/corrosion
66
url = https://github.com/corrosion-rs/corrosion.git

Diff for: CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ if (ENABLE_WASM)
2626
endif (ENABLE_WASM)
2727

2828
message ("-- Looking for git submodules")
29-
if (EXISTS ${CMAKE_SOURCE_DIR}/src/libshared/src AND EXISTS ${CMAKE_SOURCE_DIR}/src/tc/corrosion)
29+
if (EXISTS ${CMAKE_SOURCE_DIR}/src/libshared/src AND EXISTS ${CMAKE_SOURCE_DIR}/src/taskchampion-cpp/corrosion)
3030
message ("-- Found git submodules")
3131
else (EXISTS ${CMAKE_SOURCE_DIR}/src/libshared/src)
3232
message ("-- Cloning git submodules")
3333
execute_process (COMMAND git submodule update --init
3434
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
35-
endif (EXISTS ${CMAKE_SOURCE_DIR}/src/libshared/src AND EXISTS ${CMAKE_SOURCE_DIR}/src/tc/corrosion)
35+
endif (EXISTS ${CMAKE_SOURCE_DIR}/src/libshared/src AND EXISTS ${CMAKE_SOURCE_DIR}/src/taskchampion-cpp/corrosion)
3636

3737
message ("-- Looking for SHA1 references")
3838
if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
@@ -142,7 +142,7 @@ configure_file (
142142

143143
add_subdirectory (src)
144144
add_subdirectory (src/commands)
145-
add_subdirectory (src/tc)
145+
add_subdirectory (src/taskchampion-cpp)
146146
add_subdirectory (src/columns)
147147
add_subdirectory (doc)
148148
add_subdirectory (scripts)

0 commit comments

Comments
 (0)