/// <summary>
        /// Add Command Line Commands
        /// </summary>
        /// <param name="commandLine">CommandLineBuilderExtension</param>
        protected internal void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            //// Order of these affect the order of the command line

            commandLine.AppendSwitchIfNotNull("/I ", AdditionalIncludeDirectories, "");
            commandLine.AppendSwitch(SuppressStartupBanner ? "/nologo" : String.Empty);
            commandLine.AppendSwitchIfNotNull("/E", EntryPointName);
            commandLine.AppendSwitch(TreatWarningAsError ? "/WX" : String.Empty);

            // Switch cannot be null
            if (ShaderType != null && ShaderModel != null)
            {
                // shader Model and Type are one switch
                commandLine.AppendSwitch(ShaderType + "_" + ShaderModel);
            }

            commandLine.AppendSwitchIfNotNull("/D ", PreprocessorDefinitions, "");
            commandLine.AppendSwitchIfNotNull("/Fh ", HeaderFileOutput);
            commandLine.AppendSwitchIfNotNull("/Fo ", ObjectFileOutput);

            // Switch cannot be null
            if (AssemblerOutput != null)
            {
                commandLine.AppendSwitchIfNotNull(AssemblerOutput, AssemblerOutputFile);
            }

            commandLine.AppendSwitchIfNotNull("/Vn ", VariableName);
            commandLine.AppendSwitch(DisableOptimizations ? "/Od" : String.Empty);
            commandLine.AppendSwitch(EnableDebuggingInformation ? "/Zi" : String.Empty);

            commandLine.AppendSwitchIfNotNull("", Source, " ");
        }
예제 #2
0
파일: AL.cs 프로젝트: nlhepler/mono
		protected internal override void AddResponseFileCommands (
						 CommandLineBuilderExtension commandLine)
		{
			commandLine.AppendSwitchIfNotNull ("/algid:", AlgorithmId);
			commandLine.AppendSwitchIfNotNull ("/baseaddress:", BaseAddress);
			commandLine.AppendSwitchIfNotNull ("/company:", CompanyName);
			commandLine.AppendSwitchIfNotNull ("/configuration:", Configuration);
			commandLine.AppendSwitchIfNotNull ("/culture:", Culture);
			commandLine.AppendSwitchIfNotNull ("/copyright:", Copyright);
			if (Bag ["DelaySign"] != null)
				if (DelaySign)
					commandLine.AppendSwitch ("/delaysign+");
				else
					commandLine.AppendSwitch ("/delaysign-");
			commandLine.AppendSwitchIfNotNull ("/description:", Description);
			if (EmbedResources != null) {
				foreach (ITaskItem item in EmbedResources) {
					string logical_name = item.GetMetadata ("LogicalName");
					if (!string.IsNullOrEmpty (logical_name))
						commandLine.AppendSwitchIfNotNull ("/embed:", string.Format ("{0},{1}", item.ItemSpec, logical_name));
					else
						commandLine.AppendSwitchIfNotNull ("/embed:", item.ItemSpec);
				}
			}
			commandLine.AppendSwitchIfNotNull ("/evidence:", EvidenceFile);
			commandLine.AppendSwitchIfNotNull ("/fileversion:", FileVersion);
			commandLine.AppendSwitchIfNotNull ("/flags:", Flags);
			if (GenerateFullPaths)
				commandLine.AppendSwitch ("/fullpaths");
			commandLine.AppendSwitchIfNotNull ("/keyname:", KeyContainer);
			commandLine.AppendSwitchIfNotNull ("/keyfile:", KeyFile);
			if (LinkResources != null)
				foreach (ITaskItem item in LinkResources)
					commandLine.AppendSwitchIfNotNull ("/link:", item.ItemSpec);
			commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
			if (OutputAssembly != null)
				commandLine.AppendSwitchIfNotNull ("/out:", OutputAssembly.ItemSpec);
			//platform
			commandLine.AppendSwitchIfNotNull ("/product:", ProductName);
			commandLine.AppendSwitchIfNotNull ("/productversion:", ProductVersion);
			if (ResponseFiles != null)
				foreach (string s in ResponseFiles)
					commandLine.AppendFileNameIfNotNull (String.Format ("@{0}", s));
			if (SourceModules != null)
				foreach (ITaskItem item in SourceModules)
					commandLine.AppendFileNameIfNotNull (item.ItemSpec);
			commandLine.AppendSwitchIfNotNull ("/target:", TargetType);
			commandLine.AppendSwitchIfNotNull ("/template:", TemplateFile);
			commandLine.AppendSwitchIfNotNull ("/title:", Title);
			commandLine.AppendSwitchIfNotNull ("/trademark:", Trademark);
			commandLine.AppendSwitchIfNotNull ("/version:", Version);
			commandLine.AppendSwitchIfNotNull ("/win32icon:", Win32Icon);
			commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
		}
예제 #3
0
        protected internal override void AddCommandLineCommands(
            CommandLineBuilderExtension commandLine)
        {
            if (UseSourcePath)
            {
                commandLine.AppendSwitch("/useSourcePath");
            }

            commandLine.AppendSwitch(String.Format("/compile \"{0}{1}\"", SourceFile,
                                                   OutputFile != null ? "," + OutputFile : ""));
        }
 protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
     this.CreateTemporaryBatchFile();
     string batchFile = this.batchFile;
     commandLine.AppendSwitch("/Q");
     commandLine.AppendSwitch("/C");
     if (batchFile.Contains("&") && !batchFile.Contains("^&"))
     {
         batchFile = Microsoft.Build.Shared.NativeMethodsShared.GetShortFilePath(batchFile).Replace("&", "^&");
     }
     commandLine.AppendFileNameIfNotNull(batchFile);
 }
예제 #5
0
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            this.CreateTemporaryBatchFile();
            string batchFile = this.batchFile;

            commandLine.AppendSwitch("/Q");
            commandLine.AppendSwitch("/C");
            if (batchFile.Contains("&") && !batchFile.Contains("^&"))
            {
                batchFile = Microsoft.Build.Shared.NativeMethodsShared.GetShortFilePath(batchFile).Replace("&", "^&");
            }
            commandLine.AppendFileNameIfNotNull(batchFile);
        }
예제 #6
0
파일: LC.cs 프로젝트: Profit0004/mono
		protected internal override void AddCommandLineCommands (
						CommandLineBuilderExtension commandLine)
		{
			if (Sources.Length == 0)
				return;

			foreach (ITaskItem item in Sources)
				commandLine.AppendSwitchIfNotNull ("--complist=", item.ItemSpec);

			commandLine.AppendSwitchIfNotNull ("--target=", LicenseTarget);

			if (ReferencedAssemblies != null)
				foreach (ITaskItem reference in ReferencedAssemblies)
					commandLine.AppendSwitchIfNotNull ("--load=", reference.ItemSpec);

			string outdir;
			if (Bag ["OutputDirectory"] != null)
				outdir = OutputDirectory;
			else
				outdir = ".";

			commandLine.AppendSwitchIfNotNull ("--outdir=", outdir);

			if (Bag ["NoLogo"] != null && NoLogo)
				commandLine.AppendSwitch ("--nologo");

			OutputLicense = new TaskItem (Path.Combine (OutputDirectory, LicenseTarget.ItemSpec + ".licenses"));
		}
예제 #7
0
 protected internal override void AddCommandLineCommands(
     CommandLineBuilderExtension commandLine)
 {
     if (NoConfig)
     {
         commandLine.AppendSwitch("/noconfig");
     }
 }
        /// <summary>
        /// Add Command Line Commands
        /// </summary>
        /// <param name="commandLine">CommandLineBuilderExtension</param>
        protected internal void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            //// Order of these affect the order of the command line

            if (ConsumeExportFile != null || GenerateExportFile != null || GenerateExportShaderProfile != null)
            {
                // Custom effects for D2D are enabled. We need to add the path to the D2D1EffectHelpers.hlsli file.
                if (AdditionalIncludeDirectories == null || AdditionalIncludeDirectories.Length == 0)
                {
                    AdditionalIncludeDirectories = new string[] { GetPathToD2D1EffectHelpersHlsli() };
                }
                else
                {
                    List <string> includeDirs = new List <string>(AdditionalIncludeDirectories.Length + 1);
                    includeDirs.AddRange(AdditionalIncludeDirectories);
                    includeDirs.Add(GetPathToD2D1EffectHelpersHlsli());

                    AdditionalIncludeDirectories = includeDirs.ToArray();
                }
            }

            commandLine.AppendSwitchIfNotNull("/I ", AdditionalIncludeDirectories, " /I ");
            commandLine.AppendSwitch(SuppressStartupBanner ? "/nologo" : String.Empty);
            commandLine.AppendSwitchIfNotNull("/E", EntryPointName);
            commandLine.AppendSwitch(TreatWarningAsError ? "/WX" : String.Empty);

            // Switch cannot be null
            if (ShaderType != null && ShaderModel != null)
            {
                // shader Model and Type are one switch
                commandLine.AppendSwitch(ShaderType + "_" + ShaderModel);
            }

            commandLine.AppendSwitchIfNotNull("/D ", PreprocessorDefinitions, " /D ");
            commandLine.AppendSwitchIfNotNull("/Fh ", HeaderFileOutput);
            commandLine.AppendSwitchIfNotNull("/Fo ", ObjectFileOutput);

            // Switch cannot be null
            if (AssemblerOutput != null)
            {
                commandLine.AppendSwitchIfNotNull(AssemblerOutput, AssemblerOutputFile);
            }

            commandLine.AppendSwitchIfNotNull("/Vn ", VariableName);
            commandLine.AppendSwitch(DisableOptimizations ? "/Od" : String.Empty);
            commandLine.AppendSwitch(EnableDebuggingInfo ? "/Zi" : String.Empty);
            commandLine.AppendSwitch(AllResourcesBound ? "/all_resources_bound" : String.Empty);
            commandLine.AppendSwitch(EnableUnboundedDescriptorTable ? "/enable_unbounded_descriptor_tables" : String.Empty);
            commandLine.AppendSwitch(SetRootSignature ? "/setrootsignature" : String.Empty);

            commandLine.AppendSwitchIfNotNull("/setprivate ", ConsumeExportFile);
            commandLine.AppendSwitchIfNotNull("/Fl ", GenerateExportFile);
            commandLine.AppendSwitchIfNotNull("/T ", GenerateExportShaderProfile);

            commandLine.AppendSwitchIfNotNull("", Source, " ");
        }
예제 #9
0
        /// <summary>
        /// Adds the arguments for cmd.exe
        /// </summary>
        /// <param name="commandLine">command line builder class to add arguments to</param>
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            // Create the batch file now,
            // so we have the file name for the cmd.exe command line
            CreateTemporaryBatchFile();

            string batchFileForCommandLine = _batchFile;

            // Unix consoles cannot have their encodings changed in place (like chcp on windows).
            // Instead, unix scripts receive encoding information via environment variables before invocation.
            // In consequence, encoding setup has to be performed outside the script, not inside it.
            if (NativeMethodsShared.IsUnixLike)
            {
                commandLine.AppendSwitch("-c");
                commandLine.AppendTextUnquoted(" \"");
                commandLine.AppendTextUnquoted("export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; . ");
                commandLine.AppendFileNameIfNotNull(batchFileForCommandLine);
                commandLine.AppendTextUnquoted("\"");
            }
            else
            {
                if (NativeMethodsShared.IsWindows)
                {
                    commandLine.AppendSwitch("/Q"); // echo off
                    if (!Traits.Instance.EscapeHatches.UseAutoRunWhenLaunchingProcessUnderCmd)
                    {
                        commandLine.AppendSwitch("/D"); // do not load AutoRun configuration from the registry (perf)
                    }
                    commandLine.AppendSwitch("/C");     // run then terminate

                    // If for some crazy reason the path has a & character and a space in it
                    // then get the short path of the temp path, which should not have spaces in it
                    // and then escape the &
                    if (batchFileForCommandLine.Contains("&") && !batchFileForCommandLine.Contains("^&"))
                    {
                        batchFileForCommandLine = NativeMethodsShared.GetShortFilePath(batchFileForCommandLine);
                        batchFileForCommandLine = batchFileForCommandLine.Replace("&", "^&");
                    }
                }

                commandLine.AppendFileNameIfNotNull(batchFileForCommandLine);
            }
        }
예제 #10
0
        /// <summary>
        /// Adds the arguments for cmd.exe
        /// </summary>
        /// <param name="commandLine">command line builder class to add arguments to</param>
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            // Create the batch file now,
            // so we have the file name for the cmd.exe command line
            CreateTemporaryBatchFile();

            string batchFileForCommandLine = _batchFile;

            commandLine.AppendSwitch("/Q");      // echo off
            commandLine.AppendSwitch("/C");      // run then terminate

            // If for some crazy reason the path has a & character and a space in it
            // then get the short path of the temp path, which should not have spaces in it
            // and then escape the &
            if (batchFileForCommandLine.Contains("&") && !batchFileForCommandLine.Contains("^&"))
            {
                batchFileForCommandLine = NativeMethodsShared.GetShortFilePath(batchFileForCommandLine);
                batchFileForCommandLine = batchFileForCommandLine.Replace("&", "^&");
            }

            commandLine.AppendFileNameIfNotNull(batchFileForCommandLine);
        }
예제 #11
0
파일: Exec.cs 프로젝트: frje/SharpLang
		protected internal override void AddCommandLineCommands (CommandLineBuilderExtension commandLine)
		{
			if (IsRunningOnWindows)
				commandLine.AppendSwitch ("/q /c");

			if (!String.IsNullOrEmpty (command)) {
				scriptFile = Path.GetTempFileName ();
				if (IsRunningOnWindows)
					scriptFile = scriptFile + ".bat";
				using (StreamWriter sw = new StreamWriter (scriptFile)) {
					sw.Write (command);
				}
				commandLine.AppendFileNameIfNotNull (scriptFile);
			}
			base.AddCommandLineCommands (commandLine);
		}
예제 #12
0
        /// <summary>
        /// Generates command line arguments for aspnet_compiler.exe
        /// </summary>
        /// <param name="commandLine">command line builder class to add arguments to</param>
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            commandLine.AppendSwitchIfNotNull("-m ", MetabasePath);
            commandLine.AppendSwitchIfNotNull("-v ", VirtualPath);
            commandLine.AppendSwitchIfNotNull("-p ", PhysicalPath);

            if (Updateable)
            {
                commandLine.AppendSwitch("-u");
            }

            if (Force)
            {
                commandLine.AppendSwitch("-f");
            }

            if (Clean)
            {
                commandLine.AppendSwitch("-c");
            }

            if (Debug)
            {
                commandLine.AppendSwitch("-d");
            }

            if (FixedNames)
            {
                commandLine.AppendSwitch("-fixednames");
            }

            commandLine.AppendSwitchIfNotNull("", TargetPath);

            if (AllowPartiallyTrustedCallers)
            {
                commandLine.AppendSwitch("-aptca");
            }

            if (DelaySign)
            {
                commandLine.AppendSwitch("-delaysign");
            }

            commandLine.AppendSwitchIfNotNull("-keyfile ", KeyFile);
            commandLine.AppendSwitchIfNotNull("-keycontainer ", KeyContainer);
        }
예제 #13
0
        protected internal override void AddCommandLineCommands(
            CommandLineBuilderExtension commandLine)
        {
            if (Sources.Length == 0)
            {
                return;
            }

            foreach (ITaskItem item in Sources)
            {
                commandLine.AppendSwitchIfNotNull("--complist=", item.ItemSpec);
            }

            commandLine.AppendSwitchIfNotNull("--target=", LicenseTarget);

            if (ReferencedAssemblies != null)
            {
                foreach (ITaskItem reference in ReferencedAssemblies)
                {
                    commandLine.AppendSwitchIfNotNull("--load=", reference.ItemSpec);
                }
            }

            string outdir;

            if (Bag ["OutputDirectory"] != null)
            {
                outdir = OutputDirectory;
            }
            else
            {
                outdir = ".";
            }

            commandLine.AppendSwitchIfNotNull("--outdir=", outdir);

            if (Bag ["NoLogo"] != null && NoLogo)
            {
                commandLine.AppendSwitch("--nologo");
            }

            OutputLicense = new TaskItem(Path.Combine(OutputDirectory, LicenseTarget.ItemSpec + ".licenses"));
        }
예제 #14
0
파일: Exec.cs 프로젝트: mdae/MonoRT
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            if (IsRunningOnWindows)
            {
                commandLine.AppendSwitch("/q /c");
            }

            if (!String.IsNullOrEmpty(command))
            {
                scriptFile = Path.GetTempFileName();
                if (IsRunningOnWindows)
                {
                    scriptFile = scriptFile + ".bat";
                }
                using (StreamWriter sw = new StreamWriter(scriptFile)) {
                    sw.Write(command);
                }
                commandLine.AppendFileNameIfNotNull(scriptFile);
            }
            base.AddCommandLineCommands(commandLine);
        }
 protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendSwitchIfNotNull("-m ", this.MetabasePath);
     commandLine.AppendSwitchIfNotNull("-v ", this.VirtualPath);
     commandLine.AppendSwitchIfNotNull("-p ", this.PhysicalPath);
     if (this.Updateable)
     {
         commandLine.AppendSwitch("-u");
     }
     if (this.Force)
     {
         commandLine.AppendSwitch("-f");
     }
     if (this.Clean)
     {
         commandLine.AppendSwitch("-c");
     }
     if (this.Debug)
     {
         commandLine.AppendSwitch("-d");
     }
     if (this.FixedNames)
     {
         commandLine.AppendSwitch("-fixednames");
     }
     commandLine.AppendSwitchIfNotNull("", this.TargetPath);
     if (this.AllowPartiallyTrustedCallers)
     {
         commandLine.AppendSwitch("-aptca");
     }
     if (this.DelaySign)
     {
         commandLine.AppendSwitch("-delaysign");
     }
     commandLine.AppendSwitchIfNotNull("-keyfile ", this.KeyFile);
     commandLine.AppendSwitchIfNotNull("-keycontainer ", this.KeyContainer);
 }
예제 #16
0
		protected internal override void AddResponseFileCommands (CommandLineBuilderExtension commandLine)
		{
#if !NET_4_0
			//pre-MSBuild 2 targets don't support multi-targeting, so tell compiler to use 2.0 corlib
			commandLine.AppendSwitch ("/sdk:2");
#endif
			base.AddResponseFileCommands (commandLine);

			if (AdditionalLibPaths != null && AdditionalLibPaths.Length > 0)
				commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");

			if (Bag ["AllowUnsafeBlocks"] != null)
				if (AllowUnsafeBlocks)
					commandLine.AppendSwitch ("/unsafe+");
				else
					commandLine.AppendSwitch ("/unsafe-");

			//baseAddress
			
			if (Bag ["CheckForOverflowUnderflow"] != null)
				if (CheckForOverflowUnderflow)
					commandLine.AppendSwitch ("/checked+");
				else
					commandLine.AppendSwitch ("/checked-");

			if (!String.IsNullOrEmpty (DefineConstants)) {
				string [] defines = DefineConstants.Split (new char [] {';', ' '},
						StringSplitOptions.RemoveEmptyEntries);
				if (defines.Length > 0)
					commandLine.AppendSwitchIfNotNull ("/define:",
							String.Join (";", defines));
			}

			if (!String.IsNullOrEmpty (DisabledWarnings)) {
				string [] defines = DisabledWarnings.Split (new char [] {';', ' ', ','},
						StringSplitOptions.RemoveEmptyEntries);
				if (defines.Length > 0)
				    commandLine.AppendSwitchIfNotNull ("/nowarn:", defines, ";");
			}

			commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);

			//errorReport

			if (GenerateFullPaths)
				commandLine.AppendSwitch ("/fullpaths");

			commandLine.AppendSwitchIfNotNull ("/langversion:", LangVersion);

			commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);

			//moduleAssemblyName
			
			if (NoStandardLib)
				commandLine.AppendSwitch ("/nostdlib");

			//platform
			commandLine.AppendSwitchIfNotNull ("/platform:", Platform);
			//
			if (References != null)
				foreach (ITaskItem item in References) {
					string aliases = item.GetMetadata ("Aliases") ?? String.Empty;
					aliases = aliases.Trim ();
					if (aliases.Length > 0)
						commandLine.AppendSwitchIfNotNull ("/reference:" + aliases + "=", item.ItemSpec);
					else
						commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
				}

			if (ResponseFiles != null)
				foreach (ITaskItem item in ResponseFiles) 
					commandLine.AppendSwitchIfNotNull ("@", item.ItemSpec);

			if (Bag ["WarningLevel"] != null)
				commandLine.AppendSwitchIfNotNull ("/warn:", WarningLevel.ToString ());

			commandLine.AppendSwitchIfNotNull ("/warnaserror+:", WarningsAsErrors);

			commandLine.AppendSwitchIfNotNull ("/warnaserror-:", WarningsNotAsErrors);

			if (Win32Resource != null)
				commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
		}
 private void LogResgenCommandLine(List<ITaskItem> inputFiles, List<ITaskItem> outputFiles)
 {
     CommandLineBuilderExtension resGenCommand = new CommandLineBuilderExtension();
     resGenCommand.AppendFileNameIfNotNull(Path.Combine(this.resgenPath, "resgen.exe"));
     this.GenerateResGenCommandLineWithoutResources(resGenCommand);
     if (this.StronglyTypedLanguage == null)
     {
         resGenCommand.AppendSwitch("/compile");
         for (int i = 0; i < inputFiles.Count; i++)
         {
             resGenCommand.AppendFileNamesIfNotNull(new string[] { inputFiles[i].ItemSpec, outputFiles[i].ItemSpec }, ",");
         }
     }
     else
     {
         resGenCommand.AppendFileNamesIfNotNull(inputFiles.ToArray(), " ");
         resGenCommand.AppendFileNamesIfNotNull(outputFiles.ToArray(), " ");
         resGenCommand.AppendSwitchIfNotNull("/str:", new string[] { this.StronglyTypedLanguage, this.StronglyTypedNamespace, this.StronglyTypedClassName, this.StronglyTypedFileName }, ",");
     }
     base.Log.LogCommandLine(MessageImportance.Low, resGenCommand.ToString());
 }
예제 #18
0
        protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
#if !NET_4_0
            //pre-MSBuild 2 targets don't support multi-targeting, so tell compiler to use 2.0 corlib
            commandLine.AppendSwitch("/sdk:2");
#endif
            base.AddResponseFileCommands(commandLine);

            if (AdditionalLibPaths != null && AdditionalLibPaths.Length > 0)
            {
                commandLine.AppendSwitchIfNotNull("/lib:", AdditionalLibPaths, ",");
            }

            if (Bag ["AllowUnsafeBlocks"] != null)
            {
                if (AllowUnsafeBlocks)
                {
                    commandLine.AppendSwitch("/unsafe+");
                }
                else
                {
                    commandLine.AppendSwitch("/unsafe-");
                }
            }

            //baseAddress

            if (Bag ["CheckForOverflowUnderflow"] != null)
            {
                if (CheckForOverflowUnderflow)
                {
                    commandLine.AppendSwitch("/checked+");
                }
                else
                {
                    commandLine.AppendSwitch("/checked-");
                }
            }

            if (!String.IsNullOrEmpty(DefineConstants))
            {
                string [] defines = DefineConstants.Split(new char [] { ';', ' ' },
                                                          StringSplitOptions.RemoveEmptyEntries);
                if (defines.Length > 0)
                {
                    commandLine.AppendSwitchIfNotNull("/define:",
                                                      String.Join(";", defines));
                }
            }

            if (!String.IsNullOrEmpty(DisabledWarnings))
            {
                string [] defines = DisabledWarnings.Split(new char [] { ';', ' ', ',' },
                                                           StringSplitOptions.RemoveEmptyEntries);
                if (defines.Length > 0)
                {
                    commandLine.AppendSwitchIfNotNull("/nowarn:", defines, ";");
                }
            }

            commandLine.AppendSwitchIfNotNull("/doc:", DocumentationFile);

            //errorReport

            if (GenerateFullPaths)
            {
                commandLine.AppendSwitch("/fullpaths");
            }

            commandLine.AppendSwitchIfNotNull("/langversion:", LangVersion);

            commandLine.AppendSwitchIfNotNull("/main:", MainEntryPoint);

            //moduleAssemblyName

            if (NoStandardLib)
            {
                commandLine.AppendSwitch("/nostdlib");
            }

            //platform
            commandLine.AppendSwitchIfNotNull("/platform:", Platform);
            //
            if (References != null)
            {
                foreach (ITaskItem item in References)
                {
                    string aliases = item.GetMetadata("Aliases");
                    if (!string.IsNullOrEmpty(aliases))
                    {
                        AddAliasesReference(commandLine, aliases, item.ItemSpec);
                    }
                    else
                    {
                        commandLine.AppendSwitchIfNotNull("/reference:", item.ItemSpec);
                    }
                }
            }

            if (ResponseFiles != null)
            {
                foreach (ITaskItem item in ResponseFiles)
                {
                    commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
                }
            }

            if (Bag ["WarningLevel"] != null)
            {
                commandLine.AppendSwitchIfNotNull("/warn:", WarningLevel.ToString());
            }

            commandLine.AppendSwitchIfNotNull("/warnaserror+:", WarningsAsErrors);

            commandLine.AppendSwitchIfNotNull("/warnaserror-:", WarningsNotAsErrors);

            if (Win32Resource != null)
            {
                commandLine.AppendSwitchIfNotNull("/win32res:", Win32Resource);
            }
        }
예제 #19
0
		protected internal override void AddCommandLineCommands (
						 CommandLineBuilderExtension commandLine)
		{
			if (UseSourcePath)
				commandLine.AppendSwitch ("/useSourcePath");

			commandLine.AppendSwitch (String.Format ("/compile \"{0}{1}\"", SourceFile,
						OutputFile != null ? "," + OutputFile : ""));
		}
예제 #20
0
 protected internal override void AddResponseFileCommands(
     CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendSwitchIfNotNull("/algid:", AlgorithmId);
     commandLine.AppendSwitchIfNotNull("/baseaddress:", BaseAddress);
     commandLine.AppendSwitchIfNotNull("/company:", CompanyName);
     commandLine.AppendSwitchIfNotNull("/configuration:", Configuration);
     commandLine.AppendSwitchIfNotNull("/culture:", Culture);
     commandLine.AppendSwitchIfNotNull("/copyright:", Copyright);
     if (Bag ["DelaySign"] != null)
     {
         if (DelaySign)
         {
             commandLine.AppendSwitch("/delaysign+");
         }
         else
         {
             commandLine.AppendSwitch("/delaysign-");
         }
     }
     commandLine.AppendSwitchIfNotNull("/description:", Description);
     if (EmbedResources != null)
     {
         foreach (ITaskItem item in EmbedResources)
         {
             commandLine.AppendSwitchIfNotNull("/embed:", item.ItemSpec);
         }
     }
     commandLine.AppendSwitchIfNotNull("/evidence:", EvidenceFile);
     commandLine.AppendSwitchIfNotNull("/fileversion:", FileVersion);
     commandLine.AppendSwitchIfNotNull("/flags:", Flags);
     if (GenerateFullPaths)
     {
         commandLine.AppendSwitch("/fullpaths");
     }
     commandLine.AppendSwitchIfNotNull("/keyname:", KeyContainer);
     commandLine.AppendSwitchIfNotNull("/keyfile:", KeyFile);
     if (LinkResources != null)
     {
         foreach (ITaskItem item in LinkResources)
         {
             commandLine.AppendSwitchIfNotNull("/link:", item.ItemSpec);
         }
     }
     commandLine.AppendSwitchIfNotNull("/main:", MainEntryPoint);
     if (OutputAssembly != null)
     {
         commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly.ItemSpec);
     }
     //platform
     commandLine.AppendSwitchIfNotNull("/product:", ProductName);
     commandLine.AppendSwitchIfNotNull("/productversion:", ProductVersion);
     if (ResponseFiles != null)
     {
         foreach (string s in ResponseFiles)
         {
             commandLine.AppendFileNameIfNotNull(String.Format("@{0}", s));
         }
     }
     if (SourceModules != null)
     {
         foreach (ITaskItem item in SourceModules)
         {
             commandLine.AppendFileNameIfNotNull(item.ItemSpec);
         }
     }
     commandLine.AppendSwitchIfNotNull("/target:", TargetType);
     commandLine.AppendSwitchIfNotNull("/template:", TemplateFile);
     commandLine.AppendSwitchIfNotNull("/title:", Title);
     commandLine.AppendSwitchIfNotNull("/trademark:", Trademark);
     commandLine.AppendSwitchIfNotNull("/version:", Version);
     commandLine.AppendSwitchIfNotNull("/win32icon:", Win32Icon);
     commandLine.AppendSwitchIfNotNull("/win32res:", Win32Resource);
 }
예제 #21
0
        /// <summary>
        /// Generate the parts of the resgen command line that are don't involve resgen.exe itself or the 
        /// resources to be generated. 
        /// </summary>
        /// <comments>
        /// Expects resGenCommand to be non-null -- otherwise, it doesn't get passed back to the caller, so it's 
        /// useless anyway.
        /// </comments>
        /// <param name="resGenCommand"></param>
        private void GenerateResGenCommandLineWithoutResources(CommandLineBuilderExtension resGenCommand)
        {
            // Throw an internal error, since this method should only ever get called by other aspects of this task, not
            // anything that the user touches. 
            ErrorUtilities.VerifyThrowInternalNull(resGenCommand, "resGenCommand");

            // append the /useSourcePath flag if requested.
            if (UseSourcePath)
            {
                resGenCommand.AppendSwitch("/useSourcePath");
            }

            // append the /publicClass flag if requested
            if (PublicClass)
            {
                resGenCommand.AppendSwitch("/publicClass");
            }

            // append the references, if any
            if (References != null)
            {
                foreach (ITaskItem reference in References)
                {
                    resGenCommand.AppendSwitchIfNotNull("/r:", reference);
                }
            }

            // append /compile switch if not creating strongly typed class
            if (String.IsNullOrEmpty(StronglyTypedLanguage))
            {
                resGenCommand.AppendSwitch("/compile");
            }
        }
예제 #22
0
파일: Vbc.cs 프로젝트: ChronosWS/msbuild
        /// <summary>
        /// Looks at all the parameters that have been set, and builds up the string
        /// containing all the command-line switches.
        /// </summary>
        /// <param name="commandLine"></param>
        protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
            commandLine.AppendSwitchIfNotNull("/baseaddress:", this.GetBaseAddressInHex());
            commandLine.AppendSwitchIfNotNull("/libpath:", this.AdditionalLibPaths, ",");
            commandLine.AppendSwitchIfNotNull("/imports:", this.Imports, ",");
            // Make sure this /doc+ switch comes *before* the /doc:<file> switch (which is handled in the
            // ManagedCompiler.cs base class).  /doc+ is really just an alias for /doc:<assemblyname>.xml,
            // and the last /doc switch on the command-line wins.  If the user provided a specific doc filename,
            // we want that one to win.
            commandLine.AppendPlusOrMinusSwitch("/doc", this.Bag, "GenerateDocumentation");
            commandLine.AppendSwitchIfNotNull("/optioncompare:", this.OptionCompare);
            commandLine.AppendPlusOrMinusSwitch("/optionexplicit", this.Bag, "OptionExplicit");
            // Make sure this /optionstrict+ switch appears *before* the /optionstrict:xxxx switch below

            /* In Orcas a change was made that set Option Strict-, whenever this.DisabledWarnings was
             * empty.  That was clearly the wrong thing to do and we found it when we had a project with all the warning configuration 
             * entries set to WARNING.  Because this.DisabledWarnings was empty in that case we would end up sending /OptionStrict- 
             * effectively silencing all the warnings that had been selected.
             * 
             * Now what we do is:
             *  If option strict+ is specified, that trumps everything and we just set option strict+ 
             *  Otherwise, just set option strict:custom.
             *  You may wonder why we don't try to set Option Strict-  The reason is that Option Strict- just implies a certain
             *  set of warnings that should be disabled (there's ten of them today)  You get the same effect by sending 
             *  option strict:custom on along with the correct list of disabled warnings.
             *  Rather than make this code know the current set of disabled warnings that comprise Option strict-, we just send
             *  option strict:custom on with the understanding that we'll get the same behavior as option strict- since we are passing
             *  the /nowarn line on that contains all the warnings OptionStrict- would disable anyway. The IDE knows what they are
             *  and puts them in the project file so we are good.  And by not making this code aware of which warnings comprise
             *  Option Strict-, we have one less place we have to keep up to date in terms of what comprises option strict-
             */

            // Decide whether we are Option Strict+ or Option Strict:custom
            object optionStrictSetting = this.Bag["OptionStrict"];
            bool optionStrict = optionStrictSetting != null ? (bool)optionStrictSetting : false;
            if (optionStrict)
            {
                commandLine.AppendSwitch("/optionstrict+");
            }
            else // OptionStrict+ wasn't specified so use :custom.
            {
                commandLine.AppendSwitch("/optionstrict:custom");
            }

            commandLine.AppendSwitchIfNotNull("/optionstrict:", this.OptionStrictType);
            commandLine.AppendWhenTrue("/nowarn", this.Bag, "NoWarnings");
            commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", ';', ',');
            commandLine.AppendPlusOrMinusSwitch("/optioninfer", this.Bag, "OptionInfer");
            commandLine.AppendWhenTrue("/nostdlib", this.Bag, "NoStandardLib");
            commandLine.AppendWhenTrue("/novbruntimeref", this.Bag, "NoVBRuntimeReference");
            commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
            commandLine.AppendSwitchIfNotNull("/platform:", this.PlatformWith32BitPreference);
            commandLine.AppendPlusOrMinusSwitch("/removeintchecks", this.Bag, "RemoveIntegerChecks");
            commandLine.AppendSwitchIfNotNull("/rootnamespace:", this.RootNamespace);
            commandLine.AppendSwitchIfNotNull("/sdkpath:", this.SdkPath);
            commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
            commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
            commandLine.AppendWhenTrue("/netcf", this.Bag, "TargetCompactFramework");
            commandLine.AppendSwitchIfNotNull("/preferreduilang:", this.PreferredUILang);
            commandLine.AppendPlusOrMinusSwitch("/highentropyva", this.Bag, "HighEntropyVA");

            if (0 == String.Compare(this.VBRuntimePath, this.VBRuntime, StringComparison.OrdinalIgnoreCase))
            {
                commandLine.AppendSwitchIfNotNull("/vbruntime:", this.VBRuntimePath);
            }
            else if (this.VBRuntime != null)
            {
                string vbRuntimeSwitch = this.VBRuntime;
                if (0 == String.Compare(vbRuntimeSwitch, "EMBED", StringComparison.OrdinalIgnoreCase))
                {
                    commandLine.AppendSwitch("/vbruntime*");
                }
                else if (0 == String.Compare(vbRuntimeSwitch, "NONE", StringComparison.OrdinalIgnoreCase))
                {
                    commandLine.AppendSwitch("/vbruntime-");
                }
                else if (0 == String.Compare(vbRuntimeSwitch, "DEFAULT", StringComparison.OrdinalIgnoreCase))
                {
                    commandLine.AppendSwitch("/vbruntime+");
                }
                else
                {
                    commandLine.AppendSwitchIfNotNull("/vbruntime:", vbRuntimeSwitch);
                }
            }


            // Verbosity
            if (
                   (this.Verbosity != null) &&

                   (
                      (0 == String.Compare(this.Verbosity, "quiet", StringComparison.OrdinalIgnoreCase)) ||
                      (0 == String.Compare(this.Verbosity, "verbose", StringComparison.OrdinalIgnoreCase))
                   )
                )
            {
                commandLine.AppendSwitchIfNotNull("/", this.Verbosity);
            }

            commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
            commandLine.AppendSwitchUnquotedIfNotNull("/define:", Vbc.GetDefineConstantsSwitch(this.DefineConstants));
            AddReferencesToCommandLine(commandLine);
            commandLine.AppendSwitchIfNotNull("/win32resource:", this.Win32Resource);

            // Special case for "Sub Main"
            if (0 != String.Compare("Sub Main", this.MainEntryPoint, StringComparison.OrdinalIgnoreCase))
            {
                commandLine.AppendSwitchIfNotNull("/main:", this.MainEntryPoint);
            }

            base.AddResponseFileCommands(commandLine);

            // This should come after the "TreatWarningsAsErrors" flag is processed (in managedcompiler.cs).
            // Because if TreatWarningsAsErrors=false, then we'll have a /warnaserror- on the command-line,
            // and then any specific warnings that should be treated as errors should be specified with
            // /warnaserror+:<list> after the /warnaserror- switch.  The order of the switches on the command-line
            // does matter.
            //
            // Note that
            //      /warnaserror+
            // is just shorthand for:
            //      /warnaserror+:<all possible warnings>
            //
            // Similarly,
            //      /warnaserror-
            // is just shorthand for:
            //      /warnaserror-:<all possible warnings>
            commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", ';', ',');
            commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", ';', ',');

            // If not design time build and the globalSessionGuid property was set then add a -globalsessionguid:<guid>
            bool designTime = false;
            if (this.HostObject != null)
            {
                var vbHost = this.HostObject as IVbcHostObject;
                designTime = vbHost.IsDesignTime();
            }
            if (!designTime)
            {
                if (!string.IsNullOrWhiteSpace(this.VsSessionGuid))
                {
                    commandLine.AppendSwitchIfNotNull("/sqmsessionguid:", this.VsSessionGuid);
                }
            }

            // It's a good idea for the response file to be the very last switch passed, just 
            // from a predictability perspective.
            if (this.ResponseFiles != null)
            {
                foreach (ITaskItem response in this.ResponseFiles)
                {
                    commandLine.AppendSwitchIfNotNull("@", response.ItemSpec);
                }
            }
        }
예제 #23
0
            /// <summary>
            /// Generate the command line to be passed to resgen.exe, sans the path to the tool. 
            /// </summary>
            private void GenerateResGenCommands(CommandLineBuilderExtension resGenArguments, bool useForResponseFile)
            {
                resGenArguments = resGenArguments ?? new CommandLineBuilderExtension();

                if (ResGen.IsNullOrEmpty(OutputFiles))
                {
                    GenerateOutputFileNames();
                }

                // Append boolean flags if requested
                string useSourcePathSwitch = "/useSourcePath" + (useForResponseFile ? "\n" : String.Empty);
                string publicClassSwitch = "/publicClass" + (useForResponseFile ? "\n" : String.Empty);
                resGenArguments.AppendWhenTrue(useSourcePathSwitch, Bag, "UseSourcePath");
                resGenArguments.AppendWhenTrue(publicClassSwitch, Bag, "PublicClass");

                // append the references, if any
                if (References != null)
                {
                    foreach (ITaskItem reference in References)
                    {
                        // ResGen.exe response files frown on quotes in filenames, even if there are 
                        // spaces in the names of the files.  
                        if (useForResponseFile && reference != null)
                        {
                            resGenArguments.AppendTextUnquoted("/r:");
                            resGenArguments.AppendTextUnquoted(reference.ItemSpec);
                            resGenArguments.AppendTextUnquoted("\n");
                        }
                        else
                        {
                            resGenArguments.AppendSwitchIfNotNull("/r:", reference);
                        }
                    }
                }

                if (String.IsNullOrEmpty(StronglyTypedLanguage))
                {
                    // append the compile switch
                    resGenArguments.AppendSwitch("/compile" + (useForResponseFile ? "\n" : String.Empty));

                    // append the resources to compile
                    if (InputFiles != null && InputFiles.Length > 0)
                    {
                        ITaskItem[] inputFiles = InputFiles;
                        ITaskItem[] outputFiles = OutputFiles;

                        for (int i = 0; i < inputFiles.Length; ++i)
                        {
                            if (useForResponseFile)
                            {
                                // ResGen.exe response files frown on quotes in filenames, even if there are 
                                // spaces in the names of the files.  
                                if (inputFiles[i] != null && outputFiles[i] != null)
                                {
                                    resGenArguments.AppendTextUnquoted(inputFiles[i].ItemSpec);
                                    resGenArguments.AppendTextUnquoted(",");
                                    resGenArguments.AppendTextUnquoted(outputFiles[i].ItemSpec);
                                    resGenArguments.AppendTextUnquoted("\n");
                                }
                            }
                            else
                            {
                                resGenArguments.AppendFileNamesIfNotNull
                                (
                                    new ITaskItem[] { inputFiles[i], outputFiles[i] },
                                    ","
                                );
                            }
                        }
                    }
                }
                else
                {
                    // append the resource to compile
                    resGenArguments.AppendFileNamesIfNotNull(InputFiles, " ");
                    resGenArguments.AppendFileNamesIfNotNull(OutputFiles, " ");

                    // append the strongly-typed resource details
                    resGenArguments.AppendSwitchIfNotNull
                    (
                        "/str:",
                        new string[] { StronglyTypedLanguage, StronglyTypedNamespace, StronglyTypedClassName, StronglyTypedFileName },
                        ","
                    );
                }
            }
 protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
 {
     Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(!IsNullOrEmpty(this.InputFiles), "If InputFiles is empty, the task should have returned before reaching this point");
     CommandLineBuilderExtension resGenArguments = new CommandLineBuilderExtension();
     this.GenerateResGenCommands(resGenArguments, false);
     string str = this.GenerateResGenFullPath();
     if (this.TrackFileAccess)
     {
         string rootFiles = FileTracker.FormatRootingMarker(this.InputFiles);
         string temporaryFile = Microsoft.Build.Shared.FileUtilities.GetTemporaryFile();
         string fileTrackerPath = FileTracker.GetFileTrackerPath(this.ToolType, this.TrackerFrameworkPath);
         using (StreamWriter writer = new StreamWriter(temporaryFile, false, this.ResponseFileEncoding))
         {
             writer.Write(FileTracker.TrackerResponseFileArguments(fileTrackerPath, this.TrackerLogDirectory, rootFiles));
         }
         commandLine.AppendTextUnquoted(this.GetResponseFileSwitch(temporaryFile));
         commandLine.AppendSwitch(FileTracker.TrackerCommandArguments(str ?? string.Empty, resGenArguments.ToString()));
     }
     else if (((str == null) || !str.Equals(Microsoft.Build.Shared.NativeMethodsShared.GetLongFilePath(ToolLocationHelper.GetPathToDotNetFrameworkSdkFile("resgen.exe", TargetDotNetFrameworkVersion.Version40)), StringComparison.OrdinalIgnoreCase)) || !string.IsNullOrEmpty(this.StronglyTypedLanguage))
     {
         commandLine.AppendTextUnquoted(resGenArguments.ToString());
     }
 }
예제 #25
0
		protected internal override void AddCommandLineCommands (
						 CommandLineBuilderExtension commandLine)
		{
			if (NoConfig)
				commandLine.AppendSwitch ("/noconfig");
		}
예제 #26
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);
        }
예제 #27
0
        protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
            commandLine.AppendSwitchIfNotNull("/baseaddress:", this.GetBaseAddressInHex());
            commandLine.AppendSwitchIfNotNull("/libpath:", base.AdditionalLibPaths, ",");
            commandLine.AppendSwitchIfNotNull("/imports:", this.Imports, ",");
            commandLine.AppendPlusOrMinusSwitch("/doc", base.Bag, "GenerateDocumentation");
            commandLine.AppendSwitchIfNotNull("/optioncompare:", this.OptionCompare);
            commandLine.AppendPlusOrMinusSwitch("/optionexplicit", base.Bag, "OptionExplicit");
            object obj2 = base.Bag["OptionStrict"];

            if ((obj2 != null) ? ((bool)obj2) : false)
            {
                commandLine.AppendSwitch("/optionstrict+");
            }
            else
            {
                commandLine.AppendSwitch("/optionstrict:custom");
            }
            commandLine.AppendSwitchIfNotNull("/optionstrict:", this.OptionStrictType);
            commandLine.AppendWhenTrue("/nowarn", base.Bag, "NoWarnings");
            commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", new char[] { ';', ',' });
            commandLine.AppendPlusOrMinusSwitch("/optioninfer", base.Bag, "OptionInfer");
            commandLine.AppendWhenTrue("/nostdlib", base.Bag, "NoStandardLib");
            commandLine.AppendWhenTrue("/novbruntimeref", base.Bag, "NoVBRuntimeReference");
            commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
            commandLine.AppendSwitchIfNotNull("/platform:", this.Platform);
            commandLine.AppendPlusOrMinusSwitch("/removeintchecks", base.Bag, "RemoveIntegerChecks");
            commandLine.AppendSwitchIfNotNull("/rootnamespace:", this.RootNamespace);
            commandLine.AppendSwitchIfNotNull("/sdkpath:", this.SdkPath);
            commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
            commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
            commandLine.AppendWhenTrue("/netcf", base.Bag, "TargetCompactFramework");
            if (this.VBRuntime != null)
            {
                string vBRuntime = this.VBRuntime;
                if (string.Compare(vBRuntime, "EMBED", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    commandLine.AppendSwitch("/vbruntime*");
                }
                else if (string.Compare(vBRuntime, "NONE", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    commandLine.AppendSwitch("/vbruntime-");
                }
                else if (string.Compare(vBRuntime, "DEFAULT", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    commandLine.AppendSwitch("/vbruntime+");
                }
                else
                {
                    commandLine.AppendSwitchIfNotNull("/vbruntime:", vBRuntime);
                }
            }
            if ((this.Verbosity != null) && ((string.Compare(this.Verbosity, "quiet", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.Verbosity, "verbose", StringComparison.OrdinalIgnoreCase) == 0)))
            {
                commandLine.AppendSwitchIfNotNull("/", this.Verbosity);
            }
            commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
            commandLine.AppendSwitchUnquotedIfNotNull("/define:", GetDefineConstantsSwitch(base.DefineConstants));
            this.AddReferencesToCommandLine(commandLine);
            commandLine.AppendSwitchIfNotNull("/win32resource:", base.Win32Resource);
            if (string.Compare("Sub Main", base.MainEntryPoint, StringComparison.OrdinalIgnoreCase) != 0)
            {
                commandLine.AppendSwitchIfNotNull("/main:", base.MainEntryPoint);
            }
            base.AddResponseFileCommands(commandLine);
            commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", new char[] { ';', ',' });
            commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", new char[] { ';', ',' });
            if (base.ResponseFiles != null)
            {
                foreach (ITaskItem item in base.ResponseFiles)
                {
                    commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
                }
            }
        }
 private void GenerateResGenCommandLineWithoutResources(CommandLineBuilderExtension resGenCommand)
 {
     Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInternalNull(resGenCommand, "resGenCommand");
     if (this.UseSourcePath)
     {
         resGenCommand.AppendSwitch("/useSourcePath");
     }
     if (this.PublicClass)
     {
         resGenCommand.AppendSwitch("/publicClass");
     }
     if (this.References != null)
     {
         foreach (ITaskItem item in this.References)
         {
             resGenCommand.AppendSwitchIfNotNull("/r:", item);
         }
     }
 }
예제 #29
0
파일: Jar.cs 프로젝트: Kav2018/JavaForVS
        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);
        }
 private void GenerateResGenCommands(CommandLineBuilderExtension resGenArguments, bool useForResponseFile)
 {
     resGenArguments = resGenArguments ?? new CommandLineBuilderExtension();
     if (IsNullOrEmpty(this.OutputFiles))
     {
         this.GenerateOutputFileNames();
     }
     string switchName = "/useSourcePath" + (useForResponseFile ? "\n" : string.Empty);
     string str2 = "/publicClass" + (useForResponseFile ? "\n" : string.Empty);
     resGenArguments.AppendWhenTrue(switchName, base.Bag, "UseSourcePath");
     resGenArguments.AppendWhenTrue(str2, base.Bag, "PublicClass");
     if (this.References != null)
     {
         foreach (ITaskItem item in this.References)
         {
             if (useForResponseFile && (item != null))
             {
                 resGenArguments.AppendTextUnquoted("/r:");
                 resGenArguments.AppendTextUnquoted(item.ItemSpec);
                 resGenArguments.AppendTextUnquoted("\n");
             }
             else
             {
                 resGenArguments.AppendSwitchIfNotNull("/r:", item);
             }
         }
     }
     if (string.IsNullOrEmpty(this.StronglyTypedLanguage))
     {
         resGenArguments.AppendSwitch("/compile" + (useForResponseFile ? "\n" : string.Empty));
         if ((this.InputFiles != null) && (this.InputFiles.Length > 0))
         {
             ITaskItem[] inputFiles = this.InputFiles;
             ITaskItem[] outputFiles = this.OutputFiles;
             for (int i = 0; i < inputFiles.Length; i++)
             {
                 if (useForResponseFile)
                 {
                     if ((inputFiles[i] != null) && (outputFiles[i] != null))
                     {
                         resGenArguments.AppendTextUnquoted(inputFiles[i].ItemSpec);
                         resGenArguments.AppendTextUnquoted(",");
                         resGenArguments.AppendTextUnquoted(outputFiles[i].ItemSpec);
                         resGenArguments.AppendTextUnquoted("\n");
                     }
                 }
                 else
                 {
                     resGenArguments.AppendFileNamesIfNotNull(new ITaskItem[] { inputFiles[i], outputFiles[i] }, ",");
                 }
             }
         }
     }
     else
     {
         resGenArguments.AppendFileNamesIfNotNull(this.InputFiles, " ");
         resGenArguments.AppendFileNamesIfNotNull(this.OutputFiles, " ");
         resGenArguments.AppendSwitchIfNotNull("/str:", new string[] { this.StronglyTypedLanguage, this.StronglyTypedNamespace, this.StronglyTypedClassName, this.StronglyTypedFileName }, ",");
     }
 }
예제 #31
0
            /// <summary>
            /// Generate the command line to be passed to resgen.exe, sans the path to the tool.
            /// </summary>
            private void GenerateResGenCommands(CommandLineBuilderExtension resGenArguments, bool useForResponseFile)
            {
                resGenArguments = resGenArguments ?? new CommandLineBuilderExtension();

                if (ResGen.IsNullOrEmpty(OutputFiles))
                {
                    GenerateOutputFileNames();
                }

                // Append boolean flags if requested
                string useSourcePathSwitch = "/useSourcePath" + (useForResponseFile ? "\n" : String.Empty);
                string publicClassSwitch   = "/publicClass" + (useForResponseFile ? "\n" : String.Empty);

                resGenArguments.AppendWhenTrue(useSourcePathSwitch, Bag, "UseSourcePath");
                resGenArguments.AppendWhenTrue(publicClassSwitch, Bag, "PublicClass");

                // append the references, if any
                if (References != null)
                {
                    foreach (ITaskItem reference in References)
                    {
                        // ResGen.exe response files frown on quotes in filenames, even if there are
                        // spaces in the names of the files.
                        if (useForResponseFile && reference != null)
                        {
                            resGenArguments.AppendTextUnquoted("/r:");
                            resGenArguments.AppendTextUnquoted(reference.ItemSpec);
                            resGenArguments.AppendTextUnquoted("\n");
                        }
                        else
                        {
                            resGenArguments.AppendSwitchIfNotNull("/r:", reference);
                        }
                    }
                }

                if (String.IsNullOrEmpty(StronglyTypedLanguage))
                {
                    // append the compile switch
                    resGenArguments.AppendSwitch("/compile" + (useForResponseFile ? "\n" : String.Empty));

                    // append the resources to compile
                    if (InputFiles != null && InputFiles.Length > 0)
                    {
                        ITaskItem[] inputFiles  = InputFiles;
                        ITaskItem[] outputFiles = OutputFiles;

                        for (int i = 0; i < inputFiles.Length; ++i)
                        {
                            if (useForResponseFile)
                            {
                                // ResGen.exe response files frown on quotes in filenames, even if there are
                                // spaces in the names of the files.
                                if (inputFiles[i] != null && outputFiles[i] != null)
                                {
                                    resGenArguments.AppendTextUnquoted(inputFiles[i].ItemSpec);
                                    resGenArguments.AppendTextUnquoted(",");
                                    resGenArguments.AppendTextUnquoted(outputFiles[i].ItemSpec);
                                    resGenArguments.AppendTextUnquoted("\n");
                                }
                            }
                            else
                            {
                                resGenArguments.AppendFileNamesIfNotNull
                                (
                                    new ITaskItem[] { inputFiles[i], outputFiles[i] },
                                    ","
                                );
                            }
                        }
                    }
                }
                else
                {
                    // append the resource to compile
                    resGenArguments.AppendFileNamesIfNotNull(InputFiles, " ");
                    resGenArguments.AppendFileNamesIfNotNull(OutputFiles, " ");

                    // append the strongly-typed resource details
                    resGenArguments.AppendSwitchIfNotNull
                    (
                        "/str:",
                        new string[] { StronglyTypedLanguage, StronglyTypedNamespace, StronglyTypedClassName, StronglyTypedFileName },
                        ","
                    );
                }
            }
예제 #32
0
        protected internal override void AddResponseFileCommands(
            CommandLineBuilderExtension commandLine)
        {
            base.AddResponseFileCommands(commandLine);

            commandLine.AppendSwitchIfNotNull("/libpath:", AdditionalLibPaths, ",");

            commandLine.AppendSwitchIfNotNull("/baseaddress:", BaseAddress);

            if (DefineConstants != null)
            {
                commandLine.AppendSwitchUnquotedIfNotNull("/define:",
                                                          String.Format("\"{0}\"", EscapeDoubleQuotes(DefineConstants)));
            }

            // DisabledWarnings

            commandLine.AppendSwitchIfNotNull("/doc:", DocumentationFile);

            // ErrorReport

            // GenerateDocumentation

            if (Imports != null)
            {
                foreach (ITaskItem item in Imports)
                {
                    commandLine.AppendSwitchIfNotNull("/imports:", item.ItemSpec);
                }
            }

            commandLine.AppendSwitchIfNotNull("/main:", MainEntryPoint);

            // NoStandardLib

            if (NoWarnings)
            {
                commandLine.AppendSwitch("/nowarn");
            }

            commandLine.AppendSwitchIfNotNull("/optioncompare:", OptionCompare);

            if (Bag ["OptionExplicit"] != null)
            {
                if (OptionExplicit)
                {
                    commandLine.AppendSwitch("/optionexplicit+");
                }
                else
                {
                    commandLine.AppendSwitch("/optionexplicit-");
                }
            }

            if (Bag ["OptionStrict"] != null)
            {
                if (OptionStrict)
                {
                    commandLine.AppendSwitch("/optionstrict+");
                }
                else
                {
                    commandLine.AppendSwitch("/optionstrict-");
                }
            }

            // OptionStrictType

            // Platform

            if (References != null)
            {
                foreach (ITaskItem item in References)
                {
                    commandLine.AppendSwitchIfNotNull("/reference:", item.ItemSpec);
                }
            }

            if (Bag ["RemoveIntegerChecks"] != null)
            {
                if (RemoveIntegerChecks)
                {
                    commandLine.AppendSwitch("/removeintchecks+");
                }
                else
                {
                    commandLine.AppendSwitch("/removeintchecks-");
                }
            }

            if (ResponseFiles != null)
            {
                foreach (ITaskItem item in ResponseFiles)
                {
                    commandLine.AppendFileNameIfNotNull(String.Format("@{0}", item.ItemSpec));
                }
            }

            commandLine.AppendSwitchIfNotNull("/rootnamespace:", RootNamespace);

            commandLine.AppendSwitchIfNotNull("/sdkpath:", SdkPath);

            // TargetCompactFramework

            // Verbosity

            // WarningsAsErrors

            // WarningsNotAsErrors
        }
예제 #33
0
파일: Skc.cs 프로젝트: benbon/SharpKit
        protected override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
        {
            if (OutputGeneratedFile != null && !String.IsNullOrEmpty(OutputGeneratedFile.ItemSpec))
                commandLine.AppendSwitchIfNotNull("/outputgeneratedfile:", OutputGeneratedFile);
            commandLine.AppendSwitchUnquotedIfNotNull("/define:", this.GetDefineConstantsSwitch(base.DefineConstants));
            this.AddReferencesToCommandLine(commandLine);
            base.AddResponseFileCommands(commandLine);
            if (ResponseFiles != null)
            {
                foreach (ITaskItem item in ResponseFiles)
                {
                    commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
                }
            }
            if (ContentFiles != null)
            {
                foreach (var file in ContentFiles)
                {
                    commandLine.AppendSwitchIfNotNull("/contentfile:", file.ItemSpec);
                }
            }
            if (NoneFiles != null)
            {
                foreach (var file in NoneFiles)
                {
                    commandLine.AppendSwitchIfNotNull("/nonefile:", file.ItemSpec);
                }
            }
            if (SkcPlugins != null)
            {
                foreach (var file in SkcPlugins)
                {
                    commandLine.AppendSwitchIfNotNull("/plugin:", file.ItemSpec);
                }
            }
            if (SkcRebuild)
                commandLine.AppendSwitch("/rebuild");
            if (UseBuildService)
            {
                Log.LogMessage("CurrentDirectory is: " + Directory.GetCurrentDirectory());
                commandLine.AppendSwitchIfNotNull("/dir:", Directory.GetCurrentDirectory());
            }

            commandLine.AppendSwitchIfNotNull("/TargetFrameworkVersion:", TargetFrameworkVersion);
        }
예제 #34
0
파일: Exec.cs 프로젝트: rmboggs/msbuild
        /// <summary>
        /// Adds the arguments for cmd.exe
        /// </summary>
        /// <param name="commandLine">command line builder class to add arguments to</param>
        protected internal override void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            // Create the batch file now,
            // so we have the file name for the cmd.exe command line
            CreateTemporaryBatchFile();

            string batchFileForCommandLine = _batchFile;
            commandLine.AppendSwitch("/Q");      // echo off
            commandLine.AppendSwitch("/C");      // run then terminate

            // If for some crazy reason the path has a & character and a space in it
            // then get the short path of the temp path, which should not have spaces in it
            // and then escape the &
            if (batchFileForCommandLine.Contains("&") && !batchFileForCommandLine.Contains("^&"))
            {
                batchFileForCommandLine = NativeMethodsShared.GetShortFilePath(batchFileForCommandLine);
                batchFileForCommandLine = batchFileForCommandLine.Replace("&", "^&");
            }

            commandLine.AppendFileNameIfNotNull(batchFileForCommandLine);
        }
예제 #35
0
		protected internal override void AddResponseFileCommands (CommandLineBuilderExtension commandLine)
		{
			base.AddResponseFileCommands (commandLine);

			if (AdditionalLibPaths != null && AdditionalLibPaths.Length > 0)
				commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");

			if (Bag ["AllowUnsafeBlocks"] != null)
				if (AllowUnsafeBlocks)
					commandLine.AppendSwitch ("/unsafe+");
				else
					commandLine.AppendSwitch ("/unsafe-");

			//baseAddress
			
			if (Bag ["CheckForOverflowUnderflow"] != null)
				if (CheckForOverflowUnderflow)
					commandLine.AppendSwitch ("/checked+");
				else
					commandLine.AppendSwitch ("/checked-");

			if (!String.IsNullOrEmpty (DefineConstants)) {
				string [] defines = DefineConstants.Split (new char [] {';', ' '},
						StringSplitOptions.RemoveEmptyEntries);
				if (defines.Length > 0)
					commandLine.AppendSwitchUnquotedIfNotNull ("/define:",
							String.Join (";", defines));
			}

			commandLine.AppendSwitchIfNotNull ("/nowarn:", DisabledWarnings);

			commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);

			//errorReport

			if (GenerateFullPaths)
				commandLine.AppendSwitch ("/fullpaths");

			commandLine.AppendSwitchIfNotNull ("/langversion:", LangVersion);

			commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);

			//moduleAssemblyName
			
			if (NoStandardLib)
				commandLine.AppendSwitch ("/nostdlib");

			//platform
			//
			if (References != null)
				foreach (ITaskItem item in References)
					commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);

			if (ResponseFiles != null)
				foreach (ITaskItem item in ResponseFiles) 
					commandLine.AppendSwitchIfNotNull ("@", item.ItemSpec);

			if (Bag ["WarningLevel"] != null)
				commandLine.AppendSwitchIfNotNull ("/warn:", WarningLevel.ToString ());

			commandLine.AppendSwitchIfNotNull ("/warnaserror+:", WarningsAsErrors);

			commandLine.AppendSwitchIfNotNull ("/warnaserror-:", WarningsNotAsErrors);

			if (Win32Resource != null)
				commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
		}
예제 #36
0
파일: Vbc.cs 프로젝트: Profit0004/mono
		protected internal override void AddResponseFileCommands (
				CommandLineBuilderExtension commandLine )
		{
			base.AddResponseFileCommands (commandLine);

			commandLine.AppendSwitchIfNotNull ("/libpath:", AdditionalLibPaths, ",");

			commandLine.AppendSwitchIfNotNull ("/baseaddress:", BaseAddress);

			if (DefineConstants != null)
				commandLine.AppendSwitchUnquotedIfNotNull ("/define:",
						String.Format ("\"{0}\"", EscapeDoubleQuotes (DefineConstants)));

			// DisabledWarnings

			commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);

			// ErrorReport
			
			// GenerateDocumentation
			
			if (Imports != null)
				foreach (ITaskItem item in Imports)
					commandLine.AppendSwitchIfNotNull ("/imports:", item.ItemSpec);
			
			commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);

			// NoStandardLib
			if (Bag ["NoStandardLib"] != null && NoStandardLib)
				commandLine.AppendSwitch ("/nostdlib");
			
			if (NoWarnings)
				commandLine.AppendSwitch ("/nowarn");

			commandLine.AppendSwitchIfNotNull ("/optioncompare:", OptionCompare);

			if (Bag ["OptionExplicit"] != null)
				if (OptionExplicit)
					commandLine.AppendSwitch ("/optionexplicit+");
				else
					commandLine.AppendSwitch ("/optionexplicit-");

			if (Bag ["OptionStrict"] != null)
				if (OptionStrict)
					commandLine.AppendSwitch ("/optionstrict+");
				else
					commandLine.AppendSwitch ("/optionstrict-");

			if (Bag ["OptionInfer"] != null)
				if (OptionInfer)
					commandLine.AppendSwitch ("/optioninfer+");
				else
					commandLine.AppendSwitch ("/optioninfer-");

			// OptionStrictType
			
			// Platform
			
			if (References != null)
				foreach (ITaskItem item in References)
					commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
	
			if (Bag ["RemoveIntegerChecks"] != null)
				if (RemoveIntegerChecks)
					commandLine.AppendSwitch ("/removeintchecks+");
				else
					commandLine.AppendSwitch ("/removeintchecks-");

			if (ResponseFiles != null)
				foreach (ITaskItem item in ResponseFiles)
					commandLine.AppendFileNameIfNotNull (String.Format ("@{0}", item.ItemSpec));

			commandLine.AppendSwitchIfNotNull ("/rootnamespace:", RootNamespace);

			commandLine.AppendSwitchIfNotNull ("/sdkpath:", SdkPath);

			// TargetCompactFramework

			if (String.Compare (VBRuntime, "Embed", StringComparison.OrdinalIgnoreCase) == 0) 
				commandLine.AppendSwitch ("/vbruntime*");
			
			// Verbosity

			// WarningsAsErrors

			// WarningsNotAsErrors

		}
예제 #37
0
파일: Javac.cs 프로젝트: Kav2018/JavaForVS
        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, " ");
        }
예제 #38
0
		protected internal override void AddResponseFileCommands (
						 CommandLineBuilderExtension commandLine)
		{
			if (AddModules != null && AddModules.Length > 0)
				commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ",");
			if (Bag ["CodePage"] != null)
				commandLine.AppendSwitchIfNotNull ("/codepage:", CodePage.ToString ());

			commandLine.AppendSwitchIfNotNull ("/debug:", DebugType);

			if (Bag ["DelaySign"] != null)
				if (DelaySign)
					commandLine.AppendSwitch ("/delaysign+");
				else
					commandLine.AppendSwitch ("/delaysign-");
			if (Bag ["EmitDebugInformation"] != null)
				if (EmitDebugInformation)
					commandLine.AppendSwitch ("/debug+");
				else
					commandLine.AppendSwitch ("/debug-");
			//fileAlignment
			commandLine.AppendSwitchIfNotNull ("/keycontainer:", KeyContainer);
			commandLine.AppendSwitchIfNotNull ("/keyfile:", KeyFile);
			// FIXME: add ids from metadata
			if (LinkResources != null)
				foreach (ITaskItem item in LinkResources)
						commandLine.AppendSwitchIfNotNull ("/linkresource:", item.ItemSpec);
			
			if (NoLogo)
				commandLine.AppendSwitch ("/nologo");

			if (Bag ["Optimize"] != null)
				if (Optimize)
					commandLine.AppendSwitch ("/optimize+");
				else
					commandLine.AppendSwitch ("/optimize-");

			if (OutputAssembly != null)
				commandLine.AppendSwitchIfNotNull ("/out:", OutputAssembly.ItemSpec);
			
			if (Resources != null)
				foreach (ITaskItem item in Resources) {
					string logical_name = item.GetMetadata ("LogicalName");
					if (logical_name.Length > 0)
						commandLine.AppendSwitchIfNotNull ("/resource:",
								String.Format ("{0},{1}", item.ItemSpec, logical_name));
					else
						commandLine.AppendSwitchIfNotNull ("/resource:", item.ItemSpec);
				}

			if (Sources != null)
				foreach (ITaskItem item in Sources)
						commandLine.AppendFileNameIfNotNull (item.ItemSpec);
			
			if (TargetType != null)
				commandLine.AppendSwitchIfNotNull ("/target:", TargetType);
			if (Bag ["TreatWarningsAsErrors"] != null)
				if (TreatWarningsAsErrors)
					commandLine.AppendSwitch ("/warnaserror+");
				else
					commandLine.AppendSwitch ("/warnaserror-");
			commandLine.AppendSwitchIfNotNull ("/win32icon:", Win32Icon);
		}
 protected internal override void AddResponseFileCommands(CommandLineBuilderExtension commandLine)
 {
     commandLine.AppendSwitchIfNotNull("/baseaddress:", this.GetBaseAddressInHex());
     commandLine.AppendSwitchIfNotNull("/libpath:", base.AdditionalLibPaths, ",");
     commandLine.AppendSwitchIfNotNull("/imports:", this.Imports, ",");
     commandLine.AppendPlusOrMinusSwitch("/doc", base.Bag, "GenerateDocumentation");
     commandLine.AppendSwitchIfNotNull("/optioncompare:", this.OptionCompare);
     commandLine.AppendPlusOrMinusSwitch("/optionexplicit", base.Bag, "OptionExplicit");
     object obj2 = base.Bag["OptionStrict"];
     if ((obj2 != null) ? ((bool) obj2) : false)
     {
         commandLine.AppendSwitch("/optionstrict+");
     }
     else
     {
         commandLine.AppendSwitch("/optionstrict:custom");
     }
     commandLine.AppendSwitchIfNotNull("/optionstrict:", this.OptionStrictType);
     commandLine.AppendWhenTrue("/nowarn", base.Bag, "NoWarnings");
     commandLine.AppendSwitchWithSplitting("/nowarn:", this.DisabledWarnings, ",", new char[] { ';', ',' });
     commandLine.AppendPlusOrMinusSwitch("/optioninfer", base.Bag, "OptionInfer");
     commandLine.AppendWhenTrue("/nostdlib", base.Bag, "NoStandardLib");
     commandLine.AppendWhenTrue("/novbruntimeref", base.Bag, "NoVBRuntimeReference");
     commandLine.AppendSwitchIfNotNull("/errorreport:", this.ErrorReport);
     commandLine.AppendSwitchIfNotNull("/platform:", this.Platform);
     commandLine.AppendPlusOrMinusSwitch("/removeintchecks", base.Bag, "RemoveIntegerChecks");
     commandLine.AppendSwitchIfNotNull("/rootnamespace:", this.RootNamespace);
     commandLine.AppendSwitchIfNotNull("/sdkpath:", this.SdkPath);
     commandLine.AppendSwitchIfNotNull("/langversion:", this.LangVersion);
     commandLine.AppendSwitchIfNotNull("/moduleassemblyname:", this.ModuleAssemblyName);
     commandLine.AppendWhenTrue("/netcf", base.Bag, "TargetCompactFramework");
     if (this.VBRuntime != null)
     {
         string vBRuntime = this.VBRuntime;
         if (string.Compare(vBRuntime, "EMBED", StringComparison.OrdinalIgnoreCase) == 0)
         {
             commandLine.AppendSwitch("/vbruntime*");
         }
         else if (string.Compare(vBRuntime, "NONE", StringComparison.OrdinalIgnoreCase) == 0)
         {
             commandLine.AppendSwitch("/vbruntime-");
         }
         else if (string.Compare(vBRuntime, "DEFAULT", StringComparison.OrdinalIgnoreCase) == 0)
         {
             commandLine.AppendSwitch("/vbruntime+");
         }
         else
         {
             commandLine.AppendSwitchIfNotNull("/vbruntime:", vBRuntime);
         }
     }
     if ((this.Verbosity != null) && ((string.Compare(this.Verbosity, "quiet", StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(this.Verbosity, "verbose", StringComparison.OrdinalIgnoreCase) == 0)))
     {
         commandLine.AppendSwitchIfNotNull("/", this.Verbosity);
     }
     commandLine.AppendSwitchIfNotNull("/doc:", this.DocumentationFile);
     commandLine.AppendSwitchUnquotedIfNotNull("/define:", GetDefineConstantsSwitch(base.DefineConstants));
     this.AddReferencesToCommandLine(commandLine);
     commandLine.AppendSwitchIfNotNull("/win32resource:", base.Win32Resource);
     if (string.Compare("Sub Main", base.MainEntryPoint, StringComparison.OrdinalIgnoreCase) != 0)
     {
         commandLine.AppendSwitchIfNotNull("/main:", base.MainEntryPoint);
     }
     base.AddResponseFileCommands(commandLine);
     commandLine.AppendSwitchWithSplitting("/warnaserror+:", this.WarningsAsErrors, ",", new char[] { ';', ',' });
     commandLine.AppendSwitchWithSplitting("/warnaserror-:", this.WarningsNotAsErrors, ",", new char[] { ';', ',' });
     if (base.ResponseFiles != null)
     {
         foreach (ITaskItem item in base.ResponseFiles)
         {
             commandLine.AppendSwitchIfNotNull("@", item.ItemSpec);
         }
     }
 }
예제 #40
0
        protected internal override void AddResponseFileCommands(
            CommandLineBuilderExtension commandLine)
        {
            if (AddModules != null && AddModules.Length > 0)
            {
                commandLine.AppendSwitchIfNotNull("/addmodule:", AddModules, ",");
            }
            if (Bag ["CodePage"] != null)
            {
                commandLine.AppendSwitchIfNotNull("/codepage:", CodePage.ToString());
            }

            commandLine.AppendSwitchIfNotNull("/debug:", DebugType);

            if (Bag ["DelaySign"] != null)
            {
                if (DelaySign)
                {
                    commandLine.AppendSwitch("/delaysign+");
                }
                else
                {
                    commandLine.AppendSwitch("/delaysign-");
                }
            }
            if (Bag ["EmitDebugInformation"] != null)
            {
                if (EmitDebugInformation)
                {
                    commandLine.AppendSwitch("/debug+");
                }
                else
                {
                    commandLine.AppendSwitch("/debug-");
                }
            }
            //fileAlignment
            commandLine.AppendSwitchIfNotNull("/keycontainer:", KeyContainer);
            commandLine.AppendSwitchIfNotNull("/keyfile:", KeyFile);
            // FIXME: add ids from metadata
            if (LinkResources != null)
            {
                foreach (ITaskItem item in LinkResources)
                {
                    commandLine.AppendSwitchIfNotNull("/linkresource:", item.ItemSpec);
                }
            }

            if (NoLogo)
            {
                commandLine.AppendSwitch("/nologo");
            }

            if (Bag ["Optimize"] != null)
            {
                if (Optimize)
                {
                    commandLine.AppendSwitch("/optimize+");
                }
                else
                {
                    commandLine.AppendSwitch("/optimize-");
                }
            }

            if (OutputAssembly != null)
            {
                commandLine.AppendSwitchIfNotNull("/out:", OutputAssembly.ItemSpec);
            }

            if (Resources != null)
            {
                foreach (ITaskItem item in Resources)
                {
                    string logical_name = item.GetMetadata("LogicalName");
                    if (logical_name.Length > 0)
                    {
                        commandLine.AppendSwitchIfNotNull("/resource:",
                                                          String.Format("{0},{1}", item.ItemSpec, logical_name));
                    }
                    else
                    {
                        commandLine.AppendSwitchIfNotNull("/resource:", item.ItemSpec);
                    }
                }
            }

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

            if (TargetType != null)
            {
                commandLine.AppendSwitchIfNotNull("/target:", TargetType);
            }
            if (Bag ["TreatWarningsAsErrors"] != null)
            {
                if (TreatWarningsAsErrors)
                {
                    commandLine.AppendSwitch("/warnaserror+");
                }
                else
                {
                    commandLine.AppendSwitch("/warnaserror-");
                }
            }
            commandLine.AppendSwitchIfNotNull("/win32icon:", Win32Icon);
        }
예제 #41
0
        private void AddCommandLineCommands(CommandLineBuilderExtension commandLine)
        {
            string outputDirectory = Path.GetDirectoryName(this.OutputFile);

            if(!Directory.Exists( outputDirectory ))
                Directory.CreateDirectory( outputDirectory );

            commandLine.AppendSwitch( "-q" );
            if (m_inputDirectories != null)
            {
                commandLine.AppendSwitch("-r");
            }
            commandLine.AppendFileNameIfNotNull( this.m_outputFile );

            if (m_inputFiles != null)
            {
                foreach (ITaskItem inputFile in InputFiles)
                {
                    Log.LogMessage("Adding file {0}", inputFile.ItemSpec);
                    commandLine.AppendFileNameIfNotNull(inputFile.ItemSpec);
                }
            }

            if (m_inputDirectories != null)
            {
                foreach (ITaskItem inputDirectory in InputDirectories)
                {
                    Log.LogMessage("Adding directory {0}", inputDirectory.ItemSpec);
                    commandLine.AppendFileNameIfNotNull(inputDirectory.ItemSpec);
                }
            }
        }