Skip to content

Commit

Permalink
feat: Moved SDK to eavframework repository.
Browse files Browse the repository at this point in the history
To avoid circel references of external packates
Testing if it will package submodule.
  • Loading branch information
pksorensen committed Oct 18, 2023
1 parent 3942c8d commit 94ffba2
Show file tree
Hide file tree
Showing 22 changed files with 230 additions and 1,350 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "external/EAVFW.Extensions.CommandLine"]
path = external/EAVFW.Extensions.CommandLine
url = https://github.com/EAVFW/EAVFW.Extensions.CommandLine.git
[submodule "external/EAVFramework"]
path = external/EAVFramework
url = https://github.com/EAVFW/EAVFramework.git
10 changes: 10 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<LangVersion>9.0</LangVersion>
<EAVFrameworkVersion>4.0.2</EAVFrameworkVersion>
<UseEAVFromNuget>true</UseEAVFromNuget>
<LocalEAVFrameworkPath>$(MSBuildThisFileDirectory)/external/EAVFramework</LocalEAVFrameworkPath>
<LocalExternalpath>$(MSBuildThisFileDirectory)/external</LocalExternalpath>
<ManifestSDKPath>$(MSBuildThisFileDirectory)</ManifestSDKPath>
</PropertyGroup>
</Project>
38 changes: 24 additions & 14 deletions EAVFW.Extensions.Manifest.ManifestEnricherTool.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5250CA28-EB3D-4DF8-8B5B-68D520CADDEE}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
Directory.Build.props = Directory.Build.props
README.md = README.md
EndProjectSection
EndProject
Expand All @@ -29,30 +30,26 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{4AFE
.config\dotnet-tools.json = .config\dotnet-tools.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eavfw", "eavfw", "{99FD28D4-904E-4601-8B15-BAE281F48576}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EAVFW.Extensions.Manifest.SDK", "src\EAVFW.Extensions.Manifest.SDK\EAVFW.Extensions.Manifest.SDK.csproj", "{A69F8562-BDDF-4DE9-8768-E51B1FFFD368}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EAVFramework", "..\EAVFramework\src\EAVFramework.csproj", "{B8E00220-CF68-4B02-831C-15E16D61E996}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0343EA18-1645-4DFB-9A9C-2D10BBA2A2CB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EAVFW.Extensions.Manifest.ManifestEnricherTool", "src\EAVFW.Extensions.Manifest.ManifestEnricherTool\EAVFW.Extensions.Manifest.ManifestEnricherTool.csproj", "{C472564C-38FE-4465-BC62-FDCF45339C36}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EAVFW.Extensions.Manifest.Tests", "tests\EAVFW.Extensions.Manifest.Tests\EAVFW.Extensions.Manifest.Tests.csproj", "{856357CE-BB26-4E6C-BAA2-B74FF8DC5734}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "external", "external", "{CAE8FBC9-BDC3-4F45-81E1-57506D609011}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EAVFW.Extensions.CommandLine", "external\EAVFW.Extensions.CommandLine\src\EAVFW.Extensions.CommandLine\EAVFW.Extensions.CommandLine.csproj", "{79505337-2855-4CC7-8FD3-D5AF31B18278}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EAVFramework", "external\EAVFramework\src\EAVFramework.csproj", "{2F30C24A-421A-4309-9F07-99668EA70C25}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EAVFW.Extensions.Manifest.SDK", "external\EAVFramework\sdk\EAVFW.Extensions.Manifest.SDK.csproj", "{3BEF0769-ABD1-4D34-8004-C98DE9FB0339}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A69F8562-BDDF-4DE9-8768-E51B1FFFD368}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A69F8562-BDDF-4DE9-8768-E51B1FFFD368}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A69F8562-BDDF-4DE9-8768-E51B1FFFD368}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A69F8562-BDDF-4DE9-8768-E51B1FFFD368}.Release|Any CPU.Build.0 = Release|Any CPU
{B8E00220-CF68-4B02-831C-15E16D61E996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8E00220-CF68-4B02-831C-15E16D61E996}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{C472564C-38FE-4465-BC62-FDCF45339C36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C472564C-38FE-4465-BC62-FDCF45339C36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C472564C-38FE-4465-BC62-FDCF45339C36}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -61,16 +58,29 @@ Global
{856357CE-BB26-4E6C-BAA2-B74FF8DC5734}.Debug|Any CPU.Build.0 = Debug|Any CPU
{856357CE-BB26-4E6C-BAA2-B74FF8DC5734}.Release|Any CPU.ActiveCfg = Release|Any CPU
{856357CE-BB26-4E6C-BAA2-B74FF8DC5734}.Release|Any CPU.Build.0 = Release|Any CPU
{79505337-2855-4CC7-8FD3-D5AF31B18278}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79505337-2855-4CC7-8FD3-D5AF31B18278}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79505337-2855-4CC7-8FD3-D5AF31B18278}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79505337-2855-4CC7-8FD3-D5AF31B18278}.Release|Any CPU.Build.0 = Release|Any CPU
{2F30C24A-421A-4309-9F07-99668EA70C25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F30C24A-421A-4309-9F07-99668EA70C25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F30C24A-421A-4309-9F07-99668EA70C25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F30C24A-421A-4309-9F07-99668EA70C25}.Release|Any CPU.Build.0 = Release|Any CPU
{3BEF0769-ABD1-4D34-8004-C98DE9FB0339}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3BEF0769-ABD1-4D34-8004-C98DE9FB0339}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3BEF0769-ABD1-4D34-8004-C98DE9FB0339}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3BEF0769-ABD1-4D34-8004-C98DE9FB0339}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E8050101-10D8-4B0E-B081-8A45BA2E4A61} = {C88FCAB5-AE8A-44CD-9195-2B085A6CD560}
{A69F8562-BDDF-4DE9-8768-E51B1FFFD368} = {0D61C87C-0809-4CD7-9200-D78AD11A1E22}
{B8E00220-CF68-4B02-831C-15E16D61E996} = {99FD28D4-904E-4601-8B15-BAE281F48576}
{C472564C-38FE-4465-BC62-FDCF45339C36} = {0D61C87C-0809-4CD7-9200-D78AD11A1E22}
{856357CE-BB26-4E6C-BAA2-B74FF8DC5734} = {0343EA18-1645-4DFB-9A9C-2D10BBA2A2CB}
{79505337-2855-4CC7-8FD3-D5AF31B18278} = {CAE8FBC9-BDC3-4F45-81E1-57506D609011}
{2F30C24A-421A-4309-9F07-99668EA70C25} = {CAE8FBC9-BDC3-4F45-81E1-57506D609011}
{3BEF0769-ABD1-4D34-8004-C98DE9FB0339} = {CAE8FBC9-BDC3-4F45-81E1-57506D609011}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {036D5D82-DDA4-4600-B190-739D512F1062}
Expand Down
1 change: 1 addition & 0 deletions external/EAVFW.Extensions.CommandLine
1 change: 1 addition & 0 deletions external/EAVFramework
Submodule EAVFramework added at 65e40e
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
using LibGit2Sharp;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.CommandLine;
using System.CommandLine.Parsing;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace EAVFW.Extensions.Manifest.ManifestEnricherTool.Commands.GPT
{
public class GPTReviewPrCommand : Command
{

[Alias("--project")]
[Description("The project path to EAV Model Project")]
public string Project { get; set; }

[Alias("--pr")]
[Description("The project path to EAV Model Project")]
public string PR { get; set; }


public GPTReviewPrCommand() : base("pr", "Review a PR with Chat GPT")
{
Handler = COmmandExtensions.Create(this, new Command[0], Run);
}
private async Task<int> Run(ParseResult parseResult, IConsole console)
{
var name = Path.GetFileNameWithoutExtension(Project);
var folder = Path.GetTempPath() + name;
console.WriteLine(folder);
if (Directory.Exists(folder))
{
setAttributesNormal(new DirectoryInfo(folder));
Directory.Delete(folder, true);


}
Directory.CreateDirectory(folder);
var repoPath = LibGit2Sharp.Repository.Clone(Project, folder, new CloneOptions { Checkout = true, FetchOptions = new FetchOptions { } });
try
{
console.WriteLine(repoPath);
console.WriteLine(Project);

using var repo = new Repository(repoPath);

console.WriteLine("worktrees:");
console.WriteLine(string.Join("\n", repo.Worktrees.Select(c => c.Name)));

console.WriteLine("Refs:");
console.WriteLine(string.Join("\n", repo.Refs.Select(c => c.CanonicalName)));
console.WriteLine("Branches:");
console.WriteLine(string.Join("\n", repo.Branches.Select(c => c.CanonicalName)));

string mergeIntoReleaseBranch = "refs/remotes/origin/master";
string branchToBeMerged = "refs/remotes/origin/tst/job-status";
TreeChanges treeChanges = repo.Diff.Compare<TreeChanges>(repo.Branches[mergeIntoReleaseBranch].Tip.Tree, repo.Branches[branchToBeMerged].Tip.Tree);

console.WriteLine("Changes:");

Console.WriteLine(treeChanges.Count<TreeEntryChanges>());
console.WriteLine(string.Join("\n", treeChanges.Select(c => $"{c.Status.ToString()} {c.Path}\n{c.Mode}\n")));
}
finally{
setAttributesNormal(new DirectoryInfo(folder));
Directory.Delete(folder, true);
}



void setAttributesNormal(DirectoryInfo dir)
{
foreach (var subDir in dir.GetDirectories())
setAttributesNormal(subDir);
foreach (var file in dir.GetFiles())
{
file.Attributes = FileAttributes.Normal;
}
}

return 0;
}
}

public class GPTReviewCommand : Command
{
public GPTReviewCommand(GPTReviewPrCommand review) : base("review", "Chat GPT EAVFW Reviewer")
{
Handler = COmmandExtensions.Create(this, new[]
{
review
}, Run);

}
private async Task<int> Run(ParseResult parseResult, IConsole console)
{
return 0;
}
}
public class GPTCommand : Command
{
public GPTCommand(GPTReviewCommand review) : base("gpt", "ChatGPT EAVFW Developer")
{
Handler = COmmandExtensions.Create(this, new[]
{
review
}, Run);
}
private async Task<int> Run(ParseResult parseResult, IConsole console)
{
return 0;
}

}
public static class GPTExtensions
{
public static IServiceCollection AddGPT(this IServiceCollection services)
{
services.AddSingleton<Command, GPTCommand>();

AddCommands(typeof(GPTCommand));

void AddCommands(Type type)
{
foreach (var parameter in type.GetConstructors().First().GetParameters())
{
var parameterType = parameter.ParameterType;
if (typeof(Command).IsAssignableFrom(parameterType))
{
services.AddSingleton(parameterType);

AddCommands(parameterType);
}
}
}

return services;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private async Task Run(ParseResult parseResult, IConsole console)
Directory.CreateDirectory(outputDirectory);
await File.WriteAllTextAsync(outputFile, sql);
console.WriteLine("Written: " + Path.GetFullPath( outputFile));

if(parseResult.GetValueForOption(ShouldGeneratePermissions))
await InitializeSystemAdministrator(parseResult, outputDirectory,model);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
<Description>A tool to enrich and transform manifest.json to manifest.g.json</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/EAVFW/EAVFW.Extensions.Manifest.ManifestEnricherTool</RepositoryUrl>
<RemoteEAVFramework>true</RemoteEAVFramework>
<LocalEAVFrameworkPath>..\..\..\EAVFramework</LocalEAVFrameworkPath>


</PropertyGroup>
<ItemGroup>
<None Include="..\..\README.md" Link="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNETDevOps.JsonFunctions" Version="3.0.26" />
<PackageReference Include="EAVFW.Extensions.CommandLine" Version="1.1.3" />

<PackageReference Include="LibGit2Sharp" Version="0.27.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Semver" Version="2.2.0" />
Expand All @@ -35,13 +35,15 @@
<Version>6.0.11</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="$(RemoteEAVFramework) == 'false'">
<ProjectReference Include="$(LocalEAVFrameworkPath)\src\EAVFramework.csproj" />
</ItemGroup>
<ItemGroup Condition="$(RemoteEAVFramework) != 'false'">
<PackageReference Include="EAVFramework" Version="2.3.1-dev.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EAVFW.Extensions.Manifest.SDK\EAVFW.Extensions.Manifest.SDK.csproj" />
</ItemGroup>


<ItemGroup Condition="$(UseEAVFromNuget) == 'false'">
<ProjectReference Include="$(LocalEAVFrameworkPath)\src\EAVFramework.csproj" />
<ProjectReference Include="$(LocalExternalpath)/EAVFW.Extensions.CommandLine/src/EAVFW.Extensions.CommandLine/EAVFW.Extensions.CommandLine.csproj" />

</ItemGroup>
<ItemGroup Condition="$(UseEAVFromNuget) != 'false'">
<PackageReference Include="EAVFramework" Version="4.0.2" />
<PackageReference Include="EAVFW.Extensions.CommandLine" Version="1.1.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// See https://aka.ms/new-console-template for more information
using EAVFW.Extensions.Manifest.ManifestEnricherTool.Commands;
using EAVFW.Extensions.Manifest.ManifestEnricherTool.Commands.GPT;
using EAVFW.Extensions.Manifest.SDK;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand All @@ -15,7 +16,7 @@ namespace EAVFW.Extensions.Manifest.ManifestEnricherTool
public static class Program
{

static ServiceCollection ConfigureServices(ServiceCollection serviceCollection)
static IServiceCollection ConfigureServices(IServiceCollection serviceCollection)
{
serviceCollection
.AddLogging(configure =>
Expand All @@ -31,6 +32,9 @@ static ServiceCollection ConfigureServices(ServiceCollection serviceCollection)
serviceCollection.AddSingleton<Command, SQLCommand>();
serviceCollection.AddSingleton<Command, ManifestCommand>();
serviceCollection.AddSingleton<Command, CertCommand>();
serviceCollection.AddGPT();


serviceCollection.AddHttpClient();
return serviceCollection;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"profiles": {
"EAVFW.Extensions.Manifest.ManifestEnricherTool": {
"commandName": "Project",
"workingDirectory": "C:\\dev\\hafnia\\loi",
//"workingDirectory": "C:\\dev\\kfst_vanddata",
//"commandLineArgs": "--path c:\\dev\\kfst_vanddata\\apps\\KFST.Vanddata.ManagementPortal\\manifest.json --customizationprefix kfst",
//"commandLineArgs": "install EAVFW.Extensions.SecurityModel",
//"commandLineArgs": "sql C:/dev/eavfwdemo/src/EAVApp.Models"

//"commandLineArgs": "sql C:/dev/kfst_vanddata/apps/KFST.Vanddata.ManagementPortal/"

//"commandLineArgs": "manifest fix-migration --project-path c:\\dev\\kfst_vanddata\\apps\\KFST.Vanddata.ManagementPortal -v 1.0.45 --schema KFST --prefix KFST --database VandData2"

// "commandLineArgs": "--path C:\\dev\\MedlemsCentralen\\src\\MC.Models\\manifest.json --customizationprefix MC"

// "commandLineArgs": "sql ./src/Hafnia.Models",
"commandLineArgs": "gpt review pr --project https://github.com/delegateas/WorkflowEngine.git --pr 15"
// "commandLineArgs": "sql ./apps/KFST.Vanddata.ManagementPortal"
//"commandLineArgs": "--path C:\\dev\\hafnia\\loi\\src\\Hafnia.Models\\manifest.json --customizationprefix hafnia"
}
}
}
34 changes: 0 additions & 34 deletions src/EAVFW.Extensions.Manifest.SDK/DefaultManifestPathExtracter.cs

This file was deleted.

Loading

0 comments on commit 94ffba2

Please sign in to comment.