Skip to content

Commit

Permalink
Merge pull request #184 from uber/doc-clarify_integration_path-master
Browse files Browse the repository at this point in the history
Clarify generator binary path example
  • Loading branch information
neakor authored Nov 5, 2018
2 parents 1d7f67d + 2856c30 commit be7b617
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion GENERATOR.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Even though Needle's generator can be invoked from the commandline, it is most c
3. Make sure the "Shell" value is `/bin/sh`.
4. Add a shell script that invokes the generator in the script box. For example, the sample TicTacToe app uses the script: `export SOURCEKIT_LOGGING=0 && ../Carthage/Checkouts/needle/Generator/bin/needle generate Sources/NeedleGenerated.swift Sources/ --header-doc ../../copyright_header.txt`.

The first part of the script `export SOURCEKIT_LOGGING=0` silences the SourceKit logging, otherwise Xcode will display the logs as error messages. This is simply to reduce noise in Xcode. It isn't strictly required. The rest of the script simply invokes the generator executable located at a relative path in the "Carthage" folder, with a few arguments. The first argument `generate` tells the executable to run the code generation command. The second argument `Sources/NeedleGenerated.swift` tells the generator to export the generated code to that location. The third argument `Sources/` tells the generator where all the application source code is for parsing. The last optional argument `--header-doc` instructs the generator to use the text in the specified file as the header doc for the exported file that contains the generated code. Please refer to the section below for all possible parameters.
The first part of the script `export SOURCEKIT_LOGGING=0` silences the SourceKit logging, otherwise Xcode will display the logs as error messages. This is simply to reduce noise in Xcode. It isn't strictly required. The rest of the script simply invokes the generator executable located at a relative path in the "Carthage" folder, with a few arguments. Please keep in mind that the path to the generator executable binary is relative to the Xcode project's location. In our sample apps, the path is `../Carthage/Checkouts/needle/Generator/bin/needle`. This might be different depending on your project's folder structure. The first argument `generate` tells the executable to run the code generation command. The second argument `Sources/NeedleGenerated.swift` tells the generator to export the generated code to that location. The third argument `Sources/` tells the generator where all the application source code is for parsing. The last optional argument `--header-doc` instructs the generator to use the text in the specified file as the header doc for the exported file that contains the generated code. Please refer to the section below for all possible parameters.

That's it for the Xcode integration. Now every time Xcode builds the application, Needle's generator is run to generate and output the necessary DI code.

Expand Down

0 comments on commit be7b617

Please sign in to comment.