diff --git a/.travis.yml b/.travis.yml index 078e57638..89e905c41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,12 +65,12 @@ jobs: install: - pip install requests && ./contrib/pull_locale - ./contrib/make_packages - - sudo docker build --no-cache -t electrum-android-builder-img electrum/gui/kivy/tools + - sudo docker build --no-cache -t electrum-android-builder-img contrib/android script: - sudo chown -R 1000:1000 . # Output something every minute or Travis kills the job - while sleep 60; do echo "=====[ $SECONDS seconds still running ]====="; done & - - sudo docker run -it -u 1000:1000 --rm --name electrum-android-builder-cont --env CI=true -v $PWD:/home/user/wspace/electrum --workdir /home/user/wspace/electrum electrum-android-builder-img ./contrib/make_apk + - sudo docker run -it -u 1000:1000 --rm --name electrum-android-builder-cont --env CI=true -v $PWD:/home/user/wspace/electrum --workdir /home/user/wspace/electrum electrum-android-builder-img ./contrib/android/make_apk # kill background sleep loop - kill %1 - ls -la bin diff --git a/electrum/gui/kivy/tools/Dockerfile b/contrib/android/Dockerfile similarity index 100% rename from electrum/gui/kivy/tools/Dockerfile rename to contrib/android/Dockerfile diff --git a/contrib/android/Makefile b/contrib/android/Makefile new file mode 100644 index 000000000..cc9268321 --- /dev/null +++ b/contrib/android/Makefile @@ -0,0 +1,33 @@ +PYTHON = python3 + +# needs kivy installed or in PYTHONPATH + +.PHONY: theming apk clean + +theming: + #bash -c 'for i in network lightning; do convert -background none theming/light/$i.{svg,png}; done' + $(PYTHON) -m kivy.atlas ../../electrum/gui/kivy/theming/light 1024 ../../electrum/gui/kivy/theming/light/*.png +prepare: + # running pre build setup + @cp buildozer.spec ../../buildozer.spec + # copy electrum to main.py + @cp ../../run_electrum ../../main.py + @-if [ ! -d "../../.buildozer" ];then \ + cd ../..; buildozer android debug;\ + cp -f blacklist.txt .buildozer/android/platform/python-for-android/src/blacklist.txt;\ + rm -rf ./.buildozer/android/platform/python-for-android/dist;\ + fi +apk: + @make prepare + @-cd ../..; buildozer android debug deploy run + @make clean +release: + @make prepare + @-cd ../..; buildozer android release + @make clean +clean: + # Cleaning up + # rename main.py to electrum + @-rm ../../main.py + # remove buildozer.spec + @-rm ../../buildozer.spec diff --git a/electrum/gui/kivy/Readme.md b/contrib/android/Readme.md similarity index 97% rename from electrum/gui/kivy/Readme.md rename to contrib/android/Readme.md index 220ba76fc..e65c063dd 100644 --- a/electrum/gui/kivy/Readme.md +++ b/contrib/android/Readme.md @@ -24,7 +24,7 @@ folder. 2. Build image ``` - $ sudo docker build -t electrum-android-builder-img electrum/gui/kivy/tools + $ sudo docker build -t electrum-android-builder-img contrib/android ``` 3. Build locale files @@ -50,7 +50,7 @@ folder. -v ~/.keystore:/home/user/.keystore \ --workdir /home/user/wspace/electrum \ electrum-android-builder-img \ - ./contrib/make_apk + ./contrib/android/make_apk ``` This mounts the project dir inside the container, and so the modifications will affect it, e.g. `.buildozer` folder diff --git a/electrum/gui/kivy/tools/bitcoin_intent.xml b/contrib/android/bitcoin_intent.xml similarity index 100% rename from electrum/gui/kivy/tools/bitcoin_intent.xml rename to contrib/android/bitcoin_intent.xml diff --git a/electrum/gui/kivy/tools/blacklist.txt b/contrib/android/blacklist.txt similarity index 100% rename from electrum/gui/kivy/tools/blacklist.txt rename to contrib/android/blacklist.txt diff --git a/electrum/gui/kivy/tools/buildozer.spec b/contrib/android/buildozer.spec similarity index 98% rename from electrum/gui/kivy/tools/buildozer.spec rename to contrib/android/buildozer.spec index e99a53a39..dbcb7cc63 100644 --- a/electrum/gui/kivy/tools/buildozer.spec +++ b/contrib/android/buildozer.spec @@ -22,7 +22,6 @@ source.exclude_exts = spec source.exclude_dirs = bin, build, dist, contrib, electrum/tests, electrum/gui/qt, - electrum/gui/kivy/tools, electrum/gui/kivy/theming/light # (list) List of exclusions using pattern matching source.exclude_patterns = Makefile,setup* @@ -123,7 +122,7 @@ android.add_activities = org.electrum.qr.SimpleScannerActivity #android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png # (str) XML file to include as an intent filters in tag -android.manifest.intent_filters = electrum/gui/kivy/tools/bitcoin_intent.xml +android.manifest.intent_filters = contrib/android/bitcoin_intent.xml # (str) launchMode to set for the main activity android.manifest.launch_mode = singleTask diff --git a/contrib/make_apk b/contrib/android/make_apk similarity index 83% rename from contrib/make_apk rename to contrib/android/make_apk index adcfff559..ddf447ea0 100755 --- a/contrib/make_apk +++ b/contrib/android/make_apk @@ -2,8 +2,8 @@ set -e -CONTRIB="$(dirname "$(readlink -e "$0")")" -ROOT_FOLDER="$CONTRIB"/.. +CONTRIB_ANDROID="$(dirname "$(readlink -e "$0")")" +ROOT_FOLDER="$CONTRIB_ANDROID"/../.. PACKAGES="$ROOT_FOLDER"/packages/ LOCALE="$ROOT_FOLDER"/electrum/locale/ @@ -17,7 +17,7 @@ if [ ! -d "$PACKAGES" ]; then exit 1 fi -pushd ./electrum/gui/kivy/ +pushd ./contrib/android make theming @@ -34,13 +34,13 @@ if [[ -n "$1" && "$1" == "release" ]] ; then export APP_ANDROID_ARCH=arm64-v8a make release else - export P4A_DEBUG_KEYSTORE="$CONTRIB"/android_debug.keystore + 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 # create keystore if needed if [ ! -f "$P4A_DEBUG_KEYSTORE" ]; then - keytool -genkey -v -keystore "$CONTRIB"/android_debug.keystore \ + keytool -genkey -v -keystore "$CONTRIB_ANDROID"/android_debug.keystore \ -alias "$P4A_DEBUG_KEYALIAS" -keyalg RSA -keysize 2048 -validity 10000 \ -dname "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB" \ -storepass "$P4A_DEBUG_KEYSTORE_PASSWD" \ diff --git a/electrum/gui/kivy/Makefile b/electrum/gui/kivy/Makefile deleted file mode 100644 index 59c0c0ad8..000000000 --- a/electrum/gui/kivy/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -PYTHON = python3 - -# needs kivy installed or in PYTHONPATH - -.PHONY: theming apk clean - -theming: - #bash -c 'for i in network lightning; do convert -background none theming/light/$i.{svg,png}; done' - $(PYTHON) -m kivy.atlas theming/light 1024 theming/light/*.png -prepare: - # running pre build setup - @cp tools/buildozer.spec ../../../buildozer.spec - # copy electrum to main.py - @cp ../../../run_electrum ../../../main.py - @-if [ ! -d "../../../.buildozer" ];then \ - cd ../../..; buildozer android debug;\ - cp -f electrum/gui/kivy/tools/blacklist.txt .buildozer/android/platform/python-for-android/src/blacklist.txt;\ - rm -rf ./.buildozer/android/platform/python-for-android/dist;\ - fi -apk: - @make prepare - @-cd ../../..; buildozer android debug deploy run - @make clean -release: - @make prepare - @-cd ../../..; buildozer android release - @make clean -clean: - # Cleaning up - # rename main.py to electrum - @-rm ../../../main.py - # remove buildozer.spec - @-rm ../../../buildozer.spec