Skip to content

Commit c3c8390

Browse files
committed
fix: Address code review feedback
- Remove .history folders from commit - Fix 'macOS' spelling (was 'MacOS') - Add armeabi-v7a target to Windows Android build scripts for ABI parity - Remove duplicated Android setup instructions, reference dedicated guide instead - Remove unrelated Android app files from commit scope Addresses feedback from PR #8163
1 parent 6b84c4b commit c3c8390

File tree

6 files changed

+290
-30
lines changed

6 files changed

+290
-30
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ AppFlowy is the AI workspace where you achieve more without losing control of yo
6363

6464
## Getting Started with development
6565

66-
Please view the [documentation](https://docs.appflowy.io/docs/documentation/appflowy/from-source) for OS specific
67-
development instructions
66+
Please view our comprehensive [build from source guide](doc/BUILD_FROM_SOURCE.md) for detailed OS-specific development instructions, including desktop and mobile platform support.
67+
68+
For additional documentation, visit [docs.appflowy.io](https://docs.appflowy.io/docs/documentation/appflowy/from-source).
6869

6970
## Roadmap
7071

doc/BUILD_FROM_SOURCE.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# Building AppFlowy from Source
2+
3+
This guide provides comprehensive instructions for building AppFlowy from source code on all supported platforms.
4+
5+
## Prerequisites
6+
7+
Before building AppFlowy, ensure you have the following installed:
8+
9+
### All Platforms
10+
- [Git](https://git-scm.com/)
11+
- [Rust](https://rustup.rs/) (1.70 or later)
12+
- [Flutter](https://flutter.dev/docs/get-started/install) (3.13.19 or later)
13+
- [cargo-make](https://github.com/sagiegurari/cargo-make) - Install with: `cargo install cargo-make`
14+
15+
### Platform-Specific Requirements
16+
17+
#### Windows
18+
- [Visual Studio 2019/2022](https://visualstudio.microsoft.com/) with C++ development tools
19+
- [vcpkg](https://github.com/microsoft/vcpkg)
20+
21+
#### macOS
22+
- Xcode Command Line Tools: `xcode-select --install`
23+
24+
#### Linux
25+
- Build essentials: `sudo apt install build-essential pkg-config libssl-dev`
26+
- Additional dependencies: `sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev`
27+
28+
## Building for Desktop
29+
30+
### 1. Clone the Repository
31+
```bash
32+
git clone https://github.com/AppFlowy-IO/AppFlowy.git
33+
cd AppFlowy
34+
```
35+
36+
### 2. Build for Your Platform
37+
38+
#### Windows
39+
```bash
40+
cd frontend
41+
cargo make appflowy-windows
42+
```
43+
44+
#### macOS
45+
```bash
46+
cd frontend
47+
cargo make appflowy-macos
48+
```
49+
50+
#### Linux
51+
```bash
52+
cd frontend
53+
cargo make appflowy-linux
54+
```
55+
56+
### 3. Run the Application
57+
58+
After building, the executable will be located in:
59+
- **Windows**: `frontend/appflowy_flutter/product/[version]/windows/Release/AppFlowy/`
60+
- **macOS**: `frontend/appflowy_flutter/product/[version]/macos/Release/AppFlowy.app/`
61+
- **Linux**: `frontend/appflowy_flutter/product/[version]/linux/Release/AppFlowy/`
62+
63+
## Building for Mobile
64+
65+
### iOS
66+
67+
#### Prerequisites
68+
- macOS with Xcode installed
69+
- iOS development setup for Flutter
70+
71+
#### Build Steps
72+
```bash
73+
cd frontend
74+
cargo make appflowy-ios
75+
```
76+
77+
The iOS app will be built and available in `frontend/appflowy_flutter/build/ios/`.
78+
79+
### Android
80+
81+
#### Prerequisites
82+
83+
**All Platforms:**
84+
- [Android NDK](https://developer.android.com/ndk/downloads/) version 24
85+
- cargo-ndk: `cargo install cargo-ndk`
86+
87+
#### Detailed Setup Instructions
88+
89+
For comprehensive Android build setup including Windows support, please refer to the [Android-specific build guide](../frontend/appflowy_flutter/android/README.md) which covers:
90+
91+
- Platform-specific environment variable setup
92+
- Cargo configuration for all operating systems
93+
- NDK 24 clang fixes
94+
- Path configuration
95+
- Troubleshooting common issues
96+
97+
#### Build Steps
98+
```bash
99+
cd frontend
100+
cargo make appflowy-android
101+
```
102+
103+
The Android APK will be built and available in `frontend/appflowy_flutter/build/app/outputs/flutter-apk/`.
104+
105+
## Development Builds
106+
107+
For faster development builds without optimizations:
108+
109+
### Desktop Development
110+
```bash
111+
cd frontend
112+
cargo make appflowy-dev # Uses platform-specific aliases
113+
```
114+
115+
### Mobile Development
116+
```bash
117+
# iOS development build
118+
cd frontend
119+
cargo make appflowy-ios-dev
120+
121+
# Android development build
122+
cd frontend
123+
cargo make appflowy-android-dev
124+
```
125+
126+
## Troubleshooting
127+
128+
### Common Issues
129+
130+
1. **Flutter Doctor Issues**: Run `flutter doctor` to check for missing dependencies
131+
2. **Rust Version**: Ensure you're using Rust 1.70 or later
132+
3. **Path Issues**: Make sure all tools are in your system PATH
133+
4. **NDK Issues**: Verify ANDROID_NDK_HOME is set correctly
134+
135+
### Platform-Specific Issues
136+
137+
#### Windows
138+
- Ensure Visual Studio C++ tools are installed
139+
- Check that vcpkg is properly configured
140+
- Use PowerShell or Command Prompt, not Git Bash for building
141+
142+
#### macOS
143+
- Ensure Xcode Command Line Tools are installed
144+
- For iOS builds, you need a full Xcode installation
145+
146+
#### Linux
147+
- Install all required system dependencies
148+
- Check that pkg-config can find required libraries
149+
150+
### Getting Help
151+
152+
- Check the [AppFlowy Documentation](https://docs.appflowy.io/)
153+
- Join our [Discord](https://discord.gg/9Q2xaN37tV) for community support
154+
- Report issues on [GitHub](https://github.com/AppFlowy-IO/AppFlowy/issues)
155+
156+
## Additional Resources
157+
158+
- [AppFlowy Development Guide](https://docs.appflowy.io/docs/documentation/appflowy/from-source)
159+
- [Contributing Guidelines](CONTRIBUTING.md)
160+
- [Android-specific instructions](../frontend/appflowy_flutter/android/README.md)

frontend/appflowy_flutter/.metadata

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
8-
channel: unknown
7+
revision: "d8a9f9a52e5af486f80d932e838ee93861ffd863"
8+
channel: "[user-branch]"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
17-
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
16+
create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
17+
base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
1818
- platform: android
19-
create_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
20-
base_revision: 682aa387cfe4fbd71ccd5418b2c2a075729a1c66
19+
create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
20+
base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863
2121

2222
# User provided section
2323

frontend/appflowy_flutter/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ To contribute to `AppFlowy_Flutter` codebase specifically (coding contribution)
3232

3333
### What OS should I use for development?
3434

35-
We support all OS for Development i.e. Linux, MacOS and Windows. However, most of us promote macOS and Linux over Windows. We have detailed [docs](https://docs.appflowy.io/docs/documentation/appflowy/from-source/environment-setup) on how to setup `AppFlowy_Flutter` on your local system respectively per operating system.
35+
We support all OS for Development i.e. Linux, macOS and Windows. We have detailed documentation on how to setup `AppFlowy_Flutter` on your local system for each operating system:
36+
37+
- [Build from Source Guide](../../doc/BUILD_FROM_SOURCE.md) - Comprehensive setup instructions for all platforms
38+
- [Android-specific Guide](android/README.md) - Detailed Android build instructions including Windows support
39+
- [Online Documentation](https://docs.appflowy.io/docs/documentation/appflowy/from-source/environment-setup) - Additional setup resources
3640

3741
### Getting Started ❇
3842

frontend/appflowy_flutter/android/README.md

Lines changed: 75 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,28 @@ When compiling for android we need the following pre-requisites:
1212
- [Download](https://developer.android.com/ndk/downloads/) Android NDK version 24.
1313
- When downloading Android NDK you can get the compressed version as a standalone from the site.
1414
Or you can download it through [Android Studio](https://developer.android.com/studio).
15-
- After downloading the two you need to set the environment variables. For Windows that's a separate process.
16-
On macOS and Linux the process is similar.
15+
- After downloading the two you need to set the environment variables. The process differs by operating system.
1716
- The variables needed are '$ANDROID_NDK_HOME', this will point to where the NDK is located.
17+
18+
**Setting Environment Variables**
19+
20+
**Windows:**
21+
```cmd
22+
set ANDROID_NDK_HOME=C:\Users\%USERNAME%\AppData\Local\Android\Sdk\ndk\24.0.8215888
23+
```
24+
Or add to your system environment variables permanently.
25+
26+
**macOS/Linux:**
27+
```bash
28+
export ANDROID_NDK_HOME=~/Android/Sdk/ndk/24.0.8215888
29+
```
1830
---
1931

2032
**Cargo Config File**
21-
This code needs to be written in ~/.cargo/config, this helps cargo know where to locate the android tools(linker and archiver).
22-
**NB** Keep in mind just replace 'user' with your own user name. Or just point it to the location of where you put the NDK.
33+
This code needs to be written in `~/.cargo/config` (Linux/macOS) or `%USERPROFILE%\.cargo\config` (Windows). This helps cargo know where to locate the android tools (linker and archiver).
34+
**NB** Replace the paths with your actual NDK installation location.
2335

36+
**Linux/macOS:**
2437
```toml
2538
[target.aarch64-linux-android]
2639
ar = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
@@ -39,26 +52,68 @@ ar = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86
3952
linker = "/home/user/Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android29-clang"
4053
```
4154

55+
**Windows:**
56+
```toml
57+
[target.aarch64-linux-android]
58+
ar = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\llvm-ar.exe"
59+
linker = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\aarch64-linux-android29-clang.exe"
60+
61+
[target.armv7-linux-androideabi]
62+
ar = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\llvm-ar.exe"
63+
linker = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\armv7a-linux-androideabi29-clang.exe"
64+
65+
[target.i686-linux-android]
66+
ar = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\llvm-ar.exe"
67+
linker = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\i686-linux-android29-clang.exe"
68+
69+
[target.x86_64-linux-android]
70+
ar = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\llvm-ar.exe"
71+
linker = "C:\\Users\\%USERNAME%\\AppData\\Local\\Android\\Sdk\\ndk\\24.0.8215888\\toolchains\\llvm\\prebuilt\\windows-x86_64\\bin\\x86_64-linux-android29-clang.exe"
72+
```
73+
4274
**Clang Fix**
43-
In order to get clang to work properly with version 24 you need to create this file.
44-
libgcc.a, then add this one line.
45-
```
46-
INPUT(-lunwind)
47-
```
48-
49-
**Folder path: 'Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux'.**
50-
After that you have to copy this file into three different folders namely aarch64, arm, i386 and x86_64.
51-
We have to do this so we Android NDK can find clang on our system, if we used NDK 22 we wouldn't have to do this process.
52-
Though using NDK v22 will not give us a lot of features to work with.
75+
In order to get clang to work properly with version 24 you need to create this file.
76+
Create a file named `libgcc.a` with this one line:
77+
```
78+
INPUT(-lunwind)
79+
```
80+
81+
**Linux/macOS:**
82+
Folder path: `Android/Sdk/ndk/24.0.8215888/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.1/lib/linux/`
83+
84+
**Windows:**
85+
Folder path: `Android\Sdk\ndk\24.0.8215888\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\14.0.1\lib\linux\`
86+
87+
After creating the file, copy it into four different folders: `aarch64`, `arm`, `i386` and `x86_64`.
88+
We have to do this so the Android NDK can find clang on our system. If we used NDK 22 we wouldn't have to do this process, though using NDK v22 will not give us a lot of features to work with.
5389
This GitHub [issue](https://github.com/fzyzcjy/flutter_rust_bridge/issues/419) explains the reason why we are doing this.
5490

5591
---
5692

57-
**Android NDK**
93+
**Android NDK Path Setup**
94+
95+
After installing the NDK tools for Android you should add the NDK path to your system PATH.
5896

59-
After installing the NDK tools for android you should export the PATH to your config file
60-
(.vimrc, .zshrc, .profile, .bashrc file), That way it can be found.
97+
**Linux/macOS:**
98+
Add to your shell config file (.bashrc, .zshrc, .profile):
99+
```bash
100+
export PATH=$PATH:~/Android/Sdk/ndk/24.0.8215888
101+
```
102+
103+
**Windows:**
104+
Add to your system PATH environment variable or add to PowerShell profile:
105+
```powershell
106+
$env:PATH += ";C:\Users\$env:USERNAME\AppData\Local\Android\Sdk\ndk\24.0.8215888"
107+
```
108+
109+
**Building AppFlowy Android**
110+
111+
Once you have completed the setup above, you can build AppFlowy for Android using:
112+
113+
**All platforms:**
114+
```bash
115+
cd frontend
116+
cargo make appflowy-android
117+
```
61118

62-
```vim
63-
export PATH=/home/sean/Android/Sdk/ndk/24.0.8215888
64-
```
119+
This will use the appropriate build scripts for your platform (Windows, macOS, or Linux).

frontend/scripts/makefile/mobile.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ run_task = { name = [
7676
] }
7777

7878
[tasks.sdk-build-android]
79+
mac_alias = "sdk-build-android-unix"
80+
linux_alias = "sdk-build-android-unix"
81+
windows_alias = "sdk-build-android-windows"
82+
83+
[tasks.sdk-build-android-unix]
7984
dependencies = ["set-app-version"]
8085
private = true
8186
script = [
@@ -93,8 +98,31 @@ script = [
9398
]
9499
script_runner = "@shell"
95100

101+
[tasks.sdk-build-android-windows]
102+
dependencies = ["set-app-version"]
103+
private = true
104+
script = [
105+
"""
106+
cd rust-lib
107+
if eq ${BUILD_FLAG} debug
108+
echo "🚀 🚀 🚀 Building Android SDK for debug"
109+
exec cargo ndk -t arm64-v8a -t armeabi-v7a -o ./jniLibs build --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi
110+
else
111+
echo "🚀 🚀 🚀 Building Android SDK for release"
112+
exec cargo ndk -t arm64-v8a -t armeabi-v7a -o ./jniLibs build --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi --release
113+
end
114+
cd ..
115+
""",
116+
]
117+
script_runner = "@duckscript"
118+
96119
# only use in CI job
97120
[tasks.sdk-build-android-ci]
121+
mac_alias = "sdk-build-android-ci-unix"
122+
linux_alias = "sdk-build-android-ci-unix"
123+
windows_alias = "sdk-build-android-ci-windows"
124+
125+
[tasks.sdk-build-android-ci-unix]
98126
dependencies = ["set-app-version"]
99127
private = true
100128
script = [
@@ -106,6 +134,18 @@ script = [
106134
]
107135
script_runner = "@shell"
108136

137+
[tasks.sdk-build-android-ci-windows]
138+
dependencies = ["set-app-version"]
139+
private = true
140+
script = [
141+
"""
142+
cd rust-lib
143+
exec cargo ndk -t arm64-v8a -t armeabi-v7a -o ./jniLibs build --features "${FLUTTER_DESKTOP_FEATURES}" --package=dart-ffi
144+
cd ..
145+
""",
146+
]
147+
script_runner = "@duckscript"
148+
109149
[tasks.post-mobile-ios]
110150
private = true
111151
script = [

0 commit comments

Comments
 (0)