Skip to content

Commit ae85cb0

Browse files
Merge pull request #1099 from apollographql/xcode-11.4
Update swift-tools to 5.2
2 parents fd70bfd + 916706d commit ae85cb0

4 files changed

Lines changed: 32 additions & 23 deletions

File tree

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ version: 2.1
33
parameters:
44
xcode_version:
55
type: string
6-
default: "11.3.1"
6+
default: "11.4.0"
77
ios_current_version:
88
type: string
9-
default: "13.3"
9+
default: "13.4"
1010
ios_previous_version:
1111
type: string
1212
default: "12.4"
1313
ios_sdk:
1414
type: string
15-
default: "iphonesimulator13.2"
15+
default: "iphonesimulator13.4"
1616
macos_version: # The user-facing version string for macOS builds
1717
type: string
1818
default: "10.15"
@@ -21,10 +21,10 @@ parameters:
2121
default: "macosx10.15"
2222
tvos_version: # The user-facing version string of tvOS builds
2323
type: string
24-
default: "13.3"
24+
default: "13.4"
2525
tvos_sdk:
2626
type: string
27-
default: "appletvsimulator13.2"
27+
default: "appletvsimulator13.4"
2828

2929
commands:
3030
common_test_steps:

Apollo.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@
17791779
);
17801780
runOnlyForDeploymentPostprocessing = 0;
17811781
shellPath = /bin/sh;
1782-
shellScript = "cd \"${SRCROOT}/SwiftScripts\"\nswift run Codegen -t \"GitHub\"\n";
1782+
shellScript = "cd \"${SRCROOT}/SwiftScripts\"\nxcrun -sdk macosx swift run Codegen -t \"GitHub\"\n";
17831783
};
17841784
9FCE2D061E6C251100E34457 /* Generate Apollo Client API */ = {
17851785
isa = PBXShellScriptBuildPhase;
@@ -1793,7 +1793,7 @@
17931793
);
17941794
runOnlyForDeploymentPostprocessing = 0;
17951795
shellPath = /bin/sh;
1796-
shellScript = "cd \"${SRCROOT}/SwiftScripts\"\nswift run Codegen -t \"StarWars\"\n";
1796+
shellScript = "cd \"${SRCROOT}/SwiftScripts\"\nxcrun -sdk macosx swift run Codegen -t \"StarWars\"\n";
17971797
showEnvVarsInLog = 0;
17981798
};
17991799
/* End PBXShellScriptBuildPhase section */

SwiftScripts/Package.swift

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.2
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "Codegen",
88
dependencies: [
9-
.package(path: ".."),
9+
.package(name: "Apollo", path: ".."),
1010
.package(url: "https://github.com/apple/swift-tools-support-core", from: "0.0.1"),
1111
.package(url: "https://github.com/designatednerd/SourceDocs.git", .branch("master"))
1212
],
1313
targets: [
14-
.target(
15-
name: "Codegen",
16-
dependencies: ["ApolloCodegenLib", "SwiftToolsSupport-auto"]),
14+
.target(name: "Codegen",
15+
dependencies: [
16+
.product(name: "ApolloCodegenLib", package: "Apollo"),
17+
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
18+
]),
1719
.target(name: "SchemaDownload",
18-
dependencies: ["ApolloCodegenLib"]),
20+
dependencies: [
21+
.product(name: "ApolloCodegenLib", package: "Apollo"),
22+
]),
1923
.target(name: "DocumentationGenerator",
20-
dependencies: ["ApolloCodegenLib", "SourceDocsLib"]),
21-
.testTarget(
22-
name: "CodegenTests",
23-
dependencies: ["Codegen"]),
24+
dependencies: [
25+
.product(name: "ApolloCodegenLib", package: "Apollo"),
26+
.product(name: "SourceDocsLib", package: "SourceDocs"),
27+
]),
28+
.testTarget(name: "CodegenTests",
29+
dependencies: [
30+
"Codegen"
31+
]),
2432
]
2533
)

docs/source/swift-scripting.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ To begin, let's set up a Swift Package Manager executable:
3737
3838
```swift
3939
.target(name: "Codegen",
40-
dependencies: ["ApolloCodegenLib"])
40+
dependencies: [
41+
.product(name: "ApolloCodegenLib", package: "Apollo"),
42+
])
4143
```
4244
4345
6. In `main.swift`, import the Codegen lib at the top of the file:
@@ -245,16 +247,15 @@ Now, you're able to generate code from a debuggable Swift Package Manager execut
245247
1. Select the target in your project or workspace you want to run code generation, and go to the `Build Phases` tab.
246248

247249
2. Create a new Run Script Build Phase by selecting the **+** button in the upper left-hand corner:
250+
![New run script build phase dialog](screenshot/new_run_script_phase.png)
248251

249-
![New run script build phase dialog](screenshot/new_run_script_phase.png)
250-
251-
3. Update the build phase run script to `cd` into the folder where your executable's code lives, then run `swift run`.
252+
3. Update the build phase run script to `cd` into the folder where your executable's code lives, then run `swift run` (using `xcrun` so that you can ensure it runs with the correct SDK, no matter what type of project you're building):
252253

253254
```
254255
cd "${SRCROOT}"/Codegen
255-
swift run
256+
xcrun -sdk macosx swift run
256257
```
257-
258+
258259
>**Note**: If your package ever seems to have problems with caching, run `swift package clean` before `swift run` for a totally clean build. It is not recommended to do this by default, because it substantially increases build time.
259260

260261
4. Build your target.

0 commit comments

Comments
 (0)