/// <inheritdoc cref="IDScriptWorkspaceModuleResolver" /> public bool TryInitialize([NotNull] FrontEndHost host, [NotNull] FrontEndContext context, [NotNull] IConfiguration configuration, [NotNull] IResolverSettings resolverSettings, [NotNull] QualifierId[] requestedQualifiers) { InitializeInterpreter(host, context, configuration); m_resolverSettings = resolverSettings as INinjaResolverSettings; Contract.Assert(m_resolverSettings != null); return(TryInitializeWorkspaceValues()); }
/// <inheritdoc /> /// <summary> /// Initializes the workspace resolver /// </summary> public bool TryInitialize( FrontEndHost host, FrontEndContext context, IConfiguration configuration, IResolverSettings resolverSettings, QualifierId[] requestedQualifiers) { m_host = host; m_context = context; m_resolverSettings = resolverSettings as INinjaResolverSettings; Contract.Assert(m_resolverSettings != null); var relativePathToGraphConstructionTool = RelativePath.Create(context.StringTable, NinjaGraphBuilderRelativePath); m_pathToTool = configuration.Layout.BuildEngineDirectory.Combine(m_context.PathTable, relativePathToGraphConstructionTool); if (!m_resolverSettings.ProjectRoot.IsValid) { if (!m_resolverSettings.SpecFile.IsValid) { Tracing.Logger.Log.InvalidResolverSettings(m_context.LoggingContext, m_resolverSettings.Location(m_context.PathTable), "Either a project root or a spec file location (or both) must be specified."); return(false); } ProjectRoot = m_resolverSettings.SpecFile.GetParent(m_context.PathTable); SpecFile = m_resolverSettings.SpecFile; } else { ProjectRoot = m_resolverSettings.ProjectRoot; SpecFile = m_resolverSettings.SpecFile; if (!m_resolverSettings.SpecFile.IsValid) { SpecFile = ProjectRoot.Combine(m_context.PathTable, "build.ninja"); } } string path; if (!Directory.Exists(path = ProjectRoot.ToString(m_context.PathTable))) { Tracing.Logger.Log.ProjectRootDirectoryDoesNotExist(m_context.LoggingContext, m_resolverSettings.Location(m_context.PathTable), path); return(false); } if (!File.Exists(path = SpecFile.ToString(m_context.PathTable))) { Tracing.Logger.Log.NinjaSpecFileDoesNotExist(m_context.LoggingContext, m_resolverSettings.Location(m_context.PathTable), path); return(false); } m_targets = m_resolverSettings.Targets != null?m_resolverSettings.Targets.AsArray() : CollectionUtilities.EmptyArray <string>(); return(true); }
/// <nodoc /> public NinjaResolverSettings(INinjaResolverSettings template, PathRemapper pathRemapper) : base(template, template, pathRemapper) { Targets = template.Targets; Root = pathRemapper.Remap(template.Root); ModuleName = template.ModuleName; KeepProjectGraphFile = template.KeepProjectGraphFile; SpecFile = pathRemapper.Remap(template.SpecFile); RemoveAllDebugFlags = template.RemoveAllDebugFlags; Environment = template.Environment; }
/// <nodoc /> public NinjaResolverSettings(INinjaResolverSettings template, PathRemapper pathRemapper) : base(template, pathRemapper) { Targets = template.Targets; ProjectRoot = pathRemapper.Remap(template.ProjectRoot); ModuleName = template.ModuleName; KeepToolFiles = template.KeepToolFiles; SpecFile = pathRemapper.Remap(template.SpecFile); RemoveAllDebugFlags = template.RemoveAllDebugFlags; UntrackingSettings = template.UntrackingSettings; AllowWritableSourceDirectory = template.AllowWritableSourceDirectory; }
/// <inheritdoc/> public Task <bool> InitResolverAsync(IResolverSettings resolverSettings, object workspaceResolver) { Contract.Requires(resolverSettings != null); Name = resolverSettings.Name; m_ninjaResolverSettings = resolverSettings as INinjaResolverSettings; m_ninjaWorkspaceResolver = workspaceResolver as NinjaWorkspaceResolver; // TODO: Failure cases, logging return(Task.FromResult <bool>(true)); }