diff --git a/Tasks.cs b/Tasks.cs index 58d8d88..f818cbf 100644 --- a/Tasks.cs +++ b/Tasks.cs @@ -669,7 +669,7 @@ public ITaskItem[] ComputedSources } [Output] - public string[] GeneratedPaths + public string[] GeneratedCompiledPaths { get; private set; @@ -682,6 +682,10 @@ protected abstract string ToolName abstract protected ITaskItem[] GeneratedItems(ITaskItem source); + // Same as generated items but only returns the generated items that need to be compiled + // for example it excludes C++ headers + protected abstract ITaskItem[] GeneratedCompiledItems(ITaskItem source); + protected virtual string GetGeneratedPath(ITaskItem item, string outputDir, string ext) { return Path.Combine(outputDir, @@ -718,7 +722,7 @@ public virtual Dictionary GetOptions(ITaskItem item) public override bool Execute() { List computed = new List(); - List generatedPaths = new List(); + List generatedCompiledPaths = new List(); foreach(ITaskItem source in Sources) { bool skip = true; @@ -737,7 +741,8 @@ public override bool Execute() FileInfo generatedInfo = null; FileInfo dependInfo = null; - generatedPaths.AddRange(generatedItems.Select(item => item.GetMetadata("FullPath"))); + generatedCompiledPaths.AddRange( + GeneratedCompiledItems(source).Select(item => item.GetMetadata("FullPath"))); // // Check if the Slice compiler is older than the source file // @@ -932,7 +937,7 @@ public override bool Execute() computed.Add(computedSource); } ComputedSources = computed.ToArray(); - GeneratedPaths = generatedPaths.ToArray(); + GeneratedCompiledPaths = generatedCompiledPaths.ToArray(); return true; } } @@ -990,6 +995,17 @@ protected override ITaskItem[] GeneratedItems(ITaskItem source) new TaskItem(GetGeneratedPath(source, headerOutputDir, headerExt)) }; } + + // Same as generated items but only returns the generated items that need to be compiled + // for example it excludes C++ headers + protected override ITaskItem[] GeneratedCompiledItems(ITaskItem source) + { + var generatedItems = GeneratedItems(source); + return new ITaskItem[] + { + generatedItems[0] + }; + } } public class Slice2CSharpDependTask : SliceDependTask @@ -1002,6 +1018,13 @@ protected override ITaskItem[] GeneratedItems(ITaskItem source) }; } + // Same as generated items but only returns the generated items that need to be compiled + // for example it excludes C++ headers + protected override ITaskItem[] GeneratedCompiledItems(ITaskItem source) + { + return GeneratedItems(source); + } + protected override string ToolName { get diff --git a/msbuild/zeroc.icebuilder.msbuild.cpp.targets b/msbuild/zeroc.icebuilder.msbuild.cpp.targets index 07c2cc6..b004401 100644 --- a/msbuild/zeroc.icebuilder.msbuild.cpp.targets +++ b/msbuild/zeroc.icebuilder.msbuild.cpp.targets @@ -77,7 +77,7 @@ + TaskParameter = "GeneratedCompiledPaths"/> diff --git a/msbuild/zeroc.icebuilder.msbuild.csharp.targets b/msbuild/zeroc.icebuilder.msbuild.csharp.targets index e53f034..5338e6c 100644 --- a/msbuild/zeroc.icebuilder.msbuild.csharp.targets +++ b/msbuild/zeroc.icebuilder.msbuild.csharp.targets @@ -71,7 +71,7 @@ + TaskParameter = "GeneratedCompiledPaths"/>