-
Notifications
You must be signed in to change notification settings - Fork 39
feat: Add support for buildable folder exceptions #308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9305ef8
Add exceptions to buildable folders
pepicrft dbc1dc3
Fix typo
pepicrft dd3d08e
Make init public
pepicrft 85e7758
Make exceptions a sequence
pepicrft aa86654
Add resolvedPaths
pepicrft 94891e1
Add resolved files
pepicrft ff99281
Add missing initializer
pepicrft 5bf9838
Make compiler flags optional
pepicrft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,16 +1,47 @@ | ||
| import Path | ||
|
|
||
| /// A buildable folder maps to an PBXFileSystemSynchronizedRootGroup in Xcode projects. | ||
| /// Represents a file inside a buildable folder, along with any compiler flags to apply to it. | ||
| public struct BuildableFolderFile: Sendable, Codable, Equatable, Hashable { | ||
| /// The absolute path to the file within the buildable folder. | ||
| public let path: AbsolutePath | ||
|
|
||
| /// Compiler flags to apply when building this file. An empty string means no extra flags. | ||
| public let compilerFlags: String? | ||
|
|
||
| /// Initializes a buildable folder file. | ||
| /// - Parameters: | ||
| /// - path: The absolute path to the file within the buildable folder. | ||
| /// - compilerFlags: Compiler flags to apply when building this file. An empty string means no extra flags. | ||
| public init(path: AbsolutePath, compilerFlags: String?) { | ||
| self.path = path | ||
| self.compilerFlags = compilerFlags | ||
| } | ||
| } | ||
|
|
||
| /// A buildable folder maps to a PBXFileSystemSynchronizedRootGroup in Xcode projects. | ||
| /// Synchronized groups were introduced in Xcode 16 to reduce git conflicts by having a reference | ||
| /// to a folder whose content is "synchronized" by Xcode itself. Think of it as Xcode resolving | ||
| /// the globs. | ||
| /// | ||
| /// This struct describes a buildable folder, the exception rules for files within it, and the resolved file list. | ||
| public struct BuildableFolder: Sendable, Codable, Equatable, Hashable { | ||
| /// The absolute path to the buildable folder. | ||
| public var path: AbsolutePath | ||
|
|
||
| /// Creates an instance of buildable folder. | ||
| /// - Parameter path: Absolute path to the buildable folder. | ||
| public init(path: AbsolutePath) { | ||
| /// Exceptions associated with this buildable folder, describing files to exclude or per-file build configuration overrides. | ||
| public var exceptions: BuildableFolderExceptions | ||
|
|
||
| /// The files resolved from this buildable folder, each with any per-file compiler flags. | ||
| public var resolvedFiles: [BuildableFolderFile] | ||
|
|
||
| /// Creates a new `BuildableFolder` instance. | ||
| /// - Parameters: | ||
| /// - path: The absolute path to the buildable folder. | ||
| /// - exceptions: The set of exceptions (such as excluded files or custom compiler flags) for the folder. | ||
| /// - resolvedFiles: The list of files resolved from the folder, each file optionally having compiler flags. | ||
| public init(path: AbsolutePath, exceptions: BuildableFolderExceptions, resolvedFiles: [BuildableFolderFile]) { | ||
| self.path = path | ||
| self.exceptions = exceptions | ||
| self.resolvedFiles = resolvedFiles | ||
| } | ||
| } | ||
This file contains hidden or 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,19 @@ | ||
| import Path | ||
|
|
||
| /// Represents exceptions for a buildable folder, such as files to exclude or specific compiler flags to apply. | ||
| public struct BuildableFolderException: Sendable, Codable, Equatable, Hashable { | ||
| /// A list of absolute paths to files excluded from the buildable folder. | ||
| public var excluded: [AbsolutePath] | ||
|
|
||
| /// A dictionary mapping files (referenced by their absolute path) to the compiler flags to apply. | ||
| public var compilerFlags: [AbsolutePath: String] | ||
|
|
||
| /// Creates a new exception for a buildable folder. | ||
| /// - Parameters: | ||
| /// - excluded: An array of absolute paths to files that should be excluded from the buildable folder. | ||
| /// - compilerFlags: A dictionary mapping absolute file paths to specific compiler flags to apply to those files. | ||
| public init(excluded: [AbsolutePath], compilerFlags: [AbsolutePath: String]) { | ||
| self.excluded = excluded | ||
| self.compilerFlags = compilerFlags | ||
| } | ||
| } |
This file contains hidden or 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,24 @@ | ||
| import Path | ||
|
|
||
| /// PBXFileSystemSynchronizedRootGroup have a one-to-many relationship with PBXFileSystemSynchronizedBuildFileExceptionSet | ||
| /// through .exceptions. Exceptions are used to exclude files and override conffigurations. | ||
| public struct BuildableFolderExceptions: Sendable, Codable, Equatable, Hashable, ExpressibleByArrayLiteral, Sequence { | ||
| /// A list with all the exceptions. | ||
| public var exceptions: [BuildableFolderException] | ||
|
|
||
| /// Create a group of exceptions to exclude files from your group or change the configuration of some of them. | ||
| /// - Parameter exceptions: The list of exceptions. | ||
| /// - Returns: An instance containing all the exceptions. | ||
| public init(arrayLiteral elements: BuildableFolderException...) { | ||
| exceptions = elements | ||
| } | ||
|
|
||
| public init(exceptions: [BuildableFolderException]) { | ||
| self.exceptions = exceptions | ||
| } | ||
|
|
||
| /// Returns an iterator over the contained exceptions. | ||
| public func makeIterator() -> [BuildableFolderException].Iterator { | ||
| exceptions.makeIterator() | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's possible to have a default init (as right now) and a convenience one with the new params? or make them optional with fallback values in the init? This would not beak all projects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not an interface you directly interact with in your
Project.swiftmanifests if that's what you're worried about