示例#1
0
        private LockFileTarget ReadTarget(string property, JsonValue json)
        {
            var jobject = json as JsonObject;

            if (jobject == null)
            {
                throw FileFormatException.Create("The value type is not an object.", json);
            }

            var target = new LockFileTarget();
            var parts  = property.Split(new[] { '/' }, 2);

            target.TargetFramework = new FrameworkName(parts[0]);
            if (parts.Length == 2)
            {
                target.RuntimeIdentifier = parts[1];
            }

            target.Libraries = ReadObject(jobject, ReadTargetLibrary);

            return(target);
        }
示例#2
0
        private static Graph ForTarget(Project project, LockFileTarget target)
        {
            var name = VersionUtility.GetShortFrameworkName(target.TargetFramework);
            if (!string.IsNullOrEmpty(target.RuntimeIdentifier))
            {
                name += "-" + target.RuntimeIdentifier;
            }

            var graph = new Graph(name);
            foreach (var lib in target.Libraries)
            {
                foreach (var dep in lib.Dependencies)
                {
                    graph.AddLink(lib.Name, dep.Id);
                }
            }

            foreach (var dep in project.Dependencies)
            {
                graph.AddLink(project.Name, dep.Name);
            }
            return graph;
        }