diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c113a95..f29d5c6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, macos-latest] + os: [windows-latest, macos-13] steps: - uses: actions/checkout@v4 - uses: microsoft/setup-msbuild@v1.1 @@ -27,8 +27,21 @@ jobs: run: pwsh ./scripts/install-win-sdk.ps1 16299 if: startsWith(matrix.os, 'windows') - - name: Setup Java SDK + # Setup Xamarin SDK that got removed on the latest MacOS VM + - name: Setup Xamarin MacOS SDK + if: startsWith(matrix.os, 'macos') + run: | + brew tap homebrew/cask-versions + brew install --cask xamarin-mac + - name: Setup Xamarin Android SDK + if: startsWith(matrix.os, 'macos') + run: brew install --cask xamarin-android + - name: Setup Xamarin iOS SDK + if: startsWith(matrix.os, 'macos') + run: brew install --cask xamarin-ios + + - name: Setup Java SDK uses: actions/setup-java@v4 with: distribution: 'temurin' @@ -40,24 +53,9 @@ jobs: packages: 'platforms;android-30' - run: msbuild Sentry.Xamarin.sln -p:Configuration=Release -t:restore - - - name: Build Solution with MSBuild - run: msbuild Sentry.Xamarin.sln -p:Configuration=Release - - name: Restore iOS Sample app NuGet - run: msbuild Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj -p:Configuration=Release -t:restore - if: startsWith(matrix.os, 'macos') - - name: Build iOS Sample app - run: msbuild Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj -p:Configuration=Release - if: startsWith(matrix.os, 'macos') - - name: Build Android Sample app - run: msbuild Samples/Sample.Xamarin.Droid/Sample.Xamarin.Droid.csproj -p:Configuration=Release - if: startsWith(matrix.os, 'windows') - - name: Build UWP Sample app - run: msbuild Samples/Sample.Xamarin.UWP/Sample.Xamarin.UWP.csproj /p:Platform=x64 /p:Configuration=Release - if: startsWith(matrix.os, 'windows') - - name: Build UWP Test Project - run: msbuild Tests/Sentry.Xamarin.Forms.UWP.Tests/Sentry.Xamarin.Forms.UWP.Tests.csproj /p:Platform=x64 /p:Configuration=Release - if: startsWith(matrix.os, 'windows') + - name: Build SDK, Sample and Tests + run: msbuild Sentry.Xamarin-CI-Build-${{ runner.os }}.slnf -p:Configuration=Release + - name: Setup VS Test uses: darenm/Setup-VSTest@v1 if: startsWith(matrix.os, 'windows') diff --git a/.gitignore b/.gitignore index 661e454..df8c00f 100644 --- a/.gitignore +++ b/.gitignore @@ -345,4 +345,4 @@ healthchecksdb /Tests/Sentry.Xamarin.Forms.Tests.UWP/Sentry.Xamarin.Forms.Tests.UWP.GeneratedMSBuildEditorConfig.editorconfig #Do not include tokens to external sources. -*.sentryclirc \ No newline at end of file +*.sentryclirc diff --git a/CHANGELOG.md b/CHANGELOG.md index 8996353..33cb492 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,80 @@ # Changelog +## Unreleased + +### Fixes + +- Validate PrivacyInfo.xcprivacy and warn users of required missing privacy parameters ([#152](https://github.com/getsentry/sentry-xamarin/pull/152)) + + Due to a requirement by apple, all Projects will require a ([Privacy Manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files)). Sentry will automatically patch your project with the required fields by Sentry if no privacy manifest file is provided. Otherwise, it will validate your privacy manifest file for the required fields by Sentry and warn you during the build time if the required keys are present or not when building an iOS project. + Below you can find a snippet of the minimum required privacy manifest required by Sentry Xamarin: +```xml + + + + + NSPrivacyCollectedDataTypes + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeCrashData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePerformanceData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeOtherDiagnosticData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + + +``` + ## 2.0.0 ### Sentry Self-hosted Compatibility @@ -411,4 +486,4 @@ Also available via NuGet: [Sentry](https://www.nuget.org/packages/Sentry/) [Sentry.Xamarin](https://www.nuget.org/packages/Sentry.Xamarin) -[Sentry.Xamarin.Forms](https://www.nuget.org/packages/Sentry.Xamarin.Forms) +[Sentry.Xamarin.Forms](https://www.nuget.org/packages/Sentry.Xamarin.Forms) \ No newline at end of file diff --git a/Samples/Sample.Xamarin.Core/Directory.Build.props b/Samples/Sample.Xamarin.Core/Directory.Build.props index b3a93f1..552f4c5 100644 --- a/Samples/Sample.Xamarin.Core/Directory.Build.props +++ b/Samples/Sample.Xamarin.Core/Directory.Build.props @@ -2,5 +2,6 @@ + diff --git a/Samples/Sample.Xamarin.Droid/Directory.Build.props b/Samples/Sample.Xamarin.Droid/Directory.Build.props index b3a93f1..552f4c5 100644 --- a/Samples/Sample.Xamarin.Droid/Directory.Build.props +++ b/Samples/Sample.Xamarin.Droid/Directory.Build.props @@ -2,5 +2,6 @@ + diff --git a/Samples/Sample.Xamarin.Mac/Directory.Build.props b/Samples/Sample.Xamarin.Mac/Directory.Build.props index b3a93f1..552f4c5 100644 --- a/Samples/Sample.Xamarin.Mac/Directory.Build.props +++ b/Samples/Sample.Xamarin.Mac/Directory.Build.props @@ -2,5 +2,6 @@ + diff --git a/Samples/Sample.Xamarin.UWP/Directory.Build.props b/Samples/Sample.Xamarin.UWP/Directory.Build.props index b3a93f1..552f4c5 100644 --- a/Samples/Sample.Xamarin.UWP/Directory.Build.props +++ b/Samples/Sample.Xamarin.UWP/Directory.Build.props @@ -2,5 +2,6 @@ + diff --git a/Samples/Sample.Xamarin.iOS/Directory.Build.props b/Samples/Sample.Xamarin.iOS/Directory.Build.props index b3a93f1..552f4c5 100644 --- a/Samples/Sample.Xamarin.iOS/Directory.Build.props +++ b/Samples/Sample.Xamarin.iOS/Directory.Build.props @@ -2,5 +2,6 @@ + diff --git a/Samples/Sample.Xamarin.iOS/PrivacyInfo.xcprivacy b/Samples/Sample.Xamarin.iOS/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..a9d5fb2 --- /dev/null +++ b/Samples/Sample.Xamarin.iOS/PrivacyInfo.xcprivacy @@ -0,0 +1,49 @@ + + + + + Some Key Group + + + test + test + + + test + test + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + + Another Key Group + + + test + test + + + test + test + + + + \ No newline at end of file diff --git a/Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj b/Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj index 5d38afb..2a0531d 100644 --- a/Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj +++ b/Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.csproj @@ -29,19 +29,19 @@ true - - - sentry-sdks - sentry-xamarin - + + sentry-sdks + sentry-xamarin + - - true - - true - --wait + + true + + true + --wait none true bin\iPhoneSimulator\Release @@ -49,8 +49,8 @@ 4 None x86_64 - - + + true @@ -76,9 +76,9 @@ Each of the below features are opt-in. Enable the features you wish to use. --> - - true - + + true + true none true @@ -88,8 +88,8 @@ ARM64 iPhone Developer Entitlements.plist - - + + @@ -101,6 +101,9 @@ + + Always + @@ -193,4 +196,4 @@ - + \ No newline at end of file diff --git a/Sentry.Xamarin-CI-Build-Windows.slnf b/Sentry.Xamarin-CI-Build-Windows.slnf new file mode 100644 index 0000000..580d157 --- /dev/null +++ b/Sentry.Xamarin-CI-Build-Windows.slnf @@ -0,0 +1,17 @@ +{ + "solution": { + "path": "Sentry.Xamarin.sln", + "projects": [ + "Src\\Sentry.Xamarin\\Sentry.Xamarin.csproj", + "Src\\Sentry.Xamarin.Forms\\Sentry.Xamarin.Forms.csproj", + "Samples\\Sample.Xamarin.Core\\Sample.Xamarin.Core.csproj", + "Samples\\Sample.Xamarin.UWP\\Sample.Xamarin.UWP.csproj", + "Samples\\Sample.Xamarin.Mac\\Sample.Xamarin.Mac.csproj", + "Samples\\Forms\\com.sentry.ovenlibrary\\com.sentry.ovenlibrary.csproj", + "Samples\\Sample.Xamarin.Droid\\Sample.Xamarin.Droid.csproj", + "Tests\\Sentry.Xamarin.Forms.Testing\\Sentry.Xamarin.Forms.Testing.csproj", + "Tests\\Sentry.Xamarin.Tests\\Sentry.Xamarin.Tests.csproj", + "Tests\\Sentry.Xamarin.Forms.UWP.Tests\\Sentry.Xamarin.Forms.UWP.Tests.csproj" + ] + } +} \ No newline at end of file diff --git a/Sentry.Xamarin-CI-Build-macOS.slnf b/Sentry.Xamarin-CI-Build-macOS.slnf new file mode 100644 index 0000000..e3af730 --- /dev/null +++ b/Sentry.Xamarin-CI-Build-macOS.slnf @@ -0,0 +1,15 @@ +{ + "solution": { + "path": "Sentry.Xamarin.sln", + "projects": [ + "Src\\Sentry.Xamarin\\Sentry.Xamarin.csproj", + "Src\\Sentry.Xamarin.Forms\\Sentry.Xamarin.Forms.csproj", + "Samples\\Sample.Xamarin.Core\\Sample.Xamarin.Core.csproj", + "Samples\\Sample.Xamarin.Mac\\Sample.Xamarin.Mac.csproj", + "Samples\\Forms\\com.sentry.ovenlibrary\\com.sentry.ovenlibrary.csproj", + "Samples\\Sample.Xamarin.Droid\\Sample.Xamarin.Droid.csproj", + "Tests\\Sentry.Xamarin.Forms.Testing\\Sentry.Xamarin.Forms.Testing.csproj", + "Tests\\Sentry.Xamarin.Tests\\Sentry.Xamarin.Tests.csproj" + ] + } +} \ No newline at end of file diff --git a/Src/Directory.Build.props b/Src/Directory.Build.props index 7ddbfde..4936559 100644 --- a/Src/Directory.Build.props +++ b/Src/Directory.Build.props @@ -2,6 +2,7 @@ + diff --git a/Src/Sentry.Xamarin/Privacy/SentryPrivacyInfo.xcprivacy b/Src/Sentry.Xamarin/Privacy/SentryPrivacyInfo.xcprivacy new file mode 100644 index 0000000..35c9e93 --- /dev/null +++ b/Src/Sentry.Xamarin/Privacy/SentryPrivacyInfo.xcprivacy @@ -0,0 +1,64 @@ + + + + + NSPrivacyCollectedDataTypes + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeCrashData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePerformanceData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeOtherDiagnosticData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + + \ No newline at end of file diff --git a/Src/Sentry.Xamarin/Sentry.Xamarin.csproj b/Src/Sentry.Xamarin/Sentry.Xamarin.csproj index 49156d0..bfcfc46 100644 --- a/Src/Sentry.Xamarin/Sentry.Xamarin.csproj +++ b/Src/Sentry.Xamarin/Sentry.Xamarin.csproj @@ -46,6 +46,9 @@ + + + diff --git a/Src/Sentry.Xamarin/buildTransitive/Sentry.Xamarin.targets b/Src/Sentry.Xamarin/buildTransitive/Sentry.Xamarin.targets new file mode 100644 index 0000000..0b7eeb4 --- /dev/null +++ b/Src/Sentry.Xamarin/buildTransitive/Sentry.Xamarin.targets @@ -0,0 +1,70 @@ + + + + + PrivacyInfo.xcprivacy + true + + + + + + @(ProjectPrivacyInfoList->'%(FullPath)') + + + + + + false + false + + + \s*NSPrivacyAccessedAPIType\s*<\/\s*key\s*>]]> + + + \s*NSPrivacyAccessedAPICategoryFileTimestamp<\/\s*string\s*>]]> + + + \s*NSPrivacyAccessedAPICategorySystemBootTime<\/\s*string\s*>]]> + + + \s*NSPrivacyAccessedAPITypeReasons\s*<\/\s*key\s*>\s*<\s*array\s*>\s*<\s*string\s*>([^<]+)<\/\s*string\s*>\s*<\/\s*array\s*>\s*]]> + + + + + + + + + + true + true + + For more information, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files + Or https://docs.sentry.io/platforms/dotnet/guides/xamarin/data-management/apple-privacy-manifest/ + + + + + + + + + + + $(MSBuildThisFileDirectory)../Privacy/SentryPrivacyInfo.xcprivacy + + + + $(PrivacyInfoFileName) + Always + + + +