feat: 支持多APK与渠道变体,增加自动定位的服务管理CLI
This commit is contained in:
1 parent
7984785610
commit
87652364bc
33 files changed
+1110
-42
No files matched your search
@@ -25,6 +25,7 @@ def main():
|
||||
parser.add_argument('--adb', default='adb')
|
||||
parser.add_argument('--server-cert', help='Trusted server public PEM certificate for LAN HTTPS')
|
||||
parser.add_argument('--device', help='Explicit adb device serial; omit to download only')
|
||||
parser.add_argument('--artifact', help='APK artifact name or sourcePath when the build produces multiple APKs')
|
||||
args = parser.parse_args()
|
||||
token = os.environ.get('REMOTE_BUILD_TOKEN', '')
|
||||
if len(token) < 24:
|
||||
@@ -111,13 +112,16 @@ def main():
|
||||
raise
|
||||
if build['status'] != 'success':
|
||||
raise RuntimeError('Build ' + build['status'])
|
||||
if len(build['artifacts']) != 1:
|
||||
raise RuntimeError('Expected exactly one APK; split APKs unsupported in v0.1')
|
||||
artifact = build['artifacts'][0]
|
||||
artifacts = [a for a in build['artifacts'] if a['name'].lower().endswith('.apk')]
|
||||
selected = [a for a in artifacts if args.artifact in (a['name'], a.get('sourcePath'))] if args.artifact else artifacts
|
||||
if len(selected) != 1:
|
||||
choices = '\n'.join(a['name'] + ' ' + a.get('sourcePath', '') for a in artifacts)
|
||||
raise RuntimeError(f'Build succeeded ({build_id}); select one full APK with --artifact. Split APK installation is unsupported.\n{choices}')
|
||||
artifact = selected[0]
|
||||
content = request('GET', f'/builds/{build_id}/artifacts/' + urllib.parse.quote(artifact['name']))
|
||||
if hashlib.sha256(content).hexdigest() != artifact['hash']:
|
||||
raise RuntimeError('APK checksum mismatch')
|
||||
destination = output / (build_id + '.apk')
|
||||
destination = output / (build_id + '-' + artifact['hash'] + '.apk')
|
||||
destination.write_bytes(content)
|
||||
print(f'\nAPK: {destination}')
|
||||
if args.device:
|
||||
|
||||
Reference in new issue
Block a user