Skip to content

Commit 5f64e80

Browse files
committed
Add error handling and improve extraction process for .apax.tgz files in BuildContext
1 parent 4d9d529 commit 5f64e80

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

cake/BuildContext.cs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -268,23 +268,32 @@ public void CheckLicenseComplianceInArtifacts()
268268
Directory.Delete(ouptutDir, true);
269269
}
270270
}
271-
272-
foreach (var nugetFile in Directory.EnumerateFiles(this.Artifacts, "*.apax.tgz", SearchOption.AllDirectories))
271+
272+
try
273273
{
274-
using (var zip = ZipFile.OpenRead(nugetFile))
274+
foreach (var apaxPackageFile in Directory.EnumerateFiles(this.Artifacts, "*.apax.tgz", SearchOption.AllDirectories))
275275
{
276-
var ouptutDir = Path.Combine(this.Artifacts, "verif");
277-
zip.ExtractToDirectory(Path.Combine(this.Artifacts, "verif"));
278-
279-
if (Directory.EnumerateFiles(ouptutDir, "*.*", SearchOption.AllDirectories)
280-
.Select(p => new FileInfo(p))
281-
.Any(p => licensedFiles.Any(l => l.Name == p.Name)))
276+
using (var zip = ZipFile.OpenRead(apaxPackageFile))
282277
{
283-
throw new Exception("");
284-
}
278+
var ouptutDir = Path.Combine(this.Artifacts, "apax-verif");
279+
zip.ExtractToDirectory(Path.Combine(this.Artifacts, "apax-verif"));
285280

286-
Directory.Delete(ouptutDir, true);
281+
if (Directory.EnumerateFiles(ouptutDir, "*.*", SearchOption.AllDirectories)
282+
.Select(p => new FileInfo(p))
283+
.Any(p => licensedFiles.Any(l => l.Name == p.Name)))
284+
{
285+
throw new Exception("");
286+
}
287+
288+
Directory.Delete(ouptutDir, true);
289+
}
287290
}
288291
}
292+
catch (Exception e)
293+
{
294+
Console.WriteLine(e);
295+
throw;
296+
}
297+
289298
}
290299
}

0 commit comments

Comments
 (0)