play build: absolute --dir stays absolute; gradlew without exec bit is made executable

This commit is contained in:
CRTkafa 2026-10-29 19:45:18 +07:00
parent 0ea7292164
commit ab69ce020c
5 changed files with 29 additions and 5 deletions

View file

@ -14,7 +14,7 @@
// Before Gradle runs, the app module's build file must read -PversionCode / -PversionName in defaultConfig (a literal
// or an env var keeps the AAB at that value; android.injected.version.* does not override it for bundleRelease): a
// warning with the exact line to use. After the build, an AAB whose versionCode is not the planned one is a hard stop.
import { copyFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
import { chmodSync, copyFileSync, existsSync, mkdirSync, statSync, writeFileSync } from 'node:fs';
import { join, relative } from 'node:path';
import { androidSigning } from '../lib/credentials';
import type { Ctx } from '../lib/ctx';
@ -108,6 +108,11 @@ export async function run(ctx: Ctx): Promise<void> {
shipPhase('build', `${plan.task}, versionCode ${code || '?'}`);
const started = Date.now();
mkdirSync(out, { recursive: true });
// a gradlew committed from Windows has no exec bit: macOS / Linux then say "Executable not found: ./gradlew"
if (hasWrapper && process.platform !== 'win32') {
const w = join(t.dir, 'gradlew');
if ((statSync(w).mode & 0o111) === 0) { chmodSync(w, statSync(w).mode | 0o755); log(TAG, `${relative(root, w)} had no exec bit (committed from Windows?): made it executable; commit it with git update-index --chmod=+x`); }
}
const p = rt.spawn(argv, { cwd, stdout: 'pipe', stderr: 'pipe', env: { ...process.env, ...androidSdkEnv(sdk), ...signingEnv(signing) } });
const lines: string[] = [];
const each = (line: string): void => {