[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 6fdb3cd 403/496: Fix `swift-mode:debug-swift-mo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 6fdb3cd 403/496: Fix `swift-mode:debug-swift-module` |
Date: |
Sun, 29 Aug 2021 11:34:15 -0400 (EDT) |
branch: elpa/swift-mode
commit 6fdb3cd7ab2473e87919927d57b01b1f28ce93d5
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Fix `swift-mode:debug-swift-module`
---
swift-mode-repl.el | 94 ++++++++++++++++++++++++++++++++----------------------
1 file changed, 55 insertions(+), 39 deletions(-)
diff --git a/swift-mode-repl.el b/swift-mode-repl.el
index a2ed521..c2dcae3 100644
--- a/swift-mode-repl.el
+++ b/swift-mode-repl.el
@@ -293,9 +293,9 @@ Return a JSON object."
The manifest file is searched from the PROJECT-DIRECTORY, defaults to
`default-directory', or its ancestors."
(let* ((description (swift-mode:describe-package project-directory))
- (modules (cdr (assoc 'modules description))))
+ (modules (cdr (assoc 'targets description))))
(seq-find
- (lambda (module) (not (eq :json-true (cdr (assoc 'is_test module)))))
+ (lambda (module) (not (equal "test" (cdr (assoc 'type module)))))
modules)))
(defun swift-mode:read-package-name (project-directory)
@@ -352,9 +352,9 @@ Return a directory path if found. Return nil otherwise."
(swift-mode:find-ancestor-or-self-directory
'swift-mode:swift-project-directory-p directory))
-(defun swift-mode:read-project-directory ()
- "Read a project directory from the minibuffer."
- (expand-file-name (read-directory-name "Project directory: " nil nil t)))
+(defun swift-mode:read-project-directory (default)
+ "Read a project directory from the minibuffer with DEFAULT directory."
+ (expand-file-name (read-directory-name "Project directory: " default nil t)))
(defun swift-mode:ensure-swift-project-directory (project-directory)
"Check PROJECT-DIRECTORY contains the manifest file Package.swift.
@@ -460,8 +460,8 @@ passed as a destination to xcodebuild."
,scheme
"-showBuildSettings")))
(when (and device-identifier
- (not (eql device-identifier
- swift-mode:ios-local-device-identifier)))
+ (not (equal device-identifier
+ swift-mode:ios-local-device-identifier)))
(setq arglist
(append arglist
`("-destination"
@@ -489,7 +489,8 @@ passed as a destination to xcodebuild."
xcodebuild is executed in PROJECT-DIRECTORY."
(let* ((json (swift-mode:xcodebuild-list project-directory))
- (project (cdr (assoc 'project json)))
+ (project (or (cdr (assoc 'project json))
+ (cdr (assoc 'workspace json))))
(schemes (cdr (assoc 'schemes project)))
(choices (seq-map
(lambda (scheme) (cons scheme scheme))
@@ -520,9 +521,11 @@ If PROJECT-DIRECTORY is nil or omited, it is searched from
`default-directory'
or its ancestors.
An list ARGS are appended for builder command line arguments."
(interactive
- (let ((project-directory (if current-prefix-arg
- (swift-mode:read-project-directory)
- (swift-mode:find-swift-project-directory))))
+ (let* ((default-project-directory (swift-mode:find-swift-project-directory))
+ (project-directory
+ (if current-prefix-arg
+ (swift-mode:read-project-directory default-project-directory)
+ default-project-directory)))
(list
project-directory
(if (string-equal (swift-mode:read-module-type project-directory)
@@ -539,7 +542,7 @@ An list ARGS are appended for builder command line
arguments."
(zerop
(apply 'swift-mode:call-process
swift-mode:swift-build-executable
- "--chdir" project-directory
+ "--package-path" project-directory
args))
(compilation-mode)
(goto-char (point-min))
@@ -563,9 +566,14 @@ equal to `swift-mode:ios-local-device-identifier', a local
device is used via
SCHEME is the name of the project scheme in Xcode. If it is nil or omitted,
the value of `swift-mode:ios-project-scheme' is used."
(interactive
- (let ((project-directory (if current-prefix-arg
- (swift-mode:read-project-directory)
- (swift-mode:find-xcode-project-directory))))
+ (let* ((default-project-directory
+ (or
+ (swift-mode:find-xcode-workspace-directory)
+ (swift-mode:find-xcode-project-directory)))
+ (project-directory
+ (if current-prefix-arg
+ (swift-mode:read-project-directory default-project-directory)
+ default-project-directory)))
(list
project-directory
(if current-prefix-arg
@@ -596,7 +604,7 @@ the value of `swift-mode:ios-project-scheme' is used."
(xcodebuild-args `(,swift-mode:xcodebuild-executable
"-configuration" "Debug"
"-scheme" ,scheme)))
- (if (eql device-identifier swift-mode:ios-local-device-identifier)
+ (if (equal device-identifier swift-mode:ios-local-device-identifier)
(setq xcodebuild-args (append xcodebuild-args '("-sdk" "iphoneos")))
(setq xcodebuild-args
(append xcodebuild-args
@@ -655,15 +663,17 @@ STRING is passed to the command."
(defun swift-mode:debug-swift-module-library (project-directory)
"Run debugger on a Swift library module in the PROJECT-DIRECTORY."
(let* ((c99name (swift-mode:read-c99-name project-directory))
- (import-statement (concat "import " c99name)))
+ (import-statement (concat "import " c99name))
+ (build-debug-directory
+ (swift-mode:join-path project-directory ".build" "debug")))
(unless c99name (error "Cannot get module name"))
(swift-mode:build-swift-module project-directory)
(swift-mode:run-repl
(append
(swift-mode:command-string-to-list swift-mode:repl-executable)
(list
- "-I" (swift-mode:join-path project-directory ".build" "debug")
- "-L" project-directory
+ "-I" build-debug-directory
+ "-L" build-debug-directory
(concat "-l" c99name)))
nil t)
(swift-mode:enqueue-repl-commands import-statement)))
@@ -691,10 +701,11 @@ STRING is passed to the command."
If PROJECT-DIRECTORY is nil or omited, it is searched from `default-directory'
or its ancestors."
(interactive
- (list
- (if current-prefix-arg
- (swift-mode:read-project-directory)
- (swift-mode:find-swift-project-directory))))
+ (let ((default-project-directory (swift-mode:find-swift-project-directory)))
+ (list
+ (if current-prefix-arg
+ (swift-mode:read-project-directory default-project-directory)
+ default-project-directory))))
(setq project-directory
(swift-mode:ensure-swift-project-directory project-directory))
(if (string-equal (swift-mode:read-module-type project-directory) "library")
@@ -818,20 +829,20 @@ PRODUCT-BUNDLE-IDENTIFIER is the name of the product
bundle identifier used
in Xcode build settings."
(swift-mode:build-ios-app project-directory device-identifier scheme)
(let* ((devices (swift-mode:list-ios-simulator-devices))
- (target-device
+ (target-device
(seq-find
- (lambda (device)
- (string-equal (cdr (assoc 'udid device)) device-identifier))
- devices))
- (active-devices
+ (lambda (device)
+ (string-equal (cdr (assoc 'udid device)) device-identifier))
+ devices))
+ (active-devices
(seq-filter
- (lambda (device)
- (string-equal (cdr (assoc 'state device)) "Booted"))
- devices))
- (target-booted
+ (lambda (device)
+ (string-equal (cdr (assoc 'state device)) "Booted"))
+ devices))
+ (target-booted
(string-equal (cdr (assoc 'state target-device)) "Booted"))
- (simulator-running (consp active-devices))
- (progress-reporter
+ (simulator-running (consp active-devices))
+ (progress-reporter
(make-progress-reporter "Waiting for simulator...")))
(cond
(target-booted
@@ -886,9 +897,14 @@ it is equal to `swift-mode:ios-local-device-identifier', a
local build via
SCHEME is the name of the project scheme in Xcode. If it is nil or omitted,
the value of `swift-mode:ios-project-scheme' is used."
(interactive
- (let ((project-directory (if current-prefix-arg
- (swift-mode:read-project-directory)
- (swift-mode:find-xcode-project-directory))))
+ (let* ((default-project-directory
+ (or
+ (swift-mode:find-xcode-workspace-directory)
+ (swift-mode:find-xcode-project-directory)))
+ (project-directory
+ (if current-prefix-arg
+ (swift-mode:read-project-directory default-project-directory)
+ default-project-directory)))
(list
project-directory
(if current-prefix-arg
@@ -911,8 +927,8 @@ the value of `swift-mode:ios-project-scheme' is used."
swift-mode:ios-project-scheme
(swift-mode:read-project-scheme project-directory))))
(setq swift-mode:ios-project-scheme scheme)
- (let* ((local-device-build (eql device-identifier
- swift-mode:ios-local-device-identifier))
+ (let* ((local-device-build (equal device-identifier
+ swift-mode:ios-local-device-identifier))
(sdk (if local-device-build "iphoneos" "iphonesimulator"))
(build-settings
(swift-mode:read-xcode-build-settings
- [nongnu] elpa/swift-mode 25944c2 378/496: Add test for beginning/end-of-defun, (continued)
- [nongnu] elpa/swift-mode 25944c2 378/496: Add test for beginning/end-of-defun, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ea029a0 370/496: Suppress implicit semicolons inside interpolated expressions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b5602c1 375/496: Add beginning/end-of-sentence to README.md, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 18c3dc4 376/496: Bump version to 4.0.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 27e959e 385/496: Handle unmatched parens correctly, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode abf3426 392/496: Add support for highlighting function calls / properties / enum cases, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 560242d 393/496: Add support for choosing scheme when building/running iOS projects, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c56f43c 395/496: Make faces customizable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 6d4fab5 396/496: Move customizations for REPL to their own group, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 604610d 399/496: Fix LLDB breakpoint option, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 6fdb3cd 403/496: Fix `swift-mode:debug-swift-module`,
ELPA Syncer <=
- [nongnu] elpa/swift-mode d2f2f1d 410/496: Bump version to 6.0.0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode f847923 419/496: Highlight more compiler directives, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0b1e5e8 420/496: Support raw texts, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 348e153 422/496: Change buffer name of REPL, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 0eca818 431/496: Add test for Imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ddc7ae6 436/496: Fix `adaptive-fill-regexp` for multiline comments, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 2e9bdc6 430/496: Ignore import declarations in Imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b2d9cca 434/496: Fix small bugs, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 9d948d9 429/496: Add parser for function parameters for Imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 1362849 435/496: Use `seq-mapcat` instead of `apply` '`nonc` and `mapcar`, ELPA Syncer, 2021/08/29