diff --git a/doc/xcodebuild.txt b/doc/xcodebuild.txt index 7be7273..8e2cd2b 100644 --- a/doc/xcodebuild.txt +++ b/doc/xcodebuild.txt @@ -1172,6 +1172,7 @@ XcodeBuildSettings *xcodebuild.core.xcode.XcodeBuildSettings* {appPath} (string) {productName} (string) {bundleId} (string) + {buildDir} (string|nil) XcodeScheme *xcodebuild.core.xcode.XcodeScheme* @@ -1708,6 +1709,7 @@ ProjectSettings {destination} (string|nil) destination (ex. "28B52DAA-BC2F-410B-A5BE-F485A3AFB0BC") {bundleId} (string|nil) bundle identifier (ex. "com.mycompany.myapp") {appPath} (string|nil) app path (ex. "path/to/MyApp.app") + {buildDir} (string|nil) buildDir (ex. "/path/to/DerivedData/app-abc123/Build/Products") {productName} (string|nil) product name (ex. "MyApp") {testPlan} (string|nil) test plan name (ex. "MyAppTests") {xcodeproj} (string|nil) xcodeproj file path (ex. "path/to/Project.xcodeproj") @@ -1783,9 +1785,17 @@ M.is_spm_configured() (boolean) - *xcodebuild.project.config.is_project_configured* -M.is_project_configured() - Checks if Xcode project is configured. + *xcodebuild.project.config.is_library_configured* +M.is_library_configured() + Checks if Xcode static library is configured. + + Returns: ~ + (boolean) + + + *xcodebuild.project.config.is_app_configured* +M.is_app_configured() + Checks if Xcode app project is configured. Returns: ~ (boolean) @@ -4144,6 +4154,11 @@ M.show_spm_actions() Shows available actions for Swift Package project. + *xcodebuild.ui.picker_actions.show_library_project_actions* +M.show_library_project_actions() + Shows available actions for Xcode library project. + + *xcodebuild.ui.picker_actions.show_xcode_project_actions* M.show_xcode_project_actions() Shows available actions for Xcode project. @@ -4168,12 +4183,12 @@ M.cancel_actions() *xcodebuild.helpers.cancel_actions* Cancels all running actions from all modules. -M.validate_project({requiresXcodeproj}) *xcodebuild.helpers.validate_project* +M.validate_project({opts}) *xcodebuild.helpers.validate_project* Validates if the project is configured. It sends an error notification if the project is not configured. Parameters: ~ - {requiresXcodeproj} (boolean) + {opts} ({requiresXcodeproj:boolean|nil,requiresApp:boolean|nil}|nil) Returns: ~ (boolean) diff --git a/lua/xcodebuild/actions.lua b/lua/xcodebuild/actions.lua index 30ee704..69cbe44 100644 --- a/lua/xcodebuild/actions.lua +++ b/lua/xcodebuild/actions.lua @@ -37,7 +37,7 @@ end ---Opens the project in Xcode. function M.open_in_xcode() - if helpers.validate_project(false) then + if helpers.validate_project() then vim.fn.system({ "open", "-a", @@ -219,7 +219,7 @@ end ---Sends a notification with the current project settings. function M.show_current_config() - if not helpers.validate_project(false) then + if not helpers.validate_project() then return end diff --git a/lua/xcodebuild/broadcasting/notifications.lua b/lua/xcodebuild/broadcasting/notifications.lua index 75f1249..c7e47ae 100644 --- a/lua/xcodebuild/broadcasting/notifications.lua +++ b/lua/xcodebuild/broadcasting/notifications.lua @@ -234,6 +234,8 @@ function M.send_project_settings(settings) - productName: ]] .. (settings.productName or "-") .. [[ + - buildDir: ]] .. (settings.buildDir or "-") .. [[ + - appPath: ]] .. (settings.appPath or "-") .. [[ ]]) end diff --git a/lua/xcodebuild/code_coverage/coverage.lua b/lua/xcodebuild/code_coverage/coverage.lua index d8b0dfd..8ae1a95 100644 --- a/lua/xcodebuild/code_coverage/coverage.lua +++ b/lua/xcodebuild/code_coverage/coverage.lua @@ -135,7 +135,7 @@ end ---First, the code coverage must be exported using |export_coverage| function. ---@param isVisible boolean|nil function M.toggle_code_coverage(isVisible) - if not helpers.validate_project(false) then + if not helpers.validate_project() then return elseif not config.enabled then notifications.send_error("Code coverage is disabled in xcodebuild.nvim config") diff --git a/lua/xcodebuild/core/xcode.lua b/lua/xcodebuild/core/xcode.lua index a437c17..69fea5a 100644 --- a/lua/xcodebuild/core/xcode.lua +++ b/lua/xcodebuild/core/xcode.lua @@ -59,6 +59,7 @@ ---@field appPath string ---@field productName string ---@field bundleId string +---@field buildDir string|nil ---@class XcodeScheme ---@field name string @@ -184,7 +185,6 @@ function M.get_targets_filemap(derivedDataPath) end if not util.dir_exists(searchPath) then - notifications.send_error("Could not locate build dir. Please run Build.") return {} end @@ -555,24 +555,31 @@ function M.get_build_settings(platform, projectFile, scheme, xcodeprojPath, call local bundleId = nil local productName = nil local wrapperName = nil + local targetBuildDir = nil local buildDir = nil for _, line in ipairs(output) do bundleId = bundleId or find_setting(line, "PRODUCT_BUNDLE_IDENTIFIER") productName = productName or find_setting(line, "PRODUCT_NAME") wrapperName = wrapperName or find_setting(line, "WRAPPER_NAME") - buildDir = buildDir or find_setting(line, "TARGET_BUILD_DIR") + targetBuildDir = targetBuildDir or find_setting(line, "TARGET_BUILD_DIR") + buildDir = buildDir or find_setting(line, "BUILD_DIR") - if bundleId and productName and buildDir and wrapperName then + if bundleId and productName and targetBuildDir and wrapperName and buildDir then break end end - if not bundleId or (not productName and not wrapperName) or not buildDir then + if (not productName and not wrapperName) or not targetBuildDir then notifications.send_error("Could not get build settings") return end + --- Static library does not have a bundle id + if not bundleId then + notifications.send_warning("Could not find bundle id. Ignore if it's a static library.") + end + if wrapperName then wrapperName = wrapperName:gsub("%.app$", "") @@ -582,9 +589,10 @@ function M.get_build_settings(platform, projectFile, scheme, xcodeprojPath, call end local result = { - appPath = buildDir .. "/" .. productName .. ".app", + appPath = targetBuildDir .. "/" .. productName .. ".app", productName = productName, bundleId = bundleId, + buildDir = buildDir, } util.call(callback, result) diff --git a/lua/xcodebuild/helpers.lua b/lua/xcodebuild/helpers.lua index 3d46d27..64a877f 100644 --- a/lua/xcodebuild/helpers.lua +++ b/lua/xcodebuild/helpers.lua @@ -46,18 +46,35 @@ end ---Validates if the project is configured. ---It sends an error notification if the project is not configured. ----@param requiresXcodeproj boolean +---@param opts {requiresXcodeproj:boolean|nil, requiresApp:boolean|nil}|nil ---@return boolean -function M.validate_project(requiresXcodeproj) +function M.validate_project(opts) + opts = opts or {} local projectConfig = require("xcodebuild.project.config") local notifications = require("xcodebuild.broadcasting.notifications") + local requiresApp = opts.requiresApp + local requiresXcodeproj = opts.requiresXcodeproj or requiresApp if requiresXcodeproj and projectConfig.is_spm_configured() then notifications.send_error("This operation is not supported for Swift Package.") return false end - if requiresXcodeproj and not projectConfig.is_project_configured() then + if requiresApp and projectConfig.is_library_configured() then + notifications.send_error("This operation is not supported for Xcode Library.") + return false + end + + if requiresApp and not projectConfig.is_app_configured() then + notifications.send_error("The project is missing some details. Please run XcodebuildSetup first.") + return false + end + + if + requiresXcodeproj + and not projectConfig.is_app_configured() + and not projectConfig.is_library_configured() + then notifications.send_error("The project is missing some details. Please run XcodebuildSetup first.") return false end diff --git a/lua/xcodebuild/integrations/dap.lua b/lua/xcodebuild/integrations/dap.lua index 6b9b280..3b15ab0 100644 --- a/lua/xcodebuild/integrations/dap.lua +++ b/lua/xcodebuild/integrations/dap.lua @@ -98,7 +98,7 @@ function M.build_and_debug(callback) return end - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end @@ -138,7 +138,7 @@ end ---the project. ---@param callback function|nil function M.debug_without_build(callback) - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end @@ -184,7 +184,7 @@ function M.attach_debugger_for_tests() return end - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end diff --git a/lua/xcodebuild/integrations/neo-tree.lua b/lua/xcodebuild/integrations/neo-tree.lua index fed7a9f..5219a2e 100644 --- a/lua/xcodebuild/integrations/neo-tree.lua +++ b/lua/xcodebuild/integrations/neo-tree.lua @@ -39,7 +39,8 @@ function M.setup() local cwd = vim.fn.getcwd() local function isProjectFile(path) - return projectConfig.is_project_configured() and vim.startswith(path, cwd) + return (projectConfig.is_app_configured() or projectConfig.is_library_configured()) + and vim.startswith(path, cwd) end local function shouldUpdateProject(path) diff --git a/lua/xcodebuild/integrations/nvim-tree.lua b/lua/xcodebuild/integrations/nvim-tree.lua index 8eeafe5..a29e5c5 100644 --- a/lua/xcodebuild/integrations/nvim-tree.lua +++ b/lua/xcodebuild/integrations/nvim-tree.lua @@ -40,7 +40,8 @@ function M.setup() local cwd = vim.fn.getcwd() local function isProjectFile(path) - return projectConfig.is_project_configured() and vim.startswith(path, cwd) + return (projectConfig.is_app_configured() or projectConfig.is_library_configured()) + and vim.startswith(path, cwd) end local function shouldUpdateProject(path) diff --git a/lua/xcodebuild/integrations/oil-nvim.lua b/lua/xcodebuild/integrations/oil-nvim.lua index ea9637e..0eca417 100644 --- a/lua/xcodebuild/integrations/oil-nvim.lua +++ b/lua/xcodebuild/integrations/oil-nvim.lua @@ -80,7 +80,8 @@ function M.setup() local cwd = vim.fn.getcwd() local function isProjectFile(path) - return projectConfig.is_project_configured() and vim.startswith(path, cwd) + return (projectConfig.is_app_configured() or projectConfig.is_library_configured()) + and vim.startswith(path, cwd) end local function shouldUpdateProject(path) diff --git a/lua/xcodebuild/platform/device.lua b/lua/xcodebuild/platform/device.lua index 5f69038..e63a069 100644 --- a/lua/xcodebuild/platform/device.lua +++ b/lua/xcodebuild/platform/device.lua @@ -60,7 +60,7 @@ end ---Kills the application on device, simulator, or macOS. ---@param callback function|nil function M.kill_app(callback) - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end @@ -81,7 +81,7 @@ end ---@param waitForDebugger boolean ---@param callback function|nil function M.run_app(waitForDebugger, callback) - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end @@ -104,7 +104,7 @@ end ---Boots the simulator. ---@param callback function|nil function M.boot_simulator(callback) - if not helpers.validate_project(false) then + if not helpers.validate_project() then return end @@ -129,7 +129,7 @@ end ---Does not support macOS. ---@param callback function|nil function M.install_app(callback) - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end @@ -157,7 +157,7 @@ end ---Does not support macOS. ---@param callback function|nil function M.uninstall_app(callback) - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end diff --git a/lua/xcodebuild/project/builder.lua b/lua/xcodebuild/project/builder.lua index 390fd9a..dc6dde8 100644 --- a/lua/xcodebuild/project/builder.lua +++ b/lua/xcodebuild/project/builder.lua @@ -25,7 +25,7 @@ local CANCELLED_CODE = 143 ---@see xcodebuild.platform.device.run_app ---@see xcodebuild.project.builder.build_project function M.build_and_run_app(waitForDebugger, callback) - if not helpers.validate_project(true) then + if not helpers.validate_project({ requiresApp = true }) then return end @@ -53,7 +53,7 @@ end function M.build_project(opts, callback) opts = opts or {} - if not helpers.validate_project(false) then + if not helpers.validate_project() then return end @@ -127,7 +127,10 @@ end function M.clean_derived_data() local derivedDataPath - if projectConfig.settings.appPath then + if projectConfig.settings.buildDir then + local buildDir = projectConfig.settings.buildDir or "" + derivedDataPath = string.match(buildDir, "(.+/DerivedData/[^/]+)/.+") or buildDir + elseif projectConfig.settings.appPath then derivedDataPath = string.match(projectConfig.settings.appPath, "(.+/DerivedData/[^/]+)/.+") else derivedDataPath = require("xcodebuild.core.xcode").find_derived_data_path( diff --git a/lua/xcodebuild/project/config.lua b/lua/xcodebuild/project/config.lua index 36f05d2..c7da40a 100644 --- a/lua/xcodebuild/project/config.lua +++ b/lua/xcodebuild/project/config.lua @@ -17,6 +17,7 @@ ---@field destination string|nil destination (ex. "28B52DAA-BC2F-410B-A5BE-F485A3AFB0BC") ---@field bundleId string|nil bundle identifier (ex. "com.mycompany.myapp") ---@field appPath string|nil app path (ex. "path/to/MyApp.app") +---@field buildDir string|nil buildDir (ex. "/path/to/DerivedData/app-abc123/Build/Products") ---@field productName string|nil product name (ex. "MyApp") ---@field testPlan string|nil test plan name (ex. "MyAppTests") ---@field xcodeproj string|nil xcodeproj file path (ex. "path/to/Project.xcodeproj") @@ -146,9 +147,29 @@ function M.is_spm_configured() end end ----Checks if Xcode project is configured. +---Checks if Xcode static library is configured. ---@return boolean -function M.is_project_configured() +function M.is_library_configured() + local settings = M.settings + --- no bundle id + if + settings.platform + and settings.projectFile + and settings.scheme + and settings.destination + and not settings.bundleId + and settings.appPath + and settings.productName + then + return true + else + return false + end +end + +---Checks if Xcode app project is configured. +---@return boolean +function M.is_app_configured() local settings = M.settings if settings.platform @@ -168,7 +189,7 @@ end ---Checks if project is configured. ---@return boolean function M.is_configured() - return M.is_project_configured() or M.is_spm_configured() + return M.is_app_configured() or M.is_spm_configured() or M.is_library_configured() end ---Updates the settings (`appPath`, `productName`, and `bundleId`) based on @@ -190,6 +211,7 @@ function M.update_settings(opts, callback) M.settings.appPath = nil M.settings.productName = nil M.settings.bundleId = nil + M.settings.buildDir = nil M.save_settings() last_platform = nil util.call(callback) @@ -207,6 +229,7 @@ function M.update_settings(opts, callback) M.settings.appPath = buildSettings.appPath M.settings.productName = buildSettings.productName M.settings.bundleId = buildSettings.bundleId + M.settings.buildDir = buildSettings.buildDir M.save_settings() last_platform = M.settings.platform util.call(callback) diff --git a/lua/xcodebuild/project/manager.lua b/lua/xcodebuild/project/manager.lua index 5c49936..cf79c93 100644 --- a/lua/xcodebuild/project/manager.lua +++ b/lua/xcodebuild/project/manager.lua @@ -306,7 +306,7 @@ end ---It asks for the file name and creates it in the current directory. ---It also asks the user to select targets. function M.create_new_file() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -334,7 +334,7 @@ end ---@param filepath string ---@param targets string[] function M.add_file_to_targets(filepath, targets) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -344,7 +344,7 @@ end ---Returns all project targets. ---@return string[]|nil function M.get_project_targets() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -394,7 +394,7 @@ end ---@param callback function|nil ---@param opts { createGroups: boolean}|nil function M.add_file(filepath, callback, opts) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -443,7 +443,7 @@ end ---@param oldFilePath string ---@param newFilePath string function M.move_file(oldFilePath, newFilePath) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -460,7 +460,7 @@ end ---@param oldFilePath string ---@param newFilePath string function M.rename_file(oldFilePath, newFilePath) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -471,7 +471,7 @@ end ---Renames the current file in the project and on disk. ---Asks the user for the new file name. function M.rename_current_file() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -493,7 +493,7 @@ end ---Deletes the file from the project. ---@param filepath string function M.delete_file(filepath) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -504,7 +504,7 @@ end ---Deletes the current file from the project and disk. ---Asks the user for confirmation. function M.delete_current_file() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -523,7 +523,7 @@ end ---Creates a new group in the project and on disk. ---Asks the user for the group name. function M.create_new_group() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -544,7 +544,7 @@ end ---Adds the group to the project. ---@param path string function M.add_group(path) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -561,7 +561,7 @@ end ---@param oldGroupPath string ---@param newGroupPath string function M.rename_group(oldGroupPath, newGroupPath) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -572,7 +572,7 @@ end ---Renames the current group in the project and on disk. ---Asks the user for the new group name. function M.rename_current_group() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -601,7 +601,7 @@ end ---@param oldGroupPath string ---@param newGroupPath string function M.move_or_rename_group(oldGroupPath, newGroupPath) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -619,7 +619,7 @@ end ---Deletes the group from the project. function M.delete_group(groupPath) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -630,7 +630,7 @@ end ---Deletes the current group from the project and disk. ---Asks the user for confirmation. function M.delete_current_group() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -649,7 +649,7 @@ end ---Updates the file targets in the project. ---Asks the user to select the targets. function M.update_current_file_targets() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -672,7 +672,7 @@ end ---@param groupPath string ---@return string[]|nil function M.guess_target(groupPath) - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -681,7 +681,7 @@ end ---Shows the targets for the current file. function M.show_current_file_targets() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end @@ -693,7 +693,7 @@ end ---Shows the action picker with all available actions. function M.show_action_picker() - if not helpers.validate_project(true) or not validate_xcodeproj_tool() then + if not helpers.validate_project({ requiresXcodeproj = true }) or not validate_xcodeproj_tool() then return end diff --git a/lua/xcodebuild/tests/runner.lua b/lua/xcodebuild/tests/runner.lua index 27c1e3d..cebc1e0 100644 --- a/lua/xcodebuild/tests/runner.lua +++ b/lua/xcodebuild/tests/runner.lua @@ -121,7 +121,7 @@ end ---snapshot previews, and Test Explorer. ---@param testsToRun string[]|nil test ids function M.run_tests(testsToRun) - if not helpers.validate_project(false) then + if not helpers.validate_project() then return end @@ -252,7 +252,7 @@ end ---it additionally triggers build for testing. ---@param opts TestRunnerOptions function M.run_selected_tests(opts) - if not helpers.validate_project(false) then + if not helpers.validate_project() then return end @@ -334,7 +334,7 @@ end ---Shows a picker with failing snapshot tests. function M.show_failing_snapshot_tests() - if not helpers.validate_project(false) then + if not helpers.validate_project() then return end diff --git a/lua/xcodebuild/tests/search.lua b/lua/xcodebuild/tests/search.lua index 8a0ff52..d510772 100644 --- a/lua/xcodebuild/tests/search.lua +++ b/lua/xcodebuild/tests/search.lua @@ -167,8 +167,8 @@ function M.load_targets_map() local projectConfig = require("xcodebuild.project.config") if projectConfig.is_spm_configured() then - local derivedDataPath = - xcode.find_derived_data_path(projectConfig.settings.scheme, projectConfig.settings.workingDirectory) + local derivedDataPath = projectConfig.settings.buildDir + or xcode.find_derived_data_path(projectConfig.settings.scheme, projectConfig.settings.workingDirectory) M.targetsFilesMap = derivedDataPath and xcode.get_targets_filemap(derivedDataPath) or {} else diff --git a/lua/xcodebuild/ui/picker_actions.lua b/lua/xcodebuild/ui/picker_actions.lua index e796a0c..9d8a0c3 100644 --- a/lua/xcodebuild/ui/picker_actions.lua +++ b/lua/xcodebuild/ui/picker_actions.lua @@ -150,6 +150,82 @@ function M.show_spm_actions() show_picker(actionsNames, actionsPointers) end +---Shows available actions for Xcode library project. +function M.show_library_project_actions() + local actions = require("xcodebuild.actions") + local actionsNames = { + "Build Project", + "Build Project (Clean Build)", + "Build For Testing", + "Cancel Running Action", + "---------------------------------", + "Run Current Test Plan (All Tests)", + "Run Current Test Target", + "Run Current Test Class", + "Run Nearest Test", + "Rerun Failed Tests", + "Repeat Last Test Run", + "---------------------------------", + "Select Scheme", + "Select Device", + "Select Test Plan", + "---------------------------------", + "Toggle Logs", + "---------------------------------", + "Show Project Manager", + "Show Current Configuration", + "Show Configuration Wizard", + "---------------------------------", + "Boot Selected Simulator", + "---------------------------------", + "Clean DerivedData", + "Open Project in Xcode", + } + local actionsPointers = { + actions.build, + actions.clean_build, + actions.build_for_testing, + actions.cancel, + + function() end, + + actions.run_tests, + actions.run_target_tests, + actions.run_class_tests, + actions.run_nearest_test, + actions.rerun_failed_tests, + actions.repeat_last_test_run, + + function() end, + + actions.select_scheme, + actions.select_device, + actions.select_testplan, + + function() end, + + actions.toggle_logs, + + function() end, + + actions.show_project_manager_actions, + actions.show_current_config, + actions.configure_project, + + function() end, + + actions.boot_simulator, + + function() end, + + actions.clean_derived_data, + actions.open_in_xcode, + } + + add_test_actions(actionsNames, actionsPointers) + show_picker(actionsNames, actionsPointers) +end + ---Shows available actions for Xcode project. function M.show_xcode_project_actions() local actions = require("xcodebuild.actions") diff --git a/lua/xcodebuild/ui/pickers.lua b/lua/xcodebuild/ui/pickers.lua index 22ec09c..a592c88 100644 --- a/lua/xcodebuild/ui/pickers.lua +++ b/lua/xcodebuild/ui/pickers.lua @@ -754,8 +754,10 @@ function M.show_all_actions() vim.defer_fn(actionsPointers[index], 100) end end, { close_on_select = true }) - elseif projectConfig.is_project_configured() then + elseif projectConfig.is_app_configured() then pickerActions.show_xcode_project_actions() + elseif projectConfig.is_library_configured() then + pickerActions.show_library_project_actions() elseif projectConfig.is_spm_configured() then pickerActions.show_spm_actions() end