Ejemplo n.º 1
0
        public Hasher()
        {
            this.contextResolutionCache = new CachedHash <Tuple <IIncludePathContext, string, ModPart>, BuildObject>(
                delegate(Tuple <IIncludePathContext, string, ModPart> key)
            {
                return(key.Item1.search(key.Item2, key.Item3));
            });

            this.parsedIncludesCache = new CachedHash <Tuple <IIncludePathContext, BuildObject>, List <BeatIncludes.LabeledInclude> >(
                delegate(Tuple <IIncludePathContext, BuildObject> key)
            {
                return(BeatIncludes.parseLabeledIncludes(key.Item1, key.Item2));
            });
        }
Ejemplo n.º 2
0
        public Hasher()
        {
            outputToVerbMap = new Dictionary <BuildObject, IVerb>();

            _contextResolutionCache = new CachedHash <Tuple <IIncludePathContext, string, ModPart>, BuildObject>(
                delegate(Tuple <IIncludePathContext, string, ModPart> key) {
                return(key.Item1.search(key.Item2, key.Item3));
            });

            _parsedIncludesCache = new CachedHash <Tuple <IIncludePathContext, BuildObject>, List <BeatIncludes.LabeledInclude> >(
                delegate(Tuple <IIncludePathContext, BuildObject> key)
            {
                return(BeatIncludes.parseLabeledIncludes(key.Item1, key.Item2));
            });
        }
Ejemplo n.º 3
0
        private static IEnumerable <BeatIncludes.LabeledInclude> getBeatFlavoredShallowIncludesLabeled(
            IContextGeneratingVerb contextVerb, BuildObject rootObj)
        {
            ContextContents context = (ContextContents)
                                      BuildEngine.theEngine.getNuObjContents().openVirtual(contextVerb.getContextOutput());
            BeatIncludes includes = new BeatIncludes(context.context);
            OrderPreservingSet <BeatIncludes.LabeledInclude> result = new OrderPreservingSet <BeatIncludes.LabeledInclude>(
                includes.getLabeledIncludes(rootObj));

            if (BeatExtensions.whichPart(rootObj) == ModPart.Imp)
            {
                BuildObject rootIfc = context.context.search(rootObj.getFileNameWithoutExtension(), ModPart.Ifc);
                result.Add(new BeatIncludes.LabeledInclude(BeatIncludes.ImportFilter.ForBeatOrBasm, rootIfc));
            }
            return(result);
        }
Ejemplo n.º 4
0
 public BasmObligationIncludes(IIncludePathContext includePathSearcher)
 {
     this.includePathSearcher = includePathSearcher;
     this.directIncludes      = new BeatIncludes(includePathSearcher);
 }
Ejemplo n.º 5
0
 public BasmObligationIncludes(IIncludePathContext includePathSearcher)
 {
     this.includePathSearcher = includePathSearcher;
     this.directIncludes = new BeatIncludes(includePathSearcher);
 }
Ejemplo n.º 6
0
 public FetchModuleCache(IIncludePathContext context)
 {
     this.beatIncludes = new BeatIncludes(context);
     this.cache = new CachedHash<string, BuildObject>(this.fetchModule);
 }
Ejemplo n.º 7
0
 public static IEnumerable<BuildObject> getBeatFlavoredShallowIncludes(
     IContextGeneratingVerb contextVerb, BuildObject rootObj, BeatIncludes.ImportFilter importFilter)
 {
     return getBeatFlavoredShallowIncludesLabeled(contextVerb, rootObj)
         .Where(li => importFilter == BeatIncludes.ImportFilter.ForBasmOnly
             || li.importFilter == BeatIncludes.ImportFilter.ForBeatOrBasm)
         .Select(li => li.buildObject);
 }
Ejemplo n.º 8
0
        private static IEnumerable<BeatIncludes.LabeledInclude> getBeatFlavoredShallowIncludesLabeled(
            IContextGeneratingVerb contextVerb, BuildObject rootObj)
        {
            ContextContents context = (ContextContents)
                BuildEngine.theEngine.Repository.FetchVirtual(contextVerb.getContextOutput());
            BeatIncludes includes = new BeatIncludes(context.Context);
            OrderPreservingSet<BeatIncludes.LabeledInclude> result = new OrderPreservingSet<BeatIncludes.LabeledInclude>(
                includes.getLabeledIncludes(rootObj));

            if (BeatExtensions.whichPart(rootObj) == ModPart.Imp)
            {
                BuildObject rootIfc = context.Context.search(rootObj.getFileNameWithoutExtension(), ModPart.Ifc);
                result.Add(new BeatIncludes.LabeledInclude(BeatIncludes.ImportFilter.ForBeatOrBasm, rootIfc));
            }

            return result;
        }
Ejemplo n.º 9
0
        // This used to use a BeatTransitiveDepsVerb, but we're going with shallow dependencies at the moment.
        // We may want to restore that behavior later, if we can get some sane transitive dep tree worked out for
        // Verve code.
        // The returned list belongs to the caller to .Add() to as desired.
        // TODO this really needs to be factored to supply the actual Beat-flavored references separately
        // from the auxiliary deps (transitive dep objects and context dep objects), so we don't have
        // client code trying to filter back out the part it wants. Brittle.
        public static OrderPreservingSet<BuildObject> getBeatFlavoredShallowDependencies(
            IContextGeneratingVerb contextVerb, BuildObject rootObj, out DependencyDisposition ddisp, BeatIncludes.ImportFilter filter)
        {
            OrderPreservingSet<BuildObject> result = new OrderPreservingSet<BuildObject>();
            result.Add(contextVerb.getContextOutput());
            try
            {
                result.AddRange(getBeatFlavoredShallowIncludes(contextVerb, rootObj, filter));
                ddisp = DependencyDisposition.Complete;
            }
            catch (ObjectNotReadyException)
            {
                ddisp = DependencyDisposition.Incomplete;
            }
            catch (ObjectFailedException)
            {
                ddisp = DependencyDisposition.Failed;
            }

            result.Add(rootObj);    // root really needs to go at the end of the list.
            return result;
        }