Skip to content

Commit ca0d137

Browse files
ric-olivclaude
andauthored
build: gate Cocoa bindings regeneration on a stamp file (#5598)
The generated files were the target's Outputs, but Objective Sharpie writes ApiDefinition.cs before patch-cocoa-bindings.cs makes it valid C#. A parallel build sampling the timestamps in between skipped generation and compiled the unpatched output. Gate the check on a stamp touched once generation and patching are both done, so a late instance blocks on the in-flight TargetFramework=once request. The generated files stay in Outputs so a deleted one still forces regeneration. Latent until #5594 removed a non-existent glob input that had been forcing the target to run every time. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 7776365 commit ca0d137

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<PropertyGroup>
1919
<SentryCocoaFramework>$(SentryCocoaCache)Carthage\Build-$(TargetPlatformIdentifier)\SentryObjC-Dynamic.xcframework</SentryCocoaFramework>
2020
<SentryCocoaBindingInputs>../../scripts/generate-cocoa-bindings.ps1;../../scripts/patch-cocoa-bindings.cs;../../.config/dotnet-tools.json;$(SentryCocoaCache)Carthage/.built-from-sha</SentryCocoaBindingInputs>
21+
<SentryCocoaBindingsStamp>$(MSBuildThisFileDirectory)obj/cocoa-bindings.stamp</SentryCocoaBindingsStamp>
2122
<!-- Resolve path to modules/sentry-cocoa/.git -->
2223
<SentryCocoaGitFile Condition="Exists('$(SentryCocoaCache).git')">$([MSBuild]::NormalizePath($(MSBuildThisFileDirectory), $(SentryCocoaCache).git))</SentryCocoaGitFile>
2324
<!-- Standalone clone: .git is a directory -->
@@ -100,13 +101,14 @@
100101
<Target Name="_GenerateSentryCocoaBindings"
101102
Condition="$([MSBuild]::IsOSPlatform('OSX'))"
102103
Inputs="$(SentryCocoaBindingInputs)"
103-
Outputs="ApiDefinition.cs;StructsAndEnums.cs">
104+
Outputs="ApiDefinition.cs;StructsAndEnums.cs;$(SentryCocoaBindingsStamp)">
104105
<MSBuild Projects="$(MSBuildProjectFile)" Targets="_InnerGenerateSentryCocoaBindings" Properties="TargetFramework=once" />
105106
</Target>
106107
<Target Name="_InnerGenerateSentryCocoaBindings">
107108
<Exec Command="pwsh ../../scripts/generate-cocoa-bindings.ps1" />
108109
<!-- See https://github.com/getsentry/sentry-dotnet/pull/2558 -->
109110
<Exec Condition="'$(GITHUB_ACTIONS)' == 'true'" Command="pwsh ../../scripts/dirty-check.ps1 -PathToCheck $(MSBuildThisFileDirectory)" />
111+
<Touch Files="$(SentryCocoaBindingsStamp)" AlwaysCreate="true" />
110112
</Target>
111113

112114
<!-- Workaround for https://github.com/xamarin/xamarin-macios/issues/15299. -->

0 commit comments

Comments
 (0)