diff --git a/TopModel.Generator.Csharp/TopModel.Generator.Csharp.csproj b/TopModel.Generator.Csharp/TopModel.Generator.Csharp.csproj index 288f9a61..48c2b527 100644 --- a/TopModel.Generator.Csharp/TopModel.Generator.Csharp.csproj +++ b/TopModel.Generator.Csharp/TopModel.Generator.Csharp.csproj @@ -10,7 +10,7 @@ ../.nupkg - 1.0.2 + 1.0.3 false JabX Générateurs C# pour TopModel @@ -56,5 +56,13 @@ PreserveNewest + + + + true + false + build\ + + diff --git a/TopModel.Generator.Csharp/build/TopModel.Generator.Csharp.props b/TopModel.Generator.Csharp/build/TopModel.Generator.Csharp.props new file mode 100644 index 00000000..4f559d9c --- /dev/null +++ b/TopModel.Generator.Csharp/build/TopModel.Generator.Csharp.props @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/TopModel.Generator.Javascript/TopModel.Generator.Javascript.csproj b/TopModel.Generator.Javascript/TopModel.Generator.Javascript.csproj index cb96caa7..d2daa256 100644 --- a/TopModel.Generator.Javascript/TopModel.Generator.Javascript.csproj +++ b/TopModel.Generator.Javascript/TopModel.Generator.Javascript.csproj @@ -10,7 +10,7 @@ ../.nupkg - 1.0.2 + 1.0.3 false JabX;gideruette Générateurs JS/TS pour TopModel @@ -52,5 +52,13 @@ PreserveNewest + + + + true + false + build\ + + diff --git a/TopModel.Generator.Javascript/build/TopModel.Generator.Javascript.props b/TopModel.Generator.Javascript/build/TopModel.Generator.Javascript.props new file mode 100644 index 00000000..9ca51cda --- /dev/null +++ b/TopModel.Generator.Javascript/build/TopModel.Generator.Javascript.props @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/TopModel.Generator.Jpa/TopModel.Generator.Jpa.csproj b/TopModel.Generator.Jpa/TopModel.Generator.Jpa.csproj index 554c8dc3..fc31dbe0 100644 --- a/TopModel.Generator.Jpa/TopModel.Generator.Jpa.csproj +++ b/TopModel.Generator.Jpa/TopModel.Generator.Jpa.csproj @@ -10,7 +10,7 @@ ../.nupkg - 1.0.2 + 1.0.3 false gideruette Générateurs Java/JPA pour TopModel @@ -53,4 +53,12 @@ + + + true + false + build\ + + + diff --git a/TopModel.Generator.Jpa/build/TopModel.Generator.Jpa.props b/TopModel.Generator.Jpa/build/TopModel.Generator.Jpa.props new file mode 100644 index 00000000..0f3ca735 --- /dev/null +++ b/TopModel.Generator.Jpa/build/TopModel.Generator.Jpa.props @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/TopModel.Generator.Sql/TopModel.Generator.Sql.csproj b/TopModel.Generator.Sql/TopModel.Generator.Sql.csproj index abbc5ed5..050f6ac9 100644 --- a/TopModel.Generator.Sql/TopModel.Generator.Sql.csproj +++ b/TopModel.Generator.Sql/TopModel.Generator.Sql.csproj @@ -10,7 +10,7 @@ ../.nupkg - 1.0.2 + 1.0.3 false JabX;gideruette Générateurs SQL pour TopModel @@ -53,4 +53,12 @@ + + + true + false + build\ + + + diff --git a/TopModel.Generator.Sql/build/TopModel.Generator.Sql.props b/TopModel.Generator.Sql/build/TopModel.Generator.Sql.props new file mode 100644 index 00000000..6e1e8d36 --- /dev/null +++ b/TopModel.Generator.Sql/build/TopModel.Generator.Sql.props @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/TopModel.Generator.Translation/TopModel.Generator.Translation.csproj b/TopModel.Generator.Translation/TopModel.Generator.Translation.csproj index a62d75f8..af88750c 100644 --- a/TopModel.Generator.Translation/TopModel.Generator.Translation.csproj +++ b/TopModel.Generator.Translation/TopModel.Generator.Translation.csproj @@ -10,7 +10,7 @@ ../.nupkg - 1.0.2 + 1.0.3 false gideruette Générateurs de traductions manquantes pour TopModel @@ -53,4 +53,12 @@ + + + true + false + build\ + + + diff --git a/TopModel.Generator.Translation/build/TopModel.Generator.Translation.props b/TopModel.Generator.Translation/build/TopModel.Generator.Translation.props new file mode 100644 index 00000000..21418864 --- /dev/null +++ b/TopModel.Generator.Translation/build/TopModel.Generator.Translation.props @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/TopModel.Generator/Program.cs b/TopModel.Generator/Program.cs index 42b5f991..aee4bd48 100644 --- a/TopModel.Generator/Program.cs +++ b/TopModel.Generator/Program.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging; using NuGet.Common; using NuGet.Packaging; +using NuGet.Packaging.Core; using NuGet.Protocol; using NuGet.Protocol.Core.Types; using NuGet.Versioning; @@ -289,11 +290,15 @@ void HandleFile(FileInfo file) if (returnCode == 0) { - generators.AddRange(new DirectoryInfo(Path.Combine(Path.GetFullPath(cg, new FileInfo(fullName).DirectoryName!), "bin")) - .GetFiles($"{cg.Split('/').Last()}.dll", SearchOption.AllDirectories) + var assemblies = new DirectoryInfo(Path.Combine(Path.GetFullPath(cg, new FileInfo(fullName).DirectoryName!), "bin")) + .GetFiles($"*.dll", SearchOption.AllDirectories) .Where(a => a.FullName.Contains(framework) && a.Name != "TopModel.Generator.Core.dll") .DistinctBy(a => a.Name) .Select(f => Assembly.LoadFrom(f.FullName)) + .ToList(); + + generators.AddRange(assemblies + .Where(a => a.ManifestModule.Name.ToLower() == $"{cg.Split('/').Last().ToLower()}.dll") .SelectMany(a => a.GetExportedTypes()) .Where(t => GetIGenRegInterface(t) != null)); } @@ -395,15 +400,37 @@ void HandleFile(FileInfo file) packageReader.ExtractFile(file, Path.Combine(moduleFolder, file.Split('/').Last()), NullLogger.Instance); } - foreach (var otherDep in dependencies.Where(d => d.Id != "TopModel.Generator.Core")) + var installedDependencies = new List(); + dependencies = dependencies.Where(d => d.Id != "TopModel.Generator.Core"); + + while (dependencies.Any()) { - using var packageStreamDep = new MemoryStream(); - await nugetResource.CopyNupkgToStreamAsync(otherDep.Id, otherDep.VersionRange.MinVersion, packageStreamDep, nugetCache, NullLogger.Instance, ct); - using var packageReaderDep = new PackageArchiveReader(packageStreamDep); - foreach (var file in packageReaderDep.GetFiles().Where(f => f == $"lib/netstandard2.0/{otherDep.Id}.dll")) + var newDeps = new List(); + foreach (var otherDep in dependencies) { - packageReaderDep.ExtractFile(file, Path.Combine(moduleFolder, file.Split('/').Last()), NullLogger.Instance); + using var packageStreamDep = new MemoryStream(); + await nugetResource.CopyNupkgToStreamAsync(otherDep.Id, otherDep.VersionRange.MinVersion, packageStreamDep, nugetCache, NullLogger.Instance, ct); + + using var packageReaderDep = new PackageArchiveReader(packageStreamDep); + var file = packageReaderDep.GetFiles().SingleOrDefault(f => f.StartsWith($"lib/{framework}") && f.EndsWith(".dll") && !f.EndsWith(".resources.dll")); + if (file != null) + { + packageReaderDep.ExtractFile(file, Path.Combine(moduleFolder, file.Split('/').Last()), NullLogger.Instance); + + installedDependencies.Add(otherDep.Id); + + var nuspecReaderDep = await packageReaderDep.GetNuspecReaderAsync(ct); + if (nuspecReaderDep.GetDependencyGroups().Any()) + { + newDeps.AddRange(nuspecReaderDep.GetDependencyGroups() + .Single(dg => dg.TargetFramework.ToString() == framework) + .Packages + .Where(dep => !installedDependencies.Contains(dep.Id))); + } + } } + + dependencies = newDeps; } hasInstalled = true; @@ -585,4 +612,4 @@ void HandleFile(FileInfo file) return 1; } -return returnCode; \ No newline at end of file +return returnCode; diff --git a/TopModel.Generator/TopModel.Generator.csproj b/TopModel.Generator/TopModel.Generator.csproj index 0e983fd9..1b7b98d6 100644 --- a/TopModel.Generator/TopModel.Generator.csproj +++ b/TopModel.Generator/TopModel.Generator.csproj @@ -13,7 +13,7 @@ true ../.nupkg modgen - 2.0.1 + 2.0.2 false JabX;gideruette Générateur de modèle TopModel.