Automated mod packager "FCompile"

Tools which are useful for mod development.
Post Reply
User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 582
Joined: Tue May 19, 2015 1:56 am
Contact:

Automated mod packager "FCompile"

Post by Reika »

I made a Factorio mod packager I call "FCompile", which automates what often ends up being a painful process to do manually if your 'workspace' is anything like mine.

FCompile will look into your mod directory - or wherever the 'source' of your mods are - and look for mods whose info.json specifies you as the author. For each mod, it will generate a zip file suitable for upload to the Factorio Mod Portal in the chosen output directory.

Additional Features:
  • Version override - If your mod folder is also the root of a GitHub repository, like it is for me, the constantly-changing versions mean the folder (which has to change name as well) needs to also be constantly rebound to the repository. If you specify a version override in the settings, however, FCompile will ignore whatever is in the folder name and info.json for version and substitute the override instead for the compiled version. Also useful for keeping a suite of mods in lockstep versions.

    Irrelevant file cleanup - Ever upload a mod and then realize you also uploaded your layered image masters, or your .git data, or a .rar of the old version of a texture, or other garbage that needlessly inflated the mod filesize? FCompile allows you to specify file types to ignore, and strings to ignore (i.e. any file containing any such string is ignored, eg ".git"). It also allows you to filter allowance for images and sounds, so as to, for example, ignore images outside the /graphics subfolder in a mod.
A zip of both the compiler JAR and a sample settings file can be found at the download link below. All you need to run it is to have Java installed (I built it on J7, and it should work fine on J8); it can be run directly (windows explorer click, etc) or from the command line (where you can specify custom settings path or output log path). By default the settings.ini is left in the same folder as the JAR itself.
The zip also contains the source - which you can verify matches the compiled JAR with something like JD-GUI if you like - for those who want verification of the program's intentions.

The limiting factor on the program's runtime is usually disk I/O speed, so it is recommended to have the source and output folders on the same disk, ideally an SSD.

Feel free to suggest additional features/options, though anything too niche or too difficult to implement is not likely to be included.

How to use:
Download and extract the zip, open settings.ini and customize your paths, name, and other settings as you please, then simply run the JAR.

DOWNLOAD:
http://www.mediafire.com/file/p9ac7wytr ... ile+v2.zip

Please do not link directly to the above file, as the old files will be deleted as new versions are posted.

Sample settings:

Code: Select all

#############################################################
#These settings modulate the behavior of FCompile.
#Lines with a '#' are comments.
#Settings to change come after the '='.
#Do not add new lines, as they will at best do nothing
#and at worst break the setting parser.
#############################################################

#Where your Factorio mods are located.
mod_directory=C:/Users/Reika/AppData/Roaming/Factorio/mods

#The mod author whose mods you wish to compile. Almost always you.
target_author=Reika

#The output to which you want the compiled mods exported.
output_directory=E:/Compiled Factorio Mods

#Whether to purge the contents of the above output folder each compile.
clean_output=true

#If this is not 'none', whatever version is supplied in the mod folder/info is ignored in favor of the override.
#Very useful if you do not want a constantly-changing folder name (for example, because of GitHub pathing).
#Ensure it is the standard 'A.B.C' format, but you can use the numbers to mean what you wish.
version_override=none

#File extenstions to ignore; basically anything you do not want packed into the mod download.
#Use 'none' for nothing; separate entries with ',', and do not include the leading period.
ignored_filetypes=pdn,psd,zip,rar,bmp,gif,jpg,jpeg,aup,aiff,wav

#Anything containing any one of the following strings (anywhere in the path or name) is ignored.
#Use 'none' for nothing; separate entries with ','.
ignored_strings=.git,metadata

#Should images only be allowed conditionally, and if so, from what folder(s)
#(ie in-mod path must start with one of these)? Use 'none' for no filter; separate entries with ','.
image_filter=/graphics

#Should sounds only be allowed conditionally, and if so, from what folder(s)
#(ie in-mod path must start with one of these)? Use 'none' for no filter; separate entries with ','.
sound_filter=/sounds,/sound
Image

Post Reply

Return to “Development tools”