Merge branch 'AppFlowy-IO:main' into main

This commit is contained in:
Hari07 2021-11-23 21:08:02 +05:30 committed by GitHub
commit 5c5f0f6a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 74 additions and 82 deletions

View File

@ -5,17 +5,47 @@ on:
pull_request:
branches: [main]
jobs:
sdk-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup toolchain install nightly
rustup default nightly
- name: Frontend tests
run: cd frontend/rust-lib && cargo test
- name: Shared-lib tests
run: cd shared-lib && cargo test
build-macos:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Env install
run: cd frontend && make install_rust && make install_cargo_make && cargo make install_targets
- name: Run frontend tests
run: cd frontend/rust-lib && cargo test
- name: Run shared-lib tests
run: cd shared-lib && cargo test
run: cd frontend && make install_rust
- name: Flutter
run: |
git clone --depth 1 -b dev https://github.com/flutter/flutter.git
cd flutter
echo `pwd`"/bin" >> $GITHUB_PATH
export PATH="$PATH:`pwd`/bin"
flutter channel dev
flutter config --enable-macos-desktop
flutter doctor
- name: Deps
run: |
cd frontend
cargo install --force cargo-make
cargo install --force duckscript_cli
cargo make flowy_dev
- name: Build
run: |
cd frontend
cargo make --profile production-mac-x86 appflowy
build-ubuntu:
runs-on: ubuntu-latest
steps:
@ -35,7 +65,7 @@ jobs:
rustup default nightly
- name: Flutter
run: |
git clone https://github.com/flutter/flutter.git
git clone --depth 1 -b dev https://github.com/flutter/flutter.git
cd flutter
echo `pwd`"/bin" >> $GITHUB_PATH
export PATH="$PATH:`pwd`/bin"
@ -48,4 +78,7 @@ jobs:
cargo install --force cargo-make
cargo install --force duckscript_cli
cargo make flowy_dev
cargo make -p development-linux-x86 appflowy-linux-dev
- name: Build
run: |
cd frontend
cargo make --profile production-linux-x86 appflowy

2
.gitignore vendored
View File

@ -12,4 +12,4 @@ Cargo.lock
**/*.db
.idea/
/flowy-test/
.ruby-version
.ruby-version

View File

@ -52,16 +52,16 @@ cargo make -p development-windows pb
10. Build flowy-sdk (dart-ffi)
```shell
# for development
cargo make --profile development-desktop-windows-x86 flowy-sdk-dev
cargo make --profile development-windows-x86 flowy-sdk-dev
# for production
cargo make --profile production-desktop-windows-x86 flowy-sdk-release
cargo make --profile production-windows-x86 flowy-sdk-release
```
11. Build app_flowy
```shell
# for development
cargo make -p development-desktop-windows-x86 appflowy-windows-dev
cargo make -p development-windows-x86 appflowy-windows-dev
# for production
cargo make -p production-desktop-windows-x86 appflowy-windows
cargo make -p production-windows-x86 appflowy-windows
```
## Step 3: Build Server side application (optional if you don't need to host web service locally)

View File

@ -27,14 +27,14 @@ BUILD_FLAG = "debug"
FLUTTER_OUTPUT_DIR = "Debug"
PRODUCT_EXT = "app"
[env.production-desktop-mac-aarch64]
[env.production-mac-aarch64]
BUILD_FLAG = "release"
TARGET_OS = "macos"
RUST_COMPILE_TARGET = "aarch64-apple-darwin"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_EXT = "app"
[env.production-desktop-mac-x86]
[env.production-mac-x86]
BUILD_FLAG = "release"
TARGET_OS = "macos"
RUST_COMPILE_TARGET = "x86_64-apple-darwin"
@ -42,7 +42,7 @@ FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_EXT = "app"
[env.development-desktop-windows-x86]
[env.development-windows-x86]
TARGET_OS = "windows"
RUST_COMPILE_TARGET = "x86_64-pc-windows-msvc"
BUILD_FLAG = "debug"
@ -51,7 +51,7 @@ PRODUCT_EXT = "exe"
CRATE_TYPE = "cdylib"
SDK_EXT = "dll"
[env.production-desktop-windows-x86]
[env.production-windows-x86]
BUILD_FLAG = "release"
TARGET_OS = "windows"
RUST_COMPILE_TARGET = "x86_64-pc-windows-msvc"
@ -99,6 +99,7 @@ LINUX_ARCH = "arm64"
[tasks.echo_env]
script = [
'''
echo "-------- Env Parameters --------"
echo CRATE_TYPE: ${CRATE_TYPE}
echo BUILD_FLAG: ${BUILD_FLAG}
echo TARGET_OS: ${TARGET_OS}
@ -106,9 +107,15 @@ script = [
echo FEATURES: ${FEATURES}
echo PRODUCT_EXT: ${PRODUCT_EXT}
echo ${platforms}
echo "-------- Flutter --------"
flutter doctor
echo "-------- Rust --------"
rustup show
'''
]
script_runner = "@duckscript"
script_runner = "@shell"
[env.production-ios]
BUILD_FLAG = "release"

View File

@ -15,3 +15,7 @@ x86/
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
flutter/generated_plugin_registrant.cc
flutter/generated_plugin_registrant.h
flutter/generated_plugins.cmake

View File

@ -1,26 +0,0 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <flowy_editor/flowy_editor_plugin.h>
#include <flowy_infra_ui/flowy_infra_u_i_plugin.h>
#include <flowy_sdk/flowy_sdk_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <window_size/window_size_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
FlowyEditorPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlowyEditorPlugin"));
FlowyInfraUIPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlowyInfraUIPlugin"));
FlowySdkPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlowySdkPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WindowSizePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowSizePlugin"));
}

View File

@ -1,15 +0,0 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter/plugin_registry.h>
// Registers Flutter plugins.
void RegisterPlugins(flutter::PluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_

View File

@ -1,20 +0,0 @@
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
flowy_editor
flowy_infra_ui
flowy_sdk
url_launcher_windows
window_size
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

View File

@ -59,6 +59,7 @@ fn crate_log_filter(level: Option<String>) -> String {
#[derive(Clone)]
pub struct FlowySDK {
#[allow(dead_code)]
config: FlowySDKConfig,
pub user_session: Arc<UserSession>,
pub flowy_document: Arc<FlowyDocument>,

View File

@ -17,6 +17,7 @@ use std::{
#[derive(Clone, Debug, Derivative)]
pub struct EventRequest {
#[allow(dead_code)]
pub(crate) id: String,
pub(crate) event: Event,
#[derivative(Debug = "ignore")]

View File

@ -101,6 +101,7 @@ pub struct DatabaseCustomizerConfig {
pub(crate) journal_mode: SQLiteJournalMode,
pub(crate) synchronous: SQLiteSynchronous,
pub(crate) busy_timeout: i32,
#[allow(dead_code)]
pub(crate) secure_delete: bool,
}

View File

@ -1,3 +1,3 @@
echo "Start building rust sdk"
rustup show
cargo make --profile development-desktop-windows-x86 flowy-sdk-dev
cargo make --profile development-windows-x86 flowy-sdk-dev

View File

@ -2,7 +2,7 @@
# Run the task with profile, e.g.
# cargo make --profile development-mac flowy-sdk-dev
# cargo make --profile production-desktop-windows-x86 flowy-sdk-dev
# cargo make --profile production-windows-x86 flowy-sdk-dev
[tasks.env_check]
dependencies = ["echo_env"]

View File

@ -1,5 +1,5 @@
[tasks.flowy_dev]
run_task = { name = ["install_prerequests","install_diesel", "install_protobuf"] }
run_task = { name = ["install_prerequests","install_diesel"] }
[tasks.install_windows_deps.windows]
dependencies=["check_duckscript_installation", "check_visual_studio_installation", "check_vcpkg", "install_vcpkg_sqlite", "install_rust_vcpkg_cli"]
@ -66,6 +66,8 @@ dependencies = ["check_vcpkg"]
[tasks.install_targets]
script = """
# TODO: download the targets with corresponding platform. For example:
# It's not necessary to download aarch64-apple-ios when compiling the Flowy-SDK on windows.
rustup target add x86_64-apple-ios
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-ios
@ -90,7 +92,7 @@ script = """
#https://pub.dev/packages/protoc_plugin
dart pub global activate protoc_plugin
cargo install --version 2.20.0 protobuf-codegen
cargo install --version 2.22.1 protobuf-codegen
"""
[tasks.install_protobuf.windows]

View File

@ -4,7 +4,10 @@ const MAX_UNDOS: usize = 20;
#[derive(Debug, Clone)]
pub struct UndoResult {
#[allow(dead_code)]
success: bool,
#[allow(dead_code)]
len: usize,
}
@ -16,6 +19,7 @@ impl UndoResult {
#[derive(Debug, Clone)]
pub struct History {
#[allow(dead_code)]
cur_undo: usize,
undos: Vec<Delta>,
redoes: Vec<Delta>,