@@ -44,6 +44,7 @@ neo-tree.nvim Integration ··················· |xcodebuild.int
44
44
oil.nvim Integration ························ | xcodebuild.integrations.oil-nvim |
45
45
Quick Test Framework Integration ··············· | xcodebuild.integrations.quick |
46
46
xcode-build-server Integration ···· | xcodebuild.integrations.xcode-build-server |
47
+ Xcodebuild Workaround ············· | xcodebuild.integrations.xcodebuild-offline |
47
48
Pickers ················································ | xcodebuild.ui.pickers |
48
49
Helpers ··················································· | xcodebuild.helpers |
49
50
Lua Utils ···················································· | xcodebuild.util |
@@ -165,6 +166,7 @@ M.setup({options}) *xcodebuild.setup*
165
166
open_expanded = false,
166
167
},
167
168
integrations = {
169
+ xcodebuild_offline = false, -- improves build time (requires configuration, see `:h xcodebuild.xcodebuild-offline`)
168
170
xcode_build_server = {
169
171
enabled = true, -- enable calling "xcode-build-server config" when project config changes
170
172
},
@@ -247,7 +249,7 @@ Availability of features
247
249
248
250
249
251
🔐 - requires passwordless `sudo` permission to `tools/remote_debugger`
250
- script (see | xcodebuild.sudo | ).
252
+ script (see | xcodebuild.ios17 | ).
251
253
252
254
🛠️ - available if pymobiledevice3 is installed.
253
255
@@ -290,7 +292,7 @@ or just:
290
292
<
291
293
292
294
To debug on physical devices with iOS 17+ you will need to set up `sudo` ,
293
- see | xcodebuild.sudo | to learn more.
295
+ see | xcodebuild.ios17 | to learn more.
294
296
295
297
296
298
==============================================================================
@@ -543,8 +545,7 @@ Sample `lualine` integration:
543
545
==============================================================================
544
546
Debugging On iOS 17+ Device *xcodebuild.integrations.ios17*
545
547
546
- *xcodebuild.integrations.sudo*
547
- *xcodebuild.sudo*
548
+ *xcodebuild.ios17*
548
549
Since iOS 17, a new secure connection between Mac and mobile devices is
549
550
required. Xcodebuild.nvim uses `pymobiledevice3` to establish a special
550
551
trusted tunnel that is later used for debugging. However, this operation
@@ -3699,6 +3700,90 @@ M.run_config({projectCommand}, {scheme})
3699
3700
(number) job id
3700
3701
3701
3702
3703
+ ==============================================================================
3704
+ Xcodebuild Workaround *xcodebuild.integrations.xcodebuild-offline*
3705
+
3706
+ *xcodebuild.xcodebuild-offline*
3707
+
3708
+ This module provides a workaround for the issue with slow `xcodebuild` command.
3709
+
3710
+ The issue is caused by the fact that `xcodebuild` tries to connect to the Apple
3711
+ servers before building the project, which can take 20 seconds or more.
3712
+ Usually, those requests are not necessary, but they slow down each build.
3713
+
3714
+ This module provides a workaround by mapping Apple servers to localhost in the
3715
+ `/etc/ hosts` file during the build. It is a temporary solution and should be
3716
+ used with caution.
3717
+
3718
+ Keep in mind that disabling access to `developerservices2.apple.com ` for
3719
+ `xcodebuild` may cause some issues with the build process. It will disable
3720
+ things like registering devices, capabilities, and other network-related
3721
+ features. Therefore, it's best to use it when you are working just on the
3722
+ code and don't need updating project settings.
3723
+
3724
+ You can apply this workaround in two ways:
3725
+ 1. Manual - by either editing manually `/etc/ hosts` and adding
3726
+ `127.0.0.1 developerservices2.apple.com` or by blocking the
3727
+ `developerservices2.apple.com ` domain in any network sniffer like
3728
+ Proxyman or Charles Proxy.
3729
+ 2. Automatic - more advanced integration that is supported by the plugin.
3730
+ The advantage of this approach is that the Apple server will be blocked
3731
+ only when the `xcodebuild` command (triggered from Neovim) is running.
3732
+ However, it requires a passwordless `sudo` permission for the script.
3733
+
3734
+ ⚠️ CAUTION
3735
+ Giving passwordless `sudo` access to that file, potentially opens a gate for
3736
+ malicious software that could modify the file and run some evil code using
3737
+ `root` account. The best way to protect that file is to create a local copy,
3738
+ change the owner to `root` , and give write permission only to `root` .
3739
+ The script below does that automatically.
3740
+
3741
+ 👉 Enable integration that automatically blocks Apple servers
3742
+
3743
+ Update your config with:
3744
+ >lua
3745
+ integrations = {
3746
+ xcodebuild_offline = true,
3747
+ }
3748
+ <
3749
+
3750
+ 👉 Run the following command to install & protect the script
3751
+
3752
+ >bash
3753
+ DIR="$HOME/Library/xcodebuild.nvim" && \
3754
+ FILE="$DIR/xcodebuild_offline" && \
3755
+ SOURCE="$HOME/.local/share/nvim/lazy/xcodebuild.nvim/tools/xcodebuild_offline" && \
3756
+ ME="$(whoami)" && \
3757
+ mkdir -p "$DIR" && \
3758
+ cp "$SOURCE" "$FILE" && \
3759
+ chmod 755 "$FILE" && \
3760
+ sudo chown root "$FILE" && \
3761
+ sudo bash -c "echo \"$ME ALL = (ALL) NOPASSWD: $FILE\" >> /etc/sudoers"
3762
+ <
3763
+
3764
+ More details about this issue can be found here:
3765
+ https://github.com/wojciech-kulik/xcodebuild.nvim/issues/201#issuecomment-2423828065
3766
+
3767
+
3768
+ *xcodebuild.integrations.xcodebuild-offline.is_enabled*
3769
+ M.is_enabled()
3770
+ Returns whether the `xcodebuild` command should be run in offline mode.
3771
+
3772
+ Returns: ~
3773
+ (boolean)
3774
+
3775
+
3776
+ *xcodebuild.integrations.xcodebuild-offline.wrap_command_if_needed*
3777
+ M.wrap_command_if_needed({command} )
3778
+ Wraps the `xcodebuild` command with the workaround script if needed.
3779
+
3780
+ Parameters: ~
3781
+ {command} (string)
3782
+
3783
+ Returns: ~
3784
+ (string)
3785
+
3786
+
3702
3787
==============================================================================
3703
3788
Pickers *xcodebuild.ui.pickers*
3704
3789
0 commit comments