Skip to content

Commit 92c4092

Browse files
authored
Merge branch 'yonaskolb:master' into master
2 parents 60c761a + 87a275f commit 92c4092

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1667
-234
lines changed

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22

33
## Next Version
44

5+
## 2.38.0
6+
57
### Added
68

9+
- [Multi-destination targets](https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#supported-destinations) #1336 @amatig
10+
- Added `supportedDestinations` to target
11+
- Added optional new `platform` value of `auto` when using `supportedDestinations`
12+
- Added `destinationFilters` for sources and dependencies
13+
- Added `inferDestinationFiltersByPath`, a convenience filter for sources
714
- `.mlpackage` files now default to being a source type #1398 @aaron-foreflight
8-
15+
- Added support for `Build Tool Plug-ins` in `AggregateTarget` #1390 @BarredEwe
16+
917
### Fixed
1018

1119
- Fixed source file `includes` not working when no paths were found #1337 @shnhrrsn
20+
- Supports specifying multiple package products #1395 @simonbs
1221

1322
## 2.37.0
1423

@@ -359,7 +368,7 @@ Some support for Xcode Test Plans has been added. For now test plans are not gen
359368

360369
#### Fixed
361370

362-
- Fixed issue when linking and embeding static frameworks: they should be linked and NOT embed. #820 @acecilia
371+
- Fixed issue when linking and embedding static frameworks: they should be linked and NOT embed. #820 @acecilia
363372
- Fixed issue when generating projects for paths with a dot in the folder for swift sources. #826 @asifmohd
364373
- Prefix static library target filenames with 'lib' to match Xcode. #831 @ileitch
365374
- Fixed duplicate addition of carthage static frameworks. #829 @funzin

Docs/ProjectSpec.md

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ You can also use environment variables in your configuration file, by using `${S
2222
- [Target](#target)
2323
- [Product Type](#product-type)
2424
- [Platform](#platform)
25+
- [Supported Destinations](#supported-destinations)
2526
- [Sources](#sources)
2627
- [Target Source](#target-source)
2728
- [Dependency](#dependency)
@@ -69,7 +70,7 @@ You can also use environment variables in your configuration file, by using `${S
6970
- [ ] **targets**: **[String: [Target](#target)]** - The list of targets in the project mapped by name
7071
- [ ] **fileGroups**: **[String]** - A list of paths to add to the root of the project. These aren't files that will be included in your targets, but that you'd like to include in the project hierarchy anyway. For example a folder of xcconfig files that aren't already added by any target sources, or a Readme file.
7172
- [ ] **schemes**: **[Scheme](#scheme)** - A list of schemes by name. This allows more control over what is found in [Target Scheme](#target-scheme)
72-
- [ ] **schemeTemplates**: **[String: [Scheme Template](#scheme-template)]** - a list of schemes that can be used as templates for actual schems which reference them via a `template` property. They can be used to extract common scheme settings. Works great in combination with `include`.
73+
- [ ] **schemeTemplates**: **[String: [Scheme Template](#scheme-template)]** - a list of schemes that can be used as templates for actual schemes which reference them via a `template` property. They can be used to extract common scheme settings. Works great in combination with `include`.
7374
- [ ] **targetTemplates**: **[String: [Target Template](#target-template)]** - a list of targets that can be used as templates for actual targets which reference them via a `template` property. They can be used to extract common target settings. Works great in combination with `include`.
7475
- [ ] **packages**: **[String: [Swift Package](#swift-package)]** - a map of Swift packages by name.
7576
- [ ] **projectReferences**: **[String: [Project Reference](#project-reference)]** - a map of project references by name
@@ -357,6 +358,7 @@ Settings are merged in the following order: `groups`, `base`, `configs` (simple
357358

358359
- [x] **type**: **[Product Type](#product-type)** - Product type of the target
359360
- [x] **platform**: **[Platform](#platform)** - Platform of the target
361+
- [ ] **supportedDestinations**: **[[Supported Destinations](#supported-destinations)]** - List of supported platform destinations for the target.
360362
- [ ] **deploymentTarget**: **String** - The deployment target (eg `9.2`). If this is not specified the value from the project set in [Options](#options)`.deploymentTarget.PLATFORM` will be used.
361363
- [ ] **sources**: **[Sources](#sources)** - Source directories of the target
362364
- [ ] **configFiles**: **[Config Files](#config-files)** - `.xcconfig` files per config
@@ -434,12 +436,15 @@ This will provide default build settings for a certain product type. It can be a
434436

435437
This will provide default build settings for a certain platform. It can be any of the following:
436438

439+
- `auto` (available only when we use `supportedDestinations`)
437440
- `iOS`
438-
- `macOS`
439441
- `tvOS`
442+
- `macOS`
440443
- `watchOS`
441444
- `visionOS` (`visionOS` doesn't support Carthage usage)
442445

446+
Note that when we use supported destinations with Xcode 14+ we can avoid the definition of platform that fallbacks to the `auto` value.
447+
443448
**Multi Platform targets**
444449

445450
You can also specify an array of platforms. This will generate a target for each platform.
@@ -470,6 +475,33 @@ targets:
470475

471476
The above will generate 2 targets named `MyFramework_iOS` and `MyFramework_tvOS`, with all the relevant platform build settings. They will both have a `PRODUCT_NAME` of `MyFramework`
472477

478+
### Supported Destinations
479+
480+
This will provide a mix of default build settings for the chosen platform destinations. It can be any of the following:
481+
482+
- `iOS`
483+
- `tvOS`
484+
- `macOS`
485+
- `macCatalyst`
486+
- `visionOS`
487+
488+
```yaml
489+
targets:
490+
MyFramework:
491+
type: framework
492+
supportedDestinations: [iOS, tvOS]
493+
deploymentTarget:
494+
iOS: 9.0
495+
tvOS: 10.0
496+
sources:
497+
- path: MySources
498+
inferDestinationFiltersByPath: true
499+
- path: OtherSources
500+
destinationFilters: [iOS]
501+
```
502+
503+
Note that the definition of supported destinations can be applied to every type of bundle making everything more easy to manage (app targets, unit tests, UI tests etc).
504+
473505
### Sources
474506

475507
Specifies the source directories for a target. This can either be a single source or a list of sources. Applicable source files, resources, headers, and `.lproj` files will be parsed appropriately.
@@ -484,7 +516,9 @@ A source can be provided via a string (the path) or an object of the form:
484516
- [ ] **compilerFlags**: **[String]** or **String** - A list of compilerFlags to add to files under this specific path provided as a list or a space delimited string. Defaults to empty.
485517
- [ ] **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.
486518
- [ ] **includes**: **[String]** - A list of global patterns in the same format as `excludes` representing the files to include. These rules are relative to `path` and _not the directory where `project.yml` resides_. If **excludes** is present and file conflicts with **includes**, **excludes** will override the **includes** behavior.
487-
- [ ] **createIntermediateGroups**: **Bool** - This overrides the value in [Options](#options)
519+
- [ ] **destinationFilters**: **[[Supported Destinations](#supported-destinations)]** - List of supported platform destinations the files should filter to. Defaults to all supported destinations.
520+
- [ ] **inferDestinationFiltersByPath**: **Bool** - This is a convenience filter that helps you to filter the files if their paths match these patterns `**/<supportedDestination>/*` or `*_<supportedDestination>.swift`. Note, if you use `destinationFilters` this flag will be ignored.
521+
- [ ] **createIntermediateGroups**: **Bool** - This overrides the value in [Options](#options).
488522
- [ ] **optional**: **Bool** - Disable missing path check. Defaults to false.
489523
- [ ] **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:
490524
- `sources` - Compile Sources phase
@@ -520,9 +554,11 @@ targets:
520554
MyTarget:
521555
sources: MyTargetSource
522556
MyOtherTarget:
557+
supportedDestinations: [iOS, tvOS]
523558
sources:
524559
- MyOtherTargetSource1
525560
- path: MyOtherTargetSource2
561+
inferDestinationFiltersByPath: true
526562
name: MyNewName
527563
excludes:
528564
- "ios/*.[mh]"
@@ -534,6 +570,7 @@ targets:
534570
- "-Werror"
535571
- "-Wextra"
536572
- path: MyOtherTargetSource3
573+
destinationFilters: [iOS]
537574
compilerFlags: "-Werror -Wextra"
538575
- path: ModuleMaps
539576
buildPhase:
@@ -561,10 +598,11 @@ A dependency can be one of a 6 types:
561598

562599
- [ ] **embed**: **Bool** - Whether to embed the dependency. Defaults to true for application target and false for non application targets.
563600
- [ ] **link**: **Bool** - Whether to link the dependency. Defaults to `true` depending on the type of the dependency and the type of the target (e.g. static libraries will only link to executables by default).
564-
- [ ] **codeSign**: **Bool** - Whether the `codeSignOnCopy` setting is applied when embedding framework. Defaults to true
565-
- [ ] **removeHeaders**: **Bool** - Whether the `removeHeadersOnCopy` setting is applied when embedding the framework. Defaults to true
566-
- [ ] **weak**: **Bool** - Whether the `Weak` setting is applied when linking the framework. Defaults to false
567-
- [ ] **platformFilter**: **String** - This field is specific to Mac Catalyst. It corresponds to the "Platforms" dropdown in the Frameworks & Libraries section of Target settings in Xcode. Available options are: **iOS**, **macOS** and **all**. Defaults is **all**
601+
- [ ] **codeSign**: **Bool** - Whether the `codeSignOnCopy` setting is applied when embedding framework. Defaults to true.
602+
- [ ] **removeHeaders**: **Bool** - Whether the `removeHeadersOnCopy` setting is applied when embedding the framework. Defaults to true.
603+
- [ ] **weak**: **Bool** - Whether the `Weak` setting is applied when linking the framework. Defaults to false.
604+
- [ ] **platformFilter**: **String** - This field is specific to Mac Catalyst. It corresponds to the "Platforms" dropdown in the Frameworks & Libraries section of Target settings in Xcode. Available options are: **iOS**, **macOS** and **all**. Defaults is **all**.
605+
- [ ] **destinationFilters**: **[[Supported Destinations](#supported-destinations)]** - List of supported platform destinations this dependency should filter to. Defaults to all supported destinations.
568606
- [ ] **platforms**: **[[Platform](#platform)]** - List of platforms this dependency should apply to. Defaults to all applicable platforms.
569607
- **copy** - Copy Files Phase for this dependency. This only applies when `embed` is true. Must be specified as an object with the following fields:
570608
- [x] **destination**: **String** - Destination of the Copy Files phase. This can be one of the following values:
@@ -614,13 +652,17 @@ projectReferences:
614652
path: path/to/FooLib.xcodeproj
615653
targets:
616654
MyTarget:
655+
supportedDestinations: [iOS, tvOS]
617656
dependencies:
618657
- target: MyFramework
658+
destinationFilters: [iOS]
619659
- target: FooLib/FooTarget
620660
- framework: path/to/framework.framework
661+
destinationFilters: [tvOS]
621662
- carthage: Result
622663
findFrameworks: false
623664
linkType: static
665+
destinationFilters: [iOS]
624666
- sdk: Contacts.framework
625667
- sdk: libc++.tbd
626668
- sdk: libz.dylib
@@ -646,7 +688,8 @@ targets:
646688
```
647689

648690
**Package dependency**
649-
- [ ] **product**: **String** - The product to use from the package. This defaults to the package name, so is only required if a Package has multiple libraries or a library with a differing name
691+
- [ ] **product**: **String** - The product to use from the package. This defaults to the package name, so is only required if a Package has multiple libraries or a library with a differing name. Use this over `products` when you want to define different linking options per product.
692+
- [ ] **products**: **String** - A list of products to use from the package. This can be used when depending on multiple products from a package.
650693

651694
```yaml
652695
packages:
@@ -664,6 +707,21 @@ targets:
664707
product: SPMUtility
665708
```
666709

710+
Depending on multiple products from a package:
711+
712+
```yaml
713+
packages:
714+
FooFeature:
715+
path: Packages/FooFeature
716+
targets:
717+
App:
718+
dependencies:
719+
- package: FooFeature
720+
products:
721+
- FooDomain
722+
- FooUI
723+
```
724+
667725
### Config Files
668726

669727
Specifies `.xcconfig` files for each configuration.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TOOL_NAME = XcodeGen
22
export EXECUTABLE_NAME = xcodegen
3-
VERSION = 2.37.0
3+
VERSION = 2.38.0
44

55
PREFIX = /usr/local
66
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ swift run xcodegen
113113
Add the following to your Package.swift file's dependencies:
114114

115115
```swift
116-
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.37.0"),
116+
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.38.0"),
117117
```
118118

119119
And then import wherever needed: `import XcodeGenKit`

SettingPresets/Platforms/tvOS.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
TARGETED_DEVICE_FAMILY: 3
21
LD_RUNPATH_SEARCH_PATHS: ["$(inherited)", "@executable_path/Frameworks"]
32
SDKROOT: appletvos
3+
TARGETED_DEVICE_FAMILY: 3
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SUPPORTED_PLATFORMS: iphoneos iphonesimulator
2+
TARGETED_DEVICE_FAMILY: '1,2'
3+
SUPPORTS_MACCATALYST: NO
4+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: YES
5+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: YES
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SUPPORTS_MACCATALYST: YES
2+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SUPPORTED_PLATFORMS: macosx
2+
SUPPORTS_MACCATALYST: NO
3+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SUPPORTED_PLATFORMS: appletvos appletvsimulator
2+
TARGETED_DEVICE_FAMILY: '3'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SUPPORTED_PLATFORMS: xros xrsimulator
2+
TARGETED_DEVICE_FAMILY: '7'
3+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: NO

0 commit comments

Comments
 (0)