Exemple #1
0
        public void ArgumentsAreUnquoted()
        {
            WinMDExp t = new WinMDExp
            {
                AssemblyUnificationPolicy = "sp ace",
                InputDocumentationFile    = "sp ace",
                InputPDBFile = "sp ace",
                References   = new ITaskItem[]
                {
                    new TaskItem(@"sp ace"),
                },
                OutputDocumentationFile   = "sp ace",
                OutputPDBFile             = "sp ace",
                OutputWindowsMetadataFile = "sp ace",
                WinMDModule = "sp ace",
            };

            CommandLineBuilderExtension c = new CommandLineBuilderExtension(quoteHyphensOnCommandLine: false, useNewLineSeparator: true);

            t.AddResponseFileCommands(c);

            string[] actual   = c.ToString().Split(MSBuildConstants.EnvironmentNewLine, StringSplitOptions.None);
            string[] expected =
            {
                "/d:sp ace",
                "/md:sp ace",
                "/mp:sp ace",
                "/pdb:sp ace",
                "/assemblyunificationpolicy:sp ace",
                "/out:sp ace",
                "/reference:sp ace",
                "sp ace",
            };

            Assert.Equal(expected, actual);
        }
Exemple #2
0
        public void ARFC(CommandLineBuilderExtension commandLine)
        {
            base.AddResponseFileCommands(commandLine);
#if !NET_4_0
            string s = commandLine.ToString();
            if (s.Length == 6)
            {
                Assert.AreEqual("/sdk:2", s);
            }
            else
            {
                Assert.AreEqual("/sdk:2 ", s.Substring(0, 7));
            }

            BindingFlags flags           = BindingFlags.Instance | BindingFlags.NonPublic;
            PropertyInfo pi              = typeof(CommandLineBuilderExtension).GetProperty("CommandLine", flags);
            System.Text.StringBuilder sb = (System.Text.StringBuilder)pi.GetValue(commandLine, null);
            sb.Length = 0;
            if (s.Length > 6)
            {
                sb.Append(s.Substring(7));
            }
#endif
        }
Exemple #3
0
        /// <summary>
        /// Checks if command line generated by task contains given string.
        /// This is used to verify that the stuff that should get quoted actually does.
        /// </summary>
        /// <param name="t">task to get the command line from</param>
        /// <param name="lookFor">string to look for in the command line</param>
        /// <param name="useResponseFile">if true, use the response file cmd line, else use regular cmd line</param>
        internal static void ValidateDoesNotContain(ToolTaskExtension t, string lookFor, bool useResponseFile)
        {
            CommandLineBuilderExtension b = new CommandLineBuilderExtension();

            if (useResponseFile)
            {
                t.AddResponseFileCommands(b);
            }
            else
            {
                t.AddCommandLineCommands(b);
            }

            string cl  = b.ToString();
            string msg = String.Format("Command-line = [{0}]\r\n", cl);

            msg += String.Format(" Searching for [{0}]\r\n", lookFor);
            if (cl.IndexOf(lookFor) != -1)
            {
                msg += "Found!\r\n";
                Console.WriteLine(msg);
                Assert.True(false, msg);
            }
        }
Exemple #4
0
        protected override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
            JarCommand command;
            string     flags = "";

            switch (Command.ToLowerInvariant())
            {
            case "create":
                command = JarCommand.Create;
                flags  += "c";
                break;

            case "update":
                command = JarCommand.Update;
                flags  += "u";
                break;

            case "extract":
                command = JarCommand.Extract;
                flags  += "x";
                break;

            case "index":
                command = JarCommand.Index;
                flags  += "i";
                break;

            case "list":
                command = JarCommand.List;
                flags  += "t";
                break;

            default:
                throw new InvalidOperationException();
            }

            if (command != JarCommand.Index && JarFile != null && JarFile.ItemSpec != null)
            {
                flags += 'f';
            }

            if (Verbose && command != JarCommand.Index)
            {
                flags += 'v';
            }

            if (command == JarCommand.Create || command == JarCommand.Update)
            {
                if (!Compress)
                {
                    flags += '0';
                }

                if (!CreateManifest)
                {
                    flags += 'M';
                }

                if (Manifest != null && Manifest.Length == 0 && Manifest[0].ItemSpec != null)
                {
                    flags += 'm';
                }
            }

            commandLine.AppendSwitch(flags);

            if (JarFile != null && JarFile.ItemSpec != null)
            {
                commandLine.AppendFileNameIfNotNull(JarFile);
            }

            if (command == JarCommand.Create || command == JarCommand.Update)
            {
                if (Manifest != null && Manifest.Length == 0 && Manifest[0].ItemSpec != null)
                {
                    commandLine.AppendFileNameIfNotNull(Manifest[0]);
                }
            }

            ILookup <string, ITaskItem> inputs = Inputs.ToLookup(i => i.GetMetadata("BaseOutputDirectory") ?? string.Empty);

            commandLine.AppendFileNamesIfNotNull(inputs[string.Empty].ToArray(), " ");
            foreach (var pair in inputs)
            {
                if (pair.Key == string.Empty)
                {
                    continue;
                }

                foreach (var file in pair)
                {
                    commandLine.AppendSwitchIfNotNull("-C ", pair.Key);
                    commandLine.AppendFileNameIfNotNull(file.ItemSpec.StartsWith(pair.Key) ? file.ItemSpec.Substring(pair.Key.Length) : file.ItemSpec);
                }

                //commandLine.AppendSwitchIfNotNull("-C ", pair.Key);
                //commandLine.AppendFileNamesIfNotNull(pair.Select(i => i.ItemSpec.StartsWith(pair.Key) ? i.ItemSpec.Substring(pair.Key.Length) : i.ItemSpec).ToArray(), " ");
            }

            if (!string.IsNullOrEmpty(EntryPoint))
            {
                commandLine.AppendSwitchIfNotNull("-e ", EntryPoint);
            }
        }
 protected virtual void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
 }
Exemple #6
0
 /// <summary>
 /// Adds JScript-specific command-line commands not handled by the base class.
 /// </summary>
 /// <param name="commandLine">The command line to popuplate.</param>
 protected void AddMoreCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
     AddMoreCommandLineCommands_TargetType(commandLine);
 }
Exemple #7
0
 internal static void CommandLine_AppendSwitchAliased(CommandLineBuilderExtension commandLine, string switchName, string alias, string parameter)
 {
     commandLine.AppendSwitchIfNotNull(switchName, alias + "=");
     commandLine.GetType().InvokeMember("AppendTextWithQuoting", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, commandLine, new object[] { parameter });
 }
Exemple #8
0
 public void ARFC(CommandLineBuilderExtension commandLine)
 {
     base.AddResponseFileCommands(commandLine);
 }
		protected internal virtual void AddResponseFileCommands (
						CommandLineBuilderExtension commandLine)
		{
		}
Exemple #10
0
		protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
		{
			if (Bag["SuppressStartupBanner"] != null)
				commandLine.AppendSwitch("/NoLogo");

			commandLine.AppendSwitch("/c");

			if (Bag["BuildObjectsFolder"] != null) {
				string objFile = Path.GetFileNameWithoutExtension(Sources[0].ItemSpec);
				string objPath = Path.Combine(BuildObjectsFolder, objFile);
				commandLine.AppendSwitch("/Fo" + objPath);
			}

			if (Bag["AdditionalIncludeDirectories"] != null) {
				foreach (string inc in AdditionalIncludeDirectories) {
					commandLine.AppendSwitch("/I " + inc);
				}
			}

			if (Bag["AdditionalOptions"] != null) {
				commandLine.AppendSwitch(AdditionalOptions);
			}

			if (Bag["CallingConvention"] != null) {
				if (CallingConvention == "Cdecl") commandLine.AppendSwitch("/Gd");
				if (CallingConvention == "FastCall") commandLine.AppendSwitch("/Gr");
				if (CallingConvention == "StdCall") commandLine.AppendSwitch("/Gz");
			}

			if (Bag["CompileAs"] != null) {
				//if (CompileAs == "Default") ;
				if (CompileAs == "CompileAsC") commandLine.AppendSwitch("/TC");
				if (CompileAs == "CompileAsCpp") commandLine.AppendSwitch("/TP");
			}

			if (Bag["DebugInformationFormat"] != null) {
				if (DebugInformationFormat == "OldStyle") commandLine.AppendSwitch("/Z7");
				if (DebugInformationFormat == "ProgramDatabase") commandLine.AppendSwitch("/Zi");
				if (DebugInformationFormat == "EditAndContinue") commandLine.AppendSwitch("/ZI");
			}

			if (Bag["DisableLanguageExtensions"] != null) {
				commandLine.AppendSwitch(DisableLanguageExtensions ? "/Za" : "/Ze");
			}

			if (Bag["DisableSpecificWarnings"] != null) {
				foreach (String warning in DisableSpecificWarnings) {
					commandLine.AppendSwitch("/Wd" + warning);
				}
			}

			if (Bag["ExceptionHandling"] != null) {
				if (ExceptionHandling == "Async") commandLine.AppendSwitch("/EHa");
				if (ExceptionHandling == "Sync") commandLine.AppendSwitch("/EHsc");
				if (ExceptionHandling == "SyncCThrow") commandLine.AppendSwitch("/EHs");
			}

			if (Bag["FavorSizeOrSpeed"] != null) {
				if (FavorSizeOrSpeed == "Size") commandLine.AppendSwitch("/Os");
				if (FavorSizeOrSpeed == "Speed") commandLine.AppendSwitch("/Ot");
			}

			if (Bag["FloatingPointModel"] != null) {
				if (FloatingPointModel == "Precise") commandLine.AppendSwitch("/fp:precise");
				if (FloatingPointModel == "Strict") commandLine.AppendSwitch("/fp:strict");
				if (FloatingPointModel == "Fast") commandLine.AppendSwitch("/fp:fast");
			}

			if (Bag["Optimization"] != null) {
				if (Optimization == "Disabled") commandLine.AppendSwitch("/Od");
				if (Optimization == "MinSpace") commandLine.AppendSwitch("/O1");
				if (Optimization == "MaxSpeed") commandLine.AppendSwitch("/O2");
				if (Optimization == "Full") commandLine.AppendSwitch("/Ox");
			}

			if (Bag["Sources"] != null) {
				foreach (ITaskItem source in Sources) {
					commandLine.AppendFileNameIfNotNull(source.ItemSpec);
				}
			}
		}
Exemple #11
0
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            if (Bag["SuppressStartupBanner"] != null)
            {
                commandLine.AppendSwitch("/nologo");
            }

            if (Bag["AdditionalDependencies"] != null)
            {
                foreach (String dep in AdditionalDependencies)
                {
                    commandLine.AppendSwitch(dep);
                }
            }

            if (Bag["AdditionalLibraryDirectories"] != null)
            {
                foreach (String add in AdditionalLibraryDirectories)
                {
                    commandLine.AppendSwitch("/LIBPATH:" + add);
                }
            }

            if (Bag["AdditionalManifestDependencies"] != null)
            {
                foreach (String add in AdditionalManifestDependencies)
                {
                    commandLine.AppendSwitch("/MANIFESTDEPENDENCY:" + add);
                }
            }

            if (Bag["AdditionalOptions"] != null)
            {
                commandLine.AppendSwitch(AdditionalOptions);
            }

            if (Bag["AddModuleNamesToAssembly"] != null)
            {
                foreach (String add in AddModuleNamesToAssembly)
                {
                    commandLine.AppendSwitch("/ASSEMBLYMODULE:" + add);
                }
            }

            if (Bag["AllowIsolation"] != null)
            {
                if (AllowIsolation)
                {
                    commandLine.AppendSwitch("/ALLOWISOLATION");
                }
            }

            if (Bag["AssemblyDebug"] != null)
            {
                if (AllowIsolation)
                {
                    commandLine.AppendSwitch("/ASSEMBLYDEBUG");
                }
            }

            if (Bag["AssemblyLinkResource"] != null)
            {
                foreach (String add in AssemblyLinkResource)
                {
                    commandLine.AppendSwitch("/ASSEMBLYLINKRESOURCE:" + add);
                }
            }

            if (Bag["BaseAddress"] != null)
            {
                commandLine.AppendSwitch("/BASE:" + BaseAddress);
            }

            if (Bag["DataExecutionPrevention"] != null)
            {
                if (DataExecutionPrevention)
                {
                    commandLine.AppendSwitch("/NXCOMPAT");
                }
            }

            if (Bag["DelayLoadDLLs"] != null)
            {
                foreach (String add in DelayLoadDLLs)
                {
                    commandLine.AppendSwitch("/DELAYSIGN:" + add);
                }
            }

            if (Bag["DelaySign"] != null)
            {
                if (DelaySign)
                {
                    commandLine.AppendSwitch("/DELAYSIGN");
                }
            }

            if (Bag["EmbedManagedResourceFile"] != null)
            {
                foreach (String add in EmbedManagedResourceFile)
                {
                    commandLine.AppendSwitch("/ASSEMBLYRESOURCE:" + add);
                }
            }

            if (Bag["EnableUAC"] != null)
            {
                if (EnableUAC)
                {
                    commandLine.AppendSwitch("/MANIFESTUAC");
                }
            }

            if (Bag["EntryPointSymbol"] != null)
            {
                commandLine.AppendSwitch("/ENTRY" + EntryPointSymbol);
            }

            if (Bag["FixedBaseAddress"] != null)
            {
                if (FixedBaseAddress)
                {
                    commandLine.AppendSwitch("/FIXED");
                }
            }

            if (Bag["ForceSymbolReferences"] != null)
            {
                foreach (String add in ForceSymbolReferences)
                {
                    commandLine.AppendSwitch("/INCLUDE:" + add);
                }
            }

            if (Bag["FunctionOrder"] != null)
            {
                commandLine.AppendSwitch("/ORDER" + EntryPointSymbol);
            }

            if (Bag["GenerateDebugInformation"] != null)
            {
                if (GenerateDebugInformation)
                {
                    commandLine.AppendSwitch("/DEBUG");
                }
            }

            if (Bag["GenerateManifest"] != null)
            {
                if (GenerateManifest)
                {
                    commandLine.AppendSwitch("/MANIFEST");
                }
            }

            if (Bag["GenerateMapFile"] != null)
            {
                if (GenerateMapFile)
                {
                    commandLine.AppendSwitch("/MAP");
                }
            }

            if ((Bag["HeapCommitSize"] != null) || (Bag["HeapReserveSize"] != null))
            {
                String heap = "";
                if (Bag["HeapReserveSize"] != null)
                {
                    heap += HeapReserveSize;
                }
                if (Bag["HeapCommitSize"] != null)
                {
                    heap += "," + HeapCommitSize;
                }
                commandLine.AppendSwitch("/HEAP" + heap);
            }

            if (Bag["IgnoreAllDefaultLibraries"] != null)
            {
                if (IgnoreAllDefaultLibraries)
                {
                    commandLine.AppendSwitch("/NODEFAULTLIB");
                }
            }

            if (Bag["IgnoreEmbeddedIDL"] != null)
            {
                if (IgnoreEmbeddedIDL)
                {
                    commandLine.AppendSwitch("/IGNOREIDL");
                }
            }

            if (Bag["IgnoreSpecificDefaultLibraries"] != null)
            {
                String libs  = "";
                bool   first = true;
                foreach (String add in IgnoreSpecificDefaultLibraries)
                {
                    if (!first)
                    {
                        libs += ";";
                    }
                    libs += add;
                    first = false;
                }
                commandLine.AppendSwitch("/NODEFAULTLIB:" + libs);
            }

            if (Bag["ImageHasSafeExceptionHandlers"] != null)
            {
                if (ImageHasSafeExceptionHandlers)
                {
                    commandLine.AppendSwitch("/SAFESEH");
                }
            }

            if (Bag["ImportLibrary"] != null)
            {
                commandLine.AppendSwitch("/IMPLIB" + ImportLibrary);
            }

            if (Bag["KeyContainer"] != null)
            {
                commandLine.AppendSwitch("/KEYCONTAINER" + KeyContainer);
            }

            if (Bag["KeyFile"] != null)
            {
                commandLine.AppendSwitch("/KEYFILE" + KeyFile);
            }

            if (Bag["LargeAddressAware"] != null)
            {
                if (LargeAddressAware)
                {
                    commandLine.AppendSwitch("/LARGEADDRESSAWARE");
                }
            }

            if (Bag["LinkDLL"] != null)
            {
                if (LinkDLL)
                {
                    commandLine.AppendSwitch("/DLL");
                }
            }

            if (Bag["LinkIncremental"] != null)
            {
                if (LinkIncremental)
                {
                    commandLine.AppendSwitch("/INCREMENTAL");
                }
            }

            if (Bag["LinkStatus"] != null)
            {
                if (LinkStatus)
                {
                    commandLine.AppendSwitch("/LTCG" + ":STATUS");
                }
            }

            if (Bag["ManifestFile"] != null)
            {
                commandLine.AppendSwitch("/MANIFESTFILE" + ManifestFile);
            }

            if (Bag["MapExports"] != null)
            {
                if (MapExports)
                {
                    commandLine.AppendSwitch("/MAPINFO");
                }
            }

            if (Bag["MapFileName"] != null)
            {
            }

            if (Bag["MergedIDLBaseFileName"] != null)
            {
                commandLine.AppendSwitch("/IDLOUT" + MergedIDLBaseFileName);
            }

            if (Bag["MergeSections"] != null)
            {
                commandLine.AppendSwitch("/MERGE" + MergeSections);
            }

            if (Bag["MinimumRequiredVersion"] != null)
            {
                throw new NotImplementedException();
                commandLine.AppendSwitch(MinimumRequiredVersion);
            }

            if (Bag["ModuleDefinitionFile"] != null)
            {
                commandLine.AppendSwitch("/DEF" + ModuleDefinitionFile);
            }

            if (Bag["MSDOSStubFileName"] != null)
            {
                commandLine.AppendSwitch("/STUB" + MSDOSStubFileName);
            }

            if (Bag["NoEntryPoint"] != null)
            {
                if (NoEntryPoint)
                {
                    commandLine.AppendSwitch("/NOENTRY");
                }
            }
        }
Exemple #12
0
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            if (Bag["SuppressStartupBanner"] != null)
            {
                commandLine.AppendSwitch("/NOLOGO");
            }

            if (Bag["AdditionalDependencies"] != null)
            {
                foreach (String dep in AdditionalDependencies)
                {
                    commandLine.AppendFileNameIfNotNull(dep);
                }
            }

            if (Bag["AdditionalLibraryDirectories"] != null)
            {
                foreach (String add in AdditionalLibraryDirectories)
                {
                    commandLine.AppendSwitch("/LIBPATH:" + add);
                }
            }

            if (Bag["AdditionalOptions"] != null)
            {
                commandLine.AppendSwitch(AdditionalOptions);
            }

            if (Bag["DisplayLibrary"] != null)
            {
                commandLine.AppendSwitch("/LIST" + DisplayLibrary);
            }

            if (Bag["ErrorReporting"] != null)
            {
                string err = "";
                if (ErrorReporting == "NoErrorReport")
                {
                    err = "NONE";
                }
                else if (ErrorReporting == "PromptImmediately")
                {
                    err = "PROMPT";
                }
                else if (ErrorReporting == "QueueForNextLogin")
                {
                    err = "QUEUE";
                }
                else if (ErrorReporting == "SendErrorReport")
                {
                    err = "SEND";
                }
                if (err.Length != 0)
                {
                    commandLine.AppendSwitch("/ERRORREPORT:" + err);
                }
            }

            if (Bag["ExportNamedFunctions"] != null)
            {
                foreach (string exp in ExportNamedFunctions)
                {
                    commandLine.AppendSwitch("/EXPORT:" + exp);
                }
            }

            if (Bag["ForceSymbolReferences"] != null)
            {
                commandLine.AppendSwitch("/INCLUDE" + ForceSymbolReferences);
            }

            if (Bag["IgnoreAllDefaultLibraries"] != null)
            {
                if (IgnoreAllDefaultLibraries)
                {
                    commandLine.AppendSwitch("/NODEFAULTLIB");
                }
            }

            if (Bag["IgnoreSpecificDefaultLibraries"] != null)
            {
                foreach (string lib in IgnoreSpecificDefaultLibraries)
                {
                    commandLine.AppendSwitch("/NODEFAULTLIB:" + lib);
                }
            }

            if (Bag["LinkLibraryDependencies"] != null)
            {
                if (LinkLibraryDependencies)
                {
                    throw new NotImplementedException();
                }
            }

            if (Bag["LinkTimeCodeGeneration"] != null)
            {
                if (LinkTimeCodeGeneration)
                {
                    commandLine.AppendSwitch("/LTCG");
                }
            }

            if (Bag["MinimumRequiredVersion"] != null)
            {
                throw new NotImplementedException();
            }

            if (Bag["ModuleDefinitionFile"] != null)
            {
                commandLine.AppendSwitch("/DEF:" + ModuleDefinitionFile);
            }

            if (Bag["Name"] != null)
            {
                commandLine.AppendSwitch("/NAME:" + Name);
            }

            if (Bag["OutputFile"] != null)
            {
                commandLine.AppendSwitch("/OUT:" + OutputFile);
            }

            if (Bag["RemoveObjects"] != null)
            {
                foreach (string obj in RemoveObjects)
                {
                    commandLine.AppendSwitch("/REMOVE:" + obj);
                }
            }

            if (Bag["Sources"] != null)
            {
                foreach (ITaskItem item in Sources)
                {
                    commandLine.AppendFileNameIfNotNull(item.ItemSpec);
                }
            }

            if (Bag["SubSystem"] != null)
            {
                string sys = "";
                if (SubSystem == "Console")
                {
                    sys = "CONSOLE";
                }
                else if (SubSystem == "Windows")
                {
                    sys = "WINDOWS";
                }
                else if (SubSystem == "Native")
                {
                    sys = "NATIVE";
                }
                else if (SubSystem == "EFI Application")
                {
                    sys = "EFI_APPLICATION";
                }
                else if (SubSystem == "EFI Boot Service Driver")
                {
                    sys = "EFI_BOOT_SERVICE_DRIVER";
                }
                else if (SubSystem == "EFI ROM")
                {
                    sys = "EFI_ROM";
                }
                else if (SubSystem == "EFI Runtime")
                {
                    sys = "EFI_RUNTIME_DRIVER";
                }
                else if (SubSystem == "WindowsCE")
                {
                    sys = "WINDOWSCE";
                }
                else if (SubSystem == "POSIX")
                {
                    sys = "POSIX";
                }
                else
                {
                    Log.LogWarning("SubSystem is unknown");
                    sys = SubSystem;
                }

                if (sys.Length != 0)
                {
                    commandLine.AppendSwitch("/SUBSYSTEM:" + sys);
                }
            }

            if (Bag["TargetMachine"] != null)
            {
                string machine = "";
                if (TargetMachine == "MachineARM")
                {
                    machine = "ARM";
                }
                else if (TargetMachine == "MachineEBC")
                {
                    machine = "EBC";
                }
                else if (TargetMachine == "MachineIA64")
                {
                    machine = "IA64";
                }
                else if (TargetMachine == "MachineMIPS")
                {
                    machine = "MIPS";
                }
                else if (TargetMachine == "MachineMIPS16")
                {
                    machine = "MIPS16";
                }
                else if (TargetMachine == "MachineMIPSFPU")
                {
                    machine = "MIPSFPU";
                }
                else if (TargetMachine == "MachineMIPSFPU16")
                {
                    machine = "MIPSFPU16";
                }
                else if (TargetMachine == "MachineSH4")
                {
                    machine = "SH4";
                }
                else if (TargetMachine == "MachineTHUMB")
                {
                    machine = "THUMB";
                }
                else if (TargetMachine == "MachineX64")
                {
                    machine = "X64";
                }
                else if (TargetMachine == "MachineX86")
                {
                    machine = "X86";
                }
                else
                {
                    Log.LogWarning("TargetMachine is unknown");
                    machine = TargetMachine;
                }

                if (machine.Length != 0)
                {
                    commandLine.AppendSwitch("/MACHINE:" + machine);
                }
            }

            if (Bag["TrackerLogDirectory"] != null)
            {
                throw new NotImplementedException();
            }

            if (Bag["TreatLibWarningAsErrors"] != null)
            {
                if (TreatLibWarningAsErrors)
                {
                    commandLine.AppendSwitch("/WX");
                }
            }

            if (Bag["UseUnicodeResponseFiles"] != null)
            {
                if (UseUnicodeResponseFiles)
                {
                    throw new NotImplementedException();
                }
            }

            if (Bag["Verbose"] != null)
            {
                if (Verbose)
                {
                    commandLine.AppendSwitch("/VERBOSE");
                }
            }
        }
Exemple #13
0
		protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
		{
			if (Bag["SuppressStartupBanner"] != null)
				commandLine.AppendSwitch("/NOLOGO");

			if (Bag["AdditionalDependencies"] != null)
			{
				foreach (String dep in AdditionalDependencies)
				{
					commandLine.AppendFileNameIfNotNull(dep);
				}
			}

			if (Bag["AdditionalLibraryDirectories"] != null)
			{
				foreach (String add in AdditionalLibraryDirectories)
				{
					commandLine.AppendSwitch("/LIBPATH:" + add);
				}
			}

			if (Bag["AdditionalOptions"] != null)
			{
				commandLine.AppendSwitch(AdditionalOptions);
			}

			if (Bag["DisplayLibrary"] != null)
			{
				commandLine.AppendSwitch("/LIST" + DisplayLibrary);
			}

			if (Bag["ErrorReporting"] != null)
			{
				string err = "";
				if (ErrorReporting == "NoErrorReport") err = "NONE";
				else if (ErrorReporting == "PromptImmediately") err = "PROMPT";
				else if (ErrorReporting == "QueueForNextLogin") err = "QUEUE";
				else if (ErrorReporting == "SendErrorReport") err = "SEND";
				if(err.Length != 0)
					commandLine.AppendSwitch("/ERRORREPORT:" + err);
			}

			if (Bag["ExportNamedFunctions"] != null)
			{
				foreach (string exp in ExportNamedFunctions)
					commandLine.AppendSwitch("/EXPORT:" + exp);
			}

			if (Bag["ForceSymbolReferences"] != null)
			{
				commandLine.AppendSwitch("/INCLUDE" + ForceSymbolReferences);
			}

			if (Bag["IgnoreAllDefaultLibraries"] != null)
			{
				if(IgnoreAllDefaultLibraries)
					commandLine.AppendSwitch("/NODEFAULTLIB");
			}

			if (Bag["IgnoreSpecificDefaultLibraries"] != null)
			{
				foreach (string lib in IgnoreSpecificDefaultLibraries)
					commandLine.AppendSwitch("/NODEFAULTLIB:" + lib);
			}

			if (Bag["LinkLibraryDependencies"] != null)
			{
				if(LinkLibraryDependencies)
					throw new NotImplementedException();
			}

			if (Bag["LinkTimeCodeGeneration"] != null)
			{
				if (LinkTimeCodeGeneration)
					commandLine.AppendSwitch("/LTCG");
			}

			if (Bag["MinimumRequiredVersion"] != null)
			{
				throw new NotImplementedException();
			}

			if (Bag["ModuleDefinitionFile"] != null)
			{
				commandLine.AppendSwitch("/DEF:" + ModuleDefinitionFile);
			}

			if (Bag["Name"] != null)
			{
				commandLine.AppendSwitch("/NAME:" + Name);
			}

			if (Bag["OutputFile"] != null)
			{
				commandLine.AppendSwitch("/OUT:" + OutputFile);
			}

			if (Bag["RemoveObjects"] != null)
			{
				foreach (string obj in RemoveObjects)
					commandLine.AppendSwitch("/REMOVE:" + obj);
			}

			if (Bag["Sources"] != null)
			{
				foreach (ITaskItem item in Sources)
					commandLine.AppendFileNameIfNotNull(item.ItemSpec);
			}

			if (Bag["SubSystem"] != null)
			{
				string sys = "";
				if (SubSystem == "Console") sys = "CONSOLE";
				else if (SubSystem == "Windows") sys = "WINDOWS";
				else if (SubSystem == "Native") sys = "NATIVE";
				else if (SubSystem == "EFI Application") sys = "EFI_APPLICATION";
				else if (SubSystem == "EFI Boot Service Driver") sys = "EFI_BOOT_SERVICE_DRIVER";
				else if (SubSystem == "EFI ROM") sys = "EFI_ROM";
				else if (SubSystem == "EFI Runtime") sys = "EFI_RUNTIME_DRIVER";
				else if (SubSystem == "WindowsCE") sys = "WINDOWSCE";
				else if (SubSystem == "POSIX") sys = "POSIX";
				else {
					Log.LogWarning("SubSystem is unknown");
					sys = SubSystem;
				}

				if (sys.Length != 0)
					commandLine.AppendSwitch("/SUBSYSTEM:" + sys);
			}

			if (Bag["TargetMachine"] != null)
			{
				string machine = "";
				if (TargetMachine == "MachineARM") machine = "ARM";
				else if (TargetMachine == "MachineEBC") machine = "EBC";
				else if (TargetMachine == "MachineIA64") machine = "IA64";
				else if (TargetMachine == "MachineMIPS") machine = "MIPS";
				else if (TargetMachine == "MachineMIPS16") machine = "MIPS16";
				else if (TargetMachine == "MachineMIPSFPU") machine = "MIPSFPU";
				else if (TargetMachine == "MachineMIPSFPU16") machine = "MIPSFPU16";
				else if (TargetMachine == "MachineSH4") machine = "SH4";
				else if (TargetMachine == "MachineTHUMB") machine = "THUMB";
				else if (TargetMachine == "MachineX64") machine = "X64";
				else if (TargetMachine == "MachineX86") machine = "X86";
				else
				{
					Log.LogWarning("TargetMachine is unknown");
					machine = TargetMachine;
				}

				if (machine.Length != 0)
					commandLine.AppendSwitch("/MACHINE:" + machine);
			}

			if (Bag["TrackerLogDirectory"] != null)
			{
				throw new NotImplementedException();
			}

			if (Bag["TreatLibWarningAsErrors"] != null)
			{
				if (TreatLibWarningAsErrors)
					commandLine.AppendSwitch("/WX");
			}

			if (Bag["UseUnicodeResponseFiles"] != null)
			{
				if (UseUnicodeResponseFiles)
					throw new NotImplementedException();
			}

			if (Bag["Verbose"] != null)
			{
				if (Verbose)
					commandLine.AppendSwitch("/VERBOSE");
			}
		}
Exemple #14
0
 ///<summary>
 ///Fills the specified <see cref="T:Microsoft.Build.Tasks.CommandLineBuilderExtension"></see> with the switches and other information that can go into a response file.
 ///</summary>
 ///
 ///<param name="commandLine">The <see cref="T:Microsoft.Build.Tasks.CommandLineBuilderExtension"></see> to fill with switches and other information.</param>
 protected override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
 {
     return;             // Nothing goes to the response file, Ilasm won't support one
 }
 protected internal virtual void AddResponseFileCommands(
     CommandLineBuilderExtension commandLine)
 {
 }
Exemple #16
0
        protected void AddResponseFileCommandsImpl(CommandLineBuilderExtension commandLine)
        {
            if (OutputAssembly == null && Sources != null && Sources.Length > 0 && ResponseFiles == null)
            {
                try
                {
                    OutputAssembly = new TaskItem(Path.GetFileNameWithoutExtension(Sources[0].ItemSpec));
                }
                catch (ArgumentException exception)
                {
                    throw new ArgumentException(exception.Message, "Sources", exception);
                }

                var outputAssembly = OutputAssembly;
                switch (TargetType.ToLowerInvariant())
                {
                case "library":
                    outputAssembly.ItemSpec = outputAssembly.ItemSpec + ".dll";
                    break;

                case "module":
                    outputAssembly.ItemSpec = outputAssembly.ItemSpec + ".netmodule";
                    break;

                default:
                    outputAssembly.ItemSpec = outputAssembly.ItemSpec + ".exe";
                    break;
                }
            }

            // Don't call base.AddResponseFileCommands()!
            //base.AddResponseFileCommands(commandLine);

            //System.Diagnostics.Debug.Assert(false);
            if (RunDebugger)
            {
                commandLine.AppendSwitch("\n/debugger");
            }
            if (Optimize)
            {
                commandLine.AppendSwitch("\n/optimize");
            }
            commandLine.AppendPlusOrMinusSwitch("\n/checked", base.Bag, "CheckIntegerOverflow");

            commandLine.AppendSwitch("\n/no-color");
            commandLine.AppendSwitchIfNotNull("\n/lib:", base.AdditionalLibPaths, ",");
            commandLine.AppendSwitchIfNotNull("\n/nowarn:", this.DisabledWarnings, ",");
            commandLine.AppendSwitchIfNotNull("\n/dowarn:", this.EnabledWarnings, ",");
            if (NoStdLib)
            {
                commandLine.AppendSwitch("\n/no-stdlib");
            }
            if (NoStdMacros)
            {
                commandLine.AppendSwitch("\n/no-stdmacros");
            }
            if (!GreedyReferences)
            {
                commandLine.AppendSwitch("\n/greedy-references:-");
            }
            if (WarningLevel != 4)
            {
                commandLine.AppendSwitchIfNotNull("\n/warn:", this.WarningLevel.ToString());
            }
            if (IndentationSyntax)
            {
                commandLine.AppendSwitch("\n/indentation-syntax");
            }
            commandLine.AppendSwitchIfNotNull("\n/doc:", this.DocumentationFile);
            if (!string.IsNullOrEmpty(base.DefineConstants))
            {
                var defines = base.DefineConstants
                              .Split(new char[] { ';', ' ', '\r', '\n', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                commandLine.AppendSwitchUnquotedIfNotNull("\n/define:", String.Join(";", defines));
            }
            commandLine.AppendSwitchIfNotNull("\n/win32res:", base.Win32Resource);
            commandLine.AppendSwitchIfNotNull("\n/platform:", this.Platform);

            // Switchs from base.AddResponseFileCommands()
            commandLine.AppendSwitchIfNotNull("\n/addmodule:", this.AddModules, ",");
            commandLine.AppendPlusOrMinusSwitch("\n/delaysign", base.Bag, "DelaySign");
            commandLine.AppendSwitchIfNotNull("\n/keycontainer:", this.KeyContainer);
            commandLine.AppendSwitchIfNotNull("\n/keyfile:", this.KeyFile);
            commandLine.AppendSwitchIfNotNull("\n/linkresource:", this.LinkResources, new[] { "LogicalName", "Access" });
            if (NoLogo)
            {
                commandLine.AppendSwitch("\n/nologo");
            }
            commandLine.AppendSwitchIfNotNull("\n/resource:", this.Resources, new[] { "LogicalName", "Access" });
            commandLine.AppendSwitchIfNotNull("\n/target:", this.TargetType);
            commandLine.AppendPlusOrMinusSwitch("\n/warnaserror", base.Bag, "TreatWarningsAsErrors");
            commandLine.AppendSwitchIfNotNull("\n/win32icon:", this.Win32Icon);
            commandLine.AppendPlusOrMinusSwitch("\n/debug", base.Bag, "EmitDebugInformation");
            commandLine.AppendSwitchIfNotNull("\n/project-path:", this.ProjectPath);
            commandLine.AppendSwitchIfNotNull("\n/root-namespace:", this.RootNamespace);
            commandLine.AppendSwitchIfNotNull("\n/main:", this.MainEntryPoint);
            if (CompilerStackSize > 0)
            {
                commandLine.AppendSwitchIfNotNull("\n/stack-size:", this.CompilerStackSize.ToString());
            }

            // Not supported options:
            //commandLine.AppendSwitchWithInteger("\n/codepage:", base.Bag, "CodePage");
            //commandLine.AppendSwitchIfNotNull("/debug:", this.DebugType);
            //commandLine.AppendSwitchWithInteger("\n/filealign:", base.Bag, "FileAlignment");
            //commandLine.AppendWhenTrue("\n/utf8output", base.Bag, "Utf8Output");

            // Add sources
            if (this.Sources != null)
            {
                commandLine.Append("\n\n");
                commandLine.AppendFileNamesIfNotNull(this.Sources, "\n");
                commandLine.Append("\n");
            }

            if (null != base.ResponseFiles)
            {
                foreach (var it in base.ResponseFiles)
                {
                    commandLine.AppendSwitchIfNotNull("\n/fromfile:", it.ItemSpec);
                }
            }

            if (null != base.References)
            {
                foreach (var it in base.References)
                {
                    commandLine.AppendSwitchIfNotNull("\n/ref:", it.ItemSpec);
                }
            }

            if (null != this.MacroReferences)
            {
                foreach (var it in this.MacroReferences)
                {
                    commandLine.AppendSwitchIfNotNull("\n/macros:", it.ItemSpec);
                }
            }

            if (!string.IsNullOrEmpty(CustomArguments))
            {
                commandLine.AppendSwitch(CustomArguments);
            }

            commandLine.AppendSwitchIfNotNull("\n\n/out:", OutputAssembly);
        }
 protected override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
 }
		protected override string GenerateResponseFileCommands ()
		{
			CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
			AddResponseFileCommands (clbe);
			return clbe.ToString ();
		}
        protected override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
            // the -verbose flag must be included or there's no way to figure out what the output files are
            commandLine.AppendSwitch("-verbose");

            if (!string.IsNullOrEmpty(Encoding))
            {
                commandLine.AppendSwitchIfNotNull("-encoding ", Encoding);
            }

            switch (DebugSymbols)
            {
            case "All":
                commandLine.AppendSwitch("-g"); break;

            case "None":
                commandLine.AppendSwitch("-g:none"); break;

            case "Specific":
                if (!string.IsNullOrEmpty(SpecificDebugSymbols))
                {
                    commandLine.AppendSwitchIfNotNull("-g:", SpecificDebugSymbols);
                }
                else
                {
                    commandLine.AppendSwitch("-g:none");
                }

                break;

            case "Default":
            default:
                break;
            }

            if (!string.IsNullOrEmpty(SourceRelease) && !string.Equals(SourceRelease, "Default", StringComparison.OrdinalIgnoreCase))
            {
                commandLine.AppendSwitchIfNotNull("-source ", SourceRelease);
            }
            if (!string.IsNullOrEmpty(TargetRelease) && !string.Equals(TargetRelease, "Default", StringComparison.OrdinalIgnoreCase))
            {
                commandLine.AppendSwitchIfNotNull("-target ", TargetRelease);
            }

            if (!string.IsNullOrEmpty(OutputPath))
            {
                commandLine.AppendSwitchIfNotNull("-d ", OutputPath);
            }

            if (!ShowWarnings)
            {
                commandLine.AppendSwitch("-nowarn");
            }
            else if (ShowAllWarnings)
            {
                commandLine.AppendSwitch("-Xlint");
                commandLine.AppendSwitch("-deprecation");
            }

            if (!string.IsNullOrEmpty(BuildArgs))
            {
                commandLine.AppendTextUnquoted(" " + BuildArgs);
            }

            // reference paths
            List <string> referencePaths = new List <string>();

            foreach (var reference in (References ?? Enumerable.Empty <ITaskItem>()))
            {
                string path = GetReferencePath(reference);
                if (!string.IsNullOrEmpty(path))
                {
                    referencePaths.Add(path);
                }
            }

            if (referencePaths.Count > 0)
            {
                commandLine.AppendSwitchIfNotNull("-cp ", referencePaths.ToArray(), ";");
            }

            commandLine.AppendSwitchIfNotNull("-classpath ", ClassPath, ";");

            commandLine.AppendFileNamesIfNotNull(Sources, " ");
        }
Exemple #20
0
 public void ACLC(CommandLineBuilderExtension commandLine)
 {
     base.AddCommandLineCommands(commandLine);
 }
Exemple #21
0
		protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
		{
			if (Bag["SuppressStartupBanner"] != null)
				commandLine.AppendSwitch("/nologo");

			if (Bag["AdditionalDependencies"] != null)
			{
				foreach (String dep in AdditionalDependencies)
				{
					commandLine.AppendSwitch(dep);
				}
			}

			if (Bag["AdditionalLibraryDirectories"] != null)
			{
				foreach (String add in AdditionalLibraryDirectories)
				{
					commandLine.AppendSwitch("/LIBPATH:" + add);
				}
			}

			if (Bag["AdditionalManifestDependencies"] != null)
			{
				foreach (String add in AdditionalManifestDependencies)
				{
					commandLine.AppendSwitch("/MANIFESTDEPENDENCY:" + add);
				}
			}

			if (Bag["AdditionalOptions"] != null)
			{
				commandLine.AppendSwitch(AdditionalOptions);
			}

			if (Bag["AddModuleNamesToAssembly"] != null)
			{
				foreach (String add in AddModuleNamesToAssembly)
				{
					commandLine.AppendSwitch("/ASSEMBLYMODULE:" + add);
				}
			}

			if (Bag["AllowIsolation"] != null)
			{
				if (AllowIsolation)
					commandLine.AppendSwitch("/ALLOWISOLATION");
			}

			if (Bag["AssemblyDebug"] != null)
			{
				if (AllowIsolation)
					commandLine.AppendSwitch("/ASSEMBLYDEBUG");
			}

			if (Bag["AssemblyLinkResource"] != null)
			{
				foreach (String add in AssemblyLinkResource)
				{
					commandLine.AppendSwitch("/ASSEMBLYLINKRESOURCE:" + add);
				}
			}

			if (Bag["BaseAddress"] != null)
			{
				commandLine.AppendSwitch("/BASE:" + BaseAddress);
			}

			if (Bag["DataExecutionPrevention"] != null)
			{
				if (DataExecutionPrevention)
					commandLine.AppendSwitch("/NXCOMPAT");
			}

			if (Bag["DelayLoadDLLs"] != null)
			{
				foreach (String add in DelayLoadDLLs)
				{
					commandLine.AppendSwitch("/DELAYSIGN:" + add);
				}
			}

			if (Bag["DelaySign"] != null)
			{
				if (DelaySign)
					commandLine.AppendSwitch("/DELAYSIGN");
			}

			if (Bag["EmbedManagedResourceFile"] != null)
			{
				foreach (String add in EmbedManagedResourceFile)
				{
					commandLine.AppendSwitch("/ASSEMBLYRESOURCE:" + add);
				}
			}

			if (Bag["EnableUAC"] != null)
			{
				if (EnableUAC)
					commandLine.AppendSwitch("/MANIFESTUAC");
			}

			if (Bag["EntryPointSymbol"] != null)
			{
				commandLine.AppendSwitch("/ENTRY" + EntryPointSymbol);
			}

			if (Bag["FixedBaseAddress"] != null)
			{
				if (FixedBaseAddress)
					commandLine.AppendSwitch("/FIXED");
			}

			if (Bag["ForceSymbolReferences"] != null)
			{
				foreach (String add in ForceSymbolReferences)
				{
					commandLine.AppendSwitch("/INCLUDE:" + add);
				}
			}

			if (Bag["FunctionOrder"] != null)
			{
				commandLine.AppendSwitch("/ORDER" + EntryPointSymbol);
			}

			if (Bag["GenerateDebugInformation"] != null)
			{
				if (GenerateDebugInformation)
					commandLine.AppendSwitch("/DEBUG");
			}

			if (Bag["GenerateManifest"] != null)
			{
				if (GenerateManifest)
					commandLine.AppendSwitch("/MANIFEST");
			}

			if (Bag["GenerateMapFile"] != null)
			{
				if (GenerateMapFile)
					commandLine.AppendSwitch("/MAP");
			}

			if ((Bag["HeapCommitSize"] != null) || (Bag["HeapReserveSize"] != null))
			{
				String heap = "";
				if (Bag["HeapReserveSize"] != null) heap += HeapReserveSize;
				if (Bag["HeapCommitSize"] != null) heap += "," + HeapCommitSize;
				commandLine.AppendSwitch("/HEAP" + heap);
			}

			if (Bag["IgnoreAllDefaultLibraries"] != null)
			{
				if (IgnoreAllDefaultLibraries)
					commandLine.AppendSwitch("/NODEFAULTLIB");
			}

			if (Bag["IgnoreEmbeddedIDL"] != null)
			{
				if (IgnoreEmbeddedIDL)
					commandLine.AppendSwitch("/IGNOREIDL");
			}

			if (Bag["IgnoreSpecificDefaultLibraries"] != null)
			{
				String libs = "";
				bool first = true;
				foreach (String add in IgnoreSpecificDefaultLibraries)
				{
					if (!first) libs += ";";
					libs += add;
					first = false;
				}
				commandLine.AppendSwitch("/NODEFAULTLIB:" + libs);
			}

			if (Bag["ImageHasSafeExceptionHandlers"] != null)
			{
				if (ImageHasSafeExceptionHandlers)
					commandLine.AppendSwitch("/SAFESEH");
			}

			if (Bag["ImportLibrary"] != null)
			{
				commandLine.AppendSwitch("/IMPLIB" + ImportLibrary);
			}

			if (Bag["KeyContainer"] != null)
			{
				commandLine.AppendSwitch("/KEYCONTAINER" + KeyContainer);
			}

			if (Bag["KeyFile"] != null)
			{
				commandLine.AppendSwitch("/KEYFILE" + KeyFile);
			}

			if (Bag["LargeAddressAware"] != null)
			{
				if (LargeAddressAware)
					commandLine.AppendSwitch("/LARGEADDRESSAWARE");
			}

			if (Bag["LinkDLL"] != null)
			{
				if (LinkDLL)
					commandLine.AppendSwitch("/DLL");
			}

			if (Bag["LinkIncremental"] != null)
			{
				if (LinkIncremental)
					commandLine.AppendSwitch("/INCREMENTAL");
			}

			if (Bag["LinkStatus"] != null)
			{
				if (LinkStatus)
					commandLine.AppendSwitch("/LTCG" + ":STATUS");
			}

			if (Bag["ManifestFile"] != null)
			{
				commandLine.AppendSwitch("/MANIFESTFILE" + ManifestFile);
			}

			if (Bag["MapExports"] != null)
			{
				if (MapExports)
					commandLine.AppendSwitch("/MAPINFO");
			}

			if (Bag["MapFileName"] != null)
			{
			}

			if (Bag["MergedIDLBaseFileName"] != null)
			{
				commandLine.AppendSwitch("/IDLOUT" + MergedIDLBaseFileName);
			}

			if (Bag["MergeSections"] != null)
			{
				commandLine.AppendSwitch("/MERGE" + MergeSections);
			}

			if (Bag["MinimumRequiredVersion"] != null)
			{
				throw new NotImplementedException();
				commandLine.AppendSwitch(MinimumRequiredVersion);
			}

			if (Bag["ModuleDefinitionFile"] != null)
			{
				commandLine.AppendSwitch("/DEF" + ModuleDefinitionFile);
			}

			if (Bag["MSDOSStubFileName"] != null)
			{
				commandLine.AppendSwitch("/STUB" + MSDOSStubFileName);
			}

			if (Bag["NoEntryPoint"] != null)
			{
				if (NoEntryPoint)
					commandLine.AppendSwitch("/NOENTRY");
			}
		}
Exemple #22
0
 private static void CommandLine_AppendSwitchWithInteger(string sSwitchName, Hashtable bag, string sBagPropertyName, CommandLineBuilderExtension commandLine)
 {
     commandLine.GetType().InvokeMember("AppendSwitchWithInteger", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, commandLine, new object[] { sSwitchName, bag, sBagPropertyName });
 }
            protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
            {
                _addResponseFileCommands?.Invoke(commandLine);

                base.AddResponseFileCommands(commandLine);
            }
Exemple #24
0
 /// <summary>
 /// The target type command line commands.
 /// </summary>
 /// <param name="commandLine">The command line to popuplate.</param>
 protected void AddMoreCommandLineCommands_TargetType(CommandLineBuilderExtension commandLine)
 {
     CommandLineAppendWhenTrue(commandLine, "/DLL", "Dll");
     CommandLineAppendWhenTrue(commandLine, "/EXE", "Exe");
 }
Exemple #25
0
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            if (Bag["SuppressStartupBanner"] != null)
            {
                commandLine.AppendSwitch("/NoLogo");
            }

            commandLine.AppendSwitch("/c");

            if (Bag["BuildObjectsFolder"] != null)
            {
                string objFile = Path.GetFileNameWithoutExtension(Sources[0].ItemSpec);
                string objPath = Path.Combine(BuildObjectsFolder, objFile);
                commandLine.AppendSwitch("/Fo" + objPath);
            }

            if (Bag["AdditionalIncludeDirectories"] != null)
            {
                foreach (string inc in AdditionalIncludeDirectories)
                {
                    commandLine.AppendSwitch("/I " + inc);
                }
            }

            if (Bag["AdditionalOptions"] != null)
            {
                commandLine.AppendSwitch(AdditionalOptions);
            }

            if (Bag["CallingConvention"] != null)
            {
                if (CallingConvention == "Cdecl")
                {
                    commandLine.AppendSwitch("/Gd");
                }
                if (CallingConvention == "FastCall")
                {
                    commandLine.AppendSwitch("/Gr");
                }
                if (CallingConvention == "StdCall")
                {
                    commandLine.AppendSwitch("/Gz");
                }
            }

            if (Bag["CompileAs"] != null)
            {
                //if (CompileAs == "Default") ;
                if (CompileAs == "CompileAsC")
                {
                    commandLine.AppendSwitch("/TC");
                }
                if (CompileAs == "CompileAsCpp")
                {
                    commandLine.AppendSwitch("/TP");
                }
            }

            if (Bag["DebugInformationFormat"] != null)
            {
                if (DebugInformationFormat == "OldStyle")
                {
                    commandLine.AppendSwitch("/Z7");
                }
                if (DebugInformationFormat == "ProgramDatabase")
                {
                    commandLine.AppendSwitch("/Zi");
                }
                if (DebugInformationFormat == "EditAndContinue")
                {
                    commandLine.AppendSwitch("/ZI");
                }
            }

            if (Bag["DisableLanguageExtensions"] != null)
            {
                commandLine.AppendSwitch(DisableLanguageExtensions ? "/Za" : "/Ze");
            }

            if (Bag["DisableSpecificWarnings"] != null)
            {
                foreach (String warning in DisableSpecificWarnings)
                {
                    commandLine.AppendSwitch("/Wd" + warning);
                }
            }

            if (Bag["ExceptionHandling"] != null)
            {
                if (ExceptionHandling == "Async")
                {
                    commandLine.AppendSwitch("/EHa");
                }
                if (ExceptionHandling == "Sync")
                {
                    commandLine.AppendSwitch("/EHsc");
                }
                if (ExceptionHandling == "SyncCThrow")
                {
                    commandLine.AppendSwitch("/EHs");
                }
            }

            if (Bag["FavorSizeOrSpeed"] != null)
            {
                if (FavorSizeOrSpeed == "Size")
                {
                    commandLine.AppendSwitch("/Os");
                }
                if (FavorSizeOrSpeed == "Speed")
                {
                    commandLine.AppendSwitch("/Ot");
                }
            }

            if (Bag["FloatingPointModel"] != null)
            {
                if (FloatingPointModel == "Precise")
                {
                    commandLine.AppendSwitch("/fp:precise");
                }
                if (FloatingPointModel == "Strict")
                {
                    commandLine.AppendSwitch("/fp:strict");
                }
                if (FloatingPointModel == "Fast")
                {
                    commandLine.AppendSwitch("/fp:fast");
                }
            }

            if (Bag["Optimization"] != null)
            {
                if (Optimization == "Disabled")
                {
                    commandLine.AppendSwitch("/Od");
                }
                if (Optimization == "MinSpace")
                {
                    commandLine.AppendSwitch("/O1");
                }
                if (Optimization == "MaxSpeed")
                {
                    commandLine.AppendSwitch("/O2");
                }
                if (Optimization == "Full")
                {
                    commandLine.AppendSwitch("/Ox");
                }
            }

            if (Bag["Sources"] != null)
            {
                foreach (ITaskItem source in Sources)
                {
                    commandLine.AppendFileNameIfNotNull(source.ItemSpec);
                }
            }
        }