Repository navigation
sf-mod-build 0.4.0
What's new
- Two more kinds of builder in sfmod.json. Give exactly one of
builder.project(a .NET project, as before),builder.commandorbuilder.prebuilt;validatereports none or two as a PROBLEM. builder.commandruns any program that writes the plugin: a list with the program first and its first arguments after it, such as["python", "tools/build.py"]or["dotnet", "run", "build.cs", "--"].builder.argsare added after it, and the builder placeholders work in both. A program with a/or\is a path relative to sfmod.json; a bare name is found on PATH. It runs in the sfmod.json folder without a shell, and doesn't need .NET.builder.prebuiltcopies a ready plugin (made in the Creation Kit or by hand) into dist under thepluginname. It takes noargs, andpluginneeds neither the game nor .NET for it.validatenow prints aruns:line with the command a build would run. Read it before you build a mod someone else made:builder.commandruns whatever program it names.steps.afterPluginandsteps.afterPackin sfmod.json: lists of your own commands, each written likebuilder.command, run in order at the end ofpluginand at the end ofpack. Running a step on its own runs its commands too, sobuildand one step at a time give the same result. They take the builder placeholders plus{name}and{plugin}. A missing program stops the step before any work (exit 2); a command that exits non-zero stops it (exit 1) with a RESULT line naming the command.validateprints oneruns:line per command.- A top-level
archiveslist in sfmod.json: more archives thatpackmakes in dist, each named<plugin> - <suffix>.ba2. An entry either packs asourcefolder laid out like Data (with"compression": "none"for voice files, which play silent when stored compressed, and"format": "dds"for textures) or copies a ready archive fromfileas it is. These archives ship in the zip,packdeletes their old copies, and they never count as stray. The suffix may beMainorTexturesonly whenpackdoesn't make that archive itself.packchecks a source folder's files (asteps.afterPlugincommand may fill it) and stops with exit 2 before Archive2 runs when it is missing, empty or holds a file that doesn't belong (a dot file or a file in a dot folder,Thumbs.dbanddesktop.iniincluded, since Archive2 packs the folder as it is).validaterefuses a source that is, holds or is insideassets.source,assets.xboxTexturesor another entry's source, so no file ships twice.validateprints anarchive:line for each entry. In this version the list can't be used with"xbox": true. partsin sfmod.json: the other plugins your builder writes into dist, each{ "plugin": "MyMod-Extra.esm" }with optionalscriptsof its own (the same shape as the top-levelscripts;sourcedefaults to the top-level source folders).compilecompiles a part's scripts into<stage>/parts/<part>/Scripts,packpacks them into<part> - Main.ba2,pluginstops (exit 1) when a part plugin isn't in dist, andzipships every plugin and archive and stops (exit 2) when one is missing.validateprints apart:line for each and refuses a part named like the main plugin or another part, a name that breaks the plugin-name rules, a script in two places, andpartswithbuilder.prebuilt. In this version a part with scripts can't be used with"xbox": true.checkandbuildtake--masters-dir <folder>, which can be given more than once, and pass each folder to sf-mod-check'srelease. Use it for a mod whose master plugin isn't in the Data folder, such as another mod's folder in your mod manager. A folder that isn't there stopscheck, orbuildbefore it starts, with exit 2.scripts.optimizein sfmod.json (defaulttrue): set it tofalseto compile without the compiler's-optimizeoption, for a mod whose scripts were tested in game that way. A part'sscriptsfollow the top-level value unless they set their own.-releasestays refused either way.- The release now has a
<file>.sha256beside each download, as well asSHA256SUMS, so a tool can check one download on its own.
Example
A made-up mod whose builder is a Python script, with "builder": { "command": ["python", "tools/build.py", "--out", "{dist}"], "args": ["{version}"] } (folder names are shortened):
> sf-mod-build validate
...
builder: command python
args {version}
runs: python tools/build.py --out {dist} {version}
...
RESULT: OK
> sf-mod-build plugin
running the builder: python.exe (builder.command)
built C:\Mods\MyMod\dist\MyMod.esm (20 bytes)
RESULT: OK, MyMod.esm built into C:\Mods\MyMod\dist
and a mod with "builder": { "prebuilt": "Original/MyOtherMod.esm" }:
> sf-mod-build plugin
copied C:\Mods\MyOtherMod\Original\MyOtherMod.esm to C:\Mods\MyOtherMod\dist\MyOtherMod.esm (21 bytes)
RESULT: OK, MyOtherMod.esm copied into C:\Mods\MyOtherMod\dist
and a made-up mod with one step after pack that fails, "steps": { "afterPack": [["python", "tools/after.py", "{dist}/missing.txt", "fail"]] }:
> sf-mod-build pack
running steps.afterPack[0]: python.exe tools/after.py C:\Mods\StepsMod\dist/missing.txt fail
FAILED steps.afterPack[0] (python.exe) exited with code 3
after.py: C:\Mods\StepsMod\dist/missing.txt is missing
RESULT: FAILED at steps.afterPack[0] (python.exe exited with code 3). Fix: fix the error shown above (the full output is in the log: --log <file>), or the command in C:\Mods\StepsMod\sfmod.json, and run again.
and a made-up mod with a voice folder and a ready archive, "archives": [ { "suffix": "Voices", "source": "Voices", "compression": "none" }, { "suffix": "Extra", "file": "Original/Other - Extra.ba2" } ]:
> sf-mod-build validate
...
archive: "VoiceMod - Voices.ba2" packed from C:\Mods\VoiceMod\Voices, uncompressed
archive: "VoiceMod - Extra.ba2" copied from C:\Mods\VoiceMod\Original\Other - Extra.ba2
...
holds VoiceMod.esm, VoiceMod - Voices.ba2, VoiceMod - Extra.ba2
RESULT: OK
> sf-mod-build pack
packed C:\Mods\VoiceMod\dist\VoiceMod - Voices.ba2 (127 bytes)
copied C:\Mods\VoiceMod\dist\VoiceMod - Extra.ba2 from C:\Mods\VoiceMod\Original\Other - Extra.ba2 (23 bytes)
RESULT: OK, "VoiceMod - Voices.ba2" and "VoiceMod - Extra.ba2" made in C:\Mods\VoiceMod\dist
and a made-up mod whose Python builder writes three plugins, with "parts": [ { "plugin": "PartsMod-Extra.esm", "scripts": { "namespaces": ["PTMX"] } }, { "plugin": "PartsMod-Patch.esm" } ]:
> sf-mod-build build
== compile
compiled PTM\PTM_Main.psc into C:\Mods\PartsMod\.build\stage\Scripts
compiled PTMX\PTMX_Extra.psc into C:\Mods\PartsMod\.build\stage\parts\PartsMod-Extra\Scripts
...
== plugin
running the builder: python.exe (builder.command)
built C:\Mods\PartsMod\dist\PartsMod.esm (16 bytes)
built C:\Mods\PartsMod\dist\PartsMod-Extra.esm (16 bytes)
built C:\Mods\PartsMod\dist\PartsMod-Patch.esm (16 bytes)
RESULT: OK, PartsMod.esm and 2 part plugin(s) built into C:\Mods\PartsMod\dist
== pack
packed C:\Mods\PartsMod\dist\PartsMod - Main.ba2 (331 bytes)
packed C:\Mods\PartsMod\dist\PartsMod-Extra - Main.ba2 (336 bytes)
RESULT: OK, "PartsMod - Main.ba2" and "PartsMod-Extra - Main.ba2" made in C:\Mods\PartsMod\dist
== zip
zipped PartsMod - Main.ba2
zipped PartsMod-Extra - Main.ba2
zipped PartsMod-Extra.esm
zipped PartsMod-Patch.esm
zipped PartsMod.esm
...
and a made-up mod whose dist holds a folder of old copies:
> sf-mod-build plugin
RESULT: CANNOT BUILD THE PLUGIN (the dist folder C:\Mods\MyMod\dist holds "old" (a folder), which no earlier build listed as its own, and sf-mod-build deletes only the plugins and archives in dist and what earlier builds made there, so nothing was deleted. Fix: move it out of dist and run again (a build by sf-mod-build 0.3.0 or earlier left no list of what it made, so its builder's other files are named here once), or set "dist" in C:\Mods\MyMod\sfmod.json to a folder of its own).
Fixed
pluginno longer deletes the folders and other files you keep in dist (plugins and archives there are still deleted). Before, it emptied dist on every build, so a folder you kept there (old copies, notes) was deleted without a word. Now it deletes only what earlier builds made there (the names in dist's new.sf-mod-build-madelist, plugins and.ba2archives) and keeps zips and azip.folderinside dist. When dist holds anything else, it deletes nothing and stops with exit 2, naming each one and the fix. The first build after an update from 0.3.0 or earlier may name your builder's own extra files this way once, because those versions kept no list; delete them and run again. A dist folder that is a link or junction is refused too. When a delete fails (a plugin open in the Creation Kit, say), the list stays for the next run. 0.3.0 and earlier have this problem.- A build no longer fails the second time when a loose file it copies is read-only: the copies
packmakes in stage and creations-out (and, new in 0.4.0, the prebuilt plugin and ready archivespluginandpackcopy into dist) are no longer read-only, so the next build can delete them. 0.3.0 and earlier have this problem for read-only loose files. - AGENTS.md no longer says that archives your builder writes aren't supported: they have shipped through
zip.archivessince 0.3.0. - When a
zip.filesentry isn't there,validate's fix now says that a file the builder or a step makes goes in dist instead, becausezip.filestakes only files that are there before the build.
Download
sf-mod-build-0.4.0-win-x64.zip: the Windows program (no .NET needed).sf-mod-build-template-0.4.0.zip: the starter project.sf-mod-build.0.4.0.nupkg: the .NET tool package.- Check each download against
SHA256SUMSor its own.sha256file.
See CHANGELOG.md for the full history.