play build: find the Android SDK like Android Studio (ANDROID_HOME, ANDROID_SDK_ROOT, sdk.dir, default folder), pass it in the env, stop before Gradle when missing; doctor shows it. apple upload: size, per-part lines, 20 s heartbeat (api, altool, processing wait), per-part and per-call timeouts, --timeout exits 7 with the resume hint. Pitfall 25
This commit is contained in:
parent
366362d62b
commit
fc524cd2d4
15 changed files with 460 additions and 34 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { afterAll, describe, expect, test } from 'bun:test';
|
||||
import { createPrivateKey, createPublicKey, verify } from 'node:crypto';
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync, utimesSync, writeFileSync } from 'node:fs';
|
||||
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, utimesSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { installedProfiles } from '../cli/apple/build';
|
||||
|
|
@ -349,6 +349,29 @@ describe('CLI dry runs (no store access)', () => {
|
|||
expect(j).toMatchObject({ framework: 'capacitor', dir: 'android', task: ':app:bundleRelease', versionCode: 12, signing: "the project's own signingConfig" });
|
||||
expect(j.command).toContain('-Pandroid.injected.version.code=12');
|
||||
});
|
||||
test('play build: the Android SDK goes to Gradle through the environment; without one it stops before Gradle', () => {
|
||||
const d = project('cli-play-sdk');
|
||||
const marker = join(d, 'gradle-env.txt');
|
||||
touch(d, 'android/gradlew', `#!/bin/sh\necho "$ANDROID_HOME|$ANDROID_SDK_ROOT" > "${marker}"\nexit 3\n`);
|
||||
chmodSync(join(d, 'android/gradlew'), 0o755);
|
||||
const env = { ANDROID_HOME: '', ANDROID_SDK_ROOT: '', ANDROID_KEYSTORE: '' };
|
||||
const run = () => Bun.spawnSync([process.execPath, join(ROOT, 'cli/index.ts'), 'play', 'build', '--version-code', '12', '--no-prebuild', '--allow-stale-web'], { cwd: d, stdout: 'pipe', stderr: 'pipe',
|
||||
env: { ...process.env, ASC_KEY_ID: '', ASC_ISSUER_ID: '', ASC_P8: '', PLAY_SERVICE_ACCOUNT: '', HOME: dir('clihome-sdk'), ...env } });
|
||||
let r = run();
|
||||
expect(r.exitCode).toBe(1);
|
||||
expect(r.stderr.toString()).toContain('no Android SDK found');
|
||||
expect(r.stderr.toString()).toContain('android/local.properties');
|
||||
expect(existsSync(marker)).toBe(false);
|
||||
// sdk.dir in the (gitignored) local.properties is found and handed over; the file is never written
|
||||
const sdk = dir('sdk-folder');
|
||||
mkdirSync(join(sdk, 'platform-tools'), { recursive: true });
|
||||
const props = `sdk.dir=${sdk}\n`;
|
||||
touch(d, 'android/local.properties', props);
|
||||
r = run();
|
||||
expect(r.stdout.toString()).toContain(`Android SDK: ${sdk} (from local.properties)`);
|
||||
expect(readFileSync(marker, 'utf8').trim()).toBe(`${sdk}|${sdk}`);
|
||||
expect(readFileSync(join(d, 'android/local.properties'), 'utf8')).toBe(props);
|
||||
});
|
||||
test('play upload refuses production', () => {
|
||||
const d = project('cli-up');
|
||||
writeFileSync(join(d, 'app.aab'), makeAab('com.example.game', 3));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue