Skip to content

Commit

Permalink
[GoogleUtilities] Add privacy manifest for SPM / CocoaPods (#144)
Browse files Browse the repository at this point in the history
* [Draft] Test resource bundles and podspecs

* Fix dummy resource

* Add core subspec to expose resource bundle

* [GoogleUtilities] Add privacy manifest for SPM / CocoaPods

* Fix spacing in podspec

* fix target name

* Style

* Fix CI

* wrap text in comment

* Style
  • Loading branch information
ncooke3 authored Feb 16, 2024
1 parent d89bc7c commit f9f5058
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 8 deletions.
15 changes: 15 additions & 0 deletions GoogleUtilities.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,20 @@ other Google CocoaPods. They're not intended for direct public usage.
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"',
}

s.subspec 'Privacy' do |cs|
cs.resource_bundles = {
"GoogleUtilities_Privacy" => 'GoogleUtilities/Privacy/Resources/PrivacyInfo.xcprivacy'
}
end

s.subspec 'Environment' do |es|
es.source_files = [
'GoogleUtilities/Environment/**/*.[mh]',
'third_party/IsAppEncrypted/**/*.[mh]'
]
es.public_header_files = 'GoogleUtilities/Environment/Public/GoogleUtilities/*.h'
es.dependency 'PromisesObjC', '>= 1.2', '< 3.0'
es.dependency 'GoogleUtilities/Privacy'
es.frameworks = [
'Security'
]
Expand All @@ -51,6 +58,7 @@ other Google CocoaPods. They're not intended for direct public usage.
ls.source_files = 'GoogleUtilities/Logger/**/*.[mh]'
ls.public_header_files = 'GoogleUtilities/Logger/Public/GoogleUtilities/*.h'
ls.dependency 'GoogleUtilities/Environment'
ls.dependency 'GoogleUtilities/Privacy'
end


Expand All @@ -60,6 +68,7 @@ other Google CocoaPods. They're not intended for direct public usage.
ns.dependency 'GoogleUtilities/NSData+zlib'
ns.dependency 'GoogleUtilities/Logger'
ns.dependency 'GoogleUtilities/Reachability'
ns.dependency 'GoogleUtilities/Privacy'
ns.frameworks = [
'Security'
]
Expand All @@ -68,6 +77,7 @@ other Google CocoaPods. They're not intended for direct public usage.
s.subspec 'NSData+zlib' do |ns|
ns.source_files = 'GoogleUtilities/NSData+zlib/**/*.[mh]'
ns.public_header_files = 'GoogleUtilities/NSData+zlib/Public/GoogleUtilities/*.h'
ns.dependency 'GoogleUtilities/Privacy'
ns.libraries = [
'z'
]
Expand All @@ -76,6 +86,7 @@ other Google CocoaPods. They're not intended for direct public usage.
s.subspec 'Reachability' do |rs|
rs.source_files = 'GoogleUtilities/Reachability/**/*.[mh]'
rs.public_header_files = 'GoogleUtilities/Reachability/Public/GoogleUtilities/*.h'
rs.dependency 'GoogleUtilities/Privacy'
rs.ios.frameworks = [
'SystemConfiguration'
]
Expand All @@ -98,6 +109,7 @@ other Google CocoaPods. They're not intended for direct public usage.
adss.public_header_files = [
'GoogleUtilities/AppDelegateSwizzler/Public/GoogleUtilities/*.h',
]
adss.dependency 'GoogleUtilities/Privacy'
adss.dependency 'GoogleUtilities/Logger'
adss.dependency 'GoogleUtilities/Network'
adss.dependency 'GoogleUtilities/Environment'
Expand All @@ -106,12 +118,14 @@ other Google CocoaPods. They're not intended for direct public usage.
s.subspec 'ISASwizzler' do |iss|
iss.source_files = 'GoogleUtilities/ISASwizzler/**/*.[mh]', 'GoogleUtilities/Common/*.h'
iss.public_header_files = 'GoogleUtilities/ISASwizzler/Public/GoogleUtilities/*.h'
iss.dependency 'GoogleUtilities/Privacy'
end

s.subspec 'MethodSwizzler' do |mss|
mss.source_files = 'GoogleUtilities/MethodSwizzler/**/*.[mh]', 'GoogleUtilities/Common/*.h'
mss.public_header_files = 'GoogleUtilities/MethodSwizzler/Public/GoogleUtilities/*.h'
mss.dependency 'GoogleUtilities/Logger'
mss.dependency 'GoogleUtilities/Privacy'
end

s.subspec 'SwizzlerTestHelpers' do |sths|
Expand All @@ -124,6 +138,7 @@ other Google CocoaPods. They're not intended for direct public usage.
ud.source_files = 'GoogleUtilities/UserDefaults/**/*.[hm]'
ud.public_header_files = 'GoogleUtilities/UserDefaults/Public/GoogleUtilities/*.h'
ud.dependency 'GoogleUtilities/Logger'
ud.dependency 'GoogleUtilities/Privacy'
end

s.test_spec 'unit' do |unit_tests|
Expand Down
2 changes: 2 additions & 0 deletions GoogleUtilities/Privacy/Empty.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file is intentionally empty and satisfies SwiftPM's requirement that a
// target contain sources.
35 changes: 35 additions & 0 deletions GoogleUtilities/Privacy/Resources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array>
</array>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>1C8F.1</string>
<string>C56D.1</string>
</array>
</dict>
</array>
</dict>
</plist>

25 changes: 17 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,17 @@ let package = Package(
],
// TODO: Restructure directory structure to simplify the excludes here.
targets: [
.target(
name: "GoogleUtilities-Privacy",
path: "GoogleUtilities/Privacy",
resources: [.process("Resources/PrivacyInfo.xcprivacy")]
),
.target(
name: "GoogleUtilities-AppDelegateSwizzler",
dependencies: ["GoogleUtilities-Environment",
"GoogleUtilities-Logger",
"GoogleUtilities-Network"],
"GoogleUtilities-Network",
"GoogleUtilities-Privacy"],
path: "GoogleUtilities",
exclude: [
"AppDelegateSwizzler/README.md",
Expand Down Expand Up @@ -104,7 +110,8 @@ let package = Package(
name: "GoogleUtilities-Environment",
dependencies: [
.product(name: "FBLPromises", package: "Promises"),
.target(name: "third-party-IsAppEncrypted"),
"third-party-IsAppEncrypted",
"GoogleUtilities-Privacy",
],
path: "GoogleUtilities/Environment",
publicHeadersPath: "Public",
Expand All @@ -125,7 +132,7 @@ let package = Package(

.target(
name: "GoogleUtilities-Logger",
dependencies: ["GoogleUtilities-Environment"],
dependencies: ["GoogleUtilities-Environment", "GoogleUtilities-Privacy"],
path: "GoogleUtilities/Logger",
publicHeadersPath: "Public",
cSettings: [
Expand All @@ -135,7 +142,7 @@ let package = Package(

.target(
name: "GoogleUtilities-ISASwizzler",
dependencies: ["GoogleUtilities-Logger"],
dependencies: ["GoogleUtilities-Logger", "GoogleUtilities-Privacy"],
path: "GoogleUtilities/ISASwizzler",
publicHeadersPath: "Public",
cSettings: [
Expand All @@ -145,7 +152,7 @@ let package = Package(

.target(
name: "GoogleUtilities-MethodSwizzler",
dependencies: ["GoogleUtilities-Logger"],
dependencies: ["GoogleUtilities-Logger", "GoogleUtilities-Privacy"],
path: "GoogleUtilities/MethodSwizzler",
publicHeadersPath: "Public",
cSettings: [
Expand All @@ -156,7 +163,8 @@ let package = Package(
name: "GoogleUtilities-Network",
dependencies: ["GoogleUtilities-Logger",
"GoogleUtilities-NSData",
"GoogleUtilities-Reachability"],
"GoogleUtilities-Reachability",
"GoogleUtilities-Privacy"],
path: "GoogleUtilities/Network",
publicHeadersPath: "Public",
cSettings: [
Expand All @@ -165,6 +173,7 @@ let package = Package(
),
.target(
name: "GoogleUtilities-NSData",
dependencies: ["GoogleUtilities-Privacy"],
path: "GoogleUtilities/NSData+zlib",
publicHeadersPath: "Public",
cSettings: [
Expand All @@ -176,7 +185,7 @@ let package = Package(
),
.target(
name: "GoogleUtilities-Reachability",
dependencies: ["GoogleUtilities-Logger"],
dependencies: ["GoogleUtilities-Logger", "GoogleUtilities-Privacy"],
path: "GoogleUtilities/Reachability",
publicHeadersPath: "Public",
cSettings: [
Expand All @@ -185,7 +194,7 @@ let package = Package(
),
.target(
name: "GoogleUtilities-UserDefaults",
dependencies: ["GoogleUtilities-Logger"],
dependencies: ["GoogleUtilities-Logger", "GoogleUtilities-Privacy"],
path: "GoogleUtilities/UserDefaults",
publicHeadersPath: "Public",
cSettings: [
Expand Down

0 comments on commit f9f5058

Please sign in to comment.