Guides/14
Project and build
Build a mod from one folder with esx build, and set its options in esx.toml.
A project is one folder for one mod. esx build makes the plugin, the behavior files and the
archives from that folder, and checks the release. The build needs no configuration: it finds
each input by its place.
Folder layout
mymod/
esx.toml # optional manifest
ids.lock # the object ID of each new record
base/
mymod.esp # optional: a plugin from the Creation Kit or xEdit
items/ # item files: a weapon, armor or another item in a short file
10-pistol.toml
records/ # records files, applied in file name order
10-ammo.json
20-gun.json
behavior/
mygun/
mygun.bhv # one behavior source for each weapon
mygun.lock
animations/first_person/ # the clips of this weapon
assets/ # a Data-style tree: Meshes, Materials, Textures, Sound, ...
meshes/ # model files: Weapons/MyGun/Barrel.glb becomes Meshes/Weapons/MyGun/Barrel.nif
Weapons/MyGun/
Barrel.glb
Barrel.mesh.toml # optional: the job file of the model
papyrus/ # Papyrus source (.psc)
build/ # the output
- The plugin has the name of the folder with
.esp:mymod.esp. With a plugin inbase/, it has the name of that plugin. - A small mod can have one
records.jsonand one<name>.bhvat the top level. - An item file describes a weapon, a piece of armor, ammunition or a misc item.
It is the first route to the records of an item: the build makes the operations from it.
esx item new weapon 10mm --name 'Service pistol' -o mymod/items/10-pistol.tomlwrites one. - A records file is for the records that no item file covers, and for changes to the records of the item files. The build applies the item files first, then the records files.
- A records file is a batch document. In a project it needs no
pluginfield and nocreateheader. The build makes the plugin and names it. A file that has them still works. - One
.bhvfile is one weapon. A mod with two weapons has two folders inbehavior/. - A model file in
meshes/is a glTF 2.0 file (.glb, or.gltfwith its.binfile). The assets step makes a mesh from it, asesx nif importdoes. See Models in a project. - Each folder is optional. A project with only
assets/builds an empty plugin and its archives.
Build
cd mymod
esx --data '/path/to/Fallout 4/Data' build
You can also give the folder: esx build path/to/mymod.
The build runs these steps in order. It stops at the first step that fails, and the error names the step.
| Step | What it does | Output |
|---|---|---|
records |
Makes the plugin: a copy of the base plugin, or an empty plugin. Then expands and applies each item file, and applies each records file. | build/records/<Plugin>, build/records/items/<name>.json |
behavior |
Builds each behavior source on the plugin, one after the other. | build/behavior/, build/behavior.lock.json |
assets |
Copies the asset folders and the behavior files into one tree. Writes Seq/<Name>.seq when the plugin has a start-game-enabled quest. |
build/stage/ |
papyrus |
Compiles papyrus/ with the Creation Kit compiler. |
build/stage/Scripts/ |
pack |
Packs <Name> - Main.ba2 and <Name> - Textures.ba2, with the plugin. |
build/candidate/ |
check |
Runs release check. When it passes, the files become the release. |
build/release/ |
A build writes only into build/. It does not write into the sources or into a game folder.
There are two exceptions. --update-lock writes the ID lock ids.lock and the .lock file beside each behavior source.
The Papyrus compiler keeps its job logs and its source cache in the esx state folder of the user, as esx ck compile does.
A build that fails does not change build/release/, so the last good release stays. This is also true when an after command fails: the new files go back to build/candidate/.
When the release check finds issues, the exit code is 7 and the packed files stay in build/candidate/.
The assets step makes the SEQ file from the plugin. Its report has seq with the file and
the FormIDs of the quests, or null when the plugin has no such quest. Do not put a SEQ file
into an asset folder: the build replaces a file with other bytes and warns with SEQ_REPLACED.
See Startup quests.
The papyrus step needs the Creation Kit. When its tools are not ready, the step is skipped
with the warning PAPYRUS_SKIPPED and the reason. The build fails only when the plugin binds
a script that has source in papyrus/ and no compiled file in Scripts/ of an asset folder.
esx ck doctor shows what is missing.
The graphical interface shows the same build: one row for each step, the report of a step, and the checks of the release with a link from each finding to its record or its file. See Build and check a project.
Options
| Option | Effect |
|---|---|
--dry-run |
Lists the steps, their inputs, their outputs and the commands of the manifest. Writes nothing and runs nothing. |
--step STEP |
Runs only this step. Repeat it for more steps. |
--until STEP |
Stops after this step. |
--skip STEP |
Leaves this step out. Repeat it for more steps. |
--full |
Builds each step again. Removes build/state.json and build/cache/, and reuses nothing. |
--no-hooks |
Does not run the before and after commands of the manifest. |
--update-lock |
Writes the ID lock ids.lock and the .lock file beside each behavior source. |
--progress |
Prints the progress lines to stderr, also when the output is JSON. |
Progress
As each step ends, the build prints one line to stderr: the step, its main number and its time.
$ esx build
records: 27 records, 0.3 s
behavior: 295 records added, 48.2 s
assets: 335 files, 0.1 s
papyrus: skipped
pack: 2 archives, 2.6 s
check: 0 issues, 1.4 s
A step with no input prints skipped. A step that fails prints failed and its time, and the error follows.
A step that took its output from an earlier build prints reused or reused in part before its time, for example behavior: 295 records added, reused in part, 15.5 s.
When the manifest has before or after commands, they have a line too, for example before: 2 of 2 commands.
The lines show when the output format is text, which is the default on a terminal.
When the output is JSON, they show only with --progress. They go to stderr, so stdout is one JSON envelope in each case:
esx build --format json --progress > build.json
A step that makes new output removes the output of each later step that this build does not run,
because that output is then out of date.
For example, esx build --until records after a change of a records file removes build/behavior/, build/stage/ and build/candidate/.
Run the later steps again before you use their output.
What a build reuses
A build does not repeat work whose inputs did not change. build/state.json has, for each step,
a SHA-256 key of its inputs and the hashes of its output. A step reuses its output only when
the key is the same and the output still has its hashes. In each other case the step runs.
| Step | Inputs of the key | What the step reuses |
|---|---|---|
records |
The records files, the values plugin, light, author and masters, the game files |
The plugin. When only a later records file changed, the plugin after the last file that did not change (build/cache/records/). |
behavior |
The plugin of the records step, each source with its lock file and its clips, the asset folders, the game files | The complete output, when nothing changed. When only the plugin changed, the graphs and the animation data of each source (build/cache/behavior/): the step then reads the plugin and makes the behavior records again. |
assets |
For each model of meshes/: the model with its .bin file, the job file, the template and the collision source that the job file names, each material file that the conversion reads, scale and tangents of the [meshes] table, the output path |
The mesh of each model (build/cache/meshes/). The step makes the stage again in each build. The stage has hard links, so this takes less than 1 second. |
papyrus |
Nothing. The compiler runs in each build. | |
pack |
The files of the stage | The two archives. The plugin is copied again. |
check |
The files of the candidate, the game files | The release, when the candidate has the same files and they passed the check with the same game files. The build then runs the after commands and leaves release.new false. |
The key has the content of each file of the project. A game file is large, so its name, its size
and its modification time stand for its content: each plugin, archive and strings file of the
Data folder, and the load order. A build with another version of esx reuses nothing.
In an asset folder, a behavior build reads only .hkx and .txt files, and the names of the
other files. So a change in a texture does not run the behavior step, and a new file name does.
The graphs and the animation data of a source are a function of its build specification, of the list of resource paths and of each resource that the build reads. The cache keeps the hash of each of these, and the step compares them before it takes a file from the cache.
For BountyKit (two weapons, 127 MB of assets), a full build takes 131 seconds, a change of one value in a records file takes 28 seconds and a build without a change takes 1.3 seconds.
--archive FILE names game archives for the behavior step, as in behavior build.
The report
The build prints one JSON envelope. data.steps has one section for each step:
{ "step": "behavior", "status": "ok",
"inputs": ["build/records/mymod.esp", "behavior/mygun/mygun.bhv", "assets"],
"outputs": ["build/behavior", "build/behavior.lock.json"],
"warnings": [], "elapsed_ms": 48211,
"report": { "sources": [{ "source": "behavior/mygun/mygun.bhv", "records_added": 295 }] } }
status is ok, skipped or failed. A step with the status ok also has reused:
none (the step made its output), part or all (the output is that of an earlier build),
and reuse_note tells what the step reused. A step that reuses its output gives its
report and its warnings again. data.full is true for a build with --full.
Each warning in the envelope has a step field.
data.plugin has the record count. data.release lists the release files with their SHA-256.
data.hooks has each command of the manifest with its exit code.
data.summary is the last part of the report, so the text output ends with it:
summary:
result: ok, the release is new
release: build/release
records: 322
light_limit: 322 of 2048 new records of a light plugin, 1726 object IDs left
warnings: 0
result starts with ok or with failed at step. A build that passed says the release is new, the release is current: no input changed or no new release: the check step did not run. A build that did not run the records step or the behavior step did not count the records, so its summary has no records and no light_limit.
When a build fails, the summary is in error.details.summary.
The full report of each step is in build/reports/.
When a step fails, error.details.step names it and error.details.reason gives a stable reason:
| Reason | Meaning |
|---|---|
STEP_INPUT_MISSING |
The output of an earlier step is not there. Run that step first. |
BEHAVIOR_COLLISION |
Two behavior sources use the same name. The error names both. |
BEHAVIOR_PLUGIN |
A behavior source names another plugin than the project. |
BASE_PLUGIN_NAME, BASE_PLUGIN_AMBIGUOUS |
The base plugin has another name than the plugin of the project, or base/ has two or more plugins. |
BASE_PLUGIN_MASTERS, BASE_PLUGIN_LIGHT |
The masters or the light flag of the base plugin differ from the manifest. |
LIGHT_LIMIT |
The plugin has more new records than a light plugin holds. |
ID_LOCK_INVALID |
The ID lock is not a valid lock of this plugin. |
ID_LOCK_CONFLICT |
The ID lock and an id field give one object ID to two records. |
OBJECT_ID_TAKEN, OBJECT_ID_RANGE, OBJECT_ID_INVALID |
The id field of a records file is not a free object ID of the plugin. |
PAPYRUS_TOOLS_MISSING |
The plugin needs a compiled script, and the compiler is not ready. |
RELEASE_ISSUES |
The release check found issues. |
IDS_NOT_PINNED |
The build needs the ID lock for the release, and the project has no ids.lock. The step is check, and the exit code is 7. |
ID_LOCK_STALE |
The build needs the ID lock for the release, and the lock does not have each new record. The step is check, and the exit code is 7. |
HOOK_FAILED |
A before or after command failed. |
SELECT_NO_MATCH |
An include pattern of the manifest selects no file. The step is select. |
SELECT_UNSAFE_NAME |
A ZIP file of from has an entry that names a place outside the archive. |
BUILD_OUTPUT_UNSAFE |
The output folder is not safe for a build. |
BEHAVIOR_LOCK_UNSAFE |
The lock of a behavior source is not a .lock file of its own. |
REQUIRES_ESX |
The manifest needs another version of esx. |
plugin export-records has the reasons EXPORT_NOT_EQUAL, EXPORT_OUTPUT_NOT_EMPTY and
EXPORT_OUTPUT_UNSAFE, and the warnings EXPORT_BINARY_RECORDS and EXPORT_MISSING_DEPENDENCIES.
Start from a plugin
You can make the records in the Creation Kit or in xEdit. Save the plugin into base/ of the
project and run esx build. The project needs no records file:
mymod/
base/
MyMod.esp
assets/
esx --data '/path/to/Fallout 4/Data' build mymod
- The records step copies the base plugin to
build/records/and applies the records files to the copy. It never changes the base plugin. - The project builds a plugin with the name of the base plugin. When
plugininesx.tomlhas another name, the build stops with the reasonBASE_PLUGIN_NAME. base = "path/MyMod.esp"inesx.tomlnames a base plugin in another place. With two or more plugins inbase/and nopluginkey, the build stops withBASE_PLUGIN_AMBIGUOUS.- The build does not change the masters or the light flag of a base plugin. When
mastersorlightinesx.tomlhas another value, the build stops withBASE_PLUGIN_MASTERSorBASE_PLUGIN_LIGHT. - Each record of the base plugin keeps its object ID. A record that a records file adds gets a free ID. The ID lock has only the records that the build adds.
- A light base plugin with an object ID below
800needsid_range = "full". - A records file can change a record of the base plugin (
set,append) and can add records.
The report of the records step has the base plugin in report.base, with its record count.
Export a plugin to records files
esx plugin export-records writes a finished plugin as a project. You then change the
records as text, and esx build makes the plugin.
esx --data '/path/to/Fallout 4/Data' plugin export-records MyMod.esp -o mymod
esx --data '/path/to/Fallout 4/Data' build mymod
| File | Content |
|---|---|
esx.toml |
The plugin name, the masters and the header values. |
records/*.json |
The records as text. |
base/<Plugin> |
The records that the text form cannot hold, as a binary plugin. The build starts from it. |
ids.lock |
The object IDs of the records of the behavior step. Only for a plugin that esx build made. |
- A new record is one
recordentry with its full tree and its object ID, so each record keeps its ID. - An override of a master record is a
copyentry with the fields that differ. - A reference to a record of the plugin is
edid:Name. A record without an editor ID of its own isself:000800. A record of a master isFallout4.esm:01F66B (Ammo308Caliber). - The files are in dependency order: a record comes after the records that it needs. Records that belong together are in one file, with the name of their first record. Small groups that are neighbors go into one file with the name of their most frequent record type.
- Cells, worldspaces, placed references and navmeshes go into the binary plugin. So does a
record with data that the definitions do not decode, a record whose tree does not build
the same record, and each parent or child of such a record.
data.by_signaturegives the count of text and binary records for each type,data.binary_reasonsgives the reason, anddata.binary_detailsgives the first field that differed. - The command builds the records files in a temporary folder and compares the result with
the source, as
plugin diffdoes.data.proof.countsmust be 0 added, 0 removed and 0 changed. If not, the exit code is 7 with the reasonEXPORT_NOT_EQUAL, and the files stay. - The output folder must be new or empty (
EXPORT_OUTPUT_NOT_EMPTY).
--record exports one record, and --with-dependencies adds each record of the plugin that
it refers to, with their parents. This takes one weapon out of a large mod:
esx plugin export-records BigMod.esp -o one-gun --record edid:BigModGun --with-dependencies
For a plugin in build/release/, build/candidate/ or build/behavior/ of esx build, the
command exports build/records/<Plugin> and leaves out the records of the behavior step,
because the build makes them again. ids.lock keeps their object IDs. Put the behavior
sources into the new project. --records-plugin FILE names the plugin of the records step
when it is in another place.
An export of the mod of another person gives you no permission to publish it.
Stable object IDs
The game and each save name a record by its object ID. A released mod must not change the ID of a record, or the items of that record go away from the saves of its users.
Without help, the build gives the IDs in the order of the records: a file with create A and
create B gives A the ID 800 and B the ID 801. A new create at the start of the file
gives A the ID 801. A new behavior source moves about 290 records for each later source.
The ID lock ids.lock in the project folder stops this. It maps each object ID to the editor
ID of its record:
{
"version": 1,
"plugin": "MyMod.esp",
"ids": {
"000800": "MyFamily",
"000801": "MyGun"
}
}
esx build --update-lock
esx build --update-lockwrites the lock from the records of the build. Keep the file with your sources.- Each later build reads the lock and gives each record its ID. This includes the records that the behavior step makes. A new record, a new records file or a new behavior source gets IDs that the lock does not use.
- A build without
--update-lockdoes not write the lock. It warns withID_LOCK_STALEwhen the plugin has records that are not in the lock. Runesx build --update-lockbefore a release. - Without a lock file, the build works as before and warns with
IDS_NOT_PINNED. One build gives this warning one time, also when it has a behavior source. - A build that writes the ZIP file of the release needs a complete lock. Without the file,
the check step fails with the reason
IDS_NOT_PINNED. With records that are not in the file, it fails withID_LOCK_STALE. The exit code is 7, and the build makes no release and no ZIP file.esx build --update-lockcorrects both faults.require_id_lock = falsein the[release]table makes each fault a warning again, andrequire_id_lock = truegives the rule to a build without a ZIP file. - The build never removes a line. The ID of a record that you removed stays reserved. Delete the line to free the ID.
- The lock finds a record by its editor ID. A record without an editor ID gets the warning
ID_LOCK_UNNAMED. Give it an editor ID, or give it anidfield.
An id field in a records file gives one record its object ID without the lock:
{ "op": "create", "signature": "KYWD", "edid": "MyFamily", "id": "000800" }
create and copy with as_new take the field. The build stops when a record of the plugin
has the ID (OBJECT_ID_TAKEN) or when the ID is out of the range (OBJECT_ID_RANGE). An id
field wins over the lock.
Light plugin limit
A new plugin is a light plugin by default. id_range in esx.toml sets the object IDs that
new records can get:
id_range |
Object IDs | New records |
|---|---|---|
"high" (default) |
800 to FFF |
2,048 |
"full" |
800 to FFF, then 001 to 7FF |
4,095 |
The build gives IDs upward from 800. With "full", it continues at 001 after FFF, so
the change from "high" to "full" moves no record.
The IDs below 800 need a plugin with header version 1.0 and one master or more, in Fallout 4.
Fallout 4 VR does not have them. esx takes this rule from xEdit (allow_hardcoded_range_use
in crates/esx-plugin/src/fileops.rs, a port of wbImplementation.pas). The rule names the
header version only, and no version of the game program. A plugin with header version 0.95
has the IDs 800 to FFF. esx writes header version 1.0 into a new Fallout 4 plugin. Use
"full" only when each game version of your users reads the IDs below 800.
One behavior source adds about 290 records. data.plugin.light_limit.ids_left shows how many
IDs are left. The build warns with LIGHT_LIMIT_NEAR when fewer than 410 are left. It stops
with LIGHT_LIMIT when no ID is left. Set id_range = "full", or set light = false to
build a full plugin.
Several weapons in one mod
Give each weapon its own .bhv file. The build runs the sources in the order of their
folder names. Each source builds on the plugin that the source before it made.
All sources write into one folder, build/behavior/.
build/behavior.lock.json lists the files of each source. The pack step keeps a copy for
the candidate, and the check step keeps it for the release (build/release.behavior.lock.json).
release check on a plugin in build/release/ or build/candidate/ uses the lock of that
folder, so it checks the files of every weapon. A later partial build does not change the lock of the release.
Before the build writes a behavior file, it checks that the sources do not collide. Two sources must not have:
- the same mod name (the first line of the source). The generated record editor IDs start with it;
- the same weapon;
- the same animation keyword;
- the same
prefixwith the same weapon name, which gives the same clip folder; - the same output graph file, or another output file with different content. Give each source its own
prefix; - a generated record with the same editor ID as a record of the plugin.
The error has the reason BEHAVIOR_COLLISION and names both sources.
Two weapons can change the same action. For an action whose IDLE records are in a vanilla tree (the first-person grenade throw), the selections of each weapon stay in that tree, in build order.
The .lock file beside a source pins the hashes of the vanilla graphs. esx build does not
write it, because a build does not write into the sources. Run esx build --update-lock
to write it. Without the file, the build gives the warning BEHAVIOR_BASE_NOT_PINNED.
The manifest
esx.toml in the project folder replaces a convention. Each key is optional.
plugin = "MyMod.esp"
base = "base/MyMod.esp"
light = true
esm = false
author = "Me"
description = "My mod"
header_version = 1.0
masters = ["Fallout4.esm"]
id_lock = "ids.lock"
id_range = "high"
requires_esx = ">=0.1"
records = ["records/*.json"]
items = ["items/*.toml"]
assets = ["assets", "input/donor"]
papyrus = "papyrus"
[meshes]
folder = "meshes"
scale = 69.99125
tangents = "auto"
[[behavior]]
source = "behavior/mygun/mygun.bhv"
asset_dirs = ["input/donor-clips"]
[[behavior]]
source = "behavior/myrifle/myrifle.bhv"
[build]
output = "build"
zip = true
before = ["7z x input/donor.7z -oinput/donor -aos"]
[release]
require_id_lock = true
loose_dependencies = ["Scripts/F4SE/**"]
overrides = ["RACE:*", "LVLI:LL_Vendor_Weapon_GunSpecialty"]
| Key | Meaning | Default |
|---|---|---|
plugin |
The file name of the plugin. | The name of the base plugin, or else the folder name with .esp |
base |
The plugin that the records step starts from. See Start from a plugin. | The plugin in base/, or else an empty plugin |
light |
Make a light plugin. | true |
esm |
Set or clear the ESM flag of the plugin header. | Not set for a new plugin |
author |
The author in the plugin header. | None |
description |
The description in the plugin header. | None |
header_version |
The version in the plugin header, 1.0 or 0.95. id_range = "full" needs 1.0. |
1.0 for a new plugin |
masters |
The masters of a new plugin. | ["Fallout4.esm"] |
id_lock |
The ID lock: the file that maps each new record to its object ID. Its name ends with .lock. |
ids.lock |
id_range |
The object IDs of new records: "high" or "full". See Light plugin limit. |
"high" |
requires_esx |
The esx versions that can build the project, in the notation of Cargo: >=0.2, >=0.2, <0.5, =0.3.1. |
Any |
records |
The records files, in this order. * and ? are for the file name only. |
records.json, then records/*.json |
items |
The item files, in this order. * and ? are for the file name only. |
items/*.toml |
assets |
Data-style folders. A file of a later folder replaces the same file of an earlier one. An entry can be a table that selects files; see “Files of another folder”. | assets |
papyrus |
The folder with Papyrus source. | papyrus |
[meshes] folder |
The folder with the model files. | meshes |
[meshes] scale |
The count of game units for one unit of a model, for a job file with no scale key when the model file has no scale of its own. 1.0 is for models in game units. |
69.99125: one unit is 1 meter |
[meshes] tangents |
"auto" or "calculate", for a job file with no tangents key. |
"auto" |
[[behavior]] source |
A behavior source. The tables are in build order. | Each .bhv at the top level, then each one in behavior/*/ |
[[behavior]] asset_dirs |
Clip folders for this source only. They are not packed. An entry can be a table that selects files. | None |
[[behavior]] lock |
The lock file of the source. | The source path with .lock |
[build] output |
The output folder. | build |
[build] zip |
true writes build/<Name>.zip with the files of the release, after the check step passed. A file name ("MyMod-1.0.zip") gives the name; the file is always in the output folder. |
No ZIP file |
[build] links |
false makes the build copy each file. By default the stage and the selections have hard links. |
true |
[build] before |
Commands that run before the first step. | None |
[build] after |
Commands that run after the check step passed. | None |
[release] require_id_lock |
true: the check step fails when ids.lock is missing or does not have each new record. See Stable object IDs. |
true when [build] zip is set, else false |
[release] loose_dependencies |
Patterns of Data paths, in the pattern language of an assets table. A loose file of the Data folder that matches is a declared dependency of the mod. |
None |
[release] overrides |
Patterns SIG or SIG:EditorID, where * is any text. With the key, an override record that matches no pattern gives the warning OVERRIDE_UNDECLARED. An empty list says that the mod has no intended override. |
No check |
The values light, author and masters are for a new plugin. When the manifest sets one,
it wins over the create header of a records file. With a base plugin, the build checks
light and masters against that plugin. The build writes esm, author, description and
header_version into the plugin, also into the copy of a base plugin.
The asset folders are also clip folders of each behavior source. They must not contain
behavior graphs or AnimTextData of another mod. A plugin or an archive in an asset folder is not packed.
esx resolves relative paths from the folder of the manifest. An unknown key is an error that names the valid keys.
Each command that reads the manifest checks requires_esx.
Files of another folder
An entry of assets or asset_dirs can be a table. It takes files from a folder or from a
ZIP file, and needs no shell command, so it works on Windows, Linux and macOS.
assets = [
"assets",
{ from = "input/donor", include = ["Meshes/Actors/Donor/Gun", "Sound/FX/Gun"], exclude = ["**/Gun_*/**", "**/*.txt"] },
{ from = "input/donor.zip", include = ["Textures/Gun/*.dds"] },
]
| Key | Meaning |
|---|---|
from |
The folder or the ZIP file that has the files. A 7z or RAR file must be unpacked first. |
include |
The patterns of the files to take. Without the key, the entry takes each file. A pattern that selects no file stops the build with SELECT_NO_MATCH. |
exclude |
The patterns of the files to leave out. |
A pattern is a path from from with /. * is any text in one name, ? is one character
and a part ** is any number of folders. As the last part, ** is what is in a folder: **/Gun_*/**
matches each file in a folder Gun_Alt, and not a file Gun_Ammo.nif. A pattern that names a
folder selects each file in it. Letter case is ignored, as in the game.
The build makes one folder for each table in build/select/ and uses it as an asset folder.
The game reads actors and Actors as one folder, and so does a selection: two folders that
differ only in letter case become one. The folders that an include pattern names without a
wildcard take the spelling of the pattern, so Meshes/Actors/Donor/Gun gives Actors when
the donor has actors. The stage step merges folders in the same way, and there the first
spelling stays.
The ZIP file of the release
zip = true in the [build] table writes build/<Name>.zip after the check step passed, and
before the after commands. The file has each file of build/release/, with no folder. The
same release gives the same bytes: the entries are in the order of their names, and each has
the time 1980-01-01 and the mode 644. When an after command fails, the ZIP file of the
last release comes back with the release.
Hard links
The stage (build/stage/), the selections and the behavior output have hard links to the
files that they come from, so a build folder needs less disk space: for BountyKit, 338 MB for
the project with its build folder, where copies need 540 MB. A link shares its
content with the source file. The build never writes into such a file: it removes the file and
makes a new one. A file of Scripts/ is always a copy, because the Papyrus compiler writes
there. Do not change a file in build/ in place with another program. When the file system
cannot make a link (another drive, a file system without links), the build copies the file.
links = false makes the build copy each file.
Commands before and after the build
before and after are shell commands that the mod author writes. They do the work that
is not a step of the build: extract a 7z input, or copy the release to another place.
These commands can do anything that you can do on your computer. Read them before you build the project of another person.
esx build --dry-run prints them, and --no-hooks skips them.
- They run in the project folder, in the order of the list.
- On Linux and macOS they run through
sh -c. On Windows they run throughcmd /C, so write commands thatcmdknows. - The environment has
ESX_PROJECT_DIR,ESX_BUILD_DIR,ESX_RELEASE_DIRandESX_PLUGIN. beforeruns before the first step, also for a partial build. Abeforecommand can make inputs: the build reads the folders after it.afterruns only when the check step passed.- A command that fails stops the build with the reason
HOOK_FAILED. - The report has each command with its exit code and the end of its output.
The output folder
A build removes and makes again the folders records, behavior, stage, candidate,
release and reports in the output folder. To protect other files, the build refuses an output folder that:
- is the project folder or contains it;
- contains a source of the project, or is in one;
- is in a game folder;
- has files and no
.esx-buildfile. The build writes this file into its output folder; - has a link in the place of one of the build folders or files.
The error has the reason BUILD_OUTPUT_UNSAFE.
One folder in a game folder is not protected: a folder directly in the game folder that has the regular file
.esx-private-workspace with the text esx-private-workspace-v1 and one line feed. The folder Data, a link and
a game folder inside that folder stay protected. Native Windows tests describes such a folder.
The rules of the release
The [release] table gives three rules to the check step. Check a release
has the details of each check.
- A file of the mod must be in the release or in an archive that the game loads. A file that
only the Data folder has as a loose file is the issue
ASSET_NOT_IN_RELEASE, because a player does not have that file. When the mod needs a loose file of another mod, name it inloose_dependencies. The sample above declares the compiled files of F4SE. overrideslists the records of the game that the mod changes on purpose. The check step then warns about each other override, for example a record that an editor changed by accident.require_id_lockmakes a missing or incompleteids.lockan error.
Defaults for other commands
The manifest also gives default values to options of other commands.
esx reads esx.toml in the current directory. To use a file in another folder, give --project FILE.
records_plugin = "build/records/MyMod.esp"
behavior = "mymod.bhv"
asset_dirs = ["build/inputs"]
output = "build/main"
plugin = "release/MyMod.esp"
archives = ["release/MyMod - Main.ba2", "release/MyMod - Textures.ba2"]
| Key | Default value of |
|---|---|
records_plugin |
--plugin of behavior check, plan, expand, clips and build. PLUGIN of plugin collect-assets. The plugin of batch, when the document and the command line name no plugin. |
behavior |
SPECIFICATION of behavior check, plan, expand, clips and build. --behavior of plugin collect-assets. One path, or one [[behavior]] table. With more tables, name the source on the command line. |
asset_dirs |
--asset-dir of behavior check, plan, expand, clips and build. In esx build, these folders are clip folders of each behavior source. |
output |
-o of behavior build. This is not the output folder of esx build. |
plugin |
PLUGIN of release check. A path is used as written. A name is the file of that name in the project folder, or else build/release/<name>. |
archives |
--archive of release check, plugin assets and behavior verify. |
[release] loose_dependencies |
--loose-dependency of release check. |
[release] overrides |
--override of release check. An empty list gives no option. |
seed is the first name of records_plugin. It still works.
After esx build made the output folder, its files are defaults too: the records plugin
(build/records/<Plugin>), the release plugin, the one behavior source of the project and its asset folders.
Then these commands need no argument:
esx behavior check
esx release check
Command line options override the file.
esx build and the commands in the table reject unknown keys. Any command also rejects them
when you select the file with --project. Otherwise, other commands warn with
PROJECT_FILE_INVALID and ignore the file.
Only the commands and options in the table use these defaults. For example, behavior build
uses --archive for game archives, so the archives key does not apply to that option.
What the file supplied
The JSON envelope lists the defaults used by a command in its project field:
{ "ok": true, "command": "behavior check",
"project": { "file": "esx.toml", "defaults": { "SPECIFICATION": "mymod.bhv", "--plugin": "build/records/MyMod.esp" } },
"data": {} }
In text mode, esx prints one note for each value on stderr.
esx also reads bethkit.toml, which is the old name of the file, when there is no esx.toml.