public NativeApiInfoProvider( ISourceFileProvider sourceFileProvider, INativeApiInfoResolver nativeApiInfoResolver) { _sourceFileProvider = sourceFileProvider; _nativeApiInfoResolver = nativeApiInfoResolver; }
/// <summary> /// Compiles the specified module and its dependencies. /// Returns compilation diagnostics and statistics. /// </summary> /// <param name="options">Additional options, such as optimization and logging levels.</param> /// <param name="sourceFileProvider">Interface for source file access.</param> /// <param name="outputFileProvider">Interface for output file access.</param> public static CompilationResult Compile( CompilationOptions options, ISourceFileProvider sourceFileProvider, IOutputFileProvider outputFileProvider) { // TODO: Determinism (basically, compile everything in a fixed order) var compilation = new Compilation(); // Create a debug logger. If logging is not enabled, all operations do nothing. var debugLogger = new DebugLogger( options.DebugOutput ? outputFileProvider.GetDebugFileWriter() : null, options.DebugPattern); // TODO: Build the dependency graph and decide the build order var mainModule = options.MainModule; // Parse each module // TODO: Make this run in parallel ParseModule(mainModule, compilation, sourceFileProvider, out var syntaxTrees); // TODO: Compile modules only once they and their dependencies are parsed (if there were no parsing errors) // TODO: Make this parallel if (!compilation.HasErrors) { AddDeclarationsForModule(mainModule, compilation, syntaxTrees); } // After this, the module should be ready for semantic compilation in any order of methods if (!compilation.HasErrors) { debugLogger.WriteHeader("SEMANTIC COMPILATION PHASE"); CompileModule(mainModule, compilation, syntaxTrees, debugLogger); } // There must be a main method if (!compilation.HasErrors && compilation.EntryPointIndex == -1) { compilation.AddModuleLevelDiagnostic(DiagnosticCode.NoEntryPointProvided, mainModule); } // TODO: Run the optimizer if enabled // Generate code if (!compilation.HasErrors) { var outputStream = outputFileProvider.GetExecutableStream(); var disassemblyWriter = options.EmitDisassembly ? outputFileProvider.GetDisassemblyWriter() : null; if (outputStream is null || (options.EmitDisassembly && disassemblyWriter is null)) { // TODO: Also include the failed file name compilation.AddModuleLevelDiagnostic(DiagnosticCode.CouldNotCreateOutputFile, mainModule); } else { debugLogger.WriteHeader("CODE GENERATION PHASE"); GenerateCode(compilation, outputStream, disassemblyWriter, debugLogger); } }
public MpqJob( IHttpApiInputModelsGenerator httpApiInputModelsGenerator, INativeApiInfoProvider nativeApiInfoProvider, ISourceFileProvider sourceFileProvider) { _httpApiInputModelsGenerator = httpApiInputModelsGenerator; _nativeApiInfoProvider = nativeApiInfoProvider; _sourceFileProvider = sourceFileProvider; }
public CqpJob( IApiHandlerGenerator apiHandlerGenerator, INativeApiInfoProvider nativeApiInfoProvider, ISourceFileProvider sourceFileProvider) { _apiHandlerGenerator = apiHandlerGenerator; _nativeApiInfoProvider = nativeApiInfoProvider; _sourceFileProvider = sourceFileProvider; }
public QQLightJob( ISourceFileProvider sourceFileProvider, IApiHandlerGenerator apiHandlerGenerator, INativeApiInfoProvider nativeApiInfoProvider) { _sourceFileProvider = sourceFileProvider; _apiHandlerGenerator = apiHandlerGenerator; _nativeApiInfoProvider = nativeApiInfoProvider; }
public override void SetUp() { base.SetUp(); _provider = Mocker.DynamicMock <ISourceFileProvider>(); _files = new List <String>(); _files.Add(@"C:\src\main\Alpha.cs"); _files.Add(@"C:\src\main\Bravo.cs"); _files.Add(@"C:\src\main\Program.cs"); _files.Add(@"C:\src\main\AssemblyInfo.cs"); _files.Add(@"C:\src\test\Test.Designer.cs"); }
/// <summary> /// Creates a new instance of this class /// </summary> /// <param name="projectFile">The project file</param> /// <param name="provider">The source file provider</param> public CalidusProject(String projectFile, ISourceFileProvider provider) { _provider = provider; _file = projectFile; IgnoreAssemblyFiles = true; IgnoreDesignerFiles = true; IgnoreProgramFiles = true; _ignoredFiles = new List <String>(); _ruleConfigurations = new List <IRuleConfigurationOverride>(); }
/// <summary> /// Adds (if not already present) the specified <paramref name="memberInfo"/> to the /// cache associating members with their declaring file. /// </summary> /// <param name="memberInfo">The <see cref="MemberInfo"/> to cache.</param> /// <param name="provider">The implementation-specific provider to invoke if do not already have in cache.</param> private void AddMemberInfoToCache(MemberInfo memberInfo, ISourceFileProvider provider) { Debug.Assert(provider != null, "provider is required"); // Each MemberInfo is checked at most once, regardless which Type discovers it if (!this._fileIdsByMemberInfo.ContainsKey(memberInfo)) { // Invoke the implementation specific code to locate the file string fileName = provider.GetFileForMember(memberInfo); // To permit multiple providers weighing in with better information // later, we do not cache the misses yet if (!string.IsNullOrEmpty(fileName)) { // Assign it a unique ID and cache it by ID int id = this._filenameMap.AddOrGet(fileName); // Associate this memberInfo with that ID this._fileIdsByMemberInfo[memberInfo] = id; } } }
public SyncOrchestrator(ISourceFileProvider sourceFileProvider, IGoogleDriveService googleDriveService, ILog log) { _log = log; _googleDriveService = googleDriveService; _sourceFileProvider = sourceFileProvider; }