diff --git a/.cargo/config.toml b/.cargo/config.toml index 6a50f5a93..bf1bc4182 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,7 @@ +[build] +# override any global customizations, as the gradle plugin requires a specific path +target-dir = "target" + [env] -RSLIB_FTL_ROOT = { value = "ftl/core/l10n.toml", relative = true } -BUILDINFO = { value = "rsdroid/build/generated/anki_artifacts/buildinfo.txt", relative = true } -BAZEL = "1" +STRINGS_JSON = { value = "anki/out/strings.json", relative = true } +PROTOC = { value = "anki/out/extracted/protoc/bin/protoc", relative = true } diff --git a/.github/scripts/install_rust_robolectric_targets.sh b/.github/scripts/install_rust_robolectric_targets.sh deleted file mode 100755 index 24b0a534e..000000000 --- a/.github/scripts/install_rust_robolectric_targets.sh +++ /dev/null @@ -1,4 +0,0 @@ -echo "installing Rust targets for Robolectric .jar" -rustup target add x86_64-unknown-linux-gnu -rustup target add x86_64-apple-darwin -rustup target add x86_64-pc-windows-gnu \ No newline at end of file diff --git a/.github/scripts/install_rust_targets.sh b/.github/scripts/install_rust_targets.sh deleted file mode 100755 index 082b55b4c..000000000 --- a/.github/scripts/install_rust_targets.sh +++ /dev/null @@ -1,9 +0,0 @@ -echo "installing Rust targets for Android" -rustup target add armv7-linux-androideabi # arm -rustup target add i686-linux-android # x86 -rustup target add aarch64-linux-android # arm64 -rustup target add x86_64-linux-android # x86_64 -echo "installing Rust targets for Robolectric .jar" -rustup target add x86_64-unknown-linux-gnu -rustup target add x86_64-apple-darwin -rustup target add x86_64-pc-windows-gnu \ No newline at end of file diff --git a/.github/scripts/linux_install_macos_cross_compile.sh b/.github/scripts/linux_install_macos_cross_compile.sh deleted file mode 100755 index fe829d456..000000000 --- a/.github/scripts/linux_install_macos_cross_compile.sh +++ /dev/null @@ -1,7 +0,0 @@ -# disabled: Incompatible with https://www.apple.com/legal/sla/docs/xcode.pdf -sudo ./rsdroid-testing/tools/setup_macos.sh -sudo ./rsdroid-testing/tools/osxcross.sh -echo "installed OSXCROSS" -cd osxcross/target/bin -export ANKIDROID_MACOS_CC="$PWD/x86_64-apple-darwin14-cc" -echo "ANKIDROID_MACOS_CC set to ${ANKIDROID_MACOS_CC}" diff --git a/.github/scripts/linux_install_protobuf.sh b/.github/scripts/linux_install_protobuf.sh deleted file mode 100755 index 88ec75392..000000000 --- a/.github/scripts/linux_install_protobuf.sh +++ /dev/null @@ -1,15 +0,0 @@ -python --version -git clone https://github.com/pyenv/pyenv.git ~/.pyenv -echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile -echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile -echo 'export GITHUB_PATH="$PYENV_ROOT/bin:$GITHUB_PATH"' >> ~/.bash_profile -echo 'eval "$(pyenv init -)"' >> ~/.bash_profile -source ~/.bash_profile -echo "Installing Python 3.7.9" -pyenv install 3.7.9 -pyenv shell 3.7.9 -pyenv global 3.7.9 -python --version -pip3 install setuptools -pip3 install protobuf-compiler -.github/scripts/protoc_gen_deps.py \ No newline at end of file diff --git a/.github/scripts/linux_install_x86_64-unknown-linux-gnu-gcc.sh b/.github/scripts/linux_install_x86_64-unknown-linux-gnu-gcc.sh deleted file mode 100755 index ed042d62f..000000000 --- a/.github/scripts/linux_install_x86_64-unknown-linux-gnu-gcc.sh +++ /dev/null @@ -1,2 +0,0 @@ -sudo ln -s /usr/bin/cc /usr/local/bin/x86_64-unknown-linux-gnu-gcc -x86_64-unknown-linux-gnu-gcc -v diff --git a/.github/scripts/macos_install_protobuf_compiler.sh b/.github/scripts/macos_install_protobuf_compiler.sh deleted file mode 100755 index f5d16429c..000000000 --- a/.github/scripts/macos_install_protobuf_compiler.sh +++ /dev/null @@ -1,29 +0,0 @@ -# Fix for: -# protoc: stdout: . stderr: Traceback (most recent call last): -# File "/Users/runner/work/Anki-Android-Backend/Anki-Android-Backend/./tools/protoc-gen/protoc-gen.py", line 8, in -# from google.protobuf.compiler import plugin_pb2 as plugin -# ModuleNotFoundError: No module named 'google' -# --anki_out: protoc-gen-anki: Plugin failed with status code 1. -# -# on macos-latest `pip3 install protobuf-compiler` fails with "src/python/grpcio/grpc/_cython/cygrpc.cpp:64654:42: error: no member named 'tp_print' in '_typeobject'"# -# so we use Python 3.7 to stop this (with pyenv) -# Add a timeout of ~3 minutes for this. A failure will hang. -# -# -brew install pyenv -git clone https://github.com/pyenv/pyenv.git ~/.pyenv -echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile -echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile -echo 'export GITHUB_PATH="$PYENV_ROOT/bin:$GITHUB_PATH"' >> ~/.bash_profile -echo 'eval "$(pyenv init -)"' >> ~/.bash_profile -source ~/.bash_profile -pyenv install 3.7.9 -pyenv shell 3.7.9 -pyenv global 3.7.9 -python3 -v -sudo apt-get install python3-dev -pip3 install protobuf -pip3 install protobuf-compiler -.github/scripts/protoc_gen_deps.py -echo "Completed testing" - diff --git a/.github/scripts/macos_install_pyenv.sh b/.github/scripts/macos_install_pyenv.sh deleted file mode 100755 index c48132940..000000000 --- a/.github/scripts/macos_install_pyenv.sh +++ /dev/null @@ -1,7 +0,0 @@ -brew install pyenv -git clone https://github.com/pyenv/pyenv.git ~/.pyenv -echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile -echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile -echo 'export GITHUB_PATH="$PYENV_ROOT/bin:$GITHUB_PATH"' >> ~/.bash_profile -echo 'eval "$(pyenv init -)"' >> ~/.bash_profile -exec "$SHELL" diff --git a/.github/scripts/protoc_gen_deps.py b/.github/scripts/protoc_gen_deps.py deleted file mode 100755 index 84c868c9d..000000000 --- a/.github/scripts/protoc_gen_deps.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python3 - -from google.protobuf.compiler import plugin_pb2 as plugin - -print("Testing completed successfully") \ No newline at end of file diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml new file mode 100644 index 000000000..c8af27be9 --- /dev/null +++ b/.github/workflows/build-all.yml @@ -0,0 +1,140 @@ +name: Build AAR and Robo (all platforms) +on: + workflow_dispatch: + inputs: + mavenPublish: + description: "Publish artifacts to Maven Central? non-empty to publish, empty to skip publish" + required: false + type: string + push: + schedule: + - cron: "0 0 * * *" + pull_request: + +env: + ALL_ARCHS: 1 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-release + cancel-in-progress: true + +jobs: + build: + runs-on: macos-latest + timeout-minutes: 120 + steps: + - uses: actions/checkout@v2 + + - name: Fetch submodules + run: git submodule update --init + + - name: Setup Ninja + uses: ashutoshvarma/setup-ninja@master + with: + version: 1.10.0 + + # The action puts a relative path on the PATH 🙄 + - name: Make path absolute + run: echo $(pwd)/ninja_bin >> $GITHUB_PATH + + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + + - name: Install Android Command Line Tools + uses: android-actions/setup-android@v2 + + - name: Install Windows cross compiler + run: brew install mingw-w64 && x86_64-w64-mingw32-gcc -v + + - name: Install Linux cross compiler + run: | + brew tap SergioBenitez/osxct + brew install x86_64-unknown-linux-gnu + x86_64-unknown-linux-gnu-gcc -v + + - name: Install NDK + run: .github/scripts/install_ndk.sh 22.0.7026061 + + - name: Rust Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-rust-release-v5-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-rust-release-v5 + ${{ runner.os }}-rust-release + + - name: Anki cache + uses: actions/cache@v3 + with: + path: | + anki/out/node_modules + anki/out/rust + anki/out/extracted + key: ${{ runner.os }}-anki-v5-${{ hashFiles('Cargo.lock', 'anki/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-anki-v5 + ${{ runner.os }}-anki + + - name: Build Android/All + run: ./build-aar.sh + + - name: Build Robolectric/All + run: ./build-robo.sh + + - name: Check Compiled Libraries + run: > + cd rsdroid-testing/assets && + ../../.github/scripts/check_robolectric_assets.sh + + - name: Upload rsdroid AAR as artifact + uses: actions/upload-artifact@v2 + with: + name: rsdroid-aar + if-no-files-found: error + path: rsdroid/build/outputs/aar + + - name: Upload rsdroid-robo JAR as artifact + uses: actions/upload-artifact@v2 + with: + name: rsdroid-robo + if-no-files-found: error + path: rsdroid-testing/build/libs + + # following steps only run on workflow dispatch + + - name: Publish AAR to Maven + if: "${{ github.event.inputs.mavenPublish != '' && github.event_name == 'workflow_dispatch'}}" + env: + ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SONATYPE_NEXUS_USERNAME: david-allison-1 + SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + run: | + ./gradlew rsdroid:uploadArchives -DtestBuildType=release -Dorg.gradle.daemon=false -Dorg.gradle.console=plain + + - name: Publish JAR to Maven + if: "${{ github.event.inputs.mavenPublish != '' && github.event_name == 'workflow_dispatch'}}" + env: + ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SONATYPE_NEXUS_USERNAME: david-allison-1 + SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + run: | + export ANKIDROID_LINUX_CC=x86_64-unknown-linux-gnu-gcc + export ANKIDROID_MACOS_CC=cc + export RUST_DEBUG=1 + export RUST_BACKTRACE=1 + export RUST_LOG=trace + export NO_CROSS=true + ./gradlew rsdroid-testing:uploadArchives -Dorg.gradle.project.macCC=$ANKIDROID_MACOS_CC -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain + + - name: ℹ️Additional Release Instructions (requires human interaction) + if: "${{ github.event.inputs.mavenPublish != '' && github.event_name == 'workflow_dispatch'}}" + run: echo "Sign in to https://oss.sonatype.org/#stagingRepositories , close the repository, then release it" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..d25aa6de5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,126 @@ +name: Build AAR and Robo (single platform) +on: + workflow_dispatch: + push: + schedule: + - cron: "0 0 * * *" + pull_request: + +env: + DEBUG: 1 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + fail-fast: false + runs-on: ${{ matrix.os }} + timeout-minutes: 80 + steps: + - uses: actions/checkout@v2 + + - name: Fetch submodules + run: git submodule update --init + + - name: Setup Ninja + uses: ashutoshvarma/setup-ninja@master + with: + version: 1.10.0 + + # The action puts a relative path on the PATH 🙄 + - name: Make path absolute + run: echo $(pwd)/ninja_bin >> $GITHUB_PATH + + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + + - name: Install Android Command Line Tools + uses: android-actions/setup-android@v2 + + - name: Install NDK + if: matrix.os != 'windows-latest' + run: .github/scripts/install_ndk.sh 22.0.7026061 + + - name: Install NDK (Windows) + if: matrix.os == 'windows-latest' + run: | + Write-Host "NDK Install Started" + (. sdkmanager.bat --install "ndk;22.0.7026061" --sdk_root="$Env:ANDROID_SDK_ROOT") | out-null + Write-Host "NDK Install Completed" + + - name: Rust Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-rust-debug-v5-${{ hashFiles('Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-rust-debug-v5 + ${{ runner.os }}-rust-debug + + - name: Anki cache + uses: actions/cache@v3 + with: + path: | + anki/out/node_modules + anki/out/rust + anki/out/extracted + key: ${{ runner.os }}-anki-v5-${{ hashFiles('Cargo.lock', 'anki/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-anki-v5 + ${{ runner.os }}-anki + + - name: Build Android/X86_64 + if: matrix.os != 'windows-latest' + run: ./build-aar.sh + + - name: Build Android/X86_64 (Win) + if: matrix.os == 'windows-latest' + run: ./build-aar.bat + + - name: Check Rust (Linux) + if: matrix.os == 'ubuntu-latest' + run: ./check-rust.sh + + - name: Run tests (Mac) + uses: reactivecircus/android-emulator-runner@v2 + if: matrix.os == 'macos-latest' + timeout-minutes: 30 + with: + api-level: 21 + target: default + arch: x86_64 + profile: Nexus 6 + script: ./check-droid.sh + + - name: Build Robolectric/X86_64 + if: matrix.os != 'windows-latest' + run: ./build-robo.sh + + - name: Build Robolectric/X86_64 (Win) + if: matrix.os == 'windows-latest' + run: ./build-robo.bat + + - name: Upload rsdroid AAR as artifact + uses: actions/upload-artifact@v2 + with: + name: rsdroid-aar-${{ matrix.os }} + if-no-files-found: error + path: rsdroid/build/outputs/aar + + - name: Upload rsdroid-robo JAR as artifact + uses: actions/upload-artifact@v2 + with: + name: rsdroid-robo-${{ matrix.os }} + if-no-files-found: error + path: rsdroid-testing/build/libs diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml deleted file mode 100644 index 397699965..000000000 --- a/.github/workflows/linux_build.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: rsdroid (Linux) -on: - workflow_dispatch: - push: - schedule: - - cron: "0 0 * * *" - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - timeout-minutes: 80 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - # COULD_BE_BETTER: Consider turning this into a GitHub action - help the wider community - # NDK install (unzipping) is really noisy - silence the log spam with grep, while keeping errors - - name: Install NDK (silent) - run: .github/scripts/install_ndk.sh 22.0.7026061 - - - name: Install linker - run: .github/scripts/linux_install_x86_64-unknown-linux-gnu-gcc.sh - - # install cargo - - name: Install Rust - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: 1.58.1 - override: true - components: rustfmt - - # actions-rs only accepts "target" (although a "targets" param to be added in v2). We need 7 targets. - - name: Install Rust Targets - run: .github/scripts/install_rust_targets.sh - - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install Python libs - run: | - pip3 install --upgrade protobuf stringcase - - - name: Rust Cache - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - rslib-bridge/target - key: ${{ runner.os }}-rust-v1-assembleRelease-${{ hashFiles('rslib-bridge/**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-rust-v1-assembleRelease - ${{ runner.os }}-rust-v1 - - # Caching node modules and bazel, the bazel cache path on linux, mac and windows are according to following docs - # https://docs.bazel.build/versions/main/output_directories.html - - name: Node and Bazel cache - uses: actions/cache@v2 - with: - path: | - ~/.cache/bazel - rslib-bridge/anki/node_modules - key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('rslib-bridge/anki/package.json') }}-${{ hashFiles('rslib-bridge/anki/defs.bzl') }} - restore-keys: | - ${{ runner.os }}-v1-node-bazel-cache - - - name: Build - run: ./gradlew clean assembleRelease -DtestBuildType=release -Dorg.gradle.daemon=false -Dorg.gradle.console=plain # assembleAndroidTest - - # Our publish workflow (publish_library.yaml) is on Ubuntu and needs javadocs (#57) - - name: Test Javadoc - run: ./gradlew :rsdroid:androidJavadocs -DtestBuildType=release -Dorg.gradle.daemon=false -Dorg.gradle.console=plain diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml deleted file mode 100644 index 26d376782..000000000 --- a/.github/workflows/macos_build.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: rsdroid (macOS) -on: - workflow_dispatch: - push: - schedule: - - cron: "0 0 * * *" - pull_request: -# TODO: consider assembleRelease if possible - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: macos-latest - timeout-minutes: 80 - steps: - - uses: actions/checkout@v2 - - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - - name: Install NDK - run: .github/scripts/install_ndk.sh 22.0.7026061 - - - name: Test NDK - run: echo "NDK set to $ANDROID_NDK_HOME" - - - name: Install Rust - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: 1.58.1 - override: true - components: rustfmt - - # actions-rs only accepts "target" (although a "targets" param to be added in v2). We need 7 targets. - - name: Install Rust Targets - run: .github/scripts/install_rust_targets.sh - - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install & Test Protobuf Compiler - run: | - pip3 install --upgrade protobuf stringcase - python3 .github/scripts/protoc_gen_deps.py - - - name: Rust Cache - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - rslib-bridge/target - key: ${{ runner.os }}-rust-v1-assembleDebug-${{ hashFiles('rslib-bridge/**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-rust-v1-assembleDebug - ${{ runner.os }}-rust-v1 - - # Caching node modules and bazel, the bazel cache path on linux, mac and windows are according to following docs - # https://docs.bazel.build/versions/main/output_directories.html - - name: Node and Bazel cache - uses: actions/cache@v2 - with: - path: | - /private/var/tmp/_bazel_runner - rslib-bridge/anki/node_modules - key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('rslib-bridge/anki/package.json') }}-${{ hashFiles('rslib-bridge/anki/defs.bzl') }} - restore-keys: | - ${{ runner.os }}-v1-node-bazel-cache - - - name: Build - run: ./gradlew clean assembleDebug -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain - - - name: Build Instrumented Test APKs - run: ./gradlew rsdroid-instrumented:assembleDebug rsdroid-instrumented:assembleAndroidTest -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain - - - name: Upload APKs as Artifact - uses: actions/upload-artifact@v2 - with: - name: rsdroid-instrumented - if-no-files-found: error - path: rsdroid-instrumented/build/outputs/apk - - test: - needs: build - runs-on: macos-latest - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - api-level: [21] - arch: [x86, x86_64] # arm and arm64 are not supported by reactivecircus/android-emulator-runner - steps: - - uses: actions/checkout@v2 - name: Checkout - - # COULD_BE_BETTER: This may not be needed - tiny speed penalty - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Download APKs - uses: actions/download-artifact@v2 - with: - name: rsdroid-instrumented - path: rsdroid-instrumented/build/outputs/apk - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - - name: Install NDK - run: .github/scripts/install_ndk.sh 22.0.7026061 - - - name: run tests - uses: reactivecircus/android-emulator-runner@v2 - timeout-minutes: 30 - with: - api-level: ${{ matrix.api-level }} - target: default - arch: ${{ matrix.arch }} - profile: Nexus 6 - script: ./gradlew rsdroid-instrumented:connectedCheck -x rsdroid-instrumented:packageDebugAndroidTest -x rsdroid-instrumented:packageDebug diff --git a/.github/workflows/publish_library.yml b/.github/workflows/publish_library.yml deleted file mode 100644 index 18c56b531..000000000 --- a/.github/workflows/publish_library.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Publish rsdroid (Linux) -on: workflow_dispatch - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - - name: Install NDK - run: .github/scripts/install_ndk.sh 22.0.7026061 - - - name: Install linker - run: .github/scripts/linux_install_x86_64-unknown-linux-gnu-gcc.sh - - # install cargo - - name: Install Rust - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: 1.58.1 - override: true - components: rustfmt - - # actions-rs only accepts "target" (although a "targets" param to be added in v2). We need 7 targets. - - name: Install Rust Targets - run: .github/scripts/install_rust_targets.sh - - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install Python libs - run: | - pip3 install --upgrade protobuf stringcase - - # Caching node modules and bazel, the bazel cache path on linux, mac and windows are according to following docs - # https://docs.bazel.build/versions/main/output_directories.html - - name: Node and Bazel cache - uses: actions/cache@v2 - with: - path: | - ~/.cache/bazel - rslib-bridge/anki/node_modules - key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('rslib-bridge/anki/package.json') }}-${{ hashFiles('rslib-bridge/anki/defs.bzl') }} - restore-keys: | - ${{ runner.os }}-v1-node-bazel-cache - - - name: Build - run: ./gradlew clean assembleRelease -DtestBuildType=release -Dorg.gradle.daemon=false -Dorg.gradle.console=plain - - - name: Publish AAR to Maven - env: - ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} - ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SONATYPE_NEXUS_USERNAME: david-allison-1 - SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - run: | - ./gradlew rsdroid:uploadArchives -DtestBuildType=release -Dorg.gradle.daemon=false -Dorg.gradle.console=plain - - - name: ℹ️Additional Release Instructions (requires human interaction) - run: echo "Sign in to https://oss.sonatype.org/#stagingRepositories , close the repsository, then release it" diff --git a/.github/workflows/publish_testing.yml b/.github/workflows/publish_testing.yml deleted file mode 100644 index fa0c3b015..000000000 --- a/.github/workflows/publish_testing.yml +++ /dev/null @@ -1,105 +0,0 @@ -# Note: this is copied from robolectric_build.yml -name: Publish JAR for Robolectric Testing -on: workflow_dispatch - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - publish: - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - - name: Install NDK - run: .github/scripts/install_ndk.sh 22.0.7026061 - - # install cargo - - name: Install Rust - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: 1.58.1 - override: true - components: rustfmt - - - name: Install Python libs - run: | - pip3 install --upgrade protobuf stringcase - - # actions-rs only accepts "target" (although a "targets" param to be added in v2). We need 7 targets. - - name: Install Rust Targets - run: .github/scripts/install_rust_robolectric_targets.sh - - - name: Install x86_64-w64-mingw32-gcc - run: brew install mingw-w64 && x86_64-w64-mingw32-gcc -v - - - name: Install x86_64-unknown-linux-gnu - run: | - brew tap SergioBenitez/osxct - brew install x86_64-unknown-linux-gnu - x86_64-unknown-linux-gnu-gcc -v - - # Caching node modules and bazel, the bazel cache path on linux, mac and windows are according to following docs - # https://docs.bazel.build/versions/main/output_directories.html - - name: Node and Bazel cache - uses: actions/cache@v2 - with: - path: | - /private/var/tmp/_bazel_runner - rslib-bridge/anki/node_modules - key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('rslib-bridge/anki/package.json') }}-${{ hashFiles('rslib-bridge/anki/defs.bzl') }} - restore-keys: | - ${{ runner.os }}-v1-node-bazel-cache - - - name: Build JAR - run: | - export ANKIDROID_LINUX_CC=x86_64-unknown-linux-gnu-gcc - export ANKIDROID_MACOS_CC=cc - export RUST_DEBUG=1 - export RUST_BACKTRACE=1 - export RUST_LOG=trace - export NO_CROSS=true - ./gradlew clean rsdroid-testing:build -Dorg.gradle.project.macCC=$ANKIDROID_MACOS_CC -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain - - - name: Check Compiled Libraries - run: > - cd rsdroid-testing/assets && - ../../.github/scripts/check_robolectric_assets.sh - - - name: Upload rsdroid-testing JAR as artifact - uses: actions/upload-artifact@v2 - with: - name: rsdroid-testing - if-no-files-found: error - path: rsdroid-testing/build/libs - - - name: Publish JAR to Maven - env: - ORG_GRADLE_PROJECT_SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} - ORG_GRADLE_PROJECT_SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SONATYPE_NEXUS_USERNAME: david-allison-1 - SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - run: | - export ANKIDROID_LINUX_CC=x86_64-unknown-linux-gnu-gcc - export ANKIDROID_MACOS_CC=cc - export RUST_DEBUG=1 - export RUST_BACKTRACE=1 - export RUST_LOG=trace - export NO_CROSS=true - ./gradlew rsdroid-testing:uploadArchives -Dorg.gradle.project.macCC=$ANKIDROID_MACOS_CC -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain - - - name: ℹ️Additional Release Instructions (requires human interaction) - run: echo "Sign in to https://oss.sonatype.org/#stagingRepositories , close the repsository, then release it" diff --git a/.github/workflows/robolectric_build.yml b/.github/workflows/robolectric_build.yml deleted file mode 100644 index 0d05ceb5a..000000000 --- a/.github/workflows/robolectric_build.yml +++ /dev/null @@ -1,196 +0,0 @@ -name: Build JAR for Robolectric Testing -on: - workflow_dispatch: - push: - schedule: - - cron: "0 0 * * *" - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: macos-latest - timeout-minutes: 80 - steps: - # - name: Configure Mac OS environment variables - # gnu tar for cache issue: https://github.com/actions/cache/issues/403 - # error[E0463]: can't find crate for `serde_derive` which `serde` depends on - # --> /Users/runner/work/Anki-Android-Backend/Anki-Android-Backend/anki/rslib/src/decks/schema11.rs:30:9 - - # ::add-path has now been deprectated - # echo "::add-path::/usr/local/opt/gnu-tar/libexec/gnubin" - - # run: | - # echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH - - uses: actions/checkout@v2 - - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - - name: Install NDK (r22 - 22.0.7026061) - run: .github/scripts/install_ndk.sh 22.0.7026061 - - # TODO: Needs investigation. This seemed to work before adding gnubin/v1, just with serde broken. - # Now it doesn't seem to be picked up by rust. - # - name: Cache Rust dependencies - # uses: actions/cache@v1.0.1 - # with: - # path: rslib-bridge/target - # key: ${{ runner.OS }}-build-v1-${{ hashFiles('**/Cargo.lock') }} - # restore-keys: | - # ${{ runner.OS }}-build-v1- - - # install cargo - - name: Install Rust - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: 1.58.1 - override: true - components: rustfmt - - # actions-rs only accepts "target" (although a "targets" param to be added in v2). We need 7 targets. - - name: Install Rust Targets - run: .github/scripts/install_rust_robolectric_targets.sh - - - name: Install x86_64-w64-mingw32-gcc - run: brew install mingw-w64 && x86_64-w64-mingw32-gcc -v - - - name: Install x86_64-unknown-linux-gnu - run: | - brew tap SergioBenitez/osxct - brew install x86_64-unknown-linux-gnu - x86_64-unknown-linux-gnu-gcc -v - - - name: Rust Cache - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - rslib-bridge/target - key: ${{ runner.os }}-rust-v1-rsdroid-testing:build-${{ hashFiles('rslib-bridge/**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-rust-v1-rsdroid-testing:build - ${{ runner.os }}-rust-v1 - - # Caching node modules and bazel, the bazel cache path on linux, mac and windows are according to following docs - # https://docs.bazel.build/versions/main/output_directories.html - - name: Node and Bazel cache - uses: actions/cache@v2 - with: - path: | - /private/var/tmp/_bazel_runner - rslib-bridge/anki/node_modules - key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('rslib-bridge/anki/package.json') }}-${{ hashFiles('rslib-bridge/anki/defs.bzl') }} - restore-keys: | - ${{ runner.os }}-v1-node-bazel-cache - - - name: Build JAR - run: | - export ANKIDROID_LINUX_CC=x86_64-unknown-linux-gnu-gcc - export ANKIDROID_MACOS_CC=cc - export RUST_DEBUG=1 - export RUST_BACKTRACE=1 - export RUST_LOG=trace - export NO_CROSS=true - ./gradlew clean rsdroid-testing:build -Dorg.gradle.project.macCC=$ANKIDROID_MACOS_CC -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain --warning-mode all - - - name: Check Compiled Libraries - run: > - cd rsdroid-testing/assets && - ../../.github/scripts/check_robolectric_assets.sh - - - name: Upload rsdroid-testing JAR as artifact - uses: actions/upload-artifact@v2 - with: - name: rsdroid-testing - if-no-files-found: error - path: rsdroid-testing/build/libs/ - - test: - needs: build - runs-on: ${{matrix.os}} - timeout-minutes: 45 - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - fail-fast: false - steps: - - uses: actions/checkout@v2 - - - name: Fetch submodules - run: git submodule update --init --recursive - - - uses: actions/download-artifact@v2 - name: Download Artifact - with: - name: rsdroid-testing - path: rsdroid-testing/build/libs - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - - name: Install NDK (silent) - if: matrix.os != 'windows-latest' - run: .github/scripts/install_ndk.sh 22.0.7026061 - - - name: Install NDK (Windows - silent) - if: matrix.os == 'windows-latest' - run: | - Write-Host "NDK Install Started" - (. sdkmanager.bat --install "ndk;22.0.7026061" --sdk_root="$Env:ANDROID_SDK_ROOT") | out-null - Write-Host "NDK Install Completed" - - - name: Install linker - if: matrix.os == 'ubuntu-latest' - run: .github/scripts/linux_install_x86_64-unknown-linux-gnu-gcc.sh - - - name: Install Python Setuptools - if: matrix.os == 'ubuntu-latest' - run: sudo apt-get install python3-setuptools - - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install & Test Protobuf Compiler - if: matrix.os != 'windows-latest' - run: | - pip3 install --upgrade protobuf stringcase - python3 .github/scripts/protoc_gen_deps.py - - - name: Install & Test Protobuf Compiler (win) - if: matrix.os == 'windows-latest' - run: | - Set-Alias -Name "python3" -Value "python" - pip3 install --upgrade protobuf stringcase - python3 .github/scripts/protoc_gen_deps.py - - - name: Run Tests - if: matrix.os != 'windows-latest' - run: ./gradlew rsdroid:test -x jar -x cargoBuildArm -x cargoBuildX86 -x cargoBuildArm64 -x cargoBuildX86_64 - - - name: Run Tests (win) - if: matrix.os == 'windows-latest' - run: | - ./tools/web/set-bash-win.ps1 - ./gradlew rsdroid:test -x jar -x cargoBuildArm -x cargoBuildX86 -x cargoBuildArm64 -x cargoBuildX86_64 diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml deleted file mode 100644 index f98879f53..000000000 --- a/.github/workflows/windows_build.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: rsdroid (Windows) -on: - workflow_dispatch: - push: - schedule: - - cron: "0 0 * * *" - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - timeout-minutes: 80 - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - - name: Configure JDK 1.11 - uses: actions/setup-java@v3 - with: - distribution: "adopt" - java-version: "11" # minimum for Android API31 - - - name: Install Android Command Line Tools - uses: android-actions/setup-android@v2 - - # TODO: Ignore lines like we do in the Unix scripts, rather than all of them - - name: Install NDK (silent) - run: | - Write-Host "NDK Install Started" - Write-Host "ANDROID_HOME - $Env:ANDROID_HOME" - Write-Host "ANDROID_SDK_ROOT - $Env:ANDROID_SDK_ROOT" - (. sdkmanager.bat --install "ndk;22.0.7026061" --sdk_root="$Env:ANDROID_SDK_ROOT") | out-null - Write-Host "NDK Install Completed" - - # bzip2-sys does not build when the value of CC_armv7-linux-androideabi contains a space - # Setting this variable is a pain, as it contains a dash - # It's easier to just move the directory and fix the environment variables to point to the new NDK - # we change Program Files (x86) to "ProgramFiles" - # TODO: Move the setting of environment variables here (permanently) - - name: Move SDK to directory with no spaces - run: | - New-Item -ItemType directory -Path 'C:\ProgramFiles\Android' - Get-ChildItem "$Env:ANDROID_SDK_ROOT" - Move-Item -Path "$Env:ANDROID_SDK_ROOT" -Destination 'C:\ProgramFiles\Android' -ErrorAction Stop -Force - Get-ChildItem 'C:\ProgramFiles\Android\android-sdk' - - - name: Debug Env - run: | - $Env:ANDROID_HOME - - - name: Fetch submodules - run: git submodule update --init --recursive - - - name: Install Rust - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: 1.58.1 - override: true - components: rustfmt - - # actions-rs only accepts "target" (although a "targets" param to be added in v2). We need 4 targets. - - name: Install Rust Targets - run: | - rustup target add armv7-linux-androideabi - rustup target add i686-linux-android - rustup target add aarch64-linux-android - rustup target add x86_64-linux-android - - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install & Test Protobuf - run: | - Set-Alias -Name "python3" -Value "python" - pip3 install --upgrade protobuf stringcase - python3 .github/scripts/protoc_gen_deps.py - - - name: Rust Cache - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - rslib-bridge/target - key: ${{ runner.os }}-rust-v1-assembleRelease-${{ hashFiles('rslib-bridge/**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-rust-v1-assembleRelease - ${{ runner.os }}-rust-v1 - - # Caching node modules and bazel, the bazel cache path on linux, mac and windows are according to following docs - # https://docs.bazel.build/versions/main/output_directories.html - - name: Node and Bazel cache - uses: actions/cache@v2 - with: - path: | - C:/Users/runneradmin/_bazel_runneradmin - rslib-bridge/anki/node_modules - key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('rslib-bridge/anki/package.json') }}-${{ hashFiles('rslib-bridge/anki/defs.bzl') }} - restore-keys: | - ${{ runner.os }}-v1-node-bazel-cache - - # -Dorg.gradle.daemon=false has been removed - # -Dorg.gradle.console=plain has been removed - # env: - # ANDROID_HOME: "C:\\ProgramFiles\\Android\\android-sdk" - # ANDROID_NDK_HOME: "C:\\ProgramFiles\\Android\\android-sdk\\ndk-bundle" - # ANDROID_NDK_PATH: "C:\\ProgramFiles\\Android\\android-sdk\\ndk-bundle" - # ANDROID_SDK_ROOT: "C:\\ProgramFiles\\Android\\android-sdk" - - name: Build - run: | - $Env:ANDROID_HOME = "C:\ProgramFiles\Android\android-sdk" - $Env:ANDROID_NDK_HOME = "C:\ProgramFiles\Android\android-sdk\ndk-bundle" - $Env:ANDROID_NDK_PATH = "C:\ProgramFiles\Android\android-sdk\ndk-bundle" - $Env:ANDROID_SDK_ROOT = "C:\ProgramFiles\Android\android-sdk" - $env:ANDROID_HOME - ./tools/web/set-bash-win.ps1 - ./gradlew clean assembleRelease -DtestBuildType=release # assembleAndroidTest diff --git a/.github/workflows/windows_pure_build.yml b/.github/workflows/windows_pure_build.yml index b39c8d498..5adf3a892 100644 --- a/.github/workflows/windows_pure_build.yml +++ b/.github/workflows/windows_pure_build.yml @@ -73,8 +73,8 @@ jobs: with: path: | C:/Users/runneradmin/_bazel_runneradmin - rslib-bridge/anki/node_modules - key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('rslib-bridge/anki/package.json') }}-${{ hashFiles('rslib-bridge/anki/defs.bzl') }} + anki/node_modules + key: ${{ runner.os }}-v1-node-bazel-cache-${{ hashFiles('anki/package.json') }}-${{ hashFiles('anki/defs.bzl') }} restore-keys: | ${{ runner.os }}-v1-node-bazel-cache diff --git a/.gitignore b/.gitignore index fe10f09c3..6a219f52c 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,6 @@ AnkiDroid/ACRA-INSTALLATION # optional symlink to venv python + +# rust build files +target diff --git a/.gitmodules b/.gitmodules index feca11298..05feb39d9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "anki"] - path = rslib-bridge/anki + path = anki url = https://github.com/ankidroid/anki -[submodule "ftl/core"] - path = ftl/core - url = https://github.com/ankitects/anki-core-i18n.git diff --git a/rslib-bridge/Cargo.lock b/Cargo.lock similarity index 64% rename from rslib-bridge/Cargo.lock rename to Cargo.lock index 672472fe3..ceff41396 100644 --- a/rslib-bridge/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,33 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", + "opaque-debug", +] + [[package]] name = "ahash" version = "0.7.6" @@ -21,18 +42,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.18" +version = "0.7.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" dependencies = [ "memchr", ] [[package]] name = "ammonia" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5ed2509ee88cc023cccee37a6fab35826830fe8b748b3869790e7720c2c4a74" +checksum = "64e6d1c7838db705c9b756557ee27c384ce695a1c51a6fe528784cb1c6840170" dependencies = [ "html5ever", "maplit", @@ -49,16 +70,31 @@ checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" [[package]] name = "android_logger" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74b7ddf197de32e415d197aa21c1c0cb36e01e4794fd801302280ac7847ee02" +checksum = "b5e9dd62f37dea550caf48c77591dc50bd1a378ce08855be1a0c42a97b7550fb" dependencies = [ "android_log-sys", - "env_logger", + "env_logger 0.9.1", "log", "once_cell", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "anki" version = "0.0.0" @@ -70,7 +106,11 @@ dependencies = [ "bytes", "chrono", "coarsetime", + "convert_case", + "criterion", "csv", + "dissimilar", + "env_logger 0.10.0", "flate2", "fluent", "fluent-bundle", @@ -79,7 +119,6 @@ dependencies = [ "hex", "htmlescape", "id_tree", - "intl-memoizer", "itertools", "lazy_static", "nom", @@ -89,7 +128,6 @@ dependencies = [ "once_cell", "pct-str", "pin-project", - "proc-macro-nested", "prost", "prost-build", "pulldown-cmark", @@ -109,17 +147,19 @@ dependencies = [ "slog-async", "slog-envlogger", "slog-term", + "snafu", "strum", "tempfile", "tokio", - "tokio-util 0.6.10", - "unic-langid", + "tokio-util", "unic-ucd-category", "unicase", "unicode-normalization", "utime", + "which", + "workspace-hack", "zip", - "zstd", + "zstd 0.12.0+zstd.1.5.2", ] [[package]] @@ -132,23 +172,24 @@ dependencies = [ "inflections", "intl-memoizer", "num-format", - "phf", + "phf 0.11.1", "serde", "serde_json", "unic-langid", + "workspace-hack", ] [[package]] name = "anyhow" -version = "1.0.57" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" +checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" [[package]] name = "arc-swap" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5d78ce20460b82d3fa150275ed9d55e21064fc7951177baacf86a145c4a4b1f" +checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" [[package]] name = "arrayref" @@ -156,15 +197,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -179,9 +211,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "async-trait" -version = "0.1.56" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" +checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" dependencies = [ "proc-macro2", "quote", @@ -194,7 +226,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -205,12 +237,33 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide 0.5.4", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + [[package]] name = "bitflags" version = "1.3.2" @@ -219,23 +272,23 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.3.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" +checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" dependencies = [ "arrayref", "arrayvec 0.7.2", "cc", "cfg-if", - "constant_time_eq", + "constant_time_eq 0.2.4", "digest", ] [[package]] name = "block-buffer" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" dependencies = [ "generic-array", ] @@ -254,9 +307,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "byteorder" @@ -266,9 +319,36 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" + +[[package]] +name = "bzip2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" @@ -293,17 +373,73 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ - "libc", + "iana-time-zone", "num-integer", "num-traits", - "time 0.1.44", "winapi", ] +[[package]] +name = "ciborium" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369" + +[[package]] +name = "ciborium-ll" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + +[[package]] +name = "clap" +version = "3.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" +dependencies = [ + "bitflags", + "clap_lex", + "indexmap", + "textwrap", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "coarsetime" version = "0.1.22" @@ -312,15 +448,15 @@ checksum = "454038500439e141804c655b4cd1bc6a70bcb95cd2bc9463af5661b6956f0e46" dependencies = [ "libc", "once_cell", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "combine" -version = "4.6.4" +version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a604e93b79d1808327a6fca85a6f2d69de66461e7620f5a4cbf5fb4d1d7c948" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ "bytes", "memchr", @@ -332,6 +468,21 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "constant_time_eq" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.3" @@ -348,6 +499,15 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -357,21 +517,82 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "criterion" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb" +dependencies = [ + "anes", + "atty", + "cast", + "ciborium", + "clap", + "criterion-plot", + "itertools", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + [[package]] name = "crossbeam-channel" -version = "0.5.5" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if", + "crossbeam-epoch", "crossbeam-utils", ] +[[package]] +name = "crossbeam-epoch" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "once_cell", + "scopeguard", +] + [[package]] name = "crossbeam-utils" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if", "once_cell", @@ -379,9 +600,9 @@ dependencies = [ [[package]] name = "crypto-common" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", @@ -394,7 +615,7 @@ source = "git+https://github.com/ankitects/rust-csv.git?rev=1c9d3aab6f79a7d815c6 dependencies = [ "bstr", "csv-core", - "itoa 1.0.2", + "itoa", "ryu", "serde", ] @@ -409,9 +630,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" dependencies = [ "block-buffer", "crypto-common", @@ -439,11 +660,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "dissimilar" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c97b9233581d84b8e1e689cdd3a47b6f69770084fc246e86a7f78b0d9c1d4a5" + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "either" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "encoding_rs" @@ -456,12 +689,46 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ + "humantime", + "is-terminal", "log", "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", ] [[package]] @@ -487,9 +754,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] @@ -507,18 +774,18 @@ dependencies = [ [[package]] name = "fixedbitset" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.6.2", ] [[package]] @@ -571,13 +838,27 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "matches", "percent-encoding", ] @@ -593,9 +874,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -608,9 +889,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -618,15 +899,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -635,15 +916,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2", "quote", @@ -652,21 +933,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -692,9 +973,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.5" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", @@ -717,14 +998,20 @@ checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" + [[package]] name = "h2" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" dependencies = [ "bytes", "fnv", @@ -735,42 +1022,39 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.3", + "tokio-util", "tracing", ] [[package]] -name = "hashbrown" -version = "0.11.2" +name = "half" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] [[package]] name = "hashlink" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" dependencies = [ - "hashbrown 0.11.2", + "hashbrown", ] [[package]] name = "heck" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" @@ -781,12 +1065,30 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "html5ever" version = "0.26.0" @@ -815,7 +1117,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.2", + "itoa", ] [[package]] @@ -831,9 +1133,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" @@ -841,11 +1143,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" -version = "0.14.19" +version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" dependencies = [ "bytes", "futures-channel", @@ -856,7 +1164,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.2", + "itoa", "pin-project-lite", "socket2", "tokio", @@ -891,6 +1199,32 @@ dependencies = [ "tokio-io-timeout", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd911b35d940d2bd0bea0f9100068e5b97b51a1cbe13d13382f132e0365257a0" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "js-sys", + "wasm-bindgen", + "winapi", +] + [[package]] name = "id_tree" version = "1.8.0" @@ -902,23 +1236,22 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" dependencies = [ - "matches", "unicode-bidi", "unicode-normalization", ] [[package]] name = "indexmap" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.12.1", + "hashbrown", ] [[package]] @@ -956,6 +1289,16 @@ dependencies = [ "unic-langid", ] +[[package]] +name = "io-lifetimes" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +dependencies = [ + "libc", + "windows-sys 0.42.0", +] + [[package]] name = "ipnet" version = "2.5.0" @@ -963,25 +1306,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] -name = "itertools" -version = "0.10.3" +name = "is-terminal" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330" dependencies = [ - "either", + "hermit-abi 0.2.6", + "io-lifetimes", + "rustix", + "windows-sys 0.42.0", ] [[package]] -name = "itoa" -version = "0.4.8" +name = "itertools" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] [[package]] name = "itoa" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "jni" @@ -1005,18 +1354,18 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.58" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] @@ -1042,26 +1391,32 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.126" +version = "0.2.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" [[package]] name = "libsqlite3-sys" -version = "0.23.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cafc7c74096c336d9d27145f7ebd4f4b6f95ba16aa5a282387267e6925cb58" +checksum = "9f0455f2c1bc9a7caa792907026e469c1d91761fb0ea37cbb16427c77280cf35" dependencies = [ "cc", "pkg-config", "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" + [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ "autocfg", "scopeguard", @@ -1095,7 +1450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" dependencies = [ "log", - "phf", + "phf 0.10.1", "phf_codegen", "string_cache", "string_cache_codegen", @@ -1114,6 +1469,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.16" @@ -1138,23 +1502,32 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +dependencies = [ + "adler", +] + +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "wasi", + "windows-sys 0.36.1", ] [[package]] @@ -1164,16 +1537,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] -name = "new_debug_unreachable" -version = "1.0.4" +name = "native-tls" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] [[package]] -name = "nodrop" -version = "0.1.14" +name = "new_debug_unreachable" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "nom" @@ -1187,12 +1572,12 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", + "arrayvec 0.7.2", + "itoa", ] [[package]] @@ -1216,11 +1601,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] @@ -1254,11 +1639,58 @@ dependencies = [ "libc", ] +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.12.0" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "opaque-debug" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl" +version = "0.10.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "openssl-probe" @@ -1266,6 +1698,25 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-sys" +version = "0.9.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_str_bytes" +version = "6.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" + [[package]] name = "parking_lot" version = "0.12.1" @@ -1286,7 +1737,30 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.36.1", +] + +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash", + "sha2", ] [[package]] @@ -1299,9 +1773,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "petgraph" @@ -1318,10 +1792,18 @@ name = "phf" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + +[[package]] +name = "phf" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" dependencies = [ "phf_macros", - "phf_shared", - "proc-macro-hack", + "phf_shared 0.11.1", ] [[package]] @@ -1330,8 +1812,8 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.10.0", + "phf_shared 0.10.0", ] [[package]] @@ -1340,19 +1822,28 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ - "phf_shared", + "phf_shared 0.10.0", + "rand", +] + +[[package]] +name = "phf_generator" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" +dependencies = [ + "phf_shared 0.11.1", "rand", ] [[package]] name = "phf_macros" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +checksum = "92aacdc5f16768709a569e913f7451034034178b05bdc8acda226659a3dccc66" dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro-hack", + "phf_generator 0.11.1", + "phf_shared 0.11.1", "proc-macro2", "quote", "syn", @@ -1367,20 +1858,29 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -1403,7 +1903,35 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" name = "pkg-config" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" + +[[package]] +name = "plotters" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" + +[[package]] +name = "plotters-svg" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" +dependencies = [ + "plotters-backend", +] [[package]] name = "ppv-lite86" @@ -1417,12 +1945,23 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "prettyplease" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro-crate" -version = "1.1.3" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" dependencies = [ + "once_cell", "thiserror", "toml", ] @@ -1433,26 +1972,20 @@ version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.9.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +checksum = "c0b18e655c21ff5ac2084a5ad0611e827b3f92badf79f4910b5a5c58f4d87ff0" dependencies = [ "bytes", "prost-derive", @@ -1460,9 +1993,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.9.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +checksum = "e330bf1316db56b12c2bcfa399e8edddd4821965ea25ddb2c134b610b1c1c604" dependencies = [ "bytes", "heck", @@ -1471,18 +2004,20 @@ dependencies = [ "log", "multimap", "petgraph", + "prettyplease", "prost", "prost-types", "regex", + "syn", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +checksum = "7345d5f0e08c0536d7ac7229952590239e77abf0a0100a1b1d890add6ea96364" dependencies = [ "anyhow", "itertools", @@ -1493,9 +2028,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.9.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +checksum = "4dfaa718ad76a44b3415e6c4d53b17c8f99160dcb3a99b10470fce8ad43f6e3e" dependencies = [ "bytes", "prost", @@ -1503,9 +2038,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" +checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" dependencies = [ "bitflags", "getopts", @@ -1515,9 +2050,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.18" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -1545,18 +2080,42 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] +[[package]] +name = "rayon" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -1574,9 +2133,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.6" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", @@ -1591,9 +2150,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" -version = "0.6.26" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" @@ -1619,12 +2178,14 @@ dependencies = [ "hyper", "hyper-rustls", "hyper-timeout", + "hyper-tls", "ipnet", "js-sys", "lazy_static", "log", "mime", "mime_guess", + "native-tls", "percent-encoding", "pin-project-lite", "rustls", @@ -1633,6 +2194,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "tokio", + "tokio-native-tls", "tokio-rustls", "tokio-socks", "url", @@ -1672,7 +2234,6 @@ dependencies = [ "log", "num_enum", "prost", - "prost-build", "rusqlite", "serde", "serde_derive", @@ -1683,25 +2244,44 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.26.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ba4d3462c8b2e4d7f4fcfcf2b296dc6b65404fbbc7b63daa37fd485c149daf7" +checksum = "01e213bc3ecb39ac32e81e51ebe31fd888a940515173e3a18a35f8c6e896422a" dependencies = [ "bitflags", "fallible-iterator", "fallible-streaming-iterator", "hashlink", "libsqlite3-sys", - "memchr", "smallvec", ] +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", +] + [[package]] name = "rustls" version = "0.19.1" @@ -1729,15 +2309,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "same-file" @@ -1755,7 +2335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1776,9 +2356,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.6.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" dependencies = [ "bitflags", "core-foundation", @@ -1805,18 +2385,18 @@ checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af" [[package]] name = "serde" -version = "1.0.137" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" dependencies = [ "serde_derive", ] [[package]] name = "serde-aux" -version = "3.0.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93abf9799c576f004252b2a05168d58527fb7c54de12e94b4d12fe3475ffad24" +checksum = "c599b3fd89a75e0c18d6d2be693ddb12cccaf771db4ff9e39097104808a014c0" dependencies = [ "chrono", "serde", @@ -1825,9 +2405,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" dependencies = [ "proc-macro2", "quote", @@ -1836,20 +2416,20 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ - "itoa 1.0.2", + "itoa", "ryu", "serde", ] [[package]] name = "serde_repr" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ad84e47328a31223de7fed7a4f5087f2d6ddfe586cf3ca25b7a165bc0a5aed" +checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" dependencies = [ "proc-macro2", "quote", @@ -1884,25 +2464,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.2", + "itoa", "ryu", "serde", ] [[package]] name = "sha1" -version = "0.6.1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ - "sha1_smol", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] -name = "sha1_smol" -version = "1.0.0" +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] [[package]] name = "siphasher" @@ -1912,9 +2508,12 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "slab" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] [[package]] name = "slog" @@ -1981,14 +2580,37 @@ dependencies = [ "slog", "term", "thread_local", - "time 0.3.9", + "time", ] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + +[[package]] +name = "snafu" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152ba99b054b22972ee794cf04e5ef572da1229e33b65f3c57abbff0525a454" +dependencies = [ + "backtrace", + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "d5e79cdebbabaebb06a9bdbaedc7f159b410461f63611d4d0e3fb0fab8fed850" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] [[package]] name = "snowflake" @@ -1998,9 +2620,9 @@ checksum = "27207bb65232eda1f588cf46db2fee75c0808d557f6b3cf19a75f5d6d7c94df1" [[package]] name = "socket2" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" dependencies = [ "libc", "winapi", @@ -2027,7 +2649,7 @@ dependencies = [ "new_debug_unreachable", "once_cell", "parking_lot", - "phf_shared", + "phf_shared 0.10.0", "precomputed-hash", "serde", ] @@ -2038,26 +2660,26 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.10.0", + "phf_shared 0.10.0", "proc-macro2", "quote", ] [[package]] name = "strum" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.23.1" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck", "proc-macro2", @@ -2074,9 +2696,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.96" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce" dependencies = [ "proc-macro2", "quote", @@ -2125,20 +2747,35 @@ dependencies = [ "winapi", ] +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" + [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" dependencies = [ "proc-macro2", "quote", @@ -2156,32 +2793,32 @@ dependencies = [ [[package]] name = "time" -version = "0.1.44" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ + "itoa", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "num_threads", + "serde", + "time-core", + "time-macros", ] [[package]] -name = "time" -version = "0.3.9" +name = "time-core" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" -dependencies = [ - "itoa 1.0.2", - "libc", - "num_threads", - "time-macros", -] +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +dependencies = [ + "time-core", +] [[package]] name = "tinystr" @@ -2189,6 +2826,16 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29738eedb4388d9ea620eeab9384884fc3f06f586a2eddb56bedc5885126c7c1" +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -2206,18 +2853,21 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.19.2" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" +checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" dependencies = [ + "autocfg", "bytes", "libc", "memchr", "mio", "num_cpus", - "once_cell", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", + "tokio-macros", "winapi", ] @@ -2230,6 +2880,27 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.22.0" @@ -2255,23 +2926,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ "bytes", "futures-core", @@ -2292,15 +2949,15 @@ dependencies = [ [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" +checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" dependencies = [ "cfg-if", "pin-project-lite", @@ -2309,9 +2966,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.27" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921" +checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" dependencies = [ "once_cell", ] @@ -2360,9 +3017,9 @@ checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" [[package]] name = "unic-langid" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73328fcd730a030bdb19ddf23e192187a6b01cd98be6d3140622a89129459ce5" +checksum = "398f9ad7239db44fd0f80fe068d12ff22d78354080332a5077dc6f52f14dcf2f" dependencies = [ "unic-langid-impl", "unic-langid-macros", @@ -2439,30 +3096,30 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" +checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "untrusted" @@ -2472,14 +3129,14 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.2.2" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", "idna", - "matches", "percent-encoding", + "serde", ] [[package]] @@ -2537,12 +3194,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2551,9 +3202,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if", "serde", @@ -2563,13 +3214,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -2578,9 +3229,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ "cfg-if", "js-sys", @@ -2590,9 +3241,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2600,9 +3251,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", @@ -2613,15 +3264,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "web-sys" -version = "0.3.58" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" dependencies = [ "js-sys", "wasm-bindgen", @@ -2648,13 +3299,13 @@ dependencies = [ [[package]] name = "which" -version = "4.2.5" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" +checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" dependencies = [ "either", - "lazy_static", "libc", + "once_cell", ] [[package]] @@ -2694,43 +3345,100 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winreg" version = "0.7.0" @@ -2740,33 +3448,96 @@ dependencies = [ "winapi", ] +[[package]] +name = "workspace-hack" +version = "0.1.0" +dependencies = [ + "bstr", + "bytes", + "cc", + "crossbeam-utils", + "either", + "flate2", + "getrandom", + "hashbrown", + "hmac", + "indexmap", + "log", + "num-traits", + "phf_shared 0.11.1", + "prost", + "rand", + "rand_core", + "regex", + "regex-syntax", + "scopeguard", + "serde", + "sha2", + "snafu", + "syn", + "time", + "time-macros", + "tokio", + "url", + "zip", + "zstd 0.12.0+zstd.1.5.2", + "zstd-safe 6.0.2+zstd.1.5.2", + "zstd-sys", +] + [[package]] name = "zip" -version = "0.5.13" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080" dependencies = [ + "aes", "byteorder", + "bzip2", + "constant_time_eq 0.1.5", "crc32fast", + "crossbeam-utils", "flate2", - "thiserror", - "time 0.1.44", + "hmac", + "pbkdf2", + "sha1", + "time", + "zstd 0.11.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe 5.0.2+zstd.1.5.2", ] [[package]] name = "zstd" -version = "0.10.2+zstd.1.5.2" +version = "0.12.0+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4a6bd64f22b5e3e94b4e238669ff9f10815c27a5180108b849d24174a83847" +checksum = "b8148aa921e9d53217ab9322f8553bd130f7ae33489db68b381d76137d2e6374" dependencies = [ - "zstd-safe", + "zstd-safe 6.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", ] [[package]] name = "zstd-safe" -version = "4.1.6+zstd.1.5.2" +version = "6.0.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b61c51bb270702d6167b8ce67340d2754b088d0c091b06e593aa772c3ee9bb" +checksum = "a6cf39f730b440bab43da8fb5faf5f254574462f73f260f85f7987f32154ff17" dependencies = [ "libc", "zstd-sys", @@ -2774,9 +3545,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.6.3+zstd.1.5.2" +version = "2.0.1+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" +checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..febc3ccc1 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,33 @@ +[workspace.package] +version = "0.0.0" +authors = ["Ankitects Pty Ltd and contributors"] +license = "AGPL-3.0-or-later" +rust-version = "1.64" +edition = "2021" + +[workspace] +members = [ + "rslib-bridge", + "anki/rslib", +] +exclude = [] +resolver = "2" + +[patch.crates-io] +# If updating rev, hakari.toml needs updating too. +reqwest = { git = "https://github.com/ankitects/reqwest.git", rev = "7591444614de02b658ddab125efba7b2bb4e2335" } + +[profile.dev.package."*"] +opt-level = 0 +debug = 0 + +[profile.dev.package.sha2] +opt-level = 1 +debug = 0 + +# Debug info off by default, which speeds up incremental builds and produces a considerably +# smaller library. +[profile.dev.package.anki] +debug = 0 +[profile.dev.package.rsdroid] +debug = 0 diff --git a/README.md b/README.md index bf3e498bd..6b00df630 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,163 @@ # AnkiDroid-Backend -Adapter allowing AnkiDroid to leverage Anki Desktop's Rust-based business logic layer via access to `anki/rslib` over JNI. +An interface for accessing Anki Desktop's Rust backend inside AnkiDroid. This +allows AnkiDroid to re-use the computer version's business logic and webpages, +instead of having to reimplement them. -## Why? +This is a separate repo that gets published to a library that AnkiDroid consumes, +so that AnkiDroid development is possible without a Rust toolchain installed. -- Removes the need to port Anki Desktop's business logic to Java - - 100% compatibility and no bugs - - Rust should provide a speed increase - - An upgrade for AnkiDroid should only require moving to a later commit in a submodule - - Saves massive amount of AnkiDroid developer time & effort - - Allows Anki Desktop to iterate faster - - We can quickly port changes upstream, which will benefit the ecosystem -- Insulates Anki-Android users from the complexity of installing multiple toolchains - - The Rust/Python/cross-compilation toolchain is much more complex than downloading Android Studio - - A separate repository means we keep a low barrier to entry for new contributors +## Prerequisites -## How to use it in a project +We assume you already have Android Studio, and are able to build the AnkiDroid +project already. -AnkiDroid uses a pre-built version of this library, and includes it in AnkiDroid/build.gradle. -To build a local version of this library and tell AnkiDroid to use it, please see the instructions -in docs/TESTING.md +### Download Anki submodule -## Folders +git submodule update --init -`/anki/` - git submodule containing the Anki Rust Codebase, used both for building into `.so` files, and to obtain the current `.proto` files for use in Java codegen +### C toolchain -`/tools/` Tools to generate efficient protobuf-based RPC calls using JNI +Install Xcode/Visual Studio if on macOS/Windows. -`/rsdroid/` - Java library to be consumed by `Anki-Android`. +### Rust -`rsdroid-testing` - Builds a testing library which exposes a function to load `rsdroid` in a non-Android context for testing via Robolectric +Install rustup from https://rustup.rs/ -`rsdroid-instrumented` - Android Instrumented Test +### Ninja -This is defined as an application to allow instrumented tests to be run against a library - there may be a better method +Debian/Ubuntu: -`/rslib-bridge/` (Rust) Android-specific library to communicate with `anki/rslib` + sudo apt install ninja-build -## Implementation +macOS: -- Points to a fixed commit of `ankidroid/anki` - - Modifications to the library so we do not need to update to database schema 15 for version 1 -- References `rslib-bridge/anki/proto/anki/*.proto` which define RPC service calls to the anki backend -- Python script to auto-generate the Java interface/backend to the RPC mechanism. Invoked via gradle. -- Android Library which contains the rust based `.so` under (x86, x86-64, arm, arm64) - - Implements `android.database.sqlite`, redirecting SQL to the rust library - - Exposes RPC calls to Rust via a clean Java interface (`net.ankiweb.rsdroid.Backend`) -- Testing library to allow the above to be usable under Robolectric + brew upgrade + brew install ninja -## Additional Information +Windows if using choco: -See `/docs` for more in-depth information. + choco install ninja + +You can alternatively download a binary from https://github.com/ninja-build/ninja/releases +and put it on your path. + +### NDK + +In Android Studio, choose the Tools>SDK menu option. + +- In SDK tools, enable "show package details" +- Choose the NDK version that matches the number used in .github/workflows, eg 22.0.7026061 +- After downloading, you may need to restart Android Studio to get it to +synchronize gradle. + +### Windows: msys2 + +Install [msys2](https://www.msys2.org/) into the default folder location. + +After installation completes, run msys2, and run the following command: + +``` +$ pacman -S git rsync +``` + +When following the build steps below, make sure msys is on the path: + +``` +set PATH=%PATH%;c:\msys64\usr\bin +``` + +## Building + +Two main files need to be built: + +- The main .aar file, which contains the backend Kotlin code, web assets, and +Anki backend code compiled for Android. +- A .jar that contains the backend code compiled for the host platform, for use +with Robolectric unit tests. + +You should do the first build with the provided shell .sh/.bat file, as it will +take care of downloading the target architecture library as well. You'll need +to tell the script to use the Java libraries and NDK downloaded by Android Studio, +eg on Linux: + +``` +export ANDROID_SDK_ROOT=$HOME/Android/Sdk +``` + +Or macOS: + +``` +export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk +``` + +If you don't have Java installed, you may be able to use the version bundled +with Android Studio. Eg on macOS: + +``` +export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home" +``` + +or Windows: + +``` +set JAVA_HOME=C:\Program Files\Android\Android Studio\jre +``` + +Now build the .aar: + +``` +./build-aar.sh +``` + +If you have 'python3' on your system but not 'python', you can specify +the name: + +``` +RUST_ANDROID_GRADLE_PYTHON_COMMAND=python3 ./build-aar.sh +``` + +Assuming success, then build the .jar file: + +``` +./build-robo.sh +``` + + +## Modify AnkiDroid to use built library + +Now open the AnkiDroid project in AndroidStudio. To tell gradle to load the +compiled .aar and .jar files from disk, edit local.properties +in the AnkiDroid repo, and add the following line: + +``` +local_backend=true +``` + +If you also want to test out the new schema code paths that make greater use of the backend, +add the following line (be warned, do not use this on a collection you care about yet): + +``` +legacy_schema=false +``` + +Also make sure ext.ankidroid_backend_version in AnkiDroid/build.gradle matches the version +of the backend you're testing. + +After making the change, you should be able to build and run the project on an x86_64 +emulator/device (arm64 on M1 Macs), and run unit tests. + +## Release builds + +Only the current platform is built by default. In CI, the .aar and .jar files +are built for multiple platforms, so one release library can be used on a variety +of devices. See .github/workflows for how this is done. + +## Architecture + +See (ARCHITECTURE.md)[./docs/ARCHITECTURE.md] ## License [GPL-3.0 License](https://github.com/ankidroid/Anki-Android/blob/master/COPYING) -[AGPL-3.0 Licence](https://github.com/david-allison-1/anki/blob/master/LICENSE) (anki submodule) +[AGPL-3.0 Licence](https://github.com/AnkiDroid/anki/blob/main/LICENSE) (anki submodule) diff --git a/anki b/anki new file mode 160000 index 000000000..5d9f262f4 --- /dev/null +++ b/anki @@ -0,0 +1 @@ +Subproject commit 5d9f262f4c1153156b3f5fc46eaf273dce980357 diff --git a/build-aar.bat b/build-aar.bat new file mode 100755 index 000000000..160bb82c9 --- /dev/null +++ b/build-aar.bat @@ -0,0 +1,3 @@ +rustup target add x86_64-linux-android || exit /b 1 +set PATH=anki\out\extracted\python;%PATH% +gradlew assembleRelease || exit /b 1 diff --git a/build-aar.sh b/build-aar.sh new file mode 100755 index 000000000..ff28ad6e1 --- /dev/null +++ b/build-aar.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Builds the .aar file containing generated Kotlin, and the backend library +# used on Android. By default only the library for the current +# architecture is built (eg X86_64, or Arm64 on Apple M1+). +# +# Define ALL_ARCHS=1 to build a multi-platform bundle, which takes about 4x +# longer to download and build. +# +# Define DEBUG=1 to compile the Rust in debug mode, which builds faster +# but runs slower. +# +# When changing env vars, you must './gradlew stop' before rebuilding. +# +# The robolectric library needs to be built separately with ./build-robo.sh +# + +set -e + +if [ "$ALL_ARCHS" = "1" ]; then + rustup target add armv7-linux-androideabi # arm + rustup target add i686-linux-android # x86 + rustup target add aarch64-linux-android # arm64 + rustup target add x86_64-linux-android # x86_64 +else + if [[ "$OSTYPE" == "darwin"* && $(arch) == "arm64" ]]; then + rustup target add aarch64-linux-android + else + rustup target add x86_64-linux-android + fi +fi + +./gradlew assembleRelease diff --git a/build-current.sh b/build-current.sh deleted file mode 100755 index 971110c22..000000000 --- a/build-current.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# -# Builds for the current architecture only. See docs/TESTING.md -# - -set -e - -export CURRENT_ONLY=true - -# build simulator/device package -./gradlew assembleRelease - -# build library for Robolectric tests -CARGO_TARGET_DIR=target NO_CROSS=true ./gradlew rsdroid-testing:build diff --git a/build-robo.bat b/build-robo.bat new file mode 100755 index 000000000..27aa953e2 --- /dev/null +++ b/build-robo.bat @@ -0,0 +1,6 @@ +REM On Windows, linking fails with "library limit of 65535 objects exceeded" +REM when building in debug mode, so build is locked to release. + +cargo build -p rsdroid --release || exit /b 1 +cp target\release\rsdroid.dll rsdroid-testing\assets || exit /b 1 +gradlew rsdroid-testing:build || exit /b 1 diff --git a/build-robo.sh b/build-robo.sh new file mode 100755 index 000000000..9becb8a60 --- /dev/null +++ b/build-robo.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# +# Builds the .jar file containing the backend library compiled for +# desktop, which Robolectric needs. By default only the library for +# the current architecture is built (eg X86_64, or Arm64 on Apple M1+). +# +# Define ALL_ARCHS=1 to build a multi-platform bundle. This will only +# work on macOS, as it's not possible to target macOS from other platforms. +# +# Define DEBUG=1 to compile the Rust in debug mode, which builds faster +# but runs slower. +# + +set -e + +if [ "$DEBUG" = "1" ]; then + release="" + dir="debug" +else + release="--release" + dir="release" +fi + +# Build the shared libraries +if [ "$ALL_ARCHS" = "1" ]; then + if [[ "$OSTYPE" != "darwin"* ]]; then + echo "Must be on macOS to do a multi-arch build." + exit 1 + fi + + # Mac + for target in \ + x86_64-apple-darwin \ + aarch64-apple-darwin + do + rustup target add $target + cargo build -p rsdroid $release --target $target + done + lipo -create target/x86_64-apple-darwin/$dir/librsdroid.dylib \ + target/aarch64-apple-darwin/$dir/librsdroid.dylib \ + -output rsdroid-testing/assets/librsdroid.dylib + + # Linux + target=x86_64-unknown-linux-gnu + rustup target add $target + CC=x86_64-unknown-linux-gnu-gcc \ + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc \ + cargo build -p rsdroid $release --target $target + cp -v target/$target/$dir/librsdroid.so rsdroid-testing/assets + + + # Windows + target=x86_64-pc-windows-gnu + rustup target add $target + cargo build -p rsdroid $release --target $target + cp -v target/$target/$dir/rsdroid.dll rsdroid-testing/assets +else + cargo build -p rsdroid $release + for file in target/$dir/librsdroid.{dylib,so}; do + test -f $file && cp -v $file rsdroid-testing/assets/ + done +fi + +# Bundle them up into a jar +./gradlew rsdroid-testing:build diff --git a/build-web-assets.gradle b/build-web-assets.gradle index 6d16d9ffe..0e967717d 100644 --- a/build-web-assets.gradle +++ b/build-web-assets.gradle @@ -1,8 +1,8 @@ task buildAnkiWebAssets(type: Exec) { workingDir "$rootDir" - String toolPath = System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows') ? 'tools/web/build-web-assets.ps1' : 'tools/web/build-web-assets.sh' + String toolPath = System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows') ? 'tools/web/build-web-assets.bat' : 'tools/web/build-web-assets.sh' if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) { - commandLine 'PowerShell', '-File', toolPath + commandLine toolPath } else { commandLine 'sh', '-c', toolPath } diff --git a/check-droid.bat b/check-droid.bat new file mode 100755 index 000000000..fbbf95163 --- /dev/null +++ b/check-droid.bat @@ -0,0 +1,6 @@ +if not exist rsdroid\build\outputs\aar\rsdroid-release.aar ( + echo "Run ./build-aar.bat first" + exit 1 +) + +./gradlew rsdroid:lint rsdroid-instrumented:connectedCheck diff --git a/check-droid.sh b/check-droid.sh new file mode 100755 index 000000000..6bff1a6ad --- /dev/null +++ b/check-droid.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +test -f rsdroid/build/outputs/aar/rsdroid-release.aar || ( + echo "Run ./build-aar.sh first" + exit 1 +) +./gradlew rsdroid:lint rsdroid-instrumented:connectedCheck diff --git a/check-rust.sh b/check-rust.sh new file mode 100755 index 000000000..88f28a0d3 --- /dev/null +++ b/check-rust.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +rustup component add rustfmt clippy +cargo clippy +cargo fmt -- --check diff --git a/docs/OVERVIEW.md b/docs/ARCHITECTURE.md similarity index 92% rename from docs/OVERVIEW.md rename to docs/ARCHITECTURE.md index 15f64e8a4..4f427f181 100644 --- a/docs/OVERVIEW.md +++ b/docs/ARCHITECTURE.md @@ -1,4 +1,4 @@ -# Overview +# Architecture Anki-Android-Backend uses Rust, Java and a little Python. Since setting up a Rust environment is somewhat complex, having a separate library encourages drive-by contributions to the main app by keeping a low barrier to entry for Anki-Android. @@ -7,16 +7,28 @@ This repo is comprised of two main components: - `rslib-bridge` is a small Rust project that gets compiled into a shared library, which Java code can import. Its API consists of only three different functions: `openBackend()`, `closeBackend()`, and `runMethodRaw()`. When one of these functions is called by Java code, `rslib-bridge` takes care of converting the Java objects to a native Rust representation, and then passes the call - on to Anki's Rust backend, which gets included in `rslib-bridge` via the `rslib-bridge/anki[/rslib]` submodule. + on to Anki's Rust backend, which gets included in `rslib-bridge` via the `anki[/rslib]` submodule. - `rsdroid` is a Kotlin library that provides a friendly interface to the backend code. The bulk of its code is automatically - generated from the service definitions in `rslib-bridge/anki/proto/anki`. `rsdroid` also provides an adaptor to the Rust + generated from the service definitions in `anki/proto/anki`. `rsdroid` also provides an adaptor to the Rust database functionality, so that the Rust backend can be used in place of the standard Android SQLite library. +Other folders: + +`/anki/` - Git submodule containing the Anki Rust Codebase, used both for building into `.so` files, and to obtain the current `.proto` files for use in Java codegen + +`/tools/` Scripts to generate the backend interface and translations + +`rsdroid-testing` - Builds a testing library targetting desktop machines, for use with Robolectric + +`rsdroid-instrumented` - Android Instrumented Test + +This is defined as an application to allow instrumented tests to be run against a library - there may be a better method + ## Protocol Buffers The Rust backend uses Protocol Buffers to define available methods, and the structure of data each method takes and receives. The files can -be found in `rslib-bridge/anki/proto/anki`. +be found in `anki/proto/anki`. For example: diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md deleted file mode 100644 index e5abd473e..000000000 --- a/docs/ENVIRONMENT.md +++ /dev/null @@ -1,148 +0,0 @@ -# Environment Setup - -## Get the source - -Clone the project, including submodules - -`git clone --recurse-submodules git@github.com:ankidroid/Anki-Android-Backend` - -## Docker (needed for cross compilation) - -### Docker Installation - -#### macOS and Windows - -you will probably want [Docker Desktop](https://www.docker.com/products/docker-desktop/) - -#### linux - -Your package manager should have Docker, for example `apt install docker` for Ubuntu - -### Docker Image installation - -We have a script that automates Docker image build, run it in your shell: - -`./tools/build-docker-images.sh` - -### Android Tools - -Make sure you have an Android SDK, NDK and build tools installed - -You may examine the file [`rsdriod/build.gradle`](../rsdroid/build.gradle) to determine the versions needed. - -For example: - -```groovy - compileSdkVersion 30 - buildToolsVersion "30.0.1" - ndkVersion "22.0.7026061" // Used by GitHub actions - avoids an install step on some machines - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 30 -``` - -That indicates you need: - -- SDK 30 installed (compileSdkVersion and targetSdkVersion) -- NDK 22.0.7026062 (ndkVersion) -- Build Tools 30.0.1 (buildToolsVersion) - -You should open Android Studio and use the Tools --> SDK Manager to download them - -### Rust - -#### Rust toolchain - -Install rust via [rustup](https://rustup.rs/) - -Install the Rust version the desktop code uses (later is probably fine too): - -```bash -rustup install 1.58.1 -rustup default 1.58.1 -``` - -#### Android targets - -Add our 4 supported Android targets - -```bash -rustup target add armv7-linux-androideabi -rustup target add i686-linux-android -rustup target add aarch64-linux-android -rustup target add x86_64-linux-android -``` - -Optionally add the Apple Silicon target if you have an Apple Silicon M1 CPU machine: - -```bash -rustup target add aarch64-apple-darwin -``` - -It appears that you need to make a link to 'cc' on linux for the Rust build to work: - -```bash -sudo ln -s /usr/bin/cc /usr/local/bin/x86_64-unknown-linux-gnu-gcc -``` - -#### Cross-compile tools - -Install cross crate for cross compiling rust code - -```bash -cargo install cross --git https://github.com/rust-embedded/cross --tag v0.2.1 -``` - -(we need a specific version as the current version requires a newer rust to work, see #168) - -## Protobuf tools - -### Install protobuf compiler (protoc) 3.x - -- macOS: `brew install protobuf` -- ubuntu: `sudo apt-get install protobuf-compiler` -- others: - - [build from source](https://github.com/protocolbuffers/protobuf/blob/master/src/README.md) - - [pre built binary](https://github.com/protocolbuffers/protobuf/releases) - - name: `protoc-$VERSION-$PLATFORM.zip` - - add bin directory to your PATH - -### Install Python protobuf support - -#### Install Python3 - -- macOS this should be `brew install python` -- linux you may need to make sure `python` exists instead of just `python3`, for example `sudo apt install python-is-python3` - -#### Install python packages - -```bash -pip install protobuf stringcase -``` - - -## Make sure it works - -Basic commands to build and test things may be taken from the `./github/workflows` scripts. - -Some examples: - -> ./gradlew clean assembleRelease -DtestBuildType=release - -Or maybe - -> ./gradlew :rsdroid:androidJavadocs -DtestBuildType=release - -Perhaps - -> ./gradlew clean rsdroid-testing:build -DtestBuildType=debug --warning-mode all - -Even - -> ./gradlew rsdroid:test -x jar -x cargoBuildArm -x cargoBuildX86 -x cargoBuildArm64 -x cargoBuildX86_64 diff --git a/docs/TESTING.md b/docs/TESTING.md deleted file mode 100644 index 4a8a003f9..000000000 --- a/docs/TESTING.md +++ /dev/null @@ -1,83 +0,0 @@ -# Testing changes with AnkiDroid on an X86_64 sim (Linux) - -It is possible to limit the build to the current architecture, to avoid having -to use Docker or to cross-compile for multiple platforms. - -A similar approach may work on Mac and Windows, but this has only been tested on Linux -so far. - -## Setup - -Make sure you can build AnkiDroid first. - -Follow the initial setup instructions in the computer version -(rslib-bridge/anki/docs/{windows,mac,linux}.md) to install prerequisites -like Bazelisk and the build tools for your platform. - -Install NDK: - -- Download https://developer.android.com/studio#command-tools -- Rename cmdline-tools to $ANDROID_SDK_ROOT/cmdline-tools/latest -- Get ndk version from rslib/build.grade -- .github/scripts/install_ndk.sh 22.0.7026061 - -Install Rust: - -- rustup install 1.58.1 -- rustup target add x86_64-linux-android -- sudo ln -sf /usr/bin/gcc /usr/bin/x86_64-unknown-linux-gnu-gcc - -Install protobuf: - -- Install protobuf with your package manager - -## Optional Python venv - -If you don't want to `pip install protobuf stringcase` globally, -you can do so in a venv, and then symlink the python bin from the -venv into `python` at the top of the project folder: - -``` -$ ln -sf /path/to/venv/bin/python python -``` - -## Install Python packages - -``` -pip install protobuf stringcase -``` - -## Build - -Two files need to be built: - -- A .aar file for emulator/device testing -- A .jar for running unit tests - -``` -export ANDROID_SDK_ROOT=$HOME/Android/Sdk -export PATH=$HOME/Android/Sdk/cmdline-tools/latest/bin/:$PATH -./build-current.sh -``` - -## Modify AnkiDroid to use built library - -Tell gradle to load the compiled .aar and .jar files from disk by editing local.properties -in the AnkiDroid repo, and adding the following line: - -``` -local_backend=true -``` - -If you also want to test out the new schema code paths that make greater use of the backend, -add the following line (be warned, do not use this on a collection you care about yet): - -``` -legacy_schema=false -``` - -Also make sure ext.ankidroid_backend_version in AnkiDroid/build.gradle matches the version -of the backend you're testing. - -After making the change, you should be able to build and run the project on an x86_64 -emulator/device, and run unit tests. diff --git a/docs/source/sequence_method_call.plantuml b/docs/source/sequence_method_call.plantuml deleted file mode 100644 index d8cf1d8a2..000000000 --- a/docs/source/sequence_method_call.plantuml +++ /dev/null @@ -1,29 +0,0 @@ -@startuml -actor actor as user -participant RustDroidBackend as RustDroidBackend -boundary "Anki-Android-Backend" -participant BackendV1Impl as RustBackend -participant NativeMethods.java as NativeMethods -boundary "rslib-bridge" -participant lib.rs as rslibbridge -boundary "anki" -participant rslib as anki_backend -group Anki-Android - -user -> RustDroidBackend : setLocalMinutesWest(10) - -RustDroidBackend -> RustBackend : setLocalMinutesWest(10) - -RustBackend -> RustBackend: convert int to proto -RustBackend -> NativeMethods: executeCommand(ptr, 13, byte[]); -NativeMethods -> rslibbridge: command(ptr, 13, byte[]); -rslibbridge -> anki_backend: run_command_bytes(13, byte[]) -anki_backend -> anki_backend: run_command_bytes2_inner(13, byte[]) -anki_backend -> anki_backend: Switch on 13\ndecode input\ncall self.local_minutes_west\nreturn output as proto\nor error as proto -anki_backend -> rslibbridge: return (Empty|AnkiError) -rslibbridge -> rslibbridge: convert proto to bytes -rslibbridge -> rslibbridge: convert panic to bytes (if thrown) -rslibbridge -> RustDroidBackend: convert Empty to void and return - - -@enduml \ No newline at end of file diff --git a/docs/source/sequence_open_collection.plantuml b/docs/source/sequence_open_collection.plantuml deleted file mode 100644 index a35f8ed11..000000000 --- a/docs/source/sequence_open_collection.plantuml +++ /dev/null @@ -1,45 +0,0 @@ -@startuml -actor actor as user -participant RustDroidBackend as RustDroidBackend -boundary "Anki-Android-Backend" -participant BackendUtils -participant BackendV1Impl as RustBackend -participant NativeMethods.java as NativeMethods -boundary "rslib-bridge" -participant lib.rs as rslibbridge -boundary "anki" -participant rslib as anki_backend -group Anki-Android - - -user -> RustDroidBackend : openCollectionDatabase(path) -RustDroidBackend -> RustDroidBackend: create Db Instance & getDatabase() -RustDroidBackend -> BackendUtils : openAnkiDroidCollection(path) -BackendUtils -> BackendUtils: convert path to proto -BackendUtils -> RustBackend : openAnkiDroidCollection(OpenCollectionIn) - - group Obtain pointer (one time) - RustBackend -> RustBackend: ensureBackend() - RustBackend -> NativeMethods: openBackend() - NativeMethods -> rslibbridge: openBackend() - rslibbridge -> NativeMethods: return pointer - NativeMethods -> RustBackend: persist pointer - end - - group Open Collection - RustBackend -> NativeMethods: openCollection(ptr, byte[]) - NativeMethods -> rslibbridge: openCollection - rslibbridge -> rslibbridge: decode ptr - rslibbridge -> rslibbridge: decode proto - rslibbridge -> rslibbridge: open_collection_ankidroid - rslibbridge -> rslibbridge: open_or_create_no_update - rslibbridge -> rslibbridge: ptr can be used to access col - rslibbridge -> NativeMethods: byte[] - NativeMethods -> RustBackend: byte[] - RustBackend -> RustBackend: Check for error - RustBackend -> RustBackend: Response is Generic.Empty.\nReturn void - end - -RustBackend -> user - -@enduml \ No newline at end of file diff --git a/ftl/core b/ftl/core deleted file mode 160000 index 40963d9a2..000000000 --- a/ftl/core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 40963d9a29703c756a47bac8e0e7e5174a286c86 diff --git a/gradle.properties b/gradle.properties index f44274e99..541bd3be6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ android.useAndroidX=true android.enableJetifier=false GROUP=io.github.david-allison-1 -VERSION_NAME=0.1.15-anki2.1.54 +VERSION_NAME=0.1.16-anki2.1.55 POM_INCEPTION_YEAR=2020 diff --git a/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendForTesting.java b/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendForTesting.java index a36a55677..a0acf879c 100644 --- a/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendForTesting.java +++ b/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendForTesting.java @@ -50,7 +50,6 @@ public void debugProduceError(ErrorType error) { public enum ErrorType { InvalidInput, TemplateError, - IoError, DbErrorFileTooNew, DbErrorFileTooOld, DbErrorMissingEntity, diff --git a/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendIntegrationTests.java b/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendIntegrationTests.java index 0a0674080..6cc449e7c 100644 --- a/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendIntegrationTests.java +++ b/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/BackendIntegrationTests.java @@ -42,7 +42,7 @@ public class BackendIntegrationTests extends InstrumentedTest { /** Ensure that the database can't be locked */ @Rule - public Timeout timeout = new Timeout(3, TimeUnit.SECONDS); + public Timeout timeout = new Timeout(60, TimeUnit.SECONDS); @Before public void test() { diff --git a/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/ExceptionTest.java b/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/ExceptionTest.java index c7a57d5c7..fc24030bc 100644 --- a/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/ExceptionTest.java +++ b/rsdroid-instrumented/src/androidTest/java/net/ankiweb/rsdroid/ExceptionTest.java @@ -84,7 +84,6 @@ public static java.util.Collection initParameters() { { BackendForTesting.ErrorType.FatalError, BackendException.BackendFatalError.class }, { BackendForTesting.ErrorType.Interrupted, BackendInterruptedException.class}, { BackendForTesting.ErrorType.InvalidInput, BackendInvalidInputException.class}, - { BackendForTesting.ErrorType.IoError, BackendIoException.class}, { BackendForTesting.ErrorType.JSONError, BackendJsonException.class }, { BackendForTesting.ErrorType.ProtoError, BackendProtoException.class }, { BackendForTesting.ErrorType.TemplateError, BackendTemplateException.class}, diff --git a/rsdroid-testing/build.gradle b/rsdroid-testing/build.gradle index d60fae87d..f5b68e286 100644 --- a/rsdroid-testing/build.gradle +++ b/rsdroid-testing/build.gradle @@ -43,175 +43,6 @@ jar { sourceCompatibility = "1.7" targetCompatibility = "1.7" -enum Platform { - LINUX, MACOS, WINDOWS -} - -def Platform getCurrentPlatform() { - def currentOS = org.gradle.internal.os.OperatingSystem.current() - if (currentOS.isWindows()) return Platform.WINDOWS - if (currentOS.isMacOsX()) return Platform.MACOS - if (currentOS.isLinux()) return Platform.LINUX - - throw "Unsuported OS" -} - -def getInputDir() { - def path = "${project.sourceSets.main.java.srcDirs[0]}/../../../../rslib-bridge" - def canonicalPath = new File(path).getCanonicalPath() - if (!new File(canonicalPath).exists()) { - throw new FileNotFoundException("could not find working directory: ${canonicalPath}") - } - return canonicalPath -} - -def getAssetsDir() { - return "${project.sourceSets.main.java.srcDirs[0]}/../../../assets"; -} - -def getTargetDir() { - return getInputDir() + "/target" -} - -def toWindowsCommandLine(String command) { - def path = getAssetsDir() - def canonicalAssetsPath = new File(path).getCanonicalPath() - if (!new File(canonicalAssetsPath).exists()) { - throw new FileNotFoundException("could not find output path: ${canonicalAssetsPath}") - } - return ["bash", "--login", "-c", command] -} - -def toCommandLine(Platform targetPlatform) { - // the --out-dir flag requires -Z unstable-options - // -Z unstable-options requires a 'nightly' toolchain - // TODO: Explain how to select the version - - def useCross = System.getenv("NO_CROSS") != "true" - if (useCross && getCurrentPlatform() == targetPlatform) { - useCross = false - } - - def standardArg = "${useCross ? "cross" : "cargo"} build --release --features no-android --verbose" - def assetsPath = new File("${project.sourceSets.main.java.srcDirs[0]}/../../../assets").getCanonicalPath() - - String assetsSubPath = "/rsdroid-testing/assets" - File f = new File(project.rootDir, assetsSubPath) - // As we're running through WSL, we need a Unix path for windows: - // C:\GitHub\Rust-Test\rsdroid-testing\assets -> /mnt/c/GitHub/Rust-Test/rsdroid-testing/assets - String path = !org.gradle.internal.os.OperatingSystem.current().isWindows() ? f.absolutePath : - "/mnt/" + f.absolutePath[0].toLowerCase() + f.absolutePath.substring(1).replace(":\\", "\\").replace("\\", "/") - - println "Outputting to: ${path}" - def outDir = "" - System.out.println(assetsPath) - def mainArg = standardArg + " " + outDir - if (useCross) { - mainArg = "DONT_RUSTFMT=1 " + mainArg //FIXME: try to mount $CARGO_HOME/bin and add it to path using cross - } - switch (targetPlatform) { - case Platform.LINUX: return toWindowsCommandLine("CC=\$ANKIDROID_LINUX_CC ${mainArg} --target x86_64-unknown-linux-gnu") - case Platform.MACOS: - /// x86_64-apple-darwin14-cc - return toWindowsCommandLine("CC=\$ANKIDROID_MACOS_CC ${mainArg} --target x86_64-apple-darwin") - case Platform.WINDOWS: return toWindowsCommandLine("${mainArg} --target x86_64-pc-windows-gnu") - } - throw new IllegalStateException(targetPlatform) -} - -task preBuildWindows(type: Exec) { - dependsOn "buildAnkiWebAssets" - doFirst { - logger.lifecycle(toCommandLine(Platform.WINDOWS).join(" ")) - } - workingDir(getInputDir()) - commandLine(toCommandLine(Platform.WINDOWS)) -} - -task preBuildMac(type: Exec) { - dependsOn "buildAnkiWebAssets" - doFirst { - logger.lifecycle(toCommandLine(Platform.MACOS).join(" ")) - } - - if (!org.gradle.internal.os.OperatingSystem.current().isMacOsX()) { - return - -/* def macCC = System.getenv("ANKIDROID_MACOS_CC") - println "ANKIDROID_MACOS_CC: ${System.getenv("ANKIDROID_MACOS_CC")}" - if (macCC == null || macCC == "") { - throw new IllegalStateException("ANKIDROID_MACOS_CC not set.\n" + - "Please install a MacOS toolchain.\n" + - "See folder: rsdroid-testing/tools and https://wapl.es/rust/2019/02/17/rust-cross-compile-linux-to-macos.html") - }*/ - - } - workingDir(getInputDir()) - commandLine(toCommandLine(Platform.MACOS)) -} - -task preBuildLinux(type: Exec) { - dependsOn "buildAnkiWebAssets" - doFirst { - logger.lifecycle(toCommandLine(Platform.LINUX).join(" ")) - } - workingDir(getInputDir()) - commandLine(toCommandLine(Platform.LINUX)) -} - -task copyLinuxOutput(type: Copy) { - dependsOn preBuildLinux - File linuxDir = new File(targetDir, "x86_64-unknown-linux-gnu/release/") - from linuxDir - include "*.so" - into assetsDir -} - -task copyMacOutput(type: Copy) { - dependsOn preBuildMac - File macosDir = new File(targetDir, "x86_64-apple-darwin/release/") - from macosDir - include "*.dylib" - into assetsDir -} - -task copyWindowsOutput(type: Copy) { - dependsOn preBuildWindows - File windowsDir = new File(targetDir, "x86_64-pc-windows-gnu/release/") - from windowsDir - include "*.dll" - include "*.dll.a" - into assetsDir -} - - -// TODO: check for cargo -// check for targets: x86_64-apple-darwin, x86_64-pc-windows-gnu, TODO: Linux - -Boolean wantAllPlatforms = System.getenv("CURRENT_ONLY") != "true" - -if (wantAllPlatforms || org.gradle.internal.os.OperatingSystem.current().isWindows()) { - processResources.dependsOn preBuildWindows - processResources.dependsOn copyWindowsOutput -} -if (wantAllPlatforms || org.gradle.internal.os.OperatingSystem.current().isLinux()) { - // rustup target add x86_64-pc-windows-gnu --toolchain nightly - // brew install mingw-w64 && x86_64-w64-mingw32-gcc -v - // To fix: "toolchain 'nightly-x86_64-unknown-linux-gnu' is not installed" - // execute in bash: rustup toolchain install nightly-x86_64-unknown-linux-gnu - // "linker `x86_64-unknown-linux-gnu-gcc` not found" - // sudo ln -s /usr/bin/cc /usr/local/bin/x86_64-unknown-linux-gnu-gcc - processResources.dependsOn preBuildLinux - processResources.dependsOn copyLinuxOutput -} -if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) { - // due to restrictions on downloading the MacOS SDK, we can only build for MacOS on MacOS - // > Install a reasonable number of copies of the Apple Software on Apple-branded computers - // https://www.apple.com/legal/sla/docs/xcode.pdf - processResources.dependsOn preBuildMac - processResources.dependsOn copyMacOutput -} - signing { def hasPrivate = project.hasProperty('SIGNING_PRIVATE_KEY') def hasPassword = project.hasProperty('SIGNING_PASSWORD') diff --git a/rsdroid-testing/src/main/java/net/ankiweb/rsdroid/testing/RustBackendLoader.kt b/rsdroid-testing/src/main/java/net/ankiweb/rsdroid/testing/RustBackendLoader.kt index cd06871c4..ece1a2608 100644 --- a/rsdroid-testing/src/main/java/net/ankiweb/rsdroid/testing/RustBackendLoader.kt +++ b/rsdroid-testing/src/main/java/net/ankiweb/rsdroid/testing/RustBackendLoader.kt @@ -38,33 +38,28 @@ object RustBackendLoader { * This call is cached and is a no-op if called multiple times. * * Note the @Synchronized label is misleading - see the docs for loadPath() - * + * * @throws IllegalStateException OS is not Windows, Linux or macOS * @throws RuntimeException Failure when extracting library to load * @throws UnsatisfiedLinkError The library could not be loaded */ @JvmStatic @Synchronized - fun ensureSetup(customPath: String?) { + fun ensureSetup() { if (hasSetUp) { return; } - if (customPath != null) { - print("loading rsdroid-testing with path $customPath") - loadRsdroid(customPath) + // This should help diagnose some issues, + print("loading rsdroid-testing for: " + System.getProperty("os.name")) + if (OS.isFamilyWindows()) { + load("rsdroid", ".dll") + } else if (OS.isFamilyMac()) { + load("librsdroid", ".dylib") + } else if (OS.isFamilyUnix()) { + load("librsdroid", ".so") } else { - // This should help diagnose some issues, - print("loading rsdroid-testing for: " + System.getProperty("os.name")) - if (OS.isFamilyWindows()) { - load("rsdroid", ".dll") - } else if (OS.isFamilyMac()) { - load("librsdroid", ".dylib") - } else if (OS.isFamilyUnix()) { - load("librsdroid", ".so") - } else { - val osName = System.getProperty("os.name") - throw IllegalStateException(String.format("Could not determine OS Type for: '%s'", osName)) - } + val osName = System.getProperty("os.name") + throw IllegalStateException(String.format("Could not determine OS Type for: '%s'", osName)) } hasSetUp = true } @@ -75,16 +70,6 @@ object RustBackendLoader { } } - /** - * Allows unit testing rsdroid under Robolectric

- * Loads (via [Runtime.load]) a librsdroid.so alternative compiled for the current operating system.



- * - * @param filePath A full path to the compiled .dll/.dylib/.so - */ - private fun loadRsdroid(filePath: String) { - loadPath(filePath) - } - /** * loads a named file in the jar via [Runtime.load] * diff --git a/rsdroid/build.gradle b/rsdroid/build.gradle index 8054e250f..3a906711a 100644 --- a/rsdroid/build.gradle +++ b/rsdroid/build.gradle @@ -9,7 +9,7 @@ apply from: "$rootDir/build-web-assets.gradle" def getAnkiCommitHash = { -> def hashStdOut = new ByteArrayOutputStream() exec { - commandLine "git", "-C", new File("${project.rootDir}", "rslib-bridge/anki"), "rev-parse", "HEAD" + commandLine "git", "-C", new File("${project.rootDir}", "anki"), "rev-parse", "HEAD" standardOutput = hashStdOut } def commit = hashStdOut.toString().trim() @@ -61,9 +61,10 @@ cargo { module = "../rslib-bridge" libname = "rsdroid" targets = ["x86", "arm", "x86_64", "arm64"] - profile = 'release' + targetDirectory = "../target" + profile = System.getenv("DEBUG") == "1" ? "debug" : 'release' apiLevel = 21 - verbose = true + verbose = false } apply from: "proto.gradle" @@ -103,13 +104,19 @@ task generateTranslations(type: Exec) { preBuild.dependsOn "generateTranslations" -Boolean wantAllPlatforms = System.getenv("CURRENT_ONLY") != "true" +Boolean wantAllPlatforms = System.getenv("ALL_ARCHS") == "1" +println("Env: ALL_ARCHS=${System.getenv("ALL_ARCHS")}") +println("Env: DEBUG=${System.getenv("DEBUG")}") task cargoBuildTask { if (wantAllPlatforms) { preBuild.dependsOn "cargoBuild" } else { - preBuild.dependsOn "cargoBuildX86_64" + def target = "X86_64" + if (System.getProperty("os.arch") == "aarch64") { + target = "Arm64" + } + preBuild.dependsOn "cargoBuild${target}" } mustRunAfter "buildAnkiWebAssets" diff --git a/rsdroid/proto.gradle b/rsdroid/proto.gradle index f988acf30..f8927fecc 100644 --- a/rsdroid/proto.gradle +++ b/rsdroid/proto.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -def protobufFolder = new File(rootDir, "rslib-bridge/anki/proto").getAbsolutePath() +def protobufFolder = new File(rootDir, "anki/proto").getAbsolutePath() android { if (!new File(protobufFolder).exists()) { diff --git a/rsdroid/src/main/java/net/ankiweb/rsdroid/Backend.kt b/rsdroid/src/main/java/net/ankiweb/rsdroid/Backend.kt index 83da1ba3d..eac9e74c8 100644 --- a/rsdroid/src/main/java/net/ankiweb/rsdroid/Backend.kt +++ b/rsdroid/src/main/java/net/ankiweb/rsdroid/Backend.kt @@ -250,7 +250,7 @@ open class Backend(val context: Context, langs: Iterable = listOf("en"), } private fun checkMainThreadOp(sql: String? = null) { - checkMainThread { + runIfOnMainThread { val stackTraceElements = Thread.currentThread().stackTrace val firstElem = stackTraceElements.filter { val klass = it.className @@ -274,9 +274,9 @@ open class Backend(val context: Context, langs: Iterable = listOf("en"), checkMainThreadOp(query) } - private fun checkMainThread(func: () -> Unit) { + private fun runIfOnMainThread(func: () -> Unit) { try { - if (Looper.getMainLooper().isCurrentThread) { + if (Looper.getMainLooper().thread == Thread.currentThread()) { func() } } catch (exc: NoSuchMethodError) { diff --git a/rsdroid/src/main/java/net/ankiweb/rsdroid/BackendException.kt b/rsdroid/src/main/java/net/ankiweb/rsdroid/BackendException.kt index eb0f44b74..3bf2e6908 100644 --- a/rsdroid/src/main/java/net/ankiweb/rsdroid/BackendException.kt +++ b/rsdroid/src/main/java/net/ankiweb/rsdroid/BackendException.kt @@ -28,7 +28,7 @@ import java.util.regex.Pattern open class BackendException : RuntimeException { private val error: BackendError? - constructor(error: BackendError) : super(error.localized) { + constructor(error: BackendError) : super(error.message) { this.error = error } @@ -74,7 +74,7 @@ open class BackendException : RuntimeException { class BackendDbMissingEntityException(error: BackendError) : BackendException(error) companion object { fun fromDbError(error: BackendError): BackendException { - val localised = error.localized ?: return BackendDbException(error) + val localised = error.message ?: return BackendDbException(error) if (localised.contains("kind: FileTooNew")) { return BackendDbFileTooNewException(error) } diff --git a/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendInvalidInputException.kt b/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendInvalidInputException.kt index b2f530e0b..3ffec4077 100644 --- a/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendInvalidInputException.kt +++ b/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendInvalidInputException.kt @@ -30,7 +30,7 @@ open class BackendInvalidInputException(error: BackendError?) : BackendException class BackendCollectionNotOpenException(error: BackendError?) : BackendInvalidInputException(error) companion object { fun fromInvalidInputError(error: BackendError): BackendInvalidInputException { - when (error.localized) { + when (error.message) { "CollectionAlreadyOpen" -> return BackendCollectionAlreadyOpenException(error) "CollectionNotOpen" -> return BackendCollectionNotOpenException(error) } diff --git a/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendTemplateException.kt b/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendTemplateException.kt index 41240f733..68c215b58 100644 --- a/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendTemplateException.kt +++ b/rsdroid/src/main/java/net/ankiweb/rsdroid/exceptions/BackendTemplateException.kt @@ -22,10 +22,10 @@ open class BackendTemplateException(error: BackendError?) : BackendException(err class BackendTemplateSaveException(error: BackendError?) : BackendTemplateException(error) companion object { fun fromTemplateError(error: BackendError): BackendTemplateException { - if (error.localized == null) { + if (error.message == null) { return BackendTemplateException(error) } - return if (error.localized.contains("has a problem")) { + return if (error.message.contains("has a problem")) { BackendTemplateSaveException(error) } else BackendTemplateException(error) } diff --git a/rslib-bridge/.cargo/config.toml b/rslib-bridge/.cargo/config.toml deleted file mode 100644 index 66c9b3d79..000000000 --- a/rslib-bridge/.cargo/config.toml +++ /dev/null @@ -1,9 +0,0 @@ -[target.x86_64-apple-darwin] -# Required for cross-compilation - not used as we're restricted to build on MacOS by apple ToS. -# So cross-compilation is only required for Linux/Windows, which have more sensible toolchains -# linker = "x86_64-apple-darwin14-clang" -# ar = "x86_64-apple-darwin14-ar" - -[target.x86_64-unknown-linux-gnu] -linker = "x86_64-unknown-linux-gnu-gcc" -ar = "x86_64-unknown-linux-gnu-ar" diff --git a/rslib-bridge/Cargo.toml b/rslib-bridge/Cargo.toml index eb3eb42cc..b2896faac 100644 --- a/rslib-bridge/Cargo.toml +++ b/rslib-bridge/Cargo.toml @@ -1,5 +1,3 @@ -# cargo-features = ["strip"] - [package] name = "rsdroid" version = "0.1.0" @@ -11,8 +9,8 @@ crate_type = ["dylib"] [dependencies] jni = { version = "0.17.0", default-features = false } -anki = { path = "anki/rslib" } -prost = "0.9" +anki = { path = "../anki/rslib" } +prost = "0.11" serde = "1.0.114" serde_json = "1.0.56" serde_derive = "1.0.114" @@ -20,17 +18,9 @@ lazy_static = "1.4.0" num_enum = "0.5.0" itertools = "0.10.0" lexical-core = "0.7.5" - -# picked bundled - TODO: Is this correct? -rusqlite = { version = "0.26.0", features = ["trace", "functions", "collation", "bundled"] } +rusqlite = { version = "0.28.0", features = ["trace", "functions", "collation", "bundled"] } android_logger = "0.11.0" log = "0.4.17" slog = "2.7.0" gag = "1.0.0" slog-envlogger = "2.2.0" - -[features] -no-android = [] - -[build-dependencies] -prost-build = "0.9" diff --git a/rslib-bridge/Cross.toml b/rslib-bridge/Cross.toml deleted file mode 100644 index 865505450..000000000 --- a/rslib-bridge/Cross.toml +++ /dev/null @@ -1,18 +0,0 @@ -[build.env] -passthrough = [ - "RUST_BACKTRACE", - "RUST_LOG", - "RUST_DEBUG", - "DONT_RUSTFMT" -] - -volumes = [ - "OUT_DIR", -] - - -[target.x86_64-unknown-linux-gnu] -image = "ankidroid/rslib-bridge:linux" - -[target.x86_64-pc-windows-gnu] -image = "ankidroid/rslib-bridge:windows" \ No newline at end of file diff --git a/rslib-bridge/Dockerfiles/Dockerfile.linux b/rslib-bridge/Dockerfiles/Dockerfile.linux deleted file mode 100644 index c31cba885..000000000 --- a/rslib-bridge/Dockerfiles/Dockerfile.linux +++ /dev/null @@ -1,5 +0,0 @@ -# rustembedded/cross:x86_64-unknown-linux-gnu -FROM rustembedded/cross@sha256:f4bdeb42de213e8bb5baf6d2064943331d957fa3f24837ce88c1dd4945bf59aa - -# fix for error: linker `x86_64-unknown-linux-gnu-gcc` not found -RUN ln -s /usr/bin/cc /usr/local/bin/x86_64-unknown-linux-gnu-gcc diff --git a/rslib-bridge/Dockerfiles/Dockerfile.windows b/rslib-bridge/Dockerfiles/Dockerfile.windows deleted file mode 100644 index d6275fd43..000000000 --- a/rslib-bridge/Dockerfiles/Dockerfile.windows +++ /dev/null @@ -1,5 +0,0 @@ -# rustembedded/cross:x86_64-pc-windows-gnu -FROM rustembedded/cross@sha256:5005553ddf4e82d4703ee7f458a24802a014f03884f87c6277e9c718765d3517 - -# fix for error: linker `x86_64-unknown-linux-gnu-gcc` not found -RUN ln -s /usr/bin/cc /usr/local/bin/x86_64-unknown-linux-gnu-gcc diff --git a/rslib-bridge/anki b/rslib-bridge/anki deleted file mode 160000 index c7ef2b4d9..000000000 --- a/rslib-bridge/anki +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c7ef2b4d9dede30001790f7c4e3f5fc82cd6dacf diff --git a/rslib-bridge/src/lib.rs b/rslib-bridge/src/lib.rs index 2a52ed06b..f1b23a26f 100644 --- a/rslib-bridge/src/lib.rs +++ b/rslib-bridge/src/lib.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn Java_net_ankiweb_rsdroid_NativeMethods_openBackend( }) .map_err(|err| { BackendError { - localized: err, + message: err, kind: backend_error::Kind::FatalError as i32, ..Default::default() } @@ -46,7 +46,7 @@ pub unsafe extern "C" fn Java_net_ankiweb_rsdroid_NativeMethods_closeBackend( args: jlong, ) { let raw = args as *mut Backend; - Box::from_raw(raw); + drop(Box::from_raw(raw)); } #[no_mangle] @@ -117,8 +117,8 @@ fn pack_result(result: Result, Vec>, env: &JNIEnv) -> jarray { } fn panic_to_anki_error(panic: Box) -> AnkiError { - AnkiError::FatalError( - match panic.downcast_ref::<&'static str>() { + AnkiError::FatalError { + info: match panic.downcast_ref::<&'static str>() { Some(msg) => *msg, None => match panic.downcast_ref::() { Some(msg) => msg.as_str(), @@ -126,5 +126,5 @@ fn panic_to_anki_error(panic: Box) -> AnkiError { }, } .to_string(), - ) + } } diff --git a/rslib-bridge/src/logging.rs b/rslib-bridge/src/logging.rs index 8fce2de40..8795fead8 100644 --- a/rslib-bridge/src/logging.rs +++ b/rslib-bridge/src/logging.rs @@ -74,12 +74,7 @@ fn monitor_io_handle(handle: BufferRedirect) { } fn should_ignore_line(buf: &str) -> bool { - // quieten simulator noise - if buf.starts_with("s_glBindAttribLocation") { - true - } else { - false - } + buf.starts_with("s_glBindAttribLocation") } pub(crate) fn setup_logging() -> Logger { diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..4842915c4 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.65" diff --git a/test-current.sh b/test-current.sh deleted file mode 100755 index b8a496011..000000000 --- a/test-current.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e - -NO_CROSS=true CURRENT_ONLY=true ./gradlew rsdroid:test rsdroid-instrumented:connectedAndroidTest - diff --git a/tools/build-docker-images.sh b/tools/build-docker-images.sh deleted file mode 100755 index d8744742f..000000000 --- a/tools/build-docker-images.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -echo -e "\e[1;33m>>> Building Linux Image\e[0m (x86_64-unknown-linux-gnu) " -docker build -t ankidroid/rslib-bridge:linux . -f ./rslib-bridge/Dockerfiles/Dockerfile.linux - - - -echo -e "\e[1;33m>>> Building Windows Image\e[0m (x86_64-pc-windows-gnu)" -docker build -t ankidroid/rslib-bridge:windows . -f ./rslib-bridge/Dockerfiles/Dockerfile.windows \ No newline at end of file diff --git a/tools/doctor.sh b/tools/doctor.sh index 6578271d9..a2145766e 100755 --- a/tools/doctor.sh +++ b/tools/doctor.sh @@ -29,22 +29,11 @@ ok_echo() { } cecho $lgray"##################################" -cecho $lgray "# AnkiDroidBackend Docker Script #" +cecho $lgray "# AnkiDroidBackend Doctor Script #" cecho $lgray "##################################\n" -cecho $lgray "Getting all submodules recursively" -git submodule update --init --recursive - - -if [[ $(which docker) && $(docker --version) ]]; then - ok_echo "Docker is installed" -else - error_echo "Docker is not installed. please install it first" -fi - - -cecho $lgray "Building docker images" -./tools/build-docker-images.sh +cecho $lgray "Getting anki submodules" +git submodule update --init if [[ -n "$ANDROID_SDK_ROOT" ]]; then @@ -61,17 +50,10 @@ else error_echo "NDK $ANDROID_NDK_VERSION directory found" fi - -cecho $lgray "Installing rust 1.58.1" -rustup install 1.58.1 -rustup default 1.58.1 - - -cecho $lgray "Adding rust android targets" -rustup target add armv7-linux-androideabi # arm -rustup target add i686-linux-android # x86 -rustup target add aarch64-linux-android # arm64 -rustup target add x86_64-linux-android # x86_64 +which cargo || ( + echo "Rustup should be installed" + exit 1 +)) if [ "$(uname)" == "Darwin" ]; then # We do not want to run under Rosetta 2 @@ -91,28 +73,3 @@ if [ "$(uname)" == "Darwin" ]; then echo "Unknown architecture: ${arch_name}" fi fi - -cecho $lgray "Installing cross" -cargo install cross --git https://github.com/rust-embedded/cross/ --tag v0.2.1 # current requires rust-current - - -cecho $lgray "Installing protobuf python libraries" - -if [[ $(protoc --version) ]]; then - ok_echo "Protobuf compiler is installed" -else - error_echo "Protobuf compiler (protoc) is not found" -fi - -if [[ $(pip3 install protobuf) ]]; then - ok_echo "Protobuf python library is installed" -else - echo -e "Try installing with python 3.7" - error_echo "Failed installing Protobuf python libraries" -fi - -if [[ $(pip3 install stringcase) ]]; then - ok_echo "Stringcase is installed" -else - error_echo "Failed installing stringcase python library" -fi \ No newline at end of file diff --git a/tools/genfluent/genfluent.bat b/tools/genfluent/genfluent.bat index f5e1dd0cf..74e3b5121 100644 --- a/tools/genfluent/genfluent.bat +++ b/tools/genfluent/genfluent.bat @@ -1,2 +1,4 @@ @ECHO OFF +set root=%~dp0\..\.. +set PYTHONPATH=%root%\anki\pylib\anki\_vendor python "%~dp0\genfluent.py" \ No newline at end of file diff --git a/tools/genfluent/genfluent.py b/tools/genfluent/genfluent.py index 25fc5062c..d5b12d1da 100755 --- a/tools/genfluent/genfluent.py +++ b/tools/genfluent/genfluent.py @@ -11,23 +11,8 @@ import stringcase import re -def ensure_i18n_module_correct(): - reg = re.compile(r'(\s+)(\S+_(?:commit|zip_csum)) = "(.*)"') - for line in open("rslib-bridge/anki/repos.bzl").readlines(): - m = reg.match(line) - if m: - (indent, key, commit) = m.groups() - if key == "core_i18n_commit": - subprocess.run(["git", "fetch"], cwd="ftl/core", check=True) - subprocess.run(["git", "checkout", commit], cwd="ftl/core", check=True) - break - def get_strings(): - output_file = Path("output.json").absolute() - subprocess.run(["cargo", "run", output_file], check=True, cwd="rslib-bridge/anki/rslib/i18n") - data = json.load(open(output_file)) - output_file.unlink() - return data + return json.loads(Path("anki/out/strings.json").read_text()) modules = get_strings() @@ -123,5 +108,4 @@ def get_args(args: list[Variable]) -> str: [f'"{arg["name"]}" to asTranslateArg(`{stringcase.camelcase(arg["name"])}`)' for arg in args] ) -ensure_i18n_module_correct() write_source() diff --git a/tools/genfluent/genfluent.sh b/tools/genfluent/genfluent.sh index 16551d4d9..fe5eb0bd2 100755 --- a/tools/genfluent/genfluent.sh +++ b/tools/genfluent/genfluent.sh @@ -1,4 +1,4 @@ #!/bin/bash -. tools/setup-python -$PYTHON ./tools/genfluent/genfluent.py +export PYTHONPATH=$(pwd)/anki/pylib/anki/_vendor +anki/out/pyenv/bin/python ./tools/genfluent/genfluent.py diff --git a/tools/get-buildinfo.sh b/tools/get-buildinfo.sh deleted file mode 100755 index e542655d8..000000000 --- a/tools/get-buildinfo.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# -# The buildinfo.txt file should be generated as part of the build, -# but for now we'll just check it into source control. - -if ! bazel --version > /dev/null 2>&1; then - echo "bazel: command not found. Please install Bazelisk. Your distro may have it," - echo "or you can fetch the binary from https://github.com/bazelbuild/bazelisk/releases" - echo "and rename it to /usr/local/bin/bazel" - exit 1 -fi - -(cd rslib-bridge/anki && bazel build -c opt buildinfo.txt) -cp rslib-bridge/anki/.bazel/bin/buildinfo.txt rslib-bridge \ No newline at end of file diff --git a/tools/protoc-gen/protoc-gen.bat b/tools/protoc-gen/protoc-gen.bat index c1b214599..5146f036d 100644 --- a/tools/protoc-gen/protoc-gen.bat +++ b/tools/protoc-gen/protoc-gen.bat @@ -1,2 +1,5 @@ @ECHO OFF -python "%~dp0\protoc-gen.py" \ No newline at end of file +set root=%~dp0\..\.. +set PYTHONPATH=%root%\anki\pylib\anki\_vendor +set PATH=%root%\anki\out\extracted\protoc\bin;%PATH% +%root%\anki\out\pyenv\scripts\python "%~dp0\protoc-gen.py" \ No newline at end of file diff --git a/tools/protoc-gen/protoc-gen.sh b/tools/protoc-gen/protoc-gen.sh index 63912015a..e8051dc52 100755 --- a/tools/protoc-gen/protoc-gen.sh +++ b/tools/protoc-gen/protoc-gen.sh @@ -1,4 +1,6 @@ #!/bin/bash -. tools/setup-python -$PYTHON ./tools/protoc-gen/protoc-gen.py +root=$(dirname $0)/../.. +export PYTHONPATH=$root/anki/pylib/anki/_vendor +export PATH=$root/anki/out/extracted/protoc/bin:"$PATH" +$root/anki/out/pyenv/bin/python $root/tools/protoc-gen/protoc-gen.py diff --git a/tools/setup-python b/tools/setup-python deleted file mode 100644 index f4d651cf2..000000000 --- a/tools/setup-python +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# If `python` in the project folder exists, use it instead of the global python. -# - -if [ -e python ]; then - PYTHON=$(readlink $(pwd)/python) -else - PYTHON=$(which python3) -fi - diff --git a/tools/web/build-web-assets.bat b/tools/web/build-web-assets.bat new file mode 100644 index 000000000..599b1fc9e --- /dev/null +++ b/tools/web/build-web-assets.bat @@ -0,0 +1,15 @@ +set root=%~dp0\..\.. +set build=%root%\rsdroid\build\generated\anki_artifacts +set web=%build%\web +if not exist %web% ( + mkdir %web% +) + +cd anki +call tools\ninja extract:protoc ts:reviewer:reviewer_extras_bundle.js qt/aqt:data/web/pages || exit /b 1 + +copy out\ts\reviewer\reviewer_extras_bundle.js %web% || exit /b 1 +copy out\qt\_aqt\data\web\pages\*.* %web% || exit /b 1 +copy cargo\licenses.json %web% || exit /b 1 +copy ts\licenses.json %web% || exit /b 1 + diff --git a/tools/web/build-web-assets.ps1 b/tools/web/build-web-assets.ps1 deleted file mode 100644 index 1047951a4..000000000 --- a/tools/web/build-web-assets.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -$SRC_DIR = (Get-Item .).FullName -$ROOT_DIR = (Get-Item D:/a/).FullName -$ANKI_SRC = (Get-Item $SRC_DIR/rslib-bridge/anki).FullName -$TEMP_DIR = (Get-Item $ENV:TEMP).FullName - -New-Item -P $SRC_DIR/rsdroid/build/generated/anki_artifacts/web -itemType Directory -$BUILD_DIR = (Get-Item $SRC_DIR/rsdroid/build/generated/anki_artifacts).FullName - -Set-Location -Path $ANKI_SRC - -bazel --output_user_root=$ROOT_DIR/_bzl build -c opt buildinfo.txt --symlink_prefix=$TEMP_DIR/.bazel/ --verbose_failures -Copy-Item -Path $TEMP_DIR/.bazel/bin/buildinfo.txt -Destination $BUILD_DIR/buildinfo.txt -PassThru - -bazel --output_user_root=$ROOT_DIR/_bzl build ts/reviewer/reviewer_extras_bundle --symlink_prefix=$TEMP_DIR/.bazel/ --verbose_failures -Copy-Item -Path $TEMP_DIR/.bazel/bin/ts/reviewer/reviewer_extras_bundle.js -Destination $BUILD_DIR/web -PassThru - -bazel --output_user_root=$ROOT_DIR/_bzl build qt/aqt/data/web/pages --symlink_prefix=$TEMP_DIR/.bazel/ --verbose_failures -Get-Childitem $TEMP_DIR/.bazel/bin/qt/aqt/data/web/pages -Recurse -Include *.html,*.js,*.css | Copy-Item -Destination $BUILD_DIR/web -PassThru - -Copy-Item -Path $ANKI_SRC/cargo/licenses.json -Destination $BUILD_DIR/web/licenses-cargo.json -PassThru -Copy-Item -Path $ANKI_SRC/ts/licenses.json -Destination $BUILD_DIR/web/licenses-ts.json -PassThru diff --git a/tools/web/build-web-assets.sh b/tools/web/build-web-assets.sh index d9c0e0150..8312f342e 100755 --- a/tools/web/build-web-assets.sh +++ b/tools/web/build-web-assets.sh @@ -1,32 +1,18 @@ #!/bin/bash -# build web assets with anki submodule in rslib-bridge +# build web assets with anki submodule set -e -# check if bazel exist or not -if ! bazel --version > /dev/null 2>&1; then - echo "bazel: command not found. Please install Bazelisk. Your distro may have it," - echo "or you can fetch the binary from https://github.com/bazelbuild/bazelisk/releases" - echo "and rename it to /usr/local/bin/bazel" - exit 1 -fi - SRC_DIR=$(pwd) -ANKI_SRC=$SRC_DIR/rslib-bridge/anki +ANKI_SRC=$SRC_DIR/anki BUILD_DIR=$SRC_DIR/rsdroid/build/generated/anki_artifacts mkdir -p $BUILD_DIR/web -# build buildinfo.txt, reviewer_extras_bundle and pages files +# build reviewer_extras_bundle and pages files cd $ANKI_SRC -bazel build --symlink_prefix=/tmp/.bazel/ -c opt buildinfo.txt -cp /tmp/.bazel/bin/buildinfo.txt $BUILD_DIR/buildinfo.txt - -bazel build ts/reviewer/reviewer_extras_bundle --symlink_prefix=/tmp/.bazel/ -cp /tmp/.bazel/bin/ts/reviewer/reviewer_extras_bundle.js $BUILD_DIR/web - -bazel build qt/aqt/data/web/pages --symlink_prefix=/tmp/.bazel/ -cp -r /tmp/.bazel/bin/qt/aqt/data/web/pages/* $BUILD_DIR/web +./ninja extract:protoc ts:reviewer:reviewer_extras_bundle.js qt/aqt:data/web/pages +cp out/qt/_aqt/data/web/pages/* out/ts/reviewer/reviewer_extras_bundle.js $BUILD_DIR/web/ cp $ANKI_SRC/cargo/licenses.json $BUILD_DIR/web/licenses-cargo.json cp $ANKI_SRC/ts/licenses.json $BUILD_DIR/web/licenses-ts.json