コード例 #1
0
 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;
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 private void OnEnable()
 {
     RunInfo     = RunInfo.FromArgs();
     BuildConfig = BuildConfig.FromFile(RunInfo.Config);
 }