Skip to content

Latest commit

 

History

History
112 lines (85 loc) · 4.73 KB

BUILDING.md

File metadata and controls

112 lines (85 loc) · 4.73 KB

Building Kaiteki

Prerequisites

  • Flutter
    • Kaiteki is running on the Flutter master branch. Prefer checking the SDK releases page.
    • Change the branch of your Flutter SDK installation with flutter channel master and then flutter upgrade.
  • Melos
    • Kaiteki uses melos for managing dart projects as a monorepo
  • A supported IDE like Visual Studio Code, IntelliJ, or Android Studio (optional)
  • Build tools for the platform you want to compile for

Cloning and updating submodules

Note Kaiteki stores its translations inside another repository and includes them via a submodule, so it's important to update and initialize them before compiling.

git clone https://github.com/Kaiteki-Fedi/Kaiteki.git
git submodule update --init

Preparing the project

$ melos bootstrap # Bootstrap melos and get packages
melos bootstrap
  └> /home/user/Documents/GitHub/Kaiteki

Running "flutter pub get" in workspace packages...
  ✓ kaiteki_unicode_generator
    └> packages/kaiteki_unicode_generator
  ✓ kaiteki_ui
    └> packages/kaiteki_ui
  ✓ fediverse_objects
    └> packages/fediverse_objects
  ✓ kaiteki_core
    └> packages/kaiteki_core
  ✓ kaiteki_core_backends
    └> packages/kaiteki_core_backends
  ✓ kaiteki_lints
    └> packages/kaiteki_lints
  ✓ kaiteki_l10n
    └> packages/kaiteki_l10n
  ✓ kaiteki
    └> packages/kaiteki
  > SUCCESS

Generating IntelliJ IDE files...
  > SUCCESS

 -> 8 packages bootstrapped

$ melos run build_runner # (Re-)generated generated source code
melos run build_runner
  └> melos exec -c 1 -- "dart run build_runner build --delete-conflicting-outputs"> RUNNING

Select a package to run the build_runner script:

1) * [Default - Press Enter]
2) fediverse_objects
3) kaiteki
4) kaiteki_core
5) kaiteki_core_backends
6) kaiteki_unicode_generator

# press enter to build all (default)

Compiling

Important

Don't forget the build flavor

Kaiteki uses builds flavors in its Android builds. Flutter can't detect them by itself, so you need to pass --flavor unsignedfoss (no app signing + FOSS build) for Flutter to properly detect where the app has been built.

The same applies when trying to debug.

$ flutter build apk --flavor unsignedfoss # Build for Android

Running Gradle task 'assembleUnsignedfossRelease'...            
Font asset "materialdesignicons-webfont.ttf" was tree-shaken, reducing it from 1004940 to 1388 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 31752 bytes (98.1% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 1896 bytes (99.3% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Running Gradle task 'assembleUnsignedfossRelease'...              228.0s
✓  Built build/app/outputs/flutter-apk/app-unsignedfoss-release.apk (35.0MB).

Other commands

  • flutter gen-l10n to generate source code from localization files.
  • flutter pub upgrade to upgrade packages to a newer minor version.

Debugging

IDEs with official Flutter plugins are recommended. Otherwise you can still run a Flutter application with flutter run, and invoke actions like Hot Reload, or Hot Restart with your keyboard. Dart supports LSP, so IDEs like Kate support linting and showing problems as well.

Things to try when a build fails

Try clearing caches and existing build files with flutter clean. Perhaps generated files are outdated, then you can try running flutter pub run build_runner build --delete-conflicting-outputs

Official resources