Increased build speed
Instead of recompiling all of lunch source for each game, we generate source files containing the `main` function and default configuration for every game instead.
This commit is contained in:
@ -14,8 +14,11 @@ import lunch.update;
|
||||
import lunch.launch;;
|
||||
|
||||
|
||||
void app()
|
||||
void _app(string config_toml)
|
||||
{
|
||||
// Load default config
|
||||
wrapTOML(cast()config, config_toml.parseTOML());
|
||||
|
||||
// Focus on exe
|
||||
chdir( thisExePath.dirName() );
|
||||
|
||||
@ -64,7 +67,7 @@ void app()
|
||||
|
||||
if (config.ui.config_dump)
|
||||
{
|
||||
options ~= () { writeFile(config.app.config_name, default_config_toml); };
|
||||
options ~= () { writeFile(config.app.config_name, config_toml); };
|
||||
writefln("[%d] %s", options.length, config.ui.config_dump_label);
|
||||
}
|
||||
|
||||
@ -93,11 +96,11 @@ void app()
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
void app(string config_toml)
|
||||
{
|
||||
try
|
||||
{
|
||||
app();
|
||||
_app(config_toml);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -71,9 +71,7 @@ struct Config
|
||||
}
|
||||
|
||||
|
||||
immutable string default_config_toml = import("config.toml");
|
||||
immutable Config default_config;
|
||||
immutable Config config;
|
||||
shared Config config;
|
||||
|
||||
|
||||
private string dash2minus(string str)
|
||||
@ -149,10 +147,3 @@ Config parseConfig(string toml) @safe
|
||||
wrapTOML(config, doc);
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
shared static this()
|
||||
{
|
||||
default_config = cast(immutable)parseConfig(default_config_toml);
|
||||
config = default_config;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import lunch.logger;
|
||||
|
||||
version (Windows)
|
||||
{
|
||||
pragma(lib, "User32");
|
||||
import core.sys.windows.windows;
|
||||
}
|
||||
|
||||
@ -75,7 +76,7 @@ void launch()
|
||||
try
|
||||
{
|
||||
chdir(config.launcher.workdir);
|
||||
Pid pid = spawnProcess(config.launcher.command);
|
||||
Pid pid = spawnProcess(config.launcher.command.dup);
|
||||
wait(pid);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user