# XeSoft Build Delta Evidence Kit

This source-visible Unity Editor package writes the minimum JSON accepted by the browser-local Build Delta Guard evaluator after a successful Player build.

It does not upload anything. It has no networking, telemetry, account, background service, or editor window. Read `Editor/BuildDeltaEvidenceExporter.cs` before installing it.

## What it writes

- `schemaVersion: bdg-summary-v0.1`
- a revision label supplied by the build job;
- Unity version and Player build target;
- eight explicit build-contract labels supplied by the build job;
- `BuildSummary.totalSize` and `BuildSummary.totalTime`;
- registered Unity package name/version pairs.

The first kit intentionally omits texture, audio, shader, Addressables, scene, and duplicated-bundle metrics. Build Delta Guard therefore keeps the result in `REVIEW`; it cannot silently pass with missing optional evidence.

## What it never writes

Output paths, project paths, repository contents, source, logs, asset names, package paths, credentials, personal data, player data, and the build artifact itself are excluded.

## Install

1. Download `com.xesoft.build-delta-evidence-0.1.0.tgz` from `https://tools.xesoft.dev/kits/build-delta-evidence`.
2. In Unity, open **Window → Package Manager**.
3. Use the install menu and choose **Install package from tarball**.
4. Select the downloaded `.tgz` file.

## Required build-job labels

Set these environment variables in both the accepted-baseline and candidate jobs. Use non-sensitive stable labels; their values must match exactly except for `XESOFT_BDG_REVISION`.

```text
XESOFT_BDG_REVISION=main@8f32c1
XESOFT_BDG_ARTIFACT_FORMAT=AAB
XESOFT_BDG_SCRIPTING_BACKEND=IL2CPP
XESOFT_BDG_CONFIGURATION=release
XESOFT_BDG_ARCHITECTURE=ARM64
XESOFT_BDG_STRIPPING_LEVEL=medium
XESOFT_BDG_COMPRESSION=LZ4HC
XESOFT_BDG_BUILD_ENTRY=Build.ReleaseAndroid
XESOFT_BDG_RUNNER_PROFILE=windows-build-a
```

Optional: set `XESOFT_BDG_OUTPUT_DIR` to choose the evidence directory. The default is `Library/XeSoft/BuildDelta` inside the current project. The JSON filename is a filesystem-safe form of the revision label.

## Use

Run the normal Player build. After a successful build, the Editor log reports the local JSON path. Persist the accepted-baseline JSON in the studio's existing CI artifact storage, generate the candidate JSON under the same contract, and paste both into:

`https://tools.xesoft.dev/labs/build-delta-guard`

Nothing pasted into that evaluator leaves the browser. Review the JSON before using it outside the build job.

## Fail-closed behavior

The exporter skips writing a file and logs one bounded warning when:

- a required environment label is absent;
- more than 250 registered packages are present;
- a registered package lacks a non-empty name or version;
- duplicate package names are returned; or
- writing the local file fails.

It does not fail or modify the Player build. Skipped export means there is no comparable evidence; it must not be converted into a passing result.

## Primary API references

- Unity BuildSummary: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Build.Reporting.BuildSummary.html
- Unity post-build callback: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Build.IPostprocessBuildWithReport.html
- Unity PackageInfo: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/PackageManager.PackageInfo.html
- Install a local tarball: https://docs.unity3d.com/6000.0/Documentation/Manual/upm-ui-tarball.html
