public AppendFileNamesIfNotNull ( string fileNames, string delimiter ) : void | ||
fileNames | string | File names to append, if it's null this method has no effect |
delimiter | string | The delimiter between file names |
return | void |
protected override string GenerateCommandLineCommands() { CommandLineBuilder cb = new CommandLineBuilder(); //cb.AppendSwitch("-q"); cb.AppendSwitch("-nologo"); cb.AppendSwitch("--"); cb.AppendFileNamesIfNotNull(Sources, " "); return cb.ToString(); }
/// <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(); }
public void TestAppendFileNamesIfNotNull3 () { clb = new CommandLineBuilder (); clb.AppendFileNamesIfNotNull (items, null); }
public void TestAppendFileNamesIfNotNull1 () { clb = new CommandLineBuilder (); clb.AppendFileNamesIfNotNull (array, null); }
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; }
/// <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(); }
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(); }
/// <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(); }
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"); clb.AppendSwitch ("-o"); clb.AppendFileNameIfNotNull (Path.Combine (outpath, "temp.o")); if (!string.IsNullOrWhiteSpace (IncludePath)) { clb.AppendSwitch ("-I"); clb.AppendFileNameIfNotNull (IncludePath); } clb.AppendSwitch ("-I"); clb.AppendFileNameIfNotNull (NdkUtil.GetNdkPlatformIncludePath (AndroidNdkDirectory, arch, level)); clb.AppendFileNameIfNotNull (Path.Combine (outpath, "temp.c")); Log.LogDebugMessage ("[CC] " + gcc + " " + clb); if (MonoAndroidHelper.RunProcess (gccNoQuotes, clb.ToString (), OnCcOutputData, OnCcErrorData) != 0) { Log.LogCodedError ("XA5103", "NDK C compiler resulted in an error. Exit code {0}", proc.ExitCode); return false; } // ... link temp.o and assemblies.o into app.so clb = new CommandLineBuilder (); clb.AppendSwitch ("--shared"); clb.AppendFileNameIfNotNull (Path.Combine (outpath, "temp.o")); clb.AppendFileNameIfNotNull (Path.Combine (outpath, "assemblies.o")); clb.AppendSwitch ("-o"); clb.AppendFileNameIfNotNull (Path.Combine (outpath, "libmonodroid_bundle_app.so")); clb.AppendSwitch ("-L"); clb.AppendFileNameIfNotNull (NdkUtil.GetNdkPlatformLibPath (AndroidNdkDirectory, arch, level)); clb.AppendSwitch ("-lc"); clb.AppendSwitch ("-lm"); clb.AppendSwitch ("-ldl"); clb.AppendSwitch ("-llog"); clb.AppendSwitch ("-lz"); // Compress string ld = NdkUtil.GetNdkTool (AndroidNdkDirectory, arch, "ld"); Log.LogMessage (MessageImportance.Normal, "[LD] " + ld + " " + clb); if (MonoAndroidHelper.RunProcess (ld, clb.ToString (), OnLdOutputData, OnLdErrorData) != 0) { Log.LogCodedError ("XA5201", "NDK Linker resulted in an error. Exit code {0}", proc.ExitCode); return false; } results.Add (new TaskItem (Path.Combine (outpath, "libmonodroid_bundle_app.so"))); } OutputNativeLibraries = results.ToArray (); return true; }
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(); }
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); }
/// <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(); }
/// <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(); }
/// <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(); }
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()); }
protected override string GenerateCommandLineCommands() { CommandLineBuilder builder = new CommandLineBuilder(); if (this.AllowDuplicateResources) { builder.AppendSwitch(@"/allowDuplicateResources"); } if (this.AllowDuplicateTypes != null) { foreach (ITaskItem allowDuplicateType in this.AllowDuplicateTypes) { builder.AppendSwitch(@"/allowDup:" + allowDuplicateType.ItemSpec); } } if (this.AllowZeroPeKind) { builder.AppendSwitch(@"/zeroPeKind"); } if (this.AttributeFile != null) { builder.AppendSwitch(string.Format(CultureInfo.CurrentCulture, "/attr:\"{0}\"", this.AttributeFile.ItemSpec)); } if (this.Closed) { builder.AppendSwitch(@"/closed"); } if (this.CopyAttributes) { builder.AppendSwitch(@"/copyattrs"); } if (!this.DebugInfo) { builder.AppendSwitch(@"/ndebug"); } if (this.DelaySign) { builder.AppendSwitch(@"/delaysign"); } if (this.ExcludeFile != null) { builder.AppendSwitch(string.Format(CultureInfo.CurrentCulture, "/internalize:\"{0}\"", this.ExcludeFile.ItemSpec)); } else if (this.Internalize) { builder.AppendSwitch(@"/internalize"); } if (this.KeyFile != null) { builder.AppendSwitch(string.Format(CultureInfo.CurrentCulture, "/keyfile:\"{0}\"", this.KeyFile.ItemSpec)); } if (this.LogFile != null) { builder.AppendSwitch(string.Format(CultureInfo.CurrentCulture, "/log:\"{0}\"", this.LogFile.ItemSpec)); } if (this.PublicKeyTokens) { builder.AppendSwitch(@"/useFullPublicKeyForReferences"); } if (this.SearchDirectories != null) { foreach (ITaskItem searchDirectory in this.SearchDirectories) { builder.AppendSwitch(@"/lib:" + searchDirectory.ItemSpec); } } if (this.TargetPlatformVersion != null) { builder.AppendSwitch(@"/targetplatform:" + this.TargetPlatformVersion + @"," + this.TargetPlatformDirectory.ItemSpec); } if (this.TargetKind != null) { builder.AppendSwitch(@"/target:" + this.TargetKind); } if (this.UnionMerge) { builder.AppendSwitch(@"/union"); } if (this.Version != null) { builder.AppendSwitch(@"/ver:" + this.Version); } if (this.XmlDocs) { builder.AppendSwitch(@"/xmldocs"); } builder.AppendSwitch(@"/align:" + this.FileAlignment); builder.AppendSwitch(string.Format(CultureInfo.CurrentCulture, "/out:\"{0}\"", this.OutputFile.ItemSpec)); builder.AppendFileNamesIfNotNull(this.InputAssemblies, @" "); return builder.ToString(); }
protected override string GenerateCommandLineCommands() { CommandLineBuilder builder = new CommandLineBuilder(); builder.AppendSwitch("/nologo"); if (this.NoShadow) { builder.AppendSwitch("/noshadow"); } if (this.NoThread) { builder.AppendSwitch("/nothread"); } if (this.Labels) { builder.AppendSwitch("/labels"); } if (this.Timeout > 0) { builder.AppendSwitch("/timeout=" + this.TestTimeout); } builder.AppendFileNamesIfNotNull(this.Assemblies, " "); builder.AppendSwitchIfNotNull("/run=", this.Run); builder.AppendSwitchIfNotNull("/config=", this.Configuration); builder.AppendSwitchIfNotNull("/include=", this.IncludeCategory); builder.AppendSwitchIfNotNull("/exclude=", this.ExcludeCategory); builder.AppendSwitchIfNotNull("/process=", this.Process); builder.AppendSwitchIfNotNull("/domain=", this.Domain); builder.AppendSwitchIfNotNull("/framework=", this.Framework); builder.AppendSwitchIfNotNull("/xml=", this.OutputXmlFile); builder.AppendSwitchIfNotNull("/err=", this.ErrorOutputFile); builder.AppendSwitchIfNotNull("/out=", this.OutputFile); return builder.ToString(); }
/// <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(); char c = Environment.OSVersion.Platform == PlatformID.Unix ? '-' : '/'; builder.AppendSwitch(c+"nologo"); if (DisableShadowCopy) { builder.AppendSwitch(c+"noshadow"); } if (_testInNewThread.HasValue && !_testInNewThread.Value) { builder.AppendSwitch(c+"nothread"); } if (_showLabels) { builder.AppendSwitch("/labels"); } builder.AppendFileNamesIfNotNull(_assemblies, " "); builder.AppendSwitchIfNotNull(c+"config=", _projectConfiguration); builder.AppendSwitchIfNotNull(c+"fixture=", _fixture); builder.AppendSwitchIfNotNull(c+"include=", _includeCategory); builder.AppendSwitchIfNotNull(c+"exclude=", _excludeCategory); builder.AppendSwitchIfNotNull(c+"transform=", _xsltTransformFile); builder.AppendSwitchIfNotNull(c+"xml=", _outputXmlFile); builder.AppendSwitchIfNotNull(c+"err=", _errorOutputFile); builder.AppendSwitchIfNotNull(c+"framework=",_framework); return builder.ToString(); }
protected override string GenerateCommandLineCommands() { CommandLineBuilder builder = new CommandLineBuilder(); builder.AppendFileNamesIfNotNull(this.Assemblies, " "); if (this.Use32Bit) { builder.AppendSwitch("--x86"); } if (this.TeamCity) { builder.AppendSwitch("--teamcity"); } if (!this.NoShadow) { builder.AppendSwitch("--shadowcopy"); } if (this.DisposeRunners) { builder.AppendSwitch("--dispose-runners"); } if (this.WorkerThreads > 0) { builder.AppendSwitch("--workers=" + this.WorkerThreads); } if (this.TestTimeout > 0) { builder.AppendSwitch("--timeout=" + this.TestTimeout); } if (this.Agents > 0) { builder.AppendSwitch("--agents=" + this.Agents); } builder.AppendSwitchIfNotNull("--labels=", this.Labels); builder.AppendSwitchIfNotNull("--test=", this.Test); builder.AppendSwitchIfNotNull("--config=", this.Configuration); builder.AppendSwitchIfNotNull("--where=", this.Where); builder.AppendSwitchIfNotNull("--process=", this.Process); builder.AppendSwitchIfNotNull("--domain=", this.Domain); builder.AppendSwitchIfNotNull("--framework=", this.Framework); if (this.OutputXmlFile != null) { builder.AppendSwitch("--result=" + this.OutputXmlFile + ";format=nunit2"); } else { builder.AppendSwitch("--result=TestResult.xml;format=nunit2"); } builder.AppendSwitchIfNotNull("--err=", this.ErrorOutputFile); builder.AppendSwitchIfNotNull("--out=", this.OutputFile); return builder.ToString(); }
public void AppendSourcesArrayWithDashes() { CommandLineBuilder c = new CommandLineBuilder(); c.AppendFileNamesIfNotNull(new string[] { "-Mercury.cs", "-Venus.cs", "-Earth.cs" }, " "); // Managed compilers use this function to append sources files. Assert.AreEqual(@".\-Mercury.cs .\-Venus.cs .\-Earth.cs", c.ToString()); }
protected override string GenerateCommandLineCommands() { CommandLineBuilder commandLine = new CommandLineBuilder(); if (((OutputAssembly == null) && (Sources != null)) && ((Sources.Length > 0))) { OutputAssembly = new TaskItem(Path.GetFileNameWithoutExtension(this.Sources[0].ItemSpec)); if (string.Equals(this.TargetType, "library", StringComparison.OrdinalIgnoreCase)) { OutputAssembly.ItemSpec += ".dll"; } else if (string.Equals(this.TargetType, "module", StringComparison.OrdinalIgnoreCase)) { OutputAssembly.ItemSpec += ".netmodule"; } else { OutputAssembly.ItemSpec += ".exe"; } } commandLine.AppendSwitch("/NOLOGO"); // TODO: EmitDebugInformation / DebugType commandLine.AppendSwitch("/DEBUG"); if (optimize) { commandLine.AppendSwitch("/OPTIMIZE"); } commandLine.AppendSwitchIfNotNull("/KEY=@", this.KeyContainer); commandLine.AppendSwitchIfNotNull("/KEY=", this.KeyFile); if (Resources != null) { foreach (ITaskItem item in Resources) { commandLine.AppendSwitchIfNotNull("/RESOURCE=", item); } } if (FileAlignment > 0) { AppendIntegerSwitch(commandLine, "/ALIGNMENT=", FileAlignment); } commandLine.AppendSwitchIfNotNull("/OUTPUT=", this.OutputAssembly); if (string.Equals(this.TargetType, "library", StringComparison.OrdinalIgnoreCase)) { commandLine.AppendSwitch("/DLL"); } else if (string.Equals(this.TargetType, "module", StringComparison.OrdinalIgnoreCase)) { commandLine.AppendSwitch("/DLL"); } commandLine.AppendFileNamesIfNotNull(this.Sources, " "); return commandLine.ToString(); }
/// <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() { var builder = new CommandLineBuilder(); var c = Environment.OSVersion.Platform == PlatformID.Unix ? "-" : "--"; if (EnableShadowCopy) builder.AppendSwitch(c + "shadowcopy"); if (_testInNewThread.HasValue && !_testInNewThread.Value) builder.AppendSwitch(c + "nothread"); if (Force32Bit) builder.AppendSwitch(c + "x86"); if (NoHeader) builder.AppendSwitch(c + "noheader"); if (NoColor) builder.AppendSwitch(c + "nocolor"); if (Verbose) builder.AppendSwitch(c + "verbose"); if (ReportProgressToTeamCity) builder.AppendSwitch(c + "teamcity"); builder.AppendFileNamesIfNotNull(Assemblies, " "); builder.AppendSwitchIfNotNull(c + "config=", ProjectConfiguration); builder.AppendSwitchIfNotNull(c + "err=", ErrorOutputFile); builder.AppendSwitchIfNotNull(c + "out=", TextOutputFile); builder.AppendSwitchIfNotNull(c + "framework=", Framework); builder.AppendSwitchIfNotNull(c + "process=", Process); builder.AppendSwitchIfNotNull(c + "domain=", Domain); builder.AppendSwitchIfNotNull(c + "apartment=", Apartment); builder.AppendSwitchIfNotNull(c + "where=", Where); builder.AppendSwitchIfNotNull(c + "timeout=", TestTimeout); builder.AppendSwitchIfNotNull(c + "workers=", Workers); builder.AppendSwitchIfNotNull(c + "result=", OutputXmlFile); builder.AppendSwitchIfNotNull(c + "work=", WorkingDirectory); builder.AppendSwitchIfNotNull(c + "labels=", ShowLabels); builder.AppendSwitchIfNotNull(c + "trace=", InternalTrace); if(!string.IsNullOrWhiteSpace(AdditionalArguments)) builder.AppendTextUnquoted(" " + AdditionalArguments); return builder.ToString(); }
/// <summary> /// Generates the command. /// </summary> /// <param name="builder">The <see cref="CommandLineBuilder"/>.</param> protected virtual void GenerateCommand(CommandLineBuilder builder) { builder.AppendSwitch(Command); builder.AppendFileNamesIfNotNull(Files, " "); }
public void AppendSourcesArray() { CommandLineBuilder c = new CommandLineBuilder(); c.AppendFileNamesIfNotNull(new string[] { "Mercury.cs", "Venus.cs", "Earth.cs" }, " "); // Managed compilers use this function to append sources files. Assert.Equal(@"Mercury.cs Venus.cs Earth.cs", c.ToString()); }
/// <summary> /// Generates a string value containing the command line arguments /// to pass directly to the executable file. /// </summary> /// <returns> /// Returns a string value containing the command line arguments /// to pass directly to the executable file. /// </returns> protected override string GenerateCommandLineCommands() { var builder = new CommandLineBuilder(); builder.AppendSwitchIfNotNull("/allowDup:", AllowDuplicateTypes, " /allowDup:"); if (AllowZeroPeKind) builder.AppendSwitch("/zeroPeKind"); builder.AppendSwitchIfNotNull("/attr:", AttributeFile); if (Closed) builder.AppendSwitch("/closed"); if (CopyAttributes) builder.AppendSwitch("/copyattrs"); if (!DebugInfo) builder.AppendSwitch("/ndebug"); if (DelaySign) builder.AppendSwitch("/delaysign"); if (ExcludeFile != null) if (ExcludeFile.ItemSpec.Length == 0) builder.AppendSwitch("/internalize"); else builder.AppendSwitchIfNotNull("/internalize:", ExcludeFile); else if (Internalize) builder.AppendSwitch("/internalize"); builder.AppendSwitchIfNotNull("/keyfile:", KeyFile); if (LogFile != null) if (LogFile.ItemSpec.Length == 0) builder.AppendSwitchIfNotNull("/log:", LogFile); else builder.AppendSwitch("/log"); builder.AppendSwitchIfNotNull("/out:", OutputFile); if (PublicKeyTokens) builder.AppendSwitch("/publickeytokens"); if (TargetPlatformVersion != null) if (TargetPlatformDirectory == null) builder.AppendSwitch("/targetplatform:" + TargetPlatformVersion); else builder.AppendSwitchIfNotNull("/targetplatform:" + TargetPlatformVersion + ",", TargetPlatformDirectory); builder.AppendSwitchIfNotNull("/target:", TargetKind); builder.AppendSwitchIfNotNull("/ver:", Version); if (XmlDocumentation) builder.AppendSwitch("/xmldocs"); builder.AppendSwitchIfNotNull("/lib:", SearchDirectories, " /lib:"); builder.AppendFileNamesIfNotNull(InputAssemblies, " "); return builder.ToString(); }
public void AppendSourcesArrayWithDashesTaskItem() { CommandLineBuilder c = new CommandLineBuilder(); c.AppendFileNamesIfNotNull(new TaskItem[] { new TaskItem("-Mercury.cs"), null, new TaskItem("Venus.cs"), new TaskItem("-Earth.cs") }, " "); // Managed compilers use this function to append sources files. Assert.Equal(@".\-Mercury.cs Venus.cs .\-Earth.cs", c.ToString()); }
public void TestAppendFileNamesIfNotNull2 () { clb = new CommandLineBuilder (); clb.AppendFileNamesIfNotNull (array, String.Empty); Assert.AreEqual ("abc", clb.ToString (), "A1"); clb = new CommandLineBuilder (); clb.AppendFileNamesIfNotNull (array, "\t"); Assert.AreEqual ("a\tb\tc", clb.ToString (), "A2"); clb.AppendFileNamesIfNotNull ((string[]) null, "sep"); Assert.AreEqual ("a\tb\tc", clb.ToString (), "A3"); clb = new CommandLineBuilder (); clb.AppendFileNamesIfNotNull (new string [] { "a", "b c"}, " "); Assert.AreEqual ("a \"b c\"", clb.ToString (), "A4"); }
public void JoinAppendNull() { CommandLineBuilder c = new CommandLineBuilder(); c.AppendFileNamesIfNotNull((string[])null, " "); // Managed compilers use this function to append sources files. Assert.Equal(@"", c.ToString()); }
public void TestAppendFileNamesIfNotNull4 () { clb = new CommandLineBuilder (); clb.AppendFileNamesIfNotNull (items, String.Empty); Assert.AreEqual ("ab", clb.ToString (), "A1"); clb.AppendFileNamesIfNotNull ((ITaskItem[]) null, "sep"); Assert.AreEqual ("ab", clb.ToString (), "A2"); clb = new CommandLineBuilder (); clb.AppendFileNamesIfNotNull (new ITaskItem [] { new TaskItem ("a"), new TaskItem ("b c") }, " "); Assert.AreEqual ("a \"b c\"", clb.ToString (), "A3"); }
/// <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(PathSeparator + "nologo"); if (DisableShadowCopy) { builder.AppendSwitch(PathSeparator + "noshadow"); } if (HideDots) { builder.AppendSwitch(PathSeparator + "nodots"); } if (ShowLabels) { builder.AppendSwitch(PathSeparator + "labels"); } if (!TestInNewThread) { builder.AppendSwitch(PathSeparator + "nothread"); } builder.AppendFileNamesIfNotNull(Assemblies, " "); builder.AppendSwitchIfNotNull(PathSeparator + "config=", ProjectConfiguration); builder.AppendSwitchIfNotNull(PathSeparator + "run=", WhatToRun); builder.AppendSwitchIfNotNull(PathSeparator + "include=", IncludeCategory); builder.AppendSwitchIfNotNull(PathSeparator + "exclude=", ExcludeCategory); builder.AppendSwitchIfNotNull(PathSeparator + "transform=", XsltTransformFile); builder.AppendSwitchIfNotNull(PathSeparator + "xml=", OutputXmlFile); builder.AppendSwitchIfNotNull(PathSeparator + "err=", ErrorOutputFile); builder.AppendSwitchIfNotNull(PathSeparator + "framework=", FrameworkToUse); if (ProcessModelType != ProcessModelType.Default) { builder.AppendSwitchIfNotNull(PathSeparator + "process=", ProcessModelType.ToString()); } if (AppDomainUsageType != AppDomainUsageType.Default) { builder.AppendSwitchIfNotNull(PathSeparator + "domain=", AppDomainUsageType.ToString()); } if (TestCaseTimeoutInMilliseconds != 0) { builder.AppendSwitchIfNotNull(PathSeparator + "timeout=", TestCaseTimeoutInMilliseconds.ToString(CultureInfo.InvariantCulture)); } return builder.ToString(); }