本文整理汇总了C#中Microsoft.Build.Utilities.CommandLineBuilder.AppendFileNamesIfNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLineBuilder.AppendFileNamesIfNotNull方法的具体用法?C# CommandLineBuilder.AppendFileNamesIfNotNull怎么用?C# CommandLineBuilder.AppendFileNamesIfNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Utilities.CommandLineBuilder
的用法示例。
在下文中一共展示了CommandLineBuilder.AppendFileNamesIfNotNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateCommandLineCommands
protected override string GenerateCommandLineCommands()
{
CommandLineBuilder cb = new CommandLineBuilder();
//cb.AppendSwitch("-q");
cb.AppendSwitch("-nologo");
cb.AppendSwitch("--");
cb.AppendFileNamesIfNotNull(Sources, " ");
return cb.ToString();
}
示例2: GenerateCommandLineCommands
/// <summary>
/// Generate the command line from the properties.
/// </summary>
/// <returns>Command line string.</returns>
protected override string GenerateCommandLineCommands()
{
CommandLineBuilder commandLine = new CommandLineBuilder();
CommandLineHelper.AppendIfTrue(commandLine, "-nologo", this.noLogo);
commandLine.AppendSwitchIfNotNull("-out ", outputFile.ItemSpec);
CommandLineHelper.AppendExtensions(commandLine, this.extensions, this.Log);
CommandLineHelper.AppendIfTrue(commandLine, "-ss", this.suppressSchemaValidation);
CommandLineHelper.AppendIfTrue(commandLine, "-sv", this.suppressIntermediateFileVersionMatching);
CommandLineHelper.AppendIfTrue(commandLine, "-sw", this.suppressAllWarnings);
CommandLineHelper.AppendIfTrue(commandLine, "-ust", this.useSmallTableDefinitions);
CommandLineHelper.AppendIfTrue(commandLine, "-wx", this.treatWarningsAsErrors);
CommandLineHelper.AppendIfSpecified(commandLine, "-w", this.warningLevel);
CommandLineHelper.AppendIfTrue(commandLine, "-v", this.verboseOutput);
CommandLineHelper.AppendIfSpecified(commandLine, "-v", this.verboseOutputLevel);
commandLine.AppendFileNamesIfNotNull(this.objectFiles, " ");
return commandLine.ToString();
}
示例3: TestAppendFileNamesIfNotNull3
public void TestAppendFileNamesIfNotNull3 ()
{
clb = new CommandLineBuilder ();
clb.AppendFileNamesIfNotNull (items, null);
}
示例4: TestAppendFileNamesIfNotNull1
public void TestAppendFileNamesIfNotNull1 ()
{
clb = new CommandLineBuilder ();
clb.AppendFileNamesIfNotNull (array, null);
}
示例5: GenerateCompilerCommandLine
internal static string GenerateCompilerCommandLine(
string outputFolder, ITaskItem[] references, ITaskItem[] sources, bool emitDebugInformation,
string[] disabledWarnings)
{
var builder = new CommandLineBuilder();
#region javac <options> <source files>
/* where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files and annotation processors
-cp <path> Specify where to find user class files and annotation processors
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
-processorpath <path> Specify where to find annotation processors
-d <directory> Specify where to place generated class files
-s <directory> Specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system */
#endregion
#region Debugging information
if (emitDebugInformation)
{
builder.AppendSwitch("-g");
}
else
{
builder.AppendSwitch("-g:none");
}
#endregion
builder.AppendSwitch("-d");
builder.AppendFileNameIfNotNull(outputFolder);
builder.AppendSwitch("-Xlint:all");
if (disabledWarnings != null)
{
foreach (string warning in disabledWarnings)
{
builder.AppendSwitch("-Xlint:-" + warning);
}
}
#region Project references built into a classpath
if (references != null)
{
builder.AppendSwitch("-classpath");
builder.AppendSwitch('"' + references.Join(";", (item) => item.GetMetadata("HintPath")) + '"');
}
#endregion
builder.AppendFileNamesIfNotNull(sources, " ");
var result = builder.ToString();
return result;
}
示例6: GenerateCommandLineCommands
/// <summary>
/// Returns a string value containing the command line arguments to pass directly to the executable file.
/// </summary>
/// <returns>
/// A string value containing the command line arguments to pass directly to the executable file.
/// </returns>
protected override string GenerateCommandLineCommands()
{
CommandLineBuilder builder = new CommandLineBuilder();
builder.AppendSwitch("/nologo");
if (DisableShadowCopy)
{
builder.AppendSwitch("/noshadow");
}
if (_testInNewThread.HasValue && !_testInNewThread.Value)
{
builder.AppendSwitch("/nothread");
}
builder.AppendFileNamesIfNotNull(_assemblies, " ");
builder.AppendSwitchIfNotNull("/config=", _projectConfiguration);
builder.AppendSwitchIfNotNull("/fixture=", _fixture);
builder.AppendSwitchIfNotNull("/include=", _includeCategory);
builder.AppendSwitchIfNotNull("/exclude=", _excludeCategory);
builder.AppendSwitchIfNotNull("/transform=", _xsltTransformFile);
builder.AppendSwitchIfNotNull("/xml=", _outputXmlFile);
builder.AppendSwitchIfNotNull("/err=", _errorOutputFile);
builder.AppendSwitchIfNotNull("/framework=",_framework);
return builder.ToString();
}
示例7: GenerateCommandLineCommands
protected override String GenerateCommandLineCommands()
{
UsageError = false;
CommandLineBuilder builder = new CommandLineBuilder(false);
if(Depend)
{
builder.AppendSwitch("--depend-xml");
builder.AppendSwitch("--depend-file");
builder.AppendFileNameIfNotNull(Path.Combine(OutputDir, DependFile));
}
if(!String.IsNullOrEmpty(OutputDir))
{
builder.AppendSwitch("--output-dir");
builder.AppendFileNameIfNotNull(OutputDir);
}
if(AllowIcePrefix)
{
builder.AppendSwitch("--ice");
}
if(Underscore)
{
builder.AppendSwitch("--underscore");
}
if(Stream)
{
builder.AppendSwitch("--stream");
}
if(Checksum)
{
builder.AppendSwitch("--checksum");
}
if (IncludeDirectories != null)
{
foreach (String path in IncludeDirectories)
{
builder.AppendSwitchIfNotNull("-I", path);
}
}
if(!String.IsNullOrEmpty(AdditionalOptions))
{
builder.AppendTextUnquoted(" ");
builder.AppendTextUnquoted(AdditionalOptions);
}
builder.AppendFileNamesIfNotNull(Sources, " ");
return builder.ToString();
}
示例8: GenerateCommandLineCommands
/// <summary>
/// Generate the command line from the properties.
/// </summary>
/// <returns>Command line string.</returns>
protected override string GenerateCommandLineCommands()
{
CommandLineBuilder commandLine = new CommandLineBuilder();
commandLine.AppendSwitchIfNotNull("-b ", this.baseInputPath);
commandLine.AppendSwitchIfNotNull("-cc ", this.cabinetCache);
CommandLineHelper.AppendExtensions(commandLine, this.extensions, this.Log);
commandLine.AppendSwitchIfNotNull("-i ", this.baseUncompressedImagesOutputPath);
CommandLineHelper.AppendArrayIfNotNull(commandLine, "-loc ", this.LocalizationFiles);
CommandLineHelper.AppendIfTrue(commandLine, "-nologo", this.noLogo);
CommandLineHelper.AppendIfTrue(commandLine, "-notidy", this.leaveTemporaryFiles);
CommandLineHelper.AppendIfTrue(commandLine, "-reusecab", this.reuseCabinetCache);
commandLine.AppendSwitchIfNotNull("-out ", outputFile.ItemSpec);
CommandLineHelper.AppendIfTrue(commandLine, "-xo", this.outputAsXml);
CommandLineHelper.AppendIfTrue(commandLine, "-sadmin", this.suppressDefaultAdminSequenceActions);
CommandLineHelper.AppendIfTrue(commandLine, "-sadv", this.suppressDefaultAdvSequenceActions);
CommandLineHelper.AppendIfTrue(commandLine, "-sa", this.suppressAssemblies);
CommandLineHelper.AppendIfTrue(commandLine, "-sf", this.suppressFiles);
CommandLineHelper.AppendIfTrue(commandLine, "-sl", this.suppressLayout);
CommandLineHelper.AppendIfTrue(commandLine, "-ss", this.suppressSchemaValidation);
CommandLineHelper.AppendIfTrue(commandLine, "-sui", this.suppressDefaultUISequenceActions);
CommandLineHelper.AppendIfTrue(commandLine, "-sv", this.suppressIntermediateFileVersionMatching);
CommandLineHelper.AppendIfTrue(commandLine, "-sw", this.suppressAllWarnings);
CommandLineHelper.AppendIfTrue(commandLine, "-ust", this.useSmallTableDefinitions);
CommandLineHelper.AppendIfTrue(commandLine, "-wx", this.treatWarningsAsErrors);
CommandLineHelper.AppendIfSpecified(commandLine, "-w", this.warningLevel);
CommandLineHelper.AppendIfTrue(commandLine, "-v", this.verboseOutput);
CommandLineHelper.AppendIfSpecified(commandLine, "-v", this.verboseOutputLevel);
commandLine.AppendFileNamesIfNotNull(this.objectFiles, " ");
return commandLine.ToString();
}
示例9: DoExecute
bool DoExecute()
{
var abis = SupportedAbis.Split (new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
var results = new List<ITaskItem> ();
string bundlepath = Path.Combine (TempOutputPath, "bundles");
if (!Directory.Exists (bundlepath))
Directory.CreateDirectory (bundlepath);
else
Directory.Delete (bundlepath, true);
foreach (var abi in abis) {
AndroidTargetArch arch = AndroidTargetArch.Other;
switch (abi) {
case "arm64":
case "arm64-v8a":
case "aarch64":
arch = AndroidTargetArch.Arm64;
break;
case "armeabi":
case "armeabi-v7a":
arch = AndroidTargetArch.Arm;
break;
case "x86":
arch = AndroidTargetArch.X86;
break;
case "x86_64":
arch = AndroidTargetArch.X86_64;
break;
case "mips":
arch = AndroidTargetArch.Mips;
break;
}
if (!NdkUtil.ValidateNdkPlatform (Log, AndroidNdkDirectory, arch, requireLibm:true)) {
return false;
}
// FIXME: it is kind of hacky, we should have something like NdkUtil.GetMinimumApiLevelFor(arch).
int level = NdkUtil.IsNdk64BitArch (arch) ? 21 : arch == AndroidTargetArch.Arm ? 4 : 9;
var outpath = Path.Combine (bundlepath, abi);
if (!Directory.Exists (outpath))
Directory.CreateDirectory (outpath);
var clb = new CommandLineBuilder ();
clb.AppendSwitch ("--dos2unix=false");
clb.AppendSwitch ("--nomain");
clb.AppendSwitch ("--style");
clb.AppendSwitch ("linux");
clb.AppendSwitch ("-c");
clb.AppendSwitch ("-o");
clb.AppendFileNameIfNotNull (Path.Combine (outpath, "temp.c"));
clb.AppendSwitch ("-oo");
clb.AppendFileNameIfNotNull (Path.Combine (outpath, "assemblies.o"));
if (AutoDeps)
clb.AppendSwitch ("--autodeps");
if (KeepTemp)
clb.AppendSwitch ("--keeptemp");
clb.AppendSwitch ("-z"); // Compress
clb.AppendFileNamesIfNotNull (Assemblies, " ");
var psi = new ProcessStartInfo () {
FileName = MkbundlePath,
Arguments = clb.ToString (),
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
};
var gccNoQuotes = NdkUtil.GetNdkTool (AndroidNdkDirectory, arch, "gcc");
var gcc = '"' + gccNoQuotes + '"';
var gas = '"' + NdkUtil.GetNdkTool (AndroidNdkDirectory, arch, "as") + '"';
psi.EnvironmentVariables ["CC"] = gcc;
psi.EnvironmentVariables ["AS"] = gas;
Log.LogDebugMessage ("CC=" + gcc);
Log.LogDebugMessage ("AS=" + gas);
//psi.EnvironmentVariables ["PKG_CONFIG_PATH"] = Path.Combine (Path.GetDirectoryName (MonoDroidSdk.MandroidTool), "lib", abi);
Log.LogDebugMessage ("[mkbundle] " + psi.FileName + " " + clb);
var proc = new Process ();
proc.OutputDataReceived += OnMkbundleOutputData;
proc.ErrorDataReceived += OnMkbundleErrorData;
proc.StartInfo = psi;
proc.Start ();
proc.BeginOutputReadLine ();
proc.BeginErrorReadLine ();
proc.WaitForExit ();
if (proc.ExitCode != 0) {
Log.LogCodedError ("XA5102", "Conversion from assembly to native code failed. Exit code {0}", proc.ExitCode);
return false;
}
// make some changes in the mkbundle output so that it does not require libmonodroid.so
var mkbundleOutput = File.ReadAllText (Path.Combine (outpath, "temp.c"));
mkbundleOutput = mkbundleOutput.Replace ("void mono_mkbundle_init ()", "void mono_mkbundle_init (void (register_bundled_assemblies_func)(const MonoBundledAssembly **), void (register_config_for_assembly_func)(const char *, const char *))")
.Replace ("mono_register_config_for_assembly (\"", "register_config_for_assembly_func (\"")
.Replace ("install_dll_config_files (void)", "install_dll_config_files (void (register_config_for_assembly_func)(const char *, const char *))")
.Replace ("install_dll_config_files ()", "install_dll_config_files (register_config_for_assembly_func)")
.Replace ("mono_register_bundled_assemblies(", "register_bundled_assemblies_func(");
File.WriteAllText (Path.Combine (outpath, "temp.c"), mkbundleOutput);
// then compile temp.c into temp.o and ...
clb = new CommandLineBuilder ();
clb.AppendSwitch ("-c");
//.........这里部分代码省略.........
示例10: GenerateCommandLineCommands
protected override string GenerateCommandLineCommands()
{
CommandLineBuilder builder = new CommandLineBuilder();
builder.AppendFileNameIfNotNull(this.Source);
builder.AppendFileNameIfNotNull(this.Destination);
builder.AppendFileNamesIfNotNull(this.Files, " ");
if (!string.IsNullOrEmpty(this.Options))
{
builder.AppendSwitch(this.Options);
}
return builder.ToString();
}
示例11: GenerateNUnitCommandLineCommands
private void GenerateNUnitCommandLineCommands(CommandLineBuilder builder)
{
builder.AppendSwitch(NUnitToolCommand);
builder.AppendSwitch("/nologo");
builder.AppendSwitch("/noshadow");
builder.AppendFileNamesIfNotNull(_assemblies, " ");
builder.AppendSwitchIfNotNull("/xml=", NUnitOutputXmlFile);
builder.AppendSwitchIfNotNull("/framework=", Framework);
builder.AppendSwitchIfNotNull("/include=", IncludeCategory);
builder.AppendSwitchIfNotNull("/exclude=", ExcludeCategory);
builder.AppendSwitchIfNotNull("/transform=", XsltTransformFile);
}
示例12: GenerateCommandLineCommands
/// <summary>
/// Returns a string value containing the command line arguments
/// to pass directly to the executable file.
/// </summary>
/// <returns>
/// A string value containing the command line arguments to pass
/// directly to the executable file.
/// </returns>
protected override string GenerateCommandLineCommands()
{
CommandLineBuilder commandLine = new CommandLineBuilder();
if (ShowCallStack)
{
commandLine.AppendSwitch("/ShowCallStack");
}
if (LogFile != null && LogFile.Trim().Length == 0)
{
commandLine.AppendSwitch("/LogFile=");
}
else
{
commandLine.AppendSwitchIfNotNull("/LogFile=", LogFile);
}
if (IsUninstall)
{
commandLine.AppendSwitch("/uninstall");
}
commandLine.AppendFileNamesIfNotNull(AssemblyFiles, " ");
if (AssemblyNames != null)
{
foreach (ITaskItem assemblyName in AssemblyNames)
{
commandLine.AppendSwitch("/AssemblyName");
commandLine.AppendFileNameIfNotNull(assemblyName);
}
}
return commandLine.ToString();
}
示例13: GenerateResponseFileCommands
/// <summary>
/// Generates the response file commands.
/// </summary>
protected override string GenerateResponseFileCommands() {
var args = new CommandLineBuilder();
args.AppendFileNamesIfNotNull(this.Files.Select(GetWorkingDirectoryRelativePath).ToArray(), Environment.NewLine);
return args.ToString();
}
示例14: GenerateCommandLineCommands
/// <summary>
/// Returns a string value containing the command line arguments to pass directly to the executable file.
/// </summary>
/// <returns>
/// A string value containing the command line arguments to pass directly to the executable file.
/// </returns>
protected override string GenerateCommandLineCommands()
{
CommandLineBuilder builder = new CommandLineBuilder();
builder.AppendSwitchIfNotNull("/out:", OutputFile);
builder.AppendSwitchIfNotNull("/config:", ConfigFile);
builder.AppendSwitchIfNotNull("/dep:", References, ",");
if (IncludeInternal)
builder.AppendSwitch("/internal+");
builder.AppendFileNamesIfNotNull(Assemblies, " ");
return builder.ToString();
}
示例15: AppendTwoStringsEnsureNoSpace
public void AppendTwoStringsEnsureNoSpace()
{
CommandLineBuilder c = new CommandLineBuilder();
c.AppendFileNamesIfNotNull(new string[] { "Form1.resx", @"built\Form1.resources" }, ",");
// There shouldn't be a space before or after the comma
// Tools like resgen require comma-delimited lists to be bumped up next to each other.
Assert.Equal(@"Form1.resx,built\Form1.resources", c.ToString());
}