feat: add isolated Liam square540 head-chest build preset
This commit is contained in:
@@ -12,6 +12,7 @@ parser.add_argument('--startup-loader',action='store_true',help='Production back
|
||||
parser.add_argument('--waiting-session',action='store_true',help='Actual APK + production session/protocol/View/renderer, synthetic transport/audio/native APIs; finite waiting/TALK/dance replay')
|
||||
parser.add_argument('--user-asset-candidate',action='store_true',help='Exact user-authorized correct03 APK; this offline replay uses local media callback doubles and does not assert network admission')
|
||||
parser.add_argument('--media-bundle',default='black-correct03',help='Trusted user-debug bundle, when --user-asset-candidate is set')
|
||||
parser.add_argument('--framing-preset',choices=['legacy','square540-headchest'],default='legacy')
|
||||
parser.add_argument('--framing-zoom',type=float,default=1)
|
||||
parser.add_argument('--framing-center-y',type=float,default=.5)
|
||||
args=parser.parse_args()
|
||||
@@ -113,8 +114,8 @@ object BuildConfig { const val STARTUP_POSTER_RES_ID=1;const val AVATAR_STARTUP_
|
||||
const val EMOTION_MANIFEST_SHA="987e125a7d7a2cde99121b5f5246c82f4dbe36c4899d3d49eaffd1a68bafb887"
|
||||
const val NATURAL_MANIFEST_SHA="0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad"
|
||||
}'''
|
||||
assert 1<=args.framing_zoom<=2 and .4<=args.framing_center_y<=.6
|
||||
build=build.replace('object BuildConfig {','object BuildConfig { const val AVATAR_FRAME_ZOOM='+str(args.framing_zoom)+'f;const val AVATAR_FRAME_CENTER_Y='+str(args.framing_center_y)+'f;')
|
||||
assert (args.framing_preset=='legacy' and 1<=args.framing_zoom<=2 and .4<=args.framing_center_y<=.6) or (args.framing_preset=='square540-headchest' and abs(args.framing_zoom-32/9)<1e-7 and args.framing_center_y==.128125)
|
||||
build=build.replace('object BuildConfig {','object BuildConfig { const val AVATAR_FRAMING_PRESET="'+args.framing_preset+'";const val AVATAR_FRAME_ZOOM='+str(args.framing_zoom)+'f;const val AVATAR_FRAME_CENTER_Y='+str(args.framing_center_y)+'f;')
|
||||
if args.user_asset_candidate:
|
||||
import importlib.util
|
||||
spec=importlib.util.spec_from_file_location('user_startup',ROOT/'scripts/prepare-user-avatar-startup.py');asset_config=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_config)
|
||||
@@ -241,16 +242,16 @@ fun main(args: Array<String>) {
|
||||
StartupAvatarRepository.request(context,{base=it},{pack=it.getOrThrow()});waitReady()
|
||||
if(base!!.body.width==720) {
|
||||
val poster=FramedAvatarPoster(context)
|
||||
for((w,h) in listOf(720 to 1280,360 to 800,800 to 480)) {
|
||||
for((w,h) in listOf(720 to 1280,360 to 800,800 to 480,540 to 540)) {
|
||||
poster.onSizeChanged(w,h,0,0)
|
||||
val zoom=com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_ZOOM
|
||||
val center=com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_CENTER_Y
|
||||
val fitted=bodyFit(w,h,180,320)
|
||||
val composed=bodyFit(w,h,720,1280,zoom,center)
|
||||
val composed=bodyFit(w,h,720,1280,zoom,center,com.gorios.lanvoice.BuildConfig.AVATAR_FRAMING_PRESET)
|
||||
val displayedTop=h/2f+(fitted.top-h/2f)*poster.scaleY+poster.translationY
|
||||
check(poster.scaleX==zoom && poster.scaleY==zoom && kotlin.math.abs(displayedTop-composed.top)<.001f)
|
||||
}
|
||||
println("POSTER_FRAMING|viewports=3|matches_compositor=true|zoom=${com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_ZOOM}|center_y=${com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_CENTER_Y}|device=false")
|
||||
println("POSTER_FRAMING|viewports=4|matches_compositor=true|zoom=${com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_ZOOM}|center_y=${com.gorios.lanvoice.BuildConfig.AVATAR_FRAME_CENTER_Y}|device=false")
|
||||
}
|
||||
check(base!!.body.frameCount==97 && base!!.patches.isEmpty() && base!!.curves.isEmpty())
|
||||
check(pack!!.emotionAdmission=="accepted" && pack!!.emotionAction!!.packages.size==5)
|
||||
@@ -313,7 +314,10 @@ if args.user_asset_candidate and index.get('waiting'):
|
||||
with tempfile.TemporaryDirectory(prefix='baji-runtime-audit-') as td:
|
||||
tmp=Path(td);files=[]
|
||||
for path in (ROOT/'tests/avatar').glob('*.kt'):
|
||||
if path.name not in ('Pack.kt','Context.kt','Graphics.kt','BuildConfig.kt') and not((args.startup_loader or args.waiting_session) and path.name=='Clock.kt') and not(args.waiting_session and path.name=='AndroidLog.kt'):files.append(path)
|
||||
if path.name not in ('Pack.kt','Context.kt','Graphics.kt','BuildConfig.kt') and not(args.framing_preset=='square540-headchest' and path.name=='View.kt') and not((args.startup_loader or args.waiting_session) and path.name=='Clock.kt') and not(args.waiting_session and path.name=='AndroidLog.kt'):files.append(path)
|
||||
if args.framing_preset=='square540-headchest':
|
||||
square_view=(ROOT/'tests/avatar/View.kt').read_text().replace('val width = 480; val height = 848','val width = 540; val height = 540')
|
||||
p=tmp/'View.kt';p.write_text(square_view);files.append(p)
|
||||
if args.startup_loader:
|
||||
clock=(ROOT/'tests/avatar/Clock.kt').read_text().replace('fun getMainLooper() = main','private val owner=Thread.currentThread();fun myLooper(): Looper?=if(Thread.currentThread()===owner) main else null;fun getMainLooper() = main')
|
||||
clock=clock.replace(' fun add(', ' @Synchronized fun add(').replace(' fun remove(', ' @Synchronized fun remove(').replace(' fun advanceBy(', ' @Synchronized fun advanceBy(')
|
||||
|
||||
@@ -29,9 +29,10 @@ def golden(body,patch,x,y,opacity,w,h,crop,zoom=1,center_y=.5):
|
||||
|
||||
def main():
|
||||
parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--runtime',type=Path);parser.add_argument('--synthetic-shape',choices=['480x848','720x1280'],default='720x1280');parser.add_argument('--output',type=Path,required=True)
|
||||
parser.add_argument('--framing-preset',choices=['legacy','square540-headchest'],default='legacy')
|
||||
parser.add_argument('--zoom',type=float,default=1);parser.add_argument('--center-y',type=float,default=.5)
|
||||
args=parser.parse_args();args.output.mkdir(parents=True,exist_ok=True)
|
||||
assert 1<=args.zoom<=2 and .4<=args.center_y<=.6
|
||||
assert (args.framing_preset=='legacy' and 1<=args.zoom<=2 and .4<=args.center_y<=.6) or (args.framing_preset=='square540-headchest' and abs(args.zoom-32/9)<1e-7 and args.center_y==.128125)
|
||||
m=json.loads((args.runtime/'manifest.json').read_text()) if args.runtime else None
|
||||
bw,bh=(m['body']['width'],m['body']['height']) if m else map(int,args.synthetic_shape.split('x'))
|
||||
source=(ROOT/'app/src/main/java/com/gorios/lanvoice/avatar/ContinuousBodyRenderer.kt').read_text()
|
||||
@@ -57,7 +58,7 @@ def main():
|
||||
yy,xx=np.mgrid[:bh,:bw];body=np.empty((bh,bw,4),np.uint8)
|
||||
body[:,:,0]=xx%256;body[:,:,1]=yy%256;body[:,:,2]=((xx//16+yy//16)%2)*255;body[:,:,3]=255
|
||||
patch=np.zeros((22,40,4),np.uint8);patch[:,:,:3]=[211,70,39];patch[:,:,3]=np.arange(40,dtype=np.uint8)[None,:]*6
|
||||
for w,h in [(bw,bh),(360,800),(800,480)]:
|
||||
for w,h in [(bw,bh),(360,800),(800,480),(540,540)]:
|
||||
for opacity in [0,.5,1]:check(body,patch,211.25,112.5,opacity,w,h,f'synthetic-{w}x{h}-opacity{opacity}')
|
||||
check(body,patch,211.25,112.5,1,bw,bh,'synthetic-transform-crop',1)
|
||||
if m is None:
|
||||
@@ -75,7 +76,8 @@ def main():
|
||||
body=np.frombuffer(raw,np.uint8).reshape(bh,bw,4)
|
||||
for level in (0,1,2,3,4):
|
||||
patch=np.asarray(Image.open(args.runtime/row['levels'][level]['path']).convert('RGBA'))
|
||||
check(body,patch,row['x'],row['y'],0 if level==0 else 1,bw,bh,f'frame{i}-level{level}')
|
||||
for vw,vh in ([(bw,bh),(540,540)] if args.framing_preset!='legacy' else [(bw,bh)]):
|
||||
check(body,patch,row['x'],row['y'],0 if level==0 else 1,vw,vh,f'frame{i}-level{level}')
|
||||
assert pipe.stdout.read(1)==b'';assert pipe.wait(timeout=10)==0
|
||||
finally:
|
||||
if pipe.poll() is None:pipe.kill();pipe.wait()
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Finite real GLES preview of the immutable Liam media at the controlled square preset.
|
||||
No generated media, source mutation, Android OES/device/performance claim.
|
||||
"""
|
||||
import argparse, hashlib, importlib.util, json, os, re, subprocess, tempfile
|
||||
from pathlib import Path
|
||||
import cv2
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
|
||||
def main():
|
||||
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--output',type=Path,required=True);a=p.parse_args()
|
||||
a.output.mkdir(parents=True,exist_ok=False)
|
||||
catalog=json.loads((ROOT/'manifests/character-build-profiles.json').read_bytes());preset=catalog['framingPresets']['square540-headchest'];media=catalog['mediaBundles'][preset['mediaBundle']]
|
||||
root=ROOT/'app/src/main/assets'/media['assetRoot'];raw=(root/'manifest.json').read_bytes();assert hashlib.sha256(raw).hexdigest()==preset['indexSha256'];index=json.loads(raw)
|
||||
source=(ROOT/'app/src/main/java/com/gorios/lanvoice/avatar/ContinuousBodyRenderer.kt').read_text()
|
||||
vertex=re.search(r'const val VERTEX="""([\s\S]*?)"""',source)[1]
|
||||
fragment=re.search(r'const val FRAGMENT="""([\s\S]*?)"""',source)[1].replace('#extension GL_OES_EGL_image_external : require','').replace('samplerExternalOES','sampler2D')
|
||||
spec=importlib.util.spec_from_file_location('golden',ROOT/'scripts/check-avatar-shader.py');golden=importlib.util.module_from_spec(spec);spec.loader.exec_module(golden)
|
||||
refs=[r['runtimeManifest'] for r in index['conversationPackages']]+[e['mouthRuntimeManifest'] for e in index['edges'] if 'mouthRuntimeManifest' in e]
|
||||
runtimes={}
|
||||
for ref in refs:
|
||||
m=json.loads((root/ref['path']).read_bytes());runtimes[(Path(ref['path']).parent/m['body']['path']).as_posix()]=(m,root/Path(ref['path']).parent)
|
||||
rows=[];measurements=[];tiles=[]
|
||||
with tempfile.TemporaryDirectory(prefix='square540-gles-') as td:
|
||||
t=Path(td);(t/'vertex').write_text(vertex);(t/'fragment').write_text(fragment)
|
||||
subprocess.run(['cc','-O2',str(ROOT/'tests/avatar-pixels/gles-golden.c'),'-lEGL','-lGLESv2','-lm','-o',str(t/'golden')],check=True)
|
||||
env=dict(os.environ,EGL_PLATFORM='surfaceless',LIBGL_ALWAYS_SOFTWARE='1')
|
||||
for n,clip in enumerate(sorted(root.rglob('*.mp4'))):
|
||||
rel=clip.relative_to(root).as_posix();cap=cv2.VideoCapture(str(clip));total=int(cap.get(cv2.CAP_PROP_FRAME_COUNT));selected={0,total//3,2*total//3,total-1};bounds=[];i=0
|
||||
while True:
|
||||
ok,bgr=cap.read()
|
||||
if not ok:break
|
||||
# Conservative head + raised-hand upper silhouette, not a face landmark detector.
|
||||
ys,xs=np.where(np.max(bgr[:180,170:550],axis=2)<150)
|
||||
if len(ys):bounds.append([int(xs.min())+170,int(ys.min()),int(xs.max())+170,int(ys.max())])
|
||||
if i in selected:
|
||||
body=cv2.cvtColor(bgr,cv2.COLOR_BGR2RGBA);(t/'body').write_bytes(body.tobytes())
|
||||
levels=[0,4] if rel in runtimes else [0]
|
||||
for level in levels:
|
||||
if level:
|
||||
runtime,base=runtimes[rel];row=runtime['patches'][i];patch=np.asarray(Image.open(base/row['levels'][level]['path']).convert('RGBA'));x,y=row['x'],row['y'];opacity=1
|
||||
else:patch=np.array([[[255,0,255,255]]],dtype=np.uint8);x=y=0;opacity=0
|
||||
(t/'patch').write_bytes(patch.tobytes())
|
||||
r=subprocess.run([str(t/'golden'),str(t/'vertex'),str(t/'fragment'),str(t/'body'),str(t/'patch'),str(t/'out'),str(patch.shape[1]),str(patch.shape[0]),str(x),str(y),str(opacity),'540','540','0','720','1280',str(preset['zoom']),str(preset['centerY'])],env=env,capture_output=True,text=True,check=True)
|
||||
actual=np.frombuffer((t/'out').read_bytes(),np.uint8).reshape(540,540,4)[::-1,:,:3]
|
||||
expected=golden.golden(body,patch,x,y,opacity,540,540,0,preset['zoom'],preset['centerY']);diff=np.abs(actual.astype(int)-expected.astype(int));assert diff.max()<=2,(rel,i,level,diff.max())
|
||||
name=f'{n:02d}-{clip.stem}-f{i:03d}-L{level}.png';Image.fromarray(actual).save(a.output/name)
|
||||
rows.append({'clip':rel,'frame':i,'mouthLevel':level,'viewport':[540,540],'maxAbsRGB':int(diff.max()),'image':name})
|
||||
if not level:tiles.append((name,Image.fromarray(actual)))
|
||||
i+=1
|
||||
cap.release();assert i==total
|
||||
measurements.append({'clip':rel,'frames':total,'upperDarkEnvelope':[min(b[0] for b in bounds),min(b[1] for b in bounds),max(b[2] for b in bounds),max(b[3] for b in bounds)],'method':'all decoded frames; RGB<150; search x170:550 y0:180; silhouette includes raised hands; representative head/chin visually reviewed'})
|
||||
sheet=Image.new('RGB',(7*270,8*294),'white');draw=ImageDraw.Draw(sheet)
|
||||
for i,(name,im) in enumerate(tiles):sheet.paste(im.resize((270,270)),((i%7)*270,(i//7)*294));draw.text(((i%7)*270,(i//7)*294+272),name[:40],fill='black')
|
||||
sheet.save(a.output/'contact.jpg',quality=94)
|
||||
report={'status':'passed','preset':preset,'indexSha256':media['indexSha256'],'decodedFrames':sum(r['frames'] for r in measurements),'clipMeasurements':measurements,'glesCases':rows,'device':'not_run','scope':'Production shader strings + decoded 2D texture surrogate on host EGL; original media unchanged; no Android OES/codec/device claim.'}
|
||||
(a.output/'report.json').write_text(json.dumps(report,indent=2)+'\n')
|
||||
html='<!doctype html><meta charset="utf-8"><title>Liam square540 code42 preview</title><style>body{font:16px sans-serif;background:#eee}img{max-width:100%}figure{display:inline-block;margin:8px;width:270px}figure img{width:270px}figcaption{overflow-wrap:anywhere}</style><h1>Liam 540×540 head + upper chest</h1><p>Source ROI (180,-16)–(540,344), zoom=32/9, centerY=.128125. Real offline GLES; device not tested. No media bytes changed.</p><a href="report.json">Measurement / GLES report</a><p><a href="contact.jpg"><img src="contact.jpg"></a></p>'
|
||||
for row in rows:html+=f'<figure><a href="{row["image"]}"><img loading="lazy" src="{row["image"]}"></a><figcaption>{row["image"]}</figcaption></figure>'
|
||||
(a.output/'index.html').write_text(html)
|
||||
print(json.dumps({'status':'passed','clips':len(measurements),'decoded_frames':report['decodedFrames'],'gles_cases':len(rows),'output':str(a.output)}))
|
||||
if __name__=='__main__':main()
|
||||
@@ -12,6 +12,7 @@ from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import struct
|
||||
import tempfile
|
||||
import urllib.request
|
||||
import zipfile
|
||||
@@ -32,10 +33,47 @@ def file_sha(p):
|
||||
return hashlib.file_digest(f, 'sha256').hexdigest()
|
||||
|
||||
|
||||
def dex_float_fields(raw, descriptor='Lcom/gorios/lanvoice/BuildConfig;'):
|
||||
"""Read encoded FLOAT bits: dexdump prints only six significant digits."""
|
||||
def uleb(pos):
|
||||
value=0
|
||||
for shift in range(0,35,7):
|
||||
byte=raw[pos];pos+=1;value|=(byte&127)<<shift
|
||||
if byte<128:return value,pos
|
||||
raise ValueError('invalid DEX uleb')
|
||||
def uint(pos):return struct.unpack_from('<I',raw,pos)[0]
|
||||
def string(index):
|
||||
pos=uint(uint(60)+index*4);_,pos=uleb(pos)
|
||||
return raw[pos:raw.index(b'\0',pos)].decode('utf-8')
|
||||
def typename(index):return string(uint(uint(68)+index*4))
|
||||
for i in range(uint(96)):
|
||||
pos=uint(100)+i*32
|
||||
if typename(uint(pos))!=descriptor:continue
|
||||
data=uint(pos+24);values=uint(pos+28)
|
||||
count,data=uleb(data)
|
||||
for _ in range(3):_,data=uleb(data)
|
||||
fields=[];field_index=0
|
||||
for _ in range(count):
|
||||
delta,data=uleb(data);_,data=uleb(data);field_index+=delta
|
||||
fields.append(string(uint(uint(84)+field_index*8+4)))
|
||||
size,values=uleb(values);floats={}
|
||||
for name in fields[:size]:
|
||||
header=raw[values];values+=1;kind=header&31;length=(header>>5)+1
|
||||
if kind in (0x1e,0x1f):continue # null/boolean have no payload
|
||||
require(kind in (0,2,3,4,6,16,17,23,24,25,26,27), 'unexpected BuildConfig DEX value')
|
||||
payload=raw[values:values+length];values+=length
|
||||
if kind==16:
|
||||
require(length<=4,'invalid DEX float')
|
||||
floats[name]=struct.unpack('<f',b'\0'*(4-length)+payload)[0]
|
||||
return floats
|
||||
raise ValueError('BuildConfig DEX class missing')
|
||||
|
||||
|
||||
def flags(profile, version, media_bundle='black-correct03'):
|
||||
media = select.catalog()['mediaBundles'][media_bundle]
|
||||
pin = media['indexSha256']
|
||||
return ['-PcharacterProfile='+profile, '-PcharacterMediaBundle='+media_bundle,
|
||||
cache_flags = [] if profile != 'liam-test-square540' else ['--project-cache-dir='+str(ROOT/'.runtime/gradle-project-cache'/profile/'square540-headchest')]
|
||||
return cache_flags + ['-PcharacterProfile='+profile, '-PcharacterMediaBundle='+media_bundle,
|
||||
'-PavatarUserNetworkActions='+str(media.get('networkActionsAllowed',False)).lower(),
|
||||
'-PactionVersionCode='+str(version),
|
||||
'-PnaturalManifestSha=0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad',
|
||||
@@ -47,12 +85,15 @@ def flags(profile, version, media_bundle='black-correct03'):
|
||||
|
||||
|
||||
def build_dir(profile):
|
||||
return ROOT/('app/build' if profile == 'main' else 'app/build/characters/'+profile)
|
||||
return select.build_directory(profile)
|
||||
|
||||
|
||||
def verify(apk, profile, version, media_bundle='black-correct03',frame_zoom=1,frame_center_y=.5):
|
||||
catalog = select.catalog()
|
||||
role = catalog['profiles'][profile]
|
||||
framing = select.framing(profile, media_bundle)
|
||||
if framing['id'] != 'legacy':
|
||||
frame_zoom,frame_center_y=framing['zoom'],framing['centerY']
|
||||
media = catalog['mediaBundles'][media_bundle]
|
||||
selected = select.selection(ROOT/'app/src/main/assets', profile, emotion_sha=media['indexSha256'],
|
||||
user_assets=True, mouth=True, startup=True, media_bundle=media_bundle)
|
||||
@@ -78,7 +119,7 @@ def verify(apk, profile, version, media_bundle='black-correct03',frame_zoom=1,fr
|
||||
require(new.read(poster_path)==new.read('assets/'+media['bootstrapRoot']+'poster.png'), 'selected poster mismatch')
|
||||
# Read real DEX static values rather than trusting a generated Java file.
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
dex_text = ''
|
||||
dex_text = '';dex_floats={}
|
||||
for name in new.namelist():
|
||||
if re.fullmatch(r'classes\d*\.dex', name):
|
||||
dex = Path(folder)/name
|
||||
@@ -86,7 +127,7 @@ def verify(apk, profile, version, media_bundle='black-correct03',frame_zoom=1,fr
|
||||
result = subprocess.check_output([str(TOOLS/'dexdump'), str(dex)]).decode('utf-8', errors='replace')
|
||||
match = re.search(r"Class descriptor\s*:\s*'Lcom/gorios/lanvoice/BuildConfig;'([\s\S]*?)(?=\nClass #|\Z)", result)
|
||||
if match:
|
||||
dex_text = match[1]
|
||||
dex_text = match[1];dex_floats=dex_float_fields(new.read(name))
|
||||
break
|
||||
require(dex_text, 'BuildConfig absent from actual DEX')
|
||||
dex_values = dict(re.findall(r"name\s*:\s*'([^']+)'[^\n]*\n\s*type[^\n]*\n\s*access[^\n]*\n\s*value\s*:\s*([^\n]+)", dex_text))
|
||||
@@ -94,6 +135,8 @@ def verify(apk, profile, version, media_bundle='black-correct03',frame_zoom=1,fr
|
||||
'CHARACTER_PROFILE': profile, 'EMOTION_MANIFEST_SHA': media['indexSha256'],
|
||||
'EMOTION_ASSET_ROOT': media['assetRoot'], 'STARTUP_ASSET_ROOT': media['bootstrapRoot'],
|
||||
'STARTUP_MANIFEST_SHA': media['bootstrapSha256']}
|
||||
if 'AVATAR_FRAMING_PRESET' in dex_values or framing['id']!='legacy':
|
||||
expected['AVATAR_FRAMING_PRESET']=framing['id']
|
||||
for field, value in expected.items():
|
||||
require(dex_values.get(field) == '"'+value+'"', 'APK DEX mismatch: '+field)
|
||||
for field, value in {'AVATAR_NETWORK_ACTIONS_ALLOWED': media.get('networkActionsAllowed',False), 'AVATAR_USER_ASSET_CANDIDATE': True,
|
||||
@@ -105,7 +148,7 @@ def verify(apk, profile, version, media_bundle='black-correct03',frame_zoom=1,fr
|
||||
dex_values.get('VERSION_NAME') == '"0.7.14'+role['versionSuffix']+'"', 'APK DEX version mismatch')
|
||||
for field,value in [('AVATAR_FRAME_ZOOM',frame_zoom),('AVATAR_FRAME_CENTER_Y',frame_center_y)]:
|
||||
if field in dex_values or frame_zoom!=1 or frame_center_y!=.5:
|
||||
require(abs(float(dex_values.get(field,'nan'))-value)<.000001,'APK framing mismatch: '+field)
|
||||
require(abs(dex_floats.get(field,float('nan'))-value)<.000001,'APK framing mismatch: '+field)
|
||||
badge = subprocess.check_output([str(TOOLS/'aapt'), 'dump', 'badging', str(apk)], text=True)
|
||||
version_name = '0.7.14'+role['versionSuffix']
|
||||
for value in ("name='"+role['applicationId']+"'", f"versionCode='{version}'",
|
||||
@@ -129,13 +172,13 @@ def verify(apk, profile, version, media_bundle='black-correct03',frame_zoom=1,fr
|
||||
'assets_unchanged': len(selected['files']) if media_bundle=='black-correct03' else None,
|
||||
'network_actions_allowed':media.get('networkActionsAllowed',False),
|
||||
'waiting_contract_enabled':media.get('waitingContract',False),
|
||||
'framing_zoom':frame_zoom,'framing_center_y':frame_center_y,
|
||||
'framing_preset':framing['id'],'framing_zoom':frame_zoom,'framing_center_y':frame_center_y,
|
||||
'poster_resources_unchanged': 2, 'provider_authorities': authorities,
|
||||
'actual_dex_verified': True, 'device': 'not_run', 'gateway_changed': False}
|
||||
|
||||
|
||||
def artifact_name(profile, version):
|
||||
require(profile in ('lvbu-test', 'liam-test'), 'main publication outside this task')
|
||||
require(profile in ('lvbu-test', 'liam-test', 'liam-test-square540'), 'main publication outside this task')
|
||||
return f"lan-voice-v0714-{profile}-code{version}-arm64-debug.apk"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Independent Liam square540 candidate; immutable code41 media and original pipelines retained."""
|
||||
import argparse,importlib.util,json,subprocess
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
spec=importlib.util.spec_from_file_location('persona_pack',ROOT/'scripts/package-character-test.py');pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
|
||||
PROFILE='liam-test-square540';MEDIA='char-waiting-poses-r01';PRESET='square540-headchest'
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--version-code',type=int,default=42);p.add_argument('--build',action='store_true');p.add_argument('--publish',action='store_true');p.add_argument('--output',type=Path,required=True);a=p.parse_args()
|
||||
pack.require(a.version_code>=42,'fresh square540 code required');pack.require(not a.output.exists(),'new report required')
|
||||
if a.publish:pack.require(not (ROOT/'artifacts'/pack.artifact_name(PROFILE,a.version_code)).exists(),'published artifact immutable')
|
||||
if a.build:subprocess.run([str(ROOT/'scripts/build.sh'),':app:assembleDebug',':app:compileDebugAndroidTestKotlin',*pack.flags(PROFILE,a.version_code,MEDIA),'-PavatarFramingPreset='+PRESET],check=True,cwd=ROOT)
|
||||
report=pack.verify(pack.build_dir(PROFILE)/'outputs/apk/debug/app-debug.apk',PROFILE,a.version_code,MEDIA)
|
||||
if a.publish:report=pack.publish(pack.build_dir(PROFILE)/'outputs/apk/debug/app-debug.apk',report)
|
||||
a.output.parent.mkdir(parents=True,exist_ok=True)
|
||||
with a.output.open('x') as out:out.write(json.dumps(report,indent=2,ensure_ascii=False)+'\n')
|
||||
print(json.dumps(report,indent=2,ensure_ascii=False))
|
||||
@@ -34,10 +34,31 @@ def digest(data):
|
||||
|
||||
def catalog():
|
||||
data = json.loads(CATALOG.read_bytes())
|
||||
require(data['schemaVersion'] == 1 and set(data['profiles']) == {'main', 'lvbu-test', 'liam-test'}, 'unsupported profile catalog')
|
||||
require(data['schemaVersion'] == 1 and set(data['profiles']) == {'main', 'lvbu-test', 'liam-test', 'liam-test-square540'}, 'unsupported profile catalog')
|
||||
return data
|
||||
|
||||
|
||||
def framing(profile, media_bundle, preset=None):
|
||||
data = catalog(); role = data['profiles'][profile]
|
||||
expected = role.get('framingPreset', 'legacy')
|
||||
preset = expected if preset is None else preset
|
||||
require(preset == expected, 'profile/framing preset mismatch')
|
||||
if preset == 'legacy':
|
||||
return {'id': preset, 'zoom': 1, 'centerY': .5}
|
||||
row = data['framingPresets'][preset]
|
||||
require(row['profile'] == profile and row['mediaBundle'] == media_bundle and
|
||||
row['indexSha256'] == data['mediaBundles'][media_bundle]['indexSha256'], 'preset/media pin mismatch')
|
||||
return {'id': preset, **row}
|
||||
|
||||
|
||||
def build_directory(profile, preset=None):
|
||||
role = catalog()['profiles'][profile]
|
||||
expected = role.get('framingPreset', 'legacy')
|
||||
require(preset is None or preset == expected, 'profile/framing build directory mismatch')
|
||||
base = ROOT / ('app/build' if profile == 'main' else 'app/build/characters/' + profile)
|
||||
return base if expected == 'legacy' else base / 'framing' / expected
|
||||
|
||||
|
||||
def authorized_debug_sha(pin):
|
||||
return any(row.get('userAuthorizedDebug') is True and row['indexSha256']==pin
|
||||
for row in catalog()['mediaBundles'].values())
|
||||
@@ -53,6 +74,7 @@ def selection(assets, profile='main', *, emotion_sha='', user_assets=False, mout
|
||||
allowed = [role['mediaSelection'], *role.get('additionalMediaSelections', [])]
|
||||
require((role['mediaSelection'] == 'existing-build-flags' and bundle_id in (None,'black-correct03','white-full04')) or
|
||||
bundle_id in allowed and mouth and startup, 'profile/media flags mismatch')
|
||||
preset = framing(profile, bundle_id)
|
||||
bundle = data['mediaBundles'][bundle_id] if bundle_id else None
|
||||
if bundle:
|
||||
require(emotion_sha == bundle['indexSha256'], 'selected exact index mismatch')
|
||||
@@ -126,13 +148,13 @@ def selection(assets, profile='main', *, emotion_sha='', user_assets=False, mout
|
||||
resource = ROOT / bundle.get('resourceDirectory','app/src/main/res') / 'drawable-nodpi' / (bundle['posterResource'] + '.png')
|
||||
require(resource.read_bytes() == poster, 'drawable/bootstrap poster mismatch')
|
||||
return {'schemaVersion': 1, 'profile': profile, 'application_id': role['applicationId'],
|
||||
'persona': role['persona'], 'media_bundle': bundle_id, 'media_identity': bundle['identityId'] if bundle else 'a01',
|
||||
'persona': role['persona'], 'framing_preset': preset['id'], 'media_bundle': bundle_id, 'media_identity': bundle['identityId'] if bundle else 'a01',
|
||||
'index_sha256': emotion_sha, 'files': files, 'file_count': len(files)}
|
||||
|
||||
|
||||
def stage(assets, output, report):
|
||||
output = Path(output)
|
||||
expected = ROOT / ('app/build' if report['profile'] == 'main' else 'app/build/characters/' + report['profile']) / 'generated/packagedAssets'
|
||||
expected = build_directory(report['profile'], report.get('framing_preset')) / 'generated/packagedAssets'
|
||||
require(not output.is_symlink() and output.resolve() == expected, 'staging must use isolated app build output')
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
temporary = Path(tempfile.mkdtemp(prefix='.character-assets-', dir=output.parent))
|
||||
|
||||
Reference in New Issue
Block a user