コード例 #1
0
        protected override string GenerateCommandLineCommands()
        {
#if DEBUG
            if (System.Environment.GetEnvironmentVariable("DEBUG_EMITTER_TASK") == "1")
            {
                System.Diagnostics.Debugger.Launch();
            }
#endif

            var builder = new CommandLineBuilder();
            builder.AppendFileNameIfNotNull(Path.Combine(this.ToolsBinDir, "ClangSharpSourceToWinmd.dll"));

            string interopPath    = Path.Combine(this.Win32WinmdBinDir, "Windows.Win32.Interop.dll");
            string win32WinmdPath = Path.Combine(this.Win32WinmdBinDir, "Windows.Win32.winmd");

            this.outputWinmdFullPath = this.OutputWinmd;
            if (!Path.IsPathRooted(this.outputWinmdFullPath))
            {
                this.outputWinmdFullPath = Path.GetFullPath(Path.Combine(this.MSBuildProjectDirectory, this.outputWinmdFullPath));
            }

            builder.AppendSwitchIfNotNull("--sourceDir ", this.EmitterSourceDir);
            builder.AppendSwitchIfNotNull("--arch ", "crossarch");
            builder.AppendSwitchIfNotNull("--interopFileName ", interopPath);

            if (!StringComparer.OrdinalIgnoreCase.Equals(
                    Path.GetFileName(this.outputWinmdFullPath),
                    Path.GetFileName(win32WinmdPath)))
            {
                builder.AppendSwitchIfNotNull("--ref ", win32WinmdPath);
            }

            builder.AppendSwitchIfNotNull("--version ", this.WinmdVersion);
            builder.AppendSwitchIfNotNull("--outputFileName ", this.outputWinmdFullPath);

            foreach (var autoTypeJson in TaskUtils.GetFullPaths(this.AutoTypes, this.MSBuildProjectDirectory))
            {
                if (File.Exists(autoTypeJson))
                {
                    builder.AppendSwitchIfNotNull("--autoTypes ", autoTypeJson);
                }
            }

            IEnumerable <string> rspFiles = TaskUtils.GetFullPaths(this.ResponseFiles, this.MSBuildProjectDirectory);
            foreach (var rspFile in rspFiles)
            {
                if (File.Exists(rspFile))
                {
                    builder.AppendRspFile(rspFile);
                }
            }

            return(builder.ToString());
        }