Example #1
0
        private ToolArgumentBuilder GetArguments(FilePath outputAssemblyPath,
                                                 FilePath primaryAssemblyFilePath, IEnumerable <FilePath> assemblyPaths, ILMergeSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            builder.AppendText(GetOutputParameter(outputAssemblyPath));

            if (settings.TargetKind != TargetKind.Default)
            {
                builder.AppendText(GetTargetKindParameter(settings));
            }

            if (settings.Internalize)
            {
                builder.AppendText("/internalize");
            }

            // Add primary assembly.
            builder.AppendQuotedText(primaryAssemblyFilePath.MakeAbsolute(_environment).FullPath);

            foreach (var file in assemblyPaths)
            {
                builder.AppendQuotedText(file.MakeAbsolute(_environment).FullPath);
            }

            // Create the process start info.
            return(builder);
        }
Example #2
0
        private ToolArgumentBuilder GetArguments(FilePath targetFilePath, NuGetRestoreSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            builder.AppendText("restore");
            builder.AppendQuotedText(targetFilePath.MakeAbsolute(_environment).FullPath);

            // RequireConsent?
            if (settings.RequireConsent)
            {
                builder.AppendText("-RequireConsent");
            }

            // Packages Directory
            if (settings.PackagesDirectory != null)
            {
                builder.AppendText("-PackagesDirectory");
                builder.AppendQuotedText(settings.PackagesDirectory.MakeAbsolute(_environment).FullPath);
            }

            // List of package sources
            if (settings.Source != null && settings.Source.Count > 0)
            {
                builder.AppendText("-Source");
                builder.AppendQuotedText(string.Join(";", settings.Source));
            }

            // No Cache?
            if (settings.NoCache)
            {
                builder.AppendText("-NoCache");
            }

            // Disable Parallel Processing?
            if (settings.DisableParallelProcessing)
            {
                builder.AppendText("-DisableParallelProcessing");
            }

            // Verbosity?
            if (settings.Verbosity.HasValue)
            {
                builder.AppendText("-Verbosity");
                builder.AppendText(settings.Verbosity.Value.ToString().ToLowerInvariant());
            }

            // Configuration file
            if (settings.ConfigFile != null)
            {
                builder.AppendText("-ConfigFile");
                builder.AppendQuotedText(settings.ConfigFile.MakeAbsolute(_environment).FullPath);
            }

            builder.AppendText("-NonInteractive");

            return(builder);
        }
Example #3
0
        private ToolArgumentBuilder GetArguments(IEnumerable <FilePath> objectFiles, LightSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            // Add defines
            if (settings.Defines != null && settings.Defines.Any())
            {
                var defines = settings.Defines.Select(define => string.Format(CultureInfo.InvariantCulture, "-d{0}={1}", define.Key, define.Value));
                foreach (var define in defines)
                {
                    builder.AppendText(define);
                }
            }

            // Add extensions
            if (settings.Extensions != null && settings.Extensions.Any())
            {
                var extensions = settings.Extensions.Select(extension => string.Format(CultureInfo.InvariantCulture, "-ext {0}", extension));
                foreach (var extension in extensions)
                {
                    builder.AppendText(extension);
                }
            }

            // No logo
            if (settings.NoLogo)
            {
                builder.AppendText("-nologo");
            }

            // Output file
            if (settings.OutputFile != null && !string.IsNullOrEmpty(settings.OutputFile.FullPath))
            {
                builder.AppendText("-o");
                builder.AppendQuotedText(settings.OutputFile.MakeAbsolute(_environment).FullPath);
            }

            // Raw arguments
            if (!string.IsNullOrEmpty(settings.RawArguments))
            {
                builder.AppendText(settings.RawArguments);
            }

            // Object files (.wixobj)
            foreach (var objectFile in objectFiles.Select(file => file.MakeAbsolute(_environment).FullPath))
            {
                builder.AppendQuotedText(objectFile);
            }

            return(builder);
        }
Example #4
0
        private ToolArgumentBuilder GetArguments(FilePath assemblyPath, MSTestSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            // Add the assembly to build.
            builder.AppendText(string.Concat("/testcontainer:", assemblyPath.MakeAbsolute(_environment).FullPath).Quote());

            if (settings.NoIsolation)
            {
                builder.AppendQuotedText("/noisolation");
            }

            return(builder);
        }
Example #5
0
        private ToolArgumentBuilder GetArguments(FilePath packageFilePath, NuGetPushSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            builder.AppendText("push");

            builder.AppendQuotedText(packageFilePath.MakeAbsolute(_environment).FullPath);

            if (settings.ApiKey != null)
            {
                builder.AppendText(settings.ApiKey);
            }

            builder.AppendText("-NonInteractive");

            if (settings.ConfigFile != null)
            {
                builder.AppendText("-ConfigFile");
                builder.AppendQuotedText(settings.ConfigFile.MakeAbsolute(_environment).FullPath);
            }

            if (settings.Source != null)
            {
                builder.AppendText("-Source");
                builder.AppendQuotedText(settings.Source);
            }

            if (settings.Timeout != null)
            {
                builder.AppendText("-Timeout");
                builder.AppendText(Convert.ToInt32(settings.Timeout.Value.TotalSeconds).ToString(CultureInfo.InvariantCulture));
            }

            if (settings.Verbosity != null)
            {
                builder.AppendText("-Verbosity");
                builder.AppendText(settings.Verbosity.Value.ToString().ToLowerInvariant());
            }

            return(builder);
        }
Example #6
0
        private ToolArgumentBuilder GetArguments(FilePath nuspecFilePath, NuGetPackSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            builder.AppendText("pack");

            // Version
            if (!string.IsNullOrWhiteSpace(settings.Version))
            {
                builder.AppendText("-Version");
                builder.AppendQuotedText(settings.Version);
            }

            // Base path
            if (settings.BasePath != null)
            {
                builder.AppendText("-BasePath");
                builder.AppendQuotedText(settings.BasePath.MakeAbsolute(_environment).FullPath);
            }

            // Output directory
            if (settings.OutputDirectory != null)
            {
                builder.AppendText("-OutputDirectory");
                builder.AppendQuotedText(settings.OutputDirectory.MakeAbsolute(_environment).FullPath);
            }

            // Nuspec file
            builder.AppendQuotedText(nuspecFilePath.MakeAbsolute(_environment).FullPath);

            // No package analysis?
            if (settings.NoPackageAnalysis)
            {
                builder.AppendText("-NoPackageAnalysis");
            }

            // Symbols?
            if (settings.Symbols)
            {
                builder.AppendText("-Symbols");
            }

            return(builder);
        }
Example #7
0
        private static ToolArgumentBuilder GetArguments(MSBuildSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            // Set the maximum number of processors.
            builder.AppendText(settings.MaxCpuCount > 0 ? string.Concat("/m:", settings.MaxCpuCount) : "/m");

            // Got a specific configuration in mind?
            if (!string.IsNullOrWhiteSpace(settings.Configuration))
            {
                // Add the configuration as a property.
                var configuration = settings.Configuration;
                builder.AppendText(string.Concat("/p:\"Configuration\"", "=", configuration.Quote()));
            }

            // Got any properties?
            if (settings.Properties.Count > 0)
            {
                foreach (var property in GetPropertyArguments(settings.Properties))
                {
                    builder.AppendText(property);
                }
            }

            // Got any targets?
            if (settings.Targets.Count > 0)
            {
                var targets = string.Join(";", settings.Targets);
                builder.AppendText(string.Concat("/target:", targets));
            }
            else
            {
                // Use default target.
                builder.AppendText("/target:Build");
            }

            // Add the solution as the last parameter.
            builder.AppendText(settings.Solution.FullPath.Quote());

            return(builder);
        }
Example #8
0
        private ToolArgumentBuilder GetArguments(IEnumerable <FilePath> sourceFiles, CandleSettings settings)
        {
            var builder = new ToolArgumentBuilder();

            // Architecture
            if (settings.Architecture.HasValue)
            {
                builder.AppendText("-arch");
                builder.AppendText(GetArchitectureName(settings.Architecture.Value));
            }

            // Add defines
            if (settings.Defines != null && settings.Defines.Any())
            {
                var defines = settings.Defines.Select(define => string.Format(CultureInfo.InvariantCulture, "-d{0}={1}", define.Key, define.Value));
                foreach (var define in defines)
                {
                    builder.AppendText(define);
                }
            }

            // Add extensions
            if (settings.Extensions != null && settings.Extensions.Any())
            {
                var extensions = settings.Extensions.Select(extension => string.Format(CultureInfo.InvariantCulture, "-ext {0}", extension));
                foreach (var extension in extensions)
                {
                    builder.AppendText(extension);
                }
            }

            // FIPS
            if (settings.FIPS)
            {
                builder.AppendText("-fips");
            }

            // No logo
            if (settings.NoLogo)
            {
                builder.AppendText("-nologo");
            }

            // Output directory
            if (settings.OutputDirectory != null && !string.IsNullOrEmpty(settings.OutputDirectory.FullPath))
            {
                // Candle want the path to end with \\, double separator chars.
                var separatorChar = System.IO.Path.DirectorySeparatorChar;
                var fullPath      = string.Concat(settings.OutputDirectory.MakeAbsolute(_environment).FullPath, separatorChar, separatorChar);

                builder.AppendText("-o");
                builder.AppendQuotedText(fullPath);
            }

            // Pedantic
            if (settings.Pedantic)
            {
                builder.AppendText("-pedantic");
            }

            // Show source trace
            if (settings.ShowSourceTrace)
            {
                builder.AppendText("-trace");
            }

            // Verbose
            if (settings.Verbose)
            {
                builder.AppendText("-v");
            }

            // Source files (.wxs)
            foreach (var sourceFile in sourceFiles.Select(file => file.MakeAbsolute(_environment).FullPath))
            {
                builder.AppendQuotedText(sourceFile);
            }

            return(builder);
        }