Skip to content

Commit 967309f

Browse files
[bcl-tests] fixes for compilation on Windows
Context: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=1047263 There are a couple fixes to get the BCL tests (and Xamarin.Android-Tests.sln) compiling on Windows. The `SystemUnzip` task is passing some file paths to `Directory.EnumerateFiles`. Since it does not appear that this would work; in general, it seems that `GetExtractedSourceEntries` should only return directories as a simple fix to this problem. Next, MSBuild is getting a duplicate `<Compile />` entry passed to `Csc` for `obj/Debug/App.cs`. There was a conditional `<Compile />` entry as well as one added during the `_GenerateApp_cs` task. It seems simpler to just remove the condition and the duplicate `<Compile />` entry, since `<BuildDependsOn />` causes the `_GenerateApp_cs` task to run first.
1 parent 42a1a26 commit 967309f

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/SystemUnzip.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async TTask ExtractFile (string tempDir, string sourceFile, string relativeDestD
108108
p.WaitForExit ();
109109
}
110110

111-
var entries = GetExtractedSourceEntries (nestedTemp);
111+
var entries = GetExtractedSourceDirectories (nestedTemp);
112112

113113
var seenDestFiles = new HashSet<string> ();
114114

@@ -164,12 +164,12 @@ async TTask ExtractFile (string tempDir, string sourceFile, string relativeDestD
164164
}
165165
}
166166

167-
IEnumerable<string> GetExtractedSourceEntries (string root)
167+
IEnumerable<string> GetExtractedSourceDirectories (string root)
168168
{
169-
var entries = Directory.EnumerateFileSystemEntries (root, SourceEntryGlobParts [0], SearchOption.TopDirectoryOnly);
169+
var entries = Directory.EnumerateDirectories (root, SourceEntryGlobParts [0], SearchOption.TopDirectoryOnly);
170170
for (int i = 1; i < SourceEntryGlobParts.Length; ++i) {
171171
entries = entries
172-
.SelectMany (e => Directory.EnumerateFileSystemEntries (e, SourceEntryGlobParts [i], SearchOption.TopDirectoryOnly));
172+
.SelectMany (e => Directory.EnumerateDirectories (e, SourceEntryGlobParts [i], SearchOption.TopDirectoryOnly));
173173
}
174174
return entries;
175175
}

tests/Xamarin.Android.Bcl-Tests/Xamarin.Android.Bcl-Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<Compile Include="Resources\Resource.designer.cs" />
6363
<Compile Include="System.Net\NetworkChangeTest.cs" />
6464
<Compile Include="System.Net.Http\HttpClientTest.cs" />
65-
<Compile Include="$(IntermediateOutputPath)\App.cs" Condition=" Exists('$(IntermediateOutputPath)\App.cs') "/>
65+
<Compile Include="$(IntermediateOutputPath)\App.cs" />
6666
</ItemGroup>
6767
<ItemGroup>
6868
<None Include="Resources\AboutResources.txt" />

tests/Xamarin.Android.Bcl-Tests/Xamarin.Android.Bcl-Tests.targets

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@
6767
Inputs="@(MonoTestAssembly->'..\..\bin\$(Configuration)\bcl-tests\%(Identity)')"
6868
Outputs="$(IntermediateOutputPath)\App.cs">
6969
<MakeDir Directories="$(IntermediateOutputPath)" />
70-
<ItemGroup>
71-
<Compile Include="$(IntermediateOutputPath)\App.cs" />
72-
</ItemGroup>
7370
<PropertyGroup>
7471
<_Assemblies>@(MonoTestAssembly->'"%(Identity)"', ', ')</_Assemblies>
7572
</PropertyGroup>

0 commit comments

Comments
 (0)