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

MauiBlazorAndroid Scenario #2386

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ __pycache__/

# Python .env file for VS Code
.env
.venv

# Cake - Uncomment if you are using it
# tools/**
Expand Down
7 changes: 7 additions & 0 deletions src/scenarios/mauiblazorandroid/post.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'''
post cleanup script
'''

from shared.postcommands import clean_directories

clean_directories()
49 changes: 49 additions & 0 deletions src/scenarios/mauiblazorandroid/pre.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'''
pre-command
'''
import sys
import os
from zipfile import ZipFile
from performance.logger import setup_loggers, getLogger
from shutil import copyfile
from shared.precommands import PreCommands
from shared.const import PUBDIR
from argparse import ArgumentParser

setup_loggers(True)

parser = ArgumentParser()
parser.add_argument('--unzip', help='Unzip APK and report extracted tree', action='store_true', default=False)
parser.add_argument(
'--apk-name',
dest='apk',
required=True,
type=str,
help='Name of the APK to setup')
args = parser.parse_args()

if not os.path.exists(PUBDIR):
os.mkdir(PUBDIR)
apkname = args.apk
apknamezip = '%s.zip' % (apkname)
if not os.path.exists(apkname):
getLogger().error('Cannot find %s' % (apkname))
exit(-1)
if args.unzip:
if not os.path.exists(apknamezip):
copyfile(apkname, apknamezip)

with ZipFile(apknamezip) as zip:
zip.extractall(os.path.join('.', PUBDIR))

assets_dir = os.path.join(PUBDIR, 'assets')
assets_zip = os.path.join(assets_dir, 'assets.zip')
with ZipFile(assets_zip) as zip:
zip.extractall(assets_dir)

os.remove(assets_zip)
else:
copyfile(apkname, os.path.join(PUBDIR, apkname))



12 changes: 12 additions & 0 deletions src/scenarios/mauiblazorandroid/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'''
C# Console app
'''
from shared.runner import TestTraits, Runner

EXENAME = 'MauiBlazorAndroidDefault'

if __name__ == "__main__":
traits = TestTraits(exename=EXENAME,
guiapp='false',
)
Runner(traits).run()