Esempio n. 1
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);
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        public override void ProcessArgs(IIgorStepHandler StepHandler)
        {
            if (IgorDistributionCommon.RunDistributionStepsThisJob() &&
                ((IgorJobConfig.IsBoolParamSet(CopyToSyncExpEnabledFlag) && GetParamOrConfigString(CopyToSyncExplicitFlag) != "") ||
                 (IgorJobConfig.IsBoolParamSet(CopyToSyncEnvEnabledFlag) &&
                  (GetParamOrConfigString(CopyToSyncEnvFlag) != "" && IgorRuntimeUtils.GetEnvVariable(GetParamOrConfigString(CopyToSyncEnvFlag)) != ""))) &&
                GetParamOrConfigString(CopyToSyncFilenameFlag) != "")
            {
                IgorCore.SetModuleActiveForJob(this);

                if (IgorJobConfig.IsBoolParamSet(CopyFromSyncFlag))
                {
                    StepHandler.RegisterJobStep(CopyFromSyncStep, this, CopyFromSync);
                }
                else
                {
                    StepHandler.RegisterJobStep(CopyToSyncStep, this, CopyToSync);
                }
            }
        }
Esempio n. 4
0
        public virtual bool CopyToFromSync(bool bToSync)
        {
            string LocalFile = "";

            if (bToSync)
            {
                List <string> BuiltProducts = IgorCore.GetModuleProducts();

                IgorAssert.EnsureTrue(this, BuiltProducts.Count == 1, "This module requires exactly one built file, but we found " + BuiltProducts.Count + " instead.  Please make sure you've enabled a package step prior to this one.");

                if (BuiltProducts.Count > 0)
                {
                    LocalFile = BuiltProducts[0];
                }
            }
            else
            {
                LocalFile = GetParamOrConfigString(CopyToLocalDirFlag, "", Path.GetFullPath("."), false);
            }

            if (IgorAssert.EnsureTrue(this, !bToSync || File.Exists(LocalFile), "BitTorrent Sync copy was told to copy file " + LocalFile + ", but the file doesn't exist!"))
            {
                string SyncFile = "";

                if (IgorJobConfig.IsBoolParamSet(CopyToSyncExpEnabledFlag))
                {
                    SyncFile = GetParamOrConfigString(CopyToSyncExplicitFlag, "BitTorrent Sync copy to sync explicit is enabled, but the path isn't set.");
                }

                if (SyncFile == "" && IgorJobConfig.IsBoolParamSet(CopyToSyncEnvEnabledFlag))
                {
                    string EnvVariable = GetParamOrConfigString(CopyToSyncEnvFlag, "BitTorrent Sync copy to sync based on environment variable is enabled, but the env variable name isn't set.");

                    if (EnvVariable == "")
                    {
                        return(true);
                    }

                    SyncFile = IgorRuntimeUtils.GetEnvVariable(EnvVariable);

                    if (!IgorAssert.EnsureTrue(this, SyncFile != "", "The BitTorrent Sync root path environment variable " + EnvVariable + " isn't set."))
                    {
                        return(true);
                    }
                }

                string SyncFilename = GetParamOrConfigString(CopyToSyncFilenameFlag, (bToSync ?
                                                                                      "BitTorrent Sync copy to sync destination filename isn't set." : "BitTorrent Sync copy from sync source filename isn't set."));

                if (SyncFilename == "")
                {
                    return(true);
                }

                SyncFile = Path.Combine(SyncFile, SyncFilename);

                if (bToSync)
                {
                    if (File.Exists(SyncFile))
                    {
                        IgorRuntimeUtils.DeleteFile(SyncFile);
                    }

                    IgorRuntimeUtils.CopyFile(LocalFile, SyncFile);

                    Log("File " + LocalFile + " copied to requested location " + SyncFile + " for BitTorrent Sync uploading.");
                }
                else
                {
                    LocalFile = Path.Combine(LocalFile, Path.GetFileName(SyncFile));

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

                    IgorRuntimeUtils.CopyFile(SyncFile, LocalFile);

                    Log("File " + SyncFile + " copied from the BitTorrent Sync share to requested location " + LocalFile + ".");

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

                    NewProducts.Add(LocalFile);

                    IgorCore.SetNewModuleProducts(NewProducts);
                }
            }

            return(true);
        }
Esempio n. 5
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);
                }
            }
        }