Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6 #8545

Merged
merged 22 commits into from
Nov 9, 2023
Merged

Qt6 #8545

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
16d3db9
qt6: update android build container to bookworm
accumulator Jun 29, 2023
770a32c
qt6: update recipe pins, NDK, SDK, Ant, use venv for buildozer/p4a, a…
accumulator Jul 4, 2023
bf6163b
android: update p4a ref to 3b3733dbf5f461e197ba83887ac0d3b6d0f1c396
accumulator Jul 7, 2023
0441cb0
qml: exclude payserver plugin for qml
accumulator Jul 6, 2023
6270eae
qml: port PyQt5 to PyQt6
accumulator Jul 14, 2023
8b567ae
qml: remove all QML imports version numbers
accumulator Jul 17, 2023
ae44637
qml: work around toolbar layout not right-aligning indicators when in…
accumulator Jul 19, 2023
65d41cc
qml: qualify all signal handler parameters
accumulator Sep 27, 2023
a77ff99
qml: refactor qr scan to qt6
accumulator Jul 19, 2023
e561ce2
cirrus: task timeout 90m
accumulator Oct 2, 2023
db532db
qml: android back-gesture conflict hack not working on qt6, replace w…
accumulator Oct 3, 2023
be801f3
gui: make common_qt compatible with both Qt5 and Qt6
accumulator Oct 5, 2023
b9ab0f6
qt6: update buildozer ref to ce4f2257249fdf4ff1f4cb8983fd7ac44174a274
accumulator Oct 6, 2023
c33ee87
android: restore SimpleScannerActivity.java that was used in kivy
SomberNight Oct 11, 2023
5c3e14d
qml: replace Send/ScanDialog with java bases zxing qr scan activity.
SomberNight Oct 11, 2023
32c1915
qml: restore Send/ScanDialog for desktop/dev, keeping qr scan Activit…
accumulator Oct 26, 2023
11d39cd
qml: fix keyboard exclusion zone
accumulator Oct 31, 2023
55c01bd
android: set target_sdk_version to 33
accumulator Oct 31, 2023
58ff76a
android: correctly describe buildozer branch used
accumulator Nov 1, 2023
1544a71
qml qr scanner: make xml layout look nicer
SomberNight Oct 31, 2023
8798a45
qml: fix issue with width of fiat textedit on ReceiveDetailsDialog
accumulator Nov 7, 2023
047cc6f
qml: remove attempt to unfocus by clicking dialog background
accumulator Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ task:

task:
name: "build: Android (QML $APK_ARCH)"
timeout_in: 90m
container:
dockerfile: contrib/android/Dockerfile
cpu: 8
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ electrum/locale/
packages
env/
.buildozer
.buildozer_kivy/
.buildozer_qml/
.buildozer_*/
bin/
/app.fil
.idea
Expand Down
55 changes: 36 additions & 19 deletions contrib/android/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# based on https://github.com/kivy/python-for-android/blob/master/Dockerfile

FROM debian:bullseye@sha256:43ef0c6c3585d5b406caa7a0f232ff5a19c1402aeb415f68bcd1cf9d10180af8
FROM debian:bookworm@sha256:d568e251e460295a8743e9d5ef7de673c5a8f9027db11f4e666e96fb5bed708e

ENV DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -31,12 +31,12 @@ RUN apt -y update -qq \


ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
ENV ANDROID_NDK_VERSION="22b"
ENV ANDROID_NDK_HASH="ac3a0421e76f71dd330d0cd55f9d99b9ac864c4c034fc67e0d671d022d4e806b"
ENV ANDROID_NDK_VERSION="23b"
ENV ANDROID_NDK_HASH="c6e97f9c8cfe5b7be0a9e6c15af8e7a179475b7ded23e2d1c1fa0945d6fb4382"
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"

# get the latest version from https://developer.android.com/ndk/downloads/index.html
ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux.zip"
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"

# download and install Android NDK
Expand All @@ -53,9 +53,8 @@ RUN curl --location --progress-bar \
ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"

# get the latest version from https://developer.android.com/studio/index.html
ENV ANDROID_SDK_TOOLS_VERSION="8092744"
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="30.0.3"
ENV ANDROID_SDK_HASH="d71f75333d79c9c6ef5c39d3456c6c58c613de30e6a751ea0dbd433e8f8b9cbf"
ENV ANDROID_SDK_TOOLS_VERSION="9477386"
ENV ANDROID_SDK_HASH="bd1aa17c7ef10066949c88dc6c9c8d536be27f992a1f3b5a584f9bd2ba5646a0"
ENV ANDROID_SDK_TOOLS_ARCHIVE="commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip"
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
ENV ANDROID_SDK_MANAGER="${ANDROID_SDK_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_HOME}"
Expand All @@ -77,19 +76,22 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
# accept Android licenses (JDK necessary!)
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends --allow-downgrades \
openjdk-11-jdk-headless \
openjdk-17-jdk-headless \
&& apt -y autoremove
RUN yes | ${ANDROID_SDK_MANAGER} --licenses > /dev/null


ENV ANDROID_SDK_BUILD_TOOLS_VERSION="31.0.0"

# download platforms, API, build tools
RUN ${ANDROID_SDK_MANAGER} "platforms;android-30" > /dev/null && \
RUN ${ANDROID_SDK_MANAGER} "platforms;android-31" > /dev/null && \
${ANDROID_SDK_MANAGER} "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null && \
${ANDROID_SDK_MANAGER} "extras;android;m2repository" > /dev/null && \
chmod +x "${ANDROID_SDK_HOME}/cmdline-tools/bin/avdmanager"

# download ANT
ENV APACHE_ANT_VERSION="1.9.4"
ENV APACHE_ANT_HASH="66d3edcbb0eba11387705cd89178ffb65e55cd53f13ca35c1bb983c0f9992540"
ENV APACHE_ANT_VERSION="1.10.13"
ENV APACHE_ANT_HASH="776be4a5704158f00ef3f23c0327546e38159389bc8f39abbfe114913f88bab1"
ENV APACHE_ANT_ARCHIVE="apache-ant-${APACHE_ANT_VERSION}-bin.tar.gz"
ENV APACHE_ANT_DL_URL="https://archive.apache.org/dist/ant/binaries/${APACHE_ANT_ARCHIVE}"
ENV APACHE_ANT_HOME="${ANDROID_HOME}/apache-ant"
Expand Down Expand Up @@ -139,6 +141,15 @@ RUN apt -y update -qq \
&& apt -y autoremove \
&& apt -y clean

# cross compile deps for Qt6
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends --allow-downgrades \
libopengl-dev \
libegl-dev \
dos2unix \
&& apt -y autoremove \
&& apt -y clean


# create new user to avoid using root; but with sudo access and no password for convenience.
ARG UID=1000
Expand All @@ -154,23 +165,28 @@ RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
RUN chown ${USER} /opt
USER ${USER}

# venv, VIRTUAL_ENV is used by buildozer to indicate a venv environemnt
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"

COPY contrib/deterministic-build/requirements-build-base.txt /opt/deterministic-build/
COPY contrib/deterministic-build/requirements-build-android.txt /opt/deterministic-build/
RUN python3 -m pip install --no-build-isolation --no-dependencies --user \
RUN /opt/venv/bin/python3 -m pip install --no-build-isolation --no-dependencies \
-r /opt/deterministic-build/requirements-build-base.txt
RUN python3 -m pip install --no-build-isolation --no-dependencies --no-binary :all: --user \
RUN /opt/venv/bin/python3 -m pip install --no-build-isolation --no-dependencies --no-binary :all: \
-r /opt/deterministic-build/requirements-build-android.txt

# install buildozer
RUN cd /opt \
&& git clone https://github.com/kivy/buildozer \
&& cd buildozer \
&& git remote add sombernight https://github.com/SomberNight/buildozer \
&& git remote add accumulator https://github.com/accumulator/buildozer \
&& git fetch --all \
# commit: from branch sombernight/electrum_20210421 (note: careful with force-pushing! see #8162)
&& git checkout "6f03256e8312f8d1e5a6da3a2a1bf06e2738325e^{commit}" \
&& python3 -m pip install --no-build-isolation --no-dependencies --user -e .
# commit: from branch electrum-qt6 (note: careful with force-pushing! see #8162) \
&& git checkout "ce4f2257249fdf4ff1f4cb8983fd7ac44174a274^{commit}" \
&& /opt/venv/bin/python3 -m pip install --no-build-isolation --no-dependencies -e .

# install python-for-android
RUN cd /opt \
Expand All @@ -179,9 +195,10 @@ RUN cd /opt \
&& git remote add sombernight https://github.com/SomberNight/python-for-android \
&& git remote add accumulator https://github.com/accumulator/python-for-android \
&& git fetch --all \
# commit: from branch accumulator/electrum_20210421d (note: careful with force-pushing! see #8162)
&& git checkout "052b9f7945bae557347fa4a4b418040d9da9eaff^{commit}" \
&& python3 -m pip install --no-build-isolation --no-dependencies --user -e .
# commit: from branch accumulator/qt6-wip (note: careful with force-pushing! see #8162) \
#
&& git checkout "eb4a3522373e0b4e2749b8a8bc965ff51355ea35^{commit}" \
&& /opt/venv/bin/python3 -m pip install --no-build-isolation --no-dependencies -e .

# build env vars
ENV USE_SDK_WRAPPER=1
Expand Down
4 changes: 2 additions & 2 deletions contrib/android/apt.sources.list
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
deb https://snapshot.debian.org/archive/debian/20230317T205011Z/ bullseye main
deb-src https://snapshot.debian.org/archive/debian/20230317T205011Z/ bullseye main
deb https://snapshot.debian.org/archive/debian/20230629T090352Z/ bookworm main
deb-src https://snapshot.debian.org/archive/debian/20230629T090352Z/ bookworm main
1 change: 0 additions & 1 deletion contrib/android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ docker build \
--file "$CONTRIB_ANDROID/Dockerfile" \
"$PROJECT_ROOT"


# maybe do fresh clone
if [ ! -z "$ELECBUILD_COMMIT" ] ; then
info "ELECBUILD_COMMIT=$ELECBUILD_COMMIT. doing fresh clone and git checkout."
Expand Down
37 changes: 27 additions & 10 deletions contrib/android/buildozer_qml.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ source.exclude_dirs = bin, build, dist, contrib, env,
electrum/www,
electrum/gui/qt,
electrum/gui/kivy,
electrum/plugins/payserver,
packages/qdarkstyle,
packages/qtpy,
packages/bin,
Expand Down Expand Up @@ -55,8 +56,8 @@ requirements =
libffi,
libsecp256k1,
cryptography,
pyqt5sip,
pyqt5,
pyqt6sip,
pyqt6,
pillow,
libzbar

Expand Down Expand Up @@ -84,22 +85,22 @@ android.permissions = INTERNET, CAMERA, WRITE_EXTERNAL_STORAGE

# (int) Android API to use (compileSdkVersion)
# note: when changing, Dockerfile also needs to be changed to install corresponding build tools
android.api = 30
android.api = 31

# (int) Android targetSdkVersion
android.target_sdk_version = 31
android.target_sdk_version = 33

# (int) Minimum API required. You will need to set the android.ndk_api to be as low as this value.
android.minapi = 21

# (str) Android NDK version to use
android.ndk = 22b
android.ndk = 23b

# (int) Android NDK API to use (optional). This is the minimum API your app will support.
android.ndk_api = 21

# (bool) Use --private data storage (True) or --dir public storage (False)
android.private_storage = True
#android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /opt/android/android-ndk
Expand Down Expand Up @@ -137,9 +138,25 @@ android.add_jars = .buildozer/android/platform/*/build/libs_collections/Electrum

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
# android.add_src = ...
# android.add_activities = ...
android.gradle_dependencies = com.android.support:support-compat:28.0.0
android.add_src = electrum/gui/qml/java_classes/

android.gradle_dependencies =
com.android.support:support-compat:28.0.0,
me.dm7.barcodescanner:zxing:1.9.8

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 ':'
# Some examples:
# 1) A file to add to resources, legal resource names contain ['a-z','0-9','_']
# android.add_resources = my_icons/all-inclusive.png:drawable/all_inclusive.png
# 2) A directory, here 'legal_icons' must contain resources of one kind
# android.add_resources = legal_icons:drawable
# 3) A directory, here 'legal_resources' must contain one or more directories,
# each of a resource kind: drawable, xml, etc...
# android.add_resources = legal_resources
android.add_resources = electrum/gui/qml/android_res/layout:layout

# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
Expand Down Expand Up @@ -199,7 +216,7 @@ p4a.local_recipes = %(source.dir)s/contrib/android/p4a_recipes/
#p4a.hook =

# (str) Bootstrap to use for android builds
p4a.bootstrap = qt5
p4a.bootstrap = qt6

# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask)
#p4a.port =
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 @@ -90,16 +90,16 @@ fi
if [[ "$2" == "all" ]] ; then
# build all apks
# FIXME failures are not propagated out: we should fail the script if any arch build fails
export APP_ANDROID_ARCH=armeabi-v7a
export APP_ANDROID_ARCHS=armeabi-v7a
make $TARGET
export APP_ANDROID_ARCH=arm64-v8a
export APP_ANDROID_ARCHS=arm64-v8a
make $TARGET
#export APP_ANDROID_ARCH=x86
#export APP_ANDROID_ARCHS=x86
#make $TARGET
export APP_ANDROID_ARCH=x86_64
export APP_ANDROID_ARCHS=x86_64
make $TARGET
else
export APP_ANDROID_ARCH=$2
export APP_ANDROID_ARCHS=$2
make $TARGET
fi

Expand Down
4 changes: 2 additions & 2 deletions contrib/android/p4a_recipes/Pillow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
util = load_source('util', os.path.join(os.path.dirname(os.path.dirname(__file__)), 'util.py'))


assert PillowRecipe._version == "7.0.0"
assert PillowRecipe._version == "8.4.0"
assert PillowRecipe.depends == ['png', 'jpeg', 'freetype', 'setuptools', 'python3']
assert PillowRecipe.python_depends == []


class PillowRecipePinned(util.InheritedRecipeMixin, PillowRecipe):
sha512sum = "187173a525d4f3f01b4898633263b53a311f337aa7b159c64f79ba8c7006fd44798a058e7cc5d8f1116bad008e4142ff303456692329fe73b0e115ef5c225d73"
sha512sum = "d395f69ccb37c52a3b6f45836700ffbc3173afae31848cc61d7b47db88ca1594541023beb9a14fd9067aca664e182c7d6e3300ab3e3095c31afe8dcbc6e08233"


recipe = PillowRecipePinned()
4 changes: 2 additions & 2 deletions contrib/android/p4a_recipes/libffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
util = load_source('util', os.path.join(os.path.dirname(os.path.dirname(__file__)), 'util.py'))


assert LibffiRecipe._version == "v3.3"
assert LibffiRecipe._version == "v3.4.2"
assert LibffiRecipe.depends == []
assert LibffiRecipe.python_depends == []


class LibffiRecipePinned(util.InheritedRecipeMixin, LibffiRecipe):
sha512sum = "62798fb31ba65fa2a0e1f71dd3daca30edcf745dc562c6f8e7126e54db92572cc63f5aa36d927dd08375bb6f38a2380ebe6c5735f35990681878fc78fc9dbc83"
sha512sum = "d399319efcca375fe901b05722e25eca31d11a4261c6a5d5079480bbc552d4e4b42de2026912689d3b2f886ebb3c8bebbea47102e38a2f6acbc526b8d5bba388"


recipe = LibffiRecipePinned()
4 changes: 2 additions & 2 deletions contrib/android/p4a_recipes/libiconv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
util = load_source('util', os.path.join(os.path.dirname(os.path.dirname(__file__)), 'util.py'))


assert LibIconvRecipe._version == "1.15"
assert LibIconvRecipe._version == "1.16"
assert LibIconvRecipe.depends == []
assert LibIconvRecipe.python_depends == []


class LibIconvRecipePinned(util.InheritedRecipeMixin, LibIconvRecipe):
sha512sum = "1233fe3ca09341b53354fd4bfe342a7589181145a1232c9919583a8c9979636855839049f3406f253a9d9829908816bb71fd6d34dd544ba290d6f04251376b1a"
sha512sum = "365dac0b34b4255a0066e8033a8b3db4bdb94b9b57a9dca17ebf2d779139fe935caf51a465d17fd8ae229ec4b926f3f7025264f37243432075e5583925bb77b7"


recipe = LibIconvRecipePinned()
6 changes: 3 additions & 3 deletions contrib/android/p4a_recipes/pyjnius/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
util = load_source('util', os.path.join(os.path.dirname(os.path.dirname(__file__)), 'util.py'))


assert PyjniusRecipe._version == "1.3.0"
assert PyjniusRecipe.depends == [('genericndkbuild', 'sdl2', 'qt5'), 'six', 'python3']
assert PyjniusRecipe._version == "1.5.0"
assert PyjniusRecipe.depends == [('genericndkbuild', 'sdl2', 'qt6'), 'six', 'python3']
assert PyjniusRecipe.python_depends == []


class PyjniusRecipePinned(util.InheritedRecipeMixin, PyjniusRecipe):
sha512sum = "5a3475afcda5afbef6e1a67bab508e3c24bd564efda5ac38ae7669d39b4bfdbfaaa83f435f26d39b3d849d3a167a9c136c9ac6b2bfcc0bda09ef1c00aa66cf25"
sha512sum = "e47ff08bdcda8fc9ef9617fc84515a85404d77cfce3ede3e190ae21221837a4275840e14976271f38eb5d514682d22eab5d83d8ca94dbf3a6b47d4effa109790"


recipe = PyjniusRecipePinned()
18 changes: 0 additions & 18 deletions contrib/android/p4a_recipes/pyqt5/__init__.py

This file was deleted.

18 changes: 0 additions & 18 deletions contrib/android/p4a_recipes/pyqt5sip/__init__.py

This file was deleted.

18 changes: 18 additions & 0 deletions contrib/android/p4a_recipes/pyqt6/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os

from pythonforandroid.recipes.pyqt6 import PyQt6Recipe
from pythonforandroid.util import load_source

util = load_source('util', os.path.join(os.path.dirname(os.path.dirname(__file__)), 'util.py'))


assert PyQt6Recipe._version == "6.4.2"
assert PyQt6Recipe.depends == ['qt6', 'pyjnius', 'setuptools', 'pyqt6sip', 'hostpython3', 'pyqt_builder']
assert PyQt6Recipe.python_depends == []


class PyQt6RecipePinned(util.InheritedRecipeMixin, PyQt6Recipe):
sha512sum = "51e5f0d028ee7984876da1653cb135d61e2c402f18b939a92477888cc7c86d3bc2889477403dee6b3d9f66519ee3236d344323493b4c2c2e658e1637b10e53bf"


recipe = PyQt6RecipePinned()
Loading