Exemple #1
0
        public static void ReplaceStringsInFile(IIgorModule ModuleInst, string FilePath, string OriginalString, string NewString)
        {
            string FullFilePath = FilePath;

            if (!File.Exists(FullFilePath))
            {
                FullFilePath = Path.Combine(Path.GetFullPath("."), FilePath);
            }

            if (File.Exists(FullFilePath))
            {
                File.SetAttributes(FullFilePath, System.IO.FileAttributes.Normal);
            }

            if (IgorAssert.EnsureTrue(ModuleInst, File.Exists(FullFilePath), "Replace string in file failed because " + FullFilePath + " doesn't exist."))
            {
                string FileContents = File.ReadAllText(FilePath);

                FileContents = FileContents.Replace(OriginalString, NewString);

                IgorRuntimeUtils.DeleteFile(FileContents);

                File.WriteAllText(FilePath, FileContents);
            }
        }
Exemple #2
0
        public static bool RunAnt(IIgorModule ModuleInst, string ProjectDirectory, string Targets)
        {
            string ANT_ROOT   = IgorRuntimeUtils.GetEnvVariable("ANT_ROOT");
            string AntCommand = "";

            string FinalParams = "";

#if UNITY_EDITOR_OSX
            if (ANT_ROOT != "")
            {
                AntCommand = Path.Combine(ANT_ROOT, Path.Combine("bin", "ant"));
            }
            else
            {
                AntCommand = "/usr/bin/ant";
            }

            FinalParams += Targets + " -lib " +
                           Path.Combine(EditorApplication.applicationPath, Path.Combine("Contents", Path.Combine("PlaybackEngines", Path.Combine("AndroidPlayer", Path.Combine("bin", "classes.jar")))));
#else
            AntCommand = "C:\\Windows\\System32\\cmd.exe";

            FinalParams += "/C " + ANT_ROOT + "bin\\ant.bat " + Targets + " -lib " +
                           Path.Combine(EditorApplication.applicationPath, Path.Combine("Data", Path.Combine("PlaybackEngines", Path.Combine("androidplayer", Path.Combine("bin", "classes.jar")))));
#endif // UNITY_EDITOR_OSX

            if (!IgorAssert.EnsureTrue(ModuleInst, File.Exists(AntCommand), "Can't find the Ant executable!  Did you set your ANT_ROOT?"))
            {
                return(false);
            }

//			IgorCore.LogError(ModuleInst, "Ant params are " + FinalParams);

            return(IgorRuntimeUtils.RunProcessCrossPlatform(ModuleInst, AntCommand, AntCommand, FinalParams, ProjectDirectory, "Running Ant build") == 0);
        }
Exemple #3
0
        public static void ZipFilesMac(IIgorModule ModuleInst, List <string> FilesToZip, string ZipFilename, bool bUpdateBuildProducts, string RootDir)
        {
            string ZipParams = "-r \"" + ZipFilename + "\" ";

            foreach (string CurrentFile in FilesToZip)
            {
                ZipParams += "\"" + CurrentFile + "\" ";
            }

            string ZipOutput = "";
            string ZipError  = "";

            if (IgorRuntimeUtils.RunProcessCrossPlatform(ModuleInst, "zip", "", ZipParams, Path.GetFullPath(RootDir), "Zipping the files", true) == 0)
            {
                IgorDebug.Log(ModuleInst, "Zip file " + ZipFilename + " created successfully!\nOutput:\n" + ZipOutput + "\nError\n" + ZipError);

                if (bUpdateBuildProducts)
                {
                    List <string> NewProducts = new List <string>();

                    NewProducts.Add(ZipFilename);

                    IgorCore.SetNewModuleProducts(NewProducts);
                }
            }
        }
Exemple #4
0
 public static void Cleanup()
 {
     if (File.Exists(IgorJobConfigPath))
     {
         IgorRuntimeUtils.DeleteFile(IgorJobConfigPath);
     }
 }
Exemple #5
0
        public static string GetZipAlignPath(IIgorModule ModuleInst)
        {
            string AndroidSDKPath = GetAndroidSDKPath(ModuleInst);
            string ZipAlignPath   = "";

            if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(AndroidSDKPath), "The Android SDK path " + AndroidSDKPath + " doesn't exist!"))
            {
                string BuildToolsPath = Path.Combine(AndroidSDKPath, "build-tools");

                if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(BuildToolsPath), "The Android build tools path " + BuildToolsPath + " doesn't exist!"))
                {
                    List <string> BuildToolVersions = IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(BuildToolsPath, false, true, false, true, true);

                    foreach (string CurrentVersion in BuildToolVersions)
                    {
                        string ZipAlignVersionPath = Path.Combine(BuildToolsPath, Path.Combine(CurrentVersion, "zipalign"));

                        if (File.Exists(ZipAlignVersionPath))
                        {
                            ZipAlignPath = ZipAlignVersionPath;

                            break;
                        }
                    }

                    IgorAssert.EnsureTrue(ModuleInst, ZipAlignPath != "", "ZipAlign couldn't be found!  Have you downloaded the android build-tools?");
                }
            }

            return(ZipAlignPath);
        }
        public virtual void CopyJavaFilesAndReplacePackageName(string RootSourceDir, string RootDestDir)
        {
            List <string> JavaFilesToCopy = IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(RootSourceDir, true, false, true, true, true);

            foreach (string CurrentFile in JavaFilesToCopy)
            {
                if (CurrentFile.EndsWith(".java") || CurrentFile.EndsWith(".aidl"))
                {
                    string RelativeFilePath   = CurrentFile.Substring(RootSourceDir.Length + 1);
                    string NewDestinationPath = Path.Combine(RootDestDir, RelativeFilePath);

                    if (!Directory.Exists(Path.GetDirectoryName(NewDestinationPath)))
                    {
                        Directory.CreateDirectory(Path.GetDirectoryName(NewDestinationPath));
                    }

                    if (!File.Exists(NewDestinationPath))
                    {
                        IgorRuntimeUtils.CopyFile(CurrentFile, NewDestinationPath);

                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "com.facebook.android.R", PlayerSettings.bundleIdentifier + ".R");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "import com.facebook.android.*;", "import com.facebook.android.*;\nimport " + PlayerSettings.bundleIdentifier + ".R;");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "com.facebook.android.BuildConfig", PlayerSettings.bundleIdentifier + ".BuildConfig");
                        IgorUtils.ReplaceStringsInFile(this, NewDestinationPath, "import com.mikamikem.AndroidUnity.R;", "import " + PlayerSettings.bundleIdentifier + ".R;");
                    }
                }
            }
        }
Exemple #7
0
        public virtual void DrawStringParam(ref string CurrentParams, string StringLabel, string StringParam)
        {
            string CurrentStringValue = IgorRuntimeUtils.GetStringParam(CurrentParams, StringParam);

            CurrentStringValue = EditorGUILayout.TextField(new GUIContent(StringLabel, StringLabel), string.IsNullOrEmpty(CurrentStringValue) ? string.Empty : CurrentStringValue);

            CurrentParams = IgorRuntimeUtils.SetStringParam(CurrentParams, StringParam, CurrentStringValue);
        }
Exemple #8
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);
        }
Exemple #9
0
        public static void AddRequiredDeviceCapability(IIgorModule ModuleInst, string PlistPath, string NewRequiredDeviceCapability)
        {
            if (IgorAssert.EnsureTrue(ModuleInst, File.Exists(PlistPath), "Plist " + PlistPath + " doesn't exist!"))
            {
                FileInfo PlistFileInfo = new FileInfo(PlistPath);

                NSObject PlistRoot = PropertyListParser.Parse(PlistFileInfo);

                if (IgorAssert.EnsureTrue(ModuleInst, PlistRoot != null, "Plist " + PlistPath + " could not be parsed!"))
                {
                    if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSDictionary).IsAssignableFrom(PlistRoot.GetType()), "Plist " + PlistPath + " root object is not a dictionary."))
                    {
                        NSDictionary RootDictionary = (NSDictionary)PlistRoot;

                        if (IgorAssert.EnsureTrue(ModuleInst, RootDictionary != null, "Plist root is not a dictionary."))
                        {
                            if (IgorAssert.EnsureTrue(ModuleInst, RootDictionary.ContainsKey("UIRequiredDeviceCapabilities"), "Can't find UIRequiredDeviceCapabilities in plist."))
                            {
                                NSObject DeviceCapabilities = RootDictionary.Get("UIRequiredDeviceCapabilities");

                                if (IgorAssert.EnsureTrue(ModuleInst, DeviceCapabilities != null, "Plist does not contain UIRequiredDeviceCapabilities."))
                                {
                                    if (IgorAssert.EnsureTrue(ModuleInst, typeof(NSArray).IsAssignableFrom(DeviceCapabilities.GetType()), "Plist UIRequiredDeviceCapabilities is not an array."))
                                    {
                                        NSArray CapabilitiesArray = (NSArray)DeviceCapabilities;

                                        if (IgorAssert.EnsureTrue(ModuleInst, CapabilitiesArray != null, "UIRequiredDeviceCapabilities is not an array."))
                                        {
                                            if (CapabilitiesArray.ContainsObject(new NSString(NewRequiredDeviceCapability)))
                                            {
                                                IgorDebug.Log(ModuleInst, "UIRequiredDeviceCapabilities already contains " + NewRequiredDeviceCapability);
                                            }
                                            else
                                            {
                                                NSSet NewCapabilitiesSet = new NSSet(CapabilitiesArray.GetArray());

                                                NewCapabilitiesSet.AddObject(new NSString(NewRequiredDeviceCapability));

                                                NSArray NewCapabilitiesArray = new NSArray(NewCapabilitiesSet.AllObjects());

                                                RootDictionary["UIRequiredDeviceCapabilities"] = NewCapabilitiesArray;

                                                IgorRuntimeUtils.DeleteFile(PlistPath);

                                                PropertyListParser.SaveAsXml(RootDictionary, PlistFileInfo);

                                                IgorDebug.Log(ModuleInst, NewRequiredDeviceCapability + " added to UIRequiredDeviceCapabilities.");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #10
0
        public virtual bool DrawBoolParam(ref string CurrentParams, string BoolLabel, string BoolParam)
        {
            bool bIsEnabled = IgorRuntimeUtils.IsBoolParamSet(CurrentParams, BoolParam);

            bIsEnabled = EditorGUILayout.Toggle(new GUIContent(BoolLabel, BoolLabel), bIsEnabled);

            CurrentParams = IgorRuntimeUtils.SetBoolParam(CurrentParams, BoolParam, bIsEnabled);

            return(bIsEnabled);
        }
Exemple #11
0
        public override string DrawJobInspectorAndGetEnabledParams(string CurrentParams)
        {
            string EnabledParams = CurrentParams;

            string Platform = IgorRuntimeUtils.GetStringParam(CurrentParams, IgorBuildCommon.PlatformFlag);

            DrawStringConfigParamDifferentOverride(ref EnabledParams, "Built name", IgorBuildCommon.BuiltNameFlag, GetBuiltNameConfigKeyForPlatform(Platform));

            return(EnabledParams);
        }
Exemple #12
0
        public virtual bool Build()
        {
            string BuiltName     = GetBuiltNameForTarget(JobBuildTarget);
            string BuiltBaseName = BuiltName;

            if (BuiltBaseName.Contains("."))
            {
                BuiltBaseName = BuiltName.Substring(0, BuiltBaseName.LastIndexOf('.'));
            }

            string DataFolderName = BuiltBaseName + "_Data";

            if (File.Exists(BuiltName))
            {
                IgorRuntimeUtils.DeleteFile(BuiltName);
            }

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

#if !UNITY_4_3
            BuiltName = System.IO.Path.Combine(System.IO.Path.GetFullPath("."), BuiltName);
#endif
            BuildPipeline.BuildPlayer(IgorUtils.GetLevels(), BuiltName, JobBuildTarget, IgorBuildCommon.GetBuildOptions());

            Log("Destination file is: " + BuiltName);

            List <string> BuiltFiles = new List <string>();

            if (Directory.Exists(DataFolderName))
            {
                if (IgorAssert.EnsureTrue(this, File.Exists(BuiltName), "The built file " + BuiltName + " doesn't exist.  Something went wrong during the build step.  Please check the logs!"))
                {
                    BuiltFiles.Add(BuiltName);
                }

                if (IgorAssert.EnsureTrue(this, Directory.Exists(DataFolderName), "The built data directory for the Windows build " + DataFolderName + " doesn't exist.  Something went wrong during the build step.  Please check the logs!"))
                {
                    BuiltFiles.Add(DataFolderName);
                }
            }
            else
            {
                if (IgorAssert.EnsureTrue(this, Directory.Exists(BuiltName), "The built app directory for the Mac build " + BuiltName + " doesn't exist.  Something went wrong during the build step.  Please check the logs!"))
                {
                    BuiltFiles.Add(BuiltName);
                }
            }

            IgorCore.SetNewModuleProducts(BuiltFiles);

            return(true);
        }
Exemple #13
0
        public static bool IsBoolParamSet(string BoolParam)
        {
            IgorJobConfig Inst = GetConfig();

            if (Inst != null)
            {
                return(IgorRuntimeUtils.IsBoolParamSet(Inst.Persistent.JobCommandLineParams, BoolParam));
            }

            return(false);
        }
Exemple #14
0
        public void Save(string path)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(IgorConfig));

            IgorRuntimeUtils.DeleteFile(path);

            using (FileStream stream = new FileStream(path, FileMode.Create))
            {
                serializer.Serialize(stream, this);
            }
        }
Exemple #15
0
        public virtual bool Cleanup()
        {
            string DestinationFile = GetParamOrConfigString(UploadToFTPFlag, "Destination file for JenkinsFTP isn't set so we can't clean it up.");

            if (File.Exists(DestinationFile))
            {
                IgorRuntimeUtils.DeleteFile(DestinationFile);
            }

            return(true);
        }
Exemple #16
0
        public static void SetBoolParam(string BoolParam, bool bTrue)
        {
            IgorJobConfig Inst = GetConfig();

            if (Inst != null)
            {
                Inst.Persistent.JobCommandLineParams = IgorRuntimeUtils.SetBoolParam(Inst.Persistent.JobCommandLineParams, BoolParam, bTrue);

                Inst.Save(IgorJobConfigPath);
            }
        }
Exemple #17
0
        public static void SetStringParam(string ParamKey, string ParamValue)
        {
            IgorJobConfig Inst = GetConfig();

            if (Inst != null)
            {
                Inst.Persistent.JobCommandLineParams = IgorRuntimeUtils.SetStringParam(Inst.Persistent.JobCommandLineParams, ParamKey, ParamValue);

                Inst.Save(IgorJobConfigPath);
            }
        }
Exemple #18
0
        public static string GetStringParam(string ParamKey)
        {
            IgorJobConfig Inst = GetConfig();

            if (Inst != null)
            {
                return(IgorRuntimeUtils.GetStringParam(Inst.Persistent.JobCommandLineParams, ParamKey));
            }

            return("");
        }
Exemple #19
0
        public static void InitializeRuntimeCoreIfNeeded()
        {
            if (RuntimeCore == null)
            {
                List <Type> RuntimeCoreTypes = IgorRuntimeUtils.GetTypesInheritFrom <IIgorCore>();

                if (RuntimeCoreTypes.Count > 0)
                {
                    RuntimeCore = (IIgorCore)Activator.CreateInstance(RuntimeCoreTypes[0]);
                }
            }
        }
Exemple #20
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);
        }
Exemple #21
0
        public static void UnzipArchiveCrossPlatform(IIgorModule ModuleInst, string ZipFilename, string DirectoryToUnzipTo, bool bUpdateBuildProducts = false)
        {
            IgorRuntimeUtils.PlatformNames CurrentPlatform = IgorRuntimeUtils.RuntimeOrEditorGetPlatform();

            if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX)
            {
                UnzipFileMac(ModuleInst, ZipFilename, DirectoryToUnzipTo, bUpdateBuildProducts);
            }
            else if (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_Windows || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_Windows)
            {
                UnzipFileWindows(ModuleInst, ZipFilename, DirectoryToUnzipTo, bUpdateBuildProducts);
            }
        }
Exemple #22
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);
        }
Exemple #23
0
        public virtual List <string> GetAllDerivedTestStateTypes()
        {
            List <Type>   DerivedTypes = IgorRuntimeUtils.GetTypesInheritFrom <MonsterTestState>();
            List <string> TypeNames    = new List <string>();

            foreach (Type CurrentType in DerivedTypes)
            {
                MonsterTestState StateInst = (MonsterTestState)Activator.CreateInstance(CurrentType);

                TypeNames.Add(StateInst.GetEntityName());
            }

            return(TypeNames);
        }
Exemple #24
0
        // This is necessary as of 5.x  If the 3rd party libraries that you include are marked read only (like when you use Perforce as a version control system)
        // your build will fail in the built-in Unity postprocess step, so we just set them all to read/write before we build.
        public static void FixReadOnlyFilesIn3rdPartyLibs()
        {
            string        AndroidPluginPathRoot   = Path.Combine(Path.GetFullPath("."), Path.Combine("Assets", Path.Combine("Plugins", "Android")));
            List <string> Android3rdPartyLibFiles = IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(AndroidPluginPathRoot, true, false, true);

            foreach (string CurrentFilePath in Android3rdPartyLibFiles)
            {
                string CurrentFullPath = Path.Combine(AndroidPluginPathRoot, CurrentFilePath);
                if (File.Exists(CurrentFullPath))
                {
                    File.SetAttributes(CurrentFullPath, System.IO.FileAttributes.Normal);
                }
            }
        }
Exemple #25
0
        public static void ZipFilesWindows(IIgorModule ModuleInst, List <string> FilesToZip, string ZipFilename, bool bUpdateBuildProducts, string RootDir)
        {
            string ZipCommand = "";
            string ZipParams  = "";

            string PathX86 = "C:\\Program Files (x86)\\7-Zip\\7z.exe";
            string Path64  = "C:\\Program Files\\7-Zip\\7z.exe";

            if (File.Exists(PathX86))
            {
                ZipCommand = PathX86;
                ZipParams += "a -tzip \"" + ZipFilename + "\" ";
            }
            else
            if (File.Exists(Path64))
            {
                ZipCommand = Path64;
                ZipParams += "a -tzip \"" + ZipFilename + "\" ";
            }
            else
            {
                IgorDebug.LogError(ModuleInst, "7Zip is not installed.  Currently 7Zip is the only zip tool supported on Windows.\nPlease download it from here: http://www.7-zip.org/download.html");
                IgorDebug.LogError(ModuleInst, "Skipping zip step.");

                return;
            }

            foreach (string CurrentFile in FilesToZip)
            {
                ZipParams += "\"" + CurrentFile + "\" ";
            }

            string ZipOutput = "";
            string ZipError  = "";

            if (IgorRuntimeUtils.RunProcessCrossPlatform(ModuleInst, "", ZipCommand, ZipParams, Path.GetFullPath(RootDir), "Zipping the files") == 0)
            {
                IgorDebug.Log(ModuleInst, "Zip file " + ZipFilename + " created successfully!\nOutput:\n" + ZipOutput + "\nError\n" + ZipError);

                if (bUpdateBuildProducts)
                {
                    List <string> NewProducts = new List <string>();

                    NewProducts.Add(ZipFilename);

                    IgorCore.SetNewModuleProducts(NewProducts);
                }
            }
        }
Exemple #26
0
        public static void RegisterAllTypes()
        {
            List <Type> XMLTypes = IgorRuntimeUtils.GetTypesInheritFrom <XMLSerializable>();

            foreach (Type CurrentXMLType in XMLTypes)
            {
                MethodInfo RegisterFunction = CurrentXMLType.GetMethod("RegisterType", BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly);

                if (RegisterFunction != null)
                {
                    RegisterFunction.Invoke(null, new object[] {});
                }
            }

            XMLSerializable.bSafeToLoad = true;
        }
Exemple #27
0
        public override void ProcessArgs(IIgorStepHandler StepHandler)
        {
            bool bStepRegistered = false;

            if (IgorDistributionCommon.RunDistributionStepsThisJob() &&
                GetParamOrConfigString(UploadToFTPHostFlag) != "" && GetParamOrConfigString(UploadToFTPUserFlag) != "" && GetParamOrConfigString(UploadToFTPPassFlag) != "" &&
                GetParamOrConfigString(UploadToFTPDirectoryFlag) != "" &&
                (IgorJobConfig.IsBoolParamSet(UploadToFTPNoEnvFlag) ||
                 (IgorJobConfig.IsBoolParamSet(UploadToFTPEnvEnableFlag) && GetParamOrConfigString(UploadToFTPEnvNameFlag) != "" &&
                  IgorRuntimeUtils.GetEnvVariable(GetParamOrConfigString(UploadToFTPEnvNameFlag)) == "true")))
            {
                StepHandler.RegisterJobStep(UploadToFTPStep, this, UploadToFTP);

                IgorCore.SetModuleActiveForJob(this);
            }
        }
Exemple #28
0
        public static void RegisterEditorTypes()
        {
            TypeUtils.RegisterAllTypes();

            List <Type> InspectableTypes = IgorRuntimeUtils.GetTypesInheritFrom <InspectableObject>();

            foreach (Type CurrentInspectableType in InspectableTypes)
            {
                MethodInfo RegisterFunction = CurrentInspectableType.GetMethod("RegisterEditorType", BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly);

                if (RegisterFunction != null)
                {
                    RegisterFunction.Invoke(null, new object[] {});
                }
            }
        }
Exemple #29
0
        public virtual void CopyLauncherToProjectPath(BuildTarget TargetTestPlatform, string TempPath, string LocalPath)
        {
            if (TargetTestPlatform == BuildTarget.StandaloneOSXIntel64)
            {
                string        ZipPath     = Path.Combine(TempPath, "MonsterLauncherOSX.zip");
                List <string> ZipFileList = new List <string>();

                foreach (string FilePath in IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(Path.Combine(TempPath, "MonsterLauncher.app"), true, false, true))
                {
                    ZipFileList.Add("MonsterLauncher.app/" + FilePath);
                }

                IgorZip.ZipFilesCrossPlatform(this, ZipFileList, ZipPath, false, TempPath);

                string ZipLocalPath = Path.Combine(LocalPath, "MonsterLauncherOSX.zip");

                if (File.Exists(ZipLocalPath))
                {
                    IgorRuntimeUtils.DeleteFile(ZipLocalPath);
                }

                IgorRuntimeUtils.CopyFile(ZipPath, ZipLocalPath);
            }
            else if (TargetTestPlatform == BuildTarget.StandaloneWindows64)
            {
                string        ZipPath     = Path.Combine(TempPath, "MonsterLauncherWindows.zip");
                List <string> ZipFileList = new List <string>();

                foreach (string FilePath in IgorRuntimeUtils.GetListOfFilesAndDirectoriesInDirectory(Path.Combine(TempPath, "MonsterLauncher_Data"), true, false, true))
                {
                    ZipFileList.Add("MonsterLauncher_Data/" + FilePath);
                }

                ZipFileList.Add("MonsterLauncher.exe");

                IgorZip.ZipFilesCrossPlatform(this, ZipFileList, ZipPath, false, TempPath);

                string ZipLocalPath = Path.Combine(LocalPath, "MonsterLauncherWindows.zip");

                if (File.Exists(ZipLocalPath))
                {
                    IgorRuntimeUtils.DeleteFile(ZipLocalPath);
                }

                IgorRuntimeUtils.CopyFile(ZipPath, ZipLocalPath);
            }
        }
Exemple #30
0
        public static int RunProcessCrossPlatform(IIgorModule ModuleInst, string OSXCommand, string WindowsCommand, string Parameters, string Directory, string CommandLogDescription, ref string ProcessOutput, ref string ProcessError, bool bUseShell = false)
        {
            int RunProcessExitCode = RunProcessCrossPlatform(OSXCommand, WindowsCommand, Parameters, Directory, ref ProcessOutput, ref ProcessError, bUseShell);

            IgorRuntimeUtils.PlatformNames CurrentPlatform = IgorRuntimeUtils.RuntimeOrEditorGetPlatform();

            if (!IgorAssert.EnsureTrue(ModuleInst, RunProcessExitCode == 0, CommandLogDescription + " failed!\nCommand: " + (
                                           (CurrentPlatform == IgorRuntimeUtils.PlatformNames.Editor_OSX || CurrentPlatform == IgorRuntimeUtils.PlatformNames.Standalone_OSX) ? OSXCommand : WindowsCommand
                                           ) + " " + Parameters + "\nDirectory: " + Directory + "\nOutput:\n" + ProcessOutput + "\n\n\nError:\n" + ProcessError))
            {
                return(RunProcessExitCode);
            }

            IgorDebug.Log(ModuleInst, CommandLogDescription + " succeeded!\nOutput:\n" + ProcessOutput + "\n\n\nError:\n" + ProcessError);

            return(RunProcessExitCode);
        }