Skip to content

Port to vodozemac #783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
14f8da0
libOlm is dead, long live vodozemac
TobiasFella Aug 4, 2024
9972ab5
Migrate pickles
TobiasFella Aug 5, 2024
b79f883
Fix SQL
TobiasFella Aug 15, 2024
8c56715
Remove includes
TobiasFella Aug 24, 2024
e2b2656
remove olm error handling
TobiasFella Aug 24, 2024
65837aa
Remove olm from cmake
TobiasFella Aug 24, 2024
3ba44d8
Fix rebase
TobiasFella Aug 24, 2024
61e22fd
Fix rebase
TobiasFella Aug 27, 2024
9abbdd3
Fixes
TobiasFella Aug 27, 2024
87ee351
Fix migrating olm pickles to vodozemac pickles
TobiasFella Aug 29, 2024
284ac0b
fix
TobiasFella Aug 29, 2024
46f9c86
Try putting vodozemac onto CI
TobiasFella Aug 30, 2024
b11c7ed
Add corrosion
TobiasFella Aug 30, 2024
07dcc32
Build corrosion
TobiasFella Aug 30, 2024
556422c
Fix vodo build
TobiasFella Aug 30, 2024
dfeaa22
fixup! Try putting vodozemac onto CI
TobiasFella Aug 30, 2024
bd63308
fixup! Try putting vodozemac onto CI
TobiasFella Aug 30, 2024
47b2075
Try adding rust for macos and windows
TobiasFella Aug 30, 2024
81f5abd
Verification mostly working
TobiasFella Aug 30, 2024
93d3320
Fix some cases of verification
TobiasFella Aug 31, 2024
a8738c2
Adapt to vodozemac changes
TobiasFella Aug 31, 2024
f151989
Work
TobiasFella Sep 1, 2024
ef16df9
Fix some tests
TobiasFella Sep 1, 2024
3f270f9
Fixes
TobiasFella Sep 1, 2024
590a118
Fix
TobiasFella Sep 1, 2024
bf7fb66
Try macing macos happy
TobiasFella Sep 1, 2024
3f4a8e0
Use nightly rust for windows CI
TobiasFella Sep 1, 2024
09f487a
Try fix
TobiasFella Sep 14, 2024
66cd3a1
:I
TobiasFella Sep 14, 2024
571802e
?
TobiasFella Sep 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 42 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
pull_request:
types: [opened, reopened]

defaults:
run:
shell: bash

concurrency: quotient-ci

jobs:
Expand Down Expand Up @@ -49,7 +45,7 @@ jobs:
- name: Install dependencies (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
COMMON_PKGS="libolm-dev ninja-build gnome-keyring g++$GCC_VERSION clang$CLANG_VERSION"
COMMON_PKGS="libolm-dev ninja-build gnome-keyring rustc cargo g++$GCC_VERSION clang$CLANG_VERSION"
# See https://github.com/actions/runner-images/issues/9679
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
# Add LLVM repo for newer Clang
Expand All @@ -69,6 +65,7 @@ jobs:
${{ startsWith(matrix.os, 'windows') && 'tools_opensslv3_x64' || '' }}"

- name: Setup build environment
shell: bash
run: |
if [ '${{ matrix.override-compiler }}' == 'GCC' ]; then
echo "CC=gcc$GCC_VERSION" >>$GITHUB_ENV
Expand Down Expand Up @@ -123,6 +120,26 @@ jobs:
cmake -E make_directory ${{ runner.workspace }}/build
echo "BUILD_PATH=${{ runner.workspace }}/build/libQuotient" >>$GITHUB_ENV

- name: Install Rustup using win.rustup.rs
if: startsWith(matrix.os, 'windows')
run: |
# Disable the download progress bar which can cause perf issues
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=nightly-x86_64-pc-windows-msvc
del rustup-init.exe
rustup target add x86_64-pc-windows-msvc
rustup override add nightly
rustup --version
shell: powershell

- name: Install Rustup
if: startsWith(matrix.os, 'macos')
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
sh rustup-init.sh -y --default-toolchain none
rustup target add "x86_64-apple-darwin"

- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
if: startsWith(matrix.os, 'windows')
Expand All @@ -135,18 +152,31 @@ jobs:
uses: sonarsource/sonarcloud-github-c-cpp@v2

- name: Build and install QtKeychain
shell: bash
run: |
cd ..
git clone -b 0.14.3 https://github.com/frankosterfeld/qtkeychain.git
cmake -S qtkeychain -B qtkeychain/build -DBUILD_WITH_QT6=ON $CMAKE_ARGS
cmake --build qtkeychain/build --target install

- name: Build and install Olm
- name: Build and install Corrosion
run: |
cd ..
git clone https://gitlab.matrix.org/matrix-org/olm.git
cmake -S olm -B olm/build $CMAKE_ARGS
cmake --build olm/build --target install
git clone https://github.com/corrosion-rs/corrosion
cmake -S corrosion -B corrosion/build $CMAKE_ARGS
cmake --build corrosion/build --target install

- name: Build and install Vodozemac-cpp
shell: pwsh
run: |
cd ..
git clone https://github.com/TobiasFella/vodozemac-cpp
cd vodozemac-cpp
rustup override add nightly
rustup --version
cd ..
cmake -S vodozemac-cpp -B vodozemac-cpp/build $CMAKE_ARGS -DCI_BUILD=true -DCMAKE_PREFIX_PATH=~/.local -DCMAKE_INSTALL_PREFIX=~/.local
cmake --build vodozemac-cpp/build --target install

- name: Get CS API definitions; clone and build GTAD
if: matrix.update-api
Expand All @@ -171,6 +201,7 @@ jobs:
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Configure libQuotient
shell: bash
run: |
cmake -S $GITHUB_WORKSPACE -B $BUILD_PATH $CMAKE_ARGS -DQuotient_INSTALL_TESTS=ON

Expand All @@ -179,6 +210,7 @@ jobs:
run: cmake --build ../build/libQuotient --target update-api

- name: Build and install libQuotient
shell: bash
run: |
if [[ '${{ matrix.static-analysis }}' == 'sonar' ]]; then
BUILD_WRAPPER="${{ steps.sonar.outputs.build-wrapper-binary }} --out-dir $BUILD_PATH/sonar"
Expand Down Expand Up @@ -212,6 +244,7 @@ jobs:
uses: github/codeql-action/analyze@v3

- name: Run sonar-scanner
shell: bash
if: matrix.static-analysis == 'sonar'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
15 changes: 5 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ if (POLICY CMP0092)
cmake_policy(SET CMP0092 NEW)
endif()

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

set(API_VERSION "0.9")
project(Quotient VERSION "${API_VERSION}.0" LANGUAGES CXX)
set(PRE_STAGE "beta")
Expand Down Expand Up @@ -45,7 +47,7 @@ else()
endif()
endforeach ()
# disable exceptions by default, not used in most parts here and saves about 10% binary size
add_compile_options(-fno-exceptions)
#add_compile_options(-fno-exceptions)
endif()

add_compile_definitions(
Expand Down Expand Up @@ -95,13 +97,7 @@ find_package(${Qt} ${QtMinVersion} REQUIRED Core Network Gui Test Sql)
get_filename_component(Qt_Prefix "${${Qt}_DIR}/../../../.." ABSOLUTE)

find_package(${Qt}Keychain REQUIRED)

find_package(Olm 3.2.5 REQUIRED)
set_package_properties(Olm PROPERTIES
DESCRIPTION "Implementation of the Olm and Megolm cryptographic ratchets"
URL "https://gitlab.matrix.org/matrix-org/olm"
TYPE REQUIRED
)
find_package(VodozemacCpp REQUIRED)

find_package(OpenSSL 1.1.0 REQUIRED)
set_package_properties(OpenSSL PROPERTIES
Expand Down Expand Up @@ -363,7 +359,7 @@ target_include_directories(${QUOTIENT_LIB_NAME} PUBLIC
)

target_link_libraries(${QUOTIENT_LIB_NAME}
PUBLIC ${Qt}::Core ${Qt}::Network ${Qt}::Gui qt${${Qt}Core_VERSION_MAJOR}keychain Olm::Olm ${Qt}::Sql
PUBLIC ${Qt}::Core ${Qt}::Network ${Qt}::Gui qt${${Qt}Core_VERSION_MAJOR}keychain ${Qt}::Sql Vodozemac::vodozemac-cpp
PRIVATE OpenSSL::Crypto ${Qt}::CorePrivate)

configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${QUOTIENT_LIB_NAME}.pc @ONLY NEWLINE_STYLE UNIX)
Expand Down Expand Up @@ -432,7 +428,6 @@ message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS " Header files install prefix: ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDEDIR}")
message(STATUS "Using Qt ${${Qt}_VERSION} at ${Qt_Prefix}")
message(STATUS "Using QtKeychain ${${Qt}Keychain_VERSION} at ${${Qt}Keychain_DIR}")
message(STATUS "Using libOlm ${Olm_VERSION} at ${Olm_DIR}")
message(STATUS "Using OpenSSL libcrypto ${OPENSSL_VERSION} at ${OPENSSL_CRYPTO_LIBRARY}")
message(STATUS)
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES
Expand Down
2 changes: 1 addition & 1 deletion Quotient/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ bool Connection::isLoggedIn() const { return !accessToken().isEmpty(); }

QOlmAccount* Connection::olmAccount() const
{
return d->encryptionData ? &d->encryptionData->olmAccount : nullptr;
return d->encryptionData ? d->encryptionData->olmAccount : nullptr;
}

SyncJob* Connection::syncJob() const { return d->syncJob; }
Expand Down
Loading
Loading