Skip to content

Commit

Permalink
Merge pull request #1033 from apollographql/add/docgen_script
Browse files Browse the repository at this point in the history
Rename SwiftScript folder, add stub for doc generator
  • Loading branch information
designatednerd authored Feb 21, 2020
2 parents 8bcb3c6 + 9ef1cf8 commit 7eb2f3c
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ node_modules/
package-lock.json
scripts/apollo
scripts/apollo.tar.gz
Codegen/ApolloCLI
SwiftScripts/ApolloCLI
4 changes: 2 additions & 2 deletions Apollo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"${SRCROOT}/Codegen\"\nswift run Codegen -t \"GitHub\"\n";
shellScript = "cd \"${SRCROOT}/SwiftScripts\"\nswift run Codegen -t \"GitHub\"\n";
};
9FCE2D061E6C251100E34457 /* Generate Apollo Client API */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -1633,7 +1633,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"${SRCROOT}/Codegen\"\nswift run Codegen -t \"StarWars\"\n";
shellScript = "cd \"${SRCROOT}/SwiftScripts\"\nswift run Codegen -t \"StarWars\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion Codegen/Package.swift → SwiftScripts/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ let package = Package(
name: "Codegen",
dependencies: [
.package(path: ".."),
.package(url: "https://github.com/apple/swift-tools-support-core", from: "0.0.1")
.package(url: "https://github.com/apple/swift-tools-support-core", from: "0.0.1"),
],
targets: [
.target(
name: "Codegen",
dependencies: ["ApolloCodegenLib", "SwiftToolsSupport-auto"]),
.target(name: "SchemaDownload",
dependencies: ["ApolloCodegenLib"]),
.target(name: "DocumentationGenerator",
dependencies: []),
.testTarget(
name: "CodegenTests",
dependencies: ["Codegen"]),
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let parentFolderOfScriptFile = FileFinder.findParentFolder()
// Use that to calculate the source root
let sourceRootURL = parentFolderOfScriptFile
.deletingLastPathComponent() // Sources
.deletingLastPathComponent() // Codegen
.deletingLastPathComponent() // SwiftScripts
.deletingLastPathComponent() // apollo-ios

// In a typical app, you'll only need to do this for one target, so you'd
Expand All @@ -25,7 +25,7 @@ try FileManager.default.apollo_createFolderIfNeeded(at: targetURL)

// Calculate where you want to download the CLI folder.
let cliFolderURL = sourceRootURL
.appendingPathComponent("Codegen")
.appendingPathComponent("SwiftScripts")
.appendingPathComponent("ApolloCLI")

do {
Expand Down
4 changes: 4 additions & 0 deletions SwiftScripts/Sources/DocumentationGenerator/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Foundation

// TODO: Create this when I can import Sourcedocs as a library.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ let parentFolderOfScriptFile = FileFinder.findParentFolder()
// Use that to calculate the source root
let sourceRootURL = parentFolderOfScriptFile
.deletingLastPathComponent() // Sources
.deletingLastPathComponent() // Codegen
.deletingLastPathComponent() // SwiftScripts
.deletingLastPathComponent() // apollo-ios

let cliFolderURL = sourceRootURL
.appendingPathComponent("Codegen")
.appendingPathComponent("SwiftScripts")
.appendingPathComponent("ApolloCLI")

let endpoint = URL(string: "http://localhost:8080/graphql")!
Expand Down
10 changes: 5 additions & 5 deletions docs/source/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sourcedocs generate \
--link-ending "/" \
-- \
-scheme Apollo \
-workspace Apollo.xcworkspace
-project Apollo.xcodeproj
```

To generate docs for the `ApolloCodegenLib` project, `cd` into the source root and run:
Expand All @@ -41,7 +41,7 @@ sourcedocs generate \
--link-ending "/" \
-- \
-scheme ApolloCodegenLib \
-workspace Apollo.xcworkspace
-project Apollo.xcodeproj
```


Expand All @@ -53,7 +53,7 @@ sourcedocs generate \
--link-ending "/" \
-- \
-scheme ApolloSQLite \
-workspace Apollo.xcworkspace
-project Apollo.xcodeproj
```

To generate for docs the `ApolloWebSocket` project, `cd` into the source root and run:
Expand All @@ -64,7 +64,7 @@ sourcedocs generate \
--link-ending "/" \
-- \
-scheme ApolloWebSocket \
-workspace Apollo.xcworkspace
-project Apollo.xcodeproj
```

## From Source Instructions
Expand All @@ -85,5 +85,5 @@ swift run sourcedocs generate \
--link-ending "/" \
-- \
-scheme "ApolloWebSocket" \
-workspace "Apollo.xcworkspace"
-project "Apollo.xcodeproj"
``

0 comments on commit 7eb2f3c

Please sign in to comment.