Example #1
0
        /// <summary>
        /// get the output directory that will be use to generate the .r (and listing debug-list...)
        /// </summary>
        protected override bool ComputeOutputDir(FileToCompile fileToCompile, string localSubTempDir, int count)
        {
            // for *.cls files, as many *.r files are generated, we need to compile in a temp directory
            // we need to know which *.r files were generated for each input file
            // so each file gets his own sub tempDir
            var lastDeployment = ProEnv.Deployer.GetTransfersNeededForFile(fileToCompile.SourcePath, 0).Last();

            if (lastDeployment.DeployType != DeployType.Move ||
                Config.Instance.CompileForceUseOfTemp ||
                Path.GetExtension(fileToCompile.SourcePath ?? "").Equals(ExtCls))
            {
                // if the deployment dir is not on the same disk as the temp folder, we create a temp dir
                // as close to the final deployment as possible (= in the deployment base dir!)
                if (lastDeployment.DeployType != DeployType.Ftp &&
                    !string.IsNullOrEmpty(ProEnv.BaseCompilationPath) && ProEnv.BaseCompilationPath.Length > 2 && !ProEnv.BaseCompilationPath.Substring(0, 2).EqualsCi(_localTempDir.Substring(0, 2)))
                {
                    if (!Utils.CreateDirectory(DistantTempDir, FileAttributes.Hidden))
                    {
                        return(false);
                    }
                    fileToCompile.CompilationOutputDir = Path.Combine(DistantTempDir, count.ToString());
                }
                else
                {
                    fileToCompile.CompilationOutputDir = localSubTempDir;
                }
            }
            else
            {
                // if we want to move the r-code somewhere during the deployment, then we will compile the r-code
                // directly there, because it's faster than generating it in a temp folder and moving it afterward
                fileToCompile.CompilationOutputDir = lastDeployment.TargetBasePath;
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Allows to format a small text to explain the errors found in a file and the generated files...
        /// </summary>
        public static string FormatCompilationResultForSingleFile(string sourceFilePath, FileToCompile fileToCompile, List <FileToDeploy> listDeployedFiles)
        {
            var line = new StringBuilder();

            line.Append("<div style='padding-bottom: 5px;'>");
            line.Append("<img height='15px' src='" + Utils.GetExtensionImage((Path.GetExtension(sourceFilePath) ?? "").Replace(".", "")) + "'>");
            line.Append("<b>" + sourceFilePath.ToHtmlLink(Path.GetFileName(sourceFilePath), true) + "</b> in " + Path.GetDirectoryName(sourceFilePath).ToHtmlLink());
            line.Append("</div>");

            if (fileToCompile != null && fileToCompile.Errors != null)
            {
                line.Append("<div style='padding-left: 10px; padding-bottom: 5px;'>");
                foreach (var error in fileToCompile.Errors)
                {
                    line.Append(error.ToStringDescription());
                }
                line.Append("</div>");
            }

            if (listDeployedFiles != null)
            {
                line.Append("<div>");
                // group either by directory name or by pack name
                var groupDirectory = listDeployedFiles.GroupBy(deploy => deploy.GroupKey).Select(deploys => deploys.ToList()).ToList();
                foreach (var group in groupDirectory.OrderByDescending(list => list.First().DeployType).ThenBy(list => list.First().GroupKey))
                {
                    line.Append(group.First().ToStringGroupHeader());
                    foreach (var fileToDeploy in group.OrderBy(deploy => deploy.To))
                    {
                        line.Append(fileToDeploy.ToStringDescription());
                    }
                }
                line.Append("</div>");
            }

            return(line.ToString());
        }
Example #3
0
 /// <summary>
 /// get the output directory that will be use to generate the .r (and listing debug-list...)
 /// </summary>
 protected virtual bool ComputeOutputDir(FileToCompile fileToCompile, string localSubTempDir, int count)
 {
     fileToCompile.CompilationOutputDir = localSubTempDir;
     return(true);
 }