Skip to content

Commit

Permalink
Remove the phoenix-legacy module (#671)
Browse files Browse the repository at this point in the history
This commits removes the old 1.x Android legacy code, which was using
the eclair-core Scala library. This version has been deprecated 18 months 
ago and all legacy channels have now been closed.

This includes code that was added in the modern android app to manage
the switch to the legacy app, as well as the migration. Gone as well
is the special init TLV sent to the peer to check for legacy channels.
  • Loading branch information
dpad85 authored Feb 12, 2025
1 parent 2a5e78b commit 91bd78e
Show file tree
Hide file tree
Showing 413 changed files with 130 additions and 479,096 deletions.
42 changes: 4 additions & 38 deletions .github/workflows/testnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ name: Build
on:
workflow_dispatch:
push:
branches: [ master, test-ci-build, offer ]
branches: [ master, test-ci-build ]
paths:
- 'phoenix-legacy/**'
- 'phoenix-android/**'
- '.github/workflows/**'

Expand All @@ -29,28 +28,8 @@ jobs:
ref: master
path: lightning-kmp

- name: Checkout eclair-core
uses: actions/checkout@v2
with:
repository: ACINQ/eclair
ref: android-phoenix
path: eclair-core

- name: Checkout Tor_Onion_Proxy_Library (Tor for legacy android app)
uses: actions/checkout@v2
with:
repository: ACINQ/Tor_Onion_Proxy_Library
path: tor-lib

# 2 - setup cache/jdk

- name: Cache maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Cached Konan
uses: actions/cache@v4
with:
Expand All @@ -61,7 +40,7 @@ jobs:
- name: Set up jdk 1.17
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 17

# 3 - build dependencies & app

Expand All @@ -70,20 +49,7 @@ jobs:
cd lightning-kmp
./gradlew clean build publishToMavenLocal -x check
- name: Build eclair-core and install to local maven repo
run: |
cd eclair-core
mvn clean install -pl eclair-core -am -Dmaven.test.skip=true
- name: Build Tor_Onion_Proxy_Library and install to local maven repo
run: |
cd tor-lib
./gradlew :universal:build
./gradlew :universal:publishToMavenLocal
./gradlew :android:build
./gradlew :android:publishToMavenLocal
- name: Assemble new android app apk
- name: Assemble the android apk
run: |
cd phoenix
./gradlew clean
Expand All @@ -102,7 +68,7 @@ jobs:
run: |
mkdir upload
mv phoenix/phoenix-android/build/outputs/apk/release/phoenix-*.apk upload/phoenix-testnet-latest.apk
/usr/local/lib/android/sdk/build-tools/30.0.3/apksigner sign --ks signingkey --ks-pass pass:$TESTNET_STORE_PASS --ks-key-alias $TESTNET_ALIAS --key-pass pass:$TESTNET_KEY_PASS upload/phoenix-testnet-latest.apk
/usr/local/lib/android/sdk/build-tools/34.0.0/apksigner sign --ks signingkey --ks-pass pass:$TESTNET_STORE_PASS --ks-key-alias $TESTNET_ALIAS --key-pass pass:$TESTNET_KEY_PASS upload/phoenix-testnet-latest.apk
shell: bash
env:
TESTNET_STORE_PASS: ${{secrets.TESTNET_STORE_PASS}}
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ phoenix-android/release/
.externalNativeBuild
sdk-dependencies
apk
phoenix-legacy/release
phoenix-legacy/debug
.cxx
logs/

# LangTool
.langtool/deepl.authtoken
Expand Down
49 changes: 16 additions & 33 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Building

This document explains how to build Phoenix for iOS or for Android. Phoenix is a [Kotlin Multiplatform Mobile](https://kotlinlang.org/docs/mobile/home.html) application. It can run on many different platforms, including mobile devices (iOS and Android).

Note: that the legacy Android app is now a library within a new Android app. To build the old versions of this app, checkout one of the `android-legacy-vXX` tags, and follow the build instructions.
This document explains how to build Phoenix for iOS or for Android.

## Requirements

Expand All @@ -12,9 +10,11 @@ You'll need to install the following:

## Build lightning-kmp

Phoenix is an actual lightning node running on your phone. It contains much of the bitcoin/lightning protocol. For that, Phoenix relies on the [lightning-kmp](https://github.com/ACINQ/lightning-kmp) library. Tags of this library are released on public maven repository, but this repository may from time to time use a SNAPSHOT development version.
Phoenix is an actual lightning node running on your phone. It contains much of the bitcoin/lightning protocol, contained in the [lightning-kmp](https://github.com/ACINQ/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.

When that happens, you will have to build this library yourself on your local machine. To do that, follow those [instructions](https://github.com/ACINQ/lightning-kmp/blob/master/BUILD.md).
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](https://github.com/ACINQ/lightning-kmp/blob/master/BUILD.md).

## Build the application

Expand All @@ -25,39 +25,16 @@ git clone [email protected]:ACINQ/phoenix.git
cd phoenix
```

### The `phoenix-legacy` module

This module contains an older version of the Android application. This version is now an AAR, that is a Android library (and not a standalone application). It is embedded within the new `phoenix-android` app and must be built if you want to run the Android application.

Follow [those instructions](https://github.com/ACINQ/phoenix/blob/master/phoenix-legacy/BUILD.md) to build the legacy app.

Note:
- in the future, the legacy app code will be removed and the modern Android app won't have this dependency anymore.
- iOS developers who don't need the Android app and wish to save time can do so by [skipping the Android app altogether](#skipping-the-android-app).

### The `phoenix-shared` module

This module is where [Kotlin Multiplatform Mobile](https://kotlinlang.org/docs/mobile/home.html) is used. The code written in Kotlin is shared between the Android and the iOS application. It contains common logic, such as the database queries, or the MVI controllers. Development on this module should be done with Android Studio.
Like the lightning-kmp library, Phoenix shares some logic between the Android and the iOS application, thanks to [Kotlin Multiplatform](https://www.jetbrains.com/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.

You do not need to run a command to build this module. It will be built automatically whether you're building the Android or the iOS app:

- the `phoenix-android` module has a direct gradle dependency to this module, so Android Studio will build it automatically when building the Android app.

- when building the iOS app, XCode will automatically call this command:

```
./gradlew :phoenix-shared:packForXCode -PXCODE_CONFIGURATION=Debug -PXCODE_PLATFORM_NAME=iphoneos -PskipAndroid=true
```
Development on this module should be done with Android Studio.

which will generate the required phoenix-ios-framework used by iOS.
This module will be built automatically when you build the Android or the iOS app:

### Skipping the Android app

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

```
skip.android=true
```
- 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

Expand All @@ -69,6 +46,12 @@ If the project builds successfully, you can then run it on a device or an emulat

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
Expand Down
49 changes: 3 additions & 46 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
# base image to build eclair-core
FROM eclipse-temurin:17.0.10_7-jdk-alpine as ECLAIR_CORE_BUILD

# this is necessary to extract the eclair-core version that we need to clone for the build
COPY ./buildSrc/src/main/kotlin/Versions.kt .
RUN cat Versions.kt | grep "const val eclair =" | cut -d '"' -f 2 > eclair-core-version.txt

ARG MAVEN_VERSION=3.9.9
ARG USER_HOME_DIR="/root"
ARG SHA=a555254d6b53d267965a3404ecb14e53c3827c09c3b94b5678835887ab404556bfaf78dcfe03ba76fa2508649dca8531c74bca4d5846513522404d48e8c4ac8b
ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries

RUN apk add --no-cache curl tar bash git

# setup maven
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

# clone eclair at the specified branch
RUN git clone https://github.com/ACINQ/eclair -b v$(cat eclair-core-version.txt)

# build eclair-core
RUN cd eclair && mvn install -pl eclair-core -am -Dmaven.test.skip=true

# main build image
FROM ubuntu:23.10
FROM ubuntu:24.04

ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
Expand All @@ -40,8 +9,6 @@ ENV ANDROID_CMDLINETOOLS_FILE commandlinetools-linux-8092744_latest.zip
ENV ANDROID_CMDLINETOOLS_URL https://dl.google.com/android/repository/${ANDROID_CMDLINETOOLS_FILE}
ENV ANDROID_API_LEVELS android-33
ENV ANDROID_BUILD_TOOLS_VERSION 33.0.2
ENV ANDROID_NDK_VERSION 23.1.7779620
ENV CMAKE_VERSION 3.18.1
ENV ANDROID_HOME /usr/local/android-sdk
ENV PATH ${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
ENV JAVA_OPTS "-Dprofile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8"
Expand All @@ -64,21 +31,11 @@ RUN mkdir /usr/local/android-sdk && \
rm ${ANDROID_CMDLINETOOLS_FILE}

# install sdk packages
RUN echo y | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "cmake;${CMAKE_VERSION}" "ndk;${ANDROID_NDK_VERSION}" "platforms;${ANDROID_API_LEVELS}"

# build tor library
RUN git clone https://github.com/ACINQ/Tor_Onion_Proxy_Library && \
cd Tor_Onion_Proxy_Library && \
./gradlew :universal:build && \
./gradlew :universal:publishToMavenLocal && \
./gradlew :android:build && \
./gradlew :android:publishToMavenLocal
RUN echo y | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platforms;${ANDROID_API_LEVELS}"

# copy eclair-core dependency
COPY --from=ECLAIR_CORE_BUILD /root/.m2/repository/fr/acinq/eclair /root/.m2/repository/fr/acinq/eclair
# copy phoenix project over to docker image
COPY . /home/ubuntu/phoenix
# make sure we don't read properties the host environment
# make sure we don't read properties from the host environment
RUN rm -f /home/ubuntu/phoenix/local.properties
# make sure we use unix EOL files
RUN find /home/ubuntu/phoenix -type f -print0 | xargs -0 dos2unix --
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
[![Testnet Build](https://github.com/ACINQ/phoenix/workflows/TESTNET%20Build/badge.svg)](https://github.com/ACINQ/phoenix/actions?query=workflow%3A%22TESTNET+Build%22)
[![Testnet Build](https://github.com/ACINQ/phoenix/actions/workflows/testnet-build.yml/badge.svg)](https://github.com/ACINQ/phoenix/actions?query=testnet-build)
[![Download Testnet APK](https://img.shields.io/badge/Download-Testnet%20APK-green?style=flat&logo=android&logoColor=white)](https://acinq.co/pub/phoenix/phoenix-testnet-latest.apk)

![Phoenix Logo](.readme/phoenix_text.png)
Expand Down Expand Up @@ -32,9 +32,6 @@ Phoenix is separated in 3 modules:

Instructions to build the iOS and the Android apps are provided [here](https://github.com/ACINQ/phoenix/blob/master/BUILD.md).

Deprecated module:
- `phoenix-legacy`: contains the old, legacy Android application (version 1.x), using [eclair-core](https://github.com/ACINQ/eclair) for Lightning, which has been replaced by `phoenix-android`. However, this legacy app is still embedded in the new production application for migration purposes so the code remains. It will be removed eventually.

## Contribute

We use GitHub for bug tracking. Search [the existing issues](https://github.com/ACINQ/phoenix/issues) for your bug and create a new one if needed.
Expand Down
7 changes: 1 addition & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ buildscript {
classpath("org.jetbrains.kotlin:kotlin-serialization:${Versions.kotlin}")
classpath("app.cash.sqldelight:gradle-plugin:${Versions.sqlDelight}")

if (System.getProperty("includeAndroid")?.toBoolean() == true) {
// Plugins for the legacy android app
// Argument classes generation plugin for the androidx navigation component
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.AndroidLegacy.safeArgs}")
}
// Firebase cloud messaging plugin
classpath("com.google.gms:google-services:${Versions.fcmPlugin}")
}
Expand All @@ -30,5 +25,5 @@ allprojects {
}

val clean by tasks.creating(Delete::class) {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
repositories {
jcenter()
mavenCentral()
}
plugins {
`kotlin-dsl`
Expand Down
19 changes: 3 additions & 16 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ object Versions {
object Android {
const val coreKtx = "1.9.0"
const val lifecycle = "2.6.0"
const val prefs = "1.2.0"
const val datastore = "1.0.0"
const val compose = "1.6.8"
const val composeCompiler = "1.5.8"
Expand All @@ -29,24 +28,12 @@ object Versions {
const val fcm = "24.0.0"
const val logback = "2.0.0"

const val testRunner = "1.3.0"
const val espresso = "3.3.0"
}

object AndroidLegacy {
const val eclair = "0.4.25-android-phoenix"

const val safeArgs = "2.6.0"
const val appCompat = "1.3.0"
const val material = "1.7.0"
const val navigation = "2.4.2"
const val constraint = "2.0.4"
const val lifecycleExtensions = "2.2.0"
const val lifecycle = "2.7.0"
const val work = "2.8.1"
const val viewpager = "1.0.0"
const val eventbus = "3.1.1"
const val torWrapper = "0.0.6"
const val torCtl = "0.4"

const val testRunner = "1.3.0"
const val espresso = "3.3.0"
}
}
9 changes: 1 addition & 8 deletions phoenix-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = Versions.Android.composeCompiler
}

packagingOptions {
resources.merges.add("reference.conf")
}
}

kotlin {
Expand All @@ -91,7 +87,6 @@ kotlin {

dependencies {
implementation(project(":phoenix-shared"))
api(project(":phoenix-legacy"))

implementation("com.google.android.material:material:1.7.0")

Expand All @@ -105,7 +100,7 @@ dependencies {
// -- AndroidX: biometric
implementation("androidx.biometric:biometric:${Versions.Android.biometrics}")
// -- AndroidX: work manager
implementation("androidx.work:work-runtime-ktx:${Versions.AndroidLegacy.work}")
implementation("androidx.work:work-runtime-ktx:${Versions.Android.work}")


// -- jetpack compose
Expand Down Expand Up @@ -139,8 +134,6 @@ dependencies {
implementation("com.google.firebase:firebase-messaging:${Versions.Android.fcm}")
implementation("com.google.android.gms:play-services-base:18.5.0")

implementation("com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava")

testImplementation("junit:junit:${Versions.junit}")
testImplementation("app.cash.sqldelight:sqlite-driver:${Versions.sqlDelight}")
androidTestImplementation("androidx.test.ext:junit:1.1.4")
Expand Down
6 changes: 5 additions & 1 deletion phoenix-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-feature
android:name="android.hardware.camera"
android:required="false" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand All @@ -21,7 +25,7 @@
android:supportsRtl="true"
android:hardwareAccelerated="true"
android:extractNativeLibs="true"
android:theme="@style/default_theme"
android:theme="@style/Theme.PhoenixAndroid"
android:localeConfig="@xml/locales_config">

<!-- Set custom default icon for notifications -->
Expand Down
Loading

0 comments on commit 91bd78e

Please sign in to comment.