mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-12-11 15:45:19 +03:00
Address CR comments.
This commit is contained in:
parent
7f0b7354a5
commit
bc6ba9b108
@ -2,6 +2,10 @@
|
||||
|
||||
## Next Version
|
||||
|
||||
#### Added
|
||||
|
||||
- Added Bash 4 style recursive globbing (`**/*`) when excluding files from target sources. [#636](https://github.com/yonaskolb/XcodeGen/pull/636) @bclymer
|
||||
|
||||
#### Fixed
|
||||
- Fixed included specs that were referenced multiple times from duplicating content [#599](https://github.com/yonaskolb/XcodeGen/pull/599) @haritowa
|
||||
- Fixed `.orig` files being added to the project [#627](https://github.com/yonaskolb/XcodeGen/pull/627) @keith
|
||||
|
@ -304,7 +304,7 @@ A source can be provided via a string (the path) or an object of the form:
|
||||
- [x] **path**: **String** - The path to the source file or directory.
|
||||
- [ ] **name**: **String** - Can be used to override the name of the source file or directory. By default the last component of the path is used for the name
|
||||
- [ ] **compilerFlags**: **[String]** or **String** - A list of compilerFlags to add to files under this specific path provided as a list or a space delimitted string. Defaults to empty.
|
||||
- [ ] **excludes**: **[String]** - A list of [global patterns](https://en.wikipedia.org/wiki/Glob_(programming)) representing the files to exclude. These rules are relative to `path` and _not the directory where `project.yml` resides_.
|
||||
- [ ] **excludes**: **[String]** - A list of [global patterns](https://en.wikipedia.org/wiki/Glob_(programming)) representing the files to exclude. These rules are relative to `path` and _not the directory where `project.yml` resides_. XcodeGen uses Bash 4's Glob behaviors where globstar (**) is enabled.
|
||||
- [ ] **createIntermediateGroups**: **Bool** - This overrides the value in [Options](#options)
|
||||
- [ ] **optional**: **Bool** - Disable missing path check. Defaults to false.
|
||||
- [ ] **buildPhase**: **String** - This manually sets the build phase this file or files in this directory will be added to, otherwise XcodeGen will guess based on the file extension. Note that `Info.plist` files will never be added to any build phases, no matter what this setting is. Possible values are:
|
||||
@ -348,7 +348,8 @@ targets:
|
||||
- "ios/*.[mh]"
|
||||
- "configs/server[0-2].json"
|
||||
- "*-Private.h"
|
||||
- "**/*.md"
|
||||
- "**/*.md" # excludes all files with the .md extension
|
||||
- "ios/**/*Tests.[hm] # excludes all files with an h or m extension within the ios directory.
|
||||
compilerFlags:
|
||||
- "-Werror"
|
||||
- "-Wextra"
|
||||
|
@ -117,7 +117,7 @@ public class Glob: Collection {
|
||||
|
||||
// MARK: Protocol of IndexableBase
|
||||
|
||||
public func index(after i: Glob.Index) -> Glob.Index {
|
||||
public func index(after i: Int) -> Int {
|
||||
return i + 1
|
||||
}
|
||||
|
||||
|
@ -302,8 +302,10 @@ class SourceGenerator {
|
||||
let rootSourcePath = project.basePath + targetSource.path
|
||||
|
||||
return Set(
|
||||
targetSource.excludes.map {
|
||||
return expandPattern("\(rootSourcePath)/\($0)")
|
||||
targetSource.excludes.map { pattern in
|
||||
guard !pattern.isEmpty else { return [] }
|
||||
return Glob(pattern: "\(rootSourcePath)/\(pattern)")
|
||||
.map { Path($0) }
|
||||
.map {
|
||||
guard $0.isDirectory else {
|
||||
return [$0]
|
||||
@ -317,21 +319,6 @@ class SourceGenerator {
|
||||
)
|
||||
}
|
||||
|
||||
private func expandPattern(_ pattern: String) -> [Path] {
|
||||
let filePaths = listFilePaths(pattern: pattern)
|
||||
let urls = filePaths.map { Path($0) }
|
||||
|
||||
return urls
|
||||
}
|
||||
|
||||
private func listFilePaths(pattern: String) -> [String] {
|
||||
guard !pattern.isEmpty else {
|
||||
return []
|
||||
}
|
||||
|
||||
return Glob(pattern: pattern).paths
|
||||
}
|
||||
|
||||
/// Checks whether the path is not in any default or TargetSource excludes
|
||||
func isIncludedPath(_ path: Path) -> Bool {
|
||||
return !defaultExcludedFiles.contains(where: { path.lastComponent.contains($0) })
|
||||
|
Loading…
Reference in New Issue
Block a user