Skip to content

Commit

Permalink
buid: compile for android
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackcoinDev committed Jan 6, 2024
1 parent 1d5d9c2 commit f7001b7
Show file tree
Hide file tree
Showing 87 changed files with 134 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ task:
install_script:
- pip install flake8 flake8-bugbear
flake8_script:
- flake8 . --count --select="$ELECTRUM_LINTERS" --ignore="$ELECTRUM_LINTERS_IGNORE" --show-source --statistics --exclude "*_pb2.py,electrum/_vendor/"
- flake8 . --count --select="$ELECTRUM_LINTERS" --ignore="$ELECTRUM_LINTERS_IGNORE" --show-source --statistics --exclude "*_pb2.py,electrum_blk/_vendor/"
env:
ELECTRUM_IMAGE: python:3.8
ELECTRUM_REQUIREMENTS: contrib/requirements/requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include README.md
include electrum-blk.desktop
include *.py
include run_electrum
include org.electrum-blk.electrum_blk.metainfo.xml
include org.electrum.electrum.metainfo.xml
recursive-include packages *.py
recursive-include packages cacert.pem

Expand Down
14 changes: 7 additions & 7 deletions contrib/android/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ You probably need to clear the cache: `rm -rf .buildozer/android/platform/build-
### How do I deploy on connected phone for quick testing?
Assuming `adb` is installed:
```
$ adb -d install -r dist/Electrum-BLK-*-arm64-v8a-debug.apk
$ adb shell monkey -p org.electrum-blk.electrum_blk 1
$ adb -d install -r dist/Electrum-*-arm64-v8a-debug.apk
$ adb shell monkey -p org.electrum.electrum 1
```


Expand All @@ -90,7 +90,7 @@ adb logcat | grep python
```
Better `grep` but fragile because of `cut`:
```
adb logcat | grep -F "`adb shell ps | grep org.electrum-blk.electrum_blk | cut -c14-19`"
adb logcat | grep -F "`adb shell ps | grep org.electrum.electrum | cut -c14-19`"
```


Expand All @@ -100,7 +100,7 @@ Install requirements:
python3 -m pip install "pyqt6==6.5.2" "Pillow>=8.4"
```

Run electrum with the `-g` switch: `electrum-blk -g qml`
Run electrum with the `-g` switch: `electrum -g qml`

Notes:

Expand Down Expand Up @@ -135,16 +135,16 @@ of Android does not let you access the internal storage of an app without root.
To pull a file:
```
$ adb shell
adb$ run-as org.electrum-blk.electrum_blk ls /data/data/org.electrum-blk.electrum_blk/files/data
adb$ run-as org.electrum.electrum ls /data/data/org.electrum.electrum/files/data
adb$ exit
$ adb exec-out run-as org.electrum-blk.electrum_blk cat /data/data/org.electrum-blk.electrum_blk/files/data/wallets/my_wallet > my_wallet
$ adb exec-out run-as org.electrum.electrum cat /data/data/org.electrum.electrum/files/data/wallets/my_wallet > my_wallet
```
To push a file:
```
$ adb push ~/wspace/tmp/my_wallet /data/local/tmp
$ adb shell
adb$ ls -la /data/local/tmp
adb$ run-as org.electrum-blk.testnet.electrum_blk cp /data/local/tmp/my_wallet /data/data/org.electrum-blk.testnet.electrum_blk/files/data/testnet/wallets/
adb$ run-as org.electrum.testnet.electrum cp /data/local/tmp/my_wallet /data/data/org.electrum.testnet.electrum/files/data/testnet/wallets/
adb$ rm /data/local/tmp/my_wallet
```

Expand Down
3 changes: 2 additions & 1 deletion contrib/android/bitcoin_intent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="blackcoin" />
<data android:scheme="bitcoin" />
<data android:scheme="lightning" />
</intent-filter>
4 changes: 2 additions & 2 deletions contrib/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ if [ ! -z "$ELECBUILD_COMMIT" ] ; then # fresh clone (reproducible build)
fi
docker run -it --rm \
--name electrum-android-builder-cont \
-v "$PROJECT_ROOT_OR_FRESHCLONE_ROOT":/home/user/wspace/electrum \
-v "$PROJECT_ROOT_OR_FRESHCLONE_ROOT":/home/user/wspace/electrum-blk \
-v "$PROJECT_ROOT_OR_FRESHCLONE_ROOT"/.buildozer/.gradle:/home/user/.gradle \
$DOCKER_RUN_FLAGS \
--workdir /home/user/wspace/electrum \
--workdir /home/user/wspace/electrum-blk \
electrum-android-builder-img \
./contrib/android/make_apk.sh "$@"

Expand Down
10 changes: 5 additions & 5 deletions contrib/android/buildozer_qml.spec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[app]

# (str) Title of your application
title = Electrum-BLK
title = Electrum

# (str) Package name
package.name = Electrum-BLK
package.name = Electrum

# (str) Package domain (needed for android/ios packaging)
package.domain = org.electrum-blk
package.domain = org.electrum

# (str) Source code where the main.py live
source.dir = .
Expand Down Expand Up @@ -134,7 +134,7 @@ android.accept_sdk_license = True
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
#android.add_jars = lib/android/zbar.jar

android.add_jars = .buildozer/android/platform/*/build/libs_collections/Electrum-BLK/jar/*.jar
android.add_jars = .buildozer/android/platform/*/build/libs_collections/Electrum/jar/*.jar


# (list) List of Java files to add to the android project (can be java or a
Expand All @@ -145,7 +145,7 @@ android.gradle_dependencies =
com.android.support:support-compat:28.0.0,
me.dm7.barcodescanner:zxing:1.9.8

android.add_activities = org.electrum-blk.qr.SimpleScannerActivity
android.add_activities = org.electrum.qr.SimpleScannerActivity

# (list) Put these files or directories in the apk res directory.
# The option may be used in three ways, the value may contain one or zero ':'
Expand Down
10 changes: 5 additions & 5 deletions contrib/android/make_apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ info "apk building phase starts."
# Uncomment and change below to set a custom android package id,
# e.g. to allow simultaneous mainnet and testnet installs of the apk.
# defaults:
# export APP_PACKAGE_NAME=Electrum-BLK
# export APP_PACKAGE_DOMAIN=org.electrum-blk
# export APP_PACKAGE_NAME=Electrum
# export APP_PACKAGE_DOMAIN=org.electrum
# FIXME: changing "APP_PACKAGE_NAME" seems to require a clean rebuild of ".buildozer/",
# to avoid that, maybe change "APP_PACKAGE_DOMAIN" instead.
# So, in particular, to build a testnet apk, simply uncomment:
#export APP_PACKAGE_DOMAIN=org.electrum-blk.testnet
#export APP_PACKAGE_DOMAIN=org.electrum.testnet

if [ $CI ]; then
# override log level specified in buildozer.spec to "debug":
Expand All @@ -58,7 +58,7 @@ if [[ "$3" == "release" ]] ; then
export P4A_RELEASE_KEYSTORE_PASSWD="$4"
export P4A_RELEASE_KEYALIAS_PASSWD="$4"
export P4A_RELEASE_KEYSTORE=~/.keystore
export P4A_RELEASE_KEYALIAS=electrum-blk
export P4A_RELEASE_KEYALIAS=electrum
if [ -z "$P4A_RELEASE_KEYSTORE_PASSWD" ] || [ -z "$P4A_RELEASE_KEYALIAS_PASSWD" ]; then
echo "p4a password not defined"
exit 1
Expand All @@ -72,7 +72,7 @@ elif [[ "$3" == "debug" ]] ; then
export P4A_DEBUG_KEYSTORE="$CONTRIB_ANDROID"/android_debug.keystore
export P4A_DEBUG_KEYSTORE_PASSWD=unsafepassword
export P4A_DEBUG_KEYALIAS_PASSWD=unsafepassword
export P4A_DEBUG_KEYALIAS=electrum-blk
export P4A_DEBUG_KEYALIAS=electrum
# create keystore if needed
if [ ! -f "$P4A_DEBUG_KEYSTORE" ]; then
keytool -genkey -v -keystore "$CONTRIB_ANDROID"/android_debug.keystore \
Expand Down
4 changes: 2 additions & 2 deletions contrib/build-wine/README_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Alternatively, MSYS2 and MinGW-w64 can be used directly on Windows, as follows.
$ pacman -S --needed git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-autotools
$ export PATH="$PATH:/mingw64/bin"
```
`cd` into the git clone, e.g. `C:\wspace\electrum` (auto-mounted at `/c/wspace/electrum`)
`cd` into the git clone, e.g. `C:\wspace\electrum-blk` (auto-mounted at `/c/wspace/electrum-blk`)
```
$ cd /c/wspace/electrum
$ cd /c/wspace/electrum-blk
$ GCC_TRIPLET_HOST="x86_64-w64-mingw32" ./contrib/make_libsecp256k1.sh
```

Expand Down
2 changes: 1 addition & 1 deletion contrib/build-wine/build-electrum-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pushd $WINEPREFIX/drive_c/electrum-blk
VERSION=$(git describe --tags --dirty --always)
info "Last commit: $VERSION"

# Load electrum-locale for this release
# Load electrum-blk-locale for this release
git submodule update --init

LOCALE="$WINEPREFIX/drive_c/electrum-blk/electrum_blk/locale/"
Expand Down
2 changes: 1 addition & 1 deletion contrib/build-wine/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ docker build \
# maybe do fresh clone
if [ ! -z "$ELECBUILD_COMMIT" ] ; then
info "ELECBUILD_COMMIT=$ELECBUILD_COMMIT. doing fresh clone and git checkout."
FRESH_CLONE="/tmp/electrum_build/windows/fresh_clone/electrum"
FRESH_CLONE="/tmp/electrum_build/windows/fresh_clone/electrum-blk"
rm -rf "$FRESH_CLONE" 2>/dev/null || ( info "we need sudo to rm prev FRESH_CLONE." && sudo rm -rf "$FRESH_CLONE" )
umask 0022
git clone "$PROJECT_ROOT" "$FRESH_CLONE"
Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/AddressDetails.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/Addresses.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import QtQuick.Controls
import QtQuick.Controls.Material
import QtQml.Models

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/BIP39RecoveryDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/BalanceDetails.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/ChannelDetails.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/Channels.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/CloseChannelDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/ConfirmTxDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/CpfpBumpFeeDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/History.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import QtQuick.Controls
import QtQuick.Controls.Material
import QtQml.Models

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/InvoiceDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/LnurlPayRequestDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/LoadingWalletDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/NewWalletWizard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Layouts
import QtQuick.Controls

import org.electrum-blk 1.0
import org.electrum 1.0

import "wizard"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/OpenChannelDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/OpenWalletDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/OtpDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/PasswordDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
2 changes: 1 addition & 1 deletion electrum_blk/gui/qml/components/Pin.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material

import org.electrum-blk 1.0
import org.electrum 1.0

import "controls"

Expand Down
Loading

0 comments on commit f7001b7

Please sign in to comment.