update .gitignore and gitlab ci
This commit is contained in:
parent
aa418978f3
commit
a24a1d0102
9 changed files with 4 additions and 207 deletions
|
@ -1,113 +0,0 @@
|
|||
import asyncio
|
||||
import keyring
|
||||
import logging
|
||||
import pathlib
|
||||
import platform
|
||||
import sys
|
||||
import lbry.wallet
|
||||
|
||||
from jnius import autoclass
|
||||
from keyring.backend import KeyringBackend
|
||||
from lbry import __version__ as lbrynet_version, build_info
|
||||
from lbry.conf import Config
|
||||
from lbry.extras.daemon.loggly_handler import get_loggly_handler
|
||||
from lbry.extras.daemon.components import DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT
|
||||
from lbry.extras.daemon.daemon import Daemon
|
||||
from lbry.extras.daemon.loggly_handler import get_loggly_handler
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(logging.DEBUG)
|
||||
|
||||
lbrynet_android_utils = autoclass('io.lbry.browser.Utils')
|
||||
service = autoclass('io.lbry.browser.LbrynetService').serviceInstance
|
||||
platform.platform = lambda: 'Android %s (API %s)' % (lbrynet_android_utils.getAndroidRelease(), lbrynet_android_utils.getAndroidSdk())
|
||||
build_info.BUILD = 'dev' if lbrynet_android_utils.isDebug() else 'release'
|
||||
|
||||
# Keyring backend
|
||||
class LbryAndroidKeyring(KeyringBackend):
|
||||
priority = 1
|
||||
|
||||
def __init__(self):
|
||||
self._keystore = lbrynet_android_utils.initKeyStore(service.getApplicationContext())
|
||||
|
||||
def set_password(self, servicename, username, password):
|
||||
context = service.getApplicationContext()
|
||||
lbrynet_android_utils.setPassword(servicename, username, password, context, self._keystore)
|
||||
|
||||
def get_password(self, servicename, username):
|
||||
context = service.getApplicationContext()
|
||||
return lbrynet_android_utils.getPassword(servicename, username, context, self._keystore)
|
||||
|
||||
def delete_password(self, servicename, username):
|
||||
context = service.getApplicationContext()
|
||||
lbrynet_android_utils.deletePassword(servicename, username, context, self._keystore)
|
||||
|
||||
def ensure_directory_exists(path: str):
|
||||
if not os.path.isdir(path):
|
||||
pathlib.Path(path).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def configure_logging(conf):
|
||||
default_formatter = logging.Formatter("%(asctime)s %(levelname)-8s %(name)s:%(lineno)d: %(message)s")
|
||||
|
||||
file_handler = logging.handlers.RotatingFileHandler(
|
||||
conf.log_file_path, maxBytes=2097152, backupCount=5
|
||||
)
|
||||
file_handler.setFormatter(default_formatter)
|
||||
logging.getLogger('lbry').addHandler(file_handler)
|
||||
logging.getLogger('torba').addHandler(file_handler)
|
||||
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(default_formatter)
|
||||
|
||||
log.addHandler(handler)
|
||||
logging.getLogger('lbry').addHandler(handler)
|
||||
logging.getLogger('torba').addHandler(handler)
|
||||
|
||||
logging.getLogger('aioupnp').setLevel(logging.WARNING)
|
||||
logging.getLogger('aiohttp').setLevel(logging.CRITICAL)
|
||||
logging.getLogger('lbry').setLevel(logging.DEBUG if lbrynet_android_utils.isDebug() else logging.INFO)
|
||||
logging.getLogger('torba').setLevel(logging.INFO)
|
||||
|
||||
loggly_handler = get_loggly_handler(conf)
|
||||
loggly_handler.setLevel(logging.ERROR)
|
||||
logging.getLogger('lbry').addHandler(loggly_handler)
|
||||
|
||||
def start():
|
||||
keyring.set_keyring(LbryAndroidKeyring())
|
||||
private_storage_dir = lbrynet_android_utils.getAppInternalStorageDir(service.getApplicationContext())
|
||||
configured_download_dir = lbrynet_android_utils.getConfiguredDownloadDirectory(service.getApplicationContext())
|
||||
|
||||
conf = Config(
|
||||
data_dir=f'{private_storage_dir}/lbrynet',
|
||||
wallet_dir=f'{private_storage_dir}/lbryum',
|
||||
download_dir=configured_download_dir,
|
||||
blob_lru_cache_size=32,
|
||||
components_to_skip=[DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT],
|
||||
save_blobs=False,
|
||||
save_files=False,
|
||||
use_upnp=False
|
||||
)
|
||||
|
||||
for directory in (conf.data_dir, conf.download_dir, conf.wallet_dir):
|
||||
ensure_directory_exists(directory)
|
||||
|
||||
configure_logging(conf)
|
||||
|
||||
log.info('Starting lbry sdk {}'.format(lbrynet_version));
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_debug(lbrynet_android_utils.isDebug())
|
||||
|
||||
daemon = Daemon(conf)
|
||||
try:
|
||||
loop.run_until_complete(daemon.start())
|
||||
loop.run_forever()
|
||||
except (GracefulExit, asyncio.CancelledError):
|
||||
pass
|
||||
finally:
|
||||
loop.run_until_complete(daemon.stop())
|
||||
if hasattr(loop, 'shutdown_asyncgens'):
|
||||
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||
|
||||
if __name__ == '__main__':
|
||||
start()
|
|
@ -1,12 +0,0 @@
|
|||
__version__ = "0.13.1"
|
||||
|
||||
class ServiceApp(App):
|
||||
def build(self):
|
||||
from jnius import autoclass
|
||||
|
||||
Intent = autoclass('android.content.Intent')
|
||||
LbrynetService = autoclass('io.lbry.browser.LbrynetService')
|
||||
|
||||
if __name__ == '__main__':
|
||||
ServiceApp().run()
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
from os.path import join, dirname
|
||||
import sys
|
||||
sys.path.append(join(dirname(__file__), '_applibs'))
|
|
@ -1,76 +0,0 @@
|
|||
import sys
|
||||
import StringIO
|
||||
|
||||
from twisted.trial.runner import (
|
||||
TestLoader,
|
||||
TrialRunner
|
||||
)
|
||||
from twisted.trial.reporter import TreeReporter
|
||||
from twisted.plugin import getPlugins, IPlugin
|
||||
from jnius import autoclass
|
||||
import lbrynet.tests
|
||||
from os import listdir
|
||||
|
||||
str_stream = StringIO.StringIO()
|
||||
|
||||
serviceClass = autoclass('io.lbry.browser.LbrynetTestRunnerService')
|
||||
|
||||
def update_output_in_activity(str):
|
||||
service = serviceClass.serviceInstance
|
||||
if service is not None:
|
||||
service.broadcastTestRunnerOutput(str)
|
||||
|
||||
class AndroidTestReporter(TreeReporter):
|
||||
def addSuccess(self, test):
|
||||
super(TreeReporter, self).addSuccess(test)
|
||||
self.endLine('[OK]', self.SUCCESS)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def addError(self, *args):
|
||||
super(TreeReporter, self).addError(*args)
|
||||
self.endLine('[ERROR]', self.ERROR)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def addFailure(self, *args):
|
||||
super(TreeReporter, self).addFailure(*args)
|
||||
self.endLine('[FAIL]', self.FAILURE)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def addSkip(self, *args):
|
||||
super(TreeReporter, self).addSkip(*args)
|
||||
self.endLine('[SKIPPED]', self.SKIP)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def addExpectedFailure(self, *args):
|
||||
super(TreeReporter, self).addExpectedFailure(*args)
|
||||
self.endLine('[TODO]', self.TODO)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def addUnexpectedSuccess(self, *args):
|
||||
super(TreeReporter, self).addUnexpectedSuccess(*args)
|
||||
self.endLine('[SUCCESS!?!]', self.TODONE)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def startTest(self, test):
|
||||
super(AndroidTestReporter, self).startTest(test)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def endLine(self, message, color):
|
||||
super(AndroidTestReporter, self).endLine(message, color)
|
||||
update_output_in_activity(str_to_basic_html(self._stream.getvalue()))
|
||||
|
||||
def str_to_basic_html(value):
|
||||
return value.replace("\n", "<br>").replace(" ", ' ')
|
||||
|
||||
def run():
|
||||
loader = TestLoader();
|
||||
suite = loader.loadPackage(lbrynet.tests, True)
|
||||
runner = TrialRunner(AndroidTestReporter)
|
||||
runner.stream = str_stream
|
||||
passFail = not runner.run(suite).wasSuccessful()
|
||||
|
||||
print str_stream.getvalue()
|
||||
sys.exit(passFail)
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
|
@ -1 +0,0 @@
|
|||
{"android:available_permissions": ["ACCESS_CHECKIN_PROPERTIES", "ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION", "ACCESS_LOCATION_EXTRA_COMMANDS", "ACCESS_MOCK_LOCATION", "ACCESS_NETWORK_STATE", "ACCESS_NOTIFICATION_POLICY", "ACCESS_SURFACE_FLINGER", "ACCESS_WIFI_STATE", "ACCOUNT_MANAGER", "ADD_SYSTEM_SERVICE", "ADD_VOICEMAIL", "AUTHENTICATE_ACCOUNTS", "BATTERY_STATS", "BIND_ACCESSIBILITY_SERVICE", "BIND_APPWIDGET", "BIND_CARRIER_MESSAGING_SERVICE", "BIND_CARRIER_SERVICES", "BIND_CHOOSER_TARGET_SERVICE", "BIND_DEVICE_ADMIN", "BIND_DREAM_SERVICE", "BIND_INCALL_SERVICE", "BIND_INPUT_METHOD", "BIND_MIDI_DEVICE_SERVICE", "BIND_NFC_SERVICE", "BIND_NOTIFICATION_LISTENER_SERVICE", "BIND_PRINT_SERVICE", "BIND_REMOTEVIEWS", "BIND_TELECOM_CONNECTION_SERVICE", "BIND_TEXT_SERVICE", "BIND_TV_INPUT", "BIND_VOICE_INTERACTION", "BIND_VPN_SERVICE", "BIND_WALLPAPER", "BLUETOOTH", "BLUETOOTH_ADMIN", "BLUETOOTH_PRIVILEGED", "BODY_SENSORS", "BRICK", "BROADCAST_PACKAGE_REMOVED", "BROADCAST_SMS", "BROADCAST_STICKY", "BROADCAST_WAP_PUSH", "CALL_PHONE", "CALL_PRIVILEGED", "CAMERA", "CAPTURE_AUDIO_OUTPUT", "CAPTURE_SECURE_VIDEO_OUTPUT", "CAPTURE_VIDEO_OUTPUT", "CHANGE_COMPONENT_ENABLED_STATE", "CHANGE_CONFIGURATION", "CHANGE_NETWORK_STATE", "CHANGE_WIFI_MULTICAST_STATE", "CHANGE_WIFI_STATE", "CLEAR_APP_CACHE", "CLEAR_APP_USER_DATA", "CONTROL_LOCATION_UPDATES", "DELETE_CACHE_FILES", "DELETE_PACKAGES", "DEVICE_POWER", "DIAGNOSTIC", "DISABLE_KEYGUARD", "DUMP", "EXPAND_STATUS_BAR", "FACTORY_TEST", "FLASHLIGHT", "FORCE_BACK", "FOTA_UPDATE", "GET_ACCOUNTS", "GET_ACCOUNTS_PRIVILEGED", "GET_PACKAGE_SIZE", "GET_TASKS", "GET_TOP_ACTIVITY_INFO", "GLOBAL_SEARCH", "HARDWARE_TEST", "INJECT_EVENTS", "INSTALL_LOCATION_PROVIDER", "INSTALL_PACKAGES", "INSTALL_SHORTCUT", "INTERNAL_SYSTEM_WINDOW", "INTERNET", "KILL_BACKGROUND_PROCESSES", "LOCATION_HARDWARE", "MANAGE_ACCOUNTS", "MANAGE_APP_TOKENS", "MANAGE_DOCUMENTS", "MASTER_CLEAR", "MEDIA_CONTENT_CONTROL", "MODIFY_AUDIO_SETTINGS", "MODIFY_PHONE_STATE", "MOUNT_FORMAT_FILESYSTEMS", "MOUNT_UNMOUNT_FILESYSTEMS", "NFC", "PACKAGE_USAGE_STATS", "PERSISTENT_ACTIVITY", "PROCESS_OUTGOING_CALLS", "READ_CALENDAR", "READ_CALL_LOG", "READ_CONTACTS", "READ_EXTERNAL_STORAGE", "READ_FRAME_BUFFER", "READ_HISTORY_BOOKMARKS", "READ_INPUT_STATE", "READ_LOGS", "READ_OWNER_DATA", "READ_PHONE_STATE", "READ_PROFILE", "READ_SMS", "READ_SOCIAL_STREAM", "READ_SYNC_SETTINGS", "READ_SYNC_STATS", "READ_USER_DICTIONARY", "READ_VOICEMAIL", "REBOOT", "RECEIVE_BOOT_COMPLETED", "RECEIVE_MMS", "RECEIVE_SMS", "RECEIVE_WAP_PUSH", "RECORD_AUDIO", "REORDER_TASKS", "REQUEST_IGNORE_BATTERY_OPTIMIZATIONS", "REQUEST_INSTALL_PACKAGES", "RESTART_PACKAGES", "SEND_RESPOND_VIA_MESSAGE", "SEND_SMS", "SET_ACTIVITY_WATCHER", "SET_ALARM", "SET_ALWAYS_FINISH", "SET_ANIMATION_SCALE", "SET_DEBUG_APP", "SET_ORIENTATION", "SET_POINTER_SPEED", "SET_PREFERRED_APPLICATIONS", "SET_PROCESS_FOREGROUND", "SET_PROCESS_LIMIT", "SET_TIME", "SET_TIME_ZONE", "SET_WALLPAPER", "SET_WALLPAPER_HINTS", "SIGNAL_PERSISTENT_PROCESSES", "STATUS_BAR", "SUBSCRIBED_FEEDS_READ", "SUBSCRIBED_FEEDS_WRITE", "SYSTEM_ALERT_WINDOW", "TRANSMIT_IR", "UNINSTALL_SHORTCUT", "UPDATE_DEVICE_STATS", "USE_CREDENTIALS", "USE_FINGERPRINT", "USE_SIP", "VIBRATE", "WAKE_LOCK", "WRITE_APN_SETTINGS", "WRITE_CALENDAR", "WRITE_CALL_LOG", "WRITE_CONTACTS", "WRITE_EXTERNAL_STORAGE", "WRITE_GSERVICES", "WRITE_HISTORY_BOOKMARKS", "WRITE_OWNER_DATA", "WRITE_PROFILE", "WRITE_SECURE_SETTINGS", "WRITE_SETTINGS", "WRITE_SMS", "WRITE_SOCIAL_STREAM", "WRITE_SYNC_SETTINGS", "WRITE_USER_DICTIONARY", "WRITE_VOICEMAIL"], "android:sdk_installation": ["28", "21", "9c", "/home/akinwale/.buildozer/android/platform/android-sdk-23", "/home/akinwale/.buildozer/android/crystax-ndk-10.3.2"], "cache.build_id": "560", "android:latestmode": "debug", "android:latestapk": "browser-0.13.1-debug.apk", "android:available_permissions_sdk": "23", "cache.gardenlibs": ""}
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -64,4 +64,4 @@ app/google-services.json
|
|||
.vagrant
|
||||
*.hprof
|
||||
app/build
|
||||
app/bin
|
||||
bin
|
||||
|
|
|
@ -7,7 +7,7 @@ build apk:
|
|||
stage: build
|
||||
image: ubuntu:18.04
|
||||
before_script:
|
||||
- apt-get -y update && apt-get -y install build-essential ca-certificates curl git gpg-agent software-properties-common wget zipalign
|
||||
- apt-get -y update && apt-get -y install build-essential ca-certificates curl git gpg-agent openjdk-8-jdk nodejs software-properties-common wget zipalign
|
||||
- export BUILD_VERSION=$($CI_PROJECT_DIR/gradlew -q printVersionName --console=plain | tail -1)
|
||||
artifacts:
|
||||
paths:
|
||||
|
@ -24,7 +24,9 @@ build apk:
|
|||
- apt-get -y update && apt-get -y install yarn git-secret
|
||||
- git secret reveal
|
||||
- git clone https://github.com/lbryio/lbry-react-native
|
||||
- yarn global add react-native-cli
|
||||
- cd lbry-react-native
|
||||
- yarn
|
||||
- rm -rf android # temporary, should be a submodule init?
|
||||
- ln -s $CI_PROJECT_DIR android # create symbolic link
|
||||
- cd android
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue