Skip to content

Commit

Permalink
Merge pull request #904 from christianhelle/kiota-always-generates-mu…
Browse files Browse the repository at this point in the history
…ltiple-files

Ensure Kiota custom tool respects the Generate Multiple Files option
  • Loading branch information
christianhelle authored May 16, 2024
2 parents 7d67046 + 196e6c2 commit 6337026
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public string GenerateCode(IProgressReporter? pGenerateProgress)
pGenerateProgress?.Progress(10);
dependencyInstaller.InstallKiota();

if (new FileInfo(swaggerFile).Name == KiotaLockFile)
string swaggerFilename = new FileInfo(swaggerFile).Name;
if (swaggerFilename == KiotaLockFile)
{
pGenerateProgress?.Progress(40);
RunKiotaUpdate();
Expand All @@ -47,13 +48,22 @@ public string GenerateCode(IProgressReporter? pGenerateProgress)
if (!options.GenerateMultipleFiles &&
File.Exists(Path.Combine(Path.GetDirectoryName(swaggerFile)!, KiotaLockFile)))
{
File.Copy(
swaggerFile,
Path.Combine(outputFolder, swaggerFilename),
true);

File.Copy(
Path.Combine(Path.GetDirectoryName(swaggerFile)!, KiotaLockFile),
Path.Combine(outputFolder, KiotaLockFile),
true);

pGenerateProgress?.Progress(60);
RunKiotaUpdate();

var arguments = $" update -o \"{outputFolder}\"";
using var context = new DependencyContext("Kiota", $"{Command} {arguments}");
processLauncher.Start(Command, arguments, outputFolder);
context.Succeeded();
}

pGenerateProgress?.Progress(80);
Expand Down

0 comments on commit 6337026

Please sign in to comment.