diff --git a/.gitignore b/.gitignore index dfcfd56..e6b4d9d 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,6 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ + +# Ignore any generated files as part of packag builder tests +PackageBuilder/tests/**/output/* \ No newline at end of file diff --git a/GraphBuilder/src/Exceptions/GraphBuilderExcpetions.cs b/GraphBuilder/src/Exceptions/GraphBuilderExcpetions.cs index 91c55f1..a5b090e 100644 --- a/GraphBuilder/src/Exceptions/GraphBuilderExcpetions.cs +++ b/GraphBuilder/src/Exceptions/GraphBuilderExcpetions.cs @@ -1,7 +1,7 @@ using System; -namespace PackageAnalyzer +namespace PackageAnalyzer.Exceptions { public class GraphBuilderException : Exception { diff --git a/GraphBuilder/src/GraphBuilder.cs b/GraphBuilder/src/GraphBuilder.cs index 3208e2d..b0e5f9b 100644 --- a/GraphBuilder/src/GraphBuilder.cs +++ b/GraphBuilder/src/GraphBuilder.cs @@ -47,7 +47,7 @@ public void Insert(FileInfo fileInfo) } catch (Exception e) { - throw new GraphBuilderException("Malformed package description file.", e); + throw new Exceptions.GraphBuilderException("Malformed package description file.", e); } // get dependency section @@ -62,7 +62,7 @@ public void Insert(FileInfo fileInfo) } catch (Exception e) { - throw new GraphBuilderException("Malformed dependency tag in description file.", e); + throw new Exceptions.GraphBuilderException("Malformed dependency tag in description file.", e); } } diff --git a/PackageBuilder/src/Exceptions/PackageBuilder.CycleException.cs b/PackageBuilder/src/Exceptions/PackageBuilder.CycleException.cs new file mode 100644 index 0000000..bb4ee23 --- /dev/null +++ b/PackageBuilder/src/Exceptions/PackageBuilder.CycleException.cs @@ -0,0 +1,20 @@ +using System; + + +namespace PackageAnalyzer.Exceptions +{ + public class PackageBuilderCycleException : Exception + { + public PackageBuilderCycleException() + { + } + + public PackageBuilderCycleException(string message) : base(message) + { + } + + public PackageBuilderCycleException(string message, Exception inner) : base(message, inner) + { + } + } +} \ No newline at end of file diff --git a/PackageBuilder/src/PackageBuilder.cs b/PackageBuilder/src/PackageBuilder.cs index deeebee..18aa1bb 100644 --- a/PackageBuilder/src/PackageBuilder.cs +++ b/PackageBuilder/src/PackageBuilder.cs @@ -6,17 +6,30 @@ namespace PackageAnalyzer public class PackageBuilder { // location relative to specified rootFolder. - const string PACKAGE_DESCRIPTIONS = "packages//descriptions"; - const string PACKAGE_CACHE = "packages//cache"; - const string PACKAGE_SOURCE = "src"; - const string PACKAGE_OUTPUT = "output"; + const string PACKAGE_DESCRIPTIONS = "//packages//descriptions"; + const string PACKAGE_CACHE = "//packages//cache"; + const string PACKAGE_SOURCE = "//src"; + const string PACKAGE_OUTPUT = "//output"; + + + public PackageBuilder() + { + } - public List Build(string start, string rootFolder) + public List Build(string startNode, string rootFolder) { List builtPackages = new List(); + GraphBuilder gb = new GraphBuilder($"{rootFolder}{PACKAGE_DESCRIPTIONS}"); + + if (gb.Graph.IsCyclic) + { + // need logging. throw cycle exception + throw new Exceptions.PackageBuilderCycleException("Cycle detected in package graph."); + } + return builtPackages; } } diff --git a/PackageBuilder/src/PackageBuilder.csproj b/PackageBuilder/src/PackageBuilder.csproj index 9f5c4f4..6d13432 100644 --- a/PackageBuilder/src/PackageBuilder.csproj +++ b/PackageBuilder/src/PackageBuilder.csproj @@ -1,7 +1,15 @@ - netstandard2.0 + netcoreapp3.0 + + + + + + + + diff --git a/PackageHasher/src/PackageHasher.csproj b/PackageHasher/src/PackageHasher.csproj index 9f5c4f4..ea83d29 100644 --- a/PackageHasher/src/PackageHasher.csproj +++ b/PackageHasher/src/PackageHasher.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + netcoreapp3.0