#!/bin/bash # Generate the client library from the sole Console source owner. set -euo pipefail root=$(cd "$(dirname "$0")/.." && pwd) bash "$root/android_console/build.sh" build=${IOMATEX_ANDROID_CONSOLE_BUILD:-$HOME/.local/share/iomatex-dev/android-console} docker exec iomatex-android-dev bash -c 'cd /tmp/iomatex-console-build/classes && jar cf ../console-classes.jar .' docker cp iomatex-android-dev:/tmp/iomatex-console-build/console-classes.jar "$build/console-classes.jar" python3 - "$build" "$root" <<'PY' import pathlib,sys,zipfile,hashlib,json,subprocess b,root=map(pathlib.Path,sys.argv[1:]);target=b/'evax-console.aar' manifest='''''' with zipfile.ZipFile(target,'w',zipfile.ZIP_DEFLATED) as out: out.writestr('AndroidManifest.xml',manifest);out.write(b/'console-classes.jar','classes.jar');out.writestr('R.txt','') for name in ['jsch','paho','bcprov']:out.write(b/(name+'-android.jar'),'libs/'+name+'.jar') for path in sorted((b/'assets').rglob('*')): if path.is_file():out.write(path,'assets/evaxconsole/'+str(path.relative_to(b/'assets'))) source={str(p.relative_to(root)):hashlib.sha256(p.read_bytes()).hexdigest() for folder in ['android_console','stage_ui/console_core/frontend'] for p in sorted((root/folder).rglob('*')) if p.is_file() and '__pycache__' not in str(p)} metadata={'version':'0.5.0-dev','owner':'Iomatex_OS/android_console','base_commit':subprocess.check_output(['git','-C',str(root),'rev-parse','HEAD'],text=True).strip(),'sha256':hashlib.sha256(target.read_bytes()).hexdigest(),'sources':source} (b/'evax-console.json').write_text(json.dumps(metadata,indent=2)+'\n') print(target) PY