Exemple #1
0
        /// <summary>
        /// Finds or creates a node, notice that this will not perform an analysis on the node, which must be explicitly called on the node
        /// </summary>
        /// <param name="item">The asset item to find or create</param>
        /// <param name="compilationContext">The context in which the asset is compiled.</param>
        /// <returns>The build node associated with item</returns>
        public BuildAssetNode FindOrCreateNode([NotNull] AssetItem item, [NotNull] Type compilationContext)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }
            if (compilationContext == null)
            {
                throw new ArgumentNullException(nameof(compilationContext));
            }

            var nodeDesc = new BuildNodeDesc(item.Id, compilationContext);

            BuildAssetNode node;

            if (!nodes.TryGetValue(nodeDesc, out node))
            {
                node = new BuildAssetNode(item, compilationContext, this);
                nodes.TryAdd(nodeDesc, node);
            }
            else if (!ReferenceEquals(node.AssetItem, item))
            {
                node            = new BuildAssetNode(item, compilationContext, this);
                nodes[nodeDesc] = node;
            }

            return(node);
        }
Exemple #2
0
        /// <summary>
        /// Removes the node from the build graph
        /// </summary>
        /// <param name="node">The node to remove</param>
        public void RemoveNode([NotNull] BuildAssetNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }
            var nodeDesc = new BuildNodeDesc(node.AssetItem.Id, node.CompilationContext);

            nodes.TryRemove(nodeDesc, out node);
        }
Exemple #3
0
 /// <summary>
 /// Initialize a new instance of the <see cref="BuildAssetLink"/> structure.
 /// </summary>
 /// <param name="source">The source asset of the dependency.</param>
 /// <param name="target">The target asset of the dependency.</param>
 /// <param name="dependencyType">The type of dependency.</param>
 public BuildAssetLink(BuildAssetNode source, BuildAssetNode target, BuildDependencyType dependencyType)
 {
     Source         = source;
     Target         = target;
     DependencyType = dependencyType;
 }