protected override void SetExecutionInfo()
        {
            base.SetExecutionInfo();
            WorkingDirectory = WorkingDirectory ?? Path.GetDirectoryName(FilesToCompile.First().Path);

            SetPreprocessedVar("RunProgramMode", true.ToString());
            SetPreprocessedVar("RunFullClientLogPath", FullClientLogPath.ProPreProcStringify());
            SetPreprocessedVar("LogEntryTypes", LogEntryTypes.ProPreProcStringify());
        }
예제 #2
0
 protected override void CheckParameters()
 {
     base.CheckParameters();
     if (FilesToCompile == null || !FilesToCompile.Any())
     {
         throw new UoeExecutionParametersException("No files specified.");
     }
     if ((CompileInAnalysisMode || AnalysisModeSimplifiedDatabaseReferences) && !Env.IsProVersionHigherOrEqualTo(new Version(10, 2, 0)))
     {
         throw new UoeExecutionParametersException("The analysis mode (computes file and database references required to compile) is only available for openedge >= 10.2.");
     }
 }
예제 #3
0
        protected override void ExecuteNoWaitInternal()
        {
            CheckParameters();

            // ensure that each process will at least take in 10 files, starting a new process for 1 file to compile isn't efficient!
            var numberOfProcesses = Math.Min(MaxNumberOfProcesses, NumberOfFilesToCompile / MinimumNumberOfFilesPerProcess);

            numberOfProcesses = Math.Max(numberOfProcesses, 1);

            var fileLists      = new List <PathList <UoeFileToCompile> >();
            var currentProcess = 0;

            // foreach, sorted from the biggest (in size) to the smallest file
            foreach (var file in FilesToCompile.OrderByDescending(compile => compile.FileSize))
            {
                // create a new process when needed
                if (currentProcess >= fileLists.Count)
                {
                    fileLists.Add(new PathList <UoeFileToCompile>());
                }

                // assign the file to the current process
                if (!fileLists[currentProcess].TryAdd(file))
                {
                    continue;
                }

                // we will assign the next file to the next process...
                currentProcess++;
                if (currentProcess == numberOfProcesses)
                {
                    currentProcess = 0;
                }
            }

            // init the compilation on each process
            for (var i = 0; i < numberOfProcesses; i++)
            {
                var exec = new UoeExecutionCompile(Env)
                {
                    FilesToCompile = fileLists[i],
                    AnalysisModeSimplifiedDatabaseReferences = AnalysisModeSimplifiedDatabaseReferences,
                    CompileInAnalysisMode        = CompileInAnalysisMode,
                    CompileOptions               = CompileOptions,
                    CompilerMultiCompile         = CompilerMultiCompile,
                    CompileStatementExtraOptions = CompileStatementExtraOptions,
                    CompileWithDebugList         = CompileWithDebugList,
                    CompileWithListing           = CompileWithListing,
                    CompileWithPreprocess        = CompileWithPreprocess,
                    CompileWithXref              = CompileWithXref,
                    CompileUseXmlXref            = CompileUseXmlXref,
                    WorkingDirectory             = WorkingDirectory,
                    StopOnCompilationError       = StopOnCompilationError,
                    StopOnCompilationWarning     = StopOnCompilationWarning,
                    CancelToken = CancelToken
                };
                exec.OnExecutionException += OnProcessExecutionException;
                exec.OnExecutionEnd       += OnProcessExecutionEnd;
                _processes.Add(exec);
            }

            // launch the compile process
            try {
                foreach (var proExecutionCompile in _processes)
                {
                    proExecutionCompile.ExecuteNoWait();
                }
            } catch (Exception) {
                Started = true;
                KillProcess();
                throw;
            }
        }