Skip to content

Commit 1b72a18

Browse files
jonathanpeppersjonpryor
authored andcommitted
[tests] Xamarin.Android-Tests.sln builds on Windows (#853)
- Needed to `nuget restore Xamarin.Android-Tests.sln` - Added `$(XAIntegratedTests)` property which defaults to True. Windows will need to set this property in order to build `Xamarin.Android-Tests.sln` - Some project references in `Mono.Android-Tests.csproj` should be conditional against `$(XAIntegratedTests)`==True - Usage of `zip -r` is replaced with `jar cf` using `$(JarPath)` (Windows doesn't have `zip`) - `Xamarin.Android.Build.Tasks.csproj` had a file-locking issue similar to `create-vsix.csproj` (2bca09d): the `_GenerateXACommonProps` target needs to depend on `ResolveReferences` Other changes: - Update README - Update .gitignore for `.gradle/` and `*.user` files
1 parent b60bb83 commit 1b72a18

File tree

11 files changed

+22
-14
lines changed

11 files changed

+22
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.userprefs
2+
*.user
23
bin
34
Configuration.Override.props
45
Configuration.OperatingSystem.props
@@ -11,6 +12,7 @@ TestResult.xml
1112
TestResult-*.xml
1213
TestResult-*.csv
1314
.vs/
15+
.gradle/
1416
Resource.designer.cs
1517
logcat-*.txt
1618
apk-sizes-*.txt

Configuration.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<AllSupportedTargetAndroidAbis>$(AllSupported32BitTargetAndroidAbis);$(AllSupported64BitTargetAndroidAbis)</AllSupportedTargetAndroidAbis>
6969
<XABuildToolsVersion>26.0.1</XABuildToolsVersion>
7070
<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">26.0.1</XABuildToolsFolder>
71+
<XAIntegratedTests Condition="'$(XAIntegratedTests)' == ''">True</XAIntegratedTests>
7172
<PathSeparator>$([System.IO.Path]::PathSeparator)</PathSeparator>
7273
</PropertyGroup>
7374
<PropertyGroup>

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ and `$(TargetFrameworkVersion)`s. If you want a complete environment --
238238

239239
make jenkins
240240

241-
Unit tests are build in a separate target:
241+
Unit tests are built in a separate target:
242242

243243
make all-tests
244244

@@ -251,7 +251,11 @@ To build Xamarin.Android, ensure you are using MSBuild version 15+ and run:
251251

252252
These are roughly the same as how `make prepare` and `make` are used on other platforms.
253253

254-
_NOTE: there is not currently an equivalent of `make jenkins` or `make all-tests` on Windows._
254+
Unit tests are built on Windows via:
255+
256+
msbuild Xamarin.Android-Tests.sln /p:XAIntegratedTests=False
257+
258+
_NOTE: there is not currently an equivalent of `make jenkins` on Windows._
255259

256260
_Troubleshooting: Ensure you check your MSBuild version(`msbuild -version`) and path for the proper version of MSBuild._
257261

build-tools/scripts/PrepareWindows.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
Replacements="@JAVA_HOME@=$(_JavaSdkDirectory)"
2929
/>
3030
<Exec Command="$(_NuGet) restore Xamarin.Android.sln" WorkingDirectory="$(_TopDir)" />
31+
<Exec Command="$(_NuGet) restore Xamarin.Android-Tests.sln" WorkingDirectory="$(_TopDir)" />
3132
<Exec Command="$(_NuGet) restore external\Java.Interop\Java.Interop.sln" WorkingDirectory="$(_TopDir)" />
3233
<Exec Command="$(_NuGet) restore external\LibZipSharp\libZipSharp.sln" WorkingDirectory="$(_TopDir)" />
3334
<Exec Command="$(_NuGet) restore external\xamarin-android-tools\Xamarin.Android.Tools.sln" WorkingDirectory="$(_TopDir)" />

src/Mono.Android/Test/Mono.Android-Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@
108108
<Private>False</Private>
109109
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
110110
</ProjectReference>
111-
<ProjectReference Include="..\..\Xamarin.Android.Build.Tasks\Xamarin.Android.Build.Tasks.csproj">
111+
<ProjectReference Include="..\..\Xamarin.Android.Build.Tasks\Xamarin.Android.Build.Tasks.csproj" Condition=" '$(XAIntegratedTests)' == 'True' ">
112112
<Name>Xamarin.Android.Build.Tasks</Name>
113113
<Project>{3F1F2F50-AF1A-4A5A-BEDB-193372F068D7}</Project>
114114
<Private>False</Private>
115115
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
116116
</ProjectReference>
117-
<ProjectReference Include="..\..\Xamarin.Android.NUnitLite\Xamarin.Android.NUnitLite.csproj">
117+
<ProjectReference Include="..\..\Xamarin.Android.NUnitLite\Xamarin.Android.NUnitLite.csproj" Condition=" '$(XAIntegratedTests)' == 'True' ">
118118
<Name>Xamarin.Android.NUnitLite</Name>
119119
<Project>{4D603AA3-3BFD-43C8-8050-0CD6C2601126}</Project>
120120
<Private>False</Private>

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
/>
126126
</Target>
127127
<Target Name="_GenerateXACommonProps"
128-
DependsOnTargets="GetXAVersionInfo"
128+
DependsOnTargets="ResolveReferences;GetXAVersionInfo"
129129
BeforeTargets="DeployOutputFiles"
130130
Inputs="Xamarin.Android.Common.props.in"
131131
Outputs="Xamarin.Android.Common.props">

tests/CodeGen-Binding/Xamarin.Android.LibraryProjectZip-LibBinding/Xamarin.Android.LibraryProjectZip-LibBinding.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Exec Command="&quot;$(NdkBuildPath)&quot;" />
1212
<MakeDir Directories="$(OutputPath)\native-lib-1" />
1313
<Exec
14-
Command="zip -r ../$(OutputPath)/native-lib-1/NativeLib.zip arm64-v8a armeabi armeabi-v7a x86 x86_64"
14+
Command="&quot;$(JarPath)&quot; cf ../$(OutputPath)/native-lib-1/NativeLib.zip arm64-v8a armeabi armeabi-v7a x86 x86_64"
1515
WorkingDirectory="libs"
1616
/>
1717
</Target>
@@ -30,11 +30,11 @@
3030
<MakeDir Directories="$(OutputPath)\native-lib-2" />
3131
<MakeDir Directories="$(OutputPath)\native-lib-2\aar-test" />
3232
<Exec
33-
Command="zip -r ../../$(OutputPath)/native-lib-2/aar-test/EmbeddedNativeLib.zip arm64-v8a armeabi armeabi-v7a x86 x86_64"
33+
Command="&quot;$(JarPath)&quot; cf ../../$(OutputPath)/native-lib-2/aar-test/EmbeddedNativeLib.zip arm64-v8a armeabi armeabi-v7a x86 x86_64"
3434
WorkingDirectory="simple2/libs"
3535
/>
3636
<Exec
37-
Command="zip -r NativeLib2.zip aar-test"
37+
Command="&quot;$(JarPath)&quot; cf NativeLib2.zip aar-test"
3838
WorkingDirectory="$(OutputPath)\native-lib-2"
3939
/>
4040
</Target>

tests/ResolveImports/Xamarin.Android.BindingResolveImportLib1/Xamarin.Android.BindingResolveImportLib1.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
</PropertyGroup>
6161
<Target Name="BuildJar" Inputs="Jars/com/xamarin/android/test/binding/resolveimport/Lib1.java" Outputs="Jars/lib1.zip">
6262
<Exec Command="&quot;$(JavaCPath)&quot; -source 1.5 -target 1.6 -d Jars -sourcepath Jars Jars/com/xamarin/android/test/binding/resolveimport/Lib1.java" />
63-
<Exec WorkingDirectory="Jars" Command="zip -r lib1.jar com" />
63+
<Exec WorkingDirectory="Jars" Command="&quot;$(JarPath)&quot; cf lib1.jar com" />
6464
<MakeDir Directories="Jars/zipped;Jars/zipped/bin" />
6565
<Copy SourceFiles="Jars/lib1.jar;Properties/AndroidManifest.xml" DestinationFiles="Jars/zipped/bin/lib1.jar;Jars/zipped/bin/AndroidManifest.xml" />
66-
<Exec WorkingDirectory="Jars/zipped" Command="zip -r lib1.zip bin" />
66+
<Exec WorkingDirectory="Jars/zipped" Command="&quot;$(JarPath)&quot; cf lib1.zip bin" />
6767
<Copy SourceFiles="Jars/zipped/lib1.zip" DestinationFiles="Jars/lib1.zip" />
6868
</Target>
6969
<Target Name="CleanJar">

tests/ResolveImports/Xamarin.Android.BindingResolveImportLib2/Xamarin.Android.BindingResolveImportLib2.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
</PropertyGroup>
7979
<Target Name="BuildJar" Inputs="Jars/com/xamarin/android/test/binding/resolveimport/Lib2.java" Outputs="Jars/lib2.jar">
8080
<Exec Command="&quot;$(JavaCPath)&quot; -source 1.5 -target 1.6 -d Jars -sourcepath Jars Jars/com/xamarin/android/test/binding/resolveimport/Lib2.java" />
81-
<Exec WorkingDirectory="Jars" Command="zip -r lib2.jar com" />
81+
<Exec WorkingDirectory="Jars" Command="&quot;$(JarPath)&quot; cf lib2.jar com" />
8282
</Target>
8383
<Target Name="CleanJar">
8484
<RemoveDir Directories="Jars/bin" />

tests/ResolveImports/Xamarin.Android.BindingResolveImportLib3/Xamarin.Android.BindingResolveImportLib3.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@
7878
</PropertyGroup>
7979
<Target Name="BuildJar" Inputs="Jars/com/xamarin/android/test/binding/resolveimport/Lib3.java" Outputs="Jars/lib3.zip">
8080
<Exec Command="&quot;$(JavaCPath)&quot; -source 1.5 -target 1.6 -d Jars -sourcepath Jars Jars/com/xamarin/android/test/binding/resolveimport/Lib3.java" />
81-
<Exec WorkingDirectory="Jars" Command="zip -r lib3.jar com" />
81+
<Exec WorkingDirectory="Jars" Command="&quot;$(JarPath)&quot; cf lib3.jar com" />
8282
<MakeDir Directories="Jars/zipped;Jars/zipped/bin" />
8383
<Copy SourceFiles="Jars/lib3.jar;Properties/AndroidManifest.xml" DestinationFiles="Jars/zipped/bin/lib3.jar;Jars/zipped/bin/AndroidManifest.xml" />
84-
<Exec WorkingDirectory="Jars/zipped" Command="zip -r lib3.zip bin" />
84+
<Exec WorkingDirectory="Jars/zipped" Command="&quot;$(JarPath)&quot; cf lib3.zip bin" />
8585
<Copy SourceFiles="Jars/zipped/lib3.zip" DestinationFiles="Jars/lib3.zip" />
8686
</Target>
8787
<Target Name="CleanJar">

tests/ResolveImports/Xamarin.Android.BindingResolveImportLib4/Xamarin.Android.BindingResolveImportLib4.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</PropertyGroup>
7777
<Target Name="BuildJar" Inputs="Jars/com/xamarin/android/test/binding/resolveimport/Lib4.java" Outputs="Jars/lib4.jar">
7878
<Exec Command="&quot;$(JavaCPath)&quot; -source 1.5 -target 1.6 -d Jars -sourcepath Jars Jars/com/xamarin/android/test/binding/resolveimport/Lib4.java" />
79-
<Exec WorkingDirectory="Jars" Command="zip -r lib4.jar com" />
79+
<Exec WorkingDirectory="Jars" Command="&quot;$(JarPath)&quot; cf lib4.jar com" />
8080
</Target>
8181
<Target Name="CleanJar">
8282
<RemoveDir Directories="Jars/bin" />

0 commit comments

Comments
 (0)