Add PrivacyInfo.xcprivacy to plugin template (#148485)

Adds an empty privacy manifest, and commented out code to include it in the build, to the plugin template. This will make it much easier to explain how to add a privacy manifest in plugin docs, since instead of explaining the format of the file from scratch and providing example code to inculde it, we can just instruct people to add entries to an exisitng file and then uncomment a line or two. This will also make it much easier to figure out from the template output itself how to add support for people who don't find the documentation.

Part of https://github.com/flutter/flutter/issues/131940

Fixes https://github.com/flutter/flutter/issues/140013
This commit is contained in:
stuartmorgan 2024-05-16 15:58:11 -04:00 committed by GitHub
parent 3a27301013
commit b98ffdc467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 73 additions and 5 deletions

View File

@ -26,4 +26,15 @@ Pod::Spec.new do |s|
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
# If your plugin requires a privacy manifest, for example if it uses any
# required reason APIs, update the PrivacyInfo.xcprivacy file to describe your
# plugin's privacy impact, and then uncomment this line. For more information,
# see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
{{#withSwiftPackageManager}}
# s.resource_bundles = {'{{projectName}}_privacy' => ['{{projectName}}/Sources/{{projectName}}/PrivacyInfo.xcprivacy']}
{{/withSwiftPackageManager}}
{{^withSwiftPackageManager}}
# s.resource_bundles = {'{{projectName}}_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
{{/withSwiftPackageManager}}
end

View File

@ -25,4 +25,15 @@ Pod::Spec.new do |s|
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
# If your plugin requires a privacy manifest, for example if it uses any
# required reason APIs, update the PrivacyInfo.xcprivacy file to describe your
# plugin's privacy impact, and then uncomment this line. For more information,
# see https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
{{#withSwiftPackageManager}}
# s.resource_bundles = {'{{projectName}}_privacy' => ['{{projectName}}/Sources/{{projectName}}/PrivacyInfo.xcprivacy']}
{{/withSwiftPackageManager}}
{{^withSwiftPackageManager}}
# s.resource_bundles = {'{{projectName}}_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
{{/withSwiftPackageManager}}
end

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>

View File

@ -17,7 +17,15 @@ let package = Package(
name: "{{projectName}}",
dependencies: [],
resources: [
.process("Resources"),
// If your plugin requires a privacy manifest, for example if it uses any required
// reason APIs, update the PrivacyInfo.xcprivacy file to describe your plugin's
// privacy impact, and then uncomment these lines. For more information, see
// https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
// .process("PrivacyInfo.xcprivacy"),
// If you have other resources that need to be bundled with your plugin, refer to
// the following instructions to add them:
// https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package
],
cSettings: [
.headerSearchPath("include/{{projectName}}"),

View File

@ -17,7 +17,15 @@ let package = Package(
name: "{{projectName}}",
dependencies: [],
resources: [
.process("Resources"),
// If your plugin requires a privacy manifest, for example if it uses any required
// reason APIs, update the PrivacyInfo.xcprivacy file to describe your plugin's
// privacy impact, and then uncomment these lines. For more information, see
// https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
// .process("PrivacyInfo.xcprivacy"),
// If you have other resources that need to be bundled with your plugin, refer to
// the following instructions to add them:
// https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package
]
)
]

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>

View File

@ -337,6 +337,7 @@
"templates/plugin_cocoapods/ios-objc.tmpl/Classes/pluginClass.m.tmpl",
"templates/plugin_cocoapods/ios-swift.tmpl/Classes/pluginClass.swift.tmpl",
"templates/plugin_cocoapods/ios.tmpl/Assets/.gitkeep",
"templates/plugin_cocoapods/ios.tmpl/Resources/PrivacyInfo.xcprivacy",
"templates/plugin_cocoapods/macos.tmpl/Classes/pluginClass.swift.tmpl",
"templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Sources/projectName.tmpl/include/projectName.tmpl/pluginClass.h.tmpl",
@ -344,7 +345,7 @@
"templates/plugin_swift_package_manager/ios-objc.tmpl/projectName.tmpl/Package.swift.tmpl",
"templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.swift.tmpl",
"templates/plugin_swift_package_manager/ios-swift.tmpl/projectName.tmpl/Package.swift.tmpl",
"templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep",
"templates/plugin_swift_package_manager/ios.tmpl/projectName.tmpl/Sources/projectName.tmpl/PrivacyInfo.xcprivacy",
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/Resources/.gitkeep",
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Sources/projectName.tmpl/pluginClass.swift.tmpl",
"templates/plugin_swift_package_manager/macos.tmpl/projectName.tmpl/Package.swift.tmpl",

View File

@ -705,6 +705,7 @@ void main() {
'example/ios/Runner/Runner-Bridging-Header.h',
'example/lib/main.dart',
'ios/Classes/FlutterProjectPlugin.swift',
'ios/Resources/PrivacyInfo.xcprivacy',
'lib/flutter_project.dart',
],
unexpectedPaths: <String>[
@ -726,7 +727,7 @@ void main() {
<String>[
'ios/flutter_project/Package.swift',
'ios/flutter_project/Sources/flutter_project/FlutterProjectPlugin.swift',
'ios/flutter_project/Sources/flutter_project/Resources/.gitkeep',
'ios/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy',
'macos/flutter_project/Package.swift',
'macos/flutter_project/Sources/flutter_project/FlutterProjectPlugin.swift',
'macos/flutter_project/Sources/flutter_project/Resources/.gitkeep',
@ -755,7 +756,7 @@ void main() {
'ios/flutter_project/Package.swift',
'ios/flutter_project/Sources/flutter_project/include/flutter_project/FlutterProjectPlugin.h',
'ios/flutter_project/Sources/flutter_project/FlutterProjectPlugin.m',
'ios/flutter_project/Sources/flutter_project/Resources/.gitkeep',
'ios/flutter_project/Sources/flutter_project/PrivacyInfo.xcprivacy',
],
unexpectedPaths: <String>[
'ios/Classes/FlutterProjectPlugin.swift',