diff --git a/src/Microsoft.SourceIndexer.Tasks/SelectProjects.cs b/src/Microsoft.SourceIndexer.Tasks/SelectProjects.cs index 9e058f5..145b912 100644 --- a/src/Microsoft.SourceIndexer.Tasks/SelectProjects.cs +++ b/src/Microsoft.SourceIndexer.Tasks/SelectProjects.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using Microsoft.Build.Framework; +using Microsoft.Build.Tasks; using Microsoft.Build.Utilities; namespace Microsoft.SourceIndexer.Tasks @@ -30,25 +30,24 @@ public override bool Execute() } } - private static Type FileMatcher { get; } = Type.GetType("Microsoft.Build.Shared.FileMatcher, Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); - - private static Func GetFiles { get; } = - GetGetFilesFunction(); - - private static Func GetGetFilesFunction() + private string[] GetFiles(string localPath, string glob) { - var func14 = FileMatcher.GetMethod("GetFiles", BindingFlags.NonPublic | BindingFlags.Static, null, new[] { typeof(string), typeof(string) }, new ParameterModifier[0]); - if (func14 != null) + var createItemTask = new CreateItem { - return (Func)func14.CreateDelegate(typeof(Func)); - } - var func15 = FileMatcher.GetMethod("GetFiles", BindingFlags.NonPublic | BindingFlags.Static, null, new[] { typeof(string), typeof(string), typeof(IEnumerable) }, new ParameterModifier[0]); - if (func15 != null) + BuildEngine = BuildEngine, + Include = new[] + { + new TaskItem(Path.Combine(localPath, glob)) + } + }; + + if (!createItemTask.Execute()) { - var f = (Func, string[]>)func15.CreateDelegate(typeof(Func, string[]>)); - return (a, b) => f(a, b, Enumerable.Empty()); + throw new Exception( + $"Failed to create items with localPath '{localPath}', glob '{glob}'"); } - throw new MissingMethodException("Could not find FileMatcher.GetFiles"); + + return createItemTask.Include.Select(item => item.ItemSpec).ToArray(); } diff --git a/src/SourceBrowser b/src/SourceBrowser index 7c03e5a..f167770 160000 --- a/src/SourceBrowser +++ b/src/SourceBrowser @@ -1 +1 @@ -Subproject commit 7c03e5aa27d942720f8b4e2fdb810179f7e4a9ca +Subproject commit f1677702525220edb08a390efebb8e2c5dfd6e71 diff --git a/src/index/index.proj b/src/index/index.proj index 36f7aa6..9de987d 100644 --- a/src/index/index.proj +++ b/src/index/index.proj @@ -33,9 +33,16 @@ - git clone %(Repository.Url).git --depth 1 -b %(Branch) --single-branch %(LocalPath) + git clone %(Repository.Url).git -b %(Branch) --single-branch + $(CloneCommand) --depth 1 + $(CloneCommand) %(Repository.LocalPath) + + git -C %(Repository.LocalPath) checkout %(Repository.OldCommit) + + true - + + diff --git a/src/index/repositories.props b/src/index/repositories.props index a734738..fce4339 100644 --- a/src/index/repositories.props +++ b/src/index/repositories.props @@ -34,6 +34,7 @@ https://github.com/Microsoft/msbuild master + 91c86a746b312fce1aba31f8fb8540e949c11a01 build/**/*.csproj; build/**/*.vbproj;