-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Release Tooling] xcprivacy generation tooling (2)
- Loading branch information
Showing
5 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
ReleaseTooling/Sources/PrivacyManifestGenerator/PrivacyQuestionnaire.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import Foundation | ||
import PrivacyKit | ||
|
||
extension Questionnaire { | ||
/// Creates a questionnaire that, when complete, can be used to generate a Privacy Manifest. | ||
/// | ||
/// - Parameters: | ||
/// - xcframework: The xcframework to generate the Privacy Manifest for. | ||
/// - builder: The Privacy Manifest builder to mutate in each question's answer handler closure. | ||
/// - Returns: A questionnaire that can be used to generate a Privacy Manifest. | ||
static func makePrivacyQuestionnaire(for xcframework: URL, | ||
with builder: PrivacyManifest.Builder) -> Self { | ||
// TODO(ncooke3): Implement. | ||
Questionnaire() | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
ReleaseTooling/Sources/PrivacyManifestGenerator/Questionnaire.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import Foundation | ||
|
||
/// A structure representing a series of questions. | ||
struct Questionnaire { | ||
/// A structure representing a question within a questionnaire. | ||
struct Question { | ||
/// The question's string query, for example, _What is your name?_. | ||
let question: String | ||
/// A closure to be invoked with the answer to the question. | ||
let answerHandler: (_ answer: Any) throws -> Void | ||
} | ||
|
||
/// Moves to and returns the next question in the questionnaire. | ||
/// - Returns: The next question in the questionnaire, if any. | ||
mutating func nextQuestion() -> Question? { | ||
// TODO(ncooke3): Implement. | ||
nil | ||
} | ||
|
||
/// Calls the current question's answer handling closure with the given answer. | ||
/// - Parameter answer: The answer to pass to the current question's answer handling closure. | ||
func processAnswer(_ answer: String) throws { | ||
// TODO(ncooke3): Implement. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters