Skip to content

Commit

Permalink
[tests] Fix determining whether we're building for the simulator or n…
Browse files Browse the repository at this point in the history
…ot. (#20852)

The 'Platform=iPhoneSimulator' property is not necessarily set for .NET
projects, so don't rely on it.
  • Loading branch information
rolfbjarne committed Jul 12, 2024
1 parent 01400da commit d1ec7a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/common/shared-dotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<NativeLibName>ios-fat</NativeLibName>
<!-- We need this because we'd otherwise default to the latest OS version we support, and we'll want to execute on earlier versions -->
<CompilerResponseFile>$(MSBuildThisFileDirectory)\..\..\src\rsp\dotnet\ios-defines-dotnet.rsp</CompilerResponseFile>
<!-- Determine whether we're building for the simulator (not device nor desktop) -->
<_IsSimulatorBuild Condition="'$(RuntimeIdentifier)$(RuntimeIdentifiers)' == '' Or $(RuntimeIdentifier.Contains('simulator')) Or $(RuntimeIdentifiers.Contains('iossimulator'))">true</_IsSimulatorBuild>
</PropertyGroup>
<ItemGroup Condition="'$(_PlatformName)' == 'iOS'">
</ItemGroup>
Expand All @@ -18,6 +20,8 @@
<AssetTargetFallback>xamarintvos10;$(AssetTargetFallback)</AssetTargetFallback>
<NativeLibName>tvos-fat</NativeLibName>
<CompilerResponseFile>$(MSBuildThisFileDirectory)\..\..\src\rsp\dotnet\tvos-defines-dotnet.rsp</CompilerResponseFile>
<!-- Determine whether we're building for the simulator (not device nor desktop) -->
<_IsSimulatorBuild Condition="'$(RuntimeIdentifier)$(RuntimeIdentifiers)' == '' Or $(RuntimeIdentifier.Contains('simulator')) Or $(RuntimeIdentifiers.Contains('tvossimulator'))">true</_IsSimulatorBuild>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.EndsWith('-tvos'))">
</ItemGroup>
Expand Down
6 changes: 5 additions & 1 deletion tests/monotouch-test/dotnet/shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<LinkMode>None</LinkMode>
<!-- Don't remove native symbols, because it makes debugging native crashes harder -->
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
<CodesignEntitlements Condition="'$(Platform)' == 'iPhoneSimulator'">$(MonoTouchTestDirectory)\Entitlements.plist</CodesignEntitlements>

<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants>

Expand Down Expand Up @@ -53,6 +52,11 @@

<Import Project="$(RootTestsDirectory)/common/shared-dotnet.csproj" />

<PropertyGroup>
<!-- Must be done after importing shared-dotnet.csproj -->
<CodesignEntitlements Condition="'$(_IsSimulatorBuild)' == 'true'">$(MonoTouchTestDirectory)\Entitlements.plist</CodesignEntitlements>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(RootTestsDirectory)\EmbeddedResources\dotnet\$(_PlatformName)\EmbeddedResources.csproj" />
<ProjectReference Include="$(RootTestsDirectory)\bindings-test\dotnet\$(_PlatformName)\bindings-test.csproj" />
Expand Down

8 comments on commit d1ec7a7

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.