From 8471a52651df947e99e430d0345029e8590141dd Mon Sep 17 00:00:00 2001 From: Graham Zuber Date: Tue, 27 Oct 2020 19:29:40 -0700 Subject: [PATCH] Added method to skip cleaning of output assemblies to ExtensionsMetadataGenerator. --- .../BuildTasks/RemoveRuntimeDependencies.cs | 13 +++++++++++-- ...bJobs.Script.ExtensionsMetadataGenerator.targets | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/BuildTasks/RemoveRuntimeDependencies.cs b/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/BuildTasks/RemoveRuntimeDependencies.cs index 334d332a7f..69bd144ed2 100644 --- a/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/BuildTasks/RemoveRuntimeDependencies.cs +++ b/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/BuildTasks/RemoveRuntimeDependencies.cs @@ -21,8 +21,17 @@ public class RemoveRuntimeDependencies : Task [Required] public string OutputPath { get; set; } + [Required] + public ITaskItem[] IgnoreFiles { get; set; } + public override bool Execute() { + HashSet ignoreFilesSet = new HashSet(); + foreach (ITaskItem item in IgnoreFiles) + { + ignoreFilesSet.Add(item.ItemSpec); + } + Assembly assembly = typeof(RemoveRuntimeDependencies).Assembly; using (Stream resource = assembly.GetManifestResourceStream(assembly.GetName().Name + ".runtimeassemblies.txt")) using (var reader = new StreamReader(resource)) @@ -32,7 +41,7 @@ public override bool Execute() { string fileName = Path.Combine(OutputPath, assemblyName); - if (File.Exists(fileName)) + if (File.Exists(fileName) && !ignoreFilesSet.Contains(assemblyName)) { File.Delete(fileName); } @@ -44,4 +53,4 @@ public override bool Execute() return true; } } -} +} \ No newline at end of file diff --git a/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/Targets/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets b/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/Targets/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets index 30c7bbb658..b527f698b4 100644 --- a/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/Targets/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets +++ b/tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/Targets/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets @@ -21,11 +21,11 @@ AssemblyFile="$(_FunctionsExtensionsTaskAssemblyFullPath)"/> - + - +