예제 #1
0
        private Debuggee(ILoggingComponent logger, ICompilerSettings settings, string debuggeeName, int debuggeeMoniker, string outputName, CompilerOutputType outputType)
        {
            Parameter.ThrowIfNull(logger, nameof(logger));
            Parameter.ThrowIfNullOrWhiteSpace(debuggeeName, nameof(debuggeeName));
            Parameter.ThrowIfNegativeOrZero(debuggeeMoniker, nameof(debuggeeMoniker));
            Parameter.ThrowIfNull(settings, nameof(settings));

            this.OutputHelper            = logger.OutputHelper;
            this.compilerDefineConstants = new Dictionary <string, string>();
            this.debuggeeName            = debuggeeName;
            this.debuggeeMoniker         = debuggeeMoniker;
            this.CompilerOptions         = CompilerOption.GenerateSymbols;
            this.libraries       = new List <string>();
            this.outputType      = outputType;
            this.settings        = settings;
            this.sourceFilePaths = new List <string>();

            if (String.IsNullOrEmpty(outputName))
            {
                // If the outputName was not provided, assume it is called "a.out" and update the extension
                outputName = Debuggee.UpdateOutputName("a.out", outputType);
            }
            else if (String.IsNullOrEmpty(Path.GetExtension(outputName)))
            {
                // If the outputName has no extension, add the appropriate extension
                outputName = Debuggee.UpdateOutputName(outputName, outputType);
            }

            this.outputName = outputName;
        }
예제 #2
0
        /// <summary>
        /// Creates a new debuggee instance. This will copy the debuggee into a new folder based on the debuggeeMoniker.
        /// This should only be called once per debuggee.
        /// </summary>
        public static IDebuggee Create(ILoggingComponent logger, ICompilerSettings settings, string debuggeeName, int debuggeeMoniker, string outputName = null, CompilerOutputType outputType = CompilerOutputType.Executable)
        {
            Debuggee newDebuggee = new Debuggee(logger, settings, debuggeeName, debuggeeMoniker, outputName, outputType);

            newDebuggee.CopySource();
            return(newDebuggee);
        }
예제 #3
0
        void IDebuggee.Compile()
        {
            ICompiler compiler = Debuggee.CreateCompiler(this, this.settings);

            compiler.Compile(
                this.outputType,
                this.libraries,
                this.sourceFilePaths,
                this.OutputPath,
                this.CompilerOptions,
                this.compilerDefineConstants);
        }
예제 #4
0
        private Debuggee(Debuggee debuggee)
        {
            Parameter.ThrowIfNull(debuggee, nameof(debuggee));

            this.OutputHelper            = debuggee.OutputHelper;
            this.compilerDefineConstants = new Dictionary <string, string>(debuggee.compilerDefineConstants);
            this.debuggeeName            = debuggee.debuggeeName;
            this.debuggeeMoniker         = debuggee.debuggeeMoniker;
            this.CompilerOptions         = debuggee.CompilerOptions;
            this.libraries       = debuggee.libraries.ToList();
            this.outputName      = debuggee.outputName;
            this.outputType      = debuggee.outputType;
            this.settings        = debuggee.settings;
            this.sourceFilePaths = debuggee.sourceFilePaths.ToList();
        }