Skip to content

Commit

Permalink
refactor: migrate flutter to android
Browse files Browse the repository at this point in the history
  • Loading branch information
hpp2334 committed Nov 23, 2024
1 parent 0dfeaf5 commit 79e12d9
Show file tree
Hide file tree
Showing 425 changed files with 21,273 additions and 18,426 deletions.
35 changes: 15 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,35 @@ jobs:
~/.cargo/git/db/
key: ${{ runner.os }}-cargo
restore-keys: ${{ runner.os }}-cargo
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.2"
channel: "stable"
- uses: oven-sh/setup-bun@v2
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25c
ndk-version: r28-beta2
add-to-path: false
local-cache: true
- name: Set Up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: Install scripts runtime
run: pnpm install
run: bun install
- name: Install cargo-ndk
run: |
cargo install --locked cargo-ndk || true
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
- name: Install flutter dependencies
run: flutter pub get
- name: Install flutter rust bridge
run: |
cargo install --locked [email protected] || true
cargo install --locked '[email protected]' || true
- name: Generate codes
run: pnpm run generate
rustup target add aarch64-linux-android
- name: Build JNI
run: bun run build:jni
- name: Run tests
run: pnpm run test
run: bun run test
- name: Build APK
if: ${{ startsWith(github.ref, 'refs/tags/v') }} || ${{ startsWith(github.ref, 'refs/tags/pre-v') }}
run: |
mkdir -p ~/.gradle
echo "ANDROID_NDK=$ANDROID_NDK_HOME" >> ~/.gradle/gradle.properties
pnpm run build:apk
bun run build:apk
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_SIGN_JKS: ${{ secrets.ANDROID_SIGN_JKS }}
Expand Down
22 changes: 9 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ migrate_working_dir/
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
/lib/bridge_generated.dart

# Symbolication related
app.*.symbols

Expand All @@ -44,8 +32,16 @@ app.*.map.json
/android/app/profile
/android/app/release

# Sign
/android/root.jks
/android/key.properties

# Scripts
/node_modules

# Output
/artifacts
/artifacts


rust-libs/ease-client-backend/src/controllers/generated.rs
rust-libs/ease-client-shared/src/backends/generated.rs
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ease Music Player

Ease Music Player is a lightweight music player, written in rust and flutter.
Ease Music Player is a lightweight music player, written in Rust and Jetpack Compose.

Features
----
Expand All @@ -11,7 +11,29 @@ Features
ScreenShot
----

![screenshot](./screenshots/screenshot.png)
![screenshot](./screenshots/Screenshots.webp)

FAQ
----

### Why was this application developed?

The primary purpose of this application is to experiment with the feasibility and paradigm of writing core logic in Rust and using other languages (such as Android Kotlin in Android) to write the UI layer.


### Why did the switch from Flutter to Jetpack Compose occur?

[In version 0.1](https://github.com/hpp2334/ease-music-player/tree/feat/flutter), the application was implemented using Rust + Flutter. After some time of use, several issues were discovered, such as:

- Flutter's complexity in cross-platform development, especially when dealing with platform-specific features.

- Difficulty in finding solutions for some minor issues, such as the absence of system-provided crash dialogs when the program crashes.

- Redundancy in "cross-platform" capabilities when compared to Rust.

- ...

Due to the reasons above, the current version uses Jetpack Compose to better integrate with the Android platform.

License
----
Expand Down
29 changes: 0 additions & 29 deletions analysis_options.yaml

This file was deleted.

27 changes: 14 additions & 13 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
*.iml
.gradle
/local.properties
/app/src/main/jniLibs
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions android/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build
/src/main/java/uniffi
/src/main/jniLibs
111 changes: 0 additions & 111 deletions android/app/build.gradle

This file was deleted.

Loading

0 comments on commit 79e12d9

Please sign in to comment.