Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(native): repair Windows, Android and DMG release builds (#881)
Genercda389f2eca5
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 05af75ca3..e498b2ef7 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -599,10 +599,14 @@ jobs:run: pnpm --filter @alook/daemon run test:integrationdesktop-rust:- name: Desktop Rust (test + machete)+ name: Desktop Rust (${{ matrix.platform }})needs: scopeif: needs.scope.outputs.run_rust == 'true'- runs-on: ubuntu-latest+ strategy:+ fail-fast: false+ matrix:+ platform: [ubuntu-latest, windows-latest]+ runs-on: ${{ matrix.platform }}timeout-minutes: 15defaults:run:@@ -620,15 +624,23 @@ jobs:CI_PROJECTION_VALUE: ${{ needs.scope.outputs.run_rust }}run: node scripts/ci/validate-execution-plan.mjs- uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable+ with:+ targets: ${{ runner.os == 'Windows' && 'x86_64-pc-windows-msvc' || 'x86_64-unknown-linux-gnu' }}- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2with:workspaces: src/desktop/src-tauri- - uses: taiki-e/install-action@d9585d8b553a3309cc2e7a695952297e311e4c10 # cargo-machete- - run: |+ - if: runner.os == 'Linux'+ uses: taiki-e/install-action@d9585d8b553a3309cc2e7a695952297e311e4c10 # cargo-machete+ - if: runner.os == 'Linux'+ run: |sudo apt-get updatesudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libxdo-dev- - run: cargo test- - run: cargo machete+ - if: runner.os == 'Linux'+ run: cargo test --locked+ - if: runner.os == 'Linux'+ run: cargo machete+ - if: runner.os == 'Windows'+ run: cargo check --locked --target x86_64-pc-windows-msvc --all-targetslighthouse:name: Lighthouse SEOdiff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex f4891d523..d56e20cf3 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -141,6 +141,21 @@ jobs:projectPath: src/desktopargs: --target ${{ matrix.target }}+ - name: Notarize and staple final macOS DMG+ if: runner.os == 'macOS'+ env:+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}+ APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}+ APPLE_API_KEY_PATH: ${{ env.APPLE_API_KEY_PATH }}+ TARGET: ${{ matrix.target }}+ STAGE_TARGET: ${{ matrix.stage-target }}+ VERSION: ${{ steps.version.outputs.version }}+ run: |+ node scripts/ci/notarize-desktop-dmg.mjs \+ --target "$STAGE_TARGET" \+ --version "$VERSION" \+ --source "src/desktop/src-tauri/target/${TARGET}/release"+- name: Stage exact release bytesshell: bashenv:diff --git a/.github/workflows/mobile-release.yml b/.github/workflows/mobile-release.ymlindex 27a8d59a8..43ee6d3fd 100644--- a/.github/workflows/mobile-release.yml+++ b/.github/workflows/mobile-release.yml@@ -279,6 +279,11 @@ jobs:working-directory: src/desktoprun: pnpm tauri android init --ci --skip-targets-install+ - name: Verify Android initialization and toolchain+ run: |+ git diff --exit-code -- src/desktop/src-tauri/gen/android+ node scripts/ci/verify-android-project.mjs --project src/desktop/src-tauri/gen/android+- name: Prepare Android Firebase configurationenv:ANDROID_GOOGLE_SERVICES_JSON: ${{ secrets.ANDROID_GOOGLE_SERVICES_JSON }}diff --git a/scripts/ci/notarize-desktop-dmg.mjs b/scripts/ci/notarize-desktop-dmg.mjsnew file mode 100644index 000000000..ebec627cb--- /dev/null+++ b/scripts/ci/notarize-desktop-dmg.mjs@@ -0,0 +1,75 @@+import { spawnSync } from "node:child_process"+import { lstatSync } from "node:fs"+import { pathToFileURL } from "node:url"++import { parseArgs, resolveSourcePath, targetSpec } from "./desktop-release-artifacts.mjs"++function regularFile(path, label) {+ try {+ const stat = lstatSync(path)+ if (stat.isFile() && stat.size > 0) return+ } catch {+ throw new Error(`${label} must be a nonempty regular file`)+ }+ throw new Error(`${label} must be a nonempty regular file`)+}++function xcrun(args, label, env) {+ const result = spawnSync("xcrun", args, {+ env,+ encoding: "utf8",+ stdio: ["ignore", "pipe", "pipe"],+ timeout: 16 * 60 * 1000,+ })+ if (result.error || result.status !== 0) throw new Error(`${label} failed`)+ return result.stdout+}++export function notarizeDesktopDmg({ target, version, sourceRoot, env = process.env }) {+ if (target !== "macos-aarch64" && target !== "macos-x86_64") {+ throw new Error("DMG notarization requires a macOS release target")+ }+ const dmg = targetSpec(target, version).find(asset => asset.source.endsWith(".dmg"))+ const path = resolveSourcePath(sourceRoot, dmg.source)+ regularFile(path, "Final DMG")+ for (const name of ["APPLE_API_ISSUER", "APPLE_API_KEY", "APPLE_API_KEY_PATH"]) {+ if (!env[name]?.trim()) throw new Error(`Missing required macOS notarization input: ${name}`)+ }+ regularFile(env.APPLE_API_KEY_PATH, "Apple API key file")+ const output = xcrun([+ "notarytool", "submit", path,+ "--key", env.APPLE_API_KEY_PATH,+ "--key-id", env.APPLE_API_KEY,+ "--issuer", env.APPLE_API_ISSUER,+ "--wait", "--timeout", "15m", "--output-format", "json",+ ], "Final DMG notarization submission", env)+ let result+ try {+ result = JSON.parse(output)+ } catch {+ throw new Error("Final DMG notarization returned invalid JSON")+ }+ if (result?.status !== "Accepted") throw new Error("Final DMG notarization was not Accepted")+ xcrun(["stapler", "staple", path], "Final DMG stapling", env)+ xcrun(["stapler", "validate", path], "Final DMG ticket validation", env)+ return path+}++export function main(argv = process.argv.slice(2), runtime = process) {+ const args = parseArgs(["notarize", ...argv])+ const path = notarizeDesktopDmg({ target: args.target, version: args.version, sourceRoot: args.source, env: runtime.env })+ runtime.stdout.write(`Final DMG notarized, stapled and validated: ${path}\n`)+}++export function runIfMain(metaUrl, argvPath = process.argv[1], argv = process.argv.slice(2), runtime = process) {+ if (!argvPath || metaUrl !== pathToFileURL(argvPath).href) return false+ try {+ main(argv, runtime)+ } catch (error) {+ runtime.stderr.write(`${error.message}\n`)+ runtime.exitCode = 1+ }+ return true+}++runIfMain(import.meta.url)diff --git a/scripts/ci/notarize-desktop-dmg.test.ts b/scripts/ci/notarize-desktop-dmg.test.tsnew file mode 100644index 000000000..a35f699cd--- /dev/null+++ b/scripts/ci/notarize-desktop-dmg.test.ts@@ -0,0 +1,218 @@+import { spawnSync } from "node:child_process"+import { createHash } from "node:crypto"+import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs"+import { tmpdir } from "node:os"+import { dirname, join, resolve } from "node:path"+import { pathToFileURL } from "node:url"+import { afterEach, describe, expect, it } from "vitest"++import { targetSpec } from "./desktop-release-artifacts.mjs"+import { notarizeDesktopDmg, runIfMain } from "./notarize-desktop-dmg.mjs"++const directories: string[] = []+const repository = resolve(import.meta.dirname, "../..")+const workflow = readFileSync(join(repository, ".github/workflows/desktop-release.yml"), "utf8")++function workflowRun(name: string): string {+ const start = workflow.indexOf(` - name: ${name}\n`)+ const end = workflow.indexOf(" - name:", start + 1)+ const step = workflow.slice(start, end < 0 ? undefined : end)+ const body = step.split(" run: |\n")[1]+ if (!body) throw new Error(`Missing workflow command: ${name}`)+ return body.replace(/^ /gm, "")+}++function fixture(target = "macos-aarch64") {+ const root = realpathSync(mkdtempSync(join(tmpdir(), "alook-final-dmg-")))+ directories.push(root)+ mkdirSync(join(root, "scripts/ci"), { recursive: true })+ for (const file of ["notarize-desktop-dmg.mjs", "desktop-release-artifacts.mjs", "verify-minisign.mjs"]) {+ cpSync(join(repository, "scripts/ci", file), join(root, "scripts/ci", file))+ }+ const bin = join(root, "bin")+ mkdirSync(bin)+ const source = join(root, "src/desktop/src-tauri/target/offline-target/release")+ const version = "1.2.3"+ for (const asset of targetSpec(target, version)) {+ const file = join(source, asset.source)+ mkdirSync(dirname(file), { recursive: true })+ writeFileSync(file, `original ${asset.name}`)+ }+ const key = join(root, "offline-key.p8")+ writeFileSync(key, "offline key")+ const log = join(root, "commands.jsonl")+ writeFileSync(join(bin, "xcrun"), `#!${process.execPath}+const fs = require("node:fs");+const args = process.argv.slice(2);+fs.appendFileSync(process.env.OFFLINE_COMMAND_LOG, JSON.stringify(args) + "\\n");+const action = args[0] === "notarytool" ? "submit" : args[1];+if (process.env.OFFLINE_FAILURE === action) {+ console.error(process.env.APPLE_API_KEY + process.env.APPLE_API_ISSUER);+ process.exit(19);+}+if (action === "submit") {+ process.stdout.write(process.env.OFFLINE_REPLY || '{"status":"Accepted"}');+} else if (action === "staple") {+ fs.appendFileSync(args[2], "\\nSTAPLED");+}+`, { mode: 0o755 })+ const env = {+ PATH: `${bin}:${process.env.PATH}`,+ TARGET: "offline-target",+ STAGE_TARGET: target,+ VERSION: version,+ RUNNER_TEMP: root,+ GITHUB_ENV: join(root, "github-env"),+ APPLE_API_KEY: "offline-private-key-id",+ APPLE_API_ISSUER: "offline-private-issuer",+ APPLE_API_KEY_PATH: key,+ OFFLINE_COMMAND_LOG: log,+ }+ const stage = join(root, `desktop-release-${target}`)+ const dmg = join(source, targetSpec(target, version).find(asset => asset.source.endsWith(".dmg"))!.source)+ return { root, env, source, stage, dmg, log, version, target }+}++function pipeline(files: ReturnType<typeof fixture>, env: NodeJS.ProcessEnv = files.env) {+ return spawnSync("bash", ["-c", `set -euo pipefail\n${workflowRun("Notarize and staple final macOS DMG")}\n${workflowRun("Stage exact release bytes")}`], {+ cwd: files.root,+ env,+ encoding: "utf8",+ timeout: 15_000,+ })+}++function commands(files: ReturnType<typeof fixture>): string[][] {+ return existsSync(files.log)+ ? readFileSync(files.log, "utf8").trim().split("\n").map(line => JSON.parse(line))+ : []+}++afterEach(() => {+ for (const directory of directories.splice(0)) rmSync(directory, { recursive: true, force: true })+})++describe.skipIf(process.platform === "win32")("actual DMG workflow command boundary", () => {+ it.each(["macos-aarch64", "macos-x86_64"])("stages stapled bytes only after Accepted and validation for %s", target => {+ const files = fixture(target)+ const result = pipeline(files)+ expect(result.status, result.stderr).toBe(0)+ expect(commands(files)).toEqual([+ ["notarytool", "submit", files.dmg, "--key", files.env.APPLE_API_KEY_PATH,+ "--key-id", files.env.APPLE_API_KEY, "--issuer", files.env.APPLE_API_ISSUER,+ "--wait", "--timeout", "15m", "--output-format", "json"],+ ["stapler", "staple", files.dmg],+ ["stapler", "validate", files.dmg],+ ])+ const bytes = readFileSync(files.dmg)+ expect(bytes.toString()).toContain("STAPLED")+ const manifest = JSON.parse(readFileSync(join(files.stage, "manifest.json"), "utf8"))+ const dmg = manifest.files.find((file: { name: string }) => file.name.endsWith(".dmg"))+ expect(dmg.sha256).toBe(createHash("sha256").update(bytes).digest("hex"))+ expect(readFileSync(join(files.stage, dmg.path))).toEqual(bytes)+ })++ it.each(["submit", "staple", "validate"])("fails closed on %s failure before staging and suppresses credential output", action => {+ const files = fixture()+ const result = pipeline(files, { ...files.env, OFFLINE_FAILURE: action })+ expect(result.status).not.toBe(0)+ expect(existsSync(files.stage)).toBe(false)+ expect(result.stdout + result.stderr).not.toContain(files.env.APPLE_API_KEY)+ expect(result.stdout + result.stderr).not.toContain(files.env.APPLE_API_ISSUER)+ expect(commands(files)).toHaveLength({ submit: 1, staple: 2, validate: 3 }[action as "submit" | "staple" | "validate"])+ })++ it.each(['{"status":"Invalid"}', '{"status":"In Progress"}', "null", "not json"])(+ "does not staple or stage an unaccepted response %s", reply => {+ const files = fixture()+ const result = pipeline(files, { ...files.env, OFFLINE_REPLY: reply })+ expect(result.status).not.toBe(0)+ expect(commands(files)).toHaveLength(1)+ expect(existsSync(files.stage)).toBe(false)+ expect(readFileSync(files.dmg, "utf8")).not.toContain("STAPLED")+ },+ )++ it.each(["APPLE_API_KEY", "APPLE_API_ISSUER", "APPLE_API_KEY_PATH"])("rejects missing %s before any external command", name => {+ const files = fixture()+ const result = pipeline(files, { ...files.env, [name]: "" })+ expect(result.status).not.toBe(0)+ expect(result.stderr).toContain(`Missing required macOS notarization input: ${name}`)+ expect(commands(files)).toEqual([])+ expect(existsSync(files.stage)).toBe(false)+ })++ it("rejects a missing final DMG before any submission or stage", () => {+ const files = fixture()+ rmSync(files.dmg)+ const result = pipeline(files)+ expect(result.status).not.toBe(0)+ expect(result.stderr).toContain("Final DMG must be a nonempty regular file")+ expect(commands(files)).toEqual([])+ expect(existsSync(files.stage)).toBe(false)+ })++ it("rejects a missing API key file before any submission or stage", () => {+ const files = fixture()+ rmSync(files.env.APPLE_API_KEY_PATH)+ const result = pipeline(files)+ expect(result.status).not.toBe(0)+ expect(result.stderr).toContain("Apple API key file must be a nonempty regular file")+ expect(commands(files)).toEqual([])+ expect(existsSync(files.stage)).toBe(false)+ })++ it("runs the instrumented helper through the actual external command contract", () => {+ const files = fixture()+ expect(notarizeDesktopDmg({ target: files.target, version: files.version, sourceRoot: files.source, env: files.env })).toBe(files.dmg)+ expect(commands(files)).toHaveLength(3)+ })++ it.each(["submit", "staple", "validate"])("instrumented helper rejects %s command failure", action => {+ const files = fixture()+ expect(() => notarizeDesktopDmg({+ target: files.target, version: files.version, sourceRoot: files.source,+ env: { ...files.env, OFFLINE_FAILURE: action },+ })).toThrow("failed")+ })++ it.each(['{"status":"Invalid"}', "null", "not json"])("instrumented helper rejects response %s", reply => {+ const files = fixture()+ expect(() => notarizeDesktopDmg({+ target: files.target, version: files.version, sourceRoot: files.source,+ env: { ...files.env, OFFLINE_REPLY: reply },+ })).toThrow()+ })++ it("instrumented helper rejects missing inputs and nonregular files without external calls", () => {+ const files = fixture()+ expect(() => notarizeDesktopDmg({ target: "linux-x86_64", version: files.version, sourceRoot: files.source, env: files.env })).toThrow("macOS")+ expect(() => notarizeDesktopDmg({ target: files.target, version: files.version, sourceRoot: files.source, env: { ...files.env, APPLE_API_KEY: "" } })).toThrow("APPLE_API_KEY")+ rmSync(files.dmg)+ expect(() => notarizeDesktopDmg({ target: files.target, version: files.version, sourceRoot: files.source, env: files.env })).toThrow("regular file")+ mkdirSync(files.dmg)+ expect(() => notarizeDesktopDmg({ target: files.target, version: files.version, sourceRoot: files.source, env: files.env })).toThrow("regular file")+ expect(commands(files)).toEqual([])+ })++ it("runs the CLI entry only for its own path and reports command failures", () => {+ const files = fixture()+ const helper = resolve(import.meta.dirname, "notarize-desktop-dmg.mjs")+ let stdout = ""+ let stderr = ""+ const runtime = {+ env: files.env, exitCode: 0,+ stdout: { write: (text: string) => { stdout += text } },+ stderr: { write: (text: string) => { stderr += text } },+ }+ const argv = ["--target", files.target, "--version", files.version, "--source", files.source]+ expect(runIfMain(pathToFileURL(helper).href, undefined, argv, runtime)).toBe(false)+ expect(runIfMain(pathToFileURL(helper).href, `${helper}.other`, argv, runtime)).toBe(false)+ expect(runIfMain(pathToFileURL(helper).href, helper, argv, runtime)).toBe(true)+ expect(stdout).toContain(files.dmg)+ runtime.env = { ...files.env, OFFLINE_FAILURE: "submit" }+ expect(runIfMain(pathToFileURL(helper).href, helper, argv, runtime)).toBe(true)+ expect(runtime.exitCode).toBe(1)+ expect(stderr).toContain("submission failed")+ })+})diff --git a/scripts/ci/verify-android-project.mjs b/scripts/ci/verify-android-project.mjsnew file mode 100644index 000000000..ea8d7c92d--- /dev/null+++ b/scripts/ci/verify-android-project.mjs@@ -0,0 +1,98 @@+import { lstatSync, readFileSync } from "node:fs"+import { join } from "node:path"+import { pathToFileURL } from "node:url"++import { parseArgs } from "./desktop-release-artifacts.mjs"++function read(project, name) {+ const path = join(project, name)+ if (!lstatSync(path).isFile()) throw new Error(`Android project file is not regular: ${name}`)+ return readFileSync(path, "utf8")+}++function dependency(text, declaration, coordinate, label) {+ const escaped = coordinate.replaceAll(".", "\\.")+ const matches = [...text.matchAll(new RegExp(`^\\s*${declaration}\\("${escaped}:([0-9.]+)"\\)\\s*$`, "gm"))]+ if (matches.length !== 1) throw new Error(`Android ${label} declaration must occur exactly once`)+ return matches[0][1]+}++function properties(text) {+ const values = new Map()+ for (const line of text.split(/\r?\n/)) {+ const value = line.trim()+ if (!value || value.startsWith("#") || value.startsWith("!")) continue+ const match = /^([^\s=:]+)\s*[=:]\s*(.*?)\s*$/.exec(value)+ if (!match) throw new Error("Unsupported Android property declaration")+ if (values.has(match[1])) throw new Error(`Duplicate Android property: ${match[1]}`)+ values.set(match[1], match[2])+ }+ return values+}++function applicationJvmTarget(app) {+ for (const [label, pattern] of [+ ["Java source", /^\s*sourceCompatibility\s*=\s*JavaVersion\.VERSION_([A-Z0-9_]+)\s*$/gm],+ ["Java target", /^\s*targetCompatibility\s*=\s*JavaVersion\.VERSION_([A-Z0-9_]+)\s*$/gm],+ ["Kotlin target", /^\s*jvmTarget\s*=\s*"([0-9.]+)"\s*$/gm],+ ]) {+ const targets = [...app.matchAll(pattern)]+ if (targets.length !== 1 || targets[0][1] !== "11") {+ throw new Error(`Android application requires explicit Java/Kotlin JVM target 11 (${label})`)+ }+ }+ return "11"+}++function applicationLint(app) {+ const scripts = [...app.matchAll(/^\s*apply\(\s*from\s*=\s*(.+)\)\s*$/gm)]+ if (scripts.length !== 1 || scripts[0][1] !== 'file("tauri.build.gradle.kts")') {+ throw new Error("Android application must apply the generated Tauri script once through file() for lint compatibility")+ }+ if (/^\s*(?:checkReleaseBuilds|abortOnError)\s*=\s*false\s*$/m.test(app)) {+ throw new Error("Android application must retain release lint and fatal error blocking")+ }+ return { tauriScriptFile: true, releaseLint: true }+}++export function verifyAndroidProject(project) {+ const root = read(project, "build.gradle.kts")+ const buildSrc = read(project, "buildSrc/build.gradle.kts")+ const agp = dependency(root, "classpath", "com.android.tools.build:gradle", "root AGP")+ const supportAgp = dependency(buildSrc, "implementation", "com.android.tools.build:gradle", "buildSrc AGP")+ const kotlin = dependency(root, "classpath", "org.jetbrains.kotlin:kotlin-gradle-plugin", "Kotlin")+ const wrapper = properties(read(project, "gradle/wrapper/gradle-wrapper.properties"))+ const distribution = wrapper.get("distributionUrl")+ if (agp !== "9.3.1" || supportAgp !== agp || kotlin !== "2.2.10" ||+ distribution !== "https\\://services.gradle.org/distributions/gradle-9.6.1-bin.zip") {+ throw new Error("Android toolchain must match CLI2.12.1 root/buildSrc AGP9.3.1, Kotlin2.2.10 and Gradle9.6.1")+ }+ const config = properties(read(project, "gradle.properties"))+ for (const name of ["android.builtInKotlin", "android.newDsl", "android.proguard.failOnMissingFiles"]) {+ if (config.get(name) !== "false") throw new Error(`Android compatibility requires ${name}=false`)+ }+ read(project, "app/proguard-rules.pro")+ const app = read(project, "app/build.gradle.kts")+ const jvmTarget = applicationJvmTarget(app)+ const lint = applicationLint(app)+ return { agp, supportAgp, kotlin, gradle: "9.6.1", builtInKotlin: false, newDsl: false, failOnMissingProguardFiles: false, jvmTarget, ...lint }+}++export function main(argv = process.argv.slice(2), runtime = process) {+ const args = parseArgs(["verify", ...argv])+ if (!args.project) throw new Error("Expected --project Android project directory")+ runtime.stdout.write(`${JSON.stringify(verifyAndroidProject(args.project))}\n`)+}++export function runIfMain(metaUrl, argvPath = process.argv[1], argv = process.argv.slice(2), runtime = process) {+ if (!argvPath || metaUrl !== pathToFileURL(argvPath).href) return false+ try {+ main(argv, runtime)+ } catch (error) {+ runtime.stderr.write(`${error.message}\n`)+ runtime.exitCode = 1+ }+ return true+}++runIfMain(import.meta.url)diff --git a/scripts/ci/verify-android-project.test.ts b/scripts/ci/verify-android-project.test.tsnew file mode 100644index 000000000..cc819748a--- /dev/null+++ b/scripts/ci/verify-android-project.test.ts@@ -0,0 +1,180 @@+import { spawnSync } from "node:child_process"+import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"+import { tmpdir } from "node:os"+import { dirname, join, resolve } from "node:path"+import { pathToFileURL } from "node:url"+import { afterEach, describe, expect, it } from "vitest"++import { runIfMain, verifyAndroidProject } from "./verify-android-project.mjs"++const directories: string[] = []+const canonical = resolve(import.meta.dirname, "../../src/desktop/src-tauri/gen/android")++function fixture() {+ const root = mkdtempSync(join(tmpdir(), "alook-android-toolchain-"))+ directories.push(root)+ for (const file of ["build.gradle.kts", "gradle.properties", "app/build.gradle.kts", "app/proguard-rules.pro", "app/src/main/AndroidManifest.xml"]) {+ mkdirSync(dirname(join(root, file)), { recursive: true })+ cpSync(join(canonical, file), join(root, file))+ }+ mkdirSync(join(root, "buildSrc"))+ writeFileSync(join(root, "buildSrc/build.gradle.kts"), 'plugins { `kotlin-dsl` }\ndependencies {\n implementation("com.android.tools.build:gradle:9.3.1")\n}\n')+ mkdirSync(join(root, "gradle/wrapper"), { recursive: true })+ writeFileSync(join(root, "gradle/wrapper/gradle-wrapper.properties"), 'distributionUrl=https\\://services.gradle.org/distributions/gradle-9.6.1-bin.zip\n')+ return root+}++function change(root: string, file: string, before: string, after: string) {+ const path = join(root, file)+ writeFileSync(path, readFileSync(path, "utf8").replace(before, after))+}++afterEach(() => {+ for (const directory of directories.splice(0)) rmSync(directory, { recursive: true, force: true })+})++describe("post-init Android toolchain validation", () => {+ it("checks fresh support against tracked configuration and leaves custom app/manifest bytes intact", () => {+ const root = fixture()+ const app = readFileSync(join(root, "app/build.gradle.kts"))+ const manifest = readFileSync(join(root, "app/src/main/AndroidManifest.xml"))+ expect(verifyAndroidProject(root)).toEqual({+ agp: "9.3.1", supportAgp: "9.3.1", kotlin: "2.2.10", gradle: "9.6.1", builtInKotlin: false, newDsl: false, failOnMissingProguardFiles: false, jvmTarget: "11", tauriScriptFile: true, releaseLint: true,+ })+ expect(readFileSync(join(root, "app/build.gradle.kts"))).toEqual(app)+ expect(readFileSync(join(root, "app/src/main/AndroidManifest.xml"))).toEqual(manifest)+ })++ it.each([+ 'apply(from = "tauri.build.gradle.kts")',+ "",+ 'apply(from = file("tauri.build.gradle.kts"))\napply(from = "tauri.build.gradle.kts")',+ 'apply(from = file("other.gradle.kts"))',+ ])("rejects incompatible generated-script application: %s", after => {+ const root = fixture()+ change(root, "app/build.gradle.kts", 'apply(from = file("tauri.build.gradle.kts"))', after)+ expect(() => verifyAndroidProject(root)).toThrow("must apply the generated Tauri script once through file()")+ })++ it.each(["checkReleaseBuilds", "abortOnError"])("rejects disabling %s to bypass release lint", name => {+ const root = fixture()+ change(root, "app/build.gradle.kts", "android {", `android {\n lint {\n ${name} = false\n }`)+ expect(() => verifyAndroidProject(root)).toThrow("must retain release lint and fatal error blocking")+ })++ it.each([+ ['jvmTarget = "11"', 'jvmTarget = "1.8"'],+ ["targetCompatibility = JavaVersion.VERSION_11", "targetCompatibility = JavaVersion.VERSION_1_8"],+ ["sourceCompatibility = JavaVersion.VERSION_11", "sourceCompatibility = JavaVersion.VERSION_17"],+ ["targetCompatibility = JavaVersion.VERSION_11", ""],+ ['jvmTarget = "11"', 'jvmTarget = "11"\n jvmTarget = "1.8"'],+ ])("rejects missing or conflicting application JVM target: %s", (before, after) => {+ const root = fixture()+ change(root, "app/build.gradle.kts", before, after)+ expect(() => verifyAndroidProject(root)).toThrow("Android application requires explicit Java/Kotlin JVM target 11")+ })++ it.each([+ ["build.gradle.kts", "gradle:9.3.1", "gradle:8.11.0"],+ ["build.gradle.kts", "kotlin-gradle-plugin:2.2.10", "kotlin-gradle-plugin:1.9.25"],+ ["buildSrc/build.gradle.kts", "gradle:9.3.1", "gradle:8.11.0"],+ ["gradle/wrapper/gradle-wrapper.properties", "gradle-9.6.1-bin.zip", "gradle-8.14.3-bin.zip"],+ ])("rejects incompatible post-init declaration in %s", (file, before, after) => {+ const root = fixture()+ change(root, file, before, after)+ expect(() => verifyAndroidProject(root)).toThrow("Android toolchain must match")+ })++ it.each(["android.builtInKotlin", "android.newDsl", "android.proguard.failOnMissingFiles"])("rejects missing or enabled %s", name => {+ const root = fixture()+ change(root, "gradle.properties", `${name}=false`, `${name}=true`)+ expect(() => verifyAndroidProject(root)).toThrow(`${name}=false`)+ change(root, "gradle.properties", `${name}=true`, "")+ expect(() => verifyAndroidProject(root)).toThrow(`${name}=false`)+ })++ it("rejects absent generated buildSrc rather than trusting local root pins", () => {+ const root = fixture()+ rmSync(join(root, "buildSrc"), { recursive: true })+ expect(() => verifyAndroidProject(root)).toThrow()+ })++ it("requires the app's own ProGuard rules despite the project-wide missing-file compatibility switch", () => {+ const root = fixture()+ const rules = join(root, "app/proguard-rules.pro")+ rmSync(rules)+ expect(() => verifyAndroidProject(root)).toThrow("proguard-rules.pro")+ mkdirSync(rules)+ expect(() => verifyAndroidProject(root)).toThrow("not regular")+ })++ it("rejects conflicting duplicate properties", () => {+ const root = fixture()+ const file = join(root, "gradle.properties")+ writeFileSync(file, readFileSync(file, "utf8") + "\nandroid.newDsl=true\n")+ expect(() => verifyAndroidProject(root)).toThrow("Duplicate Android property: android.newDsl")+ })++ it("rejects malformed declarations and nonregular project files", () => {+ const root = fixture()+ change(root, "gradle.properties", "android.newDsl=false", "unsupported property")+ expect(() => verifyAndroidProject(root)).toThrow("Unsupported Android property declaration")+ rmSync(join(root, "build.gradle.kts"))+ mkdirSync(join(root, "build.gradle.kts"))+ expect(() => verifyAndroidProject(root)).toThrow("not regular")+ rmSync(join(root, "build.gradle.kts"), { recursive: true })+ writeFileSync(join(root, "build.gradle.kts"), "")+ expect(() => verifyAndroidProject(root)).toThrow("declaration must occur exactly once")+ })++ it("runs the CLI entry only for its own path and exposes prebuild failure", () => {+ const root = fixture()+ const helper = resolve(import.meta.dirname, "verify-android-project.mjs")+ let stdout = ""+ let stderr = ""+ const runtime = {+ exitCode: 0,+ stdout: { write: (text: string) => { stdout += text } },+ stderr: { write: (text: string) => { stderr += text } },+ }+ expect(runIfMain(pathToFileURL(helper).href, undefined, ["--project", root], runtime)).toBe(false)+ expect(runIfMain(pathToFileURL(helper).href, `${helper}.other`, ["--project", root], runtime)).toBe(false)+ expect(runIfMain(pathToFileURL(helper).href, helper, ["--project", root], runtime)).toBe(true)+ expect(JSON.parse(stdout).failOnMissingProguardFiles).toBe(false)+ expect(runIfMain(pathToFileURL(helper).href, helper, [], runtime)).toBe(true)+ expect(runtime.exitCode).toBe(1)+ expect(stderr).toContain("Expected --project")+ })++ it("runs the actual CLI with generated files and fails before build on incompatible configuration", () => {+ const root = fixture()+ const helper = resolve(import.meta.dirname, "verify-android-project.mjs")+ const valid = spawnSync(process.execPath, [helper, "--project", root], { encoding: "utf8" })+ expect(valid.status, valid.stderr).toBe(0)+ expect(JSON.parse(valid.stdout).gradle).toBe("9.6.1")+ change(root, "gradle.properties", "android.builtInKotlin=false", "android.builtInKotlin=true")+ const invalid = spawnSync(process.execPath, [helper, "--project", root], { encoding: "utf8" })+ expect(invalid.status).not.toBe(0)+ expect(invalid.stderr).toContain("android.builtInKotlin=false")+ })++ it("rejects the real Java11/Kotlin1.8 release blocker through the prebuild CLI", () => {+ const root = fixture()+ const helper = resolve(import.meta.dirname, "verify-android-project.mjs")+ change(root, "app/build.gradle.kts", 'jvmTarget = "11"', 'jvmTarget = "1.8"')+ const invalid = spawnSync(process.execPath, [helper, "--project", root], { encoding: "utf8" })+ expect(invalid.status).not.toBe(0)+ expect(invalid.stdout).toBe("")+ expect(invalid.stderr).toContain("Android application requires explicit Java/Kotlin JVM target 11 (Kotlin target)")+ })++ it("rejects the original FIR-triggering script form through the prebuild CLI", () => {+ const root = fixture()+ const helper = resolve(import.meta.dirname, "verify-android-project.mjs")+ change(root, "app/build.gradle.kts", 'apply(from = file("tauri.build.gradle.kts"))', 'apply(from = "tauri.build.gradle.kts")')+ const invalid = spawnSync(process.execPath, [helper, "--project", root], { encoding: "utf8" })+ expect(invalid.status).not.toBe(0)+ expect(invalid.stdout).toBe("")+ expect(invalid.stderr).toContain("must apply the generated Tauri script once through file()")+ })+})diff --git a/scripts/ci/workflow-contract.test.ts b/scripts/ci/workflow-contract.test.tsindex e8a7c649a..f80e692ae 100644--- a/scripts/ci/workflow-contract.test.ts+++ b/scripts/ci/workflow-contract.test.ts@@ -688,6 +688,42 @@ describe("CI test budgets", () => {})describe("CI dependency setup", () => {+ it("checks generated Android toolchain and tracked customization before credentials or signed builds", () => {+ const init = mobileReleaseWorkflow.indexOf("- name: Generate Android project support files")+ const verify = mobileReleaseWorkflow.indexOf("- name: Verify Android initialization and toolchain")+ const firebase = mobileReleaseWorkflow.indexOf("- name: Prepare Android Firebase configuration")+ const signing = mobileReleaseWorkflow.indexOf("- name: Prepare Android release signing")+ expect(init).toBeGreaterThan(-1)+ expect(verify).toBeGreaterThan(init)+ expect(firebase).toBeGreaterThan(verify)+ expect(signing).toBeGreaterThan(verify)+ expect(mobileReleaseWorkflow.slice(verify, firebase)).toContain("git diff --exit-code -- src/desktop/src-tauri/gen/android")+ expect(mobileReleaseWorkflow.slice(verify, firebase)).toContain("node scripts/ci/verify-android-project.mjs")+ expect(mobileReleaseWorkflow.slice(verify, firebase)).not.toContain("continue-on-error")+ })++ it("compiles Windows consumers through the existing scoped Rust gate without release credentials", () => {+ const desktopRust = ciJob("desktop-rust")+ expect(desktopRust).toContain("platform: [ubuntu-latest, windows-latest]")+ expect(desktopRust).toContain("if: needs.scope.outputs.run_rust == 'true'")+ expect(desktopRust).toContain("cargo check --locked --target x86_64-pc-windows-msvc --all-targets")+ expect(desktopRust).toContain("run: cargo test --locked")+ expect(desktopRust).not.toContain("secrets.")+ expect(desktopRust).not.toContain("tauri-action")+ })++ it("notarizes the final DMG before immutable staging and keeps the final macOS verifier", () => {+ const submit = desktopReleaseWorkflow.indexOf("- name: Notarize and staple final macOS DMG")+ const stage = desktopReleaseWorkflow.indexOf("- name: Stage exact release bytes")+ const verify = desktopReleaseWorkflow.indexOf("- name: Verify staged macOS bytes")+ expect(submit).toBeGreaterThan(-1)+ expect(stage).toBeGreaterThan(submit)+ expect(verify).toBeGreaterThan(stage)+ expect(desktopReleaseWorkflow.slice(submit, stage)).toContain("if: runner.os == 'macOS'")+ expect(desktopReleaseWorkflow.slice(submit, stage)).not.toContain("continue-on-error")+ expect(desktopMacVerifier).toContain("stapler validate")+ })+it("installs cargo-machete from the pinned release action", () => {const desktopRust = ciJob("desktop-rust")expect(desktopRust).toContain(diff --git a/src/desktop/src-tauri/Cargo.lock b/src/desktop/src-tauri/Cargo.lockindex 02d61fc69..40e317175 100644--- a/src/desktop/src-tauri/Cargo.lock+++ b/src/desktop/src-tauri/Cargo.lock@@ -68,8 +68,8 @@ dependencies = ["unicode-normalization","url","webkit2gtk",- "webview2-com 0.38.2",- "windows 0.61.3",+ "webview2-com",+ "windows 0.62.2",][[package]]@@ -4025,7 +4025,7 @@ dependencies = ["tray-icon","url","webkit2gtk",- "webview2-com 0.39.1",+ "webview2-com","window-vibrancy","windows 0.62.2",]@@ -4344,7 +4344,7 @@ dependencies = ["thiserror 2.0.18","url","webkit2gtk",- "webview2-com 0.39.1",+ "webview2-com","windows 0.62.2",]@@ -4369,7 +4369,7 @@ dependencies = ["tauri-utils","url","webkit2gtk",- "webview2-com 0.39.1",+ "webview2-com","windows 0.62.2","wry",]@@ -5274,20 +5274,6 @@ dependencies = ["rustls-pki-types",]-[[package]]-name = "webview2-com"-version = "0.38.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a"-dependencies = [- "webview2-com-macros",- "webview2-com-sys 0.38.2",- "windows 0.61.3",- "windows-core 0.61.2",- "windows-implement",- "windows-interface",-]-[[package]]name = "webview2-com"version = "0.39.1"@@ -5295,7 +5281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6"dependencies = ["webview2-com-macros",- "webview2-com-sys 0.39.1",+ "webview2-com-sys","windows 0.62.2","windows-core 0.62.2",]@@ -5311,17 +5297,6 @@ dependencies = ["syn 2.0.117",]-[[package]]-name = "webview2-com-sys"-version = "0.38.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c"-dependencies = [- "thiserror 2.0.18",- "windows 0.61.3",- "windows-core 0.61.2",-]-[[package]]name = "webview2-com-sys"version = "0.39.1"@@ -6019,7 +5994,7 @@ dependencies = ["url","webkit2gtk","webkit2gtk-sys",- "webview2-com 0.39.1",+ "webview2-com","windows 0.62.2","windows-core 0.62.2","windows-version",diff --git a/src/desktop/src-tauri/Cargo.toml b/src/desktop/src-tauri/Cargo.tomlindex c74d4025a..93c10e122 100644--- a/src/desktop/src-tauri/Cargo.toml+++ b/src/desktop/src-tauri/Cargo.toml@@ -51,8 +51,8 @@ objc2-user-notifications = { version = "=0.3.2", default-features = false, featuobjc2-web-kit = { version = "=0.3.2", features = ["WKWebView"], default-features = false }[target."cfg(windows)".dependencies]-webview2-com = "=0.38.2"-windows = { version = "=0.61.3", features = ["Data_Xml_Dom", "UI_Notifications"] }+webview2-com = "=0.39.1"+windows = { version = "=0.62.2", features = ["Data_Xml_Dom", "UI_Notifications"] }[target."cfg(target_os = \"linux\")".dependencies]notify-rust = "=4.17.0"diff --git a/src/desktop/src-tauri/gen/android/app/build.gradle.kts b/src/desktop/src-tauri/gen/android/app/build.gradle.ktsindex 1adde7a65..c9b358d6a 100644--- a/src/desktop/src-tauri/gen/android/app/build.gradle.kts+++ b/src/desktop/src-tauri/gen/android/app/build.gradle.kts@@ -165,8 +165,12 @@ android {)}}+ compileOptions {+ sourceCompatibility = JavaVersion.VERSION_11+ targetCompatibility = JavaVersion.VERSION_11+ }kotlinOptions {- jvmTarget = "1.8"+ jvmTarget = "11"}buildFeatures {buildConfig = true@@ -189,7 +193,7 @@ dependencies {androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")}-apply(from = "tauri.build.gradle.kts")+apply(from = file("tauri.build.gradle.kts"))listOf("UniversalDebug",diff --git a/src/desktop/src-tauri/gen/android/build.gradle.kts b/src/desktop/src-tauri/gen/android/build.gradle.ktsindex 353f711f3..379a19db0 100644--- a/src/desktop/src-tauri/gen/android/build.gradle.kts+++ b/src/desktop/src-tauri/gen/android/build.gradle.kts@@ -4,8 +4,8 @@ buildscript {mavenCentral()}dependencies {- classpath("com.android.tools.build:gradle:8.11.0")- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")+ classpath("com.android.tools.build:gradle:9.3.1")+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.10")classpath("com.google.gms:google-services:4.5.0")}}diff --git a/src/desktop/src-tauri/gen/android/gradle.properties b/src/desktop/src-tauri/gen/android/gradle.propertiesindex 2a7ec6959..c9f07d625 100644--- a/src/desktop/src-tauri/gen/android/gradle.properties+++ b/src/desktop/src-tauri/gen/android/gradle.properties@@ -21,4 +21,7 @@ kotlin.code.style=official# resources declared in the library itself and none from the library's dependencies,# thereby reducing the size of the R class for that libraryandroid.nonTransitiveRClass=true-android.nonFinalResIds=false\ No newline at end of file+android.nonFinalResIds=false+android.builtInKotlin=false+android.newDsl=false+android.proguard.failOnMissingFiles=false