You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,52 +1,52 @@
1
1
# Xcode-Build-Server
2
2
3
-
apple's [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) doesn't support xcode project. but I found it provide a [build server protocol](https://build-server-protocol.github.io/docs/specification.html) to integrate with other build system. this is why I created this repo.
3
+
Apple's [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) doesn't support xcode project. But I found it provides a [build server protocol](https://build-server-protocol.github.io/docs/specification.html) to integrate with other build system. This is why I created this repo.
4
4
5
-
This repo aims to integrate xcode with sourcekit-lsp, support all languages(swift, c, cpp, objc, objcpp) xcode supports, so I can develop iOS with my favorate editor.
5
+
This repo aims to integrate xcode with sourcekit-lsp and support all the languages(swift, c, cpp, objc, objcpp) xcode supports, so I can develop iOS with my favorate editor.
6
6
7
7
# Install
8
8
9
-
this repo require Python3.9. The latest macos already contains this tool.
9
+
This repo requires Python 3.9. The latest macOS already comes with this tool.
10
10
11
-
then just clone this repo, and `ln -s ABSPATH/TO/xcode-build-server /usr/local/bin`
11
+
After you've made sure you have Python 3.9, just clone this repo, and add a symbolic link to your bin folder by running:`ln -s ABSPATH/TO/xcode-build-server /usr/local/bin`
12
12
13
-
here is script for quick install if your terminal cd to the dir you what save this repo:
13
+
Here is a script for quick install if your working directory is your desired destination for the installation:
or install from[Macports](https://github.com/macports/macports-ports/blob/master/devel/xcode-build-server/Portfile):
25
+
or install using[Macports](https://github.com/macports/macports-ports/blob/master/devel/xcode-build-server/Portfile):
26
26
27
27
`sudo port install xcode-build-server`
28
28
29
29
# Usage
30
30
31
-
choose one of the following usage. No matter which method you use, you need to ensure that the directory where `buildServer.json` is located is **the root directory** of lsp
31
+
Choose one of the following methods. (No matter which method you use, you need to ensure that the directory where `buildServer.json` is created in is **the root/working directory** of the LSP)
32
32
33
33
### Bind to Xcode
34
34
Go to your workspace directory and execute one of the following commands:
35
35
36
36
```bash
37
-
# *.xcworkspace or *.xcodeproj should be unique. can be omit and will auto choose the unique workspace or project.
38
-
# -scheme can also be omit to auto bind the latest scheme build result. even change it in xcode after the buildServer.json generated
37
+
# *.xcworkspace or *.xcodeproj should be unique. This can be omitted and the build server will automatically choose the unique workspace or project.
38
+
# -scheme can also be omitted to automatically bind the latest scheme build result. even change it in xcode after the buildServer.json generated
This will create or update the `buildServer.json` file, with a `kind: xcode` key, which instructs xcode-build-server to watch and use compile flags from the newest xcode build log.
44
44
45
-
After this, you can open your file with sourcekit-lsp enabled, and it should works.
45
+
After this, you can open your file with sourcekit-lsp enabled and it should work.
46
46
47
47
If your compile info is outdated and something is not working properly, just build in xcode to refresh compile flags.
48
48
49
-
> PS: xcodebuild can generate same build log as xcode, if you don't overwrite build dir and specify a -resultBundlePath. this way you don't have to open xcode to build. eg:
49
+
> PS: xcodebuild can generate same build log as xcode if you don't overwrite build dir and specify a -resultBundlePath. This way you don't have to open xcode to build. eg:
When running for the first time, **you need to ensure that the log is complete**, otherwise some files cannot obtain the correct flags.
76
+
When running for the first time, **you need to ensure that the log is complete**, otherwise some files won't be able to obtain correct flags.
77
77
78
78
After completing these steps, restart your language server, and it should work as expected.
79
79
80
-
if your build environment changes(eg: add new files, switch sdk, toggle debug/release, conditional macro, etc..) and your language server stops working, just repeat the previous steps to update the compile info. In these incremental update cases, **you should make sure to use the `-a` flag**, which will only add new flags, and other irrelevant old flags will remain unchanged.
80
+
If your build environment changes(eg: add new files, switch sdk, toggle debug/release, conditional macro, etc..) and your language server stops working, just repeat the previous steps to update the compile info. In these incremental update cases, **you should make sure to use the `-a` flag**, which will only add new flags, and other irrelevant old flags will remain unchanged.
81
81
82
82
if you use xcodebuild and want to see raw output, currently you can use the following commands: `xcodebuild ... | tee build.log; xcode-build-server parse -a build.log >/dev/null 2>&1`
83
83
84
84
### [Deprecated] Sync Xcodebuild log
85
-
> this usage is deprecated by `bind xcodeproj`, which just a command and won't pollute your xcodeproj's config.
86
-
> switch from this usage to `bind xcodeproj`, you'll need to delete the `post-build-action` first. Otherwise, bind may not work properly. since kind will change to manual by post-build-action.
85
+
> this usage is deprecated by `bind xcodeproj`, which is just a command and won't pollute your xcodeproj's config.
86
+
> switch from this usage to `bind xcodeproj`, you'll need to delete the `post-build-action` first. Otherwise, bind may not work properly. Since kind will change to manual by post-build-action.
87
87
88
88
xcode-build-server provider `post-build-action` script to auto parse newest log into .compile and generate `buildServer.json`.
89
89
just add `xcode-build-server postaction | bash &` into script in **scheme -> Build -> Post-actions**. and script should choose provide build settings from target
after this, the compile info should auto generate when xcode build and no need further manual parse.
92
+
after this, the compile info should auto generate when xcode builds and no need for further manual parsing.
93
93
94
94
## Indexing While Building
95
-
[sourcekit-lsp](https://github.com/apple/sourcekit-lsp#indexing-while-building)use indexing while build.
96
-
if you found find definition or references is not work correctly, just build it to update index
95
+
[sourcekit-lsp](https://github.com/apple/sourcekit-lsp#indexing-while-building)uses indexing while building.
96
+
If you find that find definitions or references are not working correctly, just build it to update index
97
97
98
98
# More
99
99
100
-
current implementation is basicly work, but may have some rough edges. Please report issue if you have any problem. If you want to help, can check the open issue list. PR is always welcome.
100
+
Current implementation is basicly working, but may have some rough edges. Please report issue if you have any problem. If you want to help, you can check the open issue list. PR's are always welcome.
101
101
102
-
when reporting an issue, you may provide your buildServer.json and run LSP with the environment variable SOURCEKIT_LOGGING=3 to provide detailed logs to help locate the problem.
102
+
When reporting an issue, you may provide your buildServer.json and run LSP with the environment variable SOURCEKIT_LOGGING=3 to provide detailed logs to help locate the problem.
0 commit comments