public static string Serialize(ProjectBuildJob config) { return(JsonConvert.SerializeObject( config, Formatting.Indented )); }
public void RunJob( string rootDir, ProjectBuildTarget buildTarget, ProjectBuildJob job) { if (!s_BuildJobRunners.ContainsKey(job.BuildJobRunner)) { Logger.LogMessage(LoggerSystems.ModuleSystem, "Can not Find Job Runner: {0}", job.BuildJobRunner); return; } ResolveBuildJobItems(rootDir, buildTarget, job); s_BuildJobRunners[job.BuildJobRunner].RunJob(rootDir, this, buildTarget, job); }
private void ResolveBuildJobItems(string rootDir, ProjectBuildTarget buildTarget, ProjectBuildJob job) { Dictionary <string, string> varMap = new Dictionary <string, string> { { "VISDIR", AppRootHelper.AppRoot }, { "PROJDIR", rootDir.EndsWith("\\") || rootDir.EndsWith("/") ? rootDir : rootDir + "/" }, { "NAME", ProjectName }, { "VERSION", ProjectVersion }, { "TARGET", buildTarget.TargetName }, }; foreach (string varMapKey in varMap.Keys.ToArray()) { job.JobName = job.JobName.Replace($"%{varMapKey}%", varMap[varMapKey]); foreach (string argumentsKey in job.Arguments.Keys.ToArray()) { job.Arguments[argumentsKey] = job.Arguments[argumentsKey].Replace($"%{varMapKey}%", varMap[varMapKey]); } } }
public static void Save(string path, ProjectBuildJob config) { File.WriteAllText(path, Serialize(config)); }