Ejemplo n.º 1
0
        private static ITargetDescription _loadStdlib()
        {
            Trace.CorrelationManager.StartLogicalOperation("Load stdlib");
            try
            {
                var primName = new ModuleName("prx.prim", new Version(0, 0));
                var primDesc = Cache.CreateDescription(primName, Source.FromString(Resources.prx_prim),
                    "prxlib/prx.prim.pxs", Enumerable.Empty<ModuleName>());
                Cache.TargetDescriptions.Add(primDesc);

                var coreName = new ModuleName("prx.core", new Version(0, 0));
                var coreDesc = Cache.CreateDescription(coreName, Source.FromString(Resources.prx_core),
                    "prxlib/prx.core.pxs", primName.Singleton());
                Cache.TargetDescriptions.Add(coreDesc);

                var sysName = new ModuleName("sys", new Version(0, 0));
                var desc = Cache.CreateDescription(sysName, Source.FromString(Resources.sys), "prxlib/sys.pxs",
                    new[]{ primName, coreName });
                Cache.TargetDescriptions.Add(desc);

                Cache.Build(sysName);
                return Cache.TargetDescriptions[sysName];
            }
            finally
            {
                Trace.CorrelationManager.StopLogicalOperation();
                _trace.Flush();
            }
        }
Ejemplo n.º 2
0
 public static Task<ITarget> BuildAsync(this IPlan plan, ModuleName name, CancellationToken token)
 {
     var buildTasks = plan.BuildAsync(name.Singleton(), token);
     Debug.Assert(buildTasks.Count == 1,"Expected build task dictionary for a single module to only contain a single task.");
     return buildTasks[name];
 }