diff --git a/README.md b/README.md index 1d4253a..511d8e9 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Supported options are `--local`, `--cpu {aarch64,arm,x86_64}`, `--no-fetch`, and Each build is one permanent Castle application transaction. Read `out/current/build.json` for its finalized state. On `PASS`, the current package is described by `out/current/package.json` and is at `out/current/kam-mobile.apk`. `build//` is transient working state. Its useful logs are `build//logs/compile.log`, `build//logs/package.log`, and, when apksigner is available and invoked, `build//logs/signature.log`. +After every completed build, the compact logs and final `build.json` are copied to the tracked `build-evidence//` directory. It never contains the temporary application, compiler cache, or APK. ## Source and resources diff --git a/build-evidence/.gitkeep b/build-evidence/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/build-evidence/.gitkeep @@ -0,0 +1 @@ + diff --git a/build-evidence/20260915T055353Z-8d974085/build.json b/build-evidence/20260915T055353Z-8d974085/build.json new file mode 100644 index 0000000..a8667eb --- /dev/null +++ b/build-evidence/20260915T055353Z-8d974085/build.json @@ -0,0 +1,27 @@ +{ + "schema": "kam-android-build/2", + "build_id": "20260915T055353Z-8d974085", + "status": "FAIL", + "cpu": "aarch64", + "abi": "arm64-v8a", + "application": { + "name": "kam_mobile", + "caption": "KaM Remake Mobile", + "package": "org.kammobile.kamremake", + "version": "0.4.0", + "version_code": 30, + "game_unit": "GameInitialize" + }, + "upstream_commit": "962fb850324b79bbe5480e1c2087d98f83a60917", + "resource_count": 1, + "compile": { + "status": "FAIL", + "exit_code": 1 + }, + "package": { + "status": "NOT_RUN", + "exit_code": null + }, + "package_metadata": null, + "error": "/work/vendor/kam_remake/src/settings/KM_GameSettings.pas(6,15) Fatal: Can't find unit Forms used by KM_GameSettings" +} diff --git a/build-evidence/20260915T055353Z-8d974085/logs/adb-version.log b/build-evidence/20260915T055353Z-8d974085/logs/adb-version.log new file mode 100644 index 0000000..9bf960b --- /dev/null +++ b/build-evidence/20260915T055353Z-8d974085/logs/adb-version.log @@ -0,0 +1,5 @@ +$ adb version +Android Debug Bridge version 1.0.41 +Version 35.0.0-11411520 +Installed as /usr/lib/android-sdk/platform-tools/adb +Running on Linux 6.8.0-139-generic (x86_64) diff --git a/build-evidence/20260915T055353Z-8d974085/logs/android-services.log b/build-evidence/20260915T055353Z-8d974085/logs/android-services.log new file mode 100644 index 0000000..820bcfd --- /dev/null +++ b/build-evidence/20260915T055353Z-8d974085/logs/android-services.log @@ -0,0 +1,4 @@ +project service: diagnostic_report_export +source: /work/build/20260915T055353Z-8d974085/application/android_services/diagnostic_report_export +castle destination: /usr/local/castle-engine/tools/build-tool/data/android/services/diagnostic_report_export +status: staged diff --git a/build-evidence/20260915T055353Z-8d974085/logs/compile.log b/build-evidence/20260915T055353Z-8d974085/logs/compile.log new file mode 100644 index 0000000..0bed750 --- /dev/null +++ b/build-evidence/20260915T055353Z-8d974085/logs/compile.log @@ -0,0 +1,38 @@ +$ castle-engine --os=android --cpu=aarch64 --compiler=fpc --mode=debug compile +Compiling project "kam_mobile" for OS / CPU "android / aarch64" in mode "debug". +FPC executing... +Free Pascal Compiler version 3.2.2 [2026/08/04] for aarch64 +Copyright (c) 1993-2021 by Florian Klaempfl and others +/work/vendor/kam_remake/src/common/KM_CommonTypes.pas(79,57) Note: Values in enumeration types have to be ascending +/work/port-source/kam_remake/src/common/KM_CommonClasses.pas(601,3) Note: Local variable "Encoding" not used +/work/port-source/kam_remake/src/common/KM_CommonClasses.pas(1519,22) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/port-source/kam_remake/src/common/KM_CommonClasses.pas(1528,42) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/port-source/kam_remake/src/common/KM_CommonClasses.pas(1654,49) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/port-source/kam_remake/src/common/KM_CommonClasses.pas(1680,33) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/port-source/kam_remake/src/common/KM_CommonClasses.pas(1690,18) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(81,30) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(131,32) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(403,3) Note: Local variable "ErrorStr" not used +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(447,46) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "RawByteString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(461,49) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(462,73) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(463,52) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(527,3) Note: Local variable "sl" not used +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(556,44) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(564,10) Warning: Function result does not seem to be set +/work/port-source/kam_remake/src/utils/io/KM_FileIO.pas(594,10) Warning: Function result does not seem to be set +/work/vendor/kam_remake/src/KM_Log.pas(146,42) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "RawByteString" +/work/vendor/kam_remake/src/KM_Log.pas(148,45) Warning: Implicit string type conversion from "RawByteString" to "UnicodeString" +/work/vendor/kam_remake/src/KM_Log.pas(151,45) Warning: Implicit string type conversion from "RawByteString" to "UnicodeString" +/work/vendor/kam_remake/src/KM_Log.pas(151,50) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/vendor/kam_remake/src/KM_Log.pas(305,30) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/vendor/kam_remake/src/KM_Log.pas(305,76) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/vendor/kam_remake/src/KM_Log.pas(358,3) Note: Local variable "txt" is assigned but never used +/work/vendor/kam_remake/src/KM_Log.pas(480,27) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/vendor/kam_remake/src/KM_Log.pas(480,35) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString" +/work/vendor/kam_remake/src/KM_Log.pas(602,66) Warning: Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString" +/work/vendor/kam_remake/src/settings/KM_GameSettings.pas(6,15) Fatal: Can't find unit Forms used by KM_GameSettings +Fatal: Compilation aborted +Error: /usr/local/fpclazarus/3.2.2/fpc/bin/ppcrossa64 returned an error exitcode +Exception "Exception": +Failed to compile diff --git a/build-evidence/20260915T055353Z-8d974085/logs/java-version.log b/build-evidence/20260915T055353Z-8d974085/logs/java-version.log new file mode 100644 index 0000000..47f7ac4 --- /dev/null +++ b/build-evidence/20260915T055353Z-8d974085/logs/java-version.log @@ -0,0 +1,4 @@ +$ java -version +openjdk version "21.0.12" 2026-07-21 +OpenJDK Runtime Environment (build 21.0.12+8-1-24.04-Ubuntu) +OpenJDK 64-Bit Server VM (build 21.0.12+8-1-24.04-Ubuntu, mixed mode, sharing) diff --git a/build-evidence/20260915T055353Z-8d974085/logs/toolchain.json b/build-evidence/20260915T055353Z-8d974085/logs/toolchain.json new file mode 100644 index 0000000..bdbf602 --- /dev/null +++ b/build-evidence/20260915T055353Z-8d974085/logs/toolchain.json @@ -0,0 +1,38 @@ +{ + "castle": { + "status": "NOT_INSTALLED" + }, + "fpc": { + "status": "NOT_INSTALLED" + }, + "java": { + "status": "PASS", + "exit_code": 0, + "seconds": 0.067, + "command": [ + "java", + "-version" + ], + "log": "build/20260915T055353Z-8d974085/logs/java-version.log", + "output": "$ java -version\nopenjdk version \"21.0.12\" 2026-07-21\nOpenJDK Runtime Environment (build 21.0.12+8-1-24.04-Ubuntu)\nOpenJDK 64-Bit Server VM (build 21.0.12+8-1-24.04-Ubuntu, mixed mode, sharing)\n" + }, + "adb": { + "status": "PASS", + "exit_code": 0, + "seconds": 0.004, + "command": [ + "adb", + "version" + ], + "log": "build/20260915T055353Z-8d974085/logs/adb-version.log", + "output": "$ adb version\nAndroid Debug Bridge version 1.0.41\nVersion 35.0.0-11411520\nInstalled as /usr/lib/android-sdk/platform-tools/adb\nRunning on Linux 6.8.0-139-generic (x86_64)\n" + }, + "paths": {}, + "docker_image_lock": { + "image": "kambi/castle-engine-cloud-builds-tools@sha256:1a67fad233fe7a2e81ed5f750b548c9ef136ed7d36ec061ff96b2e5eb6eaa218", + "image_id": "sha256:1a67fad233fe7a2e81ed5f750b548c9ef136ed7d36ec061ff96b2e5eb6eaa218", + "resolved_from": "kambi/castle-engine-cloud-builds-tools:cge-unstable", + "locked_at": "20260908T161942Z", + "note": "Subsequent runs use this digest, never silently advance the tag." + } +} diff --git a/tools/runner.py b/tools/runner.py index 7e377bd..94ff59a 100755 --- a/tools/runner.py +++ b/tools/runner.py @@ -14,6 +14,7 @@ from artifacts import inspect_elf, inspect_apk from resource_staging import stage_runtime_resources IMAGE_TAG='kambi/castle-engine-cloud-builds-tools:cge-unstable' +BUILD_EVIDENCE_DIR=ROOT/'build-evidence' def cge_command(cpu:str,action:str)->list[str]: if cpu not in CPUS:raise ProbeError('Unsupported Android CPU') if action not in ('compile','package'):raise ProbeError('Not an Android build action') @@ -62,6 +63,15 @@ def _record(build_id:str, cpu:str, status:str, application:dict|None=None, 'package':package or {'status':'NOT_RUN','exit_code':None}, 'package_metadata':package_metadata,'error':error} +def _publish_build_evidence(record:dict)->None: + source=ROOT/'build'/record['build_id']/'logs' + destination=BUILD_EVIDENCE_DIR/record['build_id']/'logs' + destination.mkdir(parents=True,exist_ok=True) + if source.is_dir(): + for path in source.iterdir(): + if path.is_file():shutil.copy2(path,destination/path.name) + write_json(destination.parent/'build.json',record) + def _finish(record:dict)->int: if record['status']!='PASS': CURRENT_OUTPUT_DIR.mkdir(parents=True,exist_ok=True) @@ -69,6 +79,7 @@ def _finish(record:dict)->int: path.unlink(missing_ok=True) record['package_metadata']=None write_json(CURRENT_BUILD_METADATA,record) + _publish_build_evidence(record) return {'PASS':0,'FAIL':1,'BLOCKED':2}[record['status']] def _valid_docker_handoff(record:object,build_id:str,code:int)->bool: