Skip to content

Latest commit

 

History

History
109 lines (64 loc) · 4.52 KB

BUILD.md

File metadata and controls

109 lines (64 loc) · 4.52 KB

Building

This document explains how to build Phoenix for iOS or for Android.

Requirements

You'll need to install the following:

  • Xcode: if you build the iOS app.
  • Android Studio: if you want to build the Android app. Android Studio is also the recommended IDE if you want to contribute to the phoenix-shared module, which contains shared code between iOS and Android. We recommend installing it even if you're only working on the iOS app.

Build lightning-kmp

Phoenix is an actual lightning node running on your phone. It contains much of the bitcoin/lightning protocol, contained in the lightning-kmp library, also developed by ACINQ.

Tags of the lightning-kmp library are released on public Maven repository, so you'll likely not have to build it yourself.

However, from time to time, Phoenix uses a SNAPSHOT development version of lightning-kmp. When that happens, you will have to build this library yourself on your local machine. To do that, follow the lightning-kmp build instructions.

Build the application

Start by cloning the repository locally:

git clone git@github.com:ACINQ/phoenix.git
cd phoenix

The phoenix-shared module

Like the lightning-kmp library, Phoenix shares some logic between the Android and the iOS application, thanks to Kotlin Multiplatform. This includes database queries, or the some view controllers, and more (but not the UI!). The phoenix-shared module is where this cross-platform code is contained.

Development on this module should be done with Android Studio.

This module will be built automatically when you build the Android or the iOS app:

  • on Android, because the phoenix-android module has a direct gradle dependency to this module;
  • on iOS, because a build phase in iOS is set up to build a PhoenixShared.framework whenever needed.

Building the iOS app

Open XCode, then open the phoenix-ios project. Once the project is properly imported, click on Product > Build.

If the project builds successfully, you can then run it on a device or an emulator.

Building the Android app

Open the entire phoenix project in Android Studio, then build the phoenix-android application.

If you are only interested in building the iOS application, create a local.properties file at the root of the project, and add the following line:

skip.android=true

Troubleshooting

Lightning-kmp versions

Make sure that the lightning-kmp version that phoenix depends on is the same that the lightning-kmp version you are building. Your local lightning-kmp repository may not be pointing to the version that phoenix-android requires.

Phoenix defines its lightning-kmp version in buildSrc/src/main/kotlin/Versions.kt, through the val lightningKmp = "xxx" field.

If this value is snapshot it means that the current phoenix master branch is using a development version of this library. In that case, there may be API changes in lightning-kmp which are not yet supported here.

Release the Android app

Phoenix releases are built using a dockerized Linux environment. The build is not deterministic yet, we are working on it.

Notes:

  • This tool works on Linux and Windows.
  • Following instructions only work for releases after v.1.3.1 (excluded).

Prerequisites

You don't have to worry about installing any development tool, except:

  1. Docker (Community Edition)

Note: on Windows at least, it is strongly recommended to bump the resources allocation settings from the default values, especially for Memory.

Building the APK

  1. Clone the phoenix project from https://github.com/ACINQ/phoenix ;

  2. Open a terminal at the root of the cloned project ;

  3. Checkout the tag you want to build, for example:

git checkout v1.4.0
  1. Build the docker image mirroring the release environment (this typically takes ~20min):
docker build -t phoenix_build .
  1. Build the APKs using the docker image (takes typically ~10min):
# If you're on linux:
docker run --rm -v $(pwd):/home/ubuntu/phoenix/phoenix-android/build/outputs -w /home/ubuntu/phoenix phoenix_build ./gradlew :phoenix-android:assembleRelease

# If you're on Windows:
docker run --rm -v ${pwd}:/home/ubuntu/phoenix/phoenix-android/build/outputs -w //home/ubuntu/phoenix phoenix_build ./gradlew :phoenix-android:assembleRelease
  1. APK files are found in the apk folder.