public void SetCurrentGraphCollection(BatchBuildConfig.GraphCollection c)
 {
     m_graphCollection = c;
     Reload();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Executes the graph collection.
        /// </summary>
        /// <returns>The graph collection.</returns>
        /// <param name="t">T.</param>
        /// <param name="c">C.</param>
        public static List <ExecuteGraphResult> ExecuteGraphCollection(BuildTarget t, BatchBuildConfig.GraphCollection c, Action <Model.NodeData, string, float> updateHandler = null)
        {
            AssetBundleBuildMap.GetBuildMap().Clear();

            List <ExecuteGraphResult> resultCollection = new List <ExecuteGraphResult>(c.GraphGUIDs.Count);

            foreach (var guid in c.GraphGUIDs)
            {
                string path = AssetDatabase.GUIDToAssetPath(guid);
                if (path != null)
                {
                    var r = ExecuteGraph(t, path, false, updateHandler);
                    resultCollection.Add(r);
                }
                else
                {
                    LogUtility.Logger.LogFormat(LogType.Warning, "Failed to build graph in collection {0}: graph with guid {1} not found.",
                                                c.Name, guid);
                }
            }

            return(resultCollection);
        }
Ejemplo n.º 3
0
        /**
         * Build from commandline - entrypoint.
         */
        public static void BuildFromCommandline()
        {
            try {
                var arguments = new List <string>(System.Environment.GetCommandLineArgs());

                Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None);
                Application.SetStackTraceLogType(LogType.Error, StackTraceLogType.None);
                Application.SetStackTraceLogType(LogType.Warning, StackTraceLogType.None);

                BuildTarget target = EditorUserBuildSettings.activeBuildTarget;

                int targetIndex = arguments.FindIndex(a => a == "-target");

                if (targetIndex >= 0)
                {
                    var targetStr = arguments[targetIndex + 1];
                    LogUtility.Logger.Log("Target specified:" + targetStr);

                    var newTarget = BuildTargetUtility.BuildTargetFromString(arguments[targetIndex + 1]);
                    if (!BuildTargetUtility.IsBuildTargetSupported(newTarget))
                    {
                        throw new AssetGraphException(newTarget + " is not supported to build with this Unity. Please install platform support with installer(s).");
                    }

                    if (newTarget != target)
                    {
                                                #if UNITY_5_6 || UNITY_5_6_OR_NEWER
                        EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetUtility.TargetToGroup(newTarget), newTarget);
                                                #else
                        EditorUserBuildSettings.SwitchActiveBuildTarget(newTarget);
                                                #endif
                        target = newTarget;
                    }
                }

                int graphIndex      = arguments.FindIndex(a => a == "-graph");
                int collectionIndex = arguments.FindIndex(a => a == "-collection");

                if (graphIndex >= 0 && collectionIndex >= 0)
                {
                    LogUtility.Logger.Log("-graph and -collection can not be used at once. Aborting...");
                    return;
                }

                Model.ConfigGraph graph = null;

                if (graphIndex >= 0)
                {
                    var graphPath = arguments[graphIndex + 1];
                    LogUtility.Logger.Log("Graph path:" + graphPath);

                    graph = AssetDatabase.LoadAssetAtPath <Model.ConfigGraph>(graphPath);

                    LogUtility.Logger.Log("AssetReference bundle building for:" + BuildTargetUtility.TargetToHumaneString(target));

                    if (graph == null)
                    {
                        LogUtility.Logger.Log("Graph data not found. To specify graph to execute, use -graph [path]. Aborting...");
                        return;
                    }

                    var result = AssetGraphUtility.ExecuteGraph(target, graph);

                    if (result.IsAnyIssueFound)
                    {
                        LogUtility.Logger.Log("Building asset bundles terminated because of following errors. Please fix issues by opening editor.");
                        foreach (var e in result.Issues)
                        {
                            LogUtility.Logger.LogError(LogUtility.kTag, e.Reason);
                        }
                    }
                }

                if (collectionIndex >= 0)
                {
                    var collectionName = arguments[collectionIndex + 1];
                    LogUtility.Logger.Log("Collection Name:" + collectionName);

                    LogUtility.Logger.Log("AssetReference bundle building for:" + BuildTargetUtility.TargetToHumaneString(target));

                    if (collectionName == null)
                    {
                        LogUtility.Logger.Log("Collection name not specified. To specify collection to execute, use -collection [name]. Aborting...");
                        return;
                    }
                    BatchBuildConfig.GraphCollection c = BatchBuildConfig.GetConfig().Find(collectionName);
                    if (c == null)
                    {
                        LogUtility.Logger.Log("Collection not found. Please open project and configure graph collection. Aborting...");
                        return;
                    }

                    var result = AssetGraphUtility.ExecuteGraphCollection(target, c);

                    foreach (var r in result)
                    {
                        if (r.IsAnyIssueFound)
                        {
                            foreach (var e in r.Issues)
                            {
                                LogUtility.Logger.LogError(LogUtility.kTag, r.Graph.name + ":" + e.Reason);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                LogUtility.Logger.LogError(LogUtility.kTag, e);
                LogUtility.Logger.LogError(LogUtility.kTag, "Building asset bundles terminated due to unexpected error.");
            } finally {
                LogUtility.Logger.Log("End of build.");
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Executes the graph collection.
 /// </summary>
 /// <returns>The graph collection.</returns>
 /// <param name="c">C.</param>
 public static List <ExecuteGraphResult> ExecuteGraphCollection(BatchBuildConfig.GraphCollection c)
 {
     return(ExecuteGraphCollection(EditorUserBuildSettings.activeBuildTarget, c));
 }
 public void UpdateSelectedGraphCollection(BatchBuildConfig.GraphCollection c)
 {
     m_currentCollection = c;
     m_detailTree.SetCurrentGraphCollection(c);
 }