From 24eece65b8c81340316e5b1361eb0382cc76c968 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 23 Sep 2024 16:21:39 -0400 Subject: [PATCH] [various] Adds macOS privacy manifests macOS privacy manifest enforcement is rolling out soon, so this brings all macOS plugins into alignment with our iOS policy of always having a manifest, including updating the repo tooling to enforce that. Very few plugins are affected because most share the implementation package with iOS, and we didn't do any target platform switching when adding the manifests for iOS, automatically covering macOS as well. Fixes https://github.com/flutter/flutter/issues/155564 --- .../file_selector_macos/CHANGELOG.md | 3 +- .../macos/file_selector_macos.podspec | 1 + .../macos/file_selector_macos/Package.swift | 5 ++- .../Resources/PrivacyInfo.xcprivacy | 12 +++++ .../file_selector_macos/pubspec.yaml | 2 +- .../url_launcher_macos/CHANGELOG.md | 3 +- .../macos/url_launcher_macos.podspec | 1 + .../url_launcher_macos/Resources/.gitkeep | 0 .../Resources/PrivacyInfo.xcprivacy | 12 +++++ .../url_launcher_macos/pubspec.yaml | 2 +- .../tool/lib/src/podspec_check_command.dart | 3 +- .../tool/test/podspec_check_command_test.dart | 44 +++++++++++++++++++ 12 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/Resources/PrivacyInfo.xcprivacy delete mode 100644 packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/Resources/.gitkeep create mode 100644 packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/Resources/PrivacyInfo.xcprivacy diff --git a/packages/file_selector/file_selector_macos/CHANGELOG.md b/packages/file_selector/file_selector_macos/CHANGELOG.md index e63c60bef003..77d143386343 100644 --- a/packages/file_selector/file_selector_macos/CHANGELOG.md +++ b/packages/file_selector/file_selector_macos/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.9.4+1 +* Adds privacy manifest. * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. ## 0.9.4 diff --git a/packages/file_selector/file_selector_macos/macos/file_selector_macos.podspec b/packages/file_selector/file_selector_macos/macos/file_selector_macos.podspec index bb4bffee9e00..e4b8a622d6aa 100644 --- a/packages/file_selector/file_selector_macos/macos/file_selector_macos.podspec +++ b/packages/file_selector/file_selector_macos/macos/file_selector_macos.podspec @@ -13,6 +13,7 @@ Displays native macOS open and save panels. s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos' } s.source_files = 'file_selector_macos/Sources/file_selector_macos/**/*.swift' + s.resource_bundles = {'file_selector_macos_privacy' => ['file_selector_macos/Sources/file_selector_macos/Resources/PrivacyInfo.xcprivacy']} s.dependency 'FlutterMacOS' s.platform = :osx, '10.14' diff --git a/packages/file_selector/file_selector_macos/macos/file_selector_macos/Package.swift b/packages/file_selector/file_selector_macos/macos/file_selector_macos/Package.swift index 97bd0cd8d5dc..d4bc3e313df1 100644 --- a/packages/file_selector/file_selector_macos/macos/file_selector_macos/Package.swift +++ b/packages/file_selector/file_selector_macos/macos/file_selector_macos/Package.swift @@ -19,7 +19,10 @@ let package = Package( targets: [ .target( name: "file_selector_macos", - dependencies: [] + dependencies: [], + resources: [ + .process("Resources") + ] ) ] ) diff --git a/packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/Resources/PrivacyInfo.xcprivacy b/packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000000..918d80be4306 --- /dev/null +++ b/packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,12 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/packages/file_selector/file_selector_macos/pubspec.yaml b/packages/file_selector/file_selector_macos/pubspec.yaml index eede201e8d92..a1eadce6f5af 100644 --- a/packages/file_selector/file_selector_macos/pubspec.yaml +++ b/packages/file_selector/file_selector_macos/pubspec.yaml @@ -2,7 +2,7 @@ name: file_selector_macos description: macOS implementation of the file_selector plugin. repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22 -version: 0.9.4 +version: 0.9.4+1 environment: sdk: ^3.3.0 diff --git a/packages/url_launcher/url_launcher_macos/CHANGELOG.md b/packages/url_launcher/url_launcher_macos/CHANGELOG.md index 81f5a10f7faa..2dcb75263873 100644 --- a/packages/url_launcher/url_launcher_macos/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_macos/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 3.2.1 +* Adds privacy manifest. * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. ## 3.2.0 diff --git a/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos.podspec b/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos.podspec index de18c66e7d0d..a7f88852d2c4 100644 --- a/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos.podspec +++ b/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos.podspec @@ -13,6 +13,7 @@ Pod::Spec.new do |s| s.author = { 'Flutter Team' => 'flutter-dev@googlegroups.com' } s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_macos' } s.source_files = 'url_launcher_macos/Sources/url_launcher_macos/**/*.swift' + s.resource_bundles = {'url_launcher_macos_privacy' => ['url_launcher_macos/Sources/url_launcher_macos/Resources/PrivacyInfo.xcprivacy']} s.dependency 'FlutterMacOS' s.platform = :osx, '10.14' diff --git a/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/Resources/.gitkeep b/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/Resources/.gitkeep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/Resources/PrivacyInfo.xcprivacy b/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000000..918d80be4306 --- /dev/null +++ b/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,12 @@ + + + + + NSPrivacyTrackingDomains + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/packages/url_launcher/url_launcher_macos/pubspec.yaml b/packages/url_launcher/url_launcher_macos/pubspec.yaml index 1f1d570ce661..d5e29fc0e9d5 100644 --- a/packages/url_launcher/url_launcher_macos/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher_macos description: macOS implementation of the url_launcher plugin. repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_macos issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 3.2.0 +version: 3.2.1 environment: sdk: ^3.3.0 diff --git a/script/tool/lib/src/podspec_check_command.dart b/script/tool/lib/src/podspec_check_command.dart index 4f1b5e0dfa55..b8aa218ffbc3 100644 --- a/script/tool/lib/src/podspec_check_command.dart +++ b/script/tool/lib/src/podspec_check_command.dart @@ -95,7 +95,8 @@ class PodspecCheckCommand extends PackageLoopingCommand { } } - if (pluginSupportsPlatform(platformIOS, package) && + if ((pluginSupportsPlatform(platformIOS, package) || + pluginSupportsPlatform(platformMacOS, package)) && !podspecs.any(_hasPrivacyManifest)) { printError('No PrivacyInfo.xcprivacy file specified. Please ensure that ' 'a privacy manifest is included in the build using ' diff --git a/script/tool/test/podspec_check_command_test.dart b/script/tool/test/podspec_check_command_test.dart index e416a488fc74..ddbf9db05a5a 100644 --- a/script/tool/test/podspec_check_command_test.dart +++ b/script/tool/test/podspec_check_command_test.dart @@ -605,5 +605,49 @@ void main() { [contains('Ran for 1 package(s)')], )); }); + + test('fails when a macOS plugin is missing a privacy manifest', () async { + final RepositoryPackage plugin = createFakePlugin( + 'plugin1', + packagesDir, + platformSupport: { + Platform.macOS: const PlatformDetails(PlatformSupport.inline), + }, + ); + _writeFakePodspec(plugin, 'macos'); + + Error? commandError; + final List output = await runCapturingPrint( + runner, ['podspec-check'], errorHandler: (Error e) { + commandError = e; + }); + + expect(commandError, isA()); + expect( + output, + containsAllInOrder( + [contains('No PrivacyInfo.xcprivacy file specified.')], + )); + }); + + test('passes when a macOS plugin has a privacy manifest', () async { + final RepositoryPackage plugin = createFakePlugin( + 'plugin1', + packagesDir, + platformSupport: { + Platform.macOS: const PlatformDetails(PlatformSupport.inline), + }, + ); + _writeFakePodspec(plugin, 'macos', includePrivacyManifest: true); + + final List output = + await runCapturingPrint(runner, ['podspec-check']); + + expect( + output, + containsAllInOrder( + [contains('Ran for 1 package(s)')], + )); + }); }); }