kkharji / xbase

Develop Apple software products within your favorite editor.
MIT License
537 stars 17 forks source link

When using "watch" to run on change, the simulator relaunches the app six times #231

Open heygarrett opened 1 year ago

heygarrett commented 1 year ago

Editor/Client you used

Neovim

Installation and Dependences checklist

Description

When using the "watch" functionality, saving changes to a file in an Xcode project causes the simulator to relaunch the app six times.

Expected behavior

When saving changes I'd expect the simulator to relaunch the app only once.

Reproduce

Steps to reproduce:  
1. Open an Xcode project in Neovim  
2. Use the "watch" picker and select iPhone 14 Pro  
3. Make a change to the opened file  
4. `:w` to save the change

Actual behavior

The app relaunches six times in the simulator on save.

Operating system and version

macOS 13.4.1

xbase version / branch / rev

master branch

Neovim version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim"

Run :checkhealth for more info

Vscode version (if the editor you used is vscode)

No response

Installed XCode Developer Tools

Developer:

    Developer Tools:

      Version: 14.3.1 (14E300c)
      Location: /Applications/Xcode.app
      Applications:
          Xcode: 14.3.1 (21815)
          Instruments: 14.3.1 (64559.164)
      SDKs:
          DriverKit:
              22.4: 
          iOS:
              16.4: (20E238)
          iOS Simulator:
              16.4: (20E238)
          macOS:
              13.3: (22E245)
          tvOS:
              16.4: (20L489)
          tvOS Simulator:
              16.4: (20L489)
          watchOS:
              9.4: (20T248)
          watchOS Simulator:
              9.4: (20T248)
      Additional SDKs:
          iOS:
              Asset Runtime SDK for macOS hosts targeting iOS 16.4: 16.4
          tvOS:
              Asset Runtime SDK for macOS hosts targeting tvOS 16.4: 16.4
          watchOS:
              Asset Runtime SDK for macOS hosts targeting watchOS 9.4: 9.4

XBase Logs

INFO Client{fd=16}: Connected
 INFO Runtime{name="Xbase_repro"}: [Initializing] ------------------------
 INFO Broadcaster{name="Xbase_repro"}: Created
 INFO Runtime{name="Xbase_repro"}: targets: {"xbase_repro": TargetInfo { platform: "iOS", configurations: ["Debug", "Release"] }}
 INFO Broadcaster{name="Xbase_repro"}: Connected [16693]
 INFO Runtime{name="xbase_repro"}: Connected [16693]
 INFO Runtime{name="xbase_repro"}: [Initialized] -------------------------
 INFO FSWatcher{name="xbase_repro"}: Watching
 INFO FSWatcher{name="xbase_repro"}: Running xbase_repro
 INFO FSWatcher{name="xbase_repro"}: Ran xbase_repro
 INFO FSWatcher{name="xbase_repro"}: Processing "4913" [created]
DEBUG FSWatcher{name="xbase_repro"}: "ContentView.swift~" [renamed] [ignored]
 INFO FSWatcher{name="xbase_repro"}: Processed "4913" [created]
 INFO FSWatcher{name="xbase_repro"}: Processing "4913" [removed]
 INFO FSWatcher{name="xbase_repro"}: Processed "4913" [removed]
 INFO FSWatcher{name="xbase_repro"}: Processing "ContentView.swift" [renamed]
 INFO FSWatcher{name="xbase_repro"}: Processed "ContentView.swift" [renamed]
 INFO FSWatcher{name="xbase_repro"}: Processing "ContentView.swift" [created]
 INFO FSWatcher{name="xbase_repro"}: Processed "ContentView.swift" [created]
 INFO FSWatcher{name="xbase_repro"}: Processing "ContentView.swift" [modified]
 INFO FSWatcher{name="xbase_repro"}: Processed "ContentView.swift" [modified]
 INFO FSWatcher{name="xbase_repro"}: Processing "ContentView.swift~" [removed]
 INFO FSWatcher{name="xbase_repro"}: Processed "ContentView.swift~" [removed]

XBase Build Server Logs

INFO xbase_sourcekit_helper: Started
 INFO xbase_sourcekit_helper: Initialized
 INFO xbase_sourcekit_helper: Started
 INFO xbase_sourcekit_helper: Initialized
DEBUG xbase_sourcekit_helper: [ContentView.swift] Querying compile_db
ERROR xbase_sourcekit_helper: Missing compile arguments for "/Users/garrett/dev/scrap/xbase_repro/xbase_repro/ContentView.swift"

Additional Info

Config:

return {
    "https://github.com/kkharji/xbase",
    lazy = true,
    ft = "swift",
    config = function()
        require("xbase").setup({
            mappings = { enable = false },
        })

        local pickers = require("xbase.pickers")
        vim.api.nvim_create_user_command(
            "Build",
            function() pickers.build() end,
            { desc = "xbase build" }
        )
        vim.api.nvim_create_user_command(
            "Run",
            function() pickers.run() end,
            { desc = "xbase run" }
        )
        vim.api.nvim_create_user_command(
            "Watch",
            function() pickers.watch({}) end,
            { desc = "xbase watch" }
        )
    end,
}