|
12 | 12 | <SentryCocoaProperties>$([System.IO.File]::ReadAllText("$(MSBuildThisFileDirectory)../../modules/sentry-cocoa.properties"))</SentryCocoaProperties> |
13 | 13 | <SentryCocoaVersion>$([System.Text.RegularExpressions.Regex]::Match($(SentryCocoaProperties), 'version\s*=\s*([^\s]+)').Groups[1].Value)</SentryCocoaVersion> |
14 | 14 | <SentryCocoaFramework>$(SentryCocoaCache)Sentry-$(SentryCocoaVersion).xcframework</SentryCocoaFramework> |
| 15 | + <SentryCocoaBindingInputs>../../modules/sentry-cocoa.properties;../../scripts/generate-cocoa-bindings.ps1</SentryCocoaBindingInputs> |
15 | 16 | <!-- SentrySpan.g.cs: error CS0108: 'ISentrySpan.Serialize()' hides inherited member 'ISentrySerializable.Serialize()'. Use the new keyword if hiding was intended --> |
16 | 17 | <NoWarn>$(NoWarn);CS0108</NoWarn> |
17 | 18 | </PropertyGroup> |
18 | 19 |
|
| 20 | + <!-- Override values for local Cocoa SDK builds --> |
| 21 | + <PropertyGroup Condition="Exists('$(SentryCocoaCache).git')"> |
| 22 | + <SentryCocoaFramework>$(SentryCocoaCache)Carthage\Build-$(TargetPlatformIdentifier)\Sentry.xcframework</SentryCocoaFramework> |
| 23 | + <SentryCocoaBindingInputs>../../scripts/generate-cocoa-bindings.ps1;../../modules/sentry-cocoa/Carthage/.built-from-sha</SentryCocoaBindingInputs> |
| 24 | + </PropertyGroup> |
| 25 | + |
19 | 26 | <!-- Build empty assemblies when not on macOS, to pass the solution build. --> |
20 | 27 | <ItemGroup Condition="!$([MSBuild]::IsOSPlatform('OSX'))"> |
21 | 28 | <Compile Remove="*" /> |
|
52 | 59 | </ItemGroup> |
53 | 60 |
|
54 | 61 | <!-- Downloads and sets up the Cocoa SDK: dotnet msbuild /t:setupCocoaSDK src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj --> |
55 | | - <Target Name="_SetupCocoaSDK" |
56 | | - Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaFramework)')"> |
| 62 | + <Target Name="_DownloadCocoaSDK" |
| 63 | + Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaCache).git') And !Exists('$(SentryCocoaFramework)')"> |
57 | 64 |
|
58 | 65 | <Message Importance="High" Text="Setting up the Cocoa SDK version '$(SentryCocoaVersion)'." /> |
59 | 66 |
|
|
84 | 91 | SkipUnchangedFiles="true" /> |
85 | 92 | </Target> |
86 | 93 |
|
| 94 | + <!-- Build the Sentry Cocoa SDK from source --> |
| 95 | + <Target Name="_BuildCocoaSDK" |
| 96 | + Condition="$([MSBuild]::IsOSPlatform('OSX')) And Exists('$(SentryCocoaCache).git')" |
| 97 | + Inputs="..\..\modules\sentry-cocoa\.git\HEAD;..\..\scripts\build-sentry-cocoa.sh" Outputs="..\..\modules\sentry-cocoa\Carthage\.built-from-sha"> |
| 98 | + |
| 99 | + <Message Importance="High" Text="Building the Cocoa SDK from source." /> |
| 100 | + <Exec Command="bash ../../scripts/build-sentry-cocoa.sh" IgnoreStandardErrorWarningFormat="true" /> |
| 101 | + </Target> |
| 102 | + |
| 103 | + <!-- Choose between download and build --> |
| 104 | + <Target Name="_SetupCocoaSDK" |
| 105 | + DependsOnTargets="_DownloadCocoaSDK;_BuildCocoaSDK" |
| 106 | + Condition="$([MSBuild]::IsOSPlatform('OSX'))" /> |
| 107 | + |
87 | 108 | <!-- Setup exactly once: https://learn.microsoft.com/visualstudio/msbuild/run-target-exactly-once --> |
88 | 109 | <Target Name="SetupCocoaSDKBeforeOuterBuild" DependsOnTargets="_SetupCocoaSDK" |
89 | | - Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaFramework)')" |
| 110 | + Condition="$([MSBuild]::IsOSPlatform('OSX'))" |
90 | 111 | BeforeTargets="DispatchToInnerBuilds" /> |
91 | 112 |
|
92 | 113 | <Target Name="SetupCocoaSDK" |
93 | 114 | BeforeTargets="BeforeBuild" |
94 | | - Condition="$([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(SentryCocoaFramework)')"> |
| 115 | + Condition="$([MSBuild]::IsOSPlatform('OSX'))"> |
95 | 116 | <!-- Setup exactly once: https://learn.microsoft.com/visualstudio/msbuild/run-target-exactly-once --> |
96 | 117 | <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_SetupCocoaSDK" RemoveProperties="TargetFramework" /> |
97 | 118 | </Target> |
|
102 | 123 |
|
103 | 124 | <!-- Generate bindings --> |
104 | 125 | <Target Name="_GenerateSentryCocoaBindings" AfterTargets="SetupCocoaSDK" |
105 | | - Condition="$([MSBuild]::IsOSPlatform('OSX')) and Exists('$(SentryCocoaFrameworkHeaders)')" |
106 | | - Inputs="../../modules/sentry-cocoa.properties;../../scripts/generate-cocoa-bindings.ps1" |
| 126 | + Condition="$([MSBuild]::IsOSPlatform('OSX'))" |
| 127 | + Inputs="$(SentryCocoaBindingInputs)" |
107 | 128 | Outputs="ApiDefinitions.cs;StructsAndEnums.cs"> |
108 | 129 | <MSBuild Projects="$(MSBuildProjectFile)" Targets="_InnerGenerateSentryCocoaBindings" Properties="TargetFramework=once" /> |
109 | 130 | </Target> |
|
0 commit comments