A data pipeline tool written in Rust.
- Given a collection of loose and unorganized files will match and group them into a structured destination folder.
- Will build files according to matched rule.
- Only build files that have changed.
- Support includes A->B->C.
- Clean destination folder of orphaned files.
By convention .peon-config.json will be loaded from working directory. This can be overloaded with --config.
{
"ignores": [ <Glob Pattern> ],
"rules": [ <Rule> ]
}
Rule
{
"ruleName": "string",
"matcher": <Matcher>,
"builder": <Builder"
}
File Extension Matcher
{
"type": "fileExtension",
"fileExtensions": [ <string> ]
}
All examples should be run from their folder to pickup the appropriate peon-config.json by convention. Will also write peon.history to that folder by convention.
The simplest builder, will copy file and nothing else.
{
"ruleName": "CopyTxt",
"matcher": {
"type": "fileExtension",
"fileExtensions": [
"txt"
]
},
"builder": {
"type": "copyFile",
"destinationFolder": "txt"
}
}
<root>\peon\examples\copy_files> cargo run -- --source src --destination dst
Copy file with optional JsonSchema validation. If schemaFileName is configured then --json-schema-folder-path must be provided when running.
{
"ruleName": "CopyPlayer",
"matcher": {
"type": "fileExtension",
"fileExtensions": [
"player"
]
},
"builder": {
"type": "copyJsonFile",
"destinationFolder": "entities",
"schemaFileName": "player-schema.json"
}
}
<root>\peon\examples\copy_json_files> cargo run -- --source src --destination dst --json-schema-folder-path schemas
Compile shaders using Fxc. Will handle #include.
{
"ruleName": "CompileShader",
"matcher": {
"type": "fileExtension",
"fileExtensions": [
"hlsl"
]
},
"builder": {
"type": "compileShader",
"destinationFolder": "shaders",
"destinationExtension": "fxco",
"fxcExeName": "fxc.exe",
"vertexShader": {
"postfixes": ["_vs", "VS"],
"profile": "vs_5_0"
},
"pixelShader": {
"postfixes": ["_ps", "PS"],
"profile": "ps_5_0"
},
"computeShader": {
"postfixes": ["_cs"],
"profile": "cs_5_0"
},
"enableStrictMode": true,
"enableWarningsAsErrors": true,
"enableDebuggingInformation": false,
"enableOptimizations": true
}
}
Download and place fxc.exe from Fxc into compile_shaders/tools folder.
<root>\peon\examples\compile_shaders> cargo run -- --source src --destination dst --tool-folder-path tools
Resolve texture type and run Texconv or Cmft with appropriate flags.
Texture types are resolved through a number of rules:
- folder level attributes stored in
.texconvfile. This file contains glob patterns for the folder to resolve the texture type.
{
"*.png": "Particle",
"*.tga": "Particle"
}
- side-by-side
.mesh_materialfiles contain explicit texture names.
{
"base_color_texture": "foo_clr",
"occlusion_roughness_metallic_texture": "foo_orm",
"normal_texture": "foo_nrm",
"mask_texture": "foo_msk"
}
{
"ruleName": "ConvertTexture",
"matcher": {
"type": "fileExtension",
"fileExtensions": [
"png",
"tga",
"smaa_dds"
]
},
"builder": {
"type": "convertTexture",
"destinationFolder": "textures",
"destinationExtension": "dds",
"texConv": {
"exeName": "texconv.exe",
"formats": {
"StandardColor": "BC7_UNORM",
"MeshColor": "BC7_UNORM",
"MeshOrm": "BC7_UNORM",
"MeshNormal": "BC5_SNORM",
"MeshMask": "BC7_UNORM",
"Particle": "BC7_UNORM",
"SMAAArea": "BC5_UNORM",
"SMAASearch": "BC4_UNORM"
}
},
"cmft": {
"exeName": "cmft.exe",
"textureTypes": [
"SkyboxPanoramicColor"
]
}
}
}
Download and place texconv.exe from Texconv into convert_textures/tools folder.
<root>\peon\examples\convert_textures> cargo run -- --source src --destination dst --tool-folder-path tools
Run arbitrary tool exe that is expected to generate destination file. toolArguments can contain templates that will be substituted at runtime : [source_file, destination_file, destination_folder]
{
"ruleName": "RunTool",
"matcher": {
"type": "fileExtension",
"fileExtensions": [
"png"
]
},
"builder": {
"type": "runTool",
"destinationFolder": "tool_output",
"destinationExtension": "dds",
"toolName": "texconv.exe",
"toolArguments": ["-f", "BC7_UNORM", "-y", "{source_file}", "-o", "{destination_folder}"]
}
}
Download and place texconv.exe from Texconv into run_tool/tools folder.
<root>\peon\examples\run_tool> cargo run -- --source src --destination dst --tool-folder-path tools
Zip a collection of source files into a single destination file.
{
"ruleName": "ZipFolder",
"matcher": {
"type": "folderName",
"folderName": "foo"
},
"builder": {
"type": "zipFolder",
"destinationFolder": "zipped_folders",
"destinationExtension": ".zip"
}
}
<root>\peon\examples\zip_folder> cargo run -- --source src --destination dst
cargo test
or
cargo nextest run