public static BuildConfig FromJObject(JObject obj, JObject sets) { var config = new BuildConfig(); config.Targets = new List<Target>(); JToken targets = obj.GetValue("Targets"); foreach (JObject target in targets.Children()) { target.Merge(sets); config.Targets.Add(Target.FromJObject(target)); }; return config; }
public void DoAll() { RunInfo = RunInfo.FromArgs(); Debug.Log($"loading config from {RunInfo.Config}"); var buildConfig = BuildConfig.FromFile(RunInfo.Config, RunInfo.ToJObject(RunInfo.Sets)); var target = buildConfig.Targets.Find(i => i.Name == RunInfo.Target); if (target == null) { var targetNames = string.Join(",", buildConfig.Targets.Select(i => i.Name).ToArray()); Debug.LogError($"cannot find target {RunInfo.Target}, valid target is [{targetNames}]"); EditorApplication.Exit(1); } target.ApplyConfigure(); var report = BuildPipeline.BuildPlayer(target.BuildPlayerOptions); if (report.summary.result == UnityEditor.Build.Reporting.BuildResult.Failed) { Debug.LogError("Build operation fail, see log for more details"); EditorApplication.Exit(1); } }
private void OnEnable() { RunInfo = RunInfo.FromArgs(); BuildConfig = BuildConfig.FromFile(RunInfo.Config); }