Пример #1
0
        // Set scripting define symbols
        public static void SetScriptingDefines()
        {
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();  // Get settings
            string          output          = "";                                 // Create output string

            for (int i = 0; i < coreScriptingDefines.Length; i++)                 // Iterate core defines
            {
                output += coreScriptingDefines[i] + ";";                          // Add
            }
            if (projectSettings.scriptingDefines != null)                         // Check for null
            {
                for (int i = 0; i < projectSettings.scriptingDefines.Length; i++) // Iterate settings defines
                {
                    output += projectSettings.scriptingDefines[i] + ";";          // Add
                }
            }
            int platformCount = Enum.GetNames(typeof(BuildTargetGroup)).Length; // Get platform count

            for (int i = 0; i < platformCount; i++)                             // Iterate all platforms
            {
                if (!depreciatedBuiltTargets.Contains(i))
                {
                    PlayerSettings.SetScriptingDefineSymbolsForGroup((BuildTargetGroup)i, output); // Add custom to current
                }
            }
        }
Пример #2
0
        public static void GetUnityVersionInfo()
        {
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();                            // Get settings

            projectSettings.unityVersion = UnityEditorInternal.InternalEditorUtility.GetFullUnityVersion(); // Set unity version
            projectSettings.unityBranch  = UnityEditorInternal.InternalEditorUtility.GetUnityBuildBranch(); // Set unity branch
            SuiteManager.SetProjectSettings(projectSettings);
        }
Пример #3
0
        public void RunBuildPipeline()
        {
            GetUnityVersionInfo(); // Get unity version info
            //SetApplicationSettings(null); // Set application settings
            SetScriptingDefines(); // Set defines
            SetPlayerSettings();   // Set player settings
            SetQualitySettings();  // Set quality settings
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();

            this.StartCoroutine(BuildPipeline.ProcessBuildPipeline(buildConfiguration, projectSettings));
        }
Пример #4
0
        // Set various application specific settings
        public static void SetApplicationSettings(BuildTarget target)
        {
            PlayerSettings.companyName = "Unity Technologies";
            string          productName     = "";
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();

            if (projectSettings)
            {
                if (projectSettings.buildNameOverride != null && projectSettings.buildNameOverride.Length > 0)
                {
                    productName = projectSettings.buildNameOverride;
                }
                else
                {
                    if (projectSettings.suiteList.Count == 0)
                    {
                        Debug.LogError("No suites found on Settings object. Aborting.");
                        return;
                    }
                    else if (projectSettings.suiteList.Count > 1)
                    {
                        productName = "UTF_Various";
                    }
                    else
                    {
                        productName = "UTF_" + projectSettings.suiteList[0].suiteName;
                    }
                }
            }
            else
            {
                Debug.LogError("No Settings object found. Aborting.");
                return;
            }
            productName += BuildPipeline.AppendProductName(target);
            PlayerSettings.productName = productName;

            int platformCount = Enum.GetNames(typeof(BuildTargetGroup)).Length; // Get platform count

            for (int i = 0; i < platformCount; i++)                             // Iterate all platforms
            {
                if (!depreciatedBuiltTargets.Contains(i))
                {
                    if ((BuildTargetGroup)i == BuildTargetGroup.iOS)
                    {
                        PlayerSettings.SetApplicationIdentifier((BuildTargetGroup)i, "com.UnityTechnologies." + productName.Replace("_", "-")); // Set bundle identifier for iOS
                    }
                    else
                    {
                        PlayerSettings.SetApplicationIdentifier((BuildTargetGroup)i, "com.UnityTechnologies." + productName); // Set bundle identifiers for other
                    }
                }
            }
        }
Пример #5
0
        // Set various application specific settings
        public static void SetApplicationSettings(BuildTarget target, string append)
        {
            PlayerSettings.companyName = "Unity Technologies";
            string          productName     = "";
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();

            if (projectSettings)
            {
                if (projectSettings.buildNameOverride != null && projectSettings.buildNameOverride.Length > 0)
                {
                    productName = projectSettings.buildNameOverride;
                }
                else
                {
                    if (projectSettings.suiteList.Count == 0)
                    {
                        Debug.LogError("No suites found on Settings object. Aborting.");
                        return;
                    }
                    else if (projectSettings.suiteList.Count > 1)
                    {
                        productName = "UTF_Various";
                    }
                    else
                    {
                        productName = "UTF_" + projectSettings.suiteList[0].suiteName;
                    }
                }
            }
            else
            {
                Debug.LogError("No Settings object found. Aborting.");
                return;
            }
            productName += append;
            PlayerSettings.productName = productName;
            if (target != null)
            {
                if (target.platform == UnityEditor.BuildTarget.iOS)
                {
                    productName = productName.Replace("_", "-");
                }
            }
            int platformCount = Enum.GetNames(typeof(BuildTargetGroup)).Length;                                       // Get platform count

            for (int i = 0; i < platformCount; i++)                                                                   // Iterate all platforms
            {
                PlayerSettings.SetApplicationIdentifier((BuildTargetGroup)i, "com.UnityTechnologies." + productName); // Set bundle identifiers
            }
        }
Пример #6
0
        // ------------------------------------------------------------------------------------
        // Get System Data

        // Get SystemData to use for building ResultsCommon
        public SystemData GetSystemData()
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Getting system data");              // Write to console
            SystemData      output          = new SystemData();                                            // Create new class instance
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();                           // Get settings

            output.UnityVersion = projectSettings.unityVersion + "|" + projectSettings.unityBranch;        // Get Unity version
            output.AppVersion   = Common.applicationVersion.ToString();                                    // Get application version
            output.OS           = SystemInfo.operatingSystem;                                              // Get OS
            output.Device       = SystemInfo.deviceModel + "|" + SystemInfo.graphicsDeviceName + "|" + SystemInfo.processorType;
            output.Platform     = Application.platform.ToString();                                         // Get platform
#if UNITY_EDITOR
            if (!Common.IsStandaloneTarget(UnityEditor.EditorUserBuildSettings.activeBuildTarget))         // Check if target platform is emulated editor
            {
                output.Platform += "_" + UnityEditor.EditorUserBuildSettings.activeBuildTarget.ToString(); // Append build target
            }
#endif
            output.API = SystemInfo.graphicsDeviceType.ToString(); // Get graphics device type
            return(output);                                        // Return
        }
Пример #7
0
        // Find if Unity version is above specified index from unityVersionList
        public static bool IsUnityVersionAboveMinimum(int input)
        {
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings(); // Get settings
            int             versionIndex    = 0;                                 // Create version index

            for (int i = 0; i < unityVersionList.Length; i++)                    // Iterate version list
            {
                if (projectSettings.unityVersion.Contains(unityVersionList[i]))  // If unity version contains current index
                {
                    versionIndex = i;                                            // Set output index
                }
            }
            if (input > versionIndex) // If minimum is higher than current
            {
                return(false);        // Return false
            }
            else
            {
                return(true); // Return true
            }
        }
Пример #8
0
        // Generate test structure
        // - Loads all scenes and gets data from test lists
        // - Reorganises for menu layout
        IEnumerator GenerateStructure()
        {
            yield return(null);                                                                               // TODO - Remove

            testStructure = new Structure();                                                                  // Create new test structure instance

            string[]        testTypes = TestTypes.GetTypeStringList();                                        // Get the type list
            List <TestType> typeList  = new List <TestType>();                                                // Create new list to fill

            for (int i = 0; i < testTypes.Length; i++)                                                        // ITerate type list
            {
                TestType newType = new TestType();                                                            // Create new instance
                newType.typeName  = testTypes[i];                                                             // Set name
                newType.typeIndex = i;                                                                        // Set index
                typeList.Add(newType);                                                                        // Add to list
                TestModelBase model = (TestModelBase)Activator.CreateInstance(TestTypes.GetTypeFromIndex(i)); // Create model instance for logic references
                model.SetLogic();                                                                             // Need to set logic before generating type instances
                TestTypeManager.Instance.GenerateTestTypeInstance(model);                                     // Generate an instance object for test logic/display
            }
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings();                              // Get the suite list

            if (projectSettings == null)                                                                      // If no suite list found
            {
                StopAllCoroutines();                                                                          // Abort
            }
            for (int su = 0; su < projectSettings.suiteList.Count; su++)                                      // Iterate suites on suite list
            {
                Suite newSuite = new Suite();                                                                 // Create new suite instance
                newSuite.suiteName = projectSettings.suiteList[su].suiteName;                                 // Set suite name from suite list
                newSuite.types     = CloneTestTypeList(typeList);                                             // Clone the type list
                for (int gr = 0; gr < projectSettings.suiteList[su].groups.Count; gr++)                       // Iterate groups
                {
                    for (int te = 0; te < projectSettings.suiteList[su].groups[gr].tests.Count; te++)         // Iterate tests
                    {
                        GraphicsTestFramework.Test test = projectSettings.suiteList[su].groups[gr].tests[te]; // Get test
                        if (Common.IsTestApplicable(test))
                        {
                            int[] types = TestTypeManager.Instance.GetTypeSelectionFromBitMask(test.testTypes);                                     // Get type array from test's bitmask
                            for (int ty = 0; ty < types.Length; ty++)                                                                               // Iterate types of the test
                            {
                                Group newGroup = FindDuplicateGroupInType(newSuite, types[ty], projectSettings.suiteList[su].groups[gr].groupName); // Find duplicate groups in the type
                                if (newGroup == null)                                                                                               // If not found
                                {
                                    newGroup           = new Group();                                                                               // Create a new group instance
                                    newGroup.groupName = projectSettings.suiteList[su].groups[gr].groupName;                                        // Set group name
                                    FindDuplicateTypeInSuite(newSuite, types[ty]).groups.Add(newGroup);                                             // Add the group to the type
                                }
                                Test     newTest   = new Test();                                                                                    // Create new test instance
                                string[] pathSplit = projectSettings.suiteList[su].groups[gr].tests[te].scenePath.Split('/');                       // Split path for scene name
                                newTest.testName  = pathSplit[pathSplit.Length - 1].Replace(".unity", "");;                                         // Set test name
                                newTest.scenePath = projectSettings.suiteList[su].groups[gr].tests[te].scenePath;                                   // Set scene path
                                newGroup.tests.Add(newTest);                                                                                        // Add test to scene
                            }
                        }
                    }
                }
                for (int ty = 0; ty < newSuite.types.Count; ty++) // Iterate types
                {
                    if (newSuite.types[ty].groups.Count == 0)     // If empty
                    {
                        newSuite.types.RemoveAt(ty);              // Remove it
                    }
                }
                newSuite.types.TrimExcess();                                                                 // Trim the types list
                testStructure.suites.Add(newSuite);                                                          // Add to suites list
            }
            m_IsGenerated = true;                                                                            // Set generated
            Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "TestStructure finished generating"); // Write to console
            ProgressScreen.Instance.SetState(false, ProgressType.LocalLoad, "");                             // Disable ProgressScreen
        }
Пример #9
0
        // Generate test structure
        // - Loads all scenes and gets data from test lists
        // - Reorganises for menu layout
        IEnumerator GenerateStructure()
        {
            yield return(null);                                                  // TODO - Remove

            testStructure = new Structure();                                     // Create new test structure instance
            List <TestType> typeList        = GenerateTypeListAndInstances();    // Generate type list and create instances
            ProjectSettings projectSettings = SuiteManager.GetProjectSettings(); // Get the suite list

            if (projectSettings == null)                                         // If no suite list found
            {
                StopAllCoroutines();                                             // Abort
            }
            for (int su = 0; su < projectSettings.suiteList.Count; su++)         // Iterate suites on suite list
            {
                Suite newSuite = new Suite();                                    // Create new suite instance
                newSuite.suiteName = projectSettings.suiteList[su].suiteName;    // Set suite name from suite list
                newSuite.types     = CloneTestTypeList(typeList);                // Clone the type list
                RenderPipelineAsset pipeline = projectSettings.suiteList[su].defaultRenderPipeline;
                newSuite.suitePipeline = Common.GetRenderPipelineName(pipeline);
                for (int gr = 0; gr < projectSettings.suiteList[su].groups.Count; gr++) // Iterate groups
                {
                    RenderPipelineAsset grpPipeline = projectSettings.suiteList[su].groups[gr].renderPipelineOverride;
                    for (int te = 0; te < projectSettings.suiteList[su].groups[gr].tests.Count; te++)         // Iterate tests
                    {
                        GraphicsTestFramework.Test test = projectSettings.suiteList[su].groups[gr].tests[te]; // Get test
                        if (Common.IsTestApplicable(test))
                        {
                            int[] types = TestTypeManager.Instance.GetTypeSelectionFromBitMask(test.testTypes);                                     // Get type array from test's bitmask
                            for (int ty = 0; ty < types.Length; ty++)                                                                               // Iterate types of the test
                            {
                                Group newGroup = FindDuplicateGroupInType(newSuite, types[ty], projectSettings.suiteList[su].groups[gr].groupName); // Find duplicate groups in the type
                                if (newGroup == null)                                                                                               // If not found
                                {
                                    newGroup           = new Group();                                                                               // Create a new group instance
                                    newGroup.groupName = projectSettings.suiteList[su].groups[gr].groupName;                                        // Set group name
                                    if (grpPipeline != null)
                                    {
                                        newGroup.groupPipeline = Common.GetRenderPipelineName(grpPipeline);                   // Set the group pipeline name
                                    }
                                    FindDuplicateTypeInSuite(newSuite, types[ty]).groups.Add(newGroup);                       // Add the group to the type
                                }
                                Test     newTest   = new Test();                                                              // Create new test instance
                                string[] pathSplit = projectSettings.suiteList[su].groups[gr].tests[te].scenePath.Split('/'); // Split path for scene name
                                newTest.testName  = pathSplit[pathSplit.Length - 1].Replace(".unity", "");;                   // Set test name
                                newTest.scenePath = projectSettings.suiteList[su].groups[gr].tests[te].scenePath;             // Set scene path
                                newGroup.tests.Add(newTest);                                                                  // Add test to scene
                            }
                        }
                    }
                }
                for (int ty = 0; ty < newSuite.types.Count; ty++) // Iterate types
                {
                    if (newSuite.types[ty].groups.Count == 0)     // If empty
                    {
                        newSuite.types.RemoveAt(ty);              // Remove it
                    }
                }
                newSuite.types.TrimExcess();                                                                 // Trim the types list
                testStructure.suites.Add(newSuite);                                                          // Add to suites list
            }
            m_IsGenerated = true;                                                                            // Set generated
            Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "TestStructure finished generating"); // Write to console
            ProgressScreen.Instance.SetState(false, ProgressType.LocalLoad, "");                             // Disable ProgressScreen
        }