示例#1
0
        public virtual string GetParamOrConfigString(string StringKey, string EmptyStringWarningMessage = "", string DefaultValue = "", bool bCheckForEmpty = true)
        {
#if UNITY_EDITOR
            if (bIsDrawingInspector && EmptyStringWarningMessage != "")
            {
                LogError("Don't call this from within a DrawJobInspectorAndGetEnabledParams implementation!  This isn't accessing the right job config value since it hasn't been saved to disk yet.");
            }
#endif // UNITY_EDITOR

            string StringValue = DefaultValue;

            if (IgorJobConfig.IsStringParamSet(StringKey))
            {
                StringValue = IgorJobConfig.GetStringParam(StringKey);
            }
            else
            {
                StringValue = IgorConfig.GetModuleString(this, StringKey);
            }

            if (StringValue == DefaultValue && bCheckForEmpty && EmptyStringWarningMessage != "")
            {
                LogWarning(EmptyStringWarningMessage);
            }

            if (StringValue == "")
            {
                StringValue = DefaultValue;
            }

            return(StringValue);
        }
示例#2
0
        public override void ProcessArgs(IIgorStepHandler StepHandler)
        {
            if (IgorJobConfig.IsBoolParamSet(IgorBuildCommon.BuildFlag))
            {
                IgorCore.SetModuleActiveForJob(this);

                string Platform = IgorJobConfig.GetStringParam(IgorBuildCommon.PlatformFlag);

                bool bIOS = false;

                if (Platform == "iOS")
                {
#if UNITY_5
                    JobBuildTarget = BuildTarget.iOS;
#else
                    JobBuildTarget = BuildTarget.iPhone;
#endif
                    bIOS = true;

                    StepHandler.RegisterJobStep(IgorBuildCommon.SwitchPlatformStep, this, SwitchPlatforms);
                    StepHandler.RegisterJobStep(IgorBuildCommon.BuildStep, this, BuildiOS);
                    StepHandler.RegisterJobStep(FixupXCodeProjStep, this, FixupXCodeProj);
                    StepHandler.RegisterJobStep(BuildXCodeProjStep, this, BuildXCodeProj);
                }
            }
        }
示例#3
0
        public override void ProcessArgs(IIgorStepHandler StepHandler)
        {
            bool bStepRegistered = false;

            if (IgorDistributionCommon.RunDistributionStepsThisJob())
            {
                if (IgorJobConfig.GetStringParam(UploadToFTPFlag) != "" &&
                    (IgorJobConfig.IsBoolParamSet(UploadToFTPNoEnvFlag) ||
                     (IgorJobConfig.GetStringParam(UploadToFTPEnvToggleFlag) != "" && IgorRuntimeUtils.GetEnvVariable(IgorJobConfig.GetStringParam(UploadToFTPEnvToggleFlag)) == "true")))
                {
                    StepHandler.RegisterJobStep(UploadToFTPStep, this, UploadToFTP);

                    bStepRegistered = true;
                }

                if (IgorJobConfig.IsBoolParamSet(UploadToFTPNoEnvFlag) || IgorJobConfig.GetStringParam(UploadToFTPEnvToggleFlag) != "")
                {
                    StepHandler.RegisterJobStep(IgorBuildCommon.PreBuildCleanupStep, this, Cleanup);

                    bStepRegistered = true;
                }

                if (bStepRegistered)
                {
                    IgorCore.SetModuleActiveForJob(this);
                }
            }
        }
示例#4
0
        public static void CheckForNamedJobFlag()
        {
            if (IgorJobConfig.IsStringParamSet(NamedJobFlag))
            {
                string JobToStart = IgorJobConfig.GetStringParam(NamedJobFlag);

                foreach (IgorPersistentJobConfig Job in IgorConfig.GetInstance().JobConfigs)
                {
                    if (Job.JobName == JobToStart)
                    {
                        IgorJobConfig ConfigInst = IgorJobConfig.GetConfig();

                        ConfigInst.Persistent = Job;

                        ConfigInst.Save(IgorJobConfig.IgorJobConfigPath);

                        IgorDebug.CoreLog("Starting named job " + JobToStart + ".");

                        return;
                    }
                }

                IgorDebug.CoreLogError("Couldn't find named job " + JobToStart + "!");
            }
        }
示例#5
0
        public virtual bool SetScriptingDefines()
        {
            // Record pre-job-run scripting define symbols per build target so that if someone wants to test a job
            // in editor it doesn't leave the job's defines resident in the PlayerSettings afterwards.
            foreach (BuildTargetGroup group in BuildTargets)
            {
                if (group != BuildTargetGroup.Unknown)
                {
                    EditorPrefs.SetString(kEditorPrefsPrefix + group.ToString(), PlayerSettings.GetScriptingDefineSymbolsForGroup(group));
                }
            }

            string AllParams = ExtraModuleParams;

            if (AllParams.Length > 0)
            {
                AllParams += ";";
            }

            AllParams += IgorJobConfig.GetStringParam(SetScriptingDefinesFlag);

            // Flush to all of the groups, to be sure we hit the one marked for build in the job. This should be fine
            // because there's only ever at most one built platform per job.
            foreach (BuildTargetGroup group in BuildTargets)
            {
                if (group != BuildTargetGroup.Unknown)
                {
                    PlayerSettings.SetScriptingDefineSymbolsForGroup(group, AllParams);
                }
            }

            AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

            return(true);
        }
示例#6
0
        public static BuildTarget GetBuildTargetForCurrentJob(out bool bWindows, out bool bOSX, out bool bLinux, string AllParams = "")
        {
            string PlatformString = IgorJobConfig.GetStringParam(IgorBuildCommon.PlatformFlag);

            if (PlatformString == "")
            {
                PlatformString = IgorRuntimeUtils.GetStringParam(AllParams, IgorBuildCommon.PlatformFlag);
            }

            bWindows = false;
            bOSX     = false;
            bLinux   = false;

            BuildTarget CurrentJobBuildTarget = BuildTarget.StandaloneOSXIntel;

            if (PlatformString.Contains("OSX32"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneOSXIntel;
                bOSX = true;
            }
            else if (PlatformString.Contains("OSX64"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneOSXIntel64;
                bOSX = true;
            }
            else if (PlatformString.Contains("OSXUniversal"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneOSXUniversal;
                bOSX = true;
            }
            else if (PlatformString.Contains("Windows32"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneWindows;
                bWindows = true;
            }
            else if (PlatformString.Contains("Windows64"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneWindows64;
                bWindows = true;
            }
            else if (PlatformString.Contains("Linux32"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneLinux;
                bLinux = true;
            }
            else if (PlatformString.Contains("Linux64"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneLinux64;
                bLinux = true;
            }
            else if (PlatformString.Contains("LinuxUniversal"))
            {
                CurrentJobBuildTarget = BuildTarget.StandaloneLinuxUniversal;
                bLinux = true;
            }

            return(CurrentJobBuildTarget);
        }
        public virtual bool OverridePlayerSettings()
        {
            string TargetDirectory = IgorJobConfig.GetStringParam(PlayerSettingsPathFlag);

            TargetDirectory = TargetDirectory.Replace("\"", string.Empty);

            CopyStoredPlayerSettingsOverCurrent(TargetDirectory);
            return(true);
        }
示例#8
0
        public virtual bool RunTest()
        {
            MonsterTestCoreInst = this;

            bool bReturn = ActiveMonsterRunner.RunTest(IgorJobConfig.GetStringParam(TestNameFlag));

            MonsterTestCoreInst = null;

            return(bReturn);
        }
示例#9
0
        public virtual bool InternalCleanupTestable(bool bRunningTestInEditor = false)
        {
            if (!bRunningTestInEditor || (TestRunnerInst.CurrentTest != null && TestRunnerInst.CurrentTest.bForceLoadToFirstSceneInEditor))
            {
                string FirstLevelName = IgorUtils.GetFirstLevelName();

                if (FirstLevelName != "")
                {
                    if (EditorApplication.currentScene != FirstLevelName)
                    {
                        EditorApplication.OpenScene(FirstLevelName);

                        return(false);
                    }
                }
            }

            MonsterStarter[] Starters = GameObject.FindObjectsOfType <MonsterStarter>();

            foreach (MonsterStarter CurrentStarter in Starters)
            {
                GameObject.DestroyImmediate(CurrentStarter.gameObject);
            }

            if (!bRunningTestInEditor)
            {
                string StreamingAssetsFolder = Path.Combine("Assets", Path.Combine("StreamingAssets", Path.Combine("Igor", Path.Combine("Monster", "Config"))));

                if (Directory.Exists(StreamingAssetsFolder))
                {
                    IgorRuntimeUtils.DeleteDirectory(StreamingAssetsFolder);
                }

                string LastValue = IgorJobConfig.GetStringParam(LastDisplayResolutionDialogFlag);

                switch (LastValue)
                {
                case "Disabled":
                    PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Disabled;
                    break;

                case "Enabled":
                    PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Enabled;
                    break;

                case "HiddenByDefault":
                    PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.HiddenByDefault;
                    break;
                }
            }

            return(true);
        }
示例#10
0
        public static List <string> GetModuleProducts()
        {
            if (CurrentModuleProducts.Count == 0)
            {
                string CombinedProducts = IgorJobConfig.GetStringParam(ProductsFlag);

                CurrentModuleProducts.Clear();
                CurrentModuleProducts.AddRange(CombinedProducts.Split(','));
            }

            return(CurrentModuleProducts);
        }
示例#11
0
        public virtual bool RunTest(string TestName)
        {
            MonsterDebug.Log("Attempting to run test " + TestName + " on a standalone copy of the game.");

            Environment.SetEnvironmentVariable(MonsterTestCore.MonsterStarterTestNameEnvVariable, TestName);

            string AppPath = "";

            if (IgorJobConfig.IsStringParamSet(MonsterTestCore.ExplicitAppPathFlag))
            {
                AppPath = IgorJobConfig.GetStringParam(MonsterTestCore.ExplicitAppPathFlag);
            }
            else
            {
                foreach (string CurrentProduct in IgorCore.GetModuleProducts())
                {
                    if (CurrentProduct.Contains(".app"))
                    {
                        AppPath = CurrentProduct.Substring(0, CurrentProduct.IndexOf(".app") + 4);
                    }
                    else if (CurrentProduct.EndsWith(".exe"))
                    {
                        AppPath = CurrentProduct;
                    }
                }
            }

            if (AppPath.EndsWith(".app"))
            {
                AppPath = Path.Combine(AppPath, Path.Combine("Contents", Path.Combine("MacOS", AppPath.Substring(AppPath.LastIndexOf('/') + 1, AppPath.Length - AppPath.LastIndexOf('/') - 5))));

                IgorRuntimeUtils.SetFileExecutable(AppPath);
            }

            string AppOutput = "";
            string AppError  = "";

            int RunAppRC = IgorRuntimeUtils.RunProcessCrossPlatform(AppPath, AppPath, "", Path.GetFullPath("."), ref AppOutput, ref AppError);

            if (RunAppRC != 0)
            {
                MonsterDebug.LogError("Failed to run test.  App retruned RC " + RunAppRC + "!\n\nOutput:\n" + AppOutput + "\n\nError:\n" + AppError);

                return(true);
            }

            MonsterDebug.Log("Test ran successfully!\n\nOutput:\n" + AppOutput + "\n\nError:\n" + AppError);

            return(true);
        }
示例#12
0
        public override void ProcessArgs(IIgorStepHandler StepHandler)
        {
            IgorCore.SetModuleActiveForJob(this);

            if (IgorJobConfig.IsBoolParamSet(IgorBuildCommon.BuildFlag))
            {
                if (IgorJobConfig.IsStringParamSet(IgorBuildCommon.BuildOptionsFlag))
                {
                    int OutResult = 0;
                    if (Int32.TryParse(IgorJobConfig.GetStringParam(IgorBuildCommon.BuildOptionsFlag).Trim('"'), out OutResult))
                    {
                        SetBuildOptionsBitfield = OutResult;
                    }
                }
            }
        }
示例#13
0
        public override void ProcessArgs(IIgorStepHandler StepHandler)
        {
            if (IgorJobConfig.IsBoolParamSet(IgorBuildCommon.BuildFlag))
            {
                IgorCore.SetModuleActiveForJob(this);

                string Platform = IgorJobConfig.GetStringParam(IgorBuildCommon.PlatformFlag);

                if (Platform.Contains("Android"))
                {
                    JobBuildTarget = BuildTarget.Android;

                    StepHandler.RegisterJobStep(IgorBuildCommon.SwitchPlatformStep, this, SwitchPlatforms);
                    StepHandler.RegisterJobStep(IgorBuildCommon.BuildStep, this, BuildAndroid);
                    StepHandler.RegisterJobStep(BuildAndroidProjStep, this, BuildAndroidProj);
                }
            }
        }
示例#14
0
文件: IgorZip.cs 项目: fbizuneh/Igor
        public override void ProcessArgs(IIgorStepHandler StepHandler)
        {
            if (IgorPackageCommon.RunPackageStepsThisJob() && IgorJobConfig.IsBoolParamSet(ZipFlag) && IgorJobConfig.GetStringParam(ZipFilenameFlag) != "")
            {
                IgorCore.SetModuleActiveForJob(this);
                StepHandler.RegisterJobStep(IgorPackageCommon.PackageStep, this, CreateZip);
            }

            if (IgorPackageCommon.RunPackageStepsThisJob() && IgorJobConfig.IsBoolParamSet(UnzipFlag))
            {
                IgorCore.SetModuleActiveForJob(this);
                StepHandler.RegisterJobStep(IgorPackageCommon.UnpackageStep, this, UnzipProducts);
            }
        }
示例#15
0
        public virtual string GetBuiltNameForTarget(BuildTarget NewTarget)
        {
            string BuiltName = "";

            bool bOSX     = false;
            bool bWindows = false;
            bool bLinux   = false;

            if (NewTarget == BuildTarget.StandaloneOSXIntel)
            {
                BuiltName = GetConfigString("BuiltOSX32Name");
                bOSX      = true;
            }
            else if (NewTarget == BuildTarget.StandaloneOSXIntel64)
            {
                BuiltName = GetConfigString("BuiltOSX64Name");
                bOSX      = true;
            }
            else if (NewTarget == BuildTarget.StandaloneOSXUniversal)
            {
                BuiltName = GetConfigString("BuiltOSXUniversalName");
                bOSX      = true;
            }

            if (NewTarget == BuildTarget.StandaloneWindows)
            {
                BuiltName = GetConfigString("BuiltWindows32Name");
                bWindows  = true;
            }
            else if (NewTarget == BuildTarget.StandaloneWindows64)
            {
                BuiltName = GetConfigString("BuiltWindows64Name");
                bWindows  = true;
            }

            if (NewTarget == BuildTarget.StandaloneLinux)
            {
                BuiltName = GetConfigString("BuiltLinux32Name");
                bLinux    = true;
            }
            else if (NewTarget == BuildTarget.StandaloneLinux64)
            {
                BuiltName = GetConfigString("BuiltLinux64Name");
                bLinux    = true;
            }
            else if (NewTarget == BuildTarget.StandaloneLinuxUniversal)
            {
                BuiltName = GetConfigString("BuiltLinuxUniversalName");
                bLinux    = true;
            }

            if (BuiltName == "")
            {
                if (bOSX)
                {
                    BuiltName = GetConfigString("BuiltOSXName");
                }
                else if (bWindows)
                {
                    BuiltName = GetConfigString("BuiltWindowsName");
                }
                else if (bLinux)
                {
                    BuiltName = GetConfigString("BuiltLinuxName");
                }
            }

            if (BuiltName == "")
            {
                BuiltName = IgorJobConfig.GetStringParam(IgorBuildCommon.BuiltNameFlag);
            }

            if (BuiltName == "")
            {
                BuiltName = Path.GetFileName(EditorUserBuildSettings.GetBuildLocation(NewTarget));
            }

            if (BuiltName == "")
            {
                if (bOSX)
                {
                    BuiltName = "Unity.app";
                }
                else if (bWindows)
                {
                    BuiltName = "Unity.exe";
                }
                else if (bLinux)
                {
                    BuiltName = "Unity";
                }
            }

            if (!bLinux && !BuiltName.Contains(".exe") && !BuiltName.Contains(".app"))
            {
                if (bOSX)
                {
                    BuiltName += ".app";
                }
                if (bWindows)
                {
                    BuiltName += ".exe";
                }
            }

            if (!string.IsNullOrEmpty(BuiltName) && IgorJobConfig.IsBoolParamSet(IgorBuildCommon.AppendCommitInfoFlag))
            {
                string CommitInfo = IgorBuildCommon.GetCommitInfo();
                if (!string.IsNullOrEmpty(CommitInfo))
                {
                    BuiltName = BuiltName.Insert(BuiltName.IndexOf("."), "_" + CommitInfo);
                }
            }

            return(BuiltName);
        }