Ejemplo n.º 1
0
 protected bool Equals(Project other)
 {
     return base.Equals(other) && string.Equals(ProjectName, other.ProjectName) && string.Equals(ProjectPath, other.ProjectPath);
 }
Ejemplo n.º 2
0
 public void AddIgnoredProject(Project project)
 {
     Add(ignoredProjectByName, ignoredProjectByFilename, project);
 }
Ejemplo n.º 3
0
 public void AddProject(Project project)
 {
     Add(projectsByName, projectsByFilename, project);
 }
        private void WarnIfSimilarFound(List<Library> result, Project proj, Dependency dep, string filename, string refName)
        {
            if (result == null || !result.Any())
                return;

            var message = new OutputMessage().Append("The project ")
                .Append(proj, OutputMessage.ProjInfo.Name)
                .Append(" references the project ")
                .Append(filename)
                .Append(" but it could not be loaded. Using project")
                .Append(result.Count > 1 ? "s" : "")
                .Append(" ")
                .Append(refName)
                .Append(" instead:");

            if (result.Count == 1)
                result.ForEach(p => message.Append(result.First(), OutputMessage.ProjInfo.ProjectPath));
            else
                result.ForEach(p => message.Append("\n  - ")
                    .Append(p, OutputMessage.ProjInfo.ProjectPath));

            warnings.Add(new LoadingOutputEntry("Only similar project found", message, result.Select(dep.WithTarget)
                .ToArray()));
        }
        private List<Library> FindLibraryByNameAndLibraryName(Project proj, Dependency dep, string name, string libraryName)
        {
            var candidates = db.FindByNameAndLibraryName(name, libraryName);

            if (candidates != null && candidates.Count > 1)
                warnings.Add(CreateMultipleReferencesWarning(candidates, proj, dep, "with name " + name + " and library name " + libraryName));

            return candidates;
        }
        private List<Library> FindLibraryByFilename(Project proj, Dependency dep, string filename)
        {
            var candidates = db.FindByPath(filename);

            if (candidates != null && candidates.Count > 1)
                warnings.Add(CreateMultipleReferencesWarning(candidates, proj, dep, filename));

            return candidates;
        }
        private OutputEntry CreateMultipleReferencesWarning(List<Library> candidates, Project proj, Dependency dep, string refName)
        {
            var message = new OutputMessage().Append("The project ")
                .Append(proj, OutputMessage.ProjInfo.NameAndProjectPath)
                .Append(" references the project ")
                .Append(refName)
                .Append(", but there are ")
                .Append(candidates.Count)
                .Append(" projects that match:");

            candidates.ForEach(c => message.Append("\n  - ")
                .Append(c, OutputMessage.ProjInfo.ProjectPath));
            message.Append("\nMultiple dependencies will be created.");

            return new LoadingOutputEntry("Multiple projects found", message, candidates.Select(dep.WithTarget)
                .ToArray());
        }
        private Project CreateFakeProject(Project proj, Dependency dep, TempReference reference)
        {
            var result = new Project(reference.ReferenceName ?? reference.ReferenceLibraryName,
                reference.ReferenceLibraryName ?? reference.ReferenceName, reference.ReferenceGuid ?? Guid.NewGuid(), reference.ReferenceFilename, null);

            if (Ignore(result))
                return null;

            if (reference.ReferenceName == null || reference.ReferenceLibraryName == null)
            {
                var guessed = reference.ReferenceName == null ? "project name" : "library name";
                var used = reference.ReferenceName == null ? "library name" : "project name";

                var msg = new OutputMessage().Append("The project ")
                    .Append(proj, OutputMessage.ProjInfo.Name)
                    .Append(" references the project ")
                    .Append(reference.ReferenceFilename ?? reference.ReferenceName ?? reference.ReferenceLibraryName)
                    .Append(" but it could not be loaded. Guessing the ")
                    .Append(guessed)
                    .Append(" to be the same as the ")
                    .Append(used)
                    .Append(".");

                warnings.Add(new LoadingOutputEntry("Project not found", msg, dep.WithTarget(result)));
            }

            AddLibrary(result);

            return result;
        }